From fe799fa653284c24096c70dc001b8bf8a91cc3cd Mon Sep 17 00:00:00 2001 From: Sina Mahmoodi Date: Wed, 8 Apr 2026 13:56:36 +0000 Subject: [PATCH] simplify --- eth/tracers/native/prestate.go | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/eth/tracers/native/prestate.go b/eth/tracers/native/prestate.go index 0be1d02002..c072bf755f 100644 --- a/eth/tracers/native/prestate.go +++ b/eth/tracers/native/prestate.go @@ -266,25 +266,15 @@ func (t *prestateTracer) processDiffState() { modified = true postAccount.Nonce = newNonce } - prevCodeHash := common.Hash{} + // Empty code hashes are excluded from the prestate, so default + // to EmptyCodeHash to match what GetCodeHash returns for codeless accounts. + prevCodeHash := types.EmptyCodeHash if t.pre[addr].CodeHash != nil { prevCodeHash = *t.pre[addr].CodeHash } - // Empty code hashes are excluded from the prestate. Normalize - // the empty code hash to a zero hash to make it comparable. - if newCodeHash == types.EmptyCodeHash { - newCodeHash = common.Hash{} - } if newCodeHash != prevCodeHash { modified = true - // If code was cleared, report the canonical empty code hash - // rather than the zero hash used for comparison. - if newCodeHash == (common.Hash{}) { - emptyHash := types.EmptyCodeHash - postAccount.CodeHash = &emptyHash - } else { - postAccount.CodeHash = &newCodeHash - } + postAccount.CodeHash = &newCodeHash } if !t.config.DisableCode { newCode := t.env.StateDB.GetCode(addr)