From aaa14073ff5b8518ef7f5c6def04ed0c4e8a31dc Mon Sep 17 00:00:00 2001 From: Age Manning Date: Mon, 12 Apr 2021 00:57:43 +0000 Subject: [PATCH] Clean up warnings (#2240) This is a small PR that cleans up compiler warnings. The most controversial change is removing the `data_dir` field from the `BeaconChainBuilder`. It was removed because it was never read. Co-authored-by: Paul Hauner Co-authored-by: Herman Junge Co-authored-by: Michael Sproul --- beacon_node/beacon_chain/src/builder.rs | 14 -------------- beacon_node/beacon_chain/src/test_utils.rs | 3 --- beacon_node/client/src/builder.rs | 2 -- .../network/src/attestation_service/tests/mod.rs | 3 --- 4 files changed, 22 deletions(-) diff --git a/beacon_node/beacon_chain/src/builder.rs b/beacon_node/beacon_chain/src/builder.rs index 238db2b89..63d2918b5 100644 --- a/beacon_node/beacon_chain/src/builder.rs +++ b/beacon_node/beacon_chain/src/builder.rs @@ -22,7 +22,6 @@ use slasher::Slasher; use slog::{crit, info, Logger}; use slot_clock::{SlotClock, TestingSlotClock}; use std::marker::PhantomData; -use std::path::PathBuf; use std::sync::Arc; use std::time::Duration; use store::{HotColdDB, ItemStore}; @@ -78,7 +77,6 @@ pub struct BeaconChainBuilder { slot_clock: Option, shutdown_sender: Option>, head_tracker: Option, - data_dir: Option, validator_pubkey_cache: Option>, spec: ChainSpec, chain_config: ChainConfig, @@ -116,7 +114,6 @@ where slot_clock: None, shutdown_sender: None, head_tracker: None, - data_dir: None, disabled_forks: Vec::new(), validator_pubkey_cache: None, spec: TEthSpec::default_spec(), @@ -174,14 +171,6 @@ where self } - /// Sets the location to the pubkey cache file. - /// - /// Should generally be called early in the build chain. - pub fn data_dir(mut self, path: PathBuf) -> Self { - self.data_dir = Some(path); - self - } - /// Sets a list of hard-coded forks that will not be activated. pub fn disabled_forks(mut self, disabled_forks: Vec) -> Self { self.disabled_forks = disabled_forks; @@ -673,7 +662,6 @@ mod test { use std::time::Duration; use store::config::StoreConfig; use store::{HotColdDB, MemoryStore}; - use tempfile::tempdir; use types::{EthSpec, MinimalEthSpec, Slot}; type TestEthSpec = MinimalEthSpec; @@ -696,7 +684,6 @@ mod test { > = HotColdDB::open_ephemeral(StoreConfig::default(), ChainSpec::minimal(), log.clone()) .unwrap(); let spec = MinimalEthSpec::default_spec(); - let data_dir = tempdir().expect("should create temporary data_dir"); let genesis_state = interop_genesis_state( &generate_deterministic_keypairs(validator_count), @@ -710,7 +697,6 @@ mod test { let chain = BeaconChainBuilder::new(MinimalEthSpec) .logger(log.clone()) .store(Arc::new(store)) - .data_dir(data_dir.path().to_path_buf()) .genesis_state(genesis_state) .expect("should build state using recent genesis") .dummy_eth1_backend() diff --git a/beacon_node/beacon_chain/src/test_utils.rs b/beacon_node/beacon_chain/src/test_utils.rs index 9c6b3079a..c1b1ed75e 100644 --- a/beacon_node/beacon_chain/src/test_utils.rs +++ b/beacon_node/beacon_chain/src/test_utils.rs @@ -186,7 +186,6 @@ impl BeaconChainHarness> { .custom_spec(spec.clone()) .store(Arc::new(store)) .store_migrator_config(MigratorConfig::default().blocking()) - .data_dir(data_dir.path().to_path_buf()) .genesis_state( interop_genesis_state::(&validator_keypairs, HARNESS_GENESIS_TIME, &spec) .expect("should generate interop state"), @@ -236,7 +235,6 @@ impl BeaconChainHarness> { .import_max_skip_slots(None) .store(store) .store_migrator_config(MigratorConfig::default().blocking()) - .data_dir(data_dir.path().to_path_buf()) .genesis_state( interop_genesis_state::(&validator_keypairs, HARNESS_GENESIS_TIME, &spec) .expect("should generate interop state"), @@ -281,7 +279,6 @@ impl BeaconChainHarness> { .import_max_skip_slots(None) .store(store) .store_migrator_config(MigratorConfig::default().blocking()) - .data_dir(data_dir.path().to_path_buf()) .resume_from_db() .expect("should resume beacon chain from db") .dummy_eth1_backend() diff --git a/beacon_node/client/src/builder.rs b/beacon_node/client/src/builder.rs index a80fde403..8ba7a0c34 100644 --- a/beacon_node/client/src/builder.rs +++ b/beacon_node/client/src/builder.rs @@ -122,7 +122,6 @@ where let chain_spec = self.chain_spec.clone(); let runtime_context = self.runtime_context.clone(); let eth_spec_instance = self.eth_spec_instance.clone(); - let data_dir = config.data_dir.clone(); let disabled_forks = config.disabled_forks.clone(); let chain_config = config.chain.clone(); let graffiti = config.graffiti; @@ -141,7 +140,6 @@ where let builder = BeaconChainBuilder::new(eth_spec_instance) .logger(context.log().clone()) .store(store) - .data_dir(data_dir) .custom_spec(spec.clone()) .chain_config(chain_config) .disabled_forks(disabled_forks) diff --git a/beacon_node/network/src/attestation_service/tests/mod.rs b/beacon_node/network/src/attestation_service/tests/mod.rs index 4a625e0ec..de094e15f 100644 --- a/beacon_node/network/src/attestation_service/tests/mod.rs +++ b/beacon_node/network/src/attestation_service/tests/mod.rs @@ -13,7 +13,6 @@ use slot_clock::{SlotClock, SystemTimeSlotClock}; use std::time::{Duration, SystemTime}; use store::config::StoreConfig; use store::{HotColdDB, MemoryStore}; -use tempfile::tempdir; use types::{CommitteeIndex, EthSpec, MinimalEthSpec}; const SLOT_DURATION_MILLIS: u64 = 400; @@ -32,7 +31,6 @@ pub struct TestBeaconChain { impl TestBeaconChain { pub fn new_with_system_clock() -> Self { - let data_dir = tempdir().expect("should create temporary data_dir"); let spec = MinimalEthSpec::default_spec(); let keypairs = generate_deterministic_keypairs(1); @@ -48,7 +46,6 @@ impl TestBeaconChain { .logger(log.clone()) .custom_spec(spec.clone()) .store(Arc::new(store)) - .data_dir(data_dir.path().to_path_buf()) .genesis_state( interop_genesis_state::(&keypairs, 0, &spec) .expect("should generate interop state"),