mirror of
https://gitlab.com/pulsechaincom/lighthouse-pulse.git
synced 2025-01-19 18:20:52 +00:00
e550c0218f
Thou shalt appease clippy
40 lines
1.2 KiB
Rust
40 lines
1.2 KiB
Rust
use super::*;
|
|
use crate::case_result::compare_result;
|
|
use bls::{AggregatePublicKey, PublicKey};
|
|
use serde_derive::Deserialize;
|
|
|
|
#[derive(Debug, Clone, Deserialize)]
|
|
pub struct BlsAggregatePubkeys {
|
|
pub input: Vec<String>,
|
|
pub output: String,
|
|
}
|
|
|
|
impl YamlDecode for BlsAggregatePubkeys {
|
|
fn yaml_decode(yaml: &str) -> Result<Self, Error> {
|
|
Ok(serde_yaml::from_str(yaml).unwrap())
|
|
}
|
|
}
|
|
|
|
impl Case for BlsAggregatePubkeys {
|
|
fn result(&self, _case_index: usize) -> Result<(), Error> {
|
|
let mut aggregate_pubkey = AggregatePublicKey::new();
|
|
|
|
for key_str in &self.input {
|
|
let key = hex::decode(&key_str[2..])
|
|
.map_err(|e| Error::FailedToParseTest(format!("{:?}", e)))?;
|
|
let key = PublicKey::from_bytes(&key)
|
|
.map_err(|e| Error::FailedToParseTest(format!("{:?}", e)))?;
|
|
|
|
aggregate_pubkey.add(&key);
|
|
}
|
|
|
|
let output_bytes = Some(
|
|
hex::decode(&self.output[2..])
|
|
.map_err(|e| Error::FailedToParseTest(format!("{:?}", e)))?,
|
|
);
|
|
let aggregate_pubkey = Ok(aggregate_pubkey.as_raw().as_bytes());
|
|
|
|
compare_result::<Vec<u8>, Vec<u8>>(&aggregate_pubkey, &output_bytes)
|
|
}
|
|
}
|