mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-20 13:24:44 +00:00
Rename BeaconStateTypes to EthSpec
This commit is contained in:
@@ -83,7 +83,7 @@ impl BlockProcessingOutcome {
|
||||
}
|
||||
}
|
||||
|
||||
pub struct BeaconChain<T: ClientDB + Sized, U: SlotClock, F: ForkChoice, B: BeaconStateTypes> {
|
||||
pub struct BeaconChain<T: ClientDB + Sized, U: SlotClock, F: ForkChoice, B: EthSpec> {
|
||||
pub block_store: Arc<BeaconBlockStore<T>>,
|
||||
pub state_store: Arc<BeaconStateStore<T>>,
|
||||
pub slot_clock: U,
|
||||
@@ -100,7 +100,7 @@ where
|
||||
T: ClientDB,
|
||||
U: SlotClock,
|
||||
F: ForkChoice,
|
||||
B: BeaconStateTypes,
|
||||
B: EthSpec,
|
||||
{
|
||||
/// Instantiate a new Beacon Chain, from genesis.
|
||||
pub fn from_genesis(
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
use serde_derive::Serialize;
|
||||
use types::{BeaconBlock, BeaconState, BeaconStateTypes, Hash256};
|
||||
use types::{BeaconBlock, BeaconState, EthSpec, Hash256};
|
||||
|
||||
/// Represents some block and it's associated state. Generally, this will be used for tracking the
|
||||
/// head, justified head and finalized head.
|
||||
#[derive(Clone, Serialize, PartialEq, Debug)]
|
||||
pub struct CheckPoint<B: BeaconStateTypes> {
|
||||
pub struct CheckPoint<B: EthSpec> {
|
||||
pub beacon_block: BeaconBlock,
|
||||
pub beacon_block_root: Hash256,
|
||||
pub beacon_state: BeaconState<B>,
|
||||
pub beacon_state_root: Hash256,
|
||||
}
|
||||
|
||||
impl<B: BeaconStateTypes> CheckPoint<B> {
|
||||
impl<B: EthSpec> CheckPoint<B> {
|
||||
/// Create a new checkpoint.
|
||||
pub fn new(
|
||||
beacon_block: BeaconBlock,
|
||||
|
||||
@@ -11,7 +11,7 @@ use std::path::PathBuf;
|
||||
use std::sync::Arc;
|
||||
use tree_hash::TreeHash;
|
||||
use types::test_utils::TestingBeaconStateBuilder;
|
||||
use types::{BeaconBlock, ChainSpec, FewValidatorsStateTypes, FoundationStateTypes, Hash256};
|
||||
use types::{BeaconBlock, ChainSpec, FewValidatorsEthSpec, FoundationEthSpec, Hash256};
|
||||
|
||||
//TODO: Correct this for prod
|
||||
//TODO: Account for historical db
|
||||
@@ -22,8 +22,8 @@ pub fn initialise_beacon_chain(
|
||||
BeaconChain<
|
||||
DiskDB,
|
||||
SystemTimeSlotClock,
|
||||
BitwiseLMDGhost<DiskDB, FoundationStateTypes>,
|
||||
FoundationStateTypes,
|
||||
BitwiseLMDGhost<DiskDB, FoundationEthSpec>,
|
||||
FoundationEthSpec,
|
||||
>,
|
||||
> {
|
||||
// set up the db
|
||||
@@ -75,8 +75,8 @@ pub fn initialise_test_beacon_chain(
|
||||
BeaconChain<
|
||||
MemoryDB,
|
||||
SystemTimeSlotClock,
|
||||
BitwiseLMDGhost<MemoryDB, FewValidatorsStateTypes>,
|
||||
FewValidatorsStateTypes,
|
||||
BitwiseLMDGhost<MemoryDB, FewValidatorsEthSpec>,
|
||||
FewValidatorsEthSpec,
|
||||
>,
|
||||
> {
|
||||
let db = Arc::new(MemoryDB::open());
|
||||
|
||||
@@ -8,16 +8,16 @@ use slot_clock::TestingSlotClock;
|
||||
use std::sync::Arc;
|
||||
use tree_hash::TreeHash;
|
||||
use types::*;
|
||||
use types::{test_utils::TestingBeaconStateBuilder, BeaconStateTypes, FewValidatorsStateTypes};
|
||||
use types::{test_utils::TestingBeaconStateBuilder, EthSpec, FewValidatorsEthSpec};
|
||||
|
||||
type TestingBeaconChain<B> =
|
||||
BeaconChain<MemoryDB, TestingSlotClock, BitwiseLMDGhost<MemoryDB, FewValidatorsStateTypes>, B>;
|
||||
BeaconChain<MemoryDB, TestingSlotClock, BitwiseLMDGhost<MemoryDB, FewValidatorsEthSpec>, B>;
|
||||
|
||||
pub struct TestingBeaconChainBuilder<B: BeaconStateTypes> {
|
||||
pub struct TestingBeaconChainBuilder<B: EthSpec> {
|
||||
state_builder: TestingBeaconStateBuilder<B>,
|
||||
}
|
||||
|
||||
impl<B: BeaconStateTypes> TestingBeaconChainBuilder<B> {
|
||||
impl<B: EthSpec> TestingBeaconChainBuilder<B> {
|
||||
pub fn build(self, spec: &ChainSpec) -> TestingBeaconChain<B> {
|
||||
let db = Arc::new(MemoryDB::open());
|
||||
let block_store = Arc::new(BeaconBlockStore::new(db.clone()));
|
||||
@@ -44,7 +44,7 @@ impl<B: BeaconStateTypes> TestingBeaconChainBuilder<B> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<B: BeaconStateTypes> From<TestingBeaconStateBuilder<B>> for TestingBeaconChainBuilder<B> {
|
||||
impl<B: EthSpec> From<TestingBeaconStateBuilder<B>> for TestingBeaconChainBuilder<B> {
|
||||
fn from(state_builder: TestingBeaconStateBuilder<B>) -> TestingBeaconChainBuilder<B> {
|
||||
TestingBeaconChainBuilder { state_builder }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user