2518 - Generic Pagination Engine with Cursor Pagination Policy + Importer Cursor Pagination - #2626
2518 - Generic Pagination Engine with Cursor Pagination Policy + Importer Cursor Pagination#2626gventino-cw wants to merge 17 commits into
Conversation
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
PR Code Suggestions ✨Explore these optional code suggestions:
|
There was a problem hiding this comment.
Summary
Great change set. The pagination design is cohesive across server slicing (ImporterPagination), client reassembly (PaginatedPageFetcher + reducers), and domain validation (ExternalBlock transaction merge helpers). I reviewed for correctness/safety around partial data assembly, cursor integrity, and mismatch detection; the implementation has strong defensive checks (stable total, block identity/hash checks, duplicate state-change guards, and not-found-after-partial failure behavior).
Test coverage is substantial and targeted at failure modes that matter for importer safety (cursor parsing, bounds handling, multi-section slicing, mismatch/error paths, and reducer finalization). I did not find any concrete blocking issues in the provided diff/context.
There was a problem hiding this comment.
Summary
Solid implementation of cursor pagination across server and importer sides, with strong defensive checks for consistency (stable totals, block identity/hash continuity, duplicate change detection, and partial-not-found failure). The generic paginator/fetcher abstractions are coherent, and test coverage is meaningful across happy paths and important failure modes.
I did not find any concrete blocking issues in the provided diff/context.
ok, will do it |
|
Also would be good to understand the behavior if say, a follower is deployed with this new feature, but leader does not have it yet. Is that follower prepared to deal with that? |
There was a problem hiding this comment.
Summary
Nice progress on introducing generic cursor pagination and importer-side reassembly; the reducer validation and tests are generally strong. I found one blocking deployment-safety issue related to mixed-version leader/follower compatibility.
Blocking
- The importer client now always calls
stratus_getBlockAndReceipts/stratus_getBlockWithChangeswith a second pagination param and expects paginated response shapes. If follower is upgraded before leader (raised in PR discussion), older leaders that only support legacy signatures/tuple responses can fail decode or reject params, causing importer sync interruption during rollout.
Please add backward compatibility in the client fetch path (e.g., fallback to legacy one-param call and legacy response decode when paginated call fails with method/params/shape mismatch), or gate pagination usage behind a config/feature flag for staged deploys.
Other than that, coverage and invariants look good.
currently old follower -> new leader works fine. But old leader <- new follower it will not work, because the follower at this version always send the request expecting a paginated response. |
There was a problem hiding this comment.
Summary
Solid implementation overall: pagination reducers, cursor decoding, reassembly invariants, and test coverage are strong. However, there is one blocking deploy-safety issue still present in the importer client path.
Blocking
The follower importer now always sends the paginated 2-param RPC form and expects paginated/object-compatible responses, but there is no request-level fallback when talking to an older leader that only supports legacy signatures/response shapes. In a mixed-version rollout (new follower -> old leader), this can fail RPC decode/params validation and interrupt syncing.
fixed it |
|
Benchmark: Git Info:
Leader Stats: Follower Stats: Plots: |
There was a problem hiding this comment.
Summary
Great work — this PR introduces a cohesive pagination model across server and importer client with strong compatibility handling and meaningful guardrails.
What I verified in the provided diff/context:
- Server now supports optional cursor pagination for both
stratus_getBlockAndReceiptsandstratus_getBlockWithChanges, while preserving legacy one-shot shapes when pagination is not needed. - Importer client fetch path now supports both paginated and legacy response forms (
BlockWithChangesPageResponsecustom deserializer + optionalpagination), addressing mixed-version rollout risk. - Reducers include solid consistency checks (stable total, cursor monotonicity, block identity/hash continuity, duplicate change detection, tx/receipt count matching, partial-not-found fail-fast).
- Test coverage is substantial and includes e2e round-trips plus targeted unit tests for cursor decoding, clamping, section slicing, byte-budget behavior, backward compatibility, and reducer invariants.
I did not find any concrete blocking issues in the shown changes.
|
Benchmark: Git Info:
Leader Stats: Follower Stats: Plots: |
|
Benchmark: Git Info:
Leader Stats: Follower Stats: Plots: |
PR Type
Enhancement
Description
Introduce generic cursor-based pagination engine
Delegate block fetches to ImporterPaginationClient
Add server-side pagination in RPC handlers
Extend ExternalBlock for merging paginated transactions
Diagram Walkthrough
File Walkthrough
1 files
Wrap FakeLeader arm in braces for consistency6 files
Delegate fetching to ImporterPaginationClientAdd ImporterPaginationClient pagination logicImplement pagination in RPC handlersDefine ImporterPagination request/response typesIntroduce generic pagination engine and policiesAdd methods for transaction merging and count2 files
Expose importer_pagination in moduleRe-export pagination types in types module