Skip to content

Commit

Permalink
Check committee after candidacy payloads are processed in Test_ReuseD…
Browse files Browse the repository at this point in the history
…ueToNoFinalization
  • Loading branch information
jkrvivian committed May 17, 2024
1 parent 6b34744 commit 3a82b70
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions tools/docker-network/tests/committeerotation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,20 @@ func Test_ReuseDueToNoFinalization(t *testing.T) {

d.WaitUntilNodesHealthy()

nextEpoch = calcNextEpoch(d.NodeStatus("V1"), clt.CommittedAPI().TimeProvider(), nextEpoch+1)
d.AssertCommittee(nextEpoch, d.AccountsFromNodes(d.Nodes("V1", "V2", "V4")...))
// check if V2 missed to announce the candidacy during inx-validator restart.
latestAcceptedBlockSlot := d.NodeStatus("V1").LatestAcceptedBlockSlot
annoucementStartEpoch := clt.CommittedAPI().TimeProvider().EpochFromSlot(latestAcceptedBlockSlot)
maxRegistrationSlot := dockertestframework.GetMaxRegistrationSlot(clt.CommittedAPI(), annoucementStartEpoch)
// the candidacy announcement needs to be done before the nearing threshold of the epoch
if latestAcceptedBlockSlot >= maxRegistrationSlot {
// it's too late for validator to issue candidacy payloads anymore, so we wait until the next epoch
annoucementStartEpoch++
}

// we check if the committee is updated in the next epoch, after candidacy announcement have been processed
checkCommitteeEpoch := annoucementStartEpoch + 1

d.AssertCommittee(checkCommitteeEpoch, d.AccountsFromNodes(d.Nodes("V1", "V2", "V4")...))

// wait finalization to catch up and check if the finalization resumes
time.Sleep(5 * time.Second)
Expand Down

0 comments on commit 3a82b70

Please sign in to comment.