From eb35c64afdf18a7b0e5cef1ef5b05b95a3154d13 Mon Sep 17 00:00:00 2001 From: Paul Hauner Date: Thu, 11 Nov 2021 14:08:56 +1100 Subject: [PATCH] Remove old uses of testnet --- account_manager/src/validator/exit.rs | 10 +++++----- .../src/validator/slashing_protection.rs | 6 +++--- lighthouse/environment/src/lib.rs | 16 ++++++++-------- lighthouse/src/main.rs | 12 ++++++------ 4 files changed, 22 insertions(+), 22 deletions(-) diff --git a/account_manager/src/validator/exit.rs b/account_manager/src/validator/exit.rs index 738cbf16f0..221c31caf6 100644 --- a/account_manager/src/validator/exit.rs +++ b/account_manager/src/validator/exit.rs @@ -84,8 +84,8 @@ pub fn cli_run(matches: &ArgMatches, env: Environment) -> Result< Timeouts::set_all(Duration::from_secs(env.eth2_config.spec.seconds_per_slot)), ); - let testnet_config = env - .testnet + let eth2_network_config = env + .eth2_network_config .clone() .expect("network should have a valid config"); @@ -95,7 +95,7 @@ pub fn cli_run(matches: &ArgMatches, env: Environment) -> Result< &client, &spec, stdin_inputs, - &testnet_config, + ð2_network_config, no_wait, ))?; @@ -109,11 +109,11 @@ async fn publish_voluntary_exit( client: &BeaconNodeHttpClient, spec: &ChainSpec, stdin_inputs: bool, - testnet_config: &Eth2NetworkConfig, + eth2_network_config: &Eth2NetworkConfig, no_wait: bool, ) -> Result<(), String> { let genesis_data = get_geneisis_data(client).await?; - let testnet_genesis_root = testnet_config + let testnet_genesis_root = eth2_network_config .beacon_state::() .as_ref() .expect("network should have valid genesis state") diff --git a/account_manager/src/validator/slashing_protection.rs b/account_manager/src/validator/slashing_protection.rs index 67902b7d29..e56a70472c 100644 --- a/account_manager/src/validator/slashing_protection.rs +++ b/account_manager/src/validator/slashing_protection.rs @@ -82,11 +82,11 @@ pub fn cli_run( ) -> Result<(), String> { let slashing_protection_db_path = validator_base_dir.join(SLASHING_PROTECTION_FILENAME); - let testnet_config = env - .testnet + let eth2_network_config = env + .eth2_network_config .ok_or("Unable to get testnet configuration from the environment")?; - let genesis_validators_root = testnet_config + let genesis_validators_root = eth2_network_config .beacon_state::() .map(|state: BeaconState| state.genesis_validators_root()) .map_err(|e| { diff --git a/lighthouse/environment/src/lib.rs b/lighthouse/environment/src/lib.rs index b6d2424672..d44031981e 100644 --- a/lighthouse/environment/src/lib.rs +++ b/lighthouse/environment/src/lib.rs @@ -58,7 +58,7 @@ pub struct EnvironmentBuilder { log: Option, eth_spec_instance: E, eth2_config: Eth2Config, - testnet: Option, + eth2_network_config: Option, } impl EnvironmentBuilder { @@ -69,7 +69,7 @@ impl EnvironmentBuilder { log: None, eth_spec_instance: MinimalEthSpec, eth2_config: Eth2Config::minimal(), - testnet: None, + eth2_network_config: None, } } } @@ -82,7 +82,7 @@ impl EnvironmentBuilder { log: None, eth_spec_instance: MainnetEthSpec, eth2_config: Eth2Config::mainnet(), - testnet: None, + eth2_network_config: None, } } } @@ -210,19 +210,19 @@ impl EnvironmentBuilder { Ok(self) } - /// Adds a testnet configuration to the environment. + /// Adds a network configuration to the environment. pub fn eth2_network_config( mut self, eth2_network_config: Eth2NetworkConfig, ) -> Result { // Create a new chain spec from the default configuration. self.eth2_config.spec = eth2_network_config.chain_spec::()?; - self.testnet = Some(eth2_network_config); + self.eth2_network_config = Some(eth2_network_config); Ok(self) } - /// Optionally adds a testnet configuration to the environment. + /// Optionally adds a network configuration to the environment. pub fn optional_eth2_network_config( self, optional_config: Option, @@ -249,7 +249,7 @@ impl EnvironmentBuilder { log: self.log.ok_or("Cannot build environment without log")?, eth_spec_instance: self.eth_spec_instance, eth2_config: self.eth2_config, - testnet: self.testnet, + eth2_network_config: self.eth2_network_config, }) } } @@ -301,7 +301,7 @@ pub struct Environment { log: Logger, eth_spec_instance: E, pub eth2_config: Eth2Config, - pub testnet: Option, + pub eth2_network_config: Option, } impl Environment { diff --git a/lighthouse/src/main.rs b/lighthouse/src/main.rs index 31bfdff9d2..49a778e651 100644 --- a/lighthouse/src/main.rs +++ b/lighthouse/src/main.rs @@ -239,8 +239,8 @@ fn main() { Builder::from_env(Env::default()).init(); } - let result = get_eth2_network_config(&matches).and_then(|testnet_config| { - let eth_spec_id = testnet_config.eth_spec_id()?; + let result = get_eth2_network_config(&matches).and_then(|eth2_network_config| { + let eth_spec_id = eth2_network_config.eth_spec_id()?; // boot node subcommand circumvents the environment if let Some(bootnode_matches) = matches.subcommand_matches("boot_node") { @@ -256,9 +256,9 @@ fn main() { } match eth_spec_id { - EthSpecId::Mainnet => run(EnvironmentBuilder::mainnet(), &matches, testnet_config), + EthSpecId::Mainnet => run(EnvironmentBuilder::mainnet(), &matches, eth2_network_config), #[cfg(feature = "spec-minimal")] - EthSpecId::Minimal => run(EnvironmentBuilder::minimal(), &matches, testnet_config), + EthSpecId::Minimal => run(EnvironmentBuilder::minimal(), &matches, eth2_network_config), #[cfg(not(feature = "spec-minimal"))] other => { eprintln!( @@ -288,7 +288,7 @@ fn main() { fn run( environment_builder: EnvironmentBuilder, matches: &ArgMatches, - testnet_config: Eth2NetworkConfig, + eth2_network_config: Eth2NetworkConfig, ) -> Result<(), String> { if std::mem::size_of::() != 8 { return Err(format!( @@ -357,7 +357,7 @@ fn run( let mut environment = builder .multi_threaded_tokio_runtime()? - .optional_eth2_network_config(Some(testnet_config))? + .optional_eth2_network_config(Some(eth2_network_config))? .build()?; let log = environment.core_context().log().clone();