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 super::state_lru_cache::{DietAvailabilityPendingExecutedBlock, StateLRUCache};
use super::AvailableBlockData;
use super::state_lru_cache::{DietAvailabilityPendingExecutedBlock, StateLRUCache};
use crate::BeaconChainTypes;
use crate::CustodyContext;
use crate::beacon_chain::BeaconStore;
use crate::blob_verification::KzgVerifiedBlob;
use crate::block_verification_types::{
@@ -7,14 +9,12 @@ use crate::block_verification_types::{
};
use crate::data_availability_checker::{Availability, AvailabilityCheckError};
use crate::data_column_verification::KzgVerifiedCustodyDataColumn;
use crate::BeaconChainTypes;
use crate::CustodyContext;
use lru::LruCache;
use parking_lot::RwLock;
use std::cmp::Ordering;
use std::num::NonZeroUsize;
use std::sync::Arc;
use tracing::{debug, debug_span, Span};
use tracing::{Span, debug, debug_span};
use types::blob_sidecar::BlobIdentifier;
use types::{
BlobSidecar, ChainSpec, ColumnIndex, DataColumnSidecar, DataColumnSidecarList, Epoch, EthSpec,
@@ -124,10 +124,10 @@ impl<E: EthSpec> PendingComponents<E> {
pub fn merge_single_blob(&mut self, index: usize, blob: KzgVerifiedBlob<E>) {
if let Some(cached_block) = self.get_cached_block() {
let block_commitment_opt = cached_block.get_commitments().get(index).copied();
if let Some(block_commitment) = block_commitment_opt {
if block_commitment == *blob.get_commitment() {
self.insert_blob_at_index(index, blob)
}
if let Some(block_commitment) = block_commitment_opt
&& block_commitment == *blob.get_commitment()
{
self.insert_blob_at_index(index, blob)
}
} else if !self.blob_exists(index) {
self.insert_blob_at_index(index, blob)
@@ -683,10 +683,10 @@ impl<T: BeaconChainTypes> DataAvailabilityCheckerInner<T> {
let mut write_lock = self.critical.write();
let mut keys_to_remove = vec![];
for (key, value) in write_lock.iter() {
if let Some(epoch) = value.epoch() {
if epoch < cutoff_epoch {
keys_to_remove.push(*key);
}
if let Some(epoch) = value.epoch()
&& epoch < cutoff_epoch
{
keys_to_remove.push(*key);
}
}
// Now remove keys
@@ -729,8 +729,8 @@ mod test {
use logging::create_test_tracing_subscriber;
use state_processing::ConsensusContext;
use std::collections::VecDeque;
use store::{database::interface::BeaconNodeBackend, HotColdDB, ItemStore, StoreConfig};
use tempfile::{tempdir, TempDir};
use store::{HotColdDB, ItemStore, StoreConfig, database::interface::BeaconNodeBackend};
use tempfile::{TempDir, tempdir};
use tracing::{debug_span, info};
use types::non_zero_usize::new_non_zero_usize;
use types::{ExecPayload, MinimalEthSpec};
@@ -905,10 +905,10 @@ mod test {
where
E: EthSpec,
T: BeaconChainTypes<
HotStore = BeaconNodeBackend<E>,
ColdStore = BeaconNodeBackend<E>,
EthSpec = E,
>,
HotStore = BeaconNodeBackend<E>,
ColdStore = BeaconNodeBackend<E>,
EthSpec = E,
>,
{
create_test_tracing_subscriber();
let chain_db_path = tempdir().expect("should get temp dir");
@@ -1174,13 +1174,13 @@ mod test {
#[cfg(test)]
mod pending_components_tests {
use super::*;
use crate::block_verification_types::BlockImportData;
use crate::test_utils::{generate_rand_block_and_blobs, test_spec, NumBlobs};
use crate::PayloadVerificationOutcome;
use crate::block_verification_types::BlockImportData;
use crate::test_utils::{NumBlobs, generate_rand_block_and_blobs, test_spec};
use fork_choice::PayloadVerificationStatus;
use kzg::KzgCommitment;
use rand::rngs::StdRng;
use rand::SeedableRng;
use rand::rngs::StdRng;
use state_processing::ConsensusContext;
use types::test_utils::TestRandom;
use types::{

View File

@@ -1,15 +1,15 @@
use crate::block_verification_types::AsBlock;
use crate::{
AvailabilityPendingExecutedBlock, BeaconChainTypes, BeaconStore, PayloadVerificationOutcome,
block_verification_types::BlockImportData,
data_availability_checker::{AvailabilityCheckError, STATE_LRU_CAPACITY_NON_ZERO},
AvailabilityPendingExecutedBlock, BeaconChainTypes, BeaconStore, PayloadVerificationOutcome,
};
use lru::LruCache;
use parking_lot::RwLock;
use state_processing::BlockReplayer;
use std::sync::Arc;
use store::OnDiskConsensusContext;
use tracing::{debug_span, instrument, Span};
use tracing::{Span, debug_span, instrument};
use types::beacon_block_body::KzgCommitments;
use types::{BeaconState, BlindedPayload, ChainSpec, Epoch, EthSpec, Hash256, SignedBeaconBlock};