Skip to content

Commit

Permalink
TODOs and comments
Browse files Browse the repository at this point in the history
  • Loading branch information
cygnusv committed Sep 13, 2023
1 parent 8407f78 commit 3b3ff48
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 5 deletions.
8 changes: 3 additions & 5 deletions ferveo/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -413,7 +413,7 @@ mod test_dkg_full {
// Participants share updates and update their shares

// Now, every participant separately:
// TODO: Move this logic outside tests
// TODO: Move this logic outside tests (see #162, #163)
let updated_shares: Vec<_> = remaining_validators
.iter()
.map(|(_validator_address, validator)| {
Expand All @@ -440,7 +440,7 @@ mod test_dkg_full {
})
.collect();

// TODO: Rename updated_private_shares to something that doesn't imply mutation
// TODO: Rename updated_private_shares to something that doesn't imply mutation (see #162, #163)

// Now, we have to combine new share fragments into a new share
let new_private_key_share = recover_share_from_updated_private_shares(
Expand Down Expand Up @@ -549,7 +549,7 @@ mod test_dkg_full {
// Participants share updates and update their shares

// Now, every participant separately:
// TODO: Move this logic outside tests
// TODO: Move this logic outside tests (see #162, #163)
let updated_shares: Vec<_> = dkg
.validators
.iter()
Expand Down Expand Up @@ -577,8 +577,6 @@ mod test_dkg_full {
})
.collect();

// TODO: Rename updated_private_shares to something that doesn't imply mutation

// Get decryption shares, now with refreshed private shares:
let decryption_shares: Vec<DecryptionShareSimple<E>> =
validator_keypairs
Expand Down
1 change: 1 addition & 0 deletions ferveo/src/pvss.rs
Original file line number Diff line number Diff line change
Expand Up @@ -374,6 +374,7 @@ impl<E: Pairing, T: Aggregate> PubliclyVerifiableSS<E, T> {
.map_err(|e| e.into())
}

// TODO: Consider relocate to different place, maybe PrivateKeyShare? (see #162, #163)
pub fn update_private_key_share_for_recovery(
&self,
validator_decryption_key: &E::ScalarField,
Expand Down
2 changes: 2 additions & 0 deletions ferveo/src/refresh.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ pub fn prepare_share_updates_for_recovery<E: Pairing>(
prepare_share_updates_with_root::<E>(domain_points, h, x_r, threshold, rng)
}

// TODO: Consider relocating to PrivateKeyShare (see #162, #163)
/// From PSS paper, section 4.2.3, (https://link.springer.com/content/pdf/10.1007/3-540-44750-4_27.pdf)
pub fn apply_updates_to_private_share<E: Pairing>(
private_key_share: &PrivateKeyShare<E>,
Expand Down Expand Up @@ -147,6 +148,7 @@ mod tests_refresh {
remaining_participants: &[PrivateDecryptionContextSimple<E>],
) -> Vec<PrivateKeyShare<E>> {
// Each participant prepares an update for each other participant
// TODO: Extract as parameter
let domain_points = remaining_participants[0]
.public_decryption_contexts
.iter()
Expand Down
2 changes: 2 additions & 0 deletions tpke/src/combine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ pub fn prepare_combine_fast<E: Pairing>(
.collect::<Vec<_>>()
}

// TODO: Combine `tpke::prepare_combine_simple` and `tpke::share_combine_simple` into
// one function and expose it in the tpke::api?
pub fn prepare_combine_simple<E: Pairing>(
domain: &[E::ScalarField],
) -> Vec<E::ScalarField> {
Expand Down
2 changes: 2 additions & 0 deletions tpke/src/decryption.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,13 @@ impl<E: Pairing> ValidatorShareChecksum<E> {
h: &E::G2,
ciphertext: &Ciphertext<E>,
) -> bool {
// See https://github.com/nucypher/ferveo/issues/42#issuecomment-1398953777
// D_i == e(C_i, Y_i)
if *decryption_share != E::pairing(self.checksum, *share_aggregate).0 {
return false;
}

// TODO: use multipairing here (h_inv)
// e(C_i, ek_i) == e(U, H)
if E::pairing(self.checksum, *validator_public_key)
!= E::pairing(ciphertext.commitment, *h)
Expand Down

0 comments on commit 3b3ff48

Please sign in to comment.