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
- Fork the repo and create a branch
git checkout -b feat/event-archive-pruning-cursor
- Implement changes
contracts/predictify-hybrid/src/event_archive.rs
contracts/predictify-hybrid/src/lib.rs (prune_archive signature gains cursor)
- 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
Guidelines
- Use Soroban
Map/Vec indexing; avoid format! keys
- Minimum 95% coverage
- Clear documentation and inline comments
- Timeframe: 96 hours
Description
event_archive.rs::EventArchiveexposesprune_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
(timestamp, market_id)countPruneCursorclients can pass back for pagingSuggested Execution
contracts/predictify-hybrid/src/event_archive.rscontracts/predictify-hybrid/src/lib.rs(prune_archive signature gains cursor)cargo test -p predictify-hybrid event_archive -- --nocaptureExample commit message
Acceptance Criteria
require_authunwrap()in iterationGuidelines
Map/Vecindexing; avoidformat!keys