Normalize chains/ directory for Substrate and tar snapshots#21
Merged
Conversation
Contributor
vukomir
commented
Mar 30, 2026
- Add SubstrateChainsDirName (hyphens to underscores) for ChainDBDataPath and RelayChainDBDataPath so on-disk layout matches the node.
- Extend tar extraction to strip chains//db|paritydb/ prefixes using both YAML chain_id and normalized segment; pass chain_id from SyncIfNeeded.
- Add tests for path mapping and snapshot sync with underscore archive paths.
- Add SubstrateChainsDirName (hyphens to underscores) for ChainDBDataPath and RelayChainDBDataPath so on-disk layout matches the node. - Extend tar extraction to strip chains/<id>/db|paritydb/ prefixes using both YAML chain_id and normalized segment; pass chain_id from SyncIfNeeded. - Add tests for path mapping and snapshot sync with underscore archive paths. Made-with: Cursor
There was a problem hiding this comment.
Pull request overview
Normalizes on-disk chains/ directory naming to match Substrate’s hyphen→underscore behavior, and improves tar snapshot extraction to handle archives that include chains/<id>/<db|paritydb>/... prefixes.
Changes:
- Add
config.SubstrateChainsDirName()and use it inChainDBDataPath/RelayChainDBDataPath. - Extend tar extraction to rewrite member paths by stripping
chains/<id>/<storageDir>/(matching both YAMLchain_idand normalized directory segment). - Update snapshot sync call sites/signature and add tests for underscore paths in tar archives.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
internal/snapshot/snapshot.go |
Adds chain-id-aware tar member path mapping and updates tar extraction to strip chains/<id>/<storageDir> prefixes safely. |
internal/snapshot/snapshot_test.go |
Adds tests for the new tar path mapping and updates existing SyncIfNeeded call sites for the new signature. |
internal/config/config.go |
Introduces SubstrateChainsDirName() and applies it to chain DB path construction. |
internal/config/config_test.go |
Extends fixed-path tests to cover hyphenated chain IDs mapping to underscore directories. |
cmd/bootstrap/main.go |
Passes YAML chain_id through to snapshot sync for tar path rewriting. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
todvildes
approved these changes
Mar 31, 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.