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
|
|
|
|
2023-03-17 18:52:56 +00:00
|
|
|
"github.com/prysmaticlabs/prysm/v4/consensus-types/primitives"
|
|
|
|
"github.com/prysmaticlabs/prysm/v4/encoding/bytesutil"
|
|
|
|
ethpb "github.com/prysmaticlabs/prysm/v4/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
|
2023-01-26 14:40:12 +00:00
|
|
|
attesterIndices []primitives.ValidatorIndex
|
|
|
|
aggregatorIndices []primitives.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)
|
|
|
|
}
|