Skip to content

Commit

Permalink
add set_key_and_party_polynomials fn to frost coordinator
Browse files Browse the repository at this point in the history
  • Loading branch information
xoloki committed Jan 27, 2025
1 parent 4e6fed1 commit 6d439d6
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions src/state_machine/coordinator/frost.rs
Original file line number Diff line number Diff line change
Expand Up @@ -356,6 +356,32 @@ impl<Aggregator: AggregatorTrait> Coordinator<Aggregator> {
Ok(())
}

/// Set the aggregate key and polynomial commitments used to form that key.
/// Check if the polynomial commitments match the key
pub fn set_key_and_party_polynomials(
&mut self,
aggregate_key: Point,
party_polynomials: Vec<(u32, PolyCommitment)>,
) -> Result<(), Error> {
let computed_key = party_polynomials
.iter()
.fold(Point::default(), |s, (_, comm)| s + comm.poly[0]);
if computed_key != aggregate_key {
return Err(Error::AggregateKeyPolynomialMismatch(
computed_key,
aggregate_key,
));
}
let party_polynomials_len = party_polynomials.len();
let party_polynomials = HashMap::from_iter(party_polynomials);
if party_polynomials.len() != party_polynomials_len {
return Err(Error::DuplicatePartyId);
}
self.aggregate_public_key = Some(aggregate_key);
self.party_polynomials = party_polynomials;
Ok(())
}

fn request_nonces(&mut self, signature_type: SignatureType) -> Result<Packet, Error> {
self.public_nonces.clear();
info!(
Expand Down

0 comments on commit 6d439d6

Please sign in to comment.