From 04943e58435ce7cf7b9b6d349c5cbd1f262c333c Mon Sep 17 00:00:00 2001 From: Zacholme7 Date: Mon, 9 Dec 2024 22:01:36 +0000 Subject: [PATCH 1/3] newtypes --- Cargo.lock | 159 +++++++++++++----------- Cargo.toml | 5 + anchor/common/ssv_types/Cargo.toml | 11 ++ anchor/common/ssv_types/src/cluster.rs | 53 ++++++++ anchor/common/ssv_types/src/lib.rs | 7 ++ anchor/common/ssv_types/src/operator.rs | 60 +++++++++ anchor/common/ssv_types/src/share.rs | 8 ++ anchor/common/ssv_types/src/util.rs | 29 +++++ 8 files changed, 257 insertions(+), 75 deletions(-) create mode 100644 anchor/common/ssv_types/Cargo.toml create mode 100644 anchor/common/ssv_types/src/cluster.rs create mode 100644 anchor/common/ssv_types/src/lib.rs create mode 100644 anchor/common/ssv_types/src/operator.rs create mode 100644 anchor/common/ssv_types/src/share.rs create mode 100644 anchor/common/ssv_types/src/util.rs diff --git a/Cargo.lock b/Cargo.lock index 690ac517..7debfc04 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -169,9 +169,9 @@ dependencies = [ [[package]] name = "alloy-primitives" -version = "0.8.14" +version = "0.8.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9db948902dfbae96a73c2fbf1f7abec62af034ab883e4c777c3fd29702bd6e2c" +checksum = "6259a506ab13e1d658796c31e6e39d2e2ee89243bcc505ddc613b35732e0a430" dependencies = [ "alloy-rlp", "arbitrary", @@ -201,9 +201,9 @@ dependencies = [ [[package]] name = "alloy-rlp" -version = "0.3.9" +version = "0.3.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da0822426598f95e45dd1ea32a738dac057529a709ee645fcc516ffa4cbde08f" +checksum = "f542548a609dca89fcd72b3b9f355928cf844d4363c5eed9c5273a3dd225e097" dependencies = [ "alloy-rlp-derive", "arrayvec", @@ -212,9 +212,9 @@ dependencies = [ [[package]] name = "alloy-rlp-derive" -version = "0.3.9" +version = "0.3.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b09cae092c27b6f1bde952653a22708691802e57bfef4a2973b80bea21efd3f" +checksum = "5a833d97bf8a5f0f878daf2c8451fff7de7f9de38baa5a45d936ec718d81255a" dependencies = [ "proc-macro2", "quote", @@ -305,9 +305,9 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.93" +version = "1.0.94" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c95c10ba0b00a02636238b814946408b1322d5ac4760326e6fb8ec956d85775" +checksum = "c1fd03a028ef38ba2276dce7e33fcd6369c158a1bca17946c4b1b701891c1ff7" [[package]] name = "arbitrary" @@ -538,7 +538,7 @@ dependencies = [ "futures-lite", "parking", "polling", - "rustix 0.38.41", + "rustix 0.38.42", "slab", "tracing", "windows-sys 0.59.0", @@ -617,7 +617,7 @@ dependencies = [ "axum-core", "bytes", "futures-util", - "http 1.1.0", + "http 1.2.0", "http-body 1.0.1", "http-body-util", "hyper 1.5.1", @@ -650,7 +650,7 @@ dependencies = [ "async-trait", "bytes", "futures-util", - "http 1.1.0", + "http 1.2.0", "http-body 1.0.1", "http-body-util", "mime", @@ -1027,9 +1027,9 @@ dependencies = [ [[package]] name = "cc" -version = "1.2.2" +version = "1.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f34d93e62b03caf570cccc334cbc6c2fceca82f39211051345108adcba3eebdc" +checksum = "27f657647bcff5394bf56c7317665bbf790a137a50eaaa5c6bfbb9e27a518f2d" dependencies = [ "jobserver", "libc", @@ -1074,9 +1074,9 @@ dependencies = [ [[package]] name = "chrono" -version = "0.4.38" +version = "0.4.39" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a21f936df1771bf62b77f047b726c4625ff2e8aa607c01ec06e5a05bd8463401" +checksum = "7e36cc9d416881d2e24f9a963be5fb1cd90966419ac844274161d10488b3e825" dependencies = [ "android-tzdata", "iana-time-zone", @@ -1106,9 +1106,9 @@ dependencies = [ [[package]] name = "clap" -version = "4.5.21" +version = "4.5.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fb3b4b9e5a7c7514dfa52869339ee98b3156b0bfb4e8a77c4ff4babb64b1604f" +checksum = "3135e7ec2ef7b10c6ed8950f0f792ed96ee093fa088608f1c76e569722700c84" dependencies = [ "clap_builder", "clap_derive", @@ -1116,9 +1116,9 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.5.21" +version = "4.5.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b17a95aa67cc7b5ebd32aa5370189aa0d79069ef1c64ce893bd30fb24bff20ec" +checksum = "30582fc632330df2bd26877bde0c1f4470d57c582bbc070376afcd04d8cb4838" dependencies = [ "anstream", "anstyle", @@ -1141,9 +1141,9 @@ dependencies = [ [[package]] name = "clap_lex" -version = "0.7.3" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "afb84c814227b90d6895e01398aee0d8033c00e7466aca416fb6a8e0eb19d8a7" +checksum = "f46ad14479a25103f283c0f10005961cf086d8dc42205bb44c46ac563475dca6" [[package]] name = "clap_utils" @@ -2682,9 +2682,9 @@ checksum = "7360491ce676a36bf9bb3c56c1aa791658183a54d2744120f27285738d90465a" [[package]] name = "fastrand" -version = "2.2.0" +version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "486f806e73c5707928240ddc295403b1b93c96a02038563881c4a2fd84b81ac4" +checksum = "37909eebbb50d72f9059c3b6d82c0463f2ff062c9e95845c43a6c9c0355411be" [[package]] name = "fastrlp" @@ -3453,9 +3453,9 @@ dependencies = [ [[package]] name = "http" -version = "1.1.0" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "21b9ddb458710bc376481b842f5da65cdf31522de232c1ca8146abce2a358258" +checksum = "f16ca2af56261c99fba8bac40a10251ce8188205a4c448fbb745a2e4daa76fea" dependencies = [ "bytes", "fnv", @@ -3480,7 +3480,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1efedce1fb8e6913f23e0c92de8e62cd5b772a67e7b3946df930a62566c93184" dependencies = [ "bytes", - "http 1.1.0", + "http 1.2.0", ] [[package]] @@ -3491,7 +3491,7 @@ checksum = "793429d76616a256bcb62c2a2ec2bed781c8307e797e2598c50010f2bee2544f" dependencies = [ "bytes", "futures-util", - "http 1.1.0", + "http 1.2.0", "http-body 1.0.1", "pin-project-lite", ] @@ -3568,7 +3568,7 @@ dependencies = [ "bytes", "futures-channel", "futures-util", - "http 1.1.0", + "http 1.2.0", "http-body 1.0.1", "httparse", "httpdate", @@ -3613,7 +3613,7 @@ checksum = "df2dcfbe0677734ab2f3ffa7fa7bfd4706bfdc1ef393f2ee30184aed67e631b4" dependencies = [ "bytes", "futures-util", - "http 1.1.0", + "http 1.2.0", "http-body 1.0.1", "hyper 1.5.1", "pin-project-lite", @@ -4043,9 +4043,9 @@ dependencies = [ [[package]] name = "js-sys" -version = "0.3.74" +version = "0.3.76" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a865e038f7f6ed956f788f0d7d60c541fff74c7bd74272c5d4cf15c63743e705" +checksum = "6717b6b5b077764fb5966237269cb3c64edddde4b14ce42647430a78ced9e7b7" dependencies = [ "once_cell", "wasm-bindgen", @@ -4194,9 +4194,9 @@ dependencies = [ [[package]] name = "libc" -version = "0.2.167" +version = "0.2.168" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09d6582e104315a817dff97f75133544b2e094ee22447d2acf4a74e189ba06fc" +checksum = "5aaeb2981e0606ca11d79718f8bb01164f1d6ed75080182d3abf017e6d244b6d" [[package]] name = "libflate" @@ -5195,9 +5195,9 @@ dependencies = [ [[package]] name = "multihash" -version = "0.19.2" +version = "0.19.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cc41f430805af9d1cf4adae4ed2149c759b877b01d909a1f40256188d09345d2" +checksum = "6b430e7953c29dd6a09afc29ff0bb69c6e306329ee6794700aee27b76a1aea8d" dependencies = [ "core2", "unsigned-varint 0.8.0", @@ -5791,12 +5791,12 @@ checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" [[package]] name = "pest" -version = "2.7.14" +version = "2.7.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "879952a81a83930934cbf1786752d6dedc3b1f29e8f8fb2ad1d0a36f377cf442" +checksum = "8b7cafe60d6cf8e62e1b9b2ea516a089c008945bb5a275416789e7db0bc199dc" dependencies = [ "memchr", - "thiserror 1.0.69", + "thiserror 2.0.6", "ucd-trie", ] @@ -5874,7 +5874,7 @@ dependencies = [ "concurrent-queue", "hermit-abi 0.4.0", "pin-project-lite", - "rustix 0.38.41", + "rustix 0.38.42", "tracing", "windows-sys 0.59.0", ] @@ -6190,7 +6190,7 @@ dependencies = [ "rustc-hash 2.1.0", "rustls 0.23.19", "socket2 0.5.8", - "thiserror 2.0.3", + "thiserror 2.0.6", "tokio", "tracing", ] @@ -6209,7 +6209,7 @@ dependencies = [ "rustls 0.23.19", "rustls-pki-types", "slab", - "thiserror 2.0.3", + "thiserror 2.0.6", "tinyvec", "tracing", "web-time", @@ -6217,9 +6217,9 @@ dependencies = [ [[package]] name = "quinn-udp" -version = "0.5.7" +version = "0.5.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d5a626c6807713b15cac82a6acaccd6043c9a5408c24baae07611fec3f243da" +checksum = "52cd4b1eff68bf27940dd39811292c49e007f4d0b4c357358dc9b0197be6b527" dependencies = [ "cfg_aliases", "libc", @@ -6713,15 +6713,15 @@ dependencies = [ [[package]] name = "rustix" -version = "0.38.41" +version = "0.38.42" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d7f649912bc1495e167a6edee79151c84b1bad49748cb4f1f1167f459f6224f6" +checksum = "f93dc38ecbab2eb790ff964bb77fa94faf256fd3e73285fd7ba0903b76bedb85" dependencies = [ "bitflags 2.6.0", "errno", "libc", "linux-raw-sys 0.4.14", - "windows-sys 0.52.0", + "windows-sys 0.59.0", ] [[package]] @@ -7494,6 +7494,16 @@ dependencies = [ "der 0.7.9", ] +[[package]] +name = "ssv_types" +version = "0.1.0" +dependencies = [ + "base64 0.22.1", + "derive_more 1.0.0", + "openssl", + "types 0.2.1 (git+https://github.com/sigp/lighthouse?branch=unstable)", +] + [[package]] name = "ssz_types" version = "0.8.0" @@ -7790,7 +7800,7 @@ dependencies = [ "cfg-if", "fastrand", "once_cell", - "rustix 0.38.41", + "rustix 0.38.42", "windows-sys 0.59.0", ] @@ -7811,7 +7821,7 @@ version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5352447f921fda68cf61b4101566c0bdb5104eff6804d0678e5227580ab6a4e9" dependencies = [ - "rustix 0.38.41", + "rustix 0.38.42", "windows-sys 0.59.0", ] @@ -7844,11 +7854,11 @@ dependencies = [ [[package]] name = "thiserror" -version = "2.0.3" +version = "2.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c006c85c7651b3cf2ada4584faa36773bd07bac24acfb39f3c431b36d7e667aa" +checksum = "8fec2a1820ebd077e2b90c4df007bebf344cd394098a13c563957d0afc83ea47" dependencies = [ - "thiserror-impl 2.0.3", + "thiserror-impl 2.0.6", ] [[package]] @@ -7864,9 +7874,9 @@ dependencies = [ [[package]] name = "thiserror-impl" -version = "2.0.3" +version = "2.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f077553d607adc1caf65430528a576c757a71ed73944b66ebb58ef2bbd243568" +checksum = "d65750cab40f4ff1929fb1ba509e9914eb756131cef4210da8d5d700d26f6312" dependencies = [ "proc-macro2", "quote", @@ -8047,9 +8057,9 @@ dependencies = [ [[package]] name = "tokio-stream" -version = "0.1.16" +version = "0.1.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4f4e6ce100d0eb49a2734f8c0812bcd324cf357d21810932c5df6b96ef2b86f1" +checksum = "eca58d7bba4a75707817a2c44174253f9236b2d5fbd055602e9d5c07c139a047" dependencies = [ "futures-core", "pin-project-lite", @@ -8059,9 +8069,9 @@ dependencies = [ [[package]] name = "tokio-util" -version = "0.7.12" +version = "0.7.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61e7c3654c13bcd040d4a03abee2c75b1d14a37b423cf5a813ceae1cc903ec6a" +checksum = "d7fcaa8d55a2bdd6b83ace262b016eca0d79ee02818c5c1bcdf0305114081078" dependencies = [ "bytes", "futures-core", @@ -8124,7 +8134,7 @@ checksum = "403fa3b783d4b626a8ad51d766ab03cb6d2dbfc46b1c5d4448395e6628dc9697" dependencies = [ "bitflags 2.6.0", "bytes", - "http 1.1.0", + "http 1.2.0", "pin-project-lite", "tower-layer", "tower-service", @@ -8711,9 +8721,9 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "wasm-bindgen" -version = "0.2.97" +version = "0.2.99" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d15e63b4482863c109d70a7b8706c1e364eb6ea449b201a76c5b89cedcec2d5c" +checksum = "a474f6281d1d70c17ae7aa6a613c87fce69a127e2624002df63dcb39d6cf6396" dependencies = [ "cfg-if", "once_cell", @@ -8722,13 +8732,12 @@ dependencies = [ [[package]] name = "wasm-bindgen-backend" -version = "0.2.97" +version = "0.2.99" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d36ef12e3aaca16ddd3f67922bc63e48e953f126de60bd33ccc0101ef9998cd" +checksum = "5f89bb38646b4f81674e8f5c3fb81b562be1fd936d84320f3264486418519c79" dependencies = [ "bumpalo", "log", - "once_cell", "proc-macro2", "quote", "syn 2.0.90", @@ -8737,9 +8746,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-futures" -version = "0.4.47" +version = "0.4.49" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9dfaf8f50e5f293737ee323940c7d8b08a66a95a419223d9f41610ca08b0833d" +checksum = "38176d9b44ea84e9184eff0bc34cc167ed044f816accfe5922e54d84cf48eca2" dependencies = [ "cfg-if", "js-sys", @@ -8750,9 +8759,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.97" +version = "0.2.99" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "705440e08b42d3e4b36de7d66c944be628d579796b8090bfa3471478a2260051" +checksum = "2cc6181fd9a7492eef6fef1f33961e3695e4579b9872a6f7c83aee556666d4fe" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -8760,9 +8769,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.97" +version = "0.2.99" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "98c9ae5a76e46f4deecd0f0255cc223cfa18dc9b261213b8aa0c7b36f61b3f1d" +checksum = "30d7a95b763d3c45903ed6c81f156801839e5ee968bb07e534c44df0fcd330c2" dependencies = [ "proc-macro2", "quote", @@ -8773,9 +8782,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-shared" -version = "0.2.97" +version = "0.2.99" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ee99da9c5ba11bd675621338ef6fa52296b76b83305e9b6e5c77d4c286d6d49" +checksum = "943aab3fdaaa029a6e0271b35ea10b72b943135afe9bffca82384098ad0e06a6" [[package]] name = "wasm-streams" @@ -8792,9 +8801,9 @@ dependencies = [ [[package]] name = "web-sys" -version = "0.3.74" +version = "0.3.76" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a98bc3c33f0fe7e59ad7cd041b89034fa82a7c2d4365ca538dda6cdaf513863c" +checksum = "04dd7223427d52553d3702c004d3b2fe07c148165faa56313cb00211e31c12bc" dependencies = [ "js-sys", "wasm-bindgen", @@ -9200,9 +9209,9 @@ dependencies = [ [[package]] name = "xml-rs" -version = "0.8.23" +version = "0.8.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af310deaae937e48a26602b730250b4949e125f468f11e6990be3e5304ddd96f" +checksum = "ea8b391c9a790b496184c29f7f93b9ed5b16abb306c05415b68bcc16e4d06432" [[package]] name = "xmltree" diff --git a/Cargo.toml b/Cargo.toml index ed19e524..8fd1fda2 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -9,6 +9,7 @@ members = [ "anchor/network", "anchor/processor", "anchor/qbft", + "anchor/common/ssv_types", ] resolver = "2" @@ -23,6 +24,7 @@ http_metrics = { path = "anchor/http_metrics" } network = { path ="anchor/network"} version = { path ="anchor/common/version"} processor = { path = "anchor/processor" } +ssv_types = { path = "anchor/common/ssv_types" } lighthouse_network = { git = "https://github.com/sigp/lighthouse", branch = "unstable"} task_executor = { git = "https://github.com/sigp/lighthouse", branch = "unstable", default-features = false, features = [ "tracing", ] } metrics = { git = "https://github.com/agemanning/lighthouse", branch = "modularize-vc" } @@ -30,6 +32,7 @@ validator_metrics = { git = "https://github.com/agemanning/lighthouse", branch = sensitive_url = { git = "https://github.com/agemanning/lighthouse", branch = "modularize-vc" } slot_clock = { git = "https://github.com/agemanning/lighthouse", branch = "modularize-vc" } unused_port = { git = "https://github.com/sigp/lighthouse", branch = "unstable" } +types = { git = "https://github.com/sigp/lighthouse", branch = "unstable" } derive_more = { version = "1.0.0", features = ["full"] } async-channel = "1.9" axum = "0.7.7" @@ -53,6 +56,8 @@ tokio = { version = "1.39.2", features = [ ] } tracing = "0.1.40" tracing-subscriber = { version = "0.3.18", features = ["fmt", "env-filter"] } +base64 = "0.22.1" +openssl = "0.10.68" [profile.maxperf] inherits = "release" diff --git a/anchor/common/ssv_types/Cargo.toml b/anchor/common/ssv_types/Cargo.toml new file mode 100644 index 00000000..1d6b7131 --- /dev/null +++ b/anchor/common/ssv_types/Cargo.toml @@ -0,0 +1,11 @@ +[package] +name = "ssv_types" +version = "0.1.0" +edition = { workspace = true } +authors = ["Sigma Prime "] + +[dependencies] +types = { workspace = true} +openssl = { workspace = true } +derive_more = { workspace = true } +base64 = { workspace = true } diff --git a/anchor/common/ssv_types/src/cluster.rs b/anchor/common/ssv_types/src/cluster.rs new file mode 100644 index 00000000..308aee67 --- /dev/null +++ b/anchor/common/ssv_types/src/cluster.rs @@ -0,0 +1,53 @@ +use crate::OperatorId; +use crate::Share; +use derive_more::{Deref, From}; +use types::{Address, Graffiti, PublicKey}; + +/// Unique identifier for a cluster +#[derive(Clone, Copy, Debug, Default, Eq, PartialEq, Hash, From, Deref)] +pub struct ClusterId(pub u64); + +/// A Cluster is a group of Operators that are acting on behalf of a Validator +#[derive(Debug, Clone)] +pub struct Cluster { + /// Unique identifier for a Cluster + pub cluster_id: ClusterId, + /// All of the members of this Cluster + pub cluster_members: Vec, + /// The number of faulty operator in the Cluster + pub faulty: u64, + /// If the Cluster is liquidated or active + pub liquidated: bool, + /// Metadata about the validator this committee represents + pub validator_metadata: ValidatorMetadata, +} + +/// A member of a Cluster. This is just an Operator that holds onto a share of the Validator key +#[derive(Debug, Clone)] +pub struct ClusterMember { + /// Unique identifier for the Operator this member represents + pub operator_id: OperatorId, + /// Unique identifier for the Cluster this member is a part of + pub cluster_id: ClusterId, + /// The Share this member is responsible for + pub share: Share, +} + +/// Index of the validator in the validator registry. +#[derive(Clone, Copy, Debug, Default, Eq, PartialEq, Hash, From, Deref)] +pub struct ValidatorIndex(pub usize); + +/// General Metadata about a Validator +#[derive(Debug, Clone)] +pub struct ValidatorMetadata { + /// Index of the validator + pub validator_index: ValidatorIndex, + /// Public key of the validator + pub validator_pubkey: PublicKey, + /// Eth1 fee address + pub fee_recipient: Address, + /// Graffiti + pub graffiti: Graffiti, + /// The owner of the validator + pub owner: Address, +} diff --git a/anchor/common/ssv_types/src/lib.rs b/anchor/common/ssv_types/src/lib.rs new file mode 100644 index 00000000..6d25f44d --- /dev/null +++ b/anchor/common/ssv_types/src/lib.rs @@ -0,0 +1,7 @@ +pub use cluster::{Cluster, ClusterId, ClusterMember, ValidatorIndex, ValidatorMetadata}; +pub use operator::{Operator, OperatorId}; +pub use share::Share; +mod cluster; +mod operator; +mod share; +mod util; diff --git a/anchor/common/ssv_types/src/operator.rs b/anchor/common/ssv_types/src/operator.rs new file mode 100644 index 00000000..ce7f1cf5 --- /dev/null +++ b/anchor/common/ssv_types/src/operator.rs @@ -0,0 +1,60 @@ +use crate::util::parse_rsa; +use derive_more::{Deref, From}; +use openssl::pkey::Public; +use openssl::rsa::Rsa; +use std::cmp::Eq; +use std::fmt::Debug; +use std::hash::Hash; +use types::Address; + +/// Unique identifier for an Operator. +#[derive(Clone, Copy, Debug, Default, Eq, PartialEq, Hash, From, Deref)] +pub struct OperatorId(pub u64); + +/// Client responsible for maintaining the overall health of the network. +#[derive(Debug, Clone)] +pub struct Operator { + /// ID to uniquely identify this operator + pub id: OperatorId, + /// Base-64 encoded PEM RSA public key + pub rsa_pubkey: Rsa, + /// Owner of the operator + pub owner: Address, +} + +impl Operator { + /// Creates a new operator from its OperatorId and PEM-encoded public key string + pub fn new(pem_data: &str, operator_id: OperatorId, owner: Address) -> Result { + let rsa_pubkey = parse_rsa(pem_data)?; + Ok(Self::new_with_pubkey(rsa_pubkey, operator_id, owner)) + } + + // Creates a new operator from an existing RSA public key and OperatorId + pub fn new_with_pubkey(rsa_pubkey: Rsa, id: OperatorId, owner: Address) -> Self { + Self { + id, + rsa_pubkey, + owner, + } + } +} + +#[cfg(test)] +mod operator_tests { + use super::*; + + #[test] + fn operator_from_pubkey_and_id() { + // Random valid operator public key and id: https://explorer.ssv.network/operators/1141 + let pem_data = "LS0tLS1CRUdJTiBSU0EgUFVCTElDIEtFWS0tLS0tCk1JSUJJakFOQmdrcWhraUc5dzBCQVFFRkFBT0NBUThBTUlJQkNnS0NBUUVBbFFmQVIzMEd4bFpacEwrNDByU0IKTEpSYlkwY2laZDBVMXhtTlp1bFB0NzZKQXJ5d2lia0Y4SFlQV2xkM3dERVdWZXZjRzRGVVBSZ0hDM1MrTHNuMwpVVC9TS280eE9nNFlnZ0xqbVVXQysyU3ZGRFhXYVFvdFRXYW5UU0drSEllNGFnTVNEYlUzOWhSMWdOSTJhY2NNCkVCcjU2eXpWcFMvKytkSk5xU002S1FQM3RnTU5ia2IvbEtlY0piTXM0ZWNRMTNkWUQwY3dFNFQxcEdTYUdhcEkKbFNaZ2lYd0cwSGFNTm5GUkt0OFlkZjNHaTFMRlh3Zlo5NHZFRjJMLzg3RCtidjdkSFVpSGRjRnh0Vm0rVjVvawo3VFptcnpVdXB2NWhKZ3lDVE9zc0xHOW1QSGNORnhEVDJ4NUJKZ2FFOVpJYnMrWVZ5a1k3UTE4VEhRS2lWcDFaCmp3SURBUUFCCi0tLS0tRU5EIFJTQSBQVUJMSUMgS0VZLS0tLS0K"; + let operator_id = 1141; + let address = Address::random(); + + let operator = Operator::new(pem_data, operator_id.into(), address); + assert!(operator.is_ok()); + + if let Ok(op) = operator { + assert_eq!(op.id.0, operator_id); + } + } +} diff --git a/anchor/common/ssv_types/src/share.rs b/anchor/common/ssv_types/src/share.rs new file mode 100644 index 00000000..335af5ed --- /dev/null +++ b/anchor/common/ssv_types/src/share.rs @@ -0,0 +1,8 @@ +use types::PublicKey; + +/// One of N shares of a split validator key. +#[derive(Debug, Clone)] +pub struct Share { + /// The public key of this Share + pub share_pubkey: PublicKey, +} diff --git a/anchor/common/ssv_types/src/util.rs b/anchor/common/ssv_types/src/util.rs new file mode 100644 index 00000000..ef972e15 --- /dev/null +++ b/anchor/common/ssv_types/src/util.rs @@ -0,0 +1,29 @@ +use base64::prelude::*; +use openssl::pkey::Public; +use openssl::rsa::Rsa; + +// Parse from a RSA public key string into the associated RSA representation +pub fn parse_rsa(pem_data: &str) -> Result, String> { + // First decode the base64 data + let pem_decoded = BASE64_STANDARD + .decode(pem_data) + .map_err(|e| format!("Unable to decode base64 pem data: {}", e))?; + + // Convert the decoded data to a string + let mut pem_string = String::from_utf8(pem_decoded) + .map_err(|e| format!("Unable to convert decoded pem data into a string: {}", e))?; + + // Fix the header - replace PKCS1 header with PKCS8 header + pem_string = pem_string + .replace( + "-----BEGIN RSA PUBLIC KEY-----", + "-----BEGIN PUBLIC KEY-----", + ) + .replace("-----END RSA PUBLIC KEY-----", "-----END PUBLIC KEY-----"); + + // Parse the PEM string into an RSA public key using PKCS8 format + let rsa_pubkey = Rsa::public_key_from_pem(pem_string.as_bytes()) + .map_err(|e| format!("Failed to parse RSA public key: {}", e))?; + + Ok(rsa_pubkey) +} From 673537f40b27b7850276ff26e95d639312e92e9c Mon Sep 17 00:00:00 2001 From: Zacholme7 Date: Wed, 11 Dec 2024 14:44:55 +0000 Subject: [PATCH 2/3] fix ci audit and add encrypted secret key --- Cargo.lock | 98 +++++++++++--------------- anchor/common/ssv_types/src/cluster.rs | 4 +- anchor/common/ssv_types/src/share.rs | 6 +- 3 files changed, 47 insertions(+), 61 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 7debfc04..0fa4f900 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -896,7 +896,7 @@ dependencies = [ [[package]] name = "bls" version = "0.2.0" -source = "git+https://github.com/sigp/lighthouse?branch=unstable#fec502db9f93923f5fa965aad970ac244930c321" +source = "git+https://github.com/sigp/lighthouse?branch=unstable#c5a48a9dffc82e5e18d24ca7f2ab3671c9ad8469" dependencies = [ "alloy-primitives", "arbitrary", @@ -1165,7 +1165,7 @@ dependencies = [ [[package]] name = "clap_utils" version = "0.1.0" -source = "git+https://github.com/sigp/lighthouse?branch=unstable#fec502db9f93923f5fa965aad970ac244930c321" +source = "git+https://github.com/sigp/lighthouse?branch=unstable#c5a48a9dffc82e5e18d24ca7f2ab3671c9ad8469" dependencies = [ "alloy-primitives", "clap", @@ -1229,7 +1229,7 @@ dependencies = [ [[package]] name = "compare_fields" version = "0.2.0" -source = "git+https://github.com/sigp/lighthouse?branch=unstable#fec502db9f93923f5fa965aad970ac244930c321" +source = "git+https://github.com/sigp/lighthouse?branch=unstable#c5a48a9dffc82e5e18d24ca7f2ab3671c9ad8469" dependencies = [ "itertools 0.10.5", ] @@ -1246,7 +1246,7 @@ dependencies = [ [[package]] name = "compare_fields_derive" version = "0.2.0" -source = "git+https://github.com/sigp/lighthouse?branch=unstable#fec502db9f93923f5fa965aad970ac244930c321" +source = "git+https://github.com/sigp/lighthouse?branch=unstable#c5a48a9dffc82e5e18d24ca7f2ab3671c9ad8469" dependencies = [ "quote", "syn 1.0.109", @@ -1837,7 +1837,7 @@ dependencies = [ [[package]] name = "directory" version = "0.1.0" -source = "git+https://github.com/sigp/lighthouse?branch=unstable#fec502db9f93923f5fa965aad970ac244930c321" +source = "git+https://github.com/sigp/lighthouse?branch=unstable#c5a48a9dffc82e5e18d24ca7f2ab3671c9ad8469" dependencies = [ "clap", "clap_utils 0.1.0 (git+https://github.com/sigp/lighthouse?branch=unstable)", @@ -2301,7 +2301,7 @@ dependencies = [ [[package]] name = "eth2_config" version = "0.2.0" -source = "git+https://github.com/sigp/lighthouse?branch=unstable#fec502db9f93923f5fa965aad970ac244930c321" +source = "git+https://github.com/sigp/lighthouse?branch=unstable#c5a48a9dffc82e5e18d24ca7f2ab3671c9ad8469" dependencies = [ "paste", "types 0.2.1 (git+https://github.com/sigp/lighthouse?branch=unstable)", @@ -2323,7 +2323,7 @@ dependencies = [ [[package]] name = "eth2_interop_keypairs" version = "0.2.0" -source = "git+https://github.com/sigp/lighthouse?branch=unstable#fec502db9f93923f5fa965aad970ac244930c321" +source = "git+https://github.com/sigp/lighthouse?branch=unstable#c5a48a9dffc82e5e18d24ca7f2ab3671c9ad8469" dependencies = [ "bls 0.2.0 (git+https://github.com/sigp/lighthouse?branch=unstable)", "ethereum_hashing", @@ -2391,7 +2391,7 @@ dependencies = [ [[package]] name = "eth2_network_config" version = "0.2.0" -source = "git+https://github.com/sigp/lighthouse?branch=unstable#fec502db9f93923f5fa965aad970ac244930c321" +source = "git+https://github.com/sigp/lighthouse?branch=unstable#c5a48a9dffc82e5e18d24ca7f2ab3671c9ad8469" dependencies = [ "bytes", "discv5 0.9.0", @@ -2795,7 +2795,7 @@ dependencies = [ [[package]] name = "fixed_bytes" version = "0.1.0" -source = "git+https://github.com/sigp/lighthouse?branch=unstable#fec502db9f93923f5fa965aad970ac244930c321" +source = "git+https://github.com/sigp/lighthouse?branch=unstable#c5a48a9dffc82e5e18d24ca7f2ab3671c9ad8469" dependencies = [ "alloy-primitives", "safe_arith 0.1.0 (git+https://github.com/sigp/lighthouse?branch=unstable)", @@ -3141,7 +3141,7 @@ dependencies = [ [[package]] name = "gossipsub" version = "0.5.0" -source = "git+https://github.com/sigp/lighthouse?branch=unstable#fec502db9f93923f5fa965aad970ac244930c321" +source = "git+https://github.com/sigp/lighthouse?branch=unstable#c5a48a9dffc82e5e18d24ca7f2ab3671c9ad8469" dependencies = [ "async-channel", "asynchronous-codec", @@ -3336,9 +3336,9 @@ checksum = "b07f60793ff0a4d9cef0f18e63b5357e06209987153a64648c972c1e5aff336f" [[package]] name = "hickory-proto" -version = "0.24.1" +version = "0.24.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "07698b8420e2f0d6447a436ba999ec85d8fbf2a398bbd737b82cac4a2e96e512" +checksum = "447afdcdb8afb9d0a852af6dc65d9b285ce720ed7a59e42a8bf2e931c67bc1b5" dependencies = [ "async-trait", "cfg-if", @@ -3347,7 +3347,7 @@ dependencies = [ "futures-channel", "futures-io", "futures-util", - "idna 0.4.0", + "idna", "ipnet", "once_cell", "rand", @@ -3361,9 +3361,9 @@ dependencies = [ [[package]] name = "hickory-resolver" -version = "0.24.1" +version = "0.24.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28757f23aa75c98f254cf0405e6d8c25b831b32921b050a66692427679b1f243" +checksum = "0a2e2aba9c389ce5267d31cf1e4dace82390ae276b0b364ea55630b1fa1b44b4" dependencies = [ "cfg-if", "futures-util", @@ -3768,16 +3768,6 @@ version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" -[[package]] -name = "idna" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d20d6b07bfbc108882d88ed8e37d39636dcc260e15e30c45e6ba089610b917c" -dependencies = [ - "unicode-bidi", - "unicode-normalization", -] - [[package]] name = "idna" version = "1.0.3" @@ -3948,7 +3938,7 @@ dependencies = [ [[package]] name = "int_to_bytes" version = "0.2.0" -source = "git+https://github.com/sigp/lighthouse?branch=unstable#fec502db9f93923f5fa965aad970ac244930c321" +source = "git+https://github.com/sigp/lighthouse?branch=unstable#c5a48a9dffc82e5e18d24ca7f2ab3671c9ad8469" dependencies = [ "bytes", ] @@ -4144,7 +4134,7 @@ dependencies = [ [[package]] name = "kzg" version = "0.1.0" -source = "git+https://github.com/sigp/lighthouse?branch=unstable#fec502db9f93923f5fa965aad970ac244930c321" +source = "git+https://github.com/sigp/lighthouse?branch=unstable#c5a48a9dffc82e5e18d24ca7f2ab3671c9ad8469" dependencies = [ "arbitrary", "c-kzg", @@ -4784,7 +4774,7 @@ dependencies = [ [[package]] name = "lighthouse_network" version = "0.2.0" -source = "git+https://github.com/sigp/lighthouse?branch=unstable#fec502db9f93923f5fa965aad970ac244930c321" +source = "git+https://github.com/sigp/lighthouse?branch=unstable#c5a48a9dffc82e5e18d24ca7f2ab3671c9ad8469" dependencies = [ "alloy-primitives", "alloy-rlp", @@ -4842,7 +4832,7 @@ dependencies = [ [[package]] name = "lighthouse_version" version = "0.1.0" -source = "git+https://github.com/sigp/lighthouse?branch=unstable#fec502db9f93923f5fa965aad970ac244930c321" +source = "git+https://github.com/sigp/lighthouse?branch=unstable#c5a48a9dffc82e5e18d24ca7f2ab3671c9ad8469" dependencies = [ "git-version", "target_info", @@ -4921,7 +4911,7 @@ dependencies = [ [[package]] name = "logging" version = "0.2.0" -source = "git+https://github.com/sigp/lighthouse?branch=unstable#fec502db9f93923f5fa965aad970ac244930c321" +source = "git+https://github.com/sigp/lighthouse?branch=unstable#c5a48a9dffc82e5e18d24ca7f2ab3671c9ad8469" dependencies = [ "chrono", "metrics 0.2.0 (git+https://github.com/sigp/lighthouse?branch=unstable)", @@ -4969,7 +4959,7 @@ dependencies = [ [[package]] name = "lru_cache" version = "0.1.0" -source = "git+https://github.com/sigp/lighthouse?branch=unstable#fec502db9f93923f5fa965aad970ac244930c321" +source = "git+https://github.com/sigp/lighthouse?branch=unstable#c5a48a9dffc82e5e18d24ca7f2ab3671c9ad8469" dependencies = [ "fnv", ] @@ -5045,7 +5035,7 @@ dependencies = [ [[package]] name = "merkle_proof" version = "0.2.0" -source = "git+https://github.com/sigp/lighthouse?branch=unstable#fec502db9f93923f5fa965aad970ac244930c321" +source = "git+https://github.com/sigp/lighthouse?branch=unstable#c5a48a9dffc82e5e18d24ca7f2ab3671c9ad8469" dependencies = [ "alloy-primitives", "ethereum_hashing", @@ -5087,7 +5077,7 @@ dependencies = [ [[package]] name = "metrics" version = "0.2.0" -source = "git+https://github.com/sigp/lighthouse?branch=unstable#fec502db9f93923f5fa965aad970ac244930c321" +source = "git+https://github.com/sigp/lighthouse?branch=unstable#c5a48a9dffc82e5e18d24ca7f2ab3671c9ad8469" dependencies = [ "prometheus", ] @@ -5288,9 +5278,9 @@ dependencies = [ [[package]] name = "netlink-sys" -version = "0.8.6" +version = "0.8.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "416060d346fbaf1f23f9512963e3e878f1a78e707cb699ba9215761754244307" +checksum = "16c903aa70590cb93691bf97a767c8d1d6122d2cc9070433deb3bbf36ce8bd23" dependencies = [ "bytes", "futures", @@ -5929,7 +5919,7 @@ dependencies = [ [[package]] name = "pretty_reqwest_error" version = "0.1.0" -source = "git+https://github.com/sigp/lighthouse?branch=unstable#fec502db9f93923f5fa965aad970ac244930c321" +source = "git+https://github.com/sigp/lighthouse?branch=unstable#c5a48a9dffc82e5e18d24ca7f2ab3671c9ad8469" dependencies = [ "reqwest", "sensitive_url 0.1.0 (git+https://github.com/sigp/lighthouse?branch=unstable)", @@ -6855,7 +6845,7 @@ source = "git+https://github.com/agemanning/lighthouse?branch=modularize-vc#75a5 [[package]] name = "safe_arith" version = "0.1.0" -source = "git+https://github.com/sigp/lighthouse?branch=unstable#fec502db9f93923f5fa965aad970ac244930c321" +source = "git+https://github.com/sigp/lighthouse?branch=unstable#c5a48a9dffc82e5e18d24ca7f2ab3671c9ad8469" [[package]] name = "salsa20" @@ -7029,7 +7019,7 @@ dependencies = [ [[package]] name = "sensitive_url" version = "0.1.0" -source = "git+https://github.com/sigp/lighthouse?branch=unstable#fec502db9f93923f5fa965aad970ac244930c321" +source = "git+https://github.com/sigp/lighthouse?branch=unstable#c5a48a9dffc82e5e18d24ca7f2ab3671c9ad8469" dependencies = [ "serde", "url", @@ -7037,9 +7027,9 @@ dependencies = [ [[package]] name = "serde" -version = "1.0.215" +version = "1.0.216" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6513c1ad0b11a9376da888e3e0baa0077f1aed55c17f50e7b2397136129fb88f" +checksum = "0b9781016e935a97e8beecf0c933758c97a5520d32930e460142b4cd80c6338e" dependencies = [ "serde_derive", ] @@ -7056,9 +7046,9 @@ dependencies = [ [[package]] name = "serde_derive" -version = "1.0.215" +version = "1.0.216" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ad1e866f866923f252f05c889987993144fb74e722403468a4ebd70c3cd756c0" +checksum = "46f859dbbf73865c6627ed570e78961cd3ac92407a2d117204c49232485da55e" dependencies = [ "proc-macro2", "quote", @@ -7650,7 +7640,7 @@ dependencies = [ [[package]] name = "swap_or_not_shuffle" version = "0.2.0" -source = "git+https://github.com/sigp/lighthouse?branch=unstable#fec502db9f93923f5fa965aad970ac244930c321" +source = "git+https://github.com/sigp/lighthouse?branch=unstable#c5a48a9dffc82e5e18d24ca7f2ab3671c9ad8469" dependencies = [ "alloy-primitives", "ethereum_hashing", @@ -7779,7 +7769,7 @@ dependencies = [ [[package]] name = "task_executor" version = "0.1.0" -source = "git+https://github.com/sigp/lighthouse?branch=unstable#fec502db9f93923f5fa965aad970ac244930c321" +source = "git+https://github.com/sigp/lighthouse?branch=unstable#c5a48a9dffc82e5e18d24ca7f2ab3671c9ad8469" dependencies = [ "async-channel", "futures", @@ -7837,7 +7827,7 @@ dependencies = [ [[package]] name = "test_random_derive" version = "0.2.0" -source = "git+https://github.com/sigp/lighthouse?branch=unstable#fec502db9f93923f5fa965aad970ac244930c321" +source = "git+https://github.com/sigp/lighthouse?branch=unstable#c5a48a9dffc82e5e18d24ca7f2ab3671c9ad8469" dependencies = [ "quote", "syn 1.0.109", @@ -8112,14 +8102,14 @@ dependencies = [ [[package]] name = "tower" -version = "0.5.1" +version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2873938d487c3cfb9aed7546dc9f2711d867c9f90c46b889989a2cb84eba6b4f" +checksum = "d039ad9159c98b70ecfd540b2573b97f7f52c3e8d9f8ad57a24b916a536975f9" dependencies = [ "futures-core", "futures-util", "pin-project-lite", - "sync_wrapper 0.1.2", + "sync_wrapper 1.0.2", "tokio", "tower-layer", "tower-service", @@ -8352,7 +8342,7 @@ dependencies = [ [[package]] name = "types" version = "0.2.1" -source = "git+https://github.com/sigp/lighthouse?branch=unstable#fec502db9f93923f5fa965aad970ac244930c321" +source = "git+https://github.com/sigp/lighthouse?branch=unstable#c5a48a9dffc82e5e18d24ca7f2ab3671c9ad8469" dependencies = [ "alloy-primitives", "alloy-rlp", @@ -8446,12 +8436,6 @@ version = "2.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7e51b68083f157f853b6379db119d1c1be0e6e4dec98101079dec41f6f5cf6df" -[[package]] -name = "unicode-bidi" -version = "0.3.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ab17db44d7388991a428b2ee655ce0c212e862eff1768a455c58f9aad6e7893" - [[package]] name = "unicode-ident" version = "1.0.14" @@ -8536,7 +8520,7 @@ dependencies = [ [[package]] name = "unused_port" version = "0.1.0" -source = "git+https://github.com/sigp/lighthouse?branch=unstable#fec502db9f93923f5fa965aad970ac244930c321" +source = "git+https://github.com/sigp/lighthouse?branch=unstable#c5a48a9dffc82e5e18d24ca7f2ab3671c9ad8469" dependencies = [ "lru_cache 0.1.0 (git+https://github.com/sigp/lighthouse?branch=unstable)", "parking_lot 0.12.3", @@ -8549,7 +8533,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "32f8b686cadd1473f4bd0117a5d28d36b1ade384ea9b5069a1c40aefed7fda60" dependencies = [ "form_urlencoded", - "idna 1.0.3", + "idna", "percent-encoding", ] diff --git a/anchor/common/ssv_types/src/cluster.rs b/anchor/common/ssv_types/src/cluster.rs index 308aee67..231fee50 100644 --- a/anchor/common/ssv_types/src/cluster.rs +++ b/anchor/common/ssv_types/src/cluster.rs @@ -8,7 +8,7 @@ use types::{Address, Graffiti, PublicKey}; pub struct ClusterId(pub u64); /// A Cluster is a group of Operators that are acting on behalf of a Validator -#[derive(Debug, Clone)] +#[derive(Clone)] pub struct Cluster { /// Unique identifier for a Cluster pub cluster_id: ClusterId, @@ -23,7 +23,7 @@ pub struct Cluster { } /// A member of a Cluster. This is just an Operator that holds onto a share of the Validator key -#[derive(Debug, Clone)] +#[derive(Clone)] pub struct ClusterMember { /// Unique identifier for the Operator this member represents pub operator_id: OperatorId, diff --git a/anchor/common/ssv_types/src/share.rs b/anchor/common/ssv_types/src/share.rs index 335af5ed..118b4fea 100644 --- a/anchor/common/ssv_types/src/share.rs +++ b/anchor/common/ssv_types/src/share.rs @@ -1,8 +1,10 @@ -use types::PublicKey; +use types::{PublicKey, SecretKey}; /// One of N shares of a split validator key. -#[derive(Debug, Clone)] +#[derive(Clone)] pub struct Share { /// The public key of this Share pub share_pubkey: PublicKey, + /// The encrypted private key of the share + pub encrypted_private_key: SecretKey, } From bd0e451545d566faa3e33609856589905448fb29 Mon Sep 17 00:00:00 2001 From: Zacholme7 Date: Wed, 11 Dec 2024 15:01:56 +0000 Subject: [PATCH 3/3] move to byte array for encrypted private key --- anchor/common/ssv_types/src/cluster.rs | 4 ++-- anchor/common/ssv_types/src/share.rs | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/anchor/common/ssv_types/src/cluster.rs b/anchor/common/ssv_types/src/cluster.rs index 231fee50..308aee67 100644 --- a/anchor/common/ssv_types/src/cluster.rs +++ b/anchor/common/ssv_types/src/cluster.rs @@ -8,7 +8,7 @@ use types::{Address, Graffiti, PublicKey}; pub struct ClusterId(pub u64); /// A Cluster is a group of Operators that are acting on behalf of a Validator -#[derive(Clone)] +#[derive(Debug, Clone)] pub struct Cluster { /// Unique identifier for a Cluster pub cluster_id: ClusterId, @@ -23,7 +23,7 @@ pub struct Cluster { } /// A member of a Cluster. This is just an Operator that holds onto a share of the Validator key -#[derive(Clone)] +#[derive(Debug, Clone)] pub struct ClusterMember { /// Unique identifier for the Operator this member represents pub operator_id: OperatorId, diff --git a/anchor/common/ssv_types/src/share.rs b/anchor/common/ssv_types/src/share.rs index 118b4fea..80672602 100644 --- a/anchor/common/ssv_types/src/share.rs +++ b/anchor/common/ssv_types/src/share.rs @@ -1,10 +1,10 @@ -use types::{PublicKey, SecretKey}; +use types::PublicKey; /// One of N shares of a split validator key. -#[derive(Clone)] +#[derive(Debug, Clone)] pub struct Share { /// The public key of this Share pub share_pubkey: PublicKey, /// The encrypted private key of the share - pub encrypted_private_key: SecretKey, + pub encrypted_private_key: [u8; 256], }