mirror of
https://github.com/sigp/lighthouse.git
synced 2026-04-16 20:39:10 +00:00
Update Rust Edition to 2024 (#7766)
* #7749 Thanks @dknopik and @michaelsproul for your help!
This commit is contained in:
@@ -7,7 +7,7 @@ use std::collections::HashMap;
|
||||
use std::ops::Deref;
|
||||
use std::sync::Arc;
|
||||
use task_executor::TaskExecutor;
|
||||
use tokio::time::{sleep, sleep_until, Duration, Instant};
|
||||
use tokio::time::{Duration, Instant, sleep, sleep_until};
|
||||
use tracing::{debug, error, info, trace, warn};
|
||||
use tree_hash::TreeHash;
|
||||
use types::{Attestation, AttestationData, ChainSpec, CommitteeIndex, EthSpec, Slot};
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
use beacon_node_fallback::{ApiTopic, BeaconNodeFallback, Error as FallbackError, Errors};
|
||||
use bls::SignatureBytes;
|
||||
use eth2::{BeaconNodeHttpClient, StatusCode};
|
||||
use graffiti_file::{determine_graffiti, GraffitiFile};
|
||||
use graffiti_file::{GraffitiFile, determine_graffiti};
|
||||
use logging::crit;
|
||||
use slot_clock::SlotClock;
|
||||
use std::fmt::Debug;
|
||||
@@ -148,14 +148,13 @@ impl<T: SlotClock> ProposerFallback<T> {
|
||||
Err: Debug,
|
||||
{
|
||||
// If there are proposer nodes, try calling `func` on them and return early if they are successful.
|
||||
if let Some(proposer_nodes) = &self.proposer_nodes {
|
||||
if proposer_nodes
|
||||
if let Some(proposer_nodes) = &self.proposer_nodes
|
||||
&& proposer_nodes
|
||||
.request(ApiTopic::Blocks, func.clone())
|
||||
.await
|
||||
.is_ok()
|
||||
{
|
||||
return Ok(());
|
||||
}
|
||||
{
|
||||
return Ok(());
|
||||
}
|
||||
|
||||
// If the proposer nodes failed, try on the non-proposer nodes.
|
||||
@@ -353,7 +352,7 @@ impl<S: ValidatorStore + 'static, T: SlotClock + 'static> BlockService<S, T> {
|
||||
return Err(BlockError::Recoverable(format!(
|
||||
"Unable to sign block: {:?}",
|
||||
e
|
||||
)))
|
||||
)));
|
||||
}
|
||||
};
|
||||
|
||||
@@ -422,7 +421,7 @@ impl<S: ValidatorStore + 'static, T: SlotClock + 'static> BlockService<S, T> {
|
||||
return Err(BlockError::Recoverable(format!(
|
||||
"Unable to produce randao reveal signature: {:?}",
|
||||
e
|
||||
)))
|
||||
)));
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -7,26 +7,26 @@
|
||||
//! block production.
|
||||
|
||||
use crate::block_service::BlockServiceNotification;
|
||||
use crate::sync::poll_sync_committee_duties;
|
||||
use crate::sync::SyncDutiesMap;
|
||||
use crate::sync::poll_sync_committee_duties;
|
||||
use beacon_node_fallback::{ApiTopic, BeaconNodeFallback};
|
||||
use eth2::types::{
|
||||
AttesterData, BeaconCommitteeSubscription, DutiesResponse, ProposerData, StateId, ValidatorId,
|
||||
};
|
||||
use futures::{stream, StreamExt};
|
||||
use futures::{StreamExt, stream};
|
||||
use parking_lot::RwLock;
|
||||
use safe_arith::{ArithError, SafeArith};
|
||||
use slot_clock::SlotClock;
|
||||
use std::cmp::min;
|
||||
use std::collections::{hash_map, BTreeMap, HashMap, HashSet};
|
||||
use std::sync::atomic::{AtomicBool, Ordering};
|
||||
use std::collections::{BTreeMap, HashMap, HashSet, hash_map};
|
||||
use std::sync::Arc;
|
||||
use std::sync::atomic::{AtomicBool, Ordering};
|
||||
use std::time::Duration;
|
||||
use task_executor::TaskExecutor;
|
||||
use tokio::{sync::mpsc::Sender, time::sleep};
|
||||
use tracing::{debug, error, info, warn};
|
||||
use types::{ChainSpec, Epoch, EthSpec, Hash256, PublicKeyBytes, SelectionProof, Slot};
|
||||
use validator_metrics::{get_int_gauge, set_int_gauge, ATTESTATION_DUTY};
|
||||
use validator_metrics::{ATTESTATION_DUTY, get_int_gauge, set_int_gauge};
|
||||
use validator_store::{DoppelgangerStatus, Error as ValidatorStoreError, ValidatorStore};
|
||||
|
||||
/// Only retain `HISTORICAL_DUTIES_EPOCHS` duties prior to the current epoch.
|
||||
@@ -1362,15 +1362,14 @@ async fn poll_beacon_proposers<S: ValidatorStore, T: SlotClock + 'static>(
|
||||
.proposers
|
||||
.write()
|
||||
.insert(current_epoch, (dependent_root, relevant_duties))
|
||||
&& dependent_root != prior_dependent_root
|
||||
{
|
||||
if dependent_root != prior_dependent_root {
|
||||
warn!(
|
||||
%prior_dependent_root,
|
||||
%dependent_root,
|
||||
msg = "this may happen from time to time",
|
||||
"Proposer duties re-org"
|
||||
)
|
||||
}
|
||||
warn!(
|
||||
%prior_dependent_root,
|
||||
%dependent_root,
|
||||
msg = "this may happen from time to time",
|
||||
"Proposer duties re-org"
|
||||
)
|
||||
}
|
||||
}
|
||||
// Don't return early here, we still want to try and produce blocks using the cached values.
|
||||
@@ -1433,21 +1432,20 @@ async fn notify_block_production_service<S: ValidatorStore>(
|
||||
.copied()
|
||||
.collect::<Vec<_>>();
|
||||
|
||||
if !non_doppelganger_proposers.is_empty() {
|
||||
if let Err(e) = block_service_tx
|
||||
if !non_doppelganger_proposers.is_empty()
|
||||
&& let Err(e) = block_service_tx
|
||||
.send(BlockServiceNotification {
|
||||
slot: current_slot,
|
||||
block_proposers: non_doppelganger_proposers,
|
||||
})
|
||||
.await
|
||||
{
|
||||
error!(
|
||||
%current_slot,
|
||||
error = %e,
|
||||
"Failed to notify block service"
|
||||
);
|
||||
};
|
||||
}
|
||||
{
|
||||
error!(
|
||||
%current_slot,
|
||||
error = %e,
|
||||
"Failed to notify block service"
|
||||
);
|
||||
};
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
|
||||
@@ -2,7 +2,7 @@ use crate::duties_service::DutiesService;
|
||||
use slot_clock::SlotClock;
|
||||
use std::sync::Arc;
|
||||
use task_executor::TaskExecutor;
|
||||
use tokio::time::{sleep, Duration};
|
||||
use tokio::time::{Duration, sleep};
|
||||
use tracing::{debug, error, info};
|
||||
use types::{ChainSpec, EthSpec};
|
||||
use validator_metrics::set_gauge;
|
||||
|
||||
@@ -8,7 +8,7 @@ use std::ops::Deref;
|
||||
use std::sync::Arc;
|
||||
use std::time::{SystemTime, UNIX_EPOCH};
|
||||
use task_executor::TaskExecutor;
|
||||
use tokio::time::{sleep, Duration};
|
||||
use tokio::time::{Duration, sleep};
|
||||
use tracing::{debug, error, info, warn};
|
||||
use types::{
|
||||
Address, ChainSpec, EthSpec, ProposerPreparationData, SignedValidatorRegistrationData,
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
use crate::duties_service::DutiesService;
|
||||
use beacon_node_fallback::{ApiTopic, BeaconNodeFallback};
|
||||
use eth2::types::BlockId;
|
||||
use futures::future::join_all;
|
||||
use futures::future::FutureExt;
|
||||
use futures::future::join_all;
|
||||
use logging::crit;
|
||||
use slot_clock::SlotClock;
|
||||
use std::collections::HashMap;
|
||||
use std::ops::Deref;
|
||||
use std::sync::atomic::{AtomicBool, Ordering};
|
||||
use std::sync::Arc;
|
||||
use std::sync::atomic::{AtomicBool, Ordering};
|
||||
use task_executor::TaskExecutor;
|
||||
use tokio::time::{sleep, sleep_until, Duration, Instant};
|
||||
use tokio::time::{Duration, Instant, sleep, sleep_until};
|
||||
use tracing::{debug, error, info, trace, warn};
|
||||
use types::{
|
||||
ChainSpec, EthSpec, Hash256, PublicKeyBytes, Slot, SyncCommitteeSubscription,
|
||||
|
||||
Reference in New Issue
Block a user