Skip to content

Commit

Permalink
fix panic due to nil validator set (#11260)
Browse files Browse the repository at this point in the history
fix #11027
root cause: specific slot state data not found leads to empty validator
set
  • Loading branch information
domiwei authored Jul 21, 2024
1 parent bab36ea commit 5289acc
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion cl/beacon/handler/validators.go
Original file line number Diff line number Diff line change
Expand Up @@ -343,6 +343,9 @@ func (a *ApiHandler) writeValidatorsResponse(
if err != nil {
http.Error(w, err.Error(), http.StatusInternalServerError)
return
} else if validatorSet == nil {
http.Error(w, fmt.Errorf("state not found for slot %v", *slot).Error(), http.StatusNotFound)
return
}
balances, err := a.stateReader.ReadValidatorsBalances(tx, *slot)
if err != nil {
Expand Down Expand Up @@ -371,7 +374,6 @@ func (a *ApiHandler) writeValidatorsResponse(
return
}
responseValidators(w, filterIndicies, statusFilters, stateEpoch, balances, validators, *slot <= a.forkchoiceStore.FinalizedSlot(), isOptimistic)

}

func parseQueryValidatorIndex(tx kv.Tx, id string) (uint64, error) {
Expand Down

0 comments on commit 5289acc

Please sign in to comment.