Skip to content

cp: skip commitment history integrity checks when disabled#20839

Merged
AskAlexSharov merged 1 commit into
release/3.4from
cherry-pick/20835-to-release-3.4
Apr 28, 2026
Merged

cp: skip commitment history integrity checks when disabled#20839
AskAlexSharov merged 1 commit into
release/3.4from
cherry-pick/20835-to-release-3.4

Conversation

@sudeepdino008

Copy link
Copy Markdown
Member

Cherry-pick of #20835 to release/3.4.

…#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
@sudeepdino008 sudeepdino008 changed the title cmd/utils/app: skip commitment history integrity checks when disabled (cp #20835) cp: skip commitment history integrity checks when disabled Apr 27, 2026
@AskAlexSharov AskAlexSharov merged commit f1cb909 into release/3.4 Apr 28, 2026
21 checks passed
@AskAlexSharov AskAlexSharov deleted the cherry-pick/20835-to-release-3.4 branch April 28, 2026 04:04
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