Skip to content

Commit

Permalink
Merge refs/heads/develop into new-holesky-genesis
Browse files Browse the repository at this point in the history
  • Loading branch information
prylabs-bulldozer[bot] authored Sep 23, 2023
2 parents 11e46fb + 9a2c247 commit 4802221
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 2 deletions.
5 changes: 5 additions & 0 deletions beacon-chain/db/kv/genesis.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package kv

import (
"context"
"fmt"

"github.com/pkg/errors"
"github.com/prysmaticlabs/prysm/v4/beacon-chain/core/blocks"
Expand Down Expand Up @@ -45,6 +46,10 @@ func (s *Store) SaveGenesisData(ctx context.Context, genesisState state.BeaconSt

// LoadGenesis loads a genesis state from a ssz-serialized byte slice, if no genesis exists already.
func (s *Store) LoadGenesis(ctx context.Context, sb []byte) error {
if len(sb) < (1 << 10) {
log.WithField("size", fmt.Sprintf("%d bytes", len(sb))).
Warn("Genesis state is smaller than one 1Kb. This could be an empty file, git lfs metadata file, or corrupt genesis state.")
}
vu, err := detect.FromState(sb)
if err != nil {
return err
Expand Down
2 changes: 2 additions & 0 deletions beacon-chain/sync/genesis/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,14 @@ go_library(
srcs = [
"api.go",
"file.go",
"log.go",
],
importpath = "github.com/prysmaticlabs/prysm/v4/beacon-chain/sync/genesis",
visibility = ["//visibility:public"],
deps = [
"//api/client/beacon:go_default_library",
"//beacon-chain/db:go_default_library",
"//crypto/hash:go_default_library",
"//io/file:go_default_library",
"@com_github_pkg_errors//:go_default_library",
"@com_github_sirupsen_logrus//:go_default_library",
Expand Down
2 changes: 0 additions & 2 deletions beacon-chain/sync/genesis/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ package genesis
import (
"context"

log "github.com/sirupsen/logrus"

"github.com/pkg/errors"
"github.com/prysmaticlabs/prysm/v4/api/client/beacon"
"github.com/prysmaticlabs/prysm/v4/beacon-chain/db"
Expand Down
4 changes: 4 additions & 0 deletions beacon-chain/sync/genesis/file.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"fmt"
"os"

"github.com/prysmaticlabs/prysm/v4/crypto/hash"
"github.com/prysmaticlabs/prysm/v4/io/file"

"github.com/pkg/errors"
Expand Down Expand Up @@ -42,6 +43,9 @@ func (fi *FileInitializer) Initialize(ctx context.Context, d db.Database) error
if err != nil {
return errors.Wrapf(err, "error reading state file %s for checkpoint sync init", fi.statePath)
}
log.WithField(
"hash", fmt.Sprintf("%#x", hash.FastSum256(serState)),
).Info("Loading genesis state from disk.")
return d.LoadGenesis(ctx, serState)
}

Expand Down
5 changes: 5 additions & 0 deletions beacon-chain/sync/genesis/log.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package genesis

import "github.com/sirupsen/logrus"

var log = logrus.WithField("prefix", "genesis")

0 comments on commit 4802221

Please sign in to comment.