Skip to content

Commit

Permalink
feat: still working through host issues, many of the scripts aren't c…
Browse files Browse the repository at this point in the history
…ompiling, making progress
  • Loading branch information
ratankaliani committed Jan 24, 2025
1 parent 2769f00 commit f1200db
Show file tree
Hide file tree
Showing 24 changed files with 158 additions and 461 deletions.
411 changes: 92 additions & 319 deletions Cargo.lock

Large diffs are not rendered by default.

23 changes: 14 additions & 9 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ repository = "https://github.com/succinctlabs/op-succinct"
anyhow = { version = "1.0.86", default-features = false }
thiserror = { version = "2.0.3" }
cfg-if = "1.0.0"
spin = { version = "0.9.8", features = ["mutex"] }
spin = { version = "0.9.8" }
lru = "0.12.3"
async-trait = "0.1.80"
sha2 = "0.10.8"
Expand Down Expand Up @@ -68,29 +68,31 @@ kona-host = { git = "https://github.com/op-rs/kona", rev = "a59f643d0627320efff4

# op-succinct
op-succinct-prove = { path = "scripts/prove" }
op-succinct-witnessgen = { path = "scripts/witnessgen" }
op-succinct-client-utils = { path = "utils/client" }
op-succinct-host-utils = { path = "utils/host" }
op-succinct-build-utils = { path = "utils/build" }
op-succinct-proposer = { path = "proposer/succinct" }

# Alloy (Network)
alloy-signer-local = { version = "=0.9.2" }
alloy-provider = { version = "=0.9.2" }
alloy-transport = { version = "=0.9.2" }
alloy-transport-http = { version = "=0.9.2" }
alloy-contract = { version = "=0.9.2" }

# Alloy
alloy = { version = "=0.9.2", default-features = false, features = ["full"] }
alloy-rlp = { version = "=0.3.10", default-features = false }
alloy-trie = { version = "=0.7.8", default-features = false }
alloy-eips = { version = "=0.9.2", default-features = false }
alloy-serde = { version = "=0.9.2", default-features = false }
alloy-provider = { version = "=0.9.2", default-features = false }
alloy-consensus = { version = "=0.9.2", default-features = false }
alloy-transport = { version = "=0.9.2", default-features = false }
alloy-rpc-types = { version = "=0.9.2", default-features = false }
alloy-rpc-client = { version = "=0.9.2", default-features = false }
alloy-primitives = { version = "=0.8.18", default-features = false }
alloy-primitives = { version = "=0.8.19", default-features = false }
alloy-node-bindings = { version = "=0.9.2", default-features = false }
alloy-transport-http = { version = "=0.9.2", default-features = false }
alloy-rpc-types-engine = { version = "=0.9.2", default-features = false }
alloy-rpc-types-beacon = { version = "=0.9.2", default-features = false }
alloy-sol-types = { version = "=0.8.18", default-features = false }
alloy-sol-types = { version = "=0.8.19", default-features = false }

# OP Alloy
op-alloy-consensus = { version = "=0.9.5", default-features = false }
Expand All @@ -110,7 +112,10 @@ revm = { version = "19.3.0", default-features = false, features = ["kzg-rs"] }

# sp1
sp1-lib = { version = "4.0.0", features = ["verify"] }
sp1-sdk = { version = "4.0.0" }
# sp1-sdk = { version = "4.0.0" }
# Switch back to crates SP1 SDK after the release that turns off alloy default features is out.
# https://github.com/succinctlabs/sp1/pull/1980
sp1-sdk = { git = "https://github.com/succinctlabs/sp1", branch = "ratan/set-alloy-features-off-by-default" }
sp1-zkvm = { version = "4.0.0", features = ["verify", "embedded"] }
sp1-build = { version = "4.0.0" }

Expand Down
2 changes: 1 addition & 1 deletion programs/aggregation/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ sp1-zkvm = { workspace = true }
sp1-lib = { workspace = true }
op-succinct-client-utils = { workspace = true }
alloy-consensus = { workspace = true }
alloy-primitives = { workspace = true }
alloy-primitives = { workspace = true, default-features = false }
alloy-sol-types = { workspace = true }
serde_cbor.workspace = true
bincode.workspace = true
2 changes: 1 addition & 1 deletion programs/aggregation/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ sp1_zkvm::entrypoint!(main);
use alloy_consensus::Header;
use alloy_primitives::B256;
use alloy_sol_types::SolValue;
use std::collections::HashMap;
use alloy_primitives::map::HashMap;

use op_succinct_client_utils::{
boot::BootInfoStruct,
Expand Down
2 changes: 1 addition & 1 deletion programs/range/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ maili-genesis.workspace = true
alloy-consensus.workspace = true
alloy-eips.workspace = true
alloy-rlp.workspace = true
alloy-primitives.workspace = true
alloy-primitives = { workspace = true, default-features = false }

# sp1
sp1-zkvm.workspace = true
Expand Down
5 changes: 2 additions & 3 deletions programs/range/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
//! native mode, the data for verifying the batch validity is fetched from RPC, while in zkVM mode,
//! the data is supplied by the host binary to the verifiable program.
#![cfg_attr(target_os = "zkvm", no_main)]
#![no_main]
sp1_zkvm::entrypoint!(main);

extern crate alloc;

Expand All @@ -29,8 +30,6 @@ use maili_genesis::RollupConfig;
use op_succinct_client_utils::precompiles::zkvm_handle_register;
use tracing::{error, info};

sp1_zkvm::entrypoint!(main);

use alloc::vec::Vec;
use op_succinct_client_utils::{boot::BootInfoStruct, BootInfoWithBytesConfig, InMemoryOracle};
use serde_json;
Expand Down
3 changes: 1 addition & 2 deletions proposer/succinct/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@ path = "bin/server.rs"

# workspace
tokio = { workspace = true }
alloy-primitives = { workspace = true }
alloy = { workspace = true }
alloy-primitives = { workspace = true, default-features = false }

# local
op-succinct-host-utils.workspace = true
Expand Down
2 changes: 1 addition & 1 deletion scripts/fees/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ clap = { workspace = true }
anyhow = { workspace = true }
tokio = { workspace = true }
dotenv = { workspace = true }
alloy-primitives = { workspace = true }
alloy-primitives = { workspace = true, default-features = false }
3 changes: 2 additions & 1 deletion scripts/prove/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,15 @@ csv.workspace = true

# kona
kona-host = { workspace = true }
kona-preimage = { workspace = true }

# local
op-succinct-host-utils.workspace = true
op-succinct-client-utils.workspace = true
op-succinct-scripts = { path = "../utils" }

# alloy
alloy-primitives = { workspace = true }
alloy-primitives = { workspace = true, default-features = false }

# sp1
sp1-sdk = { workspace = true }
Expand Down
12 changes: 11 additions & 1 deletion scripts/prove/bin/multi.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
use anyhow::Result;
use clap::Parser;
use kona_host::start_native_preimage_server;
use kona_preimage::{BidirectionalChannel, HintWriter, OracleReader, PreimageKey, PreimageKeyType};
use op_succinct_host_utils::{
block_range::get_validated_block_range,
fetcher::{CacheMode, OPSuccinctDataFetcher, RunContext},
Expand Down Expand Up @@ -38,7 +40,15 @@ async fn main() -> Result<()> {

// By default, re-run the native execution unless the user passes `--use-cache`.
let witness_generation_time_sec = if !args.use_cache {
generate_witness(&host_cli).await?
let hint_chan = BidirectionalChannel::new()?;
let preimage_chan = BidirectionalChannel::new()?;
// Create the server and start it.
let server_task = task::spawn(start_native_preimage_server(
kv_store,
fetcher,
hint_chan.host,
preimage_chan.host,
));
} else {
Duration::ZERO
};
Expand Down
3 changes: 1 addition & 2 deletions scripts/utils/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,7 @@ path = "bin/gen_sp1_test_artifacts.rs"
[dependencies]

# workspace
alloy-primitives = { workspace = true }
alloy = { workspace = true }
alloy-primitives = { workspace = true, default-features = false }
bincode = { workspace = true }
tokio = { workspace = true }
clap = { workspace = true }
Expand Down
1 change: 0 additions & 1 deletion scripts/utils/bin/fetch_and_save_proof.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
use alloy::{hex, sol_types::SolValue};
use alloy_primitives::B256;
use anyhow::Result;
use clap::Parser;
Expand Down
1 change: 0 additions & 1 deletion scripts/utils/bin/fetch_rollup_config.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
use alloy::{eips::BlockId, hex, signers::local::PrivateKeySigner};
use alloy_primitives::Address;
use anyhow::Result;
use op_succinct_client_utils::{boot::hash_rollup_config, types::u32_to_u8};
Expand Down
18 changes: 0 additions & 18 deletions scripts/witnessgen/Cargo.toml

This file was deleted.

28 changes: 0 additions & 28 deletions scripts/witnessgen/bin/native_host_runner.rs

This file was deleted.

33 changes: 0 additions & 33 deletions utils/build/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,35 +43,6 @@ fn build_native_program(program: &str, program_args: ProgramBuildArgs) {
);
}

/// Build the native host runner to a separate target directory to avoid build lockups.
fn build_native_host_runner() {
let metadata = cargo_metadata::MetadataCommand::new()
.exec()
.expect("Failed to get cargo metadata");
let target_dir = metadata.target_directory.join("native_host_runner");

let status = Command::new("cargo")
.args([
"build",
"--workspace",
"--bin",
"native_host_runner",
"--release",
"--target-dir",
target_dir.as_ref(),
])
.status()
.expect("Failed to execute cargo build command");
if !status.success() {
panic!("Failed to build native_host_runner");
}

println!(
"cargo:warning=native_host_runner built with release profile at {}",
current_datetime()
);
}

pub(crate) fn current_datetime() -> String {
let now = Local::now();
now.format("%Y-%m-%d %H:%M:%S").to_string()
Expand Down Expand Up @@ -105,8 +76,4 @@ pub fn build_all(program_args: ProgramBuildArgs) {

// Build aggregation program.
// build_zkvm_program("aggregation");

// Note: Don't comment this out, because the Docker program depends on the native host runner
// being built.
build_native_host_runner();
}
2 changes: 1 addition & 1 deletion utils/client/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ op-alloy-consensus.workspace = true
alloy-consensus.workspace = true
alloy-rlp.workspace = true
alloy-eips.workspace = true
alloy-primitives.workspace = true
alloy-primitives = { workspace = true, default-features = false }
alloy-sol-types.workspace = true
revm.workspace = true

Expand Down
16 changes: 10 additions & 6 deletions utils/host/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,16 @@ maili-protocol.workspace = true
op-alloy-consensus.workspace = true

# alloy
alloy = { workspace = true }
alloy-rlp.workspace = true
alloy-primitives.workspace = true
alloy-consensus.workspace = true
alloy-sol-types.workspace = true
alloy-eips.workspace = true
alloy-signer-local = { workspace = true, default-features = false }
alloy-provider = { workspace = true, default-features = false }
alloy-transport = { workspace = true, default-features = true }
alloy-transport-http = { workspace = true, default-features = true }
alloy-rlp = { workspace = true, default-features = false }
alloy-primitives = { workspace = true, default-features = false }
alloy-consensus = { workspace = true, default-features = false }
alloy-sol-types = { workspace = true, default-features = false }
alloy-eips = { workspace = true, default-features = false }
alloy-contract = { workspace = true, default-features = false }

# kona
kona-host.workspace = true
Expand Down
1 change: 0 additions & 1 deletion utils/host/src/block_range.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ use crate::fetcher::{OPSuccinctDataFetcher, RPCMode};
use alloy_eips::BlockId;
use anyhow::{bail, Result};
use futures::StreamExt;
use op_alloy_rpc_types::{OutputResponse, SafeHeadResponse};
use serde::{Deserialize, Serialize};

/// Get the start and end block numbers for a range, with validation.
Expand Down
Loading

0 comments on commit f1200db

Please sign in to comment.