Skip to content

Commit

Permalink
Fix handling of VC validators by per payload-builder payload builder …
Browse files Browse the repository at this point in the history
…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.
  • Loading branch information
stephanep committed Nov 16, 2023
1 parent 98e9690 commit 3a3926c
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion beacon_chain/validators/beacon_validators.nim
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 3a3926c

Please sign in to comment.