Skip to content

Commit

Permalink
types: disable cached tree hash, update min spec
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelsproul committed Jul 25, 2019
1 parent 92c7e61 commit 5635742
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
6 changes: 6 additions & 0 deletions eth2/types/src/beacon_state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -929,6 +929,7 @@ impl<T: EthSpec> BeaconState<T> {
/// Returns the `tree_hash_root` resulting from the update. This root can be considered the
/// canonical root of `self`.
pub fn update_tree_hash_cache(&mut self) -> Result<Hash256, Error> {
/* TODO(#440): re-enable cached tree hash
if self.tree_hash_cache.is_empty() {
self.tree_hash_cache = TreeHashCache::new(self)?;
} else {
Expand All @@ -942,6 +943,8 @@ impl<T: EthSpec> BeaconState<T> {
}
self.cached_tree_hash_root()
*/
Ok(Hash256::from_slice(&self.tree_hash_root()))
}

/// Returns the tree hash root determined by the last execution of `self.update_tree_hash_cache(..)`.
Expand All @@ -951,10 +954,13 @@ impl<T: EthSpec> BeaconState<T> {
/// Returns an error if the cache is not initialized or if an error is encountered during the
/// cache update.
pub fn cached_tree_hash_root(&self) -> Result<Hash256, Error> {
/* TODO(#440): re-enable cached tree hash
self.tree_hash_cache
.tree_hash_root()
.and_then(|b| Ok(Hash256::from_slice(b)))
.map_err(Into::into)
*/
Ok(Hash256::from_slice(&self.tree_hash_root()))
}

/// Completely drops the tree hash cache, replacing it with a new, empty cache.
Expand Down
10 changes: 4 additions & 6 deletions eth2/types/src/chain_spec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -196,20 +196,18 @@ impl ChainSpec {

/// Ethereum Foundation minimal spec, as defined here:
///
/// https://github.com/ethereum/eth2.0-specs/blob/v0.6.3/configs/constant_presets/minimal.yaml
/// https://github.com/ethereum/eth2.0-specs/blob/v0.8.1/configs/constant_presets/minimal.yaml
///
/// Spec v0.6.3
/// Spec v0.8.1
pub fn minimal() -> Self {
let genesis_slot = Slot::new(0);

// Note: bootnodes to be updated when static nodes exist.
let boot_nodes = vec![];

Self {
target_committee_size: 4,
shuffle_round_count: 10,
min_attestation_inclusion_delay: 2,
genesis_slot,
min_genesis_active_validator_count: 64,
max_epochs_per_crosslink: 4,
chain_id: 2, // lighthouse testnet chain id
boot_nodes,
..ChainSpec::mainnet()
Expand Down

0 comments on commit 5635742

Please sign in to comment.