Remove dupe info between ChainSpec and EthSpec

This commit is contained in:
Paul Hauner
2019-06-08 07:57:25 -04:00
parent f69d9093a3
commit e74d49fc8a
57 changed files with 299 additions and 252 deletions

View File

@@ -96,6 +96,7 @@ pub trait BeaconChainTypes {
/// Represents the "Beacon Chain" component of Ethereum 2.0. Allows import of blocks and block
/// operations and chooses a canonical head.
pub struct BeaconChain<T: BeaconChainTypes> {
pub spec: ChainSpec,
/// Persistent storage for blocks, states, etc. Typically an on-disk store, such as LevelDB.
pub store: Arc<T::Store>,
/// Reports the current slot, typically based upon the system clock.
@@ -148,6 +149,7 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
genesis_state.build_all_caches(&spec)?;
Ok(Self {
spec,
store,
slot_clock,
op_pool: OperationPool::new(),
@@ -160,7 +162,10 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
}
/// Attempt to load an existing instance from the given `store`.
pub fn from_store(store: Arc<T::Store>) -> Result<Option<BeaconChain<T>>, Error> {
pub fn from_store(
store: Arc<T::Store>,
spec: ChainSpec,
) -> Result<Option<BeaconChain<T>>, Error> {
let key = Hash256::from_slice(&BEACON_CHAIN_DB_KEY.as_bytes());
let p: PersistedBeaconChain<T> = match store.get(&key) {
Err(e) => return Err(e.into()),
@@ -168,8 +173,6 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
Ok(Some(p)) => p,
};
let spec = T::EthSpec::spec();
let slot_clock = T::SlotClock::new(
spec.genesis_slot,
p.state.genesis_time,
@@ -179,6 +182,7 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
let fork_choice = T::ForkChoice::new(store.clone());
Ok(Some(BeaconChain {
spec,
store,
slot_clock,
op_pool: OperationPool::default(),
@@ -363,10 +367,10 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
// If required, transition the new state to the present slot.
for _ in state.slot.as_u64()..present_slot.as_u64() {
per_slot_processing(&mut state, &T::EthSpec::spec())?;
per_slot_processing(&mut state, &self.spec)?;
}
state.build_all_caches(&T::EthSpec::spec())?;
state.build_all_caches(&self.spec)?;
state
};
@@ -400,7 +404,7 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
/// Ensures the current canonical `BeaconState` has been transitioned to match the `slot_clock`.
pub fn catchup_state(&self) -> Result<(), Error> {
let spec = &T::EthSpec::spec();
let spec = &self.spec;
let present_slot = match self.slot_clock.present_slot() {
Ok(Some(slot)) => slot,
@@ -426,7 +430,7 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
///
/// Ideally this shouldn't be required, however we leave it here for testing.
pub fn ensure_state_caches_are_built(&self) -> Result<(), Error> {
self.state.write().build_all_caches(&T::EthSpec::spec())?;
self.state.write().build_all_caches(&self.spec)?;
Ok(())
}
@@ -469,7 +473,7 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
/// genesis.
pub fn slots_since_genesis(&self) -> Option<SlotHeight> {
let now = self.read_slot_clock()?;
let genesis_slot = T::EthSpec::spec().genesis_slot;
let genesis_slot = self.spec.genesis_slot;
if now < genesis_slot {
None
@@ -494,12 +498,12 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
pub fn block_proposer(&self, slot: Slot) -> Result<usize, BeaconStateError> {
self.state
.write()
.build_committee_cache(RelativeEpoch::Current, &T::EthSpec::spec())?;
.build_committee_cache(RelativeEpoch::Current, &self.spec)?;
let index = self.state.read().get_beacon_proposer_index(
slot,
RelativeEpoch::Current,
&T::EthSpec::spec(),
&self.spec,
)?;
Ok(index)
@@ -530,7 +534,7 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
/// Produce an `AttestationData` that is valid for the present `slot` and given `shard`.
pub fn produce_attestation_data(&self, shard: u64) -> Result<AttestationData, Error> {
let slots_per_epoch = T::EthSpec::spec().slots_per_epoch;
let slots_per_epoch = T::EthSpec::slots_per_epoch();
self.metrics.attestation_production_requests.inc();
let timer = self.metrics.attestation_production_times.start_timer();
@@ -591,9 +595,9 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
self.metrics.attestation_processing_requests.inc();
let timer = self.metrics.attestation_processing_times.start_timer();
let result =
self.op_pool
.insert_attestation(attestation, &*self.state.read(), &T::EthSpec::spec());
let result = self
.op_pool
.insert_attestation(attestation, &*self.state.read(), &self.spec);
if result.is_ok() {
self.metrics.attestation_processing_successes.inc();
@@ -610,19 +614,19 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
deposit: Deposit,
) -> Result<DepositInsertStatus, DepositValidationError> {
self.op_pool
.insert_deposit(deposit, &*self.state.read(), &T::EthSpec::spec())
.insert_deposit(deposit, &*self.state.read(), &self.spec)
}
/// Accept some exit and queue it for inclusion in an appropriate block.
pub fn process_voluntary_exit(&self, exit: VoluntaryExit) -> Result<(), ExitValidationError> {
self.op_pool
.insert_voluntary_exit(exit, &*self.state.read(), &T::EthSpec::spec())
.insert_voluntary_exit(exit, &*self.state.read(), &self.spec)
}
/// Accept some transfer and queue it for inclusion in an appropriate block.
pub fn process_transfer(&self, transfer: Transfer) -> Result<(), TransferValidationError> {
self.op_pool
.insert_transfer(transfer, &*self.state.read(), &T::EthSpec::spec())
.insert_transfer(transfer, &*self.state.read(), &self.spec)
}
/// Accept some proposer slashing and queue it for inclusion in an appropriate block.
@@ -630,11 +634,8 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
&self,
proposer_slashing: ProposerSlashing,
) -> Result<(), ProposerSlashingValidationError> {
self.op_pool.insert_proposer_slashing(
proposer_slashing,
&*self.state.read(),
&T::EthSpec::spec(),
)
self.op_pool
.insert_proposer_slashing(proposer_slashing, &*self.state.read(), &self.spec)
}
/// Accept some attester slashing and queue it for inclusion in an appropriate block.
@@ -642,11 +643,8 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
&self,
attester_slashing: AttesterSlashing,
) -> Result<(), AttesterSlashingValidationError> {
self.op_pool.insert_attester_slashing(
attester_slashing,
&*self.state.read(),
&T::EthSpec::spec(),
)
self.op_pool
.insert_attester_slashing(attester_slashing, &*self.state.read(), &self.spec)
}
/// Accept some block and attempt to add it to block DAG.
@@ -708,18 +706,18 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
// Transition the parent state to the block slot.
let mut state: BeaconState<T::EthSpec> = parent_state;
for _ in state.slot.as_u64()..block.slot.as_u64() {
if let Err(e) = per_slot_processing(&mut state, &T::EthSpec::spec()) {
if let Err(e) = per_slot_processing(&mut state, &self.spec) {
return Ok(BlockProcessingOutcome::InvalidBlock(
InvalidBlock::SlotProcessingError(e),
));
}
}
state.build_committee_cache(RelativeEpoch::Current, &T::EthSpec::spec())?;
state.build_committee_cache(RelativeEpoch::Current, &self.spec)?;
// Apply the received block to its parent state (which has been transitioned into this
// slot).
if let Err(e) = per_block_processing(&mut state, &block, &T::EthSpec::spec()) {
if let Err(e) = per_block_processing(&mut state, &block, &self.spec) {
return Ok(BlockProcessingOutcome::InvalidBlock(
InvalidBlock::PerBlockProcessingError(e),
));
@@ -740,7 +738,7 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
// Register the new block with the fork choice service.
self.fork_choice
.write()
.add_block(&block, &block_root, &T::EthSpec::spec())?;
.add_block(&block, &block_root, &self.spec)?;
// Execute the fork choice algorithm, enthroning a new head if discovered.
//
@@ -771,7 +769,7 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
let mut state = self.state.read().clone();
state.build_committee_cache(RelativeEpoch::Current, &T::EthSpec::spec())?;
state.build_committee_cache(RelativeEpoch::Current, &self.spec)?;
trace!("Finding attestations for new block...");
@@ -783,9 +781,8 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
state.latest_block_header.canonical_root()
};
let (proposer_slashings, attester_slashings) = self
.op_pool
.get_slashings(&*self.state.read(), &T::EthSpec::spec());
let (proposer_slashings, attester_slashings) =
self.op_pool.get_slashings(&*self.state.read(), &self.spec);
let mut block = BeaconBlock {
slot: state.slot,
@@ -806,16 +803,12 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
attester_slashings,
attestations: self
.op_pool
.get_attestations(&*self.state.read(), &T::EthSpec::spec()),
deposits: self
.op_pool
.get_deposits(&*self.state.read(), &T::EthSpec::spec()),
.get_attestations(&*self.state.read(), &self.spec),
deposits: self.op_pool.get_deposits(&*self.state.read(), &self.spec),
voluntary_exits: self
.op_pool
.get_voluntary_exits(&*self.state.read(), &T::EthSpec::spec()),
transfers: self
.op_pool
.get_transfers(&*self.state.read(), &T::EthSpec::spec()),
.get_voluntary_exits(&*self.state.read(), &self.spec),
transfers: self.op_pool.get_transfers(&*self.state.read(), &self.spec),
},
};
@@ -824,11 +817,7 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
block.body.attestations.len()
);
per_block_processing_without_verifying_block_signature(
&mut state,
&block,
&T::EthSpec::spec(),
)?;
per_block_processing_without_verifying_block_signature(&mut state, &block, &self.spec)?;
let state_root = state.canonical_root();
@@ -849,7 +838,7 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
let justified_root = {
let root = self.head().beacon_state.current_justified_root;
if root == T::EthSpec::spec().zero_hash {
if root == self.spec.zero_hash {
self.genesis_block_root
} else {
root
@@ -860,7 +849,7 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
let beacon_block_root = self
.fork_choice
.write()
.find_head(&justified_root, &T::EthSpec::spec())?;
.find_head(&justified_root, &self.spec)?;
// End fork choice metrics timer.
timer.observe_duration();
@@ -920,7 +909,7 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
loop {
let beacon_block_root = last_slot.beacon_block.previous_block_root;
if beacon_block_root == T::EthSpec::spec().zero_hash {
if beacon_block_root == self.spec.zero_hash {
break; // Genesis has been reached.
}

View File

@@ -85,8 +85,11 @@ mod test {
use types::{test_utils::TestingBeaconStateBuilder, FoundationEthSpec, Keypair};
fn get_state<T: EthSpec>() -> BeaconState<T> {
let builder =
TestingBeaconStateBuilder::from_single_keypair(0, &Keypair::random(), &T::spec());
let builder = TestingBeaconStateBuilder::from_single_keypair(
0,
&Keypair::random(),
&T::default_spec(),
);
let (state, _keypairs) = builder.build();
state
}

View File

@@ -10,7 +10,8 @@ use slot_clock::SlotClock;
use std::sync::Arc;
use tree_hash::TreeHash;
use types::{
test_utils::TestingBeaconStateBuilder, BeaconBlock, EthSpec, Hash256, LighthouseTestnetEthSpec,
test_utils::TestingBeaconStateBuilder, BeaconBlock, ChainSpec, EthSpec, Hash256,
LighthouseTestnetEthSpec,
};
/// The number initial validators when starting the `LighthouseTestnet`.
@@ -18,8 +19,12 @@ const TESTNET_VALIDATOR_COUNT: usize = 16;
/// Provides a new, initialized `BeaconChain`
pub trait InitialiseBeaconChain<T: BeaconChainTypes> {
fn initialise_beacon_chain(store: Arc<T::Store>, log: Logger) -> BeaconChain<T> {
maybe_load_from_store_for_testnet::<_, T::Store, T::EthSpec>(store, log)
fn initialise_beacon_chain(
store: Arc<T::Store>,
spec: ChainSpec,
log: Logger,
) -> BeaconChain<T> {
maybe_load_from_store_for_testnet::<_, T::Store, T::EthSpec>(store, spec, log)
}
}
@@ -48,13 +53,14 @@ impl<T: BeaconChainTypes> InitialiseBeaconChain<T> for TestnetDiskBeaconChainTyp
/// Loads a `BeaconChain` from `store`, if it exists. Otherwise, create a new chain from genesis.
fn maybe_load_from_store_for_testnet<T, U: Store, V: EthSpec>(
store: Arc<U>,
spec: ChainSpec,
log: Logger,
) -> BeaconChain<T>
where
T: BeaconChainTypes<Store = U>,
T::ForkChoice: ForkChoice<U>,
{
if let Ok(Some(beacon_chain)) = BeaconChain::from_store(store.clone()) {
if let Ok(Some(beacon_chain)) = BeaconChain::from_store(store.clone(), spec.clone()) {
info!(
log,
"Loaded BeaconChain from store";
@@ -65,8 +71,6 @@ where
beacon_chain
} else {
info!(log, "Initializing new BeaconChain from genesis");
let spec = T::EthSpec::spec();
let state_builder = TestingBeaconStateBuilder::from_default_keypairs_file_if_exists(
TESTNET_VALIDATOR_COUNT,
&spec,
@@ -92,7 +96,7 @@ where
slot_clock,
genesis_state,
genesis_block,
spec.clone(),
spec,
fork_choice,
)
.expect("Terminate if beacon chain generation fails")

View File

@@ -4,24 +4,26 @@ use network::NetworkConfig;
use serde_derive::{Deserialize, Serialize};
use std::fs;
use std::path::PathBuf;
use types::ChainSpec;
/// The core configuration of a Lighthouse beacon node.
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct ClientConfig {
pub data_dir: String,
pub spec: String,
pub spec_constants: String,
pub db_type: String,
db_name: String,
pub network: network::NetworkConfig,
pub rpc: rpc::RPCConfig,
pub http: HttpServerConfig, //pub ipc_conf:
pub spec: ChainSpec,
}
impl Default for ClientConfig {
fn default() -> Self {
Self {
data_dir: ".lighthouse".to_string(),
spec: "testnet".to_string(),
spec_constants: "testnet".to_string(),
db_type: "disk".to_string(),
db_name: "chain_db".to_string(),
// Note: there are no default bootnodes specified.
@@ -29,6 +31,7 @@ impl Default for ClientConfig {
network: NetworkConfig::new(vec![]),
rpc: rpc::RPCConfig::default(),
http: HttpServerConfig::default(),
spec: ChainSpec::lighthouse_testnet(8),
}
}
}

View File

@@ -17,7 +17,6 @@ use std::sync::Arc;
use std::time::{Duration, Instant};
use tokio::runtime::TaskExecutor;
use tokio::timer::Interval;
use types::EthSpec;
pub use beacon_chain::BeaconChainTypes;
pub use beacon_chain_types::InitialiseBeaconChain;
@@ -58,10 +57,14 @@ where
) -> error::Result<Self> {
let metrics_registry = Registry::new();
let store = Arc::new(store);
let spec = T::EthSpec::spec();
let seconds_per_slot = config.spec.seconds_per_slot;
// Load a `BeaconChain` from the store, or create a new one if it does not exist.
let beacon_chain = Arc::new(T::initialise_beacon_chain(store, log.clone()));
let beacon_chain = Arc::new(T::initialise_beacon_chain(
store,
config.spec.clone(),
log.clone(),
));
// Registry all beacon chain metrics with the global registry.
beacon_chain
.metrics
@@ -143,7 +146,7 @@ where
// set up the validator work interval - start at next slot and proceed every slot
let interval = {
// Set the interval to start at the next slot, and every slot after
let slot_duration = Duration::from_secs(spec.seconds_per_slot);
let slot_duration = Duration::from_secs(seconds_per_slot);
//TODO: Handle checked add correctly
Interval::new(Instant::now() + duration_to_next_slot, slot_duration)
};

View File

@@ -261,7 +261,7 @@ mod test {
#[test]
fn ssz_encoding() {
let original = PubsubMessage::Block(BeaconBlock::empty(&FoundationEthSpec::spec()));
let original = PubsubMessage::Block(BeaconBlock::empty(&FoundationEthSpec::default_spec()));
let encoded = ssz_encode(&original);

View File

@@ -10,7 +10,6 @@ use persistent::Read;
use router::Router;
use serde_json::json;
use std::sync::Arc;
use types::EthSpec;
/// Yields a handler for the HTTP API.
pub fn build_handler<T: BeaconChainTypes + 'static>(
@@ -65,7 +64,7 @@ fn handle_fork<T: BeaconChainTypes + 'static>(req: &mut Request) -> IronResult<R
let response = json!({
"fork": beacon_chain.head().beacon_state.fork,
"chain_id": T::EthSpec::spec().chain_id
"chain_id": beacon_chain.spec.chain_id
});
Ok(Response::with((Status::Ok, response.to_string())))

View File

@@ -158,7 +158,7 @@ impl<T: BeaconChainTypes> SimpleSync<T> {
hello: HelloMessage,
network: &mut NetworkContext,
) {
let spec = T::EthSpec::spec();
let spec = &self.chain.spec;
let remote = PeerSyncInfo::from(hello);
let local = PeerSyncInfo::from(&self.chain);
@@ -214,7 +214,7 @@ impl<T: BeaconChainTypes> SimpleSync<T> {
debug!(self.log, "Peer has high finalized epoch"; "peer" => format!("{:?}", peer_id));
let start_slot = local
.latest_finalized_epoch
.start_slot(spec.slots_per_epoch);
.start_slot(T::EthSpec::slots_per_epoch());
let required_slots = remote.best_slot - start_slot;
self.request_block_roots(
@@ -231,7 +231,7 @@ impl<T: BeaconChainTypes> SimpleSync<T> {
debug!(self.log, "Peer has higher best slot"; "peer" => format!("{:?}", peer_id));
let start_slot = local
.latest_finalized_epoch
.start_slot(spec.slots_per_epoch);
.start_slot(T::EthSpec::slots_per_epoch());
let required_slots = remote.best_slot - start_slot;
self.request_block_roots(
@@ -795,7 +795,7 @@ impl<T: BeaconChainTypes> SimpleSync<T> {
fn slot_is_finalized(&self, slot: Slot) -> bool {
slot <= hello_message(&self.chain)
.latest_finalized_epoch
.start_slot(T::EthSpec::spec().slots_per_epoch)
.start_slot(T::EthSpec::slots_per_epoch())
}
/// Generates our current state in the form of a HELLO RPC message.
@@ -806,7 +806,7 @@ impl<T: BeaconChainTypes> SimpleSync<T> {
/// Build a `HelloMessage` representing the state of the given `beacon_chain`.
fn hello_message<T: BeaconChainTypes>(beacon_chain: &BeaconChain<T>) -> HelloMessage {
let spec = T::EthSpec::spec();
let spec = &beacon_chain.spec;
let state = &beacon_chain.head().beacon_state;
HelloMessage {

View File

@@ -5,7 +5,6 @@ use protos::services::{Empty, Fork, NodeInfoResponse};
use protos::services_grpc::BeaconNodeService;
use slog::{trace, warn};
use std::sync::Arc;
use types::EthSpec;
#[derive(Clone)]
pub struct BeaconNodeServiceInstance<T: BeaconChainTypes> {
@@ -33,7 +32,7 @@ impl<T: BeaconChainTypes> BeaconNodeService for BeaconNodeServiceInstance<T> {
fork.set_current_version(state_fork.current_version.to_vec());
fork.set_epoch(state_fork.epoch.into());
let spec = T::EthSpec::spec();
let spec = &self.chain.spec;
node_info.set_fork(fork);
node_info.set_genesis_time(genesis_time);

View File

@@ -14,7 +14,6 @@ pub struct ValidatorServiceInstance<T: BeaconChainTypes> {
pub chain: Arc<BeaconChain<T>>,
pub log: slog::Logger,
}
//TODO: Refactor Errors
impl<T: BeaconChainTypes> ValidatorService for ValidatorServiceInstance<T> {
/// For a list of validator public keys, this function returns the slot at which each
@@ -29,14 +28,15 @@ impl<T: BeaconChainTypes> ValidatorService for ValidatorServiceInstance<T> {
let validators = req.get_validators();
trace!(self.log, "RPC request"; "endpoint" => "GetValidatorDuties", "epoch" => req.get_epoch());
let spec = T::EthSpec::spec();
let spec = &self.chain.spec;
let state = &self.chain.current_state();
let epoch = Epoch::from(req.get_epoch());
let mut resp = GetDutiesResponse::new();
let resp_validators = resp.mut_active_validators();
let relative_epoch =
match RelativeEpoch::from_epoch(state.slot.epoch(spec.slots_per_epoch), epoch) {
match RelativeEpoch::from_epoch(state.slot.epoch(T::EthSpec::slots_per_epoch()), epoch)
{
Ok(v) => v,
Err(e) => {
// incorrect epoch
@@ -52,7 +52,7 @@ impl<T: BeaconChainTypes> ValidatorService for ValidatorServiceInstance<T> {
};
let validator_proposers: Result<Vec<usize>, _> = epoch
.slot_iter(spec.slots_per_epoch)
.slot_iter(T::EthSpec::slots_per_epoch())
.map(|slot| state.get_beacon_proposer_index(slot, relative_epoch, &spec))
.collect();
let validator_proposers = match validator_proposers {
@@ -148,7 +148,7 @@ impl<T: BeaconChainTypes> ValidatorService for ValidatorServiceInstance<T> {
// check if the validator needs to propose a block
if let Some(slot) = validator_proposers.iter().position(|&v| val_index == v) {
duty.set_block_production_slot(
epoch.start_slot(spec.slots_per_epoch).as_u64() + slot as u64,
epoch.start_slot(T::EthSpec::slots_per_epoch()).as_u64() + slot as u64,
);
} else {
// no blocks to propose this epoch

View File

@@ -27,11 +27,11 @@ pub fn run_beacon_node(config: ClientConfig, log: &slog::Logger) -> error::Resul
.db_path()
.ok_or_else::<error::Error, _>(|| "Unable to access database path".into())?;
let db_type = &config.db_type;
let spec = &config.spec;
let spec_constants = &config.spec_constants;
let other_config = config.clone();
let result = match (db_type.as_str(), spec.as_str()) {
let result = match (db_type.as_str(), spec_constants.as_str()) {
("disk", "testnet") => {
run::<TestnetDiskBeaconChainTypes>(&db_path, config, executor, runtime, log)
}
@@ -50,7 +50,7 @@ pub fn run_beacon_node(config: ClientConfig, log: &slog::Logger) -> error::Resul
"Started beacon node";
"p2p_listen_addresses" => format!("{:?}", &other_config.network.listen_addresses()),
"data_dir" => format!("{:?}", other_config.data_dir()),
"spec" => &other_config.spec,
"spec_constants" => &other_config.spec_constants,
"db_type" => &other_config.db_type,
);
}

View File

@@ -61,7 +61,7 @@ mod tests {
#[test]
fn read_slot() {
let spec = FewValidatorsEthSpec::spec();
let spec = FewValidatorsEthSpec::default_spec();
let test_slot = |slot: Slot| {
let mut block = BeaconBlock::empty(&spec);
@@ -85,7 +85,7 @@ mod tests {
#[test]
fn read_previous_block_root() {
let spec = FewValidatorsEthSpec::spec();
let spec = FewValidatorsEthSpec::default_spec();
let test_root = |root: Hash256| {
let mut block = BeaconBlock::empty(&spec);
@@ -130,7 +130,7 @@ mod tests {
fn chain_without_skips() {
let n: usize = 10;
let store = MemoryStore::open();
let spec = FewValidatorsEthSpec::spec();
let spec = FewValidatorsEthSpec::default_spec();
let slots: Vec<usize> = (0..n).collect();
let blocks_and_roots = build_chain(&store, &slots, &spec);
@@ -154,7 +154,7 @@ mod tests {
#[test]
fn chain_with_skips() {
let store = MemoryStore::open();
let spec = FewValidatorsEthSpec::spec();
let spec = FewValidatorsEthSpec::default_spec();
let slots = vec![0, 1, 2, 5];