diff --git a/core/state/journal.go b/core/state/journal.go index 8f2e888b38..4bb204a3dd 100644 --- a/core/state/journal.go +++ b/core/state/journal.go @@ -179,7 +179,8 @@ func (j *journal) stashBalance(addr common.Address, prev *uint256.Int) { if s.balanceSet { return } - s.balance = prev.Clone() + // The balance is already deep-copied in the StateDB + s.balance = prev s.balanceSet = true } @@ -199,7 +200,8 @@ func (j *journal) stashCode(addr common.Address, prev []byte) { if s.codeSet { return } - s.code = slices.Clone(prev) + // The code is already deep-copied in the StateDB + s.code = prev s.codeSet = true } diff --git a/core/state/state_object.go b/core/state/state_object.go index 7c4ee9e427..df0740320c 100644 --- a/core/state/state_object.go +++ b/core/state/state_object.go @@ -184,8 +184,9 @@ func (s *stateObject) getState(key common.Hash) (common.Hash, common.Hash) { // without any mutations caused in the current execution. func (s *stateObject) GetCommittedState(key common.Hash) common.Hash { // Record slot access regardless of whether the storage slot exists. - s.db.stateAccessList.StorageRead(s.address, key) - + if s.db.stateAccessList != nil { + s.db.stateAccessList.StorageRead(s.address, key) + } // If we have a pending write or clean cached, return that if value, pending := s.pendingStorage[key]; pending { return value diff --git a/core/state/statedb.go b/core/state/statedb.go index d9f3ad86f2..ea5900537f 100644 --- a/core/state/statedb.go +++ b/core/state/statedb.go @@ -590,8 +590,9 @@ func (s *StateDB) deleteStateObject(addr common.Address) { // the object is not found or was deleted in this execution context. func (s *StateDB) getStateObject(addr common.Address) *stateObject { // Record state access regardless of whether the account exists. - s.stateAccessList.AccountRead(addr) - + if s.stateAccessList != nil { + s.stateAccessList.AccountRead(addr) + } // Prefer live objects if any is available if obj := s.stateObjects[addr]; obj != nil { return obj