Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
126 commits
Select commit Hold shift + click to select a range
ddc6df7
commitment: extract canonical DecodeBranchInto from unfoldBranchNode
May 4, 2026
31fdf57
commitment: add BranchCache with pinned root + bounded LRU tail
May 5, 2026
1593f0e
commitment: document BranchCache concurrency contract
May 5, 2026
8a2c565
commitment: wire BranchCache into trie read + encoder write paths
May 5, 2026
2849165
commitment, db/state: lift BranchCache lifetime to aggregator scope
May 5, 2026
f87937e
commitment: BranchCache divergence detector + per-block fingerprint log
May 6, 2026
b61655c
commitment: disable deferred-encoding mode (use inline CollectUpdate)
May 6, 2026
7e21628
commitment: add DISABLE_BRANCH_CACHE_READS env kill-switch
May 6, 2026
8d6d19a
commitment: multi-layer state probe at BranchCache divergence site
May 7, 2026
87f12be
commitment: tag BranchCache writes with origin + write-seq + timestamp
May 7, 2026
6989427
commitment, db/state/execctx: move BranchCache behind sd.mem chain
May 7, 2026
99823bb
commitment/branch_cache: document responsibility split + post-WarmupC…
May 8, 2026
4410704
commitment/branch_cache: add pinned tier (PinEntry / PinnedCount)
May 8, 2026
9b7c02a
commitment/preload: PreloadContractTrunk recursive enumeration
May 8, 2026
a60b052
state/execctx, commitment: PIN_CONTRACT_TRUNKS env hook
May 8, 2026
71d8480
state/execctx: trunk-preload sync (was async, hit cgo-pointer panic)
May 8, 2026
f85308d
commitment, state/execctx: trunk-preload progress logs + max-branches…
May 8, 2026
a289adc
state/execctx: run trunk-preload AFTER SeekCommitment
May 8, 2026
29ebc42
state/execctx: trunk-preload async with own tx, triggered from Enable…
May 8, 2026
db656cc
execution/commitment: PIN_TRUNK_MAX_DEPTH env + raise maxBranches cap
May 8, 2026
ce8cce4
stagedsync/exec3_parallel: re-enable trie warmup on parallel path
May 4, 2026
e97c95f
commitment: WarmupCache hit/miss/evict observability counters
May 4, 2026
af2ef68
commitment: extract unfoldKeyPath as per-key traversal primitive
May 4, 2026
4074bcc
commitment: WarmupCache dirty-flag + PutBranchIfClean invariants
May 5, 2026
4be9c86
commitment: WarmupCache GetBranchDecoded — lazy-decode read path
May 5, 2026
733dad5
execmodule: chain ValidateChain SD to currentContext for head-extendi…
May 6, 2026
a823097
db/state: H0 baseline benchmark for snapshot-vs-MDBX read cost
May 7, 2026
118298a
db/state: H0 real-datadir bootstrap; first production numbers
May 7, 2026
005790f
db/state, commitment: H_GetAsOf bench + per-block calculator timing
May 7, 2026
4276219
commitment: surface per-block telemetry on cache-fp log
May 8, 2026
1e8c25c
stagedsync/calc_state: skip wasted ensureStorage in StoragePath Apply…
May 8, 2026
a263695
commitment: split disk-load counter from EVM-write plumbing
May 8, 2026
fd593ca
state, commitment: scaffold to quantify EIP-684 HasPrefix cost on sna…
May 8, 2026
d2ac8ef
commitment, dbg: warmer scales 1:1 with cores; document pooling strategy
May 8, 2026
20b020d
existence, state, commitment: add measurement counters for assumption…
May 8, 2026
fefec01
commitment/warmuper: stop walking past leaf cells
May 8, 2026
c57420b
commitment: drop BranchEncoder's WarmupCache fast path
May 8, 2026
63e1124
commitment/hph: drop hph.cache (WarmupCache read-through layer)
May 8, 2026
39b758e
commitment, db/state, stagedsync: delete WarmupCache type and toggle …
May 8, 2026
b99c192
commitment: mark BranchCache dirty in CollectDeferredUpdate too
May 8, 2026
80ea439
commitment/warmuper: scope warmer to branches only — drop account/sto…
May 8, 2026
614fb7b
state, commitment: add unique-prefix file-read counter
May 8, 2026
4b95d45
state, commitment: add unique-prefix length histogram
May 8, 2026
d566e9b
state, commitment: refine length histogram inside storage subtree
May 8, 2026
65fbd14
state/changeset: trunk-probe log to identify hot contracts
May 8, 2026
c07a688
commitment: surface pinned-tier counters on cache-fp log
May 8, 2026
a62cbaf
db/state, db/kv: add TemporalMemBatch.FlushWithCallback
May 10, 2026
8bad508
commitment, state/execctx: BFS / budget-driven trunk preload
May 10, 2026
b29f3cf
state/execctx: raise PIN_TRUNK_RAM_BUDGET_MB default 32 → 64
May 10, 2026
d494eec
state/execctx: clamp PIN_TRUNK_RAM_BUDGET_MB at 64 MiB per contract
May 10, 2026
6ea7ff8
commitment/branch_cache: pin-aware Invalidate, GetWithOrigin, Clear
May 10, 2026
9ef3b9c
state/execctx: invalidate stale BranchCache entries on SD.Unwind
May 10, 2026
878f04a
commitment/preload: split BFS into resumable ContractTrunkPreload
May 10, 2026
a2b6ab5
commitment/branch_cache: add miss-callback hook for adaptive controller
May 10, 2026
be2616e
commitment: AdaptivePinController for promotion / extension / demotion
May 10, 2026
b082c93
state/execctx: wire AdaptivePinController into SharedDomains
May 10, 2026
2c6ee4e
commitment: Prometheus metrics for trunk-pin layer
May 10, 2026
f48c411
commitment: tests for trunk-pin layer + delete orphaned warmup test
May 10, 2026
e69e9bf
commitment, db/state: drop bench-only env knobs and cache-fp log
May 10, 2026
e0b0189
lint: gofmt fixes + drop snapshot_vs_mdbx bench test
May 10, 2026
fa4d7f7
perf(r3): bulk storage-trunk preload via two-parity range scan (core …
May 11, 2026
b4591a2
perf(r3): wire triggerTrunkPreload to the bulk range-scan path
May 11, 2026
ae86359
perf(r3): adaptive controller uses LoadBulk (range scan) when available
May 11, 2026
4ca9284
perf(preload): retire the broken R3 range-scan preload
May 12, 2026
3e0154f
perf(preload): parallel file-only wave-BFS preload (cut-down)
May 12, 2026
4c9968a
perf(preload): cap per-wave fetch by remaining budget
May 12, 2026
eb0c0c5
perf(preload): phase 1 — MDBX-resident branch prefetch (operational c…
May 12, 2026
a3374fe
db/state: test for the phase-1 dbPrefetch cursor walk
May 13, 2026
9db0d59
commitment, db/state: resumable parallel preload + adaptive parallel-…
May 13, 2026
ae9b3f3
execution/commitment: keep the trie checkpoint key out of BranchCache
May 21, 2026
3065d89
execution: parent fork-validation SD into the canonical generation
May 21, 2026
ae711df
execution/commitment: prealloc rest slice in preload_parallel
May 22, 2026
b2a9d64
db/state/execctx, execution/execmodule: clear BranchCache on SetHead …
May 16, 2026
9f5086b
Merge remote-tracking branch 'origin/main' into mh/perf-caches-pr
May 23, 2026
f151829
execution/stagedsync/rawdbreset: clear branchCache on ResetExec (#21138)
May 23, 2026
9898f3c
common/dbg, node/ethconfig: default ExecWorkerCount = NumCPU-1
May 23, 2026
6454b7b
Revert "common/dbg, node/ethconfig: default ExecWorkerCount = NumCPU-1"
May 23, 2026
e8ba812
cmd/evm, execution/tests: per-subtest ephemeral SharedDomains for sta…
mh0lt May 24, 2026
54a9029
execution/tests: read pre-state via sd.AsGetter so tx execution sees …
mh0lt May 24, 2026
57dd0d6
execution/engineapi/engineapitester: reset aggregator branchCache bet…
mh0lt May 24, 2026
5a415cf
execution/cache, db/state/execctx: SD-transparent ethHash bypass for …
May 14, 2026
4499ad5
execution/cache, db/state, execution/state: codeSizeCache for EXTCODE…
May 14, 2026
ad565fe
execution/exec, execution/execmodule: BlockReadAheader populates cach…
May 15, 2026
2d82956
execution/state, execution/cache: stateObject.code populate + addrToH…
May 15, 2026
987f741
execution/cache, db/state/execctx: addr → codeHash LRU above SD
May 15, 2026
934082b
execution/exec: cachePopulatingGetter caches negative results
May 15, 2026
e96df71
execution/cache: surface fill-and-freeze cliff via inserts/dropped co…
May 15, 2026
7b5a71c
execution/cache: replace GenericCache map with sharded LRU + Mode
May 15, 2026
3fec476
execution/cache: STATE_CACHE_MODE env override at NewStateCache time
May 15, 2026
1a56794
execution/cache: correct the LFU rationale in Mode docstring
May 15, 2026
4a512ce
execution/cache: reduce default cache caps to 100 MB each (bench knob)
May 17, 2026
da4b091
Parallel-exec correctness fixes (PR #3 of the perf stack) (#21387)
mh0lt May 25, 2026
3b11e0e
Merge remote-tracking branch 'origin/main' into mh/perf-caches-pr
mh0lt May 25, 2026
b7d89ad
Merge remote-tracking branch 'origin/mh/perf-caches-pr' into mh/perf-…
mh0lt May 25, 2026
9b15362
execution/state: drop tautological nil checks in code-loading paths (…
mh0lt May 25, 2026
6b582fd
execution/execmodule: clear BranchCache between unwindToCommonCanonic…
mh0lt May 26, 2026
25eb151
Revert "execution/execmodule: clear BranchCache between unwindToCommo…
mh0lt May 26, 2026
0021402
execution/commitment, common/maphash: txN-tagged BranchCache entries …
mh0lt May 26, 2026
f972499
db/state, db/state/execctx: plumb real txN to BranchCache writes
mh0lt May 26, 2026
b93969a
db/state/execctx, execution/commitment: wire BranchCache.UnwindTo int…
mh0lt May 26, 2026
c9a3deb
execution/commitment, db/state, execmodule: trim comments per project…
mh0lt May 26, 2026
4618add
execution/engineapi, db/state/execctx, execution/commitment: remove o…
mh0lt May 27, 2026
0dc7b1b
execution/commitment, db/state/execctx, cmd/evm: fix 4 Copilot review…
mh0lt May 27, 2026
fd74979
db/state/execctx: decode AccountsDomain codeHash with DeserialiseV3
mh0lt Jun 4, 2026
ba6c67a
db/state, db/kv: unify FlushWithCallback — flush-only refresh for bra…
May 20, 2026
061111f
db/rawdb, p2p/eth, execmodule: BAL cache + on-demand regeneration for…
May 13, 2026
bdfb756
db/rawdb, exec, p2p: drop BAL MDBX writes, cache-only lookup with reg…
May 13, 2026
c9664ae
execmodule, node/eth: refactor BAL regenerator on ComputeBlockContext…
May 13, 2026
f4901b5
rawdb, p2p/eth, engine_block_downloader: opportunistic BAL fetch duri…
May 13, 2026
3ebe033
balcache: move db/rawdb → execution/balcache (no DB, no rawdb home)
May 13, 2026
52c8ac6
execution/balcache, execution/engineapi, execution/exec: BAL prefetch…
May 15, 2026
6427aca
db/kv, db/rawdb, execution: drop kv.BlockAccessList table and orphan …
May 15, 2026
cd839e1
rpc/jsonrpc: debug_getRawBlockAccessList returns balcache bytes (port…
mh0lt Apr 28, 2026
2a41192
execution/cache, state, stagedsync: txNum/epoch cache invalidation; r…
mh0lt Jun 5, 2026
42a2aaf
execution: wire state cache into SetHead unwind (fixes BadBlock on re…
mh0lt Jun 5, 2026
2683865
commitment: LatestStateReader.Clone keeps its source tx, not the comp…
mh0lt Jun 5, 2026
44355fd
db/state, commitment: lock-free per-worker read metrics (+ tx-aware B…
mh0lt Jun 6, 2026
a027002
db/state: drop process-wide metrics accumulator (metrics-on safety)
mh0lt Jun 6, 2026
943968d
commitment: meter the main-fold reads per-ComputeCommitment
mh0lt Jun 6, 2026
f375aa8
db/state, commitment: collapse metrics to per-worker DomainMetrics in…
mh0lt Jun 6, 2026
cd1fb81
exec: meter parallel-exec worker reads (per-worker DomainMetrics, per…
mh0lt Jun 6, 2026
bd6097e
execution/cache: fix off-by-one in state-cache unwind floor
mh0lt Jun 7, 2026
67d0f33
execution: address #21380 review feedback
mh0lt Jun 7, 2026
6f9f737
Merge origin/main into mh/perf-caches-pr (#21380)
mh0lt Jun 7, 2026
5d16a64
Merge mh/perf-caches-pr into mh/perf-statecache-lru-pr (#21386)
mh0lt Jun 8, 2026
9733272
Merge mh/perf-statecache-lru-pr into fix/eth71-multiclient-server-dis…
mh0lt Jun 8, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 32 additions & 2 deletions cmd/evm/staterunner.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ import (
"github.com/erigontech/erigon/common/log/v3"
"github.com/erigontech/erigon/db/datadir"
"github.com/erigontech/erigon/db/kv/temporal/temporaltest"
"github.com/erigontech/erigon/db/state/execctx"
"github.com/erigontech/erigon/execution/tests/testutil"
"github.com/erigontech/erigon/execution/tracing/tracers/logger"
"github.com/erigontech/erigon/execution/vm"
Expand Down Expand Up @@ -224,7 +225,18 @@ func runStateTest(ctx *cli.Context, cfg vm.Config, fname string) ([]testResult,
}
defer tx.Rollback()

statedb, root, err := test.Run(nil, tx, st, cfg, dirs)
// Per-subtest SD scope: caller-owned, never Flushed. Closing
// without Flush discards every write made during the subtest
// (pre-state + tx execution + commitment), so per-subtest state
// never enters the long-lived branch cache.
sd, err := execctx.NewSharedDomains(context.Background(), tx, log.New())
if err != nil {
result.Pass, result.Error = false, err.Error()
return
}
defer sd.Close()

statedb, root, err := test.Run(nil, sd, tx, st, cfg, dirs)
if err != nil {
result.Pass, result.Error = false, err.Error()
}
Expand All @@ -238,8 +250,26 @@ func runStateTest(ctx *cli.Context, cfg vm.Config, fname string) ([]testResult,
}
}
if bench {
// Run the benchmark on a fresh tx + SD so the timed work
// starts from the same pre-state every iteration; the
// preceding test.Run mutated sd in place (pre-state +
// tx execution + commitment), which would otherwise
// skew the gas/throughput numbers.
benchTx, err := db.BeginTemporalRw(context.Background())
if err != nil {
result.Pass, result.Error = false, err.Error()
return
}
defer benchTx.Rollback()
benchSD, err := execctx.NewSharedDomains(context.Background(), benchTx, log.New())
if err != nil {
result.Pass, result.Error = false, err.Error()
return
}
defer benchSD.Close()

_, stats, _ := timedExec(true, func() ([]byte, uint64, error) {
_, _, gasUsed, _ := test.RunNoVerify(nil, tx, st, cfg, dirs)
_, _, gasUsed, _ := test.RunNoVerify(nil, benchSD, benchTx, st, cfg, dirs)
return nil, gasUsed, nil
})
result.Stats = &stats
Expand Down
16 changes: 14 additions & 2 deletions common/dbg/experiments.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,20 @@ var (
BorValidateHeaderTime = EnvBool("BOR_VALIDATE_HEADER_TIME", true)
TraceDeletion = EnvBool("TRACE_DELETION", false)

RpcDropResponse = EnvBool("RPC_DROP_RESPONSE", false)
TipTrieWarmupers = EnvInt("TIP_TRIE_WARMUPERS", runtime.NumCPU()*8) //io-bound (not cpu-bound). it's ok to have `io-threads > cpus`
RpcDropResponse = EnvBool("RPC_DROP_RESPONSE", false)
// The original default was NumCPU()*8 with the rationale "io-bound, more
// workers drive more concurrent I/O." Our measurements (cold-cgroup 6c
// vs unconstrained 12c on the SSTORE-bloat bench) show read_bytes
// nearly identical (1.28 GB vs 1.24 GB) regardless of worker count,
// and 76 % of TEST-block CPU sits in the warmer's recsplit/xorfilter/
// seg-decompress path. The hot path is CPU-bound, not I/O-bound; the
// "drives I/O" rationale isn't borne out. Oversubscribing past
// available cores adds scheduler/context-switch overhead and queue
// noise without throughput gain. The constraint is queue depth on the
// warmer's work channel (sized at numWorkers*64), not worker count.
// GOMAXPROCS respects cgroup CPU caps under Go 1.25+, so this scales
// correctly inside a constrained envelope.
TipTrieWarmupers = EnvInt("TIP_TRIE_WARMUPERS", runtime.GOMAXPROCS(0))

PerfProfiles = EnvBool("PERF_PROFILES", false)
)
Expand Down
45 changes: 45 additions & 0 deletions common/maphash/maphash.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,24 @@ func (m *Map[V]) Clear() {
m.m.Clear()
}

// Range iterates over every (hash, value) pair. Iteration order is
// unspecified. Return false from fn to stop early. Concurrent
// modification during Range is permitted by the underlying xsync.Map.
//
// The original byte-key is not recoverable — Set hashes-and-discards.
// Pair with DeleteByHash to evict entries discovered via Range.
func (m *Map[V]) Range(fn func(hash uint64, v V) bool) {
m.m.Range(func(key uint64, value V) bool {
return fn(key, value)
})
}

// DeleteByHash removes the entry under the pre-computed hash. Use
// alongside Range when the byte-key is unknown.
func (m *Map[V]) DeleteByHash(hash uint64) {
m.m.Delete(hash)
}

// NonConcurrentMap is a non-thread-safe map that uses maphash to hash []byte keys.
// Use this when you don't need concurrent access for better performance.
type NonConcurrentMap[V any] struct {
Expand Down Expand Up @@ -163,3 +181,30 @@ func (l *LRU[V]) SetByHash(hash uint64, value V) {
func (l *LRU[V]) ContainsByHash(hash uint64) bool {
return l.cache.Contains(hash)
}

// DeleteByHash removes the entry under the pre-computed hash. Use
// alongside Range when the byte-key is unknown.
func (l *LRU[V]) DeleteByHash(hash uint64) {
l.cache.Remove(hash)
}

// Range iterates over every (hash, value) pair without affecting LRU
// recency (uses Peek under the hood). Iteration order is unspecified.
// Return false from fn to stop early.
//
// The original byte-key is not recoverable — Set hashes-and-discards.
// Use the hash itself as the identity in callers that need cross-cache
// comparisons; same byte-key always maps to the same hash, so equality
// of (hash, value) sets is equivalent to equality of (key, value) sets
// modulo collision (vanishingly unlikely at typical working-set sizes).
func (l *LRU[V]) Range(fn func(hash uint64, v V) bool) {
for _, h := range l.cache.Keys() {
v, ok := l.cache.Peek(h)
if !ok {
continue
}
if !fn(h, v) {
return
}
}
}
32 changes: 29 additions & 3 deletions db/datastruct/existence/existence_filter.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import (
"hash"
"os"
"path/filepath"
"sync/atomic"

bloomfilter "github.com/holiman/bloomfilter/v2"

Expand Down Expand Up @@ -79,15 +80,40 @@ func (b *Filter) AddHash(hash uint64) error {
b.filter.AddHash(hash)
return nil
}

// Process-cumulative counters of ContainsHash outcomes.
// True = "probably present" (filter does not short-circuit, lookup proceeds).
// False = "definitely not present" (filter short-circuits the lookup).
// Hit-rate = true / (true + false). Used to size the value of bypassing
// the filter for callers known to lookup present keys (e.g. warmer).
var (
containsTrueCount atomic.Uint64
containsFalseCount atomic.Uint64
)

// ContainsHashStats returns (true, false) cumulative counts since process
// start. To get a per-block delta, snapshot before/after.
func ContainsHashStats() (containsTrue, containsFalse uint64) {
return containsTrueCount.Load(), containsFalseCount.Load()
}

func (b *Filter) ContainsHash(hashedKey uint64) bool {
if b.empty {
containsTrueCount.Add(1)
return true
}
var ok bool
if b.useFuse {
return b.fuseReader.ContainsHash(hashedKey)
ok = b.fuseReader.ContainsHash(hashedKey)
} else {
ok = b.filter.ContainsHash(hashedKey)
}

return b.filter.ContainsHash(hashedKey)
if ok {
containsTrueCount.Add(1)
} else {
containsFalseCount.Add(1)
}
return ok
}
func (b *Filter) Contains(v hash.Hash64) bool {
if b.empty {
Expand Down
1 change: 1 addition & 0 deletions db/kv/kv_interface.go
Original file line number Diff line number Diff line change
Expand Up @@ -530,6 +530,7 @@ type TemporalMemBatch interface {
HasPrefixInRAM(domain Domain, prefix []byte) bool
SizeEstimate() uint64
Flush(ctx context.Context, tx RwTx) error
FlushWithCallback(ctx context.Context, tx RwTx, cb func(domain Domain, k []byte, v []byte, txNum uint64)) error
Close()
PutForkable(id ForkableId, num Num, v []byte) error
DiscardWrites(domain Domain)
Expand Down
3 changes: 0 additions & 3 deletions db/kv/tables.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,6 @@ const (
HeaderTD = "HeadersTotalDifficulty" // block_num_u64 + hash -> td (RLP)

BlockBody = "BlockBody" // block_num_u64 + hash -> block body
// BlockAccessList stores RLP-encoded block access lists, keyed by block_num_u64 + hash.
BlockAccessList = "BlockAccessList"

// Naming:
// TxNum - Ethereum canonical transaction number - same across all nodes.
Expand Down Expand Up @@ -315,7 +313,6 @@ var ChaindataTables = []string{
HeaderNumber,
BadHeaderNumber,
BlockBody,
BlockAccessList,
TxLookup,
ConfigTable,
DatabaseInfo,
Expand Down
26 changes: 0 additions & 26 deletions db/rawdb/accessors_chain.go
Original file line number Diff line number Diff line change
Expand Up @@ -595,23 +595,6 @@ func ReadBody(db kv.Getter, hash common.Hash, number uint64) (*types.Body, uint6
return body, bodyForStorage.BaseTxnID.First(), bodyForStorage.TxCount - 2 // 1 system txn in the beginning of block, and 1 at the end
}

// ReadBlockAccessListBytes reads the RLP-encoded block access list sidecar for a block.
func ReadBlockAccessListBytes(db kv.Getter, hash common.Hash, number uint64) ([]byte, error) {
data, err := db.GetOne(kv.BlockAccessList, dbutils.BlockBodyKey(number, hash))
if err != nil {
return nil, err
}
return data, nil
}

// WriteBlockAccessListBytes stores the RLP-encoded block access list sidecar for a block.
func WriteBlockAccessListBytes(db kv.Putter, hash common.Hash, number uint64, data []byte) error {
if err := db.Put(kv.BlockAccessList, dbutils.BlockBodyKey(number, hash), data); err != nil {
return fmt.Errorf("failed to store block access list: %w", err)
}
return nil
}

func HasSenders(db kv.Getter, hash common.Hash, number uint64) (bool, error) {
return db.Has(kv.Senders, dbutils.BlockBodyKey(number, hash))
}
Expand Down Expand Up @@ -698,9 +681,6 @@ func DeleteBody(db kv.Putter, hash common.Hash, number uint64) {
if err := db.Delete(kv.BlockBody, dbutils.BlockBodyKey(number, hash)); err != nil {
log.Crit("Failed to delete block body", "err", err)
}
if err := db.Delete(kv.BlockAccessList, dbutils.BlockBodyKey(number, hash)); err != nil {
log.Crit("Failed to delete block access list", "err", err)
}
}

func AppendCanonicalTxNums(tx kv.RwTx, from uint64) (err error) {
Expand Down Expand Up @@ -898,9 +878,6 @@ func PruneBlocks(tx kv.RwTx, blockTo uint64, blocksDeleteLimit int) (deleted int
if err = tx.Delete(kv.BlockBody, kCopy); err != nil {
return deleted, err
}
if err = tx.Delete(kv.BlockAccessList, kCopy); err != nil {
return deleted, err
}
if err = tx.Delete(kv.Headers, kCopy); err != nil {
return deleted, err
}
Expand Down Expand Up @@ -949,9 +926,6 @@ func TruncateBlocks(ctx context.Context, tx kv.RwTx, blockFrom uint64) error {
if err := tx.Delete(kv.BlockBody, kCopy); err != nil {
return err
}
if err := tx.Delete(kv.BlockAccessList, kCopy); err != nil {
return err
}
if err := tx.Delete(kv.Headers, kCopy); err != nil {
return err
}
Expand Down
54 changes: 0 additions & 54 deletions db/rawdb/accessors_chain_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ import (
"github.com/erigontech/erigon/execution/execmodule/execmoduletester"
"github.com/erigontech/erigon/execution/rlp"
"github.com/erigontech/erigon/execution/types"
"github.com/erigontech/erigon/execution/types/accounts"
)

func newTestLegacyTx(nonce uint64, to common.Address, value uint256.Int, gasLimit uint64, gasPrice uint256.Int) *types.LegacyTx {
Expand Down Expand Up @@ -1127,59 +1126,6 @@ func TestBlockWithdrawalsStorage(t *testing.T) {
require.Nil(entry)
}

func TestBlockAccessListStorage(t *testing.T) {
t.Parallel()
_, tx := memdb.NewTestTx(t)
defer tx.Rollback()

block := types.NewBlockWithHeader(&types.Header{
Number: *uint256.NewInt(1),
Extra: []byte("test block"),
UncleHash: empty.UncleHash,
TxHash: empty.RootHash,
ReceiptHash: empty.RootHash,
})

data, err := rawdb.ReadBlockAccessListBytes(tx, block.Hash(), block.NumberU64())
require.NoError(t, err)
require.Empty(t, data)

nonEmpty := types.BlockAccessList{
{
Address: accounts.InternAddress(common.HexToAddress("0x00000000000000000000000000000000000000aa")),
},
}
nonEmptyBytes, err := types.EncodeBlockAccessListBytes(nonEmpty)
require.NoError(t, err)
require.NoError(t, rawdb.WriteBlockAccessListBytes(tx, block.Hash(), block.NumberU64(), nonEmptyBytes))

data, err = rawdb.ReadBlockAccessListBytes(tx, block.Hash(), block.NumberU64())
require.NoError(t, err)
require.Equal(t, nonEmptyBytes, data)

decoded, err := types.DecodeBlockAccessListBytes(data)
require.NoError(t, err)
require.NoError(t, decoded.Validate())
require.Equal(t, nonEmpty.Hash(), decoded.Hash())

emptyBytes, err := types.EncodeBlockAccessListBytes(nil)
require.NoError(t, err)
require.NoError(t, rawdb.WriteBlockAccessListBytes(tx, block.Hash(), block.NumberU64(), emptyBytes))

data, err = rawdb.ReadBlockAccessListBytes(tx, block.Hash(), block.NumberU64())
require.NoError(t, err)
require.Equal(t, emptyBytes, data)

decoded, err = types.DecodeBlockAccessListBytes(data)
require.NoError(t, err)
// EIP-7928: Decoding 0xc0 (empty RLP list) should return an initialized empty slice,
// rather than nil, to distinguish a valid empty BAL from a missing/pruned one.
require.NotNil(t, decoded)
require.Empty(t, decoded)
require.NoError(t, decoded.Validate())
require.Equal(t, empty.BlockAccessListHash, decoded.Hash())
}

// Tests pre-shanghai body to make sure withdrawals doesn't panic
func TestPreShanghaiBodyNoPanicOnWithdrawals(t *testing.T) {
t.Parallel()
Expand Down
Loading