From 12eeaf8052bcd50fffeca3a9af8070db5439351b Mon Sep 17 00:00:00 2001 From: harkamal Date: Sun, 6 Aug 2023 17:54:16 +0530 Subject: [PATCH] apply feedback --- packages/beacon-node/src/chain/blocks/types.ts | 11 ++++++++--- .../src/network/processor/gossipHandlers.ts | 2 +- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/packages/beacon-node/src/chain/blocks/types.ts b/packages/beacon-node/src/chain/blocks/types.ts index 0ef7e2cd1486..fdf751acb45d 100644 --- a/packages/beacon-node/src/chain/blocks/types.ts +++ b/packages/beacon-node/src/chain/blocks/types.ts @@ -99,9 +99,14 @@ export const getBlockInput = { if (signedBlock !== undefined) { // block is available, check if all blobs have shown up - const {blobKzgCommitments} = (signedBlock as deneb.SignedBeaconBlock).message.body; + const {slot, body} = signedBlock.message; + const {blobKzgCommitments} = body as deneb.BeaconBlockBody; + const blockInfo = `blockHex=${blockHex}, slot=${slot}`; + if (blobKzgCommitments.length < blockCache.blobs.size) { - throw Error(`Received more blobs=${blockCache.blobs.size} than commitments=${blobKzgCommitments.length}`); + throw Error( + `Received more blobs=${blockCache.blobs.size} than commitments=${blobKzgCommitments.length} for ${blockInfo}` + ); } if (blobKzgCommitments.length === blockCache.blobs.size) { const blobSidecars = []; @@ -110,7 +115,7 @@ export const getBlockInput = { for (let index = 0; index < blobKzgCommitments.length; index++) { const blobSidecar = blockCache.blobs.get(index); if (blobSidecar === undefined) { - throw Error("Missing blobSidecar"); + throw Error(`Missing blobSidecar at index=${index} for ${blockInfo}`); } blobSidecars.push(blobSidecar); blobsBytes.push(blockCache.blobsBytes.get(index) ?? null); diff --git a/packages/beacon-node/src/network/processor/gossipHandlers.ts b/packages/beacon-node/src/network/processor/gossipHandlers.ts index 5dbc49a74594..f269f5fad13e 100644 --- a/packages/beacon-node/src/network/processor/gossipHandlers.ts +++ b/packages/beacon-node/src/network/processor/gossipHandlers.ts @@ -177,7 +177,7 @@ export function getGossipHandlers(modules: ValidatorFnsModules, options: GossipH if (e instanceof BlockGossipError) { // Don't trigger this yet if full block and blobs haven't arrived yet if (e instanceof BlockGossipError && e.type.code === BlockErrorCode.PARENT_UNKNOWN && blockInput !== null) { - logger.debug("Gossip block has error", {slot, root: blockHex, code: e.type.code}); + logger.debug("Gossip blob has error", {slot, root: blockHex, code: e.type.code}); events.emit(NetworkEvent.unknownBlockParent, {blockInput, peer: peerIdStr}); } }