don't crash on getBlindedExecutionPayload network errors (#4222)

This commit is contained in:
tersec 2022-10-05 16:29:20 +00:00 committed by GitHub
parent b8e9240ee0
commit 1293e36148
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 17 additions and 8 deletions

View File

@ -648,16 +648,25 @@ proc proposeBlockMEV(
Future[Opt[BlockRef]] {.async.} = Future[Opt[BlockRef]] {.async.} =
let let
executionBlockRoot = node.dag.loadExecutionBlockRoot(head) executionBlockRoot = node.dag.loadExecutionBlockRoot(head)
executionPayloadHeader = awaitWithTimeout( executionPayloadHeader =
node.getBlindedExecutionPayload( try:
slot, executionBlockRoot, validator.pubkey), awaitWithTimeout(
BUILDER_PROPOSAL_DELAY_TOLERANCE): node.getBlindedExecutionPayload(
Result[ExecutionPayloadHeader, cstring].err( slot, executionBlockRoot, validator.pubkey),
"getBlindedExecutionPayload timed out") 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: if executionPayloadHeader.isErr:
debug "proposeBlockMEV: getBlindedExecutionPayload failed", 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. # Haven't committed to the MEV block, so allow EL fallback.
beacon_block_builder_missed_with_fallback.inc() beacon_block_builder_missed_with_fallback.inc()
return Opt.none BlockRef return Opt.none BlockRef
@ -708,7 +717,7 @@ proc proposeBlockMEV(
# From here on, including error paths, disallow local EL production by # From here on, including error paths, disallow local EL production by
# returning Opt.some, regardless of whether on head or newBlock. # returning Opt.some, regardless of whether on head or newBlock.
except RestDecodingError as exc: except RestDecodingError as exc:
error "proposeBlockMEV: REST recoding error", error "proposeBlockMEV: REST decoding error submitting blinded block",
slot, head = shortLog(head), validator_index, blindedBlock, slot, head = shortLog(head), validator_index, blindedBlock,
error = exc.msg error = exc.msg
return Opt.some head return Opt.some head