Skip to content

[r3.4] db/version: enforce upper-bound file version check#20739

Merged
AskAlexSharov merged 1 commit into
release/3.4from
alex/upper_bound_version_chk_34
Apr 23, 2026
Merged

[r3.4] db/version: enforce upper-bound file version check#20739
AskAlexSharov merged 1 commit into
release/3.4from
alex/upper_bound_version_chk_34

Conversation

@AskAlexSharov

Copy link
Copy Markdown
Collaborator

Cherry-pick of #20722 to release/3.4.

## Problem

Snapshot file-version checks only rejected files that were **too old**.
Files that were **too new** passed the check and got read with the wrong
parser.

Example: binary supports up to `v2.1`, directory contains
`v3.0-storage.0-32.efi` — opened silently, no error.

## Solution

Check both bounds in `Versions.MustSupport` and fail fast:

- **Too old** → suggests `erigon snapshots reset`.
- **Too new** → suggests upgrading Erigon, or `erigon snapshots reset`
to align.

Logged once via `sync.Once` (parallel goroutines don't duplicate the
banner), then panics. Callsites in `dirty_files.go` and `block_types.go`
migrated; `VersionTooLowPanic` and its local twin deleted. Unit tests
cover in-range, too-low, and too-high.
@AskAlexSharov AskAlexSharov enabled auto-merge (squash) April 23, 2026 03:52
@AskAlexSharov AskAlexSharov merged commit 2bd2c39 into release/3.4 Apr 23, 2026
21 checks passed
@AskAlexSharov AskAlexSharov deleted the alex/upper_bound_version_chk_34 branch April 23, 2026 08:50
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