Documentation ¶
Index ¶
Constants ¶
const (
// MaxUint64 is the maximum value of a uint64.
MaxUint64 = 1<<64 - 1
)
Variables ¶
This section is empty.
Functions ¶
Types ¶
type LaneLimits ¶
type LaneLimits struct { // MaxTxBytes is the maximum number of bytes allowed in the partial proposal. MaxTxBytes int64 // MaxGasLimit is the maximum gas limit allowed in the partial proposal. MaxGasLimit uint64 }
LaneLimits defines the constraints for a partial proposal. Each lane must only propose transactions that satisfy these constraints. Otherwise, the partial proposal update will be rejected.
type Proposal ¶
type Proposal struct { Logger log.Logger // Txs is the list of transactions in the proposal. Txs [][]byte // Cache is a cache of the selected transactions in the proposal. Cache map[string]struct{} // Info contains information about the state of the proposal. Info types.ProposalInfo }
Proposal defines a block proposal type.
func NewProposal ¶
NewProposal returns a new empty proposal. Any transactions added to the proposal will be subject to the given max block size and max gas limit.
func NewProposalWithContext ¶
NewProposalWithContext returns a new empty proposal.
func (*Proposal) GetLaneLimits ¶
func (p *Proposal) GetLaneLimits(ratio math.LegacyDec) LaneLimits
GetLaneLimits returns the maximum number of bytes and gas limit that can be included/consumed in the proposal for the given block space ratio. Lane's must first call this function to determine the maximum number of bytes and gas limit they can include in the proposal before constructing a partial proposal.
func (*Proposal) GetProposalWithInfo ¶
GetProposalWithInfo returns all of the transactions in the proposal along with information about the lanes that built the proposal.
NOTE: This is currently not used in production but likely will be once ABCI 3.0 is released.
func (*Proposal) UpdateProposal ¶
func (p *Proposal) UpdateProposal(lane Lane, partialProposal []utils.TxWithInfo) error
UpdateProposal updates the proposal with the given transactions and lane limits. There are a few invariants that are checked:
- The total size of the proposal must be less than the maximum number of bytes allowed.
- The total size of the partial proposal must be less than the maximum number of bytes allowed for the lane.
- The total gas limit of the proposal must be less than the maximum gas limit allowed.
- The total gas limit of the partial proposal must be less than the maximum gas limit allowed for the lane.
- The lane must not have already prepared a partial proposal.
- The transaction must not already be in the proposal.