From 418aa021912fc8c2bb0467b9ad6d97b501091111 Mon Sep 17 00:00:00 2001 From: Thomas Eizinger Date: Mon, 22 Feb 2021 12:24:40 +1100 Subject: [PATCH 1/9] Remove unnecessary ed25519-dalek dependency --- Cargo.lock | 12 ------------ swap/Cargo.toml | 1 - 2 files changed, 13 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 350e77f1..47484317 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -870,7 +870,6 @@ version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "37c66a534cbb46ab4ea03477eae19d5c22c01da8258030280b7bd9d8433fb6ef" dependencies = [ - "serde", "signature", ] @@ -884,7 +883,6 @@ dependencies = [ "ed25519", "rand 0.7.3", "serde", - "serde_bytes", "sha2 0.9.2", "zeroize 1.2.0", ] @@ -3119,15 +3117,6 @@ dependencies = [ "serde_derive", ] -[[package]] -name = "serde_bytes" -version = "0.11.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "16ae07dd2f88a366f15bd0632ba725227018c69a1c8550a927324f8eb8368bb9" -dependencies = [ - "serde", -] - [[package]] name = "serde_cbor" version = "0.11.1" @@ -3491,7 +3480,6 @@ dependencies = [ "dialoguer", "directories-next", "ecdsa_fun", - "ed25519-dalek", "futures", "get-port", "hyper", diff --git a/swap/Cargo.toml b/swap/Cargo.toml index af389fdb..8d692754 100644 --- a/swap/Cargo.toml +++ b/swap/Cargo.toml @@ -28,7 +28,6 @@ derivative = "2" dialoguer = "0.7" directories-next = "2" ecdsa_fun = { git = "https://github.com/LLFourn/secp256kfun", features = ["libsecp_compat", "serde"] } -ed25519-dalek = { version = "1.0.0-pre.4", features = ["serde"] }# Cannot be 1 because they depend on curve25519-dalek version 3 futures = { version = "0.3", default-features = false } libp2p = { version = "0.34", default-features = false, features = ["tcp-tokio", "yamux", "mplex", "dns", "noise", "request-response"] } libp2p-async-await = { git = "https://github.com/comit-network/rust-libp2p-async-await", rev = "1429cd780204624b4d244e7d8179fe6ff77988c3" } From 729f4f09a8b70bd8109c8e2d05473da169fe991a Mon Sep 17 00:00:00 2001 From: Thomas Eizinger Date: Mon, 22 Feb 2021 12:25:41 +1100 Subject: [PATCH 2/9] Remove unnecessary tracing_core dependency --- Cargo.lock | 1 - swap/Cargo.toml | 1 - swap/tests/testutils/mod.rs | 2 +- 3 files changed, 1 insertion(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 47484317..17faa5ae 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3514,7 +3514,6 @@ dependencies = [ "tokio-tungstenite", "toml", "tracing", - "tracing-core", "tracing-futures", "tracing-log", "tracing-subscriber", diff --git a/swap/Cargo.toml b/swap/Cargo.toml index 8d692754..95df1229 100644 --- a/swap/Cargo.toml +++ b/swap/Cargo.toml @@ -57,7 +57,6 @@ tokio = { version = "1.0", features = ["rt-multi-thread", "time", "macros", "syn tokio-tungstenite = { version = "0.13", features = [ "tls" ] } toml = "0.5" tracing = { version = "0.1", features = ["attributes"] } -tracing-core = "0.1" tracing-futures = { version = "0.2", features = ["std-future", "futures-03"] } tracing-log = "0.1" tracing-subscriber = { version = "0.2", default-features = false, features = ["fmt", "ansi", "env-filter"] } diff --git a/swap/tests/testutils/mod.rs b/swap/tests/testutils/mod.rs index 02464e39..392d1ba8 100644 --- a/swap/tests/testutils/mod.rs +++ b/swap/tests/testutils/mod.rs @@ -27,7 +27,7 @@ use swap::{ use tempfile::tempdir; use testcontainers::{clients::Cli, Container, Docker, RunArgs}; use tokio::{sync::mpsc, task::JoinHandle, time::interval}; -use tracing_core::dispatcher::DefaultGuard; +use tracing::dispatcher::DefaultGuard; use tracing_log::LogTracer; use url::Url; use uuid::Uuid; From d54fac6fd9187134d02a997b50e40c0956f83743 Mon Sep 17 00:00:00 2001 From: Thomas Eizinger Date: Mon, 22 Feb 2021 12:26:15 +1100 Subject: [PATCH 3/9] Remove unnecessary tempfile prod dependency --- swap/Cargo.toml | 1 - 1 file changed, 1 deletion(-) diff --git a/swap/Cargo.toml b/swap/Cargo.toml index 95df1229..965aa55c 100644 --- a/swap/Cargo.toml +++ b/swap/Cargo.toml @@ -50,7 +50,6 @@ sigma_fun = { git = "https://github.com/LLFourn/secp256kfun", features = ["ed255 sled = "0.34" structopt = "0.3" strum = { version = "0.20", features = ["derive"] } -tempfile = "3" thiserror = "1" time = "0.2" tokio = { version = "1.0", features = ["rt-multi-thread", "time", "macros", "sync"] } From f0ba80794ce9dd091d7bdecf0c640c17be88a5a2 Mon Sep 17 00:00:00 2001 From: Thomas Eizinger Date: Mon, 22 Feb 2021 12:28:57 +1100 Subject: [PATCH 4/9] Remove unnecessary serde_derive dependency declaration We already express the same thing through the serde `derive` feature. --- Cargo.lock | 1 - swap/Cargo.toml | 1 - 2 files changed, 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 17faa5ae..13ad1b55 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3498,7 +3498,6 @@ dependencies = [ "rust_decimal", "serde", "serde_cbor", - "serde_derive", "serde_json", "sha2 0.9.2", "sigma_fun", diff --git a/swap/Cargo.toml b/swap/Cargo.toml index 965aa55c..024f488e 100644 --- a/swap/Cargo.toml +++ b/swap/Cargo.toml @@ -43,7 +43,6 @@ reqwest = { version = "0.11", default-features = false } rust_decimal = "1.10" serde = { version = "1", features = ["derive"] } serde_cbor = "0.11" -serde_derive = "1.0" serde_json = "1" sha2 = "0.9" sigma_fun = { git = "https://github.com/LLFourn/secp256kfun", features = ["ed25519", "serde"] } From 2a3db9bd80c3075b0790c8abf6777eea3f25448e Mon Sep 17 00:00:00 2001 From: Thomas Eizinger Date: Mon, 22 Feb 2021 12:29:54 +1100 Subject: [PATCH 5/9] Remove unnecessary derivative dependency --- Cargo.lock | 1 - swap/Cargo.toml | 1 - 2 files changed, 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 13ad1b55..e62fb2b1 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3476,7 +3476,6 @@ dependencies = [ "config", "conquer-once", "curve25519-dalek", - "derivative", "dialoguer", "directories-next", "ecdsa_fun", diff --git a/swap/Cargo.toml b/swap/Cargo.toml index 024f488e..6309c3b0 100644 --- a/swap/Cargo.toml +++ b/swap/Cargo.toml @@ -24,7 +24,6 @@ bitcoin-harness = { git = "https://github.com/coblox/bitcoin-harness-rs" } config = { version = "0.10", default-features = false, features = ["toml"] } conquer-once = "0.3" curve25519-dalek = "3" -derivative = "2" dialoguer = "0.7" directories-next = "2" ecdsa_fun = { git = "https://github.com/LLFourn/secp256kfun", features = ["libsecp_compat", "serde"] } From 03078f328c49bc801fe6ffba263a1edbd2bdfbce Mon Sep 17 00:00:00 2001 From: Thomas Eizinger Date: Mon, 22 Feb 2021 12:32:15 +1100 Subject: [PATCH 6/9] Split monero-harness into harness and rpc This allows us to move `monero-harness` and `bitcoin-harness` into `[dev-dependencies]` of `swap`. --- Cargo.lock | 46 ++++++------------- Cargo.toml | 2 +- monero-harness/Cargo.toml | 6 +-- monero-harness/src/lib.rs | 15 +++--- monero-rpc/Cargo.toml | 12 +++++ monero-rpc/README.md | 12 +++++ monero-rpc/rust-toolchain | 1 + monero-rpc/rustfmt.toml | 9 ++++ monero-rpc/src/lib.rs | 17 +++++++ {monero-harness => monero-rpc}/src/rpc.rs | 4 +- .../src/rpc/monerod.rs | 1 - .../src/rpc/wallet.rs | 0 swap/Cargo.toml | 5 +- swap/src/database/bob.rs | 2 +- swap/src/monero/wallet.rs | 2 +- swap/src/protocol/bob/state.rs | 2 +- 16 files changed, 82 insertions(+), 54 deletions(-) create mode 100644 monero-rpc/Cargo.toml create mode 100644 monero-rpc/README.md create mode 100644 monero-rpc/rust-toolchain create mode 100644 monero-rpc/rustfmt.toml create mode 100644 monero-rpc/src/lib.rs rename {monero-harness => monero-rpc}/src/rpc.rs (95%) rename {monero-harness => monero-rpc}/src/rpc/monerod.rs (99%) rename {monero-harness => monero-rpc}/src/rpc/wallet.rs (100%) diff --git a/Cargo.lock b/Cargo.lock index e62fb2b1..5e558e44 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -439,9 +439,9 @@ checksum = "771fe0050b883fcc3ea2359b1a96bcfbc090b7116eae7c3c512c7a083fdf23d3" [[package]] name = "bstr" -version = "0.2.14" +version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "473fc6b38233f9af7baa94fb5852dca389e3d95b8e21c8e3719301462c5d9faf" +checksum = "a40b47ad93e1a5404e6c18dec46b628214fee441c70f4ab5d6942142cc268a3d" dependencies = [ "lazy_static", "memchr", @@ -801,19 +801,6 @@ dependencies = [ "generic-array 0.14.4", ] -[[package]] -name = "digest_auth" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d4bce617b8491dd210e3fcbc939e2c5bbeb27355f8adf7da335b87d6cc8d5482" -dependencies = [ - "digest 0.8.1", - "hex 0.4.2", - "md-5", - "rand 0.7.3", - "sha2 0.8.2", -] - [[package]] name = "directories-next" version = "2.0.0" @@ -1876,17 +1863,6 @@ version = "0.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7ffc5c5338469d4d3ea17d269fa8ea3512ad247247c30bd2df69e68309ed0a08" -[[package]] -name = "md-5" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a18af3dcaf2b0219366cdb4e2af65a6101457b415c3d1a5c71dd9c2b7c77b9c8" -dependencies = [ - "block-buffer 0.7.3", - "digest 0.8.1", - "opaque-debug 0.2.3", -] - [[package]] name = "memchr" version = "2.3.4" @@ -1983,20 +1959,27 @@ name = "monero-harness" version = "0.1.0" dependencies = [ "anyhow", - "digest_auth", "futures", + "monero-rpc", "port_check", "rand 0.7.3", - "reqwest", - "serde", - "serde_json", "spectral", "testcontainers 0.12.0", "tokio", "tracing", "tracing-log", "tracing-subscriber", - "url", +] + +[[package]] +name = "monero-rpc" +version = "0.1.0" +dependencies = [ + "anyhow", + "reqwest", + "serde", + "serde_json", + "tracing", ] [[package]] @@ -3488,6 +3471,7 @@ dependencies = [ "miniscript", "monero", "monero-harness", + "monero-rpc", "pem", "port_check", "prettytable-rs", diff --git a/Cargo.toml b/Cargo.toml index 976a7b53..8ddab59e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,2 +1,2 @@ [workspace] -members = ["monero-harness", "swap"] +members = ["monero-harness", "monero-rpc", "swap"] diff --git a/monero-harness/Cargo.toml b/monero-harness/Cargo.toml index a9704b0a..f4ff5b12 100644 --- a/monero-harness/Cargo.toml +++ b/monero-harness/Cargo.toml @@ -6,17 +6,13 @@ edition = "2018" [dependencies] anyhow = "1" -digest_auth = "0.2.3" futures = "0.3" +monero-rpc = { path = "../monero-rpc" } port_check = "0.1" rand = "0.7" -reqwest = { version = "0.11", default-features = false, features = ["json", "native-tls"] } -serde = { version = "1.0", features = ["derive"] } -serde_json = "1.0" spectral = "0.6" testcontainers = "0.12" tokio = { version = "1.0", default-features = false, features = ["rt-multi-thread", "time", "macros"] } tracing = "0.1" tracing-log = "0.1" tracing-subscriber = { version = "0.2", default-features = false, features = ["fmt", "ansi", "env-filter"] } -url = "2" diff --git a/monero-harness/src/lib.rs b/monero-harness/src/lib.rs index 2601fae3..ab528564 100644 --- a/monero-harness/src/lib.rs +++ b/monero-harness/src/lib.rs @@ -21,18 +21,15 @@ //! //! Also provides standalone JSON RPC clients for monerod and monero-wallet-rpc. pub mod image; -pub mod rpc; -use crate::{ - image::{ - MONEROD_DAEMON_CONTAINER_NAME, MONEROD_DEFAULT_NETWORK, MONEROD_RPC_PORT, WALLET_RPC_PORT, - }, - rpc::{ - monerod, - wallet::{self, GetAddress, Refreshed, Transfer}, - }, +use crate::image::{ + MONEROD_DAEMON_CONTAINER_NAME, MONEROD_DEFAULT_NETWORK, MONEROD_RPC_PORT, WALLET_RPC_PORT, }; use anyhow::{anyhow, bail, Result}; +use monero_rpc::{ + monerod, + wallet::{self, GetAddress, Refreshed, Transfer}, +}; use std::time::Duration; use testcontainers::{clients::Cli, core::Port, Container, Docker, RunArgs}; use tokio::time; diff --git a/monero-rpc/Cargo.toml b/monero-rpc/Cargo.toml new file mode 100644 index 00000000..cf2c7a6f --- /dev/null +++ b/monero-rpc/Cargo.toml @@ -0,0 +1,12 @@ +[package] +name = "monero-rpc" +version = "0.1.0" +authors = ["CoBloX Team "] +edition = "2018" + +[dependencies] +anyhow = "1" +reqwest = { version = "0.11", default-features = false, features = ["json", "native-tls"] } +serde = { version = "1.0", features = ["derive"] } +serde_json = "1.0" +tracing = "0.1" diff --git a/monero-rpc/README.md b/monero-rpc/README.md new file mode 100644 index 00000000..ee15783a --- /dev/null +++ b/monero-rpc/README.md @@ -0,0 +1,12 @@ +Monero Harness +============== + +Provides an implementation of `testcontainers::Image` for a monero image to run +`monerod` and `monero-wallet-rpc` in a docker container. + +Also provides two standalone JSON RPC clients, one each for `monerod` and `monero-wallet-rpc`. + +Example Usage +------------- + +Please see `tests/*` for example usage. diff --git a/monero-rpc/rust-toolchain b/monero-rpc/rust-toolchain new file mode 100644 index 00000000..0a3db35b --- /dev/null +++ b/monero-rpc/rust-toolchain @@ -0,0 +1 @@ +1.46.0 diff --git a/monero-rpc/rustfmt.toml b/monero-rpc/rustfmt.toml new file mode 100644 index 00000000..d973e35c --- /dev/null +++ b/monero-rpc/rustfmt.toml @@ -0,0 +1,9 @@ +edition = "2018" +condense_wildcard_suffixes = true +format_macro_matchers = true +imports_granularity = "Crate" +use_field_init_shorthand = true +format_code_in_doc_comments = true +normalize_comments = true +wrap_comments = true +overflow_delimited_expr = true diff --git a/monero-rpc/src/lib.rs b/monero-rpc/src/lib.rs new file mode 100644 index 00000000..1a83b3e1 --- /dev/null +++ b/monero-rpc/src/lib.rs @@ -0,0 +1,17 @@ +#![warn( + unused_extern_crates, + missing_debug_implementations, + missing_copy_implementations, + rust_2018_idioms, + clippy::cast_possible_truncation, + clippy::cast_sign_loss, + clippy::fallible_impl_from, + clippy::cast_precision_loss, + clippy::cast_possible_wrap, + clippy::dbg_macro +)] +#![forbid(unsafe_code)] + +mod rpc; + +pub use self::rpc::*; diff --git a/monero-harness/src/rpc.rs b/monero-rpc/src/rpc.rs similarity index 95% rename from monero-harness/src/rpc.rs rename to monero-rpc/src/rpc.rs index eae827c1..e0e58ed7 100644 --- a/monero-harness/src/rpc.rs +++ b/monero-rpc/src/rpc.rs @@ -39,7 +39,6 @@ struct Response { #[cfg(test)] mod tests { use super::*; - use spectral::prelude::*; #[derive(Serialize, Debug, Clone)] struct Params { @@ -58,6 +57,7 @@ mod tests { let want = "{\"jsonrpc\":\"2.0\",\"id\":\"1\",\"method\":\"get_block\",\"params\":{\"val\":0}}" .to_string(); - assert_that!(got).is_equal_to(want); + + assert_eq!(got, want); } } diff --git a/monero-harness/src/rpc/monerod.rs b/monero-rpc/src/rpc/monerod.rs similarity index 99% rename from monero-harness/src/rpc/monerod.rs rename to monero-rpc/src/rpc/monerod.rs index e27f2556..a98300a7 100644 --- a/monero-harness/src/rpc/monerod.rs +++ b/monero-rpc/src/rpc/monerod.rs @@ -1,5 +1,4 @@ use crate::rpc::{Request, Response}; - use anyhow::Result; use reqwest::Url; use serde::{Deserialize, Serialize}; diff --git a/monero-harness/src/rpc/wallet.rs b/monero-rpc/src/rpc/wallet.rs similarity index 100% rename from monero-harness/src/rpc/wallet.rs rename to monero-rpc/src/rpc/wallet.rs diff --git a/swap/Cargo.toml b/swap/Cargo.toml index 6309c3b0..f849e027 100644 --- a/swap/Cargo.toml +++ b/swap/Cargo.toml @@ -20,7 +20,6 @@ backoff = { version = "0.3", features = ["tokio"] } base64 = "0.12" bdk = { version = "0.4" } bitcoin = { version = "0.26", features = ["rand", "use-serde"] } -bitcoin-harness = { git = "https://github.com/coblox/bitcoin-harness-rs" } config = { version = "0.10", default-features = false, features = ["toml"] } conquer-once = "0.3" curve25519-dalek = "3" @@ -33,7 +32,7 @@ libp2p-async-await = { git = "https://github.com/comit-network/rust-libp2p-async log = { version = "0.4", features = ["serde"] } miniscript = { version = "5", features = ["serde"] } monero = { version = "0.10", features = ["serde_support"] } -monero-harness = { path = "../monero-harness" } +monero-rpc = { path = "../monero-rpc" } pem = "0.8" prettytable-rs = "0.8" rand = "0.7" @@ -62,8 +61,10 @@ uuid = { version = "0.8", features = ["serde", "v4"] } void = "1" [dev-dependencies] +bitcoin-harness = { git = "https://github.com/coblox/bitcoin-harness-rs" } get-port = "3" hyper = "0.14" +monero-harness = { path = "../monero-harness" } port_check = "0.1" serde_cbor = "0.11" spectral = "0.6" diff --git a/swap/src/database/bob.rs b/swap/src/database/bob.rs index 260f6d84..4ee796e4 100644 --- a/swap/src/database/bob.rs +++ b/swap/src/database/bob.rs @@ -3,7 +3,7 @@ use crate::{ protocol::{bob, bob::BobState}, }; use ::bitcoin::hashes::core::fmt::Display; -use monero_harness::rpc::wallet::BlockHeight; +use monero_rpc::wallet::BlockHeight; use serde::{Deserialize, Serialize}; #[derive(Clone, Debug, Deserialize, Serialize, PartialEq)] diff --git a/swap/src/monero/wallet.rs b/swap/src/monero/wallet.rs index 06cc02e6..ce1d1a97 100644 --- a/swap/src/monero/wallet.rs +++ b/swap/src/monero/wallet.rs @@ -7,7 +7,7 @@ use anyhow::Result; use async_trait::async_trait; use backoff::{backoff::Constant as ConstantBackoff, future::retry}; use bitcoin::hashes::core::sync::atomic::AtomicU32; -use monero_harness::rpc::wallet; +use monero_rpc::wallet; use std::{ str::FromStr, sync::{atomic::Ordering, Arc}, diff --git a/swap/src/protocol/bob/state.rs b/swap/src/protocol/bob/state.rs index ee30275f..0d6349e7 100644 --- a/swap/src/protocol/bob/state.rs +++ b/swap/src/protocol/bob/state.rs @@ -21,7 +21,7 @@ use ecdsa_fun::{ nonce::Deterministic, Signature, }; -use monero_harness::rpc::wallet::BlockHeight; +use monero_rpc::wallet::BlockHeight; use rand::{CryptoRng, RngCore}; use serde::{Deserialize, Serialize}; use sha2::Sha256; From 498fae9f64a44292382e74e3cb54f80cba8170b9 Mon Sep 17 00:00:00 2001 From: Thomas Eizinger Date: Mon, 22 Feb 2021 12:35:48 +1100 Subject: [PATCH 7/9] Remove `native-tls` feature from `monero-rpc` 1. `monero-rpc` is not in the position to decide about the TLS backend an application should use. 2. We don't use TLS encrypted communication to my knowledge so we don't have to activate this feature anywhere else. --- monero-rpc/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/monero-rpc/Cargo.toml b/monero-rpc/Cargo.toml index cf2c7a6f..c70f2797 100644 --- a/monero-rpc/Cargo.toml +++ b/monero-rpc/Cargo.toml @@ -6,7 +6,7 @@ edition = "2018" [dependencies] anyhow = "1" -reqwest = { version = "0.11", default-features = false, features = ["json", "native-tls"] } +reqwest = { version = "0.11", default-features = false, features = ["json"] } serde = { version = "1.0", features = ["derive"] } serde_json = "1.0" tracing = "0.1" From 66db8e185171fce7e2947b26360695b9381335af Mon Sep 17 00:00:00 2001 From: Thomas Eizinger Date: Mon, 22 Feb 2021 12:41:04 +1100 Subject: [PATCH 8/9] Remove unnecessary log dependency By updating `tracing_log`, we can access the re-export. That we need to initialize the `tracing_log` adaptor. The usage of `log::LevelFilter` for the `init_tracing` function was conceptually incorrect. We should be using a type from the `tracing` library here. --- Cargo.lock | 6 ++---- swap/Cargo.toml | 1 - swap/src/bin/asb.rs | 4 ++-- swap/src/bin/swap_cli.rs | 4 ++-- swap/src/trace.rs | 7 +++---- 5 files changed, 9 insertions(+), 13 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 5e558e44..5abbf4c3 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1836,7 +1836,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fcf3805d4480bb5b86070dcfeb9e2cb2ebc148adb753c5cca5f884d1d65a42b2" dependencies = [ "cfg-if 0.1.10", - "serde", ] [[package]] @@ -3467,7 +3466,6 @@ dependencies = [ "hyper", "libp2p", "libp2p-async-await", - "log", "miniscript", "monero", "monero-harness", @@ -3832,9 +3830,9 @@ dependencies = [ [[package]] name = "tracing-log" -version = "0.1.1" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e0f8c7178e13481ff6765bd169b33e8d554c5d2bbede5e32c356194be02b9b9" +checksum = "a6923477a48e41c1951f1999ef8bb5a3023eb723ceadafe78ffb65dc366761e3" dependencies = [ "lazy_static", "log", diff --git a/swap/Cargo.toml b/swap/Cargo.toml index f849e027..d9d15118 100644 --- a/swap/Cargo.toml +++ b/swap/Cargo.toml @@ -29,7 +29,6 @@ ecdsa_fun = { git = "https://github.com/LLFourn/secp256kfun", features = ["libse futures = { version = "0.3", default-features = false } libp2p = { version = "0.34", default-features = false, features = ["tcp-tokio", "yamux", "mplex", "dns", "noise", "request-response"] } libp2p-async-await = { git = "https://github.com/comit-network/rust-libp2p-async-await", rev = "1429cd780204624b4d244e7d8179fe6ff77988c3" } -log = { version = "0.4", features = ["serde"] } miniscript = { version = "5", features = ["serde"] } monero = { version = "0.10", features = ["serde_support"] } monero-rpc = { path = "../monero-rpc" } diff --git a/swap/src/bin/asb.rs b/swap/src/bin/asb.rs index e7aaf462..1f06003a 100644 --- a/swap/src/bin/asb.rs +++ b/swap/src/bin/asb.rs @@ -13,7 +13,6 @@ #![allow(non_snake_case)] use anyhow::{Context, Result}; -use log::LevelFilter; use prettytable::{row, Table}; use std::{path::Path, sync::Arc}; use structopt::StructOpt; @@ -38,6 +37,7 @@ use swap::{ trace::init_tracing, }; use tracing::{info, warn}; +use tracing_subscriber::filter::LevelFilter; #[macro_use] extern crate prettytable; @@ -48,7 +48,7 @@ const MONERO_NETWORK: monero::Network = monero::Network::Stagenet; #[tokio::main] async fn main() -> Result<()> { - init_tracing(LevelFilter::Debug).expect("initialize tracing"); + init_tracing(LevelFilter::DEBUG).expect("initialize tracing"); let opt = Arguments::from_args(); diff --git a/swap/src/bin/swap_cli.rs b/swap/src/bin/swap_cli.rs index a6fb88b4..affe443d 100644 --- a/swap/src/bin/swap_cli.rs +++ b/swap/src/bin/swap_cli.rs @@ -13,7 +13,6 @@ #![allow(non_snake_case)] use anyhow::{Context, Result}; -use log::LevelFilter; use prettytable::{row, Table}; use std::{path::Path, sync::Arc}; use structopt::StructOpt; @@ -40,6 +39,7 @@ use swap::{ trace::init_tracing, }; use tracing::{error, info, warn}; +use tracing_subscriber::filter::LevelFilter; use uuid::Uuid; #[macro_use] @@ -49,7 +49,7 @@ const MONERO_BLOCKCHAIN_MONITORING_WALLET_NAME: &str = "swap-tool-blockchain-mon #[tokio::main] async fn main() -> Result<()> { - init_tracing(LevelFilter::Debug).expect("initialize tracing"); + init_tracing(LevelFilter::DEBUG).expect("initialize tracing"); let opt = Arguments::from_args(); diff --git a/swap/src/trace.rs b/swap/src/trace.rs index d711c148..60be6213 100644 --- a/swap/src/trace.rs +++ b/swap/src/trace.rs @@ -1,17 +1,16 @@ use anyhow::Result; use atty::{self}; -use log::LevelFilter; use tracing::{info, subscriber}; use tracing_log::LogTracer; -use tracing_subscriber::FmtSubscriber; +use tracing_subscriber::{filter::LevelFilter, FmtSubscriber}; pub fn init_tracing(level: LevelFilter) -> Result<()> { - if level == LevelFilter::Off { + if level == LevelFilter::OFF { return Ok(()); } // We want upstream library log messages, just only at Info level. - LogTracer::init_with_filter(LevelFilter::Info)?; + LogTracer::init_with_filter(tracing_log::log::LevelFilter::Info)?; let is_terminal = atty::is(atty::Stream::Stderr); let subscriber = FmtSubscriber::builder() From 33cf6090204a10b7f8770ddcecee01ee5e0495a7 Mon Sep 17 00:00:00 2001 From: Thomas Eizinger Date: Mon, 22 Feb 2021 12:49:15 +1100 Subject: [PATCH 9/9] Update bitcoin-harness to latest version This finally removes the openssl dependency completely from our dependency tree. --- Cargo.lock | 159 +---------------------------------------------------- 1 file changed, 3 insertions(+), 156 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 5abbf4c3..844cecb7 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -314,7 +314,7 @@ dependencies = [ [[package]] name = "bitcoin-harness" version = "0.2.0" -source = "git+https://github.com/coblox/bitcoin-harness-rs#640acbf079c728231866b59cd830770b64871cc0" +source = "git+https://github.com/coblox/bitcoin-harness-rs#5a31e889618d2cdef613bd49cef02758b52eed4d" dependencies = [ "async-trait", "base64 0.12.3", @@ -614,22 +614,6 @@ version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "245097e9a4535ee1e3e3931fcfcd55a796a44c643e8596ff6566d68f09b87bbc" -[[package]] -name = "core-foundation" -version = "0.9.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0a89e2ae426ea83155dccf10c0fa6b1463ef6d5fcb44cee0b224a408fa640a62" -dependencies = [ - "core-foundation-sys", - "libc", -] - -[[package]] -name = "core-foundation-sys" -version = "0.8.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ea221b5284a47e40033bf9b66f35f984ec0ea2931eb03505246cd27a963f981b" - [[package]] name = "cpuid-bool" version = "0.1.2" @@ -1010,21 +994,6 @@ version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" -[[package]] -name = "foreign-types" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1" -dependencies = [ - "foreign-types-shared", -] - -[[package]] -name = "foreign-types-shared" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" - [[package]] name = "form_urlencoded" version = "1.0.0" @@ -1409,19 +1378,6 @@ dependencies = [ "want", ] -[[package]] -name = "hyper-tls" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d6183ddfa99b85da61a140bea0efc93fdf56ceaa041b37d553518030827f9905" -dependencies = [ - "bytes", - "hyper", - "native-tls", - "tokio", - "tokio-native-tls", -] - [[package]] name = "idna" version = "0.2.0" @@ -1539,9 +1495,9 @@ dependencies = [ [[package]] name = "jsonrpc_client" -version = "0.5.0" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "18fb8fc4b9e0b44f34346238c1e39e59067747ae7913b2e3d903b56e6c2c8062" +checksum = "fc8515639023bf4260cf89475355fa77301685418f655c680528c380759e7782" dependencies = [ "async-trait", "jsonrpc_client_macro", @@ -2028,24 +1984,6 @@ dependencies = [ "unsigned-varint 0.6.0", ] -[[package]] -name = "native-tls" -version = "0.2.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8d96b2e1c8da3957d58100b09f102c6d9cfdfced01b7ec5a8974044bb09dbd4" -dependencies = [ - "lazy_static", - "libc", - "log", - "openssl", - "openssl-probe", - "openssl-sys", - "schannel", - "security-framework", - "security-framework-sys", - "tempfile", -] - [[package]] name = "nb-connect" version = "1.0.2" @@ -2188,39 +2126,6 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" -[[package]] -name = "openssl" -version = "0.10.32" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "038d43985d1ddca7a9900630d8cd031b56e4794eecc2e9ea39dd17aa04399a70" -dependencies = [ - "bitflags", - "cfg-if 1.0.0", - "foreign-types", - "lazy_static", - "libc", - "openssl-sys", -] - -[[package]] -name = "openssl-probe" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77af24da69f9d9341038eba93a073b1fdaaa1b788221b00a69bce9e762cb32de" - -[[package]] -name = "openssl-sys" -version = "0.9.60" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "921fc71883267538946025deffb622905ecad223c28efbfdef9bb59a0175f3e6" -dependencies = [ - "autocfg 1.0.1", - "cc", - "libc", - "pkg-config", - "vcpkg", -] - [[package]] name = "parity-multiaddr" version = "0.11.0" @@ -2361,12 +2266,6 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" -[[package]] -name = "pkg-config" -version = "0.3.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3831453b3449ceb48b6d9c7ad7c96d5ea673e9b470a1dc578c2ce6521230884c" - [[package]] name = "polling" version = "2.0.2" @@ -2864,20 +2763,17 @@ dependencies = [ "http", "http-body", "hyper", - "hyper-tls", "ipnet", "js-sys", "lazy_static", "log", "mime", - "native-tls", "percent-encoding", "pin-project-lite", "serde", "serde_json", "serde_urlencoded", "tokio", - "tokio-native-tls", "url", "wasm-bindgen", "wasm-bindgen-futures", @@ -2974,16 +2870,6 @@ version = "1.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "71d301d4193d031abdd79ff7e3dd721168a9572ef3fe51a1517aba235bd8f86e" -[[package]] -name = "schannel" -version = "0.1.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f05ba609c234e60bee0d547fe94a4c7e9da733d1c962cf6e59efa4cd9c8bc75" -dependencies = [ - "lazy_static", - "winapi 0.3.9", -] - [[package]] name = "scopeguard" version = "1.1.0" @@ -3042,29 +2928,6 @@ dependencies = [ "subtle 2.4.0", ] -[[package]] -name = "security-framework" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c1759c2e3c8580017a484a7ac56d3abc5a6c1feadf88db2f3633f12ae4268c69" -dependencies = [ - "bitflags", - "core-foundation", - "core-foundation-sys", - "libc", - "security-framework-sys", -] - -[[package]] -name = "security-framework-sys" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f99b9d5e26d2a71633cc4f2ebae7cc9f874044e0c351a27e17892d76dce5678b" -dependencies = [ - "core-foundation-sys", - "libc", -] - [[package]] name = "semver" version = "0.9.0" @@ -3718,16 +3581,6 @@ dependencies = [ "syn", ] -[[package]] -name = "tokio-native-tls" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7d995660bd2b7f8c1568414c1126076c13fbb725c40112dc0120b78eb9b717b" -dependencies = [ - "native-tls", - "tokio", -] - [[package]] name = "tokio-stream" version = "0.1.2" @@ -4010,12 +3863,6 @@ dependencies = [ "serde", ] -[[package]] -name = "vcpkg" -version = "0.2.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b00bca6106a5e23f3eee943593759b7fcddb00554332e856d990c893966879fb" - [[package]] name = "vec-arena" version = "1.0.0"