mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2024-12-25 04:47:18 +00:00
302b0f8c80
* use fast ssz anywhere applicable * use fastssz clearly * Merge branch 'master' into use-fastssz * Apply suggestions from code review * imports * Update beacon-chain/p2p/fork.go * Merge branch 'master' into use-fastssz * update go-ssz * update go-ssz * Merge refs/heads/master into use-fastssz * Merge refs/heads/master into use-fastssz
41 lines
759 B
Go
41 lines
759 B
Go
package fuzz
|
|
|
|
import (
|
|
"os"
|
|
"strings"
|
|
|
|
stateTrie "github.com/prysmaticlabs/prysm/beacon-chain/state"
|
|
"github.com/prysmaticlabs/prysm/shared/featureconfig"
|
|
)
|
|
|
|
func init() {
|
|
featureconfig.Init(&featureconfig.Flags{
|
|
SkipBLSVerify: true,
|
|
})
|
|
}
|
|
|
|
func fail(err error) ([]byte, bool) {
|
|
shouldPanic := false
|
|
if val, ok := os.LookupEnv("PANIC_ON_ERROR"); ok {
|
|
shouldPanic = strings.ToLower(val) == "true"
|
|
}
|
|
if shouldPanic {
|
|
panic(err)
|
|
}
|
|
return nil, false
|
|
}
|
|
|
|
func success(post *stateTrie.BeaconState) ([]byte, bool) {
|
|
if val, ok := os.LookupEnv("RETURN_SSZ_POST_STATE"); ok {
|
|
if strings.ToLower(val) != "true" {
|
|
return nil, true
|
|
}
|
|
}
|
|
|
|
result, err := post.InnerStateUnsafe().MarshalSSZ()
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
return result, true
|
|
}
|