Skip to content

feat(storage): implement protocol-wide Soroban TTL management - #88

Merged
Nabeelahh merged 2 commits into
Vaulty-X:mainfrom
lynaDev2:feature/protocol-storage-ttl-management
Jul 28, 2026
Merged

feat(storage): implement protocol-wide Soroban TTL management#88
Nabeelahh merged 2 commits into
Vaulty-X:mainfrom
lynaDev2:feature/protocol-storage-ttl-management

Conversation

@lynaDev2

Copy link
Copy Markdown
Contributor

Summary

This PR introduces a protocol-wide storage lifecycle system to ensure long-lived protocol state remains available by implementing shared Soroban TTL management across contracts.

Changes

  • Added shared TTL constants and storage policy categories for instance, vault, user, reward, lending, and borrowing state.
  • Implemented reusable storage helpers to safely extend TTL when records are created, read, or updated.
  • Ensured vault metadata and balances persist for the full lock period with an additional safety buffer.
  • Added automatic TTL renewal for streak, reward, lending, and borrowing records during normal protocol activity.
  • Added handling for records approaching expiry with a consistent renewal/error path.
  • Prevented near-expiry or expired state from producing incorrect balances, debt calculations, or reward eligibility.
  • Updated affected contracts to use the shared storage helpers instead of direct persistent storage access.
  • Added unit tests covering TTL extension behaviour across all affected contracts.
  • Added an integration test covering long-lived vaults, streak updates, reward claims, lending positions, and borrowing positions across simulated ledger progression.
  • Documented the protocol TTL policy, operational assumptions, and maintenance expectations in the contract README.

Testing

  • Verified TTL is extended when records are created, read, and modified.
  • Confirmed vault state survives beyond the configured lock period with the required safety buffer.
  • Verified streak, reward, lending, and borrowing records renew correctly during normal operations.
  • Tested near-expiry and expired record handling.
  • Ran unit and integration tests covering long-term ledger progression and state persistence.

Closes #87

@Nabeelahh
Nabeelahh merged commit cef29b1 into Vaulty-X:main Jul 28, 2026
1 check failed
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.

[Contract] Implement protocol-wide Soroban storage TTL management and state-survival guarantees

2 participants