diff --git a/crates/sequencing/papyrus_consensus/src/test_utils.rs b/crates/sequencing/papyrus_consensus/src/test_utils.rs index 6a76f6cc95..2d67bbe7d7 100644 --- a/crates/sequencing/papyrus_consensus/src/test_utils.rs +++ b/crates/sequencing/papyrus_consensus/src/test_utils.rs @@ -90,6 +90,8 @@ mock! { precommits: Vec, ) -> Result<(), ConsensusError>; + async fn try_sync(&mut self, height: BlockNumber) -> bool; + async fn set_height_and_round(&mut self, height: BlockNumber, round: Round); } } diff --git a/crates/sequencing/papyrus_consensus/src/types.rs b/crates/sequencing/papyrus_consensus/src/types.rs index 48244cf8f2..aa2b3417d9 100644 --- a/crates/sequencing/papyrus_consensus/src/types.rs +++ b/crates/sequencing/papyrus_consensus/src/types.rs @@ -112,6 +112,10 @@ pub trait ConsensusContext { precommits: Vec, ) -> Result<(), ConsensusError>; + /// Attempt to learn of a decision from the sync protocol. + /// Returns true if a decision was learned so consensus can proceed. + async fn try_sync(&mut self, height: BlockNumber) -> bool; + /// Update the context with the current height and round. /// Must be called at the beginning of each height. async fn set_height_and_round(&mut self, height: BlockNumber, round: Round); diff --git a/crates/sequencing/papyrus_consensus_orchestrator/src/papyrus_consensus_context.rs b/crates/sequencing/papyrus_consensus_orchestrator/src/papyrus_consensus_context.rs index b7cab99875..3bff3f3758 100644 --- a/crates/sequencing/papyrus_consensus_orchestrator/src/papyrus_consensus_context.rs +++ b/crates/sequencing/papyrus_consensus_orchestrator/src/papyrus_consensus_context.rs @@ -301,6 +301,11 @@ impl ConsensusContext for PapyrusConsensusContext { Ok(()) } + async fn try_sync(&mut self, _height: BlockNumber) -> bool { + // TODO(Asmaa): Implement this. + todo!() + } + async fn set_height_and_round(&mut self, _height: BlockNumber, _round: Round) { // No-op } diff --git a/crates/sequencing/papyrus_consensus_orchestrator/src/sequencer_consensus_context.rs b/crates/sequencing/papyrus_consensus_orchestrator/src/sequencer_consensus_context.rs index f9e07c10fd..6c9ee3b370 100644 --- a/crates/sequencing/papyrus_consensus_orchestrator/src/sequencer_consensus_context.rs +++ b/crates/sequencing/papyrus_consensus_orchestrator/src/sequencer_consensus_context.rs @@ -339,6 +339,11 @@ impl ConsensusContext for SequencerConsensusContext { Ok(()) } + async fn try_sync(&mut self, _height: BlockNumber) -> bool { + // TODO(Asmaa): Implement sync. + todo!() + } + async fn set_height_and_round(&mut self, height: BlockNumber, round: Round) { if self.current_height.map(|h| height > h).unwrap_or(true) { self.current_height = Some(height);