mirror of
https://github.com/sigp/lighthouse.git
synced 2026-04-20 14:28:37 +00:00
Update Rust Edition to 2024 (#7766)
* #7749 Thanks @dknopik and @michaelsproul for your help!
This commit is contained in:
@@ -13,7 +13,7 @@ use tokio::time::Instant;
|
||||
use beacon_chain::{BeaconChain, BeaconChainTypes};
|
||||
use delay_map::HashSetDelay;
|
||||
use futures::prelude::*;
|
||||
use lighthouse_network::{discv5::enr::NodeId, NetworkConfig, Subnet, SubnetDiscovery};
|
||||
use lighthouse_network::{NetworkConfig, Subnet, SubnetDiscovery, discv5::enr::NodeId};
|
||||
use slot_clock::SlotClock;
|
||||
use tracing::{debug, error, info, warn};
|
||||
use types::{
|
||||
@@ -347,11 +347,11 @@ impl<T: BeaconChainTypes> SubnetService<T> {
|
||||
|
||||
// If the discovery mechanism isn't disabled, attempt to set up a peer discovery for the
|
||||
// required subnets.
|
||||
if !self.discovery_disabled {
|
||||
if let Err(e) = self.discover_peers_request(subnets_to_discover.into_iter()) {
|
||||
warn!(error = e, "Discovery lookup request error");
|
||||
};
|
||||
}
|
||||
if !self.discovery_disabled
|
||||
&& let Err(e) = self.discover_peers_request(subnets_to_discover.into_iter())
|
||||
{
|
||||
warn!(error = e, "Discovery lookup request error");
|
||||
};
|
||||
}
|
||||
|
||||
/// Checks if we have subscribed aggregate validators for the subnet. If not, checks the gossip
|
||||
@@ -671,13 +671,13 @@ impl<T: BeaconChainTypes> Stream for SubnetService<T> {
|
||||
}
|
||||
|
||||
// Poll to remove entries on expiration, no need to act on expiration events.
|
||||
if let Some(tracked_vals) = self.aggregate_validators_on_subnet.as_mut() {
|
||||
if let Poll::Ready(Some(Err(e))) = tracked_vals.poll_next_unpin(cx) {
|
||||
error!(
|
||||
error = e,
|
||||
"Failed to check for aggregate validator on subnet expirations"
|
||||
);
|
||||
}
|
||||
if let Some(tracked_vals) = self.aggregate_validators_on_subnet.as_mut()
|
||||
&& let Poll::Ready(Some(Err(e))) = tracked_vals.poll_next_unpin(cx)
|
||||
{
|
||||
error!(
|
||||
error = e,
|
||||
"Failed to check for aggregate validator on subnet expirations"
|
||||
);
|
||||
}
|
||||
|
||||
Poll::Pending
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
use super::*;
|
||||
use beacon_chain::{
|
||||
BeaconChain,
|
||||
builder::{BeaconChainBuilder, Witness},
|
||||
test_utils::get_kzg,
|
||||
BeaconChain,
|
||||
};
|
||||
use genesis::{generate_deterministic_keypairs, interop_genesis_state, DEFAULT_ETH1_BLOCK_HASH};
|
||||
use genesis::{DEFAULT_ETH1_BLOCK_HASH, generate_deterministic_keypairs, interop_genesis_state};
|
||||
use lighthouse_network::NetworkConfig;
|
||||
use rand::rngs::StdRng;
|
||||
use rand::SeedableRng;
|
||||
use rand::rngs::StdRng;
|
||||
use slot_clock::{SlotClock, SystemTimeSlotClock};
|
||||
use std::sync::{Arc, LazyLock};
|
||||
use std::time::{Duration, SystemTime};
|
||||
@@ -130,11 +130,10 @@ async fn get_events_until_timeout<S: Stream<Item = SubnetServiceMessage> + Unpin
|
||||
tokio::select! {
|
||||
Some(event) = stream.next() => {
|
||||
events.push(event);
|
||||
if let Some(num) = num_events {
|
||||
if events.len() == num {
|
||||
if let Some(num) = num_events
|
||||
&& events.len() == num {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
_ = sleep.as_mut() => {
|
||||
break;
|
||||
@@ -481,7 +480,7 @@ mod test {
|
||||
// and 1 `DiscoverPeer` request corresponding to the bulk subnet discovery.
|
||||
|
||||
assert_eq!(discover_peer_count, 1 + 1); // Generates a single discovery for permanent
|
||||
// subscriptions and 1 for the subscription
|
||||
// subscriptions and 1 for the subscription
|
||||
assert_eq!(enr_add_count, subnets_per_node);
|
||||
assert_eq!(unexpected_msg_count, 0);
|
||||
}
|
||||
@@ -584,7 +583,7 @@ mod test {
|
||||
|
||||
println!("{events:?}");
|
||||
let subscription_slot = current_slot + subscription_slot2 - 1; // one less do to the
|
||||
// advance subscription time
|
||||
// advance subscription time
|
||||
let wait_duration = subnet_service
|
||||
.beacon_chain
|
||||
.slot_clock
|
||||
|
||||
Reference in New Issue
Block a user