Skip to content

Commit

Permalink
feat: fix
Browse files Browse the repository at this point in the history
  • Loading branch information
ratankaliani committed Oct 30, 2024
1 parent 1c8a1a9 commit 3c2025f
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
14 changes: 14 additions & 0 deletions scripts/utils/bin/cost_estimator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,14 @@ async fn execute_blocks_parallel(
}
futures::future::join_all(handles).await;

let report_path = PathBuf::from(format!(
"execution-reports/{}/{}-{}-report.csv",
l2_chain_id, args.start, args.end
));
if let Some(parent) = report_path.parent() {
fs::create_dir_all(parent)?;
}

// Run the zkVM execution process for each split range in parallel and fill in the execution stats.
host_clis
.chunks(5)
Expand Down Expand Up @@ -187,6 +195,12 @@ async fn execute_blocks_parallel(
.unwrap();
exec_stats.add_report_data(&report);
exec_stats.add_aggregate_data();

let mut csv_writer = csv::Writer::from_path(report_path).unwrap();
csv_writer
.serialize(exec_stats)
.expect("Failed to write execution stats to CSV.");
csv_writer.flush().expect("Failed to flush CSV writer.");
});
});

Expand Down
6 changes: 5 additions & 1 deletion utils/host/src/fetcher.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ use anyhow::anyhow;
use anyhow::Result;
use cargo_metadata::MetadataCommand;
use kona_host::HostCli;
use log::{debug, info};
use op_alloy_genesis::RollupConfig;
use op_alloy_network::{
primitives::{BlockTransactions, BlockTransactionsKind},
Expand Down Expand Up @@ -335,6 +336,9 @@ impl OPSuccinctDataFetcher {
.map(|block_number| {
let l2_provider = l2_provider.clone();
async move {
if block_number % 1000 == 0 {
info!("Fetching block: {}", block_number);
}
let block = l2_provider
.get_block_by_number(block_number.into(), false)
.await?
Expand Down Expand Up @@ -366,7 +370,7 @@ impl OPSuccinctDataFetcher {
})
}
})
.buffered(100)
.buffered(300)
.collect::<Vec<Result<BlockInfo>>>()
.await;

Expand Down

0 comments on commit 3c2025f

Please sign in to comment.