mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-21 05:44:44 +00:00
Add new tree_hash crate project wide.
This commit is contained in:
@@ -5,7 +5,8 @@ use bls_aggregates::{
|
||||
use serde::de::{Deserialize, Deserializer};
|
||||
use serde::ser::{Serialize, Serializer};
|
||||
use serde_hex::{encode as hex_encode, HexVisitor};
|
||||
use ssz::{decode, hash, Decodable, DecodeError, Encodable, SszStream, TreeHash};
|
||||
use ssz::{decode, Decodable, DecodeError, Encodable, SszStream};
|
||||
use tree_hash::impl_tree_hash_for_ssz_bytes;
|
||||
|
||||
/// A BLS aggregate signature.
|
||||
///
|
||||
@@ -165,11 +166,7 @@ impl<'de> Deserialize<'de> for AggregateSignature {
|
||||
}
|
||||
}
|
||||
|
||||
impl TreeHash for AggregateSignature {
|
||||
fn tree_hash_root(&self) -> Vec<u8> {
|
||||
hash(&self.as_bytes())
|
||||
}
|
||||
}
|
||||
impl_tree_hash_for_ssz_bytes!(AggregateSignature);
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
|
||||
@@ -4,7 +4,8 @@ use hex::encode as hex_encode;
|
||||
use serde::de::{Deserialize, Deserializer};
|
||||
use serde::ser::{Serialize, Serializer};
|
||||
use serde_hex::HexVisitor;
|
||||
use ssz::{decode, hash, ssz_encode, Decodable, DecodeError, Encodable, SszStream, TreeHash};
|
||||
use ssz::{decode, ssz_encode, Decodable, DecodeError, Encodable, SszStream};
|
||||
use tree_hash::impl_tree_hash_for_ssz_bytes;
|
||||
|
||||
/// A single BLS signature.
|
||||
///
|
||||
@@ -114,11 +115,7 @@ impl Decodable for Signature {
|
||||
}
|
||||
}
|
||||
|
||||
impl TreeHash for Signature {
|
||||
fn tree_hash_root(&self) -> Vec<u8> {
|
||||
hash(&self.as_bytes())
|
||||
}
|
||||
}
|
||||
impl_tree_hash_for_ssz_bytes!(Signature);
|
||||
|
||||
impl Serialize for Signature {
|
||||
/// Serde serialization is compliant the Ethereum YAML test format.
|
||||
|
||||
Reference in New Issue
Block a user