fix: extend TTL on persistent storage writes (#317) - #364
Open
laurentketterle-hub wants to merge 1 commit into
Open
fix: extend TTL on persistent storage writes (#317)#364laurentketterle-hub wants to merge 1 commit into
laurentketterle-hub wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Persistent storage keys such as
YieldPerShareAccum,YieldDebt(Address),ProjectInvestment(u32),InsuranceFund,QueueEntry(u64),ComplianceEvent(u64),CarbonCreditBalance(Address)andLastDeposit(Address)are written via plain.set()with no accompanyingextend_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
PERSISTENT_TTL_THRESHOLD(1 day) andPERSISTENT_TTL_EXTEND_TO(30 days) constants.extend_ttlimmediately after every persistent write of the keys above, matching the existingpattern already used for
TotalDeposited.Note on compilation
This branch is based on
main, which currently does not compile. It therefore also carries thecompile fixes from #362 (missing closing braces in
get_withdrawal_window,get_volume_fee_tier,check_deposit_lock,withdrawal_window_set,funding_round_endedandtest_volume_fee_tier_is_admin_only, plus the duplicateVaultErrordiscriminants). Please merge#362 first, or I can rebase this branch once #362 lands.
Closes #317