diff --git a/app/ante_handler.go b/app/ante_handler.go index 81a3657..57ff6d3 100644 --- a/app/ante_handler.go +++ b/app/ante_handler.go @@ -10,6 +10,7 @@ import ( authante "github.com/cosmos/cosmos-sdk/x/auth/ante" sdkvesting "github.com/cosmos/cosmos-sdk/x/auth/vesting/types" ibcante "github.com/cosmos/ibc-go/v7/modules/core/ante" + democracyante "github.com/cosmos/interchain-security/v3/app/consumer-democracy/ante" consumerante "github.com/cosmos/interchain-security/v3/app/consumer/ante" ibcconsumerkeeper "github.com/cosmos/interchain-security/v3/x/ccv/consumer/keeper" appante "github.com/evmos/evmos/v14/app/ante" @@ -35,10 +36,10 @@ func NewAnteHandler(options appante.HandlerOptions, consumerKeeper ibcconsumerke switch typeURL := opts[0].GetTypeUrl(); typeURL { case "/ethermint.evm.v1.ExtensionOptionsEthereumTx": // handle as *evmtypes.MsgEthereumTx - anteHandler = newEVMAnteHandler(options) + anteHandler = newEVMAnteHandler(options, consumerKeeper) case "/ethermint.types.v1.ExtensionOptionsWeb3Tx": // handle as normal Cosmos SDK tx, except signature is checked for EIP712 representation - anteHandler = newLegacyCosmosAnteHandlerEip712(options) + anteHandler = newLegacyCosmosAnteHandlerEip712(options, consumerKeeper) case "/ethermint.types.v1.ExtensionOptionDynamicFeeTx": // cosmos-sdk tx with dynamic fee extension anteHandler = newCosmosAnteHandler(options, consumerKeeper) @@ -66,8 +67,9 @@ func NewAnteHandler(options appante.HandlerOptions, consumerKeeper ibcconsumerke } // newEVMAnteHandler creates the default authante handler for Ethereum transactions -func newEVMAnteHandler(options appante.HandlerOptions) sdk.AnteHandler { +func newEVMAnteHandler(options appante.HandlerOptions, consumerKeeper ibcconsumerkeeper.Keeper) sdk.AnteHandler { return sdk.ChainAnteDecorators( + consumerante.NewMsgFilterDecorator(consumerKeeper), // outermost AnteDecorator. SetUpContext must be called first evmante.NewEthSetUpContextDecorator(options.EvmKeeper), // Check eth effective gas price against the node's minimal-gas-prices config @@ -99,6 +101,7 @@ func newCosmosAnteHandler(options appante.HandlerOptions, consumerKeeper ibccons authante.NewExtensionOptionsDecorator(options.ExtensionOptionChecker), consumerante.NewMsgFilterDecorator(consumerKeeper), consumerante.NewDisabledModulesDecorator("/cosmos.evidence", "/cosmos.slashing"), + democracyante.NewForbiddenProposalsDecorator(IsProposalWhitelisted, IsModuleWhiteList), authante.NewValidateBasicDecorator(), authante.NewTxTimeoutHeightDecorator(), authante.NewValidateMemoDecorator(options.AccountKeeper), @@ -118,7 +121,7 @@ func newCosmosAnteHandler(options appante.HandlerOptions, consumerKeeper ibccons } // newCosmosAnteHandlerEip712 creates the authante handler for transactions signed with EIP712 -func newLegacyCosmosAnteHandlerEip712(options appante.HandlerOptions) sdk.AnteHandler { +func newLegacyCosmosAnteHandlerEip712(options appante.HandlerOptions, consumerKeeper ibcconsumerkeeper.Keeper) sdk.AnteHandler { return sdk.ChainAnteDecorators( cosmosante.RejectMessagesDecorator{}, // reject MsgEthereumTxs cosmosante.NewAuthzLimiterDecorator( // disable the Msg types that cannot be included on an authz.MsgExec msgs field @@ -126,6 +129,9 @@ func newLegacyCosmosAnteHandlerEip712(options appante.HandlerOptions) sdk.AnteHa sdk.MsgTypeURL(&sdkvesting.MsgCreateVestingAccount{}), ), authante.NewSetUpContextDecorator(), + consumerante.NewMsgFilterDecorator(consumerKeeper), + consumerante.NewDisabledModulesDecorator("/cosmos.evidence", "/cosmos.slashing"), + democracyante.NewForbiddenProposalsDecorator(IsProposalWhitelisted, IsModuleWhiteList), authante.NewValidateBasicDecorator(), authante.NewTxTimeoutHeightDecorator(), cosmosante.NewMinGasPriceDecorator(options.FeeMarketKeeper, options.EvmKeeper), diff --git a/app/app.go b/app/app.go index 4b221ec..2f96279 100644 --- a/app/app.go +++ b/app/app.go @@ -819,7 +819,7 @@ func (app *App) setAnteHandler(txConfig client.TxConfig, maxGasWanted uint64) { panic(err) } - app.SetAnteHandler(ante.NewAnteHandler(options)) + app.SetAnteHandler(NewAnteHandler(options, app.ConsumerKeeper)) } func (app *App) setPostHandler() {