ante

package
v0.0.0-...-cc24d94 Latest Latest
Warning

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

Go to latest
Published: Dec 25, 2023 License: AGPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

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