Skip to content

Commit 3ab1c72

Browse files
committed
fix: reading proof values in chunk aggregator
1 parent 081904e commit 3ab1c72

5 files changed

Lines changed: 24 additions & 20 deletions

File tree

Binary file not shown.

aggregation_mode/proof_aggregator/aggregation_programs/zisk/src/chunk_aggregator_main.rs

Lines changed: 20 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@ use zisk_aggregation_program::{ChunkAggregatorInput, Hash32};
66

77
// Generated with `make proof_aggregator_write_program_ids` and copied from program_ids.json
88
pub const USER_PROOFS_AGGREGATOR_PROGRAM_ROM_ROOT: [u64; 4] = [
9-
9552917093105913802,
10-
7845128850459495418,
11-
6121665346010988278,
12-
15056293071596476132,
9+
8006415978237093766,
10+
9267864536843082901,
11+
14454613831466088168,
12+
10034785771278346133,
1313
];
1414

1515
pub fn main() {
@@ -23,22 +23,25 @@ pub fn main() {
2323
let proof_words = bytemuck::cast_slice::<u8, u64>(&proof.proof);
2424

2525
// Reading public inputs as done in the verify of the lib at https://github.com/0xPolygonHermez/zisk/blob/maint/checkouts/pil2-proofman-3d49384e4e2f0af7/78497c5/verifier/src/verifier.rs#L66-L73
26-
let mut p = 0;
27-
let n_public_inputs = proof_words[p];
28-
p += 1;
2926

30-
// we should end up with a vector of length 4 as the public input is a 256 bits digest
27+
// First 64 bits are the length of public outputs so we skip it
28+
let mut proof_idx = 1;
29+
30+
// Next 4 entries are the program rom-key
3131
let mut rom_vkey: [u64; 4] = [0_u64; 4];
32+
for i in 0..4 {
33+
rom_vkey[i as usize] = proof_words[proof_idx];
34+
proof_idx += 1;
35+
}
36+
37+
// Next entry is the number of public inputs set by the program with 'ziskos::set_output'
38+
// we should end up with a vector of length 4 as the public input is a 256 bits digest
3239
let mut publics = Vec::new();
33-
for i in 0..n_public_inputs {
34-
// The first 4 entries are the rom vkey
35-
if i < 4 {
36-
rom_vkey[i as usize] = proof_words[p];
37-
p += 1;
38-
}
39-
40-
publics.push(proof_words[p]);
41-
p += 1;
40+
let n_public_inputs = proof_words[proof_idx];
41+
proof_idx += 1;
42+
for _ in 0..n_public_inputs {
43+
publics.push(proof_words[proof_idx]);
44+
proof_idx += 1;
4245
}
4346

4447
// Ensure the aggregated chunk originates from the user proofs aggregation program.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
��^����2�i��Ob�o�'[5�����}�w
1+
,�~�~������ ���(�L�$ܤ�l���

aggregation_mode/proof_aggregator/programs_ids.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,6 @@
55
"sp1_chunk_aggregator_vk_hash": "0x00d6e32a34f68ea643362b96615591c94ee0bf99ee871740ab2337966a4f77af",
66
"sp1_user_proofs_aggregator_vk_hash": "0x00a0fe3e73d4dd5f66369c60629213c8a037da04f8f68724c8a15ed1d20a0d5e",
77
"sp1_user_proofs_aggregator_vk_hash_words": "[1350508345, 1966561241, 1188269068, 690044042, 29282343, 1675238547, 289586595, 1376390494]",
8-
"zisk_chunk_aggregator_rom_vk_hex": "0xfd518d50ee1b5bfe9e594448582fc8556b7313e2607e3d1f10a1d475800912b0",
9-
"zisk_user_proofs_aggregator_rom_vk": "[9552917093105913802, 7845128850459495418, 6121665346010988278, 15056293071596476132]"
8+
"zisk_chunk_aggregator_rom_vk_hex": "0x2ce6917eec7ea5abcbc4cef57f0ca21414bc8f28e04c9d24dca4b96ca98c16f2",
9+
"zisk_user_proofs_aggregator_rom_vk": "[8006415978237093766, 9267864536843082901, 14454613831466088168, 10034785771278346133]"
1010
}

aggregation_mode/proof_aggregator/src/aggregators/zisk_aggregator.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,7 @@ pub(crate) fn run_chunk_aggregator(
181181
INPUT_PATH,
182182
"-o",
183183
OUTPUT_PATH,
184+
"-u",
184185
"-a",
185186
"-y",
186187
"-f",

0 commit comments

Comments
 (0)