-
Notifications
You must be signed in to change notification settings - Fork 740
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
Validator manager commands for standard key-manager APIs #5347
Validator manager commands for standard key-manager APIs #5347
Conversation
I have done some testing for the PR. Generally, it is a nice feature to have for Lighthouse Validator Manager family of commands that are compatible with the KeyManager API. 1. For
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have created a PR on your repo that includes updating the code and some fixes to the errors found (thanks to @michaelsproul). Feel free to merge the PR so that this PR is closer to completion.
I would also like to suggest to rename remove.rs
to delete.rs
and some wordings in the source code to be consistent with the Keymanager API.
Thanks!
if dump_config.should_exit_early(&config)? { | ||
Ok(()) | ||
} else { | ||
println!("{}", run(config).await.unwrap()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This fixes the panic bug in no. 1 here: #5347 (comment)
Thanks to @michaelsproul, he also mentioned that we should remove all unwrap() in the PR
println!("{}", run(config).await.unwrap()); | |
println!("{}", run(config).await?); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in b80d16e
|
||
use crate::{common::vc_http_client, DumpConfig}; | ||
|
||
pub const CMD: &str = "remove"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From my understanding, this is the wording that's shown on the CLI help text. I think it is better to have it named delete
to be consistent with the Keymanager API: https://ethereum.github.io/keymanager-APIs/#/Local%20Key%20Manager
pub const CMD: &str = "remove"; | |
pub const CMD: &str = "delete"; |
Maybe can revise some of the wordings in this file, and also rename the name of this file to delete_validators.rs
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in eadec07
pub const FEE_RECIPIENT: &str = "fee-recipient"; | ||
pub const GAS_LIMIT: &str = "gas-limit"; | ||
pub const BUILDER_PROPOSALS: &str = "builder-proposals"; | ||
pub const BUILDER_BOOST_FACTOR: &str = "builder-boost-factor"; | ||
pub const PREFER_BUILDER_PROPOSALS: &str = "prefer-builder-proposals"; | ||
pub const ENABLED: &str = "enabled"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This provides additional optional flags to be used when importing the validators, e.g., fee-recipient
etc, which will be added to the validator_definitions.yml
directly. I think this is a nice feature to have.
Just noted here that other import commands do not have this
.takes_value(true), | ||
) | ||
.arg( | ||
Arg::with_name(FEE_RECIPIENT) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we keep all these optional flags, I would recommend to use the same name, for example, suggested-fee-recipient
in the validator client:
lighthouse/validator_client/src/cli.rs
Line 161 in 9e12c21
Arg::new("suggested-fee-recipient") |
Also recommend to update the help text, for example, can use the same help text from the validator client. The same goes for other flags like builder-proposals
Arg::with_name(FEE_RECIPIENT) | |
Arg::with_name(SUGGESTED_FEE_RECIPIENT) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated in chong-he@100ee22
crypto/eth2_keystore/src/keystore.rs
Outdated
/// Instantiates `self` from a `JsonKeystore`. | ||
pub fn from_json_keystore(json_keystore: JsonKeystore) -> Result<Self, Error> { | ||
Ok(Keystore { json: json_keystore }) | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably can delete this since the import_validator.rs
now uses from_json_file
function
/// Instantiates `self` from a `JsonKeystore`. | |
pub fn from_json_keystore(json_keystore: JsonKeystore) -> Result<Self, Error> { | |
Ok(Keystore { json: json_keystore }) | |
} |
let validators_file = fs::read_to_string(&self.import_config.validator_file_path) | ||
.map_err(|e| format!("Unable to open {:?}: {:?}", &self.import_config.validator_file_path, e)).unwrap(); | ||
|
||
let local_keystore: Keystore = Keystore::from_json_keystore(serde_json::from_str(&validators_file).expect("JSON was not well formatted")).unwrap(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let local_keystore: Keystore = Keystore::from_json_keystore(serde_json::from_str(&validators_file).expect("JSON was not well formatted")).unwrap(); | |
let local_keystore: Keystore = Keystore::from_json_file(serde_json::from_str(&validators_file_path).expect("JSON was not well formatted")).unwrap(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Try to remove it in 6fb9f83
I've merged CK's PR into this one so we can review here. |
…anager-standard-keystore
Closing in favour of a PR from CK's repo, as updating this PR manually is becoming time-consuming. Sorry Pahor, you'll get |
Issue Addressed
#4854
Proposed Changes
Added ability to
Additional Info
This is my first PR, please let me know if anything is missing.