Skip to content

Commit

Permalink
Merge pull request #14 from morehouse/contributing_guide
Browse files Browse the repository at this point in the history
README.md: add contributing guide
  • Loading branch information
Crypt-iQ authored Oct 16, 2023
2 parents a1e6d1c + 8b94bcf commit ac98638
Showing 1 changed file with 43 additions and 0 deletions.
43 changes: 43 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,46 @@

Fuzzing seeds for the [Lightning Network
Daemon](https://github.com/lightningnetwork/lnd).

## Contributing

If you find coverage-increasing inputs while fuzzing LND, please create a pull
request adding them to this repository. Use the `corpus_merge.sh` script to only
add inputs that increase coverage.

### Example

Here's an example workflow to contribute new inputs for the lnwire
`FuzzAcceptChannel` target. We'll assume the `lnd` and `lnd-fuzz` repositories
are checked out in the current directory.

First create a directory for corpus inputs to be saved in. Use the `lnd-fuzz`
corpus to seed the new corpus, and begin fuzzing:

```shell
export ROOT=$(pwd)
mkdir lnwire_corpus
cp -r lnd-fuzz/lnwire/testdata/fuzz/FuzzAcceptChannel lnwire_corpus/
cd lnd/lnwire
go test -fuzz=FuzzAcceptChannel -parallel=4 -test.fuzzcachedir="$ROOT/lnwire_corpus"
```

After some time, the fuzzer may find some potential coverage-increasing inputs
and save them to `lnwire_corpus/FuzzAcceptChannel/`. We can then merge them into
the `lnd-fuzz` corpus:

```shell
cd $ROOT
lnd-fuzz/corpus_merge.sh lnd-fuzz/lnwire/testdata/fuzz/FuzzAcceptChannel \
lnwire_corpus/FuzzAcceptChannel lnd/lnwire FuzzAcceptChannel
```

Any inputs in `lnwire_corpus/FuzzAcceptChannel` that increase coverage over the
existing `lnd-fuzz` corpus will be copied over. If new inputs were added, create
a pull request to improve the upstream seed corpus:

```shell
cd lnd-fuzz
git add lnwire/testdata/fuzz/FuzzAcceptChannel/*
git commit
```

0 comments on commit ac98638

Please sign in to comment.