2020-07-02 17:50:05 +00:00
|
|
|
package client
|
2020-01-02 17:04:07 +00:00
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
2022-06-27 23:01:24 +00:00
|
|
|
"sync/atomic"
|
2020-01-02 17:04:07 +00:00
|
|
|
|
2022-08-16 12:20:13 +00:00
|
|
|
types "github.com/prysmaticlabs/prysm/v3/consensus-types/primitives"
|
|
|
|
"github.com/prysmaticlabs/prysm/v3/encoding/bytesutil"
|
|
|
|
ethpb "github.com/prysmaticlabs/prysm/v3/proto/prysm/v1alpha1"
|
2020-01-02 17:04:07 +00:00
|
|
|
"github.com/sirupsen/logrus"
|
|
|
|
)
|
|
|
|
|
2021-01-11 20:03:28 +00:00
|
|
|
var log = logrus.WithField("prefix", "validator")
|
|
|
|
|
2020-01-02 17:04:07 +00:00
|
|
|
type attSubmitted struct {
|
2020-01-02 23:45:48 +00:00
|
|
|
data *ethpb.AttestationData
|
2021-02-23 00:14:50 +00:00
|
|
|
attesterIndices []types.ValidatorIndex
|
|
|
|
aggregatorIndices []types.ValidatorIndex
|
2020-01-02 17:04:07 +00:00
|
|
|
}
|
|
|
|
|
2021-04-23 12:06:05 +00:00
|
|
|
// LogAttestationsSubmitted logs info about submitted attestations.
|
2020-01-02 17:04:07 +00:00
|
|
|
func (v *validator) LogAttestationsSubmitted() {
|
|
|
|
v.attLogsLock.Lock()
|
|
|
|
defer v.attLogsLock.Unlock()
|
|
|
|
|
|
|
|
for _, attLog := range v.attLogs {
|
|
|
|
log.WithFields(logrus.Fields{
|
2020-01-02 23:45:48 +00:00
|
|
|
"Slot": attLog.data.Slot,
|
|
|
|
"CommitteeIndex": attLog.data.CommitteeIndex,
|
|
|
|
"BeaconBlockRoot": fmt.Sprintf("%#x", bytesutil.Trunc(attLog.data.BeaconBlockRoot)),
|
|
|
|
"SourceEpoch": attLog.data.Source.Epoch,
|
|
|
|
"SourceRoot": fmt.Sprintf("%#x", bytesutil.Trunc(attLog.data.Source.Root)),
|
|
|
|
"TargetEpoch": attLog.data.Target.Epoch,
|
|
|
|
"TargetRoot": fmt.Sprintf("%#x", bytesutil.Trunc(attLog.data.Target.Root)),
|
|
|
|
"AttesterIndices": attLog.attesterIndices,
|
|
|
|
"AggregatorIndices": attLog.aggregatorIndices,
|
|
|
|
}).Info("Submitted new attestations")
|
2020-01-02 17:04:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
v.attLogs = make(map[[32]byte]*attSubmitted)
|
|
|
|
}
|
2020-12-10 18:56:18 +00:00
|
|
|
|
2022-06-27 23:01:24 +00:00
|
|
|
// LogSyncCommitteeMessagesSubmitted logs info about submitted sync committee messages.
|
|
|
|
func (v *validator) LogSyncCommitteeMessagesSubmitted() {
|
|
|
|
log.WithField("messages", v.syncCommitteeStats.totalMessagesSubmitted).Debug("Submitted sync committee messages successfully to beacon node")
|
|
|
|
// Reset the amount.
|
|
|
|
atomic.StoreUint64(&v.syncCommitteeStats.totalMessagesSubmitted, 0)
|
|
|
|
}
|