Evermint is a fork of open source Evmos, maintains bug fixes, customization and enable developers to fork and transform to their chain, fully customized naming, in just 2 steps. For research and development purpose.
This PR introduces Dual-Lane AnteHandler, that means each ante supposed to handle both EVM Tx and Cosmos Tx based on tx type.
Terms:
Dual-Lane decorators are decorators that wrap sdk ante, will:
Routing to sdk ante if the tx is a Cosmos tx
Process internal logic if the tx is an Ethereum tx or just move to next ante.
Evm-Lane decorators will:
Routing to next ante if the tx is a Cosmos tx
Process internal logic for Ethereum tx
Cosmos-Lane decorators are similar to Evm-Lane decorators but reverse.
Additional changes:
Adjust priority calculation logic, priority now = effective gas prices (previous only 0/1)
Extensions (ExtensionOptionsEthereumTx/ExtensionOptionDynamicFeeTx) are now optional for backward compatible to clients.
Remove any local-maintained logic if SDK already have it, if applicable.
The main purpose is take advantage of security bug fixes maintained by Cosmos team.
func NewAnteHandler(options HandlerOptions) sdk.AnteHandler {
return func(
ctx sdk.Context, tx sdk.Tx, sim bool,
) (newCtx sdk.Context, err error) {
// SDK ante plus dual-lane logic
anteDecorators := []sdk.AnteDecorator{
duallane.NewDualLaneSetupContextDecorator(*options.EvmKeeper, sdkauthante.NewSetUpContextDecorator()), // outermost AnteDecorator. SetUpContext must be called first
duallane.NewDualLaneExtensionOptionsDecorator(sdkauthante.NewExtensionOptionsDecorator(options.ExtensionOptionChecker)),
duallane.NewDualLaneValidateBasicDecorator(*options.EvmKeeper, sdkauthante.NewValidateBasicDecorator()),
/*EVM-only lane*/ evmlane.NewEvmLaneValidateBasicEoaDecorator(*options.AccountKeeper, *options.EvmKeeper),
duallane.NewDualLaneTxTimeoutHeightDecorator(sdkauthante.NewTxTimeoutHeightDecorator()),
duallane.NewDualLaneValidateMemoDecorator(sdkauthante.NewValidateMemoDecorator(options.AccountKeeper)),
duallane.NewDualLaneConsumeTxSizeGasDecorator(sdkauthante.NewConsumeGasForTxSizeDecorator(options.AccountKeeper)),
duallane.NewDualLaneDeductFeeDecorator(sdkauthante.NewDeductFeeDecorator(options.AccountKeeper, options.BankKeeper, options.FeegrantKeeper, options.TxFeeChecker)),
duallane.NewDualLaneSetPubKeyDecorator(sdkauthante.NewSetPubKeyDecorator(options.AccountKeeper)), // SetPubKeyDecorator must be called before all signature verification decorators
duallane.NewDualLaneValidateSigCountDecorator(sdkauthante.NewValidateSigCountDecorator(options.AccountKeeper)),
duallane.NewDualLaneSigGasConsumeDecorator(sdkauthante.NewSigGasConsumeDecorator(options.AccountKeeper, options.SigGasConsumer)),
duallane.NewDualLaneSigVerificationDecorator(*options.AccountKeeper, *options.EvmKeeper, sdkauthante.NewSigVerificationDecorator(options.AccountKeeper, options.SignModeHandler)),
duallane.NewDualLaneIncrementSequenceDecorator(*options.AccountKeeper, *options.EvmKeeper, sdkauthante.NewIncrementSequenceDecorator(options.AccountKeeper)),
duallane.NewDualLaneRedundantRelayDecorator(ibcante.NewRedundantRelayDecorator(options.IBCKeeper)),
// from here, there is no longer any SDK ante
// EVM-only lane
evmlane.NewEvmLaneSetupExecutionDecorator(*options.EvmKeeper),
evmlane.NewEvmLaneEmitEventDecorator(*options.EvmKeeper), // must be the last effective Ante
// Cosmos-only lane
cosmoslane.NewCosmosLaneRejectEthereumMsgsDecorator(),
cosmoslane.NewCosmosLaneRejectAuthzMsgsDecorator(options.DisabledNestedMsgs),
cosmoslane.NewCosmosLaneVestingMessagesAuthorizationDecorator(*options.VAuthKeeper),
}
anteHandler := sdk.ChainAnteDecorators(anteDecorators...)
return anteHandler(ctx, tx, sim)
}
}
This PR introduces Dual-Lane AnteHandler, that means each ante supposed to handle both EVM Tx and Cosmos Tx based on tx type.
Terms:
Additional changes:
(ExtensionOptionsEthereumTx/ExtensionOptionDynamicFeeTx)
are now optional for backward compatible to clients.