mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-20 21:34:46 +00:00
Use E for EthSpec globally (#5264)
* Use `E` for `EthSpec` globally * Fix tests * Merge branch 'unstable' into e-ethspec * Merge branch 'unstable' into e-ethspec # Conflicts: # beacon_node/execution_layer/src/engine_api.rs # beacon_node/execution_layer/src/engine_api/http.rs # beacon_node/execution_layer/src/engine_api/json_structures.rs # beacon_node/execution_layer/src/test_utils/handle_rpc.rs # beacon_node/store/src/partial_beacon_state.rs # consensus/types/src/beacon_block.rs # consensus/types/src/beacon_block_body.rs # consensus/types/src/beacon_state.rs # consensus/types/src/config_and_preset.rs # consensus/types/src/execution_payload.rs # consensus/types/src/execution_payload_header.rs # consensus/types/src/light_client_optimistic_update.rs # consensus/types/src/payload.rs # lcli/src/parse_ssz.rs
This commit is contained in:
@@ -14,16 +14,16 @@ use std::{marker::PhantomData, path::PathBuf};
|
||||
use types::EthSpec;
|
||||
|
||||
/// A set of configuration parameters for the bootnode, established from CLI arguments.
|
||||
pub struct BootNodeConfig<T: EthSpec> {
|
||||
pub struct BootNodeConfig<E: EthSpec> {
|
||||
// TODO: Generalise to multiaddr
|
||||
pub boot_nodes: Vec<Enr>,
|
||||
pub local_enr: Enr,
|
||||
pub local_key: CombinedKey,
|
||||
pub discv5_config: discv5::Config,
|
||||
phantom: PhantomData<T>,
|
||||
phantom: PhantomData<E>,
|
||||
}
|
||||
|
||||
impl<T: EthSpec> BootNodeConfig<T> {
|
||||
impl<E: EthSpec> BootNodeConfig<E> {
|
||||
pub async fn new(
|
||||
matches: &ArgMatches<'_>,
|
||||
eth2_network_config: &Eth2NetworkConfig,
|
||||
@@ -94,7 +94,7 @@ impl<T: EthSpec> BootNodeConfig<T> {
|
||||
} else {
|
||||
// build the enr_fork_id and add it to the local_enr if it exists
|
||||
let enr_fork = {
|
||||
let spec = eth2_network_config.chain_spec::<T>()?;
|
||||
let spec = eth2_network_config.chain_spec::<E>()?;
|
||||
|
||||
let genesis_state_url: Option<String> =
|
||||
clap_utils::parse_optional(matches, "genesis-state-url")?;
|
||||
@@ -104,14 +104,14 @@ impl<T: EthSpec> BootNodeConfig<T> {
|
||||
|
||||
if eth2_network_config.genesis_state_is_known() {
|
||||
let genesis_state = eth2_network_config
|
||||
.genesis_state::<T>(genesis_state_url.as_deref(), genesis_state_url_timeout, &logger).await?
|
||||
.genesis_state::<E>(genesis_state_url.as_deref(), genesis_state_url_timeout, &logger).await?
|
||||
.ok_or_else(|| {
|
||||
"The genesis state for this network is not known, this is an unsupported mode"
|
||||
.to_string()
|
||||
})?;
|
||||
|
||||
slog::info!(logger, "Genesis state found"; "root" => genesis_state.canonical_root().to_string());
|
||||
let enr_fork = spec.enr_fork_id::<T>(
|
||||
let enr_fork = spec.enr_fork_id::<E>(
|
||||
types::Slot::from(0u64),
|
||||
genesis_state.genesis_validators_root(),
|
||||
);
|
||||
@@ -188,7 +188,7 @@ pub struct BootNodeConfigSerialization {
|
||||
impl BootNodeConfigSerialization {
|
||||
/// Returns a `BootNodeConfigSerialization` obtained from copying resp. cloning the
|
||||
/// relevant fields of `config`
|
||||
pub fn from_config_ref<T: EthSpec>(config: &BootNodeConfig<T>) -> Self {
|
||||
pub fn from_config_ref<E: EthSpec>(config: &BootNodeConfig<E>) -> Self {
|
||||
let BootNodeConfig {
|
||||
boot_nodes,
|
||||
local_enr,
|
||||
|
||||
Reference in New Issue
Block a user