nim-eth/tests/fuzzing
kdeme bfbad64d83 Add update of ENR on newly discovered address 2021-02-01 20:30:55 +02:00
..
discovery Update fuzzing tests now that the helpers have moved to ntu 2020-06-12 18:58:05 +03:00
discoveryv5 Add update of ENR on newly discovered address 2021-02-01 20:30:55 +02:00
enr Add rlp_decode fuzz test + some corpus generate code 2020-07-20 17:09:15 +02:00
rlp Add rlp_decode fuzz test + some corpus generate code 2020-07-20 17:09:15 +02:00
rlpx use bearssl rng throughout (#265) 2020-07-07 10:56:26 +02:00
whisper Add whisper encode decode test and rename rlp test 2019-10-02 14:45:29 +03:00
fuzzing_helpers.nim Add rlp_decode fuzz test + some corpus generate code 2020-07-20 17:09:15 +02:00
readme.md Update fuzzing readme.md 2020-07-21 10:58:14 +02:00

readme.md

Fuzzing Tests

This directory contains a set of subdirectories which hold one or more test cases that can be used for fuzzing. The fuzzing test cases use the fuzzing templates from nim-testutils.

For more details see the fuzzing readme of nim-testutils.

Some of the subdirectories also hold corpus generation tooling in order to have some corpus files to start fuzzing from.

Prerequisites

As explained in nim-testutils fuzzing readme, first install the fuzzer you want to run.

Next install nim-testutils its ntu application.

E.g. by running the nim-testutils nimble install:

nimble install testutils

How to run

To start fuzzing a test case run following command:

# Rlp fuzzing with libFuzzer
ntu fuzz --fuzzer:libFuzzer rlp/rlp_decode
# Rlp fuzzing with afl
ntu fuzz --fuzzer:afl rlp/rlp_decode

Or another example:

# ENR fuzzing with libFuzzer
ntu fuzz --fuzzer:libFuzzer enr/fuzz_enr
# ENR fuzzing with afl
ntu fuzz --fuzzer:afl enr/fuzz_enr

Manual adjustments

The ntu application is still very limited in its functionality. Many of the underlying fuzzer functionality is not available for adjustment so you might want to configure the setup in a more manual way.

How to do this is briefly explained here for afl and here for libFuzzer.