Skip to content

Commit

Permalink
fix: Modifications after picking latest changes from master
Browse files Browse the repository at this point in the history
  • Loading branch information
storojs72 committed Jan 13, 2023
1 parent 1c7a4c9 commit 9ac186e
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 18 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ log = "0.4.8"
halo2_proofs = "0.2.0"
# `halo2_proofs` does not expose the feature `pasta_curves/gpu`, thus we must also import
# `pasta_curves/gpu` when building with `neptune/pasta`.
pasta_curves = { version = "0.5.1", features = ["serde"], package = "fil_pasta_curves", optional = true }
pasta_curves = { version = "0.5.1", features = ["serde"], package = "fil_pasta_curves" }
rust-gpu-tools = { version = "0.5.0", default-features = false, optional = true }
trait-set = "0.3.0"
serde = { version = "1.0", features = ["derive"] }
Expand Down
2 changes: 1 addition & 1 deletion src/batch_hasher.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ where

impl<F, A> Batcher<F, A>
where
F: PrimeField,
F: PrimeField + ec_gpu::GpuName,
A: Arity<F>,
{
pub fn strength(&self) -> Strength {
Expand Down
2 changes: 1 addition & 1 deletion src/column_tree_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand Down
10 changes: 10 additions & 0 deletions src/halo2_circuit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -361,6 +361,8 @@ where
let width = A::to_usize() + 1;
consts
.round_constants
.as_ref()
.unwrap()
.iter()
.skip(round * width)
.take(width)
Expand Down Expand Up @@ -415,6 +417,8 @@ where

let round_consts = consts
.round_constants
.as_ref()
.unwrap()
.iter()
.skip(round * width)
.take(width);
Expand Down Expand Up @@ -459,6 +463,8 @@ where

let round_consts = consts
.round_constants
.as_ref()
.unwrap()
.iter()
.skip(round * width)
.take(width);
Expand Down Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion src/proteus/gpu.rs
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ where

impl<F, A> ClBatchHasher<F, A>
where
F: PrimeField,
F: PrimeField + ec_gpu::GpuName,
A: Arity<F>,
{
pub(crate) fn strength(&self) -> Strength {
Expand Down
25 changes: 12 additions & 13 deletions src/proteus/sources.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<F>(
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 {
Expand Down Expand Up @@ -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::<Fr>()
.append_source(generate_program_from_constants::<Fr>(&derived_constants));
#[cfg(feature = "pasta")]
let source_builder = source_builder
let source_builder = source_builder
.add_field::<Fp>()
.add_field::<Fv>()
.append_source(generate_program_from_constants::<Fp>(&derived_constants))
Expand Down
2 changes: 1 addition & 1 deletion src/tree_builder.rs
Original file line number Diff line number Diff line change
@@ -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;
Expand Down

0 comments on commit 9ac186e

Please sign in to comment.