NCC-CSWZ001-002: adds num exp as input to beacon_constrained and adds input validation
This commit is contained in:
parent
6bca852b8b
commit
19037214ec
@ -19,8 +19,8 @@ const CHECK_INPUT_CORRECTNESS: CheckForCorrectness = CheckForCorrectness::No;
|
|||||||
#[allow(clippy::modulo_one)]
|
#[allow(clippy::modulo_one)]
|
||||||
fn main() {
|
fn main() {
|
||||||
let args: Vec<String> = std::env::args().collect();
|
let args: Vec<String> = std::env::args().collect();
|
||||||
if args.len() != 6 {
|
if args.len() != 7 {
|
||||||
println!("Usage: \n<challenge_file> <response_file> <circuit_power> <batch_size> <beacon_hash>");
|
println!("Usage: \n<challenge_file> <response_file> <circuit_power> <batch_size> <beacon_hash> <num_iterations_exp>");
|
||||||
std::process::exit(exitcode::USAGE);
|
std::process::exit(exitcode::USAGE);
|
||||||
}
|
}
|
||||||
let challenge_filename = &args[1];
|
let challenge_filename = &args[1];
|
||||||
@ -28,6 +28,12 @@ fn main() {
|
|||||||
let circuit_power = args[3].parse().expect("could not parse circuit power");
|
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 batch_size = args[4].parse().expect("could not parse batch size");
|
||||||
let beacon_hash = &args[5];
|
let beacon_hash = &args[5];
|
||||||
|
let num_iterations_exp = &args[6].parse::<usize>().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::<Bn256>::new(circuit_power, batch_size);
|
let parameters = CeremonyParams::<Bn256>::new(circuit_power, batch_size);
|
||||||
|
|
||||||
@ -51,14 +57,14 @@ fn main() {
|
|||||||
let mut cur_hash = hex::decode(beacon_hash).unwrap();
|
let mut cur_hash = hex::decode(beacon_hash).unwrap();
|
||||||
|
|
||||||
// Performs 2^n hash iterations over it
|
// 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
|
// Print 1024 of the interstitial states
|
||||||
// so that verification can be
|
// so that verification can be
|
||||||
// parallelized
|
// parallelized
|
||||||
|
|
||||||
if i % (1u64 << (N - 10)) == 0 {
|
if i % (1u64 << (n - 10)) == 0 {
|
||||||
print!("{}: ", i);
|
print!("{}: ", i);
|
||||||
for b in cur_hash.iter() {
|
for b in cur_hash.iter() {
|
||||||
print!("{:02x}", b);
|
print!("{:02x}", b);
|
||||||
|
@ -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
|
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 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 verify_transform_constrained challenge4 response4 challenge5 $SIZE $BATCH
|
||||||
|
|
||||||
cargo run --release --bin prepare_phase2 response4 $SIZE $BATCH
|
cargo run --release --bin prepare_phase2 response4 $SIZE $BATCH
|
||||||
|
Loading…
Reference in New Issue
Block a user