Skip to content
Draft
Show file tree
Hide file tree
Changes from 3 commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
7072174
execution/cache: test unwind fill-readmission window
yperbasis Aug 6, 2026
9a4e898
execution/cache, db/state: publish StateCache by state version
yperbasis Aug 7, 2026
5245ef6
Merge remote-tracking branch 'origin/main' into yperbasis/statecache-…
yperbasis Aug 7, 2026
c51d08e
execution/cache, db/state: clarify publication contract
yperbasis Aug 7, 2026
b085d39
execution/cache, commitment, db/state: unify cache publication
yperbasis Aug 7, 2026
b097a2f
execution/cache, commitment, db/state: reconcile file publications
yperbasis Aug 7, 2026
28bc1af
execution/vm: clarify jump destination cache comment
yperbasis Aug 7, 2026
6e3da33
execution/cache, db/state: bind cache generations to file views
yperbasis Aug 7, 2026
cfd5bf8
execution/commitment, cache: reject stale adaptive pin plans
yperbasis Aug 8, 2026
0891e94
Merge remote-tracking branch 'origin/main' into yperbasis/statecache-…
yperbasis Aug 8, 2026
f9823c9
db/state/execctx: bind cache views to transaction files
yperbasis Aug 9, 2026
88fc6ba
execution/commitment, cache: reset file provenance on lineage change
yperbasis Aug 10, 2026
72f06fe
db/state, rawdbreset: revoke caches on execution reset
yperbasis Aug 10, 2026
3b80d63
cmd/integration: publish caches after execution unwind
yperbasis Aug 10, 2026
739c9e5
Merge remote-tracking branch 'origin/main' into yperbasis/statecache-…
yperbasis Aug 10, 2026
718d4bb
db, execution: avoid cache-view frontier cursors
yperbasis Aug 10, 2026
d59decb
Merge remote-tracking branch 'origin/main' into yperbasis/statecache-…
yperbasis Aug 10, 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
2 changes: 1 addition & 1 deletion cmd/integration/commands/stages.go
Original file line number Diff line number Diff line change
Expand Up @@ -844,7 +844,7 @@ func execBlocksBatch(ctx context.Context, db kv.TemporalRwDB, st *stagedsync.Syn
}
defer doms.Close()
doms.SetInMemHistoryReads(false)
doms.SetStateCache(stateCache)
doms.SetCanonicalStateCache(stateCache)
doms.SetCodeStore(codeStore)
execctx.GuardAggregatorForCache(db, stateCache)

Expand Down
23 changes: 10 additions & 13 deletions db/state/execctx/codehash_routing_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ func TestCodeHashForAddr_InBatchAccountWinsOverStaleLRU(t *testing.T) {
}
var staleArr [32]byte
copy(staleArr[:], stale[:])
sc.View(frontierAt(0)).SeedAddrCodeHash(addr[:], staleArr, 0)
currentStateCacheView(t, sc).SeedAddrCodeHash(addr[:], staleArr)

t.Run("empty in-batch account wins (codeHash-no-code repro)", func(t *testing.T) {
acc := accounts.Account{Nonce: 7, CodeHash: accounts.EmptyCodeHash}
Expand All @@ -69,13 +69,9 @@ func TestCodeHashForAddr_InBatchAccountWinsOverStaleLRU(t *testing.T) {
})
}

// The addr→codeHash admission gate vouches for the tx read view's frontier, but
// resolve() may serve the account record from the shared accounts cache, which
// lags a just-committed flush until the apply loop reaches the key. A
// cache-sourced record must therefore never seed the mapping — an apply
// interleaved between the read and the fill would leave a mapping derived from
// the pre-apply record.
func TestCodeHashForAddr_CacheSourcedRecordDoesNotSeedMapping(t *testing.T) {
// A generation-bound account-cache hit can safely seed the derived mapping:
// publication revokes the view before changing either cache layer.
func TestCodeHashForAddr_CacheSourcedRecordSeedsMapping(t *testing.T) {
t.Parallel()

ctx := t.Context()
Expand Down Expand Up @@ -103,9 +99,9 @@ func TestCodeHashForAddr_CacheSourcedRecordDoesNotSeedMapping(t *testing.T) {
require.NoError(t, seedSD.Commit(ctx, seedTx))
seedSD.Close()

_, ok := sc.View(nil).Get(kv.AccountsDomain, addr[:])
_, ok := currentStateCacheView(t, sc).Get(kv.AccountsDomain, addr[:])
require.True(t, ok, "the committed record must be served by the accounts cache")
_, ok = sc.View(nil).GetAddrCodeHash(addr[:])
_, ok = currentStateCacheView(t, sc).GetAddrCodeHash(addr[:])
require.False(t, ok, "the post-commit apply must leave the derived mapping empty")

roTx, err := db.BeginTemporalRo(ctx)
Expand All @@ -118,8 +114,9 @@ func TestCodeHashForAddr_CacheSourcedRecordDoesNotSeedMapping(t *testing.T) {

got := sd.CodeHashForAddr(roTx, addr[:], 20)
require.Equal(t, codeHash[:], got)
_, ok = sc.View(nil).GetAddrCodeHash(addr[:])
require.False(t, ok, "a cache-sourced account record must not seed the addr→codeHash mapping")
h, ok := currentStateCacheView(t, sc).GetAddrCodeHash(addr[:])
require.True(t, ok)
require.Equal(t, [32]byte(codeHash), h)
}

// A record read from the tx's read view (accounts-cache miss) is exactly what
Expand Down Expand Up @@ -163,7 +160,7 @@ func TestCodeHashForAddr_ViewSourcedRecordSeedsMapping(t *testing.T) {

got := sd.CodeHashForAddr(roTx, addr[:], 20)
require.Equal(t, codeHash[:], got)
h, ok := sc.View(nil).GetAddrCodeHash(addr[:])
h, ok := currentStateCacheView(t, sc).GetAddrCodeHash(addr[:])
require.True(t, ok, "a view-sourced record must seed the mapping")
require.Equal(t, [32]byte(codeHash), h)
}
Loading
Loading