Skip to content

Commit

Permalink
sync when justified block is not found
Browse files Browse the repository at this point in the history
  • Loading branch information
sdbondi committed Jan 12, 2024
1 parent ce1f235 commit bf225dc
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 16 deletions.
7 changes: 7 additions & 0 deletions dan_layer/consensus/src/hotstuff/on_receive_local_proposal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,13 @@ impl<TConsensusSpec: ConsensusSpec> OnReceiveLocalProposalHandler<TConsensusSpec
self.store.with_write_tx(|tx| {
match self.validate_local_proposed_block(tx, block, &local_committee, &local_committee_shard) {
Ok(validated) => Ok(Some(validated)),
// Propagate this error out as sync is needed in the case where we have a valid QC but do not know the
// block
Err(
err @ HotStuffError::ProposalValidationError(ProposalValidationError::JustifyBlockNotFound {
..
}),
) => Err(err),
// Validation errors should not cause a FAILURE state transition
Err(HotStuffError::ProposalValidationError(err)) => {
warn!(target: LOG_TARGET, "❌ Block failed validation: {}", err);
Expand Down
12 changes: 0 additions & 12 deletions dan_layer/consensus/src/hotstuff/pacemaker_handle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,18 +98,6 @@ impl PaceMakerHandle {
.map_err(|e| HotStuffError::PacemakerChannelDropped { details: e.to_string() })
}

pub async fn reset_view(
&self,
last_seen_height: NodeHeight,
high_qc_height: NodeHeight,
) -> Result<(), HotStuffError> {
self.current_height.set(last_seen_height);
self.sender
.send(PacemakerRequest::ResetLeaderTimeout { high_qc_height })
.await
.map_err(|e| HotStuffError::PacemakerChannelDropped { details: e.to_string() })
}

pub fn current_height(&self) -> NodeHeight {
self.current_height.get()
}
Expand Down
4 changes: 0 additions & 4 deletions dan_layer/consensus/src/hotstuff/worker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -494,10 +494,6 @@ where TConsensusSpec: ConsensusSpec
self.pacemaker.current_height()
);

self.pacemaker
.reset_view(high_qc.block_height(), high_qc.block_height())
.await?;

let current_epoch = self.epoch_manager.current_epoch().await?;
// Send the request message
if self
Expand Down

0 comments on commit bf225dc

Please sign in to comment.