diff --git a/zebra-chain/src/block.rs b/zebra-chain/src/block.rs index a72426411..53bf21f53 100644 --- a/zebra-chain/src/block.rs +++ b/zebra-chain/src/block.rs @@ -149,9 +149,16 @@ impl Block { /// Access the [`orchard::Nullifier`]s from all transactions in this block. pub fn orchard_nullifiers(&self) -> impl Iterator { - self.transactions + // Work around a compiler panic (ICE) with flat_map(): + // https://github.com/rust-lang/rust/issues/105044 + #[allow(clippy::needless_collect)] + let nullifiers: Vec<_> = self + .transactions .iter() .flat_map(|transaction| transaction.orchard_nullifiers()) + .collect(); + + nullifiers.into_iter() } /// Count how many Sapling transactions exist in a block, diff --git a/zebra-network/src/isolated/tests/vectors.rs b/zebra-network/src/isolated/tests/vectors.rs index a182ebc13..d6e0f8158 100644 --- a/zebra-network/src/isolated/tests/vectors.rs +++ b/zebra-network/src/isolated/tests/vectors.rs @@ -120,7 +120,6 @@ async fn connect_isolated_sends_anonymised_version_message_mem_net(network: Netw /// Wait to receive a version message on `inbound_stream`, /// then check that it is correctly anonymised. -#[track_caller] async fn check_version_message( network: Network, inbound_stream: &mut Framed, diff --git a/zebra-network/src/peer/client/tests.rs b/zebra-network/src/peer/client/tests.rs index 4b3d0eef1..50730244d 100644 --- a/zebra-network/src/peer/client/tests.rs +++ b/zebra-network/src/peer/client/tests.rs @@ -90,10 +90,12 @@ impl ClientTestHarness { /// Drops the mocked heartbeat shutdown receiver endpoint. pub fn drop_heartbeat_shutdown_receiver(&mut self) { - let _ = self + let hearbeat_future = self .shutdown_receiver .take() - .expect("heartbeat shutdown receiver endpoint has already been dropped"); + .expect("unexpected test failure: heartbeat shutdown receiver endpoint has already been dropped"); + + std::mem::drop(hearbeat_future); } /// Closes the receiver endpoint of [`ClientRequest`]s that are supposed to be sent to the diff --git a/zebra-network/src/peer_set/set/tests/prop.rs b/zebra-network/src/peer_set/set/tests/prop.rs index efd7a8968..24b3c9ab5 100644 --- a/zebra-network/src/peer_set/set/tests/prop.rs +++ b/zebra-network/src/peer_set/set/tests/prop.rs @@ -145,7 +145,8 @@ proptest! { } // Send a request to all peers - let _ = peer_set.route_broadcast(Request::AdvertiseBlock(block_hash)); + let response_future = peer_set.route_broadcast(Request::AdvertiseBlock(block_hash)); + std::mem::drop(response_future); // Check how many peers received the request let mut received = 0; @@ -213,7 +214,8 @@ proptest! { let number_of_peers_to_broadcast = peer_set.number_of_peers_to_broadcast(); // Send a request to all peers we have now - let _ = peer_set.route_broadcast(Request::AdvertiseBlock(block_hash)); + let response_future = peer_set.route_broadcast(Request::AdvertiseBlock(block_hash)); + std::mem::drop(response_future); // Check how many peers received the request let mut received = 0; @@ -273,7 +275,8 @@ proptest! { } // this will panic as expected - let _ = peer_set.route_broadcast(Request::AdvertiseBlock(block_hash)); + let response_future = peer_set.route_broadcast(Request::AdvertiseBlock(block_hash)); + std::mem::drop(response_future); Ok::<_, TestCaseError>(()) })?; diff --git a/zebra-state/src/service/finalized_state/zebra_db/metrics.rs b/zebra-state/src/service/finalized_state/zebra_db/metrics.rs index 1f01f028d..9f102ec80 100644 --- a/zebra-state/src/service/finalized_state/zebra_db/metrics.rs +++ b/zebra-state/src/service/finalized_state/zebra_db/metrics.rs @@ -33,11 +33,13 @@ pub(crate) fn block_precommit_metrics(block: &Block, hash: block::Hash, height: .flat_map(|t| t.sapling_nullifiers()) .count(); - let orchard_nullifier_count = block + // Work around a compiler panic (ICE) with flat_map(): + // https://github.com/rust-lang/rust/issues/105044 + let orchard_nullifier_count: usize = block .transactions .iter() - .flat_map(|t| t.orchard_nullifiers()) - .count(); + .map(|t| t.orchard_nullifiers().count()) + .sum(); tracing::debug!( ?hash,