mirror of
https://github.com/sigp/lighthouse.git
synced 2026-04-27 01:33:33 +00:00
Merge unstable 20230911 into deneb-free-blobs.
This commit is contained in:
@@ -10,6 +10,7 @@ use eth2_keystore::Keystore;
|
||||
use eth2_network_config::Eth2NetworkConfig;
|
||||
use safe_arith::SafeArith;
|
||||
use sensitive_url::SensitiveUrl;
|
||||
use slog::Logger;
|
||||
use slot_clock::{SlotClock, SystemTimeSlotClock};
|
||||
use std::path::{Path, PathBuf};
|
||||
use std::time::Duration;
|
||||
@@ -78,6 +79,12 @@ pub fn cli_run<E: EthSpec>(matches: &ArgMatches, env: Environment<E>) -> Result<
|
||||
let password_file_path: Option<PathBuf> =
|
||||
clap_utils::parse_optional(matches, PASSWORD_FILE_FLAG)?;
|
||||
|
||||
let genesis_state_url: Option<String> =
|
||||
clap_utils::parse_optional(matches, "genesis-state-url")?;
|
||||
let genesis_state_url_timeout =
|
||||
clap_utils::parse_required(matches, "genesis-state-url-timeout")
|
||||
.map(Duration::from_secs)?;
|
||||
|
||||
let stdin_inputs = cfg!(windows) || matches.is_present(STDIN_INPUTS_FLAG);
|
||||
let no_wait = matches.is_present(NO_WAIT);
|
||||
let no_confirmation = matches.is_present(NO_CONFIRMATION);
|
||||
@@ -104,6 +111,9 @@ pub fn cli_run<E: EthSpec>(matches: &ArgMatches, env: Environment<E>) -> Result<
|
||||
ð2_network_config,
|
||||
no_wait,
|
||||
no_confirmation,
|
||||
genesis_state_url,
|
||||
genesis_state_url_timeout,
|
||||
env.core_context().log(),
|
||||
))?;
|
||||
|
||||
Ok(())
|
||||
@@ -120,13 +130,14 @@ async fn publish_voluntary_exit<E: EthSpec>(
|
||||
eth2_network_config: &Eth2NetworkConfig,
|
||||
no_wait: bool,
|
||||
no_confirmation: bool,
|
||||
genesis_state_url: Option<String>,
|
||||
genesis_state_url_timeout: Duration,
|
||||
log: &Logger,
|
||||
) -> Result<(), String> {
|
||||
let genesis_data = get_geneisis_data(client).await?;
|
||||
let testnet_genesis_root = eth2_network_config
|
||||
.beacon_state::<E>()
|
||||
.as_ref()
|
||||
.expect("network should have valid genesis state")
|
||||
.genesis_validators_root();
|
||||
.genesis_validators_root::<E>(genesis_state_url.as_deref(), genesis_state_url_timeout, log)?
|
||||
.ok_or("Genesis state is unknown")?;
|
||||
|
||||
// Verify that the beacon node and validator being exited are on the same network.
|
||||
if genesis_data.genesis_validators_root != testnet_genesis_root {
|
||||
|
||||
@@ -7,7 +7,8 @@ use slashing_protection::{
|
||||
use std::fs::File;
|
||||
use std::path::PathBuf;
|
||||
use std::str::FromStr;
|
||||
use types::{BeaconState, Epoch, EthSpec, PublicKeyBytes, Slot};
|
||||
use std::time::Duration;
|
||||
use types::{Epoch, EthSpec, PublicKeyBytes, Slot};
|
||||
|
||||
pub const CMD: &str = "slashing-protection";
|
||||
pub const IMPORT_CMD: &str = "import";
|
||||
@@ -82,19 +83,24 @@ pub fn cli_run<T: EthSpec>(
|
||||
) -> Result<(), String> {
|
||||
let slashing_protection_db_path = validator_base_dir.join(SLASHING_PROTECTION_FILENAME);
|
||||
|
||||
let genesis_state_url: Option<String> =
|
||||
clap_utils::parse_optional(matches, "genesis-state-url")?;
|
||||
let genesis_state_url_timeout =
|
||||
clap_utils::parse_required(matches, "genesis-state-url-timeout")
|
||||
.map(Duration::from_secs)?;
|
||||
|
||||
let context = env.core_context();
|
||||
let eth2_network_config = env
|
||||
.eth2_network_config
|
||||
.ok_or("Unable to get testnet configuration from the environment")?;
|
||||
|
||||
let genesis_validators_root = eth2_network_config
|
||||
.beacon_state::<T>()
|
||||
.map(|state: BeaconState<T>| state.genesis_validators_root())
|
||||
.map_err(|e| {
|
||||
format!(
|
||||
"Unable to get genesis state, has genesis occurred? Detail: {:?}",
|
||||
e
|
||||
)
|
||||
})?;
|
||||
.genesis_validators_root::<T>(
|
||||
genesis_state_url.as_deref(),
|
||||
genesis_state_url_timeout,
|
||||
context.log(),
|
||||
)?
|
||||
.ok_or_else(|| "Unable to get genesis state, has genesis occurred?".to_string())?;
|
||||
|
||||
match matches.subcommand() {
|
||||
(IMPORT_CMD, Some(matches)) => {
|
||||
|
||||
Reference in New Issue
Block a user