Documentation ¶
Overview ¶
Package ante defines the SDK auth module's AnteHandler as well as an internal AnteHandler for an Ethereum transaction (i.e MsgEthereumTx).
During CheckTx, the transaction is passed through a series of pre-message execution validation checks such as signature and account verification in addition to minimum fees being checked. Otherwise, during DeliverTx, the transaction is simply passed to the EVM which will also perform the same series of checks. The distinction is made in CheckTx to prevent spam and DoS attacks.
Index ¶
- Constants
- Variables
- func CosmosExtensionOptionChecker(any *codectypes.Any) bool
- func NewAnteHandler(options HandlerOptions) sdk.AnteHandler
- type AccountKeeper
- type ChargeGasfreeFeesDecorator
- type EthAccountVerificationDecorator
- type EthSetPubkeyDecorator
- type HandlerOptions
- type SetAccountTypeDecorator
- type SignedTx
- type ValidatorCommissionDecorator
Constants ¶
const ( LegacyTxType = iota AccessListTxType DynamicFeeTxType )
Transaction types.
Variables ¶
Functions ¶
func CosmosExtensionOptionChecker ¶ added in v1.5.0
func CosmosExtensionOptionChecker(any *codectypes.Any) bool
func NewAnteHandler ¶
func NewAnteHandler(options HandlerOptions) sdk.AnteHandler
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.
Types ¶
type AccountKeeper ¶
type AccountKeeper interface { NewAccount(ctx sdk.Context, acc authtypes.AccountI) authtypes.AccountI NewAccountWithAddress(ctx sdk.Context, addr sdk.AccAddress) authtypes.AccountI SetAccount(ctx sdk.Context, acc authtypes.AccountI) GetAccount(ctx sdk.Context, addr sdk.AccAddress) authtypes.AccountI GetAllAccounts(ctx sdk.Context) (accounts []authtypes.AccountI) IterateAccounts(ctx sdk.Context, cb func(account authtypes.AccountI) bool) GetParams(ctx sdk.Context) (params authtypes.Params) GetModuleAddress(moduleName string) sdk.AccAddress GetSequence(sdk.Context, sdk.AccAddress) (uint64, error) RemoveAccount(ctx sdk.Context, account authtypes.AccountI) }
type ChargeGasfreeFeesDecorator ¶
type ChargeGasfreeFeesDecorator struct {
// contains filtered or unexported fields
}
ChargeGasfreeFeesDecorator enables custom fee charging for gas-free transactions on a per-message basis
func NewChargeGasfreeFeesDecorator ¶
func NewChargeGasfreeFeesDecorator(ak AccountKeeper, gasfreeKeeper gasfreekeeper.Keeper, microtxKeeper microtxkeeper.Keeper) ChargeGasfreeFeesDecorator
func (ChargeGasfreeFeesDecorator) AnteHandle ¶
func (satd ChargeGasfreeFeesDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simulate bool, next sdk.AnteHandler) (sdk.Context, error)
AnteHandle charges fees for gas-free transactions on a case-by-case basis
func (ChargeGasfreeFeesDecorator) DeductAnyMicrotxFees ¶
type EthAccountVerificationDecorator ¶
type EthAccountVerificationDecorator struct {
// contains filtered or unexported fields
}
EthAccountVerificationDecorator validates an account balance checks
func NewEthAccountVerificationDecorator ¶
func NewEthAccountVerificationDecorator(ak AccountKeeper, ek *evmkeeper.Keeper) EthAccountVerificationDecorator
NewEthAccountVerificationDecorator creates a new EthAccountVerificationDecorator
func (EthAccountVerificationDecorator) AnteHandle ¶
func (avd EthAccountVerificationDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simulate bool, next sdk.AnteHandler) (newCtx sdk.Context, err error)
AnteHandle validates checks that the sender balance is greater than the total transaction cost. The account will be set to store if it doesn't exis, i.e cannot be found on store. This AnteHandler decorator will fail if: - any of the msgs is not a MsgEthereumTx - from address is empty - account balance is lower than the transaction cost
type EthSetPubkeyDecorator ¶
type EthSetPubkeyDecorator struct {
// contains filtered or unexported fields
}
EthSetPubkeyDecorator sets the pubkey on the account for EVM Txs CONTRACT: Tx must contain a single ExtensionOptionsEthereumTx
This decorator should come AFTER assigning From on the Tx, AFTER signature verification, and AFTER the account is stored
func NewEthSetPubkeyDecorator ¶
func NewEthSetPubkeyDecorator(ak AccountKeeper, evmKeeper *evmkeeper.Keeper) EthSetPubkeyDecorator
func (EthSetPubkeyDecorator) AnteHandle ¶
func (espd EthSetPubkeyDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simulate bool, next sdk.AnteHandler) (sdk.Context, error)
AnteHandle sets the pubkey for the account
type HandlerOptions ¶
type HandlerOptions struct { AccountKeeper AccountKeeper BankKeeper evmtypes.BankKeeper IBCKeeper *ibckeeper.Keeper FeeMarketKeeper feemarketkeeper.Keeper EvmKeeper *evmkeeper.Keeper 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 Cdc codec.BinaryCodec GasfreeKeeper *gasfreekeeper.Keeper MicrotxKeeper *microtxkeeper.Keeper }
HandlerOptions defines the list of module keepers required to run the canto AnteHandler decorators.
func (HandlerOptions) Validate ¶
func (options HandlerOptions) Validate() error
Validate checks if the keepers are defined
type SetAccountTypeDecorator ¶
type SetAccountTypeDecorator struct {
// contains filtered or unexported fields
}
SetAccountTypeDecorator sets the account type to EthAccount for Ethermint pubkeys PubKeys must be set in context before this decorator runs ethAccountProto initializes an Ethermint account
CONTRACT: Tx must implement SignedTx interface (sdk.Tx interface + GetSigners() method)
func NewSetAccountTypeDecorator ¶
func NewSetAccountTypeDecorator(ak AccountKeeper, ethAccountProto func(sdk.AccAddress) authtypes.AccountI) SetAccountTypeDecorator
func (SetAccountTypeDecorator) AnteHandle ¶
type ValidatorCommissionDecorator ¶
type ValidatorCommissionDecorator struct {
// contains filtered or unexported fields
}
ValidatorCommissionDecorator validates that the validator commission is always greater or equal than the min commission rate
func NewValidatorCommissionDecorator ¶
func NewValidatorCommissionDecorator(cdc codec.BinaryCodec) ValidatorCommissionDecorator
NewValidatorCommissionDecorator creates a new NewValidatorCommissionDecorator
func (ValidatorCommissionDecorator) AnteHandle ¶
func (vcd ValidatorCommissionDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simulate bool, next sdk.AnteHandler) (newCtx sdk.Context, err error)
AnteHandle checks if the tx contains a staking create validator or edit validator. It errors if the the commission rate is below the min threshold.