Skip to content

Commit

Permalink
remove configs
Browse files Browse the repository at this point in the history
  • Loading branch information
ratankaliani committed Jan 31, 2025
1 parent 9bc8ff4 commit 32a416a
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 32 deletions.
3 changes: 0 additions & 3 deletions proposer/op/Dockerfile.op_proposer
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion scripts/prove/tests/multi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()?;

Expand Down
20 changes: 19 additions & 1 deletion utils/client/src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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<OR, HW>(
oracle: Arc<StoreOracle<OR, HW>>,
) -> Result<InMemoryOracle>
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<O>(
Expand Down Expand Up @@ -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(
Expand Down
2 changes: 0 additions & 2 deletions utils/client/src/oracle/blob_provider.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<T: CommsClient> {
oracle: Arc<T>,
Expand Down
4 changes: 2 additions & 2 deletions utils/client/src/oracle/in_memory_oracle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<FixedBytes<48>, 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] =
Expand Down Expand Up @@ -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<Bytes48> = blobs
.keys()
Expand Down
27 changes: 4 additions & 23 deletions utils/host/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand Down Expand Up @@ -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<InMemoryOracle, anyhow::Error> {
Expand All @@ -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)
}

0 comments on commit 32a416a

Please sign in to comment.