Skip to content

Commit

Permalink
Merge pull request #1293 from andyleiserson/too-many-steps
Browse files Browse the repository at this point in the history
Check for large increases in step count
  • Loading branch information
akoshelev authored Sep 20, 2024
2 parents b49e1f9 + 05cfa12 commit 743739b
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}.",
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 743739b

Please sign in to comment.