Skip to content

Commit

Permalink
Merge pull request #186 from ethpandaops/pk910/fix-phase0
Browse files Browse the repository at this point in the history
fix for running dora on phase0 chain
  • Loading branch information
pk910 authored Dec 4, 2024
2 parents 7a69b2e + 6c97921 commit 830e7c8
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 12 deletions.
2 changes: 1 addition & 1 deletion indexer/beacon/block_helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ func getStateDepositIndex(state *spec.VersionedBeaconState) uint64 {
return 0
}

// getStateRandaoMixes returns the RANDAO mixes from a versioned beacon state.
// getStateRandaoMixes returns the current sync committee from a versioned beacon state.
func getStateCurrentSyncCommittee(v *spec.VersionedBeaconState) ([]phase0.BLSPubKey, error) {
switch v.Version {
case spec.DataVersionPhase0:
Expand Down
26 changes: 15 additions & 11 deletions indexer/beacon/epochstate.go
Original file line number Diff line number Diff line change
Expand Up @@ -172,19 +172,23 @@ func (s *epochState) processState(state *spec.VersionedBeaconState, cache *epoch
s.randaoMixes = randaoMixes
s.depositIndex = getStateDepositIndex(state)

currentSyncCommittee, err := getStateCurrentSyncCommittee(state)
if err != nil {
return fmt.Errorf("error getting current sync committee from state %v: %v", s.slotRoot.String(), err)
}
if state.Version >= spec.DataVersionAltair {
currentSyncCommittee, err := getStateCurrentSyncCommittee(state)
if err != nil {
return fmt.Errorf("error getting current sync committee from state %v: %v", s.slotRoot.String(), err)
}

syncCommittee := make([]phase0.ValidatorIndex, len(currentSyncCommittee))
for i, v := range currentSyncCommittee {
syncCommittee[i] = validatorPubkeyMap[v]
}
if cache != nil {
syncCommittee = cache.getOrUpdateSyncCommittee(syncCommittee)
syncCommittee := make([]phase0.ValidatorIndex, len(currentSyncCommittee))
for i, v := range currentSyncCommittee {
syncCommittee[i] = validatorPubkeyMap[v]
}
if cache != nil {
syncCommittee = cache.getOrUpdateSyncCommittee(syncCommittee)
}
s.syncCommittee = syncCommittee
} else {
s.syncCommittee = []phase0.ValidatorIndex{}
}
s.syncCommittee = syncCommittee

return nil
}

0 comments on commit 830e7c8

Please sign in to comment.