Description
Active escrows are written via env.storage().persistent().set(&DataKey::Contract(id), ...) but lib.rs never calls extend_ttl on persistent entries, while ttl.rs only handles temporary storage. Long-running contracts risk persistent-entry eviction (and fund-state loss) on Soroban. Add explicit TTL extension on contract reads/writes.
Requirements and context
- Scoped to TalentTrust
escrow Soroban contract (contracts/escrow).
- On each mutating access to
DataKey::Contract(id) (and related milestone keys), call extend_ttl with a deterministic bump threshold/extend-to policy documented in ttl.rs.
- Ensure the policy covers
DataKey::MilestoneReleased, DataKey::Reputation, and DataKey::AccumulatedProtocolFees.
- Invariant: any contract touched within its TTL window remains live; eviction cannot strand active escrow accounting.
- Must be secure, tested, and documented.
Suggested execution
- Fork the repo and create a branch:
git checkout -b security/persistent-ttl-bump
- Implement changes:
contracts/escrow/src/ttl.rs
- Tests:
contracts/escrow/src/test/persistence.rs
- Docs:
docs/escrow/storage-ttl.md
- Include rustdoc/NatSpec-style doc comments on public functions
- Validate security assumptions (auth, overflow, fail-closed state machine, storage TTL, fee accounting)
Test and commit
- Run tests:
cargo test
- Cover edge cases (unauthorized callers, double release/refund, expired approvals, fee rounding, paused state)
- Include test output and security notes in the PR
Example commit message
feat(escrow): bump persistent TTL on active contracts
Guidelines
- Minimum 95% test coverage on new/changed code
- Clear documentation
- Timeframe: 96 hours from assignment
Description
Active escrows are written via
env.storage().persistent().set(&DataKey::Contract(id), ...)butlib.rsnever callsextend_ttlon persistent entries, whilettl.rsonly handles temporary storage. Long-running contracts risk persistent-entry eviction (and fund-state loss) on Soroban. Add explicit TTL extension on contract reads/writes.Requirements and context
escrowSoroban contract (contracts/escrow).DataKey::Contract(id)(and related milestone keys), callextend_ttlwith a deterministic bump threshold/extend-to policy documented inttl.rs.DataKey::MilestoneReleased,DataKey::Reputation, andDataKey::AccumulatedProtocolFees.Suggested execution
git checkout -b security/persistent-ttl-bumpcontracts/escrow/src/ttl.rscontracts/escrow/src/test/persistence.rsdocs/escrow/storage-ttl.mdTest and commit
cargo testExample commit message
Guidelines