-
-
Notifications
You must be signed in to change notification settings - Fork 289
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
feat: pull block from peers after a cutoff if corresponding gossip blobs are seen #6534
Conversation
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## unstable #6534 +/- ##
============================================
- Coverage 61.53% 61.39% -0.14%
============================================
Files 556 556
Lines 58647 58751 +104
Branches 1847 1848 +1
============================================
- Hits 36087 36073 -14
- Misses 22520 22638 +118
Partials 40 40 |
Performance Report✔️ no performance regression detected 🚀🚀 Significant benchmark improvement detected
Full benchmark results
|
packages/beacon-node/src/chain/seenCache/seenGossipBlockInput.ts
Outdated
Show resolved
Hide resolved
resolveAvailability | ||
); | ||
|
||
resolveBlock(blockInput); |
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.
in this case there are not enough blobs showing up, why do we resolveBlock()
here? if it's needed in both if
and else
then let's put in common place
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.
so that the waiting handler for blob can resolve and emit event to pull blobs (and add its peer over there)
For code cleanliness its ok to be replicated as the return follows this statement
// however we can emit the event which will atleast add the peer to the list of peers to pull | ||
// data from | ||
if (normalBlockInput.type === BlockInputType.blobsPromise) { | ||
events.emit(NetworkEvent.unknownBlockInput, {blockInput: normalBlockInput, peer: peerIdStr}); |
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.
after block comes and there are not enough blobs, we already emit this event in handleValidBeaconBlock()
, then we also emit it here. Is this a duplicate?
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.
yes, this is a duplicate aimed to add this peer to the peers for unknown blobs pull
// resolve the block if thats unavailable | ||
let block, blobsCache, blockBytes, resolveAvailability; | ||
if (unavailableBlockInput.block === null) { | ||
const allBlocks = await network.sendBeaconBlocksByRoot(peerId, [fromHexString(unavailableBlockInput.blockRootHex)]); |
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.
now the block source lodestar_import_block_by_source_total
is very tricky, it could be wrong for now
for block, we want to know if it comes from gossip, or this function, or the above beaconBlocksMaybeBlobsByRoot()
function
same for blobs, we want to know % of them coming from 3 different places as above
if it's too much for this PR please have a follow up PR or track in another issue @g11tech
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.
yes lets do a followup on this
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.
looks good to me
🎉 This PR is included in v1.18.0 🎉 |
generally we now start block import as soon as we see a block and pull blobs if not all blobs seen.
However in edgecases, even block might arrive too late
This PR starts pulling the block (and remaining blobs) from peers if we don't see a block past a certain cutoff