Skip to content

Commit

Permalink
temp
Browse files Browse the repository at this point in the history
  • Loading branch information
rahxephon89 committed Nov 16, 2024
1 parent e8a5cc3 commit 467af26
Show file tree
Hide file tree
Showing 6 changed files with 54 additions and 53 deletions.
2 changes: 1 addition & 1 deletion consensus/src/block_storage/sync_manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ impl BlockStore {
.send_epoch_change(EpochChangeProof::new(
vec![highest_quorum_cert.ledger_info().clone()],
/* more = */ false,
))
), id)
.await;
}
Ok(())
Expand Down
2 changes: 1 addition & 1 deletion consensus/src/dag/adapter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ pub trait OrderedNotifier: Send + Sync {

#[async_trait]
pub trait ProofNotifier: Send + Sync {
async fn send_epoch_change(&self, proof: EpochChangeProof);
async fn send_epoch_change(&self, proof: EpochChangeProof, id: usize);

async fn send_commit_proof(&self, ledger_info: LedgerInfoWithSignatures, id: usize);
}
Expand Down
2 changes: 1 addition & 1 deletion consensus/src/dag/dag_state_sync.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ impl StateSyncTrigger {
.send_epoch_change(EpochChangeProof::new(
vec![ledger_info_with_sigs.clone()],
/* more = */ false,
))
), 0)
.await;
return Ok(SyncOutcome::EpochEnds);
}
Expand Down
1 change: 1 addition & 0 deletions consensus/src/epoch_manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -808,6 +808,7 @@ impl<P: OnChainConfigProvider> EpochManager<P> {
epoch = epoch_state.epoch,
validators = epoch_state.verifier.to_string(),
root_block = %recovery_data.root_block(),
id = id,
"Starting new epoch",
);

Expand Down
98 changes: 49 additions & 49 deletions consensus/src/network.rs
Original file line number Diff line number Diff line change
Expand Up @@ -425,14 +425,14 @@ impl NetworkSender {
id: 0,
consensus_msg: msg.clone()
};
let msg_1 = ConsensusMsg {
id: 1,
consensus_msg: msg.clone()
};
let _ = self.send_rpc(recipient.clone(), msg_0, Duration::from_millis(500))
.await
.map(|_| ());
self.send_rpc(recipient, msg_1, Duration::from_millis(500))
// let msg_1 = ConsensusMsg {
// id: 1,
// consensus_msg: msg.clone()
// };
// let _ = self.send_rpc(recipient.clone(), msg_0, Duration::from_millis(500))
// .await
// .map(|_| ());
self.send_rpc(recipient, msg_0, Duration::from_millis(500))
.await
.map(|_| ())
}
Expand Down Expand Up @@ -504,27 +504,27 @@ impl NetworkSender {
id: 0,
consensus_msg: msg.clone()
};
let msg_1 = ConsensusMsg {
id: 1,
consensus_msg: msg.clone()
};
self.send(msg_0, recipients.clone()).await;
self.send(msg_1, recipients).await
// let msg_1 = ConsensusMsg {
// id: 1,
// consensus_msg: msg.clone()
// };
// self.send(msg_0, recipients.clone()).await;
self.send(msg_0, recipients).await
}

