Skip to content

Commit

Permalink
Code review feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
mksh committed Aug 23, 2024
1 parent 7b70bce commit 176cfba
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 12 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 6 additions & 6 deletions src/cli/presigned_exit_message.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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")]
Expand Down Expand Up @@ -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,
);

Expand Down
4 changes: 2 additions & 2 deletions src/voluntary_exit/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions tests/e2e/presigned_exit_message.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,9 @@ fn test_presigned_exit_message() -> Result<(), Box<dyn std::error::Error>> {
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);
Expand Down

0 comments on commit 176cfba

Please sign in to comment.