Skip to content

State Footprint & TTL Management (Persistent Storage) #12

@hman38705

Description

@hman38705

Descriptions:

🔒 Security & Maintenance

Issue #6:

Developer Goal: Manage the "Time to Live" (TTL) for market data to prevent data loss due to Soroban's state expiration.

Files to Modify:

  • contracts/predict-iq/src/modules/markets.rs
  • contracts/predict-iq/src/modules/bets.rs

Detailed Logic:

  1. State Types: Distinguish between Instance (contract config/counters) and Persistent (large market data).
  2. Bumping Strategy:
    • Every bet placed must call e.storage().persistent().bump_ttl(&DataKey::Market(id), LOW_THRESHOLD, HIGH_THRESHOLD).
    • LOW_THRESHOLD: ~1 day (ledger depth).
    • HIGH_THRESHOLD: ~30 days (ledger depth).
  3. Archiving: Implement a prune_market(id) function that can only be called 30 days after a market is Resolved and all prizes are claimed.

Verification Checklist:

  • Use soroban-cli to inspect the TTL of a market entry after multiple bets. Verify it stays above the minimum threshold.
  • [ ] git checkout -b features/issue-1-advanced-payout-rewards
  • Pr Request create your pr against develop branch[ ] git checkout -b features/issue-6-State Footprint & TTL Management (Persistent Storage)
  • Pr Request create your pr against develop branch

Metadata

Metadata

Assignees

Labels

Stellar WaveIssues in the Stellar wave program

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions