diff --git a/Cargo.lock b/Cargo.lock index 1ad7d24..96484e0 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -181,17 +181,17 @@ dependencies = [ [[package]] name = "axum-test" -version = "15.2.0" +version = "14.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0882240a5cff2c0af7b01a684cb4048629841ccbd20305948e12ddc25f1c36c2" +checksum = "167294800740b4b6bc7bfbccbf3a1d50a6c6e097342580ec4c11d1672e456292" dependencies = [ "anyhow", + "async-trait", "auto-future", "axum", "bytes", "cookie", "http 1.1.0", - "http-body", "http-body-util", "hyper", "hyper-util", @@ -373,10 +373,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "acbf1af155f9b9ef647e42cdc158db4b64a1b61f743629225fde6f3e0be2a7c7" [[package]] -name = "const-crc32" -version = "1.3.0" +name = "const-crc32-nostd" +version = "1.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68d13f542d70e5b339bf46f6f74704ac052cfd526c58cd87996bd1ef4615b9a0" +checksum = "808ac43170e95b11dd23d78aa9eaac5bea45776a602955552c4e833f3f0f823d" [[package]] name = "constant_time_eq" @@ -406,7 +406,7 @@ dependencies = [ "frost-ed25519", "frost-rerandomized", "hex", - "itertools 0.13.0", + "itertools", "message-io", "rand", "reddsa", @@ -475,15 +475,14 @@ dependencies = [ [[package]] name = "curve25519-dalek" -version = "4.1.2" +version = "4.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0a677b8922c94e01bdbb12126b0bc852f00447528dee1782229af9c720c3f348" +checksum = "97fb8b7c4503de7d6ae7b42ab72a5a59857b4c937ec27a3d4539dba95b5ab2be" dependencies = [ "cfg-if", "cpufeatures", "curve25519-dalek-derive", "fiat-crypto", - "platforms", "rand_core", "rustc_version", "subtle", @@ -535,13 +534,13 @@ dependencies = [ [[package]] name = "derive-getters" -version = "0.3.0" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a2c35ab6e03642397cdda1dd58abbc05d418aef8e36297f336d5aba060fe8df" +checksum = "0a6433aac097572ea8ccc60b3f2e756c661c9aeed9225cdd4d0cb119cb7ff6ba" dependencies = [ "proc-macro2", "quote", - "syn 1.0.109", + "syn 2.0.53", ] [[package]] @@ -570,7 +569,7 @@ dependencies = [ "frost-core", "frost-ed25519", "hex", - "itertools 0.13.0", + "itertools", "pipe", "rand", "reddsa", @@ -694,31 +693,32 @@ dependencies = [ [[package]] name = "frost-core" -version = "1.0.0" +version = "2.0.0-rc.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "45d6280625f1603d160df24b23e4984a6a7286f41455ae606823d0104c32e834" +checksum = "ed1383227a6606aacf5df9a17ff57824c6971a0ab225b69b911bec0ba7bbb869" dependencies = [ "byteorder", - "const-crc32", + "const-crc32-nostd", "debugless-unwrap", "derive-getters", "document-features", "hex", - "itertools 0.12.1", + "itertools", "postcard", "rand_core", "serde", "serdect", "thiserror", + "thiserror-nostd-notrait", "visibility", "zeroize", ] [[package]] name = "frost-ed25519" -version = "1.0.0" +version = "2.0.0-rc.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b359e465bc1024663fd6cb68c3eda44d00c151246419857885f2bf267f1168ea" +checksum = "bab23316e09987113dc8a2a8f0b656d7f1b24dc2afdc8c34df98276d1158c97d" dependencies = [ "curve25519-dalek", "document-features", @@ -730,13 +730,14 @@ dependencies = [ [[package]] name = "frost-rerandomized" -version = "1.0.0" +version = "2.0.0-rc.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "52c58f58ea009000db490efd9a3936d0035647a2b00c7ba8f3868c2ed0306b0b" +checksum = "bdb14a6054f9ce5aa4912c60c11392d42c43acec8295ee1df1f67a9d0b7a73ee" dependencies = [ "derive-getters", "document-features", "frost-core", + "hex", "rand_core", ] @@ -1076,15 +1077,6 @@ version = "2.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8f518f335dce6725a761382244631d86cf0ccb2863413590b31338feb467f9c3" -[[package]] -name = "itertools" -version = "0.12.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba291022dbbd398a455acf126c1e341954079855bc60dfdda641363bd6922569" -dependencies = [ - "either", -] - [[package]] name = "itertools" version = "0.13.0" @@ -1482,12 +1474,6 @@ version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d231b230927b5e4ad203db57bbcbee2802f6bce620b1e4a9024a07d94e2907ec" -[[package]] -name = "platforms" -version = "3.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "626dec3cac7cc0e1577a2ec3fc496277ec2baa084bebad95bb6fdbfae235f84c" - [[package]] name = "postcard" version = "1.0.8" @@ -1579,7 +1565,7 @@ dependencies = [ [[package]] name = "reddsa" version = "0.5.1" -source = "git+https://github.com/ZcashFoundation/reddsa.git?rev=81c649c412e5b6ba56d491d2857f91fbd28adbc7#81c649c412e5b6ba56d491d2857f91fbd28adbc7" +source = "git+https://github.com/ZcashFoundation/reddsa.git?rev=4d8c4bb337231e6e89117334d7c61dada589a953#4d8c4bb337231e6e89117334d7c61dada589a953" dependencies = [ "blake2b_simd", "byteorder", @@ -2175,6 +2161,26 @@ dependencies = [ "syn 2.0.53", ] +[[package]] +name = "thiserror-nostd-notrait" +version = "1.0.57" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a8444e638022c44d2a9337031dee8acb732bcc7fbf52ac654edc236b26408b61" +dependencies = [ + "thiserror-nostd-notrait-impl", +] + +[[package]] +name = "thiserror-nostd-notrait-impl" +version = "1.0.57" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "585e5ef40a784ce60b49c67d762110688d211d395d39e096be204535cf64590e" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.53", +] + [[package]] name = "thread_local" version = "1.1.8" @@ -2412,7 +2418,7 @@ dependencies = [ "frost-core", "frost-ed25519", "hex", - "itertools 0.13.0", + "itertools", "rand", "reddsa", "serde_json", diff --git a/coordinator/Cargo.toml b/coordinator/Cargo.toml index bde9c65..b3bcb0a 100644 --- a/coordinator/Cargo.toml +++ b/coordinator/Cargo.toml @@ -8,10 +8,10 @@ edition = "2021" [dependencies] async-trait = "0.1.80" eyre = "0.6.12" -frost-core = { version = "1.0.0", features = ["serde"] } -frost-rerandomized = { version = "1.0.0", features = ["serde"] } -frost-ed25519 = { version = "1.0.0", features = ["serde"] } -reddsa = { git = "https://github.com/ZcashFoundation/reddsa.git", rev = "81c649c412e5b6ba56d491d2857f91fbd28adbc7", features = ["frost", "serde"] } +frost-core = { version = "2.0.0-rc.0", features = ["serde"] } +frost-rerandomized = { version = "2.0.0-rc.0", features = ["serde"] } +frost-ed25519 = { version = "2.0.0-rc.0", features = ["serde"] } +reddsa = { git = "https://github.com/ZcashFoundation/reddsa.git", rev = "4d8c4bb337231e6e89117334d7c61dada589a953", features = ["frost", "serde"] } hex = { version = "0.4", features = ["serde"] } thiserror = "1.0" rand = "0.8" diff --git a/coordinator/src/comms/cli.rs b/coordinator/src/comms/cli.rs index 41eddd8..34a873e 100644 --- a/coordinator/src/comms/cli.rs +++ b/coordinator/src/comms/cli.rs @@ -4,8 +4,6 @@ use frost_core as frost; use frost_core::Ciphersuite; -use eyre::eyre; - use async_trait::async_trait; use frost::{ @@ -106,8 +104,7 @@ pub fn read_identifier( let mut identifier_input = String::new(); input.read_line(&mut identifier_input)?; let bytes = hex::decode(identifier_input.trim())?; - let serialization = bytes.try_into().map_err(|_| eyre!("Invalid Identifier"))?; - let identifier = Identifier::::deserialize(&serialization)?; + let identifier = Identifier::::deserialize(&bytes)?; Ok(identifier) } diff --git a/coordinator/src/step_1.rs b/coordinator/src/step_1.rs index 034fa2a..c4be946 100755 --- a/coordinator/src/step_1.rs +++ b/coordinator/src/step_1.rs @@ -87,7 +87,6 @@ mod tests { keys::{PublicKeyPackage, VerifyingShare}, Error, Identifier, VerifyingKey, }; - use hex::FromHex; use crate::comms::cli::validate; @@ -103,15 +102,15 @@ mod tests { let mut signer_pubkeys = BTreeMap::new(); signer_pubkeys.insert( id_1, - VerifyingShare::deserialize(<[u8; 32]>::from_hex(PUBLIC_KEY_1).unwrap()).unwrap(), + VerifyingShare::deserialize(&hex::decode(PUBLIC_KEY_1).unwrap()).unwrap(), ); signer_pubkeys.insert( id_2, - VerifyingShare::deserialize(<[u8; 32]>::from_hex(PUBLIC_KEY_2).unwrap()).unwrap(), + VerifyingShare::deserialize(&hex::decode(PUBLIC_KEY_2).unwrap()).unwrap(), ); let group_public = - VerifyingKey::deserialize(<[u8; 32]>::from_hex(GROUP_PUBLIC_KEY).unwrap()).unwrap(); + VerifyingKey::deserialize(&hex::decode(GROUP_PUBLIC_KEY).unwrap()).unwrap(); PublicKeyPackage::new(signer_pubkeys, group_public) } diff --git a/coordinator/src/step_3.rs b/coordinator/src/step_3.rs index 958f709..45ebe2b 100644 --- a/coordinator/src/step_3.rs +++ b/coordinator/src/step_3.rs @@ -32,14 +32,10 @@ pub fn request_randomizer( fs::read(&args.randomizer)? }; - Ok(frost_rerandomized::Randomizer::deserialize( - &randomizer - .try_into() - .map_err(|_| frost::Error::::MalformedIdentifier)?, - )?) + Ok(frost_rerandomized::Randomizer::deserialize(&randomizer)?) } -pub async fn step_3( +pub async fn step_3( args: &Args, comms: &mut dyn Comms, input: &mut dyn BufRead, @@ -101,7 +97,7 @@ async fn request_inputs_signature_shares( Ok(group_signature) } -fn print_signature( +fn print_signature( args: &Args, logger: &mut dyn Write, group_signature: Signature, @@ -113,7 +109,7 @@ fn print_signature( serde_json::to_string(&group_signature)? )?; } else { - fs::write(&args.signature, group_signature.serialize())?; + fs::write(&args.signature, group_signature.serialize()?)?; eprintln!("Raw signature written to {}", &args.signature); }; Ok(()) diff --git a/coordinator/src/tests/steps.rs b/coordinator/src/tests/steps.rs index 4080b30..34a751f 100644 --- a/coordinator/src/tests/steps.rs +++ b/coordinator/src/tests/steps.rs @@ -13,7 +13,6 @@ use frost::{ Identifier, SigningPackage, VerifyingKey, }; use frost_ed25519 as frost; -use hex::FromHex; use std::{collections::BTreeMap, io::BufWriter}; use super::common::get_helpers; @@ -35,19 +34,18 @@ fn build_pub_key_package() -> (BTreeMap, VerifyingKe let mut signer_pubkeys = BTreeMap::new(); signer_pubkeys.insert( id_1, - VerifyingShare::deserialize(<[u8; 32]>::from_hex(public_key_1).unwrap()).unwrap(), + VerifyingShare::deserialize(&hex::decode(public_key_1).unwrap()).unwrap(), ); signer_pubkeys.insert( id_2, - VerifyingShare::deserialize(<[u8; 32]>::from_hex(public_key_2).unwrap()).unwrap(), + VerifyingShare::deserialize(&hex::decode(public_key_2).unwrap()).unwrap(), ); signer_pubkeys.insert( id_3, - VerifyingShare::deserialize(<[u8; 32]>::from_hex(public_key_3).unwrap()).unwrap(), + VerifyingShare::deserialize(&hex::decode(public_key_3).unwrap()).unwrap(), ); - let group_public = - VerifyingKey::deserialize(<[u8; 32]>::from_hex(verifying_key).unwrap()).unwrap(); + let group_public = VerifyingKey::deserialize(&hex::decode(verifying_key).unwrap()).unwrap(); (signer_pubkeys, group_public) } @@ -65,12 +63,12 @@ fn build_signing_commitments() -> BTreeMap { let id_3 = Identifier::try_from(3).unwrap(); let signer_commitments_1 = SigningCommitments::new( - NonceCommitment::deserialize(<[u8; 32]>::from_hex(hiding_commitment_1).unwrap()).unwrap(), - NonceCommitment::deserialize(<[u8; 32]>::from_hex(binding_commitment_1).unwrap()).unwrap(), + NonceCommitment::deserialize(&hex::decode(hiding_commitment_1).unwrap()).unwrap(), + NonceCommitment::deserialize(&hex::decode(binding_commitment_1).unwrap()).unwrap(), ); let signer_commitments_3 = SigningCommitments::new( - NonceCommitment::deserialize(<[u8; 32]>::from_hex(hiding_commitment_3).unwrap()).unwrap(), - NonceCommitment::deserialize(<[u8; 32]>::from_hex(binding_commitment_3).unwrap()).unwrap(), + NonceCommitment::deserialize(&hex::decode(hiding_commitment_3).unwrap()).unwrap(), + NonceCommitment::deserialize(&hex::decode(binding_commitment_3).unwrap()).unwrap(), ); let mut signing_commitments = BTreeMap::new(); diff --git a/dkg/Cargo.toml b/dkg/Cargo.toml index a522e1f..13d7a76 100644 --- a/dkg/Cargo.toml +++ b/dkg/Cargo.toml @@ -7,9 +7,9 @@ edition = "2021" [dependencies] eyre = "0.6.12" -frost-core = { version = "1.0.0", features = ["serde"] } -frost-ed25519 = { version = "1.0.0", features = ["serde"] } -reddsa = { git = "https://github.com/ZcashFoundation/reddsa.git", rev = "81c649c412e5b6ba56d491d2857f91fbd28adbc7", features = ["frost"] } +frost-core = { version = "2.0.0-rc.0", features = ["serde"] } +frost-ed25519 = { version = "2.0.0-rc.0", features = ["serde"] } +reddsa = { git = "https://github.com/ZcashFoundation/reddsa.git", rev = "4d8c4bb337231e6e89117334d7c61dada589a953", features = ["frost"] } clap = { version = "4.5.7", features = ["derive"] } hex = { version = "0.4", features = ["serde"] } thiserror = "1.0" diff --git a/dkg/src/inputs.rs b/dkg/src/inputs.rs index 207c70f..0349cbd 100755 --- a/dkg/src/inputs.rs +++ b/dkg/src/inputs.rs @@ -5,8 +5,6 @@ use frost::{ Error, Identifier, }; -use eyre::eyre; - use std::io::{BufRead, Write}; #[derive(Debug, PartialEq, Clone)] @@ -87,8 +85,7 @@ pub fn read_identifier( let mut identifier_input = String::new(); input.read_line(&mut identifier_input)?; let bytes = hex::decode(identifier_input.trim())?; - let serialization = bytes.try_into().map_err(|_| eyre!("Invalid Identifier"))?; - let identifier = Identifier::::deserialize(&serialization)?; + let identifier = Identifier::::deserialize(&bytes)?; Ok(identifier) } diff --git a/participant/Cargo.toml b/participant/Cargo.toml index 60f1f0d..d102ff5 100644 --- a/participant/Cargo.toml +++ b/participant/Cargo.toml @@ -7,10 +7,10 @@ edition = "2021" [dependencies] async-trait = "0.1.80" -frost-core = { version = "1.0.0", features = ["serde"] } -frost-rerandomized = { version = "1.0.0", features = ["serde"] } -frost-ed25519 = { version = "1.0.0", features = ["serde"] } -reddsa = { git = "https://github.com/ZcashFoundation/reddsa.git", rev = "81c649c412e5b6ba56d491d2857f91fbd28adbc7", features = ["frost"] } +frost-core = { version = "2.0.0-rc.0", features = ["serde"] } +frost-rerandomized = { version = "2.0.0-rc.0", features = ["serde"] } +frost-ed25519 = { version = "2.0.0-rc.0", features = ["serde"] } +reddsa = { git = "https://github.com/ZcashFoundation/reddsa.git", rev = "4d8c4bb337231e6e89117334d7c61dada589a953", features = ["frost"] } hex = "0.4" rand = "0.8" eyre = "0.6.12" diff --git a/participant/src/comms/cli.rs b/participant/src/comms/cli.rs index d6b8c07..976e8b9 100644 --- a/participant/src/comms/cli.rs +++ b/participant/src/comms/cli.rs @@ -6,8 +6,6 @@ use frost_core::Ciphersuite; use async_trait::async_trait; -use eyre::eyre; - use frost::{ keys::PublicKeyPackage, round1::SigningCommitments, round2::SignatureShare, Identifier, SigningPackage, @@ -71,11 +69,8 @@ where let mut json = String::new(); input.read_line(&mut json).unwrap(); - let randomizer = frost_rerandomized::Randomizer::::deserialize( - &hex::decode(json.trim())? - .try_into() - .map_err(|_| eyre!("Invalid randomizer"))?, - )?; + let randomizer = + frost_rerandomized::Randomizer::::deserialize(&hex::decode(json.trim())?)?; Ok((signing_package, Some(randomizer))) } else { Ok((signing_package, None)) @@ -97,8 +92,7 @@ pub fn read_identifier( let mut identifier_input = String::new(); input.read_line(&mut identifier_input)?; let bytes = hex::decode(identifier_input.trim())?; - let serialization = bytes.try_into().map_err(|_| eyre!("Invalid Identifier"))?; - let identifier = Identifier::::deserialize(&serialization)?; + let identifier = Identifier::::deserialize(&bytes)?; Ok(identifier) } diff --git a/participant/src/tests/round1.rs b/participant/src/tests/round1.rs index 92f4c4e..d4ed5e8 100644 --- a/participant/src/tests/round1.rs +++ b/participant/src/tests/round1.rs @@ -9,7 +9,6 @@ use frost::{ keys::{KeyPackage, SigningShare, VerifyingShare}, round1, Error, VerifyingKey, }; -use hex::FromHex; use participant::{ args::Args, round1::{print_values, request_inputs, Round1Config}, @@ -25,9 +24,9 @@ const SECRET_SHARE_JSON: &str = r#"{"header":{"version":0,"ciphersuite":"FROST-E async fn build_key_package() -> KeyPackage { KeyPackage::new( Identifier::try_from(1).unwrap(), - SigningShare::deserialize(<[u8; 32]>::from_hex(SIGNING_SHARE).unwrap()).unwrap(), - VerifyingShare::deserialize(<[u8; 32]>::from_hex(PUBLIC_KEY).unwrap()).unwrap(), - VerifyingKey::deserialize(<[u8; 32]>::from_hex(GROUP_PUBLIC_KEY).unwrap()).unwrap(), + SigningShare::deserialize(&hex::decode(SIGNING_SHARE).unwrap()).unwrap(), + VerifyingShare::deserialize(&hex::decode(PUBLIC_KEY).unwrap()).unwrap(), + VerifyingKey::deserialize(&hex::decode(GROUP_PUBLIC_KEY).unwrap()).unwrap(), 3, ) } @@ -135,8 +134,7 @@ async fn check_invalid_length_vss_commitment() { async fn check_print_values() { let mut buf = BufWriter::new(Vec::new()); - let signing_share = - SigningShare::deserialize(<[u8; 32]>::from_hex(SIGNING_SHARE).unwrap()).unwrap(); + let signing_share = SigningShare::deserialize(&hex::decode(SIGNING_SHARE).unwrap()).unwrap(); let mut rng = thread_rng(); let (_nonces, commitments) = round1::commit(&signing_share, &mut rng); @@ -144,7 +142,7 @@ async fn check_print_values() { let out = String::from_utf8(buf.into_inner().unwrap()).unwrap(); - let log = format!("=== Round 1 ===\nSigningNonces were generated and stored in memory\nSigningCommitments:\n{{\"header\":{{\"version\":0,\"ciphersuite\":\"FROST-ED25519-SHA512-v1\"}},\"hiding\":\"{}\",\"binding\":\"{}\"}}\n=== Round 1 Completed ===\nPlease send your SigningCommitments to the coordinator\n", &hex::encode(commitments.hiding().serialize()), &hex::encode(commitments.binding().serialize())); + let log = format!("=== Round 1 ===\nSigningNonces were generated and stored in memory\nSigningCommitments:\n{{\"header\":{{\"version\":0,\"ciphersuite\":\"FROST-ED25519-SHA512-v1\"}},\"hiding\":\"{}\",\"binding\":\"{}\"}}\n=== Round 1 Completed ===\nPlease send your SigningCommitments to the coordinator\n", &hex::encode(commitments.hiding().serialize().unwrap()), &hex::encode(commitments.binding().serialize().unwrap())); assert_eq!(out, log) } diff --git a/participant/src/tests/round2.rs b/participant/src/tests/round2.rs index e5737a4..53a810f 100644 --- a/participant/src/tests/round2.rs +++ b/participant/src/tests/round2.rs @@ -31,7 +31,7 @@ const BINDING_COMMITMENT_2: &str = "b0e13794eaf00be2e430b16ec7f72ab0b6579e52ca604d17406a4fd1597afd66"; pub fn nonce_commitment(input: &str) -> NonceCommitment { - NonceCommitment::deserialize(<[u8; 32]>::from_hex(input).unwrap()).unwrap() + NonceCommitment::deserialize(&hex::decode(input).unwrap()).unwrap() } #[tokio::test] @@ -92,9 +92,9 @@ async fn check_valid_round_2_inputs() { async fn check_sign() { let key_package = KeyPackage::new( Identifier::try_from(1).unwrap(), - SigningShare::deserialize(<[u8; 32]>::from_hex(SIGNING_SHARE).unwrap()).unwrap(), - VerifyingShare::deserialize(<[u8; 32]>::from_hex(PUBLIC_KEY).unwrap()).unwrap(), - VerifyingKey::deserialize(<[u8; 32]>::from_hex(GROUP_PUBLIC_KEY).unwrap()).unwrap(), + SigningShare::deserialize(&hex::decode(SIGNING_SHARE).unwrap()).unwrap(), + VerifyingShare::deserialize(&hex::decode(PUBLIC_KEY).unwrap()).unwrap(), + VerifyingKey::deserialize(&hex::decode(GROUP_PUBLIC_KEY).unwrap()).unwrap(), 2, ); @@ -102,13 +102,13 @@ async fn check_sign() { // TODO: Nonce doesn't seem to be exported. Look into this to improve these tests let (nonces, my_commitments) = round1::commit( - &SigningShare::deserialize(<[u8; 32]>::from_hex(SIGNING_SHARE).unwrap()).unwrap(), + &SigningShare::deserialize(&hex::decode(SIGNING_SHARE).unwrap()).unwrap(), &mut rng, ); let signer_commitments_2 = SigningCommitments::new( - NonceCommitment::deserialize(<[u8; 32]>::from_hex(HIDING_COMMITMENT_2).unwrap()).unwrap(), - NonceCommitment::deserialize(<[u8; 32]>::from_hex(BINDING_COMMITMENT_2).unwrap()).unwrap(), + NonceCommitment::deserialize(&hex::decode(HIDING_COMMITMENT_2).unwrap()).unwrap(), + NonceCommitment::deserialize(&hex::decode(BINDING_COMMITMENT_2).unwrap()).unwrap(), ); let mut signer_commitments = BTreeMap::new(); @@ -116,10 +116,9 @@ async fn check_sign() { signer_commitments.insert(Identifier::try_from(2).unwrap(), signer_commitments_2); let message = - <[u8; 32]>::from_hex("15d21ccd7ee42959562fc8aa63224c8851fb3ec85a3faf66040d380fb9738673") - .unwrap(); + &hex::decode("15d21ccd7ee42959562fc8aa63224c8851fb3ec85a3faf66040d380fb9738673").unwrap(); - let signing_package = SigningPackage::new(signer_commitments, &message); + let signing_package = SigningPackage::new(signer_commitments, message); let config = Round2Config { signing_package, @@ -138,7 +137,7 @@ async fn check_print_values_round_2() { const SIGNATURE_SHARE: &str = "44055c54d0604cbd006f0d1713a22474d7735c5e8816b1878f62ca94bf105900"; let signature_response = - SignatureShare::deserialize(<[u8; 32]>::from_hex(SIGNATURE_SHARE).unwrap()).unwrap(); + SignatureShare::deserialize(&hex::decode(SIGNATURE_SHARE).unwrap()).unwrap(); print_values_round_2(signature_response, &mut buf).unwrap(); diff --git a/server/Cargo.toml b/server/Cargo.toml index b4d60f5..257d824 100644 --- a/server/Cargo.toml +++ b/server/Cargo.toml @@ -10,22 +10,22 @@ axum = "0.7.5" clap = { version = "4.5.7", features = ["derive"] } derivative = "2.2.0" eyre = "0.6.11" -frost-core = { version = "1.0.0-rc.0", features = ["serde"] } -frost-rerandomized = { version = "1.0.0-rc.0", features = ["serde"] } +frost-core = { version = "2.0.0-rc.0", features = ["serde"] } +frost-rerandomized = { version = "2.0.0-rc.0", features = ["serde"] } rand = "0.8" serde = { version = "1.0", features = ["derive"] } serdect = { version = "0.2.0" } -serde_json = "1.0.118" +serde_json = "1.0.117" tokio = { version = "1.38", features = ["full"] } tower-http = { version = "0.5.2", features = ["trace"] } tracing = "0.1" tracing-subscriber = { version = "0.3", features = ["env-filter"] } -uuid = { version = "1.9.1", features = ["v4", "fast-rng", "serde"] } +uuid = { version = "1.6.1", features = ["v4", "fast-rng", "serde"] } [dev-dependencies] -axum-test = "15.2.0" -frost-ed25519 = { version = "1.0.0-rc.0", features = ["serde"] } -reddsa = { git = "https://github.com/ZcashFoundation/reddsa.git", rev = "81c649c412e5b6ba56d491d2857f91fbd28adbc7", features = [ +axum-test = "14.10.0" +frost-ed25519 = { version = "2.0.0-rc.0", features = ["serde"] } +reddsa = { git = "https://github.com/ZcashFoundation/reddsa.git", rev = "4d8c4bb337231e6e89117334d7c61dada589a953", features = [ "frost", "serde", ] } diff --git a/server/src/types.rs b/server/src/types.rs index 580c531..b295bf5 100644 --- a/server/src/types.rs +++ b/server/src/types.rs @@ -15,7 +15,7 @@ pub struct SerializedIdentifier( impl From> for SerializedIdentifier { fn from(identifier: frost_core::Identifier) -> Self { - Self(identifier.serialize().as_ref().to_vec()) + Self(identifier.serialize().to_vec()) } } @@ -23,13 +23,7 @@ impl TryFrom<&SerializedIdentifier> for frost_core:: type Error = frost_core::Error; fn try_from(serialized_identifier: &SerializedIdentifier) -> Result { - frost_core::Identifier::::deserialize( - &serialized_identifier - .clone() - .0 - .try_into() - .map_err(|_| frost_core::Error::::DeserializationError)?, - ) + frost_core::Identifier::::deserialize(&serialized_identifier.0) } } @@ -111,7 +105,7 @@ pub struct SerializedRandomizer( impl From> for SerializedRandomizer { fn from(randomizer: frost_rerandomized::Randomizer) -> Self { - Self(randomizer.serialize().as_ref().to_vec()) + Self(randomizer.serialize().to_vec()) } } @@ -121,13 +115,7 @@ impl TryFrom<&SerializedRandomizer> type Error = frost_core::Error; fn try_from(serialized_randomizer: &SerializedRandomizer) -> Result { - frost_rerandomized::Randomizer::::deserialize( - &serialized_randomizer - .0 - .clone() - .try_into() - .map_err(|_| frost_core::Error::::DeserializationError)?, - ) + frost_rerandomized::Randomizer::::deserialize(&serialized_randomizer.0) } } @@ -145,7 +133,7 @@ impl From> for SerializedSignatureShare { fn from(randomizer: frost_core::round2::SignatureShare) -> Self { - Self(randomizer.serialize().as_ref().to_vec()) + Self(randomizer.serialize().to_vec()) } } @@ -155,13 +143,7 @@ impl TryFrom<&SerializedSignatureShare> type Error = frost_core::Error; fn try_from(serialized_randomizer: &SerializedSignatureShare) -> Result { - frost_core::round2::SignatureShare::::deserialize( - serialized_randomizer - .0 - .clone() - .try_into() - .map_err(|_| frost_core::Error::::DeserializationError)?, - ) + frost_core::round2::SignatureShare::::deserialize(&serialized_randomizer.0) } } diff --git a/tests/Cargo.toml b/tests/Cargo.toml index 9aad1aa..d6aefdc 100644 --- a/tests/Cargo.toml +++ b/tests/Cargo.toml @@ -4,8 +4,8 @@ version = "0.1.0" edition = "2021" [dependencies] -frost-ed25519 = { version = "1.0.0", features = ["serde"] } -reddsa = { git = "https://github.com/ZcashFoundation/reddsa.git", rev = "81c649c412e5b6ba56d491d2857f91fbd28adbc7", features = ["frost"] } +frost-ed25519 = { version = "2.0.0-rc.0", features = ["serde"] } +reddsa = { git = "https://github.com/ZcashFoundation/reddsa.git", rev = "4d8c4bb337231e6e89117334d7c61dada589a953", features = ["frost"] } hex = "0.4" rand = "0.8" exitcode = "1.1.2" @@ -13,7 +13,7 @@ serde_json = "1.0" tokio = { version = "1", features = ["full"] } [dev-dependencies] -frost-ed25519 = { version = "1.0.0", features = ["serde"] } +frost-ed25519 = { version = "2.0.0-rc.0", features = ["serde"] } dkg = { path = "../dkg"} trusted-dealer = { path = "../trusted-dealer"} participant = { path = "../participant"} diff --git a/trusted-dealer/Cargo.toml b/trusted-dealer/Cargo.toml index 91679c7..8bdedca 100644 --- a/trusted-dealer/Cargo.toml +++ b/trusted-dealer/Cargo.toml @@ -6,9 +6,9 @@ edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -frost-core = { version = "1.0.0", features = ["serde"] } -frost-ed25519 = { version = "1.0.0", features = ["serde"] } -reddsa = { git = "https://github.com/ZcashFoundation/reddsa.git", rev = "81c649c412e5b6ba56d491d2857f91fbd28adbc7", features = ["frost"] } +frost-core = { version = "2.0.0-rc.0", features = ["serde"] } +frost-ed25519 = { version = "2.0.0-rc.0", features = ["serde"] } +reddsa = { git = "https://github.com/ZcashFoundation/reddsa.git", rev = "4d8c4bb337231e6e89117334d7c61dada589a953", features = ["frost"] } clap = { version = "4.5.7", features = ["derive"] } thiserror = "1.0" rand = "0.8" diff --git a/trusted-dealer/src/trusted_dealer_keygen.rs b/trusted-dealer/src/trusted_dealer_keygen.rs index 026f700..3c8bde8 100644 --- a/trusted-dealer/src/trusted_dealer_keygen.rs +++ b/trusted-dealer/src/trusted_dealer_keygen.rs @@ -33,13 +33,7 @@ pub fn split_secret( identifiers: IdentifierList, rng: &mut ThreadRng, ) -> Result<(BTreeMap, SecretShare>, PublicKeyPackage), Error> { - let secret_key = SigningKey::deserialize( - config - .secret - .clone() - .try_into() - .map_err(|_| Error::MalformedSigningKey)?, - )?; + let secret_key = SigningKey::deserialize(&config.secret)?; let (shares, pubkeys) = frost::keys::split( &secret_key, config.max_signers,