Skip to content

Commit

Permalink
Potuz's feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
terencechain committed May 23, 2024
1 parent f7ec94a commit a404d64
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions beacon-chain/core/helpers/beacon_committee.go
Original file line number Diff line number Diff line change
Expand Up @@ -230,14 +230,14 @@ func CommitteeAssignments(ctx context.Context, state state.BeaconState, epoch pr
return nil, err
}

// Retrieve active validator indices for the specified epoch.
activeValidatorIndices, err := ActiveValidatorIndices(ctx, state, epoch)
// Retrieve active validator count for the specified epoch.
activeValidatorCount, err := ActiveValidatorCount(ctx, state, epoch)
if err != nil {
return nil, err
}

// Determine the number of committees per slot based on the number of active validator indices.
numCommitteesPerSlot := SlotCommitteeCount(uint64(len(activeValidatorIndices)))
numCommitteesPerSlot := SlotCommitteeCount(activeValidatorCount)

startSlot, err := slots.EpochStart(epoch)
if err != nil {
Expand All @@ -251,10 +251,9 @@ func CommitteeAssignments(ctx context.Context, state state.BeaconState, epoch pr
}

// Compute committee assignments for each slot in the epoch.
for i := primitives.Slot(0); i < params.BeaconConfig().SlotsPerEpoch; i++ {
for slot := primitives.Slot(startSlot); slot < startSlot+params.BeaconConfig().SlotsPerEpoch; slot++ {

Check failure on line 254 in beacon-chain/core/helpers/beacon_committee.go

View workflow job for this annotation

GitHub Actions / Lint

unnecessary conversion (unconvert)
// Compute committees for the current slot.
for j := uint64(0); j < numCommitteesPerSlot; j++ {
slot := startSlot + i
committee, err := BeaconCommitteeFromState(ctx, state, slot, primitives.CommitteeIndex(j))
if err != nil {
return nil, err
Expand Down

0 comments on commit a404d64

Please sign in to comment.