diff --git a/eth2/types/src/beacon_state.rs b/eth2/types/src/beacon_state.rs index f7df3b0ab..fad756708 100644 --- a/eth2/types/src/beacon_state.rs +++ b/eth2/types/src/beacon_state.rs @@ -117,19 +117,18 @@ pub struct BeaconState { impl BeaconState { /// Produce the first state of the Beacon Chain. - pub fn genesis( + pub fn genesis_without_validators( genesis_time: u64, - initial_validator_deposits: Vec, latest_eth1_data: Eth1Data, spec: &ChainSpec, ) -> Result { - debug!("Creating genesis state."); + debug!("Creating genesis state (without validator processing)."); let initial_crosslink = Crosslink { epoch: spec.genesis_epoch, shard_block_root: spec.zero_hash, }; - let mut genesis_state = BeaconState { + Ok(BeaconState { /* * Misc */ @@ -188,7 +187,19 @@ impl BeaconState { */ cache_index_offset: 0, caches: vec![EpochCache::empty(); CACHED_EPOCHS], - }; + }) + } + /// Produce the first state of the Beacon Chain. + pub fn genesis( + genesis_time: u64, + initial_validator_deposits: Vec, + latest_eth1_data: Eth1Data, + spec: &ChainSpec, + ) -> Result { + let mut genesis_state = + BeaconState::genesis_without_validators(genesis_time, latest_eth1_data, spec)?; + + trace!("Processing genesis deposits..."); let deposit_data = initial_validator_deposits .iter()