From 3a3926c96c1092c17bc0e68bba07d7278ed9698e Mon Sep 17 00:00:00 2001 From: Stephane Poignant Date: Wed, 15 Nov 2023 17:43:53 +0100 Subject: [PATCH] Fix handling of VC validators by per payload-builder payload builder validator registration (issue 5599). The proposed change ensures that VC validators are registered with the builder specified by the `--payload-builder-url` argument even if the beacon node has no attached validators. It also prevent such validators from being unintentionally registered with builders configured for specific attached validators by the keymanager api. --- beacon_chain/validators/beacon_validators.nim | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/beacon_chain/validators/beacon_validators.nim b/beacon_chain/validators/beacon_validators.nim index df1c744f2e..576c59062a 100644 --- a/beacon_chain/validators/beacon_validators.nim +++ b/beacon_chain/validators/beacon_validators.nim @@ -1576,7 +1576,8 @@ proc registerValidatorsPerBuilder( # First, check for VC-added keys; cheaper because provided pre-signed var nonExitedVcPubkeys: HashSet[ValidatorPubKey] - if node.externalBuilderRegistrations.len > 0: + if node.externalBuilderRegistrations.len > 0 and + payloadBuilderAddress == node.config.getPayloadBuilderAddress.value: withState(node.dag.headState): let currentEpoch = node.currentSlot().epoch for i in 0 ..< forkyState.data.validators.len: @@ -1663,6 +1664,12 @@ proc registerValidators*(node: BeaconNode, epoch: Epoch) {.async.} = if not node.config.payloadBuilderEnable: return var builderKeys: Table[string, seq[ValidatorPubKey]] + + # Ensure VC validators are still registered if we have no attached validators + let externalPayloadBuilderAddress = node.config.getPayloadBuilderAddress + if externalPayloadBuilderAddress.isSome: + builderKeys[externalPayloadBuilderAddress.value] = newSeq[ValidatorPubKey](0) + for pubkey in node.attachedValidators[].validators.keys: let payloadBuilderAddress = node.getPayloadBuilderAddress(pubkey).valueOr: continue