Merge spec crate into types

This commit is contained in:
Paul Hauner
2019-01-25 13:52:21 +11:00
parent 9c86c07eea
commit ea523c8658
57 changed files with 81 additions and 131 deletions

View File

@@ -19,7 +19,6 @@ slog = "^2.2.3"
slot_clock = { path = "../eth2/utils/slot_clock" }
slog-term = "^2.4.0"
slog-async = "^2.3.0"
spec = { path = "../eth2/spec" }
types = { path = "../eth2/types" }
ssz = { path = "../eth2/utils/ssz" }
tokio = "0.1"

View File

@@ -14,6 +14,5 @@ failure_derive = "0.1"
genesis = { path = "../../eth2/genesis" }
serde_derive = "1.0"
slot_clock = { path = "../../eth2/utils/slot_clock" }
spec = { path = "../../eth2/spec" }
ssz = { path = "../../eth2/utils/ssz" }
types = { path = "../../eth2/types" }

View File

@@ -16,10 +16,9 @@ use db::{
};
use genesis::{genesis_beacon_block, genesis_beacon_state, GenesisError};
use slot_clock::SlotClock;
use spec::ChainSpec;
use ssz::ssz_encode;
use std::sync::{Arc, RwLock};
use types::{BeaconBlock, BeaconState, Hash256};
use types::{BeaconBlock, BeaconState, ChainSpec, Hash256};
pub use self::block_processing::Outcome as BlockProcessingOutcome;

View File

@@ -430,19 +430,19 @@ fn get_domain(_fork: &Fork, _slot: u64, _domain_type: u64) -> u64 {
0
}
fn bls_verify(_pubkey: &PublicKey, _message: &[u8], _signature: &Signature, _domain: u64) -> bool {
// TODO: stubbed out.
true
fn bls_verify(pubkey: &PublicKey, message: &[u8], signature: &Signature, _domain: u64) -> bool {
// TODO: add domain
signature.verify(message, pubkey)
}
fn bls_verify_aggregate(
_pubkey: &AggregatePublicKey,
_message: &[u8],
_signature: &AggregateSignature,
pubkey: &AggregatePublicKey,
message: &[u8],
signature: &AggregateSignature,
_domain: u64,
) -> bool {
// TODO: stubbed out.
true
// TODO: add domain
signature.verify(message, pubkey)
}
fn hash_tree_root<T>(_input: &T) -> Hash256 {

View File

@@ -7,9 +7,8 @@ use db::{
MemoryDB,
};
use slot_clock::TestingSlotClock;
use spec::ChainSpec;
use std::sync::{Arc, RwLock};
use types::{Keypair, Validator};
use types::{ChainSpec, Keypair, Validator};
mod utils;

View File

@@ -1,15 +1,13 @@
use super::{DirectBeaconNode, DirectDuties, TestValidator};
use super::TestValidator;
use beacon_chain::BeaconChain;
#[cfg(test)]
use block_producer::{test_utils::TestSigner, BlockProducer};
use db::{
stores::{BeaconBlockStore, BeaconStateStore},
MemoryDB,
};
use slot_clock::TestingSlotClock;
use spec::ChainSpec;
use std::sync::{Arc, RwLock};
use types::{Keypair, Validator};
use std::sync::Arc;
use types::{ChainSpec, Keypair, Validator};
pub struct TestRig {
db: Arc<MemoryDB>,

View File

@@ -4,9 +4,8 @@ use beacon_chain::BeaconChain;
use block_producer::{test_utils::TestSigner, BlockProducer, Error as PollError};
use db::MemoryDB;
use slot_clock::TestingSlotClock;
use spec::ChainSpec;
use std::sync::{Arc, RwLock};
use types::{Keypair, Validator};
use std::sync::Arc;
use types::{ChainSpec, Keypair};
pub use block_producer::PollOutcome;

View File

@@ -12,8 +12,6 @@ pub use self::beacon_state_store::BeaconStateStore;
pub use self::pow_chain_store::PoWChainStore;
pub use self::validator_store::{ValidatorStore, ValidatorStoreError};
use super::bls;
pub const BLOCKS_DB_COLUMN: &str = "blocks";
pub const STATES_DB_COLUMN: &str = "states";
pub const POW_CHAIN_DB_COLUMN: &str = "powchain";

View File

@@ -1,9 +1,9 @@
extern crate bytes;
use self::bytes::{BufMut, BytesMut};
use super::bls::PublicKey;
use super::VALIDATOR_DB_COLUMN as DB_COLUMN;
use super::{ClientDB, DBError};
use bls::PublicKey;
use ssz::{ssz_encode, Decodable};
use std::sync::Arc;
@@ -80,8 +80,8 @@ impl<T: ClientDB> ValidatorStore<T> {
#[cfg(test)]
mod tests {
use super::super::super::MemoryDB;
use super::super::bls::Keypair;
use super::*;
use bls::Keypair;
#[test]
fn test_prefix_bytes() {

View File

@@ -15,8 +15,8 @@ use db::{
};
use slog::{error, info, o, Drain};
use slot_clock::SystemTimeSlotClock;
use spec::ChainSpec;
use std::sync::Arc;
use types::ChainSpec;
fn main() {
let decorator = slog_term::TermDecorator::new().build();