Skip to content

Commit add8a70

Browse files
authored
Merge pull request #4 from datachainlab/add-image-id-str
Add string representation of image ID Signed-off-by: Jun Kimura <jun.kimura@datachain.jp>
2 parents 60e8a70 + 9da82cf commit add8a70

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

zkvm/risc0/build.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,15 +41,18 @@ fn main() {
4141
};
4242
let elf_path = get_correct_elf_path(&PathBuf::from_str(&guests[0].path).unwrap());
4343
let elf_value = std::fs::read(&elf_path).unwrap();
44-
let image_id = compute_image_id(&elf_value).unwrap().as_words().to_vec();
44+
let image_id = compute_image_id(&elf_value).unwrap();
45+
let image_id_words = image_id.as_words().to_vec();
46+
let image_id_str = image_id.to_string();
4547
let mut elf_file = File::create("./artifacts/dcap-quote-verifier").unwrap();
4648
elf_file.write_all(&elf_value).unwrap();
4749
let mut methods_file = File::create("./src/methods.rs").unwrap();
4850
methods_file
4951
.write_all(
5052
format!(
5153
r##"
52-
pub const DCAP_QUOTE_VERIFIER_ID: [u32; 8] = {image_id:?};
54+
pub const DCAP_QUOTE_VERIFIER_ID: [u32; 8] = {image_id_words:?};
55+
pub const DCAP_QUOTE_VERIFIER_ID_STR: &str = "{image_id_str}";
5356
pub const DCAP_QUOTE_VERIFIER_ELF: &[u8] = include_bytes!("../artifacts/dcap-quote-verifier");
5457
"##
5558
)

zkvm/risc0/src/methods.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11

22
pub const DCAP_QUOTE_VERIFIER_ID: [u32; 8] = [1310702660, 1468422329, 87586300, 1252053983, 3549838645, 1249629134, 1412581844, 922648141];
3+
pub const DCAP_QUOTE_VERIFIER_ID_STR: &str = "44bc1f4eb9588657fc753805dfd3a04a353d96d3ced37b4ad44932544d7efe36";
34
pub const DCAP_QUOTE_VERIFIER_ELF: &[u8] = include_bytes!("../artifacts/dcap-quote-verifier");

0 commit comments

Comments
 (0)