ante

package
v0.4.6 Latest Latest
Warning

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

Go to latest
Published: Apr 14, 2021 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const FlagTxGasHardLimit = "tx-gas-hard-limit"

FlagTxGasHardLimit defines the hard cap to prevent tx spamming attack

Variables

This section is empty.

Functions

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

func FilterMsgAndComputeTax(ctx sdk.Context, tk TreasuryKeeper, msgs []sdk.Msg) sdk.Coins

FilterMsgAndComputeTax computes the stability tax on MsgSend and MsgMultiSend.

func NewAnteHandler

func NewAnteHandler(
	ak keeper.AccountKeeper,
	supplyKeeper types.SupplyKeeper,
	oracleKeeper OracleKeeper,
	treasuryKeeper TreasuryKeeper,
	sigGasConsumer cosmosante.SignatureVerificationGasConsumer) sdk.AnteHandler

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

Types

type FeeTx

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

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

type OracleKeeper added in v0.4.5

type OracleKeeper interface {
	ValidateFeeder(ctx sdk.Context, feederAddr sdk.AccAddress, validatorAddr sdk.ValAddress, checkBonded bool) error
}

OracleKeeper for feeder validation

type SpammingPreventionDecorator added in v0.4.3

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

SpammingPreventionDecorator will check if the transaction's gas is smaller than configured hard cap

func NewSpammingPreventionDecorator added in v0.4.3

func NewSpammingPreventionDecorator(oracleKeeper OracleKeeper) SpammingPreventionDecorator

NewSpammingPreventionDecorator returns new spamming prevention decorator instance

func (SpammingPreventionDecorator) AnteHandle added in v0.4.3

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 added in v0.4.5

func (spd SpammingPreventionDecorator) CheckOracleSpamming(ctx sdk.Context, msgs []sdk.Msg) error

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

Jump to

Keyboard shortcuts

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