mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2024-12-25 21:07:18 +00:00
ce725ceec3
* Move state pkg to stateV0 pkg * Build.bazel * Remove unused RootsArrayHashTreeRoot * Revert "Remove unused RootsArrayHashTreeRoot" This reverts commit bf0bda30d1a8eb7a071f6e3ce9ee85041b45aca6. Co-authored-by: prylabs-bulldozer[bot] <58059840+prylabs-bulldozer[bot]@users.noreply.github.com>
41 lines
954 B
Go
41 lines
954 B
Go
package fuzz
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/prysmaticlabs/prysm/beacon-chain/core/helpers"
|
|
stateutil "github.com/prysmaticlabs/prysm/beacon-chain/core/state"
|
|
"github.com/prysmaticlabs/prysm/beacon-chain/state/stateV0"
|
|
pb "github.com/prysmaticlabs/prysm/proto/beacon/p2p/v1"
|
|
"github.com/prysmaticlabs/prysm/shared/featureconfig"
|
|
"github.com/prysmaticlabs/prysm/shared/params"
|
|
)
|
|
|
|
func init() {
|
|
featureconfig.Init(&featureconfig.Flags{
|
|
EnableSSZCache: false,
|
|
})
|
|
}
|
|
|
|
// BeaconStateFuzz --
|
|
func BeaconStateFuzz(input []byte) {
|
|
params.UseMainnetConfig()
|
|
st := &pb.BeaconState{}
|
|
if err := st.UnmarshalSSZ(input); err != nil {
|
|
return
|
|
}
|
|
s, err := stateV0.InitializeFromProtoUnsafe(st)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
nextEpoch := helpers.SlotToEpoch(s.Slot()) + 1
|
|
slot, err := helpers.StartSlot(nextEpoch)
|
|
if err != nil {
|
|
return
|
|
}
|
|
if _, err := stateutil.ProcessSlots(context.Background(), s, slot); err != nil {
|
|
_ = err
|
|
return
|
|
}
|
|
}
|