mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-03 00:31:50 +00:00
Update Rust Edition to 2024 (#7766)
* #7749 Thanks @dknopik and @michaelsproul for your help!
This commit is contained in:
@@ -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};
|
||||
|
||||
@@ -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> {
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
use clap::ArgMatches;
|
||||
use lighthouse_network::{
|
||||
discovery::{build_enr, CombinedKey, CombinedKeyExt, ENR_FILENAME},
|
||||
NETWORK_KEY_FILENAME, NetworkConfig,
|
||||
discovery::{CombinedKey, CombinedKeyExt, ENR_FILENAME, build_enr},
|
||||
libp2p::identity::secp256k1,
|
||||
NetworkConfig, NETWORK_KEY_FILENAME,
|
||||
};
|
||||
use std::io::Write;
|
||||
use std::path::PathBuf;
|
||||
|
||||
@@ -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");
|
||||
|
||||
@@ -11,7 +11,7 @@ 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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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};
|
||||
|
||||
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user