Merged
Conversation
Both `GET /eth/context/latest` and `GET /eth/context/blocknumber/:number` rely on fetching a remote block to pull the timestamp, blocknumber and blockhash from. If the fetched block is not found, then properties on `null` will be attempted to be accessed which will result in a runtime error. This commit adds handling for this case to prevent that kind of bug.
🦋 Changeset detectedLatest commit: 8f72064 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
| const blockNumber = Math.max(0, tip - this.options.confirmations) | ||
|
|
||
| const block = await this.state.l1RpcProvider.getBlock(blockNumber) | ||
| if (block === null) { |
Contributor
There was a problem hiding this comment.
Since this results in an error either way, I think it's good to be explicit
smartcontracts
approved these changes
Feb 4, 2022
Codecov Report
@@ Coverage Diff @@
## develop #2141 +/- ##
========================================
Coverage 72.96% 72.96%
========================================
Files 85 85
Lines 2918 2918
Branches 496 496
========================================
Hits 2129 2129
Misses 789 789
Flags with carried forward coverage won't be shown. Click here to find out more. Continue to review full report at Codecov.
|
theochap
added a commit
that referenced
this pull request
Dec 10, 2025
## Description This PR fixes some of the outstanding todos in kona's codebase. In particular: - Promotes the dial period to CLI argument for p2p. Also does a small refactor to the way the connection gater is configured - Open an issue to phase out the `sync-req-resp` optimism protocol #2141. Removed the todo to promote the configuration to CLI since the node would not sync properly if the flag is not set, and this protocol will eventually get phased out. Progress towards #2119
theochap
added a commit
that referenced
this pull request
Jan 14, 2026
## Description This PR fixes some of the outstanding todos in kona's codebase. In particular: - Promotes the dial period to CLI argument for p2p. Also does a small refactor to the way the connection gater is configured - Open an issue to phase out the `sync-req-resp` optimism protocol #2141. Removed the todo to promote the configuration to CLI since the node would not sync properly if the flag is not set, and this protocol will eventually get phased out. Progress towards #2119
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.
Description
Both
GET /eth/context/latestandGET /eth/context/blocknumber/:numberrely on fetching a remote block to pull the timestamp, blocknumber and
blockhash from. If the fetched block is not found, then properties on
nullwill be attempted to be accessed which will result in a runtimeerror. This commit adds handling for this case to prevent that kind of
bug.