|
| 1 | +use std::{env, fs, sync::Arc, time::Instant}; |
| 2 | + |
1 | 3 | use anyhow::{Context, Result}; |
2 | 4 | use clap::Parser; |
3 | 5 | use op_succinct_host_utils::{ |
4 | 6 | block_range::get_validated_block_range, fetcher::OPSuccinctDataFetcher, host::OPSuccinctHost, |
5 | | - stats::ExecutionStats, witness_generation::WitnessGenerator, |
| 7 | + network::parse_fulfillment_strategy, stats::ExecutionStats, |
| 8 | + witness_generation::WitnessGenerator, |
6 | 9 | }; |
7 | 10 | use op_succinct_proof_utils::{get_range_elf_embedded, initialize_host}; |
8 | 11 | use op_succinct_prove::{execute_multi, DEFAULT_RANGE}; |
9 | 12 | use op_succinct_scripts::HostExecutorArgs; |
10 | | -use sp1_sdk::{utils, ProverClient}; |
11 | | -use std::{fs, sync::Arc, time::Instant}; |
| 13 | +use sp1_sdk::{utils, Prover, ProverClient}; |
12 | 14 | use tracing::debug; |
13 | 15 |
|
14 | 16 | /// Execute the OP Succinct program for multiple blocks. |
@@ -46,13 +48,19 @@ async fn main() -> Result<()> { |
46 | 48 | // Get the stdin for the block. |
47 | 49 | let sp1_stdin = host.witness_generator().get_sp1_stdin(witness_data)?; |
48 | 50 |
|
49 | | - let prover = ProverClient::from_env(); |
50 | | - |
51 | 51 | if args.prove { |
52 | 52 | // If the prove flag is set, generate a proof. |
53 | | - let (pk, _) = prover.setup(get_range_elf_embedded()); |
54 | | - // Generate proofs in compressed mode for aggregation verification. |
55 | | - let proof = prover.prove(&pk, &sp1_stdin).compressed().run().unwrap(); |
| 53 | + let network_prover = ProverClient::builder().network().build(); |
| 54 | + |
| 55 | + let (pk, _) = network_prover.setup(get_range_elf_embedded()); |
| 56 | + |
| 57 | + // Generate a range proof in compressed mode for aggregation verification. |
| 58 | + let proof = network_prover |
| 59 | + .prove(&pk, &sp1_stdin) |
| 60 | + .compressed() |
| 61 | + .strategy(parse_fulfillment_strategy(env::var("RANGE_PROOF_STRATEGY")?)) |
| 62 | + .run() |
| 63 | + .unwrap(); |
56 | 64 |
|
57 | 65 | // Create a proof directory for the chain ID if it doesn't exist. |
58 | 66 | let proof_dir = format!("data/{}/proofs", data_fetcher.get_l2_chain_id().await.unwrap()); |
|
0 commit comments