Skip to content

Commit

Permalink
Allow in IssueBlocksAtSlots in testsuite to set a commitment to be us…
Browse files Browse the repository at this point in the history
…ed throughout the slot where blocks are issued. If that is not the case, some blocks might already commit to a more recent commitment (which became committable because of issuing). This, however, makes the issuance non-deterministic and assertions of e.g. attestations impossible
  • Loading branch information
jonastheis committed Nov 23, 2023
1 parent 5fa1b5c commit 6eff84f
Show file tree
Hide file tree
Showing 9 changed files with 71 additions and 56 deletions.
20 changes: 10 additions & 10 deletions pkg/tests/booker_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,7 @@ func Test_SpendRejectedCommittedRace(t *testing.T) {

// Advance both nodes at the edge of slot 1 committability
{
ts.IssueBlocksAtSlots("", []iotago.SlotIndex{2, 3, 4}, 1, "block2.4", ts.Nodes("node1", "node2"), false, nil)
ts.IssueBlocksAtSlots("", []iotago.SlotIndex{2, 3, 4}, 1, "block2.4", ts.Nodes("node1", "node2"), false, false)

ts.AssertNodeState(ts.Nodes(),
testsuite.WithProtocolParameters(ts.API.ProtocolParameters()),
Expand All @@ -420,7 +420,7 @@ func Test_SpendRejectedCommittedRace(t *testing.T) {
ts.Block("block2.tx1"): {"tx1"},
}, node1, node2)

ts.IssueBlocksAtSlots("", []iotago.SlotIndex{5}, 1, "4.0", ts.Nodes("node1"), false, nil)
ts.IssueBlocksAtSlots("", []iotago.SlotIndex{5}, 1, "4.0", ts.Nodes("node1"), false, false)

ts.AssertBlocksExist(ts.BlocksWithPrefix("5.0"), true, ts.Nodes()...)
}
Expand All @@ -436,7 +436,7 @@ func Test_SpendRejectedCommittedRace(t *testing.T) {
ts.SplitIntoPartitions(partitions)

// Only node2 will commit after issuing this one
ts.IssueBlocksAtSlots("", []iotago.SlotIndex{5}, 1, "5.0", ts.Nodes("node2"), false, nil)
ts.IssueBlocksAtSlots("", []iotago.SlotIndex{5}, 1, "5.0", ts.Nodes("node2"), false, false)

ts.AssertNodeState(ts.Nodes("node1"),
testsuite.WithProtocolParameters(ts.API.ProtocolParameters()),
Expand Down Expand Up @@ -527,7 +527,7 @@ func Test_SpendRejectedCommittedRace(t *testing.T) {
// Sync up the nodes to he same point and check consistency between them.
{
// Let node1 catch up with commitment 1
ts.IssueBlocksAtSlots("5.1", []iotago.SlotIndex{5}, 1, "5.0", ts.Nodes("node2"), false, nil)
ts.IssueBlocksAtSlots("5.1", []iotago.SlotIndex{5}, 1, "5.0", ts.Nodes("node2"), false, false)

ts.AssertNodeState(ts.Nodes("node1", "node2"),
testsuite.WithProtocolParameters(ts.API.ProtocolParameters()),
Expand Down Expand Up @@ -573,7 +573,7 @@ func Test_SpendRejectedCommittedRace(t *testing.T) {
{
ts.AssertTransactionsExist(wallet.Transactions("tx1", "tx2", "tx4"), true, node1, node2)

ts.IssueBlocksAtSlots("", []iotago.SlotIndex{6, 7, 8, 9, 10}, 5, "5.1", ts.Nodes("node1", "node2"), false, nil)
ts.IssueBlocksAtSlots("", []iotago.SlotIndex{6, 7, 8, 9, 10}, 5, "5.1", ts.Nodes("node1", "node2"), false, false)

ts.AssertNodeState(ts.Nodes("node1", "node2"),
testsuite.WithProtocolParameters(ts.API.ProtocolParameters()),
Expand Down Expand Up @@ -656,7 +656,7 @@ func Test_SpendPendingCommittedRace(t *testing.T) {

// Advance both nodes at the edge of slot 1 committability
{
ts.IssueBlocksAtSlots("", []iotago.SlotIndex{2, 3, 4}, 1, "Genesis", ts.Nodes("node1", "node2"), false, nil)
ts.IssueBlocksAtSlots("", []iotago.SlotIndex{2, 3, 4}, 1, "Genesis", ts.Nodes("node1", "node2"), false, false)

ts.AssertNodeState(ts.Nodes(),
testsuite.WithProtocolParameters(ts.API.ProtocolParameters()),
Expand All @@ -667,7 +667,7 @@ func Test_SpendPendingCommittedRace(t *testing.T) {

ts.IssueValidationBlockAtSlot("", 5, genesisCommitment, node1, ts.BlockIDsWithPrefix("4.0")...)

ts.IssueBlocksAtSlots("", []iotago.SlotIndex{5}, 1, "4.0", ts.Nodes("node1"), false, nil)
ts.IssueBlocksAtSlots("", []iotago.SlotIndex{5}, 1, "4.0", ts.Nodes("node1"), false, false)

ts.AssertBlocksExist(ts.BlocksWithPrefix("5.0"), true, ts.Nodes()...)
}
Expand All @@ -682,7 +682,7 @@ func Test_SpendPendingCommittedRace(t *testing.T) {
ts.SplitIntoPartitions(partitions)

// Only node2 will commit after issuing this one
ts.IssueBlocksAtSlots("", []iotago.SlotIndex{5}, 1, "5.0", ts.Nodes("node2"), false, nil)
ts.IssueBlocksAtSlots("", []iotago.SlotIndex{5}, 1, "5.0", ts.Nodes("node2"), false, false)

ts.AssertNodeState(ts.Nodes("node1"),
testsuite.WithProtocolParameters(ts.API.ProtocolParameters()),
Expand Down Expand Up @@ -724,7 +724,7 @@ func Test_SpendPendingCommittedRace(t *testing.T) {
// Sync up the nodes to he same point and check consistency between them.
{
// Let node1 catch up with commitment 1
ts.IssueBlocksAtSlots("5.1", []iotago.SlotIndex{5}, 1, "5.0", ts.Nodes("node2"), false, nil)
ts.IssueBlocksAtSlots("5.1", []iotago.SlotIndex{5}, 1, "5.0", ts.Nodes("node2"), false, false)

ts.AssertNodeState(ts.Nodes("node1", "node2"),
testsuite.WithProtocolParameters(ts.API.ProtocolParameters()),
Expand Down Expand Up @@ -756,7 +756,7 @@ func Test_SpendPendingCommittedRace(t *testing.T) {
ts.AssertTransactionsExist(wallet.Transactions("tx1", "tx2"), true, node1, node2)
ts.AssertTransactionsInCachePending(wallet.Transactions("tx1", "tx2"), true, node1, node2)

ts.IssueBlocksAtSlots("", []iotago.SlotIndex{6, 7, 8, 9, 10}, 5, "5.1", ts.Nodes("node1", "node2"), false, nil)
ts.IssueBlocksAtSlots("", []iotago.SlotIndex{6, 7, 8, 9, 10}, 5, "5.1", ts.Nodes("node1", "node2"), false, false)

ts.AssertNodeState(ts.Nodes("node1", "node2"),
testsuite.WithProtocolParameters(ts.API.ProtocolParameters()),
Expand Down
18 changes: 9 additions & 9 deletions pkg/tests/committee_rotation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,20 +78,20 @@ func Test_TopStakersRotation(t *testing.T) {

// Select committee for epoch 1 and test candidacy announcements at different times.
{
ts.IssueBlocksAtSlots("wave-1:", []iotago.SlotIndex{1, 2, 3, 4}, 4, "Genesis", ts.Nodes(), true, nil)
ts.IssueBlocksAtSlots("wave-1:", []iotago.SlotIndex{1, 2, 3, 4}, 4, "Genesis", ts.Nodes(), true, false)

ts.IssueCandidacyAnnouncementInSlot("node1-candidacy:1", 4, "wave-1:4.3", ts.Wallet("node1"))
ts.IssueCandidacyAnnouncementInSlot("node4-candidacy:1", 5, "node1-candidacy:1", ts.Wallet("node4"))

ts.IssueBlocksAtSlots("wave-2:", []iotago.SlotIndex{5, 6, 7, 8, 9}, 4, "node4-candidacy:1", ts.Nodes(), true, nil)
ts.IssueBlocksAtSlots("wave-2:", []iotago.SlotIndex{5, 6, 7, 8, 9}, 4, "node4-candidacy:1", ts.Nodes(), true, false)

ts.IssueCandidacyAnnouncementInSlot("node4-candidacy:2", 9, "wave-2:9.3", ts.Wallet("node4"))
ts.IssueCandidacyAnnouncementInSlot("node5-candidacy:1", 9, "node4-candidacy:2", ts.Wallet("node5"))

// This candidacy should be considered as it's announced at the last possible slot.
ts.IssueCandidacyAnnouncementInSlot("node6-candidacy:1", 10, "node5-candidacy:1", ts.Wallet("node6"))

ts.IssueBlocksAtSlots("wave-3:", []iotago.SlotIndex{10}, 4, "node6-candidacy:1", ts.Nodes(), true, nil)
ts.IssueBlocksAtSlots("wave-3:", []iotago.SlotIndex{10}, 4, "node6-candidacy:1", ts.Nodes(), true, false)

// Those candidacies should not be considered as they're issued after EpochNearingThreshold (slot 10).
ts.IssueCandidacyAnnouncementInSlot("node2-candidacy:1", 11, "wave-3:10.3", ts.Wallet("node2"))
Expand All @@ -107,7 +107,7 @@ func Test_TopStakersRotation(t *testing.T) {
ts.Node("node6").Validator.AccountID,
}, ts.Nodes()...)

ts.IssueBlocksAtSlots("wave-4:", []iotago.SlotIndex{11, 12, 13, 14, 15, 16, 17}, 4, "node5-candidacy:2", ts.Nodes(), true, nil)
ts.IssueBlocksAtSlots("wave-4:", []iotago.SlotIndex{11, 12, 13, 14, 15, 16, 17}, 4, "node5-candidacy:2", ts.Nodes(), true, false)

ts.AssertLatestFinalizedSlot(14, ts.Nodes()...)
ts.AssertSybilProtectionCommittee(1, []iotago.AccountID{
Expand All @@ -119,7 +119,7 @@ func Test_TopStakersRotation(t *testing.T) {

// Do not announce new candidacies for epoch 2 but finalize slots. The committee should be the reused.
{
ts.IssueBlocksAtSlots("wave-5:", []iotago.SlotIndex{18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30}, 4, "wave-4:17.3", ts.Nodes(), true, nil)
ts.IssueBlocksAtSlots("wave-5:", []iotago.SlotIndex{18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30}, 4, "wave-4:17.3", ts.Nodes(), true, false)

ts.AssertSybilProtectionCandidates(1, []iotago.AccountID{}, ts.Nodes()...)
ts.AssertLatestCommitmentSlotIndex(28, ts.Nodes()...)
Expand All @@ -134,13 +134,13 @@ func Test_TopStakersRotation(t *testing.T) {
// Do not finalize slots in time for epoch 3. The committee should be the reused. Even though there are candidates.
{
// Issue blocks to remove the inactive committee members.
ts.IssueBlocksAtSlots("wave-6:", []iotago.SlotIndex{31, 32}, 4, "wave-5:30.3", ts.Nodes("node5", "node7"), false, nil)
ts.IssueBlocksAtSlots("wave-6:", []iotago.SlotIndex{31, 32}, 4, "wave-5:30.3", ts.Nodes("node5", "node7"), false, false)
ts.AssertLatestCommitmentSlotIndex(30, ts.Nodes()...)

ts.IssueCandidacyAnnouncementInSlot("node6-candidacy:2", 33, "wave-6:32.3", ts.Wallet("node6"))

// Issue the rest of the epoch just before we reach epoch end - maxCommittableAge.
ts.IssueBlocksAtSlots("wave-7:", []iotago.SlotIndex{33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45}, 4, "node6-candidacy:2", ts.Nodes("node5"), true, nil)
ts.IssueBlocksAtSlots("wave-7:", []iotago.SlotIndex{33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45}, 4, "node6-candidacy:2", ts.Nodes("node5"), true, false)

ts.AssertLatestCommitmentSlotIndex(43, ts.Nodes()...)
// Even though we have a candidate, the committee should be reused as we did not finalize at epochNearingThreshold before epoch end - maxCommittableAge was committed
Expand All @@ -157,11 +157,11 @@ func Test_TopStakersRotation(t *testing.T) {

// Rotate committee to smaller committee due to too few candidates available.
{
ts.IssueBlocksAtSlots("wave-8:", []iotago.SlotIndex{46, 47, 48, 49, 50, 51, 52, 53, 54, 55}, 4, "wave-7:45.3", ts.Nodes(), true, nil)
ts.IssueBlocksAtSlots("wave-8:", []iotago.SlotIndex{46, 47, 48, 49, 50, 51, 52, 53, 54, 55}, 4, "wave-7:45.3", ts.Nodes(), true, false)

ts.IssueCandidacyAnnouncementInSlot("node3-candidacy:2", 56, "wave-8:55.3", ts.Wallet("node3"))

ts.IssueBlocksAtSlots("wave-8:", []iotago.SlotIndex{56, 57, 58, 59, 60, 61}, 4, "node3-candidacy:2", ts.Nodes(), true, nil)
ts.IssueBlocksAtSlots("wave-8:", []iotago.SlotIndex{56, 57, 58, 59, 60, 61}, 4, "node3-candidacy:2", ts.Nodes(), true, false)

ts.AssertLatestCommitmentSlotIndex(59, ts.Nodes()...)
ts.AssertLatestFinalizedSlot(58, ts.Nodes()...)
Expand Down
18 changes: 9 additions & 9 deletions pkg/tests/loss_of_acceptance_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ func TestLossOfAcceptanceFromGenesis(t *testing.T) {

// Need to issue to slot 52 so that all other nodes can warp sync up to slot 49 and then commit slot 50 themselves.
{
ts.IssueBlocksAtSlots("", []iotago.SlotIndex{51, 52}, 2, "block0", ts.Nodes("node0"), true, nil)
ts.IssueBlocksAtSlots("", []iotago.SlotIndex{51, 52}, 2, "block0", ts.Nodes("node0"), true, false)

ts.AssertEqualStoredCommitmentAtIndex(50, ts.Nodes()...)
ts.AssertLatestCommitmentSlotIndex(50, ts.Nodes()...)
Expand All @@ -68,7 +68,7 @@ func TestLossOfAcceptanceFromGenesis(t *testing.T) {

// Continue issuing on all nodes for a few slots.
{
ts.IssueBlocksAtSlots("", []iotago.SlotIndex{53, 54, 55, 56, 57}, 3, "52.1", ts.Nodes(), true, nil)
ts.IssueBlocksAtSlots("", []iotago.SlotIndex{53, 54, 55, 56, 57}, 3, "52.1", ts.Nodes(), true, false)

ts.AssertEqualStoredCommitmentAtIndex(55, ts.Nodes()...)
ts.AssertLatestCommitmentSlotIndex(55, ts.Nodes()...)
Expand All @@ -87,7 +87,7 @@ func TestLossOfAcceptanceFromGenesis(t *testing.T) {

// Continue issuing on all nodes for a few slots.
{
ts.IssueBlocksAtSlots("", []iotago.SlotIndex{58, 59}, 3, "57.2", ts.Nodes("node0", "node1", "node2"), true, nil)
ts.IssueBlocksAtSlots("", []iotago.SlotIndex{58, 59}, 3, "57.2", ts.Nodes("node0", "node1", "node2"), true, false)

ts.AssertEqualStoredCommitmentAtIndex(57, ts.Nodes()...)
ts.AssertLatestCommitmentSlotIndex(57, ts.Nodes()...)
Expand Down Expand Up @@ -129,7 +129,7 @@ func TestLossOfAcceptanceFromSnapshot(t *testing.T) {

// Issue up to slot 10, committing slot 8.
{
ts.IssueBlocksAtSlots("", []iotago.SlotIndex{1, 2, 3, 4, 5, 6, 7, 8, 9, 10}, 3, "Genesis", ts.Nodes(), true, nil)
ts.IssueBlocksAtSlots("", []iotago.SlotIndex{1, 2, 3, 4, 5, 6, 7, 8, 9, 10}, 3, "Genesis", ts.Nodes(), true, false)

ts.AssertEqualStoredCommitmentAtIndex(8, ts.Nodes()...)
ts.AssertLatestCommitmentSlotIndex(8, ts.Nodes()...)
Expand Down Expand Up @@ -170,7 +170,7 @@ func TestLossOfAcceptanceFromSnapshot(t *testing.T) {

// Need to issue to slot 22 so that all other nodes can warp sync up to slot 19 and then commit slot 20 themselves.
{
ts.IssueBlocksAtSlots("", []iotago.SlotIndex{21, 22}, 2, "block0", ts.Nodes("node0-restarted"), true, nil)
ts.IssueBlocksAtSlots("", []iotago.SlotIndex{21, 22}, 2, "block0", ts.Nodes("node0-restarted"), true, false)

ts.AssertEqualStoredCommitmentAtIndex(20, ts.Nodes()...)
ts.AssertLatestCommitmentSlotIndex(20, ts.Nodes()...)
Expand All @@ -182,7 +182,7 @@ func TestLossOfAcceptanceFromSnapshot(t *testing.T) {
// are not used again.
ts.SetAutomaticTransactionIssuingCounters(node2.Partition, 24)

ts.IssueBlocksAtSlots("", []iotago.SlotIndex{23, 24, 25}, 3, "22.1", ts.Nodes(), true, nil)
ts.IssueBlocksAtSlots("", []iotago.SlotIndex{23, 24, 25}, 3, "22.1", ts.Nodes(), true, false)

ts.AssertEqualStoredCommitmentAtIndex(23, ts.Nodes()...)
ts.AssertLatestCommitmentSlotIndex(23, ts.Nodes()...)
Expand Down Expand Up @@ -224,7 +224,7 @@ func TestLossOfAcceptanceWithRestartFromDisk(t *testing.T) {

// Issue up to slot 10, committing slot 8.
{
ts.IssueBlocksAtSlots("", []iotago.SlotIndex{1, 2, 3, 4, 5, 6, 7, 8, 9, 10}, 3, "Genesis", ts.Nodes(), true, nil)
ts.IssueBlocksAtSlots("", []iotago.SlotIndex{1, 2, 3, 4, 5, 6, 7, 8, 9, 10}, 3, "Genesis", ts.Nodes(), true, false)

ts.AssertEqualStoredCommitmentAtIndex(8, ts.Nodes()...)
ts.AssertLatestCommitmentSlotIndex(8, ts.Nodes()...)
Expand Down Expand Up @@ -261,7 +261,7 @@ func TestLossOfAcceptanceWithRestartFromDisk(t *testing.T) {

// Need to issue to slot 22 so that all other nodes can warp sync up to slot 19 and then commit slot 20 themselves.
{
ts.IssueBlocksAtSlots("", []iotago.SlotIndex{21, 22}, 2, "block0", ts.Nodes("node0-restarted"), true, nil)
ts.IssueBlocksAtSlots("", []iotago.SlotIndex{21, 22}, 2, "block0", ts.Nodes("node0-restarted"), true, false)

ts.AssertEqualStoredCommitmentAtIndex(20, ts.Nodes()...)
ts.AssertLatestCommitmentSlotIndex(20, ts.Nodes()...)
Expand All @@ -273,7 +273,7 @@ func TestLossOfAcceptanceWithRestartFromDisk(t *testing.T) {
// are not used again.
ts.SetAutomaticTransactionIssuingCounters(node2.Partition, 24)

ts.IssueBlocksAtSlots("", []iotago.SlotIndex{23, 24, 25}, 3, "22.1", ts.Nodes(), true, nil)
ts.IssueBlocksAtSlots("", []iotago.SlotIndex{23, 24, 25}, 3, "22.1", ts.Nodes(), true, false)

ts.AssertEqualStoredCommitmentAtIndex(23, ts.Nodes()...)
ts.AssertLatestCommitmentSlotIndex(23, ts.Nodes()...)
Expand Down
16 changes: 8 additions & 8 deletions pkg/tests/protocol_engine_rollback_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ func TestProtocol_EngineRollbackFinalization(t *testing.T) {
// Issue up to slot 11 - just before committee selection for the next epoch.
// Committee will be reused at slot 10 is finalized or slot 12 is committed, whichever happens first.
{
ts.IssueBlocksAtSlots("P0:", []iotago.SlotIndex{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11}, 4, "Genesis", ts.Nodes(), true, nil)
ts.IssueBlocksAtSlots("P0:", []iotago.SlotIndex{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11}, 4, "Genesis", ts.Nodes(), true, false)

ts.AssertNodeState(ts.Nodes(),
testsuite.WithLatestFinalizedSlot(8),
Expand All @@ -163,7 +163,7 @@ func TestProtocol_EngineRollbackFinalization(t *testing.T) {
}

{
ts.IssueBlocksAtSlots("P0:", []iotago.SlotIndex{12, 13, 14, 15, 16}, 4, "P0:11.3", ts.Nodes(), true, nil)
ts.IssueBlocksAtSlots("P0:", []iotago.SlotIndex{12, 13, 14, 15, 16}, 4, "P0:11.3", ts.Nodes(), true, false)

ts.AssertNodeState(ts.Nodes(),
testsuite.WithLatestFinalizedSlot(13),
Expand Down Expand Up @@ -330,7 +330,7 @@ func TestProtocol_EngineRollbackNoFinalization(t *testing.T) {
// Issue up to slot 11 - just before committee selection for the next epoch.
// Committee will be reused when slot 10 is finalized or slot 12 is committed, whichever happens first.
{
ts.IssueBlocksAtSlots("P0:", []iotago.SlotIndex{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11}, 4, "Genesis", ts.Nodes(), true, nil)
ts.IssueBlocksAtSlots("P0:", []iotago.SlotIndex{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11}, 4, "Genesis", ts.Nodes(), true, false)

ts.AssertNodeState(ts.Nodes(),
testsuite.WithLatestFinalizedSlot(8),
Expand Down Expand Up @@ -363,7 +363,7 @@ func TestProtocol_EngineRollbackNoFinalization(t *testing.T) {
}

{
ts.IssueBlocksAtSlots("P0:", []iotago.SlotIndex{12, 13, 14, 15, 16}, 4, "P0:11.3", []*mock.Node{node0, node1}, true, nil)
ts.IssueBlocksAtSlots("P0:", []iotago.SlotIndex{12, 13, 14, 15, 16}, 4, "P0:11.3", []*mock.Node{node0, node1}, true, false)

ts.AssertNodeState(ts.Nodes(),
testsuite.WithLatestFinalizedSlot(8),
Expand Down Expand Up @@ -530,7 +530,7 @@ func TestProtocol_EngineRollbackNoFinalizationLastSlot(t *testing.T) {
// Issue up to slot 11 - just before committee selection for the next epoch.
// Committee will be reused at slot 10 is finalized or slot 12 is committed, whichever happens first.
{
ts.IssueBlocksAtSlots("P0:", []iotago.SlotIndex{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11}, 4, "Genesis", ts.Nodes(), true, nil)
ts.IssueBlocksAtSlots("P0:", []iotago.SlotIndex{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11}, 4, "Genesis", ts.Nodes(), true, false)

ts.AssertNodeState(ts.Nodes(),
testsuite.WithLatestFinalizedSlot(8),
Expand Down Expand Up @@ -563,7 +563,7 @@ func TestProtocol_EngineRollbackNoFinalizationLastSlot(t *testing.T) {
}

{
ts.IssueBlocksAtSlots("P0:", []iotago.SlotIndex{12, 13, 14, 15, 16, 17, 18, 19}, 4, "P0:11.3", []*mock.Node{node0, node1}, true, nil)
ts.IssueBlocksAtSlots("P0:", []iotago.SlotIndex{12, 13, 14, 15, 16, 17, 18, 19}, 4, "P0:11.3", []*mock.Node{node0, node1}, true, false)

ts.AssertNodeState(ts.Nodes(),
testsuite.WithLatestFinalizedSlot(8),
Expand Down Expand Up @@ -730,7 +730,7 @@ func TestProtocol_EngineRollbackNoFinalizationBeforePointOfNoReturn(t *testing.T
// Issue up to slot 11 - just before committee selection for the next epoch.
// Committee will be reused at slot 10 is finalized or slot 12 is committed, whichever happens first.
{
ts.IssueBlocksAtSlots("P0:", []iotago.SlotIndex{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11}, 4, "Genesis", ts.Nodes(), true, nil)
ts.IssueBlocksAtSlots("P0:", []iotago.SlotIndex{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11}, 4, "Genesis", ts.Nodes(), true, false)

ts.AssertNodeState(ts.Nodes(),
testsuite.WithLatestFinalizedSlot(8),
Expand Down Expand Up @@ -763,7 +763,7 @@ func TestProtocol_EngineRollbackNoFinalizationBeforePointOfNoReturn(t *testing.T
}

{
ts.IssueBlocksAtSlots("P0:", []iotago.SlotIndex{12, 13, 14, 15}, 4, "P0:11.3", []*mock.Node{node0, node1}, true, nil)
ts.IssueBlocksAtSlots("P0:", []iotago.SlotIndex{12, 13, 14, 15}, 4, "P0:11.3", []*mock.Node{node0, node1}, true, false)

ts.AssertNodeState(ts.Nodes(),
testsuite.WithLatestFinalizedSlot(8),
Expand Down
6 changes: 3 additions & 3 deletions pkg/tests/protocol_engine_switching_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ func TestProtocol_EngineSwitching(t *testing.T) {

// Issue up to slot 13 in P0 (main partition with all nodes) and verify that the nodes have the expected states.
{
ts.IssueBlocksAtSlots("P0:", []iotago.SlotIndex{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13}, 4, "Genesis", ts.Nodes(), true, nil)
ts.IssueBlocksAtSlots("P0:", []iotago.SlotIndex{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13}, 4, "Genesis", ts.Nodes(), true, false)

ts.AssertNodeState(ts.Nodes(),
testsuite.WithLatestFinalizedSlot(10),
Expand Down Expand Up @@ -220,7 +220,7 @@ func TestProtocol_EngineSwitching(t *testing.T) {

// Issue blocks in partition 1.
{
ts.IssueBlocksAtSlots("P1:", []iotago.SlotIndex{14, 15, 16, 17, 18, 19, 20}, 4, "P0:13.3", nodesP1[:len(nodesP1)-1], true, nil)
ts.IssueBlocksAtSlots("P1:", []iotago.SlotIndex{14, 15, 16, 17, 18, 19, 20}, 4, "P0:13.3", nodesP1[:len(nodesP1)-1], true, false)

ts.AssertNodeState(nodesP1,
testsuite.WithLatestFinalizedSlot(17),
Expand Down Expand Up @@ -274,7 +274,7 @@ func TestProtocol_EngineSwitching(t *testing.T) {

// Issue blocks in partition 2.
{
ts.IssueBlocksAtSlots("P2:", []iotago.SlotIndex{14, 15, 16, 17, 18, 19, 20}, 4, "P0:13.3", nodesP2[:len(nodesP2)-1], true, nil)
ts.IssueBlocksAtSlots("P2:", []iotago.SlotIndex{14, 15, 16, 17, 18, 19, 20}, 4, "P0:13.3", nodesP2[:len(nodesP2)-1], true, false)

ts.AssertNodeState(nodesP2,
testsuite.WithLatestFinalizedSlot(10),
Expand Down
Loading

0 comments on commit 6eff84f

Please sign in to comment.