Skip to content

Commit

Permalink
refactor: Use HybridResolver instead of protoregistry.GlobalFiles in …
Browse files Browse the repository at this point in the history
…`runtime/v2/manager` (#22744)
  • Loading branch information
hieuvubk authored Dec 4, 2024
1 parent aa5d8ab commit c47fb8a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 24 deletions.
7 changes: 3 additions & 4 deletions runtime/v2/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import (
"google.golang.org/grpc"
proto "google.golang.org/protobuf/proto"
"google.golang.org/protobuf/reflect/protoreflect"
"google.golang.org/protobuf/reflect/protoregistry"

runtimev2 "cosmossdk.io/api/cosmos/app/runtime/v2"
cosmosmsg "cosmossdk.io/api/cosmos/msg/v1"
Expand Down Expand Up @@ -485,7 +484,7 @@ func (m *MM[T]) RunMigrations(ctx context.Context, fromVM appmodulev2.VersionMap
func (m *MM[T]) RegisterServices(app *App[T]) error {
for _, module := range m.modules {
// register msg + query
if err := registerServices(module, app, protoregistry.GlobalFiles); err != nil {
if err := registerServices(module, app, gogoproto.HybridResolver); err != nil {
return err
}

Expand Down Expand Up @@ -618,7 +617,7 @@ func (m *MM[T]) assertNoForgottenModules(
return nil
}

func registerServices[T transaction.Tx](s appmodulev2.AppModule, app *App[T], registry *protoregistry.Files) error {
func registerServices[T transaction.Tx](s appmodulev2.AppModule, app *App[T], registry gogoproto.Resolver) error {
// case module with services
if services, ok := s.(hasServicesV1); ok {
c := &configurator{
Expand Down Expand Up @@ -671,7 +670,7 @@ type configurator struct {

stfQueryRouter *stf.MsgRouterBuilder
stfMsgRouter *stf.MsgRouterBuilder
registry *protoregistry.Files
registry gogoproto.Resolver
err error
}

Expand Down
20 changes: 0 additions & 20 deletions x/accounts/module.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import (
"google.golang.org/grpc"

"cosmossdk.io/core/appmodule"
appmodulev2 "cosmossdk.io/core/appmodule/v2"
"cosmossdk.io/core/registry"
"cosmossdk.io/x/accounts/cli"
v1 "cosmossdk.io/x/accounts/v1"
Expand Down Expand Up @@ -62,25 +61,6 @@ func (am AppModule) RegisterServices(registrar grpc.ServiceRegistrar) error {
return nil
}

// RegisterQueryHandlers registers the query handlers for the accounts module.
func (am AppModule) RegisterQueryHandlers(router appmodulev2.QueryRouter) {
queryServer := NewQueryServer(am.k)

appmodulev2.RegisterMsgHandler(router, queryServer.AccountNumber)
appmodulev2.RegisterMsgHandler(router, queryServer.AccountQuery)
appmodulev2.RegisterMsgHandler(router, queryServer.AccountType)
appmodulev2.RegisterMsgHandler(router, queryServer.Schema)
}

// RegisterMsgHandlers registers the message handlers for the accounts module.
func (am AppModule) RegisterMsgHandlers(router appmodulev2.MsgRouter) {
msgServer := NewMsgServer(am.k)

appmodulev2.RegisterMsgHandler(router, msgServer.Execute)
appmodulev2.RegisterMsgHandler(router, msgServer.ExecuteBundle)
appmodulev2.RegisterMsgHandler(router, msgServer.Init)
}

// App module genesis

func (am AppModule) DefaultGenesis() json.RawMessage {
Expand Down

0 comments on commit c47fb8a

Please sign in to comment.