Skip to content

Commit

Permalink
Run tests with prover enabled. (#932)
Browse files Browse the repository at this point in the history
* Remove demo-rollup dep from demo-prover

* add methods to demo-rollup

* fix cargo hack

* fix cargo hack

* Cargo.toml

* install toolchain

* install toolchain

* modify workflow

* update cargo.toml

* rust.yaml

* Add guest-mock

* use real prover in bank tests

* native

* fix lint

* update yaml

* fic coverage

* ELF in CI

* update bench get_guest_options()

* update build.rs

* remove local from demo-rollup

* fix lint

* remove ide_setup

* Remove riscv32im-risc0-zkvm-elf
  • Loading branch information
bkolad authored and dubbelosix committed Sep 29, 2023
1 parent 046dd5b commit d307ac5
Show file tree
Hide file tree
Showing 27 changed files with 1,404 additions and 305 deletions.
25 changes: 21 additions & 4 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -113,16 +113,19 @@ jobs:
- name: cargo hack
run: make check-features
test:
name: test
runs-on: buildjet-4vcpu-ubuntu-2204
timeout-minutes: 60
env:
CI_SKIP_GUEST_BUILD: "1"
steps:
- uses: actions/checkout@v3
- uses: rui314/setup-mold@v1
- name: Install Rust
run: rustup show
# `cargo-nextest` is much faster than standard `cargo test`.
- name: Install cargo-risc0 # Risc0 v0.17 and higher require a cargo extension to build the guest code
run: cargo install cargo-risczero
- name: Install risc0-zkvm toolchain # Use the risc0 cargo extension to install the risc0 std library for the current toolchain
run: cargo risczero install
- uses: taiki-e/install-action@nextest
- uses: Swatinem/rust-cache@v2
with:
Expand All @@ -144,6 +147,10 @@ jobs:
- uses: rui314/setup-mold@v1
- name: Install Rust
run: rustup show
- name: Install cargo-risc0 # Risc0 v0.17 and higher require a cargo extension to build the guest code
run: cargo install cargo-risczero
- name: Install risc0-zkvm toolchain # Use the risc0 cargo extension to install the risc0 std library for the current toolchain
run: cargo risczero install
- uses: Swatinem/rust-cache@v2
with:
cache-provider: "buildjet"
Expand Down Expand Up @@ -193,17 +200,20 @@ jobs:
echo "demo-rollup took too long to process transaction; exiting"
exit 1
coverage:
name: coverage
runs-on: buildjet-8vcpu-ubuntu-2204
timeout-minutes: 90
env:
CI_SKIP_GUEST_BUILD: "1"
steps:
- uses: actions/checkout@v3
with:
submodules: true
- uses: rui314/setup-mold@v1
- name: Install Rust
run: rustup show
- name: Install cargo-risc0 # Risc0 v0.17 and higher require a cargo extension to build the guest code
run: cargo install cargo-risczero
- name: Install risc0-zkvm toolchain # Use the risc0 cargo extension to install the risc0 std library for the current toolchain
run: cargo risczero install
- name: add llvm component
run: rustup component add llvm-tools-preview
- name: cargo install cargo-llvm-cov
Expand Down Expand Up @@ -295,11 +305,18 @@ jobs:
run: git diff --exit-code
check-demo-rollup-bash-commands:
runs-on: ubuntu-latest
# `test` has already built dependencies, so we can share
# caches (the profile is `dev` in both cases).
needs: test
steps:
- uses: actions/checkout@v3
- uses: rui314/setup-mold@v1
- name: Install Rust
run: rustup show
- name: Install cargo-risc0 # Risc0 v0.17 and higher require a cargo extension to build the guest code
run: cargo install cargo-risczero
- name: Install risc0-zkvm toolchain # Use the risc0 cargo extension to install the risc0 std library for the current toolchain
run: cargo risczero install
- uses: Swatinem/rust-cache@v2
with:
cache-provider: "buildjet"
Expand Down
1 change: 1 addition & 0 deletions Cargo.lock

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

3 changes: 0 additions & 3 deletions examples/demo-prover/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,6 @@ You'll need at least 96GiB of RAM to run this example on a x86_64 CPU. If you do
3. Make sure that there's no data from previous runs `rm -rf demo_data`
4. Execute `cargo run -- ../demo-rollup/rollup_config.toml`.

## Development

Follow our [IDE integration](./ide_setup.md) guide document.

## License

Expand Down
26 changes: 0 additions & 26 deletions examples/demo-prover/ide_setup.md

This file was deleted.

2 changes: 1 addition & 1 deletion examples/demo-prover/methods/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ publish = false
risc0-build = { workspace = true }

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

[features]
bench = []
11 changes: 8 additions & 3 deletions examples/demo-prover/methods/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,13 @@ fn main() {
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");
std::fs::write(methods_path, "pub const ROLLUP_ELF: &[u8] = &[];")
.expect("Failed to write mock rollup elf");

let elf = r#"
pub const ROLLUP_ELF: &[u8] = &[];
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);
Expand All @@ -23,7 +28,7 @@ fn get_guest_options() -> HashMap<&'static str, risc0_build::GuestOptions> {
fn get_guest_options() -> HashMap<&'static str, risc0_build::GuestOptions> {
let mut guest_pkg_to_options = HashMap::new();
guest_pkg_to_options.insert(
"sov-demo-prover-guest",
"sov-demo-prover-guest-celestia",
risc0_build::GuestOptions {
features: vec!["bench".to_string()],
},
Expand Down

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,5 +1,5 @@
[package]
name = "sov-demo-prover-guest"
name = "sov-demo-prover-guest-celestia"
version = "0.2.0"
edition = "2021"
resolver = "2"
Expand All @@ -10,8 +10,7 @@ resolver = "2"
anyhow = "1.0.68"
risc0-zkvm = { version = "0.18", default-features = false, features = ["std"] }
risc0-zkvm-platform = "0.18"
demo-stf = { path = "../../../demo-stf", default-features = false }
sov-demo-rollup = { path = "../../../demo-rollup", default-features = false }
demo-stf = { path = "../../../demo-stf" }
sov-risc0-adapter = { path = "../../../../adapters/risc0" }
const-rollup-config = { path = "../../../const-rollup-config" }
sov-celestia-adapter = { path = "../../../../adapters/celestia" }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use const_rollup_config::ROLLUP_NAMESPACE_RAW;
use demo_stf::app::create_zk_app_template;
use sov_celestia_adapter::types::NamespaceId;
use sov_celestia_adapter::verifier::CelestiaVerifier;
use sov_demo_rollup::AppVerifier;
use demo_stf::AppVerifier;
use sov_risc0_adapter::guest::Risc0Guest;

// The rollup stores its data in the namespace b"sov-test" on Celestia
Expand Down
Loading

0 comments on commit d307ac5

Please sign in to comment.