ante

package
v2.4.2 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2022 License: Apache-2.0 Imports: 32 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConsumeMultisignatureVerificationGas

func ConsumeMultisignatureVerificationGas(
	meter sdk.GasMeter, sig *txsigning.MultiSignatureData, pubkey multisig.PubKey,
	params types.Params, accSeq uint64,
) error

ConsumeMultisignatureVerificationGas consumes gas from a GasMeter for verifying a multisig pubkey signature

func DefaultSigVerificationGasConsumer

func DefaultSigVerificationGasConsumer(
	meter sdk.GasMeter, sig txsigning.SignatureV2, params types.Params,
) error

DefaultSigVerificationGasConsumer is the default implementation of SignatureVerificationGasConsumer. It consumes gas for signature verification based upon the public key type. The cost is fetched from the given params and is matched by the concrete type.

func NewAnteHandler

func NewAnteHandler(options HandlerOptions) sdk.AnteHandler

func Recover

func Recover(logger tmlog.Logger, err *error)

Types

type AccountKeeper

type AccountKeeper interface {
	NewAccountWithAddress(ctx sdk.Context, addr sdk.AccAddress) authtypes.AccountI
	GetModuleAddress(moduleName string) sdk.AccAddress
	GetAllAccounts(ctx sdk.Context) (accounts []authtypes.AccountI)
	IterateAccounts(ctx sdk.Context, cb func(account authtypes.AccountI) bool)
	GetSequence(sdk.Context, sdk.AccAddress) (uint64, error)
	GetAccount(ctx sdk.Context, addr sdk.AccAddress) authtypes.AccountI
	SetAccount(ctx sdk.Context, account authtypes.AccountI)
	RemoveAccount(ctx sdk.Context, account authtypes.AccountI)
	GetParams(ctx sdk.Context) (params authtypes.Params)
}

AccountKeeper defines the expected account keeper interface

type BankKeeper

type BankKeeper interface {
	GetBalance(ctx sdk.Context, addr sdk.AccAddress, denom string) sdk.Coin
	SendCoinsFromModuleToAccount(ctx sdk.Context, senderModule string, recipientAddr sdk.AccAddress, amt sdk.Coins) error
	SendCoinsFromAccountToModule(ctx sdk.Context, senderAddr sdk.AccAddress, recipientModule string, amt sdk.Coins) error
	MintCoins(ctx sdk.Context, moduleName string, amt sdk.Coins) error
	BurnCoins(ctx sdk.Context, moduleName string, amt sdk.Coins) error
}

BankKeeper defines the expected interface needed to retrieve account balances.

type EVMKeeper

type EVMKeeper interface {
	statedb.Keeper

	ChainID() *big.Int
	GetParams(ctx sdk.Context) evmtypes.Params
	NewEVM(ctx sdk.Context, msg core.Message, cfg *evmtypes.EVMConfig, tracer vm.EVMLogger, stateDB vm.StateDB) *vm.EVM
	DeductTxCostsFromUserBalance(
		ctx sdk.Context, msgEthTx evmtypes.MsgEthereumTx, txData evmtypes.TxData, denom string, homestead, istanbul, london bool,
	) (sdk.Coins, error)
	GetBaseFee(ctx sdk.Context, ethCfg *params.ChainConfig) *big.Int
	GetBalance(ctx sdk.Context, addr common.Address) *big.Int
	ResetTransientGasUsed(ctx sdk.Context)
	GetTxIndexTransient(ctx sdk.Context) uint64
}

EVMKeeper defines the expected keeper interface used on the Eth AnteHandler

type FeeMarketKeeper

type FeeMarketKeeper interface {
	GetParams(ctx sdk.Context) (params feemarkettypes.Params)
	AddTransientGasWanted(ctx sdk.Context, gasWanted uint64) (uint64, error)
}

FeeMarketKeeper defines the expected keeper interface used on the AnteHandler

type FeegrantKeeper

type FeegrantKeeper interface {
	UseGrantedFees(ctx sdk.Context, granter, grantee sdk.AccAddress, fee sdk.Coins, msgs []sdk.Msg) error
}

FeegrantKeeper defines the expected feegrant keeper.

type HandlerOptions

type HandlerOptions struct {
	AccountKeeper              AccountKeeper
	BankKeeper                 BankKeeper
	FeegrantKeeper             FeegrantKeeper
	EvmKeeper                  EVMKeeper
	FeeMarketKeeper            FeeMarketKeeper
	IbcKeeper                  *ibckeeper.Keeper
	SignModeHandler            authsigning.SignModeHandler
	SigGasConsumer             ante.SignatureVerificationGasConsumer
	MaxTxGasWanted             uint64
	BypassMinFeeMsgTypes       []string
	MaxBypassMinFeeMsgGasUsage uint64
	InterceptMsgTypes          map[int64][]string
}

HandlerOptions extend the SDK's AnteHandler options by requiring the IBC channel keeper, EVM Keeper and Fee Market Keeper.

func (HandlerOptions) Validate

func (options HandlerOptions) Validate() error

type MempoolFeeDecorator

type MempoolFeeDecorator struct {
	BypassMinFeeMsgTypes       []string
	MaxBypassMinFeeMsgGasUsage uint64
}

MempoolFeeDecorator will check if the transaction's 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 NewMempoolFeeDecorator

func NewMempoolFeeDecorator(bypassMsgTypes []string, MaxBypassMinFeeMsgGasUsage uint64) MempoolFeeDecorator

func (MempoolFeeDecorator) AnteHandle

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

type MsgInterceptDecorator added in v2.2.0

type MsgInterceptDecorator struct {
	InterceptMsgTypes map[int64][]string
}

func NewMsgInterceptDecorator added in v2.2.0

func NewMsgInterceptDecorator(interceptMsgTypes map[int64][]string) MsgInterceptDecorator

func (MsgInterceptDecorator) AnteHandle added in v2.2.0

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

type RejectExtensionOptionsDecorator

type RejectExtensionOptionsDecorator struct{}

RejectExtensionOptionsDecorator is an AnteDecorator that rejects all extension options which can optionally be included in protobuf transactions. Users that need extension options should create a custom AnteHandler chain that handles needed extension options properly and rejects unknown ones.

func NewRejectExtensionOptionsDecorator

func NewRejectExtensionOptionsDecorator() RejectExtensionOptionsDecorator

NewRejectExtensionOptionsDecorator creates a new RejectExtensionOptionsDecorator

func (RejectExtensionOptionsDecorator) AnteHandle

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

AnteHandle implements the AnteDecorator.AnteHandle method

type SetPubKeyDecorator

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

SetPubKeyDecorator sets PubKeys in context for any signer which does not already have pubkey set PubKeys must be set in context for all signers before any other sigverify decorators run CONTRACT: Tx must implement SigVerifiableTx interface

func NewSetPubKeyDecorator

func NewSetPubKeyDecorator(ak ante.AccountKeeper) SetPubKeyDecorator

func (SetPubKeyDecorator) AnteHandle

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

type SigGasConsumeDecorator

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

SigGasConsumeDecorator Consume parameter-defined amount of gas for each signature according to the passed-in SignatureVerificationGasConsumer function before calling the next AnteHandler CONTRACT: Pubkeys are set in context for all signers before this decorator runs CONTRACT: Tx must implement SigVerifiableTx interface

func (SigGasConsumeDecorator) AnteHandle

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

Jump to

Keyboard shortcuts

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