mirror of
https://github.com/OffchainLabs/prysm.git
synced 2026-01-09 15:37:56 -05:00
Fix deadlines (#15221)
* Fix deadlines * use current slot in update duties --------- Co-authored-by: james-prysm <90280386+james-prysm@users.noreply.github.com>
This commit is contained in:
@@ -91,8 +91,8 @@ func run(ctx context.Context, v iface.Validator) {
|
||||
// epoch transition in the beacon node's state.
|
||||
if err := v.UpdateDuties(slotCtx, slot); err != nil {
|
||||
handleAssignmentError(err, slot)
|
||||
cancel()
|
||||
span.End()
|
||||
cancel()
|
||||
continue
|
||||
}
|
||||
|
||||
@@ -113,8 +113,8 @@ func run(ctx context.Context, v iface.Validator) {
|
||||
allRoles, err := v.RolesAt(slotCtx, slot)
|
||||
if err != nil {
|
||||
log.WithError(err).Error("Could not get validator roles")
|
||||
cancel()
|
||||
span.End()
|
||||
cancel()
|
||||
continue
|
||||
}
|
||||
performRoles(slotCtx, allRoles, v, slot, &wg, span)
|
||||
|
||||
@@ -520,7 +520,7 @@ func (v *validator) UpdateDuties(ctx context.Context, slot primitives.Slot) erro
|
||||
return nil
|
||||
}
|
||||
// Set deadline to end of epoch.
|
||||
ss, err := slots.EpochStart(slots.ToEpoch(slot) + 1)
|
||||
ss, err := slots.EpochStart(primitives.Epoch(slots.CurrentSlot(v.genesisTime) + 1))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -1158,11 +1158,8 @@ func (v *validator) checkDependentRoots(ctx context.Context, head *structs.HeadE
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
deadline := v.SlotDeadline(slot)
|
||||
slotCtx, cancel := context.WithDeadline(ctx, deadline)
|
||||
defer cancel()
|
||||
if !bytes.Equal(prevDepedentRoot, v.duties.PrevDependentRoot) {
|
||||
if err := v.UpdateDuties(slotCtx, currEpochStart); err != nil {
|
||||
if err := v.UpdateDuties(ctx, currEpochStart); err != nil {
|
||||
return errors.Wrap(err, "failed to update duties")
|
||||
}
|
||||
log.Info("Updated duties due to previous dependent root change")
|
||||
@@ -1173,7 +1170,7 @@ func (v *validator) checkDependentRoots(ctx context.Context, head *structs.HeadE
|
||||
return errors.Wrap(err, "failed to decode current duty dependent root")
|
||||
}
|
||||
if !bytes.Equal(currDepedentRoot, v.duties.CurrDependentRoot) {
|
||||
if err := v.UpdateDuties(slotCtx, currEpochStart); err != nil {
|
||||
if err := v.UpdateDuties(ctx, currEpochStart); err != nil {
|
||||
return errors.Wrap(err, "failed to update duties")
|
||||
}
|
||||
log.Info("Updated duties due to current dependent root change")
|
||||
|
||||
Reference in New Issue
Block a user