diff --git a/fuzz/block_fuzz.go b/fuzz/block_fuzz.go index 1143a4ae3..ddfddc6aa 100644 --- a/fuzz/block_fuzz.go +++ b/fuzz/block_fuzz.go @@ -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() diff --git a/fuzz/rpc_status_fuzz.go b/fuzz/rpc_status_fuzz.go index 2aabd5642..7b03c5e4b 100644 --- a/fuzz/rpc_status_fuzz.go +++ b/fuzz/rpc_status_fuzz.go @@ -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") diff --git a/fuzz/ssz_encoder_attestations_fuzz.go b/fuzz/ssz_encoder_attestations_fuzz.go index 8be1b2859..1883873a8 100644 --- a/fuzz/ssz_encoder_attestations_fuzz.go +++ b/fuzz/ssz_encoder_attestations_fuzz.go @@ -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() diff --git a/fuzz/state_fuzz.go b/fuzz/state_fuzz.go index 4cb76fe9d..2949e9f7d 100644 --- a/fuzz/state_fuzz.go +++ b/fuzz/state_fuzz.go @@ -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() diff --git a/fuzzbuzz.yaml b/fuzzbuzz.yaml new file mode 100644 index 000000000..85778da50 --- /dev/null +++ b/fuzzbuzz.yaml @@ -0,0 +1,6 @@ +base: + language: go + docker_image: golang:latest + build_tags: + - libfuzzer + - blst_disabled