Skip to content

Commit

Permalink
add create method for reject messages decorator
Browse files Browse the repository at this point in the history
  • Loading branch information
MalteHerrmann committed Sep 26, 2024
1 parent 9f2cb45 commit d7f5266
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
7 changes: 6 additions & 1 deletion ante/cosmos/reject_msgs.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,14 @@ import (
evmtypes "github.com/evmos/os/x/evm/types"
)

// RejectMessagesDecorator prevents invalid msg types from being executed
// RejectMessagesDecorator prevents invalid msg types from being executed.
type RejectMessagesDecorator struct{}

// NewRejectMessagesDecorator creates a new RejectMessagesDecorator.
func NewRejectMessagesDecorator() sdk.AnteDecorator {
return RejectMessagesDecorator{}
}

// AnteHandle rejects messages that requires ethereum-specific authentication.
// For example `MsgEthereumTx` requires fee to be deducted in the antehandler in
// order to perform the refund.
Expand Down
2 changes: 1 addition & 1 deletion example_chain/ante/cosmos_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import (
// newCosmosAnteHandler creates the default ante handler for Cosmos transactions
func newCosmosAnteHandler(options HandlerOptions) sdk.AnteHandler {
return sdk.ChainAnteDecorators(
evmoscosmosante.RejectMessagesDecorator{}, // reject MsgEthereumTxs
evmoscosmosante.NewRejectMessagesDecorator(), // reject MsgEthereumTxs
evmoscosmosante.NewAuthzLimiterDecorator( // disable the Msg types that cannot be included on an authz.MsgExec msgs field
sdk.MsgTypeURL(&evmtypes.MsgEthereumTx{}),
sdk.MsgTypeURL(&sdkvesting.MsgCreateVestingAccount{}),
Expand Down

0 comments on commit d7f5266

Please sign in to comment.