Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BlockBuilderMetricsWrapper ¶
type BlockBuilderMetricsWrapper struct {
// contains filtered or unexported fields
}
BlockBuilderMetricsWrapper implements the module.Builder interface. It wraps a module.Builder instance and measures the time which HotStuff's core logic spends in the module.Builder component, i.e. the with generating block payloads. The measured time durations are reported as values for the PayloadProductionDuration metric.
func NewMetricsWrapper ¶
func NewMetricsWrapper(builder module.Builder, metrics module.HotstuffMetrics) *BlockBuilderMetricsWrapper
type BlockProducer ¶
type BlockProducer struct {
// contains filtered or unexported fields
}
BlockProducer is responsible for producing new block proposals. It is a service component to HotStuff's main state machine (implemented in the EventHandler). The BlockProducer's central purpose is to mediate concurrent signing requests to its embedded `hotstuff.SafetyRules` during block production. The actual work of producing a block proposal is delegated to the embedded `module.Builder`.
Context: BlockProducer is part of the `hostuff` package and can therefore be expected to comply with hotstuff-internal design patterns, such as there being a single dedicated thread executing the EventLoop, including EventHandler, SafetyRules, and BlockProducer. However, `module.Builder` lives in a different package! Therefore, we should make the least restrictive assumptions, and support concurrent signing requests within `module.Builder`. To minimize implementation dependencies and reduce the chance of safety-critical consensus bugs, BlockProducer wraps `SafetyRules` and mediates concurrent access. Furthermore, by supporting concurrent singing requests, we enable various optimizations of optimistic and/or upfront block production.
func New ¶
func New(safetyRules hotstuff.SafetyRules, committee hotstuff.Replicas, builder module.Builder) (*BlockProducer, error)
New creates a new BlockProducer, which mediates concurrent signing requests to the embedded `hotstuff.SafetyRules` during block production, delegated to `module.Builder`. No errors are expected during normal operation.
func (*BlockProducer) MakeBlockProposal ¶
func (bp *BlockProducer) MakeBlockProposal(view uint64, qc *flow.QuorumCertificate, lastViewTC *flow.TimeoutCertificate) (*flow.Header, error)
MakeBlockProposal builds a new HotStuff block proposal using the given view, the given quorum certificate for its parent and [optionally] a timeout certificate for last view(could be nil). No errors are expected during normal operation.