Skip to content

Commit

Permalink
Phase 2 options not required when not verifying in control (#74)
Browse files Browse the repository at this point in the history
* phase 2 options not required when not verifying in control

* changed authors

Co-authored-by: Kobi Gurkan <kobigurk@gmail.com>
  • Loading branch information
mstraka100 and kobigurk committed Jul 3, 2021
1 parent 4f376c9 commit 33717c3
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 7 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "snark-setup-operator"
version = "0.1.0"
authors = ["Kobi Gurkan <kobigurk@gmail.com>"]
authors = ["Kobi Gurkan <kobigurk@gmail.com>", "Michael Straka <mstraka100@gmail.com>"]
edition = "2018"

[dependencies]
Expand Down
2 changes: 1 addition & 1 deletion e2e/e2ephase2.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ echo 1 | RUST_LOG=info cargo run --release --bin contribute -- --unsafe-passphr
echo 1 | RUST_LOG=info cargo run --release --bin contribute -- --unsafe-passphrase --exit-when-finished-contributing --keys-file $BASE_DIR/plumo-verifier.keys --participation-mode verify --coordinator-url http://localhost:8080
# Control used to run only 1 round
#echo 1 | RUST_LOG=info cargo run --release --bin control -- --phase phase2 -i new_challenge.query -I new_challenge.full --unsafe-passphrase --keys-file $BASE_DIR/plumo-verifier.keys --chunk-size 10 --phase1-powers 12 --phase1-filename phase2_init --circuit-filename circuit_2992c --coordinator-url http://localhost:8080 apply-beacon --beacon-hash 0000000000000000000000000000000000000000000000000000000000000000 --expected-participant 0xc31130dc73f078f99fac28e250535cbc3407608d
echo 1 | RUST_LOG=info cargo run --release --bin control -- --phase phase2 -i new_challenge.query -I new_challenge.full --unsafe-passphrase --keys-file $BASE_DIR/plumo-verifier.keys --chunk-size 10 --phase1-powers 12 --phase1-filename phase2_init --circuit-filename circuit_2992c --coordinator-url http://localhost:8080 new-round --expected-participant 0xc31130dc73f078f99fac28e250535cbc3407608d --new-participant 0x31e598a18069f75983dc00c39aafc7e9f7b71aee --publish --shutdown-delay-time-in-secs 10
echo 1 | RUST_LOG=info cargo run --release --bin control -- --phase phase2 -i new_challenge.query -I new_challenge.full --unsafe-passphrase --keys-file $BASE_DIR/plumo-verifier.keys --chunk-size 10 --phase1-powers 12 --phase1-filename phase2_init --circuit-filename circuit_2992c --coordinator-url http://localhost:8080 new-round --verify-transcript --expected-participant 0xc31130dc73f078f99fac28e250535cbc3407608d --new-participant 0x31e598a18069f75983dc00c39aafc7e9f7b71aee --publish --shutdown-delay-time-in-secs 10
echo 1 | RUST_LOG=info cargo run --release --bin contribute -- --unsafe-passphrase --exit-when-finished-contributing --keys-file $BASE_DIR/plumo-contributor-2.keys --coordinator-url http://localhost:8080
echo 1 | RUST_LOG=info cargo run --release --bin contribute -- --unsafe-passphrase --exit-when-finished-contributing --keys-file $BASE_DIR/plumo-verifier.keys --participation-mode verify --coordinator-url http://localhost:8080
echo 1 | RUST_LOG=info cargo run --release --bin control -- --phase phase2 -i new_challenge.query -I new_challenge.full --unsafe-passphrase --keys-file $BASE_DIR/plumo-verifier.keys --chunk-size 10 --phase1-powers 12 --phase1-filename phase2_init --circuit-filename circuit_2992c --coordinator-url http://localhost:8080 apply-beacon --beacon-hash 0000000000000000000000000000000000000000000000000000000000000000 --expected-participant 0x31e598a18069f75983dc00c39aafc7e9f7b71aee
Expand Down
18 changes: 13 additions & 5 deletions src/bin/control.rs
Original file line number Diff line number Diff line change
Expand Up @@ -235,11 +235,20 @@ impl Control {
Some(phase) => string_to_phase(&phase)?,
_ => string_to_phase(&ceremony.phase)?,
};
let phase2_opts = if phase == Phase::Phase2 {
Some(Phase2Opts::new(opts).await?)
} else {
None
let phase2_opts = match (&phase, opts.command.as_ref().expect("No command found")) {
(Phase::Phase2, Command::NewRound(round_opts)) => {
if round_opts.verify_transcript {
Some(Phase2Opts::new(opts).await?)
} else {
None
}
}
(Phase::Phase2, Command::ApplyBeacon(_round_opts)) => {
Some(Phase2Opts::new(opts).await?)
}
(_, _) => None,
};

let private_key = LocalWallet::from(SigningKey::new(private_key)?);
let control = Self {
phase: phase,
Expand Down Expand Up @@ -410,7 +419,6 @@ impl Control {
.enumerate()
.map(|(chunk_index, chunk)| (chunk_index, chunk.contributions.iter().last().unwrap()))
{
//let parameters = create_parameters_for_chunk::<E>(&ceremony.parameters, chunk_index)?;
remove_file_if_exists(RESPONSE_FILENAME)?;
let contributed_location = contribution.contributed_location()?;
info!("Downloading chunk {}", chunk_index);
Expand Down

0 comments on commit 33717c3

Please sign in to comment.