update builder API registrations after keymanager API fee recipient change (#6412)
This commit is contained in:
parent
85c2850971
commit
9f654690b8
|
@ -1749,8 +1749,10 @@ proc registerValidatorsPerBuilder(
|
|||
validatorRegistrations.add @[validatorRegistration]
|
||||
|
||||
# First, check for VC-added keys; cheaper because provided pre-signed
|
||||
# See issue #5599: currently VC have no way to provide BN with per-validator builders per the specs, so we have to
|
||||
# resort to use the BN fallback default (--payload-builder-url value, obtained by calling getPayloadBuilderAddress)
|
||||
# See issue #5599: currently VC have no way to provide BN with per-validator
|
||||
# builders per the specs, so we have to resort to use the BN fallback
|
||||
# default (--payload-builder-url value, obtained by calling
|
||||
# getPayloadBuilderAddress)
|
||||
var nonExitedVcPubkeys: HashSet[ValidatorPubKey]
|
||||
if node.externalBuilderRegistrations.len > 0 and
|
||||
payloadBuilderAddress == node.config.getPayloadBuilderAddress.value:
|
||||
|
|
|
@ -1481,6 +1481,7 @@ proc removeFeeRecipientFile*(host: KeymanagerHost,
|
|||
if fileExists(path):
|
||||
io2.removeFile(path).isOkOr:
|
||||
return err($uint(error) & " " & ioErrorMsg(error))
|
||||
host.validatorPool[].invalidateValidatorRegistration(pubkey)
|
||||
ok()
|
||||
|
||||
proc removeGasLimitFile*(host: KeymanagerHost,
|
||||
|
@ -1499,15 +1500,22 @@ proc removeGraffitiFile*(host: KeymanagerHost,
|
|||
return err($uint(error) & " " & ioErrorMsg(error))
|
||||
ok()
|
||||
|
||||
proc setFeeRecipient*(host: KeymanagerHost, pubkey: ValidatorPubKey, feeRecipient: Eth1Address): Result[void, string] =
|
||||
proc setFeeRecipient*(
|
||||
host: KeymanagerHost, pubkey: ValidatorPubKey, feeRecipient: Eth1Address):
|
||||
Result[void, string] =
|
||||
let validatorKeystoreDir = host.validatorKeystoreDir(pubkey)
|
||||
|
||||
? secureCreatePath(validatorKeystoreDir).mapErr(proc(e: auto): string =
|
||||
"Could not create wallet directory [" & validatorKeystoreDir & "]: " & $e)
|
||||
|
||||
io2.writeFile(validatorKeystoreDir / FeeRecipientFilename, $feeRecipient)
|
||||
let res = io2.writeFile(
|
||||
validatorKeystoreDir / FeeRecipientFilename, $feeRecipient)
|
||||
.mapErr(proc(e: auto): string = "Failed to write fee recipient file: " & $e)
|
||||
|
||||
if res.isOk:
|
||||
host.validatorPool[].invalidateValidatorRegistration(pubkey)
|
||||
|
||||
res
|
||||
|
||||
proc setGasLimit*(host: KeymanagerHost,
|
||||
pubkey: ValidatorPubKey,
|
||||
gasLimit: uint64): Result[void, string] =
|
||||
|
|
|
@ -288,6 +288,15 @@ proc updateValidator*(pool: var ValidatorPool,
|
|||
|
||||
validator.activationEpoch = activationEpoch
|
||||
|
||||
func invalidateValidatorRegistration*(
|
||||
pool: var ValidatorPool, pubkey: ValidatorPubKey) =
|
||||
# When the per-validator fee recipient changes via keymanager, the builder
|
||||
# API validator registration needs to be recomputed. This will happen when
|
||||
# next the registrations are sent, but ensure here that will happen rather
|
||||
# than relying on a now-outdated, cached, validator registration.
|
||||
pool.getValidator(pubkey).isErrOr:
|
||||
value.externalBuilderRegistration.reset()
|
||||
|
||||
proc close*(pool: var ValidatorPool) =
|
||||
## Unlock and close all validator keystore's files managed by ``pool``.
|
||||
for validator in pool.validators.values():
|
||||
|
|
Loading…
Reference in New Issue