Skip to content

Commit

Permalink
Fix bug in proposer endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
paulhauner committed Sep 17, 2020
1 parent 2e9afb8 commit 3b22a83
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion beacon_node/http_api/src/beacon_proposer_cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ impl BeaconProposerCache {
let epoch_boundary_slot = head_state
.current_epoch()
.start_slot(T::EthSpec::slots_per_epoch());
let epoch_boundary_root = if head_state.slot == epoch_boundary_slot {
let epoch_boundary_root = if head_state.slot >= epoch_boundary_slot {
head_root
} else {
*head_state.get_block_root(epoch_boundary_slot)?
Expand Down
6 changes: 6 additions & 0 deletions beacon_node/http_api/tests/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ use eth2::{types::*, BeaconNodeClient, Url};
use eth2_libp2p::NetworkGlobals;
use http_api::{Config, Context};
use network::NetworkMessage;
use state_processing::per_slot_processing;
use std::convert::TryInto;
use std::net::Ipv4Addr;
use std::sync::Arc;
Expand Down Expand Up @@ -1158,6 +1159,11 @@ impl ApiTester {
.data;

let mut state = self.chain.head_beacon_state().unwrap();

while state.current_epoch() < current_epoch {
per_slot_processing(&mut state, None, &self.chain.spec).unwrap();
}

state
.build_committee_cache(RelativeEpoch::Current, &self.chain.spec)
.unwrap();
Expand Down

0 comments on commit 3b22a83

Please sign in to comment.