Fix Rust 1.88 clippy errors & execution engine tests (#7657)

Fix Rust 1.88 clippy errors.
This commit is contained in:
Jimmy Chen
2025-06-28 04:21:17 +10:00
committed by GitHub
parent 9b1f3ed9d1
commit 83cad25d98
6 changed files with 21 additions and 21 deletions

View File

@@ -365,11 +365,7 @@ impl AttesterCache {
value: AttesterCacheValue, value: AttesterCacheValue,
) { ) {
while cache.len() >= MAX_CACHE_LEN { while cache.len() >= MAX_CACHE_LEN {
if let Some(oldest) = cache if let Some(oldest) = cache.keys().copied().min_by_key(|key| key.epoch) {
.iter()
.map(|(key, _)| *key)
.min_by_key(|key| key.epoch)
{
cache.remove(&oldest); cache.remove(&oldest);
} else { } else {
break; break;

View File

@@ -342,7 +342,7 @@ impl MonitoredValidator {
// Prune // Prune
while summaries.len() > HISTORIC_EPOCHS { 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); summaries.remove(&key);
} }
} }

View File

@@ -106,14 +106,14 @@ impl<E: EthSpec> NetworkBehaviour for PeerManager<E> {
if let Some(enr) = self.peers_to_dial.pop() { if let Some(enr) = self.peers_to_dial.pop() {
self.inject_peer_connection(&enr.peer_id(), ConnectingType::Dialing, Some(enr.clone())); 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. // Prioritize Quic connections over Tcp ones.
let multiaddrs = [ let multiaddrs = [multiaddr_quic, enr.multiaddr_tcp()].concat();
self.quic_enabled
.then_some(enr.multiaddr_quic())
.unwrap_or_default(),
enr.multiaddr_tcp(),
]
.concat();
debug!(peer_id = %enr.peer_id(), ?multiaddrs, "Dialing peer"); debug!(peer_id = %enr.peer_id(), ?multiaddrs, "Dialing peer");
return Poll::Ready(ToSwarm::Dial { return Poll::Ready(ToSwarm::Dial {

View File

@@ -700,8 +700,8 @@ impl<E: EthSpec> OperationPool<E> {
pub fn get_all_proposer_slashings(&self) -> Vec<ProposerSlashing> { pub fn get_all_proposer_slashings(&self) -> Vec<ProposerSlashing> {
self.proposer_slashings self.proposer_slashings
.read() .read()
.iter() .values()
.map(|(_, slashing)| slashing.as_inner().clone()) .map(|slashing| slashing.as_inner().clone())
.collect() .collect()
} }
@@ -711,8 +711,8 @@ impl<E: EthSpec> OperationPool<E> {
pub fn get_all_voluntary_exits(&self) -> Vec<SignedVoluntaryExit> { pub fn get_all_voluntary_exits(&self) -> Vec<SignedVoluntaryExit> {
self.voluntary_exits self.voluntary_exits
.read() .read()
.iter() .values()
.map(|(_, exit)| exit.as_inner().clone()) .map(|exit| exit.as_inner().clone())
.collect() .collect()
} }

View File

@@ -86,15 +86,15 @@ impl<E: EthSpec> PersistedOperationPool<E> {
let proposer_slashings = operation_pool let proposer_slashings = operation_pool
.proposer_slashings .proposer_slashings
.read() .read()
.iter() .values()
.map(|(_, slashing)| slashing.clone()) .cloned()
.collect(); .collect();
let voluntary_exits = operation_pool let voluntary_exits = operation_pool
.voluntary_exits .voluntary_exits
.read() .read()
.iter() .values()
.map(|(_, exit)| exit.clone()) .cloned()
.collect(); .collect();
let bls_to_execution_changes = operation_pool let bls_to_execution_changes = operation_pool

View File

@@ -14,6 +14,10 @@ pub fn build_result(repo_dir: &Path) -> Output {
Command::new("make") Command::new("make")
.arg("geth") .arg("geth")
.current_dir(repo_dir) .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() .output()
.expect("failed to make geth") .expect("failed to make geth")
} }