Skip to content

Commit 7c5abd9

Browse files
committed
prove many chunks async
1 parent 2bae6f3 commit 7c5abd9

File tree

9 files changed

+408
-126
lines changed

9 files changed

+408
-126
lines changed
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
const_message_hash = [49, 95, 91, 219, 118, 208, 120, 196, 59, 138, 192, 6, 78, 74, 1, 100, 97, 43, 31, 206, 119, 200, 105, 52, 91, 252, 148, 199, 88, 148, 237, 211]
2+
3+
[[coins_database]]
4+
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 = 8651008
6+
7+
[[coins_database]]
8+
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 = 7299269
10+
11+
[[coins_database]]
12+
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 = 2193795
14+
15+
[[coins_database]]
16+
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 = 8517520
18+
19+
[[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 = 6174260
22+
23+
[[coins_database]]
24+
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]
25+
amount = 9936895
26+
27+
[[coins_database]]
28+
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]
29+
amount = 3330723
30+
31+
[[coins_database]]
32+
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]
33+
amount = 5061920
34+
35+
[[own_utxos]]
36+
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+
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]
38+
39+
[[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]
42+
43+
[[own_utxos]]
44+
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]
45+
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]
46+
47+
[[own_utxos]]
48+
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]
49+
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]
50+
51+
[[own_utxos]]
52+
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]
53+
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]
54+
55+
[[own_utxos]]
56+
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]
57+
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]
58+
59+
[[own_utxos]]
60+
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]
61+
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]
62+
63+
[[own_utxos]]
64+
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]
65+
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]

circuits/app/proof_of_reserve/coins/Prover.toml renamed to circuits/app/proof_of_reserve/coins/provers/Prover2.toml

Lines changed: 28 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,31 @@ 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 = 5077231
5+
amount = 8798295
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 = 9905716
9+
amount = 8965247
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 = 2493733
13+
amount = 2620697
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 = 6735336
17+
amount = 2779613
18+
19+
[[coins_database]]
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
22+
23+
[[coins_database]]
24+
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]
25+
amount = 0
26+
27+
[[coins_database]]
28+
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]
29+
amount = 0
1830

1931
[[coins_database]]
2032
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]
@@ -39,3 +51,15 @@ pub_key = [3, 27, 132, 197, 86, 123, 18, 100, 64, 153, 93, 62, 213, 170, 186, 5,
3951
[[own_utxos]]
4052
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]
4153
pub_key = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,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
[[own_utxos]]
64+
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]
65+
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/coins/src/constants.nr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
pub global MAX_COINS_DATABASE_AMOUNT: u32 = 5;
1+
pub global MAX_COINS_DATABASE_AMOUNT: u32 = 8;
22
pub global MAX_MERKLE_TREE_LEVELS: u32 = 4;
33

44
pub global SHA256_HASH_SIZE: u32 = 32;

circuits/app/proof_of_reserve/utxos_tree/Prover.toml

Lines changed: 0 additions & 6 deletions
This file was deleted.

circuits/app/proof_of_reserve/utxos_tree/provers/Prover_0_1.toml

Lines changed: 34 additions & 0 deletions
Large diffs are not rendered by default.

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
pub global MAX_MERKLE_TREE_LEVELS: u32 = 3;
2-
pub global MAX_NODES_AMOUNT: u32 = 1;
1+
pub global MAX_MERKLE_TREE_LEVELS: u32 = 4;
2+
pub global MAX_NODES_AMOUNT: u32 = 8;
33

44
pub global PUBLIC_INPUTS_SIZE: u32 = 65;
55

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

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,17 +21,23 @@ fn main(
2121
let mut owned_amount = 0;
2222

2323
for i in 0..MAX_NODES_AMOUNT {
24-
verify_ultrahonkzk_proof(
25-
verification_key,
26-
node_proofs[i].proof,
27-
node_proofs[i].public_inputs,
28-
key_hash,
29-
);
30-
for j in 0..SHA256_HASH_SIZE {
31-
nodes[i][j] = node_proofs[i].public_inputs[j + SHA256_HASH_SIZE] as u8;
32-
}
24+
if !node_proofs[i].public_inputs.all(|e| e == 0) {
25+
verify_ultrahonkzk_proof(
26+
verification_key,
27+
node_proofs[i].proof,
28+
node_proofs[i].public_inputs,
29+
key_hash,
30+
);
31+
32+
for j in 0..SHA256_HASH_SIZE {
33+
nodes[i][j] = node_proofs[i].public_inputs[j + SHA256_HASH_SIZE] as u8;
34+
}
3335

34-
owned_amount += node_proofs[i].public_inputs[64] as u64;
36+
owned_amount += node_proofs[i].public_inputs[64] as u64;
37+
}
38+
else {
39+
nodes[i] = [0; 32];
40+
}
3541
}
3642

3743
(merkle_root::<MAX_NODES_AMOUNT, MAX_MERKLE_TREE_LEVELS>(nodes), owned_amount)

utxo_indexer/proof_of_reserve/Cargo.toml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,6 @@ serde = { version = "1.0", features = ["derive"] }
1111
serde_json = "1.0.145"
1212
hex = "0.4"
1313
sha2 = "0.10.9"
14-
k256 = { version = "0.11", features = ["ecdsa"] }
14+
k256 = { version = "0.11", features = ["ecdsa"] }
15+
tokio = { version = "1.48.0", features = ["full"] }
16+
futures = "0.3.31"

0 commit comments

Comments
 (0)