More tracing in the validator client (#14125)

* More tracing in the validator client

* change context expectation in tests
This commit is contained in:
Radosław Kapka
2024-06-20 18:13:53 +02:00
committed by GitHub
parent ae451a3a02
commit df3a9f218d
47 changed files with 354 additions and 185 deletions

View File

@@ -329,6 +329,9 @@ func CreateSignedVoluntaryExit(
// Sign randao reveal with randao domain and private key.
func (v *validator) signRandaoReveal(ctx context.Context, pubKey [fieldparams.BLSPubkeyLength]byte, epoch primitives.Epoch, slot primitives.Slot) ([]byte, error) {
ctx, span := trace.StartSpan(ctx, "validator.signRandaoReveal")
defer span.End()
domain, err := v.domainData(ctx, epoch, params.BeaconConfig().DomainRandao[:])
if err != nil {
return nil, errors.Wrap(err, domainDataErr)
@@ -359,6 +362,9 @@ func (v *validator) signRandaoReveal(ctx context.Context, pubKey [fieldparams.BL
// Sign block with proposer domain and private key.
// Returns the signature, block signing root, and any error.
func (v *validator) signBlock(ctx context.Context, pubKey [fieldparams.BLSPubkeyLength]byte, epoch primitives.Epoch, slot primitives.Slot, b interfaces.ReadOnlyBeaconBlock) ([]byte, [32]byte, error) {
ctx, span := trace.StartSpan(ctx, "validator.signBlock")
defer span.End()
domain, err := v.domainData(ctx, epoch, params.BeaconConfig().DomainBeaconProposer[:])
if err != nil {
return nil, [32]byte{}, errors.Wrap(err, domainDataErr)
@@ -397,6 +403,9 @@ func signVoluntaryExit(
exit *ethpb.VoluntaryExit,
slot primitives.Slot,
) ([]byte, error) {
ctx, span := trace.StartSpan(ctx, "validator.signVoluntaryExit")
defer span.End()
req := &ethpb.DomainRequest{
Epoch: exit.Epoch,
Domain: params.BeaconConfig().DomainVoluntaryExit[:],
@@ -430,6 +439,9 @@ func signVoluntaryExit(
// Graffiti gets the graffiti from cli or file for the validator public key.
func (v *validator) Graffiti(ctx context.Context, pubKey [fieldparams.BLSPubkeyLength]byte) ([]byte, error) {
ctx, span := trace.StartSpan(ctx, "validator.Graffiti")
defer span.End()
if v.proposerSettings != nil {
// Check proposer settings for specific key first
if v.proposerSettings.ProposeConfig != nil {
@@ -493,6 +505,9 @@ func (v *validator) Graffiti(ctx context.Context, pubKey [fieldparams.BLSPubkeyL
}
func (v *validator) SetGraffiti(ctx context.Context, pubkey [fieldparams.BLSPubkeyLength]byte, graffiti []byte) error {
ctx, span := trace.StartSpan(ctx, "validator.SetGraffiti")
defer span.End()
if graffiti == nil {
return nil
}
@@ -518,6 +533,9 @@ func (v *validator) SetGraffiti(ctx context.Context, pubkey [fieldparams.BLSPubk
}
func (v *validator) DeleteGraffiti(ctx context.Context, pubKey [fieldparams.BLSPubkeyLength]byte) error {
ctx, span := trace.StartSpan(ctx, "validator.DeleteGraffiti")
defer span.End()
if v.proposerSettings == nil || v.proposerSettings.ProposeConfig == nil {
return errors.New("attempted to delete graffiti without proposer settings, graffiti will default to flag options")
}