From 1293e3614853e09d679b349af80b2e32d4833fe4 Mon Sep 17 00:00:00 2001 From: tersec Date: Wed, 5 Oct 2022 16:29:20 +0000 Subject: [PATCH] don't crash on getBlindedExecutionPayload network errors (#4222) --- beacon_chain/validators/validator_duties.nim | 25 +++++++++++++------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/beacon_chain/validators/validator_duties.nim b/beacon_chain/validators/validator_duties.nim index b56b3872e..32bf6a5dc 100644 --- a/beacon_chain/validators/validator_duties.nim +++ b/beacon_chain/validators/validator_duties.nim @@ -648,16 +648,25 @@ proc proposeBlockMEV( Future[Opt[BlockRef]] {.async.} = let executionBlockRoot = node.dag.loadExecutionBlockRoot(head) - executionPayloadHeader = awaitWithTimeout( - node.getBlindedExecutionPayload( - slot, executionBlockRoot, validator.pubkey), - BUILDER_PROPOSAL_DELAY_TOLERANCE): - Result[ExecutionPayloadHeader, cstring].err( - "getBlindedExecutionPayload timed out") + executionPayloadHeader = + try: + awaitWithTimeout( + node.getBlindedExecutionPayload( + slot, executionBlockRoot, validator.pubkey), + BUILDER_PROPOSAL_DELAY_TOLERANCE): + Result[ExecutionPayloadHeader, cstring].err( + "getBlindedExecutionPayload timed out") + except RestDecodingError as exc: + Result[ExecutionPayloadHeader, cstring].err( + "getBlindedExecutionPayload REST decoding error") + except CatchableError as exc: + Result[ExecutionPayloadHeader, cstring].err( + "getBlindedExecutionPayload error") if executionPayloadHeader.isErr: debug "proposeBlockMEV: getBlindedExecutionPayload failed", - error = executionPayloadHeader.error + error = executionPayloadHeader.error, slot, validator_index, + head = shortLog(head) # Haven't committed to the MEV block, so allow EL fallback. beacon_block_builder_missed_with_fallback.inc() return Opt.none BlockRef @@ -708,7 +717,7 @@ proc proposeBlockMEV( # From here on, including error paths, disallow local EL production by # returning Opt.some, regardless of whether on head or newBlock. except RestDecodingError as exc: - error "proposeBlockMEV: REST recoding error", + error "proposeBlockMEV: REST decoding error submitting blinded block", slot, head = shortLog(head), validator_index, blindedBlock, error = exc.msg return Opt.some head