From 121618f4b0cb93aebcb15bc0ff48a500e9a42ae6 Mon Sep 17 00:00:00 2001 From: Herr Seppia Date: Mon, 8 Jan 2024 11:28:37 +0100 Subject: [PATCH] consensus: remove `iteration` from `collect_from_past` --- consensus/src/iteration_ctx.rs | 15 +++++---------- consensus/src/msg_handler.rs | 1 - consensus/src/proposal/handler.rs | 1 - consensus/src/ratification/handler.rs | 2 +- consensus/src/validation/handler.rs | 2 +- 5 files changed, 7 insertions(+), 14 deletions(-) diff --git a/consensus/src/iteration_ctx.rs b/consensus/src/iteration_ctx.rs index 609424a9bd..00f6d119a7 100644 --- a/consensus/src/iteration_ctx.rs +++ b/consensus/src/iteration_ctx.rs @@ -149,28 +149,23 @@ impl IterationCtx { msg: Message, ) -> Option { let committee = self.committees.get_committee(msg.header.get_step())?; - let iteration = msg.header.iteration; match msg.topic() { node_data::message::Topics::Candidate => { let mut handler = self.proposal_handler.lock().await; - _ = handler - .collect_from_past(msg, ru, iteration, committee) - .await; + _ = handler.collect_from_past(msg, ru, committee).await; } node_data::message::Topics::Validation => { let mut handler = self.validation_handler.lock().await; - if let Ok(Ready(m)) = handler - .collect_from_past(msg, ru, iteration, committee) - .await + if let Ok(Ready(m)) = + handler.collect_from_past(msg, ru, committee).await { return Some(m); } } node_data::message::Topics::Ratification => { let mut handler = self.ratification_handler.lock().await; - if let Ok(Ready(m)) = handler - .collect_from_past(msg, ru, iteration, committee) - .await + if let Ok(Ready(m)) = + handler.collect_from_past(msg, ru, committee).await { return Some(m); } diff --git a/consensus/src/msg_handler.rs b/consensus/src/msg_handler.rs index 2e14efd8d5..83299096ac 100644 --- a/consensus/src/msg_handler.rs +++ b/consensus/src/msg_handler.rs @@ -89,7 +89,6 @@ pub trait MsgHandler { &mut self, msg: T, ru: &RoundUpdate, - iteration: u8, committee: &Committee, ) -> Result; diff --git a/consensus/src/proposal/handler.rs b/consensus/src/proposal/handler.rs index c4ea1162f3..da62da09ec 100644 --- a/consensus/src/proposal/handler.rs +++ b/consensus/src/proposal/handler.rs @@ -61,7 +61,6 @@ impl MsgHandler for ProposalHandler { &mut self, msg: Message, _ru: &RoundUpdate, - _iteration: u8, _committee: &Committee, ) -> Result { Ok(HandleMsgOutput::Pending(msg)) diff --git a/consensus/src/ratification/handler.rs b/consensus/src/ratification/handler.rs index 25abe97798..bf120a031f 100644 --- a/consensus/src/ratification/handler.rs +++ b/consensus/src/ratification/handler.rs @@ -113,10 +113,10 @@ impl MsgHandler for RatificationHandler { &mut self, msg: Message, _ru: &RoundUpdate, - iteration: u8, committee: &Committee, ) -> Result { let ratification = Self::unwrap_msg(&msg)?; + let iteration = msg.header.iteration; // Collect vote, if msg payload is reduction type if let Some((hash, sv, quorum_reached)) = self.aggregator.collect_vote( diff --git a/consensus/src/validation/handler.rs b/consensus/src/validation/handler.rs index ccd21561e6..3a84b65cd4 100644 --- a/consensus/src/validation/handler.rs +++ b/consensus/src/validation/handler.rs @@ -139,9 +139,9 @@ impl MsgHandler for ValidationHandler { &mut self, msg: Message, _ru: &RoundUpdate, - iteration: u8, committee: &Committee, ) -> Result { + let iteration = msg.header.iteration; let signature = match &msg.payload { Payload::Validation(p) => Ok(p.signature), _ => Err(ConsensusError::InvalidMsgType),