Skip to content

Commit

Permalink
Revert blocking list feature from "feat: support blocking list of add…
Browse files Browse the repository at this point in the history
…resses in mempool and disable vesting messages in check tx mode (evmos#327)"

This reverts commit 1533fc1.
  • Loading branch information
dudong2 committed Nov 15, 2023
1 parent 1533fc1 commit 6a8ad57
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 53 deletions.
19 changes: 4 additions & 15 deletions app/ante/ante.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,17 +46,6 @@ func NewAnteHandler(options HandlerOptions) (sdk.AnteHandler, error) {
return nil, err
}

blacklist := make(map[string]struct{}, len(options.Blacklist))
for _, str := range options.Blacklist {
addr, err := sdk.AccAddressFromBech32(str)
if err != nil {
return nil, fmt.Errorf("invalid bech32 address: %s, err: %w", str, err)
}

blacklist[string(addr)] = struct{}{}
}
blockAddressDecorator := NewBlockAddressesDecorator(blacklist)

return func(
ctx sdk.Context, tx sdk.Tx, sim bool,
) (newCtx sdk.Context, err error) {
Expand Down Expand Up @@ -84,13 +73,13 @@ func NewAnteHandler(options HandlerOptions) (sdk.AnteHandler, error) {
switch typeURL := opts[0].GetTypeUrl(); typeURL {
case "/ethermint.evm.v1.ExtensionOptionsEthereumTx":
// handle as *evmtypes.MsgEthereumTx
anteHandler = newEthAnteHandler(options, blockAddressDecorator)
anteHandler = newEthAnteHandler(options)
case "/ethermint.types.v1.ExtensionOptionsWeb3Tx":
// Deprecated: Handle as normal Cosmos SDK tx, except signature is checked for Legacy EIP712 representation
anteHandler = NewLegacyCosmosAnteHandlerEip712(options, blockAddressDecorator)
anteHandler = NewLegacyCosmosAnteHandlerEip712(options)
case "/ethermint.types.v1.ExtensionOptionDynamicFeeTx":
// cosmos-sdk tx with dynamic fee extension
anteHandler = newCosmosAnteHandler(options, blockAddressDecorator)
anteHandler = newCosmosAnteHandler(options)
default:
return ctx, errorsmod.Wrapf(
errortypes.ErrUnknownExtensionOptions,
Expand All @@ -105,7 +94,7 @@ func NewAnteHandler(options HandlerOptions) (sdk.AnteHandler, error) {
// handle as totally normal Cosmos SDK tx
switch tx.(type) {
case sdk.Tx:
anteHandler = newCosmosAnteHandler(options, blockAddressDecorator)
anteHandler = newCosmosAnteHandler(options)
default:
return ctx, errorsmod.Wrapf(errortypes.ErrUnknownRequest, "invalid transaction type: %T", tx)
}
Expand Down
31 changes: 0 additions & 31 deletions app/ante/block_address.go

This file was deleted.

3 changes: 1 addition & 2 deletions app/ante/eip712.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,13 @@ func init() {

// Deprecated: NewLegacyCosmosAnteHandlerEip712 creates an AnteHandler to process legacy EIP-712
// transactions, as defined by the presence of an ExtensionOptionsWeb3Tx extension.
func NewLegacyCosmosAnteHandlerEip712(options HandlerOptions, extra sdk.AnteDecorator) sdk.AnteHandler {
func NewLegacyCosmosAnteHandlerEip712(options HandlerOptions) sdk.AnteHandler {
return sdk.ChainAnteDecorators(
RejectMessagesDecorator{}, // reject MsgEthereumTxs
// disable the Msg types that cannot be included on an authz.MsgExec msgs field
NewAuthzLimiterDecorator(options.DisabledAuthzMsgs),
authante.NewSetUpContextDecorator(),
authante.NewValidateBasicDecorator(),
extra,
authante.NewTxTimeoutHeightDecorator(),
NewMinGasPriceDecorator(options.FeeMarketKeeper, options.EvmKeeper),
authante.NewValidateMemoDecorator(options.AccountKeeper),
Expand Down
7 changes: 2 additions & 5 deletions app/ante/handler_options.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ type HandlerOptions struct {
ExtensionOptionChecker ante.ExtensionOptionChecker
TxFeeChecker ante.TxFeeChecker
DisabledAuthzMsgs []string
Blacklist []string
}

func (options HandlerOptions) validate() error {
Expand All @@ -67,13 +66,12 @@ func (options HandlerOptions) validate() error {
return nil
}

func newEthAnteHandler(options HandlerOptions, extra sdk.AnteDecorator) sdk.AnteHandler {
func newEthAnteHandler(options HandlerOptions) sdk.AnteHandler {
return sdk.ChainAnteDecorators(
NewEthSetUpContextDecorator(options.EvmKeeper), // outermost AnteDecorator. SetUpContext must be called first
NewEthMempoolFeeDecorator(options.EvmKeeper), // Check eth effective gas price against minimal-gas-prices
NewEthMinGasPriceDecorator(options.FeeMarketKeeper, options.EvmKeeper), // Check eth effective gas price against the global MinGasPrice
NewEthValidateBasicDecorator(options.EvmKeeper),
extra,
NewEthSigVerificationDecorator(options.EvmKeeper),
NewEthAccountVerificationDecorator(options.AccountKeeper, options.EvmKeeper),
NewCanTransferDecorator(options.EvmKeeper),
Expand All @@ -84,15 +82,14 @@ func newEthAnteHandler(options HandlerOptions, extra sdk.AnteDecorator) sdk.Ante
)
}

func newCosmosAnteHandler(options HandlerOptions, extra sdk.AnteDecorator) sdk.AnteHandler {
func newCosmosAnteHandler(options HandlerOptions) sdk.AnteHandler {
return sdk.ChainAnteDecorators(
RejectMessagesDecorator{}, // reject MsgEthereumTxs
// disable the Msg types that cannot be included on an authz.MsgExec msgs field
NewAuthzLimiterDecorator(options.DisabledAuthzMsgs),
ante.NewSetUpContextDecorator(),
ante.NewExtensionOptionsDecorator(options.ExtensionOptionChecker),
ante.NewValidateBasicDecorator(),
extra,
ante.NewTxTimeoutHeightDecorator(),
NewMinGasPriceDecorator(options.FeeMarketKeeper, options.EvmKeeper),
ante.NewValidateMemoDecorator(options.AccountKeeper),
Expand Down

0 comments on commit 6a8ad57

Please sign in to comment.