Skip to content

Commit

Permalink
Remove unnecessary commit decision broadcast (#13358)
Browse files Browse the repository at this point in the history
* Remove unnecessary commit decision broadcast

* Update unit test
  • Loading branch information
vusirikala authored Jun 14, 2024
1 parent 2823f2e commit 5530a29
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 11 deletions.
11 changes: 2 additions & 9 deletions consensus/src/pipeline/buffer_manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -384,15 +384,8 @@ impl BufferManager {
let aggregated_item = item.unwrap_aggregated();
let block = aggregated_item.executed_blocks.last().unwrap().block();
observe_block(block.timestamp_usecs(), BlockStage::COMMIT_CERTIFIED);
// TODO: As all the validators broadcast commit votes directly to all other validators,
// the proposer do not have to broadcast commit decision again. Remove this if block.
// if we're the proposer for the block, we're responsible to broadcast the commit decision.
if block.author() == Some(self.author) {
let commit_decision = CommitMessage::Decision(CommitDecision::new(
aggregated_item.commit_proof.clone(),
));
self.commit_proof_rb_handle = self.do_reliable_broadcast(commit_decision);
}
// As all the validators broadcast commit votes directly to all other validators,
// the proposer do not have to broadcast commit decision again.
let commit_proof = aggregated_item.commit_proof.clone();
if commit_proof.ledger_info().ends_epoch() {
// the epoch ends, reset to avoid executing more blocks, execute after
Expand Down
5 changes: 3 additions & 2 deletions consensus/src/pipeline/tests/buffer_manager_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -320,8 +320,9 @@ fn buffer_manager_happy_path_test() {
.ok();
}

// commit decision will be sent too, so 3 * 2
for _ in 0..6 {
// Only commit votes are sent, so 3 commit votes are expected
// Commit decision is no longer broadcasted
for _ in 0..3 {
if let Some(msg) = self_loop_rx.next().await {
loopback_commit_vote(msg, &msg_tx, &verifier).await;
}
Expand Down

0 comments on commit 5530a29

Please sign in to comment.