-
-
Notifications
You must be signed in to change notification settings - Fork 291
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: support eth_getBlockByNumber #6442
Conversation
34374ac
to
314d60e
Compare
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## unstable #6442 +/- ##
============================================
- Coverage 61.70% 61.64% -0.07%
============================================
Files 553 553
Lines 57858 57874 +16
Branches 1829 1830 +1
============================================
- Hits 35702 35677 -25
- Misses 22119 22160 +41
Partials 37 37 |
Performance Report✔️ no performance regression detected Full benchmark results
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As this PR is addressing a user facing bug, let's extract the refactoring to a separate PR.
- Changes of
Record
toMap
, have no objection just keep in separate PR. - Would be nice to add an E2E test for the fianlized block root, it will be easy to test in the current e2e test setup.
@@ -6,14 +6,21 @@ import {Logger} from "@lodestar/utils"; | |||
import {MAX_PAYLOAD_HISTORY} from "../constants.js"; | |||
import {hexToBuffer} from "./conversion.js"; | |||
|
|||
export async function fetchBlock(api: Api, slot: number): Promise<capella.SignedBeaconBlock | undefined> { | |||
const res = await api.beacon.getBlockV2(slot); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
are we fine with throwing here if there is a network error?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If an error is thrown here then a light-client header is not processed (that error will be logged).
I think that it's ok in the context of this PR as it doesn't change this behavior. If required a proper solution could be implemented separately.
🎉 This PR is included in v1.18.0 🎉 |
Motivation
Make sure the web3 provider
prover
wrapper correctly handleseth_getBlockByNumber
Description
During verification, wrapped calls to
eth_getBlockByNumber
try to access EL blocks using block numbers, which is incorrect. Issue is fixed by keeping track of slots numbers when new light-client header are received.Note that when trying to access older blocks it might get slow, as current implementation tries to find matching EL blocks by querying CL slots one by one starting from freshly finalized slots.
Closes #6032