Skip to content

Commit

Permalink
remove unnecessary AesGcm error since we now have EncryptionError; re…
Browse files Browse the repository at this point in the history
…move bracket access from frost coordinator
  • Loading branch information
xoloki committed Dec 21, 2024
1 parent 252b2a0 commit 6700842
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 13 deletions.
15 changes: 12 additions & 3 deletions src/state_machine/coordinator/frost.rs
Original file line number Diff line number Diff line change
Expand Up @@ -230,9 +230,18 @@ impl<Aggregator: AggregatorTrait> Coordinator<Aggregator> {
"Starting Private Share Distribution"
);
let dkg_public_shares = if self.config.embed_public_private_shares {
(0..self.config.num_signers)
.map(|id| (id, self.dkg_public_shares[&id].clone()))
.collect()
let mut public_shares = HashMap::new();
for id in 0..self.config.num_signers {
match self.dkg_public_shares.get(&id) {
Some(shares) => {
public_shares.insert(id, shares.clone());
}
None => {
return Err(Error::MissingPublicShares(id));
}
}
}
public_shares
} else {
Default::default()
};
Expand Down
3 changes: 3 additions & 0 deletions src/state_machine/coordinator/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,9 @@ pub enum Error {
/// Missing message response information for a signing round
#[error("Missing message nonce information")]
MissingMessageNonceInfo,
/// Missing DkgPublicShares for a signer_id
#[error("Missing DkgPublicShares for signer_id {0}")]
MissingPublicShares(u32),
/// DKG failure from signers
#[error("DKG failure from signers")]
DkgFailure(HashMap<u32, DkgFailure>),
Expand Down
10 changes: 0 additions & 10 deletions src/state_machine/signer/mod.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
use aes_gcm::Error as AesGcmError;
use core::num::TryFromIntError;
use hashbrown::{HashMap, HashSet};
use rand_core::{CryptoRng, RngCore};
Expand Down Expand Up @@ -63,20 +62,11 @@ pub enum Error {
/// An encryption error occurred
#[error("Encryption error: {0}")]
Encryption(#[from] EncryptionError),
/// An AES-GCM error occurred
#[error("AES-GCM: {0}")]
AesGcm(AesGcmError),
#[error("integer conversion error")]
/// An error during integer conversion operations
TryFromInt,
}

impl From<AesGcmError> for Error {
fn from(err: AesGcmError) -> Self {
Error::AesGcm(err)
}
}

impl From<TryFromIntError> for Error {
fn from(_e: TryFromIntError) -> Self {
Self::TryFromInt
Expand Down

0 comments on commit 6700842

Please sign in to comment.