evmante

package
v2.0.0-rc.14 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2024 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Overview

Copyright (c) 2023-2024 Nibi, Inc.

Copyright (c) 2023-2024 Nibi, Inc.

Copyright (c) 2023-2024 Nibi, Inc.

Copyright (c) 2023-2024 Nibi, Inc.

Copyright (c) 2023-2024 Nibi, Inc.

Copyright (c) 2023-2024 Nibi, Inc.

Copyright (c) 2023-2024 Nibi, Inc.

Copyright (c) 2023-2024 Nibi, Inc.

Copyright (c) 2023-2024 Nibi, Inc.

Copyright (c) 2023-2024 Nibi, Inc.

Copyright (c) 2023-2024 Nibi, Inc.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewAnteHandlerEVM

func NewAnteHandlerEVM(
	options ante.AnteHandlerOptions,
) sdk.AnteHandler

NewAnteHandlerEVM creates the default ante handler for Ethereum transactions

Types

type AnteDecEthGasConsume

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

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

func NewAnteDecEthGasConsume

func NewAnteDecEthGasConsume(
	k *EVMKeeper,
	maxGasWanted uint64,
) AnteDecEthGasConsume

NewAnteDecEthGasConsume creates a new EthGasConsumeDecorator

func (AnteDecEthGasConsume) AnteHandle

func (anteDec AnteDecEthGasConsume) AnteHandle(
	ctx sdk.Context, tx sdk.Tx, simulate bool, next sdk.AnteHandler,
) (sdk.Context, 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 plus any cost incurred by additional bytes of data supplied with the transaction.

This AnteHandler decorator will fail if:

  • the message is not a MsgEthereumTx
  • sender account cannot be found
  • transaction's gas limit is lower than the intrinsic gas
  • user has neither enough balance nor staking rewards to deduct the transaction fees (gas_limit * gas_price)
  • transaction or block gas meter runs out of gas
  • sets the gas meter limit
  • gas limit is greater than the block gas meter limit

type AnteDecEthIncrementSenderSequence

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

AnteDecEthIncrementSenderSequence increments the sequence of the signers.

func NewAnteDecEthIncrementSenderSequence

func NewAnteDecEthIncrementSenderSequence(k *EVMKeeper, ak ante.AccountKeeper) AnteDecEthIncrementSenderSequence

NewAnteDecEthIncrementSenderSequence creates a new EthIncrementSenderSequenceDecorator.

func (AnteDecEthIncrementSenderSequence) AnteHandle

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

AnteHandle handles incrementing the sequence of the signer (i.e. sender). If the transaction is a contract creation, the nonce will be incremented during the transaction execution and not within this AnteHandler decorator.

type AnteDecVerifyEthAcc

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

AnteDecVerifyEthAcc validates an account balance checks

func NewAnteDecVerifyEthAcc

func NewAnteDecVerifyEthAcc(k *EVMKeeper, ak evm.AccountKeeper) AnteDecVerifyEthAcc

NewAnteDecVerifyEthAcc creates a new EthAccountVerificationDecorator

func (AnteDecVerifyEthAcc) AnteHandle

func (anteDec AnteDecVerifyEthAcc) 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 exist, 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 CanTransferDecorator

type CanTransferDecorator struct {
	*EVMKeeper
}

CanTransferDecorator checks if the sender is allowed to transfer funds according to the EVM block context rules.

func (CanTransferDecorator) AnteHandle

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

AnteHandle creates an EVM from the message and calls the BlockContext CanTransfer function to see if the address can execute the transaction.

type EVMKeeper

type EVMKeeper = evmkeeper.Keeper

type EthEmitEventDecorator

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

EthEmitEventDecorator emit events in ante handler in case of tx execution failed (out of block gas limit).

func NewEthEmitEventDecorator

func NewEthEmitEventDecorator(k *EVMKeeper) EthEmitEventDecorator

NewEthEmitEventDecorator creates a new EthEmitEventDecorator

func (EthEmitEventDecorator) AnteHandle

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

AnteHandle emits some basic events for the eth messages

type EthSetupContextDecorator

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

EthSetupContextDecorator is adapted from SetUpContextDecorator from cosmos-sdk, it ignores gas consumption by setting the gas meter to infinite

func NewEthSetUpContextDecorator

func NewEthSetUpContextDecorator(k *EVMKeeper) EthSetupContextDecorator

func (EthSetupContextDecorator) AnteHandle

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

type EthSigVerificationDecorator

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

EthSigVerificationDecorator validates an ethereum signatures

func NewEthSigVerificationDecorator

func NewEthSigVerificationDecorator(k *EVMKeeper) 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 checks that the registered chain id is the same as the one on the message, and that the signer address matches the one defined on the message. It's not skipped for RecheckTx, because it set `From` address which is critical from other ante handler to work. Failure in RecheckTx will prevent tx to be included into block, especially when CheckTx succeed, in which case user won't see the error message.

type EthValidateBasicDecorator

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

EthValidateBasicDecorator is adapted from ValidateBasicDecorator from cosmos-sdk, it ignores ErrNoSignatures

func NewEthValidateBasicDecorator

func NewEthValidateBasicDecorator(k *EVMKeeper) EthValidateBasicDecorator

NewEthValidateBasicDecorator creates a new EthValidateBasicDecorator

func (EthValidateBasicDecorator) AnteHandle

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

AnteHandle handles basic validation of tx

type MempoolGasPriceDecorator

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

MempoolGasPriceDecorator will check if the transaction's fee is at least as large as the mempool MinGasPrices param. If fee is too low, decorator returns error and tx is rejected. This applies to CheckTx only. If fee is high enough, then call next AnteHandler

func NewMempoolGasPriceDecorator

func NewMempoolGasPriceDecorator(k *EVMKeeper) MempoolGasPriceDecorator

NewMempoolGasPriceDecorator creates a new MinGasPriceDecorator instance used only for Ethereum transactions.

func (MempoolGasPriceDecorator) AnteHandle

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

AnteHandle ensures that the effective fee from the transaction is greater than the local mempool gas prices, which is defined by the MinGasPrice (parameter) * GasLimit (tx argument).

Jump to

Keyboard shortcuts

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