Add blake2s hash type
This commit is contained in:
parent
702609af71
commit
64a9455f87
@ -6,6 +6,8 @@ authors = ["Paul Hauner <paul@paulhauner.com>"]
|
||||
[dependencies]
|
||||
ethereum-types = ""
|
||||
rand = ""
|
||||
blake2 = "^0.7.1"
|
||||
crypto-mac = "^0.6.2"
|
||||
bls = { git = "https://github.com/sigp/bls" }
|
||||
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::aggregate_vote::AggregateVote;
|
||||
use super::rlp::{ RlpStream, Encodable } ;
|
||||
@ -11,15 +11,14 @@ pub struct Block {
|
||||
pub attestation_aggregate_sig: AggregateSignature,
|
||||
pub shard_aggregate_votes: Vec<AggregateVote>,
|
||||
pub main_chain_ref: Sha256Digest,
|
||||
pub state_hash: Sha256Digest,
|
||||
pub state_hash: Blake2sDigest,
|
||||
pub sig: Option<Signature>
|
||||
}
|
||||
|
||||
impl Block {
|
||||
pub fn new(parent_hash: Sha256Digest,
|
||||
randao_reveal: Sha256Digest,
|
||||
main_chain_ref: Sha256Digest,
|
||||
state_hash: Sha256Digest) -> Block {
|
||||
state_hash: Blake2sDigest) -> Block {
|
||||
Block {
|
||||
parent_hash: parent_hash,
|
||||
skip_count: 0,
|
||||
|
@ -1,4 +1,6 @@
|
||||
extern crate ethereum_types;
|
||||
extern crate blake2;
|
||||
extern crate crypto_mac;
|
||||
|
||||
pub mod types;
|
||||
pub mod bls;
|
||||
|
@ -1,6 +1,12 @@
|
||||
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 Blake2sDigest = H256;
|
||||
|
||||
pub type Address = H160;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user