From 3480095c433ea6eb8dd303ae2de98d246ea92587 Mon Sep 17 00:00:00 2001 From: jsvisa Date: Mon, 18 Aug 2025 08:57:18 +0000 Subject: [PATCH] fix(statesize): use hash length Signed-off-by: jsvisa --- core/state/stateupdate.go | 4 ++-- eth/tracers/live/state.go | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/core/state/stateupdate.go b/core/state/stateupdate.go index f4656dfa79..31952c3dea 100644 --- a/core/state/stateupdate.go +++ b/core/state/stateupdate.go @@ -254,11 +254,11 @@ func (sc *StateUpdate) IntoChangeset() *StateChangeset { } if len(newValue) == 0 { storages -= 1 - storageSize -= common.HashLength + storageSize -= 2 * common.HashLength } if len(oldValue) == 0 { storages += 1 - storageSize += common.HashLength + storageSize += 2 * common.HashLength } storageSize += len(newValue) - len(oldValue) } diff --git a/eth/tracers/live/state.go b/eth/tracers/live/state.go index 3823cfa5f2..82169516cf 100644 --- a/eth/tracers/live/state.go +++ b/eth/tracers/live/state.go @@ -77,7 +77,7 @@ func (s *stateTracer) onGenesisBlock(b *types.Block, alloc types.GenesisAlloc) { ) for _, account := range alloc { accounts++ - accountSize += common.AddressLength + accountSize += common.HashLength storages += len(account.Storage) storageSize += len(account.Storage) * 2 * common.HashLength if len(account.Code) > 0 {