Skip to content

[Contracts] Extend storage TTL to prevent stream entries from being archived #449

@ogazboiz

Description

@ogazboiz

Join the discussion on Telegram

Why this matters

Soroban persistent storage entries are not permanent — every entry has a Time To Live (TTL) and is archived once it expires, after which reads fail until the entry is restored. The StreamContract writes every stream to persistent storage in save_stream (contracts/stream_contract/src/storage.rs) and the protocol config to instance storage, but nothing in the contract ever extends those TTLs. A long-running stream (e.g. a 1-year salary stream) can have its on-chain state archived out from under it, causing withdraw, cancel_stream, and view calls to fail even though the stream is logically still active. For a payment-streaming protocol where streams are explicitly designed to live a long time, this is a correctness/availability gap that must be addressed before mainnet.

Acceptance criteria

  • Extend the persistent TTL of a stream entry whenever it is read or written (e.g. in save_stream / load_stream in contracts/stream_contract/src/storage.rs, or after each mutating op in lib.rs) using env.storage().persistent().extend_ttl(...).
  • Extend the instance TTL covering ProtocolConfig and the stream counter on each mutating entry point.
  • Define sensible threshold/extend-to constants (documented) rather than magic numbers.
  • Add a unit test in contracts/stream_contract/src/test.rs that advances the ledger past a short TTL and asserts the stream is still readable after a mutating call bumped it.
  • Document the TTL strategy in code comments.

Files to touch

  • contracts/stream_contract/src/storage.rs
  • contracts/stream_contract/src/lib.rs
  • contracts/stream_contract/src/test.rs

Out of scope

  • A separate keeper/cron service to bump TTLs off-chain (this issue is about in-contract bumping only).
  • Storage archival restoration UX in the frontend.

Metadata

Metadata

Assignees

Labels

Stellar WaveIssues in the Stellar wave programcontractsSmart contract related taskshigh-priorityCritical items for MVPsmart-contractSoroban smart contract

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions