diff --git a/rs/crypto/temp_crypto/src/lib.rs b/rs/crypto/temp_crypto/src/lib.rs index b021a461743..81b8b154a4b 100644 --- a/rs/crypto/temp_crypto/src/lib.rs +++ b/rs/crypto/temp_crypto/src/lib.rs @@ -1,8 +1,8 @@ use ic_crypto_internal_csp::Csp; use ic_interfaces::time_source::SysTimeSource; use ic_limits::INITIAL_NOTARY_DELAY; -use ic_protobuf::registry::crypto::v1::{EcdsaCurve, EcdsaKeyId}; use ic_protobuf::registry::subnet::v1::{ChainKeyConfig, KeyConfig, SubnetRecord, SubnetType}; +use ic_protobuf::types::v1 as pb_types; use ic_types::{NodeId, ReplicaVersion, SubnetId}; use rand::rngs::OsRng; use rand::{CryptoRng, Rng}; @@ -1051,17 +1051,15 @@ impl EcdsaSubnetConfig { ssh_readonly_access: vec![], ssh_backup_access: vec![], ecdsa_config: None, - chain_key_config: Some(ChainKeyConfig { + chain_key_config: Some(ChainKeyConfig { key_configs: vec![KeyConfig { - key_id: Some(ic_protobuf::registry::crypto::v1::MasterPublicKeyId { - key_id: Some( - ic_protobuf::registry::crypto::v1::master_public_key_id::KeyId::Ecdsa( - EcdsaKeyId { - curve: EcdsaCurve::Secp256k1.into(), - name: "dummy_ecdsa_key_id".to_string(), - }, - ), - ), + key_id: Some(ic_protobuf::types::v1::MasterPublicKeyId { + key_id: Some(pb_types::master_public_key_id::KeyId::Ecdsa( + pb_types::EcdsaKeyId { + curve: pb_types::EcdsaCurve::Secp256k1.into(), + name: "dummy_ecdsa_key_id".to_string(), + }, + )), }), pre_signatures_to_create_in_advance: Some(1), max_queue_size: Some(20), diff --git a/rs/protobuf/def/registry/crypto/v1/crypto.proto b/rs/protobuf/def/registry/crypto/v1/crypto.proto index 02ed9df91f2..fe8680bf786 100644 --- a/rs/protobuf/def/registry/crypto/v1/crypto.proto +++ b/rs/protobuf/def/registry/crypto/v1/crypto.proto @@ -56,44 +56,3 @@ message PublicKey { message X509PublicKeyCert { bytes certificate_der = 1; } - -// Types of curves that can be used for ECDSA signatures. -enum EcdsaCurve { - ECDSA_CURVE_UNSPECIFIED = 0; - ECDSA_CURVE_SECP256K1 = 1; -} - -message EcdsaKeyId { - EcdsaCurve curve = 1; - string name = 2; -} - -// Types of curves that can be used for Schnorr signatures. -enum SchnorrAlgorithm { - SCHNORR_ALGORITHM_UNSPECIFIED = 0; - SCHNORR_ALGORITHM_BIP340SECP256K1 = 1; - SCHNORR_ALGORITHM_ED25519 = 2; -} - -message SchnorrKeyId { - SchnorrAlgorithm algorithm = 1; - string name = 2; -} - -enum VetKdCurve { - VET_KD_CURVE_UNSPECIFIED = 0; - VET_KD_CURVE_BLS12_381_G2 = 1; -} - -message VetKdKeyId { - VetKdCurve curve = 1; - string name = 2; -} - -message MasterPublicKeyId { - oneof key_id { - EcdsaKeyId ecdsa = 1; - SchnorrKeyId schnorr = 2; - VetKdKeyId vetkd = 3; - } -} diff --git a/rs/protobuf/def/registry/subnet/v1/subnet.proto b/rs/protobuf/def/registry/subnet/v1/subnet.proto index c6f7db47eaf..10ca593a4a1 100644 --- a/rs/protobuf/def/registry/subnet/v1/subnet.proto +++ b/rs/protobuf/def/registry/subnet/v1/subnet.proto @@ -92,12 +92,12 @@ message SubnetRecord { } message EcdsaInitialization { - registry.crypto.v1.EcdsaKeyId key_id = 1; + types.v1.EcdsaKeyId key_id = 1; InitialIDkgDealings dealings = 2; } message ChainKeyInitialization { - registry.crypto.v1.MasterPublicKeyId key_id = 1; + types.v1.MasterPublicKeyId key_id = 1; oneof initialization { InitialIDkgDealings dealings = 2; InitialNiDkgTranscriptRecord transcript_record = 3; @@ -311,7 +311,7 @@ message EcdsaConfig { uint32 quadruples_to_create_in_advance = 1; reserved 2; // Identifiers for threshold ECDSA keys held by the subnet. - repeated registry.crypto.v1.EcdsaKeyId key_ids = 3; + repeated types.v1.EcdsaKeyId key_ids = 3; // The maximum number of signature requests that can be enqueued at once. uint32 max_queue_size = 4; // Signature requests will timeout after the given number of nano seconds. @@ -323,7 +323,7 @@ message EcdsaConfig { message KeyConfig { // The key's identifier. - optional registry.crypto.v1.MasterPublicKeyId key_id = 1; + optional types.v1.MasterPublicKeyId key_id = 1; // Number of pre-signatures to create in advance. optional uint32 pre_signatures_to_create_in_advance = 3; // The maximum number of signature requests that can be enqueued at once. diff --git a/rs/protobuf/def/state/metadata/v1/metadata.proto b/rs/protobuf/def/state/metadata/v1/metadata.proto index fa896a42d97..a326de68ea6 100644 --- a/rs/protobuf/def/state/metadata/v1/metadata.proto +++ b/rs/protobuf/def/state/metadata/v1/metadata.proto @@ -3,7 +3,6 @@ package state.metadata.v1; import "bitcoin/v1/bitcoin.proto"; import "google/protobuf/wrappers.proto"; -import "registry/crypto/v1/crypto.proto"; import "registry/routing_table/v1/routing_table.proto"; import "registry/subnet/v1/subnet.proto"; import "state/canister_state_bits/v1/canister_state_bits.proto"; @@ -29,7 +28,7 @@ message SubnetTopology { registry.subnet.v1.SubnetFeatures subnet_features = 4; reserved 5; reserved "ecdsa_keys_held"; - repeated registry.crypto.v1.MasterPublicKeyId idkg_keys_held = 6; + repeated types.v1.MasterPublicKeyId idkg_keys_held = 6; } message SubnetsEntry { @@ -38,7 +37,7 @@ message SubnetsEntry { } message IDkgKeyEntry { - registry.crypto.v1.MasterPublicKeyId key_id = 1; + types.v1.MasterPublicKeyId key_id = 1; repeated types.v1.SubnetId subnet_ids = 2; } @@ -70,12 +69,12 @@ message SetupInitialDkgContextTree { } message EcdsaArguments { - registry.crypto.v1.EcdsaKeyId key_id = 1; + types.v1.EcdsaKeyId key_id = 1; bytes message_hash = 2; } message SchnorrArguments { - registry.crypto.v1.SchnorrKeyId key_id = 1; + types.v1.SchnorrKeyId key_id = 1; bytes message = 2; } @@ -134,7 +133,7 @@ message CanisterHttpRequestContextTree { message IDkgDealingsContext { state.queues.v1.Request request = 1; - registry.crypto.v1.MasterPublicKeyId key_id = 2; + types.v1.MasterPublicKeyId key_id = 2; repeated types.v1.NodeId nodes = 3; uint64 registry_version = 4; Time time = 5; @@ -277,7 +276,7 @@ message ApiBoundaryNodeEntry { } message ThresholdSignatureAgreementsEntry { - registry.crypto.v1.MasterPublicKeyId key_id = 1; + types.v1.MasterPublicKeyId key_id = 1; uint64 count = 2; } diff --git a/rs/protobuf/def/types/v1/idkg.proto b/rs/protobuf/def/types/v1/idkg.proto index 85e3b6cc695..9ca33e35bc0 100644 --- a/rs/protobuf/def/types/v1/idkg.proto +++ b/rs/protobuf/def/types/v1/idkg.proto @@ -2,7 +2,6 @@ syntax = "proto3"; package types.v1; -import "registry/crypto/v1/crypto.proto"; import "registry/subnet/v1/subnet.proto"; import "state/queues/v1/queues.proto"; import "types/v1/signature.proto"; @@ -34,7 +33,7 @@ message MasterKeyTranscript { reserved 1; UnmaskedTranscriptWithAttributes current = 2; KeyTranscriptCreation next_in_creation = 3; - registry.crypto.v1.MasterPublicKeyId master_key_id = 4; + types.v1.MasterPublicKeyId master_key_id = 4; } message AvailablePreSignature { @@ -154,7 +153,7 @@ message QuadrupleInCreation { UnmaskedTimesMaskedParams kappa_times_lambda_config = 9; MaskedTranscript kappa_times_lambda = 10; - registry.crypto.v1.EcdsaKeyId key_id = 12; + types.v1.EcdsaKeyId key_id = 12; } message PreSignatureQuadrupleRef { @@ -163,17 +162,17 @@ message PreSignatureQuadrupleRef { MaskedTranscript kappa_times_lambda_ref = 3; MaskedTranscript key_times_lambda_ref = 4; UnmaskedTranscript key_unmasked_ref = 5; - registry.crypto.v1.EcdsaKeyId key_id = 6; + types.v1.EcdsaKeyId key_id = 6; } message TranscriptInCreation { - registry.crypto.v1.SchnorrKeyId key_id = 1; + types.v1.SchnorrKeyId key_id = 1; RandomUnmaskedTranscriptParams blinder_unmasked_config = 2; UnmaskedTranscript blinder_unmasked = 3; } message PreSignatureTranscriptRef { - registry.crypto.v1.SchnorrKeyId key_id = 1; + types.v1.SchnorrKeyId key_id = 1; UnmaskedTranscript blinder_unmasked_ref = 2; UnmaskedTranscript key_unmasked_ref = 3; } @@ -189,7 +188,7 @@ message IDkgReshareRequest { reserved 1, 4; repeated types.v1.NodeId receiving_node_ids = 2; uint64 registry_version = 3; - registry.crypto.v1.MasterPublicKeyId master_key_id = 5; + types.v1.MasterPublicKeyId master_key_id = 5; } enum KeyTranscriptCreationState { diff --git a/rs/protobuf/def/types/v1/types.proto b/rs/protobuf/def/types/v1/types.proto index 9440f40c205..c90b4c6da99 100644 --- a/rs/protobuf/def/types/v1/types.proto +++ b/rs/protobuf/def/types/v1/types.proto @@ -45,3 +45,44 @@ message NominalCycles { uint64 high = 1; uint64 low = 2; } + +// Types of curves that can be used for ECDSA signatures. +enum EcdsaCurve { + ECDSA_CURVE_UNSPECIFIED = 0; + ECDSA_CURVE_SECP256K1 = 1; +} + +message EcdsaKeyId { + EcdsaCurve curve = 1; + string name = 2; +} + +// Types of curves that can be used for Schnorr signatures. +enum SchnorrAlgorithm { + SCHNORR_ALGORITHM_UNSPECIFIED = 0; + SCHNORR_ALGORITHM_BIP340SECP256K1 = 1; + SCHNORR_ALGORITHM_ED25519 = 2; +} + +message SchnorrKeyId { + SchnorrAlgorithm algorithm = 1; + string name = 2; +} + +enum VetKdCurve { + VET_KD_CURVE_UNSPECIFIED = 0; + VET_KD_CURVE_BLS12_381_G2 = 1; +} + +message VetKdKeyId { + VetKdCurve curve = 1; + string name = 2; +} + +message MasterPublicKeyId { + oneof key_id { + EcdsaKeyId ecdsa = 1; + SchnorrKeyId schnorr = 2; + VetKdKeyId vetkd = 3; + } +} diff --git a/rs/protobuf/generator/src/lib.rs b/rs/protobuf/generator/src/lib.rs index 6b8a7f91fec..cb752ed8930 100644 --- a/rs/protobuf/generator/src/lib.rs +++ b/rs/protobuf/generator/src/lib.rs @@ -185,14 +185,6 @@ fn build_registry_proto(def: &Path, out: &Path) { ".registry.crypto.v1.X509PublicKeyCert", "#[derive(Eq, Hash, PartialOrd, Ord)]", ); - config.type_attribute( - ".registry.crypto.v1.EcdsaCurve", - "#[derive(candid::CandidType)]", - ); - config.type_attribute( - ".registry.crypto.v1.EcdsaKeyId", - "#[derive(candid::CandidType, Eq)]", - ); config.type_attribute( ".registry.node_operator", "#[derive(candid::CandidType, serde::Serialize, candid::Deserialize, Eq, Hash)]", @@ -345,6 +337,13 @@ fn build_types_proto(def: &Path, out: &Path) { ".types.v1.SubnetId", ".types.v1.ThresholdSignature", ".types.v1.ThresholdSignatureShare", + ".types.v1.EcdsaKeyId", + ".types.v1.SchnorrKeyId", + ".types.v1.VetKdKeyId", + ".types.v1.EcdsaCurve", + ".types.v1.SchnorrAlgorithm", + ".types.v1.VetKdCurve", + ".types.v1.MasterPublicKeyId", ] { config.type_attribute(path, "#[derive(serde::Serialize, serde::Deserialize)]"); } @@ -352,6 +351,9 @@ fn build_types_proto(def: &Path, out: &Path) { config.type_attribute(".types.v1.SubnetId", "#[derive(Eq, Hash)]"); config.type_attribute(".types.v1.NiDkgId", "#[derive(Eq, Hash)]"); config.type_attribute(".types.v1.PrincipalId", "#[derive(Eq, Hash)]"); + config.type_attribute(".types.v1.EcdsaKeyId", "#[derive(Eq)]"); + config.type_attribute(".types.v1.EcdsaCurve", "#[derive(candid::CandidType)]"); + config.type_attribute(".types.v1.EcdsaKeyId", "#[derive(candid::CandidType)]"); config.type_attribute( ".types.v1.ConsensusMessage", "#[allow(clippy::large_enum_variant)]", diff --git a/rs/protobuf/src/gen/crypto/registry.crypto.v1.rs b/rs/protobuf/src/gen/crypto/registry.crypto.v1.rs index c69d66bbe64..7e8f85913d1 100644 --- a/rs/protobuf/src/gen/crypto/registry.crypto.v1.rs +++ b/rs/protobuf/src/gen/crypto/registry.crypto.v1.rs @@ -34,44 +34,6 @@ pub struct X509PublicKeyCert { #[prost(bytes = "vec", tag = "1")] pub certificate_der: ::prost::alloc::vec::Vec, } -#[derive(serde::Serialize, serde::Deserialize, Clone, PartialEq, ::prost::Message)] -pub struct EcdsaKeyId { - #[prost(enumeration = "EcdsaCurve", tag = "1")] - pub curve: i32, - #[prost(string, tag = "2")] - pub name: ::prost::alloc::string::String, -} -#[derive(serde::Serialize, serde::Deserialize, Clone, PartialEq, ::prost::Message)] -pub struct SchnorrKeyId { - #[prost(enumeration = "SchnorrAlgorithm", tag = "1")] - pub algorithm: i32, - #[prost(string, tag = "2")] - pub name: ::prost::alloc::string::String, -} -#[derive(serde::Serialize, serde::Deserialize, Clone, PartialEq, ::prost::Message)] -pub struct VetKdKeyId { - #[prost(enumeration = "VetKdCurve", tag = "1")] - pub curve: i32, - #[prost(string, tag = "2")] - pub name: ::prost::alloc::string::String, -} -#[derive(serde::Serialize, serde::Deserialize, Clone, PartialEq, ::prost::Message)] -pub struct MasterPublicKeyId { - #[prost(oneof = "master_public_key_id::KeyId", tags = "1, 2, 3")] - pub key_id: ::core::option::Option, -} -/// Nested message and enum types in `MasterPublicKeyId`. -pub mod master_public_key_id { - #[derive(serde::Serialize, serde::Deserialize, Clone, PartialEq, ::prost::Oneof)] - pub enum KeyId { - #[prost(message, tag = "1")] - Ecdsa(super::EcdsaKeyId), - #[prost(message, tag = "2")] - Schnorr(super::SchnorrKeyId), - #[prost(message, tag = "3")] - Vetkd(super::VetKdKeyId), - } -} /// An algorithm ID. This is used to specify the signature algorithm associated with a public key. #[derive( serde::Serialize, @@ -165,122 +127,3 @@ impl AlgorithmId { } } } -/// Types of curves that can be used for ECDSA signatures. -#[derive( - serde::Serialize, - serde::Deserialize, - Clone, - Copy, - Debug, - PartialEq, - Eq, - Hash, - PartialOrd, - Ord, - ::prost::Enumeration, -)] -#[repr(i32)] -pub enum EcdsaCurve { - Unspecified = 0, - Secp256k1 = 1, -} -impl EcdsaCurve { - /// String value of the enum field names used in the ProtoBuf definition. - /// - /// The values are not transformed in any way and thus are considered stable - /// (if the ProtoBuf definition does not change) and safe for programmatic use. - pub fn as_str_name(&self) -> &'static str { - match self { - Self::Unspecified => "ECDSA_CURVE_UNSPECIFIED", - Self::Secp256k1 => "ECDSA_CURVE_SECP256K1", - } - } - /// Creates an enum from field names used in the ProtoBuf definition. - pub fn from_str_name(value: &str) -> ::core::option::Option { - match value { - "ECDSA_CURVE_UNSPECIFIED" => Some(Self::Unspecified), - "ECDSA_CURVE_SECP256K1" => Some(Self::Secp256k1), - _ => None, - } - } -} -/// Types of curves that can be used for Schnorr signatures. -#[derive( - serde::Serialize, - serde::Deserialize, - Clone, - Copy, - Debug, - PartialEq, - Eq, - Hash, - PartialOrd, - Ord, - ::prost::Enumeration, -)] -#[repr(i32)] -pub enum SchnorrAlgorithm { - Unspecified = 0, - Bip340secp256k1 = 1, - Ed25519 = 2, -} -impl SchnorrAlgorithm { - /// String value of the enum field names used in the ProtoBuf definition. - /// - /// The values are not transformed in any way and thus are considered stable - /// (if the ProtoBuf definition does not change) and safe for programmatic use. - pub fn as_str_name(&self) -> &'static str { - match self { - Self::Unspecified => "SCHNORR_ALGORITHM_UNSPECIFIED", - Self::Bip340secp256k1 => "SCHNORR_ALGORITHM_BIP340SECP256K1", - Self::Ed25519 => "SCHNORR_ALGORITHM_ED25519", - } - } - /// Creates an enum from field names used in the ProtoBuf definition. - pub fn from_str_name(value: &str) -> ::core::option::Option { - match value { - "SCHNORR_ALGORITHM_UNSPECIFIED" => Some(Self::Unspecified), - "SCHNORR_ALGORITHM_BIP340SECP256K1" => Some(Self::Bip340secp256k1), - "SCHNORR_ALGORITHM_ED25519" => Some(Self::Ed25519), - _ => None, - } - } -} -#[derive( - serde::Serialize, - serde::Deserialize, - Clone, - Copy, - Debug, - PartialEq, - Eq, - Hash, - PartialOrd, - Ord, - ::prost::Enumeration, -)] -#[repr(i32)] -pub enum VetKdCurve { - Unspecified = 0, - Bls12381G2 = 1, -} -impl VetKdCurve { - /// String value of the enum field names used in the ProtoBuf definition. - /// - /// The values are not transformed in any way and thus are considered stable - /// (if the ProtoBuf definition does not change) and safe for programmatic use. - pub fn as_str_name(&self) -> &'static str { - match self { - Self::Unspecified => "VET_KD_CURVE_UNSPECIFIED", - Self::Bls12381G2 => "VET_KD_CURVE_BLS12_381_G2", - } - } - /// Creates an enum from field names used in the ProtoBuf definition. - pub fn from_str_name(value: &str) -> ::core::option::Option { - match value { - "VET_KD_CURVE_UNSPECIFIED" => Some(Self::Unspecified), - "VET_KD_CURVE_BLS12_381_G2" => Some(Self::Bls12381G2), - _ => None, - } - } -} diff --git a/rs/protobuf/src/gen/crypto/types.v1.rs b/rs/protobuf/src/gen/crypto/types.v1.rs index 81a7d74061e..19efff53939 100644 --- a/rs/protobuf/src/gen/crypto/types.v1.rs +++ b/rs/protobuf/src/gen/crypto/types.v1.rs @@ -43,6 +43,44 @@ pub struct NominalCycles { #[prost(uint64, tag = "2")] pub low: u64, } +#[derive(serde::Serialize, serde::Deserialize, Clone, PartialEq, ::prost::Message)] +pub struct EcdsaKeyId { + #[prost(enumeration = "EcdsaCurve", tag = "1")] + pub curve: i32, + #[prost(string, tag = "2")] + pub name: ::prost::alloc::string::String, +} +#[derive(serde::Serialize, serde::Deserialize, Clone, PartialEq, ::prost::Message)] +pub struct SchnorrKeyId { + #[prost(enumeration = "SchnorrAlgorithm", tag = "1")] + pub algorithm: i32, + #[prost(string, tag = "2")] + pub name: ::prost::alloc::string::String, +} +#[derive(serde::Serialize, serde::Deserialize, Clone, PartialEq, ::prost::Message)] +pub struct VetKdKeyId { + #[prost(enumeration = "VetKdCurve", tag = "1")] + pub curve: i32, + #[prost(string, tag = "2")] + pub name: ::prost::alloc::string::String, +} +#[derive(serde::Serialize, serde::Deserialize, Clone, PartialEq, ::prost::Message)] +pub struct MasterPublicKeyId { + #[prost(oneof = "master_public_key_id::KeyId", tags = "1, 2, 3")] + pub key_id: ::core::option::Option, +} +/// Nested message and enum types in `MasterPublicKeyId`. +pub mod master_public_key_id { + #[derive(serde::Serialize, serde::Deserialize, Clone, PartialEq, ::prost::Oneof)] + pub enum KeyId { + #[prost(message, tag = "1")] + Ecdsa(super::EcdsaKeyId), + #[prost(message, tag = "2")] + Schnorr(super::SchnorrKeyId), + #[prost(message, tag = "3")] + Vetkd(super::VetKdKeyId), + } +} /// A non-interactive distributed key generation (NI-DKG) tag. #[derive( serde::Serialize, @@ -85,3 +123,122 @@ impl NiDkgTag { } } } +/// Types of curves that can be used for ECDSA signatures. +#[derive( + serde::Serialize, + serde::Deserialize, + Clone, + Copy, + Debug, + PartialEq, + Eq, + Hash, + PartialOrd, + Ord, + ::prost::Enumeration, +)] +#[repr(i32)] +pub enum EcdsaCurve { + Unspecified = 0, + Secp256k1 = 1, +} +impl EcdsaCurve { + /// String value of the enum field names used in the ProtoBuf definition. + /// + /// The values are not transformed in any way and thus are considered stable + /// (if the ProtoBuf definition does not change) and safe for programmatic use. + pub fn as_str_name(&self) -> &'static str { + match self { + Self::Unspecified => "ECDSA_CURVE_UNSPECIFIED", + Self::Secp256k1 => "ECDSA_CURVE_SECP256K1", + } + } + /// Creates an enum from field names used in the ProtoBuf definition. + pub fn from_str_name(value: &str) -> ::core::option::Option { + match value { + "ECDSA_CURVE_UNSPECIFIED" => Some(Self::Unspecified), + "ECDSA_CURVE_SECP256K1" => Some(Self::Secp256k1), + _ => None, + } + } +} +/// Types of curves that can be used for Schnorr signatures. +#[derive( + serde::Serialize, + serde::Deserialize, + Clone, + Copy, + Debug, + PartialEq, + Eq, + Hash, + PartialOrd, + Ord, + ::prost::Enumeration, +)] +#[repr(i32)] +pub enum SchnorrAlgorithm { + Unspecified = 0, + Bip340secp256k1 = 1, + Ed25519 = 2, +} +impl SchnorrAlgorithm { + /// String value of the enum field names used in the ProtoBuf definition. + /// + /// The values are not transformed in any way and thus are considered stable + /// (if the ProtoBuf definition does not change) and safe for programmatic use. + pub fn as_str_name(&self) -> &'static str { + match self { + Self::Unspecified => "SCHNORR_ALGORITHM_UNSPECIFIED", + Self::Bip340secp256k1 => "SCHNORR_ALGORITHM_BIP340SECP256K1", + Self::Ed25519 => "SCHNORR_ALGORITHM_ED25519", + } + } + /// Creates an enum from field names used in the ProtoBuf definition. + pub fn from_str_name(value: &str) -> ::core::option::Option { + match value { + "SCHNORR_ALGORITHM_UNSPECIFIED" => Some(Self::Unspecified), + "SCHNORR_ALGORITHM_BIP340SECP256K1" => Some(Self::Bip340secp256k1), + "SCHNORR_ALGORITHM_ED25519" => Some(Self::Ed25519), + _ => None, + } + } +} +#[derive( + serde::Serialize, + serde::Deserialize, + Clone, + Copy, + Debug, + PartialEq, + Eq, + Hash, + PartialOrd, + Ord, + ::prost::Enumeration, +)] +#[repr(i32)] +pub enum VetKdCurve { + Unspecified = 0, + Bls12381G2 = 1, +} +impl VetKdCurve { + /// String value of the enum field names used in the ProtoBuf definition. + /// + /// The values are not transformed in any way and thus are considered stable + /// (if the ProtoBuf definition does not change) and safe for programmatic use. + pub fn as_str_name(&self) -> &'static str { + match self { + Self::Unspecified => "VET_KD_CURVE_UNSPECIFIED", + Self::Bls12381G2 => "VET_KD_CURVE_BLS12_381_G2", + } + } + /// Creates an enum from field names used in the ProtoBuf definition. + pub fn from_str_name(value: &str) -> ::core::option::Option { + match value { + "VET_KD_CURVE_UNSPECIFIED" => Some(Self::Unspecified), + "VET_KD_CURVE_BLS12_381_G2" => Some(Self::Bls12381G2), + _ => None, + } + } +} diff --git a/rs/protobuf/src/gen/messaging/types.v1.rs b/rs/protobuf/src/gen/messaging/types.v1.rs index c77f017b956..a49c3e2e36f 100644 --- a/rs/protobuf/src/gen/messaging/types.v1.rs +++ b/rs/protobuf/src/gen/messaging/types.v1.rs @@ -43,6 +43,44 @@ pub struct NominalCycles { #[prost(uint64, tag = "2")] pub low: u64, } +#[derive(serde::Serialize, serde::Deserialize, Clone, PartialEq, ::prost::Message)] +pub struct EcdsaKeyId { + #[prost(enumeration = "EcdsaCurve", tag = "1")] + pub curve: i32, + #[prost(string, tag = "2")] + pub name: ::prost::alloc::string::String, +} +#[derive(serde::Serialize, serde::Deserialize, Clone, PartialEq, ::prost::Message)] +pub struct SchnorrKeyId { + #[prost(enumeration = "SchnorrAlgorithm", tag = "1")] + pub algorithm: i32, + #[prost(string, tag = "2")] + pub name: ::prost::alloc::string::String, +} +#[derive(serde::Serialize, serde::Deserialize, Clone, PartialEq, ::prost::Message)] +pub struct VetKdKeyId { + #[prost(enumeration = "VetKdCurve", tag = "1")] + pub curve: i32, + #[prost(string, tag = "2")] + pub name: ::prost::alloc::string::String, +} +#[derive(serde::Serialize, serde::Deserialize, Clone, PartialEq, ::prost::Message)] +pub struct MasterPublicKeyId { + #[prost(oneof = "master_public_key_id::KeyId", tags = "1, 2, 3")] + pub key_id: ::core::option::Option, +} +/// Nested message and enum types in `MasterPublicKeyId`. +pub mod master_public_key_id { + #[derive(serde::Serialize, serde::Deserialize, Clone, PartialEq, ::prost::Oneof)] + pub enum KeyId { + #[prost(message, tag = "1")] + Ecdsa(super::EcdsaKeyId), + #[prost(message, tag = "2")] + Schnorr(super::SchnorrKeyId), + #[prost(message, tag = "3")] + Vetkd(super::VetKdKeyId), + } +} /// A non-interactive distributed key generation (NI-DKG) tag. #[derive( serde::Serialize, @@ -85,6 +123,125 @@ impl NiDkgTag { } } } +/// Types of curves that can be used for ECDSA signatures. +#[derive( + serde::Serialize, + serde::Deserialize, + Clone, + Copy, + Debug, + PartialEq, + Eq, + Hash, + PartialOrd, + Ord, + ::prost::Enumeration, +)] +#[repr(i32)] +pub enum EcdsaCurve { + Unspecified = 0, + Secp256k1 = 1, +} +impl EcdsaCurve { + /// String value of the enum field names used in the ProtoBuf definition. + /// + /// The values are not transformed in any way and thus are considered stable + /// (if the ProtoBuf definition does not change) and safe for programmatic use. + pub fn as_str_name(&self) -> &'static str { + match self { + Self::Unspecified => "ECDSA_CURVE_UNSPECIFIED", + Self::Secp256k1 => "ECDSA_CURVE_SECP256K1", + } + } + /// Creates an enum from field names used in the ProtoBuf definition. + pub fn from_str_name(value: &str) -> ::core::option::Option { + match value { + "ECDSA_CURVE_UNSPECIFIED" => Some(Self::Unspecified), + "ECDSA_CURVE_SECP256K1" => Some(Self::Secp256k1), + _ => None, + } + } +} +/// Types of curves that can be used for Schnorr signatures. +#[derive( + serde::Serialize, + serde::Deserialize, + Clone, + Copy, + Debug, + PartialEq, + Eq, + Hash, + PartialOrd, + Ord, + ::prost::Enumeration, +)] +#[repr(i32)] +pub enum SchnorrAlgorithm { + Unspecified = 0, + Bip340secp256k1 = 1, + Ed25519 = 2, +} +impl SchnorrAlgorithm { + /// String value of the enum field names used in the ProtoBuf definition. + /// + /// The values are not transformed in any way and thus are considered stable + /// (if the ProtoBuf definition does not change) and safe for programmatic use. + pub fn as_str_name(&self) -> &'static str { + match self { + Self::Unspecified => "SCHNORR_ALGORITHM_UNSPECIFIED", + Self::Bip340secp256k1 => "SCHNORR_ALGORITHM_BIP340SECP256K1", + Self::Ed25519 => "SCHNORR_ALGORITHM_ED25519", + } + } + /// Creates an enum from field names used in the ProtoBuf definition. + pub fn from_str_name(value: &str) -> ::core::option::Option { + match value { + "SCHNORR_ALGORITHM_UNSPECIFIED" => Some(Self::Unspecified), + "SCHNORR_ALGORITHM_BIP340SECP256K1" => Some(Self::Bip340secp256k1), + "SCHNORR_ALGORITHM_ED25519" => Some(Self::Ed25519), + _ => None, + } + } +} +#[derive( + serde::Serialize, + serde::Deserialize, + Clone, + Copy, + Debug, + PartialEq, + Eq, + Hash, + PartialOrd, + Ord, + ::prost::Enumeration, +)] +#[repr(i32)] +pub enum VetKdCurve { + Unspecified = 0, + Bls12381G2 = 1, +} +impl VetKdCurve { + /// String value of the enum field names used in the ProtoBuf definition. + /// + /// The values are not transformed in any way and thus are considered stable + /// (if the ProtoBuf definition does not change) and safe for programmatic use. + pub fn as_str_name(&self) -> &'static str { + match self { + Self::Unspecified => "VET_KD_CURVE_UNSPECIFIED", + Self::Bls12381G2 => "VET_KD_CURVE_BLS12_381_G2", + } + } + /// Creates an enum from field names used in the ProtoBuf definition. + pub fn from_str_name(value: &str) -> ::core::option::Option { + match value { + "VET_KD_CURVE_UNSPECIFIED" => Some(Self::Unspecified), + "VET_KD_CURVE_BLS12_381_G2" => Some(Self::Bls12381G2), + _ => None, + } + } +} #[derive(serde::Serialize, serde::Deserialize, Clone, PartialEq, ::prost::Message)] pub struct BasicSignature { #[prost(bytes = "vec", tag = "1")] diff --git a/rs/protobuf/src/gen/registry/registry.crypto.v1.rs b/rs/protobuf/src/gen/registry/registry.crypto.v1.rs index 1df6d48effd..d1a25591edb 100644 --- a/rs/protobuf/src/gen/registry/registry.crypto.v1.rs +++ b/rs/protobuf/src/gen/registry/registry.crypto.v1.rs @@ -54,46 +54,6 @@ pub struct X509PublicKeyCert { #[prost(bytes = "vec", tag = "1")] pub certificate_der: ::prost::alloc::vec::Vec, } -#[derive( - serde::Serialize, serde::Deserialize, candid::CandidType, Eq, Clone, PartialEq, ::prost::Message, -)] -pub struct EcdsaKeyId { - #[prost(enumeration = "EcdsaCurve", tag = "1")] - pub curve: i32, - #[prost(string, tag = "2")] - pub name: ::prost::alloc::string::String, -} -#[derive(serde::Serialize, serde::Deserialize, Clone, PartialEq, ::prost::Message)] -pub struct SchnorrKeyId { - #[prost(enumeration = "SchnorrAlgorithm", tag = "1")] - pub algorithm: i32, - #[prost(string, tag = "2")] - pub name: ::prost::alloc::string::String, -} -#[derive(serde::Serialize, serde::Deserialize, Clone, PartialEq, ::prost::Message)] -pub struct VetKdKeyId { - #[prost(enumeration = "VetKdCurve", tag = "1")] - pub curve: i32, - #[prost(string, tag = "2")] - pub name: ::prost::alloc::string::String, -} -#[derive(serde::Serialize, serde::Deserialize, Clone, PartialEq, ::prost::Message)] -pub struct MasterPublicKeyId { - #[prost(oneof = "master_public_key_id::KeyId", tags = "1, 2, 3")] - pub key_id: ::core::option::Option, -} -/// Nested message and enum types in `MasterPublicKeyId`. -pub mod master_public_key_id { - #[derive(serde::Serialize, serde::Deserialize, Clone, PartialEq, ::prost::Oneof)] - pub enum KeyId { - #[prost(message, tag = "1")] - Ecdsa(super::EcdsaKeyId), - #[prost(message, tag = "2")] - Schnorr(super::SchnorrKeyId), - #[prost(message, tag = "3")] - Vetkd(super::VetKdKeyId), - } -} /// An algorithm ID. This is used to specify the signature algorithm associated with a public key. #[derive( serde::Serialize, @@ -187,123 +147,3 @@ impl AlgorithmId { } } } -/// Types of curves that can be used for ECDSA signatures. -#[derive( - serde::Serialize, - serde::Deserialize, - candid::CandidType, - Clone, - Copy, - Debug, - PartialEq, - Eq, - Hash, - PartialOrd, - Ord, - ::prost::Enumeration, -)] -#[repr(i32)] -pub enum EcdsaCurve { - Unspecified = 0, - Secp256k1 = 1, -} -impl EcdsaCurve { - /// String value of the enum field names used in the ProtoBuf definition. - /// - /// The values are not transformed in any way and thus are considered stable - /// (if the ProtoBuf definition does not change) and safe for programmatic use. - pub fn as_str_name(&self) -> &'static str { - match self { - Self::Unspecified => "ECDSA_CURVE_UNSPECIFIED", - Self::Secp256k1 => "ECDSA_CURVE_SECP256K1", - } - } - /// Creates an enum from field names used in the ProtoBuf definition. - pub fn from_str_name(value: &str) -> ::core::option::Option { - match value { - "ECDSA_CURVE_UNSPECIFIED" => Some(Self::Unspecified), - "ECDSA_CURVE_SECP256K1" => Some(Self::Secp256k1), - _ => None, - } - } -} -/// Types of curves that can be used for Schnorr signatures. -#[derive( - serde::Serialize, - serde::Deserialize, - Clone, - Copy, - Debug, - PartialEq, - Eq, - Hash, - PartialOrd, - Ord, - ::prost::Enumeration, -)] -#[repr(i32)] -pub enum SchnorrAlgorithm { - Unspecified = 0, - Bip340secp256k1 = 1, - Ed25519 = 2, -} -impl SchnorrAlgorithm { - /// String value of the enum field names used in the ProtoBuf definition. - /// - /// The values are not transformed in any way and thus are considered stable - /// (if the ProtoBuf definition does not change) and safe for programmatic use. - pub fn as_str_name(&self) -> &'static str { - match self { - Self::Unspecified => "SCHNORR_ALGORITHM_UNSPECIFIED", - Self::Bip340secp256k1 => "SCHNORR_ALGORITHM_BIP340SECP256K1", - Self::Ed25519 => "SCHNORR_ALGORITHM_ED25519", - } - } - /// Creates an enum from field names used in the ProtoBuf definition. - pub fn from_str_name(value: &str) -> ::core::option::Option { - match value { - "SCHNORR_ALGORITHM_UNSPECIFIED" => Some(Self::Unspecified), - "SCHNORR_ALGORITHM_BIP340SECP256K1" => Some(Self::Bip340secp256k1), - "SCHNORR_ALGORITHM_ED25519" => Some(Self::Ed25519), - _ => None, - } - } -} -#[derive( - serde::Serialize, - serde::Deserialize, - Clone, - Copy, - Debug, - PartialEq, - Eq, - Hash, - PartialOrd, - Ord, - ::prost::Enumeration, -)] -#[repr(i32)] -pub enum VetKdCurve { - Unspecified = 0, - Bls12381G2 = 1, -} -impl VetKdCurve { - /// String value of the enum field names used in the ProtoBuf definition. - /// - /// The values are not transformed in any way and thus are considered stable - /// (if the ProtoBuf definition does not change) and safe for programmatic use. - pub fn as_str_name(&self) -> &'static str { - match self { - Self::Unspecified => "VET_KD_CURVE_UNSPECIFIED", - Self::Bls12381G2 => "VET_KD_CURVE_BLS12_381_G2", - } - } - /// Creates an enum from field names used in the ProtoBuf definition. - pub fn from_str_name(value: &str) -> ::core::option::Option { - match value { - "VET_KD_CURVE_UNSPECIFIED" => Some(Self::Unspecified), - "VET_KD_CURVE_BLS12_381_G2" => Some(Self::Bls12381G2), - _ => None, - } - } -} diff --git a/rs/protobuf/src/gen/registry/registry.subnet.v1.rs b/rs/protobuf/src/gen/registry/registry.subnet.v1.rs index 6b4348175cf..a52519c9d03 100644 --- a/rs/protobuf/src/gen/registry/registry.subnet.v1.rs +++ b/rs/protobuf/src/gen/registry/registry.subnet.v1.rs @@ -81,14 +81,14 @@ pub struct SubnetRecord { #[derive(serde::Serialize, serde::Deserialize, Clone, PartialEq, ::prost::Message)] pub struct EcdsaInitialization { #[prost(message, optional, tag = "1")] - pub key_id: ::core::option::Option, + pub key_id: ::core::option::Option, #[prost(message, optional, tag = "2")] pub dealings: ::core::option::Option, } #[derive(serde::Serialize, serde::Deserialize, Clone, PartialEq, ::prost::Message)] pub struct ChainKeyInitialization { #[prost(message, optional, tag = "1")] - pub key_id: ::core::option::Option, + pub key_id: ::core::option::Option, #[prost(oneof = "chain_key_initialization::Initialization", tags = "2, 3")] pub initialization: ::core::option::Option, } @@ -326,7 +326,7 @@ pub struct EcdsaConfig { pub quadruples_to_create_in_advance: u32, /// Identifiers for threshold ECDSA keys held by the subnet. #[prost(message, repeated, tag = "3")] - pub key_ids: ::prost::alloc::vec::Vec, + pub key_ids: ::prost::alloc::vec::Vec, /// The maximum number of signature requests that can be enqueued at once. #[prost(uint32, tag = "4")] pub max_queue_size: u32, @@ -342,7 +342,7 @@ pub struct EcdsaConfig { pub struct KeyConfig { /// The key's identifier. #[prost(message, optional, tag = "1")] - pub key_id: ::core::option::Option, + pub key_id: ::core::option::Option, /// Number of pre-signatures to create in advance. #[prost(uint32, optional, tag = "3")] pub pre_signatures_to_create_in_advance: ::core::option::Option, diff --git a/rs/protobuf/src/gen/registry/types.v1.rs b/rs/protobuf/src/gen/registry/types.v1.rs index e2cd92f4a01..a4772d33102 100644 --- a/rs/protobuf/src/gen/registry/types.v1.rs +++ b/rs/protobuf/src/gen/registry/types.v1.rs @@ -43,6 +43,44 @@ pub struct NominalCycles { #[prost(uint64, tag = "2")] pub low: u64, } +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct EcdsaKeyId { + #[prost(enumeration = "EcdsaCurve", tag = "1")] + pub curve: i32, + #[prost(string, tag = "2")] + pub name: ::prost::alloc::string::String, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct SchnorrKeyId { + #[prost(enumeration = "SchnorrAlgorithm", tag = "1")] + pub algorithm: i32, + #[prost(string, tag = "2")] + pub name: ::prost::alloc::string::String, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct VetKdKeyId { + #[prost(enumeration = "VetKdCurve", tag = "1")] + pub curve: i32, + #[prost(string, tag = "2")] + pub name: ::prost::alloc::string::String, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MasterPublicKeyId { + #[prost(oneof = "master_public_key_id::KeyId", tags = "1, 2, 3")] + pub key_id: ::core::option::Option, +} +/// Nested message and enum types in `MasterPublicKeyId`. +pub mod master_public_key_id { + #[derive(Clone, PartialEq, ::prost::Oneof)] + pub enum KeyId { + #[prost(message, tag = "1")] + Ecdsa(super::EcdsaKeyId), + #[prost(message, tag = "2")] + Schnorr(super::SchnorrKeyId), + #[prost(message, tag = "3")] + Vetkd(super::VetKdKeyId), + } +} /// A non-interactive distributed key generation (NI-DKG) tag. #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] #[repr(i32)] @@ -73,3 +111,86 @@ impl NiDkgTag { } } } +/// Types of curves that can be used for ECDSA signatures. +#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] +#[repr(i32)] +pub enum EcdsaCurve { + Unspecified = 0, + Secp256k1 = 1, +} +impl EcdsaCurve { + /// String value of the enum field names used in the ProtoBuf definition. + /// + /// The values are not transformed in any way and thus are considered stable + /// (if the ProtoBuf definition does not change) and safe for programmatic use. + pub fn as_str_name(&self) -> &'static str { + match self { + Self::Unspecified => "ECDSA_CURVE_UNSPECIFIED", + Self::Secp256k1 => "ECDSA_CURVE_SECP256K1", + } + } + /// Creates an enum from field names used in the ProtoBuf definition. + pub fn from_str_name(value: &str) -> ::core::option::Option { + match value { + "ECDSA_CURVE_UNSPECIFIED" => Some(Self::Unspecified), + "ECDSA_CURVE_SECP256K1" => Some(Self::Secp256k1), + _ => None, + } + } +} +/// Types of curves that can be used for Schnorr signatures. +#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] +#[repr(i32)] +pub enum SchnorrAlgorithm { + Unspecified = 0, + Bip340secp256k1 = 1, + Ed25519 = 2, +} +impl SchnorrAlgorithm { + /// String value of the enum field names used in the ProtoBuf definition. + /// + /// The values are not transformed in any way and thus are considered stable + /// (if the ProtoBuf definition does not change) and safe for programmatic use. + pub fn as_str_name(&self) -> &'static str { + match self { + Self::Unspecified => "SCHNORR_ALGORITHM_UNSPECIFIED", + Self::Bip340secp256k1 => "SCHNORR_ALGORITHM_BIP340SECP256K1", + Self::Ed25519 => "SCHNORR_ALGORITHM_ED25519", + } + } + /// Creates an enum from field names used in the ProtoBuf definition. + pub fn from_str_name(value: &str) -> ::core::option::Option { + match value { + "SCHNORR_ALGORITHM_UNSPECIFIED" => Some(Self::Unspecified), + "SCHNORR_ALGORITHM_BIP340SECP256K1" => Some(Self::Bip340secp256k1), + "SCHNORR_ALGORITHM_ED25519" => Some(Self::Ed25519), + _ => None, + } + } +} +#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] +#[repr(i32)] +pub enum VetKdCurve { + Unspecified = 0, + Bls12381G2 = 1, +} +impl VetKdCurve { + /// String value of the enum field names used in the ProtoBuf definition. + /// + /// The values are not transformed in any way and thus are considered stable + /// (if the ProtoBuf definition does not change) and safe for programmatic use. + pub fn as_str_name(&self) -> &'static str { + match self { + Self::Unspecified => "VET_KD_CURVE_UNSPECIFIED", + Self::Bls12381G2 => "VET_KD_CURVE_BLS12_381_G2", + } + } + /// Creates an enum from field names used in the ProtoBuf definition. + pub fn from_str_name(value: &str) -> ::core::option::Option { + match value { + "VET_KD_CURVE_UNSPECIFIED" => Some(Self::Unspecified), + "VET_KD_CURVE_BLS12_381_G2" => Some(Self::Bls12381G2), + _ => None, + } + } +} diff --git a/rs/protobuf/src/gen/state/registry.crypto.v1.rs b/rs/protobuf/src/gen/state/registry.crypto.v1.rs index 9f0c609fbb7..85ecbcb0b96 100644 --- a/rs/protobuf/src/gen/state/registry.crypto.v1.rs +++ b/rs/protobuf/src/gen/state/registry.crypto.v1.rs @@ -34,44 +34,6 @@ pub struct X509PublicKeyCert { #[prost(bytes = "vec", tag = "1")] pub certificate_der: ::prost::alloc::vec::Vec, } -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct EcdsaKeyId { - #[prost(enumeration = "EcdsaCurve", tag = "1")] - pub curve: i32, - #[prost(string, tag = "2")] - pub name: ::prost::alloc::string::String, -} -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct SchnorrKeyId { - #[prost(enumeration = "SchnorrAlgorithm", tag = "1")] - pub algorithm: i32, - #[prost(string, tag = "2")] - pub name: ::prost::alloc::string::String, -} -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct VetKdKeyId { - #[prost(enumeration = "VetKdCurve", tag = "1")] - pub curve: i32, - #[prost(string, tag = "2")] - pub name: ::prost::alloc::string::String, -} -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct MasterPublicKeyId { - #[prost(oneof = "master_public_key_id::KeyId", tags = "1, 2, 3")] - pub key_id: ::core::option::Option, -} -/// Nested message and enum types in `MasterPublicKeyId`. -pub mod master_public_key_id { - #[derive(Clone, PartialEq, ::prost::Oneof)] - pub enum KeyId { - #[prost(message, tag = "1")] - Ecdsa(super::EcdsaKeyId), - #[prost(message, tag = "2")] - Schnorr(super::SchnorrKeyId), - #[prost(message, tag = "3")] - Vetkd(super::VetKdKeyId), - } -} /// An algorithm ID. This is used to specify the signature algorithm associated with a public key. #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] #[repr(i32)] @@ -153,86 +115,3 @@ impl AlgorithmId { } } } -/// Types of curves that can be used for ECDSA signatures. -#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] -#[repr(i32)] -pub enum EcdsaCurve { - Unspecified = 0, - Secp256k1 = 1, -} -impl EcdsaCurve { - /// String value of the enum field names used in the ProtoBuf definition. - /// - /// The values are not transformed in any way and thus are considered stable - /// (if the ProtoBuf definition does not change) and safe for programmatic use. - pub fn as_str_name(&self) -> &'static str { - match self { - Self::Unspecified => "ECDSA_CURVE_UNSPECIFIED", - Self::Secp256k1 => "ECDSA_CURVE_SECP256K1", - } - } - /// Creates an enum from field names used in the ProtoBuf definition. - pub fn from_str_name(value: &str) -> ::core::option::Option { - match value { - "ECDSA_CURVE_UNSPECIFIED" => Some(Self::Unspecified), - "ECDSA_CURVE_SECP256K1" => Some(Self::Secp256k1), - _ => None, - } - } -} -/// Types of curves that can be used for Schnorr signatures. -#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] -#[repr(i32)] -pub enum SchnorrAlgorithm { - Unspecified = 0, - Bip340secp256k1 = 1, - Ed25519 = 2, -} -impl SchnorrAlgorithm { - /// String value of the enum field names used in the ProtoBuf definition. - /// - /// The values are not transformed in any way and thus are considered stable - /// (if the ProtoBuf definition does not change) and safe for programmatic use. - pub fn as_str_name(&self) -> &'static str { - match self { - Self::Unspecified => "SCHNORR_ALGORITHM_UNSPECIFIED", - Self::Bip340secp256k1 => "SCHNORR_ALGORITHM_BIP340SECP256K1", - Self::Ed25519 => "SCHNORR_ALGORITHM_ED25519", - } - } - /// Creates an enum from field names used in the ProtoBuf definition. - pub fn from_str_name(value: &str) -> ::core::option::Option { - match value { - "SCHNORR_ALGORITHM_UNSPECIFIED" => Some(Self::Unspecified), - "SCHNORR_ALGORITHM_BIP340SECP256K1" => Some(Self::Bip340secp256k1), - "SCHNORR_ALGORITHM_ED25519" => Some(Self::Ed25519), - _ => None, - } - } -} -#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] -#[repr(i32)] -pub enum VetKdCurve { - Unspecified = 0, - Bls12381G2 = 1, -} -impl VetKdCurve { - /// String value of the enum field names used in the ProtoBuf definition. - /// - /// The values are not transformed in any way and thus are considered stable - /// (if the ProtoBuf definition does not change) and safe for programmatic use. - pub fn as_str_name(&self) -> &'static str { - match self { - Self::Unspecified => "VET_KD_CURVE_UNSPECIFIED", - Self::Bls12381G2 => "VET_KD_CURVE_BLS12_381_G2", - } - } - /// Creates an enum from field names used in the ProtoBuf definition. - pub fn from_str_name(value: &str) -> ::core::option::Option { - match value { - "VET_KD_CURVE_UNSPECIFIED" => Some(Self::Unspecified), - "VET_KD_CURVE_BLS12_381_G2" => Some(Self::Bls12381G2), - _ => None, - } - } -} diff --git a/rs/protobuf/src/gen/state/registry.subnet.v1.rs b/rs/protobuf/src/gen/state/registry.subnet.v1.rs index 62a050400cd..2481c2220fb 100644 --- a/rs/protobuf/src/gen/state/registry.subnet.v1.rs +++ b/rs/protobuf/src/gen/state/registry.subnet.v1.rs @@ -81,14 +81,14 @@ pub struct SubnetRecord { #[derive(Clone, PartialEq, ::prost::Message)] pub struct EcdsaInitialization { #[prost(message, optional, tag = "1")] - pub key_id: ::core::option::Option, + pub key_id: ::core::option::Option, #[prost(message, optional, tag = "2")] pub dealings: ::core::option::Option, } #[derive(Clone, PartialEq, ::prost::Message)] pub struct ChainKeyInitialization { #[prost(message, optional, tag = "1")] - pub key_id: ::core::option::Option, + pub key_id: ::core::option::Option, #[prost(oneof = "chain_key_initialization::Initialization", tags = "2, 3")] pub initialization: ::core::option::Option, } @@ -315,7 +315,7 @@ pub struct EcdsaConfig { pub quadruples_to_create_in_advance: u32, /// Identifiers for threshold ECDSA keys held by the subnet. #[prost(message, repeated, tag = "3")] - pub key_ids: ::prost::alloc::vec::Vec, + pub key_ids: ::prost::alloc::vec::Vec, /// The maximum number of signature requests that can be enqueued at once. #[prost(uint32, tag = "4")] pub max_queue_size: u32, @@ -331,7 +331,7 @@ pub struct EcdsaConfig { pub struct KeyConfig { /// The key's identifier. #[prost(message, optional, tag = "1")] - pub key_id: ::core::option::Option, + pub key_id: ::core::option::Option, /// Number of pre-signatures to create in advance. #[prost(uint32, optional, tag = "3")] pub pre_signatures_to_create_in_advance: ::core::option::Option, diff --git a/rs/protobuf/src/gen/state/state.metadata.v1.rs b/rs/protobuf/src/gen/state/state.metadata.v1.rs index 072ac12e03f..5b700df6215 100644 --- a/rs/protobuf/src/gen/state/state.metadata.v1.rs +++ b/rs/protobuf/src/gen/state/state.metadata.v1.rs @@ -26,8 +26,7 @@ pub struct SubnetTopology { pub subnet_features: ::core::option::Option, #[prost(message, repeated, tag = "6")] - pub idkg_keys_held: - ::prost::alloc::vec::Vec, + pub idkg_keys_held: ::prost::alloc::vec::Vec, } #[derive(Clone, PartialEq, ::prost::Message)] pub struct SubnetsEntry { @@ -39,8 +38,7 @@ pub struct SubnetsEntry { #[derive(Clone, PartialEq, ::prost::Message)] pub struct IDkgKeyEntry { #[prost(message, optional, tag = "1")] - pub key_id: - ::core::option::Option, + pub key_id: ::core::option::Option, #[prost(message, repeated, tag = "2")] pub subnet_ids: ::prost::alloc::vec::Vec, } @@ -89,14 +87,14 @@ pub struct SetupInitialDkgContextTree { #[derive(Clone, PartialEq, ::prost::Message)] pub struct EcdsaArguments { #[prost(message, optional, tag = "1")] - pub key_id: ::core::option::Option, + pub key_id: ::core::option::Option, #[prost(bytes = "vec", tag = "2")] pub message_hash: ::prost::alloc::vec::Vec, } #[derive(Clone, PartialEq, ::prost::Message)] pub struct SchnorrArguments { #[prost(message, optional, tag = "1")] - pub key_id: ::core::option::Option, + pub key_id: ::core::option::Option, #[prost(bytes = "vec", tag = "2")] pub message: ::prost::alloc::vec::Vec, } @@ -181,8 +179,7 @@ pub struct IDkgDealingsContext { #[prost(message, optional, tag = "1")] pub request: ::core::option::Option, #[prost(message, optional, tag = "2")] - pub key_id: - ::core::option::Option, + pub key_id: ::core::option::Option, #[prost(message, repeated, tag = "3")] pub nodes: ::prost::alloc::vec::Vec, #[prost(uint64, tag = "4")] @@ -393,8 +390,7 @@ pub struct ApiBoundaryNodeEntry { #[derive(Clone, PartialEq, ::prost::Message)] pub struct ThresholdSignatureAgreementsEntry { #[prost(message, optional, tag = "1")] - pub key_id: - ::core::option::Option, + pub key_id: ::core::option::Option, #[prost(uint64, tag = "2")] pub count: u64, } diff --git a/rs/protobuf/src/gen/state/types.v1.rs b/rs/protobuf/src/gen/state/types.v1.rs index fcb02a95163..24d72856531 100644 --- a/rs/protobuf/src/gen/state/types.v1.rs +++ b/rs/protobuf/src/gen/state/types.v1.rs @@ -43,6 +43,44 @@ pub struct NominalCycles { #[prost(uint64, tag = "2")] pub low: u64, } +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct EcdsaKeyId { + #[prost(enumeration = "EcdsaCurve", tag = "1")] + pub curve: i32, + #[prost(string, tag = "2")] + pub name: ::prost::alloc::string::String, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct SchnorrKeyId { + #[prost(enumeration = "SchnorrAlgorithm", tag = "1")] + pub algorithm: i32, + #[prost(string, tag = "2")] + pub name: ::prost::alloc::string::String, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct VetKdKeyId { + #[prost(enumeration = "VetKdCurve", tag = "1")] + pub curve: i32, + #[prost(string, tag = "2")] + pub name: ::prost::alloc::string::String, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MasterPublicKeyId { + #[prost(oneof = "master_public_key_id::KeyId", tags = "1, 2, 3")] + pub key_id: ::core::option::Option, +} +/// Nested message and enum types in `MasterPublicKeyId`. +pub mod master_public_key_id { + #[derive(Clone, PartialEq, ::prost::Oneof)] + pub enum KeyId { + #[prost(message, tag = "1")] + Ecdsa(super::EcdsaKeyId), + #[prost(message, tag = "2")] + Schnorr(super::SchnorrKeyId), + #[prost(message, tag = "3")] + Vetkd(super::VetKdKeyId), + } +} /// A non-interactive distributed key generation (NI-DKG) tag. #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] #[repr(i32)] @@ -73,6 +111,89 @@ impl NiDkgTag { } } } +/// Types of curves that can be used for ECDSA signatures. +#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] +#[repr(i32)] +pub enum EcdsaCurve { + Unspecified = 0, + Secp256k1 = 1, +} +impl EcdsaCurve { + /// String value of the enum field names used in the ProtoBuf definition. + /// + /// The values are not transformed in any way and thus are considered stable + /// (if the ProtoBuf definition does not change) and safe for programmatic use. + pub fn as_str_name(&self) -> &'static str { + match self { + Self::Unspecified => "ECDSA_CURVE_UNSPECIFIED", + Self::Secp256k1 => "ECDSA_CURVE_SECP256K1", + } + } + /// Creates an enum from field names used in the ProtoBuf definition. + pub fn from_str_name(value: &str) -> ::core::option::Option { + match value { + "ECDSA_CURVE_UNSPECIFIED" => Some(Self::Unspecified), + "ECDSA_CURVE_SECP256K1" => Some(Self::Secp256k1), + _ => None, + } + } +} +/// Types of curves that can be used for Schnorr signatures. +#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] +#[repr(i32)] +pub enum SchnorrAlgorithm { + Unspecified = 0, + Bip340secp256k1 = 1, + Ed25519 = 2, +} +impl SchnorrAlgorithm { + /// String value of the enum field names used in the ProtoBuf definition. + /// + /// The values are not transformed in any way and thus are considered stable + /// (if the ProtoBuf definition does not change) and safe for programmatic use. + pub fn as_str_name(&self) -> &'static str { + match self { + Self::Unspecified => "SCHNORR_ALGORITHM_UNSPECIFIED", + Self::Bip340secp256k1 => "SCHNORR_ALGORITHM_BIP340SECP256K1", + Self::Ed25519 => "SCHNORR_ALGORITHM_ED25519", + } + } + /// Creates an enum from field names used in the ProtoBuf definition. + pub fn from_str_name(value: &str) -> ::core::option::Option { + match value { + "SCHNORR_ALGORITHM_UNSPECIFIED" => Some(Self::Unspecified), + "SCHNORR_ALGORITHM_BIP340SECP256K1" => Some(Self::Bip340secp256k1), + "SCHNORR_ALGORITHM_ED25519" => Some(Self::Ed25519), + _ => None, + } + } +} +#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] +#[repr(i32)] +pub enum VetKdCurve { + Unspecified = 0, + Bls12381G2 = 1, +} +impl VetKdCurve { + /// String value of the enum field names used in the ProtoBuf definition. + /// + /// The values are not transformed in any way and thus are considered stable + /// (if the ProtoBuf definition does not change) and safe for programmatic use. + pub fn as_str_name(&self) -> &'static str { + match self { + Self::Unspecified => "VET_KD_CURVE_UNSPECIFIED", + Self::Bls12381G2 => "VET_KD_CURVE_BLS12_381_G2", + } + } + /// Creates an enum from field names used in the ProtoBuf definition. + pub fn from_str_name(value: &str) -> ::core::option::Option { + match value { + "VET_KD_CURVE_UNSPECIFIED" => Some(Self::Unspecified), + "VET_KD_CURVE_BLS12_381_G2" => Some(Self::Bls12381G2), + _ => None, + } + } +} #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] #[repr(i32)] pub enum RejectCode { diff --git a/rs/protobuf/src/gen/types/registry.crypto.v1.rs b/rs/protobuf/src/gen/types/registry.crypto.v1.rs index 9f0c609fbb7..85ecbcb0b96 100644 --- a/rs/protobuf/src/gen/types/registry.crypto.v1.rs +++ b/rs/protobuf/src/gen/types/registry.crypto.v1.rs @@ -34,44 +34,6 @@ pub struct X509PublicKeyCert { #[prost(bytes = "vec", tag = "1")] pub certificate_der: ::prost::alloc::vec::Vec, } -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct EcdsaKeyId { - #[prost(enumeration = "EcdsaCurve", tag = "1")] - pub curve: i32, - #[prost(string, tag = "2")] - pub name: ::prost::alloc::string::String, -} -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct SchnorrKeyId { - #[prost(enumeration = "SchnorrAlgorithm", tag = "1")] - pub algorithm: i32, - #[prost(string, tag = "2")] - pub name: ::prost::alloc::string::String, -} -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct VetKdKeyId { - #[prost(enumeration = "VetKdCurve", tag = "1")] - pub curve: i32, - #[prost(string, tag = "2")] - pub name: ::prost::alloc::string::String, -} -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct MasterPublicKeyId { - #[prost(oneof = "master_public_key_id::KeyId", tags = "1, 2, 3")] - pub key_id: ::core::option::Option, -} -/// Nested message and enum types in `MasterPublicKeyId`. -pub mod master_public_key_id { - #[derive(Clone, PartialEq, ::prost::Oneof)] - pub enum KeyId { - #[prost(message, tag = "1")] - Ecdsa(super::EcdsaKeyId), - #[prost(message, tag = "2")] - Schnorr(super::SchnorrKeyId), - #[prost(message, tag = "3")] - Vetkd(super::VetKdKeyId), - } -} /// An algorithm ID. This is used to specify the signature algorithm associated with a public key. #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] #[repr(i32)] @@ -153,86 +115,3 @@ impl AlgorithmId { } } } -/// Types of curves that can be used for ECDSA signatures. -#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] -#[repr(i32)] -pub enum EcdsaCurve { - Unspecified = 0, - Secp256k1 = 1, -} -impl EcdsaCurve { - /// String value of the enum field names used in the ProtoBuf definition. - /// - /// The values are not transformed in any way and thus are considered stable - /// (if the ProtoBuf definition does not change) and safe for programmatic use. - pub fn as_str_name(&self) -> &'static str { - match self { - Self::Unspecified => "ECDSA_CURVE_UNSPECIFIED", - Self::Secp256k1 => "ECDSA_CURVE_SECP256K1", - } - } - /// Creates an enum from field names used in the ProtoBuf definition. - pub fn from_str_name(value: &str) -> ::core::option::Option { - match value { - "ECDSA_CURVE_UNSPECIFIED" => Some(Self::Unspecified), - "ECDSA_CURVE_SECP256K1" => Some(Self::Secp256k1), - _ => None, - } - } -} -/// Types of curves that can be used for Schnorr signatures. -#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] -#[repr(i32)] -pub enum SchnorrAlgorithm { - Unspecified = 0, - Bip340secp256k1 = 1, - Ed25519 = 2, -} -impl SchnorrAlgorithm { - /// String value of the enum field names used in the ProtoBuf definition. - /// - /// The values are not transformed in any way and thus are considered stable - /// (if the ProtoBuf definition does not change) and safe for programmatic use. - pub fn as_str_name(&self) -> &'static str { - match self { - Self::Unspecified => "SCHNORR_ALGORITHM_UNSPECIFIED", - Self::Bip340secp256k1 => "SCHNORR_ALGORITHM_BIP340SECP256K1", - Self::Ed25519 => "SCHNORR_ALGORITHM_ED25519", - } - } - /// Creates an enum from field names used in the ProtoBuf definition. - pub fn from_str_name(value: &str) -> ::core::option::Option { - match value { - "SCHNORR_ALGORITHM_UNSPECIFIED" => Some(Self::Unspecified), - "SCHNORR_ALGORITHM_BIP340SECP256K1" => Some(Self::Bip340secp256k1), - "SCHNORR_ALGORITHM_ED25519" => Some(Self::Ed25519), - _ => None, - } - } -} -#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] -#[repr(i32)] -pub enum VetKdCurve { - Unspecified = 0, - Bls12381G2 = 1, -} -impl VetKdCurve { - /// String value of the enum field names used in the ProtoBuf definition. - /// - /// The values are not transformed in any way and thus are considered stable - /// (if the ProtoBuf definition does not change) and safe for programmatic use. - pub fn as_str_name(&self) -> &'static str { - match self { - Self::Unspecified => "VET_KD_CURVE_UNSPECIFIED", - Self::Bls12381G2 => "VET_KD_CURVE_BLS12_381_G2", - } - } - /// Creates an enum from field names used in the ProtoBuf definition. - pub fn from_str_name(value: &str) -> ::core::option::Option { - match value { - "VET_KD_CURVE_UNSPECIFIED" => Some(Self::Unspecified), - "VET_KD_CURVE_BLS12_381_G2" => Some(Self::Bls12381G2), - _ => None, - } - } -} diff --git a/rs/protobuf/src/gen/types/registry.subnet.v1.rs b/rs/protobuf/src/gen/types/registry.subnet.v1.rs index 62a050400cd..2481c2220fb 100644 --- a/rs/protobuf/src/gen/types/registry.subnet.v1.rs +++ b/rs/protobuf/src/gen/types/registry.subnet.v1.rs @@ -81,14 +81,14 @@ pub struct SubnetRecord { #[derive(Clone, PartialEq, ::prost::Message)] pub struct EcdsaInitialization { #[prost(message, optional, tag = "1")] - pub key_id: ::core::option::Option, + pub key_id: ::core::option::Option, #[prost(message, optional, tag = "2")] pub dealings: ::core::option::Option, } #[derive(Clone, PartialEq, ::prost::Message)] pub struct ChainKeyInitialization { #[prost(message, optional, tag = "1")] - pub key_id: ::core::option::Option, + pub key_id: ::core::option::Option, #[prost(oneof = "chain_key_initialization::Initialization", tags = "2, 3")] pub initialization: ::core::option::Option, } @@ -315,7 +315,7 @@ pub struct EcdsaConfig { pub quadruples_to_create_in_advance: u32, /// Identifiers for threshold ECDSA keys held by the subnet. #[prost(message, repeated, tag = "3")] - pub key_ids: ::prost::alloc::vec::Vec, + pub key_ids: ::prost::alloc::vec::Vec, /// The maximum number of signature requests that can be enqueued at once. #[prost(uint32, tag = "4")] pub max_queue_size: u32, @@ -331,7 +331,7 @@ pub struct EcdsaConfig { pub struct KeyConfig { /// The key's identifier. #[prost(message, optional, tag = "1")] - pub key_id: ::core::option::Option, + pub key_id: ::core::option::Option, /// Number of pre-signatures to create in advance. #[prost(uint32, optional, tag = "3")] pub pre_signatures_to_create_in_advance: ::core::option::Option, diff --git a/rs/protobuf/src/gen/types/types.v1.rs b/rs/protobuf/src/gen/types/types.v1.rs index 945a4a113ee..c88c12f1952 100644 --- a/rs/protobuf/src/gen/types/types.v1.rs +++ b/rs/protobuf/src/gen/types/types.v1.rs @@ -130,6 +130,46 @@ pub struct NominalCycles { #[prost(uint64, tag = "2")] pub low: u64, } +#[derive( + serde::Serialize, serde::Deserialize, Eq, candid::CandidType, Clone, PartialEq, ::prost::Message, +)] +pub struct EcdsaKeyId { + #[prost(enumeration = "EcdsaCurve", tag = "1")] + pub curve: i32, + #[prost(string, tag = "2")] + pub name: ::prost::alloc::string::String, +} +#[derive(serde::Serialize, serde::Deserialize, Clone, PartialEq, ::prost::Message)] +pub struct SchnorrKeyId { + #[prost(enumeration = "SchnorrAlgorithm", tag = "1")] + pub algorithm: i32, + #[prost(string, tag = "2")] + pub name: ::prost::alloc::string::String, +} +#[derive(serde::Serialize, serde::Deserialize, Clone, PartialEq, ::prost::Message)] +pub struct VetKdKeyId { + #[prost(enumeration = "VetKdCurve", tag = "1")] + pub curve: i32, + #[prost(string, tag = "2")] + pub name: ::prost::alloc::string::String, +} +#[derive(serde::Serialize, serde::Deserialize, Clone, PartialEq, ::prost::Message)] +pub struct MasterPublicKeyId { + #[prost(oneof = "master_public_key_id::KeyId", tags = "1, 2, 3")] + pub key_id: ::core::option::Option, +} +/// Nested message and enum types in `MasterPublicKeyId`. +pub mod master_public_key_id { + #[derive(serde::Serialize, serde::Deserialize, Clone, PartialEq, ::prost::Oneof)] + pub enum KeyId { + #[prost(message, tag = "1")] + Ecdsa(super::EcdsaKeyId), + #[prost(message, tag = "2")] + Schnorr(super::SchnorrKeyId), + #[prost(message, tag = "3")] + Vetkd(super::VetKdKeyId), + } +} /// A non-interactive distributed key generation (NI-DKG) tag. #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] #[repr(i32)] @@ -160,6 +200,126 @@ impl NiDkgTag { } } } +/// Types of curves that can be used for ECDSA signatures. +#[derive( + serde::Serialize, + serde::Deserialize, + candid::CandidType, + Clone, + Copy, + Debug, + PartialEq, + Eq, + Hash, + PartialOrd, + Ord, + ::prost::Enumeration, +)] +#[repr(i32)] +pub enum EcdsaCurve { + Unspecified = 0, + Secp256k1 = 1, +} +impl EcdsaCurve { + /// String value of the enum field names used in the ProtoBuf definition. + /// + /// The values are not transformed in any way and thus are considered stable + /// (if the ProtoBuf definition does not change) and safe for programmatic use. + pub fn as_str_name(&self) -> &'static str { + match self { + Self::Unspecified => "ECDSA_CURVE_UNSPECIFIED", + Self::Secp256k1 => "ECDSA_CURVE_SECP256K1", + } + } + /// Creates an enum from field names used in the ProtoBuf definition. + pub fn from_str_name(value: &str) -> ::core::option::Option { + match value { + "ECDSA_CURVE_UNSPECIFIED" => Some(Self::Unspecified), + "ECDSA_CURVE_SECP256K1" => Some(Self::Secp256k1), + _ => None, + } + } +} +/// Types of curves that can be used for Schnorr signatures. +#[derive( + serde::Serialize, + serde::Deserialize, + Clone, + Copy, + Debug, + PartialEq, + Eq, + Hash, + PartialOrd, + Ord, + ::prost::Enumeration, +)] +#[repr(i32)] +pub enum SchnorrAlgorithm { + Unspecified = 0, + Bip340secp256k1 = 1, + Ed25519 = 2, +} +impl SchnorrAlgorithm { + /// String value of the enum field names used in the ProtoBuf definition. + /// + /// The values are not transformed in any way and thus are considered stable + /// (if the ProtoBuf definition does not change) and safe for programmatic use. + pub fn as_str_name(&self) -> &'static str { + match self { + Self::Unspecified => "SCHNORR_ALGORITHM_UNSPECIFIED", + Self::Bip340secp256k1 => "SCHNORR_ALGORITHM_BIP340SECP256K1", + Self::Ed25519 => "SCHNORR_ALGORITHM_ED25519", + } + } + /// Creates an enum from field names used in the ProtoBuf definition. + pub fn from_str_name(value: &str) -> ::core::option::Option { + match value { + "SCHNORR_ALGORITHM_UNSPECIFIED" => Some(Self::Unspecified), + "SCHNORR_ALGORITHM_BIP340SECP256K1" => Some(Self::Bip340secp256k1), + "SCHNORR_ALGORITHM_ED25519" => Some(Self::Ed25519), + _ => None, + } + } +} +#[derive( + serde::Serialize, + serde::Deserialize, + Clone, + Copy, + Debug, + PartialEq, + Eq, + Hash, + PartialOrd, + Ord, + ::prost::Enumeration, +)] +#[repr(i32)] +pub enum VetKdCurve { + Unspecified = 0, + Bls12381G2 = 1, +} +impl VetKdCurve { + /// String value of the enum field names used in the ProtoBuf definition. + /// + /// The values are not transformed in any way and thus are considered stable + /// (if the ProtoBuf definition does not change) and safe for programmatic use. + pub fn as_str_name(&self) -> &'static str { + match self { + Self::Unspecified => "VET_KD_CURVE_UNSPECIFIED", + Self::Bls12381G2 => "VET_KD_CURVE_BLS12_381_G2", + } + } + /// Creates an enum from field names used in the ProtoBuf definition. + pub fn from_str_name(value: &str) -> ::core::option::Option { + match value { + "VET_KD_CURVE_UNSPECIFIED" => Some(Self::Unspecified), + "VET_KD_CURVE_BLS12_381_G2" => Some(Self::Bls12381G2), + _ => None, + } + } +} #[derive(Clone, PartialEq, ::prost::Message)] pub struct DkgMessage { #[prost(message, optional, tag = "5")] @@ -507,8 +667,7 @@ pub struct MasterKeyTranscript { #[prost(message, optional, tag = "3")] pub next_in_creation: ::core::option::Option, #[prost(message, optional, tag = "4")] - pub master_key_id: - ::core::option::Option, + pub master_key_id: ::core::option::Option, } #[derive(Clone, PartialEq, ::prost::Message)] pub struct AvailablePreSignature { @@ -678,7 +837,7 @@ pub struct QuadrupleInCreation { #[prost(message, optional, tag = "10")] pub kappa_times_lambda: ::core::option::Option, #[prost(message, optional, tag = "12")] - pub key_id: ::core::option::Option, + pub key_id: ::core::option::Option, } #[derive(Clone, PartialEq, ::prost::Message)] pub struct PreSignatureQuadrupleRef { @@ -693,12 +852,12 @@ pub struct PreSignatureQuadrupleRef { #[prost(message, optional, tag = "5")] pub key_unmasked_ref: ::core::option::Option, #[prost(message, optional, tag = "6")] - pub key_id: ::core::option::Option, + pub key_id: ::core::option::Option, } #[derive(Clone, PartialEq, ::prost::Message)] pub struct TranscriptInCreation { #[prost(message, optional, tag = "1")] - pub key_id: ::core::option::Option, + pub key_id: ::core::option::Option, #[prost(message, optional, tag = "2")] pub blinder_unmasked_config: ::core::option::Option, #[prost(message, optional, tag = "3")] @@ -707,7 +866,7 @@ pub struct TranscriptInCreation { #[derive(Clone, PartialEq, ::prost::Message)] pub struct PreSignatureTranscriptRef { #[prost(message, optional, tag = "1")] - pub key_id: ::core::option::Option, + pub key_id: ::core::option::Option, #[prost(message, optional, tag = "2")] pub blinder_unmasked_ref: ::core::option::Option, #[prost(message, optional, tag = "3")] @@ -727,8 +886,7 @@ pub struct IDkgReshareRequest { #[prost(uint64, tag = "3")] pub registry_version: u64, #[prost(message, optional, tag = "5")] - pub master_key_id: - ::core::option::Option, + pub master_key_id: ::core::option::Option, } #[derive(Clone, PartialEq, ::prost::Message)] pub struct KeyTranscriptCreation { diff --git a/rs/protobuf/src/registry/subnet.rs b/rs/protobuf/src/registry/subnet.rs index 1e1f3e26391..df287edf5ee 100644 --- a/rs/protobuf/src/registry/subnet.rs +++ b/rs/protobuf/src/registry/subnet.rs @@ -2,10 +2,10 @@ #[path = "../gen/registry/registry.subnet.v1.rs"] pub mod v1; -use crate::registry::crypto::v1::{master_public_key_id, MasterPublicKeyId as MasterPublicKeyIdPb}; use crate::registry::subnet::v1::{ ChainKeyConfig as ChainKeyConfigPb, EcdsaConfig as EcdsaConfigPb, KeyConfig as KeyConfigPb, }; +use crate::types::v1::{master_public_key_id, MasterPublicKeyId as MasterPublicKeyIdPb}; /// This code is part of the data migration from `EcdsaConfig` to `ChainKeyConfig`. /// diff --git a/rs/registry/canister/src/invariants/crypto.rs b/rs/registry/canister/src/invariants/crypto.rs index ecc93579684..f9884169fb0 100644 --- a/rs/registry/canister/src/invariants/crypto.rs +++ b/rs/registry/canister/src/invariants/crypto.rs @@ -8,8 +8,9 @@ use crate::invariants::{ }; use ic_base_types::{subnet_id_try_from_protobuf, NodeId, SubnetId}; use ic_crypto_utils_ni_dkg::extract_subnet_threshold_sig_public_key; -use ic_protobuf::registry::crypto::v1::{MasterPublicKeyId, PublicKey, X509PublicKeyCert}; +use ic_protobuf::registry::crypto::v1::{PublicKey, X509PublicKeyCert}; use ic_protobuf::registry::subnet::v1::{CatchUpPackageContents, SubnetRecord}; +use ic_protobuf::types::v1::MasterPublicKeyId; use ic_registry_keys::{ get_master_public_key_id_from_signing_subnet_list_key, make_catch_up_package_contents_key, make_crypto_threshold_signing_pubkey_key, make_node_record_key, make_subnet_record_key, diff --git a/rs/registry/canister/src/invariants/crypto/tests.rs b/rs/registry/canister/src/invariants/crypto/tests.rs index 75b2a09f57d..876f1631ec7 100644 --- a/rs/registry/canister/src/invariants/crypto/tests.rs +++ b/rs/registry/canister/src/invariants/crypto/tests.rs @@ -603,13 +603,13 @@ mod ecdsa_signing_subnet_lists { use ic_base_types::{subnet_id_into_protobuf, SubnetId}; use ic_management_canister_types::{EcdsaCurve, EcdsaKeyId, MasterPublicKeyId}; use ic_protobuf::registry::crypto::v1::ChainKeySigningSubnetList; - use ic_protobuf::registry::crypto::v1::{ - self as pb, master_public_key_id, MasterPublicKeyId as MasterPublicKeyIdPb, - }; use ic_protobuf::registry::subnet::v1::{ ChainKeyConfig as ChainKeyConfigPb, KeyConfig as KeyConfigPb, SubnetRecord as SubnetRecordPb, }; + use ic_protobuf::types::v1::{ + self as pb, master_public_key_id, MasterPublicKeyId as MasterPublicKeyIdPb, + }; use ic_registry_keys::CHAIN_KEY_SIGNING_SUBNET_LIST_KEY_PREFIX; use ic_registry_subnet_features::KeyConfig; use ic_registry_transport::pb::v1::RegistryMutation; diff --git a/rs/registry/canister/src/mutations/do_update_subnet.rs b/rs/registry/canister/src/mutations/do_update_subnet.rs index de0f53b7435..a175c28afb6 100644 --- a/rs/registry/canister/src/mutations/do_update_subnet.rs +++ b/rs/registry/canister/src/mutations/do_update_subnet.rs @@ -613,13 +613,11 @@ mod tests { }; use ic_management_canister_types::{EcdsaCurve, EcdsaKeyId, SchnorrAlgorithm, SchnorrKeyId}; use ic_nervous_system_common_test_keys::{TEST_USER1_PRINCIPAL, TEST_USER2_PRINCIPAL}; - use ic_protobuf::registry::{ - crypto::v1::MasterPublicKeyId as MasterPublicKeyIdPb, - subnet::v1::{ - ChainKeyConfig as ChainKeyConfigPb, EcdsaConfig as EcdsaConfigPb, - KeyConfig as KeyConfigPb, SubnetRecord as SubnetRecordPb, - }, + use ic_protobuf::registry::subnet::v1::{ + ChainKeyConfig as ChainKeyConfigPb, EcdsaConfig as EcdsaConfigPb, KeyConfig as KeyConfigPb, + SubnetRecord as SubnetRecordPb, }; + use ic_protobuf::types::v1::MasterPublicKeyId as MasterPublicKeyIdPb; use ic_registry_subnet_features::DEFAULT_ECDSA_MAX_QUEUE_SIZE; use ic_registry_subnet_type::SubnetType; use ic_test_utilities_types::ids::subnet_test_id; diff --git a/rs/registry/canister/tests/create_subnet.rs b/rs/registry/canister/tests/create_subnet.rs index cfb692a59dd..02205428b40 100644 --- a/rs/registry/canister/tests/create_subnet.rs +++ b/rs/registry/canister/tests/create_subnet.rs @@ -21,11 +21,11 @@ use ic_nns_test_utils::{ }, registry::{invariant_compliant_mutation_as_atomic_req, INITIAL_MUTATION_ID}, }; -use ic_protobuf::registry::crypto::v1::MasterPublicKeyId as MasterPublicKeyIdPb; use ic_protobuf::registry::subnet::v1::{ ChainKeyConfig as ChainKeyConfigPb, KeyConfig as KeyConfigPb, SubnetListRecord as SubnetListRecordPb, SubnetRecord as SubnetRecordPb, }; +use ic_protobuf::types::v1::MasterPublicKeyId as MasterPublicKeyIdPb; use ic_registry_keys::{make_subnet_list_record_key, make_subnet_record_key}; use ic_registry_subnet_features::{ ChainKeyConfig, KeyConfig as KeyConfigInternal, DEFAULT_ECDSA_MAX_QUEUE_SIZE, diff --git a/rs/registry/canister/tests/recover_subnet.rs b/rs/registry/canister/tests/recover_subnet.rs index d9693c26c91..95db6836827 100644 --- a/rs/registry/canister/tests/recover_subnet.rs +++ b/rs/registry/canister/tests/recover_subnet.rs @@ -15,12 +15,13 @@ use ic_nns_test_utils::{ registry::{get_value_or_panic, prepare_registry}, }; use ic_protobuf::registry::{ - crypto::v1::{ChainKeySigningSubnetList, MasterPublicKeyId as MasterPublicKeyIdPb}, + crypto::v1::ChainKeySigningSubnetList, subnet::v1::{ CatchUpPackageContents, ChainKeyConfig as ChainKeyConfigPb, EcdsaInitialization, KeyConfig as KeyConfigPb, SubnetListRecord, SubnetRecord, }, }; +use ic_protobuf::types::v1::MasterPublicKeyId as MasterPublicKeyIdPb; use ic_registry_keys::{ make_catch_up_package_contents_key, make_chain_key_signing_subnet_list_key, make_subnet_list_record_key, make_subnet_record_key, diff --git a/rs/registry/subnet_features/src/lib.rs b/rs/registry/subnet_features/src/lib.rs index ca7b38ab28a..a1671279f2a 100644 --- a/rs/registry/subnet_features/src/lib.rs +++ b/rs/registry/subnet_features/src/lib.rs @@ -1,8 +1,9 @@ use candid::CandidType; use ic_management_canister_types::{EcdsaKeyId, MasterPublicKeyId}; +use ic_protobuf::types::v1 as pb_types; use ic_protobuf::{ proxy::{try_from_option_field, ProxyDecodeError}, - registry::{crypto::v1 as crypto_pb, subnet::v1 as pb}, + registry::subnet::v1 as pb, }; use serde::{Deserialize, Serialize}; use std::{convert::TryFrom, str::FromStr}; @@ -141,7 +142,7 @@ impl From for pb::KeyConfig { max_queue_size, } = src; - let key_id = Some(crypto_pb::MasterPublicKeyId::from(&key_id)); + let key_id = Some(pb_types::MasterPublicKeyId::from(&key_id)); let pre_signatures_to_create_in_advance = Some(pre_signatures_to_create_in_advance); @@ -315,7 +316,7 @@ mod tests { // Run code under test. let chain_key_config_pb = pb::ChainKeyConfig::from(pb::EcdsaConfig { quadruples_to_create_in_advance: 77, - key_ids: vec![crypto_pb::EcdsaKeyId { + key_ids: vec![pb_types::EcdsaKeyId { curve: 1, name: "test_curve".to_string(), }], @@ -328,9 +329,9 @@ mod tests { chain_key_config_pb, pb::ChainKeyConfig { key_configs: vec![pb::KeyConfig { - key_id: Some(crypto_pb::MasterPublicKeyId { - key_id: Some(crypto_pb::master_public_key_id::KeyId::Ecdsa( - crypto_pb::EcdsaKeyId { + key_id: Some(pb_types::MasterPublicKeyId { + key_id: Some(pb_types::master_public_key_id::KeyId::Ecdsa( + pb_types::EcdsaKeyId { curve: 1, name: "test_curve".to_string(), } @@ -366,9 +367,9 @@ mod tests { // Assert expected result value. let expected_chain_key_config_pb = pb::ChainKeyConfig { key_configs: vec![pb::KeyConfig { - key_id: Some(crypto_pb::MasterPublicKeyId { - key_id: Some(crypto_pb::master_public_key_id::KeyId::Ecdsa( - crypto_pb::EcdsaKeyId { + key_id: Some(pb_types::MasterPublicKeyId { + key_id: Some(pb_types::master_public_key_id::KeyId::Ecdsa( + pb_types::EcdsaKeyId { curve: 1, name: "test_curve".to_string(), }, diff --git a/rs/replicated_state/src/metadata_state/subnet_call_context_manager.rs b/rs/replicated_state/src/metadata_state/subnet_call_context_manager.rs index 0f24bd2d3de..586895fa8d0 100644 --- a/rs/replicated_state/src/metadata_state/subnet_call_context_manager.rs +++ b/rs/replicated_state/src/metadata_state/subnet_call_context_manager.rs @@ -3,9 +3,9 @@ use ic_logger::{info, ReplicaLogger}; use ic_management_canister_types::{EcdsaKeyId, MasterPublicKeyId, SchnorrKeyId}; use ic_protobuf::{ proxy::{try_from_option_field, ProxyDecodeError}, - registry::crypto::v1 as pb_crypto, state::queues::v1 as pb_queues, state::system_metadata::v1 as pb_metadata, + types::v1 as pb_types, }; use ic_types::{ canister_http::CanisterHttpRequestContext, @@ -954,7 +954,7 @@ impl From<&IDkgDealingsContext> for pb_metadata::IDkgDealingsContext { fn from(context: &IDkgDealingsContext) -> Self { Self { request: Some(pb_queues::Request::from(&context.request)), - key_id: Some(pb_crypto::MasterPublicKeyId::from(&context.key_id)), + key_id: Some(pb_types::MasterPublicKeyId::from(&context.key_id)), nodes: context .nodes .iter() diff --git a/rs/types/management_canister_types/src/lib.rs b/rs/types/management_canister_types/src/lib.rs index 54e4c1ab7a2..efd8e76608f 100644 --- a/rs/types/management_canister_types/src/lib.rs +++ b/rs/types/management_canister_types/src/lib.rs @@ -17,17 +17,18 @@ use ic_base_types::{ CanisterId, NodeId, NumBytes, PrincipalId, RegistryVersion, SnapshotId, SubnetId, }; use ic_error_types::{ErrorCode, UserError}; +use ic_protobuf::proxy::ProxyDecodeError; use ic_protobuf::proxy::{try_decode_hash, try_from_option_field}; use ic_protobuf::registry::crypto::v1::PublicKey; use ic_protobuf::registry::subnet::v1::{InitialIDkgDealings, InitialNiDkgTranscriptRecord}; use ic_protobuf::state::canister_state_bits::v1::{self as pb_canister_state_bits}; +use ic_protobuf::types::v1 as pb_types; use ic_protobuf::types::v1::CanisterInstallModeV2 as CanisterInstallModeV2Proto; use ic_protobuf::types::v1::{ CanisterInstallMode as CanisterInstallModeProto, CanisterUpgradeOptions as CanisterUpgradeOptionsProto, WasmMemoryPersistence as WasmMemoryPersistenceProto, }; -use ic_protobuf::{proxy::ProxyDecodeError, registry::crypto::v1 as pb_registry_crypto}; use num_traits::cast::ToPrimitive; pub use provisional::{ProvisionalCreateCanisterWithCyclesArgs, ProvisionalTopUpCanisterArgs}; use serde::Serialize; @@ -2040,21 +2041,21 @@ pub enum EcdsaCurve { Secp256k1, } -impl From<&EcdsaCurve> for pb_registry_crypto::EcdsaCurve { +impl From<&EcdsaCurve> for pb_types::EcdsaCurve { fn from(item: &EcdsaCurve) -> Self { match item { - EcdsaCurve::Secp256k1 => pb_registry_crypto::EcdsaCurve::Secp256k1, + EcdsaCurve::Secp256k1 => pb_types::EcdsaCurve::Secp256k1, } } } -impl TryFrom for EcdsaCurve { +impl TryFrom for EcdsaCurve { type Error = ProxyDecodeError; - fn try_from(item: pb_registry_crypto::EcdsaCurve) -> Result { + fn try_from(item: pb_types::EcdsaCurve) -> Result { match item { - pb_registry_crypto::EcdsaCurve::Secp256k1 => Ok(EcdsaCurve::Secp256k1), - pb_registry_crypto::EcdsaCurve::Unspecified => Err(ProxyDecodeError::ValueOutOfRange { + pb_types::EcdsaCurve::Secp256k1 => Ok(EcdsaCurve::Secp256k1), + pb_types::EcdsaCurve::Unspecified => Err(ProxyDecodeError::ValueOutOfRange { typ: "EcdsaCurve", err: format!("Unable to convert {:?} to an EcdsaCurve", item), }), @@ -2093,27 +2094,25 @@ pub struct EcdsaKeyId { pub name: String, } -impl From<&EcdsaKeyId> for pb_registry_crypto::EcdsaKeyId { +impl From<&EcdsaKeyId> for pb_types::EcdsaKeyId { fn from(item: &EcdsaKeyId) -> Self { Self { - curve: pb_registry_crypto::EcdsaCurve::from(&item.curve) as i32, + curve: pb_types::EcdsaCurve::from(&item.curve) as i32, name: item.name.clone(), } } } -impl TryFrom for EcdsaKeyId { +impl TryFrom for EcdsaKeyId { type Error = ProxyDecodeError; - fn try_from(item: pb_registry_crypto::EcdsaKeyId) -> Result { + fn try_from(item: pb_types::EcdsaKeyId) -> Result { Ok(Self { - curve: EcdsaCurve::try_from( - pb_registry_crypto::EcdsaCurve::try_from(item.curve).map_err(|_| { - ProxyDecodeError::ValueOutOfRange { - typ: "EcdsaKeyId", - err: format!("Unable to convert {} to an EcdsaCurve", item.curve), - } - })?, - )?, + curve: EcdsaCurve::try_from(pb_types::EcdsaCurve::try_from(item.curve).map_err( + |_| ProxyDecodeError::ValueOutOfRange { + typ: "EcdsaKeyId", + err: format!("Unable to convert {} to an EcdsaCurve", item.curve), + }, + )?)?, name: item.name, }) } @@ -2163,32 +2162,26 @@ pub enum SchnorrAlgorithm { Ed25519, } -impl From<&SchnorrAlgorithm> for pb_registry_crypto::SchnorrAlgorithm { +impl From<&SchnorrAlgorithm> for pb_types::SchnorrAlgorithm { fn from(item: &SchnorrAlgorithm) -> Self { match item { - SchnorrAlgorithm::Bip340Secp256k1 => { - pb_registry_crypto::SchnorrAlgorithm::Bip340secp256k1 - } - SchnorrAlgorithm::Ed25519 => pb_registry_crypto::SchnorrAlgorithm::Ed25519, + SchnorrAlgorithm::Bip340Secp256k1 => pb_types::SchnorrAlgorithm::Bip340secp256k1, + SchnorrAlgorithm::Ed25519 => pb_types::SchnorrAlgorithm::Ed25519, } } } -impl TryFrom for SchnorrAlgorithm { +impl TryFrom for SchnorrAlgorithm { type Error = ProxyDecodeError; - fn try_from(item: pb_registry_crypto::SchnorrAlgorithm) -> Result { + fn try_from(item: pb_types::SchnorrAlgorithm) -> Result { match item { - pb_registry_crypto::SchnorrAlgorithm::Bip340secp256k1 => { - Ok(SchnorrAlgorithm::Bip340Secp256k1) - } - pb_registry_crypto::SchnorrAlgorithm::Ed25519 => Ok(SchnorrAlgorithm::Ed25519), - pb_registry_crypto::SchnorrAlgorithm::Unspecified => { - Err(ProxyDecodeError::ValueOutOfRange { - typ: "SchnorrAlgorithm", - err: format!("Unable to convert {:?} to a SchnorrAlgorithm", item), - }) - } + pb_types::SchnorrAlgorithm::Bip340secp256k1 => Ok(SchnorrAlgorithm::Bip340Secp256k1), + pb_types::SchnorrAlgorithm::Ed25519 => Ok(SchnorrAlgorithm::Ed25519), + pb_types::SchnorrAlgorithm::Unspecified => Err(ProxyDecodeError::ValueOutOfRange { + typ: "SchnorrAlgorithm", + err: format!("Unable to convert {:?} to a SchnorrAlgorithm", item), + }), } } } @@ -2225,27 +2218,26 @@ pub struct SchnorrKeyId { pub name: String, } -impl From<&SchnorrKeyId> for pb_registry_crypto::SchnorrKeyId { +impl From<&SchnorrKeyId> for pb_types::SchnorrKeyId { fn from(item: &SchnorrKeyId) -> Self { Self { - algorithm: pb_registry_crypto::SchnorrAlgorithm::from(&item.algorithm) as i32, + algorithm: pb_types::SchnorrAlgorithm::from(&item.algorithm) as i32, name: item.name.clone(), } } } -impl TryFrom for SchnorrKeyId { +impl TryFrom for SchnorrKeyId { type Error = ProxyDecodeError; - fn try_from(item: pb_registry_crypto::SchnorrKeyId) -> Result { - let pb_registry_crypto::SchnorrKeyId { algorithm, name } = item; - let algorithm = SchnorrAlgorithm::try_from( - pb_registry_crypto::SchnorrAlgorithm::try_from(algorithm).map_err(|_| { - ProxyDecodeError::ValueOutOfRange { + fn try_from(item: pb_types::SchnorrKeyId) -> Result { + let pb_types::SchnorrKeyId { algorithm, name } = item; + let algorithm = + SchnorrAlgorithm::try_from(pb_types::SchnorrAlgorithm::try_from(algorithm).map_err( + |_| ProxyDecodeError::ValueOutOfRange { typ: "SchnorrKeyId", err: format!("Unable to convert {} to a SchnorrAlgorithm", algorithm), - } - })?, - )?; + }, + )?)?; Ok(Self { algorithm, name }) } } @@ -2293,21 +2285,21 @@ pub enum VetKdCurve { Bls12_381_G2, } -impl From<&VetKdCurve> for pb_registry_crypto::VetKdCurve { +impl From<&VetKdCurve> for pb_types::VetKdCurve { fn from(item: &VetKdCurve) -> Self { match item { - VetKdCurve::Bls12_381_G2 => pb_registry_crypto::VetKdCurve::Bls12381G2, + VetKdCurve::Bls12_381_G2 => pb_types::VetKdCurve::Bls12381G2, } } } -impl TryFrom for VetKdCurve { +impl TryFrom for VetKdCurve { type Error = ProxyDecodeError; - fn try_from(item: pb_registry_crypto::VetKdCurve) -> Result { + fn try_from(item: pb_types::VetKdCurve) -> Result { match item { - pb_registry_crypto::VetKdCurve::Bls12381G2 => Ok(VetKdCurve::Bls12_381_G2), - pb_registry_crypto::VetKdCurve::Unspecified => Err(ProxyDecodeError::ValueOutOfRange { + pb_types::VetKdCurve::Bls12381G2 => Ok(VetKdCurve::Bls12_381_G2), + pb_types::VetKdCurve::Unspecified => Err(ProxyDecodeError::ValueOutOfRange { typ: "VetKdCurve", err: format!("Unable to convert {:?} to a VetKdCurve", item), }), @@ -2347,27 +2339,25 @@ pub struct VetKdKeyId { pub name: String, } -impl From<&VetKdKeyId> for pb_registry_crypto::VetKdKeyId { +impl From<&VetKdKeyId> for pb_types::VetKdKeyId { fn from(item: &VetKdKeyId) -> Self { Self { - curve: pb_registry_crypto::VetKdCurve::from(&item.curve) as i32, + curve: pb_types::VetKdCurve::from(&item.curve) as i32, name: item.name.clone(), } } } -impl TryFrom for VetKdKeyId { +impl TryFrom for VetKdKeyId { type Error = ProxyDecodeError; - fn try_from(item: pb_registry_crypto::VetKdKeyId) -> Result { + fn try_from(item: pb_types::VetKdKeyId) -> Result { Ok(Self { - curve: VetKdCurve::try_from( - pb_registry_crypto::VetKdCurve::try_from(item.curve).map_err(|_| { - ProxyDecodeError::ValueOutOfRange { - typ: "VetKdKeyId", - err: format!("Unable to convert {} to a VetKdCurve", item.curve), - } - })?, - )?, + curve: VetKdCurve::try_from(pb_types::VetKdCurve::try_from(item.curve).map_err( + |_| ProxyDecodeError::ValueOutOfRange { + typ: "VetKdKeyId", + err: format!("Unable to convert {} to a VetKdCurve", item.curve), + }, + )?)?, name: item.name, }) } @@ -2406,9 +2396,9 @@ pub enum MasterPublicKeyId { VetKd(VetKdKeyId), } -impl From<&MasterPublicKeyId> for pb_registry_crypto::MasterPublicKeyId { +impl From<&MasterPublicKeyId> for pb_types::MasterPublicKeyId { fn from(item: &MasterPublicKeyId) -> Self { - use pb_registry_crypto::master_public_key_id::KeyId; + use pb_types::master_public_key_id::KeyId; let key_id_pb = match item { MasterPublicKeyId::Schnorr(schnorr_key_id) => KeyId::Schnorr(schnorr_key_id.into()), MasterPublicKeyId::Ecdsa(ecdsa_key_id) => KeyId::Ecdsa(ecdsa_key_id.into()), @@ -2420,10 +2410,10 @@ impl From<&MasterPublicKeyId> for pb_registry_crypto::MasterPublicKeyId { } } -impl TryFrom for MasterPublicKeyId { +impl TryFrom for MasterPublicKeyId { type Error = ProxyDecodeError; - fn try_from(item: pb_registry_crypto::MasterPublicKeyId) -> Result { - use pb_registry_crypto::master_public_key_id::KeyId; + fn try_from(item: pb_types::MasterPublicKeyId) -> Result { + use pb_types::master_public_key_id::KeyId; let Some(key_id_pb) = item.key_id else { return Err(ProxyDecodeError::MissingField("MasterPublicKeyId::key_id")); }; diff --git a/rs/types/types/src/consensus/idkg.rs b/rs/types/types/src/consensus/idkg.rs index 29bd2789f2c..feb95cd06ba 100644 --- a/rs/types/types/src/consensus/idkg.rs +++ b/rs/types/types/src/consensus/idkg.rs @@ -32,9 +32,10 @@ use ic_crypto_sha2::Sha256; #[cfg(test)] use ic_exhaustive_derive::ExhaustiveSet; use ic_management_canister_types::MasterPublicKeyId; +use ic_protobuf::types::v1 as pb_types; use ic_protobuf::{ proxy::{try_from_option_field, ProxyDecodeError}, - registry::{crypto::v1 as crypto_pb, subnet::v1 as subnet_pb}, + registry::subnet::v1 as subnet_pb, types::v1 as pb, }; use phantom_newtype::Id; @@ -486,9 +487,7 @@ impl From for pb::MasterKeyTranscript { next_in_creation: Some(pb::KeyTranscriptCreation::from( &transcript.next_in_creation, )), - master_key_id: Some(crypto_pb::MasterPublicKeyId::from( - &transcript.master_key_id, - )), + master_key_id: Some(pb_types::MasterPublicKeyId::from(&transcript.master_key_id)), } } }