fix(statesize): use hash length

Signed-off-by: jsvisa <delweng@gmail.com>
This commit is contained in:
jsvisa 2025-08-18 08:57:18 +00:00
parent b8d6e5e203
commit 3480095c43
2 changed files with 3 additions and 3 deletions

View file

@ -254,11 +254,11 @@ func (sc *StateUpdate) IntoChangeset() *StateChangeset {
} }
if len(newValue) == 0 { if len(newValue) == 0 {
storages -= 1 storages -= 1
storageSize -= common.HashLength storageSize -= 2 * common.HashLength
} }
if len(oldValue) == 0 { if len(oldValue) == 0 {
storages += 1 storages += 1
storageSize += common.HashLength storageSize += 2 * common.HashLength
} }
storageSize += len(newValue) - len(oldValue) storageSize += len(newValue) - len(oldValue)
} }

View file

@ -77,7 +77,7 @@ func (s *stateTracer) onGenesisBlock(b *types.Block, alloc types.GenesisAlloc) {
) )
for _, account := range alloc { for _, account := range alloc {
accounts++ accounts++
accountSize += common.AddressLength accountSize += common.HashLength
storages += len(account.Storage) storages += len(account.Storage)
storageSize += len(account.Storage) * 2 * common.HashLength storageSize += len(account.Storage) * 2 * common.HashLength
if len(account.Code) > 0 { if len(account.Code) > 0 {