Skip to content
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

chore: run nargo fmt on integration tests #3059

Merged
merged 32 commits into from
Oct 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
8e5667e
chore: format integration tests
TomAFrench Oct 9, 2023
b376e07
Merge branch 'master' into tf/format-integration-tests-2
TomAFrench Oct 10, 2023
cae9802
chore: update yarn.lock file (#3064)
TomAFrench Oct 10, 2023
56d8278
chore: Update ACIR artifacts (#3013)
kevaundray Oct 10, 2023
bf0c2a6
chore(ci): validate that yarn.lock is current on PRs (#3065)
TomAFrench Oct 10, 2023
4707288
chore: make backend instantiate available (#3071)
kobyhallx Oct 10, 2023
fb3dd94
chore: update imports in noir_js tests (#3066)
TomAFrench Oct 10, 2023
7c43c4c
chore: deduplicate parsing of JSON ABI inputs (#3022)
TomAFrench Oct 10, 2023
c3087bb
chore: clippy fixes (#3074)
TomAFrench Oct 10, 2023
19b05a3
fix: Prevent mutating immutable bindings to mutable types (#3075)
jfecher Oct 10, 2023
f004909
feat: publish aztec build of noir_wasm (#3049)
alexghr Oct 10, 2023
d337fa0
feat: add `execute` method to `Noir` class (#3081)
TomAFrench Oct 10, 2023
8270cac
feat: Implement automatic dereferencing for index expressions (#3082)
jfecher Oct 10, 2023
0b5eecf
fix: disallow returning constant values (#2978)
guipublic Oct 10, 2023
b8d8268
feat: Implement automatic dereferencing for indexing lvalues (#3083)
jfecher Oct 10, 2023
335d322
chore: Update ACIR artifacts (#3086)
kevaundray Oct 11, 2023
f3f30a2
feat: Implement impl specialization (#3087)
jfecher Oct 11, 2023
b909e05
chore: add support for index expressions in formatter (#3069)
jonybur Oct 11, 2023
3828e22
chore: standardize witness map serialization format in JS (#3104)
TomAFrench Oct 11, 2023
31684bc
feat: adding destroy and options object (#3105)
signorecello Oct 11, 2023
6d1bf77
chore: clippy (#3108)
TomAFrench Oct 11, 2023
e8fc701
fix: Determinism of fallback transformer (#3100)
sirasistant Oct 11, 2023
580b294
chore: add member access formatter (#3109)
jonybur Oct 11, 2023
7ad5728
feat!: Pass ACIR to ACVM by reference rather than passing ownership (…
TomAFrench Oct 11, 2023
e2e7913
chore: add method call formatter (#3106)
jonybur Oct 11, 2023
5c762e8
feat: Save Brillig execution state in ACVM (#3026)
ggiraldez Oct 12, 2023
6fd6f99
feat: return compilation errors from noir_wasm (#3091)
alexghr Oct 12, 2023
6f1f90c
chore: remove unnecessary clone when executing brillig (#3120)
TomAFrench Oct 12, 2023
54a8b3b
chore: add call formatter (#3102)
jonybur Oct 12, 2023
c066b20
chore: clean up JS dependencies (#3114)
TomAFrench Oct 12, 2023
4e23e6b
fix: minor problems with `aztec` publishing (#3095)
kobyhallx Oct 12, 2023
4819180
Merge branch 'master' into tf/format-integration-tests-2
TomAFrench Oct 12, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
// a test before ACIR gen optimizes this test.
fn main(_x : Field) -> pub Field {
5
}
}
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
// ---

fn new_concrete_c_over_d() -> C<D> {
let d_method_interface = get_d_method_interface();
C::new(d_method_interface)
}
fn new_concrete_c_over_d() -> C<D> {
let d_method_interface = get_d_method_interface();
C::new(d_method_interface)
}

// ---

Expand Down Expand Up @@ -54,25 +53,24 @@
d: Field,
}

fn d_method(input: D) -> Field {
input.d * input.d
}
fn d_method(input: D) -> Field {
input.d * input.d
}

fn get_d_method_interface() -> MethodInterface<D> {
MethodInterface {
fn get_d_method_interface() -> MethodInterface<D> {
MethodInterface {
some_method_on_t_d: d_method,
}
}

// ---
}

fn main(input: Field) -> pub Field {
let b: B<C<D>> = B::new(new_concrete_c_over_d);
let c: C<D> = b.get_t_c(); // Singleton<Note>
let d: D = D { d: input }; // Note
let output = c.call_method_of_t_d(d);

output
}
// ---
fn main(input: Field) -> pub Field {
let b: B<C<D>> = B::new(new_concrete_c_over_d);
let c: C<D> = b.get_t_c(); // Singleton<Note>
let d: D = D { d: input }; // Note
let output = c.call_method_of_t_d(d);

output
}

// ---
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ fn main(mut x: u32, y: u32) {
x = std::wrapping_mul(x,x);
assert(y == x);

let c:u3 = 2;
let c: u3 = 2;
assert(c > x as u3);
}
4 changes: 2 additions & 2 deletions tooling/nargo_cli/tests/execution_success/6_array/src/main.nr
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use dep::std;
//Basic tests for arrays
fn main(x: [u32; 5], y: [u32; 5], mut z: u32, t: u32) {
//Basic tests for arrays
fn main(x: [u32; 5], y: [u32; 5], mut z: u32, t: u32) {
let mut c = 2301;
z = y[4];
//Test 1:
Expand Down
15 changes: 6 additions & 9 deletions tooling/nargo_cli/tests/execution_success/7_function/src/main.nr
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
//Tests for function calling
//Tests for function calling
fn f1(mut x: Field) -> Field {
x = x + 1;
x = f2(x);
x
}

fn f2(mut x: Field) -> Field{
fn f2(mut x: Field) -> Field {
x += 2;
x
}
Expand All @@ -22,7 +22,7 @@ fn test1(mut a: Field) {
assert(a == 4);
}

fn test2(z: Field, t: u32 ) {
fn test2(z: Field, t: u32 ) {
let a = z + t as Field;
assert(a == 64);
let e = pow(z, t as Field);
Expand Down Expand Up @@ -78,15 +78,12 @@ fn test_multiple5(a: (u32, u32)) {
assert(a.0 == a.1+2);
}


fn test_multiple6(a: my2, b: my_struct, c: (my2, my_struct)) {
test_multiple4(a.aa);
test_multiple5((b.a, b.b));
assert(c.0.aa.a == c.1.a);
}



fn foo<N>(a: [Field; N]) -> [Field; N] {
a
}
Expand All @@ -95,7 +92,7 @@ fn bar() -> [Field; 1] {
foo([0])
}

fn main(x: u32 , y: u32 , a: Field, arr1: [u32; 9], arr2: [u32; 9]) {
fn main(x: u32 , y: u32 , a: Field, arr1: [u32; 9], arr2: [u32; 9]) {
let mut ss: my_struct = my_struct { b: x, a: x+2, };
test_multiple4(ss);
test_multiple5((ss.a,ss.b));
Expand All @@ -106,13 +103,13 @@ fn main(x: u32 , y: u32 , a: Field, arr1: [u32; 9], arr2: [u32; 9]) {
ss.a = 61;
test_multiple6(my, ss, (my,ss));

let my_block = {
let my_block = {
let mut ab = f2(a);
ab = ab + a;
(x,ab)
};
assert(my_block.1 == 4);

test0(a);
test1(a);
test2(x as Field, y);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ fn main(x : Field, y : Field, z : Field) -> pub Field {
let c = b * z; // 2 * 5 = 10
let d = c / a; // 10 / 6 (This uses field inversion, so we test it by multiplying by `a`)
d * a
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

fn main(x: [u32; 5], mut z: u32, t: u32, index: [Field;5], index2: [Field;5], offset: Field, sublen: Field) {
let idx = (z - 5*t - 5) as Field;
//dynamic array test
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Tests a very simple program.
//
// The features being tested is assertion
fn main(x : Field, y : pub Field) {
fn main(x : Field, y : pub Field) {
assert(x == y, "x and y are not equal");
assert_eq(x, y, "x and y are not equal");
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ fn main(x : Field, y : Field) {
let y_as_u11 = y as u11;
assert((x_as_u11 & y_as_u11) == x_as_u11);
}

Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
fn main(x: u64) {
let two: u64 = 2;
let three: u64 = 3;
let two: u64 = 2;
let three: u64 = 3;

// shifts on constant values
assert(two << 2 == 8);
Expand All @@ -11,13 +11,13 @@ fn main(x: u64) {
assert(x << 1 == 128);
assert(x >> 2 == 16);

regression_2250();
regression_2250();
}

fn regression_2250() {
let a: u1 = 1 >> 1;
let a: u1 = 1 >> 1;
assert(a == 0);
let b: u32 = 1 >> 32;

let b: u32 = 1 >> 32;
assert(b == 0);
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
fn main(x: u1) {
assert(!x == 0);
}

Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ fn main(x: u1, y: u1) {

assert(x | y | x == 1);
}

Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@

fn main(x: u32) {
fn main(x: u32) {
assert(entry_point(x) == 2);
swap_entry_point(x, x + 1);
assert(deep_entry_point(x) == 4);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
// Tests a very simple program.
//
// The features being tested are array reads and writes

fn main(x: [Field; 3]) {
fn main(x: [Field; 3]) {
read_array(x);
read_write_array(x);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Tests a very simple program.
//
// The features being tested is using assert on brillig
fn main(x: Field) {
fn main(x: Field) {
assert(1 == conditional(x as bool));
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Tests a very simple program.
//
// The features being tested is brillig calls
fn main(x: u32) {
fn main(x: u32) {
assert(entry_point(x) == 2);
swap_entry_point(x, x + 1);
assert(deep_entry_point(x) == 4);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Tests a very simple program.
//
// The features being tested is brillig calls passing arrays around
fn main(x: [u32; 3]) {
fn main(x: [u32; 3]) {
assert(entry_point(x) == 9);
another_entry_point(x);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Tests a very simple program.
//
// The features being tested is brillig calls with conditionals
fn main(x: [u32; 3]) {
fn main(x: [u32; 3]) {
assert(entry_point(x[0]) == 7);
assert(entry_point(x[1]) == 8);
assert(entry_point(x[2]) == 9);
Expand Down Expand Up @@ -29,7 +29,7 @@ unconstrained fn entry_point(x: u32) -> u32 {
result = inner_2();
} else if x == 3 {
result = inner_3();
}
}

result
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Tests a very simple program.
//
// The features being tested is basic conditonal on brillig
fn main(x: Field) {
fn main(x: Field) {
assert(4 == conditional(x == 1));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ struct MyStruct {
operation: fn (u32) -> u32,
}

fn main(x: u32) {
fn main(x: u32) {
assert(wrapper(increment, x) == x + 1);
assert(wrapper(increment_acir, x) == x + 1);
assert(wrapper(decrement, x) == x - 1);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ struct myStruct {
// Tests a very simple program.
//
// The features being tested is the identity function in Brillig
fn main(x : Field) {
fn main(x : Field) {
assert(x == identity(x));
// TODO: add support for array comparison
let arr = identity_array([x, x]);
Expand All @@ -21,13 +21,13 @@ fn main(x : Field) {
}

unconstrained fn identity(x : Field) -> Field {
x
x
}

unconstrained fn identity_array(arr : [Field; 2]) -> [Field; 2] {
arr
arr
}

unconstrained fn identity_struct(s : myStruct) -> myStruct {
s
s
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ fn main(x: Field, result: [u8; 32]) {
let digest = keccak256([x as u8], 1);
assert(digest == result);

//#1399: variable meesage size
//#1399: variable meesage size
let message_size = 4;
let hash_a = keccak256([1,2,3,4], message_size);
let hash_b = keccak256([1,2,3,4,0,0,0,0], message_size);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Tests a very simple program.
//
// The features being tested is basic looping on brillig
fn main(sum: u32){
fn main(sum: u32) {
assert(loop(4) == sum);
assert(plain_loop() == sum);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Tests a very simple Brillig function.
//
// The features being tested is not instruction on brillig
fn main(x: Field, y : Field) {
fn main(x: Field, y : Field) {
assert(false == not_operator(x as bool));
assert(true == not_operator(y as bool));
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use dep::std::slice;

// Tests oracle usage in brillig/unconstrained functions
fn main(x: Field) {
fn main(x: Field) {
get_number_sequence_wrapper(20);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ unconstrained fn main(x: Field, y: Field, salt: Field, out_x: Field, out_y: Fiel
let hash = std::hash::pedersen_with_separator([state], 0);
assert(std::hash::pedersen_with_separator([43], 0)[0] == hash[0]);
}

Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Tests a very simple program.
//
// The feature being tested is brillig recursion
fn main(x: u32) {
fn main(x: u32) {
assert(fibonacci(x) == 55);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ unconstrained fn main(
b_pub_x: pub Field,
b_pub_y: pub Field
) {
let mut priv_key = a;
let mut pub_x: Field = a_pub_x;
let mut pub_y: Field = a_pub_y;
if a != 1 { // Change `a` in Prover.toml to test input `b`
let mut priv_key = a;
let mut pub_x: Field = a_pub_x;
let mut pub_y: Field = a_pub_y;
if a != 1 { // Change `a` in Prover.toml to test input `b`
priv_key = b;
pub_x = b_pub_x;
pub_y = b_pub_y;
}
let res = std::scalar_mul::fixed_base_embedded_curve(priv_key, 0);
let res = std::scalar_mul::fixed_base_embedded_curve(priv_key, 0);
assert(res[0] == pub_x);
assert(res[1] == pub_y);
}
Loading
Loading