From 3c5440b87af3d18a803f9ecf661b564d67ab1d1f Mon Sep 17 00:00:00 2001 From: Gary Rong Date: Tue, 3 Feb 2026 16:58:37 +0800 Subject: [PATCH] core/state: track slot reads for empty storage --- core/state/state_object.go | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/core/state/state_object.go b/core/state/state_object.go index 2873c3cb8a..0f4cf37be7 100644 --- a/core/state/state_object.go +++ b/core/state/state_object.go @@ -188,6 +188,19 @@ func (s *stateObject) GetCommittedState(key common.Hash) common.Hash { // have been handles via pendingStorage above. // 2) we don't have new values, and can deliver empty response back if _, destructed := s.db.stateObjectsDestruct[s.address]; destructed { + // Invoke the reader regardless and discard the returned value. + // The returned value may not be empty, as it could belong to a + // self-destructed contract. + // + // The read operation is still essential for correctly building + // the block-level access list. + // + // TODO(rjl493456442) the reader interface can be extended with + // Touch, recording the read access without the actual disk load. + _, err := s.db.reader.Storage(s.address, key) + if err != nil { + s.db.setError(err) + } s.originStorage[key] = common.Hash{} // track the empty slot as origin value return common.Hash{} }