mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2024-12-25 04:47:18 +00:00
Add Spans for Validator DB Methods (#8390)
Co-authored-by: prylabs-bulldozer[bot] <58059840+prylabs-bulldozer[bot]@users.noreply.github.com>
This commit is contained in:
parent
c5551ebebb
commit
afa5b5e790
@ -52,6 +52,8 @@ var (
|
||||
// we have stored in the database for the given validator public key.
|
||||
func (s *Store) AttestationHistoryForPubKey(ctx context.Context, pubKey [48]byte) ([]*AttestationRecord, error) {
|
||||
records := make([]*AttestationRecord, 0)
|
||||
ctx, span := trace.StartSpan(ctx, "Validator.AttestationHistoryForPubKey")
|
||||
defer span.End()
|
||||
err := s.view(func(tx *bolt.Tx) error {
|
||||
bucket := tx.Bucket(pubKeysBucket)
|
||||
pkBucket := bucket.Bucket(pubKey[:])
|
||||
@ -90,6 +92,8 @@ func (s *Store) AttestationHistoryForPubKey(ctx context.Context, pubKey [48]byte
|
||||
func (s *Store) CheckSlashableAttestation(
|
||||
ctx context.Context, pubKey [48]byte, signingRoot [32]byte, att *ethpb.IndexedAttestation,
|
||||
) (SlashingKind, error) {
|
||||
ctx, span := trace.StartSpan(ctx, "Validator.CheckSlashableAttestation")
|
||||
defer span.End()
|
||||
var slashKind SlashingKind
|
||||
err := s.view(func(tx *bolt.Tx) error {
|
||||
bucket := tx.Bucket(pubKeysBucket)
|
||||
@ -170,6 +174,8 @@ func (s *Store) CheckSlashableAttestation(
|
||||
func (s *Store) SaveAttestationsForPubKey(
|
||||
ctx context.Context, pubKey [48]byte, signingRoots [][32]byte, atts []*ethpb.IndexedAttestation,
|
||||
) error {
|
||||
ctx, span := trace.StartSpan(ctx, "Validator.SaveAttestationsForPubKey")
|
||||
defer span.End()
|
||||
if len(signingRoots) != len(atts) {
|
||||
return fmt.Errorf(
|
||||
"number of signing roots %d does not match number of attestations %d",
|
||||
@ -194,6 +200,8 @@ func (s *Store) SaveAttestationsForPubKey(
|
||||
func (s *Store) SaveAttestationForPubKey(
|
||||
ctx context.Context, pubKey [48]byte, signingRoot [32]byte, att *ethpb.IndexedAttestation,
|
||||
) error {
|
||||
ctx, span := trace.StartSpan(ctx, "Validator.SaveAttestationForPubKey")
|
||||
defer span.End()
|
||||
s.batchedAttestationsChan <- &AttestationRecord{
|
||||
PubKey: pubKey,
|
||||
Source: att.Data.Source.Epoch,
|
||||
|
@ -3,10 +3,10 @@ package kv
|
||||
import (
|
||||
"context"
|
||||
|
||||
bolt "go.etcd.io/bbolt"
|
||||
|
||||
"github.com/prysmaticlabs/prysm/shared/bytesutil"
|
||||
"github.com/prysmaticlabs/prysm/shared/params"
|
||||
bolt "go.etcd.io/bbolt"
|
||||
"go.opencensus.io/trace"
|
||||
)
|
||||
|
||||
// PruneAttestationsOlderThanCurrentWeakSubjectivity loops through every
|
||||
@ -14,6 +14,8 @@ import (
|
||||
// that has target epochs older than the highest weak subjectivity period
|
||||
// in our database. This routine is meant to run on startup.
|
||||
func (s *Store) PruneAttestationsOlderThanCurrentWeakSubjectivity(ctx context.Context) error {
|
||||
ctx, span := trace.StartSpan(ctx, "Validator.PruneAttestationsOlderThanCurrentWeakSubjectivity")
|
||||
defer span.End()
|
||||
return s.update(func(tx *bolt.Tx) error {
|
||||
bucket := tx.Bucket(pubKeysBucket)
|
||||
return bucket.ForEach(func(pubKey []byte, _ []byte) error {
|
||||
|
Loading…
Reference in New Issue
Block a user