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

feat: add a check on OP Succinct cycle count in CI #1064

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
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
2,958 changes: 2,731 additions & 227 deletions Cargo.lock

Large diffs are not rendered by default.

19 changes: 19 additions & 0 deletions bin/host/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,11 @@ op-alloy-network.workspace = true
# Revm
revm = { workspace = true, features = ["std", "c-kzg", "secp256k1", "portable", "blst"] }

# SP1
sp1-sdk = { version = "4.1.0", optional = true }
op-succinct-client-utils = { git = "https://github.com/succinctlabs/op-succinct", tag = "v1.2.2", optional = true }
op-succinct-host-utils = { git = "https://github.com/succinctlabs/op-succinct", tag = "v1.2.2", optional = true }

# General
anyhow.workspace = true
tracing.workspace = true
Expand All @@ -64,11 +69,25 @@ tracing-subscriber = { workspace = true, features = ["fmt"] }
[dev-dependencies]
proptest.workspace = true

[build-dependencies]
sp1-helper = { version = "4.1.0", optional = true }

[features]
default = ["single", "interop"]
single = []
interop = ["single"]
sp1 = [
"dep:sp1-helper",
"dep:sp1-sdk",
"dep:op-succinct-client-utils",
"dep:op-succinct-host-utils",
]

[[bin]]
name = "kona-host"
path = "src/bin/host.rs"

[[bin]]
name = "sp1"
path = "src/sp1/main.rs"
required-features = ["sp1"]
6 changes: 6 additions & 0 deletions bin/host/build.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
//! Builds the SP1 program

fn main() {
#[cfg(feature = "sp1")]
sp1_helper::build_program("./src/sp1/program");
}
7 changes: 7 additions & 0 deletions bin/host/src/kv/mem.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,10 @@ impl KeyValueStore for MemoryKeyValueStore {
Ok(())
}
}

#[cfg(feature = "sp1")]
impl From<MemoryKeyValueStore> for op_succinct_client_utils::InMemoryOracle {
fn from(value: MemoryKeyValueStore) -> Self {
Self { cache: value.store.into_iter().map(|(k, v)| (k.0, v)).collect() }
}
}
22 changes: 22 additions & 0 deletions bin/host/src/sp1/main.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
//! Main entrypoint for SP1 the host binary.

use kona_host::{DiskKeyValueStore, MemoryKeyValueStore};
use op_succinct_client_utils::InMemoryOracle;
use op_succinct_host_utils::get_proof_stdin;
use sp1_sdk::{include_elf, ProverClient};

#[tokio::main(flavor = "multi_thread")]
async fn main() -> anyhow::Result<()> {
let elf = include_elf!("op-succinct");
let disk_kv_store = DiskKeyValueStore::new("./data".into());
let mem_kv_store = MemoryKeyValueStore::try_from(disk_kv_store)?;
let oracle = InMemoryOracle::from(mem_kv_store);
let stdin = get_proof_stdin(oracle)?;
let prover = ProverClient::builder().cpu().build();

let (_, execution_report) = prover.execute(elf, &stdin).run()?;

println!("{execution_report}");

Ok(())
}
Loading