Skip to content

Commit

Permalink
Merge pull request #10847 from filecoin-project/asr/deflake-ethbalance
Browse files Browse the repository at this point in the history
feat: deflake eth_balance_test
  • Loading branch information
arajasek authored May 9, 2023
2 parents ff8d81d + a4235e2 commit 7c98160
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions itests/eth_balance_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,15 +121,24 @@ func TestEthBalanceCorrectLookup(t *testing.T) {
require.NoError(t, err)
require.True(t, ml.Receipt.ExitCode.IsSuccess())

bal, err := client.EVM().EthGetBalance(ctx, ethAddr, strconv.FormatInt(int64(ml.Height-2), 10))
execTs, err := client.ChainGetTipSet(ctx, ml.TipSet)
require.NoError(t, err)

inclTs, err := client.ChainGetTipSet(ctx, execTs.Parents())
require.NoError(t, err)

inclTsParents, err := client.ChainGetTipSet(ctx, inclTs.Parents())
require.NoError(t, err)

bal, err := client.EVM().EthGetBalance(ctx, ethAddr, strconv.FormatInt(int64(inclTsParents.Height()), 10))
require.NoError(t, err)
require.Equal(t, int64(0), bal.Int64())

bal, err = client.EVM().EthGetBalance(ctx, ethAddr, strconv.FormatInt(int64(ml.Height-1), 10))
bal, err = client.EVM().EthGetBalance(ctx, ethAddr, strconv.FormatInt(int64(inclTs.Height()), 10))
require.NoError(t, err)
require.Equal(t, val, bal.Int64())

bal, err = client.EVM().EthGetBalance(ctx, ethAddr, strconv.FormatInt(int64(ml.Height), 10))
bal, err = client.EVM().EthGetBalance(ctx, ethAddr, strconv.FormatInt(int64(execTs.Height()), 10))
require.NoError(t, err)
require.Equal(t, val, bal.Int64())
}

0 comments on commit 7c98160

Please sign in to comment.