ante

package
v6.0.0 Latest Latest
Warning

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

Go to latest
Published: Sep 14, 2023 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const MaxOracleGasUsage = uint64(140_000)

MaxOracleGasUsage defines the maximum gas allowed for an oracle transaction.

Variables

This section is empty.

Functions

func AssertMinProtocolGasPrice

func AssertMinProtocolGasPrice(gasPrices sdk.DecCoins) error

AssertMinProtocolGasPrice returns an error if the provided gasPrices are lower then the required by protocol.

func FeeAndPriority

func FeeAndPriority(ctx sdk.Context, tx sdk.Tx) (sdk.Coins, int64, error)

FeeAndPriority ensures tx has enough fee coins to pay for the gas at the CheckTx time to early remove transactions from the mempool without enough attached fee. The validator min fee check is ignored if the tx contains only oracle messages and tx gas limit is <= MaxOracleMsgGasUsage. Essentially, validators can provide price transactison for free as long as the gas per message is in the MaxOracleMsgGasUsage limit.

func IsOracleOrGravityTx

func IsOracleOrGravityTx(msgs []sdk.Msg) bool

IsOracleOrGravityTx checks if all messages are oracle messages

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.

Types

type HandlerOptions

type HandlerOptions struct {
	AccountKeeper     cosmosante.AccountKeeper
	BankKeeper        types.BankKeeper
	FeegrantKeeper    cosmosante.FeegrantKeeper
	OracleKeeper      OracleKeeper
	IBCKeeper         *ibckeeper.Keeper
	SignModeHandler   signing.SignModeHandler
	SigGasConsumer    cosmosante.SignatureVerificationGasConsumer
	WasmConfig        *wasmTypes.WasmConfig
	TXCounterStoreKey storetypes.StoreKey
}

type OracleKeeper

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

OracleKeeper for feeder validation

type SpamPreventionDecorator

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

SpamPreventionDecorator defines a custom Umee AnteHandler decorator that is responsible for preventing oracle message spam. Specifically, it prohibits oracle feeders from submitting multiple oracle messages in a single block.

func NewSpamPreventionDecorator

func NewSpamPreventionDecorator(oracleKeeper OracleKeeper) *SpamPreventionDecorator

func (*SpamPreventionDecorator) AnteHandle

func (spd *SpamPreventionDecorator) AnteHandle(
	ctx sdk.Context,
	tx sdk.Tx,
	simulate bool,
	next sdk.AnteHandler,
) (newCtx sdk.Context, err error)

func (*SpamPreventionDecorator) CheckOracleSpam

func (spd *SpamPreventionDecorator) CheckOracleSpam(ctx sdk.Context, msgs []sdk.Msg) error

CheckOracleSpam performs the check of whether or not we've seen an oracle message from an oracle feeder in the current block or not. If we have, we return an error which prohibits the transaction from being processed.

Jump to

Keyboard shortcuts

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