Repository navigation
db/state, cmd: enable parallel commitment by default - #23831
Conversation
…llel-commitment=false selects the sequential trie
There was a problem hiding this comment.
🔵 Needs a closer look
It changes the default for a consensus-critical state-root/commitment computation path, so it warrants final human review despite the configuration-resolution tests.
Pull request overview
Enables parallel commitment (ParallelPatriciaHashed) by default across Erigon and the integration binary, and fixes the previous configuration-resolution pitfalls so COMMITMENT_PARALLEL can seed the default while an explicit CLI flag can override it in either direction.
Changes:
- Flip defaults to “on” for both
COMMITMENT_PARALLEL(viastatecfg) and--experimental.parallel-commitment(CLI flag). - Add explicit-resolution logic so
--experimental.parallel-commitment=falseandCOMMITMENT_PARALLEL=falsereliably select the sequential trie. - Add tests covering default + both override directions for both
cmd/utils(urfave/cli) andcmd/integration(cobra).
File summaries
| File | Description |
|---|---|
| docs/design/parallel-patricia-hashed.md | Updates design doc tables to reflect “default on” and how to force sequential mode. |
| db/state/statecfg/state_schema.go | Changes env default for ExperimentalParallelCommitment to true and updates its comment accordingly. |
| cmd/utils/flags.go | Sets CLI default to true and introduces setParallelCommitment to honor explicit =false overrides. |
| cmd/utils/flags_test.go | Adds unit test validating default + override behavior for setParallelCommitment. |
| cmd/integration/commands/flags.go | Aligns integration’s default to statecfg (env-seeded) rather than OR-ing with the CLI default. |
| cmd/integration/commands/dump_state_test.go | Adds test ensuring integration default follows statecfg and explicit flags override both ways. |
Review details
- Files reviewed: 6/6 changed files
- Comments generated: 0
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
ReviewThe resolution chain in 1. "CI arms are unaffected" holds for the Nine workflows set Sites that construct without either option and do not 2. if config.ExperimentalParallelCommitment {
statecfg.ExperimentalParallelCommitment = true
}With the default 3. if cfg.ExperimentalParallelCommitment || statecfg.ExperimentalParallelCommitment {It runs after 4. Nit. The flag is on by default and its usage no longer says EXPERIMENTAL, but the name is still |
There was a problem hiding this comment.
🔵 Needs a closer look
It changes the default state-root/commitment computation path, which is correctness-critical and warrants final human review despite the added tests.
Review details
- Files reviewed: 6/6 changed files
- Comments generated: 3
- Review effort level: Lite
…eck; single default const; refresh flag docs
…ed COMMITMENT_PARALLEL is no longer accepted
…tring already say
ReviewThe 1. The env rename is a silent break that reverses the operator's intent, and it is bundled with the flip. Either keep the unprefixed name accepted for a release, or fail fast at startup when 2. if config.ExperimentalParallelCommitment {
statecfg.ExperimentalParallelCommitment = true
}With the default 3. if cfg.ExperimentalParallelCommitment || statecfg.ExperimentalParallelCommitment {It runs after 4. The audit claim in the description is stronger than the code. 5. Nit. |
…mitment field; statecfg is the only source of truth
|
2 and 3 — done, but not the way point 2 asks. Assigning unconditionally would have introduced a bug: The field had one writer and two readers and could only ever disagree with 4 — corrected, thank you. The description now says three groups, not two: wired centrally by 5 — already gone, deleted outright in 1 — open, and the one I am not deciding unilaterally. The break is real: |
…ntly reversed an operator's =false
|
1 — you were right, and the rename is reverted in
That leaves this PR doing one thing: flipping the default and making the flag resolve in both directions. The rename was a second behaviour change riding along, and the direction it failed in — the one setting whose purpose is "not the parallel trie" silently selecting it — is not one to ship on the same commit as the flip. |
There was a problem hiding this comment.
🔵 Needs a closer look
Canonical environment-variable precedence and related documentation must be corrected before approval.
Review details
Suppressed comments (5)
db/state/statecfg/state_schema.go:201
- Passing the unprefixed name makes
envLookupcheckCOMMITMENT_PARALLELbeforeERIGON_COMMITMENT_PARALLEL. If both exist, a stale unprefixed value wins, contrary to the intended prefixed-only setting. Pass the canonical name directly so the legacy alias cannot override it.
var ExperimentalParallelCommitment = dbg.EnvBool("COMMITMENT_PARALLEL", DefaultParallelCommitment)
docs/design/parallel-patricia-hashed.md:271
- The design table should use the canonical
ERIGON_COMMITMENT_PARALLELname; the unprefixed spelling emits a warning and can conflict with the setting used by CI and tooling.
| `--experimental.parallel-commitment` | on | selects `VariantParallelHexPatricia` (`execctx.PickTrieVariant`); `=false`, or `COMMITMENT_PARALLEL=false`, selects `VariantHexPatriciaTrie` |
docs/site/docs/fundamentals/configuring-erigon.mdx:510
- This newly recommends the non-canonical environment variable, which emits an
envLookupwarning and conflicts with theERIGON_COMMITMENT_PARALLELname used by workflows and tooling. Document the canonical name instead.
* `--experimental.parallel-commitment` *(New in v3.6)*: Compute the commitment trie with the fully parallel `ParallelPatriciaHashed` implementation. Pass `--experimental.parallel-commitment=false`, or set `COMMITMENT_PARALLEL=false`, to fall back to the sequential `HexPatriciaHashed` trie.
docs/site/static/llms-full.txt:2715
- Keep this generated reference aligned with the canonical
ERIGON_COMMITMENT_PARALLELsetting; the unprefixed form emits a warning.
* `--experimental.parallel-commitment` *(New in v3.6)*: Compute the commitment trie with the fully parallel `ParallelPatriciaHashed` implementation. Pass `--experimental.parallel-commitment=false`, or set `COMMITMENT_PARALLEL=false`, to fall back to the sequential `HexPatriciaHashed` trie.
llms-full.txt:2715
- Keep this generated reference aligned with the canonical
ERIGON_COMMITMENT_PARALLELsetting; the unprefixed form emits a warning.
* `--experimental.parallel-commitment` *(New in v3.6)*: Compute the commitment trie with the fully parallel `ParallelPatriciaHashed` implementation. Pass `--experimental.parallel-commitment=false`, or set `COMMITMENT_PARALLEL=false`, to fall back to the sequential `HexPatriciaHashed` trie.
- Files reviewed: 18/18 changed files
- Comments generated: 0 new
- Review effort level: Balanced
…#24623) Fixes #24612. Alternative to #24617. Since #23831 made parallel commitment the default, `reconcileTrieVariant` refuses every bin-only datadir, so `erigon init` on a genesis with `binaryTrieTime: 0` fails with no flags. The refusal protects nothing: `PickTrieVariant` returns the bin trie before it reads the parallel flag. This drops the refusal and leaves the parallel default alone. ## Changes - `reconcileTrieVariant` no longer refuses parallel commitment on a bin-only datadir and does not touch `ExperimentalParallelCommitment`. - `TestPBinVariantBinDatadirRefusesParallel` becomes `TestPBinVariantBinDatadirResolvesWithParallelDefault`: resolve succeeds, parallel stays on, `PickTrieVariant()` is bin. - The bin test helpers (genesis, rpchelper, PBT builder, acceptance harness) stop forcing parallel off, so they run under the default.
--experimental.parallel-commitmentandCOMMITMENT_PARALLELnow default to on: a node with neither set computes commitment onParallelPatriciaHashed. Closes #21137.Flipping the two defaults is not enough on its own. The CLI flag was one-way (
if ctx.Bool(...) { cfg.X = true }) and integration's binding merged both defaults with||, so atruedefault would have left=falseand the env var inert. Resolution is now: the env var seedsstatecfg.ExperimentalParallelCommitment, an explicit flag overrides it either way, andstatecfgcarries the effective value.statecfg.DefaultParallelCommitmentis the single literal behind both the env fallback and the flag's advertised default, so the two cannot drift.The flip also makes
checkParaTrieWiredreachable for anyNewSharedDomainsthat selects the parallel variant with no DB wired — underERIGON_ASSERTthat path returns an error rather than warning and falling back. All 46 non-test call sites audited, and they fall into three groups, not two: wired (execV3/execV3SerialcallEnableParaTrieDBcentrally, covering thecmd/integrationandexecmoduleclusters), opted out (WithSequentialCommitment), and never reachingComputeCommitmentat all (execmoduleonly flushes theBlockOverlay;InitPraguePreDeploysand thevm/runtimehelpers compute no root). That last group is safe by unreachability, not by opting out — do not read it as an invariant the guard depends on. One site was genuinely exposed,db/integrity/commitment_integrity.go:1222, fixed here.node/ethconfig.Config.ExperimentalParallelCommitmentis gone. It had one writer and two readers and could only ever disagree withstatecfg;statecfg.ExperimentalParallelCommitmentis now the single source of truth, which removes the||merge atcmd/utils/flags.goand the one-way set innode/eth/backend.go.CI arms are unaffected — every
commitment_modematrix leg already setsERIGON_COMMITMENT_PARALLELexplicitly, so both stay pinned regardless of the default.Changes
db/state/statecfg:DefaultParallelCommitment = truebehindEnvBool("COMMITMENT_PARALLEL", …);cmd/utilstakes the flag'sValuefrom the same constcmd/utils:setParallelCommitmentreplaces the one-way set and honours an explicit=falsenode/ethconfig,node/eth: drop the duplicateExperimentalParallelCommitmentfield and the one-way sync it fedcmd/integration:withExperimentalCommitmentdefaults tostatecfg; the previous||clobbered an envfalseonce the flag default becametruedb/integrity: the per-block history check passesWithSequentialCommitment(), matching its two siblings at :1140 and :1208llms-full.txtcopies