Skip to content

Commit

Permalink
consensus: track down followup issues
Browse files Browse the repository at this point in the history
  • Loading branch information
herr-seppia committed Jul 10, 2024
1 parent 2cbe352 commit 55cc6a7
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion node/src/chain/fsm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -213,8 +213,11 @@ impl<N: Network, DB: database::DB, VM: vm::VMExecution> SimpleFSM<N, DB, VM> {
}

// FIXME: The block should return only if accepted. The current issue is
// that the impl of State::on_block_event don't return always the
// that the impl of State::on_block_event doesn't return always the
// accepted block, so we can't rely on them
//
// Due to this issue, we reset the outer timeout even if we are not
// accepting the received block
Ok(blk)
}

Expand Down Expand Up @@ -248,6 +251,13 @@ impl<N: Network, DB: database::DB, VM: vm::VMExecution> SimpleFSM<N, DB, VM> {
quorum: &payload::Quorum,
msg: &Message,
) -> anyhow::Result<Option<Block>> {
// FIXME: We should return the whole outcome for this quorum
// Basically we need to inform the upper layer if the received quorum is
// valid (even if it's a FailedQuorum)
// This will be usefull in order to:
// - Reset the idle timer if the current iteration reached a quorum
// - Move to next iteration if the quorum is a Failed one
// - Remove the FIXME in fsm::on_block_event
let res = match quorum.att.result {
RatificationResult::Success(Vote::Valid(hash)) => {
let local_header = self.acc.read().await.tip_header().await;
Expand Down Expand Up @@ -431,6 +441,9 @@ impl<DB: database::DB, VM: vm::VMExecution, N: Network> InSyncImpl<DB, VM, N> {
/// performed when exiting the state
async fn on_exiting(&mut self) {}

/// Return Some if there is the need to switch to OutOfSync mode.
/// This way the sync-up procedure to download all missing blocks from the
/// main chain will be triggered
async fn on_block_event(
&mut self,
remote_blk: &Block,
Expand Down Expand Up @@ -763,6 +776,7 @@ impl<DB: database::DB, VM: vm::VMExecution, N: Network>
self.pool.clear();
}

/// Return true if a transit back to InSync mode is needed
pub async fn on_block_event(
&mut self,
blk: &Block,
Expand Down

0 comments on commit 55cc6a7

Please sign in to comment.