ante

package
v0.19.14 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 13, 2021 License: Apache-2.0 Imports: 16 Imported by: 0

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

This section is empty.

Variables

This section is empty.

Functions

func NewAnteHandler

func NewAnteHandler(ak auth.AccountKeeper, evmKeeper EVMKeeper, sk types.SupplyKeeper, validateMsgHandler ValidateMsgHandler) 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 AccountBlockedVerificationDecorator added in v0.19.11

type AccountBlockedVerificationDecorator struct {
	// contains filtered or unexported fields
}

AccountBlockedVerificationDecorator check whether signer is blocked.

func NewAccountBlockedVerificationDecorator added in v0.19.11

func NewAccountBlockedVerificationDecorator(evmKeeper EVMKeeper) AccountBlockedVerificationDecorator

NewAccountBlockedVerificationDecorator creates a new AccountBlockedVerificationDecorator instance

func (AccountBlockedVerificationDecorator) AnteHandle added in v0.19.11

func (abvd AccountBlockedVerificationDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simulate bool, next sdk.AnteHandler) (sdk.Context, error)

AnteHandle check wether signer of tx(contains cosmos-tx and eth-tx) is blocked.

type AccountSetupDecorator

type AccountSetupDecorator struct {
	// contains filtered or unexported fields
}

AccountSetupDecorator sets an account to state if it's not stored already. This only applies for MsgEthermint.

func NewAccountSetupDecorator

func NewAccountSetupDecorator(ak auth.AccountKeeper) AccountSetupDecorator

NewAccountSetupDecorator creates a new AccountSetupDecorator instance

func (AccountSetupDecorator) AnteHandle

func (asd AccountSetupDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simulate bool, next sdk.AnteHandler) (sdk.Context, error)

AnteHandle sets an account for MsgEthermint (evm) if the sender is registered. NOTE: Since the account is set without any funds, the message execution will fail if the validator requires a minimum fee > 0.

type AccountVerificationDecorator

type AccountVerificationDecorator struct {
	// contains filtered or unexported fields
}

AccountVerificationDecorator validates an account balance checks

func NewAccountVerificationDecorator

func NewAccountVerificationDecorator(ak auth.AccountKeeper, ek EVMKeeper) AccountVerificationDecorator

NewAccountVerificationDecorator creates a new AccountVerificationDecorator

func (AccountVerificationDecorator) AnteHandle

func (avd AccountVerificationDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simulate bool, next sdk.AnteHandler) (newCtx sdk.Context, err error)

AnteHandle validates the signature and returns sender address

type EVMKeeper

type EVMKeeper interface {
	GetParams(ctx sdk.Context) evmtypes.Params
	IsAddressBlocked(ctx sdk.Context, addr sdk.AccAddress) bool
}

EVMKeeper defines the expected keeper interface used on the Eth AnteHandler

type EthGasConsumeDecorator

type EthGasConsumeDecorator struct {
	// contains filtered or unexported fields
}

EthGasConsumeDecorator validates enough intrinsic gas for the transaction and gas consumption.

func NewEthGasConsumeDecorator

func NewEthGasConsumeDecorator(ak auth.AccountKeeper, sk types.SupplyKeeper, ek EVMKeeper) EthGasConsumeDecorator

NewEthGasConsumeDecorator creates a new EthGasConsumeDecorator

func (EthGasConsumeDecorator) AnteHandle

func (egcd EthGasConsumeDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simulate bool, next sdk.AnteHandler) (newCtx sdk.Context, err error)

AnteHandle validates that the Ethereum tx message has enough to cover intrinsic gas (during CheckTx only) and that the sender has enough balance to pay for the gas cost.

Intrinsic gas for a transaction is the amount of gas that the transaction uses before the transaction is executed. The gas is a constant value of 21000 plus any cost inccured by additional bytes of data supplied with the transaction.

type EthMempoolFeeDecorator

type EthMempoolFeeDecorator struct {
	// contains filtered or unexported fields
}

EthMempoolFeeDecorator validates that sufficient fees have been provided that meet a minimum threshold defined by the proposer (for mempool purposes during CheckTx).

func NewEthMempoolFeeDecorator

func NewEthMempoolFeeDecorator(ek EVMKeeper) EthMempoolFeeDecorator

