Documentation ¶
Index ¶
- func ConsumeMultisignatureVerificationGas(meter sdk.GasMeter, sig *signing.MultiSignatureData, pubkey multisig.PubKey, ...) error
- func CountSubKeys(pub cryptotypes.PubKey) int
- func DeductFees(bankKeeper types.BankKeeper, ctx sdk.Context, acc types.AccountI, ...) error
- func DefaultSigVerificationGasConsumer(meter sdk.GasMeter, sig signing.SignatureV2, params types.Params) error
- func GetSignerAcc(ctx sdk.Context, ak AccountKeeper, addr sdk.AccAddress) (types.AccountI, error)
- func NewAnteHandler(ak AccountKeeper, bankKeeper types.BankKeeper, ...) sdk.AnteHandler
- func OnlyLegacyAminoSigners(sigData signing.SignatureData) bool
- func SetGasMeter(simulate bool, ctx sdk.Context, gasLimit uint64) sdk.Context
- type AccountKeeper
- type ConsumeTxSizeGasDecorator
- type DeductFeeDecorator
- type GasTx
- type HasExtensionOptionsTx
- type IncrementSequenceDecorator
- type MempoolFeeDecorator
- type RejectExtensionOptionsDecorator
- type RejectFeeGranterDecorator
- type SetPubKeyDecorator
- type SetUpContextDecorator
- type SigGasConsumeDecorator
- type SigVerificationDecorator
- type SignatureVerificationGasConsumer
- type TxTimeoutHeightDecorator
- type TxWithTimeoutHeight
- type ValidateBasicDecorator
- type ValidateMemoDecorator
- type ValidateSigCountDecorator
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ConsumeMultisignatureVerificationGas ¶
func ConsumeMultisignatureVerificationGas( meter sdk.GasMeter, sig *signing.MultiSignatureData, pubkey multisig.PubKey, params types.Params, accSeq uint64, ) error
ConsumeMultisignatureVerificationGas consumes gas from a GasMeter for verifying a multisig pubkey signature
func CountSubKeys ¶
func CountSubKeys(pub cryptotypes.PubKey) int
CountSubKeys counts the total number of keys for a multi-sig public key.
func DeductFees ¶
func DeductFees(bankKeeper types.BankKeeper, ctx sdk.Context, acc types.AccountI, fees sdk.Coins) error
DeductFees deducts fees from the given account.
func DefaultSigVerificationGasConsumer ¶
func DefaultSigVerificationGasConsumer( meter sdk.GasMeter, sig signing.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 GetSignerAcc ¶
func GetSignerAcc(ctx sdk.Context, ak AccountKeeper, addr sdk.AccAddress) (types.AccountI, error)
GetSignerAcc returns an account for a given address that is expected to sign a transaction.
func NewAnteHandler ¶
func NewAnteHandler( ak AccountKeeper, bankKeeper types.BankKeeper, sigGasConsumer SignatureVerificationGasConsumer, signModeHandler signing.SignModeHandler, ) sdk.AnteHandler
NewAnteHandler returns an AnteHandler that checks and increments sequence numbers, checks signatures & account numbers, and deducts fees from the first signer.
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 AccountKeeper ¶
type AccountKeeper interface { GetParams(ctx sdk.Context) (params types.Params) GetAccount(ctx sdk.Context, addr sdk.AccAddress) types.AccountI SetAccount(ctx sdk.Context, acc types.AccountI) GetModuleAddress(moduleName string) sdk.AccAddress }
AccountKeeper defines the contract needed for AccountKeeper related APIs. Interface provides support to use non-sdk AccountKeeper for AnteHandler's decorators.
type ConsumeTxSizeGasDecorator ¶
type ConsumeTxSizeGasDecorator struct {
// contains filtered or unexported fields
}
ConsumeTxSizeGasDecorator will take in parameters and consume gas proportional to the size of tx before calling next AnteHandler. Note, the gas costs will be slightly over estimated due to the fact that any given signing account may need to be retrieved from state.
CONTRACT: If simulate=true, then signatures must either be completely filled in or empty. CONTRACT: To use this decorator, signatures of transaction must be represented as legacytx.StdSignature otherwise simulate mode will incorrectly estimate gas cost.
func NewConsumeGasForTxSizeDecorator ¶
func NewConsumeGasForTxSizeDecorator(ak AccountKeeper) ConsumeTxSizeGasDecorator
func (ConsumeTxSizeGasDecorator) AnteHandle ¶
type DeductFeeDecorator ¶
type DeductFeeDecorator struct {
// contains filtered or unexported fields
}
DeductFeeDecorator 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
func NewDeductFeeDecorator ¶
func NewDeductFeeDecorator(ak AccountKeeper, bk types.BankKeeper) DeductFeeDecorator
func (DeductFeeDecorator) AnteHandle ¶
type HasExtensionOptionsTx ¶
type HasExtensionOptionsTx interface { GetExtensionOptions() []*codectypes.Any GetNonCriticalExtensionOptions() []*codectypes.Any }
type IncrementSequenceDecorator ¶
type IncrementSequenceDecorator struct {
// contains filtered or unexported fields
}
IncrementSequenceDecorator handles incrementing sequences of all signers. Use the IncrementSequenceDecorator decorator to prevent replay attacks. Note, there is no need to execute IncrementSequenceDecorator on RecheckTX since CheckTx would already bump the sequence number.
NOTE: Since CheckTx and DeliverTx state are managed separately, subsequent and sequential txs orginating from the same account cannot be handled correctly in a reliable way unless sequence numbers are managed and tracked manually by a client. It is recommended to instead use multiple messages in a tx.
func NewIncrementSequenceDecorator ¶
func NewIncrementSequenceDecorator(ak AccountKeeper) IncrementSequenceDecorator
func (IncrementSequenceDecorator) AnteHandle ¶
type MempoolFeeDecorator ¶
type MempoolFeeDecorator struct{}
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() MempoolFeeDecorator
func (MempoolFeeDecorator) AnteHandle ¶
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 types.Context, tx types.Tx, simulate bool, next types.AnteHandler) (newCtx types.Context, err error)
AnteHandle implements the AnteDecorator.AnteHandle method
type RejectFeeGranterDecorator ¶
type RejectFeeGranterDecorator struct{}
RejectFeeGranterDecorator is an AnteDecorator which rejects transactions which have the Fee.granter field set. It is to be used by chains which do not support fee grants.
func NewRejectFeeGranterDecorator ¶
func NewRejectFeeGranterDecorator() RejectFeeGranterDecorator
NewRejectFeeGranterDecorator returns a new RejectFeeGranterDecorator.
func (RejectFeeGranterDecorator) AnteHandle ¶
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 AccountKeeper) SetPubKeyDecorator
func (SetPubKeyDecorator) AnteHandle ¶
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 SigGasConsumeDecorator ¶
type SigGasConsumeDecorator struct {
// contains filtered or unexported fields
}
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 NewSigGasConsumeDecorator ¶
func NewSigGasConsumeDecorator(ak AccountKeeper, sigGasConsumer SignatureVerificationGasConsumer) SigGasConsumeDecorator
func (SigGasConsumeDecorator) AnteHandle ¶
type SigVerificationDecorator ¶
type SigVerificationDecorator struct {
// contains filtered or unexported fields
}
Verify all signatures for a tx and return an error if any are invalid. Note, the SigVerificationDecorator decorator will not get executed on ReCheck.
CONTRACT: Pubkeys are set in context for all signers before this decorator runs CONTRACT: Tx must implement SigVerifiableTx interface
func NewSigVerificationDecorator ¶
func NewSigVerificationDecorator(ak AccountKeeper, signModeHandler authsigning.SignModeHandler) SigVerificationDecorator
func (SigVerificationDecorator) AnteHandle ¶
type SignatureVerificationGasConsumer ¶
type SignatureVerificationGasConsumer = func(meter sdk.GasMeter, sig signing.SignatureV2, params types.Params) error
SignatureVerificationGasConsumer is the type of function that is used to both consume gas when verifying signatures and also to accept or reject different types of pubkeys This is where apps can define their own PubKey
type TxTimeoutHeightDecorator ¶
type TxTimeoutHeightDecorator struct{}
TxTimeoutHeightDecorator defines an AnteHandler decorator that checks for a tx height timeout.
func (TxTimeoutHeightDecorator) AnteHandle ¶
func (txh TxTimeoutHeightDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simulate bool, next sdk.AnteHandler) (sdk.Context, error)
AnteHandle implements an AnteHandler decorator for the TxHeightTimeoutDecorator type where the current block height is checked against the tx's height timeout. If a height timeout is provided (non-zero) and is less than the current block height, then an error is returned.
type TxWithTimeoutHeight ¶
TxWithTimeoutHeight defines the interface a tx must implement in order for TxHeightTimeoutDecorator to process the tx.
type ValidateBasicDecorator ¶
type ValidateBasicDecorator struct{}
ValidateBasicDecorator will call tx.ValidateBasic and return any non-nil error. If ValidateBasic passes, decorator calls next AnteHandler in chain. Note, ValidateBasicDecorator decorator will not get executed on ReCheckTx since it is not dependent on application state.
func NewValidateBasicDecorator ¶
func NewValidateBasicDecorator() ValidateBasicDecorator
func (ValidateBasicDecorator) AnteHandle ¶
type ValidateMemoDecorator ¶
type ValidateMemoDecorator struct {
// contains filtered or unexported fields
}
ValidateMemoDecorator will validate memo given the parameters passed in If memo is too large decorator returns with error, otherwise call next AnteHandler CONTRACT: Tx must implement TxWithMemo interface
func NewValidateMemoDecorator ¶
func NewValidateMemoDecorator(ak AccountKeeper) ValidateMemoDecorator
func (ValidateMemoDecorator) AnteHandle ¶
type ValidateSigCountDecorator ¶
type ValidateSigCountDecorator struct {
// contains filtered or unexported fields
}
ValidateSigCountDecorator takes in Params and returns errors if there are too many signatures in the tx for the given params otherwise it calls next AnteHandler Use this decorator to set parameterized limit on number of signatures in tx CONTRACT: Tx must implement SigVerifiableTx interface
func NewValidateSigCountDecorator ¶
func NewValidateSigCountDecorator(ak AccountKeeper) ValidateSigCountDecorator