Skip to content

Commit

Permalink
Update workflow and batch circuit
Browse files Browse the repository at this point in the history
  • Loading branch information
ax0 committed Mar 30, 2024
1 parent ef78987 commit 0d3abdb
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 11 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/noir.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ jobs:
uses: noir-lang/[email protected]
with:
toolchain: nightly
- name: Execute single SMT OP circuit
- name: Prove single SMT OP circuit
run: |
cd circuits/single_smt_op
nargo execute
- name: Execute batch SMT OP circuit
nargo prove
- name: Prove batch SMT OP circuit
run: |
cd circuits/batch_smt_op
nargo execute
nargo prove
2 changes: 1 addition & 1 deletion circuits/batch_smt_op/Prover.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
address = ["0x00","0x00","0x00","0x00","0x00","0x00","0x00","0x00","0x00","0x00"]
address = ["0x7e5f4552091a69125d5dfcb7b8c2659029395bdf","0x7e5f4552091a69125d5dfcb7b8c2659029395bdf","0x7e5f4552091a69125d5dfcb7b8c2659029395bdf","0x7e5f4552091a69125d5dfcb7b8c2659029395bdf","0x7e5f4552091a69125d5dfcb7b8c2659029395bdf","0x7e5f4552091a69125d5dfcb7b8c2659029395bdf","0x7e5f4552091a69125d5dfcb7b8c2659029395bdf","0x7e5f4552091a69125d5dfcb7b8c2659029395bdf","0x7e5f4552091a69125d5dfcb7b8c2659029395bdf","0x7e5f4552091a69125d5dfcb7b8c2659029395bdf"]
new_root = "0"
num_transactions = "0"
op = ["0x00","0x00","0x00","0x00","0x00","0x00","0x00","0x00","0x00","0x00"]
Expand Down
11 changes: 5 additions & 6 deletions circuits/batch_smt_op/src/main.nr
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,11 @@ fn main(num_transactions: pub u32, proof: [SMTProof<Field, Field, Field, 160>; N

for i in 0..NUM_TRANSACTIONS
{
if i < num_transactions
{
assert(address_from_pubkey(signature[i].pub_key) == address[i]); // Check address
assert(check_op(op[i], address[i], op_value[i], cur_root, signature[i].msg_hash)); // Check message
cur_root = smt.compute_root(smt.process(proof[i], op[i], address[i], op_value[i], cur_root)); // Compute new root
}
let range_ind = i < num_transactions;
assert(!range_ind | (address_from_pubkey(signature[i].pub_key) == address[i])); // Check address
assert(!range_ind | check_op(op[i], address[i], op_value[i], cur_root, signature[i].msg_hash)); // Check message

cur_root = (range_ind as Field) * smt.compute_root(smt.process(proof[i], op[i], address[i], op_value[i], (range_ind as Field) * cur_root)) + (1 - range_ind as Field) * cur_root; // Compute new root
assert(signature[i].verify()); // Check signature
}

Expand Down

0 comments on commit 0d3abdb

Please sign in to comment.