diff --git a/core/state/statedb.go b/core/state/statedb.go index f5abfbd8ff..fbc72ffd97 100644 --- a/core/state/statedb.go +++ b/core/state/statedb.go @@ -1050,7 +1050,7 @@ func (s *StateDB) deleteStorage(addr common.Address, addrHash common.Hash, root // with their values be tracked as original value. // In case (d), **original** account along with its storages should be deleted, // with their values be tracked as original value. -func (s *StateDB) handleDestruction(noStorageWiping bool) (map[common.Hash]*accountDelete, []*trienode.NodeSet, error) { +func (s *StateDB) handleDestruction(rawStorageKey bool) (map[common.Hash]*accountDelete, []*trienode.NodeSet, error) { var ( nodes []*trienode.NodeSet buf = crypto.NewKeccakState() @@ -1079,7 +1079,7 @@ func (s *StateDB) handleDestruction(noStorageWiping bool) (map[common.Hash]*acco if prev.Root == types.EmptyRootHash || s.db.TrieDB().IsVerkle() { continue } - if noStorageWiping { + if rawStorageKey { return nil, nil, fmt.Errorf("unexpected storage wiping, %x", addr) } // Remove storage slots belonging to the account. @@ -1103,7 +1103,7 @@ func (s *StateDB) GetTrie() Trie { // commit gathers the state mutations accumulated along with the associated // trie changes, resetting all internal flags with the new state as the base. -func (s *StateDB) commit(deleteEmptyObjects bool, noStorageWiping bool) (*stateUpdate, error) { +func (s *StateDB) commit(deleteEmptyObjects bool, rawStorageKey bool) (*stateUpdate, error) { // Short circuit in case any database failure occurred earlier. if s.dbErr != nil { return nil, fmt.Errorf("commit aborted due to earlier error: %v", s.dbErr) @@ -1157,7 +1157,7 @@ func (s *StateDB) commit(deleteEmptyObjects bool, noStorageWiping bool) (*stateU // the same block, account deletions must be processed first. This ensures // that the storage trie nodes deleted during destruction and recreated // during subsequent resurrection can be combined correctly. - deletes, delNodes, err := s.handleDestruction(noStorageWiping) + deletes, delNodes, err := s.handleDestruction(rawStorageKey) if err != nil { return nil, err } @@ -1213,7 +1213,7 @@ func (s *StateDB) commit(deleteEmptyObjects bool, noStorageWiping bool) (*stateU // Run the storage updates concurrently to one another workers.Go(func() error { // Write any storage changes in the state object to its storage trie - update, set, err := obj.commit(noStorageWiping) + update, set, err := obj.commit(rawStorageKey) if err != nil { return err } @@ -1255,13 +1255,13 @@ func (s *StateDB) commit(deleteEmptyObjects bool, noStorageWiping bool) (*stateU origin := s.originalRoot s.originalRoot = root - return newStateUpdate(noStorageWiping, origin, root, deletes, updates, nodes), nil + return newStateUpdate(rawStorageKey, origin, root, deletes, updates, nodes), nil } // commitAndFlush is a wrapper of commit which also commits the state mutations // to the configured data stores. -func (s *StateDB) commitAndFlush(block uint64, deleteEmptyObjects bool, noStorageWiping bool) (*stateUpdate, error) { - ret, err := s.commit(deleteEmptyObjects, noStorageWiping) +func (s *StateDB) commitAndFlush(block uint64, deleteEmptyObjects bool, rawStorageKey bool) (*stateUpdate, error) { + ret, err := s.commit(deleteEmptyObjects, rawStorageKey) if err != nil { return nil, err } @@ -1314,12 +1314,12 @@ func (s *StateDB) commitAndFlush(block uint64, deleteEmptyObjects bool, noStorag // The associated block number of the state transition is also provided // for more chain context. // -// noStorageWiping is a flag indicating whether storage wiping is permitted. +// rawStorageKey is a flag indicating whether storage wiping is permitted. // Since self-destruction was deprecated with the Cancun fork and there are // no empty accounts left that could be deleted by EIP-158, storage wiping // should not occur. -func (s *StateDB) Commit(block uint64, deleteEmptyObjects bool, noStorageWiping bool) (common.Hash, error) { - ret, err := s.commitAndFlush(block, deleteEmptyObjects, noStorageWiping) +func (s *StateDB) Commit(block uint64, deleteEmptyObjects bool, rawStorageKey bool) (common.Hash, error) { + ret, err := s.commitAndFlush(block, deleteEmptyObjects, rawStorageKey) if err != nil { return common.Hash{}, err }