ante

package
v0.3.6-dev1 Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2023 License: AGPL-3.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

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.

func ShouldSkipSequenceValidation

func ShouldSkipSequenceValidation(msgs []sdk.Msg) (shouldSkipValidation bool)

ShouldSkipSequenceValidation returns whether sequence validation can be skipped for a given list of messages. If the transaction consists of only messages which use `GoodTilBlock` to prevent transaction replay, the sequence numbers for this transaction won't get incremented and verified.

Important: ALL messages from a transaction must use `GoodTilBlock` in order to skip sequence number validation. Otherwise, attackers can create transactions with a single `GoodTilBlock` message, followed by any number of messages that they wish to be replayed which normally use sequence numbers. This would cause the sequence validation to be skipped for all of those messages and this transaction could be replayed.

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 FeegrantKeeper

type FeegrantKeeper interface {
	UseGrantedFees(ctx sdk.Context, granter, grantee sdk.AccAddress, fee sdk.Coins, msgs []sdk.Msg) error
}

FeegrantKeeper defines the expected feegrant keeper.

type FreeInfiniteGasDecorator

type FreeInfiniteGasDecorator struct {
}

FreeInfiniteGasDecorator is an AnteHandler that sets `GasMeter` to `FreeInfiniteGasMeter` for off-chain single clob msg transactions, and app-injected transactions. These transactions should not use any gas, and the sender should not be charged any gas. Using this meter means gas will never be consumed for these transactions. Also note that not explicitly setting a `gasMeter` means that the `gasMeter` from the previous transaction or from `BeginBlock` will be used. Not doing this could result in consensus failure as demonstrated in #869. Cosmos SDK expects an explicit call to `WithGasMeter` at the beginning of the AnteHandler chain.

func NewFreeInfiniteGasDecorator

func NewFreeInfiniteGasDecorator() FreeInfiniteGasDecorator

func (FreeInfiniteGasDecorator) AnteHandle

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

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 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

func NewSigVerificationDecorator(
	ak AccountKeeper,
	signModeHandler authsigning.SignModeHandler,
) SigVerificationDecorator

func (SigVerificationDecorator) AnteHandle

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

type ValidateMsgTypeDecorator

type ValidateMsgTypeDecorator struct{}

ValidateMsgTypeDecorator checks that the tx has the expected message types. Specifically, if the list of msgs in the tx contains an "app-injected message", the tx must only contain a single message. This decorator will not get exeuted on ReCheckTx since it does not depend on app state.

func NewValidateMsgTypeDecorator

func NewValidateMsgTypeDecorator() ValidateMsgTypeDecorator

func (ValidateMsgTypeDecorator) AnteHandle

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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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