mirror of
https://github.com/sigp/lighthouse.git
synced 2026-07-04 13:24:39 +00:00
Add blake2s hash type
This commit is contained in:
@@ -6,6 +6,8 @@ authors = ["Paul Hauner <paul@paulhauner.com>"]
|
|||||||
[dependencies]
|
[dependencies]
|
||||||
ethereum-types = ""
|
ethereum-types = ""
|
||||||
rand = ""
|
rand = ""
|
||||||
|
blake2 = "^0.7.1"
|
||||||
|
crypto-mac = "^0.6.2"
|
||||||
bls = { git = "https://github.com/sigp/bls" }
|
bls = { git = "https://github.com/sigp/bls" }
|
||||||
rlp = { path = "parity/util/rlp" }
|
rlp = { path = "parity/util/rlp" }
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
use super::utils::types::{ Sha256Digest, Bitfield };
|
use super::utils::types::{ Sha256Digest, Bitfield, Blake2sDigest };
|
||||||
use super::utils::bls::{ Signature, AggregateSignature, Keypair, PublicKey };
|
use super::utils::bls::{ Signature, AggregateSignature, Keypair, PublicKey };
|
||||||
use super::aggregate_vote::AggregateVote;
|
use super::aggregate_vote::AggregateVote;
|
||||||
use super::rlp::{ RlpStream, Encodable } ;
|
use super::rlp::{ RlpStream, Encodable } ;
|
||||||
@@ -11,15 +11,14 @@ pub struct Block {
|
|||||||
pub attestation_aggregate_sig: AggregateSignature,
|
pub attestation_aggregate_sig: AggregateSignature,
|
||||||
pub shard_aggregate_votes: Vec<AggregateVote>,
|
pub shard_aggregate_votes: Vec<AggregateVote>,
|
||||||
pub main_chain_ref: Sha256Digest,
|
pub main_chain_ref: Sha256Digest,
|
||||||
pub state_hash: Sha256Digest,
|
pub state_hash: Blake2sDigest,
|
||||||
pub sig: Option<Signature>
|
pub sig: Option<Signature>
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Block {
|
impl Block {
|
||||||
pub fn new(parent_hash: Sha256Digest,
|
pub fn new(parent_hash: Sha256Digest,
|
||||||
randao_reveal: Sha256Digest,
|
randao_reveal: Sha256Digest,
|
||||||
main_chain_ref: Sha256Digest,
|
main_chain_ref: Sha256Digest,
|
||||||
state_hash: Sha256Digest) -> Block {
|
state_hash: Blake2sDigest) -> Block {
|
||||||
Block {
|
Block {
|
||||||
parent_hash: parent_hash,
|
parent_hash: parent_hash,
|
||||||
skip_count: 0,
|
skip_count: 0,
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
extern crate ethereum_types;
|
extern crate ethereum_types;
|
||||||
|
extern crate blake2;
|
||||||
|
extern crate crypto_mac;
|
||||||
|
|
||||||
pub mod types;
|
pub mod types;
|
||||||
pub mod bls;
|
pub mod bls;
|
||||||
|
|||||||
@@ -1,6 +1,12 @@
|
|||||||
use super::ethereum_types::{ H256, H160 };
|
use super::ethereum_types::{ H256, H160 };
|
||||||
|
|
||||||
|
pub use super::blake2::Blake2s;
|
||||||
|
|
||||||
|
// TODO: presently the compiler accepts these two types
|
||||||
|
// as interchangable. This is somewhat loose typing,
|
||||||
|
// which is bad. Make the compiler think they're incompatible.
|
||||||
pub type Sha256Digest = H256;
|
pub type Sha256Digest = H256;
|
||||||
|
pub type Blake2sDigest = H256;
|
||||||
|
|
||||||
pub type Address = H160;
|
pub type Address = H160;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user