From 01f946062c75fdbd584c6ed0a0da62869f4bbf6b Mon Sep 17 00:00:00 2001 From: Matan Markind <matan@starkware.co> Date: Wed, 14 Aug 2024 15:24:48 +0300 Subject: [PATCH] refactor(consensus): rename notify_decision to decision_reached --- crates/sequencing/papyrus_consensus/src/manager.rs | 2 +- crates/sequencing/papyrus_consensus/src/manager_test.rs | 6 +++--- .../papyrus_consensus/src/papyrus_consensus_context.rs | 2 +- crates/sequencing/papyrus_consensus/src/test_utils.rs | 2 +- crates/sequencing/papyrus_consensus/src/types.rs | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/crates/sequencing/papyrus_consensus/src/manager.rs b/crates/sequencing/papyrus_consensus/src/manager.rs index 80df134a3c2..3e24434eb73 100644 --- a/crates/sequencing/papyrus_consensus/src/manager.rs +++ b/crates/sequencing/papyrus_consensus/src/manager.rs @@ -65,7 +65,7 @@ where tokio::select! { decision = run_height => { let decision = decision?; - context.notify_decision(decision.block, decision.precommits).await?; + context.decision_reached(decision.block, decision.precommits).await?; current_height = current_height.unchecked_next(); }, sync_height = sync_height(current_height, &mut sync_receiver) => { diff --git a/crates/sequencing/papyrus_consensus/src/manager_test.rs b/crates/sequencing/papyrus_consensus/src/manager_test.rs index 6f26a5d138d..337b475bb03 100644 --- a/crates/sequencing/papyrus_consensus/src/manager_test.rs +++ b/crates/sequencing/papyrus_consensus/src/manager_test.rs @@ -74,7 +74,7 @@ mock! { fin_receiver: oneshot::Receiver<BlockHash>, ) -> Result<(), ConsensusError>; - async fn notify_decision( + async fn decision_reached( &mut self, block: TestBlock, precommits: Vec<Vote>, @@ -184,7 +184,7 @@ async fn run_consensus_sync() { context.expect_validators().returning(move |_| vec![*PROPOSER_ID, *VALIDATOR_ID]); context.expect_proposer().returning(move |_, _| *PROPOSER_ID); context.expect_broadcast().returning(move |_| Ok(())); - context.expect_notify_decision().return_once(move |block, votes| { + context.expect_decision_reached().return_once(move |block, votes| { assert_eq!(block.id(), BlockHash(Felt::TWO)); assert_eq!(votes[0].height, 2); decision_tx.send(()).unwrap(); @@ -247,7 +247,7 @@ async fn run_consensus_sync_cancellation_safety() { Ok(()) }); context.expect_broadcast().returning(move |_| Ok(())); - context.expect_notify_decision().return_once(|block, votes| { + context.expect_decision_reached().return_once(|block, votes| { assert_eq!(block.id(), BlockHash(Felt::ONE)); assert_eq!(votes[0].height, 1); decision_tx.send(()).unwrap(); diff --git a/crates/sequencing/papyrus_consensus/src/papyrus_consensus_context.rs b/crates/sequencing/papyrus_consensus/src/papyrus_consensus_context.rs index 33bd87b3ffd..87d2e092532 100644 --- a/crates/sequencing/papyrus_consensus/src/papyrus_consensus_context.rs +++ b/crates/sequencing/papyrus_consensus/src/papyrus_consensus_context.rs @@ -236,7 +236,7 @@ impl ConsensusContext for PapyrusConsensusContext { Ok(()) } - async fn notify_decision( + async fn decision_reached( &mut self, block: Self::Block, precommits: Vec<Vote>, diff --git a/crates/sequencing/papyrus_consensus/src/test_utils.rs b/crates/sequencing/papyrus_consensus/src/test_utils.rs index 5b1d3ce9359..465014882b3 100644 --- a/crates/sequencing/papyrus_consensus/src/test_utils.rs +++ b/crates/sequencing/papyrus_consensus/src/test_utils.rs @@ -58,7 +58,7 @@ mock! { fin_receiver: oneshot::Receiver<BlockHash>, ) -> Result<(), ConsensusError>; - async fn notify_decision( + async fn decision_reached( &mut self, block: TestBlock, precommits: Vec<Vote>, diff --git a/crates/sequencing/papyrus_consensus/src/types.rs b/crates/sequencing/papyrus_consensus/src/types.rs index bd81fe8c992..621563417e5 100644 --- a/crates/sequencing/papyrus_consensus/src/types.rs +++ b/crates/sequencing/papyrus_consensus/src/types.rs @@ -140,7 +140,7 @@ pub trait ConsensusContext { /// - `block` identifies the decision. /// - `precommits` - All precommits must be for the same `(block.id(), height, round)` and form /// a quorum (>2/3 of the voting power) for this height. - async fn notify_decision( + async fn decision_reached( &mut self, block: Self::Block, precommits: Vec<Vote>,