NewEthMempoolFeeDecorator creates a new EthMempoolFeeDecorator

func (EthMempoolFeeDecorator) AnteHandle

func (emfd EthMempoolFeeDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simulate bool, next sdk.AnteHandler) (newCtx sdk.Context, err error)

AnteHandle verifies that enough fees have been provided by the Ethereum transaction that meet the minimum threshold set by the block proposer.

NOTE: This should only be run during a CheckTx mode.

type EthSetupContextDecorator

type EthSetupContextDecorator struct{}

EthSetupContextDecorator sets the infinite 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 NewEthSetupContextDecorator

func NewEthSetupContextDecorator() EthSetupContextDecorator

NewEthSetupContextDecorator creates a new EthSetupContextDecorator

func (EthSetupContextDecorator) AnteHandle

func (escd EthSetupContextDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simulate bool, next sdk.AnteHandler) (newCtx sdk.Context, err error)

AnteHandle sets the infinite gas meter to done to ignore costs in AnteHandler checks. This is undone at the EthGasConsumeDecorator, where the context is set with the ethereum tx GasLimit.

type EthSigVerificationDecorator

type EthSigVerificationDecorator struct{}

EthSigVerificationDecorator validates an ethereum signature

func NewEthSigVerificationDecorator

func NewEthSigVerificationDecorator() EthSigVerificationDecorator

NewEthSigVerificationDecorator creates a new EthSigVerificationDecorator

func (EthSigVerificationDecorator) AnteHandle

func (esvd EthSigVerificationDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simulate bool, next sdk.AnteHandler) (newCtx sdk.Context, err error)

AnteHandle validates the signature and returns sender address

type GasLimitDecorator

type GasLimitDecorator struct {
	// contains filtered or unexported fields
}

func NewGasLimitDecorator

func NewGasLimitDecorator(evm EVMKeeper) GasLimitDecorator

NewGasLimitDecorator creates a new GasLimitDecorator.

func (GasLimitDecorator) AnteHandle

func (g GasLimitDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simulate bool, next sdk.AnteHandler) (sdk.Context, error)

AnteHandle handles incrementing the sequence of the sender.

type IncrementSenderSequenceDecorator

type IncrementSenderSequenceDecorator struct {
	// contains filtered or unexported fields
}

IncrementSenderSequenceDecorator increments the sequence of the signers. The main difference with the SDK's IncrementSequenceDecorator is that the MsgEthereumTx doesn't implement the SigVerifiableTx interface.

CONTRACT: must be called after msg.VerifySig in order to cache the sender address.

func NewIncrementSenderSequenceDecorator

func NewIncrementSenderSequenceDecorator(ak auth.AccountKeeper) IncrementSenderSequenceDecorator

NewIncrementSenderSequenceDecorator creates a new IncrementSenderSequenceDecorator.

func (IncrementSenderSequenceDecorator) AnteHandle

func (issd IncrementSenderSequenceDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simulate bool, next sdk.AnteHandler) (sdk.Context, error)

AnteHandle handles incrementing the sequence of the sender.

type NonceVerificationDecorator

type NonceVerificationDecorator struct {
	// contains filtered or unexported fields
}

NonceVerificationDecorator checks that the account nonce from the transaction matches the sender account sequence.

func NewNonceVerificationDecorator

func NewNonceVerificationDecorator(ak auth.AccountKeeper) NonceVerificationDecorator

NewNonceVerificationDecorator creates a new NonceVerificationDecorator

func (NonceVerificationDecorator) AnteHandle

func (nvd NonceVerificationDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simulate bool, next sdk.AnteHandler) (newCtx sdk.Context, err error)

AnteHandle validates that the transaction nonce is valid (equivalent to the sender account’s current nonce).

type ValidateMsgHandler

type ValidateMsgHandler func(ctx sdk.Context, msgs []sdk.Msg) error

type ValidateMsgHandlerDecorator

type ValidateMsgHandlerDecorator struct {
	// contains filtered or unexported fields
}

func NewValidateMsgHandlerDecorator

func NewValidateMsgHandlerDecorator(validateHandler ValidateMsgHandler) ValidateMsgHandlerDecorator

func (ValidateMsgHandlerDecorator) AnteHandle

func (vmhd ValidateMsgHandlerDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simulate bool, next sdk.AnteHandler) (sdk.Context, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL