noir-lang / noir

Noir is a domain specific language for zero knowledge proofs
https://noir-lang.org
Apache License 2.0
887 stars 196 forks source link

Add fuzz tests to show equivalence between stdlib cryptographic functions and rust implementations #6141

Closed TomAFrench closed 1 month ago

TomAFrench commented 1 month ago

We should add some fuzz tests which generates random inputs and feeds them into the stdlib implementations of keccak256/sha256/etc. alongside an off-the-shelf rust implementation to give greater assurances about correctness.

Note that this won't work with just a regular fuzz test but will need a rust harness.

TomAFrench commented 1 month ago

proptest usage: https://github.com/noir-lang/noir/blob/be9dcfe56d808b1bd5ef552d41274705b2df7062/tooling/noirc_abi/src/lib.rs#L503C7-L503C8

exeuctor: https://github.com/noir-lang/noir/blob/be9dcfe56d808b1bd5ef552d41274705b2df7062/tooling/nargo/src/ops/execute.rs#L62

TomAFrench commented 1 month ago

compile from string snippet: https://github.com/noir-lang/noir/blob/be9dcfe56d808b1bd5ef552d41274705b2df7062/tooling/lsp/src/lib.rs#L332