Skip to content

Implement Soroban Persistent Storage TTL Renewal and Expiry Tests #568

Description

@grantfox-oss

Package: packages/contracts

Complexity: High

Problem

Soroban persistent and instance storage entries have ledger time-to-live behavior. Long-lived market, stake, entitlement, admin, and configuration records can become unavailable if contracts do not apply a deliberate renewal policy. The repository has many contract crates, but no shared, tested TTL policy is documented for critical state.

Goal

Define and implement a consistent TTL renewal policy for critical BACKit contract state, with tests proving active and claimable records remain available for their required lifecycle.

Acceptance criteria

  • Inventory instance, persistent, and temporary storage across the core call_registry, outcome_manager, prediction_market, and prediction_market_futures crates.
  • Classify records by required retention window, including active markets, unresolved outcomes, unclaimed payouts/refunds, configuration, and terminal historical data.
  • Add shared TTL thresholds and extension values with documented ledger/time assumptions; avoid unexplained magic numbers.
  • Renew TTL on appropriate read/write lifecycle operations without allowing arbitrary callers to create unbounded storage growth.
  • Ensure claimable payout/refund state remains live through its documented claim window.
  • Define the behavior for already-expired or archived non-critical history instead of silently recreating incorrect state.
  • Emit no misleading business event solely because TTL was renewed.
  • Tests advance ledger sequence near and beyond thresholds and cover renewal, non-renewal, terminal state, and claim-window boundaries.
  • Tests demonstrate one user's activity cannot indefinitely renew unrelated users' records.
  • Document estimated rent/resource implications and the rationale for each retention class.
  • Keep public contract behavior backward-compatible unless an unavoidable change is separately documented for maintainer approval.
  • No frontend or backend changes are included.

Technical pointers

  • packages/contracts/shared
  • packages/contracts/call_registry/src/storage.rs
  • packages/contracts/outcome_manager/src/storage.rs
  • packages/contracts/prediction_market/src/storage.rs
  • packages/contracts/prediction_market_futures/src/lib.rs

Out of scope

  • An off-chain archival/indexing service
  • Contract deployment or migration execution
  • TTL work for every experimental contract crate

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

GrantFox OSSIssue tracked in GrantFox OSSMaybe RewardedIssue may be eligible for a GrantFox rewardThird CampaignCampaign: Third CampaignenhancementNew feature or request

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions