Skip to content

Commit 1bea52d

Browse files
committed
feat: update write_program_image_id_vk_hash with new programs
1 parent 5335d2a commit 1bea52d

File tree

2 files changed

+34
-18
lines changed

2 files changed

+34
-18
lines changed

aggregation_mode/bin/write_program_image_id_vk_hash.rs

Lines changed: 27 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,48 @@
11
use alloy::hex::hex;
2-
use proof_aggregator::aggregators::{
3-
risc0_aggregator::RISC0_AGGREGATOR_PROGRAM_ID_BYTES, sp1_aggregator,
4-
};
2+
use proof_aggregator::aggregators::{risc0_aggregator, sp1_aggregator};
53
use serde_json::json;
64
use sp1_sdk::HashableKey;
75
use std::{env, fs, path::Path};
86
use tracing::info;
97
use tracing_subscriber::FmtSubscriber;
108

11-
const SP1_PROGRAM_ELF: &[u8] =
12-
include_bytes!("../aggregation_programs/sp1/elf/sp1_aggregator_program");
9+
const SP1_CHUNK_AGGREGATOR_PROGRAM_ELF: &[u8] =
10+
include_bytes!("../aggregation_programs/sp1/elf/sp1_chunk_aggregator_program");
1311

14-
// include!(concat!(env!("OUT_DIR"), "/methods.rs"));
12+
const SP1_ROOT_AGGREGATOR_PROGRAM_ELF: &[u8] =
13+
include_bytes!("../aggregation_programs/sp1/elf/sp1_root_aggregator_program");
1514

1615
fn main() {
1716
let subscriber = FmtSubscriber::builder().finish();
1817
tracing::subscriber::set_global_default(subscriber).expect("setting default subscriber failed");
1918

2019
info!("About to write sp1 programs vk hash bytes + risc0 programs image id bytes");
21-
let sp1_vk_hash = sp1_aggregator::vk_from_elf(SP1_PROGRAM_ELF).bytes32_raw();
22-
//let risc0_image_id_bytes = RISC0_AGGREGATOR_PROGRAM_ID_BYTES;
23-
// Just to test sp1
24-
let risc0_image_id_bytes = SP1_PROGRAM_ELF;
25-
26-
let sp1_vk_hash_hex = hex::encode(sp1_vk_hash);
27-
let risc0_image_id_hex = hex::encode(risc0_image_id_bytes);
20+
let sp1_chunk_aggregator_vk_hash =
21+
sp1_aggregator::vk_from_elf(SP1_CHUNK_AGGREGATOR_PROGRAM_ELF).bytes32_raw();
22+
let sp1_chunk_aggregator_vk_hash_words =
23+
sp1_aggregator::vk_from_elf(SP1_CHUNK_AGGREGATOR_PROGRAM_ELF).hash_u32();
24+
let sp1_root_aggreagot_vk_hash =
25+
sp1_aggregator::vk_from_elf(SP1_ROOT_AGGREGATOR_PROGRAM_ELF).bytes32_raw();
26+
27+
let risc0_chunk_aggregator_image_id_bytes =
28+
risc0_aggregator::RISC0_CHUNK_AGGREGATOR_PROGRAM_ID_BYTES;
29+
let risc0_root_aggregator_image_id_bytes =
30+
risc0_aggregator::RISC0_ROOT_AGGREGATOR_PROGRAM_ID_BYTES;
31+
32+
let sp1_chunk_aggregator_vk_hash_hex = hex::encode(sp1_chunk_aggregator_vk_hash);
33+
let sp1_root_aggregator_vk_hash_hex = hex::encode(sp1_root_aggreagot_vk_hash);
34+
let risc0_chunk_aggregator_image_id_hex = hex::encode(risc0_chunk_aggregator_image_id_bytes);
35+
let risc0_root_aggregator_imaged_id_hex = hex::encode(risc0_root_aggregator_image_id_bytes);
2836

2937
let dest_path = Path::new("programs_ids.json");
3038

3139
let json_data = json!({
32-
"sp1_vk_hash": format!("0x{}", sp1_vk_hash_hex),
33-
"risc0_image_id": format!("0x{}", risc0_image_id_hex),
40+
"sp1_chunk_aggregator_vk_hash": format!("0x{}", sp1_chunk_aggregator_vk_hash_hex),
41+
"sp1_chunk_aggregator_vk_hash_words": format!("{:?}", sp1_chunk_aggregator_vk_hash_words),
42+
"sp1_root_aggregator_vk_hash": format!("0x{}", sp1_root_aggregator_vk_hash_hex),
43+
"risc0_chunk_aggregator_image_id": format!("0x{}", risc0_chunk_aggregator_image_id_hex),
44+
"risc0_chunk_aggregator_image_id_bytes": format!("{:?}", risc0_chunk_aggregator_image_id_bytes),
45+
"risc0_root_aggregator_image_id": format!("0x{}", risc0_root_aggregator_imaged_id_hex),
3446
});
3547

3648
// Write to the file

aggregation_mode/programs_ids.json

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
{
2-
"risc0_image_id": "0xb0ce0665805c4219d134845b74be6f1f97ab74dbbc1b341b73af4068d33bc1b0",
3-
"sp1_vk_hash": "0x0035279b39b0a20aac302dd3c569f3a6324a00acc1b8e864af9e3a5fbf453b69"
4-
}
2+
"risc0_chunk_aggregator_image_id": "0x0184e25336a5ce1757febbca2ec2cd9ae0e7de82389b8d4e4189a044f2adceef",
3+
"risc0_chunk_aggregator_image_id_bytes": "[1, 132, 226, 83, 54, 165, 206, 23, 87, 254, 187, 202, 46, 194, 205, 154, 224, 231, 222, 130, 56, 155, 141, 78, 65, 137, 160, 68, 242, 173, 206, 239]",
4+
"risc0_root_aggregator_image_id": "0x4e2bb70eabcbf1a1f2cda2dd46d84f77014489f938e860d64114df01012cb379",
5+
"sp1_chunk_aggregator_vk_hash": "0x006b4421a6fed44853b9c3ec3c82612827e04fba80d6b8606edae2a4523d9e1e",
6+
"sp1_chunk_aggregator_vk_hash_words": "[899813587, 1068831252, 2000190855, 1210454658, 1057127892, 56287617, 1572193608, 1379769886]",
7+
"sp1_root_aggregator_vk_hash": "0x00a2d19dfab6d777d6cc83ca708170098e1ba92ce2a50b23d980f7e3cff1b36e"
8+
}

0 commit comments

Comments
 (0)