Skip to content

feat: add persistent storage TTL bumps for commitments#552

Open
Dayz-tech-co wants to merge 3 commits into
Commitlabs-Org:masterfrom
Dayz-tech-co:feature/storage-ttl-bump
Open

feat: add persistent storage TTL bumps for commitments#552
Dayz-tech-co wants to merge 3 commits into
Commitlabs-Org:masterfrom
Dayz-tech-co:feature/storage-ttl-bump

Conversation

@Dayz-tech-co
Copy link
Copy Markdown
Contributor

@Dayz-tech-co Dayz-tech-co commented Jun 1, 2026

Closes #468


#468
This PR adds persistent-storage TTL management for escrow commitments so active commitment records and owner indexes remain readable through their full maturity window.

What changed

  • Added maturity-based TTL bump helpers in contracts/escrow/src/lib.rs

    • converts remaining commitment lifetime into Soroban ledgers
    • adds a small post-maturity buffer
    • caps TTL requests at the network max TTL
  • Updated persistent write paths

    • save now bumps DataKey::Commitment(id) after each create/mutation write
    • index_owner recomputes the latest maturity in an owner’s commitment list and bumps DataKey::OwnerIndex(owner)
    • deindex_owner refreshes the remaining owner index TTL after ownership changes
  • Added focused contract tests in contracts/escrow/src/test.rs

    • verifies commitment and owner-index TTLs are bumped on create
    • verifies a later mutation refreshes TTL when storage falls behind the remaining maturity horizon
    • verifies owner-index TTL tracks the latest commitment maturity
  • Documented the strategy in contracts/README.md

    • explains maturity-based TTL targeting
    • explains the thresholded bump behavior and fee tradeoff

Why

The escrow contract stores commitments in persistent Soroban storage, but without explicit TTL extension long-duration commitments can expire before they mature. This PR keeps active entries alive for the full escrow duration while avoiding unnecessary rent-extension fees.

Validation

Ran:

  • cargo check --lib --manifest-path contracts/Cargo.toml
  • cargo test ttl_ --manifest-path contracts/Cargo.toml

Result:

  • library compile passed
  • new TTL-focused tests passed

Notes

  • TTL bumps are conditional, not unconditional, so writes only pay extension fees when the current entry TTL no longer covers the remaining maturity horizon.
  • The target TTL includes a small post-maturity buffer so release/refund can still execute after maturity.

@vercel
Copy link
Copy Markdown

vercel Bot commented Jun 1, 2026

@Dayz-tech-co is attempting to deploy a commit to the 1nonly's projects Team on Vercel.

A member of the Team first needs to authorize it.

@drips-wave
Copy link
Copy Markdown

drips-wave Bot commented Jun 1, 2026

@Dayz-tech-co Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Contracts - Add storage TTL/bump management for persistent commitment entries

1 participant