From e9b599c6a17107cd884cbf09593aab9915682dc8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A9ter=20Szil=C3=A1gyi?= Date: Tue, 7 May 2024 09:53:49 +0300 Subject: [PATCH] core/state: remove update concurrency for Verkle tries --- core/state/statedb.go | 8 ++++++++ core/state/trie_prefetcher.go | 4 ---- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/core/state/statedb.go b/core/state/statedb.go index 14e4456830..8bec4f675c 100644 --- a/core/state/statedb.go +++ b/core/state/statedb.go @@ -847,6 +847,14 @@ func (s *StateDB) IntermediateRoot(deleteEmptyObjects bool) common.Hash { start = time.Now() workers errgroup.Group ) + if s.db.TrieDB().IsVerkle() { + // Whilst MPT storage tries are independent, Verkle has one single trie + // for all the accounts and all the storage slots merged together. The + // former can thus be simply parallelized, but updating the latter will + // need concurrency support within the trie itself. That's a TODO for a + // later time. + workers.SetLimit(1) + } for addr, op := range s.mutations { if op.applied || op.isDelete() { continue diff --git a/core/state/trie_prefetcher.go b/core/state/trie_prefetcher.go index 63816ceecc..12e29a3551 100644 --- a/core/state/trie_prefetcher.go +++ b/core/state/trie_prefetcher.go @@ -32,10 +32,6 @@ var ( // errTerminated is returned if a fetcher is attempted to be operated after it // has already terminated. errTerminated = errors.New("fetcher is already terminated") - - // errNotTerminated is returned if a fetchers data is attempted to be retrieved - // before it terminates. - errNotTerminated = errors.New("fetcher is not yet terminated") ) // triePrefetcher is an active prefetcher, which receives accounts or storage