From f3b91bd44f321853c38386f5ad83d64a821c636c Mon Sep 17 00:00:00 2001 From: Luke Parker Date: Fri, 16 Aug 2024 14:51:31 -0400 Subject: [PATCH] Smash key-gen into independent crate --- .github/workflows/tests.yml | 1 + Cargo.toml | 1 + deny.toml | 1 + processor/key-gen/Cargo.toml | 97 +++++++++++++++++++ processor/key-gen/LICENSE | 15 +++ .../{src/key_gen.rs => key-gen/src/lib.rs} | 0 6 files changed, 115 insertions(+) create mode 100644 processor/key-gen/Cargo.toml create mode 100644 processor/key-gen/LICENSE rename processor/{src/key_gen.rs => key-gen/src/lib.rs} (100%) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 05c25972..fabfaba9 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -39,6 +39,7 @@ jobs: GITHUB_CI=true RUST_BACKTRACE=1 cargo test --all-features \ -p serai-message-queue \ -p serai-processor-messages \ + -p serai-processor-key-gen \ -p serai-processor \ -p tendermint-machine \ -p tributary-chain \ diff --git a/Cargo.toml b/Cargo.toml index bce4ebe3..f0bdd6a8 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -70,6 +70,7 @@ members = [ "message-queue", "processor/messages", + "processor/key-gen", "processor", "coordinator/tributary/tendermint", diff --git a/deny.toml b/deny.toml index e5c72f0c..0d82cb8a 100644 --- a/deny.toml +++ b/deny.toml @@ -46,6 +46,7 @@ exceptions = [ { allow = ["AGPL-3.0"], name = "serai-message-queue" }, { allow = ["AGPL-3.0"], name = "serai-processor-messages" }, + { allow = ["AGPL-3.0"], name = "serai-processor-key-gen" }, { allow = ["AGPL-3.0"], name = "serai-processor" }, { allow = ["AGPL-3.0"], name = "tributary-chain" }, diff --git a/processor/key-gen/Cargo.toml b/processor/key-gen/Cargo.toml new file mode 100644 index 00000000..ed6e7383 --- /dev/null +++ b/processor/key-gen/Cargo.toml @@ -0,0 +1,97 @@ +[package] +name = "serai-processor-key-gen" +version = "0.1.0" +description = "Key generation for the Serai processor" +license = "AGPL-3.0-only" +repository = "https://github.com/serai-dex/serai/tree/develop/processor/key-gen" +authors = ["Luke Parker "] +keywords = [] +edition = "2021" +publish = false + +[package.metadata.docs.rs] +all-features = true +rustdoc-args = ["--cfg", "docsrs"] + +[lints] +workspace = true + +[dependencies] +# Macros +async-trait = { version = "0.1", default-features = false } +zeroize = { version = "1", default-features = false, features = ["std"] } +thiserror = { version = "1", default-features = false } + +# Libs +rand_core = { version = "0.6", default-features = false, features = ["std", "getrandom"] } +rand_chacha = { version = "0.3", default-features = false, features = ["std"] } + +# Encoders +const-hex = { version = "1", default-features = false } +hex = { version = "0.4", default-features = false, features = ["std"] } +scale = { package = "parity-scale-codec", version = "3", default-features = false, features = ["std"] } +borsh = { version = "1", default-features = false, features = ["std", "derive", "de_strict_order"] } +serde_json = { version = "1", default-features = false, features = ["std"] } + +# Cryptography +ciphersuite = { path = "../crypto/ciphersuite", default-features = false, features = ["std", "ristretto"] } + +blake2 = { version = "0.10", default-features = false, features = ["std"] } +transcript = { package = "flexible-transcript", path = "../crypto/transcript", default-features = false, features = ["std"] } +ec-divisors = { package = "ec-divisors", path = "../crypto/evrf/divisors", default-features = false } +dkg = { package = "dkg", path = "../crypto/dkg", default-features = false, features = ["std", "evrf-ristretto"] } +frost = { package = "modular-frost", path = "../crypto/frost", default-features = false, features = ["ristretto"] } +frost-schnorrkel = { path = "../crypto/schnorrkel", default-features = false } + +# Bitcoin/Ethereum +k256 = { version = "^0.13.1", default-features = false, features = ["std"], optional = true } + +# Bitcoin +secp256k1 = { version = "0.29", default-features = false, features = ["std", "global-context", "rand-std"], optional = true } +bitcoin-serai = { path = "../networks/bitcoin", default-features = false, features = ["std"], optional = true } + +# Ethereum +ethereum-serai = { path = "../networks/ethereum", default-features = false, optional = true } + +# Monero +dalek-ff-group = { path = "../crypto/dalek-ff-group", default-features = false, features = ["std"], optional = true } +monero-simple-request-rpc = { path = "../networks/monero/rpc/simple-request", default-features = false, optional = true } +monero-wallet = { path = "../networks/monero/wallet", default-features = false, features = ["std", "multisig", "compile-time-generators"], optional = true } + +# Application +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" } +serai-env = { path = "../common/env", optional = true } +# TODO: Replace with direct usage of primitives +serai-client = { path = "../substrate/client", default-features = false, features = ["serai"] } + +messages = { package = "serai-processor-messages", path = "./messages" } + +message-queue = { package = "serai-message-queue", path = "../message-queue", optional = true } + +[dev-dependencies] +frost = { package = "modular-frost", path = "../crypto/frost", features = ["tests"] } + +sp-application-crypto = { git = "https://github.com/serai-dex/substrate", default-features = false, features = ["std"] } + +ethereum-serai = { path = "../networks/ethereum", default-features = false, features = ["tests"] } + +dockertest = "0.4" +serai-docker-tests = { path = "../tests/docker" } + +[features] +secp256k1 = ["k256", "dkg/evrf-secp256k1", "frost/secp256k1"] +bitcoin = ["dep:secp256k1", "secp256k1", "bitcoin-serai", "serai-client/bitcoin"] + +ethereum = ["secp256k1", "ethereum-serai/tests"] + +ed25519 = ["dalek-ff-group", "dkg/evrf-ed25519", "frost/ed25519"] +monero = ["ed25519", "monero-simple-request-rpc", "monero-wallet", "serai-client/monero"] + +binaries = ["env_logger", "serai-env", "message-queue"] +parity-db = ["serai-db/parity-db"] +rocksdb = ["serai-db/rocksdb"] diff --git a/processor/key-gen/LICENSE b/processor/key-gen/LICENSE new file mode 100644 index 00000000..41d5a261 --- /dev/null +++ b/processor/key-gen/LICENSE @@ -0,0 +1,15 @@ +AGPL-3.0-only license + +Copyright (c) 2022-2024 Luke Parker + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU Affero General Public License Version 3 as +published by the Free Software Foundation. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU Affero General Public License for more details. + +You should have received a copy of the GNU Affero General Public License +along with this program. If not, see . diff --git a/processor/src/key_gen.rs b/processor/key-gen/src/lib.rs similarity index 100% rename from processor/src/key_gen.rs rename to processor/key-gen/src/lib.rs