mirror of
https://github.com/OffchainLabs/prysm.git
synced 2026-05-02 03:02:54 -04:00
prevent additional array OOB errors for validator balances (#4872)
Co-authored-by: garyschulte <garyschulte@gmail.com>
This commit is contained in:
@@ -95,19 +95,21 @@ func (v *validator) LogValidatorGainsAndLosses(ctx context.Context, slot uint64)
|
||||
}
|
||||
}
|
||||
|
||||
if resp.InclusionSlots[i] != ^uint64(0) {
|
||||
if i < len(resp.InclusionSlots) && resp.InclusionSlots[i] != ^uint64(0) {
|
||||
included++
|
||||
}
|
||||
if resp.CorrectlyVotedSource[i] {
|
||||
if i < len(resp.CorrectlyVotedSource) && resp.CorrectlyVotedSource[i] {
|
||||
votedSource++
|
||||
}
|
||||
if resp.CorrectlyVotedTarget[i] {
|
||||
if i < len(resp.CorrectlyVotedTarget) && resp.CorrectlyVotedTarget[i] {
|
||||
votedTarget++
|
||||
}
|
||||
if resp.CorrectlyVotedHead[i] {
|
||||
if i < len(resp.CorrectlyVotedHead) && resp.CorrectlyVotedHead[i] {
|
||||
votedHead++
|
||||
}
|
||||
v.prevBalance[bytesutil.ToBytes48(pkey)] = resp.BalancesBeforeEpochTransition[i]
|
||||
if i < len(resp.BalancesAfterEpochTransition) {
|
||||
v.prevBalance[bytesutil.ToBytes48(pkey)] = resp.BalancesBeforeEpochTransition[i]
|
||||
}
|
||||
}
|
||||
|
||||
log.WithFields(logrus.Fields{
|
||||
|
||||
Reference in New Issue
Block a user