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

Web3signer: persistent public keys #13682

Merged
merged 119 commits into from
Jun 26, 2024
Merged

Web3signer: persistent public keys #13682

merged 119 commits into from
Jun 26, 2024

Conversation

james-prysm
Copy link
Contributor

@james-prysm james-prysm commented Mar 1, 2024

What type of PR is this?

Feature

What does this PR do? Why is it needed?

currently prysm doesn't provide a way to persist api changes for web3signer keys using things like add or remove remote keys.

This pr provides a new flag --validators-external-signer-key-file=/path/to/keyfile.txt where you can provide a list of your public keys in hex format on each line to be used with your web3signer. note,hex keys will require a 0xprefix. if this flag is provided all keys provided via the validators-external-signer-public-keys can also be saved if there are calls to the api. updating the file directly will also update the keys used without restart of the validator client( but caution as this part is still experimental)

Which issues(s) does this PR fix?

Fixes #9994, #12373

Other notes for review

@james-prysm james-prysm added Web3Signer Web3Signer related tasks API Api related tasks UX cosmetic / user experience related labels Mar 1, 2024
Comment on lines 586 to 591
{
name: "overwrite existing file",
lines: []string{"line1", "line2"},
filename: "testfile2.txt",
wantErr: false,
},
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't this test do exactly the same as the first one?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

need to fix this test

validator/keymanager/remote-web3signer/internal/client.go Outdated Show resolved Hide resolved
validator/keymanager/remote-web3signer/keymanager.go Outdated Show resolved Hide resolved
validator/keymanager/remote-web3signer/keymanager.go Outdated Show resolved Hide resolved
validator/keymanager/remote-web3signer/keymanager.go Outdated Show resolved Hide resolved
return nil
}

func (km *Keymanager) areEmptyPublicKeys() bool {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

arePublicKeysEmpty sounds better in my opinion

return len(km.providedPublicKeys) == 0
}

func (km *Keymanager) refreshRemoteKeysFromFileChanges(ctx context.Context) error {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Most of the logic is low-level logic independent of remote signer keys. If we move it to io/file, then we will be able to reuse such file watching in other places.

validator/keymanager/remote-web3signer/keymanager.go Outdated Show resolved Hide resolved
validator/keymanager/remote-web3signer/keymanager.go Outdated Show resolved Hide resolved
validator/keymanager/remote-web3signer/keymanager.go Outdated Show resolved Hide resolved
}
return errors.Wrap(err, "could not watch for file changes")
case <-ctx.Done():
return nil
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We probably want to log something here

@james-prysm james-prysm added this pull request to the merge queue Jun 26, 2024
Merged via the queue into develop with commit 539b981 Jun 26, 2024
16 of 17 checks passed
@james-prysm james-prysm deleted the persistent-web3signer branch June 26, 2024 15:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API Api related tasks UX cosmetic / user experience related Web3Signer Web3Signer related tasks
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Tracking] - Web3Signer capabilities for Prysm
6 participants