Skip to content

Bound domain merge limit; add CLI override#20705

Merged
wmitsuda merged 2 commits into
mainfrom
wmitsuda/bound-domain-merge
Apr 21, 2026
Merged

Bound domain merge limit; add CLI override#20705
wmitsuda merged 2 commits into
mainfrom
wmitsuda/bound-domain-merge

Conversation

@wmitsuda

Copy link
Copy Markdown
Member

Currently domain merge is unlimited (ignores steps-in-frozen-files setting, applied only to hsitory/index).

From now on, it follows the same limit by default.

On +3.5 snapshotters we should run erigon with --override.domain.steps-in-frozen-files="Inf" to preserve the old behavior and fabricate domains with unlimited merging.

…in-frozen-file

Domain merges previously ignored the stepsInFrozenFile cap that history and
inverted-index merges already honour, so a single domain merge could span
arbitrarily many steps. Apply the same cap to domain merges.

Also add --override.domain.steps-in-frozen-file to override the cap for
domain merges only (history/II keep using erigondb.toml): a positive integer
sets an explicit cap; "Inf" (via the new config3.UnboundedDomainMerge
sentinel) restores the pre-existing unbounded behaviour. When the override
is active it is logged once at startup alongside the "erigondb settings"
log line so operators can see the active cap.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR bounds domain-value merges by the same steps_in_frozen_file cap used elsewhere, and adds a CLI override to restore the legacy “unbounded domain merge” behavior when needed (e.g., for snapshot fabrication workflows).

Changes:

  • Apply a merge-span cap to domain value merges (separately from history/II) and thread the new parameter through call sites/tests.
  • Add --override.domain.steps-in-frozen-file CLI flag (supports "Inf") and plumb it into aggregator construction.
  • Introduce config3.UnboundedDomainMerge sentinel to represent “no cap”.

Reviewed changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
node/ethconfig/gen_config.go Adds TOML marshal/unmarshal support for the new override field.
node/ethconfig/config.go Adds OverrideDomainStepsInFrozenFile to the node config schema with semantics doc.
node/eth/backend.go Applies the override when building state.AggOpts, with startup logging.
node/cli/default_flags.go Registers the new override flag in default CLI flags list.
cmd/utils/flags.go Defines/parses the CLI flag and sets ethconfig.Config.OverrideDomainStepsInFrozenFile.
db/config3/config3.go Adds UnboundedDomainMerge sentinel constant.
db/state/aggregator2.go Adds AggOpts.DomainStepsInFrozenFileOverride plumbed into Aggregator.
db/state/aggregator.go Uses the override to compute a domain-only max span and forwards it into domain merge-range selection.
db/state/merge.go Updates DomainRoTx.findMergeRange to cap domain-value merge span via domainMaxSpan.
db/state/merge_test.go Updates unit tests for the new findMergeRange signature.
db/state/domain_test.go Updates domain tests to pass separate domain/history span args.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread db/state/aggregator.go
Comment thread db/state/merge.go
Comment thread cmd/utils/flags.go Outdated
@wmitsuda wmitsuda added this pull request to the merge queue Apr 21, 2026
@wmitsuda wmitsuda removed this pull request from the merge queue due to a manual request Apr 21, 2026
…rigondb.domain

Rename the CLI flag from --override.domain.steps-in-frozen-file to
--erigondb.domain.steps-in-frozen-file and the matching ethconfig/AggOpts
identifiers, so the name reflects that it's an erigondb-level setting
rather than a generic chain-config override.
@wmitsuda wmitsuda enabled auto-merge April 21, 2026 06:52
@wmitsuda wmitsuda added this pull request to the merge queue Apr 21, 2026
Merged via the queue into main with commit 9906635 Apr 21, 2026
36 checks passed
@wmitsuda wmitsuda deleted the wmitsuda/bound-domain-merge branch April 21, 2026 08:32
AskAlexSharov added a commit to JayeTurn/erigon that referenced this pull request Apr 23, 2026
…h#20730)

## Summary

Documents the `--erigondb.domain.steps-in-frozen-file` flag introduced
in erigontech#20705.

- Adds entry to the **Database and Caching** section of
`configuring-erigon/README.md`
- Flag overrides `erigondb.toml` `steps_in_frozen_file` for the domain
merge cap only
- Accepts a positive integer or `Inf` (unbounded); default is unset
(uses `erigondb.toml`)
- History and inverted-index merges are unaffected

## Test plan
- [ ] Verify flag appears in `erigon --help` on `main`
- [ ] Verify `Inf` is accepted as value

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: bloxster <gianni.morselli@erigon.tech>
Co-authored-by: Alex Sharov <AskAlexSharov@gmail.com>
wmitsuda added a commit that referenced this pull request Apr 27, 2026
AskAlexSharov pushed a commit that referenced this pull request May 13, 2026
….steps-in-frozen-file (#21148)

Cherry-pick of #20705 to `release/3.4`.

Conflict-resolution notes:
- Kept `stepSize`/`stepsInFrozenFile` as `uint64` (release/3.4 hasn't
picked up the `atomic.Uint64` refactor from main); only the new
`erigondbDomainStepsInFrozenFile` override field was added.
- Did not pull in unrelated test helpers
(`filledDomainWithHashMapAccessor`,
`TestDomain_KeyPosResetOnCollisionRetry`) that exist on main but not on
`release/3.4`.
- `node/eth/backend.go`: kept the `db/consensuschain` import and added
`db/config3` alongside it.

Prerequisite for cherry-pick of #21025 to `release/3.4`.
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.

3 participants