Update Rust Edition to 2024 (#7766)

* #7749

Thanks @dknopik and @michaelsproul for your help!
This commit is contained in:
chonghe
2025-08-13 11:04:31 +08:00
committed by GitHub
parent bd6b8b6a65
commit 522bd9e9c6
468 changed files with 3594 additions and 3396 deletions

View File

@@ -1,5 +1,7 @@
use crate::ChainConfig;
use crate::CustodyContext;
use crate::beacon_chain::{
CanonicalHead, LightClientProducerEvent, BEACON_CHAIN_DB_KEY, OP_POOL_DB_KEY,
BEACON_CHAIN_DB_KEY, CanonicalHead, LightClientProducerEvent, OP_POOL_DB_KEY,
};
use crate::beacon_proposer_cache::BeaconProposerCache;
use crate::data_availability_checker::DataAvailabilityChecker;
@@ -15,8 +17,6 @@ use crate::persisted_custody::load_custody_context;
use crate::shuffling_cache::{BlockShufflingIds, ShufflingCache};
use crate::validator_monitor::{ValidatorMonitor, ValidatorMonitorConfig};
use crate::validator_pubkey_cache::ValidatorPubkeyCache;
use crate::ChainConfig;
use crate::CustodyContext;
use crate::{
BeaconChain, BeaconChainTypes, BeaconForkChoiceStore, BeaconSnapshot, ServerSentEventHandler,
};
@@ -32,7 +32,7 @@ use rand::RngCore;
use rayon::prelude::*;
use slasher::Slasher;
use slot_clock::{SlotClock, TestingSlotClock};
use state_processing::{per_slot_processing, AllCaches};
use state_processing::{AllCaches, per_slot_processing};
use std::marker::PhantomData;
use std::sync::Arc;
use std::time::Duration;
@@ -1037,23 +1037,25 @@ where
.map_err(|e| format!("Failed to prime attester cache: {:?}", e))?;
// Only perform the check if it was configured.
if let Some(wss_checkpoint) = beacon_chain.config.weak_subjectivity_checkpoint {
if let Err(e) = beacon_chain.verify_weak_subjectivity_checkpoint(
if let Some(wss_checkpoint) = beacon_chain.config.weak_subjectivity_checkpoint
&& let Err(e) = beacon_chain.verify_weak_subjectivity_checkpoint(
wss_checkpoint,
head.beacon_block_root,
&head.beacon_state,
) {
crit!(
head_block_root = %head.beacon_block_root,
head_slot = %head.beacon_block.slot(),
finalized_epoch = %head.beacon_state.finalized_checkpoint().epoch,
wss_checkpoint_epoch = %wss_checkpoint.epoch,
error = ?e,
"Weak subjectivity checkpoint verification failed on startup!"
);
crit!("You must use the `--purge-db` flag to clear the database and restart sync. You may be on a hostile network.");
return Err(format!("Weak subjectivity verification failed: {:?}", e));
}
)
{
crit!(
head_block_root = %head.beacon_block_root,
head_slot = %head.beacon_block.slot(),
finalized_epoch = %head.beacon_state.finalized_checkpoint().epoch,
wss_checkpoint_epoch = %wss_checkpoint.epoch,
error = ?e,
"Weak subjectivity checkpoint verification failed on startup!"
);
crit!(
"You must use the `--purge-db` flag to clear the database and restart sync. You may be on a hostile network."
);
return Err(format!("Weak subjectivity verification failed: {:?}", e));
}
info!(
@@ -1198,13 +1200,13 @@ fn build_data_columns_from_blobs<E: EthSpec>(
#[cfg(test)]
mod test {
use super::*;
use crate::test_utils::{get_kzg, EphemeralHarnessType};
use crate::test_utils::{EphemeralHarnessType, get_kzg};
use ethereum_hashing::hash;
use genesis::{
generate_deterministic_keypairs, interop_genesis_state, DEFAULT_ETH1_BLOCK_HASH,
DEFAULT_ETH1_BLOCK_HASH, generate_deterministic_keypairs, interop_genesis_state,
};
use rand::rngs::StdRng;
use rand::SeedableRng;
use rand::rngs::StdRng;
use ssz::Encode;
use std::time::Duration;
use store::config::StoreConfig;