From a2f57f67980632e1ecbcf4944542355367ad47b3 Mon Sep 17 00:00:00 2001 From: Philippe Camacho Date: Wed, 24 May 2023 15:25:39 -0400 Subject: [PATCH 1/4] Add serde traits to associated type SignatureScheme.PublicParameter. --- primitives/src/signatures/mod.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/primitives/src/signatures/mod.rs b/primitives/src/signatures/mod.rs index 53d822db4..be64b500b 100644 --- a/primitives/src/signatures/mod.rs +++ b/primitives/src/signatures/mod.rs @@ -42,7 +42,7 @@ pub trait SignatureScheme { + Eq; /// Public Parameter - type PublicParameter; + type PublicParameter: for<'a> Deserialize<'a> + Serialize; /// Signature type Signature: Debug From 839ac6a98470e577ee63643a4f1e021a4c9a7d2a Mon Sep 17 00:00:00 2001 From: Philippe Camacho Date: Wed, 24 May 2023 15:49:55 -0400 Subject: [PATCH 2/4] Add SerDe traits to struct BLSOverBN254CurveSignatureScheme. --- primitives/src/signatures/bls_over_bn254.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/primitives/src/signatures/bls_over_bn254.rs b/primitives/src/signatures/bls_over_bn254.rs index 2c2a31ef0..31f721f04 100644 --- a/primitives/src/signatures/bls_over_bn254.rs +++ b/primitives/src/signatures/bls_over_bn254.rs @@ -67,6 +67,7 @@ use tagged_base64::tagged; use zeroize::Zeroize; /// BLS signature scheme. +#[derive(CanonicalSerialize, CanonicalDeserialize)] pub struct BLSOverBN254CurveSignatureScheme; impl SignatureScheme for BLSOverBN254CurveSignatureScheme { From 29739c7999c68fc729b05dd82542cfefaede51ba Mon Sep 17 00:00:00 2001 From: Philippe Camacho Date: Wed, 24 May 2023 16:14:12 -0400 Subject: [PATCH 3/4] Make the trait AggregateableSignatureScheme inherit from (De)Serialize. --- primitives/src/signatures/bls_over_bn254.rs | 5 +++-- primitives/src/signatures/mod.rs | 4 +++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/primitives/src/signatures/bls_over_bn254.rs b/primitives/src/signatures/bls_over_bn254.rs index 31f721f04..7741444bf 100644 --- a/primitives/src/signatures/bls_over_bn254.rs +++ b/primitives/src/signatures/bls_over_bn254.rs @@ -48,7 +48,7 @@ use ark_ff::{ field_hashers::{DefaultFieldHasher, HashToField}, BigInteger, Field, PrimeField, }; -use ark_serialize::*; +use ark_serialize::{CanonicalDeserialize, CanonicalSerialize, *}; use ark_std::{ format, hash::{Hash, Hasher}, @@ -58,6 +58,7 @@ use ark_std::{ One, UniformRand, }; use digest::DynDigest; +use serde::{Deserialize, Serialize}; use sha3::Keccak256; use crate::errors::PrimitivesError::{ParameterError, VerificationError}; @@ -67,7 +68,7 @@ use tagged_base64::tagged; use zeroize::Zeroize; /// BLS signature scheme. -#[derive(CanonicalSerialize, CanonicalDeserialize)] +#[derive(Serialize, Deserialize)] pub struct BLSOverBN254CurveSignatureScheme; impl SignatureScheme for BLSOverBN254CurveSignatureScheme { diff --git a/primitives/src/signatures/mod.rs b/primitives/src/signatures/mod.rs index be64b500b..3c310568c 100644 --- a/primitives/src/signatures/mod.rs +++ b/primitives/src/signatures/mod.rs @@ -92,7 +92,9 @@ pub trait SignatureScheme { /// Trait for aggregatable signatures. /// TODO: generic over hash functions -pub trait AggregateableSignatureSchemes: SignatureScheme { +pub trait AggregateableSignatureSchemes: + SignatureScheme + Serialize + for<'a> Deserialize<'a> +{ /// Aggregate multiple signatures into a single signature /// The list of public keys is also in the input as some aggregate signature /// schemes might also use pks for aggregation From a95f633e46dfd9c6306e72f4630fbec95411c103 Mon Sep 17 00:00:00 2001 From: Philippe Camacho Date: Thu, 25 May 2023 11:38:38 -0400 Subject: [PATCH 4/4] Update CHANGELOG.md. --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index f9deaca9e..6da6756f3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,6 +20,7 @@ and follow [semantic versioning](https://semver.org/) for our releases. - [#234](https://github.com/EspressoSystems/jellyfish/pull/234) New `bytes_from_field_elements` util - [#231](https://github.com/EspressoSystems/jellyfish/pull/231) Implemented FK23 for fast amortized opening for univariate PCS - [#254](https://github.com/EspressoSystems/jellyfish/pull/254) Ensure `no_std` and target WASM support +- [#271](https://github.com/EspressoSystems/jellyfish/pull/271) Serde support for Aggregateable signatures ### Changed