diff --git a/src/batch_hasher.rs b/src/batch_hasher.rs index 6d2d81a1..2d568f80 100644 --- a/src/batch_hasher.rs +++ b/src/batch_hasher.rs @@ -83,7 +83,7 @@ where impl Batcher where - F: PrimeField, + F: PrimeField + ec_gpu::GpuName, A: Arity, { pub fn strength(&self) -> Strength { diff --git a/src/column_tree_builder.rs b/src/column_tree_builder.rs index 024d87bf..26bf144b 100644 --- a/src/column_tree_builder.rs +++ b/src/column_tree_builder.rs @@ -2,7 +2,7 @@ use crate::batch_hasher::Batcher; use crate::error::Error; use crate::poseidon::{Poseidon, PoseidonConstants}; use crate::tree_builder::{TreeBuilder, TreeBuilderTrait}; -use crate::{Arity, BatchHasher, Strength, NeptuneField}; +use crate::{Arity, BatchHasher, NeptuneField, Strength}; use ff::{Field, PrimeField}; use generic_array::{ArrayLength, GenericArray}; diff --git a/src/halo2_circuit.rs b/src/halo2_circuit.rs index 1874e91f..27035570 100644 --- a/src/halo2_circuit.rs +++ b/src/halo2_circuit.rs @@ -361,6 +361,8 @@ where let width = A::to_usize() + 1; consts .round_constants + .as_ref() + .unwrap() .iter() .skip(round * width) .take(width) @@ -415,6 +417,8 @@ where let round_consts = consts .round_constants + .as_ref() + .unwrap() .iter() .skip(round * width) .take(width); @@ -459,6 +463,8 @@ where let round_consts = consts .round_constants + .as_ref() + .unwrap() .iter() .skip(round * width) .take(width); @@ -528,12 +534,16 @@ where let round_consts_a = consts .round_constants + .as_ref() + .unwrap() .iter() .skip(round_a * width) .take(width); let round_consts_b = consts .round_constants + .as_ref() + .unwrap() .iter() .skip(round_b * width) .take(width); diff --git a/src/proteus/gpu.rs b/src/proteus/gpu.rs index 487ea394..4ee3afcd 100644 --- a/src/proteus/gpu.rs +++ b/src/proteus/gpu.rs @@ -161,7 +161,7 @@ where impl ClBatchHasher where - F: PrimeField, + F: PrimeField + ec_gpu::GpuName, A: Arity, { pub(crate) fn strength(&self) -> Strength { diff --git a/src/proteus/sources.rs b/src/proteus/sources.rs index c0c4b713..e928328e 100644 --- a/src/proteus/sources.rs +++ b/src/proteus/sources.rs @@ -125,12 +125,11 @@ fn poseidon_source(field: &str, strength: &str, derived_constants: &DerivedConst /// The constants can be generated based on the the arity and the strength. The `derived_constants` /// parameter is a list of tuples, where the first element contains the standard strength /// parameters, the second element is the strengthed, and the third is the "even-partial" strength. -/// parameters, the second element is the strengthed one. fn generate_program_from_constants( derived_constants: &[(DerivedConstants, DerivedConstants, DerivedConstants)], ) -> String - where - F: GpuName + 'static, +where + F: GpuName + 'static, { let mut source = vec![shared(&F::name())]; for (standard, _strengthened, _even_partial) in derived_constants { @@ -162,31 +161,31 @@ fn derive_constants(arity: usize) -> (DerivedConstants, DerivedConstants, Derive /// Kernels for certain arities are enabled by feature flags. pub fn generate_program() -> SourceBuilder { #[cfg(any(feature = "bls", feature = "pasta"))] - let derived_constants = vec![ + let derived_constants = vec![ #[cfg(feature = "arity2")] - derive_constants(2), + derive_constants(2), #[cfg(feature = "arity4")] - derive_constants(4), + derive_constants(4), #[cfg(feature = "arity8")] - derive_constants(8), + derive_constants(8), #[cfg(feature = "arity11")] - derive_constants(11), + derive_constants(11), #[cfg(feature = "arity16")] - derive_constants(16), + derive_constants(16), #[cfg(feature = "arity24")] - derive_constants(24), + derive_constants(24), #[cfg(feature = "arity36")] - derive_constants(36), + derive_constants(36), ]; let source_builder = SourceBuilder::new(); #[cfg(feature = "bls")] - let source_builder = source_builder + let source_builder = source_builder .add_field::() .append_source(generate_program_from_constants::(&derived_constants)); #[cfg(feature = "pasta")] - let source_builder = source_builder + let source_builder = source_builder .add_field::() .add_field::() .append_source(generate_program_from_constants::(&derived_constants)) diff --git a/src/tree_builder.rs b/src/tree_builder.rs index 02fdd3ec..0b501b8d 100644 --- a/src/tree_builder.rs +++ b/src/tree_builder.rs @@ -1,7 +1,7 @@ use crate::batch_hasher::Batcher; use crate::error::Error; use crate::poseidon::{Poseidon, PoseidonConstants}; -use crate::{Arity, BatchHasher, Strength, NeptuneField}; +use crate::{Arity, BatchHasher, NeptuneField, Strength}; use ff::{Field, PrimeField}; use generic_array::GenericArray;