diff --git a/core/state/statedb.go b/core/state/statedb.go index 636026694e..9dcc3a0c7b 100644 --- a/core/state/statedb.go +++ b/core/state/statedb.go @@ -1430,7 +1430,10 @@ func (s *StateDB) Prepare(rules params.Rules, sender, coinbase common.Address, d } // Reset transient storage at the beginning of transaction execution s.transientStorage = newTransientStorage() - s.stateReadList = bal.NewStateAccessList() + + if rules.IsAmsterdam { + s.stateReadList = bal.NewStateAccessList() + } } // AddAddressToAccessList adds the given address to the access list diff --git a/core/types/bal/access_list.go b/core/types/bal/access_list.go index 243fd1fd7c..91da5ebcb7 100644 --- a/core/types/bal/access_list.go +++ b/core/types/bal/access_list.go @@ -42,6 +42,9 @@ func NewStateAccessList() *StateAccessList { // AddAccount records an access to the given account. It is a no-op if the // account is already present. func (s *StateAccessList) AddAccount(addr common.Address) { + if s == nil { + return + } if _, exists := s.list[addr]; !exists { s.list[addr] = make(StorageAccessList) } @@ -50,6 +53,9 @@ func (s *StateAccessList) AddAccount(addr common.Address) { // AddState records an access to the given storage slot. The owning account is // implicitly recorded as well. func (s *StateAccessList) AddState(addr common.Address, slot common.Hash) { + if s == nil { + return + } slots, exists := s.list[addr] if !exists { slots = make(StorageAccessList) @@ -60,6 +66,9 @@ func (s *StateAccessList) AddState(addr common.Address, slot common.Hash) { // Merge merges the entries from other into the receiver. func (s *StateAccessList) Merge(other *StateAccessList) { + if s == nil || other == nil { + return + } for addr, otherSlots := range other.list { slots, exists := s.list[addr] if !exists {