mirror of
https://github.com/OffchainLabs/prysm.git
synced 2026-01-08 21:08:10 -05:00
duties v2 fix no assignment panic (#15466)
* adding fix * preston's suggestion
This commit is contained in:
@@ -403,7 +403,7 @@ func AssignmentForValidator(
|
||||
}
|
||||
}
|
||||
}
|
||||
return nil // validator is not scheduled this epoch
|
||||
return &LiteAssignment{} // validator is not scheduled this epoch
|
||||
}
|
||||
|
||||
// CommitteeAssignments calculates committee assignments for each validator during the specified epoch.
|
||||
|
||||
@@ -912,6 +912,7 @@ func TestAssignmentForValidator(t *testing.T) {
|
||||
{{4, 5, 6}},
|
||||
}
|
||||
got = helpers.AssignmentForValidator(bySlot, start, primitives.ValidatorIndex(99))
|
||||
require.IsNil(t, got)
|
||||
// should be empty to be safe
|
||||
require.DeepEqual(t, &helpers.LiteAssignment{}, got)
|
||||
})
|
||||
}
|
||||
|
||||
@@ -261,6 +261,10 @@ func (vs *Server) buildValidatorDuty(
|
||||
}
|
||||
|
||||
func populateCommitteeFields(duty *ethpb.DutiesV2Response_Duty, la *helpers.LiteAssignment) {
|
||||
if duty == nil || la == nil {
|
||||
// should never be the case as previous functions should set
|
||||
return
|
||||
}
|
||||
duty.CommitteeLength = la.CommitteeLength
|
||||
duty.CommitteeIndex = la.CommitteeIndex
|
||||
duty.ValidatorCommitteeIndex = la.ValidatorCommitteeIndex
|
||||
|
||||
3
changelog/james-prysm_fix-duties-v2-assignment.md
Normal file
3
changelog/james-prysm_fix-duties-v2-assignment.md
Normal file
@@ -0,0 +1,3 @@
|
||||
### Fixed
|
||||
|
||||
- Fix panic on dutiesv2 when there is no committee assignment on the epoch
|
||||
Reference in New Issue
Block a user