From e98d76fb240044d4173ac8aa803232b44cd83f93 Mon Sep 17 00:00:00 2001 From: Emmanuel T Odeke Date: Mon, 13 Dec 2021 11:39:35 -0800 Subject: [PATCH] Revert stray changes that were used in testing --- x/evm/keeper/benchmark_test.go | 33 --------------------------------- x/evm/keeper/statedb.go | 5 +---- 2 files changed, 1 insertion(+), 37 deletions(-) diff --git a/x/evm/keeper/benchmark_test.go b/x/evm/keeper/benchmark_test.go index 69ad2639b8..c312681508 100644 --- a/x/evm/keeper/benchmark_test.go +++ b/x/evm/keeper/benchmark_test.go @@ -180,36 +180,3 @@ func BenchmarkDeepContextStack10(b *testing.B) { func BenchmarkDeepContextStack13(b *testing.B) { DoBenchmarkDeepContextStack(b, 13) } - -func before() *big.Int { - b2 := new(big.Int).SetUint64(2) - return new(big.Int).Mul(b2, new(big.Int).SetUint64(34)) -} - -func after() *big.Int { - b2 := new(big.Int).SetUint64(2) - return b2 - return b2.Mul(b2, new(big.Int).SetUint64(34)) -} - -var sink interface{} - -func BenchmarkMulBefore(b *testing.B) { - for i := 0; i < b.N; i++ { - sink = before() - } - if sink == nil { - b.Fatal("Benchmark did not run") - } - sink = (interface{})(nil) -} - -func BenchmarkMulAfter(b *testing.B) { - for i := 0; i < b.N; i++ { - sink = after() - } - if sink == nil { - b.Fatal("Benchmark did not run") - } - sink = (interface{})(nil) -} diff --git a/x/evm/keeper/statedb.go b/x/evm/keeper/statedb.go index 4a912ede9e..ac1cef6650 100644 --- a/x/evm/keeper/statedb.go +++ b/x/evm/keeper/statedb.go @@ -623,15 +623,12 @@ func (k *Keeper) Empty(addr common.Address) bool { codeHash = common.HexToHash(ethAccount.CodeHash).Bytes() } - if nonce == 0 { - return false - } balance := k.GetBalance(addr) hasZeroBalance := balance.Sign() == 0 hasEmptyCodeHash := bytes.Equal(codeHash, types.EmptyCodeHash) - return hasZeroBalance && hasEmptyCodeHash + return hasZeroBalance && nonce == 0 && hasEmptyCodeHash } // ----------------------------------------------------------------------------