Update dependencies and CI.

This commit is contained in:
parazyd
2022-04-23 21:20:40 +02:00
parent a1aeade1e8
commit f4bab15776
28 changed files with 226 additions and 2840 deletions

2
.gitignore vendored
View File

@@ -1,9 +1,9 @@
*.pyc *.pyc
*.sage.py *.sage.py
*.zk.bin
.vscode/ .vscode/
/target/* /target/*
/proof/*.bin
/cashierd /cashierd
/dao-cli /dao-cli

2965
Cargo.lock generated

File diff suppressed because it is too large Load Diff

View File

@@ -19,12 +19,12 @@ codegen-units = 1
[workspace] [workspace]
members = [ members = [
"bin/zkas", "bin/zkas",
"bin/cashierd", #"bin/cashierd",
"bin/darkfid", #"bin/darkfid",
"bin/darkfid2", "bin/darkfid2",
"bin/drk", "bin/drk",
"bin/faucetd", "bin/faucetd",
"bin/gatewayd", #"bin/gatewayd",
"bin/ircd", "bin/ircd",
"bin/dnetview", "bin/dnetview",
"bin/daod", "bin/daod",
@@ -108,7 +108,7 @@ sha2 = {version = "0.10.2", optional = true}
group = {version = "0.11.0", optional = true} group = {version = "0.11.0", optional = true}
arrayvec = {version = "0.7.2", optional = true} arrayvec = {version = "0.7.2", optional = true}
blake2b_simd = {version = "1.0.0", optional = true} blake2b_simd = {version = "1.0.0", optional = true}
pasta_curves = {version = "0.3.0", optional = true} pasta_curves = {version = "0.3.1", optional = true}
crypto_api_chachapoly = {version = "0.5.0", optional = true} crypto_api_chachapoly = {version = "0.5.0", optional = true}
incrementalmerkletree = {version = "0.3.0-beta.2", optional = true} incrementalmerkletree = {version = "0.3.0-beta.2", optional = true}
halo2_proofs = {version = "0.1.0-beta.4", features = ["dev-graph", "gadget-traces", "sanity-checks"], optional = true} halo2_proofs = {version = "0.1.0-beta.4", features = ["dev-graph", "gadget-traces", "sanity-checks"], optional = true}
@@ -128,7 +128,7 @@ libsqlite3-sys = {version = "0.24.2", features = ["bundled-sqlcipher"], optiona
sled = {version = "0.34.7", optional = true} sled = {version = "0.34.7", optional = true}
[dev-dependencies] [dev-dependencies]
clap = {version = "3.1.10", features = ["derive"]} clap = {version = "3.1.12", features = ["derive"]}
[features] [features]
async-runtime = [ async-runtime = [

View File

@@ -40,7 +40,7 @@ clippy:
RUSTFLAGS="$(RUSTFLAGS)" $(CARGO) clippy --release --all-features --all RUSTFLAGS="$(RUSTFLAGS)" $(CARGO) clippy --release --all-features --all
# zkas source files which we want to compile for tests # zkas source files which we want to compile for tests
VM_SRC = proof/arithmetic.zk proof/mint.zk proof/burn.zk VM_SRC = proof/arithmetic.zk proof/mint.zk proof/burn.zk example/simple.zk
VM_BIN = $(VM_SRC:=.bin) VM_BIN = $(VM_SRC:=.bin)
$(VM_BIN): zkas $(VM_SRC) $(VM_BIN): zkas $(VM_SRC)

View File

@@ -21,7 +21,7 @@ easy-parallel = "3.2.0"
rand = "0.8.5" rand = "0.8.5"
# Misc # Misc
clap = {version = "3.1.10", features = ["derive"]} clap = {version = "3.1.12", features = ["derive"]}
log = "0.4.16" log = "0.4.16"
num_cpus = "1.13.1" num_cpus = "1.13.1"
simplelog = "0.12.0" simplelog = "0.12.0"
@@ -35,7 +35,7 @@ serde_json = "1.0.79"
# Bitcoin bridge dependencies # Bitcoin bridge dependencies
bdk = {version = "0.17.0", optional = true} bdk = {version = "0.17.0", optional = true}
anyhow = {version = "1.0.56", optional = true} anyhow = {version = "1.0.57", optional = true}
bitcoin = {version = "0.27.1", optional = true} bitcoin = {version = "0.27.1", optional = true}
secp256k1 = {version = "0.20.1", default-features = false, features = ["rand-std"], optional = true} secp256k1 = {version = "0.20.1", default-features = false, features = ["rand-std"], optional = true}

View File

@@ -242,8 +242,7 @@ impl Client {
Ok(Self { Ok(Self {
electrum, electrum,
subscriptions: Vec::new(), subscriptions: Vec::new(),
latest_block_height: BlockHeight::try_from(latest_block) latest_block_height: BlockHeight::try_from(latest_block)?,
.map_err(|_| darkfi::Error::TryFromError)?,
last_sync: Instant::now(), last_sync: Instant::now(),
sync_interval: interval, sync_interval: interval,
script_history: Default::default(), script_history: Default::default(),
@@ -310,7 +309,7 @@ impl Client {
Ok(ScriptStatus::InMempool) Ok(ScriptStatus::InMempool)
} else { } else {
Ok(ScriptStatus::Confirmed(Confirmed::from_inclusion_and_latest_block( Ok(ScriptStatus::Confirmed(Confirmed::from_inclusion_and_latest_block(
u32::try_from(last.height).map_err(|_| darkfi::Error::TryFromError)?, last.height as u32,
u32::from(self.latest_block_height), u32::from(self.latest_block_height),
))) )))
} }
@@ -362,7 +361,7 @@ impl BtcClient {
let (network, url) = match network { let (network, url) = match network {
"mainnet" => (Network::Bitcoin, "ssl://electrum.blockstream.info:50002"), "mainnet" => (Network::Bitcoin, "ssl://electrum.blockstream.info:50002"),
"testnet" => (Network::Testnet, "ssl://electrum.blockstream.info:60002"), "testnet" => (Network::Testnet, "ssl://electrum.blockstream.info:60002"),
_ => return Err(Error::NotSupportedNetwork), _ => return Err(Error::UnsupportedCoinNetwork),
}; };
let main_account = Account::new(&main_keypair, network); let main_account = Account::new(&main_keypair, network);

View File

@@ -291,7 +291,7 @@ impl EthClient {
if sub_iter > 60 * 10 { if sub_iter > 60 * 10 {
// 10 minutes // 10 minutes
self.unsubscribe(&addr).await; self.unsubscribe(&addr).await;
return Err(darkfi::Error::ClientFailed("Deposit for expired".into())) return Err(EthFailed::Custom("Deposit for expired".to_string()).into())
} }
sub_iter += iter_interval; sub_iter += iter_interval;
@@ -309,9 +309,9 @@ impl EthClient {
self.unsubscribe(&addr).await; self.unsubscribe(&addr).await;
if current_balance < prev_balance { if current_balance < prev_balance {
return Err(darkfi::Error::ClientFailed( return Err(
"New balance is less than previous balance".into(), EthFailed::Custom("New balance is less than previous balance".to_string()).into()
)) )
} }
let received_balance = current_balance - prev_balance; let received_balance = current_balance - prev_balance;
@@ -532,6 +532,8 @@ pub enum EthFailed {
ParseError(String), ParseError(String),
#[error("Unable to derive address from private key")] #[error("Unable to derive address from private key")]
ImportPrivateError, ImportPrivateError,
#[error("{0}")]
Custom(String),
} }
impl From<darkfi::Error> for EthFailed { impl From<darkfi::Error> for EthFailed {

View File

@@ -102,7 +102,7 @@ impl SolClient {
"devnet" => ("https://api.devnet.solana.com", "wss://api.devnet.solana.com"), "devnet" => ("https://api.devnet.solana.com", "wss://api.devnet.solana.com"),
"testnet" => ("https://api.testnet.solana.com", "wss://api.testnet.solana.com"), "testnet" => ("https://api.testnet.solana.com", "wss://api.testnet.solana.com"),
"localhost" => ("http://localhost:8899", "ws://localhost:8900"), "localhost" => ("http://localhost:8899", "ws://localhost:8900"),
_ => return Err(Error::NotSupportedNetwork), _ => return Err(Error::UnsupportedCoinNetwork),
}; };
Ok(Arc::new(Self { Ok(Arc::new(Self {

View File

@@ -18,7 +18,7 @@ async-executor = "1.4.1"
easy-parallel = "3.2.0" easy-parallel = "3.2.0"
# Misc # Misc
clap = {version = "3.1.10", features = ["derive"]} clap = {version = "3.1.12", features = ["derive"]}
log = "0.4.16" log = "0.4.16"
num_cpus = "1.13.1" num_cpus = "1.13.1"
simplelog = "0.12.0" simplelog = "0.12.0"

View File

@@ -1,5 +1,5 @@
use clap::{IntoApp, Parser, Subcommand}; use clap::{IntoApp, Parser, Subcommand};
use log::{debug, error}; use log::debug;
use serde_json::{json, Value}; use serde_json::{json, Value};
use url::Url; use url::Url;
@@ -17,6 +17,7 @@ pub enum CliDaoSubCommands {
/// DAO cli /// DAO cli
#[derive(Parser)] #[derive(Parser)]
#[clap(name = "dao")] #[clap(name = "dao")]
#[clap(arg_required_else_help(true))]
pub struct CliDao { pub struct CliDao {
/// Increase verbosity /// Increase verbosity
#[clap(short, parse(from_occurrences))] #[clap(short, parse(from_occurrences))]
@@ -77,9 +78,8 @@ async fn start(options: CliDao) -> Result<()> {
} }
None => {} None => {}
} }
error!("Please run 'dao help' to see usage.");
Err(Error::MissingParams) Ok(())
} }
#[async_std::main] #[async_std::main]

View File

@@ -17,7 +17,7 @@ async-executor = "1.4.1"
easy-parallel = "3.2.0" easy-parallel = "3.2.0"
# Misc # Misc
clap = {version = "3.1.10", features = ["derive"]} clap = {version = "3.1.12", features = ["derive"]}
url = "2.2.2" url = "2.2.2"
log = "0.4.16" log = "0.4.16"
num_cpus = "1.13.1" num_cpus = "1.13.1"

View File

@@ -19,7 +19,7 @@ easy-parallel = "3.2.0"
async-channel = "1.6.1" async-channel = "1.6.1"
# Misc # Misc
clap = "3.1.10" clap = "3.1.12"
rand = "0.8.5" rand = "0.8.5"
simplelog = "0.12.0" simplelog = "0.12.0"
log = "0.4.16" log = "0.4.16"

View File

@@ -12,7 +12,7 @@ features = ["rpc"]
async-std = {version = "1.11.0", features = ["attributes"]} async-std = {version = "1.11.0", features = ["attributes"]}
# Misc # Misc
clap = {version = "3.1.10", features = ["derive"]} clap = {version = "3.1.12", features = ["derive"]}
log = "0.4.16" log = "0.4.16"
simplelog = "0.12.0" simplelog = "0.12.0"
prettytable-rs = "0.8.0" prettytable-rs = "0.8.0"

View File

@@ -115,6 +115,7 @@ pub enum CliDrkSubCommands {
#[derive(Parser)] #[derive(Parser)]
#[clap(name = "drk")] #[clap(name = "drk")]
#[clap(author, version, about)] #[clap(author, version, about)]
#[clap(arg_required_else_help(true))]
pub struct CliDrk { pub struct CliDrk {
/// Sets a custom config file /// Sets a custom config file
#[clap(short, long)] #[clap(short, long)]
@@ -147,7 +148,7 @@ impl Drk {
features.as_object().unwrap()["networks"].as_array().is_none() && features.as_object().unwrap()["networks"].as_array().is_none() &&
features.as_object().unwrap()["networks"].as_array().unwrap().is_empty() features.as_object().unwrap()["networks"].as_array().unwrap().is_empty()
{ {
return Err(Error::NotSupportedNetwork) return Err(Error::UnsupportedCoinNetwork)
} }
for nets in features.as_object().unwrap()["networks"].as_array().unwrap() { for nets in features.as_object().unwrap()["networks"].as_array().unwrap() {
@@ -158,7 +159,7 @@ impl Drk {
} }
} }
Err(Error::NotSupportedNetwork) Err(Error::UnsupportedCoinNetwork)
} }
async fn request(&self, r: jsonrpc::JsonRequest) -> Result<Value> { async fn request(&self, r: jsonrpc::JsonRequest) -> Result<Value> {
@@ -461,8 +462,7 @@ async fn start(config: &DrkConfig, options: CliDrk) -> Result<()> {
None => {} None => {}
} }
error!("Please run 'drk help' to see usage."); Ok(())
Err(Error::MissingParams)
} }
#[async_std::main] #[async_std::main]

View File

@@ -16,7 +16,7 @@ async-executor = "1.4.1"
easy-parallel = "3.2.0" easy-parallel = "3.2.0"
# Misc # Misc
clap = {version = "3.1.10", features = ["derive"]} clap = {version = "3.1.12", features = ["derive"]}
log = "0.4.16" log = "0.4.16"
num_cpus = "1.13.1" num_cpus = "1.13.1"
simplelog = "0.12.0" simplelog = "0.12.0"

View File

@@ -23,7 +23,7 @@ easy-parallel = "3.2.0"
rand = "0.8.5" rand = "0.8.5"
# Misc # Misc
clap = {version = "3.1.10", features = ["derive"]} clap = {version = "3.1.12", features = ["derive"]}
log = "0.4.16" log = "0.4.16"
simplelog = "0.12.0" simplelog = "0.12.0"
fxhash = "0.2.1" fxhash = "0.2.1"

View File

@@ -16,7 +16,7 @@ async-executor = "1.4.1"
easy-parallel = "3.2.0" easy-parallel = "3.2.0"
# Misc # Misc
clap = {version = "3.1.10", features = ["derive"]} clap = {version = "3.1.12", features = ["derive"]}
log = "0.4.16" log = "0.4.16"
num_cpus = "1.13.1" num_cpus = "1.13.1"
simplelog = "0.12.0" simplelog = "0.12.0"

View File

@@ -18,7 +18,7 @@ async-executor = "1.4.1"
easy-parallel = "3.2.0" easy-parallel = "3.2.0"
# Misc # Misc
clap = {version = "3.1.10", features = ["derive"]} clap = {version = "3.1.12", features = ["derive"]}
log = "0.4.16" log = "0.4.16"
num_cpus = "1.13.1" num_cpus = "1.13.1"
simplelog = "0.12.0" simplelog = "0.12.0"

View File

@@ -10,7 +10,7 @@ edition = "2021"
[dependencies] [dependencies]
bs58 = "0.4.0" bs58 = "0.4.0"
clap = {version = "3.1.10", features = ["derive"]} clap = {version = "3.1.12", features = ["derive"]}
ctrlc = "3.2.1" ctrlc = "3.2.1"
darkfi = {path = "../../", features = ["crypto"]} darkfi = {path = "../../", features = ["crypto"]}
indicatif = "0.17.0-rc.10" indicatif = "0.17.0-rc.10"

View File

@@ -9,5 +9,5 @@ license = "AGPL-3.0-only"
edition = "2021" edition = "2021"
[dependencies] [dependencies]
clap = {version = "3.1.10", features = ["derive"]} clap = {version = "3.1.12", features = ["derive"]}
darkfi = {path = "../../", features = ["zkas"]} darkfi = {path = "../../", features = ["zkas"]}

View File

@@ -173,6 +173,12 @@ def main():
ps["dependencies"][dep] = ret[1] ps["dependencies"][dep] = ret[1]
else: else:
ps["dependencies"][dep]["version"] = ret[1] ps["dependencies"][dep]["version"] = ret[1]
elif "dev-dependencies" in ps and dep in ps[
"dev-dependencies"]:
if ps["dev-dependencies"][dep] == ret[0]:
ps["dev-dependencies"][dep] = ret[1]
else:
ps["dev-dependencies"][dep]["version"] = ret[1]
if args.update: if args.update:
with open(filename, "w") as f: with open(filename, "w") as f:

View File

@@ -23,7 +23,7 @@ easy-parallel = "3.2.0"
rand = "0.8.5" rand = "0.8.5"
# Misc # Misc
clap = {version = "3.1.10", features = ["derive"]} clap = {version = "3.1.12", features = ["derive"]}
log = "0.4.16" log = "0.4.16"
simplelog = "0.12.0" simplelog = "0.12.0"
fxhash = "0.2.1" fxhash = "0.2.1"

View File

@@ -3,6 +3,10 @@ set -e
find_packages() { find_packages() {
find bin -type f -name Cargo.toml | while read line; do find bin -type f -name Cargo.toml | while read line; do
if echo "$line" | grep -Eq 'cashierd|darkfid|gatewayd'; then
continue
fi
echo "$(basename "$(dirname "$line")")" echo "$(basename "$(dirname "$line")")"
done done
} }

View File

@@ -20,10 +20,10 @@ async-executor = "1.4.1"
easy-parallel = "3.2.0" easy-parallel = "3.2.0"
# Misc # Misc
clap = {version = "3.1.8", features = ["derive"]} clap = {version = "3.1.12", features = ["derive"]}
log = "0.4.16" log = "0.4.16"
num_cpus = "1.13.1" num_cpus = "1.13.1"
simplelog = "0.12.0-alpha1" simplelog = "0.12.0"
# Encoding and parsing # Encoding and parsing
serde = {version = "1.0.136", features = ["derive"]} serde = {version = "1.0.136", features = ["derive"]}

View File

@@ -7,7 +7,7 @@ edition = "2018"
[workspace] [workspace]
[dependencies] [dependencies]
pasta_curves = "0.3.0" pasta_curves = "0.3.1"
ff = "0.11.0" ff = "0.11.0"
group = "0.11.0" group = "0.11.0"
rand = "0.8.5" rand = "0.8.5"

View File

@@ -31,6 +31,6 @@ toml = "0.5.9"
# Misc # Misc
log = "0.4.16" log = "0.4.16"
num_cpus = "1.13.1" num_cpus = "1.13.1"
simplelog = "0.12.0-alpha1" simplelog = "0.12.0"
[workspace] [workspace]

View File

@@ -176,6 +176,9 @@ pub enum Error {
#[error("JSON-RPC error: {0}")] #[error("JSON-RPC error: {0}")]
JsonRpcError(String), JsonRpcError(String),
#[error("Cashier error: {0}")]
CashierError(String),
// =============== // ===============
// Database errors // Database errors
// =============== // ===============

View File

@@ -65,13 +65,12 @@ fn burn_proof() -> Result<()> {
tree.witness(); tree.witness();
tree.append(&MerkleNode(coin1)); tree.append(&MerkleNode(coin1));
tree.append(&MerkleNode(coin2)); tree.append(&MerkleNode(coin2));
tree.witness(); let leaf_pos = tree.witness().unwrap();
tree.append(&MerkleNode(coin3)); tree.append(&MerkleNode(coin3));
tree.witness(); tree.witness();
let (leaf_pos, merkle_path) = tree.authentication_path(&MerkleNode(coin2)).unwrap(); let merkle_path = tree.authentication_path(leaf_pos).unwrap();
let leaf_pos: u64 = leaf_pos.into(); let leaf_pos: u64 = leaf_pos.into();
let leaf_pos = leaf_pos as u32;
let prover_witnesses = vec![ let prover_witnesses = vec![
Witness::Base(Some(secret.0)), Witness::Base(Some(secret.0)),
@@ -81,7 +80,7 @@ fn burn_proof() -> Result<()> {
Witness::Base(Some(coin_blind)), Witness::Base(Some(coin_blind)),
Witness::Scalar(Some(value_blind)), Witness::Scalar(Some(value_blind)),
Witness::Scalar(Some(token_blind)), Witness::Scalar(Some(token_blind)),
Witness::Uint32(Some(leaf_pos)), Witness::Uint32(Some(leaf_pos.try_into().unwrap())),
Witness::MerklePath(Some(merkle_path.try_into().unwrap())), Witness::MerklePath(Some(merkle_path.try_into().unwrap())),
Witness::Base(Some(sig_secret.0)), Witness::Base(Some(sig_secret.0)),
]; ];