mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2024-12-22 03:30:35 +00:00
Improve "synced block.." log (#9760)
This commit is contained in:
parent
65d2df4609
commit
f114a47b5b
@ -55,6 +55,8 @@ func logBlockSyncStatus(block block.BeaconBlock, blockRoot [32]byte, finalized *
|
||||
"epoch": slots.ToEpoch(block.Slot()),
|
||||
"finalizedEpoch": finalized.Epoch,
|
||||
"finalizedRoot": fmt.Sprintf("0x%s...", hex.EncodeToString(finalized.Root)[:8]),
|
||||
"parentRoot": fmt.Sprintf("0x%s...", hex.EncodeToString(block.ParentRoot())[:8]),
|
||||
"version": version.String(block.Version()),
|
||||
}).Info("Synced new block")
|
||||
log.WithFields(logrus.Fields{
|
||||
"slot": block.Slot,
|
||||
|
@ -1,4 +1,4 @@
|
||||
load("@prysm//tools/go:def.bzl", "go_library")
|
||||
load("@prysm//tools/go:def.bzl", "go_library", "go_test")
|
||||
|
||||
go_library(
|
||||
name = "go_default_library",
|
||||
@ -20,3 +20,9 @@ go_library(
|
||||
"@com_github_prometheus_client_golang//prometheus/promauto:go_default_library",
|
||||
],
|
||||
)
|
||||
|
||||
go_test(
|
||||
name = "go_default_test",
|
||||
srcs = ["fork_test.go"],
|
||||
embed = [":go_default_library"],
|
||||
)
|
||||
|
@ -4,3 +4,14 @@ const (
|
||||
Phase0 = iota
|
||||
Altair
|
||||
)
|
||||
|
||||
func String(version int) string {
|
||||
switch version {
|
||||
case Phase0:
|
||||
return "phase0"
|
||||
case Altair:
|
||||
return "altair"
|
||||
default:
|
||||
return "unknown version"
|
||||
}
|
||||
}
|
||||
|
29
runtime/version/fork_test.go
Normal file
29
runtime/version/fork_test.go
Normal file
@ -0,0 +1,29 @@
|
||||
package version
|
||||
|
||||
import "testing"
|
||||
|
||||
func TestVersionString(t *testing.T) {
|
||||
tests := []struct {
|
||||
name string
|
||||
version int
|
||||
want string
|
||||
}{
|
||||
{
|
||||
name: "phase0",
|
||||
version: Phase0,
|
||||
want: "phase0",
|
||||
},
|
||||
{
|
||||
name: "altair",
|
||||
version: Altair,
|
||||
want: "altair",
|
||||
},
|
||||
}
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
if got := String(tt.version); got != tt.want {
|
||||
t.Errorf("String() = %v, want %v", got, tt.want)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user