Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(consensus): rename notify_decision to decision_reached #465

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion crates/sequencing/papyrus_consensus/src/manager.rs
Original file line number Diff line number Diff line change
@@ -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) => {
6 changes: 3 additions & 3 deletions crates/sequencing/papyrus_consensus/src/manager_test.rs
Original file line number Diff line number Diff line change
@@ -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();
Original file line number Diff line number Diff line change
@@ -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>,
Original file line number Diff line number Diff line change
@@ -104,7 +104,7 @@ async fn decision() {
let (_, mut papyrus_context, _, mut sync_network) = test_setup();
let block = PapyrusConsensusBlock::default();
let precommit = Vote::default();
papyrus_context.notify_decision(block, vec![precommit.clone()]).await.unwrap();
papyrus_context.decision_reached(block, vec![precommit.clone()]).await.unwrap();
assert_eq!(sync_network.messages_to_broadcast_receiver.next().await.unwrap(), precommit);
}

2 changes: 1 addition & 1 deletion crates/sequencing/papyrus_consensus/src/test_utils.rs
Original file line number Diff line number Diff line change
@@ -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>,
2 changes: 1 addition & 1 deletion crates/sequencing/papyrus_consensus/src/types.rs
Original file line number Diff line number Diff line change
@@ -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>,
Loading