Skip to content

Implement contract state snapshots, pinning, and historical queries #524

Description

@Just-Bamford

Description

Problem

Contract state changes continuously, making it difficult to reproduce historical conditions or investigate bugs that depend on a previous state.

There is currently no high-level mechanism for identifying, storing, and querying historical contract state snapshots.

Solution

Implement contract state snapshot infrastructure.

Snapshots should be associated with a contract ID, ledger/version identifier, timestamp, and deterministic state fingerprint.

Applications should be able to pin a specific state version and later query or compare historical snapshots.

Acceptance Criteria

  • Contract state snapshot infrastructure is implemented.
  • pinContractState(contractId, version) is supported.
  • Snapshots contain contract ID, version/ledger reference, timestamp, and state fingerprint.
  • Historical snapshots can be queried.
  • Snapshot integrity can be verified.
  • Multiple snapshots for the same contract are supported.
  • State comparison between versions is available.
  • Missing or unavailable historical state is reported clearly.
  • Tests cover snapshot creation, pinning, retrieval, integrity validation, and comparison.
  • Exported through src/soroban/index.ts and src/index.ts.

Note for Contributors

Do not imply that arbitrary historical blockchain state can always be reconstructed locally. Clearly distinguish SDK-managed snapshots from externally retrievable ledger state.

Metadata

Metadata

Assignees

Labels

Stellar WaveIssues in the Stellar wave programbackendBackend / SDK logicenhancementNew feature or requestsmart-contractSoroban contract related

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions