-
Notifications
You must be signed in to change notification settings - Fork 253
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: ssa fuzzer #7641
base: master
Are you sure you want to change the base?
feat: ssa fuzzer #7641
Conversation
tooling/ssa_fuzzer/src/builder.rs
Outdated
|
||
/// Inserts an add instruction between two values | ||
pub fn insert_add_instruction(&mut self, lhs: Id<Value>, rhs: Id<Value>) -> Id<Value> { | ||
let result = self.builder.insert_binary(lhs, BinaryOp::Add { unchecked: false }, rhs); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Checked/Unchecked should be parameterized, too
pub mod compiler; | ||
pub mod config; | ||
pub mod helpers; | ||
pub mod runner; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
COuld you please add tests checking the correctness of all simple instructions (additions, etc). Run in both modes and check results
} | ||
|
||
/// Checks if two indices exist in both ACIR and Brillig witness vectors | ||
fn both_indeces_presented( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
indices
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rename to "index_exists_in_both_witness_vectors"
} | ||
|
||
/// Checks if an index exists in both ACIR and Brillig witness vectors | ||
fn index_presented( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
index_exists
|
||
/// Gets an element from an array at the given index | ||
fn insert_array_get(&mut self, array_idx: u32, index: u32) { | ||
if array_idx >= self.acir_arrays.len() as u32 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is better to just use indices modulo lengths. Otherwise the majority of testcases will skip instructions instead of creating them
/// Sets an element in an array at the given index | ||
fn insert_array_set(&mut self, array_idx: u32, index: u32, value: u32) { | ||
if array_idx >= self.acir_arrays.len() as u32 | ||
|| array_idx >= self.brillig_arrays.len() as u32 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here
} | ||
|
||
/// Checks if an index exists in both ACIR and Brillig witness vectors | ||
fn index_presented( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems like you are duplicating functionality from field.rs here
Co-authored-by: Innokentii Sennovskii <isennovskiy@gmail.com>
Co-authored-by: Innokentii Sennovskii <isennovskiy@gmail.com>
Co-authored-by: Innokentii Sennovskii <isennovskiy@gmail.com>
tooling/nargo/src/ops/mod.rs
Outdated
@@ -11,7 +11,7 @@ pub use self::test::{TestStatus, run_test}; | |||
|
|||
mod check; | |||
mod compile; | |||
mod execute; | |||
pub mod execute; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pub mod execute; | |
mod execute; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I need it here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We reexport that function a couple of lines up.
Description
Summary*
This PR introduces SSA fuzzer for testing ACIR and Brillig execution of ssa built from scratch.
Additional Context
Documentation*
Check one:
PR Checklist*
cargo fmt
on default settings.