Documentation
¶
Index ¶
- func NoOpValidateVoteExtensions(_ sdk.Context, _ cometabci.ExtendedCommitInfo) error
- func ValidateExtendedCommitAgainstLastCommit(ec cometabci.ExtendedCommitInfo, lc comet.CommitInfo) error
- func ValidateOracleVoteExtension(ctx sdk.Context, ve vetypes.OracleVoteExtension, ...) error
- func ValidateVoteExtensions(ctx sdk.Context, valStore ValidatorStore, ...) error
- func VoteExtensionsEnabled(ctx sdk.Context) bool
- type ErrPanic
- type OracleClientError
- type PreBlockError
- type TransformPricesError
- type ValidateVoteExtensionError
- type ValidateVoteExtensionsFn
- type ValidatorStore
- type VoteExtensionHandler
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NoOpValidateVoteExtensions ¶
func NoOpValidateVoteExtensions( _ sdk.Context, _ cometabci.ExtendedCommitInfo, ) error
NoOpValidateVoteExtensions is a no-op validation method (purely used for testing).
func ValidateExtendedCommitAgainstLastCommit ¶
func ValidateExtendedCommitAgainstLastCommit(ec cometabci.ExtendedCommitInfo, lc comet.CommitInfo) error
ValidateExtendedCommitAgainstLastCommit validates an ExtendedCommitInfo against a LastCommit. Specifically, it checks that the ExtendedCommit + LastCommit (for the same height), are consistent with each other + that they are ordered correctly (by voting power) in accordance with comet(https://github.com/cometbft/cometbft/blob/4ce0277b35f31985bbf2c25d3806a184a4510010/types/validator_set.go#L784).
func ValidateOracleVoteExtension ¶
func ValidateOracleVoteExtension( ctx sdk.Context, ve vetypes.OracleVoteExtension, strategy currencypair.CurrencyPairStrategy, ) error
ValidateOracleVoteExtension validates the vote extension provided by a validator.
func ValidateVoteExtensions ¶
func ValidateVoteExtensions( ctx sdk.Context, valStore ValidatorStore, extCommit cometabci.ExtendedCommitInfo, ) error
ValidateVoteExtensions defines a helper function for verifying vote extension signatures that may be passed or manually injected into a block proposal from a proposer in PrepareProposal. It returns an error if any signature is invalid or if unexpected vote extensions and/or signatures are found or less than 2/3 power is received.
func VoteExtensionsEnabled ¶
VoteExtensionsEnabled determines if vote extensions are enabled for the current block. If vote extensions are enabled at height h, then a proposer will receive vote extensions in height h+1. This is primarily utilized by any module that needs to make state changes based on whether they were included in a proposal.
Types ¶
type ErrPanic ¶
type ErrPanic struct {
Err error
}
ErrPanic is an error that is returned when a panic occurs in the ABCI handler.
type OracleClientError ¶
type OracleClientError struct {
Err error
}
OracleClientError is an error that is returned when the oracle client's response is invalid.
func (OracleClientError) Error ¶
func (e OracleClientError) Error() string
func (OracleClientError) Label ¶
func (e OracleClientError) Label() string
type PreBlockError ¶
type PreBlockError struct {
Err error
}
PreBlockError is an error that is returned when the pre-block simulation fails.
func (PreBlockError) Error ¶
func (e PreBlockError) Error() string
func (PreBlockError) Label ¶
func (e PreBlockError) Label() string
type TransformPricesError ¶
type TransformPricesError struct {
Err error
}
TransformPricesError is an error that is returned when there is a failure in attempting to transform the prices returned from the oracle server to the format expected by the validator set.
func (TransformPricesError) Error ¶
func (e TransformPricesError) Error() string
func (TransformPricesError) Label ¶
func (e TransformPricesError) Label() string
type ValidateVoteExtensionError ¶
type ValidateVoteExtensionError struct {
Err error
}
ValidateVoteExtensionError is an error that is returned when there is a failure in validating a vote extension.
func (ValidateVoteExtensionError) Error ¶
func (e ValidateVoteExtensionError) Error() string
func (ValidateVoteExtensionError) Label ¶
func (e ValidateVoteExtensionError) Label() string
type ValidateVoteExtensionsFn ¶
type ValidateVoteExtensionsFn func( ctx sdk.Context, extInfo cometabci.ExtendedCommitInfo, ) error
ValidateVoteExtensionsFn defines the function for validating vote extensions. This function is not explicitly used to validate the oracle data but rather that the signed vote extensions included in the proposal are valid and provide a super-majority of vote extensions for the current block. This method is expected to be used in PrepareProposal and ProcessProposal.
func NewDefaultValidateVoteExtensionsFn ¶
func NewDefaultValidateVoteExtensionsFn(validatorStore ValidatorStore) ValidateVoteExtensionsFn
NewDefaultValidateVoteExtensionsFn returns a new DefaultValidateVoteExtensionsFn.
type ValidatorStore ¶
type ValidatorStore interface {
GetPubKeyByConsAddr(context.Context, sdk.ConsAddress) (cmtprotocrypto.PublicKey, error)
}
ValidatorStore defines the interface contract require for verifying vote extension signatures. Typically, this will be implemented by the x/staking module, which has knowledge of the CometBFT public key.
type VoteExtensionHandler ¶
type VoteExtensionHandler struct {
// contains filtered or unexported fields
}
VoteExtensionHandler is a handler that extends a vote with the oracle's current price feed. In the case where oracle data is unable to be fetched or correctly marshalled, the handler will return an empty vote extension to ensure liveliness.
func NewVoteExtensionHandler ¶
func NewVoteExtensionHandler( logger log.Logger, oracleClient slinkyabci.OracleClient, timeout time.Duration, strategy currencypair.CurrencyPairStrategy, codec compression.VoteExtensionCodec, priceApplier aggregator.PriceApplier, metrics servicemetrics.Metrics, ) *VoteExtensionHandler
NewVoteExtensionHandler returns a new VoteExtensionHandler.
func (*VoteExtensionHandler) ExtendVoteHandler ¶
func (h *VoteExtensionHandler) ExtendVoteHandler() sdk.ExtendVoteHandler
ExtendVoteHandler returns a handler that extends a vote with the oracle's current price feed. In the case where oracle data is unable to be fetched or correctly marshalled, the handler will return an empty vote extension to ensure liveness.
func (*VoteExtensionHandler) VerifyVoteExtensionHandler ¶
func (h *VoteExtensionHandler) VerifyVoteExtensionHandler() sdk.VerifyVoteExtensionHandler
VerifyVoteExtensionHandler returns a handler that verifies the vote extension provided by a validator is valid. In the case when the vote extension is empty, we return ACCEPT. This means that the validator may have been unable to fetch prices from the oracle and is voting an empty vote extension. We reject any vote extensions that are not empty and fail to unmarshal or contain invalid prices.