Open
Conversation
There was a problem hiding this comment.
Pull request overview
This PR fixes an off-by-one error in the runloop_monad function that caused zero blocks to be executed when nblocks=1. The fix initializes the internal finalized_block_num counter to start_block_num - 1 instead of starting it at start_block_num, ensuring the loop executes the correct number of iterations.
Changes:
- Renamed the function parameter from
finalized_block_numtoblock_numfor consistency with other runloop implementations - Introduced a local
finalized_block_numvariable initialized tostart_block_num - 1to fix the loop condition - Added an assertion to ensure
start_block_num > 0to prevent underflow - Set
block_num = finalized_block_num + 1at the end to maintain consistency with other runloops
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Baltoli
approved these changes
Jan 15, 2026
0c30ed1 to
e8e57bf
Compare
95a3cf7 to
45cb631
Compare
b966bb4 to
8df65e8
Compare
8df65e8 to
eabf392
Compare
eabf392 to
3ee7698
Compare
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Fixes off by one in monad runloop.
Before with nblocks=1 does not run any blocks
Before with nblocks=2 runs two blocks correctly
After with nblocks=1 now correctly runs one block
After with nblocks=2 still runs two blocks correctly