Skip to content

Add archival pruning entrypoint with sorted-by-resolution cursor to EventArchive #614

Description

@greatest0fallt1me

Description

event_archive.rs::EventArchive exposes prune_archive(env, admin, count) but the order of pruning is undefined. Make pruning deterministic by resolution timestamp ascending and expose a paginated cursor for very large archives.

Requirements and Context

  • Track resolution-timestamp index keyed by (timestamp, market_id)
  • Iterate ascending and stop after count
  • Return a PruneCursor clients can pass back for paging
  • 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 feat/event-archive-pruning-cursor
  2. Implement changes
    • contracts/predictify-hybrid/src/event_archive.rs
    • contracts/predictify-hybrid/src/lib.rs (prune_archive signature gains cursor)
  3. Test and commit
    • cargo test -p predictify-hybrid event_archive -- --nocapture
    • Cover edge cases: empty archive, single entry, count > archive size
    • Include test output and notes in the PR

Example commit message

feat: deterministic archive pruning with paginated PruneCursor

Acceptance Criteria

  • Order is by resolution timestamp ascending
  • Cursor roundtrip tested
  • Admin auth enforced via require_auth
  • No unwrap() in iteration

Guidelines

  • Use Soroban Map/Vec indexing; avoid format! keys
  • Minimum 95% coverage
  • Clear documentation and inline comments
  • Timeframe: 96 hours

Metadata

Metadata

Assignees

Labels

GRANTFOX OSSGrantFox open-source campaign taskMAYBE REWARDEDMay be rewarded under the GrantFox campaignOFFICIAL CAMPAIGNOfficial GrantFox campaign issueStellar WaveIssues in the Stellar wave programenhancementNew feature or improvementrustRust implementationsmart-contractSoroban smart-contract worksorobanSoroban SDK / Stellar

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions