From 6a46abf3ac5720a971e219426b0d58dd4f9d1b57 Mon Sep 17 00:00:00 2001 From: harkamal Date: Fri, 13 May 2022 11:52:04 +0530 Subject: [PATCH] Log errors on fetch errors for terminal pow --- .../lodestar/src/chain/blocks/verifyBlock.ts | 27 +++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/packages/lodestar/src/chain/blocks/verifyBlock.ts b/packages/lodestar/src/chain/blocks/verifyBlock.ts index f023393419a1..5a72d9edd4ae 100644 --- a/packages/lodestar/src/chain/blocks/verifyBlock.ts +++ b/packages/lodestar/src/chain/blocks/verifyBlock.ts @@ -295,9 +295,32 @@ export async function verifyBlockStateTransition( // in import block if (isMergeTransitionBlock) { const mergeBlock = block.message as bellatrix.BeaconBlock; + const mergeBlockHash = toHexString( + chain.config.getForkTypes(mergeBlock.slot).BeaconBlock.hashTreeRoot(mergeBlock) + ); const powBlockRootHex = toHexString(mergeBlock.body.executionPayload.parentHash); - const powBlock = await chain.eth1.getPowBlock(powBlockRootHex).catch((_error) => null); - const powBlockParent = powBlock && (await chain.eth1.getPowBlock(powBlock.parentHash).catch((_error) => null)); + const powBlock = await chain.eth1.getPowBlock(powBlockRootHex).catch((error) => { + // Lets just warn the user here, errors if any will be reported on + // `assertValidTerminalPowBlock` checks + chain.logger.warn( + "Error fetching terminal PoW block referred in the merge transition block", + {powBlockHash: powBlockRootHex, mergeBlockHash}, + error + ); + return null; + }); + const powBlockParent = + powBlock && + (await chain.eth1.getPowBlock(powBlock.parentHash).catch((error) => { + // Lets just warn the user here, errors if any will be reported on + // `assertValidTerminalPowBlock` checks + chain.logger.warn( + "Error fetching parent of the terminal PoW block referred in the merge transition block", + {powBlockParentHash: powBlock.parentHash, powBlock: powBlockRootHex, mergeBlockHash}, + error + ); + return null; + })); assertValidTerminalPowBlock(chain.config, mergeBlock, {executionStatus, powBlock, powBlockParent}); }