mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2024-12-26 13:18:57 +00:00
dca93ce641
* analyzer with tests * fix bazel file * modify analyzer to fix build issues * add analyzer to tool chain * remove arrays from inspections * fix redundant [:] operator * Merge branch 'master' into use-slice-directly * Merge branch 'master' into use-slice-directly * fix another inspection * add package-level comment
36 lines
1.2 KiB
Go
36 lines
1.2 KiB
Go
package blockchain
|
|
|
|
import (
|
|
"encoding/hex"
|
|
"fmt"
|
|
|
|
ethpb "github.com/prysmaticlabs/ethereumapis/eth/v1alpha1"
|
|
"github.com/prysmaticlabs/prysm/beacon-chain/core/helpers"
|
|
"github.com/prysmaticlabs/prysm/shared/params"
|
|
"github.com/sirupsen/logrus"
|
|
)
|
|
|
|
var log = logrus.WithField("prefix", "blockchain")
|
|
|
|
// logs state transition related data every slot.
|
|
func logStateTransitionData(b *ethpb.BeaconBlock) {
|
|
log.WithFields(logrus.Fields{
|
|
"attestations": len(b.Body.Attestations),
|
|
"deposits": len(b.Body.Deposits),
|
|
"attesterSlashings": len(b.Body.AttesterSlashings),
|
|
"proposerSlashings": len(b.Body.ProposerSlashings),
|
|
"voluntaryExits": len(b.Body.VoluntaryExits),
|
|
}).Info("Finished applying state transition")
|
|
}
|
|
|
|
func logBlockSyncStatus(block *ethpb.BeaconBlock, blockRoot [32]byte, finalized *ethpb.Checkpoint) {
|
|
log.WithFields(logrus.Fields{
|
|
"slot": block.Slot,
|
|
"slotInEpoch": block.Slot % params.BeaconConfig().SlotsPerEpoch,
|
|
"block": fmt.Sprintf("0x%s...", hex.EncodeToString(blockRoot[:])[:8]),
|
|
"epoch": helpers.SlotToEpoch(block.Slot),
|
|
"finalizedEpoch": finalized.Epoch,
|
|
"finalizedRoot": fmt.Sprintf("0x%s...", hex.EncodeToString(finalized.Root)[:8]),
|
|
}).Info("Synced new block")
|
|
}
|