Skip to content

Commit cf58580

Browse files
committed
[❄] s/compute_randomness_beacon/vrf_security_check
compute_randomness_beacon was too abstract.
1 parent 931354b commit cf58580

File tree

4 files changed

+20
-15
lines changed

4 files changed

+20
-15
lines changed

schnorr_fun/src/frost/chilldkg/certpedpop.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ impl SecretShareReceiver {
168168
.encryption_keys()
169169
.map(|(_, encryption_key)| encryption_key)
170170
.chain(contributor_keys.iter().cloned())
171-
.collect::<BTreeSet<_>>(); // dedupe as some contributers may have also be receivers
171+
.collect::<BTreeSet<_>>(); // dedupe as some contributors may also be receivers
172172

173173
for cert_key in cert_keys {
174174
match certificate.get(&cert_key) {
@@ -436,10 +436,10 @@ mod test {
436436
.expect("CertifiedKeygen should be valid");
437437

438438
// Compute randomness beacon from the VRF outputs
439-
let randomness = output.certified_keygen.compute_randomness_beacon(sha2::Sha256::default());
439+
let randomness = output.certified_keygen.vrf_security_check(sha2::Sha256::default());
440440

441441
// Verify the randomness is deterministic
442-
let randomness2 = output.certified_keygen.compute_randomness_beacon(sha2::Sha256::default());
442+
let randomness2 = output.certified_keygen.vrf_security_check(sha2::Sha256::default());
443443
assert_eq!(randomness, randomness2);
444444

445445
// Verify we have the expected number of VRF certificates

schnorr_fun/src/frost/chilldkg/certpedpop/certificate.rs

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -254,18 +254,23 @@ pub mod vrf_cert {
254254
///
255255
/// ## Security
256256
///
257-
/// This is secure because from the view of the honest party the
258-
/// certpedpop acts as a secure coin tossing protocol, where if no
259-
/// parties controlled my the adversary **do not** abort the output will
260-
/// be uniformly distributed. Observe that:
257+
/// If no parties controlled by the adversary abort, the output will
258+
/// be uniformly distributed. The VRF outputs effectively act as a "randomness beacon" -
259+
/// a source of verifiable randomness that all parties can compute deterministically
260+
/// from the certificates. Observe that:
261261
///
262262
/// 1. The malicious party must commit to all the VRF public keys up front.
263-
/// 2. The honest party verifies its contribution to the keygen is included (which are always rampled randomly)
264-
/// 3. The VRF is over the transcript and every transcript with the honest party can never happen twice (because of #2).
263+
/// 2. The honest party verifies its contribution to the keygen is included (which are always sampled randomly)
264+
/// 3. The VRF is over the transcript and every transcript with an honest party will always be unique (because of #2).
265265
/// 4. The honest party's VRF output will be both hidden and uniformly distributed.
266-
pub fn compute_randomness_beacon(&self, hasher: impl Hash32) -> [u8; 32] {
267-
// BTreeMap already maintains sorted order by key
268-
let mut hasher = hasher;
266+
/// 5. All honest parties with the same `AggKeygenInput::cert_bytes` will output the same check
267+
/// 6. All honest parties with a different `AggKeygenInput::cert_bytes` are statistically likely to output different bytes.
268+
///
269+
/// This check is *statistically* secure -- per keygen the attacker only
270+
/// has 1/2ⁿ chance of succeeding to collide the checks where `n` is the
271+
/// number of bits the honest parties check among each other. **It is up
272+
/// to the application to limit the number of attempts the adversary can make.**
273+
pub fn vrf_security_check(&self, mut hasher: impl Hash32) -> [u8; 32] {
269274
for vrf_proof in self.certificate.values() {
270275
let gamma = vrf_proof.dangerously_access_gamma_without_verifying();
271276
hasher.update(gamma.to_bytes().as_ref());

schnorr_fun/src/frost/chilldkg/encpedpop.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ impl Contributor {
4242
/// has nothing to do with the "receiver" index (the `ShareIndex` of share receivers). If
4343
/// there are `n` `KeyGenInputParty`s then each party must be assigned an index from `0` to `n-1`.
4444
///
45-
/// This method return `Self` to retain the state of the protocol which is needded to verify
45+
/// This method returns `Self` to retain the state of the protocol which is needed to verify
4646
/// the aggregated input later on.
4747
pub fn gen_keygen_input<H, NG>(
4848
schnorr: &Schnorr<H, NG>,

schnorr_fun/src/frost/chilldkg/simplepedpop.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ impl Contributor {
3535
/// has nothing to do with the "receiver" index (the `ShareIndex` of share receivers). If
3636
/// there are `n` `KeyGenInputParty`s then each party must be assigned an index from `0` to `n-1`.
3737
///
38-
/// This method return `Self` to retain the state of the protocol which is needded to verify
38+
/// This method returns `Self` to retain the state of the protocol which is needed to verify
3939
/// the aggregated input later on.
4040
pub fn gen_keygen_input<H, NG>(
4141
schnorr: &Schnorr<H, NG>,
@@ -50,7 +50,7 @@ impl Contributor {
5050
{
5151
let secret_poly = poly::scalar::generate(threshold as usize, rng);
5252
let pop_keypair = KeyPair::new_xonly(secret_poly[0]);
53-
// XXX The thing that's singed differs from the spec
53+
// XXX The thing that's signed differs from the spec
5454
let pop = schnorr.sign(&pop_keypair, Message::empty());
5555
let com = poly::scalar::to_point_poly(&secret_poly);
5656

0 commit comments

Comments
 (0)