Commit 815b6779 authored by Mark Tyneway's avatar Mark Tyneway Committed by GitHub

Merge pull request #3255 from ethereum-optimism/fix/flakey-tests

state-surgery: fix flakey tests
parents 838d4204 f0f963bd
...@@ -28,7 +28,7 @@ func TestAddBalance(t *testing.T) { ...@@ -28,7 +28,7 @@ func TestAddBalance(t *testing.T) {
account := db.GetAccount(addr) account := db.GetAccount(addr)
require.NotNil(t, account) require.NotNil(t, account)
require.Equal(t, account.Balance, value) require.True(t, BigEqual(account.Balance, value))
} }
} }
...@@ -61,3 +61,11 @@ func TestCode(t *testing.T) { ...@@ -61,3 +61,11 @@ func TestCode(t *testing.T) {
require.Equal(t, codeHash, common.BytesToHash(crypto.Keccak256(code))) require.Equal(t, codeHash, common.BytesToHash(crypto.Keccak256(code)))
} }
} }
func BigEqual(a, b *big.Int) bool {
if a == nil || b == nil {
return a == b
} else {
return a.Cmp(b) == 0
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment