Repository navigation
fix(aperture): accept a config object as the second getBlocks parameter - #1904
erkancamli wants to merge 1 commit into
Conversation
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.
|
Warning Review limit reachedYou'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. View limit details
Tip 🎯 Customize your risk assessments
✅ Automatic approvals, with your rules
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. |
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.