(Optional) Refactor espressoBatchLoadingLoop to match blockLoadingLoop#214
Open
Ayiga wants to merge 2 commits into
Open
(Optional) Refactor espressoBatchLoadingLoop to match blockLoadingLoop#214Ayiga wants to merge 2 commits into
espressoBatchLoadingLoop to match blockLoadingLoop#214Ayiga wants to merge 2 commits into
Conversation
It is possible for the returned `inclusiveBlockRange` to can return a `start` value that is greater than the `end` value. This can be addressed by adding an extra check to the return statement that causes it. This changes adds a check to ensure that it doesn't return a start value that actually follows the end value of the range.
It would be beneficial for the implementation of `espressoBatchLoadingLoop` to more closely match the `blockLoadingLoop` implementation so that any deviations in their implementation can be more easily identified. This change modifies the `espressoBatchLoadingLoop` method to more closely mirror the `blockLoadingLoop` implementation.
QuentinI
reviewed
Sep 10, 2025
| // State empty, just enqueue all unsafe blocks | ||
| if len(l.queuedBlocks) == 0 { | ||
| return inclusiveBlockRange{safeL2.Number + 1, newSyncStatus.UnsafeL2.Number}, ActionEnqueue | ||
| if newSyncStatus.UnsafeL2.Number <= safeL2.Number+1 { |
Collaborator
There was a problem hiding this comment.
Nit: can we make a firstUnsafeBlock := safeL2.Number + 1 or something like that? I feel like the next few lines would be easier to read then.
Collaborator
|
Can we close this PR @Ayiga ? |
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.
This PR:
Adds a check to fix a potential invariant where the
startvalue of aninclusiveBlockRangeis not guaranteed to precede theendvalue of the sameinclusiveBlockRange.Refactors the
espressoBatchLoadingLoopto more closely match theblockLoadingLoopso they can be more easily compared. Should be reviewed by @QuentinI for correctness, and opinion.