Skip to content

Commit

Permalink
Check for large increases in step count
Browse files Browse the repository at this point in the history
  • Loading branch information
andyleiserson committed Sep 20, 2024
1 parent b49e1f9 commit 05cfa12
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions ipa-core/src/protocol/ipa_prf/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -724,8 +724,7 @@ pub mod tests {

#[cfg(all(test, all(feature = "compact-gate", feature = "in-memory-infra")))]
mod compact_gate_tests {

use ipa_step::StepNarrow;
use ipa_step::{CompactStep, StepNarrow};

use crate::{
ff::{
Expand All @@ -741,6 +740,18 @@ mod compact_gate_tests {
test_fixture::{ipa::TestRawDataRecord, Reconstruct, Runner, TestWorld, TestWorldConfig},
};

#[test]
fn step_count_limit() {
// This is an arbitrary limit intended to catch changes that unintentionally
// blow up the step count. It can be increased, within reason.
const STEP_COUNT_LIMIT: u32 = 200_000;
assert!(
ProtocolStep::STEP_COUNT < STEP_COUNT_LIMIT,
"Step count of {actual} exceeds limit of {STEP_COUNT_LIMIT}.",

Check warning on line 750 in ipa-core/src/protocol/ipa_prf/mod.rs

View check run for this annotation

Codecov / codecov/patch

ipa-core/src/protocol/ipa_prf/mod.rs#L750

Added line #L750 was not covered by tests
actual = ProtocolStep::STEP_COUNT,
);
}

#[test]
fn saturated_agg() {
const EXPECTED: &[u128] = &[0, 255, 255, 0, 0, 0, 0, 0];
Expand Down

0 comments on commit 05cfa12

Please sign in to comment.