Resolve merge conflicts

This commit is contained in:
Eitan Seri-Levi
2026-01-02 08:52:14 -06:00
918 changed files with 49304 additions and 37273 deletions

View File

@@ -30,7 +30,7 @@ use crate::transition_blocks::load_from_ssz_with;
use clap::ArgMatches;
use clap_utils::{parse_optional, parse_required};
use environment::Environment;
use eth2::{types::BlockId, BeaconNodeHttpClient, SensitiveUrl, Timeouts};
use eth2::{BeaconNodeHttpClient, SensitiveUrl, Timeouts, types::BlockId};
use eth2_network_config::Eth2NetworkConfig;
use std::path::PathBuf;
use std::time::{Duration, Instant};

View File

@@ -1,6 +1,6 @@
use clap::ArgMatches;
use clap_utils::{parse_required, parse_ssz_required};
use deposit_contract::{decode_eth1_tx_data, DEPOSIT_DATA_LEN};
use deposit_contract::{DEPOSIT_DATA_LEN, decode_eth1_tx_data};
use tree_hash::TreeHash;
pub fn run(matches: &ArgMatches) -> Result<(), String> {

View File

@@ -1,14 +1,16 @@
use clap::ArgMatches;
use fixed_bytes::FixedBytesExtended;
use lighthouse_network::{
discovery::{build_enr, CombinedKey, CombinedKeyExt, ENR_FILENAME},
NETWORK_KEY_FILENAME, NetworkConfig,
discovery::{CombinedKey, ENR_FILENAME, build_enr},
libp2p::identity::secp256k1,
NetworkConfig, NETWORK_KEY_FILENAME,
};
use network_utils::enr_ext::CombinedKeyExt;
use std::io::Write;
use std::path::PathBuf;
use std::{fs, net::Ipv4Addr};
use std::{fs::File, num::NonZeroU16};
use types::{ChainSpec, EnrForkId, Epoch, EthSpec, FixedBytesExtended, Hash256};
use types::{ChainSpec, EnrForkId, Epoch, EthSpec, Hash256};
pub fn run<E: EthSpec>(matches: &ArgMatches, spec: &ChainSpec) -> Result<(), String> {
let ip: Ipv4Addr = clap_utils::parse_required(matches, "ip")?;
@@ -32,13 +34,21 @@ pub fn run<E: EthSpec>(matches: &ArgMatches, spec: &ChainSpec) -> Result<(), Str
let secp256k1_keypair = secp256k1::Keypair::generate();
let enr_key = CombinedKey::from_secp256k1(&secp256k1_keypair);
let genesis_fork_digest = spec.compute_fork_digest(Hash256::zero(), Epoch::new(0));
let enr_fork_id = EnrForkId {
fork_digest: ChainSpec::compute_fork_digest(genesis_fork_version, Hash256::zero()),
fork_digest: genesis_fork_digest,
next_fork_version: genesis_fork_version,
next_fork_epoch: Epoch::max_value(), // FAR_FUTURE_EPOCH
};
let enr = build_enr::<E>(&enr_key, &config, &enr_fork_id, spec)
.map_err(|e| format!("Unable to create ENR: {:?}", e))?;
let enr = build_enr::<E>(
&enr_key,
&config,
&enr_fork_id,
spec.custody_requirement,
genesis_fork_digest,
spec,
)
.map_err(|e| format!("Unable to create ENR: {:?}", e))?;
fs::create_dir_all(&output_dir).map_err(|e| format!("Unable to create output-dir: {:?}", e))?;

View File

@@ -2,8 +2,8 @@ use clap::ArgMatches;
use clap_utils::{parse_optional, parse_required};
use environment::Environment;
use eth2::{
types::{BlockId, ChainSpec, ForkName, PublishBlockRequest, SignedBlockContents},
BeaconNodeHttpClient, Error, SensitiveUrl, Timeouts,
types::{BlockId, ChainSpec, ForkName, PublishBlockRequest, SignedBlockContents},
};
use eth2_network_config::Eth2NetworkConfig;
use ssz::Encode;
@@ -64,11 +64,11 @@ pub async fn run_async<T: EthSpec>(
next_block_id = BlockId::Root(block.parent_root());
blocks.push((block.slot(), publish_block_req));
if let Some(ref common_ancestor_block) = maybe_common_ancestor_block {
if common_ancestor_block == &next_block_id {
println!("reached known common ancestor: {next_block_id:?}");
break;
}
if let Some(ref common_ancestor_block) = maybe_common_ancestor_block
&& common_ancestor_block == &next_block_id
{
println!("reached known common ancestor: {next_block_id:?}");
break;
}
let block_exists_in_target = target
@@ -86,12 +86,13 @@ pub async fn run_async<T: EthSpec>(
for (slot, block) in blocks.iter().rev() {
println!("posting block at slot {slot}");
if let Err(e) = target.post_beacon_blocks(block).await {
if let Error::ServerMessage(ref e) = e {
if e.code == 202 {
println!("duplicate block detected while posting block at slot {slot}");
continue;
}
if let Error::ServerMessage(ref e) = e
&& e.code == 202
{
println!("duplicate block detected while posting block at slot {slot}");
continue;
}
return Err(format!("error posting {slot}: {e:?}"));
} else {
println!("success");
@@ -123,7 +124,7 @@ async fn get_block_from_source<T: EthSpec>(
.unwrap()
.unwrap();
let blobs_from_source = source
.get_blobs::<T>(block_id, None, spec)
.get_blob_sidecars::<T>(block_id, None, spec)
.await
.unwrap()
.unwrap()
@@ -131,15 +132,14 @@ async fn get_block_from_source<T: EthSpec>(
let (kzg_proofs, blobs): (Vec<_>, Vec<_>) = blobs_from_source
.iter()
.cloned()
.map(|sidecar| (sidecar.kzg_proof, sidecar.blob.clone()))
.unzip();
let block_root = block_from_source.canonical_root();
let block_contents = SignedBlockContents {
signed_block: Arc::new(block_from_source),
kzg_proofs: kzg_proofs.into(),
blobs: blobs.into(),
kzg_proofs: kzg_proofs.try_into().unwrap(),
blobs: blobs.try_into().unwrap(),
};
let publish_block_req = PublishBlockRequest::BlockContents(block_contents);

View File

@@ -11,19 +11,17 @@ mod state_root;
mod transition_blocks;
use clap::{Arg, ArgAction, ArgMatches, Command};
use clap_utils::{parse_optional, FLAG_HEADER};
use clap_utils::{FLAG_HEADER, parse_optional};
use environment::{EnvironmentBuilder, LoggerConfig};
use eth2_network_config::Eth2NetworkConfig;
use parse_ssz::run_parse_ssz;
use std::path::PathBuf;
use std::process;
use std::str::FromStr;
use tracing_subscriber::filter::LevelFilter;
use tracing_subscriber::{filter::LevelFilter, layer::SubscriberExt, util::SubscriberInitExt};
use types::{EthSpec, EthSpecId};
fn main() {
env_logger::init();
let matches = Command::new("Lighthouse CLI Tool")
.version(lighthouse_version::VERSION)
.display_order(0)
@@ -653,7 +651,7 @@ fn main() {
}
fn run<E: EthSpec>(env_builder: EnvironmentBuilder<E>, matches: &ArgMatches) -> Result<(), String> {
let (env_builder, _file_logging_layer, _stdout_logging_layer, _sse_logging_layer_opt) =
let (env_builder, file_logging_layer, stdout_logging_layer, _sse_logging_layer_opt) =
env_builder
.multi_threaded_tokio_runtime()
.map_err(|e| format!("should start tokio runtime: {:?}", e))?
@@ -675,12 +673,25 @@ fn run<E: EthSpec>(env_builder: EnvironmentBuilder<E>, matches: &ArgMatches) ->
extra_info: false,
},
"",
0o600,
);
let env = env_builder
.build()
.map_err(|e| format!("should build env: {:?}", e))?;
let mut logging_layers = vec![file_logging_layer];
if let Some(stdout) = stdout_logging_layer {
logging_layers.push(stdout);
}
let logging_result = tracing_subscriber::registry()
.with(logging_layers)
.try_init();
if let Err(e) = logging_result {
eprintln!("Failed to initialize logger: {e}");
}
// Determine testnet-dir path or network name depending on CLI flags.
let (testnet_dir, network_name) =
if let Some(testnet_dir) = parse_optional::<PathBuf>(matches, "testnet-dir")? {

View File

@@ -1,9 +1,9 @@
use account_utils::eth2_keystore::{keypair_from_secret, Keystore, KeystoreBuilder};
use account_utils::eth2_keystore::{Keystore, KeystoreBuilder, keypair_from_secret};
use account_utils::random_password;
use clap::ArgMatches;
use eth2_wallet::bip39::Seed;
use eth2_wallet::bip39::{Language, Mnemonic};
use eth2_wallet::{recover_validator_secret_from_mnemonic, KeyType};
use eth2_wallet::{KeyType, recover_validator_secret_from_mnemonic};
use rayon::prelude::*;
use std::fs;
use std::path::PathBuf;

View File

@@ -4,7 +4,7 @@ use environment::Environment;
use execution_layer::{
auth::JwtKey,
test_utils::{
Config, MockExecutionConfig, MockServer, DEFAULT_JWT_SECRET, DEFAULT_TERMINAL_BLOCK,
Config, DEFAULT_JWT_SECRET, DEFAULT_TERMINAL_BLOCK, MockExecutionConfig, MockServer,
},
};
use std::net::Ipv4Addr;
@@ -22,6 +22,7 @@ pub fn run<E: EthSpec>(mut env: Environment<E>, matches: &ArgMatches) -> Result<
let prague_time = parse_optional(matches, "prague-time")?;
let eip7805_time = parse_optional(matches, "eip7805-time")?;
let osaka_time = parse_optional(matches, "osaka-time")?;
let amsterdam_time = parse_optional(matches, "amsterdam-time")?;
let handle = env.core_context().executor.handle().unwrap();
let spec = Arc::new(E::default_spec());
@@ -42,9 +43,10 @@ pub fn run<E: EthSpec>(mut env: Environment<E>, matches: &ArgMatches) -> Result<
cancun_time,
prague_time,
osaka_time,
amsterdam_time,
};
let kzg = None;
let server: MockServer<E> = MockServer::new_with_config(&handle, config, spec, kzg);
let server: MockServer<E> = MockServer::new_with_config(&handle, config, kzg);
if all_payloads_valid {
eprintln!(

View File

@@ -48,11 +48,11 @@ use crate::transition_blocks::load_from_ssz_with;
use clap::ArgMatches;
use clap_utils::{parse_optional, parse_required};
use environment::Environment;
use eth2::{types::StateId, BeaconNodeHttpClient, SensitiveUrl, Timeouts};
use eth2::{BeaconNodeHttpClient, SensitiveUrl, Timeouts, types::StateId};
use eth2_network_config::Eth2NetworkConfig;
use ssz::Encode;
use state_processing::state_advance::{complete_state_advance, partial_state_advance};
use state_processing::AllCaches;
use state_processing::state_advance::{complete_state_advance, partial_state_advance};
use std::fs::File;
use std::io::prelude::*;
use std::path::PathBuf;

View File

@@ -2,7 +2,7 @@ use crate::transition_blocks::load_from_ssz_with;
use clap::ArgMatches;
use clap_utils::{parse_optional, parse_required};
use environment::Environment;
use eth2::{types::StateId, BeaconNodeHttpClient, SensitiveUrl, Timeouts};
use eth2::{BeaconNodeHttpClient, SensitiveUrl, Timeouts, types::StateId};
use eth2_network_config::Eth2NetworkConfig;
use std::path::PathBuf;
use std::time::{Duration, Instant};

View File

@@ -68,15 +68,15 @@ use clap::ArgMatches;
use clap_utils::{parse_optional, parse_required};
use environment::Environment;
use eth2::{
types::{BlockId, StateId},
BeaconNodeHttpClient, SensitiveUrl, Timeouts,
types::{BlockId, StateId},
};
use eth2_network_config::Eth2NetworkConfig;
use ssz::Encode;
use state_processing::state_advance::complete_state_advance;
use state_processing::{
block_signature_verifier::BlockSignatureVerifier, per_block_processing, AllCaches,
BlockSignatureStrategy, ConsensusContext, VerifyBlockRoot,
AllCaches, BlockSignatureStrategy, ConsensusContext, VerifyBlockRoot,
block_signature_verifier::BlockSignatureVerifier, per_block_processing,
};
use std::borrow::Cow;
use std::fs::File;
@@ -184,7 +184,7 @@ pub fn run<E: EthSpec>(
return Err(
"must supply *both* --pre-state-path and --block-path *or* only --beacon-url"
.into(),
)
);
}
};
@@ -354,10 +354,9 @@ fn do_transition<E: EthSpec>(
let mut ctxt = if let Some(ctxt) = saved_ctxt {
ctxt.clone()
} else {
let ctxt = ConsensusContext::new(pre_state.slot())
ConsensusContext::new(pre_state.slot())
.set_current_block_root(block_root)
.set_proposer_index(block.message().proposer_index());
ctxt
.set_proposer_index(block.message().proposer_index())
};
if !config.no_signature_verification {