Skip to content

Commit

Permalink
chore: rename broadcasted_message_manager to _metadata (#1624)
Browse files Browse the repository at this point in the history
  • Loading branch information
guy-starkware authored Oct 30, 2024
1 parent 2c672a2 commit bdb72e6
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 10 deletions.
6 changes: 3 additions & 3 deletions crates/mempool_p2p/src/runner/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -66,15 +66,15 @@ 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);
}
}
}
}
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);
}
}
Expand Down
7 changes: 4 additions & 3 deletions crates/sequencing/papyrus_consensus/src/manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand All @@ -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())
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,14 +130,14 @@ impl Stream for NetworkReceiver {
) -> Poll<Option<Self::Item>> {
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)));
}
}
}
Expand Down

0 comments on commit bdb72e6

Please sign in to comment.