decorators

package
v30.0.0 Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2026 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (

	// MaxBypassMinFeeMsgGasUsage is the maximum gas limit a zero-fee tx made up
	// exclusively of bypass message types (IBC relayer messages) may request.
	// It bounds the free gas a relayer can consume per tx; anything heavier
	// must pay fees like everyone else. Matches the pre-v30 x/globalfee value.
	MaxBypassMinFeeMsgGasUsage = uint64(2_000_000)
)
View Source
const (
	MaxChangeRate = "0.05"
)

Variables

This section is empty.

Functions

func CheckTxFee

func CheckTxFee(ctx sdk.Context, gasPrice sdk.DecCoin, feeCoin sdk.Coin, feeGas int64, isAnte bool) (payCoin sdk.Coin, tip sdk.Coin, err error)

CheckTxFee implements the logic for the fee market to check if a Tx has provided sufficient fees given the current state of the fee market. Returns an error if insufficient fees.

func GetTxPriority

func GetTxPriority(fee sdk.Coin, gasLimit int64, currentGasPrice sdk.DecCoin) int64

GetTxPriority returns a naive tx priority based on the amount of gas price provided in a transaction.

The fee amount is divided by the gasLimit to calculate "Effective Gas Price". This value is then normalized and scaled into an integer, so it can be used as a priority.

effectiveGasPrice = feeAmount / gas limit (denominated in fee per gas)
normalizedGasPrice = effectiveGasPrice / currentGasPrice (floor is 1.  The minimum effective gas price can ever be is current gas price)
scaledGasPrice = normalizedGasPrice * gasPricePrecisionMultiplier (10^6 — decimal places in the normalized gas price to consider when converting to int64).

Types

type DeductFeeDecorator

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

func NewDeductFeeDecorator

func NewDeductFeeDecorator(fpk feepaykeeper.Keeper, fmk feemarketkeeper.Keeper, ak authkeeper.AccountKeeper, bk bankkeeper.Keeper, fgk feegrantkeeper.Keeper, bondDenom string, bypassMinFeeMsgTypes []string, fallbackDecorator sdk.AnteDecorator) DeductFeeDecorator

func (DeductFeeDecorator) AnteHandle

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

AnteHandle calls the feemarket antehandler if the keeper is enabled. If disabled, the fallback fee antehandler is fallen back to.

type InnerDeductFeeDecorator

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

InnerDeductFeeDecorator deducts fees from the first signer of the tx If the first signer does not have the funds to pay for the fees, return with InsufficientFunds error Call next AnteHandler if fees successfully deducted CONTRACT: Tx must implement FeeTx interface to use DeductFeeDecorator

Additionally, the Deduct Fee ante is a fork of the SDK's DeductFeeDecorator. This decorator looks for single message transactions with no provided fee. If they correspond to a registered FeePay Contract, the FeePay module will cover the cost of the fee (if the balance permits).

func (InnerDeductFeeDecorator) HandleFees

func (dfd InnerDeductFeeDecorator) HandleFees(ctx sdk.Context, feeTx sdk.FeeTx, fee sdk.Coin, isValidFeepayTx bool) error

type MsgChangeRateDecorator

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

MsgChangeRateDecorator defines the AnteHandler that filters & prevents messages that create validators and exceed the max change rate of 5%.

func NewChangeRateDecorator

func NewChangeRateDecorator(sk *stakingkeeper.Keeper) MsgChangeRateDecorator

NewChangeRateDecorator creates a new Change Rate Decorator

func (MsgChangeRateDecorator) AnteHandle

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

AnteHandle checks for transactions that exceed the max change rate of 5% on the creation of a validator.

Jump to

Keyboard shortcuts

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