-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 6823523
Showing
14 changed files
with
704 additions
and
0 deletions.
There are no files selected for viewing
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,3 @@ | ||
node_modules | ||
build | ||
codegen |
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 @@ | ||
# Noir recursion |
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,8 @@ | ||
[package] | ||
name = "recurse" | ||
type = "lib" | ||
authors = [""] | ||
compiler_version = ">=0.26.0" | ||
|
||
[dependencies] | ||
simple = { path = "../simple" } |
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 @@ | ||
{"noir_version":"0.26.0+c46b164ce56e6a8f81255fb17eb6539bd040f336","hash":12993080274337799997,"abi":{"parameters":[{"name":"x","type":{"kind":"field"},"visibility":"private"},{"name":"y","type":{"kind":"field"},"visibility":"private"}],"param_witnesses":{"x":[{"start":0,"end":1}],"y":[{"start":1,"end":2}]},"return_type":{"abi_type":{"kind":"boolean"},"visibility":"public"},"return_witnesses":[25]},"bytecode":"H4sIAAAAAAAA/+1X207jMBCdNN3QUGDJsrD0A/Z9nHve+JWmJP//tI8LNThoGowqkTNVK9VS5CiX4zM3e05A72O1vf66+3B7zejzCNz85GaeNgwQ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dep::simple;\n\n// #[recursive]\n#[export]\nfn main(x: Field, y: Field) -> pub bool {\n let mut res = simple::not_odd(x);\n res &= simple::not_odd(y);\n res &= simple::not_equal(x, y);\n res\n}\n\n#[test]\nfn test_not_equal() {\n assert(main(2, 4));\n // Uncomment to make test fail\n // assert(not_equal(1, 1));\n}\n","path":"/home/jz/Documents/code/aztec/recurseNoirTS/circuits/recurse/src/lib.nr"},"48":{"source":"#[export]\npub fn not_equal(x: Field, y: Field) -> bool {\n x != y\n}\n\n#[export]\npub fn not_odd(x: Field) -> bool {\n !(((x as u8) & 1) as bool)\n}\n\n#[test]\nfn test_not_equal() {\n assert(not_equal(1, 2));\n // Uncomment to make test fail\n // assert(not_equal(1, 1));\n}\n\nfn test_not_odd() {\n assert(not_odd(2));\n // Uncomment to make test fail\n // assert(not_equal(1, 1));\n}\n","path":"/home/jz/Documents/code/aztec/recurseNoirTS/circuits/simple/src/lib.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 @@ | ||
{"noir_version":"0.26.0+c46b164ce56e6a8f81255fb17eb6539bd040f336","hash":11451067821145455187,"abi":{"parameters":[{"name":"x","type":{"kind":"field"},"visibility":"private"},{"name":"y","type":{"kind":"field"},"visibility":"private"}],"param_witnesses":{"x":[{"start":0,"end":1}],"y":[{"start":1,"end":2}]},"return_type":{"abi_type":{"kind":"boolean"},"visibility":"private"},"return_witnesses":[25]},"bytecode":"H4sIAAAAAAAA/+1X207jMBCdNN3QUGDJsrD0A/Z9nHve+JWmJP//tI8LNThoGowqkTNVK9VS5CiX4zM3e05A72O1vf66+3B7zejzCNz85GaeNgwQiz10MdiGWfpiJnwUufvI8176TP7zMno3zIH4/0X84/sm+AJn6eGReJ4FNBpPbuZpwwzG2uufMN4avhitGYLXllgZl3neVWlnMrPmtGnrgvOiLWtTm6IuntM6y7o6r6umbSpuTJ51pi+arOvtYDMDYPWOWEg6ST4D+w9p83wHa/vtOs3LruCyq5u6a6q+qHiz7vvnivNNy22bl5yZrG+rlNu02S7bdMXGvPEKyZOwhN+M5jgslnx/uMuOyMN/GKHnfiG++0/YWpFrjbkkHp5qm4YER2HOndPRuBHhikTL7ggfIy9XxMYYKeBeELaQ7cZoMWM6XGekdWiA8yKVvhgO+Ji+1xnFo3fDLDujmPZ3Rj6co+mMrJMuhPExfX0SoNaWyTStM+r7BeEKNcbZyIcqzIBOoDBHkuXSzbYIzpJl5KrBWOskKVksMW3JIpNpqmS5JFxhLkknydGSBWnzFZ2eZLnCYe1Ilms6S5a9ZDSCea2Ae0PHLVms3Tf4GKlIlqXjisb9SdhCthutxTykZNE6NMB5sSNZbt1sN4+zZNkdH52RdZKULAnpSxaZTFMlyy3hCjUhnSQfd0ZIaTUV6xcwrpo2J0CsOyWbQ7DNyJoLgLx+43jxobppJGfJ957O3fReMhrBvFfAfaDj7qat3Q/4GKlwtQfLHeG76T90Goc0Mpce6bjr0cbkUSHWK3CsZccfeO5X4hm9Ao/vA4c8IwAA","debug_symbols":"tdffCoIwFAbwdznXXrhz3B99lehilYEgFmlBiO+eo4ywFYh8dzvsnB+M8cHWU33a+646NS0VPaVUbHpqz74JVdv5S0eFSiWhsjmMK1ZDQseqLqnI7JB8t3I2tcpHqxu2CSmgzUBbgHYGtDXQNkDbAm0HtHNkdtYH890qZo4rJM5IXJB4PJzyviXNKy5UI3GDxC0Sd0g8B+KcInGFxBmJCxJfn9Df8WeNxA0St0g8nlC2cTxM5EsnJJ4lo6cJ5/4fwKhXp7Hzx5zC0YyjBUfHM6RdnA4TetnEWNz8pfK7ugx/jLB3bfbTl2Msu/v5uTM8AA==","file_map":{"47":{"source":"use dep::std;\nuse dep::simple;\n\n#[export]\nfn main_call(x: Field, y: Field) -> bool {\n let mut res = simple::not_odd(x);\n res &= simple::not_odd(y);\n res &= simple::not_equal(x, y);\n res\n}\n\n// #[recursive]\n// #[export]\n// fn main(x: Field, y: Field) -> pub bool {}\n\n#[test]\nfn test_not_equal() {\n assert(main_call(2, 4));\n // Uncomment to make test fail\n // assert(not_equal(1, 1));\n}\n","path":"/home/jz/Documents/code/aztec/recurseNoirTS/circuits/recurse/src/lib.nr"},"48":{"source":"#[export]\npub fn not_equal(x: Field, y: Field) -> bool {\n x != y\n}\n\n#[export]\npub fn not_odd(x: Field) -> bool {\n !(((x as u8) & 1) as bool)\n}\n\n#[test]\nfn test_not_equal() {\n assert(not_equal(1, 2));\n // Uncomment to make test fail\n // assert(not_equal(1, 1));\n}\n\nfn test_not_odd() {\n assert(not_odd(2));\n // Uncomment to make test fail\n // assert(not_equal(1, 1));\n}\n","path":"/home/jz/Documents/code/aztec/recurseNoirTS/circuits/simple/src/lib.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,21 @@ | ||
use dep::std; | ||
use dep::simple; | ||
|
||
#[export] | ||
fn main_call(x: Field, y: Field) -> bool { | ||
let mut res = simple::not_odd(x); | ||
res &= simple::not_odd(y); | ||
res &= simple::not_equal(x, y); | ||
res | ||
} | ||
|
||
// #[recursive] | ||
// #[export] | ||
// fn main(x: Field, y: Field) -> pub bool {} | ||
|
||
#[test] | ||
fn test_not_equal() { | ||
assert(main_call(2, 4)); | ||
// Uncomment to make test fail | ||
// assert(not_equal(1, 1)); | ||
} |
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,7 @@ | ||
[package] | ||
name = "simple" | ||
type = "lib" | ||
authors = [""] | ||
compiler_version = ">=0.26.0" | ||
|
||
[dependencies] |
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 @@ | ||
{"noir_version":"0.26.0+c46b164ce56e6a8f81255fb17eb6539bd040f336","hash":17779628616883538135,"abi":{"parameters":[{"name":"x","type":{"kind":"field"},"visibility":"private"},{"name":"y","type":{"kind":"field"},"visibility":"private"}],"param_witnesses":{"x":[{"start":0,"end":1}],"y":[{"start":1,"end":2}]},"return_type":{"abi_type":{"kind":"boolean"},"visibility":"private"},"return_witnesses":[5]},"bytecode":"H4sIAAAAAAAA/7VUSQ7DIAwMJKl67U9slmBu+UpRyf9fUFVVqEQdbpiRkH2wzHjGoKYTazkcc4l7iRY253IwGS0+wcREHpxPGyGhJ/8yZG0mRyGmGCCisxkPH+0BJ+pe0AdUgry0HC/4aqYaWiqmJfQBJTkr5vlvF24N/nUdz+9V3VtwVn4v5/Jo8Lx4sAuSGWHmPKDvMsk+3hFzL/IeQdVy0qx3rw6Smq7Ce6mruVUj//vkPwR1AkL+BQAA","debug_symbols":"lY9NCoAgGETvMmsX/VHgVaLFlxkIoqIWhHj3lOgA7uYxb/MStBUUlTUBPKEDXxOCI1MpRPIRfO4ZpDnKWDLDqbQEn5a8MfRt+tCmjy16gZu8ol3LWlK/y4g/rGB83PfkFw==","file_map":{"47":{"source":"#[export]\npub fn not_equal(x: Field, y: Field) -> bool {\n x != y\n}\n\n#[export]\npub fn not_odd(x: Field) -> bool {\n !(((x as u8) & 1) as bool)\n}\n\n#[test]\nfn test_not_equal() {\n assert(not_equal(1, 2));\n // Uncomment to make test fail\n // assert(not_equal(1, 1));\n}\n\nfn test_not_odd() {\n assert(not_odd(2));\n // Uncomment to make test fail\n // assert(not_equal(1, 1));\n}\n","path":"/home/jz/Documents/code/aztec/recurseNoirTS/circuits/simple/src/lib.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 @@ | ||
{"noir_version":"0.26.0+c46b164ce56e6a8f81255fb17eb6539bd040f336","hash":15860874175066265550,"abi":{"parameters":[{"name":"x","type":{"kind":"field"},"visibility":"private"}],"param_witnesses":{"x":[{"start":0,"end":1}]},"return_type":{"abi_type":{"kind":"boolean"},"visibility":"private"},"return_witnesses":[9]},"bytecode":"H4sIAAAAAAAA/81WzW7DIAx2wpIm2mHqm5i/ALe+Smnh/U87rktWIrGMatJiplpCpoR+/mxscAN3GefxluZsHi38lCbpU9K4TzghFhbo0mBzxLYQg2WtT/M++94WYtZmcb0VsJoN7i37T2lP8wDntcDjWFhrYCOnpHGf8NXZRb9nzi9j2NhkxLZzLImTUsGIwCU/o3DealTaT5Zbrq2+CitlsMoa551Bx5UMPGonQ1zk7sderJiItVAnydsKZ0flM/uGNe89CzUFjVOwzgZnojZ4Ocd4NaguHr1XE0ouozcCvXCzWRf0hX/xYlBIWKC/jBgdFuZ8X+bRpXlf4L8KK8yHbN8H0NZKbmvL5VjgWe3SyMGpMFkKPDVuB3RFUsvvjv6MilwpLsauAm4PtIW8vvRLh/RfnVGtR4M4L0Qei0PSA/ytMxo331add0Yj/N4ZlXCepjM6pLH+HuDxS0BlO0+mfZ1RjAegK9QB6iT5tjOi5LkXayQ812LCZmt5IcAnVgpzjegNAAA=","debug_symbols":"ldLNCsIwEATgd9lzDubHVvMq4mGtEQIhLU0UJOTdTRA9FHqY2w7Ld5opFOaJs59jIlvoQPZSKC0ce0qZ10xWKiPIxXu7tKyCHj44smasV0ESBQoFGgUGBUcUDCgYUXBCwRkubqdq/RfDVkhYKFhoTLTw4tXzLbi+3/57xuk35xbze/l+6gc=","file_map":{"47":{"source":"#[export]\npub fn not_equal(x: Field, y: Field) -> bool {\n x != y\n}\n\n#[export]\npub fn not_odd(x: Field) -> bool {\n !(((x as u8) & 1) as bool)\n}\n\n#[test]\nfn test_not_equal() {\n assert(not_equal(1, 2));\n // Uncomment to make test fail\n // assert(not_equal(1, 1));\n}\n\nfn test_not_odd() {\n assert(not_odd(2));\n // Uncomment to make test fail\n // assert(not_equal(1, 1));\n}\n","path":"/home/jz/Documents/code/aztec/recurseNoirTS/circuits/simple/src/lib.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,22 @@ | ||
#[export] | ||
pub fn not_equal(x: Field, y: Field) -> bool { | ||
x != y | ||
} | ||
|
||
#[export] | ||
pub fn not_odd(x: Field) -> bool { | ||
!(((x as u8) & 1) as bool) | ||
} | ||
|
||
#[test] | ||
fn test_not_equal() { | ||
assert(not_equal(1, 2)); | ||
// Uncomment to make test fail | ||
// assert(not_equal(1, 1)); | ||
} | ||
|
||
fn test_not_odd() { | ||
assert(not_odd(2)); | ||
// Uncomment to make test fail | ||
// assert(not_equal(1, 1)); | ||
} |
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,11 @@ | ||
import { CompiledCircuit } from '@noir-lang/types'; | ||
import { not_equal, not_odd, main_call, main } from './codegen'; | ||
import { setTimeout } from "timers/promises"; | ||
|
||
|
||
async function start() { | ||
let res = await main_call("02", "04"); | ||
console.log(res); | ||
} | ||
|
||
start(); |
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,21 @@ | ||
{ | ||
"license": "UNLICENSED", | ||
"scripts": { | ||
"clean": "rm -rf build", | ||
"compile": "yarn clean && tsc", | ||
"start": "node build/main.js", | ||
"clean:codegen": "rm -rf codegen", | ||
"export:simple": "nargo export --program-dir=./circuits/simple", | ||
"export:recurse": "nargo export --program-dir=./circuits/recurse", | ||
"export:all": "yarn clean:codegen && yarn export:simple && yarn export:recurse", | ||
"codegen": "yarn noir-codegen ./circuits/**/export/*.json", | ||
"compile:all": "yarn export:all && yarn codegen && yarn compile" | ||
}, | ||
"devDependencies": { | ||
"@noir-lang/backend_barretenberg": "^0.26.0", | ||
"@noir-lang/noir_codegen": "^0.26.0", | ||
"@noir-lang/noir_js": "^0.26.0", | ||
"@types/node": "^20.12.2", | ||
"typescript": "^5.4.3" | ||
} | ||
} |
Oops, something went wrong.