Skip to content

feat(round): implement paginated bidder reads end-to-end - #12

Merged
karagozemin merged 1 commit into
Sub-Rosa-Issue:mainfrom
NnamdiCyber:feat/paginated-bidder-reads
Jun 23, 2026
Merged

feat(round): implement paginated bidder reads end-to-end#12
karagozemin merged 1 commit into
Sub-Rosa-Issue:mainfrom
NnamdiCyber:feat/paginated-bidder-reads

Conversation

@NnamdiCyber

Copy link
Copy Markdown
Contributor

Problem

The existing get_bidders view returns the entire bidder index as one array. For rounds with hundreds or thousands of bidders, this forces the keeper to load all addresses into memory at once and risks hitting Soroban RPC response size limits.

Solution

Add get_bidders_page — a zero-based cursor/limit paginated view — across all layers, keeping the original get_bidders fully intact for backward compatibility.

Contract (contracts/round/)

BiddersPage {
  data:        Vec<Address>,   // page of bidder addresses
  next_cursor: u32,            // 0 = no more pages
  total:       u32,            // total bidders in the round
}
- MAX_PAGE_SIZE = 100, InvalidLimit = 39 error code
- cursor is zero-based; next_cursor = 0 signals end-of-list (avoids Soroban XDR Option<u32> complexity)
- 12 new pagination tests (empty, partial, exact, final, multi-page, invalid limits, cursor at/beyond total, order preservation)
- Existing get_bidders unchanged and fully compatible
Bindings (@sub-rosa/round-bindings)
- BiddersPage TypeScript interface
- get_bidders_page method on Client
- Hand-crafted XDR spec entries for struct and function
- InvalidLimit error code mapping
SDK (@sub-rosa/sdk)
- getBiddersPage(roundId, cursor, limit) — fetch one page
- async *bidders(roundId) — lazy async generator that pages through all bidders
- 3 encoding tests verifying get_bidders_page argument encoding
Keeper
- keepRound uses sdk.bidders() async generator instead of bulk sdk.getBidders()
- Same per-bidder reveal logic, addresses are now fetched page-by-page
Backward Compatibility
All existing callers using get_bidders continue to work without changes. The old function remains exported and functionally identical.

Closes #7

Adds BiddersPage struct, get_bidders_page contract function (cursor+limit),
TypeScript bindings, SDK pagination support (getBiddersPage + async generator),
and keeper migration from bulk getBidders to paginated iteration.

Closes Sub-Rosa-Issue#7
@drips-wave

drips-wave Bot commented Jun 23, 2026

Copy link
Copy Markdown

@NnamdiCyber Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@karagozemin
karagozemin merged commit 16479e3 into Sub-Rosa-Issue:main Jun 23, 2026
VeronicDev pushed a commit to VeronicDev/sub-rosa-drips that referenced this pull request Jul 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants