feat(tests): add storage TTL verification tests (#480)#602
Merged
Vera3289 merged 2 commits intoJun 27, 2026
Conversation
- Add test_ttl.rs with 7 tests covering persistent, instance, and temporary storage TTL behaviour in the governance contract - Tests verify initial TTL values match min_persistent/temp_entry_ttl - Tests confirm proposal and HasVoted entries survive ledger advancement - Tests confirm temporary allowance entry expires after TTL elapses - Tests confirm proposal data is accessible through full voting lifecycle - Wire test_ttl module into lib.rs - Add ADR-006 documenting storage TTL patterns across both contracts - Update ADR index and README
|
@Philzwrist07 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
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 #480 Adds storage TTL verification tests for the governance and token contracts, confirming that
entries expire or persist according to Soroban TTL expectations across the proposal lifecycle.
Changes
contracts/governance/src/test_ttl.rs (new)
7 tests covering all three Soroban storage tiers:
┌───────────────────────────┬──────────────────┐
│ Test │ What it verifies │
├───────────────────────────┼───────────────────────────────────────────────────────┤
│ test_proposal_initial_ttl │ Proposal entry starts at │
│ │ min_persistent_entry_ttl - 1 │
├─────────────────────────────────────────────┼─────────────────────────────────────────────┤
│ test_proposal_persists_after_ledger_advance │ Proposal entry survives partial TTL │
│ │ consumption │
├─────────────────────────────────────────────┼─────────────────────────────────────────────┤
│ test_has_voted_initial_ttl │ HasVoted entry gets the correct initial │
│ │ persistent TTL │
├─────────────────────────────────────────────┼─────────────────────────────────────────────┤
│ test_instance_initial_ttl │ Instance storage (Admin, VotingToken, │
│ │ ProposalCount) starts at correct TTL │
├─────────────────────────────────────────────┼─────────────────────────────────────────────┤
│ test_instance_persists_after_ledger_advance │ Instance storage remains accessible after │
│ │ ledger advancement │
├─────────────────────────────────────────────┼─────────────────────────────────────────────┤
│ test_temporary_allowance_expires │ Token allowance (temporary storage) reads 0 │
│ │ TTL elapses │
├───────────────────────────────────┼──────────────────────────────────────────────────────┤
│ test_proposal_accessible_thr │ Proposal persistent entry survives Active → Passed → │
│ ough_full_lifecycle │ Executed │
└───────────────────────────────────┴──────────────────────────────────────────────────────┘
Each test sets explicit min_persistent_entry_ttl / min_temp_entry_ttl values so assertions are
deterministic and independent of network defaults.
docs/adr/ADR-006-storage-ttl-patterns.md (new)
Documents the storage tier assignment for every entry in both contracts, expected TTL behaviour
per tier, and guidance for operators on extending TTLs in production.
contracts/governance/src/lib.rs — wires in mod test_ttl under #[cfg(test)]
docs/adr/README.md / README.md — ADR-006 added to index tables
Testing
Tests use env.ledger().with_mut(|l| l.sequence_number += N) to simulate ledger advancement and
env.as_contract(...) + get_ttl (Soroban SDK v21+) to assert TTL values directly.