Skip to content

Commit

Permalink
wip: certain blocks are failing, but 122864388 works
Browse files Browse the repository at this point in the history
  • Loading branch information
ratankaliani committed Jul 19, 2024
1 parent 7b770a1 commit c0e32d9
Show file tree
Hide file tree
Showing 11 changed files with 299 additions and 282 deletions.
22 changes: 11 additions & 11 deletions Cargo.lock

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

23 changes: 9 additions & 14 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,17 @@ repository = ""
[workspace.dependencies]

# kona
kona-common = { git = "https://github.com/moongate-forks/kona/", branch = "kona-upstream" }
kona-common-proc = { git = "https://github.com/moongate-forks/kona/", branch = "kona-upstream" }
kona-preimage = { git = "https://github.com/moongate-forks/kona/", branch = "kona-upstream", features = [
kona-common = { git = "https://github.com/moongate-forks/kona/", branch = "new-upstream" }
kona-common-proc = { git = "https://github.com/moongate-forks/kona/", branch = "new-upstream" }
kona-preimage = { git = "https://github.com/moongate-forks/kona/", branch = "new-upstream", features = [
"rkyv",
] }
kona-primitives = { git = "https://github.com/moongate-forks/kona/", branch = "kona-upstream" }
kona-mpt = { git = "https://github.com/moongate-forks/kona/", branch = "kona-upstream" }
kona-derive = { git = "https://github.com/moongate-forks/kona/", branch = "kona-upstream", default-features = false }
kona-executor = { git = "https://github.com/moongate-forks/kona/", branch = "kona-upstream" }
kona-client = { git = "https://github.com/moongate-forks/kona/", branch = "kona-upstream" }
kona-primitives = { git = "https://github.com/moongate-forks/kona/", branch = "new-upstream" }
kona-mpt = { git = "https://github.com/moongate-forks/kona/", branch = "new-upstream" }
kona-derive = { git = "https://github.com/moongate-forks/kona/", branch = "new-upstream", default-features = false }
kona-executor = { git = "https://github.com/moongate-forks/kona/", branch = "new-upstream" }
kona-client = { git = "https://github.com/moongate-forks/kona/", branch = "new-upstream" }
kona-host = { git = "https://github.com/moongate-forks/kona/", branch = "new-upstream" }

# general
anyhow = { version = "1.0.86", default-features = false }
Expand Down Expand Up @@ -56,7 +57,6 @@ alloy-primitives = { version = "0.7.6", default-features = false }
alloy-rlp = { version = "0.3.5", default-features = false }
alloy-consensus = { version = "0.1", default-features = false }
alloy-sol-types = { version = "0.7.6" }
kona-host = { git = "https://github.com/moongate-forks/kona/", branch = "kona-upstream" }
op-alloy-consensus = { version = "0.1.0", default-features = false }
alloy-eips = { version = "0.1", default-features = false }
revm = { git = "https://github.com/bluealloy/revm", tag = "v37", version = "10.0.0", default-features = false }
Expand All @@ -73,11 +73,6 @@ panic = "abort"
codegen-units = 1
lto = "fat"

[profile.release]
panic = "abort"
codegen-units = 1
lto = "fat"

[patch.crates-io]
tiny-keccak = { git = "https://github.com/sp1-patches/tiny-keccak", branch = "patch-v2.0.2" }
sha2 = { git = "https://github.com/sp1-patches/RustCrypto-hashes", branch = "patch-v0.10.8", package = "sha2" }
17 changes: 17 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,20 @@ stderr: note: Some details are omitted, run with `RUST_BACKTRACE=full` for a ver
2024-07-18T17:54:03.165344Z INFO execute: close time.busy=57.8s time.idle=2.33µ
```

**Failing Blocks**: 122912529, 122864391

Ex. Similar errors to this where the source slice and destination slice length don't match.

```
stderr: thread '<unnamed>' panicked at zkvm-client/src/oracle/mod.rs:109:34:
stderr: source slice length (48) does not match destination slice length (32)
stderr: stack backtrace:
stderr: note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
2024-07-19T22:38:50.173599Z INFO execute: close time.busy=9.43s time.idle=1.67µs
thread 'main' panicked at zkvm-host/src/lib.rs:99:72:
called `Result::unwrap()` on an `Err` value: execution failed with exit code 1
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
error: Recipe `run-zkvm-host` failed on line 88 with exit code 101
error: Recipe `run` failed on line 11 with exit code 101
```

Binary file modified elf/riscv32im-succinct-zkvm-elf
Binary file not shown.
4 changes: 2 additions & 2 deletions native-host/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
use anyhow::Result;
use kona_host::{init_tracing_subscriber, start_server_and_native_client, HostCli};
pub use kona_host::init_tracing_subscriber;
use kona_host::{start_server_and_native_client, HostCli};

pub async fn run_native_host(cfg: &HostCli) -> Result<()> {
init_tracing_subscriber(cfg.v).unwrap();
start_server_and_native_client(cfg.clone()).await.unwrap();
Ok(())
}
3 changes: 2 additions & 1 deletion native-host/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
use clap::Parser;
use kona_host::HostCli;
use kona_host::{init_tracing_subscriber, HostCli};
use native_host::run_native_host;

#[tokio::main(flavor = "multi_thread")]
async fn main() {
let cfg = HostCli::parse();
init_tracing_subscriber(cfg.v).unwrap();
run_native_host(&cfg).await.unwrap();
}
27 changes: 15 additions & 12 deletions zkvm-host/bin/cost_estimator.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
use anyhow::Result;
use clap::Parser;
use kona_host::init_tracing_subscriber;
use native_host::run_native_host;
use num_format::{Locale, ToFormattedString};
use zkvm_host::{execute_kona_program, SP1KonaDataFetcher};
use zkvm_host::execute_kona_program;
use zkvm_host::fetcher::SP1KonaDataFetcher;

#[derive(Parser, Debug)]
#[command(author, version, about, long_about = None)]
Expand All @@ -21,7 +23,6 @@ struct Args {

/// Skip native data generation if data directory already exists.
#[arg(
short,
long,
help = "Skip native data generation if the Merkle tree data is already stored in data."
)]
Expand All @@ -31,6 +32,10 @@ struct Args {
/// Collect the execution reports across a number of blocks. Inclusive of start and end block.
#[tokio::main]
async fn main() -> Result<()> {
// Initialize tracing subscriber.
let verbosity_level = 1;
init_tracing_subscriber(verbosity_level).unwrap();

dotenv::dotenv().ok();
let args = Args::parse();

Expand All @@ -42,23 +47,21 @@ async fn main() -> Result<()> {
};

for block_num in args.start_block..=args.end_block {
// Get the relevant data for native and zkvm execution.
let block_data = data_fetcher.pull_block_data(block_num).await?;

if !args.skip_datagen {
// Get native execution data.
let native_execution_data = data_fetcher.get_native_execution_data(block_num).await?;
let native_execution_data = data_fetcher.get_native_execution_data(&block_data)?;
run_native_host(&native_execution_data).await?;
}

// Execute Kona program and collect execution reports.
let (boot_info, _) = data_fetcher
.get_boot_info_without_rollup_config(block_num)
.await?;

println!("Boot info: {:?}", boot_info);
let report = execute_kona_program(&boot_info);

println!("Block {}: {}", block_num, report);
// Execute the Kona program.
let report = execute_kona_program(&block_data.into());

reports.push(report);

println!("Executed block {}", block_num);
}

// Nicely print out the total instruction count for each block.
Expand Down
46 changes: 0 additions & 46 deletions zkvm-host/bin/inputs.rs

This file was deleted.

21 changes: 21 additions & 0 deletions zkvm-host/build.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,27 @@
use std::process::Command;

use sp1_helper::{build_program_with_args, BuildArgs};

fn main() {
// Build the zkvm program with the release-client-lto profile for native execution.
let status = Command::new("cargo")
.args(&[
"build",
"--workspace",
"--bin",
"zkvm-client",
"--profile",
"release-client-lto",
])
.status()
.expect("Failed to execute cargo build command");

if !status.success() {
panic!("Failed to build zkvm-client with release-client-lto profile");
}

println!("cargo:warning=zkvm-client built with release-client-lto profile");

build_program_with_args(
"../zkvm-client",
BuildArgs {
Expand Down
Loading

0 comments on commit c0e32d9

Please sign in to comment.