From 39d854795c93c948c20f7ef4d07d2e90717ad37a Mon Sep 17 00:00:00 2001 From: Alyak Date: Wed, 18 Dec 2024 13:33:56 +0200 Subject: [PATCH] Remove circuit module (#7715) * remoe circuit module * remove circuit * chore: nit checks in ante handler --------- Co-authored-by: DimitrisJim Co-authored-by: Damian Nolan --- modules/light-clients/08-wasm/testing/simapp/app.go | 12 ++---------- simapp/ante.go | 10 +++++++--- testing/simapp/ante.go | 4 ---- testing/simapp/app.go | 12 +----------- 4 files changed, 10 insertions(+), 28 deletions(-) diff --git a/modules/light-clients/08-wasm/testing/simapp/app.go b/modules/light-clients/08-wasm/testing/simapp/app.go index 65f05041ad2..f343b96f4b1 100644 --- a/modules/light-clients/08-wasm/testing/simapp/app.go +++ b/modules/light-clients/08-wasm/testing/simapp/app.go @@ -30,9 +30,6 @@ import ( "cosmossdk.io/x/bank" bankkeeper "cosmossdk.io/x/bank/keeper" banktypes "cosmossdk.io/x/bank/types" - "cosmossdk.io/x/circuit" - circuitkeeper "cosmossdk.io/x/circuit/keeper" - circuittypes "cosmossdk.io/x/circuit/types" "cosmossdk.io/x/consensus" consensusparamkeeper "cosmossdk.io/x/consensus/keeper" consensusparamtypes "cosmossdk.io/x/consensus/types" @@ -212,7 +209,6 @@ type SimApp struct { FeeGrantKeeper feegrantkeeper.Keeper GroupKeeper groupkeeper.Keeper ConsensusParamsKeeper consensusparamkeeper.Keeper - CircuitKeeper circuitkeeper.Keeper PoolKeeper poolkeeper.Keeper // make IBC modules public for test purposes @@ -319,7 +315,7 @@ func NewSimApp( authtypes.StoreKey, banktypes.StoreKey, stakingtypes.StoreKey, minttypes.StoreKey, distrtypes.StoreKey, slashingtypes.StoreKey, govtypes.StoreKey, consensusparamtypes.StoreKey, upgradetypes.StoreKey, feegrant.StoreKey, - evidencetypes.StoreKey, circuittypes.StoreKey, + evidencetypes.StoreKey, authzkeeper.StoreKey, nftkeeper.StoreKey, group.StoreKey, pooltypes.StoreKey, accounts.StoreKey, epochstypes.StoreKey, paramstypes.StoreKey, @@ -452,9 +448,6 @@ func NewSimApp( stakingtypes.NewMultiStakingHooks(app.DistrKeeper.Hooks(), app.SlashingKeeper.Hooks()), ) - app.CircuitKeeper = circuitkeeper.NewKeeper(runtime.NewEnvironment(runtime.NewKVStoreService(keys[circuittypes.StoreKey]), logger.With(log.ModuleKey, "x/circuit")), appCodec, govModuleAddr, app.AuthKeeper.AddressCodec()) - app.BaseApp.SetCircuitBreaker(&app.CircuitKeeper) - app.AuthzKeeper = authzkeeper.NewKeeper(runtime.NewEnvironment(runtime.NewKVStoreService(keys[authzkeeper.StoreKey]), logger.With(log.ModuleKey, "x/authz"), runtime.EnvWithMsgRouterService(app.MsgServiceRouter()), runtime.EnvWithQueryRouterService(app.GRPCQueryRouter())), appCodec, app.AuthKeeper.AddressCodec()) groupConfig := group.DefaultConfig() @@ -713,7 +706,6 @@ func NewSimApp( authzmodule.NewAppModule(appCodec, app.AuthzKeeper, app.interfaceRegistry), groupmodule.NewAppModule(appCodec, app.GroupKeeper, app.AuthKeeper, app.BankKeeper, app.interfaceRegistry), consensus.NewAppModule(appCodec, app.ConsensusParamsKeeper), - circuit.NewAppModule(appCodec, app.CircuitKeeper), // IBC modules ibc.NewAppModule(appCodec, app.IBCKeeper), @@ -778,7 +770,7 @@ func NewSimApp( slashingtypes.ModuleName, govtypes.ModuleName, minttypes.ModuleName, ibcexported.ModuleName, genutiltypes.ModuleName, evidencetypes.ModuleName, authz.ModuleName, ibctransfertypes.ModuleName, icatypes.ModuleName, ibcfeetypes.ModuleName, ibcmock.ModuleName, feegrant.ModuleName, paramstypes.ModuleName, upgradetypes.ModuleName, - vestingtypes.ModuleName, group.ModuleName, consensusparamtypes.ModuleName, circuittypes.ModuleName, wasmtypes.ModuleName, + vestingtypes.ModuleName, group.ModuleName, consensusparamtypes.ModuleName, wasmtypes.ModuleName, } app.ModuleManager.SetOrderInitGenesis(genesisModuleOrder...) app.ModuleManager.SetOrderExportGenesis(genesisModuleOrder...) diff --git a/simapp/ante.go b/simapp/ante.go index 83f7ed147fe..5549194e933 100644 --- a/simapp/ante.go +++ b/simapp/ante.go @@ -25,15 +25,19 @@ type HandlerOptions struct { // signer. func NewAnteHandler(options HandlerOptions) (sdk.AnteHandler, error) { if options.AccountKeeper == nil { - return nil, errors.New("account keeper is required for ante builder") + return nil, errors.New("account keeper is required for ante handler") } if options.BankKeeper == nil { - return nil, errors.New("bank keeper is required for ante builder") + return nil, errors.New("bank keeper is required for ante handler") } if options.SignModeHandler == nil { - return nil, errors.New("sign mode handler is required for ante builder") + return nil, errors.New("sign mode handler is required for ante handler") + } + + if options.IBCKeeper == nil { + return nil, errors.New("ibc keeper is required for the ante handler") } anteDecorators := []sdk.AnteDecorator{ diff --git a/testing/simapp/ante.go b/testing/simapp/ante.go index 83f7ed147fe..afdac5c4649 100644 --- a/testing/simapp/ante.go +++ b/testing/simapp/ante.go @@ -3,8 +3,6 @@ package simapp import ( "errors" - circuitante "cosmossdk.io/x/circuit/ante" - sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/x/auth/ante" "github.com/cosmos/cosmos-sdk/x/auth/ante/unorderedtx" @@ -16,7 +14,6 @@ import ( // HandlerOptions are the options required for constructing a default SDK AnteHandler. type HandlerOptions struct { ante.HandlerOptions - CircuitKeeper circuitante.CircuitBreaker IBCKeeper *keeper.Keeper } @@ -38,7 +35,6 @@ func NewAnteHandler(options HandlerOptions) (sdk.AnteHandler, error) { anteDecorators := []sdk.AnteDecorator{ ante.NewSetUpContextDecorator(options.Environment, options.ConsensusKeeper), // outermost AnteDecorator. SetUpContext must be called first - circuitante.NewCircuitBreakerDecorator(options.CircuitKeeper), ante.NewExtensionOptionsDecorator(options.ExtensionOptionChecker), ante.NewValidateBasicDecorator(options.Environment), ante.NewTxTimeoutHeightDecorator(options.Environment), diff --git a/testing/simapp/app.go b/testing/simapp/app.go index 9fc8fad4d4a..a7388396b73 100644 --- a/testing/simapp/app.go +++ b/testing/simapp/app.go @@ -30,9 +30,6 @@ import ( "cosmossdk.io/x/bank" bankkeeper "cosmossdk.io/x/bank/keeper" banktypes "cosmossdk.io/x/bank/types" - "cosmossdk.io/x/circuit" - circuitkeeper "cosmossdk.io/x/circuit/keeper" - circuittypes "cosmossdk.io/x/circuit/types" "cosmossdk.io/x/consensus" consensusparamkeeper "cosmossdk.io/x/consensus/keeper" consensustypes "cosmossdk.io/x/consensus/types" @@ -206,7 +203,6 @@ type SimApp struct { GroupKeeper groupkeeper.Keeper NFTKeeper nftkeeper.Keeper ConsensusParamsKeeper consensusparamkeeper.Keeper - CircuitKeeper circuitkeeper.Keeper PoolKeeper poolkeeper.Keeper EpochsKeeper *epochskeeper.Keeper ParamsKeeper paramskeeper.Keeper @@ -330,7 +326,7 @@ func NewSimApp( authtypes.StoreKey, banktypes.StoreKey, stakingtypes.StoreKey, minttypes.StoreKey, distrtypes.StoreKey, slashingtypes.StoreKey, govtypes.StoreKey, consensustypes.StoreKey, upgradetypes.StoreKey, feegrant.StoreKey, - evidencetypes.StoreKey, circuittypes.StoreKey, + evidencetypes.StoreKey, authzkeeper.StoreKey, nftkeeper.StoreKey, group.StoreKey, pooltypes.StoreKey, accounts.StoreKey, epochstypes.StoreKey, paramstypes.StoreKey, @@ -438,9 +434,6 @@ func NewSimApp( stakingtypes.NewMultiStakingHooks(app.DistrKeeper.Hooks(), app.SlashingKeeper.Hooks()), ) - app.CircuitKeeper = circuitkeeper.NewKeeper(runtime.NewEnvironment(runtime.NewKVStoreService(keys[circuittypes.StoreKey]), logger.With(log.ModuleKey, "x/circuit")), appCodec, govModuleAddr, app.AuthKeeper.AddressCodec()) - app.BaseApp.SetCircuitBreaker(&app.CircuitKeeper) - app.AuthzKeeper = authzkeeper.NewKeeper(runtime.NewEnvironment(runtime.NewKVStoreService(keys[authzkeeper.StoreKey]), logger.With(log.ModuleKey, "x/authz"), runtime.EnvWithMsgRouterService(app.MsgServiceRouter()), runtime.EnvWithQueryRouterService(app.GRPCQueryRouter())), appCodec, app.AuthKeeper.AddressCodec()) groupConfig := group.DefaultConfig() @@ -673,7 +666,6 @@ func NewSimApp( groupmodule.NewAppModule(appCodec, app.GroupKeeper, app.AuthKeeper, app.BankKeeper, app.interfaceRegistry), nftmodule.NewAppModule(appCodec, app.NFTKeeper, app.AuthKeeper, app.BankKeeper, app.interfaceRegistry), consensus.NewAppModule(appCodec, app.ConsensusParamsKeeper), - circuit.NewAppModule(appCodec, app.CircuitKeeper), protocolpool.NewAppModule(appCodec, app.PoolKeeper, app.AuthKeeper, app.BankKeeper), epochs.NewAppModule(appCodec, app.EpochsKeeper), @@ -756,7 +748,6 @@ func NewSimApp( icatypes.ModuleName, ibcfeetypes.ModuleName, ibcmock.ModuleName, paramstypes.ModuleName, upgradetypes.ModuleName, vestingtypes.ModuleName, - circuittypes.ModuleName, epochstypes.ModuleName, } app.ModuleManager.SetOrderInitGenesis(genesisModuleOrder...) @@ -882,7 +873,6 @@ func (app *SimApp) setAnteHandler(txConfig client.TxConfig) { SigGasConsumer: ante.DefaultSigVerificationGasConsumer, UnorderedTxManager: app.UnorderedTxManager, }, - CircuitKeeper: &app.CircuitKeeper, IBCKeeper: app.IBCKeeper, }, )