-
Notifications
You must be signed in to change notification settings - Fork 722
fix(flat): isolate warmer misses and safely publish verified reads #12951
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
6da4345
fix(flat): isolate the trie warmer negative cache in a dedicated stru…
AnkushinDaniil b772b09
docs(flat): scope the MissNodes summary to the proven isolation invar…
AnkushinDaniil 0bcdca6
perf(flat): publish the trie warmer's persistence reads into the tran…
kamilchodola 7ebd4ba
fix(flat): verify the warmer's persistence RLP hashes to the requeste…
kamilchodola 71ce3e6
test(flat): cover same-transient warmer miss isolation
kamilchodola b68a696
test(flat): cover resolved warmer miss isolation
kamilchodola fd7c994
test(flat): cover storage warmer miss reuse
kamilchodola b31cdf8
Merge branch 'master' into perf/flat-warmer-publish-resolved
kamilchodola 0e2353c
Optimize safe trie warmer cache promotion
kamilchodola efb875f
Avoid copying published warmer node RLP
kamilchodola 017f376
Synchronize shared trie warmer resolution
kamilchodola 5c792cc
Merge branch 'master' into perf/flat-warmer-publish-resolved
kamilchodola 79ca835
fix(flat): treat a stale warmer read as a miss instead of an error
kamilchodola a383af4
Merge branch 'master' into perf/flat-warmer-publish-resolved
kamilchodola 8d62166
fix(flat): drop the unused Trie.Pruning using directive
github-actions[bot] 58bd117
test(flat): assert a live read stays Unknown while a warmer node reso…
kamilchodola ef01490
Merge branch 'master' into perf/flat-warmer-publish-resolved
kamilchodola 17f3f44
fix(flat): never Sleep(1) on a block thread waiting for a warmer reso…
kamilchodola File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
406 changes: 388 additions & 18 deletions
406
src/Nethermind/Nethermind.State.Flat.Test/SnapshotBundleWarmerTests.cs
Large diffs are not rendered by default.
Oops, something went wrong.
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
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
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
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Low — the
keccak is nullbranch is unreachable, and it is the one path here that would skip verification.Every warmer-owned node that can appear in
transientResource.Nodescomes fromSnapshotBundle.CreateWarmerUnknownNode(hash), which is called only with a non-nullhashfrom the four warmer find sites (SnapshotBundle.cs:193,:219,:327,:349).MarkWarmerOwnedis otherwise reached only fromCreateInlineChild, and inline children live inside a parent's_nodeData— they are never inserted intoNodes. Sosource.Keccakis non-null for every source that reaches this helper.If it were reachable it would be the wrong behaviour twice over: the
keccak is not null &&guard on line 143 short-circuits, so unverified bytes get promoted; and the resulting node hasKeccak == null, whichTryGet(line 91,maybeNode.Keccak == hash) can never match — so it would occupy a bucket, evict whatever was there, and be charged to_shardMemoryUsageswhile being permanently unreachable.Per the AGENTS.md preference for removing code over adding it, I'd collapse it to the invariant:
That also makes the "re-verified before promotion" claim unconditional, which is what the PR description says it is.
(The two
catches below are likewise defensive-only —TryResolveNodeon a non-warmer node already swallowsRlpExceptioninternally, and the bytes are hash-verified before they get here — but they're cheap and I'd leave them.)