Handle HTTP 404 Not Found in SubmitAggregateAndProof (#13320)

Co-authored-by: james-prysm <90280386+james-prysm@users.noreply.github.com>
This commit is contained in:
Radosław Kapka
2023-12-12 20:46:19 +01:00
committed by GitHub
parent ce7452c97a
commit 8387088a52
2 changed files with 12 additions and 2 deletions

View File

@@ -3,14 +3,17 @@ package client
import (
"context"
"fmt"
"net/http"
"time"
"github.com/pkg/errors"
"github.com/prysmaticlabs/prysm/v4/beacon-chain/core/signing"
fieldparams "github.com/prysmaticlabs/prysm/v4/config/fieldparams"
"github.com/prysmaticlabs/prysm/v4/config/params"
"github.com/prysmaticlabs/prysm/v4/consensus-types/primitives"
"github.com/prysmaticlabs/prysm/v4/crypto/bls"
"github.com/prysmaticlabs/prysm/v4/monitoring/tracing"
"github.com/prysmaticlabs/prysm/v4/network/httputil"
ethpb "github.com/prysmaticlabs/prysm/v4/proto/prysm/v1alpha1"
validatorpb "github.com/prysmaticlabs/prysm/v4/proto/prysm/v1alpha1/validator-client"
prysmTime "github.com/prysmaticlabs/prysm/v4/time"
@@ -71,11 +74,17 @@ func (v *validator) SubmitAggregateAndProof(ctx context.Context, slot primitives
SlotSignature: slotSig,
})
if err != nil {
// handle grpc not found
s, ok := status.FromError(err)
if ok && s.Code() == codes.NotFound {
grpcNotFound := ok && s.Code() == codes.NotFound
// handle http not found
jsonErr := &httputil.DefaultErrorJson{}
httpNotFound := errors.As(err, &jsonErr) && jsonErr.Code == http.StatusNotFound
if grpcNotFound || httpNotFound {
log.WithField("slot", slot).WithError(err).Warn("No attestations to aggregate")
} else {
log.WithField("slot", slot).WithError(err).Error("Could not submit slot signature to beacon node")
log.WithField("slot", slot).WithError(err).Error("Could not submit aggregate selection proof to beacon node")
if v.emitAccountMetrics {
ValidatorAggFailVec.WithLabelValues(fmtKey).Inc()
}