Skip to content

Patricia alt 2#5

Merged
tkstanczak merged 6 commits into
masterfrom
patricia_alt_2
May 22, 2018
Merged

Patricia alt 2#5
tkstanczak merged 6 commits into
masterfrom
patricia_alt_2

Conversation

@tkstanczak

Copy link
Copy Markdown
Member

No description provided.

@tkstanczak tkstanczak merged commit 5a4b7f7 into master May 22, 2018
@tkstanczak tkstanczak deleted the patricia_alt_2 branch August 29, 2018 00:58
@claude claude Bot mentioned this pull request Apr 30, 2026
12 tasks
@LukaszRozmej LukaszRozmej mentioned this pull request May 18, 2026
16 tasks
@claude claude Bot mentioned this pull request May 21, 2026
12 tasks
@LukaszRozmej LukaszRozmej mentioned this pull request May 25, 2026
16 tasks
kamilchodola added a commit that referenced this pull request May 28, 2026
#3+#4 (correctness/robustness): the sparse-vs-Patricia agreement counter lived
in static fields on FlatWorldStateScope. Every scope (read-only RPC, parallel
block processing, snapshot validation) updated and read the same counter, so
one scope's mismatch could reset another's confidence and one scope's wins
could promote another to authoritative without that scope validating its own
sparse trie. Moved to SparseAuthoritativeTracker held by FlatScopeProvider so
each provider owns its own confidence.

Also tied _sparseIsAuthoritative to SparseTrieSkipPatricia: the previous
condition (just 10 consecutive matches and !VerificationMode) flipped sparse
into the authoritative root/commit role while Patricia BulkSet still ran on
every block, paying for trie work whose result was thrown away. Now sparse
takes over only when the operator has explicitly opted out of Patricia
persistence via SparseTrieSkipPatricia (currently default-on for the EXPB
sparse-storage runs).

#5 (performance): storage commit walked every retained sparse storage trie
on every block. With cross-block PreservedSparseTrie reuse and no LFU pruning
yet, that's O(retained contracts) per commit and grows unboundedly. Expose
DirtyStorageAccountHashes (a lock-free enumeration of SparseRootComputer's
_storageChanges keys) and walk only the contracts whose storage actually
changed this block. CommitStorageTrie still skips clean subtrees internally
as a second filter, but now we don't even iterate cold contracts at the outer
level.

Test updates: FlatWorldStateScopeProviderTests registers SparseAuthoritativeTracker
in the Autofac container; FlatOverridableWorldScope and WriteBatchBenchmark
pass new instances at construction. All 432 State.Flat tests pass.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant