Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use Comm.Nodes() only at Consensus Start #578

Merged
merged 1 commit into from
Mar 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions internal/bft/controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 2 additions & 0 deletions internal/bft/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,7 @@ func (ifp *InFlightData) clear() {
type ProposalMaker struct {
DecisionsPerLeader uint64
N uint64
NodesList []uint64
SelfID uint64
Decider Decider
FailureDetector FailureDetector
Expand All @@ -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,
Expand Down
5 changes: 3 additions & 2 deletions internal/bft/view.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ type View struct {
RetrieveCheckpoint CheckpointRetriever
SelfID uint64
N uint64
NodesList []uint64
LeaderID uint64
Quorum int
Number uint64
Expand Down Expand Up @@ -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,
}

Expand Down Expand Up @@ -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,
Expand Down
10 changes: 10 additions & 0 deletions internal/bft/view_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down
1 change: 1 addition & 0 deletions internal/bft/viewchanger.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
1 change: 1 addition & 0 deletions pkg/consensus/consensus.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}
Expand Down