You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(aperture): accept a config object as the second getBlocks parameter - #1904
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:
@solana/web3.jsconnection.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.
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.
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: 4
Check name
Status
Explanation
Title check
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
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
Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check
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.
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.
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.
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.
@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.
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
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.
What changed
getBlocksonly accepted an end slot as its second parameter. Agave reads that parameter asRpcBlocksConfigWrapper, 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.jsconnection.getBlocks(start)on aConnectioncreated with a commitment sends[start, {"commitment": "confirmed"}].Aperture answered both with
-32602invalid params. The handler now parses the parameter asRpcBlocksConfigWrapperand 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
get_blocks_accepts_a_config_in_place_of_the_end_slotinaperture/tests/blocks.rscovers both forms. It fails onmasterand passes with this change.tests/blocks.rspasses, andcargo fmt --checkandcargo clippy -p magicblock-aperture --tests -- -D warningsare clean.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.