mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-03 00:31:50 +00:00
Make #stateprocessingcompileagain
This commit is contained in:
@@ -159,9 +159,10 @@ pub fn process_crosslinks<T: EthSpec>(
|
||||
|
||||
state.previous_crosslinks = state.current_crosslinks.clone();
|
||||
|
||||
for epoch in vec![state.previous_epoch(), state.current_epoch()] {
|
||||
for offset in 0..state.get_epoch_committee_count(epoch, spec) {
|
||||
let shard = (state.get_epoch_start_shard(epoch, spec) + offset) % spec.shard_count;
|
||||
for relative_epoch in vec![RelativeEpoch::Previous, RelativeEpoch::Current] {
|
||||
let epoch = relative_epoch.into_epoch(state.current_epoch());
|
||||
for offset in 0..state.get_epoch_committee_count(relative_epoch)? {
|
||||
let shard = (state.get_epoch_start_shard(relative_epoch)? + offset) % spec.shard_count;
|
||||
let crosslink_committee = state.get_crosslink_committee(epoch, shard, spec)?;
|
||||
|
||||
let winning_root = winning_root(state, shard, epoch, spec)?;
|
||||
@@ -211,9 +212,7 @@ pub fn process_final_updates<T: EthSpec>(
|
||||
}
|
||||
|
||||
// Update start shard.
|
||||
state.latest_start_shard = (state.latest_start_shard
|
||||
+ state.get_shard_delta(current_epoch, spec))
|
||||
% T::ShardCount::to_u64();
|
||||
state.latest_start_shard = state.next_epoch_start_shard()?;
|
||||
|
||||
// This is a hack to allow us to update index roots and slashed balances for the next epoch.
|
||||
//
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#![cfg(test)]
|
||||
use crate::per_epoch_processing;
|
||||
use crate::per_epoch_processing::per_epoch_processing;
|
||||
use env_logger::{Builder, Env};
|
||||
use types::test_utils::TestingBeaconStateBuilder;
|
||||
use types::*;
|
||||
|
||||
@@ -232,7 +232,8 @@ impl ValidatorStatuses {
|
||||
// The inclusion slot and distance are only required for previous epoch attesters.
|
||||
let attestation_slot = state.get_attestation_slot(&a.data)?;
|
||||
let inclusion_slot = attestation_slot + a.inclusion_delay;
|
||||
let relative_epoch = RelativeEpoch::from_slot(state.slot, inclusion_slot, spec)?;
|
||||
let relative_epoch =
|
||||
RelativeEpoch::from_slot(state.slot, inclusion_slot, spec.slots_per_epoch)?;
|
||||
status.inclusion_info = Some(InclusionInfo {
|
||||
slot: inclusion_slot,
|
||||
distance: a.inclusion_delay,
|
||||
|
||||
@@ -42,7 +42,7 @@ pub fn winning_root<T: EthSpec>(
|
||||
spec: &ChainSpec,
|
||||
) -> Result<Option<WinningRoot>, BeaconStateError> {
|
||||
let shard_attestations: Vec<&PendingAttestation> = state
|
||||
.get_matching_source_attestations(epoch, spec)?
|
||||
.get_matching_source_attestations(epoch)?
|
||||
.iter()
|
||||
.filter(|a| a.data.shard == shard)
|
||||
.collect();
|
||||
|
||||
Reference in New Issue
Block a user