Skip to content

Bump persistent storage TTL for active escrow contracts to prevent eviction #334

@mikewheeleer

Description

@mikewheeleer

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

Metadata

Metadata

Assignees

Type

No fields configured for Task.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions