PR comments

This commit is contained in:
wborgeaud 2021-09-27 12:29:27 +02:00
parent 747c9f894b
commit df9a211475
2 changed files with 10 additions and 7 deletions

View File

@ -5,7 +5,6 @@ use crate::field::extension_field::target::ExtensionTarget;
use crate::field::extension_field::Extendable;
use crate::field::field_types::{Field, RichField};
use crate::gates::gate::Gate;
use crate::hash::hashing::SPONGE_WIDTH;
use crate::hash::poseidon;
use crate::hash::poseidon::Poseidon;
use crate::iop::generator::{GeneratedValues, SimpleGenerator, WitnessGenerator};
@ -104,7 +103,7 @@ where
let swap = vars.local_wires[Self::WIRE_SWAP];
constraints.push(swap * (swap - F::Extension::ONE));
let mut state = Vec::with_capacity(SPONGE_WIDTH);
let mut state = Vec::with_capacity(WIDTH);
for i in 0..4 {
let a = vars.local_wires[i];
let b = vars.local_wires[i + 4];
@ -115,7 +114,7 @@ where
let b = vars.local_wires[i];
state.push(a + swap * (b - a));
}
for i in 8..SPONGE_WIDTH {
for i in 8..WIDTH {
state.push(vars.local_wires[i]);
}
@ -183,7 +182,7 @@ where
let swap = vars.local_wires[Self::WIRE_SWAP];
constraints.push(swap * (swap - F::ONE));
let mut state = Vec::with_capacity(SPONGE_WIDTH);
let mut state = Vec::with_capacity(WIDTH);
for i in 0..4 {
let a = vars.local_wires[i];
let b = vars.local_wires[i + 4];
@ -194,7 +193,7 @@ where
let b = vars.local_wires[i];
state.push(a + swap * (b - a));
}
for i in 8..SPONGE_WIDTH {
for i in 8..WIDTH {
state.push(vars.local_wires[i]);
}
@ -266,7 +265,7 @@ where
let swap = vars.local_wires[Self::WIRE_SWAP];
constraints.push(builder.mul_sub_extension(swap, swap, swap));
let mut state = Vec::with_capacity(SPONGE_WIDTH);
let mut state = Vec::with_capacity(WIDTH);
for i in 0..4 {
let a = vars.local_wires[i];
let b = vars.local_wires[i + 4];
@ -279,7 +278,7 @@ where
let delta = builder.sub_extension(b, a);
state.push(builder.mul_add_extension(swap, delta, a));
}
for i in 8..SPONGE_WIDTH {
for i in 8..WIDTH {
state.push(vars.local_wires[i]);
}

View File

@ -87,6 +87,10 @@ impl GMiMC<12> for CrandallField {
const ROUND_CONSTANTS: [u64; NUM_ROUNDS] = CRANDALL_AND_GOLDILOCKS_ROUND_CONSTANTS;
}
impl GMiMC<8> for GoldilocksField {
const ROUND_CONSTANTS: [u64; NUM_ROUNDS] = CRANDALL_AND_GOLDILOCKS_ROUND_CONSTANTS;
}
impl GMiMC<12> for GoldilocksField {
const ROUND_CONSTANTS: [u64; NUM_ROUNDS] = CRANDALL_AND_GOLDILOCKS_ROUND_CONSTANTS;
}