Documentation
¶
Index ¶
- Constants
- func ChainPrepareLanes(chain []block.Lane) block.PrepareLanesHandler
- func ChainProcessLanes(partialProposals [][][]byte, chain []block.Lane) block.ProcessLanesHandler
- type ProposalHandler
- func (h *ProposalHandler) ExtractLanes(proposal [][]byte) (types.ProposalInfo, [][][]byte, error)
- func (h *ProposalHandler) PrepareProposalHandler() sdk.PrepareProposalHandler
- func (h *ProposalHandler) ProcessProposalHandler() sdk.ProcessProposalHandler
- func (h *ProposalHandler) ValidateBlockLimits(finalProposal proposals.Proposal, proposalInfo types.ProposalInfo) error
Constants ¶
const (
// ProposalInfoIndex is the index of the proposal metadata in the proposal.
ProposalInfoIndex = 0
)
Variables ¶
This section is empty.
Functions ¶
func ChainPrepareLanes ¶
func ChainPrepareLanes(chain []block.Lane) block.PrepareLanesHandler
ChainPrepareLanes chains together the proposal preparation logic from each lane into a single function. The first lane in the chain is the first lane to be prepared and the last lane in the chain is the last lane to be prepared. In the case where any of the lanes fail to prepare the partial proposal, the lane that failed will be skipped and the next lane in the chain will be called to prepare the proposal.
func ChainProcessLanes ¶
func ChainProcessLanes(partialProposals [][][]byte, chain []block.Lane) block.ProcessLanesHandler
ChainProcessLanes chains together the proposal verification logic from each lane into a single function. The first lane in the chain is the first lane to be verified and the last lane in the chain is the last lane to be verified. Each lane will validate the transactions that it selected in the prepare phase.
Types ¶
type ProposalHandler ¶
type ProposalHandler struct {
// contains filtered or unexported fields
}
ProposalHandler is a wrapper around the ABCI++ PrepareProposal and ProcessProposal handlers.
func NewProposalHandler ¶
func NewProposalHandler( logger log.Logger, txDecoder sdk.TxDecoder, txEncoder sdk.TxEncoder, mempool block.Mempool, ) *ProposalHandler
NewProposalHandler returns a new ABCI++ proposal handler. This proposal handler will iteratively call each of the lanes in the chain to prepare and process the proposal.
func (*ProposalHandler) ExtractLanes ¶ added in v1.1.0
func (h *ProposalHandler) ExtractLanes(proposal [][]byte) (types.ProposalInfo, [][][]byte, error)
ExtractLanes validates the proposal against the basic invariants that are required for the proposal to be valid. This includes:
- The proposal must contain the proposal information and must be valid.
- The proposal must contain the correct number of transactions for each lane.
func (*ProposalHandler) PrepareProposalHandler ¶
func (h *ProposalHandler) PrepareProposalHandler() sdk.PrepareProposalHandler
PrepareProposalHandler prepares the proposal by selecting transactions from each lane according to each lane's selection logic. We select transactions in the order in which the lanes are configured on the chain. Note that each lane has an boundary on the number of bytes/gas that can be included in the proposal. By default, the default lane will not have a boundary on the number of bytes that can be included in the proposal and will include all valid transactions in the proposal (up to MaxBlockSize, MaxGasLimit).
func (*ProposalHandler) ProcessProposalHandler ¶
func (h *ProposalHandler) ProcessProposalHandler() sdk.ProcessProposalHandler
ProcessProposalHandler processes the proposal by verifying all transactions in the proposal according to each lane's verification logic. Proposals are verified similar to how they are constructed. After a proposal is processed, it should amount to the same proposal that was prepared. Each proposal will first be broken down by the lanes that prepared each partial proposal. Then, each lane will iteratively verify the transactions that it belong to it. If any lane fails to verify the transactions, then the proposal is rejected.
func (*ProposalHandler) ValidateBlockLimits ¶ added in v1.1.0
func (h *ProposalHandler) ValidateBlockLimits(finalProposal proposals.Proposal, proposalInfo types.ProposalInfo) error
ValidateBlockLimits validates the block limits of the proposal against the block limits of the chain.