From 2adffd276da140d5a24b302fa8ec521c3940e259 Mon Sep 17 00:00:00 2001 From: gabrielbosio Date: Mon, 23 Sep 2024 14:29:29 -0300 Subject: [PATCH] Comment input checks --- operator/mina/lib/src/consensus_state.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/operator/mina/lib/src/consensus_state.rs b/operator/mina/lib/src/consensus_state.rs index 080adb751..ac521de11 100644 --- a/operator/mina/lib/src/consensus_state.rs +++ b/operator/mina/lib/src/consensus_state.rs @@ -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())