From 91b3543b6181376b0f19fac06688fb860169b08d Mon Sep 17 00:00:00 2001 From: Gary Rong Date: Mon, 16 Mar 2026 15:35:37 +0800 Subject: [PATCH] core/state: fix test --- core/state/reader_eip_7928.go | 18 ++++++++++++------ core/state/reader_eip_7928_test.go | 8 ++++---- 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/core/state/reader_eip_7928.go b/core/state/reader_eip_7928.go index 180688f010..4af72959a7 100644 --- a/core/state/reader_eip_7928.go +++ b/core/state/reader_eip_7928.go @@ -32,21 +32,21 @@ package state // with mutated states from preceding transactions in the block. // // - Tracking Layer: Finally, the readerTracker wraps the execution reader to -// capture all state accesses made during a specific transaction. These individual -// access are subsequently merged to construct a comprehensive access list +// capture all state reads made during a specific transaction. These individual +// reads are subsequently merged to construct a comprehensive access list // for the entire block. // // The architecture can be illustrated by the diagram below: -// [ Block Level Access List ] <────────────────┐ -// ▲ │ (Merge) +// [ Block Level Read List ] <────────────────┐ +// ▲ │ ( Aggregate ) // │ │ // ┌───────┴───────┐ ┌───────┴───────┐ -// │ readerTracker │ │ readerTracker │ (Access Tracking) +// │ readerTracker │ │ readerTracker │ (State read tracking) // └───────┬───────┘ └───────┬───────┘ // │ │ // ┌──────────────┴──────────────┐ ┌──────────────┴──────────────┐ -// │ ReaderWithBlockLevelAL │ │ ReaderWithBlockLevelAL │ (Unified View) +// │ ReaderWithBlockLevelAL │ │ ReaderWithBlockLevelAL │ // │ (Pre-state + Mutations) │ │ (Pre-state + Mutations) │ // └──────────────┬──────────────┘ └──────────────┬──────────────┘ // │ │ @@ -62,6 +62,12 @@ package state // │ (State & Contract Code) │ // └─────────────────────────────┘ +// Note: The block producer, which is responsible for generating the block +// along with the block-level access list, does not maintain the internal +// hierarchy (e.g., PrefetchStateReader or ReaderWithBlockLevelAL). +// Instead, it directly utilizes the readerTracker, wrapped around the +// base reader, to construct the access list. + import ( "maps" "sync" diff --git a/core/state/reader_eip_7928_test.go b/core/state/reader_eip_7928_test.go index d9d20f6d7b..409f50a347 100644 --- a/core/state/reader_eip_7928_test.go +++ b/core/state/reader_eip_7928_test.go @@ -164,12 +164,12 @@ type noopCodeReader struct{} func (r *noopCodeReader) Has(addr common.Address, codeHash common.Hash) bool { return false } -func (r *noopCodeReader) Code(addr common.Address, codeHash common.Hash) ([]byte, error) { - return nil, nil +func (r *noopCodeReader) Code(addr common.Address, codeHash common.Hash) []byte { + return nil } -func (r *noopCodeReader) CodeSize(addr common.Address, codeHash common.Hash) (int, error) { - return 0, nil +func (r *noopCodeReader) CodeSize(addr common.Address, codeHash common.Hash) int { + return 0 } func TestReaderWithTracker(t *testing.T) {