Merge spec
crate into types
This commit is contained in:
parent
9c86c07eea
commit
ea523c8658
@ -3,7 +3,6 @@ members = [
|
|||||||
"eth2/block_producer",
|
"eth2/block_producer",
|
||||||
"eth2/genesis",
|
"eth2/genesis",
|
||||||
"eth2/naive_fork_choice",
|
"eth2/naive_fork_choice",
|
||||||
"eth2/spec",
|
|
||||||
"eth2/types",
|
"eth2/types",
|
||||||
"eth2/utils/bls",
|
"eth2/utils/bls",
|
||||||
"eth2/utils/boolean-bitfield",
|
"eth2/utils/boolean-bitfield",
|
||||||
|
@ -19,7 +19,6 @@ slog = "^2.2.3"
|
|||||||
slot_clock = { path = "../eth2/utils/slot_clock" }
|
slot_clock = { path = "../eth2/utils/slot_clock" }
|
||||||
slog-term = "^2.4.0"
|
slog-term = "^2.4.0"
|
||||||
slog-async = "^2.3.0"
|
slog-async = "^2.3.0"
|
||||||
spec = { path = "../eth2/spec" }
|
|
||||||
types = { path = "../eth2/types" }
|
types = { path = "../eth2/types" }
|
||||||
ssz = { path = "../eth2/utils/ssz" }
|
ssz = { path = "../eth2/utils/ssz" }
|
||||||
tokio = "0.1"
|
tokio = "0.1"
|
||||||
|
@ -14,6 +14,5 @@ failure_derive = "0.1"
|
|||||||
genesis = { path = "../../eth2/genesis" }
|
genesis = { path = "../../eth2/genesis" }
|
||||||
serde_derive = "1.0"
|
serde_derive = "1.0"
|
||||||
slot_clock = { path = "../../eth2/utils/slot_clock" }
|
slot_clock = { path = "../../eth2/utils/slot_clock" }
|
||||||
spec = { path = "../../eth2/spec" }
|
|
||||||
ssz = { path = "../../eth2/utils/ssz" }
|
ssz = { path = "../../eth2/utils/ssz" }
|
||||||
types = { path = "../../eth2/types" }
|
types = { path = "../../eth2/types" }
|
||||||
|
@ -16,10 +16,9 @@ use db::{
|
|||||||
};
|
};
|
||||||
use genesis::{genesis_beacon_block, genesis_beacon_state, GenesisError};
|
use genesis::{genesis_beacon_block, genesis_beacon_state, GenesisError};
|
||||||
use slot_clock::SlotClock;
|
use slot_clock::SlotClock;
|
||||||
use spec::ChainSpec;
|
|
||||||
use ssz::ssz_encode;
|
use ssz::ssz_encode;
|
||||||
use std::sync::{Arc, RwLock};
|
use std::sync::{Arc, RwLock};
|
||||||
use types::{BeaconBlock, BeaconState, Hash256};
|
use types::{BeaconBlock, BeaconState, ChainSpec, Hash256};
|
||||||
|
|
||||||
pub use self::block_processing::Outcome as BlockProcessingOutcome;
|
pub use self::block_processing::Outcome as BlockProcessingOutcome;
|
||||||
|
|
||||||
|
@ -430,19 +430,19 @@ fn get_domain(_fork: &Fork, _slot: u64, _domain_type: u64) -> u64 {
|
|||||||
0
|
0
|
||||||
}
|
}
|
||||||
|
|
||||||
fn bls_verify(_pubkey: &PublicKey, _message: &[u8], _signature: &Signature, _domain: u64) -> bool {
|
fn bls_verify(pubkey: &PublicKey, message: &[u8], signature: &Signature, _domain: u64) -> bool {
|
||||||
// TODO: stubbed out.
|
// TODO: add domain
|
||||||
true
|
signature.verify(message, pubkey)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn bls_verify_aggregate(
|
fn bls_verify_aggregate(
|
||||||
_pubkey: &AggregatePublicKey,
|
pubkey: &AggregatePublicKey,
|
||||||
_message: &[u8],
|
message: &[u8],
|
||||||
_signature: &AggregateSignature,
|
signature: &AggregateSignature,
|
||||||
_domain: u64,
|
_domain: u64,
|
||||||
) -> bool {
|
) -> bool {
|
||||||
// TODO: stubbed out.
|
// TODO: add domain
|
||||||
true
|
signature.verify(message, pubkey)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn hash_tree_root<T>(_input: &T) -> Hash256 {
|
fn hash_tree_root<T>(_input: &T) -> Hash256 {
|
||||||
|
@ -7,9 +7,8 @@ use db::{
|
|||||||
MemoryDB,
|
MemoryDB,
|
||||||
};
|
};
|
||||||
use slot_clock::TestingSlotClock;
|
use slot_clock::TestingSlotClock;
|
||||||
use spec::ChainSpec;
|
|
||||||
use std::sync::{Arc, RwLock};
|
use std::sync::{Arc, RwLock};
|
||||||
use types::{Keypair, Validator};
|
use types::{ChainSpec, Keypair, Validator};
|
||||||
|
|
||||||
mod utils;
|
mod utils;
|
||||||
|
|
||||||
|
@ -1,15 +1,13 @@
|
|||||||
use super::{DirectBeaconNode, DirectDuties, TestValidator};
|
use super::TestValidator;
|
||||||
use beacon_chain::BeaconChain;
|
use beacon_chain::BeaconChain;
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
use block_producer::{test_utils::TestSigner, BlockProducer};
|
|
||||||
use db::{
|
use db::{
|
||||||
stores::{BeaconBlockStore, BeaconStateStore},
|
stores::{BeaconBlockStore, BeaconStateStore},
|
||||||
MemoryDB,
|
MemoryDB,
|
||||||
};
|
};
|
||||||
use slot_clock::TestingSlotClock;
|
use slot_clock::TestingSlotClock;
|
||||||
use spec::ChainSpec;
|
use std::sync::Arc;
|
||||||
use std::sync::{Arc, RwLock};
|
use types::{ChainSpec, Keypair, Validator};
|
||||||
use types::{Keypair, Validator};
|
|
||||||
|
|
||||||
pub struct TestRig {
|
pub struct TestRig {
|
||||||
db: Arc<MemoryDB>,
|
db: Arc<MemoryDB>,
|
||||||
|
@ -4,9 +4,8 @@ use beacon_chain::BeaconChain;
|
|||||||
use block_producer::{test_utils::TestSigner, BlockProducer, Error as PollError};
|
use block_producer::{test_utils::TestSigner, BlockProducer, Error as PollError};
|
||||||
use db::MemoryDB;
|
use db::MemoryDB;
|
||||||
use slot_clock::TestingSlotClock;
|
use slot_clock::TestingSlotClock;
|
||||||
use spec::ChainSpec;
|
use std::sync::Arc;
|
||||||
use std::sync::{Arc, RwLock};
|
use types::{ChainSpec, Keypair};
|
||||||
use types::{Keypair, Validator};
|
|
||||||
|
|
||||||
pub use block_producer::PollOutcome;
|
pub use block_producer::PollOutcome;
|
||||||
|
|
||||||
|
@ -12,8 +12,6 @@ pub use self::beacon_state_store::BeaconStateStore;
|
|||||||
pub use self::pow_chain_store::PoWChainStore;
|
pub use self::pow_chain_store::PoWChainStore;
|
||||||
pub use self::validator_store::{ValidatorStore, ValidatorStoreError};
|
pub use self::validator_store::{ValidatorStore, ValidatorStoreError};
|
||||||
|
|
||||||
use super::bls;
|
|
||||||
|
|
||||||
pub const BLOCKS_DB_COLUMN: &str = "blocks";
|
pub const BLOCKS_DB_COLUMN: &str = "blocks";
|
||||||
pub const STATES_DB_COLUMN: &str = "states";
|
pub const STATES_DB_COLUMN: &str = "states";
|
||||||
pub const POW_CHAIN_DB_COLUMN: &str = "powchain";
|
pub const POW_CHAIN_DB_COLUMN: &str = "powchain";
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
extern crate bytes;
|
extern crate bytes;
|
||||||
|
|
||||||
use self::bytes::{BufMut, BytesMut};
|
use self::bytes::{BufMut, BytesMut};
|
||||||
use super::bls::PublicKey;
|
|
||||||
use super::VALIDATOR_DB_COLUMN as DB_COLUMN;
|
use super::VALIDATOR_DB_COLUMN as DB_COLUMN;
|
||||||
use super::{ClientDB, DBError};
|
use super::{ClientDB, DBError};
|
||||||
|
use bls::PublicKey;
|
||||||
use ssz::{ssz_encode, Decodable};
|
use ssz::{ssz_encode, Decodable};
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
|
|
||||||
@ -80,8 +80,8 @@ impl<T: ClientDB> ValidatorStore<T> {
|
|||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::super::super::MemoryDB;
|
use super::super::super::MemoryDB;
|
||||||
use super::super::bls::Keypair;
|
|
||||||
use super::*;
|
use super::*;
|
||||||
|
use bls::Keypair;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_prefix_bytes() {
|
fn test_prefix_bytes() {
|
||||||
|
@ -15,8 +15,8 @@ use db::{
|
|||||||
};
|
};
|
||||||
use slog::{error, info, o, Drain};
|
use slog::{error, info, o, Drain};
|
||||||
use slot_clock::SystemTimeSlotClock;
|
use slot_clock::SystemTimeSlotClock;
|
||||||
use spec::ChainSpec;
|
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
|
use types::ChainSpec;
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let decorator = slog_term::TermDecorator::new().build();
|
let decorator = slog_term::TermDecorator::new().build();
|
||||||
|
@ -6,6 +6,5 @@ edition = "2018"
|
|||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
slot_clock = { path = "../../eth2/utils/slot_clock" }
|
slot_clock = { path = "../../eth2/utils/slot_clock" }
|
||||||
spec = { path = "../../eth2/spec" }
|
|
||||||
ssz = { path = "../../eth2/utils/ssz" }
|
ssz = { path = "../../eth2/utils/ssz" }
|
||||||
types = { path = "../../eth2/types" }
|
types = { path = "../../eth2/types" }
|
||||||
|
@ -2,10 +2,9 @@ pub mod test_utils;
|
|||||||
mod traits;
|
mod traits;
|
||||||
|
|
||||||
use slot_clock::SlotClock;
|
use slot_clock::SlotClock;
|
||||||
use spec::ChainSpec;
|
|
||||||
use ssz::ssz_encode;
|
use ssz::ssz_encode;
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
use types::{BeaconBlock, Hash256, ProposalSignedData, PublicKey};
|
use types::{BeaconBlock, ChainSpec, Hash256, ProposalSignedData, PublicKey};
|
||||||
|
|
||||||
pub use self::traits::{
|
pub use self::traits::{
|
||||||
BeaconNode, BeaconNodeError, DutiesReader, DutiesReaderError, PublishOutcome, Signer,
|
BeaconNode, BeaconNodeError, DutiesReader, DutiesReaderError, PublishOutcome, Signer,
|
||||||
|
@ -6,7 +6,6 @@ edition = "2018"
|
|||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
bls = { path = "../utils/bls" }
|
bls = { path = "../utils/bls" }
|
||||||
spec = { path = "../spec" }
|
|
||||||
ssz = { path = "../utils/ssz" }
|
ssz = { path = "../utils/ssz" }
|
||||||
types = { path = "../types" }
|
types = { path = "../types" }
|
||||||
validator_induction = { path = "../validator_induction" }
|
validator_induction = { path = "../validator_induction" }
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
use spec::ChainSpec;
|
use types::{BeaconBlock, BeaconBlockBody, ChainSpec, Eth1Data, Hash256};
|
||||||
use types::{BeaconBlock, BeaconBlockBody, Eth1Data, Hash256};
|
|
||||||
|
|
||||||
/// Generate a genesis BeaconBlock.
|
/// Generate a genesis BeaconBlock.
|
||||||
pub fn genesis_beacon_block(state_root: Hash256, spec: &ChainSpec) -> BeaconBlock {
|
pub fn genesis_beacon_block(state_root: Hash256, spec: &ChainSpec) -> BeaconBlock {
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
use spec::ChainSpec;
|
use types::{BeaconState, ChainSpec, Crosslink, Fork};
|
||||||
use types::{BeaconState, Crosslink, Fork};
|
|
||||||
use validator_shuffling::{shard_and_committees_for_cycle, ValidatorAssignmentError};
|
use validator_shuffling::{shard_and_committees_for_cycle, ValidatorAssignmentError};
|
||||||
|
|
||||||
#[derive(Debug, PartialEq)]
|
#[derive(Debug, PartialEq)]
|
||||||
|
@ -1,8 +1,3 @@
|
|||||||
extern crate spec;
|
|
||||||
extern crate types;
|
|
||||||
extern crate validator_induction;
|
|
||||||
extern crate validator_shuffling;
|
|
||||||
|
|
||||||
mod beacon_block;
|
mod beacon_block;
|
||||||
mod beacon_state;
|
mod beacon_state;
|
||||||
|
|
||||||
|
@ -1,9 +0,0 @@
|
|||||||
[package]
|
|
||||||
name = "spec"
|
|
||||||
version = "0.1.0"
|
|
||||||
authors = ["Paul Hauner <paul@paulhauner.com>"]
|
|
||||||
edition = "2018"
|
|
||||||
|
|
||||||
[dependencies]
|
|
||||||
bls = { path = "../utils/bls" }
|
|
||||||
types = { path = "../types" }
|
|
@ -1,8 +1,8 @@
|
|||||||
use super::bls::AggregateSignature;
|
|
||||||
use super::ssz::{Decodable, DecodeError, Encodable, SszStream};
|
|
||||||
use super::{AttestationData, Bitfield};
|
use super::{AttestationData, Bitfield};
|
||||||
use crate::test_utils::TestRandom;
|
use crate::test_utils::TestRandom;
|
||||||
|
use bls::AggregateSignature;
|
||||||
use rand::RngCore;
|
use rand::RngCore;
|
||||||
|
use ssz::{Decodable, DecodeError, Encodable, SszStream};
|
||||||
|
|
||||||
#[derive(Debug, Clone, PartialEq)]
|
#[derive(Debug, Clone, PartialEq)]
|
||||||
pub struct Attestation {
|
pub struct Attestation {
|
||||||
@ -62,7 +62,7 @@ impl<T: RngCore> TestRandom<T> for Attestation {
|
|||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::super::ssz::ssz_encode;
|
use super::ssz::ssz_encode;
|
||||||
use super::*;
|
use super::*;
|
||||||
use crate::test_utils::{SeedableRng, TestRandom, XorShiftRng};
|
use crate::test_utils::{SeedableRng, TestRandom, XorShiftRng};
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
use super::ssz::{Decodable, DecodeError, Encodable, SszStream};
|
|
||||||
use super::Hash256;
|
use super::Hash256;
|
||||||
use crate::test_utils::TestRandom;
|
use crate::test_utils::TestRandom;
|
||||||
use rand::RngCore;
|
use rand::RngCore;
|
||||||
|
use ssz::{Decodable, DecodeError, Encodable, SszStream};
|
||||||
|
|
||||||
pub const SSZ_ATTESTION_DATA_LENGTH: usize = {
|
pub const SSZ_ATTESTION_DATA_LENGTH: usize = {
|
||||||
8 + // slot
|
8 + // slot
|
||||||
@ -102,7 +102,7 @@ impl<T: RngCore> TestRandom<T> for AttestationData {
|
|||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::super::ssz::ssz_encode;
|
use super::ssz::ssz_encode;
|
||||||
use super::*;
|
use super::*;
|
||||||
use crate::test_utils::{SeedableRng, TestRandom, XorShiftRng};
|
use crate::test_utils::{SeedableRng, TestRandom, XorShiftRng};
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
use super::ssz::{Decodable, DecodeError, Encodable, SszStream};
|
|
||||||
use super::AttestationData;
|
use super::AttestationData;
|
||||||
use crate::test_utils::TestRandom;
|
use crate::test_utils::TestRandom;
|
||||||
use rand::RngCore;
|
use rand::RngCore;
|
||||||
|
use ssz::{Decodable, DecodeError, Encodable, SszStream};
|
||||||
|
|
||||||
#[derive(Debug, Clone, PartialEq, Default)]
|
#[derive(Debug, Clone, PartialEq, Default)]
|
||||||
pub struct AttestationDataAndCustodyBit {
|
pub struct AttestationDataAndCustodyBit {
|
||||||
@ -39,7 +39,7 @@ impl<T: RngCore> TestRandom<T> for AttestationDataAndCustodyBit {
|
|||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod test {
|
mod test {
|
||||||
use super::super::ssz::ssz_encode;
|
use super::ssz::ssz_encode;
|
||||||
use super::*;
|
use super::*;
|
||||||
use crate::test_utils::{SeedableRng, TestRandom, XorShiftRng};
|
use crate::test_utils::{SeedableRng, TestRandom, XorShiftRng};
|
||||||
|
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
use super::ssz::{ssz_encode, Decodable, DecodeError, Encodable, SszStream};
|
|
||||||
use super::{BeaconBlockBody, Eth1Data, Hash256};
|
use super::{BeaconBlockBody, Eth1Data, Hash256};
|
||||||
use crate::test_utils::TestRandom;
|
use crate::test_utils::TestRandom;
|
||||||
use bls::Signature;
|
use bls::Signature;
|
||||||
use hashing::canonical_hash;
|
use hashing::canonical_hash;
|
||||||
use rand::RngCore;
|
use rand::RngCore;
|
||||||
|
use ssz::{ssz_encode, Decodable, DecodeError, Encodable, SszStream};
|
||||||
|
|
||||||
#[derive(Debug, PartialEq, Clone)]
|
#[derive(Debug, PartialEq, Clone)]
|
||||||
pub struct BeaconBlock {
|
pub struct BeaconBlock {
|
||||||
@ -77,7 +77,7 @@ impl<T: RngCore> TestRandom<T> for BeaconBlock {
|
|||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::super::ssz::ssz_encode;
|
use super::ssz::ssz_encode;
|
||||||
use super::*;
|
use super::*;
|
||||||
use crate::test_utils::{SeedableRng, TestRandom, XorShiftRng};
|
use crate::test_utils::{SeedableRng, TestRandom, XorShiftRng};
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
use super::ssz::{Decodable, DecodeError, Encodable, SszStream};
|
|
||||||
use super::{Attestation, CasperSlashing, Deposit, Exit, ProposerSlashing};
|
use super::{Attestation, CasperSlashing, Deposit, Exit, ProposerSlashing};
|
||||||
use crate::test_utils::TestRandom;
|
use crate::test_utils::TestRandom;
|
||||||
use rand::RngCore;
|
use rand::RngCore;
|
||||||
|
use ssz::{Decodable, DecodeError, Encodable, SszStream};
|
||||||
|
|
||||||
// The following types are just dummy classes as they will not be defined until
|
// The following types are just dummy classes as they will not be defined until
|
||||||
// Phase 1 (Sharding phase)
|
// Phase 1 (Sharding phase)
|
||||||
@ -78,7 +78,7 @@ impl<T: RngCore> TestRandom<T> for BeaconBlockBody {
|
|||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::super::ssz::ssz_encode;
|
use super::ssz::ssz_encode;
|
||||||
use super::*;
|
use super::*;
|
||||||
use crate::test_utils::{SeedableRng, TestRandom, XorShiftRng};
|
use crate::test_utils::{SeedableRng, TestRandom, XorShiftRng};
|
||||||
|
|
||||||
|
@ -203,7 +203,7 @@ impl<T: RngCore> TestRandom<T> for BeaconState {
|
|||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::super::ssz::ssz_encode;
|
use super::ssz::ssz_encode;
|
||||||
use super::*;
|
use super::*;
|
||||||
use crate::test_utils::{SeedableRng, TestRandom, XorShiftRng};
|
use crate::test_utils::{SeedableRng, TestRandom, XorShiftRng};
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
use super::ssz::{Decodable, DecodeError, Encodable, SszStream};
|
|
||||||
use super::SlashableVoteData;
|
use super::SlashableVoteData;
|
||||||
use crate::test_utils::TestRandom;
|
use crate::test_utils::TestRandom;
|
||||||
use rand::RngCore;
|
use rand::RngCore;
|
||||||
|
use ssz::{Decodable, DecodeError, Encodable, SszStream};
|
||||||
|
|
||||||
#[derive(Debug, PartialEq, Clone)]
|
#[derive(Debug, PartialEq, Clone)]
|
||||||
pub struct CasperSlashing {
|
pub struct CasperSlashing {
|
||||||
@ -42,7 +42,7 @@ impl<T: RngCore> TestRandom<T> for CasperSlashing {
|
|||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::super::ssz::ssz_encode;
|
use super::ssz::ssz_encode;
|
||||||
use super::*;
|
use super::*;
|
||||||
use crate::test_utils::{SeedableRng, TestRandom, XorShiftRng};
|
use crate::test_utils::{SeedableRng, TestRandom, XorShiftRng};
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
use super::ssz::{Decodable, DecodeError, Encodable, SszStream};
|
|
||||||
use super::Hash256;
|
use super::Hash256;
|
||||||
use crate::test_utils::TestRandom;
|
use crate::test_utils::TestRandom;
|
||||||
use rand::RngCore;
|
use rand::RngCore;
|
||||||
|
use ssz::{Decodable, DecodeError, Encodable, SszStream};
|
||||||
|
|
||||||
#[derive(Clone, Debug, PartialEq)]
|
#[derive(Clone, Debug, PartialEq)]
|
||||||
pub struct Crosslink {
|
pub struct Crosslink {
|
||||||
@ -52,7 +52,7 @@ impl<T: RngCore> TestRandom<T> for Crosslink {
|
|||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::super::ssz::ssz_encode;
|
use super::ssz::ssz_encode;
|
||||||
use super::*;
|
use super::*;
|
||||||
use crate::test_utils::{SeedableRng, TestRandom, XorShiftRng};
|
use crate::test_utils::{SeedableRng, TestRandom, XorShiftRng};
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
use super::ssz::{Decodable, DecodeError, Encodable, SszStream};
|
|
||||||
use super::{DepositData, Hash256};
|
use super::{DepositData, Hash256};
|
||||||
use crate::test_utils::TestRandom;
|
use crate::test_utils::TestRandom;
|
||||||
use rand::RngCore;
|
use rand::RngCore;
|
||||||
|
use ssz::{Decodable, DecodeError, Encodable, SszStream};
|
||||||
|
|
||||||
#[derive(Debug, PartialEq, Clone)]
|
#[derive(Debug, PartialEq, Clone)]
|
||||||
pub struct Deposit {
|
pub struct Deposit {
|
||||||
@ -47,7 +47,7 @@ impl<T: RngCore> TestRandom<T> for Deposit {
|
|||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::super::ssz::ssz_encode;
|
use super::ssz::ssz_encode;
|
||||||
use super::*;
|
use super::*;
|
||||||
use crate::test_utils::{SeedableRng, TestRandom, XorShiftRng};
|
use crate::test_utils::{SeedableRng, TestRandom, XorShiftRng};
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
use super::ssz::{Decodable, DecodeError, Encodable, SszStream};
|
|
||||||
use super::DepositInput;
|
use super::DepositInput;
|
||||||
use crate::test_utils::TestRandom;
|
use crate::test_utils::TestRandom;
|
||||||
use rand::RngCore;
|
use rand::RngCore;
|
||||||
|
use ssz::{Decodable, DecodeError, Encodable, SszStream};
|
||||||
|
|
||||||
#[derive(Debug, PartialEq, Clone)]
|
#[derive(Debug, PartialEq, Clone)]
|
||||||
pub struct DepositData {
|
pub struct DepositData {
|
||||||
@ -47,7 +47,7 @@ impl<T: RngCore> TestRandom<T> for DepositData {
|
|||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::super::ssz::ssz_encode;
|
use super::ssz::ssz_encode;
|
||||||
use super::*;
|
use super::*;
|
||||||
use crate::test_utils::{SeedableRng, TestRandom, XorShiftRng};
|
use crate::test_utils::{SeedableRng, TestRandom, XorShiftRng};
|
||||||
|
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
use super::ssz::{Decodable, DecodeError, Encodable, SszStream};
|
|
||||||
use super::Hash256;
|
use super::Hash256;
|
||||||
use crate::test_utils::TestRandom;
|
use crate::test_utils::TestRandom;
|
||||||
use bls::{PublicKey, Signature};
|
use bls::{PublicKey, Signature};
|
||||||
use rand::RngCore;
|
use rand::RngCore;
|
||||||
|
use ssz::{Decodable, DecodeError, Encodable, SszStream};
|
||||||
|
|
||||||
#[derive(Debug, PartialEq, Clone)]
|
#[derive(Debug, PartialEq, Clone)]
|
||||||
pub struct DepositInput {
|
pub struct DepositInput {
|
||||||
@ -48,7 +48,7 @@ impl<T: RngCore> TestRandom<T> for DepositInput {
|
|||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::super::ssz::ssz_encode;
|
use super::ssz::ssz_encode;
|
||||||
use super::*;
|
use super::*;
|
||||||
use crate::test_utils::{SeedableRng, TestRandom, XorShiftRng};
|
use crate::test_utils::{SeedableRng, TestRandom, XorShiftRng};
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
use super::ssz::{Decodable, DecodeError, Encodable, SszStream};
|
|
||||||
use super::Hash256;
|
use super::Hash256;
|
||||||
use crate::test_utils::TestRandom;
|
use crate::test_utils::TestRandom;
|
||||||
use rand::RngCore;
|
use rand::RngCore;
|
||||||
|
use ssz::{Decodable, DecodeError, Encodable, SszStream};
|
||||||
|
|
||||||
// Note: this is refer to as DepositRootVote in specs
|
// Note: this is refer to as DepositRootVote in specs
|
||||||
#[derive(Debug, PartialEq, Clone, Default)]
|
#[derive(Debug, PartialEq, Clone, Default)]
|
||||||
@ -43,7 +43,7 @@ impl<T: RngCore> TestRandom<T> for Eth1Data {
|
|||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::super::ssz::ssz_encode;
|
use super::ssz::ssz_encode;
|
||||||
use super::*;
|
use super::*;
|
||||||
use crate::test_utils::{SeedableRng, TestRandom, XorShiftRng};
|
use crate::test_utils::{SeedableRng, TestRandom, XorShiftRng};
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
use super::ssz::{Decodable, DecodeError, Encodable, SszStream};
|
|
||||||
use super::Eth1Data;
|
use super::Eth1Data;
|
||||||
use crate::test_utils::TestRandom;
|
use crate::test_utils::TestRandom;
|
||||||
use rand::RngCore;
|
use rand::RngCore;
|
||||||
|
use ssz::{Decodable, DecodeError, Encodable, SszStream};
|
||||||
|
|
||||||
// Note: this is refer to as DepositRootVote in specs
|
// Note: this is refer to as DepositRootVote in specs
|
||||||
#[derive(Debug, PartialEq, Clone, Default)]
|
#[derive(Debug, PartialEq, Clone, Default)]
|
||||||
@ -43,7 +43,7 @@ impl<T: RngCore> TestRandom<T> for Eth1DataVote {
|
|||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::super::ssz::ssz_encode;
|
use super::ssz::ssz_encode;
|
||||||
use super::*;
|
use super::*;
|
||||||
use crate::test_utils::{SeedableRng, TestRandom, XorShiftRng};
|
use crate::test_utils::{SeedableRng, TestRandom, XorShiftRng};
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
use super::ssz::{Decodable, DecodeError, Encodable, SszStream};
|
|
||||||
use crate::test_utils::TestRandom;
|
use crate::test_utils::TestRandom;
|
||||||
use bls::Signature;
|
use bls::Signature;
|
||||||
use rand::RngCore;
|
use rand::RngCore;
|
||||||
|
use ssz::{Decodable, DecodeError, Encodable, SszStream};
|
||||||
|
|
||||||
#[derive(Debug, PartialEq, Clone)]
|
#[derive(Debug, PartialEq, Clone)]
|
||||||
pub struct Exit {
|
pub struct Exit {
|
||||||
@ -47,7 +47,7 @@ impl<T: RngCore> TestRandom<T> for Exit {
|
|||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::super::ssz::ssz_encode;
|
use super::ssz::ssz_encode;
|
||||||
use super::*;
|
use super::*;
|
||||||
use crate::test_utils::{SeedableRng, TestRandom, XorShiftRng};
|
use crate::test_utils::{SeedableRng, TestRandom, XorShiftRng};
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
use super::ssz::{Decodable, DecodeError, Encodable, SszStream};
|
|
||||||
use crate::test_utils::TestRandom;
|
use crate::test_utils::TestRandom;
|
||||||
use rand::RngCore;
|
use rand::RngCore;
|
||||||
|
use ssz::{Decodable, DecodeError, Encodable, SszStream};
|
||||||
|
|
||||||
#[derive(Debug, Clone, PartialEq, Default)]
|
#[derive(Debug, Clone, PartialEq, Default)]
|
||||||
pub struct Fork {
|
pub struct Fork {
|
||||||
@ -46,7 +46,7 @@ impl<T: RngCore> TestRandom<T> for Fork {
|
|||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::super::ssz::ssz_encode;
|
use super::ssz::ssz_encode;
|
||||||
use super::*;
|
use super::*;
|
||||||
use crate::test_utils::{SeedableRng, TestRandom, XorShiftRng};
|
use crate::test_utils::{SeedableRng, TestRandom, XorShiftRng};
|
||||||
|
|
||||||
|
@ -1,8 +1,3 @@
|
|||||||
extern crate bls;
|
|
||||||
extern crate boolean_bitfield;
|
|
||||||
extern crate ethereum_types;
|
|
||||||
extern crate ssz;
|
|
||||||
|
|
||||||
pub mod test_utils;
|
pub mod test_utils;
|
||||||
|
|
||||||
pub mod attestation;
|
pub mod attestation;
|
||||||
@ -26,6 +21,7 @@ pub mod proposer_slashing;
|
|||||||
pub mod shard_committee;
|
pub mod shard_committee;
|
||||||
pub mod shard_reassignment_record;
|
pub mod shard_reassignment_record;
|
||||||
pub mod slashable_vote_data;
|
pub mod slashable_vote_data;
|
||||||
|
pub mod spec;
|
||||||
pub mod special_record;
|
pub mod special_record;
|
||||||
pub mod validator;
|
pub mod validator;
|
||||||
pub mod validator_registry;
|
pub mod validator_registry;
|
||||||
@ -33,7 +29,7 @@ pub mod validator_registry_delta_block;
|
|||||||
|
|
||||||
pub mod readers;
|
pub mod readers;
|
||||||
|
|
||||||
use self::ethereum_types::{H160, H256, U256};
|
use ethereum_types::{H160, H256, U256};
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
|
|
||||||
pub use crate::attestation::Attestation;
|
pub use crate::attestation::Attestation;
|
||||||
@ -56,6 +52,7 @@ pub use crate::proposal_signed_data::ProposalSignedData;
|
|||||||
pub use crate::proposer_slashing::ProposerSlashing;
|
pub use crate::proposer_slashing::ProposerSlashing;
|
||||||
pub use crate::shard_committee::ShardCommittee;
|
pub use crate::shard_committee::ShardCommittee;
|
||||||
pub use crate::slashable_vote_data::SlashableVoteData;
|
pub use crate::slashable_vote_data::SlashableVoteData;
|
||||||
|
pub use crate::spec::ChainSpec;
|
||||||
pub use crate::special_record::{SpecialRecord, SpecialRecordKind};
|
pub use crate::special_record::{SpecialRecord, SpecialRecordKind};
|
||||||
pub use crate::validator::{StatusFlags as ValidatorStatusFlags, Validator};
|
pub use crate::validator::{StatusFlags as ValidatorStatusFlags, Validator};
|
||||||
pub use crate::validator_registry_delta_block::ValidatorRegistryDeltaBlock;
|
pub use crate::validator_registry_delta_block::ValidatorRegistryDeltaBlock;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
use super::ssz::{Decodable, DecodeError, Encodable, SszStream};
|
|
||||||
use super::{AttestationData, Bitfield};
|
use super::{AttestationData, Bitfield};
|
||||||
use crate::test_utils::TestRandom;
|
use crate::test_utils::TestRandom;
|
||||||
use rand::RngCore;
|
use rand::RngCore;
|
||||||
|
use ssz::{Decodable, DecodeError, Encodable, SszStream};
|
||||||
|
|
||||||
#[derive(Debug, Clone, PartialEq)]
|
#[derive(Debug, Clone, PartialEq)]
|
||||||
pub struct PendingAttestation {
|
pub struct PendingAttestation {
|
||||||
@ -52,7 +52,7 @@ impl<T: RngCore> TestRandom<T> for PendingAttestation {
|
|||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::super::ssz::ssz_encode;
|
use super::ssz::ssz_encode;
|
||||||
use super::*;
|
use super::*;
|
||||||
use crate::test_utils::{SeedableRng, TestRandom, XorShiftRng};
|
use crate::test_utils::{SeedableRng, TestRandom, XorShiftRng};
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
use super::ssz::{Decodable, DecodeError, Encodable, SszStream};
|
|
||||||
use super::Hash256;
|
use super::Hash256;
|
||||||
use crate::test_utils::TestRandom;
|
use crate::test_utils::TestRandom;
|
||||||
use rand::RngCore;
|
use rand::RngCore;
|
||||||
|
use ssz::{Decodable, DecodeError, Encodable, SszStream};
|
||||||
|
|
||||||
#[derive(Debug, PartialEq, Clone, Default)]
|
#[derive(Debug, PartialEq, Clone, Default)]
|
||||||
pub struct ProposalSignedData {
|
pub struct ProposalSignedData {
|
||||||
@ -47,7 +47,7 @@ impl<T: RngCore> TestRandom<T> for ProposalSignedData {
|
|||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::super::ssz::ssz_encode;
|
use super::ssz::ssz_encode;
|
||||||
use super::*;
|
use super::*;
|
||||||
use crate::test_utils::{SeedableRng, TestRandom, XorShiftRng};
|
use crate::test_utils::{SeedableRng, TestRandom, XorShiftRng};
|
||||||
|
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
use super::ssz::{Decodable, DecodeError, Encodable, SszStream};
|
|
||||||
use super::ProposalSignedData;
|
use super::ProposalSignedData;
|
||||||
use crate::test_utils::TestRandom;
|
use crate::test_utils::TestRandom;
|
||||||
use bls::Signature;
|
use bls::Signature;
|
||||||
use rand::RngCore;
|
use rand::RngCore;
|
||||||
|
use ssz::{Decodable, DecodeError, Encodable, SszStream};
|
||||||
|
|
||||||
#[derive(Debug, PartialEq, Clone)]
|
#[derive(Debug, PartialEq, Clone)]
|
||||||
pub struct ProposerSlashing {
|
pub struct ProposerSlashing {
|
||||||
@ -58,7 +58,7 @@ impl<T: RngCore> TestRandom<T> for ProposerSlashing {
|
|||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::super::ssz::ssz_encode;
|
use super::ssz::ssz_encode;
|
||||||
use super::*;
|
use super::*;
|
||||||
use crate::test_utils::{SeedableRng, TestRandom, XorShiftRng};
|
use crate::test_utils::{SeedableRng, TestRandom, XorShiftRng};
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
use super::ssz::{Decodable, DecodeError, Encodable, SszStream};
|
|
||||||
use crate::test_utils::TestRandom;
|
use crate::test_utils::TestRandom;
|
||||||
use rand::RngCore;
|
use rand::RngCore;
|
||||||
|
use ssz::{Decodable, DecodeError, Encodable, SszStream};
|
||||||
|
|
||||||
#[derive(Clone, Debug, PartialEq)]
|
#[derive(Clone, Debug, PartialEq)]
|
||||||
pub struct ShardCommittee {
|
pub struct ShardCommittee {
|
||||||
@ -35,7 +35,7 @@ impl<T: RngCore> TestRandom<T> for ShardCommittee {
|
|||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::super::ssz::ssz_encode;
|
use super::ssz::ssz_encode;
|
||||||
use super::*;
|
use super::*;
|
||||||
use crate::test_utils::{SeedableRng, TestRandom, XorShiftRng};
|
use crate::test_utils::{SeedableRng, TestRandom, XorShiftRng};
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
use super::ssz::{Decodable, DecodeError, Encodable, SszStream};
|
|
||||||
use crate::test_utils::TestRandom;
|
use crate::test_utils::TestRandom;
|
||||||
use rand::RngCore;
|
use rand::RngCore;
|
||||||
|
use ssz::{Decodable, DecodeError, Encodable, SszStream};
|
||||||
|
|
||||||
#[derive(Debug, PartialEq, Clone)]
|
#[derive(Debug, PartialEq, Clone)]
|
||||||
pub struct ShardReassignmentRecord {
|
pub struct ShardReassignmentRecord {
|
||||||
@ -46,9 +46,9 @@ impl<T: RngCore> TestRandom<T> for ShardReassignmentRecord {
|
|||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::super::ssz::ssz_encode;
|
|
||||||
use super::*;
|
use super::*;
|
||||||
use crate::test_utils::{SeedableRng, TestRandom, XorShiftRng};
|
use crate::test_utils::{SeedableRng, TestRandom, XorShiftRng};
|
||||||
|
use ssz::ssz_encode;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
pub fn test_ssz_round_trip() {
|
pub fn test_ssz_round_trip() {
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
use super::ssz::{Decodable, DecodeError, Encodable, SszStream};
|
|
||||||
use super::AttestationData;
|
use super::AttestationData;
|
||||||
use crate::test_utils::TestRandom;
|
use crate::test_utils::TestRandom;
|
||||||
use bls::AggregateSignature;
|
use bls::AggregateSignature;
|
||||||
use rand::RngCore;
|
use rand::RngCore;
|
||||||
|
use ssz::{Decodable, DecodeError, Encodable, SszStream};
|
||||||
|
|
||||||
#[derive(Debug, PartialEq, Clone)]
|
#[derive(Debug, PartialEq, Clone)]
|
||||||
pub struct SlashableVoteData {
|
pub struct SlashableVoteData {
|
||||||
@ -53,7 +53,7 @@ impl<T: RngCore> TestRandom<T> for SlashableVoteData {
|
|||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::super::ssz::ssz_encode;
|
use super::ssz::ssz_encode;
|
||||||
use super::*;
|
use super::*;
|
||||||
use crate::test_utils::{SeedableRng, TestRandom, XorShiftRng};
|
use crate::test_utils::{SeedableRng, TestRandom, XorShiftRng};
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
use super::ChainSpec;
|
use super::ChainSpec;
|
||||||
use bls::{Keypair, PublicKey, SecretKey, Signature};
|
use bls::{Keypair, PublicKey, SecretKey, Signature};
|
||||||
|
|
||||||
use types::{Address, Eth1Data, Hash256, Validator};
|
use crate::{Address, Eth1Data, Hash256, Validator};
|
||||||
|
|
||||||
/// The size of a validators deposit in GWei.
|
/// The size of a validators deposit in GWei.
|
||||||
pub const DEPOSIT_GWEI: u64 = 32_000_000_000;
|
pub const DEPOSIT_GWEI: u64 = 32_000_000_000;
|
@ -1,10 +1,7 @@
|
|||||||
extern crate bls;
|
|
||||||
extern crate types;
|
|
||||||
|
|
||||||
mod foundation;
|
mod foundation;
|
||||||
|
|
||||||
|
use crate::{Address, Eth1Data, Hash256, Validator};
|
||||||
use bls::Signature;
|
use bls::Signature;
|
||||||
use types::{Address, Eth1Data, Hash256, Validator};
|
|
||||||
|
|
||||||
#[derive(PartialEq, Debug, Clone)]
|
#[derive(PartialEq, Debug, Clone)]
|
||||||
pub struct ChainSpec {
|
pub struct ChainSpec {
|
@ -1,4 +1,4 @@
|
|||||||
use super::ssz::{Decodable, DecodeError, Encodable, SszStream};
|
use ssz::{Decodable, DecodeError, Encodable, SszStream};
|
||||||
|
|
||||||
/// The value of the "type" field of SpecialRecord.
|
/// The value of the "type" field of SpecialRecord.
|
||||||
///
|
///
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
use super::bls::PublicKey;
|
|
||||||
use super::Hash256;
|
use super::Hash256;
|
||||||
use crate::test_utils::TestRandom;
|
use crate::test_utils::TestRandom;
|
||||||
|
use bls::PublicKey;
|
||||||
use rand::RngCore;
|
use rand::RngCore;
|
||||||
use ssz::{Decodable, DecodeError, Encodable, SszStream};
|
use ssz::{Decodable, DecodeError, Encodable, SszStream};
|
||||||
|
|
||||||
@ -162,7 +162,7 @@ impl<T: RngCore> TestRandom<T> for Validator {
|
|||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::super::ssz::ssz_encode;
|
use super::ssz::ssz_encode;
|
||||||
use super::*;
|
use super::*;
|
||||||
use crate::test_utils::{SeedableRng, TestRandom, XorShiftRng};
|
use crate::test_utils::{SeedableRng, TestRandom, XorShiftRng};
|
||||||
|
|
||||||
|
@ -72,7 +72,7 @@ impl<T: RngCore> TestRandom<T> for ValidatorRegistryDeltaBlock {
|
|||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::super::ssz::ssz_encode;
|
use super::ssz::ssz_encode;
|
||||||
use super::*;
|
use super::*;
|
||||||
use crate::test_utils::{SeedableRng, TestRandom, XorShiftRng};
|
use crate::test_utils::{SeedableRng, TestRandom, XorShiftRng};
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
use super::ssz::{decode_ssz_list, Decodable, DecodeError, Encodable, SszStream};
|
|
||||||
use super::{AggregatePublicKey, Signature};
|
use super::{AggregatePublicKey, Signature};
|
||||||
use bls_aggregates::AggregateSignature as RawAggregateSignature;
|
use bls_aggregates::AggregateSignature as RawAggregateSignature;
|
||||||
|
use ssz::{decode_ssz_list, Decodable, DecodeError, Encodable, SszStream};
|
||||||
|
|
||||||
/// A BLS aggregate signature.
|
/// A BLS aggregate signature.
|
||||||
///
|
///
|
||||||
@ -46,8 +46,8 @@ impl Decodable for AggregateSignature {
|
|||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::super::ssz::ssz_encode;
|
|
||||||
use super::super::{Keypair, Signature};
|
use super::super::{Keypair, Signature};
|
||||||
|
use super::ssz::ssz_encode;
|
||||||
use super::*;
|
use super::*;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
@ -67,7 +67,7 @@ impl Hash for PublicKey {
|
|||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::super::ssz::ssz_encode;
|
use super::ssz::ssz_encode;
|
||||||
use super::*;
|
use super::*;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
use super::ssz::{decode_ssz_list, Decodable, DecodeError, Encodable, SszStream};
|
|
||||||
use super::{PublicKey, SecretKey};
|
use super::{PublicKey, SecretKey};
|
||||||
use bls_aggregates::Signature as RawSignature;
|
use bls_aggregates::Signature as RawSignature;
|
||||||
|
use ssz::{decode_ssz_list, Decodable, DecodeError, Encodable, SszStream};
|
||||||
|
|
||||||
/// A single BLS signature.
|
/// A single BLS signature.
|
||||||
///
|
///
|
||||||
@ -59,8 +59,8 @@ impl Decodable for Signature {
|
|||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::super::ssz::ssz_encode;
|
|
||||||
use super::super::Keypair;
|
use super::super::Keypair;
|
||||||
|
use super::ssz::ssz_encode;
|
||||||
use super::*;
|
use super::*;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
@ -8,4 +8,3 @@ edition = "2018"
|
|||||||
bls = { path = "../utils/bls" }
|
bls = { path = "../utils/bls" }
|
||||||
hashing = { path = "../utils/hashing" }
|
hashing = { path = "../utils/hashing" }
|
||||||
types = { path = "../types" }
|
types = { path = "../types" }
|
||||||
spec = { path = "../spec" }
|
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
use bls::verify_proof_of_possession;
|
use bls::verify_proof_of_possession;
|
||||||
use spec::ChainSpec;
|
use types::{BeaconState, ChainSpec, Deposit, Validator};
|
||||||
use types::{BeaconState, Deposit, Validator};
|
|
||||||
|
|
||||||
#[derive(Debug, PartialEq, Clone)]
|
#[derive(Debug, PartialEq, Clone)]
|
||||||
pub enum ValidatorInductionError {
|
pub enum ValidatorInductionError {
|
||||||
|
@ -1,8 +1,3 @@
|
|||||||
extern crate bls;
|
|
||||||
extern crate hashing;
|
|
||||||
extern crate spec;
|
|
||||||
extern crate types;
|
|
||||||
|
|
||||||
mod inductor;
|
mod inductor;
|
||||||
|
|
||||||
pub use crate::inductor::{process_deposit, ValidatorInductionError};
|
pub use crate::inductor::{process_deposit, ValidatorInductionError};
|
||||||
|
@ -6,6 +6,5 @@ edition = "2018"
|
|||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
honey-badger-split = { path = "../utils/honey-badger-split" }
|
honey-badger-split = { path = "../utils/honey-badger-split" }
|
||||||
spec = { path = "../spec" }
|
|
||||||
types = { path = "../types" }
|
types = { path = "../types" }
|
||||||
vec_shuffle = { path = "../utils/vec_shuffle" }
|
vec_shuffle = { path = "../utils/vec_shuffle" }
|
||||||
|
@ -1,8 +1,3 @@
|
|||||||
extern crate honey_badger_split;
|
|
||||||
extern crate spec;
|
|
||||||
extern crate types;
|
|
||||||
extern crate vec_shuffle;
|
|
||||||
|
|
||||||
mod shuffle;
|
mod shuffle;
|
||||||
|
|
||||||
pub use crate::shuffle::{shard_and_committees_for_cycle, ValidatorAssignmentError};
|
pub use crate::shuffle::{shard_and_committees_for_cycle, ValidatorAssignmentError};
|
||||||
|
@ -1,9 +1,8 @@
|
|||||||
use std::cmp::min;
|
use std::cmp::min;
|
||||||
|
|
||||||
use honey_badger_split::SplitExt;
|
use honey_badger_split::SplitExt;
|
||||||
use spec::ChainSpec;
|
|
||||||
use types::validator_registry::get_active_validator_indices;
|
use types::validator_registry::get_active_validator_indices;
|
||||||
use types::{ShardCommittee, Validator};
|
use types::{ChainSpec, ShardCommittee, Validator};
|
||||||
use vec_shuffle::{shuffle, ShuffleErr};
|
use vec_shuffle::{shuffle, ShuffleErr};
|
||||||
|
|
||||||
type DelegatedCycle = Vec<Vec<ShardCommittee>>;
|
type DelegatedCycle = Vec<Vec<ShardCommittee>>;
|
||||||
|
@ -13,7 +13,6 @@ grpcio = { version = "0.4", default-features = false, features = ["protobuf-code
|
|||||||
protobuf = "2.0.2"
|
protobuf = "2.0.2"
|
||||||
protos = { path = "../protos" }
|
protos = { path = "../protos" }
|
||||||
slot_clock = { path = "../eth2/utils/slot_clock" }
|
slot_clock = { path = "../eth2/utils/slot_clock" }
|
||||||
spec = { path = "../eth2/spec" }
|
|
||||||
types = { path = "../eth2/types" }
|
types = { path = "../eth2/types" }
|
||||||
slog = "^2.2.3"
|
slog = "^2.2.3"
|
||||||
slog-term = "^2.4.0"
|
slog-term = "^2.4.0"
|
||||||
|
@ -11,8 +11,8 @@ pub use self::service::DutiesManagerService;
|
|||||||
use self::traits::{BeaconNode, BeaconNodeError};
|
use self::traits::{BeaconNode, BeaconNodeError};
|
||||||
use bls::PublicKey;
|
use bls::PublicKey;
|
||||||
use slot_clock::SlotClock;
|
use slot_clock::SlotClock;
|
||||||
use spec::ChainSpec;
|
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
|
use types::ChainSpec;
|
||||||
|
|
||||||
#[derive(Debug, PartialEq, Clone, Copy)]
|
#[derive(Debug, PartialEq, Clone, Copy)]
|
||||||
pub enum PollOutcome {
|
pub enum PollOutcome {
|
||||||
|
@ -8,10 +8,10 @@ use grpcio::{ChannelBuilder, EnvBuilder};
|
|||||||
use protos::services_grpc::{BeaconBlockServiceClient, ValidatorServiceClient};
|
use protos::services_grpc::{BeaconBlockServiceClient, ValidatorServiceClient};
|
||||||
use slog::{error, info, o, Drain};
|
use slog::{error, info, o, Drain};
|
||||||
use slot_clock::SystemTimeSlotClock;
|
use slot_clock::SystemTimeSlotClock;
|
||||||
use spec::ChainSpec;
|
|
||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
use std::thread;
|
use std::thread;
|
||||||
|
use types::ChainSpec;
|
||||||
|
|
||||||
mod block_producer_service;
|
mod block_producer_service;
|
||||||
mod config;
|
mod config;
|
||||||
|
Loading…
Reference in New Issue
Block a user