diff --git a/test/e2e-go/features/incentives/payouts_test.go b/test/e2e-go/features/incentives/payouts_test.go index 28fc91089e..7c4cc32aac 100644 --- a/test/e2e-go/features/incentives/payouts_test.go +++ b/test/e2e-go/features/incentives/payouts_test.go @@ -120,6 +120,7 @@ func TestBasicPayouts(t *testing.T) { } next, err := client.AccountData(block.Proposer().String()) + a.NoError(err) a.LessOrEqual(int(status.LastRound), int(next.LastProposed)) // regardless of proposer, nobody gets paid switch block.Proposer().String() { @@ -137,6 +138,12 @@ func TestBasicPayouts(t *testing.T) { a.NoError(err) } + // all nodes are in sync + for _, c := range []libgoal.Client{c15, c01, relay} { + _, err := c.WaitForRound(status.LastRound) + a.NoError(err) + } + // Wait until each have proposed, so we can see that 01 gets paid and 15 does not (too much balance) proposed01 := false proposed15 := false @@ -148,13 +155,17 @@ func TestBasicPayouts(t *testing.T) { a.EqualValues(bonus1, block.Bonus.Raw) next, err := client.AccountData(block.Proposer().String()) + a.NoError(err) fmt.Printf(" proposer %v has %d after proposing round %d\n", block.Proposer(), next.MicroAlgos.Raw, status.LastRound) // all nodes agree the proposer proposed for i, c := range []libgoal.Client{c15, c01, relay} { + _, err := c.WaitForRound(status.LastRound) + a.NoError(err) data, err := c.AccountData(block.Proposer().String()) a.NoError(err) - a.Equal(block.Round(), data.LastProposed, i) + // <= in case one node is behind, and the others have already advanced + a.LessOrEqual(block.Round(), data.LastProposed, i) } // 01 would get paid (because under balance cap) 15 would not @@ -211,14 +222,21 @@ func TestBasicPayouts(t *testing.T) { a.NoError(err) for _, c := range []libgoal.Client{c15, c01, relay} { + _, err := c.WaitForRound(status.LastRound) + a.NoError(err) data, err = c.AccountData(block.Proposer().String()) a.NoError(err) - a.Equal(block.Round(), data.LastProposed) - a.Equal(pdata, data) + // <= in case one node is behind, and the others have already advanced + a.LessOrEqual(block.Round(), data.LastProposed) + // <= in case one node is behind, and the others have already advanced + a.LessOrEqual(pdata.MicroAlgos.Raw, data.MicroAlgos.Raw) + a.Equal(pdata.Status, data.Status) + a.True(data.IncentiveEligible) data, err = c.AccountData(feesink.String()) a.NoError(err) - a.Equal(fdata, data) + // >= in case one node is behind, and the others have already advanced + a.GreaterOrEqual(fdata.MicroAlgos.Raw, data.MicroAlgos.Raw) } a.LessOrEqual(100000, int(data.MicroAlgos.Raw)) // won't go below minfee if data.MicroAlgos.Raw == 100000 { @@ -270,6 +288,7 @@ func TestBasicPayouts(t *testing.T) { // account is gone anyway (it didn't get paid) data, err = relay.AccountData(account01.Address) + a.NoError(err) a.Zero(data, "%+v", data) data, err = relay.AccountData(feesink.String()) diff --git a/test/e2e-go/features/incentives/suspension_test.go b/test/e2e-go/features/incentives/suspension_test.go index 3d3f0954f6..9be9cade6b 100644 --- a/test/e2e-go/features/incentives/suspension_test.go +++ b/test/e2e-go/features/incentives/suspension_test.go @@ -155,11 +155,13 @@ func TestBasicSuspension(t *testing.T) { stat, err = lg.WaitForRound(stat.LastRound + 1) a.NoError(err) attempts++ - a.Less(attempts, suspend20, "n20 didn't propose\n") + a.Less(attempts, 2*suspend20, "n20 didn't propose\n") } // paranoia. see payouts_test.go for more details. r := require.New(t) for i, c := range []libgoal.Client{c10, c20} { + _, err := c.WaitForRound(stat.LastRound) + r.NoError(err) account, err = c.AccountData(account20.Address) a.NoError(err) r.Equal(basics.Online, account.Status, i)