Skip to content

Commit

Permalink
Validator: Annotate attestation error spans (#8451)
Browse files Browse the repository at this point in the history
* Annotate attestation spans

* Annotate attestation spans

* gaz

Co-authored-by: Raul Jordan <raul@prysmaticlabs.com>
Co-authored-by: prylabs-bulldozer[bot] <58059840+prylabs-bulldozer[bot]@users.noreply.github.com>
  • Loading branch information
3 people authored Feb 16, 2021
1 parent a069738 commit 558b162
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 0 deletions.
9 changes: 9 additions & 0 deletions validator/client/attest.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,13 @@ func (v *validator) SubmitAttestation(ctx context.Context, slot types.Slot, pubK
var b strings.Builder
if err := b.WriteByte(byte(roleAttester)); err != nil {
log.WithError(err).Error("Could not write role byte for lock key")
traceutil.AnnotateError(span, err)
return
}
_, err := b.Write(pubKey[:])
if err != nil {
log.WithError(err).Error("Could not write pubkey bytes for lock key")
traceutil.AnnotateError(span, err)
return
}
lock := mputil.NewMultilock(b.String())
Expand All @@ -58,6 +60,7 @@ func (v *validator) SubmitAttestation(ctx context.Context, slot types.Slot, pubK
if v.emitAccountMetrics {
ValidatorAttestFailVec.WithLabelValues(fmtKey).Inc()
}
traceutil.AnnotateError(span, err)
return
}
if len(duty.Committee) == 0 {
Expand All @@ -75,6 +78,7 @@ func (v *validator) SubmitAttestation(ctx context.Context, slot types.Slot, pubK
if v.emitAccountMetrics {
ValidatorAttestFailVec.WithLabelValues(fmtKey).Inc()
}
traceutil.AnnotateError(span, err)
return
}

Expand All @@ -89,6 +93,7 @@ func (v *validator) SubmitAttestation(ctx context.Context, slot types.Slot, pubK
if v.emitAccountMetrics {
ValidatorAttestFailVec.WithLabelValues(fmtKey).Inc()
}
traceutil.AnnotateError(span, err)
return
}

Expand All @@ -98,6 +103,7 @@ func (v *validator) SubmitAttestation(ctx context.Context, slot types.Slot, pubK
if v.emitAccountMetrics {
ValidatorAttestFailVec.WithLabelValues(fmtKey).Inc()
}
traceutil.AnnotateError(span, err)
return
}

Expand Down Expand Up @@ -133,6 +139,7 @@ func (v *validator) SubmitAttestation(ctx context.Context, slot types.Slot, pubK
log.WithFields(
attestationLogFields(pubKey, indexedAtt),
).Debug("Attempted slashable attestation details")
traceutil.AnnotateError(span, err)
return
}
attResp, err := v.validatorClient.ProposeAttestation(ctx, attestation)
Expand All @@ -141,6 +148,7 @@ func (v *validator) SubmitAttestation(ctx context.Context, slot types.Slot, pubK
if v.emitAccountMetrics {
ValidatorAttestFailVec.WithLabelValues(fmtKey).Inc()
}
traceutil.AnnotateError(span, err)
return
}

Expand All @@ -149,6 +157,7 @@ func (v *validator) SubmitAttestation(ctx context.Context, slot types.Slot, pubK
if v.emitAccountMetrics {
ValidatorAttestFailVec.WithLabelValues(fmtKey).Inc()
}
traceutil.AnnotateError(span, err)
return
}

Expand Down
1 change: 1 addition & 0 deletions validator/db/kv/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ go_library(
"//shared/params:go_default_library",
"//shared/progressutil:go_default_library",
"//shared/slashutil:go_default_library",
"//shared/traceutil:go_default_library",
"@com_github_pkg_errors//:go_default_library",
"@com_github_prometheus_client_golang//prometheus:go_default_library",
"@com_github_prysmaticlabs_eth2_types//:go_default_library",
Expand Down
3 changes: 3 additions & 0 deletions validator/db/kv/attester_protection.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
ethpb "github.com/prysmaticlabs/ethereumapis/eth/v1alpha1"
"github.com/prysmaticlabs/prysm/shared/bytesutil"
"github.com/prysmaticlabs/prysm/shared/slashutil"
"github.com/prysmaticlabs/prysm/shared/traceutil"
bolt "go.etcd.io/bbolt"
"go.opencensus.io/trace"
)
Expand Down Expand Up @@ -215,6 +216,8 @@ func (s *Store) CheckSlashableAttestation(
return nil
})
})

traceutil.AnnotateError(span, err)
return slashKind, err
}

Expand Down

0 comments on commit 558b162

Please sign in to comment.