diff --git a/Cargo.lock b/Cargo.lock index e60bcf81..07ade92c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -7344,6 +7344,7 @@ dependencies = [ "sp-runtime", "tokio", "tributary-chain", + "zalloc", "zeroize", ] @@ -7486,6 +7487,7 @@ dependencies = [ "serai-env", "serai-primitives", "tokio", + "zalloc", "zeroize", ] @@ -7607,6 +7609,7 @@ dependencies = [ "sp-application-crypto", "thiserror", "tokio", + "zalloc", "zeroize", ] diff --git a/coordinator/Cargo.toml b/coordinator/Cargo.toml index c049360b..12f8e763 100644 --- a/coordinator/Cargo.toml +++ b/coordinator/Cargo.toml @@ -32,6 +32,7 @@ frost-schnorrkel = { path = "../crypto/schnorrkel" } scale = { package = "parity-scale-codec", version = "3", default-features = false, features = ["std", "derive"] } +zalloc = { path = "../common/zalloc" } serai-db = { path = "../common/db" } serai-env = { path = "../common/env" } diff --git a/coordinator/src/main.rs b/coordinator/src/main.rs index b3599024..d0f38741 100644 --- a/coordinator/src/main.rs +++ b/coordinator/src/main.rs @@ -63,6 +63,10 @@ use cosign_evaluator::CosignEvaluator; #[cfg(test)] pub mod tests; +#[global_allocator] +static ALLOCATOR: zalloc::ZeroizingAlloc = + zalloc::ZeroizingAlloc(std::alloc::System); + #[derive(Clone)] pub struct ActiveTributary { pub spec: TributarySpec, diff --git a/message-queue/Cargo.toml b/message-queue/Cargo.toml index 95970163..9eeaa5ce 100644 --- a/message-queue/Cargo.toml +++ b/message-queue/Cargo.toml @@ -40,6 +40,7 @@ env_logger = { version = "0.10", default-features = false, features = ["humantim # Uses a single threaded runtime since this shouldn't ever be CPU-bound tokio = { version = "1", default-features = false, features = ["rt", "time", "io-util", "net", "macros"] } +zalloc = { path = "../common/zalloc" } serai-db = { path = "../common/db", optional = true } serai-env = { path = "../common/env" } diff --git a/message-queue/src/main.rs b/message-queue/src/main.rs index 754528af..c43cc3c8 100644 --- a/message-queue/src/main.rs +++ b/message-queue/src/main.rs @@ -1,6 +1,3 @@ -mod messages; -mod queue; - pub(crate) use std::{ sync::{Arc, RwLock}, collections::HashMap, @@ -38,6 +35,13 @@ mod clippy { } pub(crate) use self::clippy::*; +mod messages; +mod queue; + +#[global_allocator] +static ALLOCATOR: zalloc::ZeroizingAlloc = + zalloc::ZeroizingAlloc(std::alloc::System); + // queue RPC method /* Queues a message to be delivered from a processor to a coordinator, or vice versa. diff --git a/processor/Cargo.toml b/processor/Cargo.toml index e3c28477..a213b983 100644 --- a/processor/Cargo.toml +++ b/processor/Cargo.toml @@ -54,6 +54,7 @@ log = { version = "0.4", default-features = false, features = ["std"] } env_logger = { version = "0.10", default-features = false, features = ["humantime"], optional = true } tokio = { version = "1", default-features = false, features = ["rt-multi-thread", "sync", "time", "macros"] } +zalloc = { path = "../common/zalloc" } serai-db = { path = "../common/db", optional = true } serai-env = { path = "../common/env", optional = true } # TODO: Replace with direct usage of primitives diff --git a/processor/src/main.rs b/processor/src/main.rs index 7eb0fcd7..f673169b 100644 --- a/processor/src/main.rs +++ b/processor/src/main.rs @@ -61,6 +61,10 @@ use multisigs::{MultisigEvent, MultisigManager}; #[cfg(test)] mod tests; +#[global_allocator] +static ALLOCATOR: zalloc::ZeroizingAlloc = + zalloc::ZeroizingAlloc(std::alloc::System); + // Items which are mutably borrowed by Tributary. // Any exceptions to this have to be carefully monitored in order to ensure consistency isn't // violated.