Skip to content

Commit

Permalink
fix ordering
Browse files Browse the repository at this point in the history
  • Loading branch information
xenowits committed Nov 3, 2022
1 parent 5b64b93 commit 1e45bd3
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions testutil/validatormock/synccomm.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,12 +118,12 @@ func (s *SyncCommMember) PrepareEpoch(ctx context.Context) error {
return err
}

s.subcomms, err = prepareSubcommittees(ctx, s.eth2Cl, s.vals)
s.duties, err = prepareSyncCommDuties(ctx, s.eth2Cl, s.vals, s.epoch)
if err != nil {
return err
}

s.duties, err = prepareSyncCommDuties(ctx, s.eth2Cl, s.vals, s.epoch)
s.subcomms, err = prepareSubcommittees(ctx, s.eth2Cl, s.duties)
if err != nil {
return err
}
Expand Down Expand Up @@ -167,17 +167,17 @@ func (s *SyncCommMember) Aggregate(ctx context.Context, slot eth2p0.Slot) error
}

// prepareSubcommittees returns the assignment of validators to sync subcommittees. It assumes that all validators are included in all sync subnets (subcommittees).
func prepareSubcommittees(ctx context.Context, eth2Cl eth2wrap.Client, vals validators) (subCommittees, error) {
func prepareSubcommittees(ctx context.Context, eth2Cl eth2wrap.Client, duties syncDuties) (subCommittees, error) {
spec, err := eth2Cl.Spec(ctx)
if err != nil {
return nil, err
}

subnetCount := spec["SYNC_COMMITTEE_SUBNET_COUNT"].(uint64)
subcomms := make(subCommittees)
for vIdx := range vals {
for _, duty := range duties {
for i := uint64(0); i < subnetCount; i++ {
subcomms[vIdx] = append(subcomms[vIdx], eth2p0.CommitteeIndex(i))
subcomms[duty.ValidatorIndex] = append(subcomms[duty.ValidatorIndex], eth2p0.CommitteeIndex(i))
}
}

Expand Down

0 comments on commit 1e45bd3

Please sign in to comment.