From 27794d03c9eec580e55f232b431f0f6e4e17dd9c Mon Sep 17 00:00:00 2001 From: Justin Restivo Date: Sat, 2 Dec 2023 11:17:25 -0500 Subject: [PATCH] feat: implement genesis pk generator --- crates/hotshot-signature-key/src/bn254/bn254_pub.rs | 6 +++++- crates/testing/tests/network_task.rs | 9 +++------ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/crates/hotshot-signature-key/src/bn254/bn254_pub.rs b/crates/hotshot-signature-key/src/bn254/bn254_pub.rs index 3a6c11ab19..3b8183a986 100644 --- a/crates/hotshot-signature-key/src/bn254/bn254_pub.rs +++ b/crates/hotshot-signature-key/src/bn254/bn254_pub.rs @@ -148,8 +148,12 @@ impl SignatureKey for BLSPubKey { } fn genesis_proposer_pk() -> Self { + use jf_primitives::signatures::bls_over_bn254::KeyPair; + use rand::rngs::mock::StepRng; + let mut my_rng = StepRng::new(42, 1337); + let kp = KeyPair::generate(&mut my_rng); BLSPubKey { - pub_key: unimplemented!(), + pub_key: kp.ver_key(), } } } diff --git a/crates/testing/tests/network_task.rs b/crates/testing/tests/network_task.rs index f34025dc44..927bf85a0d 100644 --- a/crates/testing/tests/network_task.rs +++ b/crates/testing/tests/network_task.rs @@ -41,12 +41,9 @@ async fn test_network_task() { let vid_disperse = vid.disperse(&encoded_transactions).unwrap(); let payload_commitment = vid_disperse.commit; let signature = - ::SignatureKey::sign( - api.private_key(), - payload_commitment.as_ref(), - ) - .expect("Failed to sign block commitment"); - let da_proposal = Proposal { + ::SignatureKey::sign(api.private_key(), payload_commitment.as_ref()) + .expect("Failed to sign block commitment"); + let da_proposal = Proposal:: { data: DAProposal { encoded_transactions: encoded_transactions.clone(), metadata: (),