Remove old uses of testnet
This commit is contained in:
parent
24966c059d
commit
eb35c64afd
@ -84,8 +84,8 @@ pub fn cli_run<E: EthSpec>(matches: &ArgMatches, env: Environment<E>) -> 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<E: EthSpec>(matches: &ArgMatches, env: Environment<E>) -> Result<
|
||||
&client,
|
||||
&spec,
|
||||
stdin_inputs,
|
||||
&testnet_config,
|
||||
ð2_network_config,
|
||||
no_wait,
|
||||
))?;
|
||||
|
||||
@ -109,11 +109,11 @@ async fn publish_voluntary_exit<E: EthSpec>(
|
||||
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::<E>()
|
||||
.as_ref()
|
||||
.expect("network should have valid genesis state")
|
||||
|
@ -82,11 +82,11 @@ pub fn cli_run<T: EthSpec>(
|
||||
) -> 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::<T>()
|
||||
.map(|state: BeaconState<T>| state.genesis_validators_root())
|
||||
.map_err(|e| {
|
||||
|
@ -58,7 +58,7 @@ pub struct EnvironmentBuilder<E: EthSpec> {
|
||||
log: Option<Logger>,
|
||||
eth_spec_instance: E,
|
||||
eth2_config: Eth2Config,
|
||||
testnet: Option<Eth2NetworkConfig>,
|
||||
eth2_network_config: Option<Eth2NetworkConfig>,
|
||||
}
|
||||
|
||||
impl EnvironmentBuilder<MinimalEthSpec> {
|
||||
@ -69,7 +69,7 @@ impl EnvironmentBuilder<MinimalEthSpec> {
|
||||
log: None,
|
||||
eth_spec_instance: MinimalEthSpec,
|
||||
eth2_config: Eth2Config::minimal(),
|
||||
testnet: None,
|
||||
eth2_network_config: None,
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -82,7 +82,7 @@ impl EnvironmentBuilder<MainnetEthSpec> {
|
||||
log: None,
|
||||
eth_spec_instance: MainnetEthSpec,
|
||||
eth2_config: Eth2Config::mainnet(),
|
||||
testnet: None,
|
||||
eth2_network_config: None,
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -210,19 +210,19 @@ impl<E: EthSpec> EnvironmentBuilder<E> {
|
||||
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<Self, String> {
|
||||
// Create a new chain spec from the default configuration.
|
||||
self.eth2_config.spec = eth2_network_config.chain_spec::<E>()?;
|
||||
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<Eth2NetworkConfig>,
|
||||
@ -249,7 +249,7 @@ impl<E: EthSpec> EnvironmentBuilder<E> {
|
||||
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<E: EthSpec> {
|
||||
log: Logger,
|
||||
eth_spec_instance: E,
|
||||
pub eth2_config: Eth2Config,
|
||||
pub testnet: Option<Eth2NetworkConfig>,
|
||||
pub eth2_network_config: Option<Eth2NetworkConfig>,
|
||||
}
|
||||
|
||||
impl<E: EthSpec> Environment<E> {
|
||||
|
@ -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<E: EthSpec>(
|
||||
environment_builder: EnvironmentBuilder<E>,
|
||||
matches: &ArgMatches,
|
||||
testnet_config: Eth2NetworkConfig,
|
||||
eth2_network_config: Eth2NetworkConfig,
|
||||
) -> Result<(), String> {
|
||||
if std::mem::size_of::<usize>() != 8 {
|
||||
return Err(format!(
|
||||
@ -357,7 +357,7 @@ fn run<E: EthSpec>(
|
||||
|
||||
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();
|
||||
|
Loading…
Reference in New Issue
Block a user