From b01202e3fe6f9e4ec0883da66f3fe30dfd5051ef Mon Sep 17 00:00:00 2001 From: Jared Wasinger Date: Tue, 5 May 2026 11:33:39 -0400 Subject: [PATCH] the start of some changes I was experimenting with. broken --- core/blockchain.go | 2 ++ core/state/database.go | 21 +++++++++++++++++++++ core/state/reader.go | 7 ------- 3 files changed, 23 insertions(+), 7 deletions(-) diff --git a/core/blockchain.go b/core/blockchain.go index efe6985001..95240293d6 100644 --- a/core/blockchain.go +++ b/core/blockchain.go @@ -681,6 +681,8 @@ func (bc *BlockChain) processBlockWithAccessList(parentRoot common.Hash, block * }); ok { prefetchAccountReads, prefetchStorageReads = pr.PrefetchReadTimes() } + prefetchAccountReads, prefetchStorageReads = prefetchReader.(*.PrefetchReadTimes() + balAccountReads, balStorageReads := stateTransition.ReadTimes() stats.AccountReads = res.Reads.Account + prefetchAccountReads + balAccountReads stats.StorageReads = res.Reads.Storage + prefetchStorageReads + balStorageReads diff --git a/core/state/database.go b/core/state/database.go index 7760cc4b5c..da44d383ab 100644 --- a/core/state/database.go +++ b/core/state/database.go @@ -18,6 +18,7 @@ package state import ( "fmt" + "time" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/core/overlay" @@ -240,6 +241,26 @@ func (db *CachingDB) ReadersWithCacheStats(stateRoot common.Hash) (Reader, Reade return ra, rb, nil } +type ReaderEIP7928Metrics struct { + // the total amount of time it took to complete the scheduled workload + WallElapsed time.Duration + // the aggregated total time spent on state loading by all workers + TotalElapsed time.Duration + // the amount of accounts loaded + Accounts int + // the amount of storage slots loaded + Storages int + // number of accounts with code loaded + Codes int + // total amount of code bytes loaded + CodeBytes int +} + +type ReaderEIP7928 interface { + Reader + Metrics() *ReaderEIP7928Metrics +} + // ReaderEIP7928 creates a state reader with the manner of Block-level accessList. func (db *CachingDB) ReaderEIP7928(stateRoot common.Hash, accessList map[common.Address][]common.Hash, threads int) (Reader, error) { base, err := db.StateReader(stateRoot) diff --git a/core/state/reader.go b/core/state/reader.go index 9cfaab9b7c..e6a6b5022c 100644 --- a/core/state/reader.go +++ b/core/state/reader.go @@ -574,10 +574,3 @@ func (r *reader) PrefetchReadTimes() (account, storage time.Duration) { } return 0, 0 } - -// WaitPrefetch blocks until the wrapped prefetcher drains; no-op otherwise. -func (r *reader) WaitPrefetch() { - if pr, ok := r.StateReader.(interface{ Wait() error }); ok { - _ = pr.Wait() - } -}