ante

package
v0.0.48 Latest Latest
Warning

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

Go to latest
Published: Sep 11, 2026 License: MIT Imports: 36 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DeductFees

func DeductFees(bankKeeper types.BankKeeper, ctx sdk.Context, acc sdk.AccountI, fees sdk.Coins) error

DeductFees deducts fees from the given account.

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.

func NewCosmosAnteHandler

func NewCosmosAnteHandler(ctx sdk.Context, options HandlerOptions) sdk.AnteHandler

NewCosmosAnteHandler creates the default ante handler for Cosmos transactions

func OnlyLegacyAminoSigners

func OnlyLegacyAminoSigners(sigData signing.SignatureData) bool

OnlyLegacyAminoSigners checks SignatureData to see if all signers are using SIGN_MODE_LEGACY_AMINO_JSON. If this is the case then the corresponding SignatureV2 struct will not have account sequence explicitly set, and we should skip the explicit verification of sig.Sequence in the SigVerificationDecorator's AnteHandler function.

Types

type AccountInitDecorator

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

func NewAccountInitDecorator

func NewAccountInitDecorator(ak AccountKeeper, uvk UValidatorKeeper, signModeHandler *txsigning.HandlerMap) AccountInitDecorator

func (AccountInitDecorator) AnteHandle

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

type AccountKeeper

type AccountKeeper interface {
	NewAccountWithAddress(ctx context.Context, addr sdk.AccAddress) sdk.AccountI
	GetModuleAddress(moduleName string) sdk.AccAddress
	GetAccount(ctx context.Context, addr sdk.AccAddress) sdk.AccountI
	HasAccount(ctx context.Context, addr sdk.AccAddress) bool
	SetAccount(ctx context.Context, account sdk.AccountI)
	RemoveAccount(ctx context.Context, account sdk.AccountI)
	GetParams(ctx context.Context) (params authtypes.Params)
	GetSequence(ctx context.Context, addr sdk.AccAddress) (uint64, error)
	AddressCodec() addresscodec.Codec
	// Unordered transaction support (added in cosmos-sdk v0.53).
	UnorderedTransactionsEnabled() bool
	RemoveExpiredUnorderedNonces(ctx sdk.Context) error
	TryAddUnorderedNonce(ctx sdk.Context, sender []byte, timestamp time.Time) error
}

type BankKeeper

type BankKeeper interface {
	IsSendEnabledCoins(ctx context.Context, coins ...sdk.Coin) error
	SendCoins(ctx context.Context, from, to sdk.AccAddress, amt sdk.Coins) error
	SendCoinsFromAccountToModule(ctx context.Context, senderAddr sdk.AccAddress, recipientModule string, amt sdk.Coins) error
}

BankKeeper defines the contract needed for supply related APIs (noalias)

type BlockedMsgsDecorator added in v0.0.48

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

BlockedMsgsDecorator rejects a fixed set of msg type URLs anywhere in a tx: at the top level, and nested inside authz.MsgExec (arbitrarily deep, up to maxNestedBlockedMsgs).

It complements cosmosante.NewAuthzLimiterDecorator, which only blocks msgs carried *inside* an authz message and lets the same msg through when it is submitted directly.

func NewBlockedMsgsDecorator added in v0.0.48

func NewBlockedMsgsDecorator(blockedMsgTypes ...string) BlockedMsgsDecorator

NewBlockedMsgsDecorator creates a decorator that rejects the given msg type URLs regardless of where they appear in the tx.

func (BlockedMsgsDecorator) AnteHandle added in v0.0.48

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

type DeductFeeDecorator

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

DeductFeeDecorator deducts fees from the fee payer. The fee payer is the fee granter (if specified) or first signer of the tx. If the fee payer does not have the funds to pay for the fees, return an InsufficientFunds error. Call next AnteHandler if fees successfully deducted. CONTRACT: Tx must implement FeeTx interface to use DeductFeeDecorator

func (DeductFeeDecorator) AnteHandle

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

type GaslessGasLimitDecorator added in v0.0.48

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

GaslessGasLimitDecorator caps the gas limit a fee-exempt (gasless) tx may declare.

A fee-paying tx is bounded by its own fee: the ante handler requires ceil(minGasPrice * gasLimit), so an absurd gas limit costs an absurd amount of tokens. A gasless tx pays nothing, so nothing bounds the gas it declares while that declared gas is still added to the block's cumulative gas wanted. Enough of them, or few enough with a large enough declaration, push the cumulative total past what the fee market can represent.

CONTRACT: must run before the EVM GasWantedDecorator, which is what accumulates the declared gas into the fee market transient store.

func NewGaslessGasLimitDecorator added in v0.0.48

func NewGaslessGasLimitDecorator(pk GaslessParamsKeeper) GaslessGasLimitDecorator

func (GaslessGasLimitDecorator) AnteHandle added in v0.0.48

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

type GaslessParamsKeeper added in v0.0.48

type GaslessParamsKeeper interface {
	GetParams(ctx context.Context) (uexecutortypes.Params, error)
}

GaslessParamsKeeper reads the module parameters that bound fee-exempt txs.

type HandlerOptions

type HandlerOptions struct {
	Cdc                    codec.BinaryCodec
	AccountKeeper          AccountKeeper
	BankKeeper             BankKeeper
	UValidatorKeeper       UValidatorKeeper
	FeegrantKeeper         ante.FeegrantKeeper
	ExtensionOptionChecker ante.ExtensionOptionChecker
	SignModeHandler        *txsigning.HandlerMap
	SigGasConsumer         func(meter storetypes.GasMeter, sig signing.SignatureV2, params authtypes.Params) error
	WasmConfig             *wasmtypes.NodeConfig
	WasmKeeper             *wasmkeeper.Keeper
	TXCounterStoreService  corestoretypes.KVStoreService

	MaxTxGasWanted  uint64
	FeeMarketKeeper anteinterfaces.FeeMarketKeeper
	EvmKeeper       anteinterfaces.EVMKeeper

	// UexecutorKeeper supplies the governance-controlled cap on the gas a
	// fee-exempt (gasless) tx may declare.
	UexecutorKeeper GaslessParamsKeeper

	IBCKeeper     *ibckeeper.Keeper
	CircuitKeeper *circuitkeeper.Keeper
}

HandlerOptions defines the list of module keepers required to run the EVM AnteHandler decorators.

func (HandlerOptions) Validate

func (options HandlerOptions) Validate() error

Validate checks if the keepers are defined

type UValidatorKeeper added in v0.0.48

type UValidatorKeeper interface {
	IsBondedUniversalValidator(ctx context.Context, universalValidator string) (bool, error)
}

UValidatorKeeper is the minimal slice of the uvalidator keeper the ante chain needs. Declared locally, like AccountKeeper/BankKeeper above, so the ante package does not depend on a concrete keeper.

Jump to

Keyboard shortcuts

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