Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove jf_utils::tagged_blob, replace with tagged_base64::tagged #143

Merged
merged 2 commits into from
Nov 22, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,4 @@ members = [
"primitives",
"relation",
"utilities",
"utilities_derive",
]
1 change: 1 addition & 0 deletions plonk/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ rand_chacha = { version = "0.3.1" }
rayon = { version = "1.5.0", optional = true }
serde = { version = "1.0", default-features = false, features = ["derive"] }
sha3 = "^0.10"
tagged-base64 = { git = "https://github.com/espressosystems/tagged-base64", tag = "0.2.4" }

[dev-dependencies]
ark-ed-on-bls12-377 = { git = "https://github.com/arkworks-rs/curves", rev = "677b4ae751a274037880ede86e9b6f30f62635af" }
Expand Down
7 changes: 4 additions & 3 deletions plonk/src/proof_system/structs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ use jf_relation::{
},
PlonkCircuit,
};
use jf_utils::{field_switching, fq_to_fr, fr_to_fq, tagged_blob};
use jf_utils::{field_switching, fq_to_fr, fr_to_fq};
use tagged_base64::tagged;

/// Universal StructuredReferenceString
pub type UniversalSrs<E> = UnivariateUniversalParams<E>;
Expand All @@ -51,7 +52,7 @@ pub type CommitKey<E> = UnivariateProverParam<<E as PairingEngine>::G1Affine>;
pub type OpenKey<E> = UnivariateVerifierParam<E>;

/// A Plonk SNARK proof.
#[tagged_blob(tag::PROOF)]
#[tagged(tag::PROOF)]
#[derive(Debug, Clone, PartialEq, Eq, CanonicalSerialize, CanonicalDeserialize, Derivative)]
#[derivative(Hash(bound = "E:PairingEngine"))]
pub struct Proof<E: PairingEngine> {
Expand Down Expand Up @@ -226,7 +227,7 @@ pub struct PlookupProof<E: PairingEngine> {
}

/// An aggregated SNARK proof that batchly proving multiple instances.
#[tagged_blob(tag::BATCHPROOF)]
#[tagged(tag::BATCHPROOF)]
#[derive(Debug, Clone, PartialEq, Eq, CanonicalSerialize, CanonicalDeserialize, Derivative)]
#[derivative(Hash(bound = "E:PairingEngine"))]
pub struct BatchProof<E: PairingEngine> {
Expand Down
1 change: 1 addition & 0 deletions primitives/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ rand_chacha = { version = "0.3.1", default-features = false }
rayon = { version = "1.5.0", optional = true }
serde = { version = "1.0", default-features = false, features = ["derive"] }
sha2 = { version = "0.10.1", default-features = false }
tagged-base64 = { git = "https://github.com/espressosystems/tagged-base64", tag = "0.2.4" }
zeroize = { version = "1.3", default-features = false }

[dev-dependencies]
Expand Down
14 changes: 9 additions & 5 deletions primitives/src/merkle_tree.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,14 @@ use ark_std::{
vec,
vec::Vec,
};
use core::{convert::TryFrom, fmt::Debug};
use core::{
convert::{TryFrom, TryInto},
fmt::Debug,
};
use espresso_systems_common::jellyfish::tag;
use jf_utils::tagged_blob;
use jf_utils::field_elem;
use serde::{Deserialize, Serialize};
use tagged_base64::tagged;

#[derive(Clone, Copy, PartialEq, Eq, Debug, Hash, Deserialize, Serialize)]
/// Enum for identifying a position of a node (left, middle or right).
Expand Down Expand Up @@ -192,7 +196,7 @@ impl<F: PrimeField> MerklePath<F> {
}

/// Represents the value for a node in the merkle tree.
#[tagged_blob(tag::NODE)]
#[tagged(tag::NODE)]
#[derive(
Clone, Debug, PartialEq, Eq, Hash, Default, CanonicalSerialize, CanonicalDeserialize, Copy,
)]
Expand Down Expand Up @@ -337,7 +341,7 @@ where
Leaf {
value: NodeValue<F>,
uid: u64,
#[serde(with = "jf_utils::field_elem")]
#[serde(with = "field_elem")]
elem: F,
},
}
Expand Down Expand Up @@ -820,7 +824,7 @@ where
}

