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

[consensus] rename some network methods and failpoints to make them more consistent #2130

Merged
merged 2 commits into from
Jul 21, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
4 changes: 2 additions & 2 deletions consensus/src/block_storage/sync_manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ impl BlockStore {
if highest_commit_cert.ledger_info().ledger_info().ends_epoch() {
retriever
.network
.notify_epoch_change(EpochChangeProof::new(
.send_epoch_change(EpochChangeProof::new(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was trying to differentiate it from send but maybe did a bad job. notify == notify self so this doesn't go through network

vec![highest_ordered_cert.ledger_info().clone()],
/* more = */ false,
))
Expand Down Expand Up @@ -333,7 +333,7 @@ impl BlockStore {
&& self.block_exists(ledger_info.commit_info().id())
&& self.ordered_root().round() >= ledger_info.commit_info().round()
{
network.notify_commit_proof(ledger_info.clone()).await
network.send_commit_proof(ledger_info.clone()).await
}
}

Expand Down
2 changes: 1 addition & 1 deletion consensus/src/experimental/buffer_manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ impl BufferManager {
let aggregated_item = item.unwrap_aggregated();
if aggregated_item.commit_proof.ledger_info().ends_epoch() {
self.commit_msg_tx
.notify_epoch_change(EpochChangeProof::new(
.send_epoch_change(EpochChangeProof::new(
vec![aggregated_item.commit_proof.clone()],
false,
))
Expand Down
16 changes: 8 additions & 8 deletions consensus/src/network.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ impl NetworkSender {
from: Author,
timeout: Duration,
) -> anyhow::Result<BlockRetrievalResponse> {
fail_point!("consensus::send_block_retrieval", |_| {
fail_point!("consensus::request_block", |_| {
Err(anyhow::anyhow!("Injected error in request_block"))
});

Expand Down Expand Up @@ -169,31 +169,31 @@ impl NetworkSender {
}

pub async fn broadcast_proposal(&mut self, proposal_msg: ProposalMsg) {
fail_point!("consensus::send_proposal", |_| ());
fail_point!("consensus::broadcast_proposal", |_| ());
let msg = ConsensusMsg::ProposalMsg(Box::new(proposal_msg));
self.broadcast(msg).await
}

pub async fn broadcast_sync_info(&mut self, sync_info_msg: SyncInfo) {
fail_point!("consensus::send_sync_info", |_| ());
fail_point!("consensus::broadcast_sync_info", |_| ());
let msg = ConsensusMsg::SyncInfo(Box::new(sync_info_msg));
self.broadcast(msg).await
}

pub async fn broadcast_timeout_vote(&mut self, timeout_vote_msg: VoteMsg) {
fail_point!("consensus::send_vote", |_| ());
fail_point!("consensus::broadcast_timeout_vote", |_| ());
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Everything else is just aesthetics. This is the only significant change (it conflicts with L210)

let msg = ConsensusMsg::VoteMsg(Box::new(timeout_vote_msg));
self.broadcast(msg).await
}

pub async fn broadcast_epoch_change(&mut self, epoch_chnage_proof: EpochChangeProof) {
fail_point!("consensus::send_epoch_change", |_| ());
fail_point!("consensus::broadcast_epoch_change", |_| ());
let msg = ConsensusMsg::EpochChangeProof(Box::new(epoch_chnage_proof));
self.broadcast(msg).await
}

pub async fn broadcast_commit_vote(&mut self, commit_vote: CommitVote) {
fail_point!("consensus::send_commit_vote", |_| ());
fail_point!("consensus::broadcast_commit_vote", |_| ());
let msg = ConsensusMsg::CommitVoteMsg(Box::new(commit_vote));
self.broadcast(msg).await
}
Expand All @@ -218,14 +218,14 @@ impl NetworkSender {
self.send(msg, recipients).await
}

pub async fn notify_epoch_change(&mut self, proof: EpochChangeProof) {
pub async fn send_epoch_change(&mut self, proof: EpochChangeProof) {
fail_point!("consensus::send_epoch_change", |_| ());
let msg = ConsensusMsg::EpochChangeProof(Box::new(proof));
self.send(msg, vec![self.author]).await
}

/// Sends the ledger info to self buffer manager
pub async fn notify_commit_proof(&self, ledger_info: LedgerInfoWithSignatures) {
pub async fn send_commit_proof(&self, ledger_info: LedgerInfoWithSignatures) {
fail_point!("consensus::send_commit_proof", |_| ());

// this requires re-verification of the ledger info we can probably optimize it later
Expand Down