218: Cleanup dependencies r=thomaseizinger a=thomaseizinger

Fixes https://github.com/comit-network/xmr-btc-swap/issues/208.

Co-authored-by: Thomas Eizinger <thomas@eizinger.io>
This commit is contained in:
bors[bot] 2021-02-23 05:02:55 +00:00 committed by GitHub
commit 2654879ff3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
20 changed files with 95 additions and 244 deletions

226
Cargo.lock generated
View File

@ -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",
@ -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",
@ -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"
@ -801,19 +785,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"
@ -870,7 +841,6 @@ version = "1.0.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "37c66a534cbb46ab4ea03477eae19d5c22c01da8258030280b7bd9d8433fb6ef"
dependencies = [
"serde",
"signature",
]
@ -884,7 +854,6 @@ dependencies = [
"ed25519",
"rand 0.7.3",
"serde",
"serde_bytes",
"sha2 0.9.2",
"zeroize 1.2.0",
]
@ -1025,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"
@ -1424,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"
@ -1554,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",
@ -1851,7 +1792,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fcf3805d4480bb5b86070dcfeb9e2cb2ebc148adb753c5cca5f884d1d65a42b2"
dependencies = [
"cfg-if 0.1.10",
"serde",
]
[[package]]
@ -1878,17 +1818,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"
@ -1985,20 +1914,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]]
@ -2048,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"
@ -2208,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"
@ -2381,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"
@ -2884,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",
@ -2994,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"
@ -3062,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"
@ -3119,15 +2962,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"
@ -3487,20 +3321,18 @@ dependencies = [
"config",
"conquer-once",
"curve25519-dalek",
"derivative",
"dialoguer",
"directories-next",
"ecdsa_fun",
"ed25519-dalek",
"futures",
"get-port",
"hyper",
"libp2p",
"libp2p-async-await",
"log",
"miniscript",
"monero",
"monero-harness",
"monero-rpc",
"pem",
"port_check",
"prettytable-rs",
@ -3510,7 +3342,6 @@ dependencies = [
"rust_decimal",
"serde",
"serde_cbor",
"serde_derive",
"serde_json",
"sha2 0.9.2",
"sigma_fun",
@ -3526,7 +3357,6 @@ dependencies = [
"tokio-tungstenite",
"toml",
"tracing",
"tracing-core",
"tracing-futures",
"tracing-log",
"tracing-subscriber",
@ -3751,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"
@ -3863,9 +3683,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",
@ -4043,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"

View File

@ -1,2 +1,2 @@
[workspace]
members = ["monero-harness", "swap"]
members = ["monero-harness", "monero-rpc", "swap"]

View File

@ -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"

View File

@ -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;

12
monero-rpc/Cargo.toml Normal file
View File

@ -0,0 +1,12 @@
[package]
name = "monero-rpc"
version = "0.1.0"
authors = ["CoBloX Team <team@coblox.tech>"]
edition = "2018"
[dependencies]
anyhow = "1"
reqwest = { version = "0.11", default-features = false, features = ["json"] }
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
tracing = "0.1"

12
monero-rpc/README.md Normal file
View File

@ -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.

View File

@ -0,0 +1 @@
1.46.0

9
monero-rpc/rustfmt.toml Normal file
View File

@ -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

17
monero-rpc/src/lib.rs Normal file
View File

@ -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::*;

View File

@ -39,7 +39,6 @@ struct Response<T> {
#[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);
}
}

View File

@ -1,5 +1,4 @@
use crate::rpc::{Request, Response};
use anyhow::Result;
use reqwest::Url;
use serde::{Deserialize, Serialize};

View File

@ -20,22 +20,18 @@ 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"
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" }
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"
@ -44,21 +40,18 @@ 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"] }
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"] }
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"] }
@ -67,8 +60,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"

View File

@ -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();

View File

@ -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();

View File

@ -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)]

View File

@ -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},

View File

@ -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;

View File

@ -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()

View File

@ -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;