From 1823378bfaa7f8b11a86c2633fb2d1d5b32b5cba Mon Sep 17 00:00:00 2001 From: Michael Sproul Date: Mon, 17 Jun 2019 16:02:01 +1000 Subject: [PATCH] v0.6: remove some FIXMEs --- eth2/types/src/beacon_state.rs | 6 ++---- .../builders/testing_beacon_state_builder.rs | 2 +- .../builders/testing_pending_attestation_builder.rs | 10 ++++++++-- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/eth2/types/src/beacon_state.rs b/eth2/types/src/beacon_state.rs index 825f50c32..ba70b21d3 100644 --- a/eth2/types/src/beacon_state.rs +++ b/eth2/types/src/beacon_state.rs @@ -450,10 +450,10 @@ impl BeaconState { Ok(&self.latest_block_roots[i]) } - /// Return the block root at a recent `slot`. + /// Return the block root at a recent `epoch`. /// /// Spec v0.6.0 - // FIXME(sproul): name swap with get_block_root + // NOTE: the spec calls this get_block_root pub fn get_block_root_at_epoch(&self, epoch: Epoch) -> Result<&Hash256, BeaconStateError> { self.get_block_root(epoch.start_slot(T::slots_per_epoch())) } @@ -854,8 +854,6 @@ impl BeaconState { self.committee_caches[Self::cache_index(relative_epoch)] = CommitteeCache::default(); } - // FIXME(sproul): drop_previous/current_committee_cache - /// Updates the pubkey cache, if required. /// /// Adds all `pubkeys` from the `validator_registry` which are not already in the cache. Will diff --git a/eth2/types/src/test_utils/builders/testing_beacon_state_builder.rs b/eth2/types/src/test_utils/builders/testing_beacon_state_builder.rs index 4f0927508..e949c26b2 100644 --- a/eth2/types/src/test_utils/builders/testing_beacon_state_builder.rs +++ b/eth2/types/src/test_utils/builders/testing_beacon_state_builder.rs @@ -175,7 +175,7 @@ impl TestingBeaconStateBuilder { state.slot = slot; - // FIXME(sproul): update latest_start_shard? + // NOTE: we could update the latest start shard here state.previous_justified_epoch = epoch - 3; state.current_justified_epoch = epoch - 2; diff --git a/eth2/types/src/test_utils/builders/testing_pending_attestation_builder.rs b/eth2/types/src/test_utils/builders/testing_pending_attestation_builder.rs index 89000f219..d4ba9c826 100644 --- a/eth2/types/src/test_utils/builders/testing_pending_attestation_builder.rs +++ b/eth2/types/src/test_utils/builders/testing_pending_attestation_builder.rs @@ -23,12 +23,18 @@ impl TestingPendingAttestationBuilder { ) -> Self { let data_builder = TestingAttestationDataBuilder::new(state, shard, slot, spec); + let relative_epoch = + RelativeEpoch::from_epoch(state.current_epoch(), slot.epoch(T::slots_per_epoch())) + .expect("epoch out of bounds"); + let proposer_index = state + .get_beacon_proposer_index(slot, relative_epoch, spec) + .unwrap() as u64; + let pending_attestation = PendingAttestation { aggregation_bitfield: Bitfield::new(), data: data_builder.build(), inclusion_delay: spec.min_attestation_inclusion_delay, - // FIXME(sproul) - proposer_index: 0, + proposer_index, }; Self {