Update dependencies and rust-toolchain to 1.59

This commit updates the rust-toolchain to the current stable version
1.59, and fixes a number of new clippy warnings from that change.

Other changes:
    - updates backoff to 0.4
    - updates swap to 2021 edition
    - updates comfy-table to 5.0
    - updates monero-wallet to 2021 edition
    - updates moneor-harness to 2021 edition
    - updates bdk and rust_decimal
    - updates tokio-util to 0.7
    - updates workflow to use actions/setup-python@3
    - updates pem and serde_with
    - adds stable rust toolchain notice to readme
This commit is contained in:
Byron Hambly 2022-03-12 13:05:36 +02:00
parent c76abd48c7
commit 5a3675a06f
No known key found for this signature in database
GPG Key ID: 7A669B749695225E
27 changed files with 265 additions and 186 deletions

View File

@ -67,9 +67,9 @@ jobs:
run: target/${{ matrix.target }}/release/${{ matrix.bin }} --help run: target/${{ matrix.target }}/release/${{ matrix.bin }} --help
# Remove once python 3 is the default # Remove once python 3 is the default
- uses: actions/setup-python@v2.3.2 - uses: actions/setup-python@v3
with: with:
python-version: '3.x' python-version: "3.x"
- id: create-archive-name - id: create-archive-name
shell: python # Use python to have a prettier name for the archive on Windows. shell: python # Use python to have a prettier name for the archive on Windows.

237
Cargo.lock generated
View File

