Unify EthSpecs in Mainnet and Minimal

This commit is contained in:
Paul Hauner
2019-06-08 08:49:04 -04:00
parent caddeba81b
commit 749f2fcb5f
27 changed files with 119 additions and 186 deletions

View File

@@ -183,7 +183,7 @@ mod tests {
pub fn polling() {
let mut rng = XorShiftRng::from_seed([42; 16]);
let spec = Arc::new(ChainSpec::foundation());
let spec = Arc::new(ChainSpec::mainnet());
let slot_clock = Arc::new(TestingSlotClock::new(0));
let beacon_node = Arc::new(SimulatedBeaconNode::default());
let signer = Arc::new(LocalSigner::new(Keypair::random()));

View File

@@ -6,9 +6,7 @@ use std::fs;
use std::fs::File;
use std::io::{Error, ErrorKind};
use std::path::PathBuf;
use types::{
ChainSpec, EthSpec, FewValidatorsEthSpec, FoundationEthSpec, LighthouseTestnetEthSpec,
};
use types::{ChainSpec, EthSpec, MainnetEthSpec, MinimalEthSpec};
/// Stores the core configuration for this validator instance.
#[derive(Clone)]
@@ -34,13 +32,13 @@ impl Default for Config {
let server = "localhost:5051".to_string();
let spec = FoundationEthSpec::default_spec();
let spec = MainnetEthSpec::default_spec();
Self {
data_dir,
server,
spec,
slots_per_epoch: FoundationEthSpec::slots_per_epoch(),
slots_per_epoch: MainnetEthSpec::slots_per_epoch(),
}
}
}
@@ -69,9 +67,8 @@ impl Config {
if let Some(spec_str) = args.value_of("spec") {
info!(log, "Using custom spec: {:?}", spec_str);
config.spec = match spec_str {
"foundation" => FoundationEthSpec::default_spec(),
"few_validators" => FewValidatorsEthSpec::default_spec(),
"lighthouse_testnet" => LighthouseTestnetEthSpec::default_spec(),
"mainnet" => MainnetEthSpec::default_spec(),
"minimal" => MinimalEthSpec::default_spec(),
// Should be impossible due to clap's `possible_values(..)` function.
_ => unreachable!(),
};

View File

@@ -163,7 +163,7 @@ mod tests {
#[test]
pub fn polling() {
let spec = Arc::new(ChainSpec::foundation());
let spec = Arc::new(ChainSpec::mainnet());
let duties_map = Arc::new(EpochDutiesMap::new(T::slots_per_epoch()));
let keypair = Keypair::random();
let slot_clock = Arc::new(TestingSlotClock::new(0));

View File

@@ -46,8 +46,8 @@ fn main() {
.short("s")
.help("Configuration of Beacon Chain")
.takes_value(true)
.possible_values(&["foundation", "few_validators", "lighthouse_testnet"])
.default_value("lighthouse_testnet"),
.possible_values(&["mainnet", "minimal"])
.default_value("minimal"),
)
.get_matches();