Skip to content

Commit fab18e7

Browse files
committed
updates per pr review
1 parent c13e42e commit fab18e7

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

consensus/types/src/beacon_state.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1074,14 +1074,15 @@ impl<E: EthSpec> BeaconState<E> {
10741074
}
10751075
}
10761076

1077+
let gloas_enabled = self.fork_name_unchecked().gloas_enabled();
10771078
epoch
10781079
.slot_iter(E::slots_per_epoch())
10791080
.map(|slot| {
10801081
let mut preimage = seed.to_vec();
10811082
preimage.append(&mut int_to_bytes8(slot.as_u64()));
10821083
let seed = hash(&preimage);
10831084

1084-
if self.fork_name_unchecked().gloas_enabled() {
1085+
if gloas_enabled {
10851086
self.compute_balance_weighted_selection(indices, &seed, 1, true, spec)?
10861087
.first()
10871088
.copied()
@@ -2842,6 +2843,11 @@ impl<E: EthSpec> BeaconState<E> {
28422843
iteration: usize,
28432844
spec: &ChainSpec,
28442845
) -> Result<bool, Error> {
2846+
// TODO(EIP-7732): Consider grabbing effective balances from the epoch cache here.
2847+
// Note that this function will be used in a loop, so using cached values could be nice for performance.
2848+
// However, post-gloas, this function will be used in `compute_proposer_indices`, `get_next_sync_committee_indices`, and `get_ptc`, which has ~15 call sites in total
2849+
// so we will need to check each one to ensure epoch cache is initialized first, if we deem a good idea.
2850+
// Currently, we can't test if making the change would work since the test suite is not ready for gloas.
28452851
let effective_balance = self.get_effective_balance(index)?;
28462852
let max_effective_balance = spec.max_effective_balance_for_fork(self.fork_name_unchecked());
28472853

0 commit comments

Comments
 (0)