update frost-secp256-tr code to changes from 1.0.0
This commit is contained in:
parent
0ed163f93a
commit
c63a3ca699
|
@ -4,7 +4,7 @@ edition = "2021"
|
|||
# When releasing to crates.io:
|
||||
# - Update CHANGELOG.md
|
||||
# - Create git tag.
|
||||
version = "1.0.0-rc.0"
|
||||
version = "1.0.0"
|
||||
authors = [
|
||||
"Deirdre Connolly <durumcrustulum@gmail.com>",
|
||||
"Chelsea Komlo <me@chelseakomlo.com>",
|
||||
|
@ -23,16 +23,16 @@ rustdoc-args = ["--cfg", "docsrs"]
|
|||
|
||||
[dependencies]
|
||||
document-features = "0.2.7"
|
||||
frost-core = { path = "../frost-core", version = "1.0.0-rc.0" }
|
||||
frost-rerandomized = { path = "../frost-rerandomized", version = "1.0.0-rc.0" }
|
||||
frost-core = { path = "../frost-core", version = "1.0.0" }
|
||||
frost-rerandomized = { path = "../frost-rerandomized", version = "1.0.0" }
|
||||
k256 = { version = "0.13.0", features = ["arithmetic", "expose-field", "hash2curve"] }
|
||||
rand_core = "0.6"
|
||||
sha2 = "0.10.2"
|
||||
|
||||
[dev-dependencies]
|
||||
criterion = "0.5"
|
||||
frost-core = { path = "../frost-core", version = "1.0.0-rc.0", features = ["test-impl"] }
|
||||
frost-rerandomized = { path = "../frost-rerandomized", version = "1.0.0-rc.0", features = ["test-impl"] }
|
||||
frost-core = { path = "../frost-core", version = "1.0.0", features = ["test-impl"] }
|
||||
frost-rerandomized = { path = "../frost-rerandomized", version = "1.0.0", features = ["test-impl"] }
|
||||
insta = { version = "1.31.0", features = ["yaml"] }
|
||||
hex = "0.4.3"
|
||||
lazy_static = "1.4"
|
||||
|
|
|
@ -1 +1,5 @@
|
|||
// Required since each integration test is compiled as a separated crate,
|
||||
// and each one uses only part of the module.
|
||||
#![allow(dead_code)]
|
||||
|
||||
pub mod samples;
|
||||
|
|
|
@ -2,14 +2,14 @@
|
|||
|
||||
use std::collections::BTreeMap;
|
||||
|
||||
use frost_core::{Ciphersuite, Element, Group, Scalar};
|
||||
use frost_core::{round1::Nonce, Ciphersuite, Element, Group, Scalar};
|
||||
use frost_secp256k1_tr::{
|
||||
keys::{
|
||||
dkg::{round1, round2},
|
||||
KeyPackage, PublicKeyPackage, SecretShare, SigningShare, VerifiableSecretSharingCommitment,
|
||||
VerifyingShare,
|
||||
},
|
||||
round1::{NonceCommitment, SigningCommitments},
|
||||
round1::{NonceCommitment, SigningCommitments, SigningNonces},
|
||||
round2::SignatureShare,
|
||||
Field, Signature, SigningPackage, VerifyingKey,
|
||||
};
|
||||
|
@ -32,6 +32,16 @@ fn scalar1() -> Scalar<C> {
|
|||
.expect("nonzero elements have inverses")
|
||||
}
|
||||
|
||||
/// Generate a sample SigningCommitments.
|
||||
pub fn signing_nonces() -> SigningNonces {
|
||||
let serialized_scalar1 = <<C as Ciphersuite>::Group as Group>::Field::serialize(&scalar1());
|
||||
let serialized_scalar2 = <<C as Ciphersuite>::Group as Group>::Field::serialize(&scalar1());
|
||||
let hiding_nonce = Nonce::deserialize(serialized_scalar1).unwrap();
|
||||
let binding_nonce = Nonce::deserialize(serialized_scalar2).unwrap();
|
||||
|
||||
SigningNonces::from_nonces(hiding_nonce, binding_nonce)
|
||||
}
|
||||
|
||||
/// Generate a sample SigningCommitments.
|
||||
pub fn signing_commitments() -> SigningCommitments {
|
||||
let serialized_element1 = <C as Ciphersuite>::Group::serialize(&element1());
|
||||
|
|
|
@ -6,7 +6,7 @@ use frost_secp256k1_tr::{
|
|||
dkg::{round1, round2},
|
||||
KeyPackage, PublicKeyPackage, SecretShare,
|
||||
},
|
||||
round1::SigningCommitments,
|
||||
round1::{SigningCommitments, SigningNonces},
|
||||
round2::SignatureShare,
|
||||
SigningPackage,
|
||||
};
|
||||
|
@ -15,6 +15,16 @@ mod helpers;
|
|||
|
||||
use helpers::samples;
|
||||
|
||||
/// Check if SigningNonces can be recreated.
|
||||
#[test]
|
||||
fn check_signing_nonces_recreation() {
|
||||
let nonces = samples::signing_nonces();
|
||||
let hiding = nonces.hiding();
|
||||
let binding = nonces.binding();
|
||||
let new_nonces = SigningNonces::from_nonces(*hiding, *binding);
|
||||
assert!(nonces == new_nonces);
|
||||
}
|
||||
|
||||
/// Check if SigningCommitments can be recreated.
|
||||
#[test]
|
||||
fn check_signing_commitments_recreation() {
|
||||
|
|
|
@ -7,7 +7,7 @@ use frost_secp256k1_tr::{
|
|||
dkg::{round1, round2},
|
||||
KeyPackage, PublicKeyPackage, SecretShare,
|
||||
},
|
||||
round1::SigningCommitments,
|
||||
round1::{SigningCommitments, SigningNonces},
|
||||
round2::SignatureShare,
|
||||
SigningPackage,
|
||||
};
|
||||
|
@ -15,6 +15,14 @@ use frost_secp256k1_tr::{
|
|||
use helpers::samples;
|
||||
use insta::assert_snapshot;
|
||||
|
||||
#[test]
|
||||
fn check_signing_nonces_postcard_serialization() {
|
||||
let nonces = samples::signing_nonces();
|
||||
let bytes: Vec<_> = nonces.serialize().unwrap();
|
||||
assert_snapshot!(hex::encode(&bytes));
|
||||
assert_eq!(nonces, SigningNonces::deserialize(&bytes).unwrap());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn check_signing_commitments_postcard_serialization() {
|
||||
let commitments = samples::signing_commitments();
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
source: frost-secp256k1/tests/serialization_tests.rs
|
||||
expression: "hex::encode(&bytes)"
|
||||
---
|
||||
00230f8ab3aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa9d1c9e899ca306ad27fe1945de0242b81aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa9d1c9e899ca306ad27fe1945de0242b8100230f8ab3034c7ff4f2ba8603998339c8e42675ceac23ef2e9623fdb260b24b1c944a2ea1a9034c7ff4f2ba8603998339c8e42675ceac23ef2e9623fdb260b24b1c944a2ea1a9
|
Loading…
Reference in New Issue