diff --git a/core/state/statedb.go b/core/state/statedb.go index 5d94d4806d..1858f4758d 100644 --- a/core/state/statedb.go +++ b/core/state/statedb.go @@ -716,6 +716,9 @@ func (s *StateDB) Copy() *StateDB { if s.accessEvents != nil { state.accessEvents = s.accessEvents.Copy() } + if s.stateReadList != nil { + state.stateReadList = s.stateReadList.Copy() + } // Deep copy cached state objects. for addr, obj := range s.stateObjects { state.stateObjects[addr] = obj.deepCopy(state) diff --git a/core/types/bal/access_list.go b/core/types/bal/access_list.go index 91da5ebcb7..e563fa22e2 100644 --- a/core/types/bal/access_list.go +++ b/core/types/bal/access_list.go @@ -78,3 +78,17 @@ func (s *StateAccessList) Merge(other *StateAccessList) { maps.Copy(slots, otherSlots) } } + +// Copy returns a deep copy of the StateAccessList. +func (s *StateAccessList) Copy() *StateAccessList { + if s == nil { + return nil + } + cpy := &StateAccessList{ + list: make(map[common.Address]StorageAccessList, len(s.list)), + } + for addr, slots := range s.list { + cpy.list[addr] = maps.Clone(slots) + } + return cpy +}