feat(storage): extend persistent storage TTL on every write#460
Open
devEunicee wants to merge 1 commit into
Open
feat(storage): extend persistent storage TTL on every write#460devEunicee wants to merge 1 commit into
devEunicee wants to merge 1 commit into
Conversation
…nJoy#294) - Add PROPOSAL_TTL_LEDGERS (518400 ~30d) and VOTE_TTL_LEDGERS for proposal/vote/has-voted keys - Add COOLDOWN_TTL_LEDGERS (120960 ~7d) for LastProposal cooldown key - Call extend_ttl on every persistent set_* so data survives the full proposal lifecycle without manual bumping - Document TTL assumptions and constants in docs/storage.md Closes PrincessnJoy#294
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
Closes #294
Soroban persistent storage entries expire if their TTL reaches zero. This PR bumps the TTL on every write to persistent storage so proposal and vote data survives the full proposal lifecycle.
Changes
contracts/governance/src/storage.rs— Added TTL constants andextend_ttlcalls on everyset_*persistent accessor:PROPOSAL_TTL_LEDGERS = 518_400(~30 days at 5 s/ledger) applied toProposal,HasVoted,VoteRecordkeysCOOLDOWN_TTL_LEDGERS = 120_960(~7 days) applied toLastProposalkeydocs/storage.md— Added Storage TTL Extension section documenting TTL values, rationale, and assumptionsTesting
Existing test suite is unaffected.
extend_ttlis a no-op in test environments unless ledger sequence is explicitly advanced past the TTL.