Skip to content

refactor(slots_v1): switch slot endpoint pagination from start_slot to page number#566

Merged
barnabasbusa merged 10 commits intomasterfrom
bbusa/orphaned-pages
Feb 10, 2026
Merged

refactor(slots_v1): switch slot endpoint pagination from start_slot to page number#566
barnabasbusa merged 10 commits intomasterfrom
bbusa/orphaned-pages

Conversation

@barnabasbusa
Copy link
Copy Markdown
Collaborator

The pagination logic for the /api/v1/slots endpoint changes from using start_slot to explicitly using a page query parameter.

This change improves the clarity and usability of the API by:

  1. Replacing start_slot with page (0-indexed).
  2. Updating the response structure to include page and next_page instead of next_slot.
  3. Removing complex, slot-based calculation for determining the page index.

This aligns the slot endpoint with standard page-based pagination patterns used elsewhere.

…o page number

The pagination logic for the `/api/v1/slots` endpoint changes from using `start_slot` to explicitly using a `page` query parameter.

This change improves the clarity and usability of the API by:
1. Replacing `start_slot` with `page` (0-indexed).
2. Updating the response structure to include `page` and `next_page` instead of `next_slot`.
3. Removing complex, slot-based calculation for determining the page index.

This aligns the slot endpoint with standard page-based pagination patterns used elsewhere.
@barnabasbusa barnabasbusa requested a review from pk910 February 9, 2026 09:50
barnabasbusa and others added 6 commits February 10, 2026 15:12
… in slots V1 endpoint

Add support for filtering slots up to a maximum slot number (`max_slot`) in the slots V1 API.

This change introduces:
1. Adding `max_slot` to `APISlotsData` struct.
2. Documenting `max_slot` in the OpenAPI specification.
3. Parsing `max_slot` from query parameters and applying it as a filter (`blockFilter.MaxSlot`).
4. Calculating `NextSlot` when results are paginated beyond the limit, using the slot number of the first block on the next page (or the first block excluded from the current page if it exceeds the limit).

This provides a more robust cursor for pagination when dealing with slot numbers, especially when combined with `max_slot` filtering.
…ovided in filter

The `cacheStartSlot` was being initialized to `*filter.MaxSlot + 1`, which caused the query to potentially skip the block at `MaxSlot` when retrieving blocks from the cache.

By changing it to `*filter.MaxSlot`, the query now correctly includes the block corresponding to the maximum slot specified in the filter.
The maximum number of results allowed in a single API response for slots is increased from 100 to 1000. This change allows users to fetch more slots in a single request, reducing the need for excessive pagination when a larger dataset is expected.
…slots

Adds the `min_slot` query parameter to the `/api/v1/slots` endpoint. This allows consumers to specify the minimum slot number (inclusive) they wish to retrieve, improving filtering capabilities for slot data. Documentation is also updated to reflect this new parameter.
This change introduces a step in the shared CI workflow that automatically checks if the generated API documentation files in the `docs/` directory are up-to-date.

It runs `make api-docs` and then uses `git status` to ensure no documentation files have been modified locally but not committed. If the docs are stale, the check fails and outputs the specific changes, forcing contributors to generate and commit updated documentation. This ensures documentation always reflects the current state of the API.
@barnabasbusa barnabasbusa merged commit 2bc1416 into master Feb 10, 2026
3 of 4 checks passed
@barnabasbusa barnabasbusa deleted the bbusa/orphaned-pages branch February 10, 2026 15:38
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