Skip to content

Commit

Permalink
Updated ironfish-frost to the latest version
Browse files Browse the repository at this point in the history
  • Loading branch information
andiflabs committed Feb 22, 2024
1 parent 67345ea commit 116e6d8
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 16 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion ironfish-rust-nodejs/src/frost.rs
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ pub fn split_secret(

let mut public_key_package_vec: Vec<u8> = vec![];
t.public_key_package
.write(&mut public_key_package_vec)
.serialize_into(&mut public_key_package_vec)
.map_err(to_napi_err)?;

Ok(TrustedDealerKeyPackages {
Expand Down
2 changes: 1 addition & 1 deletion ironfish-rust-nodejs/src/structs/transaction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -531,7 +531,7 @@ pub fn aggregate_signature_shares(
signing_package_str: String,
signature_shares_arr: Vec<String>,
) -> Result<Buffer> {
let public_key_package = PublicKeyPackage::read(
let public_key_package = PublicKeyPackage::deserialize_from(
&hex_to_vec_bytes(&public_key_package_str).map_err(to_napi_err)?[..],
)
.map_err(to_napi_err)?;
Expand Down
6 changes: 2 additions & 4 deletions ironfish-rust/src/frost_utils/split_secret.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,8 @@ pub(crate) fn split_secret<R: RngCore + CryptoRng>(
key_packages.insert(identity, key_package);
}

let public_key_package = PublicKeyPackage {
frost_public_key_package: pubkeys,
identities: config.identities.clone(),
};
let public_key_package =
PublicKeyPackage::from_frost(pubkeys, config.identities.iter().cloned());

Ok((key_packages, public_key_package))
}
Expand Down
5 changes: 1 addition & 4 deletions ironfish-rust/src/frost_utils/split_spender_key.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,7 @@ pub fn split_spender_key(

let (key_packages, public_key_package) = split_secret(&secret_config, rng)?;

let authorizing_key_bytes = public_key_package
.frost_public_key_package
.verifying_key()
.serialize();
let authorizing_key_bytes = public_key_package.verifying_key().serialize();

let authorizing_key = Option::from(SubgroupPoint::from_bytes(&authorizing_key_bytes))
.ok_or_else(|| IronfishError::new(IronfishErrorKind::InvalidAuthorizingKey))?;
Expand Down
8 changes: 3 additions & 5 deletions ironfish-rust/src/transaction/unsigned.rs
Original file line number Diff line number Diff line change
Expand Up @@ -206,15 +206,13 @@ impl UnsignedTransaction {

let randomizer = Randomizer::deserialize(&self.public_key_randomness.to_bytes())
.map_err(|e| IronfishError::new_with_source(IronfishErrorKind::InvalidRandomizer, e))?;
let randomized_params = RandomizedParams::from_randomizer(
public_key_package.frost_public_key_package.verifying_key(),
randomizer,
);
let randomized_params =
RandomizedParams::from_randomizer(public_key_package.verifying_key(), randomizer);

let authorizing_group_signature = aggregate(
authorizing_signing_package,
&authorizing_signature_shares,
&public_key_package.frost_public_key_package,
public_key_package.frost_public_key_package(),
&randomized_params,
)
.map_err(|e| {
Expand Down

0 comments on commit 116e6d8

Please sign in to comment.