Feat/281 query paginated user participation history - #321
Merged
josephchimebuka merged 4 commits intoAug 8, 2026
Merged
Conversation
- Add DataKey::UserArchivedRoundIds(Address) to track per-user archived round participation - Modify _archive_round to accept participant list and write per-user round ID indices - Add get_user_archive_history(env, user, offset, limit) query with pagination - Add comprehensive tests: resolve, cancel, fallback, precision mode, pagination ordering, offset/limit, bounds, multi-user isolation, empty history - Update TypeScript bindings with get_user_archive_history method - Fix root Cargo.toml (remove invalid dev-dependencies from virtual manifest, pin SDK)
…ted-user-participation-history # Conflicts resolved: # Cargo.toml - kept SDK pin =23.0.1 + workspace deps # contracts/src/contract.rs - kept delegation pattern for # get_updown_positions_page to queries.rs; kept my # get_user_archive_history as delegation to queries.rs # contracts/src/types.rs - accepted incoming refactored DataKey # with additional variants; added UserArchivedRoundIds(Address) # # Additional changes to make feature work with refactored modules: # contracts/src/queries.rs - added get_user_archive_history fn # contracts/src/settlement.rs - changed _archive_round signature # from participant_count: u32 to participants: &[Address] and # added UserArchivedRoundIds recording inside
Contributor
Author
3 tasks
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.
Summary
Closes #281
Implements paginated archived participation history for user profiles (Issue #281). Users can now query which archived rounds they participated in, with standard offset/limit pagination.
Changes
New on-chain storage
DataKey::UserArchivedRoundIds(Address)→Vec<u64>— per-user index of archived round IDs they participated inModified internal function
_archive_round— now accepts the full&Vec<Address>participant list instead of just a count, and writes each participant's round ID to theirUserArchivedRoundIdsindexNew public query
get_user_archive_history(env, user, offset, limit)→Vec<ArchivedRoundSummary>ArchivedRoundSummaryoffsetpast the end → empty pagelimit == 0→ empty pagelimitcapped atMAX_PAGE_SIZE(100)Tests (
archive_participation.rs)test_archived_participation_after_resolvetest_archived_participation_after_canceltest_archived_participation_after_fallback_refundtest_archived_participation_no_historytest_archived_participation_non_participant_after_roundtest_archived_participation_newest_firsttest_archived_participation_page_respects_offset_and_limittest_archived_participation_full_page_matches_alltest_archived_participation_offset_past_end_is_emptytest_archived_participation_zero_limit_is_emptytest_archived_participation_limit_is_cappedtest_archived_participation_multi_user_isolationtest_archived_participation_precision_modeTypeScript bindings
get_user_archive_historymethod toClientinterface andfromJSONmarshalling mapBuild fixes
[dev-dependencies]section from root virtual manifestCargo.tomlsoroban-sdkto exact=23.0.1to prevent accidental upgrades to breaking SDK versionsRetention alignment
The
UserArchivedRoundIdsindex is written alongside theArchivedRoundSummaryduring_archive_round. When FIFO pruning evicts old archived rounds, stale entries in the per-user index are silently filtered at query time (the query checksArchivedRoundexistence and skipsNoneentries). This avoids expensive reverse-pruning of user indices while maintaining correctness.Notes
bindings/src/index.tsshould be regenerated once the contract compiles cleanly: runsoroban contract bindings typescriptagainst the compiled WASM#[contracterror]variant limit (53 > 50) andsymbol_short!length limit (≥10 chars) are addressed in a separate fix ticket as they affect the entire codebase