mirror of
https://gitlab.com/pulsechaincom/lighthouse-pulse.git
synced 2024-12-22 11:41:28 +00:00
Add new tree_hash
crate project wide.
This commit is contained in:
parent
b8c4c3308a
commit
f69b56ad60
@ -23,4 +23,5 @@ serde_json = "1.0"
|
||||
slot_clock = { path = "../../eth2/utils/slot_clock" }
|
||||
ssz = { path = "../../eth2/utils/ssz" }
|
||||
state_processing = { path = "../../eth2/state_processing" }
|
||||
tree_hash = { path = "../../eth2/utils/tree_hash" }
|
||||
types = { path = "../../eth2/types" }
|
||||
|
@ -38,5 +38,6 @@ serde_json = "1.0"
|
||||
serde_yaml = "0.8"
|
||||
slot_clock = { path = "../../../eth2/utils/slot_clock" }
|
||||
ssz = { path = "../../../eth2/utils/ssz" }
|
||||
tree_hash = { path = "../../../eth2/utils/tree_hash" }
|
||||
types = { path = "../../../eth2/types" }
|
||||
yaml-rust = "0.4.2"
|
||||
|
@ -15,6 +15,7 @@ version = { path = "../version" }
|
||||
types = { path = "../../eth2/types" }
|
||||
slog = { version = "^2.2.3" , features = ["max_level_trace", "release_max_level_debug"] }
|
||||
ssz = { path = "../../eth2/utils/ssz" }
|
||||
tree_hash = { path = "../../eth2/utils/tree_hash" }
|
||||
futures = "0.1.25"
|
||||
error-chain = "0.12.0"
|
||||
crossbeam-channel = "0.3.8"
|
||||
|
@ -7,4 +7,5 @@ edition = "2018"
|
||||
[dependencies]
|
||||
slot_clock = { path = "../../eth2/utils/slot_clock" }
|
||||
ssz = { path = "../../eth2/utils/ssz" }
|
||||
tree_hash = { path = "../../eth2/utils/tree_hash" }
|
||||
types = { path = "../../eth2/types" }
|
||||
|
@ -141,8 +141,7 @@ impl<T: SlotClock, U: BeaconNode, V: DutiesReader, W: Signer> Attester<T, U, V,
|
||||
data: attestation_data.clone(),
|
||||
custody_bit: PHASE_0_CUSTODY_BIT,
|
||||
}
|
||||
.tree_hash_root
|
||||
| update();
|
||||
.tree_hash_root();
|
||||
|
||||
self.signer
|
||||
.sign_attestation_message(&message[..], DOMAIN_ATTESTATION)
|
||||
|
@ -8,4 +8,5 @@ edition = "2018"
|
||||
int_to_bytes = { path = "../utils/int_to_bytes" }
|
||||
slot_clock = { path = "../utils/slot_clock" }
|
||||
ssz = { path = "../utils/ssz" }
|
||||
tree_hash = { path = "../../eth2/utils/tree_hash" }
|
||||
types = { path = "../types" }
|
||||
|
@ -2,8 +2,8 @@ pub mod test_utils;
|
||||
mod traits;
|
||||
|
||||
use slot_clock::SlotClock;
|
||||
use ssz::{SignedRoot, TreeHash};
|
||||
use std::sync::Arc;
|
||||
use tree_hash::{SignedRoot, TreeHash};
|
||||
use types::{BeaconBlock, ChainSpec, Domain, Slot};
|
||||
|
||||
pub use self::traits::{
|
||||
|
@ -26,5 +26,7 @@ log = "0.4"
|
||||
merkle_proof = { path = "../utils/merkle_proof" }
|
||||
ssz = { path = "../utils/ssz" }
|
||||
ssz_derive = { path = "../utils/ssz_derive" }
|
||||
tree_hash = { path = "../utils/tree_hash" }
|
||||
tree_hash_derive = { path = "../utils/tree_hash_derive" }
|
||||
types = { path = "../types" }
|
||||
rayon = "1.0"
|
||||
|
@ -1,7 +1,7 @@
|
||||
use crate::common::slash_validator;
|
||||
use errors::{BlockInvalid as Invalid, BlockProcessingError as Error, IntoWithIndex};
|
||||
use rayon::prelude::*;
|
||||
use ssz::{SignedRoot, TreeHash};
|
||||
use tree_hash::{SignedRoot, TreeHash};
|
||||
use types::*;
|
||||
|
||||
pub use self::verify_attester_slashing::{
|
||||
|
@ -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.
|
||||
|
@ -17,6 +17,7 @@ block_proposer = { path = "../eth2/block_proposer" }
|
||||
attester = { path = "../eth2/attester" }
|
||||
bls = { path = "../eth2/utils/bls" }
|
||||
ssz = { path = "../eth2/utils/ssz" }
|
||||
tree_hash = { path = "../eth2/utils/tree_hash" }
|
||||
clap = "2.32.0"
|
||||
dirs = "1.0.3"
|
||||
grpcio = { version = "0.4", default-features = false, features = ["protobuf-codec"] }
|
||||
|
@ -6,8 +6,8 @@ pub use self::beacon_node_block::{BeaconNodeError, PublishOutcome};
|
||||
pub use self::grpc::BeaconBlockGrpcClient;
|
||||
use crate::signer::Signer;
|
||||
use slog::{error, info, warn};
|
||||
use ssz::{SignedRoot, TreeHash};
|
||||
use std::sync::Arc;
|
||||
use tree_hash::{SignedRoot, TreeHash};
|
||||
use types::{BeaconBlock, ChainSpec, Domain, Fork, Slot};
|
||||
|
||||
#[derive(Debug, PartialEq)]
|
||||
|
Loading…
Reference in New Issue
Block a user