Skip to content

Commit 7573ba9

Browse files
committed
updates per pr review
1 parent b573696 commit 7573ba9

File tree

2 files changed

+13
-6
lines changed

2 files changed

+13
-6
lines changed

consensus/state_processing/src/per_block_processing/signature_sets.rs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,12 @@ use tree_hash::TreeHash;
99
use types::{
1010
AbstractExecPayload, AggregateSignature, AttesterSlashingRef, BeaconBlockRef, BeaconState,
1111
BeaconStateError, ChainSpec, DepositData, Domain, Epoch, EthSpec, Fork, Hash256,
12-
IndexedAttestation, IndexedAttestationRef, IndexedPayloadAttestation, ProposerSlashing,
13-
PublicKey, PublicKeyBytes, Signature, SignedAggregateAndProof, SignedBeaconBlock,
14-
SignedBeaconBlockHeader, SignedBlsToExecutionChange, SignedContributionAndProof,
15-
SignedExecutionPayloadBid, SignedExecutionPayloadEnvelope, SignedRoot, SignedVoluntaryExit,
16-
SigningData, Slot, SyncAggregate, SyncAggregatorSelectionData, Unsigned,
12+
InconsistentFork, IndexedAttestation, IndexedAttestationRef, IndexedPayloadAttestation,
13+
ProposerSlashing, PublicKey, PublicKeyBytes, Signature, SignedAggregateAndProof,
14+
SignedBeaconBlock, SignedBeaconBlockHeader, SignedBlsToExecutionChange,
15+
SignedContributionAndProof, SignedExecutionPayloadBid, SignedExecutionPayloadEnvelope,
16+
SignedRoot, SignedVoluntaryExit, SigningData, Slot, SyncAggregate, SyncAggregatorSelectionData,
17+
Unsigned,
1718
};
1819

1920
pub type Result<T> = std::result::Result<T, Error>;

consensus/types/src/beacon_state.rs

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

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

1085-
if self.fork_name_unchecked().gloas_enabled() {
1086+
if gloas_enabled {
10861087
self.compute_balance_weighted_selection(indices, &seed, 1, true, spec)?
10871088
.first()
10881089
.copied()
@@ -2870,6 +2871,11 @@ impl<E: EthSpec> BeaconState<E> {
28702871
iteration: usize,
28712872
spec: &ChainSpec,
28722873
) -> Result<bool, Error> {
2874+
// TODO(EIP-7732): Consider grabbing effective balances from the epoch cache here.
2875+
// Note that this function will be used in a loop, so using cached values could be nice for performance.
2876+
// 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
2877+
// so we will need to check each one to ensure epoch cache is initialized first, if we deem a good idea.
2878+
// Currently, we can't test if making the change would work since the test suite is not ready for gloas.
28732879
let effective_balance = self.get_effective_balance(index)?;
28742880
let max_effective_balance = spec.max_effective_balance_for_fork(self.fork_name_unchecked());
28752881

0 commit comments

Comments
 (0)