Skip to content

Commit

Permalink
nargo fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
vezenovm committed Jan 21, 2025
1 parent eda949b commit adec5bf
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 17 deletions.
19 changes: 10 additions & 9 deletions test_programs/execution_failure/regression_7128/src/main.nr
Original file line number Diff line number Diff line change
@@ -1,26 +1,27 @@
fn main(in0: Field) -> pub Field {
let mut out0 : Field = 0;
let mut tmp1 : Field = 0;
let mut out0: Field = 0;
let mut tmp1: Field = 0;

if ((out0 == out0) & true) // <== changing out0 to in0 or removing
{ // the comparison changes the result
let in0_as_bytes : [u8; 32] = in0.to_be_bytes();
let mut result : [u8; 32] = 0.to_be_bytes();
{
// the comparison changes the result
let in0_as_bytes: [u8; 32] = in0.to_be_bytes();
let mut result: [u8; 32] = 0.to_be_bytes();
for i in 0..32 {
result[i] = (in0_as_bytes[i] ^ result[i]);
}
tmp1 = std::field::bytes32_to_field(result);
}

let mut tmp2 : Field = 0; // <== moving this to the top of main,
if (0.lt(in0)) // changes the result
let mut tmp2: Field = 0; // <== moving this to the top of main,
if (0.lt(in0)) // changes the result
{
tmp2 = 1;
}

out0 = (tmp2 - tmp1);

assert(out0 != 0, "soundness violation");
assert(out0 != 0, "soundness violation");

out0
}
}
17 changes: 9 additions & 8 deletions test_programs/execution_success/regression_7128/src/main.nr
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
fn main(in0: Field) -> pub Field {
let mut out0 : Field = 0;
let mut tmp1 : Field = 0;
let mut out0: Field = 0;
let mut tmp1: Field = 0;

if ((out0 == out0) & true) // <== changing out0 to in0 or removing
{ // the comparison changes the result
let in0_as_bytes : [u8; 32] = in0.to_be_bytes();
let mut result : [u8; 32] = 0.to_be_bytes();
{
// the comparison changes the result
let in0_as_bytes: [u8; 32] = in0.to_be_bytes();
let mut result: [u8; 32] = 0.to_be_bytes();
for i in 0..32 {
result[i] = (in0_as_bytes[i] ^ result[i]);
}
tmp1 = std::field::bytes32_to_field(result);
}

let mut tmp2 : Field = 0; // <== moving this to the top of main,
if (0.lt(in0)) // changes the result
let mut tmp2: Field = 0; // <== moving this to the top of main,
if (0.lt(in0)) // changes the result
{
tmp2 = 1;
}
Expand All @@ -23,4 +24,4 @@ fn main(in0: Field) -> pub Field {
assert(out0 == 0, "completeness violation");

out0
}
}

0 comments on commit adec5bf

Please sign in to comment.