mirror of
https://github.com/OffchainLabs/prysm.git
synced 2026-01-07 22:54:17 -05:00
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:
3
changelog/potuz_domain_data_context.md
Normal file
3
changelog/potuz_domain_data_context.md
Normal file
@@ -0,0 +1,3 @@
|
||||
### Ignored
|
||||
|
||||
- Use independent context for domain data calculation.
|
||||
@@ -72,7 +72,11 @@ func feeRecipientIsPresent(_ *types.EvaluationContext, conns ...*grpc.ClientConn
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "failed to get chain head")
|
||||
}
|
||||
req := ðpb.ListBlocksRequest{QueryFilter: ðpb.ListBlocksRequest_Epoch{Epoch: chainHead.HeadEpoch.Sub(1)}}
|
||||
epoch := chainHead.HeadEpoch
|
||||
if epoch > 0 {
|
||||
epoch--
|
||||
}
|
||||
req := ðpb.ListBlocksRequest{QueryFilter: ðpb.ListBlocksRequest_Epoch{Epoch: epoch}}
|
||||
blks, err := client.ListBeaconBlocks(context.Background(), req)
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "failed to list blocks")
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user