Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

double getBlindedBlock timeout to 1 second #4750

Closed
wants to merge 1 commit into from
Closed

double getBlindedBlock timeout to 1 second #4750

wants to merge 1 commit into from

Conversation

tersec
Copy link
Contributor

@tersec tersec commented Mar 20, 2023

Only merge one of #4751 and this

This is from

let blindedBlockParts = await getBlindedBlockParts[EPH](
node, head, validator.pubkey, slot, randao, validator_index,
node.graffitiBytes)
if blindedBlockParts.isErr:
# Not signed yet, fine to try to fall back on EL
beacon_block_builder_missed_with_fallback.inc()
return Opt.none BlockRef
# These, together, get combined into the blinded block for signing and
# proposal through the relay network.
let (executionPayloadHeader, forkedBlck) = blindedBlockParts.get
# This is only substantively asynchronous with a remote key signer
let blindedBlock = awaitWithTimeout(
getBlindedBeaconBlock[SBBB](
node, slot, validator, validator_index, forkedBlck,
executionPayloadHeader),
500.milliseconds):
Result[SBBB, string].err("getBlindedBlock timed out")
if blindedBlock.isErr:
info "proposeBlockMEV: getBlindedBeaconBlock failed",
slot, head = shortLog(head), validator_index, blindedBlock,
error = blindedBlock.error
return Opt.none BlockRef
# Before unblindAndRouteBlockMEV, can fall back to EL; after, cannot

But getBlindedBlock doesn't directly interact with MEV relays, and is only truly asynchronous at all if someone's using a remote keysigner. getBlindedBlockParts, rather, is the call which gets the header bid from the MEV relay.

The issue is that if the timeout hits after the slashing has been checked in

proc getBlindedBeaconBlock[
T: bellatrix_mev.SignedBlindedBeaconBlock |
capella_mev.SignedBlindedBeaconBlock](
node: BeaconNode, slot: Slot, validator: AttachedValidator,
validator_index: ValidatorIndex, forkedBlock: ForkedBeaconBlock,
executionPayloadHeader: bellatrix.ExecutionPayloadHeader |
capella.ExecutionPayloadHeader):
Future[Result[T, string]] {.async.} =
withBlck(forkedBlock):
when consensusFork >= ConsensusFork.Deneb:
debugRaiseAssert $denebImplementationMissing & ": getBlindedBeaconBlock"
return err("getBlindedBeaconBlock: Deneb blinded block creation not implemented")
elif consensusFork >= ConsensusFork.Bellatrix:
when not (
(T is bellatrix_mev.SignedBlindedBeaconBlock and
consensusFork == ConsensusFork.Bellatrix) or
(T is capella_mev.SignedBlindedBeaconBlock and
consensusFork == ConsensusFork.Capella)):
return err("getBlindedBeaconBlock: mismatched block/payload types")
else:
return await blindedBlockCheckSlashingAndSign(
node, slot, validator, validator_index,
constructSignableBlindedBlock[T](blck, executionPayloadHeader))
else:
return err("getBlindedBeaconBlock: attempt to construct pre-Bellatrix blinded block")

it can effectively disable the local EL fallback, because the slashing protection already thinks it's produced a block.

500 milliseconds was somewhat arbitrary, and there hadn't been any timeout in non-remote keysigning setups, so reduce likelihood of this case.

@tersec
Copy link
Contributor Author

tersec commented Mar 20, 2023

#4751 is a better approach

@tersec tersec closed this Mar 20, 2023
@tersec tersec deleted the e3f branch March 20, 2023 11:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant