From 027c3aee910a7a0cae1dec4eb19b7865d4aa5c0d Mon Sep 17 00:00:00 2001 From: Brecht Devos Date: Wed, 15 May 2024 05:27:18 +0200 Subject: [PATCH] fix(raiko): make kzg work on SP1 (#205) * fix kzg for SP1 * fix ci --- Cargo.toml | 1 + host/src/raiko.rs | 6 ++++-- provers/risc0/builder/src/main.rs | 7 ++++++- provers/sp1/builder/src/main.rs | 7 ++++++- 4 files changed, 17 insertions(+), 4 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 10a19efb..098f7437 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -115,6 +115,7 @@ prometheus = { version = "0.13.3", features = ["process"] } c-kzg = "1.0.0" c-kzg-taiko = { git = "https://github.com/smtmfft/c-kzg-4844", branch = "for-alpha7", default-features = false, features = [ "preload-kzg-settings", + "no-threads", ] } sha3 = { version = "0.10", default-features = false } sha2 = "0.10.8" diff --git a/host/src/raiko.rs b/host/src/raiko.rs index 04917e01..568845fc 100644 --- a/host/src/raiko.rs +++ b/host/src/raiko.rs @@ -269,7 +269,9 @@ mod tests { async fn test_prove_block_taiko_a7() { let proof_type = get_proof_type_from_env(); let network = Network::TaikoA7; - let block_number = 105987; + // Give the CI an simpler block to test because it doesn't have enough memory. + // Unfortunately that also means that kzg is not getting fully verified by CI. + let block_number = if is_ci() { 105987 } else { 101368 }; let chain_spec = get_network_spec(network); let proof_request = ProofRequest { block_number, @@ -290,7 +292,7 @@ mod tests { async fn test_prove_block_ethereum() { let proof_type = get_proof_type_from_env(); // Skip test on SP1 for now because it's too slow on CI - if proof_type != ProofType::Sp1 { + if !(is_ci() && proof_type == ProofType::Sp1) { let network = Network::Ethereum; let block_number = 19707175; let chain_spec = get_network_spec(network); diff --git a/provers/risc0/builder/src/main.rs b/provers/risc0/builder/src/main.rs index a93f1ac0..81803a21 100644 --- a/provers/risc0/builder/src/main.rs +++ b/provers/risc0/builder/src/main.rs @@ -34,7 +34,12 @@ impl Pipeline for Risc0Pipeline { "panic=abort", ]) .cc_compiler("gcc".into()) - .c_flags(&["/opt/riscv/bin/riscv32-unknown-elf-gcc"]) + .c_flags(&[ + "/opt/riscv/bin/riscv32-unknown-elf-gcc", + "-march=rv32im", + "-mstrict-align", + "-falign-functions=2", + ]) .custom_args(&["--ignore-rust-version"]); // Cannot use /.rustup/toolchains/risc0/bin/cargo, use regular cargo builder.unset_cargo(); diff --git a/provers/sp1/builder/src/main.rs b/provers/sp1/builder/src/main.rs index 86701f42..7db899a1 100644 --- a/provers/sp1/builder/src/main.rs +++ b/provers/sp1/builder/src/main.rs @@ -37,7 +37,12 @@ impl Pipeline for Sp1Pipeline { "panic=abort", ]) .cc_compiler("gcc".into()) - .c_flags(&["/opt/riscv/bin/riscv32-unknown-elf-gcc", "-mstrict-align"]) + .c_flags(&[ + "/opt/riscv/bin/riscv32-unknown-elf-gcc", + "-march=rv32im", + "-mstrict-align", + "-falign-functions=2", + ]) .custom_args(&["--ignore-rust-version"]) }