Jelajahi Sumber

downgrade clap crate to 2.33.3 version

ghassmo 4 tahun lalu
induk
melakukan
4c7493acf8
7 mengubah file dengan 99 tambahan dan 169 penghapusan
  1. 17 97
      Cargo.lock
  2. 1 1
      Cargo.toml
  3. 5 3
      lisp/lisp.rs
  4. 26 18
      src/bin/zkvm.rs
  5. 14 14
      src/cli/cashierd_cli.rs
  6. 6 6
      src/cli/darkfid_cli.rs
  7. 30 30
      src/cli/drk_cli.rs

+ 17 - 97
Cargo.lock

@@ -100,6 +100,15 @@ dependencies = [
  "memchr",
  "memchr",
 ]
 ]
 
 
+[[package]]
+name = "ansi_term"
+version = "0.11.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ee49baf6cb617b853aa8d93bf420db2383fab46d314482ca2803b40d5fde979b"
+dependencies = [
+ "winapi 0.3.9",
+]
+
 [[package]]
 [[package]]
 name = "anyhow"
 name = "anyhow"
 version = "1.0.43"
 version = "1.0.43"
@@ -699,35 +708,19 @@ dependencies = [
 
 
 [[package]]
 [[package]]
 name = "clap"
 name = "clap"
-version = "3.0.0-beta.4"
+version = "2.33.3"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "fcd70aa5597dbc42f7217a543f9ef2768b2ef823ba29036072d30e1d88e98406"
+checksum = "37e58ac78573c40708d45522f0d80fa2f01cc4f9b4e2bf749807255454312002"
 dependencies = [
 dependencies = [
+ "ansi_term",
  "atty",
  "atty",
  "bitflags",
  "bitflags",
- "clap_derive",
- "indexmap",
- "lazy_static",
- "os_str_bytes",
  "strsim",
  "strsim",
- "termcolor",
  "textwrap",
  "textwrap",
+ "unicode-width",
  "vec_map",
  "vec_map",
 ]
 ]
 
 
-[[package]]
-name = "clap_derive"
-version = "3.0.0-beta.4"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "0b5bb0d655624a0b8770d1c178fb8ffcb1f91cc722cb08f451e3dc72465421ac"
-dependencies = [
- "heck",
- "proc-macro-error",
- "proc-macro2",
- "quote",
- "syn",
-]
-
 [[package]]
 [[package]]
 name = "concurrent-queue"
 name = "concurrent-queue"
 version = "1.2.2"
 version = "1.2.2"
@@ -1574,15 +1567,6 @@ dependencies = [
  "hashbrown",
  "hashbrown",
 ]
 ]
 
 
-[[package]]
-name = "heck"
-version = "0.3.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "6d621efb26863f0e9924c6ac577e8275e5e6b77455db64ffa6c65c904e9e132c"
-dependencies = [
- "unicode-segmentation",
-]
-
 [[package]]
 [[package]]
 name = "hermit-abi"
 name = "hermit-abi"
 version = "0.1.19"
 version = "0.1.19"
@@ -1694,16 +1678,6 @@ dependencies = [
  "unicode-normalization",
  "unicode-normalization",
 ]
 ]
 
 
-[[package]]
-name = "indexmap"
-version = "1.7.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "bc633605454125dec4b66843673f01c7df2b89479b32e0ed634e43a91cff62a5"
-dependencies = [
- "autocfg",
- "hashbrown",
-]
-
 [[package]]
 [[package]]
 name = "infer"
 name = "infer"
 version = "0.2.3"
 version = "0.2.3"
@@ -2188,12 +2162,6 @@ dependencies = [
  "vcpkg",
  "vcpkg",
 ]
 ]
 
 
-[[package]]
-name = "os_str_bytes"
-version = "3.1.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "6acbef58a60fe69ab50510a55bc8cdd4d6cf2283d27ad338f54cb52747a9cf2d"
-
 [[package]]
 [[package]]
 name = "owning_ref"
 name = "owning_ref"
 version = "0.4.1"
 version = "0.4.1"
