diff --git a/internal/bft/controller_test.go b/internal/bft/controller_test.go index 9bc0bd36..85f2f816 100644 --- a/internal/bft/controller_test.go +++ b/internal/bft/controller_test.go @@ -666,6 +666,7 @@ func createView(c *bft.Controller, leader, proposalSequence, viewNum, decisionsI return &bft.View{ RetrieveCheckpoint: c.Checkpoint.Get, N: c.N, + NodesList: c.NodesList, LeaderID: leader, SelfID: c.ID, Quorum: quorumSize, diff --git a/internal/bft/util.go b/internal/bft/util.go index eac5e8df..584813cb 100644 --- a/internal/bft/util.go +++ b/internal/bft/util.go @@ -257,6 +257,7 @@ func (ifp *InFlightData) clear() { type ProposalMaker struct { DecisionsPerLeader uint64 N uint64 + NodesList []uint64 SelfID uint64 Decider Decider FailureDetector FailureDetector @@ -281,6 +282,7 @@ func (pm *ProposalMaker) NewProposer(leader, proposalSequence, viewNum, decision RetrieveCheckpoint: pm.Checkpoint.Get, DecisionsPerLeader: pm.DecisionsPerLeader, N: pm.N, + NodesList: pm.NodesList, LeaderID: leader, SelfID: pm.SelfID, Quorum: quorumSize, diff --git a/internal/bft/view.go b/internal/bft/view.go index 161bfeb2..8fb5cf68 100644 --- a/internal/bft/view.go +++ b/internal/bft/view.go @@ -72,6 +72,7 @@ type View struct { RetrieveCheckpoint CheckpointRetriever SelfID uint64 N uint64 + NodesList []uint64 LeaderID uint64 Quorum int Number uint64 @@ -702,7 +703,7 @@ func (v *View) verifyBlacklist(prevCommitSignatures []*protos.Signature, currVer f: f, logger: v.Logger, metricsBlacklist: v.MetricsBlacklist, - nodes: v.Comm.Nodes(), + nodes: v.NodesList, currView: v.Number, } @@ -1045,7 +1046,7 @@ func (v *View) updateBlacklistMetadata(metadata *protos.ViewMetadata, prevSigs [ leaderRotation: v.DecisionsPerLeader > 0, currView: metadata.ViewId, prevMD: prevMD, - nodes: v.Comm.Nodes(), + nodes: v.NodesList, f: f, n: v.N, logger: v.Logger, diff --git a/internal/bft/view_test.go b/internal/bft/view_test.go index d5cdaba1..4461cafd 100644 --- a/internal/bft/view_test.go +++ b/internal/bft/view_test.go @@ -133,6 +133,7 @@ func TestViewBasic(t *testing.T) { State: state, Logger: log, N: 4, + NodesList: []uint64{1, 2, 3, 4}, LeaderID: 1, Quorum: 3, Number: 1, @@ -333,6 +334,7 @@ func TestBadPrePrepare(t *testing.T) { State: state, Logger: log, N: 4, + NodesList: []uint64{1, 2, 3, 4}, LeaderID: 1, Quorum: 3, Number: 1, @@ -423,6 +425,7 @@ func TestBadPrepare(t *testing.T) { State: state, Logger: log, N: 4, + NodesList: []uint64{1, 2, 3, 4}, LeaderID: 1, Quorum: 3, Number: 1, @@ -494,6 +497,7 @@ func TestBadCommit(t *testing.T) { State: state, Logger: log, N: 4, + NodesList: []uint64{1, 2, 3, 4}, LeaderID: 1, Quorum: 3, Number: 1, @@ -582,6 +586,7 @@ func TestNormalPath(t *testing.T) { State: state, Logger: log, N: 4, + NodesList: []uint64{1, 2, 3, 4}, LeaderID: 1, SelfID: 1, Quorum: 3, @@ -707,6 +712,7 @@ func TestTwoSequences(t *testing.T) { State: state, Logger: log, N: 4, + NodesList: []uint64{1, 2, 3, 4}, LeaderID: 1, Quorum: 3, Number: 1, @@ -877,6 +883,7 @@ func TestViewPersisted(t *testing.T) { State: state, Logger: log, N: 4, + NodesList: []uint64{1, 2, 3, 4}, LeaderID: 1, Quorum: 3, Number: 1, @@ -1090,6 +1097,7 @@ func TestDiscoverDeliberateCensorship(t *testing.T) { RetrieveCheckpoint: (&types.Checkpoint{}).Get, Logger: basicLog.Sugar(), N: 4, + NodesList: []uint64{1, 2, 3, 4}, LeaderID: 1, Quorum: 3, Number: 5, @@ -1179,6 +1187,7 @@ func TestTwoPrePreparesInARow(t *testing.T) { State: state, Logger: log, N: 4, + NodesList: []uint64{1, 2, 3, 4}, LeaderID: 1, Quorum: 3, Number: 1, @@ -1438,6 +1447,7 @@ func newView(t *testing.T, selfID uint64, network map[uint64]*testedView) *teste State: state, Logger: log, N: 4, + NodesList: []uint64{1, 2, 3, 4}, LeaderID: 1, Quorum: 3, Number: 1, diff --git a/internal/bft/viewchanger.go b/internal/bft/viewchanger.go index f835fee3..b1a49226 100644 --- a/internal/bft/viewchanger.go +++ b/internal/bft/viewchanger.go @@ -1225,6 +1225,7 @@ func (v *ViewChanger) commitInFlightProposal(proposal *protos.Proposal) (success DecisionsPerLeader: v.DecisionsPerLeader, SelfID: v.SelfID, N: v.N, + NodesList: v.NodesList, Number: inFlightViewNum, LeaderID: v.SelfID, // so that no byzantine leader will cause a complain Quorum: v.quorum, diff --git a/pkg/consensus/consensus.go b/pkg/consensus/consensus.go index 5f5345c4..46c8ddec 100644 --- a/pkg/consensus/consensus.go +++ b/pkg/consensus/consensus.go @@ -332,6 +332,7 @@ func (c *Consensus) proposalMaker() *algorithm.ProposalMaker { FailureDetector: c, Verifier: c.Verifier, N: c.numberOfNodes, + NodesList: c.nodes, InMsqQSize: int(c.Config.IncomingMessageBufferSize), ViewSequences: c.controller.ViewSequences, }