Skip to content

Implement Soroban Contract State Snapshot with Point-in-Time Recovery Capability #794

Description

@temma02

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Stellar WaveIssues in the Stellar wave programsorobanSoroban smart contract issuesstellarStellar blockchain issues

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions