Skip to content

feat: implement storage ttl extensions across state mutations - #81

Open
AbuJulaybeeb wants to merge 1 commit into
Padi-Pay:mainfrom
AbuJulaybeeb:feat/ttl-extensions
Open

feat: implement storage ttl extensions across state mutations#81
AbuJulaybeeb wants to merge 1 commit into
Padi-Pay:mainfrom
AbuJulaybeeb:feat/ttl-extensions

Conversation

@AbuJulaybeeb

Copy link
Copy Markdown

What was done

  • Abstracted extend_instance_ttl and extend_persistent_ttl wrapper functions in src/storage.rs.
  • Defined ledger metric variables mapping dynamically to 30 days (BUMP_AMOUNT = 30 * DAY_IN_LEDGERS).
  • Integrated persistent TTL extensions globally into the write_escrow_state helper, protecting the core EscrowState ledger persistence anytime an escrow is manipulated.
  • Integrated instance TTL extensions uniformly across all major state-mutating entrypoints (create_escrow, lock_funds, release_funds, and refund) in src/contract.rs.

Why it was done

  • Active contracts require consistent bumping of their Time-To-Live parameters inside the new Soroban ledger expiry model.
  • By failing to perform these bump executions locally, instances carrying live escrows or administration config parameters can permanently fall off the ledger—locking buyer funds entirely.
  • Exposing these wrappers abstracts away the internal manual env.storage().extend_ttl(...) configurations and standardizes our bump lengths safely across all contract states preventing logic repetition and ledger evaporation risks.

How it was verified

  • cargo test executed locally resulting in completely unbroken functionality across all 26 escrow lifecycle/storage verification tests.
  • Extenders strictly invoked exactly once per state mutation utilizing optimal lifetimes and triggering limits.

closes #51

@Robotron2

Copy link
Copy Markdown
Contributor

Ensure the CI checks pass before the PR can be merged please. @AbuJulaybeeb

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.

TTL Extension & State Preservation

2 participants