alpamayo: fix get_blocks to respect end_slot boundary#99
Conversation
There was a problem hiding this comment.
Pull request overview
This PR fixes a bug in the get_blocks function where it wasn't respecting the end_slot boundary parameter, along with several refactoring improvements and a rustls crypto provider setup.
Changes:
- Fixed
get_blocksto checkblock.slot > end_slotto prevent returning blocks beyond the confirmed/finalized boundary - Refactored
tokio::select!branches to use guard conditions instead ofpending()futures - Replaced
.boxed_local()withBox::pin()for future boxing - Added rustls crypto provider initialization at startup
Reviewed changes
Copilot reviewed 5 out of 7 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| src/storage/blocks.rs | Adds end_slot boundary check and refactors dead block handling in get_blocks loop |
| src/storage/read.rs | Refactors tokio::select! to use guard conditions, removes pending import |
| src/storage/files.rs | Replaces .boxed_local() with Box::pin(), removes FutureExt import |
| src/bin/alpamayo.rs | Adds rustls crypto provider initialization |
| Cargo.toml | Adds rustls dependency, bumps version to 0.18.1 |
| Cargo.lock | Updates version and dependencies |
| CHANGELOG.md | Documents the fix in version 0.18.1 |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| if let RpcRequestBlocksUntil::Limit(limit) = until | ||
| && blocks.len() == limit | ||
| { | ||
| break; | ||
| } |
There was a problem hiding this comment.
The limit check only handles RpcRequestBlocksUntil::Limit but doesn't handle RpcRequestBlocksUntil::EndSlot. The old code checked for both cases - when until was EndSlot(end_slot) it would break when end_slot == block.slot. Without this check, the function will continue iterating past the requested end slot when until is EndSlot with a value less than the end_slot parameter. This could return more blocks than requested or loop unnecessarily.
No description provided.