pub async fn send_epoch_change(&self, proof: EpochChangeProof) {
pub async fn send_epoch_change(&self, proof: EpochChangeProof, id: usize) {
fail_point!("consensus::send::epoch_change", |_| ());
let msg = ConsensusMsg_::EpochChangeProof(Box::new(proof));
let msg_0 = ConsensusMsg {
id: 0,
consensus_msg: msg.clone()
};
let msg_1 = ConsensusMsg {
id: 1,
let msg = ConsensusMsg {
id,
consensus_msg: msg.clone()
};
self.send(msg_0, vec![self.author]).await;
self.send(msg_1, vec![self.author]).await
// let msg_1 = ConsensusMsg {
// id: 1,
// consensus_msg: msg.clone()
// };
// self.send(msg_0, vec![self.author]).await;
self.send(msg, vec![self.author]).await
}

/// Sends the ledger info to self buffer manager
Expand Down Expand Up @@ -595,12 +595,12 @@ impl QuorumStoreSender for NetworkSender {
id: 0,
consensus_msg: msg.clone()
};
let msg_1 = ConsensusMsg {
id: 1,
consensus_msg: msg.clone()
};
self.send(msg_0, recipients.clone()).await;
self.send(msg_1, recipients).await
// let msg_1 = ConsensusMsg {
// id: 1,
// consensus_msg: msg.clone()
// };
// self.send(msg_0, recipients.clone()).await;
self.send(msg_0, recipients).await
}

async fn broadcast_batch_msg(&mut self, batches: Vec<Batch>) {
Expand All @@ -610,12 +610,12 @@ impl QuorumStoreSender for NetworkSender {
id: 0,
consensus_msg: msg.clone()
};
let msg_1 = ConsensusMsg {
id: 1,
consensus_msg: msg.clone()
};
self.broadcast(msg_0).await;
self.broadcast(msg_1).await
// let msg_1 = ConsensusMsg {
// id: 1,
// consensus_msg: msg.clone()
// };
// self.broadcast(msg_0).await;
self.broadcast(msg_0).await
}

async fn broadcast_proof_of_store_msg(&mut self, proofs: Vec<ProofOfStore>) {
Expand All @@ -625,12 +625,12 @@ impl QuorumStoreSender for NetworkSender {
id: 0,
consensus_msg: msg.clone()
};
let msg_1 = ConsensusMsg {
id: 1,
consensus_msg: msg.clone()
};
self.broadcast(msg_0).await;
self.broadcast(msg_1).await
// let msg_1 = ConsensusMsg {
// id: 1,
// consensus_msg: msg.clone()
// };
// self.broadcast(msg_0).await;
self.broadcast(msg_0).await
}

async fn send_proof_of_store_msg_to_self(&mut self, proofs: Vec<ProofOfStore>) {
Expand All @@ -640,12 +640,12 @@ impl QuorumStoreSender for NetworkSender {
id: 0,
consensus_msg: msg.clone()
};
let msg_1 = ConsensusMsg {
id: 1,
consensus_msg: msg.clone()
};
self.send(msg_0, vec![self.author.clone()]).await;
self.send(msg_1, vec![self.author]).await
// let msg_1 = ConsensusMsg {
// id: 1,
// consensus_msg: msg.clone()
// };
// self.send(msg_0, vec![self.author.clone()]).await;
self.send(msg_0, vec![self.author]).await
}
}

Expand Down Expand Up @@ -733,8 +733,8 @@ impl<Req: TConsensusMsg + RBMessage + 'static, Res: TConsensusMsg + RBMessage +

#[async_trait]
impl ProofNotifier for NetworkSender {
async fn send_epoch_change(&self, proof: EpochChangeProof) {
self.send_epoch_change(proof).await
async fn send_epoch_change(&self, proof: EpochChangeProof, id: usize) {
self.send_epoch_change(proof, id).await
}

async fn send_commit_proof(&self, ledger_info: LedgerInfoWithSignatures, id: usize) {
Expand Down
2 changes: 1 addition & 1 deletion consensus/src/pipeline/buffer_manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -543,7 +543,7 @@ impl BufferManager {
// this needs to be done after creating the persisting request to avoid it being lost
if commit_proof.ledger_info().ends_epoch() {
self.commit_msg_tx
.send_epoch_change(EpochChangeProof::new(vec![commit_proof], false))
.send_epoch_change(EpochChangeProof::new(vec![commit_proof], false), 0)
.await;
}
info!("Advance head to {:?}", self.buffer.head_cursor());
Expand Down

0 comments on commit 467af26

Please sign in to comment.