@@ -13,12 +13,12 @@ import (
1313
1414// BFT is a structure that holds data for a Hotstuff BFT instance
1515type BFT struct {
16- * lib.View // the current period during which the BFT is occurring (CreatedHeight /Round/Phase)
16+ * lib.View // the current period during which the BFT is occurring (Height /Round/Phase)
1717 Votes VotesForHeight // 'votes' received from Replica (non-leader) Validators
1818 Proposals ProposalsForHeight // 'proposals' received from the Leader Validator(s)
1919 ProposerKey []byte // the public key of the proposer
2020 ValidatorSet ValSet // the current set of Validators
21- HighQC * QC // the highest PRECOMMIT quorum certificate the node is aware of for this CreatedHeight
21+ HighQC * QC // the highest PRECOMMIT quorum certificate the node is aware of for this Height
2222 Block []byte // the current Block being voted on (the foundational unit of the blockchain)
2323 BlockHash []byte // the current hash of the block being voted on
2424 Results * lib.CertificateResult // the current Result being voted on (reward and slash recipients)
@@ -101,6 +101,8 @@ func (b *BFT) Start() {
101101 func () {
102102 b .Controller .Lock ()
103103 defer b .Controller .Unlock ()
104+ // Update BFT metrics
105+ defer b .Metrics .UpdateBFTMetrics (b .Height , b .RootHeight , b .Round , b .Phase , time .Now ())
104106 // handle the phase
105107 b .HandlePhase ()
106108 }()
@@ -240,7 +242,7 @@ func (b *BFT) StartElectionVotePhase() {
240242 Header : b .View .Copy (),
241243 ProposerKey : b .ProposerKey , // using voting power, authorizes Candidate to act as the 'Leader'
242244 },
243- HighQc : b .HighQC , // forward highest known 'Lock' for this CreatedHeight , so the new Proposer may satisfy SAFE-NODE-PREDICATE
245+ HighQc : b .HighQC , // forward highest known 'Lock' for this Height , so the new Proposer may satisfy SAFE-NODE-PREDICATE
244246 LastDoubleSignEvidence : b .ByzantineEvidence .DSE .Evidence , // forward any evidence of DoubleSigning
245247 Vdf : b .HighVDF , // forward local VDF to the candidate
246248 })
@@ -249,7 +251,7 @@ func (b *BFT) StartElectionVotePhase() {
249251// StartProposePhase() begins the ProposePhase after the ELECTION-VOTE phase timeout
250252// PROPOSE PHASE:
251253// - Leader reviews the collected vote messages from Replicas
252- // - Determines the highest 'lock' (HighQC) if one exists for this CreatedHeight
254+ // - Determines the highest 'lock' (HighQC) if one exists for this Height
253255// - Combines any ByzantineEvidence sent from Replicas into their own
254256// - Aggregates the signatures from the Replicas to form a +2/3 threshold multi-signature
255257//
@@ -292,7 +294,7 @@ func (b *BFT) StartProposePhase() {
292294// StartProposeVotePhase() begins the ProposeVote after the PROPOSE phase timeout
293295// PROPOSE-VOTE PHASE:
294296// - Replica reviews the message from the Leader by validating the justification (+2/3 multi-sig) proving that they are in-fact the leader
295- // - If the Replica is currently Locked on a previous Proposal for this CreatedHeight , the new Proposal must pass the SAFE-NODE-PREDICATE
297+ // - If the Replica is currently Locked on a previous Proposal for this Height , the new Proposal must pass the SAFE-NODE-PREDICATE
296298// - Replica Validates the proposal using the byzantine evidence and the specific plugin
297299// - Replicas send a signed (aggregable) PROPOSE vote to the Leader
298300func (b * BFT ) StartProposeVotePhase () {
@@ -592,8 +594,6 @@ func (b *BFT) NewHeight(keepLocks ...bool) {
592594 b .Height = b .Controller .ChainHeight ()
593595 // update canopy height
594596 b .RootHeight = b .Controller .RootChainHeight ()
595- // Update BFT metrics
596- b .Metrics .UpdateBFTMetrics (b .Height , b .RootHeight )
597597 // update the validator set
598598 b .ValidatorSet , err = b .Controller .LoadCommittee (b .LoadRootChainId (b .Height ), b .RootHeight )
599599 if err != nil {
0 commit comments