From 6e8a5f9cb17fb6d5b66515120b71cb883923b40b Mon Sep 17 00:00:00 2001 From: Luke Parker Date: Sun, 3 Dec 2023 00:04:59 -0500 Subject: [PATCH] cargo update, remove unneeded dependencies from the processor --- Cargo.lock | 76 ++++++++++----------- coordinator/tributary/tendermint/Cargo.toml | 4 +- processor/Cargo.toml | 3 - processor/messages/Cargo.toml | 2 +- processor/src/networks/bitcoin.rs | 15 ++-- processor/src/tests/mod.rs | 21 +++--- 6 files changed, 60 insertions(+), 61 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 8937c439f..615e238bc 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -282,9 +282,9 @@ dependencies = [ [[package]] name = "async-lock" -version = "3.1.2" +version = "3.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dea8b3453dd7cc96711834b75400d671b73e3656975fa68d9f277163b7f7e316" +checksum = "7125e42787d53db9dd54261812ef17e937c95a51e4d291373b670342fa44310c" dependencies = [ "event-listener 4.0.0", "event-listener-strategy", @@ -939,9 +939,9 @@ dependencies = [ [[package]] name = "clap" -version = "4.4.9" +version = "4.4.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "46ca43acc1b21c6cc2d1d3129c19e323a613935b5bc28fb3b33b5b2e5fb00030" +checksum = "41fffed7514f420abec6d183b1d3acfd9099c79c3a10a06ade4f8203f1411272" dependencies = [ "clap_builder", "clap_derive", @@ -995,9 +995,9 @@ checksum = "acbf1af155f9b9ef647e42cdc158db4b64a1b61f743629225fde6f3e0be2a7c7" [[package]] name = "concurrent-queue" -version = "2.3.0" +version = "2.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f057a694a54f12365049b0958a1685bb52d567f5593b355fbf685838e873d400" +checksum = "d16048cd947b08fa32c24458a22f5dc5e835264f689f4f5653210c69fd107363" dependencies = [ "crossbeam-utils", ] @@ -1048,9 +1048,9 @@ checksum = "f7144d30dcf0fafbce74250a3963025d8d52177934239851c917d29f1df280c2" [[package]] name = "core-foundation" -version = "0.9.3" +version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "194a7a9e6de53fa55116934067c844d9d749312f75c6f6d0980e8c252f8c2146" +checksum = "91e195e091a93c46f7102ec7818a2aa394e1e1771c3ab4825963fa03e45afb8f" dependencies = [ "core-foundation-sys", "libc", @@ -1058,9 +1058,9 @@ dependencies = [ [[package]] name = "core-foundation-sys" -version = "0.8.4" +version = "0.8.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e496a50fda8aacccc86d7529e2c1e0892dbd0f898a6b5645b5561b89c3210efa" +checksum = "06ea2b9bc92be3c2baa9334a323ebca2d6f074ff852cd1d7b11064035cd3868f" [[package]] name = "core2" @@ -1437,9 +1437,9 @@ dependencies = [ [[package]] name = "deranged" -version = "0.3.9" +version = "0.3.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f32d04922c60427da6f9fef14d042d9edddef64cb9d4ce0d64d0685fbeb1fd3" +checksum = "8eb30d70a07a3b04884d2677f06bec33509dc67ca60d92949e5535352d3191dc" dependencies = [ "powerfmt", "serde", @@ -2507,9 +2507,9 @@ checksum = "8bf34a163b5c4c52d0478a4d757da8fb65cabef42ba90515efee0f6f9fa45aaa" [[package]] name = "futures-lite" -version = "2.0.1" +version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3831c2651acb5177cbd83943f3d9c8912c5ad03c76afcc0e9511ba568ec5ebb" +checksum = "aeee267a1883f7ebef3700f262d2d54de95dfaf38189015a74fdc4e0c7ad8143" dependencies = [ "futures-core", "pin-project-lite 0.2.13", @@ -3955,9 +3955,9 @@ dependencies = [ [[package]] name = "linux-raw-sys" -version = "0.4.11" +version = "0.4.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "969488b55f8ac402214f3f5fd243ebb7206cf82de60d3172994707a4bcc2b829" +checksum = "c4cd1a83af159aa67994778be9070f0ae1bd732942279cabb14f86f986a21456" [[package]] name = "lock_api" @@ -4995,9 +4995,9 @@ dependencies = [ [[package]] name = "parity-scale-codec" -version = "3.6.5" +version = "3.6.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0dec8a8073036902368c2cdc0387e85ff9a37054d7e7c98e592145e0c92cd4fb" +checksum = "881331e34fa842a2fb61cc2db9643a8fedc615e47cfcc52597d1af0db9a7e8fe" dependencies = [ "arrayvec", "bitvec", @@ -5010,11 +5010,11 @@ dependencies = [ [[package]] name = "parity-scale-codec-derive" -version = "3.6.5" +version = "3.6.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "312270ee71e1cd70289dacf597cab7b207aa107d2f28191c2ae45b2ece18a260" +checksum = "be30eaf4b0a9fba5336683b38de57bb86d179a35862ba6bfcf57625d006bde5b" dependencies = [ - "proc-macro-crate 1.3.1", + "proc-macro-crate 2.0.0", "proc-macro2", "quote", "syn 1.0.109", @@ -5901,9 +5901,9 @@ dependencies = [ [[package]] name = "ring" -version = "0.17.5" +version = "0.17.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fb0205304757e5d899b9c2e448b867ffd03ae7f988002e47cd24954391394d0b" +checksum = "684d5e6e18f669ccebf64a92236bb7db9a34f07be010e3627368182027180866" dependencies = [ "cc", "getrandom", @@ -6046,7 +6046,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "629648aced5775d558af50b2b4c7b02983a04b312126d45eeead26e7caa498b9" dependencies = [ "log", - "ring 0.17.5", + "ring 0.17.6", "rustls-webpki", "sct", ] @@ -6078,7 +6078,7 @@ version = "0.101.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8b6275d1ee7a1cd780b64aca7726599a1dbc893b1e64144529e55c3c2f745765" dependencies = [ - "ring 0.17.5", + "ring 0.17.6", "untrusted 0.9.0", ] @@ -7152,7 +7152,7 @@ version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "da046153aa2352493d6cb7da4b6e5c0c057d8a1d0a9aa8560baffdd945acd414" dependencies = [ - "ring 0.17.5", + "ring 0.17.6", "untrusted 0.9.0", ] @@ -7579,13 +7579,11 @@ dependencies = [ "env_logger", "flexible-transcript", "frost-schnorrkel", - "futures", "hex", "k256", "log", "modular-frost", "monero-serai", - "once_cell", "parity-scale-codec", "rand_chacha", "rand_core", @@ -7991,7 +7989,7 @@ dependencies = [ "chacha20poly1305", "curve25519-dalek", "rand_core", - "ring 0.17.5", + "ring 0.17.6", "rustc_version", "sha2", "subtle", @@ -8650,9 +8648,9 @@ checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67" [[package]] name = "spki" -version = "0.7.2" +version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d1e996ef02c474957d681f1b05213dfb0abab947b446a62d37770b23500184a" +checksum = "d91ed6c858b01f942cd56b37a94b3e0a1798290327d1236e4d9cf4eaca44d29d" dependencies = [ "base64ct", "der", @@ -10040,9 +10038,9 @@ dependencies = [ [[package]] name = "web-sys" -version = "0.3.65" +version = "0.3.66" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5db499c5f66323272151db0e666cd34f78617522fb0c1604d31a27c50c206a85" +checksum = "50c24a44ec86bb68fbecd1b3efed7e85ea5621b39b35ef2766b66cd984f8010f" dependencies = [ "js-sys", "wasm-bindgen", @@ -10300,9 +10298,9 @@ dependencies = [ [[package]] name = "yamux" -version = "0.12.0" +version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0329ef377816896f014435162bb3711ea7a07729c23d0960e6f8048b21b8fe91" +checksum = "9ed0164ae619f2dc144909a9f082187ebb5893693d8c0196e8085283ccd4b776" dependencies = [ "futures", "log", @@ -10331,18 +10329,18 @@ dependencies = [ [[package]] name = "zerocopy" -version = "0.7.26" +version = "0.7.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e97e415490559a91254a2979b4829267a57d2fcd741a98eee8b722fb57289aa0" +checksum = "7d6f15f7ade05d2a4935e34a457b936c23dc70a05cc1d97133dc99e7a3fe0f0e" dependencies = [ "zerocopy-derive", ] [[package]] name = "zerocopy-derive" -version = "0.7.26" +version = "0.7.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd7e48ccf166952882ca8bd778a43502c64f33bf94c12ebe2a7f08e5a0f6689f" +checksum = "dbbad221e3f78500350ecbd7dfa4e63ef945c05f4c61cb7f4d3f84cd0bba649b" dependencies = [ "proc-macro2", "quote", diff --git a/coordinator/tributary/tendermint/Cargo.toml b/coordinator/tributary/tendermint/Cargo.toml index 652e10d8c..00578938b 100644 --- a/coordinator/tributary/tendermint/Cargo.toml +++ b/coordinator/tributary/tendermint/Cargo.toml @@ -17,7 +17,7 @@ log = { version = "0.4", default-features = false, features = ["std"] } parity-scale-codec = { version = "3", default-features = false, features = ["std", "derive"] } futures = { version = "0.3", default-features = false, features = ["std", "async-await"] } -tokio = { version = "1", default-features = false, features = ["sync", "time"] } +tokio = { version = "1", default-features = false, features = ["time"] } [dev-dependencies] -tokio = { version = "1", features = ["rt-multi-thread", "macros"] } +tokio = { version = "1", features = ["sync", "rt-multi-thread", "macros"] } diff --git a/processor/Cargo.toml b/processor/Cargo.toml index 33e910465..6bcb37b12 100644 --- a/processor/Cargo.toml +++ b/processor/Cargo.toml @@ -16,7 +16,6 @@ rustdoc-args = ["--cfg", "docsrs"] [dependencies] # Macros async-trait = { version = "0.1", default-features = false } -once_cell = { version = "1", default-features = false } zeroize = { version = "1", default-features = false, features = ["std"] } thiserror = { version = "1", default-features = false } serde = { version = "1", default-features = false, features = ["std", "derive"] } @@ -62,8 +61,6 @@ messages = { package = "serai-processor-messages", path = "./messages", optional message-queue = { package = "serai-message-queue", path = "../message-queue", optional = true } [dev-dependencies] -futures = { version = "0.3", default-features = false } - frost = { package = "modular-frost", path = "../crypto/frost", features = ["tests"] } sp-application-crypto = { git = "https://github.com/serai-dex/substrate", default-features = false, features = ["std"] } diff --git a/processor/messages/Cargo.toml b/processor/messages/Cargo.toml index a3611193d..951ea974f 100644 --- a/processor/messages/Cargo.toml +++ b/processor/messages/Cargo.toml @@ -17,7 +17,7 @@ rustdoc-args = ["--cfg", "docsrs"] scale = { package = "parity-scale-codec", version = "3", default-features = false, features = ["std"] } borsh = { version = "1", default-features = false, features = ["std", "derive", "de_strict_order"] } -dkg = { path = "../../crypto/dkg", default-features = false, features = ["std", "borsh", "serde"] } +dkg = { path = "../../crypto/dkg", default-features = false, features = ["std", "borsh"] } serai-primitives = { path = "../../substrate/primitives", default-features = false, features = ["std", "borsh"] } in-instructions-primitives = { package = "serai-in-instructions-primitives", path = "../../substrate/in-instructions/primitives", default-features = false, features = ["std", "borsh"] } diff --git a/processor/src/networks/bitcoin.rs b/processor/src/networks/bitcoin.rs index 6bd2d1fb7..94f2d7c3e 100644 --- a/processor/src/networks/bitcoin.rs +++ b/processor/src/networks/bitcoin.rs @@ -1,7 +1,6 @@ -use std::{time::Duration, io, collections::HashMap}; +use std::{sync::OnceLock, time::Duration, io, collections::HashMap}; use async_trait::async_trait; -use once_cell::sync::Lazy; use scale::{Encode, Decode}; @@ -297,9 +296,9 @@ impl BlockTrait for Block { } const KEY_DST: &[u8] = b"Serai Bitcoin Output Offset"; -static BRANCH_OFFSET: Lazy = Lazy::new(|| Secp256k1::hash_to_F(KEY_DST, b"branch")); -static CHANGE_OFFSET: Lazy = Lazy::new(|| Secp256k1::hash_to_F(KEY_DST, b"change")); -static FORWARD_OFFSET: Lazy = Lazy::new(|| Secp256k1::hash_to_F(KEY_DST, b"forward")); +static BRANCH_OFFSET: OnceLock = OnceLock::new(); +static CHANGE_OFFSET: OnceLock = OnceLock::new(); +static FORWARD_OFFSET: OnceLock = OnceLock::new(); // Always construct the full scanner in order to ensure there's no collisions fn scanner( @@ -321,9 +320,9 @@ fn scanner( kinds.insert(offset_ref.to_vec(), kind); }; - register(OutputType::Branch, *BRANCH_OFFSET); - register(OutputType::Change, *CHANGE_OFFSET); - register(OutputType::Forwarded, *FORWARD_OFFSET); + register(OutputType::Branch, *BRANCH_OFFSET.get_or_init(|| Secp256k1::hash_to_F(KEY_DST, b"branch"))); + register(OutputType::Change, *CHANGE_OFFSET.get_or_init(|| Secp256k1::hash_to_F(KEY_DST, b"change"))); + register(OutputType::Forwarded, *FORWARD_OFFSET.get_or_init(|| Secp256k1::hash_to_F(KEY_DST, b"forward"))); (scanner, offsets, kinds) } diff --git a/processor/src/tests/mod.rs b/processor/src/tests/mod.rs index 9a68b7bc5..2454acbbd 100644 --- a/processor/src/tests/mod.rs +++ b/processor/src/tests/mod.rs @@ -1,3 +1,5 @@ +use std::sync::OnceLock; + mod key_gen; pub(crate) use key_gen::test_key_gen; @@ -17,7 +19,10 @@ mod addresses; pub(crate) use addresses::test_addresses; // Effective Once -static INIT_LOGGER: once_cell::sync::Lazy<()> = once_cell::sync::Lazy::new(env_logger::init); +static INIT_LOGGER_CELL: OnceLock<()> = OnceLock::new(); +fn init_logger() { + *INIT_LOGGER_CELL.get_or_init(env_logger::init) +} #[macro_export] macro_rules! test_network { @@ -33,20 +38,20 @@ macro_rules! test_network { $no_deadlock_in_multisig_completed: ident, ) => { use $crate::tests::{ - INIT_LOGGER, test_key_gen, test_scanner, test_no_deadlock_in_multisig_completed, test_signer, + init_logger, test_key_gen, test_scanner, test_no_deadlock_in_multisig_completed, test_signer, test_wallet, test_addresses, }; // This doesn't interact with a node and accordingly doesn't need to be run #[tokio::test] async fn $key_gen() { - *INIT_LOGGER; + init_logger(); test_key_gen::<$N>().await; } #[test] fn $scanner() { - *INIT_LOGGER; + init_logger(); let docker = $docker(); docker.run(|ops| async move { test_scanner($network(&ops).await).await; @@ -55,7 +60,7 @@ macro_rules! test_network { #[test] fn $signer() { - *INIT_LOGGER; + init_logger(); let docker = $docker(); docker.run(|ops| async move { test_signer($network(&ops).await).await; @@ -64,7 +69,7 @@ macro_rules! test_network { #[test] fn $wallet() { - *INIT_LOGGER; + init_logger(); let docker = $docker(); docker.run(|ops| async move { test_wallet($network(&ops).await).await; @@ -73,7 +78,7 @@ macro_rules! test_network { #[test] fn $addresses() { - *INIT_LOGGER; + init_logger(); let docker = $docker(); docker.run(|ops| async move { test_addresses($network(&ops).await).await; @@ -82,7 +87,7 @@ macro_rules! test_network { #[test] fn $no_deadlock_in_multisig_completed() { - *INIT_LOGGER; + init_logger(); let docker = $docker(); docker.run(|ops| async move { test_no_deadlock_in_multisig_completed($network(&ops).await).await;