Documentation ¶
Index ¶
- type InvalidExtendedCommitInfoError
- type Option
- type ProposalHandler
- func (h *ProposalHandler) PrepareProposalHandler() sdk.PrepareProposalHandler
- func (h *ProposalHandler) ProcessProposalHandler() sdk.ProcessProposalHandler
- func (h *ProposalHandler) PruneAndValidateExtendedCommitInfo(ctx sdk.Context, extendedCommitInfo cometabci.ExtendedCommitInfo) (cometabci.ExtendedCommitInfo, error)
- func (h *ProposalHandler) ValidateExtendedCommitInfo(ctx sdk.Context, height int64, extendedCommitInfo cometabci.ExtendedCommitInfo) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type InvalidExtendedCommitInfoError ¶
type InvalidExtendedCommitInfoError struct {
Err error
}
InvalidExtendedCommitInfoError is an error that is returned when a proposed ExtendedCommitInfo is invalid.
func (InvalidExtendedCommitInfoError) Error ¶
func (e InvalidExtendedCommitInfoError) Error() string
func (InvalidExtendedCommitInfoError) Label ¶
func (e InvalidExtendedCommitInfoError) Label() string
type Option ¶
type Option func(*ProposalHandler)
Option is a function that enables optional configuration of the ProposalHandler.
func RetainOracleDataInWrappedProposalHandler ¶
func RetainOracleDataInWrappedProposalHandler() Option
RetainOracleDataInWrappedProposalHandler returns an Option that configures the ProposalHandler to pass the injected extend-commit-info to the wrapped proposal handler.
type ProposalHandler ¶
type ProposalHandler struct {
// contains filtered or unexported fields
}
ProposalHandler is responsible primarily for:
- Filling a proposal with transactions.
- Injecting vote extensions into the proposal (if vote extensions are enabled).
- Verifying that the vote extensions injected are valid.
To verify the validity of the vote extensions, the proposal handler will call the validateVoteExtensionsFn. This function is responsible for verifying that the vote extensions included in the proposal are valid and compose a super-majority of signatures and vote extensions for the current block. The given VoteExtensionCodec must be the same used by the VoteExtensionHandler, the extended commit is decoded in accordance with the given ExtendedCommitCodec.
func NewProposalHandler ¶
func NewProposalHandler( logger log.Logger, prepareProposalHandler sdk.PrepareProposalHandler, processProposalHandler sdk.ProcessProposalHandler, validateVoteExtensionsFn ve.ValidateVoteExtensionsFn, voteExtensionCodec codec.VoteExtensionCodec, extendedCommitInfoCodec codec.ExtendedCommitCodec, currencyPairStrategy currencypair.CurrencyPairStrategy, metrics servicemetrics.Metrics, opts ...Option, ) *ProposalHandler
NewProposalHandler returns a new ProposalHandler.
func (*ProposalHandler) PrepareProposalHandler ¶
func (h *ProposalHandler) PrepareProposalHandler() sdk.PrepareProposalHandler
PrepareProposalHandler returns a PrepareProposalHandler that will be called by base app when a new block proposal is requested. The PrepareProposalHandler will first fill the proposal with transactions. Then, if vote extensions are enabled, the handler will inject the extended commit info into the proposal. If the size of the vote extensions exceed the requests MaxTxBytes size, this handler will fail.
func (*ProposalHandler) ProcessProposalHandler ¶
func (h *ProposalHandler) ProcessProposalHandler() sdk.ProcessProposalHandler
ProcessProposalHandler returns a ProcessProposalHandler that will be called by base app when a new block proposal needs to be verified. The ProcessProposalHandler will verify that the vote extensions included in the proposal are valid and compose a super-majority of signatures and vote extensions for the current block.
func (*ProposalHandler) PruneAndValidateExtendedCommitInfo ¶
func (h *ProposalHandler) PruneAndValidateExtendedCommitInfo( ctx sdk.Context, extendedCommitInfo cometabci.ExtendedCommitInfo, ) (cometabci.ExtendedCommitInfo, error)
PruneAndValidateExtendedCommitInfo validates each vote-extension in the extended commit, and removes any vote-extensions that are invalid. Removal will effectively treat the validator's vote as absent. This function performs all validation that ValidateExtendedCommitInfo performs.
func (*ProposalHandler) ValidateExtendedCommitInfo ¶
func (h *ProposalHandler) ValidateExtendedCommitInfo( ctx sdk.Context, height int64, extendedCommitInfo cometabci.ExtendedCommitInfo, ) error
ValidateExtendedCommitInfo validates the extended commit info for a block. It first ensures that the vote extensions compose a super-majority of the signatures and voting power for the block. Then, it ensures that oracle vote extensions are correctly marshalled and contain valid prices.