mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2024-12-22 11:32:09 +00:00
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:
parent
cff7dbd015
commit
ad269ee147
@ -99,6 +99,12 @@ func (fakeChecker) Resync() error {
|
|||||||
return nil
|
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.
|
// BeaconFuzzBlock runs full processing of beacon block against a given state.
|
||||||
func BeaconFuzzBlock(b []byte) {
|
func BeaconFuzzBlock(b []byte) {
|
||||||
params.UseMainnetConfig()
|
params.UseMainnetConfig()
|
||||||
|
@ -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.
|
// BeaconFuzzP2PRPCStatus implements libfuzzer and beacon fuzz interface.
|
||||||
func BeaconFuzzP2PRPCStatus(b []byte) {
|
func BeaconFuzzP2PRPCStatus(b []byte) {
|
||||||
s, err := h.NewStream(context.Background(), p.PeerID(), "/eth2/beacon_chain/req/status/1/ssz_snappy")
|
s, err := h.NewStream(context.Background(), p.PeerID(), "/eth2/beacon_chain/req/status/1/ssz_snappy")
|
||||||
|
@ -10,6 +10,13 @@ import (
|
|||||||
|
|
||||||
var buf = new(bytes.Buffer)
|
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.
|
// SszEncoderAttestationFuzz runs network encode/decode for attestations.
|
||||||
func SszEncoderAttestationFuzz(b []byte) {
|
func SszEncoderAttestationFuzz(b []byte) {
|
||||||
params.UseMainnetConfig()
|
params.UseMainnetConfig()
|
||||||
|
@ -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 --
|
// BeaconStateFuzz --
|
||||||
func BeaconStateFuzz(input []byte) {
|
func BeaconStateFuzz(input []byte) {
|
||||||
params.UseMainnetConfig()
|
params.UseMainnetConfig()
|
||||||
|
6
fuzzbuzz.yaml
Normal file
6
fuzzbuzz.yaml
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
base:
|
||||||
|
language: go
|
||||||
|
docker_image: golang:latest
|
||||||
|
build_tags:
|
||||||
|
- libfuzzer
|
||||||
|
- blst_disabled
|
Loading…
Reference in New Issue
Block a user