Skip to content

Commit

Permalink
cargo update, remove unneeded dependencies from the processor
Browse files Browse the repository at this point in the history
  • Loading branch information
kayabaNerve committed Dec 3, 2023
1 parent 4446a36 commit 6e8a5f9
Show file tree
Hide file tree
Showing 6 changed files with 60 additions and 61 deletions.
76 changes: 37 additions & 39 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions coordinator/tributary/tendermint/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"] }
3 changes: 0 additions & 3 deletions processor/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"] }
Expand Down Expand Up @@ -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"] }
Expand Down
2 changes: 1 addition & 1 deletion processor/messages/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"] }
Expand Down
15 changes: 7 additions & 8 deletions processor/src/networks/bitcoin.rs
Original file line number Diff line number Diff line change
@@ -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};

Expand Down Expand Up @@ -297,9 +296,9 @@ impl BlockTrait<Bitcoin> for Block {
}

const KEY_DST: &[u8] = b"Serai Bitcoin Output Offset";
static BRANCH_OFFSET: Lazy<Scalar> = Lazy::new(|| Secp256k1::hash_to_F(KEY_DST, b"branch"));
static CHANGE_OFFSET: Lazy<Scalar> = Lazy::new(|| Secp256k1::hash_to_F(KEY_DST, b"change"));
static FORWARD_OFFSET: Lazy<Scalar> = Lazy::new(|| Secp256k1::hash_to_F(KEY_DST, b"forward"));
static BRANCH_OFFSET: OnceLock<Scalar> = OnceLock::new();
static CHANGE_OFFSET: OnceLock<Scalar> = OnceLock::new();
static FORWARD_OFFSET: OnceLock<Scalar> = OnceLock::new();

// Always construct the full scanner in order to ensure there's no collisions
fn scanner(
Expand All @@ -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)
}
Expand Down
21 changes: 13 additions & 8 deletions processor/src/tests/mod.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
use std::sync::OnceLock;

mod key_gen;
pub(crate) use key_gen::test_key_gen;

Expand All @@ -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 {
Expand All @@ -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;
Expand All @@ -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;
Expand All @@ -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;
Expand All @@ -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;
Expand All @@ -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;
Expand Down

0 comments on commit 6e8a5f9

Please sign in to comment.