Documentation ¶
Index ¶
- Constants
- func AssertMinProtocolGasPrice(gasPrices sdk.DecCoins) error
- func FeeAndPriority(ctx sdk.Context, tx sdk.Tx) (sdk.Coins, int64, error)
- func IsOracleTx(msgs []sdk.Msg) bool
- func NewAnteHandler(options HandlerOptions) (sdk.AnteHandler, error)
- type HandlerOptions
- type OracleKeeper
- type SpamPreventionDecorator
Constants ¶
const MaxMsgGasUsage = uint64(140_000)
MaxMsgGasUsage defines the maximum gas allowed for an oracle transaction.
Variables ¶
This section is empty.
Functions ¶
func AssertMinProtocolGasPrice ¶
AssertMinProtocolGasPrice returns an error if the provided gasPrices are lower then the required by protocol.
func FeeAndPriority ¶
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 <= MaxMsgGasUsage. Essentially, validators can provide price transactison for free as long as the gas per message is in the MaxMsgGasUsage limit.
func IsOracleTx ¶
IsOracleTx 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 *txsigning.HandlerMap SigGasConsumer cosmosante.SignatureVerificationGasConsumer 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 Ojo 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 (*SpamPreventionDecorator) CheckOracleSpam ¶
CheckOracleSpam performs the check of whether or not we've seen an oracle message from an oracle feeder in the current block. If we have, we return an error which prohibits the transaction from being processed.