Ensure difficulty/hash/epoch overrides change the ChainSpec (#2798)

* Unify loading of eth2_network_config

* Apply overrides at lighthouse binary level

* Remove duplicate override values

* Add merge values to existing net configs

* Make override flags global

* Add merge fields to testing config

* Add one to TTD

* Fix failing engine tests

* Fix test compile error

* Remove TTD flags

* Move get_eth2_network_config

* Fix warn

* Address review comments
This commit is contained in:
Paul Hauner
2021-11-16 11:46:12 +11:00
parent 47db682d7e
commit afe59afacd
25 changed files with 391 additions and 267 deletions

View File

@@ -1,5 +1,6 @@
use beacon_node::{get_data_dir, get_eth2_network_config, set_network_config};
use beacon_node::{get_data_dir, set_network_config};
use clap::ArgMatches;
use eth2_network_config::Eth2NetworkConfig;
use lighthouse_network::discv5::{enr::CombinedKey, Discv5Config, Enr};
use lighthouse_network::{
discovery::{create_enr_builder_from_config, load_enr_from_disk, use_or_load_enr},
@@ -7,7 +8,6 @@ use lighthouse_network::{
};
use serde_derive::{Deserialize, Serialize};
use ssz::Encode;
use std::convert::TryFrom;
use std::net::SocketAddr;
use std::{marker::PhantomData, path::PathBuf};
use types::EthSpec;
@@ -23,15 +23,13 @@ pub struct BootNodeConfig<T: EthSpec> {
phantom: PhantomData<T>,
}
impl<T: EthSpec> TryFrom<&ArgMatches<'_>> for BootNodeConfig<T> {
type Error = String;
fn try_from(matches: &ArgMatches<'_>) -> Result<Self, Self::Error> {
impl<T: EthSpec> BootNodeConfig<T> {
pub fn new(
matches: &ArgMatches<'_>,
eth2_network_config: &Eth2NetworkConfig,
) -> Result<Self, String> {
let data_dir = get_data_dir(matches);
// Try and grab network config from input CLI params
let eth2_network_config = get_eth2_network_config(matches)?;
// Try and obtain bootnodes
let boot_nodes = {