mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2024-12-22 03:30:35 +00:00
Add Back Error/Debug Logs (#7922)
* add back logs * add back string * Reformat loggings Co-authored-by: Terence Tsao <terence@prysmaticlabs.com> Co-authored-by: Preston Van Loon <preston@prysmaticlabs.com>
This commit is contained in:
parent
4c0db8bca4
commit
8c3faaa4c7
@ -98,7 +98,7 @@ func (l *limiter) add(stream network.Stream, amt int64) {
|
||||
|
||||
collector, err := l.retrieveCollector(topic)
|
||||
if err != nil {
|
||||
log.Debugf("collector with topic '%s' does not exist", topic)
|
||||
log.Errorf("collector with topic '%s' does not exist", topic)
|
||||
return
|
||||
}
|
||||
key := stream.Conn().RemotePeer().String()
|
||||
|
@ -86,7 +86,7 @@ func (s *Service) registerRPC(baseTopic string, handle rpcHandler) {
|
||||
|
||||
base, ok := p2p.RPCTopicMappings[baseTopic]
|
||||
if !ok {
|
||||
log.Debugf("Could not retrieve base message for topic %s", baseTopic)
|
||||
log.Errorf("Could not retrieve base message for topic %s", baseTopic)
|
||||
return
|
||||
}
|
||||
t := reflect.TypeOf(base)
|
||||
|
@ -254,7 +254,7 @@ func (s *Service) registerHandlers() {
|
||||
case statefeed.Initialized:
|
||||
data, ok := event.Data.(*statefeed.InitializedData)
|
||||
if !ok {
|
||||
log.Debug("Event feed data is not type *statefeed.InitializedData")
|
||||
log.Error("Event feed data is not type *statefeed.InitializedData")
|
||||
return
|
||||
}
|
||||
startTime := data.StartTime
|
||||
@ -273,7 +273,7 @@ func (s *Service) registerHandlers() {
|
||||
case statefeed.Synced:
|
||||
_, ok := event.Data.(*statefeed.SyncedData)
|
||||
if !ok {
|
||||
log.Debug("Event feed data is not type *statefeed.SyncedData")
|
||||
log.Error("Event feed data is not type *statefeed.SyncedData")
|
||||
return
|
||||
}
|
||||
// Register respective pubsub handlers at state synced event.
|
||||
|
@ -3,6 +3,7 @@ package sync
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
"github.com/libp2p/go-libp2p-core/peer"
|
||||
@ -50,10 +51,12 @@ func (s *Service) validateBeaconBlockPubSub(ctx context.Context, pid peer.ID, ms
|
||||
|
||||
blk, ok := m.(*ethpb.SignedBeaconBlock)
|
||||
if !ok {
|
||||
log.WithError(errors.New("msg is not ethpb.SignedBeaconBlock")).Debug("Rejected block")
|
||||
return pubsub.ValidationReject
|
||||
}
|
||||
|
||||
if blk.Block == nil {
|
||||
log.WithError(errors.New("block.Block is nil")).Debug("Rejected block")
|
||||
return pubsub.ValidationReject
|
||||
}
|
||||
|
||||
@ -73,6 +76,7 @@ func (s *Service) validateBeaconBlockPubSub(ctx context.Context, pid peer.ID, ms
|
||||
|
||||
blockRoot, err := blk.Block.HashTreeRoot()
|
||||
if err != nil {
|
||||
log.WithError(err).WithField("blockSlot", blk.Block.Slot).Debug("Ignored block")
|
||||
return pubsub.ValidationIgnore
|
||||
}
|
||||
if s.db.HasBlock(ctx, blockRoot) {
|
||||
@ -81,6 +85,8 @@ func (s *Service) validateBeaconBlockPubSub(ctx context.Context, pid peer.ID, ms
|
||||
// Check if parent is a bad block and then reject the block.
|
||||
if s.hasBadBlock(bytesutil.ToBytes32(blk.Block.ParentRoot)) {
|
||||
s.setBadBlock(ctx, blockRoot)
|
||||
e := fmt.Errorf("received block with root %#x that has an invalid parent %#x", blockRoot, blk.Block.ParentRoot)
|
||||
log.WithError(e).WithField("blockSlot", blk.Block.Slot).Debug("Rejected block")
|
||||
return pubsub.ValidationReject
|
||||
}
|
||||
|
||||
@ -92,19 +98,24 @@ func (s *Service) validateBeaconBlockPubSub(ctx context.Context, pid peer.ID, ms
|
||||
s.pendingQueueLock.RUnlock()
|
||||
|
||||
if err := helpers.VerifySlotTime(uint64(s.chain.GenesisTime().Unix()), blk.Block.Slot, params.BeaconNetworkConfig().MaximumGossipClockDisparity); err != nil {
|
||||
log.WithError(err).WithField("blockSlot", blk.Block.Slot).Debug("Ignored block")
|
||||
return pubsub.ValidationIgnore
|
||||
}
|
||||
|
||||
// Add metrics for block arrival time subtracts slot start time.
|
||||
if captureArrivalTimeMetric(uint64(s.chain.GenesisTime().Unix()), blk.Block.Slot) != nil {
|
||||
if err := captureArrivalTimeMetric(uint64(s.chain.GenesisTime().Unix()), blk.Block.Slot); err != nil {
|
||||
log.WithError(err).WithField("blockSlot", blk.Block.Slot).Debug("Ignored block")
|
||||
return pubsub.ValidationIgnore
|
||||
}
|
||||
|
||||
startSlot, err := helpers.StartSlot(s.chain.FinalizedCheckpt().Epoch)
|
||||
if err != nil {
|
||||
log.WithError(err).WithField("blockSlot", blk.Block.Slot).Debug("Ignored block")
|
||||
return pubsub.ValidationIgnore
|
||||
}
|
||||
if startSlot >= blk.Block.Slot {
|
||||
e := fmt.Errorf("finalized slot %d greater or equal to block slot %d", startSlot, blk.Block.Slot)
|
||||
log.WithError(e).WithField("blockSlot", blk.Block.Slot).Debug("Ignored block")
|
||||
return pubsub.ValidationIgnore
|
||||
}
|
||||
|
||||
@ -112,14 +123,16 @@ func (s *Service) validateBeaconBlockPubSub(ctx context.Context, pid peer.ID, ms
|
||||
if !s.db.HasBlock(ctx, bytesutil.ToBytes32(blk.Block.ParentRoot)) {
|
||||
s.pendingQueueLock.Lock()
|
||||
if err := s.insertBlockToPendingQueue(blk.Block.Slot, blk, blockRoot); err != nil {
|
||||
log.WithError(err).WithField("blockSlot", blk.Block.Slot).Debug("Ignored block")
|
||||
return pubsub.ValidationIgnore
|
||||
}
|
||||
s.pendingQueueLock.Unlock()
|
||||
log.WithError(errors.New("unknown parent")).WithField("blockSlot", blk.Block.Slot).Debug("Ignored block")
|
||||
return pubsub.ValidationIgnore
|
||||
}
|
||||
|
||||
if err := s.validateBeaconBlock(ctx, blk, blockRoot); err != nil {
|
||||
log.WithError(err).WithField("blockSlot", blk.Block.Slot).Warn("Could not validate beacon block")
|
||||
log.WithError(err).WithField("blockSlot", blk.Block.Slot).Warn("Rejected block")
|
||||
return pubsub.ValidationReject
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user