prysm-pulse/fuzz/common.go
Raul Jordan 302b0f8c80
Use FastSSZ Everywhere Applicable (#6135)
* 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
2020-06-05 13:48:40 +00:00

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
}