revault/revault_tx

fuzz: fix run.sh script and some warnings in fuzz_targets

Closed this issue · 2 comments

It's not clear to know where to use run.sh, ./fuzz/run.sh or cd fuzz & ./run.sh ?

cd corpus && git clone https://github.com/revault/revault_tx_corpus

cargo install --force cargo-fuzz
for target in $(ls fuzz/fuzz_targets);do
    cargo +nightly fuzz run "${target%.*}" -- -runs=0
done

corpus is in fuzz directory and for target in $(ls fuzz/fuzz_targets) means we are in revault_tx root directory


When running some warnings are often:

warning: unused `Result` that must be used
  --> fuzz_targets/parse_unvault.rs:45:9
   |
45 |         tx.verify_input(0);
   |         ^^^^^^^^^^^^^^^^^^^
   |
   = note: `#[warn(unused_must_use)]` on by default
   = note: this `Result` may be an `Err` variant, which should be handled

warning: unused `Result` that must be used
  --> fuzz_targets/parse_unvault.rs:51:9
   |
51 |         tx.finalize(&secp);
   |         ^^^^^^^^^^^^^^^^^^^
   |
   = note: this `Result` may be an `Err` variant, which should be handled

I usually do ./fuzz/run.sh for compilation sanity check.

For actually running against our corpus i do:

for target in $(ls fuzz/fuzz_targets);do cargo +nightly fuzz run "${target%.*}" -- -runs=0 -maxlen=500000 ../tx_corpus; done

For generating new corpus i have a dedicated branch and a script.

The warnings are there on purpose (and was mentioned in the commit or the PR introducing them iirc), it's that we can't technically satisfy the inputs so i want to ignore them.... But i was not able to actually do it, so i left them since they are harmless.

I found a (hacky) way to get rid of the warning, but i also learned that it seems to be the norm so i'll just use it. Making progress in my rust journey!