diff --git a/common/api.go b/common/api.go index bb0e0233..a688a78e 100644 --- a/common/api.go +++ b/common/api.go @@ -59,8 +59,8 @@ type Storage interface { } type Communication interface { - // Nodes returns all nodes that participate in the epoch. - Nodes() Nodes + // Validators returns all nodes that participate in consensus in the epoch. + Validators() Nodes // Send sends a message to the given destination node Send(msg *Message, destination NodeID) diff --git a/nonvalidator/comm_test.go b/nonvalidator/comm_test.go index a1c1242e..02888f7f 100644 --- a/nonvalidator/comm_test.go +++ b/nonvalidator/comm_test.go @@ -42,7 +42,7 @@ func newTestResponder(t *testing.T, myNodeID common.NodeID, tc *testChain) *nonV } } -func (r *nonValidatorResponderComm) Nodes() common.Nodes { return r.nodes } +func (r *nonValidatorResponderComm) Validators() common.Nodes { return r.nodes } // Enqueues a response coming from `destination`. func (r *nonValidatorResponderComm) Send(msg *common.Message, destination common.NodeID) { diff --git a/nonvalidator/epochs.go b/nonvalidator/epochs.go index 44759e80..38ff354f 100644 --- a/nonvalidator/epochs.go +++ b/nonvalidator/epochs.go @@ -131,7 +131,7 @@ func (e epochs) canValidate(block common.Block) bool { // latestValidatorSetRetriever is an allows the epoch replicator to get the latest validator set. // This is used to calculate the threshold of votes needed to validate an epoch. type latestValidatorSetRetriever interface { - Nodes() common.Nodes + Validators() common.Nodes } // epochDigestCounter counts sealing block responses from validators for each epoch. @@ -166,7 +166,7 @@ func (e *epochDigestCounter) collectedSealingBlockInfo(sealingBlockInfo *common. } e.logger.Debug("Collected a sealing block", zap.Stringer("QR", sealingBlockInfo), zap.Stringer("From", from)) - threshold := common.F(len(e.latestValidatorSetRetriever.Nodes())) + 1 + threshold := common.F(len(e.latestValidatorSetRetriever.Validators())) + 1 newEpoch := bh.Seq epochResponses, ok := e.sealingBlockResponses[newEpoch] digest := bh.Digest diff --git a/nonvalidator/epochs_test.go b/nonvalidator/epochs_test.go index 49150a89..c1c5bca2 100644 --- a/nonvalidator/epochs_test.go +++ b/nonvalidator/epochs_test.go @@ -255,7 +255,7 @@ type testValidatorSetRetriever struct { nodes common.Nodes } -func (v *testValidatorSetRetriever) Nodes() common.Nodes { +func (v *testValidatorSetRetriever) Validators() common.Nodes { return v.nodes } diff --git a/nonvalidator/non_validator.go b/nonvalidator/non_validator.go index f630ef21..e890710e 100644 --- a/nonvalidator/non_validator.go +++ b/nonvalidator/non_validator.go @@ -453,7 +453,7 @@ func (n *NonValidator) processReplicationState() error { if err != nil { n.Logger.Debug("Failed verifying QC that was next to commit", zap.Error(err)) // We fetch from comm.Nodes instead of the nodes given in the finalization, because this node may give us an adversarial node list. - n.sequenceReplicator.ResendFinalizationRequest(block.BlockHeader().Seq, n.Comm.Nodes().NodeIDs()) + n.sequenceReplicator.ResendFinalizationRequest(block.BlockHeader().Seq, n.Comm.Validators().NodeIDs()) return nil } diff --git a/simplex/epoch.go b/simplex/epoch.go index 8e6d8eda..7d4e9429 100644 --- a/simplex/epoch.go +++ b/simplex/epoch.go @@ -199,7 +199,7 @@ func (e *Epoch) init() error { e.finishCtx, e.finishFn = context.WithCancel(context.Background()) e.blockBuilderCtx = context.Background() e.blockBuilderCancelFunc = func() {} - e.nodes = e.Comm.Nodes() + e.nodes = e.Comm.Validators() common.SortNodes(e.nodes) e.nodeIDs = e.nodes.NodeIDs() e.timedOutRounds = make(map[uint16]uint64, len(e.nodeIDs)) diff --git a/simplex/epoch_failover_test.go b/simplex/epoch_failover_test.go index f9b7adbc..480002f1 100644 --- a/simplex/epoch_failover_test.go +++ b/simplex/epoch_failover_test.go @@ -1144,7 +1144,7 @@ func newRebroadcastComm(nodes Nodes) *rebroadcastComm { } } -func (r *rebroadcastComm) Nodes() Nodes { +func (r *rebroadcastComm) Validators() Nodes { return r.nodes } @@ -1232,7 +1232,7 @@ func runCrashAndRestartExecution(t *testing.T, e *Epoch, bb *testutil.TestBlockB cloneWAL := wal.Clone() cloneStorage := storage.Clone() - nodes := e.Comm.Nodes() + nodes := e.Comm.Validators() // Clone the block builder bbAfterCrash := testutil.NewTestBlockBuilder().WithBlockShouldBeBuiltBuffer(uint64(cap(bb.BlockShouldBeBuilt))) diff --git a/simplex/epoch_test.go b/simplex/epoch_test.go index e9d9bd59..5485e142 100644 --- a/simplex/epoch_test.go +++ b/simplex/epoch_test.go @@ -83,7 +83,7 @@ func TestFinalizeSameSequence(t *testing.T) { Prev: initialBlock.VerifiedBlock.BlockHeader().Digest, } vb, ok := bb.BuildBlock(context.Background(), md, Blacklist{ - NodeCount: uint16(len(e.EpochConfig.Comm.Nodes())), + NodeCount: uint16(len(e.EpochConfig.Comm.Validators())), }) require.True(t, ok) @@ -117,7 +117,7 @@ func TestFinalizeSameSequence(t *testing.T) { require.NoError(t, err) // create a notarization and now we should send a finalize vote for seq 1 again - sigAggr := e.SignatureAggregatorCreator(conf.Comm.Nodes()) + sigAggr := e.SignatureAggregatorCreator(conf.Comm.Validators()) notarization, err := testutil.NewNotarization(e.Logger, sigAggr, block, nodes[1:]) require.NoError(t, err) testutil.InjectTestNotarization(t, e, notarization, nodes[1]) @@ -202,7 +202,7 @@ func testFinalizeSameSequenceGap(t *testing.T, nodes []NodeID, numEmptyNotarizat } for range numEmptyNotarizations { - leader := LeaderForRound(e.Comm.Nodes().NodeIDs(), e.Metadata().Round) + leader := LeaderForRound(e.Comm.Validators().NodeIDs(), e.Metadata().Round) if e.ID.Equals(leader) { fVote := advanceWithFinalizeCheck(t, e, recordingComm, bb) finalizeVoteSeqs[fVote.Finalization.Seq] = fVote @@ -226,7 +226,7 @@ func testFinalizeSameSequenceGap(t *testing.T, nodes []NodeID, numEmptyNotarizat Prev: finalizeVoteSeqs[seqToDoubleFinalize-1].Finalization.Digest, } vb, ok := bb.BuildBlock(context.Background(), md, Blacklist{ - NodeCount: uint16(len(e.EpochConfig.Comm.Nodes())), + NodeCount: uint16(len(e.EpochConfig.Comm.Validators())), }) require.True(t, ok) @@ -236,7 +236,7 @@ func testFinalizeSameSequenceGap(t *testing.T, nodes []NodeID, numEmptyNotarizat verified <- struct{}{} } - leader := LeaderForRound(e.Comm.Nodes().NodeIDs(), 1+numEmptyNotarizations+numNotarizations) + leader := LeaderForRound(e.Comm.Validators().NodeIDs(), 1+numEmptyNotarizations+numNotarizations) if e.ID.Equals(leader) { return } @@ -275,7 +275,7 @@ func testFinalizeSameSequenceGap(t *testing.T, nodes []NodeID, numEmptyNotarizat } // create a notarization and now we should send a finalize vote for seqToDoubleFinalize again - sigAggr := e.SignatureAggregatorCreator(conf.Comm.Nodes()) + sigAggr := e.SignatureAggregatorCreator(conf.Comm.Validators()) notarization, err := testutil.NewNotarization(e.Logger, sigAggr, block, nodes[1:]) require.NoError(t, err) testutil.InjectTestNotarization(t, e, notarization, nodes[1]) @@ -378,7 +378,7 @@ func TestEpochHandleNotarizationFutureRound(t *testing.T) { require.NoError(t, e.Start()) // Create a notarization for round 1 which is a future round because we haven't gone through round 0 yet. - sigAggr := e.SignatureAggregatorCreator(conf.Comm.Nodes()) + sigAggr := e.SignatureAggregatorCreator(conf.Comm.Validators()) notarization, err := testutil.NewNotarization(conf.Logger, sigAggr, secondBlock, nodes) require.NoError(t, err) @@ -444,8 +444,8 @@ func TestEpochIndexFinalization(t *testing.T) { // when we receive that finalization, we should commit the rest of the finalizations for seqs // 1 & 2 - sigAggr := e.SignatureAggregatorCreator(conf.Comm.Nodes()) - finalization, _ := testutil.NewFinalizationRecord(t, sigAggr, firstBlock, e.Comm.Nodes().NodeIDs()) + sigAggr := e.SignatureAggregatorCreator(conf.Comm.Validators()) + finalization, _ := testutil.NewFinalizationRecord(t, sigAggr, firstBlock, e.Comm.Validators().NodeIDs()) testutil.InjectTestFinalization(t, e, &finalization, nodes[1]) storage.WaitForBlockCommit(2) @@ -544,7 +544,7 @@ func TestEpochIncreasesRoundAfterFinalization(t *testing.T) { require.Equal(t, uint64(0), storage.NumBlocks()) // create the finalized block - sigAggr := e.SignatureAggregatorCreator(conf.Comm.Nodes()) + sigAggr := e.SignatureAggregatorCreator(conf.Comm.Validators()) finalization, _ := testutil.NewFinalizationRecord(t, sigAggr, block, nodes) testutil.InjectTestFinalization(t, e, &finalization, nodes[1]) @@ -752,10 +752,10 @@ func TestEpochStartedTwice(t *testing.T) { } func advanceRoundFromEmpty(t *testing.T, e *Epoch) { - leader := LeaderForRound(e.Comm.Nodes().NodeIDs(), e.Metadata().Round) + leader := LeaderForRound(e.Comm.Validators().NodeIDs(), e.Metadata().Round) require.False(t, e.ID.Equals(leader), "epoch cannot be the leader for the empty round") - emptyNote := testutil.NewEmptyNotarization(e.Comm.Nodes().NodeIDs(), e.Metadata().Round) + emptyNote := testutil.NewEmptyNotarization(e.Comm.Validators().NodeIDs(), e.Metadata().Round) err := e.HandleMessage(&Message{ EmptyNotarization: emptyNote, }, leader) @@ -1016,7 +1016,7 @@ func TestEpochQCSignedByNonExistentNodes(t *testing.T) { wal.AssertWALSize(1) - sigAggr := e.SignatureAggregatorCreator(conf.Comm.Nodes()) + sigAggr := e.SignatureAggregatorCreator(conf.Comm.Validators()) t.Run("notarization with unknown signer isn't taken into account", func(t *testing.T) { notarization, err := testutil.NewNotarization(conf.Logger, sigAggr, block, []NodeID{{2}, {3}, {5}}) @@ -1258,7 +1258,7 @@ func TestEpochSendsBlockDigestRequest(t *testing.T) { require.True(t, built) block := bb.GetBuiltBlock() - sigAggr := e.SignatureAggregatorCreator(conf.Comm.Nodes()) + sigAggr := e.SignatureAggregatorCreator(conf.Comm.Validators()) notarization, err := testutil.NewNotarization(conf.Logger, sigAggr, block, nodes) require.NoError(t, err) @@ -1504,7 +1504,7 @@ func TestDoubleIncrementOnPersistNotarization(t *testing.T) { require.True(t, ok) block := bb.GetBuiltBlock() - sigAggr := e.SignatureAggregatorCreator(conf.Comm.Nodes()) + sigAggr := e.SignatureAggregatorCreator(conf.Comm.Validators()) notarization, err := testutil.NewNotarization(conf.Logger, sigAggr, block, nodes) require.NoError(t, err) @@ -1596,7 +1596,7 @@ func TestRejectsOldNotarizationAndVotes(t *testing.T) { } // send notarization for round 1, after the finalization was sent - sigAggr := e.SignatureAggregatorCreator(conf.Comm.Nodes()) + sigAggr := e.SignatureAggregatorCreator(conf.Comm.Validators()) notarization, err := testutil.NewNotarization(conf.Logger, sigAggr, block, nodes) require.NoError(t, err) @@ -1642,7 +1642,7 @@ func TestBlockDeserializer(t *testing.T) { func advanceRound(t *testing.T, e *Epoch, bb *testutil.TestBlockBuilder, notarize bool, finalize bool, injectedMD *ProtocolMetadata) (VerifiedBlock, *Notarization) { require.True(t, notarize || finalize, "must either notarize or finalize a round to advance") nextSeqToCommit := e.Storage.NumBlocks() - nodes := e.Comm.Nodes() + nodes := e.Comm.Validators() quorum := Quorum(len(nodes)) // leader is the proposer of the new block for the given round leader := LeaderForRound(nodes.NodeIDs(), e.Metadata().Round) @@ -1655,7 +1655,7 @@ func advanceRound(t *testing.T, e *Epoch, bb *testutil.TestBlockBuilder, notariz isEpochNode := leader.Equals(e.ID) if !isEpochNode { _, ok := bb.BuildBlock(context.Background(), md, Blacklist{ - NodeCount: uint16(len(e.EpochConfig.Comm.Nodes())), + NodeCount: uint16(len(e.EpochConfig.Comm.Validators())), }) require.True(t, ok) } diff --git a/simplex/recovery_test.go b/simplex/recovery_test.go index 7e7da8e5..a1b29a81 100644 --- a/simplex/recovery_test.go +++ b/simplex/recovery_test.go @@ -249,7 +249,7 @@ func TestWalCreatedProperly(t *testing.T) { records, err = e.WAL.ReadAll() require.NoError(t, err) require.Len(t, records, 2) - sigAggr := e.SignatureAggregatorCreator(conf.Comm.Nodes()) + sigAggr := e.SignatureAggregatorCreator(conf.Comm.Validators()) expectedNotarizationRecord, err := testutil.NewNotarizationRecord(conf.Logger, sigAggr, block, nodes[0:quorum]) require.NoError(t, err) require.Equal(t, expectedNotarizationRecord, records[1]) @@ -423,7 +423,7 @@ func TestRecoverFromMultipleNotarizations(t *testing.T) { require.NoError(t, err) t.Cleanup(e.Stop) - sigAggr := e.SignatureAggregatorCreator(conf.Comm.Nodes()) + sigAggr := e.SignatureAggregatorCreator(conf.Comm.Validators()) protocolMetadata := e.Metadata() firstBlock, ok := bb.BuildBlock(ctx, protocolMetadata, emptyBlacklist) @@ -501,7 +501,7 @@ func TestRecoveryBlocksIndexed(t *testing.T) { record := BlockRecord(firstBlock.BlockHeader(), fBytes) wal.Append(record) - sigAggr := conf.SignatureAggregatorCreator(conf.Comm.Nodes()) + sigAggr := conf.SignatureAggregatorCreator(conf.Comm.Validators()) firstNotarizationRecord, err := testutil.NewNotarizationRecord(conf.Logger, sigAggr, firstBlock, nodes[0:quorum]) require.NoError(t, err) wal.Append(firstNotarizationRecord) @@ -658,7 +658,7 @@ func TestWalRecoveryTriggersEmptyVoteTimeout(t *testing.T) { require.NoError(t, wal.Append(blockRecord)) // lets add some notarizations - sigAggr := e.SignatureAggregatorCreator(conf.Comm.Nodes()) + sigAggr := e.SignatureAggregatorCreator(conf.Comm.Validators()) notarizationRecord, err := testutil.NewNotarizationRecord(conf.Logger, sigAggr, block, nodes[0:quorum]) require.NoError(t, err) @@ -765,7 +765,7 @@ func TestWalRecoverySetsRoundCorrectly(t *testing.T) { require.NoError(t, err) blockRecord := BlockRecord(block.BlockHeader(), bBytes) - notarizationRecord, err := testutil.NewNotarizationRecord(conf.Logger, conf.SignatureAggregatorCreator(conf.Comm.Nodes()), block, nodes[0:quorum]) + notarizationRecord, err := testutil.NewNotarizationRecord(conf.Logger, conf.SignatureAggregatorCreator(conf.Comm.Validators()), block, nodes[0:quorum]) require.NoError(t, err) return [][]byte{blockRecord, notarizationRecord} @@ -783,7 +783,7 @@ func TestWalRecoverySetsRoundCorrectly(t *testing.T) { require.NoError(t, err) blockRecord1 := BlockRecord(block1.BlockHeader(), bBytes1) - _, finalizationRecord1 := testutil.NewFinalizationRecord(t, conf.SignatureAggregatorCreator(conf.Comm.Nodes()), block1, nodes[0:quorum]) + _, finalizationRecord1 := testutil.NewFinalizationRecord(t, conf.SignatureAggregatorCreator(conf.Comm.Validators()), block1, nodes[0:quorum]) // Create empty notarization for round 0 emptyNotarization0 := testutil.NewEmptyNotarization(nodes[0:quorum], 0) @@ -804,7 +804,7 @@ func TestWalRecoverySetsRoundCorrectly(t *testing.T) { bBytes0, err := block0.Bytes() require.NoError(t, err) blockRecord0 := BlockRecord(block0.BlockHeader(), bBytes0) - notarizationRecord0, err := testutil.NewNotarizationRecord(conf.Logger, conf.SignatureAggregatorCreator(conf.Comm.Nodes()), block0, nodes[0:quorum]) + notarizationRecord0, err := testutil.NewNotarizationRecord(conf.Logger, conf.SignatureAggregatorCreator(conf.Comm.Validators()), block0, nodes[0:quorum]) require.NoError(t, err) block1, ok := bb.BuildBlock(ctx, ProtocolMetadata{Round: 1, Epoch: 0, Seq: 1}, emptyBlacklist) @@ -812,7 +812,7 @@ func TestWalRecoverySetsRoundCorrectly(t *testing.T) { bBytes1, err := block1.Bytes() require.NoError(t, err) blockRecord1 := BlockRecord(block1.BlockHeader(), bBytes1) - notarizationRecord1, err := testutil.NewNotarizationRecord(conf.Logger, conf.SignatureAggregatorCreator(conf.Comm.Nodes()), block1, nodes[0:quorum]) + notarizationRecord1, err := testutil.NewNotarizationRecord(conf.Logger, conf.SignatureAggregatorCreator(conf.Comm.Validators()), block1, nodes[0:quorum]) require.NoError(t, err) block2, ok := bb.BuildBlock(ctx, ProtocolMetadata{Round: 2, Epoch: 0, Seq: 2}, emptyBlacklist) @@ -820,7 +820,7 @@ func TestWalRecoverySetsRoundCorrectly(t *testing.T) { bBytes2, err := block2.Bytes() require.NoError(t, err) blockRecord2 := BlockRecord(block2.BlockHeader(), bBytes2) - notarizationRecord2, err := testutil.NewNotarizationRecord(conf.Logger, conf.SignatureAggregatorCreator(conf.Comm.Nodes()), block2, nodes[0:quorum]) + notarizationRecord2, err := testutil.NewNotarizationRecord(conf.Logger, conf.SignatureAggregatorCreator(conf.Comm.Validators()), block2, nodes[0:quorum]) require.NoError(t, err) // Create empty notarization for round 3 @@ -847,7 +847,7 @@ func TestWalRecoverySetsRoundCorrectly(t *testing.T) { bBytes3, err := block3.Bytes() require.NoError(t, err) blockRecord3 := BlockRecord(block3.BlockHeader(), bBytes3) - _, finalizationRecord3 := testutil.NewFinalizationRecord(t, conf.SignatureAggregatorCreator(conf.Comm.Nodes()), block3, nodes[0:quorum]) + _, finalizationRecord3 := testutil.NewFinalizationRecord(t, conf.SignatureAggregatorCreator(conf.Comm.Validators()), block3, nodes[0:quorum]) // Create empty notarization for round 2 emptyNotarization2 := testutil.NewEmptyNotarization(nodes[0:quorum], 2) @@ -860,7 +860,7 @@ func TestWalRecoverySetsRoundCorrectly(t *testing.T) { bBytes1, err := block1.Bytes() require.NoError(t, err) blockRecord1 := BlockRecord(block1.BlockHeader(), bBytes1) - notarizationRecord1, err := testutil.NewNotarizationRecord(conf.Logger, conf.SignatureAggregatorCreator(conf.Comm.Nodes()), block1, nodes[0:quorum]) + notarizationRecord1, err := testutil.NewNotarizationRecord(conf.Logger, conf.SignatureAggregatorCreator(conf.Comm.Validators()), block1, nodes[0:quorum]) require.NoError(t, err) // Return in reverse order @@ -882,7 +882,7 @@ func TestWalRecoverySetsRoundCorrectly(t *testing.T) { bBytes0, err := block0.Bytes() require.NoError(t, err) blockRecord0 := BlockRecord(block0.BlockHeader(), bBytes0) - notarizationRecord0, err := testutil.NewNotarizationRecord(conf.Logger, conf.SignatureAggregatorCreator(conf.Comm.Nodes()), block0, nodes[0:quorum]) + notarizationRecord0, err := testutil.NewNotarizationRecord(conf.Logger, conf.SignatureAggregatorCreator(conf.Comm.Validators()), block0, nodes[0:quorum]) require.NoError(t, err) // Create finalization for round 10 (highest) @@ -891,7 +891,7 @@ func TestWalRecoverySetsRoundCorrectly(t *testing.T) { bBytes10, err := block10.Bytes() require.NoError(t, err) blockRecord10 := BlockRecord(block10.BlockHeader(), bBytes10) - _, finalizationRecord10 := testutil.NewFinalizationRecord(t, conf.SignatureAggregatorCreator(conf.Comm.Nodes()), block10, nodes[0:quorum]) + _, finalizationRecord10 := testutil.NewFinalizationRecord(t, conf.SignatureAggregatorCreator(conf.Comm.Validators()), block10, nodes[0:quorum]) // Create empty notarization for round 5 emptyNotarization5 := testutil.NewEmptyNotarization(nodes[0:quorum], 5) @@ -917,10 +917,10 @@ func TestWalRecoverySetsRoundCorrectly(t *testing.T) { require.NoError(t, err) blockRecord2 := BlockRecord(block2.BlockHeader(), bBytes2) - notarizationRecord2, err := testutil.NewNotarizationRecord(conf.Logger, conf.SignatureAggregatorCreator(conf.Comm.Nodes()), block2, nodes[0:quorum]) + notarizationRecord2, err := testutil.NewNotarizationRecord(conf.Logger, conf.SignatureAggregatorCreator(conf.Comm.Validators()), block2, nodes[0:quorum]) require.NoError(t, err) - _, finalizationRecord2 := testutil.NewFinalizationRecord(t, conf.SignatureAggregatorCreator(conf.Comm.Nodes()), block2, nodes[0:quorum]) + _, finalizationRecord2 := testutil.NewFinalizationRecord(t, conf.SignatureAggregatorCreator(conf.Comm.Validators()), block2, nodes[0:quorum]) // All records for same round return [][]byte{ diff --git a/simplex/replication_test.go b/simplex/replication_test.go index b8b7000e..3c155510 100644 --- a/simplex/replication_test.go +++ b/simplex/replication_test.go @@ -132,7 +132,7 @@ func TestReplicationAdversarialNode(t *testing.T) { require.Equal(t, uint64(0), laggingNode.E.Metadata().Round) net.Connect(laggingNode.E.ID) - sigAggr := laggingNode.E.SignatureAggregatorCreator(laggingNode.E.Comm.Nodes()) + sigAggr := laggingNode.E.SignatureAggregatorCreator(laggingNode.E.Comm.Validators()) finalization, _ := NewFinalizationRecord(t, sigAggr, blocks[1], nodes[:quorum]) finalizationMsg := &common.Message{ Finalization: &finalization, @@ -376,7 +376,7 @@ func TestReplicationStartsBeforeCurrentRound(t *testing.T) { record := common.BlockRecord(firstBlock.BlockHeader(), fBytes) laggingNode.WAL.Append(record) - sigAggr := laggingNode.E.SignatureAggregatorCreator(laggingNode.E.Comm.Nodes()) + sigAggr := laggingNode.E.SignatureAggregatorCreator(laggingNode.E.Comm.Validators()) firstNotarizationRecord, err := NewNotarizationRecord(laggingNode.E.Logger, sigAggr, firstBlock, nodes[0:quorum]) require.NoError(t, err) laggingNode.WAL.Append(firstNotarizationRecord) @@ -443,7 +443,7 @@ func TestReplicationFutureFinalization(t *testing.T) { }, nodes[0]) require.NoError(t, err) - sigAggr := e.SignatureAggregatorCreator(conf.Comm.Nodes()) + sigAggr := e.SignatureAggregatorCreator(conf.Comm.Validators()) finalization, _ := NewFinalizationRecord(t, sigAggr, block, nodes[0:quorum]) // send finalization err = e.HandleMessage(&common.Message{ @@ -630,7 +630,7 @@ func TestReplicationStuckInProposingBlock(t *testing.T) { highBlock, _ := blocks[3].VerifiedBlock.(*TestBlock) - sigAggr := e.SignatureAggregatorCreator(conf.Comm.Nodes()) + sigAggr := e.SignatureAggregatorCreator(conf.Comm.Validators()) highFinalization, _ := NewFinalizationRecord(t, sigAggr, highBlock, nodes[0:quorum]) // Trigger the replication process to start by sending a finalization for a block we do not have @@ -976,7 +976,7 @@ func TestReplicationVerifyNotarization(t *testing.T) { block := bb.GetBuiltBlock() - sigAggr := e.SignatureAggregatorCreator(conf.Comm.Nodes()) + sigAggr := e.SignatureAggregatorCreator(conf.Comm.Validators()) finalization, _ := NewFinalizationRecord(t, sigAggr, block, nodes[0:quorum]) // Trigger the replication process to start by sending a finalization for a block we do not have @@ -1064,7 +1064,7 @@ func TestReplicationVerifyEmptyNotarization(t *testing.T) { block := bb.GetBuiltBlock() - sigAggr := e.SignatureAggregatorCreator(conf.Comm.Nodes()) + sigAggr := e.SignatureAggregatorCreator(conf.Comm.Validators()) finalization, _ := NewFinalizationRecord(t, sigAggr, block, nodes[0:quorum]) // Trigger the replication process to start by sending a finalization for a block we do not have diff --git a/simplex/replication_timeout_test.go b/simplex/replication_timeout_test.go index a9facfa2..9b741d8f 100644 --- a/simplex/replication_timeout_test.go +++ b/simplex/replication_timeout_test.go @@ -622,7 +622,7 @@ func TestReplicationResendsFinalizedBlocksThatFailedVerification(t *testing.T) { block := bb.GetBuiltBlock() block.VerificationError = errors.New("block verification failed") - sigAggr := e.SignatureAggregatorCreator(conf.Comm.Nodes()) + sigAggr := e.SignatureAggregatorCreator(conf.Comm.Validators()) finalization, _ := testutil.NewFinalizationRecord(t, sigAggr, block, nodes[0:quorum]) // send the finalization to start the replication process diff --git a/testutil/comm.go b/testutil/comm.go index 94e3bce1..8c0dc6b0 100644 --- a/testutil/comm.go +++ b/testutil/comm.go @@ -24,7 +24,7 @@ type MessageFilter func(msg *common.Message, from common.NodeID, to common.NodeI type NoopComm common.Nodes -func (n NoopComm) Nodes() common.Nodes { +func (n NoopComm) Validators() common.Nodes { return common.Nodes(n) } @@ -51,7 +51,7 @@ func NewTestComm(from common.NodeID, net *BasicInMemoryNetwork, messageFilter Me } } -func (c *TestComm) Nodes() common.Nodes { +func (c *TestComm) Validators() common.Nodes { return c.net.nodeWeights } diff --git a/testutil/controlled.go b/testutil/controlled.go index 6554b58e..05fece1e 100644 --- a/testutil/controlled.go +++ b/testutil/controlled.go @@ -72,7 +72,7 @@ func (n *ControlledInMemoryNetwork) AdvanceWithoutLeader(round uint64, laggingNo } for _, n := range n.Instances { - leader := n.E.ID.Equals(simplex.LeaderForRound(n.E.Comm.Nodes().NodeIDs(), n.E.Metadata().Round)) + leader := n.E.ID.Equals(simplex.LeaderForRound(n.E.Comm.Validators().NodeIDs(), n.E.Metadata().Round)) if leader || laggingNodeId.Equals(n.E.ID) { continue }