Skip to content

cmd: make 'seg ls' work without chaindata via graceful degradation - #21862

Merged
yperbasis merged 1 commit into
mainfrom
awskii/seg-ls-no-mdbx
Jun 18, 2026
Merged

yperbasis merged 1 commit into
mainfrom
awskii/seg-ls-no-mdbx

Conversation

@awskii

@awskii awskii commented Jun 17, 2026

Copy link
Copy Markdown
Member

What

erigon seg ls now works even when chaindata is unavailable (e.g. snapshot-only datadirs, cold storage, post-mortem analysis).

How

One doLS path with graceful degradation — no branching into two code paths:

  • tryOpenChaindata replaces panicking MustOpen(), returns nil if chaindata missing/locked
  • Block + bor snaps opened directly from filesystem (always works)
  • State aggregator opened via new tryOpenAgg — skipped with a log message if unavailable (e.g. no salt files)
  • Caplin snaps only opened when chain name is known
  • openAgg refactored into panic wrapper over tryOpenAgg — existing callers unchanged

Test

TestSegLS_NoChaindata — asserts no panic/error on empty datadir.

Verified

  • make lint clean (×2)
  • make erigon integration builds
  • erigon seg ls --datadir=/tmp/empty logs degradation messages, exits 0

doLS panicked via MustOpen() when a datadir had no chaindata (snapshot-only
nodes, cold storage, post-mortem analysis). Replace it with a single
lsDatadir path that tries to open chaindata but falls back to filesystem-only
listing when it is missing, and skips the state aggregator when its salt is
absent instead of panicking.
@awskii
awskii marked this pull request as ready for review June 18, 2026 03:29
@awskii
awskii requested a review from yperbasis as a code owner June 18, 2026 03:29
@awskii
awskii enabled auto-merge June 18, 2026 03:29
@awskii
awskii added this pull request to the merge queue Jun 18, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Jun 18, 2026
@yperbasis
yperbasis added this pull request to the merge queue Jun 18, 2026
Merged via the queue into main with commit 213f13c Jun 18, 2026
169 checks passed
@yperbasis
yperbasis deleted the awskii/seg-ls-no-mdbx branch June 18, 2026 09:21
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