From ffe864381299d754812d6de2d1af32299361e864 Mon Sep 17 00:00:00 2001 From: parazyd Date: Tue, 29 Aug 2023 13:06:01 +0200 Subject: [PATCH] bin: Feature cleanup --- .github/workflows/ci.yml | 10 ++++----- Cargo.lock | 31 ---------------------------- Cargo.toml | 6 +++--- bin/darkfid/Cargo.toml | 4 ++-- bin/darkfid/src/rpc_blockchain.rs | 2 +- bin/darkfid/src/rpc_tx.rs | 2 +- bin/darkfid2/Cargo.toml | 2 +- bin/darkfid2/src/rpc_blockchain.rs | 2 +- bin/darkfid2/src/rpc_tx.rs | 6 +++--- bin/darkirc/Cargo.toml | 3 +-- bin/dhtd/dhtd/Cargo.toml | 1 - bin/faucetd/Cargo.toml | 2 +- bin/faucetd/src/main.rs | 5 +++-- bin/fud/fu/Cargo.toml | 1 - bin/fud/fud/Cargo.toml | 1 - bin/genev/genev-cli/Cargo.toml | 1 - bin/genev/genevd/Cargo.toml | 3 +-- bin/lilith/Cargo.toml | 3 +-- bin/tau/tau-cli/Cargo.toml | 1 - bin/tau/taud/Cargo.toml | 5 ++--- src/contract/test-harness/Cargo.toml | 4 ++-- src/contract/test-harness/src/vks.rs | 2 +- src/util/cli.rs | 2 +- 23 files changed, 29 insertions(+), 70 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ad879edcd..7514ff2b4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -26,13 +26,12 @@ jobs: - name: Install dependencies (Linux) run: | - sudo apt update - sudo apt -y install build-essential clang libclang-dev llvm-dev libudev-dev pkg-config libasound2-dev + sh contrib/dependency_setup.sh if: matrix.os == 'ubuntu-latest' - name: Install dependencies (macOS) run: | - brew install llvm + sh contrib/dependency_setup.sh if: matrix.os == 'macos-latest' - name: Run test units @@ -66,13 +65,12 @@ jobs: - name: Install dependencies (Linux) run: | - sudo apt update - sudo apt -y install build-essential clang libclang-dev llvm-dev libasound2-dev + sh contrib/dependency_setup.sh if: matrix.os == 'ubuntu-latest' - name: Install dependencies (macOS) run: | - brew install llvm + sh contrib/dependency_setup.sh if: matrix.os == 'macos-latest' - name: Run feature powerset builds diff --git a/Cargo.lock b/Cargo.lock index 6410210ee..87f2be135 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1672,7 +1672,6 @@ dependencies = [ "darkfi-serial", "easy-parallel", "futures", - "libsqlite3-sys", "log", "rand 0.8.5", "rustls-pemfile", @@ -2603,7 +2602,6 @@ dependencies = [ "darkfi", "darkfi-serial", "easy-parallel", - "libsqlite3-sys", "log", "serde", "signal-hook", @@ -2754,7 +2752,6 @@ dependencies = [ "darkfi", "darkfi-serial", "genevd", - "libsqlite3-sys", "log", "simplelog", "smol", @@ -2770,7 +2767,6 @@ dependencies = [ "darkfi", "darkfi-serial", "easy-parallel", - "libsqlite3-sys", "log", "serde", "signal-hook", @@ -3259,8 +3255,6 @@ version = "0.26.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "afc22eff61b133b115c6e8c74e818c628d6d5e7a502afea6f64dee076dd94326" dependencies = [ - "cc", - "openssl-sys", "pkg-config", "vcpkg", ] @@ -3273,7 +3267,6 @@ dependencies = [ "darkfi", "easy-parallel", "futures", - "libsqlite3-sys", "log", "semver 1.0.18", "serde", @@ -3614,28 +3607,6 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" -[[package]] -name = "openssl-src" -version = "111.27.0+1.1.1v" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "06e8f197c82d7511c5b014030c9b1efeda40d7d5f99d23b4ceed3524a5e63f02" -dependencies = [ - "cc", -] - -[[package]] -name = "openssl-sys" -version = "0.9.91" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "866b5f16f90776b9bb8dc1e1802ac6f0513de3a7a7465867bfbc563dc737faac" -dependencies = [ - "cc", - "libc", - "openssl-src", - "pkg-config", - "vcpkg", -] - [[package]] name = "option-ext" version = "0.2.0" @@ -5401,7 +5372,6 @@ dependencies = [ "colored", "darkfi", "libc", - "libsqlite3-sys", "log", "prettytable-rs", "serde", @@ -5428,7 +5398,6 @@ dependencies = [ "futures", "hex", "libc", - "libsqlite3-sys", "log", "rand 0.8.5", "serde", diff --git a/Cargo.toml b/Cargo.toml index 87bc42d09..9a7cd8578 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -128,9 +128,9 @@ prettytable-rs = "0.10.0" # -----BEGIN LIBRARY FEATURES----- [features] -async-serial = [ - "darkfi-serial/async", -] +default = [] +async-daemonize = [] +async-serial = ["darkfi-serial/async"] async-sdk = [ "darkfi-sdk/async", diff --git a/bin/darkfid/Cargo.toml b/bin/darkfid/Cargo.toml index 0ba03837a..e2ddfd2c7 100644 --- a/bin/darkfid/Cargo.toml +++ b/bin/darkfid/Cargo.toml @@ -12,8 +12,8 @@ edition = "2021" async-trait = "0.1.73" blake3 = "1.4.1" bs58 = "0.5.0" -darkfi = {path = "../../", features = ["blockchain", "wallet", "rpc", "net", "zkas"]} -darkfi-sdk = {path = "../../src/sdk"} +darkfi = {path = "../../", features = ["async-daemonize", "validator"]} +darkfi-sdk = {path = "../../src/sdk", features = ["async"]} darkfi-serial = {path = "../../src/serial"} log = "0.4.20" sled = "0.34.7" diff --git a/bin/darkfid/src/rpc_blockchain.rs b/bin/darkfid/src/rpc_blockchain.rs index 575abfa89..04f2ebd1f 100644 --- a/bin/darkfid/src/rpc_blockchain.rs +++ b/bin/darkfid/src/rpc_blockchain.rs @@ -24,11 +24,11 @@ use log::{debug, error}; use tinyjson::JsonValue; use darkfi::{ + blockchain::contract_store::SMART_CONTRACT_ZKAS_DB_NAME, rpc::jsonrpc::{ ErrorCode::{InternalError, InvalidParams, ParseError}, JsonError, JsonResponse, JsonResult, }, - runtime::vm_runtime::SMART_CONTRACT_ZKAS_DB_NAME, util::encoding::base64, }; diff --git a/bin/darkfid/src/rpc_tx.rs b/bin/darkfid/src/rpc_tx.rs index 38ed6bf54..5f1e9b575 100644 --- a/bin/darkfid/src/rpc_tx.rs +++ b/bin/darkfid/src/rpc_tx.rs @@ -158,7 +158,7 @@ impl Darkfid { return server_error(RpcError::TxBroadcastFail, id, None) } - let tx_hash = tx.hash().to_string(); + let tx_hash = tx.hash().unwrap().to_string(); JsonResponse::new(JsonValue::String(tx_hash), id).into() } } diff --git a/bin/darkfid2/Cargo.toml b/bin/darkfid2/Cargo.toml index aaba86890..2d700e3d0 100644 --- a/bin/darkfid2/Cargo.toml +++ b/bin/darkfid2/Cargo.toml @@ -10,7 +10,7 @@ edition = "2021" [dependencies] # Darkfi -darkfi = {path = "../../", features = ["async-runtime", "util"]} +darkfi = {path = "../../", features = ["async-daemonize"]} darkfi-consensus-contract = {path = "../../src/contract/consensus"} darkfi-money-contract = {path = "../../src/contract/money"} darkfi-contract-test-harness = {path = "../../src/contract/test-harness"} diff --git a/bin/darkfid2/src/rpc_blockchain.rs b/bin/darkfid2/src/rpc_blockchain.rs index 1a274f08b..73db18421 100644 --- a/bin/darkfid2/src/rpc_blockchain.rs +++ b/bin/darkfid2/src/rpc_blockchain.rs @@ -24,11 +24,11 @@ use log::{debug, error}; use tinyjson::JsonValue; use darkfi::{ + blockchain::contract_store::SMART_CONTRACT_ZKAS_DB_NAME, rpc::jsonrpc::{ ErrorCode::{InternalError, InvalidParams, ParseError}, JsonError, JsonResponse, JsonResult, }, - runtime::vm_runtime::SMART_CONTRACT_ZKAS_DB_NAME, util::encoding::base64, }; diff --git a/bin/darkfid2/src/rpc_tx.rs b/bin/darkfid2/src/rpc_tx.rs index b4fc359eb..f7e9c4dc5 100644 --- a/bin/darkfid2/src/rpc_tx.rs +++ b/bin/darkfid2/src/rpc_tx.rs @@ -149,7 +149,7 @@ impl Darkfid { return server_error(RpcError::TxBroadcastFail, id, None) } - let tx_hash = tx.hash().to_string(); + let tx_hash = tx.hash().unwrap().to_string(); JsonResponse::new(JsonValue::String(tx_hash), id).into() } @@ -179,7 +179,7 @@ impl Darkfid { }; let pending_txs: Vec = - pending_txs.iter().map(|x| JsonValue::String(x.hash().to_string())).collect(); + pending_txs.iter().map(|x| JsonValue::String(x.hash().unwrap().to_string())).collect(); JsonResponse::new(JsonValue::Array(pending_txs), id).into() } @@ -215,7 +215,7 @@ impl Darkfid { }; let pending_txs: Vec = - pending_txs.iter().map(|x| JsonValue::String(x.hash().to_string())).collect(); + pending_txs.iter().map(|x| JsonValue::String(x.hash().unwrap().to_string())).collect(); JsonResponse::new(JsonValue::Array(pending_txs), id).into() } diff --git a/bin/darkirc/Cargo.toml b/bin/darkirc/Cargo.toml index d22466f4b..462100f1a 100644 --- a/bin/darkirc/Cargo.toml +++ b/bin/darkirc/Cargo.toml @@ -9,7 +9,7 @@ homepage = "https://dark.fi" repository = "https://github.com/darkrenaissance/darkfi" [dependencies] -darkfi = {path = "../../", features = ["event-graph", "rpc", "bs58"]} +darkfi = {path = "../../", features = ["bs58", "toml", "async-daemonize", "event-graph", "rpc"]} darkfi-serial = {path = "../../src/serial"} # TLS @@ -25,7 +25,6 @@ rand = "0.8.5" # Misc clap = {version = "4.3.24", features = ["derive"]} chrono = "0.4.26" -libsqlite3-sys = {version = "0.26.0", features = ["bundled-sqlcipher-vendored-openssl"]} log = "0.4.20" url = "2.4.0" diff --git a/bin/dhtd/dhtd/Cargo.toml b/bin/dhtd/dhtd/Cargo.toml index d999e3c4b..2bb2285e0 100644 --- a/bin/dhtd/dhtd/Cargo.toml +++ b/bin/dhtd/dhtd/Cargo.toml @@ -14,7 +14,6 @@ blake3 = "1.4.1" darkfi = {path = "../../../", features = ["dht"]} darkfi-serial = {path = "../../../src/serial", features = ["derive", "crypto"]} easy-parallel = "3.3.0" -libsqlite3-sys = {version = "0.26.0", features = ["bundled-sqlcipher-vendored-openssl"]} log = "0.4.20" rand = "0.8.5" simplelog = "0.12.1" diff --git a/bin/faucetd/Cargo.toml b/bin/faucetd/Cargo.toml index af12b24c9..1e69f5a51 100644 --- a/bin/faucetd/Cargo.toml +++ b/bin/faucetd/Cargo.toml @@ -12,7 +12,7 @@ edition = "2021" async-trait = "0.1.73" blake3 = "1.4.1" chrono = "0.4.26" -darkfi = {path = "../../", features = ["blockchain", "wallet", "rpc", "net", "zkas"]} +darkfi = {path = "../../", features = ["async-daemonize", "validator"]} darkfi-serial = {path = "../../src/serial"} darkfi-sdk = {path = "../../src/sdk"} darkfi-money-contract = {path = "../../src/contract/money", features = ["no-entrypoint", "client"]} diff --git a/bin/faucetd/src/main.rs b/bin/faucetd/src/main.rs index 96680e8f4..33b4a18ff 100644 --- a/bin/faucetd/src/main.rs +++ b/bin/faucetd/src/main.rs @@ -50,7 +50,9 @@ use tinyjson::JsonValue; use url::Url; use darkfi::{ - async_daemonize, cli_desc, + async_daemonize, + blockchain::contract_store::SMART_CONTRACT_ZKAS_DB_NAME, + cli_desc, consensus::{ constants::{ MAINNET_BOOTSTRAP_TIMESTAMP, MAINNET_GENESIS_HASH_BYTES, MAINNET_GENESIS_TIMESTAMP, @@ -70,7 +72,6 @@ use darkfi::{ }, server::{listen_and_serve, RequestHandler}, }, - runtime::vm_runtime::SMART_CONTRACT_ZKAS_DB_NAME, system::{sleep, StoppableTask}, tx::Transaction, util::{parse::decode_base10, path::expand_path}, diff --git a/bin/fud/fu/Cargo.toml b/bin/fud/fu/Cargo.toml index 87da6a335..d0f64b6eb 100644 --- a/bin/fud/fu/Cargo.toml +++ b/bin/fud/fu/Cargo.toml @@ -16,7 +16,6 @@ async-std = {version = "1.12.0", features = ["attributes"]} # Misc clap = {version = "4.3.24", features = ["derive"]} -libsqlite3-sys = {version = "0.26.0", features = ["bundled-sqlcipher-vendored-openssl"]} log = "0.4.20" serde_json = "1.0.105" simplelog = "0.12.1" diff --git a/bin/fud/fud/Cargo.toml b/bin/fud/fud/Cargo.toml index ad6af01ec..b074671e5 100644 --- a/bin/fud/fud/Cargo.toml +++ b/bin/fud/fud/Cargo.toml @@ -15,7 +15,6 @@ darkfi-serial = {path = "../../../src/serial", features = ["hash"]} # Misc async-trait = "0.1.73" blake3 = "1.4.1" -libsqlite3-sys = {version = "0.26.0", features = ["bundled-sqlcipher-vendored-openssl"]} log = "0.4.20" tinyjson = "2.5.1" url = "2.4.0" diff --git a/bin/genev/genev-cli/Cargo.toml b/bin/genev/genev-cli/Cargo.toml index 849792683..f93f33e34 100644 --- a/bin/genev/genev-cli/Cargo.toml +++ b/bin/genev/genev-cli/Cargo.toml @@ -16,7 +16,6 @@ darkfi-serial = {path = "../../../src/serial"} smol = "1.3.0" clap = {version = "4.3.24", features = ["derive"]} -libsqlite3-sys = {version = "0.26.0", features = ["bundled-sqlcipher-vendored-openssl"]} log = "0.4.20" simplelog = "0.12.1" tinyjson = "2.5.1" diff --git a/bin/genev/genevd/Cargo.toml b/bin/genev/genevd/Cargo.toml index 529c3b066..84939a4f3 100644 --- a/bin/genev/genevd/Cargo.toml +++ b/bin/genev/genevd/Cargo.toml @@ -17,12 +17,11 @@ name = "genevd" path = "src/main.rs" [dependencies] -darkfi = {path = "../../../", features = ["event-graph", "rpc", "bs58", "util"]} +darkfi = {path = "../../../", features = ["async-daemonize", "event-graph", "rpc"]} darkfi-serial = {path = "../../../src/serial"} # Misc async-trait = "0.1.73" -libsqlite3-sys = {version = "0.26.0", features = ["bundled-sqlcipher-vendored-openssl"]} log = "0.4.20" tinyjson = "2.5.1" url = "2.4.0" diff --git a/bin/lilith/Cargo.toml b/bin/lilith/Cargo.toml index c2f556e6c..acafa2940 100644 --- a/bin/lilith/Cargo.toml +++ b/bin/lilith/Cargo.toml @@ -9,12 +9,11 @@ homepage = "https://dark.fi" repository = "https://github.com/darkrenaissance/darkfi" [dependencies] -darkfi = {path = "../../", features = ["net", "rpc"]} +darkfi = {path = "../../", features = ["toml", "async-daemonize", "net", "rpc"]} # Misc async-trait = "0.1.73" futures = "0.3.28" -libsqlite3-sys = {version = "0.26.0", features = ["bundled-sqlcipher-vendored-openssl"]} log = "0.4.20" semver = "1.0.18" tinyjson = "2.5.1" diff --git a/bin/tau/tau-cli/Cargo.toml b/bin/tau/tau-cli/Cargo.toml index b1c6e3368..ff28a1abe 100644 --- a/bin/tau/tau-cli/Cargo.toml +++ b/bin/tau/tau-cli/Cargo.toml @@ -16,7 +16,6 @@ taud = {path = "../taud"} # Misc chrono = "0.4.26" colored = "2.0.4" -libsqlite3-sys = {version = "0.26.0", features = ["bundled-sqlcipher-vendored-openssl"]} log = "0.4.20" prettytable-rs = "0.10.0" simplelog = "0.12.1" diff --git a/bin/tau/taud/Cargo.toml b/bin/tau/taud/Cargo.toml index 5cb378305..5eca6c87b 100644 --- a/bin/tau/taud/Cargo.toml +++ b/bin/tau/taud/Cargo.toml @@ -17,8 +17,8 @@ name = "taud" path = "src/main.rs" [dependencies] -darkfi = { path = "../../../", features = ["event-graph", "rpc", "bs58", "async-serial"]} -darkfi-serial = { path = "../../../src/serial" } +darkfi = {path = "../../../", features = ["bs58", "async-daemonize", "event-graph", "rpc"]} +darkfi-serial = {path = "../../../src/serial"} # Misc async-trait = "0.1.73" @@ -28,7 +28,6 @@ crypto_box = {version = "0.9.1", features = ["std", "chacha20"]} futures = "0.3.28" hex = "0.4.3" libc = "0.2.147" -libsqlite3-sys = {version = "0.26.0", features = ["bundled-sqlcipher-vendored-openssl"]} log = "0.4.20" rand = "0.8.5" thiserror = "1.0.47" diff --git a/src/contract/test-harness/Cargo.toml b/src/contract/test-harness/Cargo.toml index 98e61afcd..842b1dc98 100644 --- a/src/contract/test-harness/Cargo.toml +++ b/src/contract/test-harness/Cargo.toml @@ -6,9 +6,9 @@ license = "AGPL-3.0-only" edition = "2021" [dependencies] -darkfi = {path = "../../../", features = ["zk", "tx", "blockchain"]} +darkfi = {path = "../../../", features = ["validator"]} darkfi-sdk = {path = "../../../src/sdk"} -darkfi-serial = {path = "../../../src/serial", features = ["derive", "crypto"]} +darkfi-serial = {path = "../../../src/serial", features = ["crypto"]} darkfi-dao-contract = {path = "../dao", features = ["client", "no-entrypoint"]} darkfi-money-contract = {path = "../money", features = ["client", "no-entrypoint"]} darkfi-consensus-contract = {path = "../consensus", features = ["client", "no-entrypoint"]} diff --git a/src/contract/test-harness/src/vks.rs b/src/contract/test-harness/src/vks.rs index b7730e6dc..454adcf84 100644 --- a/src/contract/test-harness/src/vks.rs +++ b/src/contract/test-harness/src/vks.rs @@ -24,7 +24,7 @@ use std::{ }; use darkfi::{ - runtime::vm_runtime::SMART_CONTRACT_ZKAS_DB_NAME, + blockchain::contract_store::SMART_CONTRACT_ZKAS_DB_NAME, zk::{empty_witnesses, ProvingKey, VerifyingKey, ZkCircuit}, zkas::ZkBinary, Result, diff --git a/src/util/cli.rs b/src/util/cli.rs index 2102045d8..9c25bd93b 100644 --- a/src/util/cli.rs +++ b/src/util/cli.rs @@ -163,7 +163,7 @@ pub fn get_log_config(verbosity_level: u8) -> simplelog::Config { /// Ok(()) /// } /// ``` -#[cfg(feature = "async-runtime")] +#[cfg(feature = "async-daemonize")] #[macro_export] macro_rules! async_daemonize { ($realmain:ident) => {