Skip to content

fix: extend TTL on persistent storage writes (#317) - #364

Open
laurentketterle-hub wants to merge 1 commit into
Heliobond:mainfrom
laurentketterle-hub:fix/persistent-storage-ttl
Open

fix: extend TTL on persistent storage writes (#317)#364
laurentketterle-hub wants to merge 1 commit into
Heliobond:mainfrom
laurentketterle-hub:fix/persistent-storage-ttl

Conversation

@laurentketterle-hub

Copy link
Copy Markdown

Summary

Persistent storage keys such as YieldPerShareAccum, YieldDebt(Address), ProjectInvestment(u32),
InsuranceFund, QueueEntry(u64), ComplianceEvent(u64), CarbonCreditBalance(Address) and
LastDeposit(Address) are written via plain .set() with no accompanying extend_ttl.

ADR-002 asserts "rent is implicitly paid when the entries are read or written", which is not how
Soroban's TTL model works — writes do not auto-extend an entry beyond the network default
minimum. Long-idle vaults therefore risk archival of yield/queue/insurance/credit state, which would
require an explicit restore (or fail) on next access.

Changes

  • Add PERSISTENT_TTL_THRESHOLD (1 day) and PERSISTENT_TTL_EXTEND_TO (30 days) constants.
  • Call extend_ttl immediately after every persistent write of the keys above, matching the existing
    pattern already used for TotalDeposited.

Note on compilation

This branch is based on main, which currently does not compile. It therefore also carries the
compile fixes from #362 (missing closing braces in get_withdrawal_window, get_volume_fee_tier,
check_deposit_lock, withdrawal_window_set, funding_round_ended and
test_volume_fee_tier_is_admin_only, plus the duplicate VaultError discriminants). Please merge
#362 first, or I can rebase this branch once #362 lands.

Closes #317

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.

Most persistent storage keys in investment_vault never get a TTL extension

1 participant