Skip to content

Commit

Permalink
Threshold Custody: check uniqueness of verification keys in DKG
Browse files Browse the repository at this point in the history
  • Loading branch information
cronokirby committed Dec 6, 2023
1 parent 96547e3 commit c6a4723
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion crates/custody/src/threshold/dkg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use ark_serialize::{CanonicalDeserialize, CanonicalSerialize};
use decaf377::Fq;
use decaf377_frost as frost;
use frost::keys::dkg as frost_dkg;
use std::collections::HashMap;
use std::collections::{HashMap, HashSet};
mod encryption;
use ed25519_consensus::{Signature, SigningKey, VerificationKey};
use encryption::EncryptionKey;
Expand Down Expand Up @@ -257,6 +257,17 @@ pub fn round2(
state: Round1State,
messages: Vec<Round1>,
) -> Result<(Round2, Round2State)> {
// Check that all verification keys are unique, and not equal to my own
{
let mut seen = HashSet::new();
seen.insert(state.sk.verification_key());
for m in &messages {
if seen.contains(&m.vk) {
anyhow::bail!("duplicate verification key in messages");
}
}
}

let associated_info = messages
.into_iter()
.map(|x| {
Expand Down

0 comments on commit c6a4723

Please sign in to comment.