db/kv/kvcache: rename SimpleCache to LatestBatchCache - #22278
Merged
Conversation
AskAlexSharov
approved these changes
Jul 7, 2026
yperbasis
force-pushed
the
yperbasis/latest-batch-cache
branch
from
July 17, 2026 08:30
0deb297 to
4741ed8
Compare
yperbasis
changed the base branch from
alex/fcu_bg_commit_35
to
yperbasis/coherent-state-cache
July 17, 2026 08:30
This was referenced Jul 17, 2026
The old name described the implementation, not the contract, and suggested Simple and Coherent sit on a complexity spectrum. They differ semantically: Coherent is snapshot-consistency-first (version-keyed; readers stay consistent with their own committed view), LatestBatchCache is freshness-first (version-blind; readers see the latest announced state-change batch on top of their tx, staleness bounded to one batch by FCU serialization). The new name carries the content, the lifetime (replaced per batch), and the trade-off. Mechanical rename (SimpleCache -> LatestBatchCache, NewSimple -> NewLatestBatchCache, SimpleView -> LatestBatchView, simple.go -> latest_batch.go), plus the type doc comment and the --state.cache help text updated to match. No behavior change.
Evict had no callers and is not part of the Cache interface (leftover from the DummyCache era).
yperbasis
force-pushed
the
yperbasis/latest-batch-cache
branch
from
July 18, 2026 08:23
4741ed8 to
1a3db61
Compare
yperbasis
marked this pull request as ready for review
July 18, 2026 08:28
yperbasis
requested review from
lupin012,
mh0lt,
sudeepdino008 and
taratorio
as code owners
July 18, 2026 08:28
Contributor
There was a problem hiding this comment.
Pull request overview
This PR clarifies the state-cache semantics in db/kv/kvcache by renaming the former SimpleCache to LatestBatchCache, aligning the API and filenames with the cache’s actual contract (“serve the latest announced batch”, rather than “simple implementation”). This helps distinguish it from the version-keyed, snapshot-consistent Coherent cache.
Changes:
- Renamed
SimpleCache→LatestBatchCache(andNewSimple→NewLatestBatchCache,SimpleView→LatestBatchView,simple.go→latest_batch.go). - Updated call sites across txpool, rpcdaemon, and RPC gasprice tests/benchmarks to use the new constructor.
- Removed the dead
Evict() int { return 0 }stub from the cache implementation.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
db/kv/kvcache/latest_batch.go |
Renames the cache/view types and constructor; updates the type doc comment to describe the “latest batch” contract; removes the unused Evict stub. |
txnprovider/txpool/pool_test.go |
Updates txpool tests and explanatory comments to reference LatestBatchCache / NewLatestBatchCache. |
rpc/gasprice/gasprice_test.go |
Switches gasprice tests to construct BaseApi with NewLatestBatchCache. |
rpc/gasprice/feehistory_test.go |
Switches fee history tests to construct BaseApi with NewLatestBatchCache. |
rpc/gasprice/bench_test.go |
Switches gasprice benchmarks to construct BaseApi with NewLatestBatchCache. |
node/eth/backend.go |
Updates embedded txpool assembly to use NewLatestBatchCache. |
execution/execmodule/execmoduletester/exec_module_tester.go |
Updates exec-module test harness txpool assembly to use NewLatestBatchCache. |
cmd/rpcdaemon/cli/config.go |
Updates rpcdaemon wiring to use NewLatestBatchCache where it previously used NewSimple. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
yperbasis
enabled auto-merge
July 18, 2026 08:32
github-merge-queue
Bot
removed this pull request from the merge queue due to failed status checks
Jul 18, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Renames
SimpleCache→LatestBatchCache(withNewSimple→NewLatestBatchCache,SimpleView→LatestBatchView,simple.go→latest_batch.go)."Simple" described the implementation rather than the contract, and suggested Simple and Coherent sit on a complexity spectrum. They actually sit on opposite sides of a semantic fork:
Coherent— snapshot-consistency first: entries are keyed byPlainStateVersion, so a reader stays consistent with its own committed view and never sees fresher data.LatestBatchCache— freshness first: version-blind, it serves the most recent announced state-change batch on top of the caller's tx, deliberately showing announced-but-not-yet-committed account data; staleness is bounded to one batch by FCU serialization.That fork is what decides which cache is safe where (in-process txpool vs RPC reads — see #22532 / #22269), and the new name carries it: content (the latest batch), lifetime (replaced wholesale per batch), and the trade-off (by contrast with
Coherent). Also updates the type doc comment to lead with the contract.One cleanup rider in the same spirit: the dead
Evict() int { return 0 }stub is removed (no callers, not part of theCacheinterface — aDummyCache-era leftover).Mechanical rename + dead-code removal, no behavior change (TDD not applicable).