-
Notifications
You must be signed in to change notification settings - Fork 219
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(ssa refactor): allow simplified call inserts & fix const radix ar…
…g handling (#1774) * fix(ssa refactor): allow simplified call inserts * fix(ssa refactor): bad radix arg handling * chore(ssa refactor): cp working test * Use Cow to avoid clones * Change _y to a --------- Co-authored-by: Jake Fecher <jake@aztecprotocol.com>
- Loading branch information
1 parent
97da745
commit 46facce
Showing
6 changed files
with
83 additions
and
11 deletions.
There are no files selected for viewing
5 changes: 5 additions & 0 deletions
5
crates/nargo_cli/tests/test_data_ssa_refactor/to_bytes_integration/Nargo.toml
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,5 @@ | ||
[package] | ||
authors = [""] | ||
compiler_version = "0.1" | ||
|
||
[dependencies] |
2 changes: 2 additions & 0 deletions
2
crates/nargo_cli/tests/test_data_ssa_refactor/to_bytes_integration/Prover.toml
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,2 @@ | ||
x = "2040124" | ||
a = "0x2000000000000000000000000000000000000000000000000000000000000000" |
25 changes: 25 additions & 0 deletions
25
crates/nargo_cli/tests/test_data_ssa_refactor/to_bytes_integration/src/main.nr
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,25 @@ | ||
use dep::std; | ||
|
||
fn main(x : Field, a: Field) { | ||
let y: Field = 2040124; | ||
let be_byte_array = y.to_be_bytes(31); | ||
let le_byte_array = x.to_le_bytes(31); | ||
|
||
assert(le_byte_array[0] == 60); | ||
assert(le_byte_array[0] == be_byte_array[30]); | ||
assert(le_byte_array[1] == be_byte_array[29]); | ||
assert(le_byte_array[2] == be_byte_array[28]); | ||
|
||
let z = 0 - 1; | ||
let p_bytes = std::field::modulus_le_bytes(); | ||
let z_bytes = z.to_le_bytes(32); | ||
assert(p_bytes[10] == z_bytes[10]); | ||
assert(p_bytes[0] == z_bytes[0] as u8 + 1 as u8); | ||
|
||
let p_bits = std::field::modulus_le_bits(); | ||
let z_bits = z.to_le_bits(std::field::modulus_num_bits() as u32); | ||
assert(z_bits[0] == 0); | ||
assert(p_bits[100] == z_bits[100]); | ||
|
||
a.to_le_bits(std::field::modulus_num_bits() as u32); | ||
} |
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
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
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