mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-15 02:42:38 +00:00
Rename Eth2TestnetDir to Eth2TestnetConfig
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
use clap::ArgMatches;
|
||||
use environment::Environment;
|
||||
use eth1_test_rig::DepositContract;
|
||||
use eth2_testnet::Eth2TestnetDir;
|
||||
use eth2_testnet_config::Eth2TestnetConfig;
|
||||
use std::fs::File;
|
||||
use std::io::Read;
|
||||
use std::path::PathBuf;
|
||||
@@ -91,7 +91,7 @@ pub fn run<T: EthSpec>(mut env: Environment<T>, matches: &ArgMatches) -> Result<
|
||||
let mut spec = lighthouse_testnet_spec(env.core_context().eth2_config.spec.clone());
|
||||
spec.min_genesis_time = min_genesis_time;
|
||||
|
||||
let testnet_dir: Eth2TestnetDir<T> = Eth2TestnetDir {
|
||||
let testnet_config: Eth2TestnetConfig<T> = Eth2TestnetConfig {
|
||||
deposit_contract_address: format!("{}", deposit_contract.address()),
|
||||
deposit_contract_deploy_block: deploy_block.as_u64(),
|
||||
boot_enr: None,
|
||||
@@ -99,7 +99,7 @@ pub fn run<T: EthSpec>(mut env: Environment<T>, matches: &ArgMatches) -> Result<
|
||||
yaml_config: Some(YamlConfig::from_spec::<T>(&spec)),
|
||||
};
|
||||
|
||||
testnet_dir.write_to_file(output_dir)?;
|
||||
testnet_config.write_to_file(output_dir)?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
use clap::ArgMatches;
|
||||
use environment::Environment;
|
||||
use eth2_testnet::Eth2TestnetDir;
|
||||
use eth2_testnet_config::Eth2TestnetConfig;
|
||||
use futures::Future;
|
||||
use genesis::{Eth1Config, Eth1GenesisService};
|
||||
use std::path::PathBuf;
|
||||
@@ -25,9 +25,10 @@ pub fn run<T: EthSpec>(mut env: Environment<T>, matches: &ArgMatches) -> Result<
|
||||
.expect("should locate home directory")
|
||||
});
|
||||
|
||||
let mut eth2_testnet_dir: Eth2TestnetDir<T> = Eth2TestnetDir::load(testnet_dir.clone())?;
|
||||
let mut eth2_testnet_config: Eth2TestnetConfig<T> =
|
||||
Eth2TestnetConfig::load(testnet_dir.clone())?;
|
||||
|
||||
let spec = eth2_testnet_dir
|
||||
let spec = eth2_testnet_config
|
||||
.yaml_config
|
||||
.as_ref()
|
||||
.ok_or_else(|| "The testnet directory must contain a spec config".to_string())?
|
||||
@@ -41,9 +42,9 @@ pub fn run<T: EthSpec>(mut env: Environment<T>, matches: &ArgMatches) -> Result<
|
||||
|
||||
let mut config = Eth1Config::default();
|
||||
config.endpoint = endpoint.to_string();
|
||||
config.deposit_contract_address = eth2_testnet_dir.deposit_contract_address.clone();
|
||||
config.deposit_contract_deploy_block = eth2_testnet_dir.deposit_contract_deploy_block;
|
||||
config.lowest_cached_block_number = eth2_testnet_dir.deposit_contract_deploy_block;
|
||||
config.deposit_contract_address = eth2_testnet_config.deposit_contract_address.clone();
|
||||
config.deposit_contract_deploy_block = eth2_testnet_config.deposit_contract_deploy_block;
|
||||
config.lowest_cached_block_number = eth2_testnet_config.deposit_contract_deploy_block;
|
||||
config.follow_distance = spec.eth1_follow_distance / 2;
|
||||
|
||||
let genesis_service = Eth1GenesisService::new(config, env.core_context().log.clone());
|
||||
@@ -51,8 +52,8 @@ pub fn run<T: EthSpec>(mut env: Environment<T>, matches: &ArgMatches) -> Result<
|
||||
let future = genesis_service
|
||||
.wait_for_genesis_state(ETH1_GENESIS_UPDATE_INTERVAL, spec)
|
||||
.map(move |genesis_state| {
|
||||
eth2_testnet_dir.genesis_state = Some(genesis_state);
|
||||
eth2_testnet_dir.force_write_to_file(testnet_dir)
|
||||
eth2_testnet_config.genesis_state = Some(genesis_state);
|
||||
eth2_testnet_config.force_write_to_file(testnet_dir)
|
||||
});
|
||||
|
||||
info!("Starting service to produce genesis BeaconState from eth1");
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
use crate::deploy_deposit_contract::parse_password;
|
||||
use clap::ArgMatches;
|
||||
use environment::Environment;
|
||||
use eth2_testnet::Eth2TestnetDir;
|
||||
use eth2_testnet_config::Eth2TestnetConfig;
|
||||
use futures::{future, Future};
|
||||
use std::path::PathBuf;
|
||||
use types::EthSpec;
|
||||
@@ -37,7 +37,7 @@ pub fn run<T: EthSpec>(mut env: Environment<T>, matches: &ArgMatches) -> Result<
|
||||
.expect("should locate home directory")
|
||||
});
|
||||
|
||||
let eth2_testnet_dir: Eth2TestnetDir<T> = Eth2TestnetDir::load(testnet_dir)?;
|
||||
let eth2_testnet_config: Eth2TestnetConfig<T> = Eth2TestnetConfig::load(testnet_dir)?;
|
||||
|
||||
let (_event_loop, transport) = Http::new(&endpoint).map_err(|e| {
|
||||
format!(
|
||||
@@ -51,7 +51,7 @@ pub fn run<T: EthSpec>(mut env: Environment<T>, matches: &ArgMatches) -> Result<
|
||||
|
||||
// Convert from `types::Address` to `web3::types::Address`.
|
||||
let deposit_contract = Address::from_slice(
|
||||
eth2_testnet_dir
|
||||
eth2_testnet_config
|
||||
.deposit_contract_address()?
|
||||
.as_fixed_bytes(),
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user