ante

package
v0.0.0-...-8551cdf Latest Latest
Warning

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

Go to latest
Published: Jul 9, 2020 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DeductFees

func DeductFees(ctx sdk.Context, assetKeeper AssetKeeper, payer AccountID, fees Coins) error

DeductFees deducts fees from the given account.

func NewHandler

func NewHandler(ak keeper.AccountKeeper, asset AssetKeeper) sdk.AnteHandler

NewAnteHandler returns an AnteHandler that checks and increments sequence numbers, checks signatures & account numbers, and deducts fees from the first signer.

func SetGasMeter

func SetGasMeter(simulate bool, ctx sdk.Context, gasLimit uint64) sdk.Context

SetGasMeter returns a new context with a gas meter set from a given context.

Types

type AccountID

type AccountID = types.AccountID

type AccountKeeper

type AccountKeeper interface {
	GetAccount(ctx sdk.Context, id AccountID) exported.Account
}

type AssetKeeper

type AssetKeeper interface {
	PayFee(sdk.Context, types.AccountID, types.Coins) error
}

AssetKeeper

type Coin

type Coin = types.Coin

type Coins

type Coins = types.Coins

type ConsumeTxSizeGasDecorator

type ConsumeTxSizeGasDecorator struct {
}

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 types.StdSignature otherwise simulate mode will incorrectly estimate gas cost.

func NewConsumeGasForTxSizeDecorator

func NewConsumeGasForTxSizeDecorator() ConsumeTxSizeGasDecorator

func (ConsumeTxSizeGasDecorator) AnteHandle

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

type DeductFeeDecorator

type DeductFeeDecorator struct {
	// contains filtered or unexported fields
}

DeductFeeDecorator deducts fees from payer or the first signer of the tx

func NewDeductFeeDecorator

func NewDeductFeeDecorator(acc AccountKeeper, ak AssetKeeper) DeductFeeDecorator

func (DeductFeeDecorator) AnteHandle

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

type FeeTx

type FeeTx interface {
	sdk.Tx
	GetGas() uint64
	GetFee() Coins
	FeePayer() AccountID
}

FeeTx defines the interface to be implemented by Tx to use the FeeDecorators

type GasTx

type GasTx interface {
	sdk.Tx
	GetGas() uint64
}

GasTx defines a Tx with a GetGas() method which is needed to use SetUpContextDecorator

type IncrementSequenceDecorator

type IncrementSequenceDecorator struct {
	// contains filtered or unexported fields
}

func (IncrementSequenceDecorator) AnteHandle

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

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

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

type PluginHandlerDecorator

type PluginHandlerDecorator struct {
}

func NewPluginHandlerDecorator

func NewPluginHandlerDecorator() PluginHandlerDecorator

func (PluginHandlerDecorator) AnteHandle

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

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 keeper.AccountKeeper) SetPubKeyDecorator

func (SetPubKeyDecorator) AnteHandle

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

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

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

type SigVerifiableTx

type SigVerifiableTx interface {
	types.Tx
	GetSignatures() []types.StdSignature
	GetSigners() []types.AccAddress
}

SigVerifiableTx defines a Tx interface for all signature verification decorators

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 keeper.AccountKeeper) 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 StdTx

type StdTx = types.StdTx

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

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

Jump to

Keyboard shortcuts

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