Skip to content

Commit

Permalink
docs: detailed use of get_justification in informal spec (#204)
Browse files Browse the repository at this point in the history
  • Loading branch information
brunoffranca authored Oct 4, 2024
1 parent d6e6780 commit d41ac00
Show file tree
Hide file tree
Showing 4 changed files with 240 additions and 217 deletions.
24 changes: 12 additions & 12 deletions node/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 10 additions & 2 deletions spec/informal-spec/proposer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,21 @@ fn on_start(replica_state: &ReplicaState) {
// Get the justification for this view. If we have both a commit QC
// and a timeout QC for this view (highly unlikely), we should prefer
// to use the commit QC.
let justification = replica_state.get_justification(cur_view);
let justification = replica_state.create_justification();

assert!(justification.view() == cur_view);

// Get the block number and check if this must be a reproposal.
let (block_number, opt_block_hash) = justification.get_implied_block();

// Propose only if you have collected all committed blocks so far.
assert!(block_number == self.committed_blocks.last().map_or(0,|b|b.commit_qc.vote.block_number+1));
assert!(
block_number
== self
.committed_blocks
.last()
.map_or(0, |b| b.commit_qc.vote.block_number + 1)
);

// Now we create the block.
let block = if opt_block_hash.is_some() {
Expand Down
Loading

0 comments on commit d41ac00

Please sign in to comment.