diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7dc88d9e..f9e9f229 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -17,9 +17,6 @@ jobs: - uses: Swatinem/rust-cache@v1.2.0 - - name: Check code formatting - run: cargo fmt --all -- --check - - name: Check formatting uses: dprint/check@v1.4 diff --git a/Cargo.lock b/Cargo.lock index 4fafdf54..506650d6 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -812,11 +812,24 @@ dependencies = [ "byteorder", "digest 0.9.0", "rand_core 0.5.1", - "serde", "subtle 2.4.0", "zeroize", ] +[[package]] +name = "curve25519-dalek-ng" +version = "4.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "574d8b2cd0bae5434fd50d53280f8299d95557a978686555880aaf5b8f4f81e9" +dependencies = [ + "byteorder", + "digest 0.9.0", + "rand_core 0.6.2", + "serde", + "subtle-ng", + "zeroize", +] + [[package]] name = "data-encoding" version = "2.3.2" @@ -918,11 +931,11 @@ checksum = "212d0f5754cb6769937f4501cc0e67f4f4483c8d2c3e1e922ee9edbe4ab4c7c0" [[package]] name = "ecdsa_fun" -version = "0.4.2-alpha.0" -source = "git+https://github.com/LLFourn/secp256kfun#8538ef22498170960a9769df2700c1986cc540fd" +version = "0.6.2-alpha.0" +source = "git+https://github.com/LLFourn/secp256kfun#84134daf34845434d7f38cdae7ffc31730a3b1e9" dependencies = [ "bincode", - "rand_chacha 0.2.2", + "rand_chacha 0.3.0", "secp256kfun", "serde", "sigma_fun", @@ -2204,11 +2217,10 @@ dependencies = [ [[package]] name = "monero" version = "0.12.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2c73108ba5cf025e437600990935234241f95ada3c4621960d50912cde739af6" +source = "git+https://github.com/comit-network/monero-rs?rev=818f38b#818f38b043e2a9fa38d74fec5310a270f510844e" dependencies = [ "base58-monero", - "curve25519-dalek", + "curve25519-dalek-ng", "fixed-hash", "hex 0.4.3", "hex-literal", @@ -3388,24 +3400,24 @@ dependencies = [ [[package]] name = "secp256kfun" -version = "0.4.2-alpha.0" -source = "git+https://github.com/LLFourn/secp256kfun#8538ef22498170960a9769df2700c1986cc540fd" +version = "0.6.2-alpha.0" +source = "git+https://github.com/LLFourn/secp256kfun#84134daf34845434d7f38cdae7ffc31730a3b1e9" dependencies = [ "digest 0.9.0", - "rand_core 0.5.1", + "rand_core 0.6.2", "secp256k1", "secp256kfun_parity_backend", "serde", - "subtle 2.4.0", + "subtle-ng", ] [[package]] name = "secp256kfun_parity_backend" -version = "0.1.4-alpha.0" -source = "git+https://github.com/LLFourn/secp256kfun#8538ef22498170960a9769df2700c1986cc540fd" +version = "0.1.6-alpha.0" +source = "git+https://github.com/LLFourn/secp256kfun#84134daf34845434d7f38cdae7ffc31730a3b1e9" dependencies = [ "crunchy", - "subtle 2.4.0", + "subtle-ng", ] [[package]] @@ -3594,13 +3606,13 @@ dependencies = [ [[package]] name = "sigma_fun" -version = "0.1.3-alpha.0" -source = "git+https://github.com/LLFourn/secp256kfun#8538ef22498170960a9769df2700c1986cc540fd" +version = "0.3.2-alpha.0" +source = "git+https://github.com/LLFourn/secp256kfun#84134daf34845434d7f38cdae7ffc31730a3b1e9" dependencies = [ - "curve25519-dalek", + "curve25519-dalek-ng", "digest 0.9.0", "generic-array 0.14.4", - "rand_core 0.5.1", + "rand_core 0.6.2", "secp256kfun", "serde", ] @@ -3857,6 +3869,12 @@ version = "2.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1e81da0851ada1f3e9d4312c704aa4f8806f0f9d69faaf8df2f3464b4a9437c2" +[[package]] +name = "subtle-ng" +version = "2.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8049cf85f0e715d6af38dde439cb0ccb91f67fb9f5f63c80f8b43e48356e1a3f" + [[package]] name = "swap" version = "0.6.0" @@ -3875,7 +3893,7 @@ dependencies = [ "bmrng", "config", "conquer-once", - "curve25519-dalek", + "curve25519-dalek-ng", "data-encoding", "dialoguer", "directories-next", @@ -3895,8 +3913,8 @@ dependencies = [ "port_check", "prettytable-rs", "proptest", - "rand 0.7.3", - "rand_chacha 0.2.2", + "rand 0.8.3", + "rand_chacha 0.3.0", "reqwest", "rust_decimal", "rust_decimal_macros", diff --git a/Cargo.toml b/Cargo.toml index 56e4fe63..0f654d91 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,2 +1,5 @@ [workspace] members = [ "monero-harness", "monero-rpc", "swap", "monero-wallet" ] + +[patch.crates-io] +monero = { git = "https://github.com/comit-network/monero-rs", rev = "818f38b" } diff --git a/dprint.json b/dprint.json index 5e4931b2..c73d9690 100644 --- a/dprint.json +++ b/dprint.json @@ -4,10 +4,22 @@ "incremental": true, "markdown": { }, - "includes": ["**/*.{md}", "**/*.{toml}"], - "excludes": [ ], + "rustfmt": { + "edition": 2018, + "condense_wildcard_suffixes": true, + "format_macro_matchers": true, + "imports_granularity" : "Module", + "use_field_init_shorthand": true, + "format_code_in_doc_comments": true, + "normalize_comments": true, + "wrap_comments": true, + "overflow_delimited_expr": true + }, + "includes": ["**/*.{md}", "**/*.{toml}", "**/*.{rs}"], + "excludes": [ "target/" ], "plugins": [ "https://plugins.dprint.dev/markdown-0.6.1.wasm", - "https://github.com/thomaseizinger/dprint-plugin-cargo-toml/releases/download/0.1.0/cargo-toml-0.1.0.wasm" + "https://github.com/thomaseizinger/dprint-plugin-cargo-toml/releases/download/0.1.0/cargo-toml-0.1.0.wasm", + "https://plugins.dprint.dev/rustfmt-0.4.0.exe-plugin@c6bb223ef6e5e87580177f6461a0ab0554ac9ea6b54f78ea7ae8bf63b14f5bc2" ] } diff --git a/rust-toolchain b/rust-toolchain deleted file mode 100644 index 6a154529..00000000 --- a/rust-toolchain +++ /dev/null @@ -1,4 +0,0 @@ -[toolchain] -channel = "nightly-2021-01-31" -components = ["rustfmt", "clippy"] -targets = ["armv7-unknown-linux-gnueabihf"] diff --git a/rust-toolchain.toml b/rust-toolchain.toml new file mode 100644 index 00000000..242a73de --- /dev/null +++ b/rust-toolchain.toml @@ -0,0 +1,4 @@ +[toolchain] +channel = "1.52" +components = ["clippy"] +targets = ["armv7-unknown-linux-gnueabihf"] diff --git a/rustfmt.toml b/rustfmt.toml deleted file mode 100644 index 6e3e8004..00000000 --- a/rustfmt.toml +++ /dev/null @@ -1,12 +0,0 @@ -edition = "2018" -condense_wildcard_suffixes = true -format_macro_matchers = true -imports_granularity = "Module" -use_field_init_shorthand = true -format_code_in_doc_comments = true -normalize_comments = true -wrap_comments = true -overflow_delimited_expr = true -ignore = [ - "tokio-tar" -] diff --git a/swap/Cargo.toml b/swap/Cargo.toml index 3747cf67..80dca924 100644 --- a/swap/Cargo.toml +++ b/swap/Cargo.toml @@ -21,11 +21,11 @@ bitcoin = { version = "0.26", features = [ "rand", "use-serde" ] } bmrng = "0.5" config = { version = "0.11", default-features = false, features = [ "toml" ] } conquer-once = "0.3" -curve25519-dalek = "3" +curve25519-dalek = { package = "curve25519-dalek-ng", version = "4" } data-encoding = "2.3" dialoguer = "0.8" directories-next = "2" -ecdsa_fun = { git = "https://github.com/LLFourn/secp256kfun", features = [ "libsecp_compat", "serde" ] } +ecdsa_fun = { git = "https://github.com/LLFourn/secp256kfun", default-features = false, features = [ "libsecp_compat", "serde" ] } ed25519-dalek = "1" futures = { version = "0.3", default-features = false } itertools = "0.10" @@ -37,8 +37,8 @@ monero-rpc = { path = "../monero-rpc" } pem = "0.8" prettytable-rs = "0.8" proptest = "1" -rand = "0.7" -rand_chacha = "0.2" +rand = "0.8" +rand_chacha = "0.3" reqwest = { version = "0.11", features = [ "rustls-tls", "stream", "socks" ], default-features = false } rust_decimal = { version = "1", features = [ "serde-float" ] } rust_decimal_macros = "1" @@ -46,7 +46,7 @@ serde = { version = "1", features = [ "derive" ] } serde_cbor = "0.11" serde_json = "1" sha2 = "0.9" -sigma_fun = { git = "https://github.com/LLFourn/secp256kfun", features = [ "ed25519", "serde" ] } +sigma_fun = { git = "https://github.com/LLFourn/secp256kfun", default-features = false, features = [ "ed25519", "serde" ] } sled = "0.34" structopt = "0.3" strum = { version = "0.20", features = [ "derive" ] } diff --git a/swap/src/bin/asb.rs b/swap/src/bin/asb.rs index 019ae16c..0dde5f46 100644 --- a/swap/src/bin/asb.rs +++ b/swap/src/bin/asb.rs @@ -353,7 +353,7 @@ async fn register_tor_services( } }) }) - .filter_map(|details| details) + .flatten() .collect::>(); let key = seed.derive_torv3_key(); diff --git a/swap/src/bitcoin/timelocks.rs b/swap/src/bitcoin/timelocks.rs index ab365df8..04f589a9 100644 --- a/swap/src/bitcoin/timelocks.rs +++ b/swap/src/bitcoin/timelocks.rs @@ -17,18 +17,6 @@ impl From for u32 { } } -impl BlockHeight { - pub const fn new(block_height: u32) -> Self { - Self(block_height) - } - pub const fn checked_sub(self, rhs: Self) -> Option { - match self.0.checked_sub(rhs.0) { - Some(result) => Some(BlockHeight(result)), - None => None, - } - } -} - impl TryFrom for BlockHeight { type Error = anyhow::Error; diff --git a/swap/src/protocol/alice/state.rs b/swap/src/protocol/alice/state.rs index e8150cc7..17522a76 100644 --- a/swap/src/protocol/alice/state.rs +++ b/swap/src/protocol/alice/state.rs @@ -314,8 +314,8 @@ impl State2 { let tx_cancel_sig = self.a.sign(tx_cancel.digest()); Message3 { - tx_refund_encsig, tx_cancel_sig, + tx_refund_encsig, } }