mirror of
https://github.com/serai-dex/serai.git
synced 2025-04-10 00:07:33 +00:00
Use zalloc for processor/message-queue/coordinator
An additional layer which protects us against edge cases with Zeroizing (objects which don't support it or don't miss it).
This commit is contained in:
parent
7d2c47f3d4
commit
8bd2a0fc56
7 changed files with 21 additions and 3 deletions
3
Cargo.lock
generated
3
Cargo.lock
generated
|
@ -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",
|
||||
]
|
||||
|
||||
|
|
|
@ -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" }
|
||||
|
||||
|
|
|
@ -63,6 +63,10 @@ use cosign_evaluator::CosignEvaluator;
|
|||
#[cfg(test)]
|
||||
pub mod tests;
|
||||
|
||||
#[global_allocator]
|
||||
static ALLOCATOR: zalloc::ZeroizingAlloc<std::alloc::System> =
|
||||
zalloc::ZeroizingAlloc(std::alloc::System);
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct ActiveTributary<D: Db, P: P2p> {
|
||||
pub spec: TributarySpec,
|
||||
|
|
|
@ -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" }
|
||||
|
|
|
@ -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<std::alloc::System> =
|
||||
zalloc::ZeroizingAlloc(std::alloc::System);
|
||||
|
||||
// queue RPC method
|
||||
/*
|
||||
Queues a message to be delivered from a processor to a coordinator, or vice versa.
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -61,6 +61,10 @@ use multisigs::{MultisigEvent, MultisigManager};
|
|||
#[cfg(test)]
|
||||
mod tests;
|
||||
|
||||
#[global_allocator]
|
||||
static ALLOCATOR: zalloc::ZeroizingAlloc<std::alloc::System> =
|
||||
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.
|
||||
|
|
Loading…
Reference in a new issue