Skip to content

Commit

Permalink
Arrabbiata/test: check transformation into sparse mvpoly
Browse files Browse the repository at this point in the history
Useful for cross-terms computation
  • Loading branch information
dannywillems committed Feb 3, 2025
1 parent 9e964b3 commit acac0ba
Showing 1 changed file with 22 additions and 2 deletions.
24 changes: 22 additions & 2 deletions arrabbiata/tests/constraints.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
use arrabbiata::{
columns::Gadget,
columns::{Gadget, E},
constraints,
interpreter::{self, Instruction},
MAX_DEGREE, NUMBER_OF_COLUMNS, NUMBER_OF_PUBLIC_INPUTS,
};
use mina_curves::pasta::{curves::vesta::Vesta, Pallas};
use mina_curves::pasta::{curves::vesta::Vesta, Fp, Pallas};
use mvpoly::{monomials::Sparse, MVPoly};
use std::collections::HashMap;

fn helper_compute_constraints_gadget(instr: Instruction, exp_constraints: usize) {
Expand Down Expand Up @@ -140,3 +142,21 @@ fn test_gadget_elliptic_curve_scaling() {

helper_check_gadget_activated(instr, Gadget::EllipticCurveScaling);
}

#[test]
fn test_get_mvpoly_equivalent() {
// Check that each constraint can be converted to a MVPoly. The type of the
// MVPoly is crucial as it determines the maximum degree of the constraint
// and the number of wires. For this reason, no checkis performed on the
// result of the mapping.
let constraints_fp: Vec<E<Fp>> = {
let constraints_env: constraints::Env<Vesta> = constraints::Env::default();
constraints_env.get_all_constraints()
};
let _constraints_fp: Vec<
Sparse<Fp, { (NUMBER_OF_PUBLIC_INPUTS + NUMBER_OF_COLUMNS) * 2 }, { MAX_DEGREE }>,
> = constraints_fp
.into_iter()
.map(|expr| Sparse::from_expr(expr, Some(NUMBER_OF_COLUMNS + NUMBER_OF_PUBLIC_INPUTS)))
.collect();
}

0 comments on commit acac0ba

Please sign in to comment.