Skip to content

Commit ef209aa

Browse files
committed
Remove legacy key upgrading
1 parent f749a18 commit ef209aa

File tree

7 files changed

+1
-258
lines changed

7 files changed

+1
-258
lines changed

account_manager/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,6 @@ clap_utils = { path = "../common/clap_utils" }
2626
eth2_wallet = { path = "../crypto/eth2_wallet" }
2727
eth2_wallet_manager = { path = "../common/eth2_wallet_manager" }
2828
rand = "0.7.2"
29-
validator_dir = { path = "../common/validator_dir", features = ["unencrypted_keys"] }
29+
validator_dir = { path = "../common/validator_dir" }
3030
tokio = { version = "0.2.21", features = ["full"] }
3131
eth2_keystore = { path = "../crypto/eth2_keystore" }

account_manager/src/lib.rs

-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
mod common;
2-
pub mod upgrade_legacy_keypairs;
32
pub mod validator;
43
pub mod wallet;
54

@@ -19,15 +18,13 @@ pub fn cli_app<'a, 'b>() -> App<'a, 'b> {
1918
.about("Utilities for generating and managing Ethereum 2.0 accounts.")
2019
.subcommand(wallet::cli_app())
2120
.subcommand(validator::cli_app())
22-
.subcommand(upgrade_legacy_keypairs::cli_app())
2321
}
2422

2523
/// Run the account manager, returning an error if the operation did not succeed.
2624
pub fn run<T: EthSpec>(matches: &ArgMatches<'_>, env: Environment<T>) -> Result<(), String> {
2725
match matches.subcommand() {
2826
(wallet::CMD, Some(matches)) => wallet::cli_run(matches)?,
2927
(validator::CMD, Some(matches)) => validator::cli_run(matches, env)?,
30-
(upgrade_legacy_keypairs::CMD, Some(matches)) => upgrade_legacy_keypairs::cli_run(matches)?,
3128
(unknown, _) => {
3229
return Err(format!(
3330
"{} is not a valid {} command. See --help.",

account_manager/src/upgrade_legacy_keypairs.rs

-149
This file was deleted.

common/validator_dir/Cargo.toml

-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ authors = ["Paul Hauner <paul@paulhauner.com>"]
55
edition = "2018"
66

77
[features]
8-
unencrypted_keys = []
98
insecure_keys = []
109

1110
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

common/validator_dir/src/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
mod builder;
1111
pub mod insecure_keys;
1212
mod manager;
13-
pub mod unencrypted_keys;
1413
mod validator_dir;
1514

1615
pub use crate::validator_dir::{Error, Eth1DepositData, ValidatorDir, ETH1_DEPOSIT_TX_HASH_FILE};

common/validator_dir/src/unencrypted_keys.rs

-48
This file was deleted.

lighthouse/tests/account_manager.rs

-55
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
#![cfg(not(debug_assertions))]
22

33
use account_manager::{
4-
upgrade_legacy_keypairs::{CMD as UPGRADE_CMD, *},
54
validator::{create::*, CMD as VALIDATOR_CMD},
65
wallet::{
76
create::{CMD as CREATE_CMD, *},
@@ -16,7 +15,6 @@ use std::path::{Path, PathBuf};
1615
use std::process::{Command, Output};
1716
use std::str::from_utf8;
1817
use tempfile::{tempdir, TempDir};
19-
use types::Keypair;
2018
use validator_dir::ValidatorDir;
2119

2220
// TODO: create tests for the `lighthouse account validator deposit` command. This involves getting
@@ -365,56 +363,3 @@ fn validator_create() {
365363

366364
assert_eq!(dir_child_count(validator_dir.path()), 6);
367365
}
368-
369-
fn write_legacy_keypair<P: AsRef<Path>>(name: &str, dir: P) -> Keypair {
370-
let keypair = Keypair::random();
371-
372-
let mut keypair_bytes = keypair.pk.serialize().to_vec();
373-
keypair_bytes.extend_from_slice(keypair.sk.serialize().as_ref());
374-
375-
fs::write(dir.as_ref().join(name), &keypair_bytes).unwrap();
376-
377-
keypair
378-
}
379-
380-
#[test]
381-
fn upgrade_legacy_keypairs() {
382-
let validators_dir = tempdir().unwrap();
383-
let secrets_dir = tempdir().unwrap();
384-
385-
let validators = (0..2)
386-
.into_iter()
387-
.map(|i| {
388-
let validator_dir = validators_dir.path().join(format!("myval{}", i));
389-
390-
fs::create_dir_all(&validator_dir).unwrap();
391-
392-
let voting_keypair = write_legacy_keypair(VOTING_KEYPAIR_FILE, &validator_dir);
393-
let withdrawal_keypair = write_legacy_keypair(WITHDRAWAL_KEYPAIR_FILE, &validator_dir);
394-
395-
(validator_dir, voting_keypair, withdrawal_keypair)
396-
})
397-
.collect::<Vec<_>>();
398-
399-
account_cmd()
400-
.arg(UPGRADE_CMD)
401-
.arg(format!("--{}", VALIDATOR_DIR_FLAG))
402-
.arg(validators_dir.path().as_os_str())
403-
.arg(format!("--{}", SECRETS_DIR_FLAG))
404-
.arg(secrets_dir.path().as_os_str())
405-
.output()
406-
.unwrap();
407-
408-
for (validator_dir, voting_keypair, withdrawal_keypair) in validators {
409-
let dir = ValidatorDir::open(&validator_dir).unwrap();
410-
411-
assert_eq!(
412-
voting_keypair.pk,
413-
dir.voting_keypair(secrets_dir.path()).unwrap().pk
414-
);
415-
assert_eq!(
416-
withdrawal_keypair.pk,
417-
dir.withdrawal_keypair(secrets_dir.path()).unwrap().pk
418-
);
419-
}
420-
}

0 commit comments

Comments
 (0)