Heavy query pagination pattern#305
Merged
hman38705 merged 2 commits intoMar 27, 2026
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #468
Edited lib.rs
Viewed Makefile:1-163
Ran command:
make test-unitRan command:
cargo test --lib --features testutilsRan command:
cargo test query_tests --features testutilsRan command:
rustc --versionRan command:
rustup default stableEdited PR_QUERY_PAGINATION.md
Viewed bets_test.rs:1-474
I have successfully implemented the heavy query pagination pattern in the PredictIQ smart contracts. This implementation addresses potential resource limit issues (gas and memory) on Stellar Soroban by introducing offset/limit pagination and a lightweight archiving system for pruned data.
🚀 Key Improvements
1. Pagination Pattern (Offset/Limit)
I've implemented a consistent pagination pattern for all bulk data retrieval.
2. Event Archive (event_archive.rs)
To optimize storage, PredictIQ prunes resolved markets after a grace period. I've added an
event_archivemodule that acts as a tombstone registry.3. Documentation & Developer Experience
🛡️ Security & Reliability
✅ Test Coverage
Added a new test suite in query_tests.rs covering:
📁 Modified Files
queries.rs: Core pagination logic.event_archive.rs: Tombstone tracking for pruned markets.lib.rs: Public API exposure and test registration.markets.rs: Integration with the pruning lifecycle.QUERY_IMPLEMENTATION_GUIDE.md: Integration documentation.PR_QUERY_PAGINATION.md: Full PR overview and security notes.The changes are now ready for audit and merge into the
feature/query-paginationbranch.