Skip to content

fix(aperture): accept a config object as the second getBlocks parameter - #1904

Merged
bmuddha merged 2 commits into
magicblock-labs:masterfrom
erkancamli:fix/aperture-get-blocks-config
Nov 13, 2026
Merged

bmuddha merged 2 commits into
magicblock-labs:masterfrom
erkancamli:fix/aperture-get-blocks-config

Conversation

@erkancamli

Copy link
Copy Markdown
Contributor

What changed

getBlocks only accepted an end slot as its second parameter. Agave reads that parameter as RpcBlocksConfigWrapper, so it can be either an end slot or a context config. Clients send the config form whenever they have no end slot:

  • RpcClient::get_blocks_with_commitment(start, None, commitment) sends [start, {"commitment": ..}].
  • @solana/web3.js connection.getBlocks(start) on a Connection created with a commitment sends [start, {"commitment": "confirmed"}].

Aperture answered both with -32602 invalid params. The handler now parses the parameter as RpcBlocksConfigWrapper and keeps the existing end-slot handling.

Impact

getBlocks(start) works from Rust and web3.js clients that set a commitment. The end-slot form is unchanged.

Reviewer notes

  • New test get_blocks_accepts_a_config_in_place_of_the_end_slot in aperture/tests/blocks.rs covers both forms. It fails on master and passes with this change. tests/blocks.rs passes, and cargo fmt --check and cargo clippy -p magicblock-aperture --tests -- -D warnings are clean.
  • fix(rpc): return an empty list from getBlocks past the tip #1879 edits the same lines of get_blocks.rs (empty list past the tip). The two changes do not overlap in behaviour, but whichever lands second needs a small rebase; I'm happy to do it.

@coderabbitai

coderabbitai Bot commented Nov 7, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

Important

Review skipped

Review was skipped as selected files did not have any reviewable changes.

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 5722b4d and c072024.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review

No actionable comments were generated in the recent review.

Walkthrough

The HTTP block range parser now reads the optional end slot from an RPC blocks configuration wrapper. A test checks that omitting the end slot returns slots from the start through the latest slot, inclusive.

Changes: Block range parsing

Layer / File(s) Summary
Parse optional end slot
aperture/src/requests/http/get_blocks.rs, aperture/tests/blocks.rs
The parser extracts the end slot from the optional configuration wrapper. It defaults to the latest slot and retains the existing caps. The test checks the inclusive range when no end slot is provided.

Estimated code review effort: 2 (Simple) | ~8 minutes

Change: Bug fix

Suggested labels: bug, rust

Suggested reviewers: bmuddha, ravan002

Merge Risk: Minimal · previous review 5722b

This change lets clients that send a config object in place of the end slot call getBlocks successfully, and the end-slot form is unchanged. No merge-blocking risk remains.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the main change: getBlocks now accepts a config object as its second parameter. It is specific and follows the fix(aperture) convention. The changeset parses the second parameter as Rp…
Description check Passed The description states the problem, the cause, the code change, the affected clients, and the new test. It matches the changeset in aperture/src/requests/http/get_blocks.rs and aperture/tests/blocks.r…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title names the main change: getBlocks now accepts a config object as its second parameter. It is specific and follows the fix(aperture) convention. The changeset parses the second parameter as RpcBlocksConfigWrapper, which matches the title.

Full details: Description check

Explanation

The description states the problem, the cause, the code change, the affected clients, and the new test. It matches the changeset in aperture/src/requests/http/get_blocks.rs and aperture/tests/blocks.rs. It also notes a possible rebase conflict with PR #1879.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 35ea591 and 5722b4d.

Files selected for processing: 2

  • aperture/src/requests/http/get_blocks.rs
  • aperture/tests/blocks.rs

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

@bmuddha bmuddha left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The parser change makes sense. Please fold the test into the existing block RPC fixture and rebase on master.

Comment thread aperture/tests/blocks.rs Resolved
@erkancamli
erkancamli force-pushed the fix/aperture-get-blocks-config branch from a80b82b to 9638d70 Compare November 10, 2026 17:15
@erkancamli

Copy link
Copy Markdown
Contributor Author

Rebased on master and squashed into one commit. The parser change is the same, and start > end keeps the empty list from #1879 with no error branch. The config form assertion now sits in block_rpc_methods right after the numeric end slot one, and the separate test is removed.

The unit tests, tests/blocks.rs, tests/transactions.rs, cargo fmt --check and clippy with -D warnings pass locally, and the new assertion fails once the source change is reverted.

@erkancamli
erkancamli requested a review from bmuddha November 12, 2026 17:35
Agave reads the second getBlocks parameter as RpcBlocksConfigWrapper:
an end slot or a context config. RpcClient::get_blocks_with_commitment
without an end slot, and @solana/web3.js getBlocks(start) on a
Connection created with a commitment, both send [start, {commitment}],
which aperture rejected as invalid params.

Parse the parameter as RpcBlocksConfigWrapper.
@erkancamli
erkancamli force-pushed the fix/aperture-get-blocks-config branch from 5722b4d to 2bbfe8c Compare November 12, 2026 17:39
@erkancamli

Copy link
Copy Markdown
Contributor Author

@bmuddha both review points are in: the config form assertion is in block_rpc_methods, and after the rebase start > end keeps the empty list from #1879. The branch is one commit on current master (35ea591). Could you take another look when you have a moment? The CI runs for this fork are waiting for approval.

@bmuddha
bmuddha merged commit 96ecf26 into magicblock-labs:master Nov 13, 2026
8 checks passed
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