From cf3ac5395f1659b9ea427e74b4fb779e3c229663 Mon Sep 17 00:00:00 2001 From: ratankaliani Date: Thu, 10 Aug 2023 23:29:23 -0700 Subject: [PATCH] lint --- src/fixtures/generate_tests.rs | 75 ---------------------------------- 1 file changed, 75 deletions(-) diff --git a/src/fixtures/generate_tests.rs b/src/fixtures/generate_tests.rs index c1d3d7fe..fe9b4d1a 100644 --- a/src/fixtures/generate_tests.rs +++ b/src/fixtures/generate_tests.rs @@ -94,79 +94,4 @@ pub async fn get_celestia_consensus_signatures() -> Result<(), Error> { file.write_all(json.as_bytes()).unwrap(); Ok(()) - - // let block: SignedBlock = v.result.try_into().expect("Failed to parse JSON"); - - // let non_absent_votes = - // block - // .commit - // .signatures - // .iter() - // .enumerate() - // .filter_map(|(idx, signature)| { - // ValidatorIndex::try_from(idx) - // .ok() - // .and_then(|validator_idx| { - // non_absent_vote(signature, validator_idx, &block.commit) - // .map(|vote| (signature, vote)) - // }) - // }); - - // let mut signature_verify_data = Vec::new(); - // for (_, vote) in non_absent_votes { - // let validator = Box::new( - // match block.validator_set.validator(vote.validator_address) { - // Some(validator) => validator, - // None => continue, // Cannot find matching validator, so we skip the vote - // }, - // ); - - // // Cast the vote into a signedVote struct (which is used to get the signed bytes) - // let signed_vote = Box::new( - // SignedVote::from_vote(vote.clone(), block.header.chain_id.clone()) - // .expect("missing signature"), - // ); - - // let pub_key = validator.pub_key.ed25519().unwrap(); - - // // Get the encoded signed vote bytes - // // https://github.com/celestiaorg/celestia-core/blob/main/proto/tendermint/types/canonical.proto#L30-L37 - // let sign_bytes = signed_vote.sign_bytes(); - - // // Similar to encoding the vote: https://github.com/informalsystems/tendermint-rs/blob/c2b5c9e01eab1c740598aa14375a7453f3bfa436/tendermint/src/vote.rs#L267-L271 - // // let decoded_vote: CanonicalVote = Protobuf::::decode_length_delimited_vec(&sign_bytes).expect("failed to decode sign_bytes"); - - // // Verify that the message signed is in fact the sign_bytes - // validator - // .verify_signature::( - // &sign_bytes, - // signed_vote.signature(), - // ) - // .expect("invalid signature"); - - // let pubkey_str = String::from_utf8(hex::encode(pub_key.as_bytes())).unwrap(); - // println!("Pubkey: {:?}", pubkey_str); - // let message_str = String::from_utf8(hex::encode(sign_bytes.clone())).unwrap(); - // println!("Signed Vote: {:?}", message_str); - // let signature_bytes = signed_vote.signature().clone().into_bytes(); - // let signature_str = String::from_utf8(hex::encode(signature_bytes.clone())).unwrap(); - // println!("Signature: {:?}", signature_str); - - // // Add pubkey, signed vote, signature into JSON object - // signature_verify_data.push(VerifySignatureData { - // pubkey: pubkey_str, - // signature: signature_str, - // message: message_str, - // }); - // // TODO: We can break out of the loop when we have enough voting power. - // // See https://github.com/informalsystems/tendermint-rs/issues/235 - // } - - // // Write to JSON file - // let json = serde_json::to_string(&signature_verify_data).unwrap(); - // // Write to file named "signature_verify_data.json" - // let mut file = File::create("src/fixtures/signature_verify_data.json").unwrap(); - // file.write_all(json.as_bytes()).unwrap(); - - // Ok(()) }