-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: added README.md for init instructions
- Loading branch information
1 parent
31a1c95
commit fc95118
Showing
1 changed file
with
43 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
# cargo fuzz | ||
|
||
This repository contains the fuzz targets for the summa codebase. Go to the root of the directory and follow thsi path: | ||
`summa/zk_prover/fuzz` and then run `cargo fuzz --help`. If this does not work then follow the setup. | ||
|
||
### SetUp | ||
Go to the following directory `summa/zk_prover/fuzz` and run: | ||
``` | ||
cargo install cargo fuzz | ||
``` | ||
To test a function, create a new fuzz target: | ||
``` | ||
cargo fuzz add <fuzz_target_name>` | ||
``` | ||
To check all fuzz targets, run: | ||
``` | ||
cargo fuzz list | ||
``` | ||
To run fuzz tests on a target, run: | ||
``` | ||
cargo fuzz run <fuzz_target_name>` | ||
``` | ||
|
||
### How to write tests | ||
|
||
Refer `fuzz_targets/operation_helpers.rs` | ||
|
||
``` rust | ||
fuzz_target!(|data: &[u8]| { | ||
// code goes here | ||
} | ||
``` | ||
This function generates a random bytes array that can be used to pass as inputs in any function you wish to fuzz. | ||
In order to import a function, write: | ||
``` rust | ||
use summa_solvency::merkle_sum_tree | ||
``` | ||
at the top and write the function by providing the specific path | ||
|
||
For example: | ||
``` rust | ||
let username_as_big_uint = merkle_sum_tree::utils::big_intify_username(username); | ||
``` |