mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-03 00:31:50 +00:00
Fix Rust 1.88 clippy errors & execution engine tests (#7657)
Fix Rust 1.88 clippy errors.
This commit is contained in:
@@ -365,11 +365,7 @@ impl AttesterCache {
|
||||
value: AttesterCacheValue,
|
||||
) {
|
||||
while cache.len() >= MAX_CACHE_LEN {
|
||||
if let Some(oldest) = cache
|
||||
.iter()
|
||||
.map(|(key, _)| *key)
|
||||
.min_by_key(|key| key.epoch)
|
||||
{
|
||||
if let Some(oldest) = cache.keys().copied().min_by_key(|key| key.epoch) {
|
||||
cache.remove(&oldest);
|
||||
} else {
|
||||
break;
|
||||
|
||||
@@ -342,7 +342,7 @@ impl MonitoredValidator {
|
||||
|
||||
// Prune
|
||||
while summaries.len() > HISTORIC_EPOCHS {
|
||||
if let Some(key) = summaries.iter().map(|(epoch, _)| *epoch).min() {
|
||||
if let Some(key) = summaries.keys().copied().min() {
|
||||
summaries.remove(&key);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -106,14 +106,14 @@ impl<E: EthSpec> NetworkBehaviour for PeerManager<E> {
|
||||
if let Some(enr) = self.peers_to_dial.pop() {
|
||||
self.inject_peer_connection(&enr.peer_id(), ConnectingType::Dialing, Some(enr.clone()));
|
||||
|
||||
let multiaddr_quic = if self.quic_enabled {
|
||||
enr.multiaddr_quic()
|
||||
} else {
|
||||
vec![]
|
||||
};
|
||||
|
||||
// Prioritize Quic connections over Tcp ones.
|
||||
let multiaddrs = [
|
||||
self.quic_enabled
|
||||
.then_some(enr.multiaddr_quic())
|
||||
.unwrap_or_default(),
|
||||
enr.multiaddr_tcp(),
|
||||
]
|
||||
.concat();
|
||||
let multiaddrs = [multiaddr_quic, enr.multiaddr_tcp()].concat();
|
||||
|
||||
debug!(peer_id = %enr.peer_id(), ?multiaddrs, "Dialing peer");
|
||||
return Poll::Ready(ToSwarm::Dial {
|
||||
|
||||
@@ -700,8 +700,8 @@ impl<E: EthSpec> OperationPool<E> {
|
||||
pub fn get_all_proposer_slashings(&self) -> Vec<ProposerSlashing> {
|
||||
self.proposer_slashings
|
||||
.read()
|
||||
.iter()
|
||||
.map(|(_, slashing)| slashing.as_inner().clone())
|
||||
.values()
|
||||
.map(|slashing| slashing.as_inner().clone())
|
||||
.collect()
|
||||
}
|
||||
|
||||
@@ -711,8 +711,8 @@ impl<E: EthSpec> OperationPool<E> {
|
||||
pub fn get_all_voluntary_exits(&self) -> Vec<SignedVoluntaryExit> {
|
||||
self.voluntary_exits
|
||||
.read()
|
||||
.iter()
|
||||
.map(|(_, exit)| exit.as_inner().clone())
|
||||
.values()
|
||||
.map(|exit| exit.as_inner().clone())
|
||||
.collect()
|
||||
}
|
||||
|
||||
|
||||
@@ -86,15 +86,15 @@ impl<E: EthSpec> PersistedOperationPool<E> {
|
||||
let proposer_slashings = operation_pool
|
||||
.proposer_slashings
|
||||
.read()
|
||||
.iter()
|
||||
.map(|(_, slashing)| slashing.clone())
|
||||
.values()
|
||||
.cloned()
|
||||
.collect();
|
||||
|
||||
let voluntary_exits = operation_pool
|
||||
.voluntary_exits
|
||||
.read()
|
||||
.iter()
|
||||
.map(|(_, exit)| exit.clone())
|
||||
.values()
|
||||
.cloned()
|
||||
.collect();
|
||||
|
||||
let bls_to_execution_changes = operation_pool
|
||||
|
||||
@@ -14,6 +14,10 @@ pub fn build_result(repo_dir: &Path) -> Output {
|
||||
Command::new("make")
|
||||
.arg("geth")
|
||||
.current_dir(repo_dir)
|
||||
// Geth now uses the commit hash from a GitHub runner environment variable if it detects a CI environment.
|
||||
// We need to override this to successfully build Geth in Lighthouse workflows.
|
||||
// See: https://github.com/ethereum/go-ethereum/blob/668c3a7278af399c0e776e92f1c721b5158388f2/internal/build/env.go#L95-L121
|
||||
.env("CI", "false")
|
||||
.output()
|
||||
.expect("failed to make geth")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user