attempting to add some more flakey tolarance

This commit is contained in:
james-prysm
2026-01-04 22:05:21 -06:00
parent a5f0c6ea06
commit 3df4a868cf
2 changed files with 26 additions and 13 deletions

View File

@@ -117,7 +117,10 @@ func metricsTest(_ *types.EvaluationContext, conns ...*grpc.ClientConn) error {
return err
}
timeSlot := slots.CurrentSlot(genesisResp.GenesisTime.AsTime())
if uint64(chainHead.HeadSlot) != uint64(timeSlot) {
// Allow 1 slot tolerance due to race between calculating current slot
// and fetching chain head - a slot boundary may occur between these calls.
slotDiff := int64(timeSlot) - int64(chainHead.HeadSlot)
if slotDiff < 0 || slotDiff > 1 {
return fmt.Errorf("expected metrics slot to equal chain head slot, expected %d, received %d", timeSlot, chainHead.HeadSlot)
}

View File

@@ -26,7 +26,7 @@ import (
"google.golang.org/protobuf/types/known/emptypb"
)
var expectedParticipation = 0.99
var expectedParticipation = 0.98
var expectedMulticlientParticipation = 0.95
@@ -310,20 +310,30 @@ func validatorsSyncParticipation(_ *types.EvaluationContext, conns ...*grpc.Clie
if b == nil || b.IsNil() {
return errors.New("nil block provided")
}
forkSlot, err := slots.EpochStart(params.BeaconConfig().AltairForkEpoch)
if err != nil {
return err
// Skip evaluation of fork transition slots as sync participation
// tends to drop briefly when transitioning between forks.
forkEpochs := []primitives.Epoch{
params.BeaconConfig().AltairForkEpoch,
params.BeaconConfig().BellatrixForkEpoch,
params.BeaconConfig().CapellaForkEpoch,
params.BeaconConfig().DenebForkEpoch,
params.BeaconConfig().ElectraForkEpoch,
params.BeaconConfig().FuluForkEpoch,
}
nexForkSlot, err := slots.EpochStart(params.BeaconConfig().BellatrixForkEpoch)
if err != nil {
return err
skipSlot := false
for _, forkEpoch := range forkEpochs {
forkSlot, err := slots.EpochStart(forkEpoch)
if err != nil {
return err
}
// Skip the first two slots of each fork epoch.
if b.Block().Slot() == forkSlot || b.Block().Slot() == forkSlot+1 {
skipSlot = true
break
}
}
switch b.Block().Slot() {
case forkSlot, forkSlot + 1, nexForkSlot:
// Skip evaluation of the slot.
if skipSlot {
continue
default:
// no-op
}
syncAgg, err := b.Block().Body().SyncAggregate()
if err != nil {