Documentation ¶
Index ¶
- Constants
- func CalculateBaseFee(ctx sdk.Context, feeTx sdk.FeeTx, msgfeekeeper msgfeestypes.MsgFeesKeeper) sdk.Coins
- func ConsumeMsgFee(ctx sdk.Context, fee sdk.Coins, msg sdk.Msg, recipient string)
- func DeductFees(bankKeeper bankkeeper.Keeper, ctx sdk.Context, addr sdk.AccAddress, ...) error
- func DetermineTestBaseFeeAmount(ctx sdk.Context, feeTx sdk.FeeTx) (fee sdk.Coins)
- func EnsureSufficientFloorAndMsgFees(ctx sdk.Context, feeCoins sdk.Coins, floorGasPrice sdk.Coin, gas uint64, ...) error
- func GetFeePayerUsingFeeGrant(ctx sdk.Context, feegrantKeeper msgfeestypes.FeegrantKeeper, feeTx sdk.FeeTx, ...) (sdk.AccAddress, bool, error)
- func GetFeeTx(tx sdk.Tx) (sdk.FeeTx, error)
- func IsInitGenesis(ctx sdk.Context) bool
- func NewAnteHandler(options HandlerOptions) (sdk.AnteHandler, error)
- func NewFeeGasMeterWrapper(logger log.Logger, baseMeter storetypes.GasMeter, isSimulate bool) storetypes.GasMeter
- type FeeGasMeter
- func (g *FeeGasMeter) BaseFeeConsumed() sdk.Coins
- func (g *FeeGasMeter) ConsumeBaseFee(amount sdk.Coins) sdk.Coins
- func (g *FeeGasMeter) ConsumeFee(amount sdk.Coins, msgType string, recipient string)
- func (g *FeeGasMeter) ConsumeGas(amount storetypes.Gas, descriptor string)
- func (g *FeeGasMeter) EventFeeSummary() *msgfeestypes.EventMsgFees
- func (g *FeeGasMeter) FeeConsumed() sdk.Coins
- func (g *FeeGasMeter) FeeConsumedByMsg() map[string]sdk.Coins
- func (g *FeeGasMeter) FeeConsumedDistributions() map[string]sdk.Coins
- func (g *FeeGasMeter) FeeConsumedForType(msgType string, recipient string) sdk.Coins
- func (g *FeeGasMeter) GasConsumed() storetypes.Gas
- func (g *FeeGasMeter) GasConsumedToLimit() storetypes.Gas
- func (g *FeeGasMeter) GasRemaining() storetypes.Gas
- func (g *FeeGasMeter) IsOutOfGas() bool
- func (g *FeeGasMeter) IsPastLimit() bool
- func (g *FeeGasMeter) IsSimulate() bool
- func (g *FeeGasMeter) Limit() storetypes.Gas
- func (g *FeeGasMeter) RefundGas(amount uint64, descriptor string)
- func (g *FeeGasMeter) String() string
- type FeeMeterContextDecorator
- type HandlerOptions
- type MinGasPricesDecorator
- type MsgFeesDecorator
- type MsgFeesDistribution
- type ProvenanceDeductFeeDecorator
- type TxGasLimitDecorator
Constants ¶
const ( AttributeKeyBaseFee = "basefee" AttributeKeyAdditionalFee = "additionalfee" AttributeKeyMinFeeCharged = "min_fee_charged" )
const (
SimAppChainID = "simapp-unit-testing"
)
Variables ¶
This section is empty.
Functions ¶
func CalculateBaseFee ¶ added in v1.11.0
func CalculateBaseFee(ctx sdk.Context, feeTx sdk.FeeTx, msgfeekeeper msgfeestypes.MsgFeesKeeper) sdk.Coins
CalculateBaseFee calculates the base fee. The base fee is floor gas price
func ConsumeMsgFee ¶ added in v1.18.0
ConsumeMsgFee attempts to consume the provided fee for the given msg. If the fee is zero or the ctx does not have a FeeGasMeter, this does nothing.
func DeductFees ¶ added in v1.8.0
func DeductFees(bankKeeper bankkeeper.Keeper, ctx sdk.Context, addr sdk.AccAddress, fee sdk.Coins) error
DeductFees deducts fees from the given account.
func DetermineTestBaseFeeAmount ¶ added in v1.11.0
DetermineTestBaseFeeAmount determines the type of test that is running. ChainID = "" is a simple unit We need this because of how tests are setup using atom and we have nhash specific code for msgfees
func EnsureSufficientFloorAndMsgFees ¶ added in v1.13.0
func EnsureSufficientFloorAndMsgFees(ctx sdk.Context, feeCoins sdk.Coins, floorGasPrice sdk.Coin, gas uint64, additionalFees sdk.Coins) error
EnsureSufficientFloorAndMsgFees verifies that the given transaction has supplied enough fees(gas + additional fees) to cover x/msgfees costs.
Contract: This should only be called during CheckTx as it cannot be part of consensus.
func GetFeePayerUsingFeeGrant ¶ added in v1.13.0
func GetFeePayerUsingFeeGrant(ctx sdk.Context, feegrantKeeper msgfeestypes.FeegrantKeeper, feeTx sdk.FeeTx, fee sdk.Coins, msgs []sdk.Msg) (sdk.AccAddress, bool, error)
func IsInitGenesis ¶ added in v1.13.0
IsInitGenesis returns true if the context indicates we're in InitGenesis.
func NewAnteHandler ¶
func NewAnteHandler(options HandlerOptions) (sdk.AnteHandler, error)
func NewFeeGasMeterWrapper ¶ added in v1.8.0
func NewFeeGasMeterWrapper(logger log.Logger, baseMeter storetypes.GasMeter, isSimulate bool) storetypes.GasMeter
NewFeeGasMeterWrapper returns a reference to a new tracing gas meter that will track calls to the base gas meter
Types ¶
type FeeGasMeter ¶ added in v1.8.0
type FeeGasMeter struct {
// contains filtered or unexported fields
}
func GetFeeGasMeter ¶ added in v1.13.0
func GetFeeGasMeter(ctx sdk.Context) (*FeeGasMeter, error)
GetFeeGasMeter gets a FeeGasMeter from the provided context.
func (*FeeGasMeter) BaseFeeConsumed ¶ added in v1.8.0
func (g *FeeGasMeter) BaseFeeConsumed() sdk.Coins
func (*FeeGasMeter) ConsumeBaseFee ¶ added in v1.8.0
func (g *FeeGasMeter) ConsumeBaseFee(amount sdk.Coins) sdk.Coins
func (*FeeGasMeter) ConsumeFee ¶ added in v1.8.0
func (g *FeeGasMeter) ConsumeFee(amount sdk.Coins, msgType string, recipient string)
ConsumeFee increments the amount of msg fee required by a msg type.
func (*FeeGasMeter) ConsumeGas ¶ added in v1.8.0
func (g *FeeGasMeter) ConsumeGas(amount storetypes.Gas, descriptor string)
ConsumeGas increments the amount of gas used on the meter associated with a given purpose.
func (*FeeGasMeter) EventFeeSummary ¶ added in v1.9.0
func (g *FeeGasMeter) EventFeeSummary() *msgfeestypes.EventMsgFees
EventFeeSummary returns total fee consumed in the current fee gas meter, is returned Sorted.
func (*FeeGasMeter) FeeConsumed ¶ added in v1.8.0
func (g *FeeGasMeter) FeeConsumed() sdk.Coins
FeeConsumed returns total fee consumed in the current fee gas meter, is returned Sorted.
func (*FeeGasMeter) FeeConsumedByMsg ¶ added in v1.8.0
func (g *FeeGasMeter) FeeConsumedByMsg() map[string]sdk.Coins
FeeConsumedByMsg total fee consumed for a particular MsgType
func (*FeeGasMeter) FeeConsumedDistributions ¶ added in v1.11.0
func (g *FeeGasMeter) FeeConsumedDistributions() map[string]sdk.Coins
FeeConsumedDistributions returns fees by distribution either to fee module when key is empty or address
func (*FeeGasMeter) FeeConsumedForType ¶ added in v1.8.0
func (g *FeeGasMeter) FeeConsumedForType(msgType string, recipient string) sdk.Coins
func (*FeeGasMeter) GasConsumed ¶ added in v1.8.0
func (g *FeeGasMeter) GasConsumed() storetypes.Gas
GasConsumed reports the amount of gas consumed at Log.Info level
func (*FeeGasMeter) GasConsumedToLimit ¶ added in v1.8.0
func (g *FeeGasMeter) GasConsumedToLimit() storetypes.Gas
GasConsumedToLimit will report the actual consumption or the meter limit, whichever is less.
func (*FeeGasMeter) GasRemaining ¶ added in v1.13.0
func (g *FeeGasMeter) GasRemaining() storetypes.Gas
GasRemaining returns the gas left in the GasMeter.
func (*FeeGasMeter) IsOutOfGas ¶ added in v1.8.0
func (g *FeeGasMeter) IsOutOfGas() bool
IsOutOfGas indicates the gas meter has tracked consumption at or above the limit
func (*FeeGasMeter) IsPastLimit ¶ added in v1.8.0
func (g *FeeGasMeter) IsPastLimit() bool
IsPastLimit indicates consumption has passed the limit (if any)
func (*FeeGasMeter) IsSimulate ¶ added in v1.8.0
func (g *FeeGasMeter) IsSimulate() bool
func (*FeeGasMeter) Limit ¶ added in v1.8.0
func (g *FeeGasMeter) Limit() storetypes.Gas
Limit for amount of gas that can be consumed (if zero then unlimited)
func (*FeeGasMeter) RefundGas ¶ added in v1.8.0
func (g *FeeGasMeter) RefundGas(amount uint64, descriptor string)
RefundGas refunds an amount of gas
func (*FeeGasMeter) String ¶ added in v1.8.0
func (g *FeeGasMeter) String() string
String implements stringer interface
type FeeMeterContextDecorator ¶ added in v1.8.0
type FeeMeterContextDecorator struct{}
FeeMeterContextDecorator is an AnteDecorator that wraps the current context gas meter with a msg based fee meter. Also, it merges functionality from GasTracerContextDecorator in previous versions which provided an AnteDecorator that wraps the current context gas meter with one that outputs debug logging and telemetry whenever gas is consumed on the meter.
func NewFeeMeterContextDecorator ¶ added in v1.8.0
func NewFeeMeterContextDecorator() FeeMeterContextDecorator
NewFeeMeterContextDecorator creates a new FeeMeterContextDecorator
func (FeeMeterContextDecorator) AnteHandle ¶ added in v1.8.0
func (r FeeMeterContextDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simulate bool, next sdk.AnteHandler) (sdk.Context, error)
AnteHandle implements the AnteDecorator.AnteHandle method
type HandlerOptions ¶ added in v1.8.0
type HandlerOptions struct { AccountKeeper cosmosante.AccountKeeper BankKeeper banktypes.Keeper ExtensionOptionChecker cosmosante.ExtensionOptionChecker FeegrantKeeper msgfeestypes.FeegrantKeeper MsgFeesKeeper msgfeestypes.MsgFeesKeeper CircuitKeeper circuitante.CircuitBreaker TxSigningHandlerMap *txsigning.HandlerMap SigGasConsumer func(meter storetypes.GasMeter, sig signing.SignatureV2, params types.Params) error }
HandlerOptions are the options required for constructing a default SDK AnteHandler.
type MinGasPricesDecorator ¶ added in v1.13.0
type MinGasPricesDecorator struct{}
MinGasPricesDecorator 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 MinGasPricesDecorator
func NewMinGasPricesDecorator ¶ added in v1.13.0
func NewMinGasPricesDecorator() MinGasPricesDecorator
func (MinGasPricesDecorator) AnteHandle ¶ added in v1.13.0
type MsgFeesDecorator ¶ added in v1.8.0
type MsgFeesDecorator struct {
// contains filtered or unexported fields
}
MsgFeesDecorator will check if the transaction's fee is at least as large as floor gas fee (defined in MsgFee module) + message-based fees (also defined in the MsgFee module). 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 MsgFeesDecorator
func NewMsgFeesDecorator ¶ added in v1.8.0
func NewMsgFeesDecorator(msgFeeKeeper msgfeestypes.MsgFeesKeeper) MsgFeesDecorator
func (MsgFeesDecorator) AnteHandle ¶ added in v1.8.0
func (mfd MsgFeesDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simulate bool, next sdk.AnteHandler) (sdk.Context, error)
AnteHandle handles msg fee checking has two functions ensures, 1. has enough fees to add to Mempool (this involves CheckTx) 2. Makes sure enough fees are present for additional message fees Let z be the Total Fees to be paid Let x be the Base gas Fees to be paid Let y is the additional fees to be paid per MsgType then z = x + y This Fee Decorator makes sure that z is >= to x + y
type MsgFeesDistribution ¶ added in v1.11.0
type ProvenanceDeductFeeDecorator ¶ added in v1.8.0
type ProvenanceDeductFeeDecorator struct {
// contains filtered or unexported fields
}
ProvenanceDeductFeeDecorator identifies the payer (using feegrant funds if appropriate), makes sure the payer has enough funds to cover the fees, and deducts the base fee from the payer's account. The base fee is the floor gas price * gas. 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: In order to use ProvenanceDeductFeeDecorator:
- Tx must implement FeeTx interface.
- GasMeter must be a FeeGasMeter.
func NewProvenanceDeductFeeDecorator ¶ added in v1.8.0
func NewProvenanceDeductFeeDecorator( accountKeeper authante.AccountKeeper, bankKeeper bankkeeper.Keeper, feegrantKeeper msgfeestypes.FeegrantKeeper, msgfeesKeeper msgfeestypes.MsgFeesKeeper, ) ProvenanceDeductFeeDecorator
func (ProvenanceDeductFeeDecorator) AnteHandle ¶ added in v1.8.0
type TxGasLimitDecorator ¶ added in v1.8.0
type TxGasLimitDecorator struct{}
TxGasLimitDecorator will check if the transaction's gas amount is higher 4,000,000. If gas is too high, decorator returns error and tx is rejected from mempool. If gas is below the limit, then call next AnteHandler CONTRACT: Tx must implement FeeTx to use TxGasLimitDecorator
func NewTxGasLimitDecorator ¶ added in v1.8.0
func NewTxGasLimitDecorator() TxGasLimitDecorator