diff --git a/src/gates/poseidon.rs b/src/gates/poseidon.rs index bbc42b0d..c45be25f 100644 --- a/src/gates/poseidon.rs +++ b/src/gates/poseidon.rs @@ -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]); } diff --git a/src/hash/gmimc.rs b/src/hash/gmimc.rs index 44af69d6..e64c940f 100644 --- a/src/hash/gmimc.rs +++ b/src/hash/gmimc.rs @@ -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; }