Skip to content

Bound recovery.rs RecoveryStorage history growth and add prune entrypoint #556

@greatest0fallt1me

Description

@greatest0fallt1me

Description

RecoveryStorage in recovery.rs persists MarketRecovery records for emergency procedures, but unbounded recovery history grows persistent storage and rent cost over time. Add an upper bound on retained recovery records per market plus an admin prune entrypoint, mirroring the existing event-archive pruning.

Requirements and Context

  • Cap retained recovery records in contracts/predictify-hybrid/src/recovery.rs.
  • Add an admin-gated prune function (with require_auth) and expose it via lib.rs.
  • Ensure pruning never removes the active recovery state of an unresolved market.
  • Must be secure, tested, and documented
  • Should be efficient and easy to review

Suggested Execution

  1. Fork the repo and create a branch
    git checkout -b feature/recovery-history-bounds
  2. Implement changes
    • contracts/predictify-hybrid/src/recovery.rs, contracts/predictify-hybrid/src/lib.rs
  3. Test and commit
    • cargo test -p predictify-hybrid -- recovery
    • Cover edge cases: prune with active recovery present, prune count > stored
    • Include test output and notes in the PR

Example commit message

feat: bound recovery history and add admin prune

Acceptance Criteria

  • Recovery history is capped per market
  • Admin prune requires auth and preserves active recovery state
  • Storage growth is bounded under repeated recovery events

Guidelines

  • Minimum 95% coverage on touched code, validate auth and storage growth bounds
  • Clear documentation and inline comments
  • Timeframe: 96 hours

Metadata

Metadata

Assignees

Labels

Stellar WaveIssues in the Stellar wave programenhancementNew feature or improvementsmart-contractSoroban smart-contract worksorobanSoroban SDK / Stellar
No fields configured for Feature.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions