cmd: make 'seg ls' work without chaindata via graceful degradation - #21862
Merged
Merged
Conversation
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.
AskAlexSharov
approved these changes
Jun 17, 2026
awskii
marked this pull request as ready for review
June 18, 2026 03:29
awskii
enabled auto-merge
June 18, 2026 03:29
github-merge-queue
Bot
removed this pull request from the merge queue due to failed status checks
Jun 18, 2026
This was referenced Jun 19, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
erigon seg lsnow works even when chaindata is unavailable (e.g. snapshot-only datadirs, cold storage, post-mortem analysis).How
One
doLSpath with graceful degradation — no branching into two code paths:tryOpenChaindatareplaces panickingMustOpen(), returns nil if chaindata missing/lockedtryOpenAgg— skipped with a log message if unavailable (e.g. no salt files)openAggrefactored into panic wrapper overtryOpenAgg— existing callers unchangedTest
TestSegLS_NoChaindata— asserts no panic/error on empty datadir.Verified
make lintclean (×2)make erigon integrationbuildserigon seg ls --datadir=/tmp/emptylogs degradation messages, exits 0