change blinded block proposal failures to REST internal errors (#5501)

This commit is contained in:
tersec 2023-10-12 21:54:24 +00:00 committed by GitHub
parent afc7912ebf
commit c5028b56bf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 12 deletions

View File

@ -1007,7 +1007,7 @@ proc installBeaconApiHandlers*(router: var RestRouter, node: BeaconNode) =
if res.isErr(): if res.isErr():
return RestApiResponse.jsonError( return RestApiResponse.jsonError(
Http503, BeaconNodeInSyncError, $res.error()) Http500, InternalServerError, $res.error())
if res.get().isNone(): if res.get().isNone():
return RestApiResponse.jsonError(Http202, BlockValidationError) return RestApiResponse.jsonError(Http202, BlockValidationError)
@ -1028,7 +1028,7 @@ proc installBeaconApiHandlers*(router: var RestRouter, node: BeaconNode) =
if res.isErr(): if res.isErr():
return RestApiResponse.jsonError( return RestApiResponse.jsonError(
Http503, BeaconNodeInSyncError, $res.error()) Http500, InternalServerError, $res.error())
if res.get().isNone(): if res.get().isNone():
return RestApiResponse.jsonError(Http202, BlockValidationError) return RestApiResponse.jsonError(Http202, BlockValidationError)

View File

@ -72,9 +72,8 @@ proc unblindAndRouteBlockMEV*(
if hash_tree_root( if hash_tree_root(
blindedBlock.message.body.execution_payload_header) != blindedBlock.message.body.execution_payload_header) !=
hash_tree_root(unblindedPayload.data.data): hash_tree_root(unblindedPayload.data.data):
debug "unblindAndRouteBlockMEV: unblinded payload doesn't match blinded payload", return err("unblinded payload doesn't match blinded payload header: " &
blindedPayload = $blindedBlock.message.body.execution_payload_header)
blindedBlock.message.body.execution_payload_header
else: else:
# Signature provided is consistent with unblinded execution payload, # Signature provided is consistent with unblinded execution payload,
# so construct full beacon block # so construct full beacon block
@ -110,8 +109,8 @@ proc unblindAndRouteBlockMEV*(
return ok newBlockRef return ok newBlockRef
else: else:
debug "unblindAndRouteBlockMEV: submitBlindedBlock failed", return err("submitBlindedBlock failed with HTTP error code" &
blindedBlock, payloadStatus = unblindedPayload.status $unblindedPayload.status & ": " & $shortLog(blindedBlock))
# https://github.com/ethereum/builder-specs/blob/v0.3.0/specs/bellatrix/validator.md#proposer-slashing # https://github.com/ethereum/builder-specs/blob/v0.3.0/specs/bellatrix/validator.md#proposer-slashing
# This means if a validator publishes a signature for a # This means if a validator publishes a signature for a
@ -151,9 +150,8 @@ proc unblindAndRouteBlockMEV*(
if hash_tree_root( if hash_tree_root(
blindedBlock.message.body.execution_payload_header) != blindedBlock.message.body.execution_payload_header) !=
hash_tree_root(unblindedPayload.data.data.execution_payload): hash_tree_root(unblindedPayload.data.data.execution_payload):
debug "unblindAndRouteBlockMEV: unblinded payload doesn't match blinded payload", return err("unblinded payload doesn't match blinded payload header: " &
blindedPayload = $blindedBlock.message.body.execution_payload_header)
blindedBlock.message.body.execution_payload_header
else: else:
# Signature provided is consistent with unblinded execution payload, # Signature provided is consistent with unblinded execution payload,
# so construct full beacon block # so construct full beacon block
@ -193,8 +191,8 @@ proc unblindAndRouteBlockMEV*(
return ok newBlockRef return ok newBlockRef
else: else:
debug "unblindAndRouteBlockMEV: submitBlindedBlock failed", return err("submitBlindedBlock failed with HTTP error code" &
blindedBlock, payloadStatus = unblindedPayload.status $unblindedPayload.status & ": " & $shortLog(blindedBlock))
# https://github.com/ethereum/builder-specs/blob/v0.3.0/specs/bellatrix/validator.md#proposer-slashing # https://github.com/ethereum/builder-specs/blob/v0.3.0/specs/bellatrix/validator.md#proposer-slashing
# This means if a validator publishes a signature for a # This means if a validator publishes a signature for a