Skip to content

Commit

Permalink
adds a metric to track blob sig cache lookups (#13755)
Browse files Browse the repository at this point in the history
Co-authored-by: Kasey Kirkham <kasey@users.noreply.github.com>
  • Loading branch information
kasey and kasey authored Mar 16, 2024
1 parent 2de21eb commit d76f55e
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 0 deletions.
3 changes: 3 additions & 0 deletions beacon-chain/verification/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ go_library(
"fake.go",
"initializer.go",
"interface.go",
"metrics.go",
"mock.go",
"result.go",
],
Expand All @@ -35,6 +36,8 @@ go_library(
"//time/slots:go_default_library",
"@com_github_hashicorp_golang_lru//:go_default_library",
"@com_github_pkg_errors//:go_default_library",
"@com_github_prometheus_client_golang//prometheus:go_default_library",
"@com_github_prometheus_client_golang//prometheus/promauto:go_default_library",
"@com_github_sirupsen_logrus//:go_default_library",
],
)
Expand Down
3 changes: 3 additions & 0 deletions beacon-chain/verification/blob.go
Original file line number Diff line number Diff line change
Expand Up @@ -190,12 +190,15 @@ func (bv *ROBlobVerifier) ValidProposerSignature(ctx context.Context) (err error
// First check if there is a cached verification that can be reused.
seen, err := bv.sc.SignatureVerified(sd)
if seen {
blobVerifiationProposerSignatureCache.WithLabelValues("hit-valid").Inc()
if err != nil {
log.WithFields(logging.BlobFields(bv.blob)).WithError(err).Debug("reusing failed proposer signature validation from cache")
blobVerifiationProposerSignatureCache.WithLabelValues("hit-invalid").Inc()
return ErrInvalidProposerSignature
}
return nil
}
blobVerifiationProposerSignatureCache.WithLabelValues("miss").Inc()

// Retrieve the parent state to fallback to full verification.
parent, err := bv.parentState(ctx)
Expand Down
16 changes: 16 additions & 0 deletions beacon-chain/verification/metrics.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package verification

import (
"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/client_golang/prometheus/promauto"
)

var (
blobVerifiationProposerSignatureCache = promauto.NewCounterVec(
prometheus.CounterOpts{
Name: "blob_verification_proposer_signature_cache",
Help: "BlobSidecar proposer signature cache result.",
},
[]string{"result"},
)
)

0 comments on commit d76f55e

Please sign in to comment.