Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add risc0-prover to rollup-template. #1031

Merged
merged 8 commits into from
Oct 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#![no_main]
use sov_risc0_adapter::guest::Risc0Guest;
use demo_stf::{create_zk_app_template, AppVerifier};

use sov_rollup_interface::mocks::MockDaVerifier;

risc0_zkvm::guest::entry!(main);
Expand Down
1 change: 1 addition & 0 deletions templates/rollup-template/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ serde_json = { workspace = true }
jsonrpsee = { workspace = true }
anyhow = { workspace = true }

template-risc0 = { path = "./provers/risc0" }
template-stf = { path = "./stf", features = ["native"] }

sov-db = { path = "../../full-node/db/sov-db" }
Expand Down
2 changes: 2 additions & 0 deletions templates/rollup-template/provers/risc0/.cargo/config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[patch.crates-io]
cc = { git = "https://github.com/rust-lang/cc-rs", rev = "e5bbdfa" }
16 changes: 16 additions & 0 deletions templates/rollup-template/provers/risc0/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
[package]
name = "template-risc0"
version = "0.2.0"
edition = "2021"
resolver = "2"
license = "MIT OR Apache-2.0"
publish = false

[build-dependencies]
risc0-build = { workspace = true }

[package.metadata.risc0]
methods = ["guest-mock"]

[features]
bench = []
23 changes: 23 additions & 0 deletions templates/rollup-template/provers/risc0/build.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
use std::collections::HashMap;

fn main() {
if std::env::var("CI_SKIP_GUEST_BUILD").is_ok() {
println!("Skipping guest build for CI run");
let out_dir = std::env::var_os("OUT_DIR").unwrap();
let out_dir = std::path::Path::new(&out_dir);
let methods_path = out_dir.join("methods.rs");

let elf = r#"
pub const MOCK_DA_ELF: &[u8] = &[];
"#;

std::fs::write(methods_path, elf).expect("Failed to write mock rollup elf");
} else {
let guest_pkg_to_options = get_guest_options();
risc0_build::embed_methods_with_options(guest_pkg_to_options);
}
}

fn get_guest_options() -> HashMap<&'static str, risc0_build::GuestOptions> {
HashMap::new()
}
Loading