Description
There is no mechanism to snapshot Soroban contract state at a specific ledger for point-in-time recovery. Implement a state snapshot service that captures all persistent storage entries at a given ledger and supports restoring them to a Soroban sandbox for debugging.
Requirements and Context
- Snapshot: enumerate all
ContractData ledger entries for a contract at a given ledger
- Store snapshots in Supabase with ledger number, contract ID, and compressed state blob
- Restore: load snapshot into a Soroban simulation context for offline replay
- Snapshot size limit: 10MB per contract per snapshot
Suggested Execution
Branch: feat/soroban-contract-state-snapshot-recovery
Implement Changes
- Create
contract-state-snapshot.ts in packages/stellar/src/
- Use Horizon
/ledger/{sequence}/effects to enumerate storage changes
- Compress and store snapshots in Supabase Storage with metadata in DB
- Add tests for snapshot creation, compression, and offline restore
Test and Commit
Run pnpm test --filter=stellar -- contract-state-snapshot and confirm snapshot and restore roundtrip tests pass.
Example Commit Message
feat(soroban): add contract state snapshot service with point-in-time recovery
Co-authored-by: <your-name>
Guidelines
- Branch off
main, keep PRs focused on one issue
- All new code must include unit or integration tests
- Ensure
pnpm lint and pnpm typecheck pass before review
- Link this issue in your PR description
- Request review from at least one maintainer before merging
Description
There is no mechanism to snapshot Soroban contract state at a specific ledger for point-in-time recovery. Implement a state snapshot service that captures all persistent storage entries at a given ledger and supports restoring them to a Soroban sandbox for debugging.
Requirements and Context
ContractDataledger entries for a contract at a given ledgerSuggested Execution
Branch:
feat/soroban-contract-state-snapshot-recoveryImplement Changes
contract-state-snapshot.tsinpackages/stellar/src//ledger/{sequence}/effectsto enumerate storage changesTest and Commit
Run
pnpm test --filter=stellar -- contract-state-snapshotand confirm snapshot and restore roundtrip tests pass.Example Commit Message
Guidelines
main, keep PRs focused on one issuepnpm lintandpnpm typecheckpass before review