Skip to content

Commit 17cefbc

Browse files
fix: Update Mod Builder symbolic expression multiplication test (#1551)
The symbolic expression multiplication unit test was being run with an incorrect expected result. The test became out-of-date after #1473 changed the `max_abs` method. This PR updates the test with the correct expected result and adds the Mod Builder crate's unit tests to the CI workflow. This change has no impact on the functionality of the Mod Builder crate as it only updates the tests.
1 parent 6a02604 commit 17cefbc

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

.github/workflows/primitives.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ on:
99
- "crates/circuits/primitives/**"
1010
- "crates/circuits/poseidon2-air/**"
1111
- "crates/circuits/sha256-air/**"
12+
- "crates/circuits/mod-builder/**"
1213
- "Cargo.toml"
1314
- ".github/workflows/primitives.yml"
1415

@@ -50,3 +51,8 @@ jobs:
5051
working-directory: crates/circuits/sha256-air
5152
run: |
5253
cargo nextest run --cargo-profile fast --features parallel
54+
55+
- name: Run tests for mod-builder
56+
working-directory: crates/circuits/mod-builder
57+
run: |
58+
cargo nextest run --cargo-profile fast --features parallel

crates/circuits/mod-builder/src/tests.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -387,9 +387,9 @@ fn test_symbolic_limbs_mul() {
387387
Box::new(SymbolicExpr::Var(0)),
388388
Box::new(SymbolicExpr::Var(1)),
389389
);
390-
// x * y = pq, q can be up to p so can limbs as p.
391-
// x * y and p * q both have 63 limbs.
392-
let expected_q = 32;
393-
let expected_carry = 63;
390+
// x * y = pq, and x,y can be up to 2^256 - 1 so q can be up to ceil((2^256 - 1)^2 / p) which has 257 bits, which is 33 limbs
391+
// x * y has 63 limbs, but p * q can have 64 limbs since q is 33 limbs
392+
let expected_q = 33;
393+
let expected_carry = 64;
394394
test_symbolic_limbs(expr, expected_q, expected_carry);
395395
}

0 commit comments

Comments
 (0)