Set up Prysm for fuzz testing on Fuzzbuzz (#8789)

* Wrap beacon fuzz tests in go-fuzz compatible test functions

* Add fuzzbuzz.yaml
This commit is contained in:
Everest Stefan Munro-Zeisberger 2021-04-19 12:00:46 -07:00 committed by GitHub
parent cff7dbd015
commit ad269ee147
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 31 additions and 0 deletions

View File

@ -99,6 +99,12 @@ func (fakeChecker) Resync() error {
return nil
}
// FuzzBlock wraps BeaconFuzzBlock in a go-fuzz compatible interface
func FuzzBlock(b []byte) int {
BeaconFuzzBlock(b)
return 0
}
// BeaconFuzzBlock runs full processing of beacon block against a given state.
func BeaconFuzzBlock(b []byte) {
params.UseMainnetConfig()

View File

@ -62,6 +62,12 @@ func init() {
})
}
// FuzzP2PRPCStatus wraps BeaconFuzzP2PRPCStatus in a go-fuzz compatible interface
func FuzzP2PRPCStatus(b []byte) int {
BeaconFuzzP2PRPCStatus(b)
return 0
}
// BeaconFuzzP2PRPCStatus implements libfuzzer and beacon fuzz interface.
func BeaconFuzzP2PRPCStatus(b []byte) {
s, err := h.NewStream(context.Background(), p.PeerID(), "/eth2/beacon_chain/req/status/1/ssz_snappy")

View File

@ -10,6 +10,13 @@ import (
var buf = new(bytes.Buffer)
// FuzzSszEncoderAttestation wraps SszEncoderAttestationFuzz in a
// go-fuzz compatible interface
func FuzzSszEncoderAttestation(b []byte) int {
SszEncoderAttestationFuzz(b)
return 0
}
// SszEncoderAttestationFuzz runs network encode/decode for attestations.
func SszEncoderAttestationFuzz(b []byte) {
params.UseMainnetConfig()

View File

@ -17,6 +17,12 @@ func init() {
})
}
// FuzzState wraps BeaconStateFuzz in a go-fuzz compatible interface
func FuzzState(b []byte) int {
BeaconStateFuzz(b)
return 0
}
// BeaconStateFuzz --
func BeaconStateFuzz(input []byte) {
params.UseMainnetConfig()

6
fuzzbuzz.yaml Normal file
View File

@ -0,0 +1,6 @@
base:
language: go
docker_image: golang:latest
build_tags:
- libfuzzer
- blst_disabled