From 176cfba7ff27afe8499c718f6e8bad27d6a890c9 Mon Sep 17 00:00:00 2001 From: Maksym Kulish Date: Fri, 23 Aug 2024 15:59:59 +0300 Subject: [PATCH] Code review feedback --- README.md | 4 ++-- src/cli/presigned_exit_message.rs | 12 ++++++------ src/voluntary_exit/mod.rs | 4 ++-- tests/e2e/presigned_exit_message.rs | 4 ++-- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index 5b7f0ef..9ad3b8e 100644 --- a/README.md +++ b/README.md @@ -106,10 +106,10 @@ Use `eth-staking-smith` via command line like: ### Command to generate presigned exit message ``` -./target/debug/eth-staking-smith presigned-exit-message --chain mainnet --mnemonic "entire habit bottom mention spoil clown finger wheat motion fox axis mechanic country make garment bar blind stadium sugar water scissors canyon often ketchup" --validator_start_index 0 --validator_index 100 --epoch 300000 +./target/debug/eth-staking-smith presigned-exit-message --chain mainnet --mnemonic "entire habit bottom mention spoil clown finger wheat motion fox axis mechanic country make garment bar blind stadium sugar water scissors canyon often ketchup" --validator_seed_index 0 --validator_beacon_index 100 --epoch 300000 ``` -Note that --validator-index and --validator-start-index are two distinct parameter, the former being index of validator on Beacon chain, and the latter is the index of validator private key derived from the seed +Note that --validator-beacon-index and --validator-seed-index are two distinct parameter, the former being index of validator on Beacon chain, and the latter is the index of validator private key derived from the seed ## Exporting CLI standard output into common keystores folder format diff --git a/src/cli/presigned_exit_message.rs b/src/cli/presigned_exit_message.rs index 60347d7..275285c 100644 --- a/src/cli/presigned_exit_message.rs +++ b/src/cli/presigned_exit_message.rs @@ -27,12 +27,12 @@ pub struct PresignedExitMessageSubcommandOpts { /// and you want to generate for the 2nd validator, /// the validator_start_index would be 1. /// If no index specified, it will be set to 0. - #[arg(long, visible_alias = "validator_start_index")] - pub validator_start_index: u32, + #[arg(long, visible_alias = "validator_seed_index")] + pub validator_seed_index: u32, /// On-chain beacon index of the validator. - #[arg(long, visible_alias = "validator_index")] - pub validator_index: u32, + #[arg(long, visible_alias = "validator_beacon_index")] + pub validator_beacon_index: u32, /// Epoch number which must be included in the presigned exit message. #[arg(long, visible_alias = "execution_address")] @@ -78,8 +78,8 @@ impl PresignedExitMessageSubcommandOpts { let (voluntary_exit, key_material) = voluntary_exit::voluntary_exit_message_from_mnemonic( self.mnemonic.as_bytes(), - self.validator_start_index as u64, - self.validator_index as u64, + self.validator_seed_index as u64, + self.validator_beacon_index as u64, self.epoch, ); diff --git a/src/voluntary_exit/mod.rs b/src/voluntary_exit/mod.rs index 278f765..fe871f3 100644 --- a/src/voluntary_exit/mod.rs +++ b/src/voluntary_exit/mod.rs @@ -6,7 +6,7 @@ use crate::key_material::VotingKeyMaterial; pub fn voluntary_exit_message_from_mnemonic( mnemonic_phrase: &[u8], - validator_start_index: u64, + validator_seed_index: u64, validator_beacon_index: u64, epoch: u64, ) -> (VoluntaryExit, VotingKeyMaterial) { @@ -15,7 +15,7 @@ pub fn voluntary_exit_message_from_mnemonic( let key_materials = crate::key_material::seed_to_key_material( &seed, 1, - validator_start_index as u32, + validator_seed_index as u32, None, false, None, diff --git a/tests/e2e/presigned_exit_message.rs b/tests/e2e/presigned_exit_message.rs index 3660de0..d8d1d03 100644 --- a/tests/e2e/presigned_exit_message.rs +++ b/tests/e2e/presigned_exit_message.rs @@ -78,9 +78,9 @@ fn test_presigned_exit_message() -> Result<(), Box> { cmd.arg("presigned-exit-message"); cmd.arg("--chain"); cmd.arg(chain); - cmd.arg("--validator_start_index"); + cmd.arg("--validator_seed_index"); cmd.arg(validator_start_index); - cmd.arg("--validator_index"); + cmd.arg("--validator_beacon_index"); cmd.arg(validator_index); cmd.arg("--mnemonic"); cmd.arg(expected_mnemonic);