mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-06 10:11:44 +00:00
Improve single-node testnet support and Arc NetworkConfig/ChainSpec (#6396)
* Arc ChainSpec and NetworkConfig * Fix release tests * Fix lint * Merge remote-tracking branch 'origin/unstable' into single-node-testnet
This commit is contained in:
@@ -103,7 +103,7 @@ pub fn run<E: EthSpec>(
|
||||
network_config: Eth2NetworkConfig,
|
||||
matches: &ArgMatches,
|
||||
) -> Result<(), String> {
|
||||
let spec = &network_config.chain_spec::<E>()?;
|
||||
let spec = Arc::new(network_config.chain_spec::<E>()?);
|
||||
let executor = env.core_context().executor;
|
||||
|
||||
/*
|
||||
@@ -137,13 +137,15 @@ pub fn run<E: EthSpec>(
|
||||
(Some(pre_state_path), Some(block_path), None) => {
|
||||
info!("Block path: {:?}", block_path);
|
||||
info!("Pre-state path: {:?}", pre_state_path);
|
||||
let pre_state = load_from_ssz_with(&pre_state_path, spec, BeaconState::from_ssz_bytes)?;
|
||||
let block = load_from_ssz_with(&block_path, spec, SignedBeaconBlock::from_ssz_bytes)?;
|
||||
let pre_state =
|
||||
load_from_ssz_with(&pre_state_path, &spec, BeaconState::from_ssz_bytes)?;
|
||||
let block = load_from_ssz_with(&block_path, &spec, SignedBeaconBlock::from_ssz_bytes)?;
|
||||
(pre_state, None, block)
|
||||
}
|
||||
(None, None, Some(beacon_url)) => {
|
||||
let block_id: BlockId = parse_required(matches, "block-id")?;
|
||||
let client = BeaconNodeHttpClient::new(beacon_url, Timeouts::set_all(HTTP_TIMEOUT));
|
||||
let inner_spec = spec.clone();
|
||||
executor
|
||||
.handle()
|
||||
.ok_or("shutdown in progress")?
|
||||
@@ -155,7 +157,7 @@ pub fn run<E: EthSpec>(
|
||||
.ok_or_else(|| format!("Unable to locate block at {:?}", block_id))?
|
||||
.data;
|
||||
|
||||
if block.slot() == spec.genesis_slot {
|
||||
if block.slot() == inner_spec.genesis_slot {
|
||||
return Err("Cannot run on the genesis block".to_string());
|
||||
}
|
||||
|
||||
@@ -215,7 +217,7 @@ pub fn run<E: EthSpec>(
|
||||
|
||||
if config.exclude_cache_builds {
|
||||
pre_state
|
||||
.build_all_caches(spec)
|
||||
.build_all_caches(&spec)
|
||||
.map_err(|e| format!("Unable to build caches: {:?}", e))?;
|
||||
let state_root = pre_state
|
||||
.update_tree_hash_cache()
|
||||
@@ -251,7 +253,7 @@ pub fn run<E: EthSpec>(
|
||||
&config,
|
||||
&validator_pubkey_cache,
|
||||
&mut saved_ctxt,
|
||||
spec,
|
||||
&spec,
|
||||
)?;
|
||||
|
||||
let duration = Instant::now().duration_since(start);
|
||||
|
||||
Reference in New Issue
Block a user