Skip to content

Commit 1660e74

Browse files
committed
Fix e2e test
1 parent a58599b commit 1660e74

4 files changed

Lines changed: 20 additions & 9 deletions

File tree

prover/Cargo.toml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,14 @@ version = "0.1.0"
44
edition = "2021"
55

66
[dependencies]
7+
bitcoin.workspace = true
78
header-chain = { path = "../header-chain" }
89
final-spv = { path = "../final-spv" }
910
borsh = {version = "1.5.3", features = ["derive"] }
10-
risc0-zkvm = {version = "1.2.5", default-features = false, features = ["prove", "client"]}
11-
risc0-zkp = {version = "1.2.5", default-features = false, features = ["prove"]}
12-
risc0-binfmt = {version = "1.2.5"}
13-
risc0-circuit-recursion = {version = "1.2.5"}
11+
risc0-zkvm = {version = "2.0.2", default-features = false, features = ["prove", "client"]}
12+
risc0-zkp = {version = "2.0.1", default-features = false, features = ["prove"]}
13+
risc0-binfmt = {version = "2.0.1"}
14+
risc0-circuit-recursion = {version = "2.0.1"}
1415
sha2 = { version = "0.10.8", default-features = false }
1516
blake3 = { version = "1.5.0", default-features = false }
1617
tempfile = "3.10.1"

prover/data/mainnet_first_10.bin

64 Bytes
Binary file not shown.

prover/src/docker.rs

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,13 +89,21 @@ pub fn stark_to_succinct(
8989
println!("Succinct control root a0 dec: {:?}", a0_dec);
9090
println!("Succinct control root a1 dec: {:?}", a1_dec);
9191
println!("CONTROL_ID: {:?}", ident_receipt.control_id);
92-
let id_bn254_fr_bits: Vec<String> = ident_receipt
92+
let mut id_bn254_fr_bits: Vec<String> = ident_receipt
9393
.control_id
9494
.as_bytes()
9595
.iter()
9696
.flat_map(|&byte| (0..8).rev().map(move |i| ((byte >> i) & 1).to_string()))
9797
.collect();
9898
println!("id_bn254_fr_bits: {:?}", id_bn254_fr_bits);
99+
// remove 248th and 249th bits
100+
id_bn254_fr_bits.remove(248);
101+
id_bn254_fr_bits.remove(248);
102+
103+
println!(
104+
"id_bn254_fr_bits after removing 2 extra bits: {:?}",
105+
id_bn254_fr_bits
106+
);
99107

100108
let mut seal_json: Value = {
101109
let file_content = fs::read_to_string(&seal_path).unwrap();
@@ -112,13 +120,15 @@ pub fn stark_to_succinct(
112120
let output = Command::new("docker")
113121
.arg("run")
114122
.arg("--rm")
123+
.arg("--platform=linux/amd64") // Force linux/amd64 platform
115124
.arg("-v")
116125
.arg(format!("{}:/mnt", work_dir.to_string_lossy()))
117126
.arg("ozancw/risc0-to-bitvm2-groth16-prover:latest")
118127
.stdout(Stdio::piped())
119128
.stderr(Stdio::piped())
120129
.output()
121130
.unwrap();
131+
122132
println!("Output: {:?}", output);
123133

124134
if !output.status.success() {
@@ -130,6 +140,7 @@ pub fn stark_to_succinct(
130140
println!("proof_path: {:?}", proof_path);
131141
let proof_content = std::fs::read_to_string(proof_path).unwrap();
132142
let output_content_dec = std::fs::read_to_string(output_path).unwrap();
143+
println!("output content: {:?}", output_content_dec);
133144
let proof_json: ProofJson = serde_json::from_str(&proof_content).unwrap();
134145
// let output_json: Value = serde_json::from_str(&output_content).unwrap();
135146
// Convert output_content_dec from decimal to hex
@@ -149,8 +160,7 @@ pub fn stark_to_succinct(
149160
};
150161

151162
// Step 3: Decode the hexadecimal string to a byte vector
152-
let output_byte_vec = Vec::<u8>::from_hex(&output_content_hex).unwrap();
153-
// let output_byte_vec = Vec::<u8>::from_hex(output_hex).unwrap();
163+
let output_byte_vec = Vec::from_hex(&output_content_hex).unwrap();
154164
let output_bytes: [u8; 31] = output_byte_vec.as_slice().try_into().unwrap();
155165
(proof_json.try_into().unwrap(), output_bytes)
156166
}

prover/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -191,8 +191,8 @@ mod tests {
191191
/// Run this test only when build for the mainnet
192192
#[test]
193193
fn test_final_circuit() {
194-
let final_circuit_elf = include_bytes!("../elfs/mainnet-final-spv-guest");
195-
let header_chain_circuit_elf = include_bytes!("../elfs/mainnet-header-chain-guest");
194+
let final_circuit_elf = include_bytes!("../elfs/mainnet-final-spv-guest.bin");
195+
let header_chain_circuit_elf = include_bytes!("../elfs/mainnet-header-chain-guest.bin");
196196
println!(
197197
"Header chain circuit id: {:#?}",
198198
compute_image_id(header_chain_circuit_elf)

0 commit comments

Comments
 (0)