Skip to content

Commit

Permalink
Comment input checks
Browse files Browse the repository at this point in the history
  • Loading branch information
gabrielbosio committed Sep 23, 2024
1 parent 752e7fd commit 2adffd2
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions operator/mina/lib/src/consensus_state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,10 @@ fn relative_min_window_density(candidate: &MinaProtocolState, tip: &MinaProtocol
return candidate.min_window_density.as_u32();
}

// Added input checks to compute `shift_count` and `i` safely.
// We don't take into account how to compute consensus checks in those border cases since
// we assume those cases happen when candidate and tip states aren't taken from a Mina node
// but built to perform a DoS attack.
let projected_window = {
let shift_count = max_slot
.checked_sub(candidate.global_slot())
Expand Down

0 comments on commit 2adffd2

Please sign in to comment.