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,12 +1,12 @@
use crate::NetworkMessage;
use crate::network_beacon_processor::NetworkBeaconProcessor;
use crate::sync::block_lookups::{
BlockLookupSummary, PARENT_DEPTH_TOLERANCE, SINGLE_BLOCK_LOOKUP_MAX_ATTEMPTS,
};
use crate::sync::{
manager::{BlockProcessType, BlockProcessingResult, SyncManager},
SyncMessage,
manager::{BlockProcessType, BlockProcessingResult, SyncManager},
};
use crate::NetworkMessage;
use std::sync::Arc;
use std::time::Duration;
@@ -15,36 +15,36 @@ use super::*;
use crate::sync::block_lookups::common::ResponseType;
use beacon_chain::observed_data_sidecars::Observe;
use beacon_chain::{
AvailabilityPendingExecutedBlock, AvailabilityProcessingStatus, BlockError,
PayloadVerificationOutcome, PayloadVerificationStatus,
blob_verification::GossipVerifiedBlob,
block_verification_types::{AsBlock, BlockImportData},
data_availability_checker::Availability,
test_utils::{
generate_rand_block_and_blobs, generate_rand_block_and_data_columns, test_spec,
BeaconChainHarness, EphemeralHarnessType, NumBlobs,
BeaconChainHarness, EphemeralHarnessType, NumBlobs, generate_rand_block_and_blobs,
generate_rand_block_and_data_columns, test_spec,
},
validator_monitor::timestamp_now,
AvailabilityPendingExecutedBlock, AvailabilityProcessingStatus, BlockError,
PayloadVerificationOutcome, PayloadVerificationStatus,
};
use beacon_processor::WorkEvent;
use lighthouse_network::discovery::CombinedKey;
use lighthouse_network::{
NetworkConfig, NetworkGlobals, PeerId,
rpc::{RPCError, RequestType, RpcErrorResponse},
service::api_types::{
AppRequestId, DataColumnsByRootRequestId, DataColumnsByRootRequester, Id,
SingleLookupReqId, SyncRequestId,
},
types::SyncState,
NetworkConfig, NetworkGlobals, PeerId,
};
use slot_clock::{SlotClock, TestingSlotClock};
use tokio::sync::mpsc;
use tracing::info;
use types::{
data_column_sidecar::ColumnIndex,
test_utils::{SeedableRng, TestRandom, XorShiftRng},
BeaconState, BeaconStateBase, BlobSidecar, DataColumnSidecar, EthSpec, ForkContext, ForkName,
Hash256, MinimalEthSpec as E, SignedBeaconBlock, Slot,
data_column_sidecar::ColumnIndex,
test_utils::{SeedableRng, TestRandom, XorShiftRng},
};
const D: Duration = Duration::new(0, 0);
@@ -104,6 +104,7 @@ impl TestRig {
let spec = chain.spec.clone();
// deterministic seed
let rng_08 = <rand_chacha_03::ChaCha20Rng as rand_08::SeedableRng>::from_seed([0u8; 32]);
let rng = ChaCha20Rng::from_seed([0u8; 32]);
init_tracing();
@@ -114,6 +115,7 @@ impl TestRig {
network_rx,
network_rx_queue: vec![],
sync_rx,
rng_08,
rng,
network_globals: beacon_processor.network_globals.clone(),
sync_manager: SyncManager::new(
@@ -348,7 +350,7 @@ impl TestRig {
}
fn determinstic_key(&mut self) -> CombinedKey {
k256::ecdsa::SigningKey::random(&mut self.rng).into()
k256::ecdsa::SigningKey::random(&mut self.rng_08).into()
}
pub fn new_connected_peers_for_peerdas(&mut self) {

View File

@@ -1,7 +1,7 @@
use crate::NetworkMessage;
use crate::sync::SyncMessage;
use crate::sync::manager::SyncManager;
use crate::sync::range_sync::RangeSyncType;
use crate::sync::SyncMessage;
use crate::NetworkMessage;
use beacon_chain::builder::Witness;
use beacon_chain::test_utils::{BeaconChainHarness, EphemeralHarnessType};
use beacon_processor::WorkEvent;
@@ -65,6 +65,7 @@ struct TestRig {
/// Beacon chain harness
harness: BeaconChainHarness<EphemeralHarnessType<E>>,
/// `rng` for generating test blocks and blobs.
rng_08: rand_chacha_03::ChaCha20Rng,
rng: ChaCha20Rng,
fork_name: ForkName,
spec: Arc<ChainSpec>,

View File

@@ -1,19 +1,19 @@
use super::*;
use crate::network_beacon_processor::ChainSegmentProcessId;
use crate::status::ToStatusMessage;
use crate::sync::SyncMessage;
use crate::sync::manager::SLOT_IMPORT_TOLERANCE;
use crate::sync::network_context::RangeRequestId;
use crate::sync::range_sync::RangeSyncType;
use crate::sync::SyncMessage;
use beacon_chain::data_column_verification::CustodyDataColumn;
use beacon_chain::test_utils::{AttestationStrategy, BlockStrategy};
use beacon_chain::{block_verification_types::RpcBlock, EngineState, NotifyExecutionLayer};
use beacon_chain::{EngineState, NotifyExecutionLayer, block_verification_types::RpcBlock};
use beacon_processor::WorkType;
use lighthouse_network::rpc::RequestType;
use lighthouse_network::rpc::methods::{
BlobsByRangeRequest, DataColumnsByRangeRequest, OldBlocksByRangeRequest,
OldBlocksByRangeRequestV2, StatusMessageV2,
};
use lighthouse_network::rpc::RequestType;
use lighthouse_network::service::api_types::{
AppRequestId, BlobsByRangeRequestId, BlocksByRangeRequestId, DataColumnsByRangeRequestId,
SyncRequestId,
@@ -207,11 +207,12 @@ impl TestRig {
return false;
}
}
if let Some(expected_peer) = request_filter.peer {
if peer != expected_peer {
return false;
}
if let Some(expected_peer) = request_filter.peer
&& peer != expected_peer
{
return false;
}
true
};