@@ -2358,30 +2326,6 @@ dependencies = [
  "toml",
  "toml",
 ]
 ]
 
 
-[[package]]
-name = "proc-macro-error"
-version = "1.0.4"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c"
-dependencies = [
- "proc-macro-error-attr",
- "proc-macro2",
- "quote",
- "syn",
- "version_check",
-]
-
-[[package]]
-name = "proc-macro-error-attr"
-version = "1.0.4"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869"
-dependencies = [
- "proc-macro2",
- "quote",
- "version_check",
-]
-
 [[package]]
 [[package]]
 name = "proc-macro-hack"
 name = "proc-macro-hack"
 version = "0.5.19"
 version = "0.5.19"
@@ -3011,9 +2955,9 @@ checksum = "213701ba3370744dcd1a12960caa4843b3d68b4d1c0a5d575e0d65b2ee9d16c0"
 
 
 [[package]]
 [[package]]
 name = "strsim"
 name = "strsim"
-version = "0.10.0"
+version = "0.8.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623"
+checksum = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a"
 
 
 [[package]]
 [[package]]
 name = "subtle"
 name = "subtle"
@@ -3097,20 +3041,11 @@ dependencies = [
  "winapi 0.3.9",
  "winapi 0.3.9",
 ]
 ]
 
 
-[[package]]
-name = "termcolor"
-version = "1.1.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2dfed899f0eb03f32ee8c6a0aabdb8a7949659e3466561fc0adf54e26d88c5f4"
-dependencies = [
- "winapi-util",
-]
-
 [[package]]
 [[package]]
 name = "textwrap"
 name = "textwrap"
-version = "0.14.2"
+version = "0.11.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "0066c8d12af8b5acd21e00547c3797fde4e8677254a7ee429176ccebbe93dd80"
+checksum = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060"
 dependencies = [
 dependencies = [
  "unicode-width",
  "unicode-width",
 ]
 ]
@@ -3295,12 +3230,6 @@ dependencies = [
  "tinyvec",
  "tinyvec",
 ]
 ]
 
 
-[[package]]
-name = "unicode-segmentation"
-version = "1.8.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8895849a949e7845e06bd6dc1aa51731a103c42707010a5b591c0038fb73385b"
-
 [[package]]
 [[package]]
 name = "unicode-width"
 name = "unicode-width"
 version = "0.1.8"
 version = "0.1.8"
@@ -3540,15 +3469,6 @@ version = "0.4.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
 checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
 
 
-[[package]]
-name = "winapi-util"
-version = "0.1.5"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178"
-dependencies = [
- "winapi 0.3.9",
-]
-
 [[package]]
 [[package]]
 name = "winapi-x86_64-pc-windows-gnu"
 name = "winapi-x86_64-pc-windows-gnu"
 version = "0.4.0"
 version = "0.4.0"

+ 1 - 1
Cargo.toml

@@ -42,7 +42,7 @@ itertools = "0.8.0"
 regex = "1"
 regex = "1"
 
 
 simplelog = "0.7.4"
 simplelog = "0.7.4"
-clap = "3.0.0-beta.1"
+clap = "2.33.3"
 failure = "0.1.8"
 failure = "0.1.8"
 failure_derive = "0.1.8"
 failure_derive = "0.1.8"
 log = "0.4"
 log = "0.4"

+ 5 - 3
lisp/lisp.rs

