Compare commits

...

2 Commits

Author SHA1 Message Date
nisdas
ef92530045 Logging 2024-11-04 13:15:42 +08:00
nisdas
7879732c55 Hack 2024-11-04 13:12:35 +08:00
4 changed files with 13 additions and 2 deletions

View File

@@ -139,6 +139,7 @@ func (s *Store) SaveStates(ctx context.Context, states []state.ReadOnlyBeaconSta
}
multipleEncs[i] = stateBytes
}
log.Infof("Total serialization: %s", time.Since(startTime).String())
if err := s.db.Update(func(tx *bolt.Tx) error {
bucket := tx.Bucket(stateBucket)

View File

@@ -82,6 +82,7 @@ go_library(
"@com_github_prometheus_client_golang//prometheus/promauto:go_default_library",
"@com_github_prysmaticlabs_fastssz//:go_default_library",
"@com_github_prysmaticlabs_go_bitfield//:go_default_library",
"@com_github_sirupsen_logrus//:go_default_library",
"@org_golang_google_protobuf//proto:go_default_library",
],
)

View File

@@ -1,12 +1,15 @@
package state_native
import (
"time"
"github.com/pkg/errors"
customtypes "github.com/prysmaticlabs/prysm/v5/beacon-chain/state/state-native/custom-types"
"github.com/prysmaticlabs/prysm/v5/config/features"
consensus_types "github.com/prysmaticlabs/prysm/v5/consensus-types"
ethpb "github.com/prysmaticlabs/prysm/v5/proto/prysm/v1alpha1"
"github.com/prysmaticlabs/prysm/v5/runtime/version"
log "github.com/sirupsen/logrus"
)
// ToProtoUnsafe returns the pointer value of the underlying
@@ -15,16 +18,19 @@ func (b *BeaconState) ToProtoUnsafe() interface{} {
if b == nil {
return nil
}
startTime := time.Now()
gvrCopy := b.genesisValidatorsRoot
br := b.blockRootsVal().Slice()
sr := b.stateRootsVal().Slice()
rm := b.randaoMixesVal().Slice()
log.Infof("Generated slices for state in %s", time.Since(startTime).String())
var vals []*ethpb.Validator
var bals []uint64
if features.Get().EnableExperimentalState {
vals = b.validatorsVal()
log.Infof("Generated validators for state in %s", time.Since(startTime).String())
bals = b.balancesVal()
log.Infof("Generated balances for state in %s", time.Since(startTime).String())
} else {
vals = b.validators
bals = b.balances
@@ -142,6 +148,9 @@ func (b *BeaconState) ToProtoUnsafe() interface{} {
HistoricalSummaries: b.historicalSummaries,
}
case version.Deneb:
defer func() {
log.Infof("Generated roots and inactivitu scores for state in %s", time.Since(startTime).String())
}()
return &ethpb.BeaconStateDeneb{
GenesisTime: b.genesisTime,
GenesisValidatorsRoot: gvrCopy[:],

View File

@@ -44,7 +44,7 @@ func (s *State) MigrateToCold(ctx context.Context, fRoot [32]byte) error {
return ctx.Err()
}
if slot%s.slotsPerArchivedPoint == 0 && slot != 0 {
if slot%128 == 0 && slot != 0 {
cached, exists, err := s.epochBoundaryStateCache.getBySlot(slot)
if err != nil {
return fmt.Errorf("could not get epoch boundary state for slot %d", slot)