diff --git a/powersoftau/src/bin/beacon_constrained.rs b/powersoftau/src/bin/beacon_constrained.rs index e63c091..90ec337 100644 --- a/powersoftau/src/bin/beacon_constrained.rs +++ b/powersoftau/src/bin/beacon_constrained.rs @@ -19,8 +19,8 @@ const CHECK_INPUT_CORRECTNESS: CheckForCorrectness = CheckForCorrectness::No; #[allow(clippy::modulo_one)] fn main() { let args: Vec = std::env::args().collect(); - if args.len() != 6 { - println!("Usage: \n "); + if args.len() != 7 { + println!("Usage: \n "); std::process::exit(exitcode::USAGE); } let challenge_filename = &args[1]; @@ -28,6 +28,12 @@ fn main() { let circuit_power = args[3].parse().expect("could not parse circuit power"); let batch_size = args[4].parse().expect("could not parse batch size"); let beacon_hash = &args[5]; + let num_iterations_exp = &args[6].parse::().unwrap(); + + if *num_iterations_exp < 10 || *num_iterations_exp > 63 { + println!("in_num_iterations_exp should be in [10, 63] range"); + std::process::exit(exitcode::DATAERR); + } let parameters = CeremonyParams::::new(circuit_power, batch_size); @@ -51,14 +57,14 @@ fn main() { let mut cur_hash = hex::decode(beacon_hash).unwrap(); // Performs 2^n hash iterations over it - const N: u64 = 10; + let n: usize = *num_iterations_exp; - for i in 0..(1u64 << N) { + for i in 0..(1u64 << n) { // Print 1024 of the interstitial states // so that verification can be // parallelized - if i % (1u64 << (N - 10)) == 0 { + if i % (1u64 << (n - 10)) == 0 { print!("{}: ", i); for b in cur_hash.iter() { print!("{:02x}", b); diff --git a/powersoftau/test.sh b/powersoftau/test.sh index 5ad637b..c9567bf 100755 --- a/powersoftau/test.sh +++ b/powersoftau/test.sh @@ -21,7 +21,7 @@ cargo run --release --bin verify_transform_constrained challenge2 response2 chal yes | cargo run --release --bin compute_constrained challenge3 response3 $SIZE $BATCH cargo run --release --bin verify_transform_constrained challenge3 response3 challenge4 $SIZE $BATCH -cargo run --release --bin beacon_constrained challenge4 response4 $SIZE $BATCH 0000000000000000000a558a61ddc8ee4e488d647a747fe4dcc362fe2026c620 +cargo run --release --bin beacon_constrained challenge4 response4 $SIZE $BATCH 0000000000000000000a558a61ddc8ee4e488d647a747fe4dcc362fe2026c620 10 cargo run --release --bin verify_transform_constrained challenge4 response4 challenge5 $SIZE $BATCH cargo run --release --bin prepare_phase2 response4 $SIZE $BATCH