Documentation ¶
Overview ¶
Copyright 2021 Evmos Foundation This file is part of Evmos' Ethermint library.
The Ethermint library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
The Ethermint library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License along with the Ethermint library. If not, see https://github.com/evmos/ethermint/blob/main/LICENSE
Copyright 2023 ZetaChain modified to exclude gentx transaction type from the min gas price check
Index ¶
- Variables
- func IsSystemTx(tx sdk.Tx, isAuthorizedSigner func(string) bool) bool
- func NewAnteHandler(options HandlerOptions) (sdk.AnteHandler, error)
- func NewLegacyCosmosAnteHandlerEip712(options HandlerOptions) sdk.AnteHandler
- func Recover(logger tmlog.Logger, err *error)
- func SetGasMeter(_ bool, ctx sdk.Context, gasLimit uint64) sdk.Context
- func ValidateHandlerOptions(options HandlerOptions) error
- type AuthzLimiterDecorator
- type DynamicFeeEVMKeeper
- type EVMKeeper
- type EthMempoolFeeDecorator
- type EthMinGasPriceDecorator
- type FeeMarketKeeper
- type GasTx
- type HandlerOptions
- type MinGasPriceDecorator
- type SetUpContextDecorator
- type SystemPriorityDecorator
- type VestingAccountDecorator
Constants ¶
This section is empty.
Variables ¶
var (
GasPriceReductionRate = "0.01" // 1% of regular tx gas price for system txs
)
Functions ¶
func IsSystemTx ¶
IsSystemTx determines whether tx is a system tx that's signed by an authorized signer system tx are special types of txs (see in the switch below), or such txs wrapped inside a MsgExec the parameter isAuthorizedSigner is a caller specified function that determines whether the signer of the tx is authorized.
func NewAnteHandler ¶
func NewAnteHandler(options HandlerOptions) (sdk.AnteHandler, error)
NewAnteHandler returns an ante handler responsible for attempting to route an Ethereum or SDK transaction to an internal ante handler for performing transaction-level processing (e.g. fee payment, signature verification) before being passed onto it's respective handler.
func NewLegacyCosmosAnteHandlerEip712 ¶
func NewLegacyCosmosAnteHandlerEip712(options HandlerOptions) sdk.AnteHandler
func SetGasMeter ¶
SetGasMeter returns a new context with a gas meter set from a given context.
func ValidateHandlerOptions ¶
func ValidateHandlerOptions(options HandlerOptions) error
Types ¶
type AuthzLimiterDecorator ¶
type AuthzLimiterDecorator struct {
// contains filtered or unexported fields
}
AuthzLimiterDecorator blocks certain msg types from being granted or executed within the authorization module.
func NewAuthzLimiterDecorator ¶
func NewAuthzLimiterDecorator(disabledMsgTypes ...string) AuthzLimiterDecorator
NewAuthzLimiterDecorator creates a decorator to block certain msg types from being granted or executed within authz.
func (AuthzLimiterDecorator) AnteHandle ¶
type DynamicFeeEVMKeeper ¶
type DynamicFeeEVMKeeper interface { ChainID() *big.Int GetParams(ctx sdk.Context) evmtypes.Params GetBaseFee(ctx sdk.Context, ethCfg *params.ChainConfig) *big.Int }
DynamicFeeEVMKeeper is a subset of EVMKeeper interface that supports dynamic fee checker
type EVMKeeper ¶
type EVMKeeper interface { statedb.Keeper DynamicFeeEVMKeeper NewEVM(ctx sdk.Context, msg core.Message, cfg *statedb.EVMConfig, tracer vm.EVMLogger, stateDB vm.StateDB) evm.EVM DeductTxCostsFromUserBalance(ctx sdk.Context, fees sdk.Coins, from common.Address) error GetBalance(ctx sdk.Context, addr common.Address) *big.Int ResetTransientGasUsed(ctx sdk.Context) GetTxIndexTransient(ctx sdk.Context) uint64 GetParams(ctx sdk.Context) evmtypes.Params }
EVMKeeper defines the expected keeper interface used on the Eth AnteHandler
type EthMempoolFeeDecorator ¶
type EthMempoolFeeDecorator struct {
// contains filtered or unexported fields
}
EthMempoolFeeDecorator will check if the transaction's effective fee is at least as large as the local validator's minimum gasFee (defined in validator config). If fee is too low, decorator returns error and tx is rejected from mempool. Note this only applies when ctx.CheckTx = true If fee is high enough or not CheckTx, then call next AnteHandler CONTRACT: Tx must implement FeeTx to use MempoolFeeDecorator
func NewEthMempoolFeeDecorator ¶
func NewEthMempoolFeeDecorator(ek EVMKeeper) EthMempoolFeeDecorator
NewEthMempoolFeeDecorator creates a new NewEthMempoolFeeDecorator instance used only for Ethereum transactions.
func (EthMempoolFeeDecorator) AnteHandle ¶
func (mfd EthMempoolFeeDecorator) AnteHandle( ctx sdk.Context, tx sdk.Tx, simulate bool, next sdk.AnteHandler, ) (newCtx sdk.Context, err error)
AnteHandle ensures that the provided fees meet a minimum threshold for the validator. This check only for local mempool purposes, and thus it is only run on (Re)CheckTx. The logic is also skipped if the London hard fork and EIP-1559 are enabled.
type EthMinGasPriceDecorator ¶
type EthMinGasPriceDecorator struct {
// contains filtered or unexported fields
}
EthMinGasPriceDecorator will check if the transaction's fee is at least as large as the MinGasPrices param. If fee is too low, decorator returns error and tx is rejected. This applies to both CheckTx and DeliverTx and regardless if London hard fork or fee market params (EIP-1559) are enabled. If fee is high enough, then call next AnteHandler
func NewEthMinGasPriceDecorator ¶
func NewEthMinGasPriceDecorator(fk FeeMarketKeeper, ek EVMKeeper) EthMinGasPriceDecorator
NewEthMinGasPriceDecorator creates a new MinGasPriceDecorator instance used only for Ethereum transactions.
func (EthMinGasPriceDecorator) AnteHandle ¶
func (empd EthMinGasPriceDecorator) AnteHandle( ctx sdk.Context, tx sdk.Tx, simulate bool, next sdk.AnteHandler, ) (newCtx sdk.Context, err error)
AnteHandle ensures that the that the effective fee from the transaction is greater than the minimum global fee, which is defined by the MinGasPrice (parameter) * GasLimit (tx argument).
type FeeMarketKeeper ¶
type FeeMarketKeeper interface { GetParams(ctx sdk.Context) (params feemarkettypes.Params) AddTransientGasWanted(ctx sdk.Context, gasWanted uint64) (uint64, error) GetBaseFeeEnabled(ctx sdk.Context) bool }
FeeMarketKeeper defines the expected keeper interface used on the AnteHandler
type HandlerOptions ¶
type HandlerOptions struct { AccountKeeper evmtypes.AccountKeeper BankKeeper evmtypes.BankKeeper IBCKeeper *ibckeeper.Keeper FeeMarketKeeper FeeMarketKeeper EvmKeeper EVMKeeper FeegrantKeeper ante.FeegrantKeeper SignModeHandler authsigning.SignModeHandler SigGasConsumer func(meter sdk.GasMeter, sig signing.SignatureV2, params authtypes.Params) error MaxTxGasWanted uint64 ExtensionOptionChecker ante.ExtensionOptionChecker TxFeeChecker ante.TxFeeChecker DisabledAuthzMsgs []string ObserverKeeper *observerkeeper.Keeper }
type MinGasPriceDecorator ¶
type MinGasPriceDecorator struct {
// contains filtered or unexported fields
}
MinGasPriceDecorator will check if the transaction's fee is at least as large as the MinGasPrices param. If fee is too low, decorator returns error and tx is rejected. This applies for both CheckTx and DeliverTx If fee is high enough, then call next AnteHandler CONTRACT: Tx must implement FeeTx to use MinGasPriceDecorator
func NewMinGasPriceDecorator ¶
func NewMinGasPriceDecorator(fk FeeMarketKeeper, ek EVMKeeper) MinGasPriceDecorator
NewMinGasPriceDecorator creates a new MinGasPriceDecorator instance used only for Cosmos transactions.
func (MinGasPriceDecorator) AnteHandle ¶
type SetUpContextDecorator ¶
type SetUpContextDecorator struct{}
SetUpContextDecorator sets the GasMeter in the Context and wraps the next AnteHandler with a defer clause to recover from any downstream OutOfGas panics in the AnteHandler chain to return an error with information on gas provided and gas used. CONTRACT: Must be first decorator in the chain CONTRACT: Tx must implement GasTx interface
func NewSetUpContextDecorator ¶
func NewSetUpContextDecorator() SetUpContextDecorator
func (SetUpContextDecorator) AnteHandle ¶
type SystemPriorityDecorator ¶
type SystemPriorityDecorator struct { }
SystemPriorityDecorator adds bigger priority for system messages
func NewSystemPriorityDecorator ¶
func NewSystemPriorityDecorator() SystemPriorityDecorator
NewSystemPriorityDecorator creates a decorator to add bigger priority for system messages
func (SystemPriorityDecorator) AnteHandle ¶
func (vad SystemPriorityDecorator) AnteHandle( ctx sdk.Context, tx sdk.Tx, simulate bool, next sdk.AnteHandler, ) (sdk.Context, error)
AnteHandle implements AnteDecorator
type VestingAccountDecorator ¶
type VestingAccountDecorator struct {
// contains filtered or unexported fields
}
VestingAccountDecorator blocks vesting messages from reaching the mempool
func NewVestingAccountDecorator ¶
func NewVestingAccountDecorator() VestingAccountDecorator
NewVestingAccountDecorator creates a decorator to block vesting messages from reaching the mempool
func (VestingAccountDecorator) AnteHandle ¶
func (vad VestingAccountDecorator) AnteHandle( ctx sdk.Context, tx sdk.Tx, simulate bool, next sdk.AnteHandler, ) (newCtx sdk.Context, err error)
AnteHandle implements AnteDecorator