diff --git a/proposer/op/Dockerfile.op_proposer b/proposer/op/Dockerfile.op_proposer index 8909838a..c9c6dde0 100644 --- a/proposer/op/Dockerfile.op_proposer +++ b/proposer/op/Dockerfile.op_proposer @@ -37,9 +37,6 @@ COPY --from=optimism-builder /optimism/op-proposer/proposer/bin/op-proposer /usr # Set the entrypoint to run op-proposer with environment variables COPY ./proposer/op/op_proposer.sh /usr/local/bin/op_proposer.sh -# Copy the rollup configs -COPY ../configs /configs - # Make the binary and entrypoint executable. RUN ls -l /usr/local/bin/ RUN chmod +x /usr/local/bin/op-proposer diff --git a/scripts/prove/tests/multi.rs b/scripts/prove/tests/multi.rs index d125b62a..3f246c87 100644 --- a/scripts/prove/tests/multi.rs +++ b/scripts/prove/tests/multi.rs @@ -11,7 +11,7 @@ use op_succinct_prove::{execute_multi, DEFAULT_RANGE, ONE_HOUR}; mod common; -#[tokio::test] +#[tokio::test(flavor = "multi_thread", worker_threads = 4)] async fn execute_batch() -> Result<()> { dotenv::dotenv()?; diff --git a/utils/client/src/client.rs b/utils/client/src/client.rs index 96c3b3d9..371f1997 100644 --- a/utils/client/src/client.rs +++ b/utils/client/src/client.rs @@ -15,6 +15,8 @@ use kona_driver::DriverResult; use kona_driver::Executor; use kona_driver::TipCursor; use kona_executor::{KonaHandleRegister, TrieDBProvider}; +use kona_preimage::HintWriterClient; +use kona_preimage::PreimageOracleClient; use kona_preimage::{CommsClient, PreimageKeyType}; use kona_proof::errors::OracleProviderError; use kona_proof::executor::KonaExecutor; @@ -36,6 +38,22 @@ use tracing::info; use tracing::warn; use crate::oracle::OPSuccinctOracleBlobProvider; +use crate::precompiles::zkvm_handle_register; +use crate::InMemoryOracle; +use crate::StoreOracle; + +pub async fn run_witnessgen_client( + oracle: Arc>, +) -> Result +where + OR: PreimageOracleClient + Send + Sync + Debug + Clone, + HW: HintWriterClient + Send + Sync + Debug + Clone, +{ + let _ = run_opsuccinct_client(oracle.clone(), Some(zkvm_handle_register)).await?; + let in_memory_oracle = InMemoryOracle::populate_from_store(oracle.as_ref())?; + drop(oracle); + Ok(in_memory_oracle) +} // Sourced from https://github.com/op-rs/kona/tree/main/bin/client/src/single.rs pub async fn run_opsuccinct_client( @@ -124,7 +142,7 @@ where // Run the derivation pipeline until we are able to produce the output root of the claimed // L2 block. - // TODO: Replace advance_to_target to get a more refined cycle count. + // Use custom advance to target with cycle tracking. #[cfg(target_os = "zkvm")] println!("cycle-tracker-report-start: block-execution-and-derivation"); let (safe_head, output_root) = advance_to_target( diff --git a/utils/client/src/oracle/blob_provider.rs b/utils/client/src/oracle/blob_provider.rs index 5266000e..9f39c17e 100644 --- a/utils/client/src/oracle/blob_provider.rs +++ b/utils/client/src/oracle/blob_provider.rs @@ -14,8 +14,6 @@ use maili_protocol::BlockInfo; /// the Keccak256 preimage of the blob commitment and field elements as well as the KZG proof. /// /// https://github.com/op-rs/kona/blob/main/crates/proof-sdk/proof/src/l1/blob_provider.rs -/// -/// TODO: Switch to saving the witness with the blob provider. #[derive(Debug, Clone)] pub struct OPSuccinctOracleBlobProvider { oracle: Arc, diff --git a/utils/client/src/oracle/in_memory_oracle.rs b/utils/client/src/oracle/in_memory_oracle.rs index 59692b66..a159579c 100644 --- a/utils/client/src/oracle/in_memory_oracle.rs +++ b/utils/client/src/oracle/in_memory_oracle.rs @@ -122,13 +122,14 @@ pub fn verify_preimage(key: &PreimageKey, value: &[u8]) -> PreimageOracleResult< impl InMemoryOracle { /// Verifies all data in the oracle. Once the function has been called, all data in the /// oracle can be trusted for the remainder of execution. + /// + /// TODO(r): Switch to using the BlobProvider to save the witness and verify this. pub fn verify(&self) -> AnyhowResult<()> { let mut blobs: HashMap, Blob, BytesHasherBuilder> = HashMap::with_hasher(BytesHasherBuilder); for (key, value) in self.cache.iter() { let preimage_key = PreimageKey::try_from(*key).unwrap(); - // TODO: Switch to using the Blob provider. if preimage_key.key_type() == PreimageKeyType::Blob { // We should verify the keys using the Blob provider. let blob_data_key: [u8; 32] = @@ -168,7 +169,6 @@ impl InMemoryOracle { } } - // TODO: Figure out how to use the Blob provider to verify this. println!("cycle-tracker-report-start: blob-verification"); let commitments: Vec = blobs .keys() diff --git a/utils/host/src/lib.rs b/utils/host/src/lib.rs index 9ca47eab..988f7803 100644 --- a/utils/host/src/lib.rs +++ b/utils/host/src/lib.rs @@ -17,8 +17,7 @@ use kona_preimage::HintWriter; use kona_preimage::OracleReader; use kona_preimage::OracleServer; use log::info; -use op_succinct_client_utils::client::run_opsuccinct_client; -use op_succinct_client_utils::precompiles::zkvm_handle_register; +use op_succinct_client_utils::client::run_witnessgen_client; use op_succinct_client_utils::InMemoryOracle; use op_succinct_client_utils::StoreOracle; use op_succinct_client_utils::{boot::BootInfoStruct, types::AggregationInputs}; @@ -98,7 +97,7 @@ pub fn get_agg_proof_stdin( Ok(stdin) } -/// TODO: Can we run many program tasks in parallel? +/// TODO(r): Can we run many program tasks in parallel? pub async fn start_server_and_native_client( cfg: &SingleChainHostCli, ) -> Result { @@ -119,32 +118,14 @@ pub async fn start_server_and_native_client( .start(), ); - //////////////////////////////////////////////////////////////// - // PROLOGUE // - //////////////////////////////////////////////////////////////// - - // TODO: Confirm that store oracle is as fast as the caching oracle. let oracle = Arc::new(StoreOracle::new( OracleReader::new(preimage_chan.client), HintWriter::new(hint_chan.client), )); - let program_task = task::spawn(run_opsuccinct_client( - oracle.clone(), - Some(zkvm_handle_register), - )); - - // TODO: Clean this up. info!("Starting preimage server and client program."); - let _ = tokio::select! { - r = server_task => { - let _ = r?; - return Err(anyhow!("Server task completed before program task")); - }, - r = program_task => r??, - }; - - let in_memory_oracle = InMemoryOracle::populate_from_store(&oracle).unwrap(); + let in_memory_oracle = run_witnessgen_client(oracle).await?; + server_task.abort(); Ok(in_memory_oracle) }