Documentation ¶
Index ¶
- Constants
- func ConsumeMultisignatureVerificationGas(meter sdk.GasMeter, sig *signing.MultiSignatureData, pubkey multisig.PubKey, ...) error
- func CountSubKeys(pub cryptotypes.PubKey) int
- func DefaultSigVerificationGasConsumer(meter sdk.GasMeter, sig signing.SignatureV2, params types.Params) error
- func EnsureSufficientMempoolFees(ctx sdk.Context, gas uint64, feeCoins sdk.Coins, taxes sdk.Coins) error
- func FilterMsgAndComputeTax(ctx sdk.Context, tk TreasuryKeeper, msgs ...sdk.Msg) sdk.Coins
- func GetSignerAcc(ctx sdk.Context, ak cosmosante.AccountKeeper, addr sdk.AccAddress) (types.AccountI, error)
- func NewAnteHandler(options HandlerOptions) (sdk.AnteHandler, error)
- func OnlyLegacyAminoSigners(sigData signing.SignatureData) bool
- type HandlerOptions
- type IncrementSequenceDecorator
- type OracleKeeper
- type SetPubKeyDecorator
- type SigGasConsumeDecorator
- type SigVerificationDecorator
- type SignatureVerificationGasConsumer
- type SpammingPreventionDecorator
- type TaxFeeDecorator
- type TreasuryKeeper
- type ValidateSigCountDecorator
Constants ¶
const MaxOracleMsgGasUsage = uint64(100_000)
MaxOracleMsgGasUsage is constant expected oracle msg gas cost
Variables ¶
This section is empty.
Functions ¶
func ConsumeMultisignatureVerificationGas ¶ added in v0.5.19
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 ¶ added in v0.5.19
func CountSubKeys(pub cryptotypes.PubKey) int
CountSubKeys counts the total number of keys for a multi-sig public key.
func DefaultSigVerificationGasConsumer ¶ added in v0.5.19
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 EnsureSufficientMempoolFees ¶
func EnsureSufficientMempoolFees(ctx sdk.Context, gas uint64, feeCoins sdk.Coins, taxes sdk.Coins) error
EnsureSufficientMempoolFees verifies that the given transaction has supplied enough fees(gas + stability) to cover a proposer's minimum fees. A result object is returned indicating success or failure.
Contract: This should only be called during CheckTx as it cannot be part of consensus.
func FilterMsgAndComputeTax ¶
FilterMsgAndComputeTax computes the stability tax on MsgSend and MsgMultiSend.
func GetSignerAcc ¶ added in v0.5.19
func GetSignerAcc(ctx sdk.Context, ak cosmosante.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(options HandlerOptions) (sdk.AnteHandler, error)
NewAnteHandler returns an AnteHandler that checks and increments sequence numbers, checks signatures & account numbers, and deducts fees from the first signer.
func OnlyLegacyAminoSigners ¶ added in v0.5.19
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 HandlerOptions ¶
type HandlerOptions struct { AccountKeeper cosmosante.AccountKeeper BankKeeper types.BankKeeper FeegrantKeeper cosmosante.FeegrantKeeper OracleKeeper OracleKeeper TreasuryKeeper TreasuryKeeper SignModeHandler signing.SignModeHandler SigGasConsumer cosmosante.SignatureVerificationGasConsumer IBCChannelKeeper channelkeeper.Keeper }
HandlerOptions are the options required for constructing a default SDK AnteHandler.
type IncrementSequenceDecorator ¶ added in v0.5.19
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 ¶ added in v0.5.19
func NewIncrementSequenceDecorator(ak cosmosante.AccountKeeper) IncrementSequenceDecorator
func (IncrementSequenceDecorator) AnteHandle ¶ added in v0.5.19
type OracleKeeper ¶
type OracleKeeper interface {
ValidateFeeder(ctx sdk.Context, feederAddr sdk.AccAddress, validatorAddr sdk.ValAddress) error
}
OracleKeeper for feeder validation
type SetPubKeyDecorator ¶ added in v0.5.19
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 ¶ added in v0.5.19
func NewSetPubKeyDecorator(ak cosmosante.AccountKeeper) SetPubKeyDecorator
func (SetPubKeyDecorator) AnteHandle ¶ added in v0.5.19
type SigGasConsumeDecorator ¶ added in v0.5.19
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 ¶ added in v0.5.19
func NewSigGasConsumeDecorator(ak cosmosante.AccountKeeper, sigGasConsumer SignatureVerificationGasConsumer) SigGasConsumeDecorator
func (SigGasConsumeDecorator) AnteHandle ¶ added in v0.5.19
type SigVerificationDecorator ¶ added in v0.5.19
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 will not check signatures on ReCheck.
CONTRACT: Pubkeys are set in context for all signers before this decorator runs CONTRACT: Tx must implement SigVerifiableTx interface
func NewSigVerificationDecorator ¶ added in v0.5.19
func NewSigVerificationDecorator(ak cosmosante.AccountKeeper, signModeHandler authsigning.SignModeHandler) SigVerificationDecorator
func (SigVerificationDecorator) AnteHandle ¶ added in v0.5.19
type SignatureVerificationGasConsumer ¶ added in v0.5.19
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 SpammingPreventionDecorator ¶
type SpammingPreventionDecorator struct {
// contains filtered or unexported fields
}
SpammingPreventionDecorator will check if the transaction's gas is smaller than configured hard cap
func NewSpammingPreventionDecorator ¶
func NewSpammingPreventionDecorator(oracleKeeper OracleKeeper) SpammingPreventionDecorator
NewSpammingPreventionDecorator returns new spamming prevention decorator instance
func (SpammingPreventionDecorator) AnteHandle ¶
func (spd SpammingPreventionDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simulate bool, next sdk.AnteHandler) (newCtx sdk.Context, err error)
AnteHandle handles msg tax fee checking
func (SpammingPreventionDecorator) CheckOracleSpamming ¶
CheckOracleSpamming check whether the msgs are spamming purpose or not
type TaxFeeDecorator ¶
type TaxFeeDecorator struct {
// contains filtered or unexported fields
}
TaxFeeDecorator will check if the transaction's fee is at least as large as tax + the local validator's minimum gasFee (defined in validator config) and record tax proceeds to treasury module to track tax proceeds. 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 NewTaxFeeDecorator ¶
func NewTaxFeeDecorator(treasuryKeeper TreasuryKeeper) TaxFeeDecorator
NewTaxFeeDecorator returns new tax fee decorator instance
func (TaxFeeDecorator) AnteHandle ¶
func (tfd TaxFeeDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simulate bool, next sdk.AnteHandler) (newCtx sdk.Context, err error)
AnteHandle handles msg tax fee checking
type TreasuryKeeper ¶
type TreasuryKeeper interface { RecordEpochTaxProceeds(ctx sdk.Context, delta sdk.Coins) GetTaxRate(ctx sdk.Context) (taxRate sdk.Dec) GetTaxCap(ctx sdk.Context, denom string) (taxCap sdk.Int) }
TreasuryKeeper for tax charging & recording
type ValidateSigCountDecorator ¶ added in v0.5.19
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 ¶ added in v0.5.19
func NewValidateSigCountDecorator(ak cosmosante.AccountKeeper) ValidateSigCountDecorator