Add progress on debugging fork choice

This commit is contained in:
Paul Hauner
2019-06-20 18:46:03 +10:00
parent 5a8cde0598
commit d0037f49d8
5 changed files with 92 additions and 48 deletions

View File

@@ -210,6 +210,8 @@ where
}
fn find_head_from<'a>(&'a self, start_node: &'a Node) -> Result<&'a Node> {
dbg!(&self.nodes);
if start_node.does_not_have_children() {
Ok(start_node)
} else {
@@ -585,7 +587,7 @@ pub struct Vote {
///
/// E.g., a `get` or `insert` to an out-of-bounds element will cause the Vec to grow (using
/// Default) to the smallest size required to fulfill the request.
#[derive(Default, Clone)]
#[derive(Default, Clone, Debug)]
pub struct ElasticList<T>(Vec<T>);
impl<T> ElasticList<T>

View File

@@ -5,7 +5,7 @@ use bls::Signature;
use serde_derive::{Deserialize, Serialize};
use ssz_derive::{Decode, Encode};
use test_random_derive::TestRandom;
use tree_hash::TreeHash;
use tree_hash::{SignedRoot, TreeHash};
use tree_hash_derive::{CachedTreeHash, SignedRoot, TreeHash};
/// A block of the `BeaconChain`.

View File

@@ -703,9 +703,6 @@ impl<T: EthSpec> BeaconState<T> {
let active_index_root = self.get_active_index_root(epoch, spec)?;
let epoch_bytes = int_to_bytes32(epoch.as_u64());
dbg!(randao);
dbg!(active_index_root);
let mut preimage = [0; 32 * 3];
preimage[0..32].copy_from_slice(&randao[..]);
preimage[32..64].copy_from_slice(&active_index_root[..]);
@@ -838,10 +835,12 @@ impl<T: EthSpec> BeaconState<T> {
/// Note: whilst this function will preserve already-built caches, it will not build any.
pub fn advance_caches(&mut self) {
let next = Self::cache_index(RelativeEpoch::Previous);
let current = Self::cache_index(RelativeEpoch::Current);
let caches = &mut self.committee_caches[..];
caches.rotate_left(1);
caches[next] = CommitteeCache::default();
caches[current] = CommitteeCache::default();
}
fn cache_index(relative_epoch: RelativeEpoch) -> usize {