Skip to content
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
15 changes: 8 additions & 7 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@ authors = ["Parity Technologies <admin@parity.io>"]
repository = "https://github.com/paritytech/verifiable.git"
license = "GPL-3.0-or-later WITH Classpath-exception-2.0"

exclude = ["src/ring-data/zcash-srs-2-16-uncompressed.bin"]

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
exclude = ["src/ring/data/bls12-381/zcash-srs-2-16-uncompressed.bin"]

[dependencies]
derive-where = "1.2"
Expand All @@ -19,8 +17,8 @@ scale-info = { version = "2.11", default-features = false, features = ["derive"]
schnorrkel = { version = "0.11.5", default-features = false, optional = true }
ark-serialize = { version = "0.5", default-features = false, features = ["derive"] }
ark-scale = { version = "0.0.13", default-features = false }
ark-vrf = { version = "0.1.0", default-features = false, features = ["bandersnatch", "ring"] }
spin = { version = "0.9", default-features = false, features = ["once"], optional = true }
ark-vrf = { version = "0.1.1", default-features = false, features = ["bandersnatch", "ring"] }
spin = { version = "0.9", default-features = false, features = ["once"] }

[dev-dependencies]
rand = { version = "0.8", features = ["getrandom"] }
Expand All @@ -34,6 +32,7 @@ path = "utils/generate_test_keys.rs"
[features]
default = ["std"]
std = [
"prover",
"bounded-collections/std",
"parity-scale-codec/std",
"scale-info/std",
Expand All @@ -47,10 +46,12 @@ std = [
# Disable this feature to reduce library size in production environments
# that only need to validate proofs (not build new ring commitments).
builder-params = []
schnorrkel = ["dep:schnorrkel"]
# Enables ring proof generation (prover) functionality.
prover = []
# Prover for no-std environments with deterministic ring-proof.
# Not for production, may be useful for testing.
no-std-prover = [
"spin",
"prover",
"ark-vrf/test-vectors",
]
schnorrkel = ["dep:schnorrkel"]
13 changes: 5 additions & 8 deletions src/demo_impls.rs → src/demo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ impl GenerateVerifiable for Trivial {
secret.clone()
}

#[cfg(any(feature = "std", feature = "no-std-prover"))]
#[cfg(feature = "prover")]
fn open(
_capacity: (),
member: &Self::Member,
Expand All @@ -71,7 +71,7 @@ impl GenerateVerifiable for Trivial {
Ok((member.clone(), set))
}

#[cfg(any(feature = "std", feature = "no-std-prover"))]
#[cfg(feature = "prover")]
fn create(
(member, _): Self::Commitment,
secret: &Self::Secret,
Expand Down Expand Up @@ -168,7 +168,7 @@ impl GenerateVerifiable for Simple {
pair.public.to_bytes()
}

#[cfg(any(feature = "std", feature = "no-std-prover"))]
#[cfg(feature = "prover")]
fn open(
_capacity: (),
member: &Self::Member,
Expand All @@ -181,7 +181,7 @@ impl GenerateVerifiable for Simple {
Ok((member.clone(), set))
}

#[cfg(any(feature = "std", feature = "no-std-prover"))]
#[cfg(feature = "prover")]
fn create(
(member, _): Self::Commitment,
secret: &Self::Secret,
Expand Down Expand Up @@ -248,10 +248,7 @@ impl GenerateVerifiable for Simple {
mod tests {
use super::*;

#[cfg(all(
feature = "schnorrkel",
any(feature = "std", feature = "no-std-prover")
))]
#[cfg(all(feature = "schnorrkel", feature = "prover"))]
#[test]
fn simple_works() {
let alice_sec = <Simple as GenerateVerifiable>::new_secret([0u8; 32]);
Expand Down
10 changes: 5 additions & 5 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ use core::{fmt::Debug, ops::Range};
use parity_scale_codec::{Decode, DecodeWithMemTracking, Encode, FullCodec, MaxEncodedLen};
use scale_info::*;

pub mod demo_impls;
pub mod ring_vrf_impl;
pub mod demo;
pub mod ring;

/// Trait for capacity types used in ring operations.
///
Expand Down Expand Up @@ -122,7 +122,7 @@ pub trait GenerateVerifiable {
///
/// **WARNING**: This function may panic if called from on-chain or an environment not
/// implementing the functionality.
#[cfg(any(feature = "std", feature = "no-std-prover"))]
#[cfg(feature = "prover")]
fn open(
capacity: Self::Capacity,
member: &Self::Member,
Expand All @@ -144,7 +144,7 @@ pub trait GenerateVerifiable {
///
/// **WARNING**: This function may panic if called from on-chain or an environment not
/// implementing the functionality.
#[cfg(any(feature = "std", feature = "no-std-prover"))]
#[cfg(feature = "prover")]
fn create(
commitment: Self::Commitment,
secret: &Self::Secret,
Expand Down Expand Up @@ -208,7 +208,7 @@ pub struct Receipt<Gen: GenerateVerifiable> {
}

impl<Gen: GenerateVerifiable> Receipt<Gen> {
#[cfg(any(feature = "std", feature = "no-std-prover"))]
#[cfg(feature = "prover")]
pub fn create<'a>(
capacity: Gen::Capacity,
secret: &Gen::Secret,
Expand Down
Loading