@@ -734,9 +734,11 @@ fn main() -> Result<(), ()> {
     // .unwrap();
     // .unwrap();
 
 
     match matches.subcommand() {
     match matches.subcommand() {
-        Some(("load", matches)) => {
-            let file: String = matches.value_of("FILE").unwrap().parse().unwrap();
-            repl_load(file)?;
+        ("load", matches) => {
+            if let Some(matches) = matches {
+                let file: String = matches.value_of("FILE").unwrap().parse().unwrap();
+                repl_load(file)?;
+            }
         }
         }
         _ => {
         _ => {
             eprintln!("error: Invalid subcommand invoked");
             eprintln!("error: Invalid subcommand invoked");

+ 26 - 18
src/bin/zkvm.rs

@@ -126,27 +126,35 @@ fn main() -> Result<()> {
     .unwrap();
     .unwrap();
 
 
     match matches.subcommand() {
     match matches.subcommand() {
-        Some(("init", matches)) => {
-            let contract_data: String = matches.value_of("CONTRACT_DATA").unwrap().parse()?;
-            let setup_file: String = matches.value_of("SETUP_FILE").unwrap().parse()?;
-            trusted_setup(contract_data, setup_file)?;
+        ("init", matches) => {
+            if let Some(matches) = matches {
+                let contract_data: String = matches.value_of("CONTRACT_DATA").unwrap().parse()?;
+                let setup_file: String = matches.value_of("SETUP_FILE").unwrap().parse()?;
+                trusted_setup(contract_data, setup_file)?;
+            }
         }
         }
-        Some(("prove", matches)) => {
-            let contract_data: String = matches.value_of("CONTRACT_DATA").unwrap().parse()?;
-            let setup_file: String = matches.value_of("SETUP_FILE").unwrap().parse()?;
-            let params: String = matches.value_of("PARAMS").unwrap().parse()?;
-            let zk_proof: String = matches.value_of("ZK_PROOF").unwrap().parse()?;
-            create_proof(contract_data, setup_file, params, zk_proof)?;
+        ("prove", matches) => {
+            if let Some(matches) = matches {
+                let contract_data: String = matches.value_of("CONTRACT_DATA").unwrap().parse()?;
+                let setup_file: String = matches.value_of("SETUP_FILE").unwrap().parse()?;
+                let params: String = matches.value_of("PARAMS").unwrap().parse()?;
+                let zk_proof: String = matches.value_of("ZK_PROOF").unwrap().parse()?;
+                create_proof(contract_data, setup_file, params, zk_proof)?;
+            }
         }
         }
-        Some(("verify", matches)) => {
-            let contract_data: String = matches.value_of("CONTRACT_DATA").unwrap().parse()?;
-            let setup_file: String = matches.value_of("SETUP_FILE").unwrap().parse()?;
-            let zk_proof: String = matches.value_of("ZK_PROOF").unwrap().parse()?;
-            verify_proof(contract_data, setup_file, zk_proof)?;
+        ("verify", matches) => {
+            if let Some(matches) = matches {
+                let contract_data: String = matches.value_of("CONTRACT_DATA").unwrap().parse()?;
+                let setup_file: String = matches.value_of("SETUP_FILE").unwrap().parse()?;
+                let zk_proof: String = matches.value_of("ZK_PROOF").unwrap().parse()?;
+                verify_proof(contract_data, setup_file, zk_proof)?;
+            }
         }
         }
-        Some(("show", matches)) => {
-            let zk_proof: String = matches.value_of("ZK_PROOF").unwrap().parse()?;
-            show_public(zk_proof)?;
+        ("show", matches) => {
+            if let Some(matches) = matches {
+                let zk_proof: String = matches.value_of("ZK_PROOF").unwrap().parse()?;
+                show_public(zk_proof)?;
+            }
         }
         }
         _ => {
         _ => {
             eprintln!("error: Invalid subcommand invoked");
             eprintln!("error: Invalid subcommand invoked");

+ 14 - 14
src/cli/cashierd_cli.rs

@@ -16,37 +16,37 @@ impl CashierdCli {
             .author("Dark Renaissance Technologies")
             .author("Dark Renaissance Technologies")
             .about("run service daemon")
             .about("run service daemon")
             .arg(
             .arg(
-                Arg::new("verbose")
-                    .short('v')
-                    .help_heading(Some("Increase verbosity"))
+                Arg::with_name("verbose")
+                    .short("v")
+                    .help("Increase verbosity")
                     .long("verbose")
                     .long("verbose")
                     .takes_value(false),
                     .takes_value(false),
             )
             )
             .arg(
             .arg(
-                Arg::new("hello")
+                Arg::with_name("hello")
                     .long("hello")
                     .long("hello")
-                    .help_heading(Some("Say hello"))
+                    .help("Say hello")
                     .takes_value(false),
                     .takes_value(false),
             )
             )
             .arg(
             .arg(
-                Arg::new("wallet")
-                    .short('w')
+                Arg::with_name("wallet")
+                    .short("w")
                     .long("wallet")
                     .long("wallet")
-                    .help_heading(Some("Create a new wallet"))
+                    .help("Create a new wallet")
                     .takes_value(false),
                     .takes_value(false),
             )
             )
             .arg(
             .arg(
-                Arg::new("info")
-                    .short('i')
+                Arg::with_name("info")
+                    .short("i")
                     .long("info")
                     .long("info")
-                    .help_heading(Some("Request info from daemon"))
+                    .help("Request info from daemon")
                     .takes_value(false),
                     .takes_value(false),
             )
             )
             .arg(
             .arg(
-                Arg::new("stop")
-                    .short('s')
+                Arg::with_name("stop")
+                    .short("s")
                     .long("stop")
                     .long("stop")
-                    .help_heading(Some("Send a stop signal to the daemon"))
+                    .help("Send a stop signal to the daemon")
                     .takes_value(false),
                     .takes_value(false),
             )
             )
             .get_matches();
             .get_matches();

+ 6 - 6
src/cli/darkfid_cli.rs

@@ -16,16 +16,16 @@ impl DarkfidCli {
             .author("Dark Renaissance Technologies")
             .author("Dark Renaissance Technologies")
             .about("Run Darkfi Daemon")
             .about("Run Darkfi Daemon")
             .arg(
             .arg(
-                Arg::new("verbose")
-                    .short('v')
-                    .help_heading(Some("Increase verbosity"))
+                Arg::with_name("verbose")
+                    .short("v")
+                    .help("Increase verbosity")
                     .long("verbose")
                     .long("verbose")
                     .takes_value(false),
                     .takes_value(false),
             )
             )
             .arg(
             .arg(
-                Arg::new("config")
-                    .short('c')
-                    .help_heading(Some("Path for config file"))
+                Arg::with_name("config")
+                    .short("c")
+                    .help("Path for config file")
                     .long("config")
                     .long("config")
                     .takes_value(true),
                     .takes_value(true),
             )
             )

+ 30 - 30
src/cli/drk_cli.rs

@@ -6,7 +6,7 @@ use serde::Deserialize;
 
 
 use std::path::PathBuf;
 use std::path::PathBuf;
 
 
-fn amount_f64<'a>(v: &'a str) -> std::result::Result<(), String> {
+fn amount_f64(v: String) -> std::result::Result<(), String> {
     if v.parse::<f64>().is_ok() {
     if v.parse::<f64>().is_ok() {
         Ok(())
         Ok(())
     } else {
     } else {
@@ -77,55 +77,55 @@ impl DrkCli {
             .author("Dark Renaissance Technologies")
             .author("Dark Renaissance Technologies")
             .about("Run Drk Client")
             .about("Run Drk Client")
             .arg(
             .arg(
-                Arg::new("verbose")
-                    .short('v')
-                    .help_heading(Some("Increase verbosity"))
+                Arg::with_name("verbose")
+                    .short("v")
+                    .help("Increase verbosity")
                     .long("verbose")
                     .long("verbose")
                     .takes_value(false),
                     .takes_value(false),
             )
             )
             .arg(
             .arg(
-                Arg::new("hello")
+                Arg::with_name("hello")
                     .long("hello")
                     .long("hello")
-                    .help_heading(Some("Say hello"))
+                    .help("Say hello")
                     .takes_value(false),
                     .takes_value(false),
             )
             )
             .arg(
             .arg(
-                Arg::new("key")
-                    .short('k')
+                Arg::with_name("key")
+                    .short("k")
                     .long("key")
                     .long("key")
-                    .help_heading(Some("Test key"))
+                    .help("Test key")
                     .takes_value(false),
                     .takes_value(false),
             )
             )
             .arg(
             .arg(
-                Arg::new("getkey")
+                Arg::with_name("getkey")
                     .long("getkey")
                     .long("getkey")
-                    .help_heading(Some("Get public key as base-58 encoded string"))
+                    .help("Get public key as base-58 encoded string")
                     .takes_value(false),
                     .takes_value(false),
             )
             )
             .arg(
             .arg(
-                Arg::new("wallet")
-                    .short('w')
+                Arg::with_name("wallet")
+                    .short("w")
                     .long("wallet")
                     .long("wallet")
-                    .help_heading(Some("Create a new wallet"))
+                    .help("Create a new wallet")
                     .takes_value(false),
                     .takes_value(false),
             )
             )
             .arg(
             .arg(
-                Arg::new("info")
-                    .short('i')
+                Arg::with_name("info")
+                    .short("i")
                     .long("info")
                     .long("info")
-                    .help_heading(Some("Request info from daemon"))
+                    .help("Request info from daemon")
                     .takes_value(false),
                     .takes_value(false),
             )
             )
             .arg(
             .arg(
-                Arg::new("stop")
-                    .short('s')
+                Arg::with_name("stop")
+                    .short("s")
                     .long("stop")
                     .long("stop")
-                    .help_heading(Some("Send a stop signal to the daemon"))
+                    .help("Send a stop signal to the daemon")
                     .takes_value(false),
                     .takes_value(false),
             )
             )
             .arg(
             .arg(
-                Arg::new("config")
-                    .help_heading(Some("Path for config file"))
+                Arg::with_name("config")
+                    .help("Path for config file")
                     .long("config")
                     .long("config")
                     .takes_value(true),
                     .takes_value(true),
             )
             )
@@ -133,20 +133,20 @@ impl DrkCli {
                 App::new("transfer")
                 App::new("transfer")
                     .about("Transfer DBTC between users")
                     .about("Transfer DBTC between users")
                     .arg(
                     .arg(
-                        Arg::new("address")
+                        Arg::with_name("address")
                             .value_name("RECEIVE_ADDRESS")
                             .value_name("RECEIVE_ADDRESS")
                             .takes_value(true)
                             .takes_value(true)
                             .index(1)
                             .index(1)
-                            .help_heading(Some("Address of recipient"))
+                            .help("Address of recipient")
                             .required(true),
                             .required(true),
                     )
                     )
                     .arg(
                     .arg(
-                        Arg::new("amount")
+                        Arg::with_name("amount")
                             .value_name("AMOUNT")
                             .value_name("AMOUNT")
                             .takes_value(true)
                             .takes_value(true)
                             .index(2)
                             .index(2)
                             .validator(amount_f64)
                             .validator(amount_f64)
-                            .help_heading(Some("Amount to send, in DBTC"))
+                            .help("Amount to send, in DBTC")
                             .required(true),
                             .required(true),
                     ),
                     ),
             )
             )
@@ -155,20 +155,20 @@ impl DrkCli {
                 App::new("withdraw")
                 App::new("withdraw")
                     .about("Withdraw BTC for dBTC")
                     .about("Withdraw BTC for dBTC")
                     .arg(
                     .arg(
-                        Arg::new("address")
+                        Arg::with_name("address")
                             .value_name("RECEIVE_ADDRESS")
                             .value_name("RECEIVE_ADDRESS")
                             .takes_value(true)
                             .takes_value(true)
                             .index(1)
                             .index(1)
-                            .help_heading(Some("Address of recipient"))
+                            .help("Address of recipient")
                             .required(true),
                             .required(true),
                     )
                     )
                     .arg(
                     .arg(
-                        Arg::new("amount")
+                        Arg::with_name("amount")
                             .value_name("AMOUNT")
                             .value_name("AMOUNT")
                             .takes_value(true)
                             .takes_value(true)
                             .index(2)
                             .index(2)
                             .validator(amount_f64)
                             .validator(amount_f64)
-                            .help_heading(Some("Amount to send, in BTC"))
+                            .help("Amount to send, in BTC")
                             .required(true),
                             .required(true),
                     ),
                     ),
             )
             )