diff --git a/Cargo.lock b/Cargo.lock index a93e1dc9..95df1016 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -7526,6 +7526,7 @@ dependencies = [ "serai-docker-tests", "serai-runtime", "sp-core", + "sp-runtime", "subxt", "thiserror", "tokio", diff --git a/message-queue/Cargo.toml b/message-queue/Cargo.toml index 489c256d..5d228526 100644 --- a/message-queue/Cargo.toml +++ b/message-queue/Cargo.toml @@ -39,7 +39,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", "macros"] } -serai-db = { path = "../common/db", optional = true } +serai-db = { path = "../common/db", features = ["rocksdb"], optional = true } serai-env = { path = "../common/env" } @@ -49,4 +49,4 @@ jsonrpsee = { version = "0.16", default-features = false, features = ["server"], simple-request = { path = "../common/request", default-features = false } [features] -binaries = ["serai-db", "serai-db/rocksdb", "jsonrpsee"] +binaries = ["serai-db", "jsonrpsee"] diff --git a/orchestration/processor/bitcoin/Dockerfile b/orchestration/processor/bitcoin/Dockerfile index 31fb5721..0d06f07f 100644 --- a/orchestration/processor/bitcoin/Dockerfile +++ b/orchestration/processor/bitcoin/Dockerfile @@ -46,7 +46,7 @@ RUN --mount=type=cache,target=/root/.cargo \ --mount=type=cache,target=/usr/local/cargo/git \ --mount=type=cache,target=/serai/target \ mkdir /serai/bin && \ - cargo build --release --features bitcoin -p serai-processor && \ + cargo build --release --features "binaries bitcoin" -p serai-processor && \ mv /serai/target/release/serai-processor /serai/bin FROM debian:bookworm-slim as image diff --git a/orchestration/processor/bitcoin/Dockerfile.processor.bitcoin b/orchestration/processor/bitcoin/Dockerfile.processor.bitcoin index a3156aa4..36393e0a 100644 --- a/orchestration/processor/bitcoin/Dockerfile.processor.bitcoin +++ b/orchestration/processor/bitcoin/Dockerfile.processor.bitcoin @@ -1,2 +1,2 @@ - cargo build --release --features bitcoin -p serai-processor && \ + cargo build --release --features "binaries bitcoin" -p serai-processor && \ mv /serai/target/release/serai-processor /serai/bin diff --git a/orchestration/processor/monero/Dockerfile b/orchestration/processor/monero/Dockerfile index 038ccb76..1f33967f 100644 --- a/orchestration/processor/monero/Dockerfile +++ b/orchestration/processor/monero/Dockerfile @@ -46,7 +46,7 @@ RUN --mount=type=cache,target=/root/.cargo \ --mount=type=cache,target=/usr/local/cargo/git \ --mount=type=cache,target=/serai/target \ mkdir /serai/bin && \ - cargo build --release --features monero -p serai-processor && \ + cargo build --release --features "binaries monero" -p serai-processor && \ mv /serai/target/release/serai-processor /serai/bin FROM debian:bookworm-slim as image diff --git a/orchestration/processor/monero/Dockerfile.processor.monero b/orchestration/processor/monero/Dockerfile.processor.monero index 233726a9..f11f50bb 100644 --- a/orchestration/processor/monero/Dockerfile.processor.monero +++ b/orchestration/processor/monero/Dockerfile.processor.monero @@ -1,2 +1,2 @@ - cargo build --release --features monero -p serai-processor && \ + cargo build --release --features "binaries monero" -p serai-processor && \ mv /serai/target/release/serai-processor /serai/bin diff --git a/processor/Cargo.toml b/processor/Cargo.toml index 43780d7e..000eedf0 100644 --- a/processor/Cargo.toml +++ b/processor/Cargo.toml @@ -49,16 +49,16 @@ monero-serai = { path = "../coins/monero", default-features = false, features = # Application log = { version = "0.4", default-features = false, features = ["std"] } -env_logger = { version = "0.10", default-features = false, features = ["humantime"] } +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"] } -serai-db = { path = "../common/db", features = ["rocksdb"] } -serai-env = { path = "../common/env" } +serai-db = { path = "../common/db", features = ["rocksdb"], optional = true } +serai-env = { path = "../common/env", optional = true } serai-client = { path = "../substrate/client", default-features = false } -messages = { package = "serai-processor-messages", path = "./messages" } +messages = { package = "serai-processor-messages", path = "./messages", optional = true } -message-queue = { package = "serai-message-queue", path = "../message-queue" } +message-queue = { package = "serai-message-queue", path = "../message-queue", optional = true } [dev-dependencies] futures = { version = "0.3", default-features = false } @@ -76,3 +76,5 @@ bitcoin = ["dep:secp256k1", "secp256k1", "bitcoin-serai", "serai-client/bitcoin" ed25519 = ["dalek-ff-group", "frost/ed25519"] monero = ["ed25519", "monero-serai", "serai-client/monero"] + +binaries = ["env_logger", "serai-db", "serai-env", "messages", "message-queue"] diff --git a/processor/messages/src/lib.rs b/processor/messages/src/lib.rs index 59eb3c4e..8f01a3d6 100644 --- a/processor/messages/src/lib.rs +++ b/processor/messages/src/lib.rs @@ -12,9 +12,7 @@ use in_instructions_primitives::{Batch, SignedBatch}; use coins_primitives::OutInstructionWithBalance; use validator_sets_primitives::{ValidatorSet, KeyPair}; -#[derive( - Clone, Copy, PartialEq, Eq, Debug, Zeroize, Encode, Decode, BorshSerialize, BorshDeserialize, -)] +#[derive(Clone, Copy, PartialEq, Eq, Debug, Zeroize, BorshSerialize, BorshDeserialize)] pub struct SubstrateContext { pub serai_time: u64, pub network_latest_finalized_block: BlockHash, @@ -239,9 +237,7 @@ pub mod coordinator { } } - #[derive( - Clone, PartialEq, Eq, Debug, Zeroize, Encode, Decode, BorshSerialize, BorshDeserialize, - )] + #[derive(Clone, PartialEq, Eq, Debug, Zeroize, BorshSerialize, BorshDeserialize)] pub struct PlanMeta { pub key: Vec, pub id: [u8; 32], @@ -261,7 +257,7 @@ pub mod coordinator { pub mod substrate { use super::*; - #[derive(Clone, PartialEq, Eq, Debug, Encode, Decode, BorshSerialize, BorshDeserialize)] + #[derive(Clone, PartialEq, Eq, Debug, BorshSerialize, BorshDeserialize)] pub enum CoordinatorMessage { ConfirmKeyPair { context: SubstrateContext, @@ -287,9 +283,7 @@ pub mod substrate { } } - #[derive( - Clone, PartialEq, Eq, Debug, Zeroize, Encode, Decode, BorshSerialize, BorshDeserialize, - )] + #[derive(Clone, PartialEq, Eq, Debug, Zeroize, BorshSerialize, BorshDeserialize)] pub enum ProcessorMessage { Batch { batch: Batch }, SignedBatch { batch: SignedBatch }, diff --git a/substrate/client/Cargo.toml b/substrate/client/Cargo.toml index d47be773..3208470b 100644 --- a/substrate/client/Cargo.toml +++ b/substrate/client/Cargo.toml @@ -23,9 +23,10 @@ hex = "0.4" scale = { package = "parity-scale-codec", version = "3" } scale-info = { version = "2", optional = true } +sp-core = { git = "https://github.com/serai-dex/substrate" } +sp-runtime = { git = "https://github.com/serai-dex/substrate" } serai-runtime = { path = "../runtime", version = "0.1" } -sp-core = { git = "https://github.com/serai-dex/substrate" } subxt = { version = "0.29", default-features = false, features = ["jsonrpsee-ws"], optional = true } bitcoin = { version = "0.31", optional = true } diff --git a/substrate/client/src/serai/mod.rs b/substrate/client/src/serai/mod.rs index 432f4722..320569f2 100644 --- a/substrate/client/src/serai/mod.rs +++ b/substrate/client/src/serai/mod.rs @@ -168,15 +168,14 @@ impl Serai { const TX_VERSION: u32 = 1; const EXTRINSIC_FORMAT_VERSION: u8 = 4; - let era = subxt::config::substrate::Era::Immortal; + let era = sp_runtime::generic::Era::Immortal; let extra = (era, Compact(nonce), tip); let genesis = self.0.genesis_hash(); let mortality_checkpoint = genesis; let mut signature_payload = (call, extra, SPEC_VERSION, TX_VERSION, genesis, mortality_checkpoint).encode(); if signature_payload.len() > 256 { - use subxt::config::Hasher; - signature_payload = BlakeTwo256::hash(&signature_payload).0.to_vec(); + signature_payload = sp_core::blake2_256(&signature_payload).to_vec(); } let signature = signer.sign(&signature_payload); diff --git a/substrate/coins/primitives/Cargo.toml b/substrate/coins/primitives/Cargo.toml index af483fba..8117bb8b 100644 --- a/substrate/coins/primitives/Cargo.toml +++ b/substrate/coins/primitives/Cargo.toml @@ -26,7 +26,7 @@ serai-primitives = { path = "../../primitives", default-features = false } sp-runtime = { git = "https://github.com/serai-dex/substrate", default-features = false } [features] -std = ["zeroize", "borsh?/std", "serde/std", "scale/std", "scale-info/std", "sp-runtime/std", "serai-primitives/std"] +std = ["zeroize", "borsh?/std", "serde?/std", "scale/std", "scale-info/std", "sp-runtime/std", "serai-primitives/std"] borsh = ["dep:borsh", "serai-primitives/borsh"] serde = ["dep:serde", "serai-primitives/serde"] default = ["std"]