Skip to content

Commit

Permalink
further wait till cutoff for all data to be available
Browse files Browse the repository at this point in the history
  • Loading branch information
g11tech committed Sep 11, 2024
1 parent 8c21168 commit d35873e
Showing 1 changed file with 38 additions and 12 deletions.
50 changes: 38 additions & 12 deletions packages/beacon-node/src/network/processor/gossipHandlers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -478,7 +478,6 @@ function getDefaultHandlers(modules: ValidatorFnsModules, options: GossipHandler
});

if (normalBlockInput !== null) {
chain.logger.debug("Block corresponding to blob is now available for processing", {blobSlot, index});
// we can directly send it for processing but block gossip handler will queue it up anyway
// if we see any issues later, we can send it to handleValidBeaconBlock
//
Expand All @@ -487,10 +486,29 @@ function getDefaultHandlers(modules: ValidatorFnsModules, options: GossipHandler
// 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.dataPromise) {
events.emit(NetworkEvent.unknownBlockInput, {blockInput: normalBlockInput, peer: peerIdStr});
chain.logger.debug("Block corresponding to blob is now available but waiting for data availability", {
blobSlot,
index,
});
await raceWithCutoff(
chain,
blobSlot,
normalBlockInput.cachedData.availabilityPromise as Promise<BlockInputData>,
BLOCK_AVAILABILITY_CUTOFF_MS
).catch((_e) => {
chain.logger.debug("Block under processing not yet fully available adding to unknownBlockInput", {
blobSlot,
});
events.emit(NetworkEvent.unknownBlockInput, {blockInput: normalBlockInput, peer: peerIdStr});
});
} else {
chain.logger.debug("Block corresponding to blob is now available for processing", {blobSlot, index});
}
} else {
chain.logger.debug("Block not available till BLOCK_AVAILABILITY_CUTOFF_MS", {blobSlot, index});
chain.logger.debug(
"Block corresponding to blob not available till BLOCK_AVAILABILITY_CUTOFF_MS adding to unknownBlockInput",
{blobSlot, index}
);
events.emit(NetworkEvent.unknownBlockInput, {blockInput, peer: peerIdStr});
}
}
Expand Down Expand Up @@ -535,16 +553,24 @@ function getDefaultHandlers(modules: ValidatorFnsModules, options: GossipHandler
});

if (normalBlockInput !== null) {
chain.logger.debug("Block corresponding to blob is now available for processing", {blobSlot, index});
// we can directly send it for processing but block gossip handler will queue it up anyway
// if we see any issues later, we can send it to handleValidBeaconBlock
//
// handleValidBeaconBlock(normalBlockInput, peerIdStr, seenTimestampSec);
//
// 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.dataPromise) {
events.emit(NetworkEvent.unknownBlockInput, {blockInput: normalBlockInput, peer: peerIdStr});
chain.logger.debug("Block corresponding to blob is now available but waiting for data availability", {
blobSlot,
index,
});
await raceWithCutoff(
chain,
blobSlot,
normalBlockInput.cachedData.availabilityPromise as Promise<BlockInputData>,
BLOCK_AVAILABILITY_CUTOFF_MS
).catch((_e) => {
chain.logger.debug("Block under processing not yet fully available adding to unknownBlockInput", {
blobSlot,
});
events.emit(NetworkEvent.unknownBlockInput, {blockInput: normalBlockInput, peer: peerIdStr});
});
} else {
chain.logger.debug("Block corresponding to blob is now available for processing", {blobSlot, index});
}
} else {
chain.logger.debug("Block not available till BLOCK_AVAILABILITY_CUTOFF_MS", {blobSlot, index});
Expand Down

0 comments on commit d35873e

Please sign in to comment.