Skip to content

feat: environment-driven snapshot restore with targetHeight selection#51

Merged
bdchatham merged 4 commits intomainfrom
feat/env-driven-snapshot-restore
Apr 1, 2026
Merged

feat: environment-driven snapshot restore with targetHeight selection#51
bdchatham merged 4 commits intomainfrom
feat/env-driven-snapshot-restore

Conversation

@bdchatham
Copy link
Copy Markdown
Contributor

Summary

  • Snapshot restore derives S3 bucket/region/chainID from environment (SEI_SNAPSHOT_BUCKET, SEI_SNAPSHOT_REGION, SEI_CHAIN_ID)
  • Only task param is now targetHeight:
    • > 0: lists S3 objects, picks highest snapshot <= target
    • == 0: reads latest.txt for newest snapshot
  • Simplified filename convention: {height}.tar.gz (removed chain/region suffix)
  • Added ObjectLister interface for S3 ListObjectsV2 pagination
  • serve.go validates snapshot env vars at startup

Test plan

  • All sidecar tests pass
  • Target height selection tested (picks correct snapshot, errors on no match)
  • Latest.txt path tested
  • Client round-trip tests updated

🤖 Generated with Claude Code

Refactor snapshot restore to derive S3 bucket/region/chainID from
environment variables (matching the genesis convention). The only task
param is now targetHeight:

- targetHeight > 0: lists S3 objects, picks highest snapshot <= target
- targetHeight == 0: reads latest.txt for newest snapshot

Changes:
- SnapshotRestoreRequest: remove Bucket/Prefix/Region/ChainID, add TargetHeight
- NewSnapshotRestorer: takes bucket/region/chainID from env at construction
- Add resolveKeyForHeight with S3 ListObjectsV2 pagination
- Add ObjectLister/ObjectListerFactory interfaces to s3 package
- Simplify snapshot filename to {height}.tar.gz (drop chain/region suffix)
- serve.go: validate SEI_SNAPSHOT_BUCKET/SEI_SNAPSHOT_REGION at startup
- Update client SnapshotRestoreTask to match
- Full test coverage for target height selection

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
bdchatham and others added 3 commits April 1, 2026 14:54
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…idation, dead code

- Add pagination test for resolveKeyForHeight (multi-page mock)
- Add negative targetHeight validation in Restore
- Remove dead parseUploadConfig function

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…structor

Fail at construction time rather than at task execution time, matching
the pattern requested in PR review.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@bdchatham bdchatham merged commit 4fb3316 into main Apr 1, 2026
2 checks passed
@bdchatham bdchatham deleted the feat/env-driven-snapshot-restore branch April 1, 2026 22:22
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.

1 participant