Skip to content

cmd/utils/app: skip commitment history integrity checks when disabled#20835

Merged
sudeepdino008 merged 1 commit into
mainfrom
sudeepdino008/integrity_skip_commitment_hist_when_disabled
Apr 27, 2026
Merged

cmd/utils/app: skip commitment history integrity checks when disabled#20835
sudeepdino008 merged 1 commit into
mainfrom
sudeepdino008/integrity_skip_commitment_hist_when_disabled

Conversation

@sudeepdino008

@sudeepdino008 sudeepdino008 commented Apr 27, 2026

Copy link
Copy Markdown
Member

Summary

seg integrity runs CommitmentHistVal and StateRootVerifyByHistory regardless of whether commitment history is persisted on the datadir. Both depend on commitment history .v files:

  • CheckCommitmentHistVal iterates .v files; when none exist it returns nil after logging files=0, which silently masks misconfiguration as a passing check.
  • CheckCommitmentHistAtBlkRange would fail confusingly when trying to read history that isn't there.

This PR reads rawdb.ReadDBCommitmentHistoryEnabled once at the start of doIntegrity and skips both checks with an informative log line when the flag is off. Mirrors the existing BorEvents / BorSpans chain-guard pattern in the same dispatch switch.

The other commitment checks (CommitmentRoot, CommitmentKvi, CommitmentKvDeref, StateVerify) operate on the domain .kv files and don't depend on history, so they remain unconditional.

Test plan

  • make lint clean
  • go build ./cmd/utils/app/... succeeds
  • On a no-history datadir, run seg integrity --check CommitmentHistVal and confirm the skip log appears and the command exits 0 instead of "passing" with files=0
  • On a history-enabled datadir, confirm CommitmentHistVal and StateRootVerifyByHistory still execute as before

CommitmentHistVal and StateRootVerifyByHistory require commitment
history. When commitment history isn't persisted, the former silently
"passed" with files=0 (masking misconfiguration) and the latter would
fail confusingly. Read the flag once at integrity entry and skip both
checks with an informative log line, matching the BorEvents/BorSpans
chain-name guard pattern in the same dispatch switch.
@AskAlexSharov AskAlexSharov enabled auto-merge April 27, 2026 07:58
@AskAlexSharov AskAlexSharov added this pull request to the merge queue Apr 27, 2026
@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Apr 27, 2026
@sudeepdino008 sudeepdino008 added this pull request to the merge queue Apr 27, 2026
Merged via the queue into main with commit c0e211f Apr 27, 2026
37 checks passed
@sudeepdino008 sudeepdino008 deleted the sudeepdino008/integrity_skip_commitment_hist_when_disabled branch April 27, 2026 09:40
sudeepdino008 added a commit that referenced this pull request Apr 27, 2026
…#20835)

## Summary

`seg integrity` runs `CommitmentHistVal` and `StateRootVerifyByHistory`
regardless of whether commitment history is persisted on the datadir.
Both depend on commitment history `.v` files:

- `CheckCommitmentHistVal` iterates `.v` files; when none exist it
returns nil after logging `files=0`, which silently masks
misconfiguration as a passing check.
- `CheckCommitmentHistAtBlkRange` would fail confusingly when trying to
read history that isn't there.

This PR reads `rawdb.ReadDBCommitmentHistoryEnabled` once at the start
of `doIntegrity` and skips both checks with an informative log line when
the flag is off. Mirrors the existing `BorEvents` / `BorSpans`
chain-guard pattern in the same dispatch switch.

The other commitment checks (`CommitmentRoot`, `CommitmentKvi`,
`CommitmentKvDeref`, `StateVerify`) operate on the domain `.kv` files
and don't depend on history, so they remain unconditional.

## Test plan

- [x] `make lint` clean
- [x] `go build ./cmd/utils/app/...` succeeds
- [x] On a no-history datadir, run `seg integrity --check
CommitmentHistVal` and confirm the skip log appears and the command
exits 0 instead of "passing" with files=0
- [x] On a history-enabled datadir, confirm `CommitmentHistVal` and
`StateRootVerifyByHistory` still execute as before
wmitsuda added a commit that referenced this pull request Apr 27, 2026
… (#20838)

Cherry-picks the integrity-area chain from `main` onto `performance`, in
order:

1. #20435 — `integrity: restore StateProgress check`
2. #20680 — `integrity, stagedsync: cap state collation at block
snapshots progress`
3. #20714 — `add time budget for integrity checks`
4. #20835 — `cmd/utils/app: skip commitment history integrity checks
when disabled`

#20714 is the structural refactor of `doIntegrity`
(`errgroup.Go(switch{...})` → `runCheck := func{}` + budget loop).
Conflicted with performance-only Bloatnet customizations on the same
function (#20806, #20810, #20813); resolved by adopting #20714's shape
and re-applying the Bloatnet handling for `CommitmentKvDeref`,
`CommitmentHistVal`, and `StateRootVerifyByHistory`. `failFast` arg on
`CheckCommitmentHistAtBlkRange` preserved (matches performance's
signature).

Submodule pointer for `execution/tests/execution-spec-tests` left
unchanged.

`make erigon` + `make lint` clean.
AskAlexSharov pushed a commit that referenced this pull request Apr 28, 2026
lupin012 pushed a commit that referenced this pull request May 2, 2026
…#20835)

## Summary

`seg integrity` runs `CommitmentHistVal` and `StateRootVerifyByHistory`
regardless of whether commitment history is persisted on the datadir.
Both depend on commitment history `.v` files:

- `CheckCommitmentHistVal` iterates `.v` files; when none exist it
returns nil after logging `files=0`, which silently masks
misconfiguration as a passing check.
- `CheckCommitmentHistAtBlkRange` would fail confusingly when trying to
read history that isn't there.

This PR reads `rawdb.ReadDBCommitmentHistoryEnabled` once at the start
of `doIntegrity` and skips both checks with an informative log line when
the flag is off. Mirrors the existing `BorEvents` / `BorSpans`
chain-guard pattern in the same dispatch switch.

The other commitment checks (`CommitmentRoot`, `CommitmentKvi`,
`CommitmentKvDeref`, `StateVerify`) operate on the domain `.kv` files
and don't depend on history, so they remain unconditional.

## Test plan

- [x] `make lint` clean
- [x] `go build ./cmd/utils/app/...` succeeds
- [x] On a no-history datadir, run `seg integrity --check
CommitmentHistVal` and confirm the skip log appears and the command
exits 0 instead of "passing" with files=0
- [x] On a history-enabled datadir, confirm `CommitmentHistVal` and
`StateRootVerifyByHistory` still execute as before
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