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

Synchronize keys between validator client and external signer #6624

Closed
nflaig opened this issue Apr 3, 2024 · 2 comments · Fixed by #6672
Closed

Synchronize keys between validator client and external signer #6624

nflaig opened this issue Apr 3, 2024 · 2 comments · Fixed by #6672
Labels
help wanted The author indicates that additional help is wanted. meta-feature-request Issues to track feature requests. scope-interop Issues that fix interop issues between Lodestar and CL, EL or tooling.
Milestone

Comments

@nflaig
Copy link
Member

nflaig commented Apr 3, 2024

Problem description

It is possible to delegate signing duties to a remote signer by specifying a --externalSigner.url on the validator client. For the validator client to know which pubkeys are managed by the remote signer it is required to either

The later approach is much more commonly used as it is the most convenient way to set up the validator client with a remote signer. However, the problem is that the keys will get out of sync if new keys are imported (or deleted) into the remote signer as Lodestar only queries the /api/v1/eth2/publicKeys API on startup.

A common workaround for this is to use external tooling / sidecars to keep the keys in sync by calling POST /eth/v1/remotekeys and DELETE /eth/v1/remotekeys on both the validator client and remote signer, or alternatively poll /api/v1/eth2/publicKeys on the remote singer and only call POST /eth/v1/remotekeys on the validator client.

Either way, it's not ideal that this lifecycle has to be managed by external tooling and it likely the best option to let the validator client take care of keeping the keys in sync as it is already able to call the /api/v1/eth2/publicKeys API of the remote signer while it is not guaranteed that the remote signer will be able to send requests tot the validator client as this is currently not a requirement and the connectivity might be one directional in many setups.

Solution description

Implement a solution similar to Nimbus which already polls the remote signer /api/v1/eth2/publicKeys API in a configurable interval to keep the keys in sync.

We could just enable this polling if a user has already set the --externalSigner.fetch flag but instead of just fetching the keys on startup, we would do it every epoch or potentially just every hour (as Nimbus does) and add an additional flag to configure the interval, e.g. --externalsigner.fetchInterval or similar.

The validator client would have to compare the list of pubkeys received from the remote signer against the (remote) pubkeys imported in the validator store and add any missing keys.

It also has to make sure to remove any extraneous keys no longer present on the remote signer as otherwise it would still try to handle duties for those keys but signature requests would fail because the keys are removed from remote signer. It's not a slashing risk in that case due to double signing but would cause a bunch of errors on the validator client side and creates additional overhead for the connected beacon node.

Additional context

Related discussion on discord

@nflaig nflaig added scope-interop Issues that fix interop issues between Lodestar and CL, EL or tooling. meta-feature-request Issues to track feature requests. labels Apr 3, 2024
@nflaig nflaig added the help wanted The author indicates that additional help is wanted. label Apr 5, 2024
@philknows philknows added this to the v1.19.0 milestone Apr 9, 2024
@philknows
Copy link
Member

Tagged as v1.19 but understand this needs discussion with @g11tech to ensure safety.

@nflaig
Copy link
Member Author

nflaig commented Apr 9, 2024

Tagged as v1.19 but understand this needs discussion with @g11tech to ensure safety.

Just to clarify, this does not change the behavior as this is what the sidecar process used by Diva does already, and Nimbus has implemented for a while.

Also we fetch the pubkeys already on startup if --externalSigner.fetch is set, so the only difference this makes is to do it continuously without requiring a restart.

@nflaig nflaig changed the title Synchronize keys between validator client and remote signer Synchronize keys between validator client and external signer Apr 15, 2024
@nflaig nflaig modified the milestones: v1.19.0, v1.18.0 Apr 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted The author indicates that additional help is wanted. meta-feature-request Issues to track feature requests. scope-interop Issues that fix interop issues between Lodestar and CL, EL or tooling.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants