attach smalltest feature directly to REQUIRED_POWER constant

This commit is contained in:
poma 2020-01-24 13:59:12 +08:00
parent 213aea092f
commit aed734275e
No known key found for this signature in database
GPG Key ID: BA20CB01FE165657
2 changed files with 15 additions and 33 deletions

@ -24,15 +24,17 @@ use crate::parameters::*;
use crate::keypair::*; use crate::keypair::*;
use crate::utils::*; use crate::utils::*;
#[cfg(not(feature = "smalltest"))]
#[derive(Clone)] #[derive(Clone)]
pub struct Bn256CeremonyParameters { pub struct Bn256CeremonyParameters {
} }
#[cfg(not(feature = "smalltest"))]
impl PowersOfTauParameters for Bn256CeremonyParameters { impl PowersOfTauParameters for Bn256CeremonyParameters {
const REQUIRED_POWER: usize = 28; // generate to have roughly 64 million constraints #[cfg(not(feature = "smalltest"))]
const REQUIRED_POWER: usize = 28;
#[cfg(feature = "smalltest")]
const REQUIRED_POWER: usize = 10;
// This ceremony is based on the BN256 elliptic curve construction. // This ceremony is based on the BN256 elliptic curve construction.
const G1_UNCOMPRESSED_BYTE_SIZE: usize = 64; const G1_UNCOMPRESSED_BYTE_SIZE: usize = 64;
@ -41,26 +43,6 @@ impl PowersOfTauParameters for Bn256CeremonyParameters {
const G2_COMPRESSED_BYTE_SIZE: usize = 64; const G2_COMPRESSED_BYTE_SIZE: usize = 64;
} }
#[cfg(feature = "smalltest")]
#[derive(Clone)]
pub struct Bn256CeremonyParameters {
}
#[cfg(feature = "smalltest")]
impl PowersOfTauParameters for Bn256CeremonyParameters {
const REQUIRED_POWER: usize = 12;
const EMPIRICAL_BATCH_SIZE: usize = 1 << 10;
// This ceremony is based on the BN256 elliptic curve construction.
const G1_UNCOMPRESSED_BYTE_SIZE: usize = 64;
const G2_UNCOMPRESSED_BYTE_SIZE: usize = 128;
const G1_COMPRESSED_BYTE_SIZE: usize = 32;
const G2_COMPRESSED_BYTE_SIZE: usize = 64;
}
#[test] #[test]
fn test_pubkey_serialization() { fn test_pubkey_serialization() {
use self::rand::thread_rng; use self::rand::thread_rng;

@ -8,18 +8,18 @@ rm tmp_*
set -e set -e
cargo run --release --bin new_constrained --features smalltest -- challenge1 cargo run --release --features smalltest --bin new_constrained challenge1
yes | cargo run --release --bin compute_constrained --features smalltest -- challenge1 response1 yes | cargo run --release --features smalltest --bin compute_constrained challenge1 response1
cargo run --release --bin verify_transform_constrained --features smalltest -- challenge1 response1 challenge2 cargo run --release --features smalltest --bin verify_transform_constrained challenge1 response1 challenge2
yes | cargo run --release --bin compute_constrained --features smalltest -- challenge2 response2 yes | cargo run --release --features smalltest --bin compute_constrained challenge2 response2
cargo run --release --bin verify_transform_constrained --features smalltest -- challenge2 response2 challenge3 cargo run --release --features smalltest --bin verify_transform_constrained challenge2 response2 challenge3
yes | cargo run --release --bin compute_constrained --features smalltest -- challenge3 response3 yes | cargo run --release --features smalltest --bin compute_constrained challenge3 response3
cargo run --release --bin verify_transform_constrained --features smalltest -- challenge3 response3 challenge4 cargo run --release --features smalltest --bin verify_transform_constrained challenge3 response3 challenge4
cargo run --release --bin beacon_constrained --features smalltest -- challenge4 response4 cargo run --release --features smalltest --bin beacon_constrained challenge4 response4
cargo run --release --bin verify_transform_constrained --features smalltest -- challenge4 response4 challenge5 cargo run --release --features smalltest --bin verify_transform_constrained challenge4 response4 challenge5
cat response1 response2 response3 response4 > transcript cat response1 response2 response3 response4 > transcript
cargo run --release --bin verify --features smalltest -- transcript cargo run --release --features smalltest --bin verify transcript