refactor(core,stf): complete gas service + simplify deps (#21166)
This commit is contained in:
@@ -208,7 +208,7 @@ func (c coreAppModuleAdaptor) RegisterLegacyAminoCodec(amino legacy.Amino) {
|
||||
|
||||
// RegisterServices implements HasServices
|
||||
func (c coreAppModuleAdaptor) RegisterServices(cfg Configurator) {
|
||||
if module, ok := c.module.(appmodule.HasServices); ok {
|
||||
if module, ok := c.module.(hasServicesV1); ok {
|
||||
err := module.RegisterServices(cfg)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
|
||||
+10
-1
@@ -30,6 +30,7 @@ import (
|
||||
"github.com/grpc-ecosystem/grpc-gateway/runtime"
|
||||
"github.com/spf13/cobra"
|
||||
"golang.org/x/exp/maps"
|
||||
"google.golang.org/grpc"
|
||||
|
||||
"cosmossdk.io/core/appmodule"
|
||||
appmodulev2 "cosmossdk.io/core/appmodule/v2"
|
||||
@@ -92,6 +93,14 @@ type HasServices interface {
|
||||
RegisterServices(Configurator)
|
||||
}
|
||||
|
||||
// hasServicesV1 is the interface for registering service in baseapp Cosmos SDK.
|
||||
// This API is part of core/appmodule but commented out for dependencies.
|
||||
type hasServicesV1 interface {
|
||||
appmodule.AppModule
|
||||
|
||||
RegisterServices(grpc.ServiceRegistrar) error
|
||||
}
|
||||
|
||||
// MigrationHandler is the migration function that each module registers.
|
||||
type MigrationHandler func(sdk.Context) error
|
||||
|
||||
@@ -383,7 +392,7 @@ func (m *Manager) RegisterServices(cfg Configurator) error {
|
||||
module.RegisterServices(cfg)
|
||||
}
|
||||
|
||||
if module, ok := module.(appmodule.HasServices); ok {
|
||||
if module, ok := module.(hasServicesV1); ok {
|
||||
err := module.RegisterServices(cfg)
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
@@ -577,5 +577,4 @@ func (MockCoreAppModule) ExportGenesis(ctx context.Context, target appmodule.Gen
|
||||
var (
|
||||
_ appmodule.AppModule = MockCoreAppModule{}
|
||||
_ appmodule.HasGenesisAuto = MockCoreAppModule{}
|
||||
_ appmodule.HasServices = MockCoreAppModule{}
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user