mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-14 18:32:42 +00:00
Add state-root command and network support to lcli (#4492)
## Proposed Changes * Add `lcli state-root` command for computing the hash tree root of a `BeaconState`. * Add a `--network` flag which can be used instead of `--testnet-dir` to set the network, e.g. Mainnet, Goerli, Gnosis. * Use the new network flag in `transition-blocks`, `skip-slots`, and `block-root`, which previously only supported mainnet. * **BREAKING CHANGE** Remove the default value of `~/.lighthouse/testnet` from `--testnet-dir`. This may have made sense in previous versions where `lcli` was more testnet focussed, but IMO it is an unnecessary complication and foot-gun today.
This commit is contained in:
@@ -49,6 +49,7 @@ use clap::ArgMatches;
|
||||
use clap_utils::{parse_optional, parse_required};
|
||||
use environment::Environment;
|
||||
use eth2::{types::StateId, BeaconNodeHttpClient, SensitiveUrl, Timeouts};
|
||||
use eth2_network_config::Eth2NetworkConfig;
|
||||
use ssz::Encode;
|
||||
use state_processing::state_advance::{complete_state_advance, partial_state_advance};
|
||||
use std::fs::File;
|
||||
@@ -59,8 +60,12 @@ use types::{BeaconState, CloneConfig, EthSpec, Hash256};
|
||||
|
||||
const HTTP_TIMEOUT: Duration = Duration::from_secs(10);
|
||||
|
||||
pub fn run<T: EthSpec>(env: Environment<T>, matches: &ArgMatches) -> Result<(), String> {
|
||||
let spec = &T::default_spec();
|
||||
pub fn run<T: EthSpec>(
|
||||
env: Environment<T>,
|
||||
network_config: Eth2NetworkConfig,
|
||||
matches: &ArgMatches,
|
||||
) -> Result<(), String> {
|
||||
let spec = &network_config.chain_spec::<T>()?;
|
||||
let executor = env.core_context().executor;
|
||||
|
||||
let output_path: Option<PathBuf> = parse_optional(matches, "output-path")?;
|
||||
|
||||
Reference in New Issue
Block a user