From e3a674fb26d51bc6ba549e662b599f39a518b465 Mon Sep 17 00:00:00 2001 From: Aayush <arajasek94@gmail.com> Date: Wed, 3 May 2023 14:53:31 -0400 Subject: [PATCH] feat: deflake TestEthFeeHistory --- itests/eth_fee_history_test.go | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-) diff --git a/itests/eth_fee_history_test.go b/itests/eth_fee_history_test.go index a792c7f0e93..a4858d3d0db 100644 --- a/itests/eth_fee_history_test.go +++ b/itests/eth_fee_history_test.go @@ -50,19 +50,6 @@ func TestEthFeeHistory(t *testing.T) { ctx, cancel := context.WithTimeout(context.Background(), time.Minute) defer cancel() - heads, err := client.ChainNotify(ctx) - require.NoError(err) - - // Save the full view of the tipsets to calculate the answer when there are null rounds - tsHeights := []int{1} - go func() { - for chg := range heads { - for _, c := range chg { - tsHeights = append(tsHeights, int(c.Val.Height())) - } - } - }() - miner := ens.InterconnectAll().BeginMining(blockTime) client.WaitTillChain(ctx, kit.HeightAtLeast(7)) @@ -89,7 +76,15 @@ func TestEthFeeHistory(t *testing.T) { } }() - sort.Ints(tsHeights) + currTs, err := client.ChainHead(ctx) + require.NoError(err) + + var tsHeights []int + for currTs.Height() != 0 { + tsHeights = append([]int{int(currTs.Height())}, tsHeights...) + currTs, err = client.ChainGetTipSet(ctx, currTs.Parents()) + require.NoError(err) + } // because of the deferred execution, the last tipset is not executed yet, // and the one before the last one is the last executed tipset,