From 3b3ff487555958255cdd078cd553f534f074b108 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20N=C3=BA=C3=B1ez?= Date: Wed, 13 Sep 2023 11:39:08 +0200 Subject: [PATCH] TODOs and comments --- ferveo/src/lib.rs | 8 +++----- ferveo/src/pvss.rs | 1 + ferveo/src/refresh.rs | 2 ++ tpke/src/combine.rs | 2 ++ tpke/src/decryption.rs | 2 ++ 5 files changed, 10 insertions(+), 5 deletions(-) diff --git a/ferveo/src/lib.rs b/ferveo/src/lib.rs index 5107a261..fa5340f1 100644 --- a/ferveo/src/lib.rs +++ b/ferveo/src/lib.rs @@ -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)| { @@ -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( @@ -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() @@ -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> = validator_keypairs diff --git a/ferveo/src/pvss.rs b/ferveo/src/pvss.rs index 050e3dfd..91976ee9 100644 --- a/ferveo/src/pvss.rs +++ b/ferveo/src/pvss.rs @@ -374,6 +374,7 @@ impl PubliclyVerifiableSS { .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, diff --git a/ferveo/src/refresh.rs b/ferveo/src/refresh.rs index da6bd8e7..bb11bb48 100644 --- a/ferveo/src/refresh.rs +++ b/ferveo/src/refresh.rs @@ -22,6 +22,7 @@ pub fn prepare_share_updates_for_recovery( prepare_share_updates_with_root::(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( private_key_share: &PrivateKeyShare, @@ -147,6 +148,7 @@ mod tests_refresh { remaining_participants: &[PrivateDecryptionContextSimple], ) -> Vec> { // Each participant prepares an update for each other participant + // TODO: Extract as parameter let domain_points = remaining_participants[0] .public_decryption_contexts .iter() diff --git a/tpke/src/combine.rs b/tpke/src/combine.rs index a46477fb..f9d8ddbb 100644 --- a/tpke/src/combine.rs +++ b/tpke/src/combine.rs @@ -56,6 +56,8 @@ pub fn prepare_combine_fast( .collect::>() } +// 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( domain: &[E::ScalarField], ) -> Vec { diff --git a/tpke/src/decryption.rs b/tpke/src/decryption.rs index 01ae5df7..0622e6a8 100644 --- a/tpke/src/decryption.rs +++ b/tpke/src/decryption.rs @@ -56,11 +56,13 @@ impl ValidatorShareChecksum { h: &E::G2, ciphertext: &Ciphertext, ) -> 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)