@@ -920,14 +920,45 @@ proc getBuilderBid[
920
920
proc proposeBlockMEV(
921
921
node: BeaconNode, payloadBuilderClient: RestClientRef,
922
922
blindedBlock:
923
- electra_mev.SignedBlindedBeaconBlock |
923
+ electra_mev.SignedBlindedBeaconBlock):
924
+ Future[Result[Opt[BlockRef], string ]] {.async: (raises: [CancelledError]) .} =
925
+ let unblindedBlockRef = await node.unblindAndRouteBlockMEV(
926
+ payloadBuilderClient, blindedBlock)
927
+ if unblindedBlockRef.isOk and unblindedBlockRef.get.isSome:
928
+ beacon_blocks_proposed.inc()
929
+ return ok(unblindedBlockRef.get)
930
+ else :
931
+ # unblindedBlockRef.isOk and unblindedBlockRef.get.isNone indicates that
932
+ # the block failed to validate and integrate into the DAG, which for the
933
+ # purpose of this return value, is equivalent. It's used to drive Beacon
934
+ # REST API output.
935
+ #
936
+ # https://collective.flashbots.net/t/post-mortem-april-3rd-2023-mev-boost-relay-incident-and-related-timing-issue/1540
937
+ # has caused false positives, because
938
+ # "A potential mitigation to this attack is to introduce a cutoff timing
939
+ # into the proposer's slot whereafter this time (e.g. 3 seconds) the relay
940
+ # will no longer return a block to the proposer. Relays began to roll out
941
+ # this mitigation in the evening of April 3rd UTC time with a 2 second
942
+ # cutoff, and notified other relays to do the same. After receiving
943
+ # credible reports of honest validators missing their slots the suggested
944
+ # timing cutoff was increased to 3 seconds."
945
+ let errMsg =
946
+ if unblindedBlockRef.isErr:
947
+ unblindedBlockRef.error
948
+ else :
949
+ " Unblinded block not returned to proposer"
950
+ err errMsg
951
+
952
+ proc proposeBlockMEV(
953
+ node: BeaconNode, payloadBuilderClient: RestClientRef,
954
+ blindedBlock:
924
955
fulu_mev.SignedBlindedBeaconBlock):
925
- Future[Result[BlockRef, string ]] {.async: (raises: [CancelledError]) .} =
956
+ Future[Result[Opt[ BlockRef] , string ]] {.async: (raises: [CancelledError]) .} =
926
957
let unblindedBlockRef = await node.unblindAndRouteBlockMEV(
927
958
payloadBuilderClient, blindedBlock)
928
- return if unblindedBlockRef.isOk and unblindedBlockRef.get.isSome :
959
+ if unblindedBlockRef.isOk:
929
960
beacon_blocks_proposed.inc()
930
- ok(unblindedBlockRef.get.get )
961
+ return ok(Opt.none(BlockRef) )
931
962
else :
932
963
# unblindedBlockRef.isOk and unblindedBlockRef.get.isNone indicates that
933
964
# the block failed to validate and integrate into the DAG, which for the
@@ -1156,7 +1187,12 @@ proc proposeBlockAux(
1156
1187
maybeUnblindedBlock = await proposeBlockMEV(
1157
1188
node, payloadBuilderClient, blindedBlock)
1158
1189
1159
- return maybeUnblindedBlock.valueOr:
1190
+ if maybeUnblindedBlock.isOk():
1191
+ if maybeUnblindedBlock.get.isSome():
1192
+ return maybeUnblindedBlock.get.get
1193
+ else:
1194
+ return head
1195
+ else:
1160
1196
warn "Blinded block proposal incomplete",
1161
1197
head = shortLog(head), slot, validator_index,
1162
1198
validator = shortLog(validator),
0 commit comments