Skip to content

Commit

Permalink
Testing: Don't fail for heartbeat in same block as proposal (algorand…
Browse files Browse the repository at this point in the history
  • Loading branch information
jannotti authored Jan 15, 2025
1 parent afb8216 commit 80077cb
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions test/e2e-go/features/incentives/challenge_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,7 @@ func testChallengesOnce(t *testing.T, a *require.Assertions) (retry bool) {
// Watch the first half grace period for proposals from challenged nodes, since they won't have to heartbeat.
lucky := util.MakeSet[basics.Address]()
fixture.WithEveryBlock(challengeRound, challengeRound+grace/2, func(block bookkeeping.Block) {
t.Logf("1st half Block %d, proposed by %s\n", block.Round(), block.Proposer())
if eligible2.Contains(block.Proposer()) {
lucky.Add(block.Proposer())
}
Expand All @@ -186,10 +187,7 @@ func testChallengesOnce(t *testing.T, a *require.Assertions) (retry bool) {
// In the second half of the grace period, Node 2 should heartbeat for its eligible accounts
beated := util.MakeSet[basics.Address]()
fixture.WithEveryBlock(challengeRound+grace/2+1, challengeRound+grace, func(block bookkeeping.Block) {
t.Logf("2nd half Block %d\n", block.Round())
if eligible2.Contains(block.Proposer()) {
lucky.Add(block.Proposer())
}
t.Logf("2nd half Block %d, proposed by %s\n", block.Round(), block.Proposer())
for i, txn := range block.Payset {
hb := txn.Txn.HeartbeatTxnFields
t.Logf("Heartbeat txn %v in position %d round %d\n", hb, i, block.Round())
Expand All @@ -199,6 +197,9 @@ func testChallengesOnce(t *testing.T, a *require.Assertions) (retry bool) {
beated.Add(hb.HbAddress)
a.NotContains(lucky, hb.HbAddress, "unneeded %s", hb.HbAddress) // we should not see a heartbeat from an account that proposed
}
if eligible2.Contains(block.Proposer()) {
lucky.Add(block.Proposer())
}
a.Empty(block.AbsentParticipationAccounts) // nobody suspended during grace
})
a.Equal(eligible2, util.Union(beated, lucky))
Expand Down

0 comments on commit 80077cb

Please sign in to comment.