Documentation
¶
Index ¶
- Variables
- func IsMarketUpdateTx(tx sdk.Tx) (bool, error)
- func ShouldSkipSequenceValidation(msgs []sdk.Msg) (shouldSkipValidation bool)
- type EmitPubKeyEventsDecorator
- type FreeInfiniteGasDecorator
- type MarketMapKeeper
- type ReplayProtectionDecorator
- type SigVerificationDecorator
- type ValidateMarketUpdateDecorator
- type ValidateMsgTypeDecorator
Constants ¶
This section is empty.
Variables ¶
var ErrRestrictedMarketUpdates = errors.New("cannot call MsgUpdateMarkets or MsgUpsertMarkets " +
"on a restricted market")
Functions ¶
func IsMarketUpdateTx ¶
IsMarketUpdateTx returns `true` if the supplied `tx` consists of a single MsgUpdateMarkets or MsgUpsertMarkets
func ShouldSkipSequenceValidation ¶
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 EmitPubKeyEventsDecorator ¶
type EmitPubKeyEventsDecorator struct{}
NewEmitPubKeyEventsDecorator emits events for each signer's public key. CONTRACT: Tx must implement SigVerifiableTx interface
func NewEmitPubKeyEventsDecorator ¶
func NewEmitPubKeyEventsDecorator() EmitPubKeyEventsDecorator
func (EmitPubKeyEventsDecorator) AnteHandle ¶
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 ¶
type MarketMapKeeper ¶
type ReplayProtectionDecorator ¶
type ReplayProtectionDecorator struct {
// contains filtered or unexported fields
}
func NewReplayProtectionDecorator ¶
func NewReplayProtectionDecorator( ak sdkante.AccountKeeper, akp accountpluskeeper.Keeper, ) ReplayProtectionDecorator
func (ReplayProtectionDecorator) AnteHandle ¶
type SigVerificationDecorator ¶
type SigVerificationDecorator struct {
// contains filtered or unexported fields
}
SigVerificationDecorator verifies 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 *txsigning.HandlerMap, ) SigVerificationDecorator
func (SigVerificationDecorator) AnteHandle ¶
type ValidateMarketUpdateDecorator ¶
type ValidateMarketUpdateDecorator struct {
// contains filtered or unexported fields
}
func NewValidateMarketUpdateDecorator ¶
func NewValidateMarketUpdateDecorator( perpKeeper perpetualstypes.PerpetualsKeeper, priceKeeper pricestypes.PricesKeeper, marketMapKeeper MarketMapKeeper, ) ValidateMarketUpdateDecorator
NewValidateMarketUpdateDecorator returns an AnteDecorator that is able to check for x/marketmap update messages and reject them if they are updating cross margin markets.
NOTE: this is a stop-gap solution before more general functionality is added to x/marketmap to delay and gate certain update operations.
func (ValidateMarketUpdateDecorator) AnteHandle ¶
func (d ValidateMarketUpdateDecorator) AnteHandle( ctx sdk.Context, tx sdk.Tx, simulate bool, next sdk.AnteHandler, ) (newCtx sdk.Context, err error)
AnteHandle performs the following checks: - check if tx contains x/marketmap/MsgUpdateMarkets or x/marketmap/MsgUpsertMarkets - check if the given Tx has more than one message if it has x/marketmap updates, reject if so - check if the x/marketmap update affects markets that are registered as cross margin in x/perpetuals, reject if so.
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