core/state: address comments

This commit is contained in:
Gary Rong 2026-04-20 21:10:26 +08:00
parent a70367b8ae
commit 2758b1af48
2 changed files with 6 additions and 11 deletions

View file

@ -181,16 +181,16 @@ func (s *StateDB) DumpToCollector(c DumpCollector, conf *DumpConfig) (nextKey []
return nil, err
}
for storageIt.Next() {
key, err := storageIt.Key()
if err != nil {
// Silently ignore the storage slot without the key preimage.
continue
}
val := storageIt.Slot()
if err := storageIt.Error(); err != nil {
storageIt.Release()
return nil, err
}
account.Storage[key] = val.Hex()
key, err := storageIt.Key()
if err != nil {
continue
}
account.Storage[key] = common.Bytes2Hex(common.TrimLeftZeroes(val[:]))
}
storageIt.Release()
}

View file

@ -127,11 +127,6 @@ func NewStateUpdate(typ StorageKeyEncoding, originRoot common.Hash, root common.
accounts[addrHash] = nil
accountsOrigin[addr] = op.Origin
// If storage wiping is present, the StorageKeyEncoding MUST be hashed.
// Deleted storage slots are iterated from either the trie or the flat
// state snapshot, both of which use the storage slot hash as the identifier.
// Fortunately, storage wiping is no longer practical after the Cancun fork
// and is not expected to occur.
if len(op.Storages) > 0 {
storages[addrHash] = op.Storages
}