Skip to content

Commit

Permalink
Update clap requirement from 3.0.1 to 4.0.18 (#79)
Browse files Browse the repository at this point in the history
* Update clap requirement from 3.0.1 to 4.0.18

Updates the requirements on [clap](https://github.com/clap-rs/clap) to permit the latest version.
- [Release notes](https://github.com/clap-rs/clap/releases)
- [Changelog](https://github.com/clap-rs/clap/blob/master/CHANGELOG.md)
- [Commits](clap-rs/clap@clap_complete-v3.0.1...v4.0.18)

---
updated-dependencies:
- dependency-name: clap
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <[email protected]>

* workflows: `cargo test --all-targets`

Signed-off-by: William Woodruff <[email protected]>

* main: clap 4.0 changes

Signed-off-by: William Woodruff <[email protected]>

* workflows/ci: temporarily allow `clippy::explicit_auto_deref` failures

Signed-off-by: William Woodruff <[email protected]>

* ci, src: Do clippy the right way

Signed-off-by: William Woodruff <[email protected]>

* main: lintage

Signed-off-by: William Woodruff <[email protected]>

Signed-off-by: dependabot[bot] <[email protected]>
Signed-off-by: William Woodruff <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: William Woodruff <[email protected]>
  • Loading branch information
dependabot[bot] and woodruffw authored Nov 1, 2022
1 parent 113a5d4 commit c894baf
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 39 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@ jobs:
run: cargo fmt -- --check

- name: Lint
run: cargo clippy -- -D warnings
run: cargo clippy -- -D warnings -A clippy::explicit_auto_deref

- name: Build
run: cargo build

- name: Test
run: cargo test
run: cargo test --all-targets
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ async-std = "1.7"
bincode = "1.3.3"
blake3 = "1.0.0"
chacha = "0.3"
clap = "3.0.1"
clap = "4.0.18"
ctr = "0.9"
mcircuit = "0.1.7"
num-traits = "0.2"
Expand Down
72 changes: 37 additions & 35 deletions src/main.rs
Original file line number Diff line number Diff line change
@@ -1,27 +1,21 @@
#![allow(dead_code)]
#![allow(unused_imports)]
#![allow(clippy::explicit_auto_deref)]

use std::fs::File;
use std::io;
use std::io::{BufReader, BufWriter};
use std::marker::PhantomData;
use std::mem;
use std::path::PathBuf;
use std::process::exit;
use std::sync::Arc;

use async_std::task;
use clap::{App, Arg};
use clap::{value_parser, Arg, Command};
use num_traits::Zero;
use rand::rngs::OsRng;
use rand::Rng;
use reverie::algebra::*;
use reverie::crypto::prg::KEY_SIZE;
use reverie::interpreter::{CombineInstance, Instance};
use reverie::proof::Proof;
use reverie::transcript::ProverTranscript;
use reverie::PACKED;
use reverie::CombineOperation;
use reverie::{evaluate_composite_program, largest_wires};
use reverie::{CombineOperation, Operation};

mod witness;

Expand Down Expand Up @@ -170,60 +164,58 @@ async fn oneshot_zk<WP: Parser<bool> + Send + 'static>(
}
}

async fn async_main() {
let matches = App::new("Speed Reverie")
fn app() -> Command {
Command::new("Speed Reverie")
.about("Gotta go fast")
.arg(
Arg::new("operation")
.long("operation")
.help("Specify the operation: \"prove\", \"verify\"")
.possible_values(["prove", "verify", "oneshot", "oneshot-zk", "version_info"])
.forbid_empty_values(true)
.takes_value(true)
.value_parser(["prove", "verify", "oneshot", "oneshot-zk", "version_info"])
.required(true),
)
.arg(
Arg::new("witness-path")
.long("witness-path")
.help("The path to the file containing the witness (for proving)")
.required_if_eq_any(&[
.required_if_eq_any([
("operation", "prove"),
("operation", "oneshot"),
("operation", "oneshot-zk"),
("operation", "bench"),
])
.takes_value(true)
.forbid_empty_values(true),
.value_parser(value_parser!(PathBuf)),
)
.arg(
Arg::new("program-path")
.long("program-path")
.help("The path to the file containing the program (or statement)")
.required_if_eq_any(&[
.required_if_eq_any([
("operation", "prove"),
("operation", "verify"),
("operation", "oneshot"),
("operation", "oneshot-zk"),
("operation", "bench"),
])
.forbid_empty_values(true)
.takes_value(true),
.value_parser(value_parser!(PathBuf)),
)
.arg(
Arg::new("proof-path")
.long("proof-path")
.help("The path to write the proof file")
.required_if_eq_any(&[("operation", "prove"), ("operation", "verify")])
.forbid_empty_values(true)
.takes_value(true),
.required_if_eq_any([("operation", "prove"), ("operation", "verify")])
.value_parser(value_parser!(PathBuf)),
)
.get_matches();
}

async fn async_main() {
let matches = app().get_matches();

match matches.value_of("operation").unwrap() {
match *matches.get_one("operation").unwrap() {
"oneshot" => {
let res = oneshot::<witness::WitParser>(
matches.value_of("program-path").unwrap(),
matches.value_of("witness-path").unwrap(),
*matches.get_one("program-path").unwrap(),
*matches.get_one("witness-path").unwrap(),
)
.await;
match res {
Expand All @@ -236,8 +228,8 @@ async fn async_main() {
}
"oneshot-zk" => {
let res = oneshot_zk::<witness::WitParser>(
matches.value_of("program-path").unwrap(),
matches.value_of("witness-path").unwrap(),
*matches.get_one("program-path").unwrap(),
*matches.get_one("witness-path").unwrap(),
)
.await;
match res {
Expand All @@ -250,9 +242,9 @@ async fn async_main() {
}
"prove" => {
let res = prove::<witness::WitParser>(
matches.value_of("program-path").unwrap(),
matches.value_of("witness-path").unwrap(),
matches.value_of("proof-path").unwrap(),
*matches.get_one("program-path").unwrap(),
*matches.get_one("witness-path").unwrap(),
*matches.get_one("proof-path").unwrap(),
)
.await;
match res {
Expand All @@ -265,8 +257,8 @@ async fn async_main() {
}
"verify" => {
let res = verify::<witness::WitParser>(
matches.value_of("program-path").unwrap(),
matches.value_of("proof-path").unwrap(),
*matches.get_one("program-path").unwrap(),
*matches.get_one("proof-path").unwrap(),
)
.await;
match res {
Expand Down Expand Up @@ -296,3 +288,13 @@ async fn print_version() {
fn main() {
task::block_on(async_main());
}

#[cfg(all(test, unix))]
mod tests {
use super::*;

#[test]
fn test_app() {
app().debug_assert();
}
}
1 change: 0 additions & 1 deletion src/witness.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ use std::fs::File;
use std::io::{self, prelude::*, BufReader};

use reverie::algebra::gf2;
use reverie::Domain;

use super::Parser;

Expand Down

0 comments on commit c894baf

Please sign in to comment.