/// Data struct for a merkle leaf.
#[tagged_blob(tag::LEAF)]
#[tagged(tag::LEAF)]
#[derive(
Clone, Debug, PartialEq, Eq, Hash, Default, CanonicalSerialize, CanonicalDeserialize, Copy,
)]
Expand Down
10 changes: 6 additions & 4 deletions primitives/src/signatures/schnorr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,10 @@ use ark_std::{
string::ToString,
vec,
};
use core::convert::TryInto;
use espresso_systems_common::jellyfish::tag;
use jf_utils::{fq_to_fr, fq_to_fr_with_mask, fr_to_fq, tagged_blob};
use jf_utils::{fq_to_fr, fq_to_fr_with_mask, fr_to_fq};
use tagged_base64::tagged;
use zeroize::Zeroize;

/// Schnorr signature scheme.
Expand Down Expand Up @@ -125,7 +127,7 @@ impl<F: PrimeField> SignKey<F> {

/// Signature public verification key
// derive zeroize here so that keypair can be zeroized
#[tagged_blob(tag::SCHNORRVERKEY)]
#[tagged(tag::SCHNORRVERKEY)]
#[derive(CanonicalSerialize, CanonicalDeserialize, Derivative)]
#[derivative(
Debug(bound = "P: Parameters"),
Expand Down Expand Up @@ -194,7 +196,7 @@ impl<P: Parameters> VerKey<P> {

/// Signature secret key pair used to sign messages
// make sure sk can be zeroized
#[tagged_blob(tag::SIGNKEYPAIR)]
#[tagged(tag::SIGNKEYPAIR)]
#[derive(CanonicalSerialize, CanonicalDeserialize, Derivative)]
#[derivative(
Debug(bound = "P: Parameters"),
Expand All @@ -215,7 +217,7 @@ where
// =====================================================

/// The signature of Schnorr signature scheme
#[tagged_blob(tag::SIG)]
#[tagged(tag::SIG)]
#[derive(CanonicalSerialize, CanonicalDeserialize, Derivative)]
#[derivative(
Debug(bound = "P: Parameters"),
Expand Down
1 change: 0 additions & 1 deletion scripts/check_no_std.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

set -x

cargo-nono check --no-default-features --package jf-utils-derive
cargo-nono check --no-default-features --package jf-utils
cargo-nono check --no-default-features --package jf-rescue
cargo-nono check --no-default-features --package jf-primitives
Expand Down
1 change: 0 additions & 1 deletion scripts/run_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,4 @@ cargo test --release -p jf-plonk -- -Zunstable-options --report-time
cargo test --release -p jf-primitives -- -Zunstable-options --report-time
cargo test --release -p jf-rescue -- -Zunstable-options --report-time
cargo test --release -p jf-utils -- -Zunstable-options --report-time
cargo test --release -p jf-utils-derive -- -Zunstable-options --report-time

6 changes: 1 addition & 5 deletions utilities/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,10 @@ ark-ff = { version = "0.3.0", default-features = false, features = [ "asm" ] }
ark-serialize = { version = "0.3.0", default-features = false }
ark-std = { version = "0.3.0", default-features = false }
digest = { version = "0.10.1", default-features = false }
displaydoc = { version = "0.2.3", default-features = false }
jf-utils-derive = { path = "../utilities_derive" }
rayon = { version = "1.5.0", optional = true }
serde = { version = "1.0", default-features = false, features = ["derive"] }
sha2 = { version = "0.10.1", default-features = false }
tagged-base64 = { git = "https://github.com/EspressoSystems/tagged-base64", tag = "0.2.0" }
tagged-base64 = { git = "https://github.com/espressosystems/tagged-base64", tag = "0.2.4" }

[dev-dependencies]
ark-bls12-377 = { git = "https://github.com/arkworks-rs/curves", rev = "677b4ae751a274037880ede86e9b6f30f62635af" }
Expand All @@ -28,8 +26,6 @@ ark-ed-on-bls12-377 = { git = "https://github.com/arkworks-rs/curves", rev = "67
ark-ed-on-bls12-381 = "0.3.0"
ark-ed-on-bls12-381-bandersnatch = { git = "https://github.com/arkworks-rs/curves", rev = "677b4ae751a274037880ede86e9b6f30f62635af" }
ark-ed-on-bn254 = "0.3.0"
ark-serialize = { version = "0.3.0", features = ["derive"] }
serde_json = "1.0"

[features]
default = []
Expand Down
Loading