mirror of
https://github.com/logos-storage/plonky2.git
synced 2026-01-13 03:03:05 +00:00
more fixes
This commit is contained in:
parent
ea4f950d6e
commit
9043a47e1b
@ -232,7 +232,7 @@ mod tests {
|
||||
use rand::Rng;
|
||||
|
||||
use crate::{
|
||||
field::crandall_field::CrandallField,
|
||||
field::goldilocks_field::GoldilocksField,
|
||||
iop::witness::PartialWitness,
|
||||
plonk::{circuit_builder::CircuitBuilder, circuit_data::CircuitConfig, verifier::verify},
|
||||
};
|
||||
@ -245,8 +245,8 @@ mod tests {
|
||||
let y_value = BigUint::from_u128(rng.gen()).unwrap();
|
||||
let expected_z_value = &x_value + &y_value;
|
||||
|
||||
type F = CrandallField;
|
||||
let config = CircuitConfig::large_config();
|
||||
type F = GoldilocksField;
|
||||
let config = CircuitConfig::standard_recursion_config();
|
||||
let pw = PartialWitness::new();
|
||||
let mut builder = CircuitBuilder::<F, 4>::new(config);
|
||||
|
||||
@ -273,8 +273,8 @@ mod tests {
|
||||
}
|
||||
let expected_z_value = &x_value - &y_value;
|
||||
|
||||
type F = CrandallField;
|
||||
let config = CircuitConfig::large_config();
|
||||
type F = GoldilocksField;
|
||||
let config = CircuitConfig::standard_recursion_config();
|
||||
let pw = PartialWitness::new();
|
||||
let mut builder = CircuitBuilder::<F, 4>::new(config);
|
||||
|
||||
@ -298,8 +298,8 @@ mod tests {
|
||||
let y_value = BigUint::from_u128(rng.gen()).unwrap();
|
||||
let expected_z_value = &x_value * &y_value;
|
||||
|
||||
type F = CrandallField;
|
||||
let config = CircuitConfig::large_config();
|
||||
type F = GoldilocksField;
|
||||
let config = CircuitConfig::standard_recursion_config();
|
||||
let pw = PartialWitness::new();
|
||||
let mut builder = CircuitBuilder::<F, 4>::new(config);
|
||||
|
||||
@ -322,8 +322,8 @@ mod tests {
|
||||
let x_value = BigUint::from_u128(rng.gen()).unwrap();
|
||||
let y_value = BigUint::from_u128(rng.gen()).unwrap();
|
||||
|
||||
type F = CrandallField;
|
||||
let config = CircuitConfig::large_config();
|
||||
type F = GoldilocksField;
|
||||
let config = CircuitConfig::standard_recursion_config();
|
||||
let pw = PartialWitness::new();
|
||||
let mut builder = CircuitBuilder::<F, 4>::new(config);
|
||||
|
||||
@ -350,8 +350,8 @@ mod tests {
|
||||
}
|
||||
let (expected_div_value, expected_rem_value) = x_value.div_rem(&y_value);
|
||||
|
||||
type F = CrandallField;
|
||||
let config = CircuitConfig::large_config();
|
||||
type F = GoldilocksField;
|
||||
let config = CircuitConfig::standard_recursion_config();
|
||||
let pw = PartialWitness::new();
|
||||
let mut builder = CircuitBuilder::<F, 4>::new(config);
|
||||
|
||||
|
||||
@ -71,16 +71,16 @@ mod tests {
|
||||
use num::BigUint;
|
||||
use rand::Rng;
|
||||
|
||||
use crate::field::crandall_field::CrandallField;
|
||||
use crate::field::field_types::Field;
|
||||
use crate::field::goldilocks_field::GoldilocksField;
|
||||
use crate::iop::witness::PartialWitness;
|
||||
use crate::plonk::circuit_builder::CircuitBuilder;
|
||||
use crate::plonk::circuit_data::CircuitConfig;
|
||||
use crate::plonk::verifier::verify;
|
||||
|
||||
fn test_list_le(size: usize, num_bits: usize) -> Result<()> {
|
||||
type F = CrandallField;
|
||||
let config = CircuitConfig::large_config();
|
||||
type F = GoldilocksField;
|
||||
let config = CircuitConfig::standard_recursion_config();
|
||||
let pw = PartialWitness::new();
|
||||
let mut builder = CircuitBuilder::<F, 4>::new(config);
|
||||
|
||||
|
||||
@ -115,8 +115,8 @@ impl<F: RichField + Extendable<D>, const D: usize> CircuitBuilder<F, D> {
|
||||
mod tests {
|
||||
use anyhow::Result;
|
||||
|
||||
use crate::field::crandall_field::CrandallField;
|
||||
use crate::field::field_types::Field;
|
||||
use crate::field::goldilocks_field::GoldilocksField;
|
||||
use crate::field::secp256k1::Secp256K1Base;
|
||||
use crate::iop::witness::PartialWitness;
|
||||
use crate::plonk::circuit_builder::CircuitBuilder;
|
||||
@ -130,8 +130,8 @@ mod tests {
|
||||
let y_ff = FF::rand();
|
||||
let sum_ff = x_ff + y_ff;
|
||||
|
||||
type F = CrandallField;
|
||||
let config = CircuitConfig::large_config();
|
||||
type F = GoldilocksField;
|
||||
let config = CircuitConfig::standard_recursion_config();
|
||||
let pw = PartialWitness::new();
|
||||
let mut builder = CircuitBuilder::<F, 4>::new(config);
|
||||
|
||||
@ -157,8 +157,8 @@ mod tests {
|
||||
}
|
||||
let diff_ff = x_ff - y_ff;
|
||||
|
||||
type F = CrandallField;
|
||||
let config = CircuitConfig::large_config();
|
||||
type F = GoldilocksField;
|
||||
let config = CircuitConfig::standard_recursion_config();
|
||||
let pw = PartialWitness::new();
|
||||
let mut builder = CircuitBuilder::<F, 4>::new(config);
|
||||
|
||||
@ -181,8 +181,8 @@ mod tests {
|
||||
let y_ff = FF::rand();
|
||||
let product_ff = x_ff * y_ff;
|
||||
|
||||
type F = CrandallField;
|
||||
let config = CircuitConfig::large_config();
|
||||
type F = GoldilocksField;
|
||||
let config = CircuitConfig::standard_recursion_config();
|
||||
let pw = PartialWitness::new();
|
||||
let mut builder = CircuitBuilder::<F, 4>::new(config);
|
||||
|
||||
@ -204,8 +204,8 @@ mod tests {
|
||||
let x_ff = FF::rand();
|
||||
let neg_x_ff = -x_ff;
|
||||
|
||||
type F = CrandallField;
|
||||
let config = CircuitConfig::large_config();
|
||||
type F = GoldilocksField;
|
||||
let config = CircuitConfig::standard_recursion_config();
|
||||
let pw = PartialWitness::new();
|
||||
let mut builder = CircuitBuilder::<F, 4>::new(config);
|
||||
|
||||
|
||||
@ -432,9 +432,9 @@ mod tests {
|
||||
use anyhow::Result;
|
||||
use rand::Rng;
|
||||
|
||||
use crate::field::crandall_field::CrandallField;
|
||||
use crate::field::extension_field::quartic::QuarticExtension;
|
||||
use crate::field::field_types::{Field, PrimeField};
|
||||
use crate::field::goldilocks_field::GoldilocksField;
|
||||
use crate::gates::assert_le::AssertLessThanGate;
|
||||
use crate::gates::gate::Gate;
|
||||
use crate::gates::gate_testing::{test_eval_fns, test_low_degree};
|
||||
@ -443,7 +443,7 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn wire_indices() {
|
||||
type AG = AssertLessThanGate<CrandallField, 4>;
|
||||
type AG = AssertLessThanGate<GoldilocksField, 4>;
|
||||
let num_bits = 40;
|
||||
let num_chunks = 5;
|
||||
|
||||
@ -473,7 +473,7 @@ mod tests {
|
||||
let num_bits = 40;
|
||||
let num_chunks = 5;
|
||||
|
||||
test_low_degree::<CrandallField, _, 4>(AssertLessThanGate::<_, 4>::new(
|
||||
test_low_degree::<GoldilocksField, _, 4>(AssertLessThanGate::<_, 4>::new(
|
||||
num_bits, num_chunks,
|
||||
))
|
||||
}
|
||||
@ -483,13 +483,15 @@ mod tests {
|
||||
let num_bits = 40;
|
||||
let num_chunks = 5;
|
||||
|
||||
test_eval_fns::<CrandallField, _, 4>(AssertLessThanGate::<_, 4>::new(num_bits, num_chunks))
|
||||
test_eval_fns::<GoldilocksField, _, 4>(AssertLessThanGate::<_, 4>::new(
|
||||
num_bits, num_chunks,
|
||||
))
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_gate_constraint() {
|
||||
type F = CrandallField;
|
||||
type FF = QuarticExtension<CrandallField>;
|
||||
type F = GoldilocksField;
|
||||
type FF = QuarticExtension<GoldilocksField>;
|
||||
const D: usize = 4;
|
||||
|
||||
let num_bits = 40;
|
||||
|
||||
@ -317,9 +317,9 @@ mod tests {
|
||||
use anyhow::Result;
|
||||
use rand::Rng;
|
||||
|
||||
use crate::field::crandall_field::CrandallField;
|
||||
use crate::field::extension_field::quartic::QuarticExtension;
|
||||
use crate::field::field_types::{Field, PrimeField};
|
||||
use crate::field::goldilocks_field::GoldilocksField;
|
||||
use crate::gates::gate::Gate;
|
||||
use crate::gates::gate_testing::{test_eval_fns, test_low_degree};
|
||||
use crate::gates::subtraction_u32::{U32SubtractionGate, NUM_U32_SUBTRACTION_OPS};
|
||||
@ -328,22 +328,22 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn low_degree() {
|
||||
test_low_degree::<CrandallField, _, 4>(U32SubtractionGate::<CrandallField, 4> {
|
||||
test_low_degree::<GoldilocksField, _, 4>(U32SubtractionGate::<GoldilocksField, 4> {
|
||||
_phantom: PhantomData,
|
||||
})
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn eval_fns() -> Result<()> {
|
||||
test_eval_fns::<CrandallField, _, 4>(U32SubtractionGate::<CrandallField, 4> {
|
||||
test_eval_fns::<GoldilocksField, _, 4>(U32SubtractionGate::<GoldilocksField, 4> {
|
||||
_phantom: PhantomData,
|
||||
})
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_gate_constraint() {
|
||||
type F = CrandallField;
|
||||
type FF = QuarticExtension<CrandallField>;
|
||||
type F = GoldilocksField;
|
||||
type FF = QuarticExtension<GoldilocksField>;
|
||||
const D: usize = 4;
|
||||
|
||||
fn get_wires(inputs_x: Vec<u64>, inputs_y: Vec<u64>, borrows: Vec<u64>) -> Vec<FF> {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user