Skip to content

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

Open
erkancamli wants to merge 1 commit into
magicblock-labs:masterfrom
erkancamli:fix/aperture-get-blocks-config
Open

erkancamli wants to merge 1 commit into
magicblock-labs:masterfrom
erkancamli:fix/aperture-get-blocks-config

Conversation

@erkancamli

Copy link
Copy Markdown

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.

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.
@coderabbitai

coderabbitai Bot commented Nov 7, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 59 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 377a086 and a80b82b.

Files selected for processing: 2

  • aperture/src/requests/http/get_blocks.rs
  • aperture/tests/blocks.rs
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Tip

🎯 Customize your risk assessments

Guide how CodeRabbit assesses merge risk and security architecture risk. Highlight sensitive changes and explain your security boundaries using Merge Risk Instructions and Security Risk Instructions in your review settings. Security architecture risk assessments require the Advanced plan or above.

✅ Automatic approvals, with your rules

Let CodeRabbit approve pull requests once required threads are resolved, pre-merge checks pass, and your risk limits are met. Enable Automatic approvals in review settings, with overrides for teams or file paths.

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

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.

1 participant