mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2024-12-26 05:17:22 +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
31 lines
830 B
Go
31 lines
830 B
Go
package fuzz
|
|
|
|
import (
|
|
"github.com/prysmaticlabs/prysm/beacon-chain/core/blocks"
|
|
stateTrie "github.com/prysmaticlabs/prysm/beacon-chain/state"
|
|
prylabs_testing "github.com/prysmaticlabs/prysm/fuzz/testing"
|
|
"github.com/prysmaticlabs/prysm/shared/params"
|
|
)
|
|
|
|
// BeaconFuzzBlockHeader using the corpora from sigp/beacon-fuzz.
|
|
func BeaconFuzzBlockHeader(b []byte) ([]byte, bool) {
|
|
params.UseMainnetConfig()
|
|
input := &InputBlockHeader{}
|
|
if err := input.UnmarshalSSZ(b); err != nil {
|
|
return fail(err)
|
|
}
|
|
s, err := prylabs_testing.GetBeaconFuzzState(input.StateID)
|
|
if err != nil || s == nil {
|
|
return nil, false
|
|
}
|
|
st, err := stateTrie.InitializeFromProto(s)
|
|
if err != nil {
|
|
return fail(err)
|
|
}
|
|
post, err := blocks.ProcessBlockHeaderNoVerify(st, input.Block)
|
|
if err != nil {
|
|
return fail(err)
|
|
}
|
|
return success(post)
|
|
}
|