Skip to content

Commit 40934e4

Browse files
committed
update noir version (to fix bug with ecdsa verify)
1 parent 1fbcc8e commit 40934e4

File tree

19 files changed

+104
-83
lines changed

19 files changed

+104
-83
lines changed

circuits/app/proof_of_reserve/coins/Nargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name = "coins"
33
type = "bin"
44

55
[dependencies]
6-
sha256 = { tag = "v0.1.0", git = "https://github.com/noir-lang/sha256" }
7-
ripemd160 = { tag = "v0.0.3", git = "https://github.com/distributed-lab/noir-ripemd160" }
6+
sha256 = { tag = "v0.2.1", git = "https://github.com/noir-lang/sha256" }
7+
ripemd160 = { tag = "v0.0.4", git = "https://github.com/distributed-lab/noir-ripemd160" }
88
utils = { path = "../../../crates/utils" }
99
crypto = { path = "../../../crates/crypto" }

circuits/app/proof_of_reserve/coins/Prover.toml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,23 +2,23 @@ const_message_hash = [49, 95, 91, 219, 118, 208, 120, 196, 59, 138, 192, 6, 78,
22

33
[[coins_database]]
44
script_pub_key = [118, 169, 20, 121, 176, 0, 136, 118, 38, 178, 148, 169, 20, 80, 26, 76, 210, 38, 181, 139, 35, 89, 131, 136, 172]
5-
amount = 2627669
5+
amount = 5077231
66

77
[[coins_database]]
88
script_pub_key = [118, 169, 20, 121, 176, 0, 136, 118, 38, 178, 148, 169, 20, 80, 26, 76, 210, 38, 181, 139, 35, 89, 131, 136, 172]
9-
amount = 3111962
9+
amount = 9905716
1010

1111
[[coins_database]]
1212
script_pub_key = [118, 169, 20, 121, 176, 0, 136, 118, 38, 178, 148, 169, 20, 80, 26, 76, 210, 38, 181, 139, 35, 89, 131, 136, 172]
13-
amount = 3060838
13+
amount = 2493733
1414

1515
[[coins_database]]
1616
script_pub_key = [118, 169, 20, 121, 176, 0, 136, 118, 38, 178, 148, 169, 20, 80, 26, 76, 210, 38, 181, 139, 35, 89, 131, 136, 172]
17-
amount = 9993668
17+
amount = 6735336
1818

1919
[[coins_database]]
20-
script_pub_key = [118, 169, 20, 121, 176, 0, 136, 118, 38, 178, 148, 169, 20, 80, 26, 76, 210, 38, 181, 139, 35, 89, 131, 136, 172]
21-
amount = 7353970
20+
script_pub_key = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
21+
amount = 0
2222

2323
[[own_utxos]]
2424
witness = [48, 69, 2, 33, 0, 176, 13, 195, 19, 255, 73, 45, 45, 108, 64, 66, 69, 250, 68, 134, 160, 179, 250, 237, 127, 30, 197, 101, 2, 107, 209, 142, 13, 184, 235, 138, 56, 2, 32, 120, 103, 36, 158, 33, 198, 151, 26, 30, 56, 250, 37, 73, 202, 33, 166, 26, 253, 114, 192, 163, 252, 223, 56, 48, 150, 15, 48, 27, 224, 6, 63, 0]
@@ -37,5 +37,5 @@ witness = [48, 69, 2, 33, 0, 176, 13, 195, 19, 255, 73, 45, 45, 108, 64, 66, 69,
3737
pub_key = [3, 27, 132, 197, 86, 123, 18, 100, 64, 153, 93, 62, 213, 170, 186, 5, 101, 215, 30, 24, 52, 96, 72, 25, 255, 156, 23, 245, 233, 213, 221, 7, 143, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
3838

3939
[[own_utxos]]
40-
witness = [48, 69, 2, 33, 0, 176, 13, 195, 19, 255, 73, 45, 45, 108, 64, 66, 69, 250, 68, 134, 160, 179, 250, 237, 127, 30, 197, 101, 2, 107, 209, 142, 13, 184, 235, 138, 56, 2, 32, 120, 103, 36, 158, 33, 198, 151, 26, 30, 56, 250, 37, 73, 202, 33, 166, 26, 253, 114, 192, 163, 252, 223, 56, 48, 150, 15, 48, 27, 224, 6, 63, 0]
41-
pub_key = [3, 27, 132, 197, 86, 123, 18, 100, 64, 153, 93, 62, 213, 170, 186, 5, 101, 215, 30, 24, 52, 96, 72, 25, 255, 156, 23, 245, 233, 213, 221, 7, 143, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
40+
witness = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
41+
pub_key = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]

circuits/app/proof_of_reserve/utxos_tree/Nargo.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,5 @@ name = "utxos_tree"
33
type = "bin"
44

55
[dependencies]
6-
utils = { path = "../../../crates/utils" }
6+
utils = { path = "../../../crates/utils" }
7+
bb_proof_verification = { git = "https://github.com/AztecProtocol/aztec-packages/", tag = "v3.0.0-nightly.20251104", directory = "barretenberg/noir/bb_proof_verification" }

circuits/app/proof_of_reserve/utxos_tree/Prover.toml

Lines changed: 4 additions & 3 deletions
Large diffs are not rendered by default.
Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
pub global MAX_MERKLE_TREE_LEVELS: u32 = 3;
22
pub global MAX_NODES_AMOUNT: u32 = 1;
33

4-
pub global HONK_VK_SIZE: u32 = 128;
5-
pub global HONK_PROOF_SIZE: u32 = 456;
6-
pub global HONK_IDENTIFIER: u32 = 1;
74
pub global PUBLIC_INPUTS_SIZE: u32 = 65;
85

96
pub global SHA256_HASH_SIZE: u32 = 32;

circuits/app/proof_of_reserve/utxos_tree/src/main.nr

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,31 +3,29 @@
33

44
mod constants;
55

6-
use constants::{
7-
HONK_IDENTIFIER, HONK_PROOF_SIZE, HONK_VK_SIZE, MAX_MERKLE_TREE_LEVELS, MAX_NODES_AMOUNT,
8-
PUBLIC_INPUTS_SIZE, SHA256_HASH_SIZE,
9-
};
6+
use bb_proof_verification::{UltraHonkVerificationKey, UltraHonkZKProof, verify_ultrahonkzk_proof};
7+
use constants::{MAX_MERKLE_TREE_LEVELS, MAX_NODES_AMOUNT, PUBLIC_INPUTS_SIZE, SHA256_HASH_SIZE};
108
use utils::merkle_root::merkle_root;
119

1210
struct NodeProof {
13-
proof: [Field; HONK_PROOF_SIZE],
11+
proof: UltraHonkZKProof,
1412
public_inputs: [Field; PUBLIC_INPUTS_SIZE],
1513
}
1614

1715
fn main(
18-
verification_key: [Field; HONK_VK_SIZE],
16+
verification_key: UltraHonkVerificationKey,
17+
key_hash: Field,
1918
node_proofs: [NodeProof; MAX_NODES_AMOUNT],
2019
) -> pub ([u8; SHA256_HASH_SIZE], u64) {
2120
let mut nodes = [[0; SHA256_HASH_SIZE]; MAX_NODES_AMOUNT];
2221
let mut owned_amount = 0;
2322

2423
for i in 0..MAX_NODES_AMOUNT {
25-
std::verify_proof_with_type(
24+
verify_ultrahonkzk_proof(
2625
verification_key,
2726
node_proofs[i].proof,
2827
node_proofs[i].public_inputs,
29-
0x0,
30-
HONK_IDENTIFIER,
28+
key_hash,
3129
);
3230
for j in 0..SHA256_HASH_SIZE {
3331
nodes[i][j] = node_proofs[i].public_inputs[j + SHA256_HASH_SIZE] as u8;

circuits/crates/blocks/Nargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@ type = "lib"
44
authors = ["Distributed Lab"]
55

66
[dependencies]
7-
sha256 = { tag = "v0.1.0", git = "https://github.com/noir-lang/sha256" }
8-
bignum = { tag = "v0.7.1", git = "https://github.com/noir-lang/noir-bignum" }
7+
sha256 = { tag = "v0.2.1", git = "https://github.com/noir-lang/sha256" }
8+
bignum = { tag = "v0.8.0", git = "https://github.com/noir-lang/noir-bignum" }
99
convert = { path = "../utils" }

circuits/crates/bvm/Nargo.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ authors = ["Distributed Lab"]
66
[dependencies]
77
utils = { path = "../utils" }
88
sign = { path = "../sign" }
9-
ripemd160 = { tag = "v0.0.3", git = "https://github.com/distributed-lab/noir-ripemd160" }
10-
sha1 = { tag = "v0.1.0", git = "https://github.com/zac-williamson/sha1" }
11-
sha256 = { tag = "v0.1.0", git = "https://github.com/noir-lang/sha256" }
9+
ripemd160 = { tag = "v0.0.4", git = "https://github.com/distributed-lab/noir-ripemd160" }
10+
sha1 = { tag = "v0.11", git = "https://github.com/zac-williamson/sha1" }
11+
sha256 = { tag = "v0.2.1", git = "https://github.com/noir-lang/sha256" }
1212
crypto = { path = "../../crates/crypto" }
13-
bignum = { tag = "v0.7.1", git = "https://github.com/noir-lang/noir-bignum" }
13+
bignum = { tag = "v0.8.0", git = "https://github.com/noir-lang/noir-bignum" }

circuits/crates/bvm/src/stack.nr

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -593,14 +593,14 @@ impl<let MAX_STACK_ELEMENT_SIZE: u32, let MAX_STACK_SIZE: u32, let CURRENT_TRANS
593593
// todo: replace bit shifts with more efficient operations
594594
pub fn op_checklocktimeverify(&mut self) {
595595
let elem = self.data[self.stack_size - 1];
596-
let num = vec_to_i32(elem);
596+
let num = vec_to_u32(elem);
597597
let ltime_offset = self.cur_transaction.lock_time.offset;
598598
let sequence_offset = self.cur_transaction.inputs[self.input_to_sign].sequence.offset;
599599
let mut locktime = 0;
600600
let mut sequence = 0;
601601
for i in 0..4 {
602-
locktime += self.cur_transaction.data[ltime_offset + i] as i32 << (i * 8) as u8;
603-
sequence += self.cur_transaction.data[sequence_offset + i] as i32 << (i * 8) as u8;
602+
locktime += self.cur_transaction.data[ltime_offset + i] as u32 << (i * 8) as u32;
603+
sequence += self.cur_transaction.data[sequence_offset + i] as u32 << (i * 8) as u32;
604604
}
605605

606606
if (num < 0)
@@ -615,14 +615,14 @@ impl<let MAX_STACK_ELEMENT_SIZE: u32, let MAX_STACK_SIZE: u32, let CURRENT_TRANS
615615
// todo: replace bit shifts with more efficiency operations
616616
pub fn op_checksequenceverify(&mut self) {
617617
let elem = self.data[self.stack_size - 1];
618-
let num = vec_to_i32(elem);
618+
let num = vec_to_u32(elem);
619619
let version_offset = self.cur_transaction.version.offset;
620620
let sequence_offset = self.cur_transaction.inputs[self.input_to_sign].sequence.offset;
621621
let mut version = 0;
622622
let mut sequence = 0;
623623
for i in 0..4 {
624-
version += self.cur_transaction.data[version_offset + i] as i32 << (i * 8) as u8;
625-
sequence += self.cur_transaction.data[sequence_offset + i] as i32 << (i * 8) as u8;
624+
version += self.cur_transaction.data[version_offset + i] as u32 << (i * 8) as u32;
625+
sequence += self.cur_transaction.data[sequence_offset + i] as u32 << (i * 8) as u32;
626626
}
627627

628628
let types_are_equal = ((sequence >> 22) & 1) == ((num >> 22) & 1);
@@ -1183,7 +1183,7 @@ impl<let MAX_STACK_ELEMENT_SIZE: u32, let MAX_STACK_SIZE: u32, let CURRENT_TRANS
11831183
let mut message_hash = [0; 32];
11841184

11851185
let (pub_x, pub_y) = keys[N - 1 - i];
1186-
let (signature, hash_type, _) = sigs[sig_now];
1186+
let (signature, hash_type, _) = sigs[sig_now as u32];
11871187

11881188
if hash_type == SIGHASH_ALL {
11891189
message_hash = self.get_sighash_all_message_hash::<SCRIPT_CODE_LEN>(address);

circuits/crates/crypto/Nargo.toml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ type = "lib"
44
authors = ["Distributed Lab"]
55

66
[dependencies]
7-
bignum = { tag = "v0.7.1", git = "https://github.com/noir-lang/noir-bignum" }
8-
bignum2 = {tag = "v0.7.3-2", git = "https://github.com/zkpassport/noir-bignum"}
7+
bignum = { tag = "v0.8.0", git = "https://github.com/noir-lang/noir-bignum" }
8+
bignum2 = {tag = "v0.8.0-2", git = "https://github.com/zkpassport/noir-bignum"}
99
utils = { path = "../utils" }
10-
noir_ecdsa = { tag = "v0.2.7", git = "https://github.com/zkpassport/noir-ecdsa" }
11-
bigcurve = {tag = "v0.9.0-1", git = "https://github.com/zkpassport/noir_bigcurve"}
12-
sha256 = { tag = "v0.1.0", git = "https://github.com/noir-lang/sha256" }
10+
noir_ecdsa = { tag = "v0.2.9", git = "https://github.com/zkpassport/noir-ecdsa" }
11+
bigcurve = {tag = "v0.11.0-1", git = "https://github.com/zkpassport/noir_bigcurve"}
12+
sha256 = { tag = "v0.2.1", git = "https://github.com/noir-lang/sha256" }

0 commit comments

Comments
 (0)