Documentation
¶
Index ¶
- Constants
- Variables
- func DecodeValidateAndCacheVE(ctx sdk.Context, request *abci.RequestProcessProposal, ...) error
- func FullNodeProcessProposalHandler(txConfig client.TxConfig, bridgeKeeper ProcessBridgeKeeper, ...) sdk.ProcessProposalHandler
- func IsDisallowClobOrderMsgInOtherTxs(targetMsg sdk.Msg) bool
- func ProcessProposalHandler(txConfig client.TxConfig, bridgeKeeper ProcessBridgeKeeper, ...) sdk.ProcessProposalHandler
- type AcknowledgeBridgesTx
- type AddPremiumVotesTx
- type MultiMsgsTx
- type OtherMsgsTx
- type ProcessBridgeKeeper
- type ProcessClobKeeper
- type ProcessPerpetualKeeper
- type ProcessProposalTxs
- type ProcessProposalVEApplier
- type ProcessStakingKeeper
- type ProposedOperationsTx
- type SingleMsgTx
Constants ¶
const ConsensusRound = sdk.ContextKey("consensus_round")
const (
ModuleName = "process_proposal"
)
Variables ¶
var ( // 1 - 99: Default. ErrDecodingTxBytes = errorsmod.Register(ModuleName, 1, "Decoding tx bytes failed") ErrMsgValidateBasic = errorsmod.Register(ModuleName, 2, "ValidateBasic failed on msg") ErrUnexpectedNumMsgs = errorsmod.Register(ModuleName, 3, "Unexpected num of msgs") ErrUnexpectedMsgType = errorsmod.Register(ModuleName, 4, "Unexpected msg type") )
Functions ¶
func DecodeValidateAndCacheVE ¶
func DecodeValidateAndCacheVE( ctx sdk.Context, request *abci.RequestProcessProposal, veApplier ProcessProposalVEApplier, extCommitBz []byte, validateVoteExtensionFn ve.ValidateVEConsensusInfoFn, pricesKeeper ve.PreBlockExecPricesKeeper, yieldsKeeper ve.VoteExtensionYieldsKeeper, voteCodec codec.VoteExtensionCodec, extCodec codec.ExtendedCommitCodec, ) error
func FullNodeProcessProposalHandler ¶
func FullNodeProcessProposalHandler( txConfig client.TxConfig, bridgeKeeper ProcessBridgeKeeper, clobKeeper ProcessClobKeeper, stakingKeeper ProcessStakingKeeper, perpetualKeeper ProcessPerpetualKeeper, pricesKeeper ve.PreBlockExecPricesKeeper, ) sdk.ProcessProposalHandler
FullNodeProcessProposalHandler is the `ProcessProposal` implementation for full-nodes. This implementation calculates and reports MEV metrics and always returns `abci.ResponseProcessProposal_ACCEPT`. Validators within the validator set should never use this implementation.
func IsDisallowClobOrderMsgInOtherTxs ¶
IsDisallowClobOrderMsgInOtherTxs returns true if the given msg type is not allowed to be in a proposed block as part of OtherTxs. Otherwise, returns false.
func ProcessProposalHandler ¶
func ProcessProposalHandler( txConfig client.TxConfig, bridgeKeeper ProcessBridgeKeeper, clobKeeper ProcessClobKeeper, stakingKeeper ProcessStakingKeeper, perpetualKeeper ProcessPerpetualKeeper, pricesKeeper ve.PreBlockExecPricesKeeper, yieldsKeeper ve.VoteExtensionYieldsKeeper, extCodec codec.ExtendedCommitCodec, veCodec codec.VoteExtensionCodec, veApplier ProcessProposalVEApplier, validateVoteExtensionFn ve.ValidateVEConsensusInfoFn, ) sdk.ProcessProposalHandler
Note: stakingKeeper and perpetualKeeper are only needed for MEV calculations.
Types ¶
type AcknowledgeBridgesTx ¶
type AcknowledgeBridgesTx struct {
// contains filtered or unexported fields
}
AcknowledgeBridgesTx represents `MsgAcknowledgeBridge`s tx that can be validated.
func DecodeAcknowledgeBridgesTx ¶
func DecodeAcknowledgeBridgesTx( ctx sdk.Context, bridgeKeeper ProcessBridgeKeeper, decoder sdk.TxDecoder, txBytes []byte, ) (*AcknowledgeBridgesTx, error)
DecodeAcknowledgeBridgesTx returns a new `AcknowledgeBridgesTx` after validating the following:
- decodes the given tx bytes
- checks the msg is of expected type
If error occurs during any of the checks, returns error.
func (*AcknowledgeBridgesTx) GetMsg ¶
func (abt *AcknowledgeBridgesTx) GetMsg() sdk.Msg
GetMsg returns the underlying `MsgAcknowledgeBridges`.
func (*AcknowledgeBridgesTx) Validate ¶
func (abt *AcknowledgeBridgesTx) Validate() error
Validate returns an error if: - msg fails `ValidateBasic`. - bridge events are non empty and bridging is disabled. - first bridge event ID is not the one to be next acknowledged. - last bridge event ID has not been recognized. - a bridge event's content is not the same as in server state.
type AddPremiumVotesTx ¶
type AddPremiumVotesTx struct {
// contains filtered or unexported fields
}
AddPremiumVotesTx represents `MsgAddPremiumVotes` tx that can be validated.
func DecodeAddPremiumVotesTx ¶
func DecodeAddPremiumVotesTx(decoder sdk.TxDecoder, txBytes []byte) (*AddPremiumVotesTx, error)
DecodeAddPremiumVotesTx returns a new `AddPremiumVotesTx` after validating the following:
- decodes the given tx bytes
- checks the num of msgs in the tx matches expectations
- checks the msg is of expected type
If error occurs during any of the checks, returns error.
func (*AddPremiumVotesTx) GetMsg ¶
func (afst *AddPremiumVotesTx) GetMsg() sdk.Msg
GetMsg returns the underlying `MsgAddPremiumVotes`.
func (*AddPremiumVotesTx) Validate ¶
func (afst *AddPremiumVotesTx) Validate() error
Validate returns an error if the underlying msg fails `ValidateBasic`.
type MultiMsgsTx ¶
type MultiMsgsTx interface { // Validate checks if the underlying msgs are valid or not. // Returns error if one of the msgs is invalid. Otherwise, returns nil. Validate() error // GetMsgs returns the underlying msgs in the tx. GetMsgs() []sdk.Msg }
MultiMsgsTx represents a tx with multiple msgs.
type OtherMsgsTx ¶
type OtherMsgsTx struct {
// contains filtered or unexported fields
}
OtherMsgsTx represents tx msgs in the "other" category that can be validated.
func DecodeOtherMsgsTx ¶
func DecodeOtherMsgsTx(decoder sdk.TxDecoder, txBytes []byte) (*OtherMsgsTx, error)
DecodeOtherMsgsTx returns a new `OtherMsgsTx` after validating the following:
- decodes the given tx bytes
- checks the num of msgs in the tx is not 0
- checks the msgs do not contain "app-injected msgs" or "internal msgs" or "unsupported msgs"
- checks the msgs do not contain "nested msgs" that fail `ValidateNestedMsg`
- checks the msgs do not contain top-level msgs that are not allowed in OtherTxs
If error occurs during any of the checks, returns error.
func (*OtherMsgsTx) GetMsgs ¶
func (omt *OtherMsgsTx) GetMsgs() []sdk.Msg
GetMsgs returns the underlying msgs in the tx.
func (*OtherMsgsTx) Validate ¶
func (omt *OtherMsgsTx) Validate() error
Validate returns an error if one of the underlying msgs fails `ValidateBasic`.
type ProcessBridgeKeeper ¶
type ProcessBridgeKeeper interface { GetAcknowledgedEventInfo( ctx sdk.Context, ) (acknowledgedEventInfo bridgetypes.BridgeEventInfo) GetRecognizedEventInfo( ctx sdk.Context, ) (recognizedEventInfo bridgetypes.BridgeEventInfo) GetBridgeEventFromServer(ctx sdk.Context, id uint32) (event bridgetypes.BridgeEvent, found bool) GetSafetyParams(ctx sdk.Context) (safetyParams bridgetypes.SafetyParams) }
ProcessBridgeKeeper defines the expected bridge keeper used for `ProcessProposal`.
type ProcessClobKeeper ¶
type ProcessClobKeeper interface { RecordMevMetricsIsEnabled() bool RecordMevMetrics( ctx sdk.Context, stakingKeeper ProcessStakingKeeper, perpetualKeeper ProcessPerpetualKeeper, msgProposedOperations *types.MsgProposedOperations, ) }
ProcessClobKeeper defines the expected clob keeper used for `ProcessProposal`.
type ProcessPerpetualKeeper ¶
type ProcessPerpetualKeeper interface { MaybeProcessNewFundingTickEpoch(ctx sdk.Context) GetSettlementPpm( ctx sdk.Context, perpetualId uint32, quantums *big.Int, index *big.Int, ) ( bigNetSettlementPpm *big.Int, newFundingIndex *big.Int, err error, ) GetPerpetual(ctx sdk.Context, id uint32) (val perptypes.Perpetual, err error) }
ProcessPerpetualKeeper defines the expected perpetual keeper used for `ProcessProposal`.
type ProcessProposalTxs ¶
type ProcessProposalTxs struct { // Single msg txs. ProposedOperationsTx *ProposedOperationsTx AcknowledgeBridgesTx *AcknowledgeBridgesTx AddPremiumVotesTx *AddPremiumVotesTx // Multi msgs txs. OtherTxs []*OtherMsgsTx }
TODO: add extInfo into this and use to decode (cleanup) ProcessProposalTxs is used as an intermediary struct to validate a proposed list of txs for `ProcessProposal`.
func DecodeProcessProposalTxs ¶
func DecodeProcessProposalTxs( ctx sdk.Context, decoder sdk.TxDecoder, req *abci.RequestProcessProposal, bridgeKeeper ProcessBridgeKeeper, pricesKeeper ve.PreBlockExecPricesKeeper, ) (*ProcessProposalTxs, error)
DecodeProcessProposalTxs returns a new `processProposalTxs`.
func (*ProcessProposalTxs) Validate ¶
func (ppt *ProcessProposalTxs) Validate() error
Validate performs `ValidateBasic` on the underlying msgs that are part of the txs. Returns nil if all are valid. Otherwise, returns error.
Exception: for UpdateMarketPricesTx, we perform "in-memory stateful" validation to ensure that the new proposed prices are "valid" in comparison to daemon prices.
type ProcessStakingKeeper ¶
type ProcessStakingKeeper interface {
GetValidatorByConsAddr(ctx context.Context, consAddr sdk.ConsAddress) (validator stakingtypes.Validator, err error)
}
ProcessStakingKeeper defines the expected staking keeper used for `ProcessProposal`.
type ProposedOperationsTx ¶
type ProposedOperationsTx struct {
// contains filtered or unexported fields
}
ProposedOperationsTx represents `MsgProposedOperations` tx that can be validated.
func DecodeProposedOperationsTx ¶
func DecodeProposedOperationsTx(decoder sdk.TxDecoder, txBytes []byte) (*ProposedOperationsTx, error)
DecodeProposedOperationsTx returns a new `ProposedOperationsTx` after validating the following:
- decodes the given tx bytes
- checks the num of msgs in the tx matches expectations
- checks the msg is of expected type
If error occurs during any of the checks, returns error.
func (*ProposedOperationsTx) GetMsg ¶
func (pmot *ProposedOperationsTx) GetMsg() sdk.Msg
GetMsg returns the underlying `MsgProposedOperations`.
func (*ProposedOperationsTx) Validate ¶
func (pmot *ProposedOperationsTx) Validate() error
Validate returns an error if the underlying msg fails `ValidateBasic`.
type SingleMsgTx ¶
type SingleMsgTx interface { // validate checks if the underlying msg is valid or not. // Returns error if invalid. Otherwise, returns nil. Validate() error // getMsg returns the underlying msg in the tx. GetMsg() sdk.Msg }
SingleMsgTx represents a tx with a single msg.