Description
Long-running streams may span days or weeks, so persistent stream entries and instance storage must have their TTLs extended to avoid archival mid-stream. This addresses the org's "durable long-running jobs / multi-day stream windows" concern at the contract layer.
Requirements and Context
- Bump persistent entry TTL (
env.storage().persistent().extend_ttl(...)) for a stream on every read/write in its money paths.
- Bump instance TTL (
env.storage().instance().extend_ttl(...)) for admin/count keys.
- Define and document threshold/extend-to constants tuned for multi-day/multi-week streams.
- Handle restore semantics so a stream survives the entire
start_time..end_time window plus a buffer.
- Must be secure, tested, and documented.
- Should be efficient and easy to review.
Suggested Execution
- Fork the repo and create a branch
git checkout -b feature/storage-ttl-archival
- Implement changes
contracts/contracts/streampay-stream/src/storage.rs (centralized TTL bump helpers + constants)
contracts/contracts/streampay-stream/src/lib.rs (call bumps in read/write paths)
contracts/contracts/streampay-stream/src/test.rs (advance ledger sequence, assert TTL extended)
- Test and commit
cd contracts && cargo test -p streampay-stream ttl
- Cover edge cases (long window near max TTL, repeated bumps)
- Include test output and notes in the PR
Example commit message
feat: extend storage TTL to survive long stream windows
Acceptance Criteria
Guidelines
.rs files under contracts/contracts/streampay-stream/src/; tests via cargo test; NatSpec-style /// docs; minimum 95% test coverage; tune TTL for multi-week streams
- Clear documentation and inline comments
- Timeframe: 96 hours
Description
Long-running streams may span days or weeks, so persistent stream entries and instance storage must have their TTLs extended to avoid archival mid-stream. This addresses the org's "durable long-running jobs / multi-day stream windows" concern at the contract layer.
Requirements and Context
env.storage().persistent().extend_ttl(...)) for a stream on every read/write in its money paths.env.storage().instance().extend_ttl(...)) for admin/count keys.start_time..end_timewindow plus a buffer.Suggested Execution
contracts/contracts/streampay-stream/src/storage.rs(centralized TTL bump helpers + constants)contracts/contracts/streampay-stream/src/lib.rs(call bumps in read/write paths)contracts/contracts/streampay-stream/src/test.rs(advance ledger sequence, assert TTL extended)cd contracts && cargo test -p streampay-stream ttlExample commit message
Acceptance Criteria
cargo testadvances ledger and asserts entries remain liveGuidelines
.rsfiles undercontracts/contracts/streampay-stream/src/; tests viacargo test; NatSpec-style///docs; minimum 95% test coverage; tune TTL for multi-week streams