Documentation ¶
Overview ¶
Package ante defines the SDK auth module's AnteHandler as well as an internal AnteHandler for an Ethereum transaction (i.e MsgEthereumTx).
During CheckTx, the transaction is passed through a series of pre-message execution validation checks such as signature and account verification in addition to minimum fees being checked. Otherwise, during DeliverTx, the transaction is simply passed to the EVM which will also perform the same series of checks. The distinction is made in CheckTx to prevent spam and DoS attacks.
Index ¶
- Constants
- func CalculateFee(msgs []sdk.Msg, txBytesLen int64, factor sdk.Dec) (sdk.Int, error)
- func DeductFees(ctx sdk.Context, bankKeeper evmTypes.BankKeeper, ...) error
- func ErrCoinDoesNotExist(feeDenom string) *sdkerrors.Error
- func ErrCoinReserveBecomeInsufficient(reserve, decreasing, minReserve string) *sdkerrors.Error
- func ErrCoinReserveInsufficient(reserve, commission string) *sdkerrors.Error
- func ErrCoinVolumeBecomeInsufficient(volume, decreasing, minVolume string) *sdkerrors.Error
- func ErrFailedToSendCoins(err string) *sdkerrors.Error
- func ErrFeeLessThanCommission(feeInBaseCoin, commissionInBaseCoin string) *sdkerrors.Error
- func ErrFeePayerAddressDoesNotExist(feePayer string) *sdkerrors.Error
- func ErrInsufficientFundsToPayFee(coins, fee string) *sdkerrors.Error
- func ErrInvalidAddressOfCreatedAccount() *sdkerrors.Error
- func ErrInvalidFeeAmount(fee string) *sdkerrors.Error
- func ErrNotFeeTxType() *sdkerrors.Error
- func ErrNotGasTxType() *sdkerrors.Error
- func ErrNotStdTxType() *sdkerrors.Error
- func ErrOutOfGas(location, gasWanted, gasUsed string) *sdkerrors.Error
- func ErrUnableToFindCreatedAccount() *sdkerrors.Error
- func ErrUnknownTransaction(txType string) *sdkerrors.Error
- func NewAnteHandler(options HandlerOptions) sdk.AnteHandler
- func NewCommissionGasMeter(limit sdk.Gas) sdk.GasMeter
- func SetGasMeter(simulate bool, ctx sdk.Context, gasLimit uint64) sdk.Context
- type CodeType
- type FeeDecorator
- type HandlerOptions
- type SetUpContextDecorator
- type ValidatorCommissionDecorator
Constants ¶
const ( // Default ante codespace DefaultRootCodespace string = "ante" CodeFeePayerAddressDoesNotExist CodeType = 101 CodeFeeLessThanCommission CodeType = 102 CodeFailedToSendCoins CodeType = 103 CodeInsufficientFundsToPayFee CodeType = 104 CodeInvalidFeeAmount CodeType = 105 CodeCoinDoesNotExist CodeType = 106 CodeNotStdTxType CodeType = 107 CodeNotFeeTxType CodeType = 108 CodeOutOfGas CodeType = 109 CodeNotGasTxType CodeType = 110 CodeInvalidAddressOfCreatedAccount CodeType = 111 CodeUnableToFindCreatedAccount CodeType = 112 CodeUnknownTransaction CodeType = 113 CodeCoinReserveInsufficient CodeType = 114 CodeCoinReserveBecomeInsufficient CodeType = 115 CodeCoinVolumeBecomeInsufficient CodeType = 116 )
const (
GasCommissionDesc = "commission"
)
Gas consumption descriptors.
Variables ¶
This section is empty.
Functions ¶
func CalculateFee ¶
Calculate fee in base coin
func DeductFees ¶
func DeductFees(ctx sdk.Context, bankKeeper evmTypes.BankKeeper, coinKeeper coinTypes.CoinKeeper, feePayerAddress sdk.AccAddress, fee sdk.Coin) error
DeductFees deducts fees from the given account.
func ErrCoinDoesNotExist ¶
func ErrFailedToSendCoins ¶
func ErrInvalidFeeAmount ¶
func ErrNotFeeTxType ¶
func ErrNotGasTxType ¶
func ErrNotStdTxType ¶
func ErrOutOfGas ¶
func ErrUnknownTransaction ¶
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.
Types ¶
type FeeDecorator ¶
type FeeDecorator struct {
// contains filtered or unexported fields
}
func NewFeeDecorator ¶
func NewFeeDecorator(ck coinTypes.CoinKeeper, bk evmTypes.BankKeeper, ak evmTypes.AccountKeeper) FeeDecorator
NewFeeDecorator creates new FeeDecorator to deduct fee
func (FeeDecorator) AnteHandle ¶
func (fd FeeDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simulate bool, next sdk.AnteHandler) (newCtx sdk.Context, err error)
AnteHandle implements sdk.AnteHandler function.
type HandlerOptions ¶
type HandlerOptions struct { AccountKeeper evmtypes.AccountKeeper BankKeeper evmtypes.BankKeeper //IBCKeeper *ibckeeper.Keeper FeeMarketKeeper evmtypes.FeeMarketKeeper EvmKeeper evmante.EVMKeeper FeegrantKeeper authante.FeegrantKeeper CoinKeeper cointypes.CoinKeeper SignModeHandler authsigning.SignModeHandler SigGasConsumer func(meter sdk.GasMeter, sig signing.SignatureV2, params authtypes.Params) error Cdc codec.BinaryCodec MaxTxGasWanted uint64 }
HandlerOptions defines the list of module keepers required to run the Decimal AnteHandler decorators.
func (HandlerOptions) Validate ¶
func (options HandlerOptions) Validate() error
Validate checks if the keepers are defined
type SetUpContextDecorator ¶
type SetUpContextDecorator struct{}
SetUpContextDecorator sets the GasMeter in the Context and wraps the next AnteHandler with a defer clause to recover from any downstream OutOfGas panics in the AnteHandler chain to return an error with information on gas provided and gas used. CONTRACT: Must be first decorator in the chain CONTRACT: Tx must implement GasTx interface
func NewSetUpContextDecorator ¶
func NewSetUpContextDecorator() SetUpContextDecorator
func (SetUpContextDecorator) AnteHandle ¶
type ValidatorCommissionDecorator ¶
type ValidatorCommissionDecorator struct {
// contains filtered or unexported fields
}
ValidatorCommissionDecorator validates that the validator commission is always greater or equal than the min commission rate
func NewValidatorCommissionDecorator ¶
func NewValidatorCommissionDecorator(cdc codec.BinaryCodec) ValidatorCommissionDecorator
NewValidatorCommissionDecorator creates a new NewValidatorCommissionDecorator
func (ValidatorCommissionDecorator) AnteHandle ¶
func (vcd ValidatorCommissionDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simulate bool, next sdk.AnteHandler) (newCtx sdk.Context, err error)
AnteHandle checks if the tx contains a staking create validator or edit validator. It errors if the the commission rate is below the min threshold.