@ -74,9 +74,9 @@ dependencies = [
[[package]] [[package]]
name = "anyhow" name = "anyhow"
version = "1.0.52" version = "1.0.56"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "84450d0b4a8bd1ba4144ce8ce718fbc5d071358b1e5384bace6536b3d1f2d5b3" checksum = "4361135be9122e0870de935d7c439aef945b9f9ddd4199a553b5270b49c82a27"
[[package]] [[package]]
name = "arrayref" name = "arrayref"
@ -90,6 +90,12 @@ version = "0.5.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "23b62fc65de8e4e7f52534fb52b0f3ed04746ae267519eef2a83941e8085068b" checksum = "23b62fc65de8e4e7f52534fb52b0f3ed04746ae267519eef2a83941e8085068b"
[[package]]
name = "arrayvec"
version = "0.7.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8da52d66c7071e2e3fa2a1e5c6d088fec47b593032b254f5e980de8ea54454d6"
[[package]] [[package]]
name = "asn1_der" name = "asn1_der"
version = "0.7.4" version = "0.7.4"
@ -105,7 +111,7 @@ dependencies = [
"bzip2", "bzip2",
"futures-core", "futures-core",
"memchr", "memchr",
"pin-project-lite 0.2.6", "pin-project-lite 0.2.8",
"tokio", "tokio",
] ]
@ -130,7 +136,7 @@ dependencies = [
"futures-sink", "futures-sink",
"futures-util", "futures-util",
"memchr", "memchr",
"pin-project-lite 0.2.6", "pin-project-lite 0.2.8",
] ]
[[package]] [[package]]
@ -176,14 +182,14 @@ checksum = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a"
[[package]] [[package]]
name = "backoff" name = "backoff"
version = "0.3.0" 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 = "9fe17f59a06fe8b87a6fc8bf53bb70b3aba76d7685f432487a68cd5552853625" checksum = "b62ddb9cb1ec0a098ad4bbf9344d0713fa193ae1a80af55febcff2627b6a00c1"
dependencies = [ dependencies = [
"futures-core", "futures-core",
"getrandom 0.2.2", "getrandom 0.2.2",
"instant", "instant",
"pin-project 1.0.5", "pin-project-lite 0.2.8",
"rand 0.8.3", "rand 0.8.3",
"tokio", "tokio",
] ]
@ -235,9 +241,9 @@ dependencies = [
[[package]] [[package]]
name = "bdk" name = "bdk"
version = "0.12.0" version = "0.16.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ecf7e997526ceefbab7dd99fc0da6834ed8853bd051f53523415ed1dc82b870d" checksum = "3face7de38293a2f7e2a9f69a48b442f28e864da0fc7a6a977388e31bdc367d7"
dependencies = [ dependencies = [
"async-trait", "async-trait",
"bdk-macros", "bdk-macros",
@ -364,9 +370,9 @@ dependencies = [
[[package]] [[package]]
name = "bitflags" name = "bitflags"
version = "1.2.1" version = "1.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693" checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
[[package]] [[package]]
name = "blake2" name = "blake2"
@ -562,13 +568,13 @@ checksum = "3d7b894f5411737b7867f4827955924d7c254fc9f4d91a6aad6b097804b1018b"
[[package]] [[package]]
name = "comfy-table" name = "comfy-table"
version = "4.1.1" version = "5.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "11e95a3e867422fd8d04049041f5671f94d53c32a9dcd82e2be268714942f3f3" checksum = "b103d85ca6e209388771bfb7aa6b68a7aeec4afbf6f0a0264bfbf50360e5212e"
dependencies = [ dependencies = [
"crossterm", "crossterm",
"strum 0.21.0", "strum",
"strum_macros 0.21.0", "strum_macros",
"unicode-width", "unicode-width",
] ]
@ -729,15 +735,15 @@ dependencies = [
[[package]] [[package]]
name = "crossterm" name = "crossterm"
version = "0.20.0" version = "0.23.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c0ebde6a9dd5e331cd6c6f48253254d117642c31653baa475e394657c59c1f7d" checksum = "77b75a27dc8d220f1f8521ea69cd55a34d720a200ebb3a624d9aa19193d3b432"
dependencies = [ dependencies = [
"bitflags", "bitflags",
"crossterm_winapi", "crossterm_winapi",
"libc", "libc",
"mio", "mio",
"parking_lot", "parking_lot 0.12.0",
"signal-hook", "signal-hook",
"signal-hook-mio", "signal-hook-mio",
"winapi 0.3.9", "winapi 0.3.9",
@ -745,9 +751,9 @@ dependencies = [
[[package]] [[package]]
name = "crossterm_winapi" name = "crossterm_winapi"
version = "0.8.0" version = "0.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3a6966607622438301997d3dac0d2f6e9a90c68bb6bc1785ea98456ab93c0507" checksum = "2ae1b35a484aa10e07fe0638d02301c5ad24de82d310ccbd2f3693da5f09bf1c"
dependencies = [ dependencies = [
"winapi 0.3.9", "winapi 0.3.9",
] ]
@ -1184,7 +1190,7 @@ checksum = "62007592ac46aa7c2b6416f7deb9a8a8f63a01e0f1d6e1787d5630170db2b63e"
dependencies = [ dependencies = [
"futures-core", "futures-core",
"lock_api", "lock_api",
"parking_lot", "parking_lot 0.11.2",
] ]
[[package]] [[package]]
@ -1249,7 +1255,7 @@ dependencies = [
"futures-sink", "futures-sink",
"futures-task", "futures-task",
"memchr", "memchr",
"pin-project-lite 0.2.6", "pin-project-lite 0.2.8",
"pin-utils", "pin-utils",
"proc-macro-hack", "proc-macro-hack",
"proc-macro-nested", "proc-macro-nested",
@ -1356,7 +1362,7 @@ dependencies = [
"indexmap", "indexmap",
"slab", "slab",
"tokio", "tokio",
"tokio-util", "tokio-util 0.6.9",
"tracing", "tracing",
] ]
@ -1515,7 +1521,7 @@ dependencies = [
"httparse", "httparse",
"httpdate", "httpdate",
"itoa 0.4.7", "itoa 0.4.7",
"pin-project-lite 0.2.6", "pin-project-lite 0.2.8",
"socket2 0.4.0", "socket2 0.4.0",
"tokio", "tokio",
"tower-service", "tower-service",
@ -1740,7 +1746,7 @@ version = "0.7.5"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "21f866863575d0e1d654fbeeabdc927292fdf862873dc3c96c6f753357e13374" checksum = "21f866863575d0e1d654fbeeabdc927292fdf862873dc3c96c6f753357e13374"
dependencies = [ dependencies = [
"arrayvec", "arrayvec 0.5.2",
"bitflags", "bitflags",
"cfg-if 1.0.0", "cfg-if 1.0.0",
"ryu", "ryu",
@ -1788,7 +1794,7 @@ dependencies = [
"libp2p-websocket", "libp2p-websocket",
"libp2p-yamux", "libp2p-yamux",
"multiaddr", "multiaddr",
"parking_lot", "parking_lot 0.11.2",
"pin-project 1.0.5", "pin-project 1.0.5",
"smallvec", "smallvec",
"wasm-timer", "wasm-timer",
@ -1812,7 +1818,7 @@ dependencies = [
"multiaddr", "multiaddr",
"multihash", "multihash",
"multistream-select", "multistream-select",
"parking_lot", "parking_lot 0.11.2",
"pin-project 1.0.5", "pin-project 1.0.5",
"prost", "prost",
"prost-build", "prost-build",
@ -1861,7 +1867,7 @@ dependencies = [
"libp2p-core", "libp2p-core",
"log", "log",
"nohash-hasher", "nohash-hasher",
"parking_lot", "parking_lot 0.11.2",
"rand 0.7.3", "rand 0.7.3",
"smallvec", "smallvec",
"unsigned-varint", "unsigned-varint",
@ -2005,7 +2011,7 @@ source = "git+https://github.com/libp2p/rust-libp2p.git#6d3ab8a3debe8d69dcd00417
dependencies = [ dependencies = [
"futures", "futures",
"libp2p-core", "libp2p-core",
"parking_lot", "parking_lot 0.11.2",
"thiserror", "thiserror",
"yamux", "yamux",
] ]
@ -2089,9 +2095,9 @@ checksum = "7fb9b38af92608140b86b693604b9ffcc5824240a484d1ecd4795bacb2fe88f3"
[[package]] [[package]]
name = "lock_api" name = "lock_api"
version = "0.4.5" version = "0.4.6"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "712a4d093c9976e24e7dbca41db895dabcbac38eb5f4045393d17a95bdfb1109" checksum = "88943dd7ef4a2e5a4bfa2753aaab3013e34ce2533d1996fb18ef591e315e2b3b"
dependencies = [ dependencies = [
"scopeguard", "scopeguard",
] ]
@ -2555,7 +2561,17 @@ checksum = "7d17b78036a60663b797adeaee46f5c9dfebb86948d1255007a1d6be0271ff99"
dependencies = [ dependencies = [
"instant", "instant",
"lock_api", "lock_api",
"parking_lot_core", "parking_lot_core 0.8.5",
]
[[package]]
name = "parking_lot"
version = "0.12.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "87f5ec2493a61ac0506c0f4199f99070cbe83857b0337006a30f3e6719b8ef58"
dependencies = [
"lock_api",
"parking_lot_core 0.9.1",
] ]
[[package]] [[package]]
@ -2573,14 +2589,25 @@ dependencies = [
] ]
[[package]] [[package]]
name = "pem" name = "parking_lot_core"
version = "1.0.1" version = "0.9.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "06673860db84d02a63942fa69cd9543f2624a5df3aea7f33173048fa7ad5cf1a" checksum = "28141e0cc4143da2443301914478dc976a61ffdb3f043058310c70df2fed8954"
dependencies = [
"cfg-if 1.0.0",
"libc",
"redox_syscall",
"smallvec",
"windows-sys",
]
[[package]]
name = "pem"
version = "1.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e9a3b09a20e374558580a4914d3b7d89bd61b954a5a5e1dcbea98753addb1947"
dependencies = [ dependencies = [
"base64 0.13.0", "base64 0.13.0",
"once_cell",
"regex",
] ]
[[package]] [[package]]
@ -2656,9 +2683,9 @@ checksum = "257b64915a082f7811703966789728173279bdebb956b143dbcd23f6f970a777"
[[package]] [[package]]
name = "pin-project-lite" name = "pin-project-lite"
version = "0.2.6" version = "0.2.8"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dc0e1f259c92177c30a4c9d177246edd0a3568b25756a977d0632cf8fa37e905" checksum = "e280fbe77cc62c91527259e9442153f4688736748d24660126286329742b4c6c"
[[package]] [[package]]
name = "pin-utils" name = "pin-utils"
@ -3177,7 +3204,7 @@ dependencies = [
"log", "log",
"mime", "mime",
"percent-encoding", "percent-encoding",
"pin-project-lite 0.2.6", "pin-project-lite 0.2.8",
"rustls 0.20.2", "rustls 0.20.2",
"rustls-pemfile", "rustls-pemfile",
"serde", "serde",
@ -3186,7 +3213,7 @@ dependencies = [
"tokio", "tokio",
"tokio-rustls 0.23.1", "tokio-rustls 0.23.1",
"tokio-socks", "tokio-socks",
"tokio-util", "tokio-util 0.6.9",
"url", "url",
"wasm-bindgen", "wasm-bindgen",
"wasm-bindgen-futures", "wasm-bindgen-futures",
@ -3222,20 +3249,20 @@ dependencies = [
[[package]] [[package]]
name = "rust_decimal" name = "rust_decimal"
version = "1.18.0" version = "1.22.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "71b5a9625a7e6060b23db692facf49082cc78889a7e6ac94a735356ae49db4b0" checksum = "d37baa70cf8662d2ba1c1868c5983dda16ef32b105cce41fb5c47e72936a90b3"
dependencies = [ dependencies = [
"arrayvec", "arrayvec 0.7.2",
"num-traits", "num-traits",
"serde", "serde",
] ]
[[package]] [[package]]
name = "rust_decimal_macros" name = "rust_decimal_macros"
version = "1.18.0" version = "1.22.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f2a71e447554613b11da876d63d04e78fc3e8e86769488d3b58887671e23bc86" checksum = "184abaf7b434800e1a5a8aad3ebc8cd7498df33af72d65371d797a264713a59b"
dependencies = [ dependencies = [
"quote", "quote",
"rust_decimal", "rust_decimal",
@ -3541,9 +3568,9 @@ dependencies = [
[[package]] [[package]]
name = "serde_with" name = "serde_with"
version = "1.11.0" version = "1.12.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ad6056b4cb69b6e43e3a0f055def223380baecc99da683884f205bf347f7c4b3" checksum = "ec1e6ec4d8950e5b1e894eac0d360742f3b1407a6078a604a731c4b3f49cefbc"
dependencies = [ dependencies = [
"rustversion", "rustversion",
"serde", "serde",
@ -3624,9 +3651,9 @@ dependencies = [
[[package]] [[package]]
name = "signal-hook" name = "signal-hook"
version = "0.3.9" version = "0.3.13"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "470c5a6397076fae0094aaf06a08e6ba6f37acb77d3b1b91ea92b4d6c8650c39" checksum = "647c97df271007dcea485bb74ffdb57f2e683f1306c854f468a0c244badabf2d"
dependencies = [ dependencies = [
"libc", "libc",
"signal-hook-registry", "signal-hook-registry",
@ -3677,7 +3704,7 @@ dependencies = [
"fxhash", "fxhash",
"libc", "libc",
"log", "log",
"parking_lot", "parking_lot 0.11.2",
] ]
[[package]] [[package]]
@ -3818,7 +3845,7 @@ dependencies = [
"log", "log",
"memchr", "memchr",
"once_cell", "once_cell",
"parking_lot", "parking_lot 0.11.2",
"percent-encoding", "percent-encoding",
"rustls 0.19.0", "rustls 0.19.0",
"serde", "serde",
@ -3926,31 +3953,13 @@ dependencies = [
"syn", "syn",
] ]
[[package]]
name = "strum"
version = "0.21.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "aaf86bbcfd1fa9670b7a129f64fc0c9fcbbfe4f1bc4210e9e98fe71ffc12cde2"
[[package]] [[package]]
name = "strum" name = "strum"
version = "0.23.0" version = "0.23.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cae14b91c7d11c9a851d3fbc80a963198998c2a64eec840477fa92d8ce9b70bb" checksum = "cae14b91c7d11c9a851d3fbc80a963198998c2a64eec840477fa92d8ce9b70bb"
dependencies = [ dependencies = [
"strum_macros 0.23.0", "strum_macros",
]
[[package]]
name = "strum_macros"
version = "0.21.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cb076d8b589fde927ec90d05920d610554ca3a4d9dddb177481cadd071a19c2e"
dependencies = [
"heck",
"proc-macro2",
"quote",
"syn",
] ]
[[package]] [[package]]
@ -4029,7 +4038,7 @@ dependencies = [
"spectral", "spectral",
"sqlx", "sqlx",
"structopt", "structopt",
"strum 0.23.0", "strum",
"tempfile", "tempfile",
"testcontainers 0.12.0", "testcontainers 0.12.0",
"thiserror", "thiserror",
@ -4038,7 +4047,7 @@ dependencies = [
"tokio-socks", "tokio-socks",
"tokio-tar", "tokio-tar",
"tokio-tungstenite", "tokio-tungstenite",
"tokio-util", "tokio-util 0.7.0",
"toml", "toml",
"torut", "torut",
"tracing", "tracing",
@ -4214,18 +4223,19 @@ checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c"
[[package]] [[package]]
name = "tokio" name = "tokio"
version = "1.16.1" version = "1.14.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0c27a64b625de6d309e8c57716ba93021dccf1b3b5c97edd6d3dd2d2135afc0a" checksum = "b9d0183f6f6001549ab68f8c7585093bb732beefbcf6d23a10b9b95c73a1dd49"
dependencies = [ dependencies = [
"autocfg 1.0.1",
"bytes", "bytes",
"libc", "libc",
"memchr", "memchr",
"mio", "mio",
"num_cpus", "num_cpus",
"once_cell", "once_cell",
"parking_lot", "parking_lot 0.11.2",
"pin-project-lite 0.2.6", "pin-project-lite 0.2.8",
"signal-hook-registry", "signal-hook-registry",
"tokio-macros", "tokio-macros",
"winapi 0.3.9", "winapi 0.3.9",
@ -4283,7 +4293,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c535f53c0cfa1acace62995a8994fc9cc1f12d202420da96ff306ee24d576469" checksum = "c535f53c0cfa1acace62995a8994fc9cc1f12d202420da96ff306ee24d576469"
dependencies = [ dependencies = [
"futures-core", "futures-core",
"pin-project-lite 0.2.6", "pin-project-lite 0.2.8",
"tokio", "tokio",
] ]
@ -4321,15 +4331,29 @@ dependencies = [
[[package]] [[package]]
name = "tokio-util" name = "tokio-util"
version = "0.6.8" version = "0.6.9"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "08d3725d3efa29485e87311c5b699de63cde14b00ed4d256b8318aa30ca452cd" checksum = "9e99e1983e5d376cd8eb4b66604d2e99e79f5bd988c3055891dcd8c9e2604cc0"
dependencies = [ dependencies = [
"bytes", "bytes",
"futures-core", "futures-core",
"futures-sink", "futures-sink",
"log", "log",
"pin-project-lite 0.2.6", "pin-project-lite 0.2.8",
"tokio",
]
[[package]]
name = "tokio-util"
version = "0.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "64910e1b9c1901aaf5375561e35b9c057d95ff41a44ede043a03e09279eabaf1"
dependencies = [
"bytes",
"futures-core",
"futures-sink",
"log",
"pin-project-lite 0.2.8",
"tokio", "tokio",
] ]
@ -4373,7 +4397,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "375a639232caf30edfc78e8d89b2d4c375515393e7af7e16f01cd96917fb2105" checksum = "375a639232caf30edfc78e8d89b2d4c375515393e7af7e16f01cd96917fb2105"
dependencies = [ dependencies = [
"cfg-if 1.0.0", "cfg-if 1.0.0",
"pin-project-lite 0.2.6", "pin-project-lite 0.2.8",
"tracing-attributes", "tracing-attributes",
"tracing-core", "tracing-core",
] ]
@ -4500,7 +4524,7 @@ dependencies = [
"lazy_static", "lazy_static",
"log", "log",
"lru-cache", "lru-cache",
"parking_lot", "parking_lot 0.11.2",
"resolv-conf", "resolv-conf",
"smallvec", "smallvec",
"thiserror", "thiserror",
@ -4804,7 +4828,7 @@ checksum = "be0ecb0db480561e9a7642b5d3e4187c128914e58aa84330b9493e3eb68c5e7f"
dependencies = [ dependencies = [
"futures", "futures",
"js-sys", "js-sys",
"parking_lot", "parking_lot 0.11.2",
"pin-utils", "pin-utils",
"wasm-bindgen", "wasm-bindgen",
"wasm-bindgen-futures", "wasm-bindgen-futures",
@ -4928,6 +4952,49 @@ 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 = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
[[package]]
name = "windows-sys"
version = "0.32.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3df6e476185f92a12c072be4a189a0210dcdcf512a1891d6dff9edb874deadc6"
dependencies = [
"windows_aarch64_msvc",
"windows_i686_gnu",
"windows_i686_msvc",
"windows_x86_64_gnu",
"windows_x86_64_msvc",
]
[[package]]
name = "windows_aarch64_msvc"
version = "0.32.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d8e92753b1c443191654ec532f14c199742964a061be25d77d7a96f09db20bf5"
[[package]]
name = "windows_i686_gnu"
version = "0.32.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6a711c68811799e017b6038e0922cb27a5e2f43a2ddb609fe0b6f3eeda9de615"
[[package]]
name = "windows_i686_msvc"
version = "0.32.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "146c11bb1a02615db74680b32a68e2d61f553cc24c4eb5b4ca10311740e44172"
[[package]]
name = "windows_x86_64_gnu"
version = "0.32.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c912b12f7454c6620635bbff3450962753834be2a594819bd5e945af18ec64bc"
[[package]]
name = "windows_x86_64_msvc"
version = "0.32.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "504a2476202769977a040c6364301a3f65d0cc9e3fb08600b2bda150a0488316"
[[package]] [[package]]
name = "winreg" name = "winreg"
version = "0.6.2" version = "0.6.2"
@ -4985,7 +5052,7 @@ dependencies = [
"futures", "futures",
"log", "log",
"nohash-hasher", "nohash-hasher",
"parking_lot", "parking_lot 0.11.2",
"rand 0.8.3", "rand 0.8.3",
"static_assertions", "static_assertions",
] ]

View File

@ -47,6 +47,11 @@ It is not recommended to bump fees when swapping because it can have unpredictab
We are encourage community contributions whether it be a bug fix or an improvement to the documentation. We are encourage community contributions whether it be a bug fix or an improvement to the documentation.
Please have a look at the [contribution guidelines](./CONTRIBUTING.md). Please have a look at the [contribution guidelines](./CONTRIBUTING.md).
## Rust Version Support
Please note that only the latest stable Rust toolchain is supported.
All stable toolchains since 1.58 _should_ work.
## Contact ## Contact
Feel free to reach out to us in the [COMIT-Monero Matrix channel](https://matrix.to/#/#comit-monero:matrix.org). Feel free to reach out to us in the [COMIT-Monero Matrix channel](https://matrix.to/#/#comit-monero:matrix.org).

View File

@ -2,7 +2,7 @@
name = "monero-harness" name = "monero-harness"
version = "0.1.0" version = "0.1.0"
authors = [ "CoBloX Team <team@coblox.tech>" ] authors = [ "CoBloX Team <team@coblox.tech>" ]
edition = "2018" edition = "2021"
publish = false publish = false
[dependencies] [dependencies]

View File

@ -13,7 +13,7 @@ pub const MONEROD_DEFAULT_NETWORK: &str = "monero_network";
/// this doesn't matter. /// this doesn't matter.
pub const RPC_PORT: u16 = 18081; pub const RPC_PORT: u16 = 18081;
#[derive(Debug)] #[derive(Debug, Default)]
pub struct Monerod { pub struct Monerod {
args: MonerodArgs, args: MonerodArgs,
} }
@ -58,15 +58,7 @@ impl Image for Monerod {
} }
} }
impl Default for Monerod { #[derive(Debug, Default)]
fn default() -> Self {
Self {
args: MonerodArgs::default(),
}
}
}
#[derive(Debug)]
pub struct MoneroWalletRpc { pub struct MoneroWalletRpc {
args: MoneroWalletRpcArgs, args: MoneroWalletRpcArgs,
} }
@ -111,14 +103,6 @@ impl Image for MoneroWalletRpc {
} }
} }
impl Default for MoneroWalletRpc {
fn default() -> Self {
Self {
args: MoneroWalletRpcArgs::default(),
}
}
}
impl MoneroWalletRpc { impl MoneroWalletRpc {
pub fn new(name: &str, daemon_address: String) -> Self { pub fn new(name: &str, daemon_address: String) -> Self {
Self { Self {

View File

@ -71,7 +71,7 @@ impl<'c> Monero {
let miner = "miner"; let miner = "miner";
tracing::info!("Starting miner wallet: {}", miner); tracing::info!("Starting miner wallet: {}", miner);
let (miner_wallet, miner_container) = let (miner_wallet, miner_container) =
MoneroWalletRpc::new(cli, &miner, &monerod, prefix.clone()).await?; MoneroWalletRpc::new(cli, miner, &monerod, prefix.clone()).await?;
wallets.push(miner_wallet); wallets.push(miner_wallet);
containers.push(miner_container); containers.push(miner_container);
@ -83,7 +83,7 @@ impl<'c> Monero {
// trying for 5 minutes // trying for 5 minutes
let (wallet, container) = tokio::time::timeout(Duration::from_secs(300), async { let (wallet, container) = tokio::time::timeout(Duration::from_secs(300), async {
loop { loop {
let result = MoneroWalletRpc::new(cli, &wallet, &monerod, prefix.clone()).await; let result = MoneroWalletRpc::new(cli, wallet, &monerod, prefix.clone()).await;
match result { match result {
Ok(tuple) => { return tuple; } Ok(tuple) => { return tuple; }
@ -188,7 +188,6 @@ fn random_prefix() -> String {
#[derive(Clone, Debug)] #[derive(Clone, Debug)]
pub struct Monerod { pub struct Monerod {
rpc_port: u16,
name: String, name: String,
network: String, network: String,
client: monerod::Client, client: monerod::Client,
@ -196,9 +195,7 @@ pub struct Monerod {
#[derive(Clone, Debug)] #[derive(Clone, Debug)]
pub struct MoneroWalletRpc { pub struct MoneroWalletRpc {
rpc_port: u16,
name: String, name: String,
network: String,
client: wallet::Client, client: wallet::Client,
} }
@ -220,7 +217,6 @@ impl<'c> Monerod {
Ok(( Ok((
Self { Self {
rpc_port: monerod_rpc_port,
name, name,
network, network,
client: monerod::Client::localhost(monerod_rpc_port)?, client: monerod::Client::localhost(monerod_rpc_port)?,
@ -252,7 +248,7 @@ impl<'c> MoneroWalletRpc {
prefix: String, prefix: String,
) -> Result<(Self, Container<'c, Cli, image::MoneroWalletRpc>)> { ) -> Result<(Self, Container<'c, Cli, image::MoneroWalletRpc>)> {
let daemon_address = format!("{}:{}", monerod.name, RPC_PORT); let daemon_address = format!("{}:{}", monerod.name, RPC_PORT);
let image = image::MoneroWalletRpc::new(&name, daemon_address); let image = image::MoneroWalletRpc::new(name, daemon_address);
let network = monerod.network.clone(); let network = monerod.network.clone();
let run_args = RunArgs::default() let run_args = RunArgs::default()
@ -272,9 +268,7 @@ impl<'c> MoneroWalletRpc {
Ok(( Ok((
Self { Self {
rpc_port: wallet_rpc_port,
name: name.to_string(), name: name.to_string(),
network,
client, client,
}, },
container, container,

View File

@ -2,7 +2,7 @@
name = "monero-rpc" name = "monero-rpc"
version = "0.1.0" version = "0.1.0"
authors = [ "CoBloX Team <team@coblox.tech>" ] authors = [ "CoBloX Team <team@coblox.tech>" ]
edition = "2018" edition = "2021"
[dependencies] [dependencies]
anyhow = "1" anyhow = "1"

View File

@ -184,12 +184,7 @@ pub struct Refreshed {
#[derive(Debug, Clone, Deserialize)] #[derive(Debug, Clone, Deserialize)]
pub struct SweepAll { pub struct SweepAll {
amount_list: Vec<u64>,
fee_list: Vec<u64>,
multisig_txset: String,
pub tx_hash_list: Vec<String>, pub tx_hash_list: Vec<String>,
unsigned_txset: String,
weight_list: Vec<u32>,
} }
#[derive(Debug, Copy, Clone, Deserialize)] #[derive(Debug, Copy, Clone, Deserialize)]
@ -244,7 +239,7 @@ mod tests {
} }
}"#; }"#;
let _: Response<SweepAll> = serde_json::from_str(&response).unwrap(); let _: Response<SweepAll> = serde_json::from_str(response).unwrap();
} }
#[test] #[test]
@ -256,6 +251,6 @@ mod tests {
} }
}"#; }"#;
let _: Response<WalletCreated> = serde_json::from_str(&response).unwrap(); let _: Response<WalletCreated> = serde_json::from_str(response).unwrap();
} }
} }

View File

@ -2,7 +2,7 @@
name = "monero-wallet" name = "monero-wallet"
version = "0.1.0" version = "0.1.0"
authors = [ "CoBloX Team <team@coblox.tech>" ] authors = [ "CoBloX Team <team@coblox.tech>" ]
edition = "2018" edition = "2021"
[dependencies] [dependencies]
anyhow = "1" anyhow = "1"

View File

@ -77,8 +77,8 @@ mod tests {
let result = rpc_client let result = rpc_client
.get_outs( .get_outs(
key_offsets key_offsets
.to_vec() .iter()
.into_iter() .cloned()
.map(|varint| GetOutputsOut { .map(|varint| GetOutputsOut {
amount: 0, amount: 0,
index: varint.0, index: varint.0,

View File

@ -1,4 +1,4 @@
[toolchain] [toolchain]
channel = "1.53" channel = "1.59"
components = ["clippy"] components = ["clippy"]
targets = ["armv7-unknown-linux-gnueabihf"] targets = ["armv7-unknown-linux-gnueabihf"]

View File

@ -2,7 +2,7 @@
name = "swap" name = "swap"
version = "0.10.2" version = "0.10.2"
authors = [ "The COMIT guys <hello@comit.network>" ] authors = [ "The COMIT guys <hello@comit.network>" ]
edition = "2018" edition = "2021"
description = "XMR/BTC trustless atomic swaps." description = "XMR/BTC trustless atomic swaps."
[lib] [lib]
@ -13,13 +13,13 @@ anyhow = "1"
async-compression = { version = "0.3", features = [ "bzip2", "tokio" ] } async-compression = { version = "0.3", features = [ "bzip2", "tokio" ] }
async-trait = "0.1" async-trait = "0.1"
atty = "0.2" atty = "0.2"
backoff = { version = "0.3", features = [ "tokio" ] } backoff = { version = "0.4", features = [ "tokio" ] }
base64 = "0.13" base64 = "0.13"
bdk = "0.12" bdk = "0.16"
big-bytes = "1" big-bytes = "1"
bitcoin = { version = "0.27", features = [ "rand", "use-serde" ] } bitcoin = { version = "0.27", features = [ "rand", "use-serde" ] }
bmrng = "0.5" bmrng = "0.5"
comfy-table = "4.1.1" comfy-table = "5.0"
config = { version = "0.11", default-features = false, features = [ "toml" ] } config = { version = "0.11", default-features = false, features = [ "toml" ] }
conquer-once = "0.3" conquer-once = "0.3"
curve25519-dalek = { package = "curve25519-dalek-ng", version = "4" } curve25519-dalek = { package = "curve25519-dalek-ng", version = "4" }
@ -56,7 +56,7 @@ time = "0.3"
tokio = { version = "1", features = [ "rt-multi-thread", "time", "macros", "sync", "process", "fs", "net" ] } tokio = { version = "1", features = [ "rt-multi-thread", "time", "macros", "sync", "process", "fs", "net" ] }
tokio-socks = "0.5" tokio-socks = "0.5"
tokio-tungstenite = { version = "0.15", features = [ "rustls-tls" ] } tokio-tungstenite = { version = "0.15", features = [ "rustls-tls" ] }
tokio-util = { version = "0.6", features = [ "io" ] } tokio-util = { version = "0.7", features = [ "io", "codec" ] }
toml = "0.5" toml = "0.5"
torut = { version = "0.2", default-features = false, features = [ "v3", "control" ] } torut = { version = "0.2", default-features = false, features = [ "v3", "control" ] }
tracing = { version = "0.1", features = [ "attributes" ] } tracing = { version = "0.1", features = [ "attributes" ] }

View File

@ -47,7 +47,7 @@ async fn main() -> Result<()> {
json, json,
cmd, cmd,
} = match parse_args_and_apply_defaults(env::args_os())? { } = match parse_args_and_apply_defaults(env::args_os())? {
ParseResult::Arguments(args) => args, ParseResult::Arguments(args) => *args,
ParseResult::PrintAndExitZero { message } => { ParseResult::PrintAndExitZero { message } => {
println!("{}", message); println!("{}", message);
std::process::exit(0); std::process::exit(0);
@ -95,7 +95,7 @@ async fn main() -> Result<()> {
tracing::debug!(peer_id = %swarm.local_peer_id(), "Network layer initialized"); tracing::debug!(peer_id = %swarm.local_peer_id(), "Network layer initialized");
let (event_loop, mut event_loop_handle) = let (event_loop, mut event_loop_handle) =
EventLoop::new(swap_id, swarm, seller_peer_id, env_config)?; EventLoop::new(swap_id, swarm, seller_peer_id)?;
let event_loop = tokio::spawn(event_loop.run()); let event_loop = tokio::spawn(event_loop.run());
let max_givable = || bitcoin_wallet.max_giveable(TxLock::script_size()); let max_givable = || bitcoin_wallet.max_giveable(TxLock::script_size());
@ -276,8 +276,7 @@ async fn main() -> Result<()> {
.add_address(seller_peer_id, seller_address); .add_address(seller_peer_id, seller_address);
} }
let (event_loop, event_loop_handle) = let (event_loop, event_loop_handle) = EventLoop::new(swap_id, swarm, seller_peer_id)?;
EventLoop::new(swap_id, swarm, seller_peer_id, env_config)?;
let handle = tokio::spawn(event_loop.run()); let handle = tokio::spawn(event_loop.run());
let monero_receive_address = db.get_monero_address(swap_id).await?; let monero_receive_address = db.get_monero_address(swap_id).await?;

View File

@ -171,7 +171,7 @@ pub fn verify_sig(
) -> Result<()> { ) -> Result<()> {
let ecdsa = ECDSA::verify_only(); let ecdsa = ECDSA::verify_only();
if ecdsa.verify(&verification_key.0, &transaction_sighash.into_inner(), &sig) { if ecdsa.verify(&verification_key.0, &transaction_sighash.into_inner(), sig) {
Ok(()) Ok(())
} else { } else {
bail!(InvalidSignature) bail!(InvalidSignature)
@ -194,7 +194,7 @@ pub fn verify_encsig(
&verification_key.0, &verification_key.0,
&encryption_key.0, &encryption_key.0,
&digest.into_inner(), &digest.into_inner(),
&encsig, encsig,
) { ) {
Ok(()) Ok(())
} else { } else {
@ -213,7 +213,7 @@ pub fn build_shared_output_descriptor(A: Point, B: Point) -> Descriptor<bitcoin:
let A = ToHex::to_hex(&secp256k1::PublicKey::from(A)); let A = ToHex::to_hex(&secp256k1::PublicKey::from(A));
let B = ToHex::to_hex(&secp256k1::PublicKey::from(B)); let B = ToHex::to_hex(&secp256k1::PublicKey::from(B));
let miniscript = MINISCRIPT_TEMPLATE.replace("A", &A).replace("B", &B); let miniscript = MINISCRIPT_TEMPLATE.replace('A', &A).replace('B', &B);
let miniscript = let miniscript =
bdk::miniscript::Miniscript::<bitcoin::PublicKey, Segwitv0>::from_str(&miniscript) bdk::miniscript::Miniscript::<bitcoin::PublicKey, Segwitv0>::from_str(&miniscript)

View File

@ -200,9 +200,10 @@ mod tests {
#[tokio::test] #[tokio::test]
async fn bob_can_fund_without_a_change_output() { async fn bob_can_fund_without_a_change_output() {
let (A, B) = alice_and_bob(); let (A, B) = alice_and_bob();
let fees = 610; let fees = 300;
let agreed_amount = Amount::from_sat(10000); let agreed_amount = Amount::from_sat(10000);
let wallet = WalletBuilder::new(agreed_amount.as_sat() + fees).build(); let amount = agreed_amount.as_sat() + fees;
let wallet = WalletBuilder::new(amount).build();
let psbt = bob_make_psbt(A, B, &wallet, agreed_amount).await; let psbt = bob_make_psbt(A, B, &wallet, agreed_amount).await;
assert_eq!( assert_eq!(
@ -262,7 +263,7 @@ mod tests {
amount: Amount, amount: Amount,
) -> PartiallySignedTransaction { ) -> PartiallySignedTransaction {
let change = wallet.new_address().await.unwrap(); let change = wallet.new_address().await.unwrap();
TxLock::new(&wallet, amount, A, B, change) TxLock::new(wallet, amount, A, B, change)
.await .await
.unwrap() .unwrap()
.into() .into()

View File

@ -128,7 +128,7 @@ impl TxRedeem {
let sig = sigs let sig = sigs
.into_iter() .into_iter()
.find(|sig| verify_sig(&B, &self.digest(), &sig).is_ok()) .find(|sig| verify_sig(&B, &self.digest(), sig).is_ok())
.context("Neither signature on witness stack verifies against B")?; .context("Neither signature on witness stack verifies against B")?;
Ok(sig) Ok(sig)

View File

@ -132,7 +132,7 @@ impl TxRefund {
let sig = sigs let sig = sigs
.into_iter() .into_iter()
.find(|sig| verify_sig(&B, &self.digest(), &sig).is_ok()) .find(|sig| verify_sig(&B, &self.digest(), sig).is_ok())
.context("Neither signature on witness stack verifies against B")?; .context("Neither signature on witness stack verifies against B")?;
Ok(sig) Ok(sig)

View File

@ -102,7 +102,7 @@ impl Wallet {
self.wallet self.wallet
.lock() .lock()
.await .await
.broadcast(transaction) .broadcast(&transaction)
.with_context(|| { .with_context(|| {
format!("Failed to broadcast Bitcoin {} transaction {}", kind, txid) format!("Failed to broadcast Bitcoin {} transaction {}", kind, txid)
})?; })?;

View File

@ -41,7 +41,7 @@ pub struct Arguments {
#[derive(Debug, PartialEq)] #[derive(Debug, PartialEq)]
pub enum ParseResult { pub enum ParseResult {
/// The arguments we were invoked in. /// The arguments we were invoked in.
Arguments(Arguments), Arguments(Box<Arguments>),
/// A flag or command was given that does not need further processing other /// A flag or command was given that does not need further processing other
/// than printing the provided message. /// than printing the provided message.
/// ///
@ -260,7 +260,7 @@ where
}, },
}; };
Ok(ParseResult::Arguments(arguments)) Ok(ParseResult::Arguments(Box::new(arguments)))
} }
#[derive(Debug, PartialEq)] #[derive(Debug, PartialEq)]
@ -693,7 +693,8 @@ mod tests {
MULTI_ADDRESS, MULTI_ADDRESS,
]; ];
let expected_args = ParseResult::Arguments(Arguments::buy_xmr_mainnet_defaults()); let expected_args =
ParseResult::Arguments(Arguments::buy_xmr_mainnet_defaults().into_boxed());
let args = parse_args_and_apply_defaults(raw_ars).unwrap(); let args = parse_args_and_apply_defaults(raw_ars).unwrap();
assert_eq!(expected_args, args); assert_eq!(expected_args, args);
@ -717,7 +718,7 @@ mod tests {
assert_eq!( assert_eq!(
args, args,
ParseResult::Arguments(Arguments::buy_xmr_testnet_defaults()) ParseResult::Arguments(Arguments::buy_xmr_testnet_defaults().into_boxed())
); );
} }
@ -778,7 +779,7 @@ mod tests {
assert_eq!( assert_eq!(
args, args,
ParseResult::Arguments(Arguments::resume_mainnet_defaults()) ParseResult::Arguments(Arguments::resume_mainnet_defaults().into_boxed())
); );
} }
@ -790,7 +791,7 @@ mod tests {
assert_eq!( assert_eq!(
args, args,
ParseResult::Arguments(Arguments::resume_testnet_defaults()) ParseResult::Arguments(Arguments::resume_testnet_defaults().into_boxed())
); );
} }
@ -802,7 +803,7 @@ mod tests {
assert_eq!( assert_eq!(
args, args,
ParseResult::Arguments(Arguments::cancel_mainnet_defaults()) ParseResult::Arguments(Arguments::cancel_mainnet_defaults().into_boxed())
); );
} }
@ -814,7 +815,7 @@ mod tests {
assert_eq!( assert_eq!(
args, args,
ParseResult::Arguments(Arguments::cancel_testnet_defaults()) ParseResult::Arguments(Arguments::cancel_testnet_defaults().into_boxed())
); );
} }
@ -826,7 +827,7 @@ mod tests {
assert_eq!( assert_eq!(
args, args,
ParseResult::Arguments(Arguments::refund_mainnet_defaults()) ParseResult::Arguments(Arguments::refund_mainnet_defaults().into_boxed())
); );
} }
@ -838,7 +839,7 @@ mod tests {
assert_eq!( assert_eq!(
args, args,
ParseResult::Arguments(Arguments::refund_testnet_defaults()) ParseResult::Arguments(Arguments::refund_testnet_defaults().into_boxed())
); );
} }
@ -866,6 +867,7 @@ mod tests {
ParseResult::Arguments( ParseResult::Arguments(
Arguments::buy_xmr_mainnet_defaults() Arguments::buy_xmr_mainnet_defaults()
.with_data_dir(PathBuf::from_str(data_dir).unwrap().join("mainnet")) .with_data_dir(PathBuf::from_str(data_dir).unwrap().join("mainnet"))
.into_boxed()
) )
); );
@ -890,6 +892,7 @@ mod tests {
ParseResult::Arguments( ParseResult::Arguments(
Arguments::buy_xmr_testnet_defaults() Arguments::buy_xmr_testnet_defaults()
.with_data_dir(PathBuf::from_str(data_dir).unwrap().join("testnet")) .with_data_dir(PathBuf::from_str(data_dir).unwrap().join("testnet"))
.into_boxed()
) )
); );
@ -909,6 +912,7 @@ mod tests {
ParseResult::Arguments( ParseResult::Arguments(
Arguments::resume_mainnet_defaults() Arguments::resume_mainnet_defaults()
.with_data_dir(PathBuf::from_str(data_dir).unwrap().join("mainnet")) .with_data_dir(PathBuf::from_str(data_dir).unwrap().join("mainnet"))
.into_boxed()
) )
); );
@ -929,6 +933,7 @@ mod tests {
ParseResult::Arguments( ParseResult::Arguments(
Arguments::resume_testnet_defaults() Arguments::resume_testnet_defaults()
.with_data_dir(PathBuf::from_str(data_dir).unwrap().join("testnet")) .with_data_dir(PathBuf::from_str(data_dir).unwrap().join("testnet"))
.into_boxed()
) )
); );
} }
@ -950,7 +955,11 @@ mod tests {
let args = parse_args_and_apply_defaults(raw_ars).unwrap(); let args = parse_args_and_apply_defaults(raw_ars).unwrap();
assert_eq!( assert_eq!(
args, args,
ParseResult::Arguments(Arguments::buy_xmr_mainnet_defaults().with_debug()) ParseResult::Arguments(
Arguments::buy_xmr_mainnet_defaults()
.with_debug()
.into_boxed()
)
); );
let raw_ars = vec![ let raw_ars = vec![
@ -969,7 +978,11 @@ mod tests {
let args = parse_args_and_apply_defaults(raw_ars).unwrap(); let args = parse_args_and_apply_defaults(raw_ars).unwrap();
assert_eq!( assert_eq!(
args, args,
ParseResult::Arguments(Arguments::buy_xmr_testnet_defaults().with_debug()) ParseResult::Arguments(
Arguments::buy_xmr_testnet_defaults()
.with_debug()
.into_boxed()
)
); );
let raw_ars = vec![BINARY_NAME, "--debug", "resume", "--swap-id", SWAP_ID]; let raw_ars = vec![BINARY_NAME, "--debug", "resume", "--swap-id", SWAP_ID];
@ -977,7 +990,11 @@ mod tests {
let args = parse_args_and_apply_defaults(raw_ars).unwrap(); let args = parse_args_and_apply_defaults(raw_ars).unwrap();
assert_eq!( assert_eq!(
args, args,
ParseResult::Arguments(Arguments::resume_mainnet_defaults().with_debug()) ParseResult::Arguments(
Arguments::resume_mainnet_defaults()
.with_debug()
.into_boxed()
)
); );
let raw_ars = vec![ let raw_ars = vec![
@ -992,7 +1009,11 @@ mod tests {
let args = parse_args_and_apply_defaults(raw_ars).unwrap(); let args = parse_args_and_apply_defaults(raw_ars).unwrap();
assert_eq!( assert_eq!(
args, args,
ParseResult::Arguments(Arguments::resume_testnet_defaults().with_debug()) ParseResult::Arguments(
Arguments::resume_testnet_defaults()
.with_debug()
.into_boxed()
)
); );
} }
@ -1013,7 +1034,11 @@ mod tests {
let args = parse_args_and_apply_defaults(raw_ars).unwrap(); let args = parse_args_and_apply_defaults(raw_ars).unwrap();
assert_eq!( assert_eq!(
args, args,
ParseResult::Arguments(Arguments::buy_xmr_mainnet_defaults().with_json()) ParseResult::Arguments(
Arguments::buy_xmr_mainnet_defaults()
.with_json()
.into_boxed()
)
); );
let raw_ars = vec![ let raw_ars = vec![
@ -1032,7 +1057,11 @@ mod tests {
let args = parse_args_and_apply_defaults(raw_ars).unwrap(); let args = parse_args_and_apply_defaults(raw_ars).unwrap();
assert_eq!( assert_eq!(
args, args,
ParseResult::Arguments(Arguments::buy_xmr_testnet_defaults().with_json()) ParseResult::Arguments(
Arguments::buy_xmr_testnet_defaults()
.with_json()
.into_boxed()
)
); );
let raw_ars = vec![BINARY_NAME, "--json", "resume", "--swap-id", SWAP_ID]; let raw_ars = vec![BINARY_NAME, "--json", "resume", "--swap-id", SWAP_ID];
@ -1040,7 +1069,11 @@ mod tests {
let args = parse_args_and_apply_defaults(raw_ars).unwrap(); let args = parse_args_and_apply_defaults(raw_ars).unwrap();
assert_eq!( assert_eq!(
args, args,
ParseResult::Arguments(Arguments::resume_mainnet_defaults().with_json()) ParseResult::Arguments(
Arguments::resume_mainnet_defaults()
.with_json()
.into_boxed()
)
); );
let raw_ars = vec![ let raw_ars = vec![
@ -1055,7 +1088,11 @@ mod tests {
let args = parse_args_and_apply_defaults(raw_ars).unwrap(); let args = parse_args_and_apply_defaults(raw_ars).unwrap();
assert_eq!( assert_eq!(
args, args,
ParseResult::Arguments(Arguments::resume_testnet_defaults().with_json()) ParseResult::Arguments(
Arguments::resume_testnet_defaults()
.with_json()
.into_boxed()
)
); );
} }
@ -1303,6 +1340,10 @@ mod tests {
self.json = true; self.json = true;
self self
} }
pub fn into_boxed(self) -> Box<Self> {
Box::new(self)
}
} }
fn data_dir_path_cli() -> PathBuf { fn data_dir_path_cli() -> PathBuf {

View File

@ -1,10 +1,10 @@
use crate::bitcoin::EncryptedSignature; use crate::bitcoin::EncryptedSignature;
use crate::cli::behaviour::{Behaviour, OutEvent}; use crate::cli::behaviour::{Behaviour, OutEvent};
use crate::monero;
use crate::network::encrypted_signature; use crate::network::encrypted_signature;
use crate::network::quote::BidQuote; use crate::network::quote::BidQuote;
use crate::network::swap_setup::bob::NewSwap; use crate::network::swap_setup::bob::NewSwap;
use crate::protocol::bob::State2; use crate::protocol::bob::State2;
use crate::{env, monero};
use anyhow::{Context, Result}; use anyhow::{Context, Result};
use futures::future::{BoxFuture, OptionFuture}; use futures::future::{BoxFuture, OptionFuture};
use futures::{FutureExt, StreamExt}; use futures::{FutureExt, StreamExt};
@ -50,7 +50,6 @@ impl EventLoop {
swap_id: Uuid, swap_id: Uuid,
swarm: Swarm<Behaviour>, swarm: Swarm<Behaviour>,
alice_peer_id: PeerId, alice_peer_id: PeerId,
env_config: env::Config,
) -> Result<(Self, EventLoopHandle)> { ) -> Result<(Self, EventLoopHandle)> {
let execution_setup = bmrng::channel_with_timeout(1, Duration::from_secs(60)); let execution_setup = bmrng::channel_with_timeout(1, Duration::from_secs(60));
let transfer_proof = bmrng::channel_with_timeout(1, Duration::from_secs(60)); let transfer_proof = bmrng::channel_with_timeout(1, Duration::from_secs(60));
@ -76,7 +75,6 @@ impl EventLoop {
transfer_proof: transfer_proof.1, transfer_proof: transfer_proof.1,
encrypted_signature: encrypted_signature.0, encrypted_signature: encrypted_signature.0,
quote: quote.0, quote: quote.0,
env_config,
}; };
Ok((event_loop, handle)) Ok((event_loop, handle))
@ -220,7 +218,6 @@ pub struct EventLoopHandle {
transfer_proof: bmrng::RequestReceiver<monero::TransferProof, ()>, transfer_proof: bmrng::RequestReceiver<monero::TransferProof, ()>,
encrypted_signature: bmrng::RequestSender<EncryptedSignature, ()>, encrypted_signature: bmrng::RequestSender<EncryptedSignature, ()>,
quote: bmrng::RequestSender<(), BidQuote>, quote: bmrng::RequestSender<(), BidQuote>,
env_config: env::Config,
} }
impl EventLoopHandle { impl EventLoopHandle {

View File

@ -271,7 +271,7 @@ impl EventLoop {
QuoteStatus::Received(Status::Online(quote)) => { QuoteStatus::Received(Status::Online(quote)) => {
let address = self let address = self
.reachable_asb_address .reachable_asb_address
.get(&peer_id) .get(peer_id)
.expect("if we got a quote we must have stored an address"); .expect("if we got a quote we must have stored an address");
Ok(Seller { Ok(Seller {
@ -282,7 +282,7 @@ impl EventLoop {
QuoteStatus::Received(Status::Unreachable) => { QuoteStatus::Received(Status::Unreachable) => {
let address = self let address = self
.unreachable_asb_address .unreachable_asb_address
.get(&peer_id) .get(peer_id)
.expect("if we got a quote we must have stored an address"); .expect("if we got a quote we must have stored an address");
Ok(Seller { Ok(Seller {

View File

@ -138,7 +138,7 @@ mod monero_network {
Network::Stagenet => "stagenet", Network::Stagenet => "stagenet",
Network::Testnet => "testnet", Network::Testnet => "testnet",
}; };
s.serialize_str(&str) s.serialize_str(str)
} }
} }

View File

@ -45,7 +45,7 @@ pub fn connect(price_ticker_ws_url: Url) -> Result<PriceUpdates> {
} }
} }
Err(backoff::Error::Transient(anyhow!("stream ended"))) Err(backoff::Error::transient(anyhow!("stream ended")))
} }
}, },
|error, next: Duration| { |error, next: Duration| {
@ -108,8 +108,8 @@ fn to_backoff(e: connection::Error) -> backoff::Error<anyhow::Error> {
match e { match e {
// Connection closures and websocket errors will be retried // Connection closures and websocket errors will be retried
connection::Error::ConnectionClosed => Transient(anyhow::Error::from(e)), connection::Error::ConnectionClosed => backoff::Error::transient(anyhow::Error::from(e)),
connection::Error::WebSocket(_) => Transient(anyhow::Error::from(e)), connection::Error::WebSocket(_) => backoff::Error::transient(anyhow::Error::from(e)),
// Failures while parsing a message are permanent because they most likely present a // Failures while parsing a message are permanent because they most likely present a
// programmer error // programmer error
@ -275,8 +275,6 @@ mod wire {
pub struct TickerData { pub struct TickerData {
#[serde(rename = "a")] #[serde(rename = "a")]
ask: Vec<RateElement>, ask: Vec<RateElement>,
#[serde(rename = "b")]
bid: Vec<RateElement>,
} }
#[derive(Debug, Deserialize)] #[derive(Debug, Deserialize)]

View File

@ -6,7 +6,7 @@ pub mod ecdsa_fun {
use ::ecdsa_fun::fun::{Point, Scalar, G}; use ::ecdsa_fun::fun::{Point, Scalar, G};
pub fn point() -> impl Strategy<Value = Point> { pub fn point() -> impl Strategy<Value = Point> {
scalar().prop_map(|mut scalar| Point::from_scalar_mul(&G, &mut scalar).mark::<Normal>()) scalar().prop_map(|mut scalar| Point::from_scalar_mul(G, &mut scalar).mark::<Normal>())
} }
pub fn scalar() -> impl Strategy<Value = Scalar> { pub fn scalar() -> impl Strategy<Value = Scalar> {

View File

@ -29,7 +29,7 @@ impl Image for Bitcoind {
container container
.logs() .logs()
.stdout .stdout
.wait_for_message(&"init message: Done loading") .wait_for_message("init message: Done loading")
.unwrap(); .unwrap();
} }

View File

@ -14,7 +14,6 @@ pub struct Electrs {
entrypoint: Option<String>, entrypoint: Option<String>,
wait_for_message: String, wait_for_message: String,
volume: String, volume: String,
bitcoind_container_name: String,
} }
impl Image for Electrs { impl Image for Electrs {
@ -73,7 +72,6 @@ impl Default for Electrs {
entrypoint: Some("/build/electrs".into()), entrypoint: Some("/build/electrs".into()),
wait_for_message: "Running accept thread".to_string(), wait_for_message: "Running accept thread".to_string(),
volume: uuid::Uuid::new_v4().to_string(), volume: uuid::Uuid::new_v4().to_string(),
bitcoind_container_name: uuid::Uuid::new_v4().to_string(),
} }
} }
} }

View File

@ -146,14 +146,14 @@ async fn init_containers(cli: &Cli) -> (Monero, Containers<'_>) {
let prefix = random_prefix(); let prefix = random_prefix();
let bitcoind_name = format!("{}_{}", prefix, "bitcoind"); let bitcoind_name = format!("{}_{}", prefix, "bitcoind");
let (bitcoind, bitcoind_url) = let (bitcoind, bitcoind_url) =
init_bitcoind_container(&cli, prefix.clone(), bitcoind_name.clone(), prefix.clone()) init_bitcoind_container(cli, prefix.clone(), bitcoind_name.clone(), prefix.clone())
.await .await
.expect("could not init bitcoind"); .expect("could not init bitcoind");
let electrs = init_electrs_container(&cli, prefix.clone(), bitcoind_name, prefix) let electrs = init_electrs_container(cli, prefix.clone(), bitcoind_name, prefix)
.await .await
.expect("could not init electrs"); .expect("could not init electrs");
let (monero, monerod_container, monero_wallet_rpc_containers) = let (monero, monerod_container, monero_wallet_rpc_containers) =
Monero::new(&cli, vec![MONERO_WALLET_NAME_ALICE, MONERO_WALLET_NAME_BOB]) Monero::new(cli, vec![MONERO_WALLET_NAME_ALICE, MONERO_WALLET_NAME_BOB])
.await .await
.unwrap(); .unwrap();
@ -237,7 +237,7 @@ async fn start_alice(
let resume_only = false; let resume_only = false;
let mut swarm = swarm::asb( let mut swarm = swarm::asb(
&seed, seed,
min_buy, min_buy,
max_buy, max_buy,
latest_rate, latest_rate,
@ -485,7 +485,7 @@ impl BobParams {
.behaviour_mut() .behaviour_mut()
.add_address(self.alice_peer_id, self.alice_address.clone()); .add_address(self.alice_peer_id, self.alice_address.clone());
cli::EventLoop::new(swap_id, swarm, self.alice_peer_id, self.env_config) cli::EventLoop::new(swap_id, swarm, self.alice_peer_id)
} }
} }