From 2badf8d70154b73df1016ae63d767af9e2400cb5 Mon Sep 17 00:00:00 2001 From: Giacomo Fenzi Date: Sat, 27 Jul 2024 16:59:57 +0200 Subject: [PATCH] Update another part --- Cargo.toml | 2 +- src/plugins/ark/common.rs | 24 ++++++++++++++++++------ 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 3b7e224..67d6f03 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -35,7 +35,7 @@ ark-bls12-381 = {version="0.4.0", optional=true} [features] -default = [] +default = ["ark"] ark = ["dep:ark-ff", "dep:ark-ec", "dep:ark-serialize"] group = ["dep:group"] ark-bls12-381 = ["ark", "dep:ark-bls12-381"] diff --git a/src/plugins/ark/common.rs b/src/plugins/ark/common.rs index 52b105a..cd501db 100644 --- a/src/plugins/ark/common.rs +++ b/src/plugins/ark/common.rs @@ -98,16 +98,22 @@ where // Field <-> Field interactions: -impl FieldPublic> for Merlin, R> +impl FieldPublic for Merlin, R> where + F: Field>, H: DuplexHash>, R: RngCore + CryptoRng, C: FpConfig, { type Repr = (); - fn public_scalars(&mut self, input: &[Fp]) -> ProofResult { - self.public_units(input)?; + fn public_scalars(&mut self, input: &[F]) -> ProofResult { + let flattened: Vec<_> = input + .into_iter() + .map(|f| f.to_base_prime_field_elements()) + .flatten() + .collect(); + self.public_units(&flattened)?; Ok(()) } } @@ -131,15 +137,21 @@ where // // -impl FieldPublic> for Arthur<'_, H, Fp> +impl FieldPublic for Arthur<'_, H, Fp> where + F: Field>, H: DuplexHash>, C: FpConfig, { type Repr = (); - fn public_scalars(&mut self, input: &[Fp]) -> ProofResult { - self.public_units(input)?; + fn public_scalars(&mut self, input: &[F]) -> ProofResult { + let flattened: Vec<_> = input + .into_iter() + .map(|f| f.to_base_prime_field_elements()) + .flatten() + .collect(); + self.public_units(&flattened)?; Ok(()) } }