From bdb72e68fed013b0ee17ea4f3194bc013126dad0 Mon Sep 17 00:00:00 2001 From: guy-starkware Date: Wed, 30 Oct 2024 07:55:41 -0700 Subject: [PATCH] chore: rename broadcasted_message_manager to _metadata (#1624) --- crates/mempool_p2p/src/runner/mod.rs | 6 +++--- crates/sequencing/papyrus_consensus/src/manager.rs | 7 ++++--- .../papyrus_consensus/src/simulation_network_receiver.rs | 8 ++++---- 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/crates/mempool_p2p/src/runner/mod.rs b/crates/mempool_p2p/src/runner/mod.rs index 66d82f0dbe..eaf3cca2cf 100644 --- a/crates/mempool_p2p/src/runner/mod.rs +++ b/crates/mempool_p2p/src/runner/mod.rs @@ -53,7 +53,7 @@ impl ComponentStarter for MempoolP2pRunner { panic!("Network stopped unexpectedly"); } // TODO(eitan): Extract the logic into a handle_broadcasted_message method - Some((message_result, broadcasted_message_manager)) = self.broadcasted_topic_server.next() => { + Some((message_result, broadcasted_message_metadata)) = self.broadcasted_topic_server.next() => { match message_result { Ok(message) => { // TODO(eitan): Add message metadata. @@ -66,7 +66,7 @@ impl ComponentStarter for MempoolP2pRunner { Err(e) => { warn!( "Failed to forward transaction from MempoolP2pRunner to gateway: {:?}", e); - if let Err(e) = self.broadcast_topic_client.report_peer(broadcasted_message_manager).await { + if let Err(e) = self.broadcast_topic_client.report_peer(broadcasted_message_metadata).await { warn!("Failed to report peer: {:?}", e); } } @@ -74,7 +74,7 @@ impl ComponentStarter for MempoolP2pRunner { } Err(e) => { warn!("Received a faulty transaction from network: {:?}. Attempting to report the sending peer", e); - if let Err(e) = self.broadcast_topic_client.report_peer(broadcasted_message_manager).await { + if let Err(e) = self.broadcast_topic_client.report_peer(broadcasted_message_metadata).await { warn!("Failed to report peer: {:?}", e); } } diff --git a/crates/sequencing/papyrus_consensus/src/manager.rs b/crates/sequencing/papyrus_consensus/src/manager.rs index 3a9f18bb7e..94a1606803 100644 --- a/crates/sequencing/papyrus_consensus/src/manager.rs +++ b/crates/sequencing/papyrus_consensus/src/manager.rs @@ -235,7 +235,7 @@ where return Ok(msg); } - let (msg, broadcasted_message_manager) = + let (msg, broadcasted_message_metadata) = broadcasted_messages_receiver.next().await.ok_or_else(|| { ConsensusError::InternalNetworkError( "NetworkReceiver should never be closed".to_string(), @@ -244,12 +244,13 @@ where match msg { // TODO(matan): Return report_sender for use in later errors by SHC. Ok(msg) => { - let _ = broadcast_topic_client.continue_propagation(&broadcasted_message_manager).await; + let _ = + broadcast_topic_client.continue_propagation(&broadcasted_message_metadata).await; Ok(msg) } Err(e) => { // Failed to parse consensus message - let _ = broadcast_topic_client.report_peer(broadcasted_message_manager).await; + let _ = broadcast_topic_client.report_peer(broadcasted_message_metadata).await; Err(e.into()) } } diff --git a/crates/sequencing/papyrus_consensus/src/simulation_network_receiver.rs b/crates/sequencing/papyrus_consensus/src/simulation_network_receiver.rs index 9f55939a2f..28fe2f8fc5 100644 --- a/crates/sequencing/papyrus_consensus/src/simulation_network_receiver.rs +++ b/crates/sequencing/papyrus_consensus/src/simulation_network_receiver.rs @@ -130,14 +130,14 @@ impl Stream for NetworkReceiver { ) -> Poll> { loop { let item = self.broadcasted_messages_receiver.poll_next_unpin(cx); - let (msg, broadcasted_message_manager) = match item { - Poll::Ready(Some((Ok(msg), broadcasted_message_manager))) => { - (msg, broadcasted_message_manager) + let (msg, broadcasted_message_metadata) = match item { + Poll::Ready(Some((Ok(msg), broadcasted_message_metadata))) => { + (msg, broadcasted_message_metadata) } _ => return item, }; if let Some(msg) = self.filter_msg(msg) { - return Poll::Ready(Some((Ok(msg), broadcasted_message_manager))); + return Poll::Ready(Some((Ok(msg), broadcasted_message_metadata))); } } }