Merge pull request #10847 from filecoin-project/asr/deflake-ethbalance

feat: deflake eth_balance_test
This commit is contained in:
Aayush Rajasekaran 2023-05-09 12:48:45 -04:00 committed by GitHub
commit 7c98160b81
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -121,15 +121,24 @@ func TestEthBalanceCorrectLookup(t *testing.T) {
require.NoError(t, err) require.NoError(t, err)
require.True(t, ml.Receipt.ExitCode.IsSuccess()) 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.NoError(t, err)
require.Equal(t, int64(0), bal.Int64()) 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.NoError(t, err)
require.Equal(t, val, bal.Int64()) 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.NoError(t, err)
require.Equal(t, val, bal.Int64()) require.Equal(t, val, bal.Int64())
} }