Use independent context when updating domain data (#15268)

* Use independent context when updating domain data

* Terence's review

* don't cancel immediately

* fix e2e panic

* add new context for roles
This commit is contained in:
Potuz
2025-05-19 13:14:03 -03:00
committed by GitHub
parent 5bbcfe5237
commit 17204ca817
3 changed files with 14 additions and 3 deletions

View File

@@ -0,0 +1,3 @@
### Ignored
- Use independent context for domain data calculation.

View File

@@ -72,7 +72,11 @@ func feeRecipientIsPresent(_ *types.EvaluationContext, conns ...*grpc.ClientConn
if err != nil {
return errors.Wrap(err, "failed to get chain head")
}
req := &ethpb.ListBlocksRequest{QueryFilter: &ethpb.ListBlocksRequest_Epoch{Epoch: chainHead.HeadEpoch.Sub(1)}}
epoch := chainHead.HeadEpoch
if epoch > 0 {
epoch--
}
req := &ethpb.ListBlocksRequest{QueryFilter: &ethpb.ListBlocksRequest_Epoch{Epoch: epoch}}
blks, err := client.ListBeaconBlocks(context.Background(), req)
if err != nil {
return errors.Wrap(err, "failed to list blocks")

View File

@@ -119,7 +119,8 @@ func run(ctx context.Context, v iface.Validator) {
// Start fetching domain data for the next epoch.
if slots.IsEpochEnd(slot) {
go v.UpdateDomainDataCaches(slotCtx, slot+1)
domainCtx, _ := context.WithDeadline(ctx, deadline)
go v.UpdateDomainDataCaches(domainCtx, slot+1)
}
var wg sync.WaitGroup
@@ -131,7 +132,10 @@ func run(ctx context.Context, v iface.Validator) {
cancel()
continue
}
performRoles(slotCtx, allRoles, v, slot, &wg, span)
cancel()
// performRoles calls span.End()
rolesCtx, _ := context.WithDeadline(ctx, deadline)
performRoles(rolesCtx, allRoles, v, slot, &wg, span)
case isHealthyAgain := <-healthTracker.HealthUpdates():
if isHealthyAgain {
headSlot, err = initializeValidatorAndGetHeadSlot(ctx, v)