Skip to content
This repository has been archived by the owner on Jan 11, 2024. It is now read-only.

Commit

Permalink
ignore proposal height
Browse files Browse the repository at this point in the history
  • Loading branch information
cryptoAtwill committed Nov 29, 2023
1 parent 2a6acf2 commit b742886
Showing 1 changed file with 16 additions and 8 deletions.
24 changes: 16 additions & 8 deletions fendermint/vm/topdown/src/finality/null.rs
Original file line number Diff line number Diff line change
Expand Up @@ -184,13 +184,6 @@ impl FinalityWithNull {
unreachable!("last committed finality will be available at this point");
};

// this is possible due to delayed execution as the proposed height's data cannot be
// executed because they have yet to be executed.
if last_committed_height == latest_height {
tracing::debug!(last_committed_height, latest_height, "no new blocks from cache");
return Ok(None);
}

let max_proposal_height = last_committed_height + self.config.max_proposal_range();
let candidate_height = min(max_proposal_height, latest_height);
tracing::debug!(max_proposal_height, candidate_height, "propose heights");
Expand All @@ -208,8 +201,23 @@ impl FinalityWithNull {
let r =
self.first_non_null_block_before(first_non_null_height - self.config.proposal_delay())?;
tracing::debug!(delayed_height = r, delay = self.config.proposal_delay());
if let Some(final_proposal) = r {
// this is possible due to delayed execution as the proposed height's data cannot be
// executed because they have yet to be executed.
return if last_committed_height == final_proposal {
tracing::debug!(
last_committed_height,
final_proposal,
"no new blocks from cache, not proposing"
);
Ok(None)
} else {
Ok(Some(final_proposal))
};
}

Ok(r)
tracing::debug!(last_committed_heigh, "no non-null block after delay");
Ok(None)
}

fn handle_null_block<T, F: Fn(&ParentViewPayload) -> T, D: Fn() -> T>(
Expand Down

0 comments on commit b742886

Please sign in to comment.