Skip to content

execution/commitment: parallel-commitment trie-context deferral and worker file-generation pin - #22360

Closed
awskii wants to merge 5 commits into
mainfrom
awskii/parallel-commitment-context-pin
Closed

execution/commitment: parallel-commitment trie-context deferral and worker file-generation pin#22360
awskii wants to merge 5 commits into
mainfrom
awskii/parallel-commitment-context-pin

Conversation

@awskii

@awskii awskii commented Jul 9, 2026

Copy link
Copy Markdown
Member

ExperimentalParallelCommitment had correctness bugs that only surface once the parallel-commitment trie path is actually exercised:

  • Non-DB-backed SharedDomains (integrity checks, RPC-created domains, test harnesses) selected the parallel trie but never got the per-worker TrieContextFactory it needs, panicking with ParallelPatriciaHashed.Process requires a TrieContextFactory.
  • Parallel-commitment workers each opened a fresh BeginTemporalRo, pinning a possibly-newer aggregator file generation than the main commitment tx. A deleted/reincarnated account then read AccountsDomain=empty (from the in-memory overlay) but CodeDomain=stale (from the worker's newer file view, since the code delete leaves no mem tombstone when prevVal is nil), tripping the ERIGON_ASSERT code-hash consistency check and wedging the node. Serial commitment reads through one tx and stayed consistent.

Changes

  • Defer parallel/streaming trie selection to EnableParaTrieDB: the context starts on the sequential trie and upgrades to the selected variant when the DB is wired. SeekCommitment may restore state before the DB is available, so the upgrade adopts the already-restored trie as the parallel template instead of re-encoding.
  • Add a files-pin API (AggregatorRoTx.PinAggregatorFilesPin, kv.TemporalFilesPin): ComputeCommitment pins the main tx's file generation and opens worker read txns from it, so all concurrent workers observe the snapshot the in-memory overlay was built against. Forwarded through the block-overlay wrapper for the builder path; falls back with a warning for backends that can't pin files.
  • Restrict the pin to the ParallelPatriciaHashed fold factory; serial/streaming warmup keeps its independent snapshot (pinning warmup regressed serial commitment to a wrong trie root on mainnet).

Split out of #22141 so the parallel-commitment fixes land independently of the CI matrix change that exercises them.

awskii added 4 commits July 9, 2026 18:44
With COMMITMENT_PARALLEL set globally, every SharedDomains selected the
parallel trie, but only DB-backed consumers (exec, builder, squeeze,
backtester) wire the per-worker TrieContextFactory it needs — integrity
checks, RPC-created domains, and test harnesses failed with
'ParallelPatriciaHashed.Process requires a TrieContextFactory'.

The context now starts on the sequential trie and upgrades to the
selected parallel/streaming variant when EnableParaTrieDB provides the
DB. SeekCommitment may restore state before the DB is wired, so the
upgrade adopts the already-restored trie as the parallel template
instead of re-encoding (SetState re-reads a sole-account root through
the not-yet-installed context). Touching before the upgrade panics:
keys collected on the sequential buffer would be dropped.

(cherry picked from commit 1436a65)
…el-commitment worker reads

Parallel-commitment workers each opened a fresh BeginTemporalRo, pinning
whatever aggregator visible-file generation was current — possibly newer than
the main commitment tx. A deleted/reincarnated account then read
AccountsDomain=empty (from the in-memory overlay) but CodeDomain=stale (from the
worker's newer file view, since the code delete leaves no mem tombstone when
prevVal is nil), failing the ERIGON_ASSERT code-hash consistency check and
wedging the node. Serial commitment reads through one tx and stayed consistent,
so this only surfaced once CI began exercising the parallel-commitment axis.

Add a files-pin API (AggregatorRoTx.Pin -> AggregatorFilesPin,
kv.TemporalFilesPin): ComputeCommitment pins the main tx's file generation and
opens worker read txns from it, so all concurrent workers observe the snapshot
the in-memory overlay was built against. Forwarded through the block-overlay
wrapper for the builder path; falls back (with a warning) for backends that
can't pin files.

(cherry picked from commit a8cb055)
The pin's worker tx copied BeginTemporalRo's forkaggs setup, which main removed;
the branch+main merge build then failed on the now-undefined forkaggs. Commitment
workers read only state domains via aggtx, so the worker tx needs just the pinned
file snapshot.

(cherry picked from commit bd0dbb0)
…rial warmup

The pin was also applied to the warmup factory, which serves serial/streaming
commitment's page-cache warmup. Warmup does not compute the root, and pinning it
regressed serial commitment to a wrong trie root on mainnet. Restrict the pin to
the ParallelPatriciaHashed fold factory (which computes the root and had the torn
Accounts/Code read); serial warmup keeps its independent snapshot, so the serial
path is behaviorally identical to before the pin change.

(cherry picked from commit 995f74c)
@awskii awskii closed this Jul 13, 2026
@awskii
awskii deleted the awskii/parallel-commitment-context-pin branch July 31, 2026 11:28
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.

2 participants