Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 13 additions & 12 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 16 additions & 3 deletions crates/host-bench/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,9 @@ pub struct HostArgs {
#[arg(long)]
pub output_dir: Option<PathBuf>,

#[arg(long)]
pub app_vk_path: Option<PathBuf>,

/// If specified, loads the app proving key from this path.
#[arg(long)]
pub app_pk_path: Option<PathBuf>,
Expand Down Expand Up @@ -302,6 +305,7 @@ pub async fn run_ceno_reth_benchmark(args: HostArgs) -> eyre::Result<()> {
MultiProver::new(0, 1, (1 << 30) * 8 / 4 / 2, MAX_CYCLE_PER_SHARD),
);

// init app prover and app pk/vk
ceno_sdk.init_base_prover(max_num_variables, security_level);
info!("setup ceno sdk done in {:?}", start.elapsed());

Expand All @@ -314,6 +318,12 @@ pub async fn run_ceno_reth_benchmark(args: HostArgs) -> eyre::Result<()> {
ceno_sdk.set_agg_pk(agg_pk);
}

if let Some(app_vk_path) = args.app_vk_path.as_ref() {
let app_vk = read_object_from_file(app_vk_path)?;
// reset app vk
ceno_sdk.set_app_vk(app_vk);
}

let program_name = format!("reth.{}.block_{}", args.mode, args.block_number);

run_with_metric_collection("OUTPUT_PATH", || {
Expand Down Expand Up @@ -514,14 +524,17 @@ pub async fn run_ceno_reth_benchmark(args: HostArgs) -> eyre::Result<()> {
BenchMode::GenerateFixtures => {
// generate pk,vk if needed
let _app_pk = ceno_sdk.get_app_pk();
let app_vk = ceno_sdk.get_app_vk();
let agg_pk = ceno_sdk.init_agg_pk();

let fixture_path = args.fixtures_path.unwrap();

// TODO serialize ceno app pk
// let mut app_pk_path = fixture_path.clone();
// app_pk_path.push("app_pk.bitcode");
// fs::write(app_pk_path, bitcode::serialize(&app_pk)?)?;

// serialize ceno app vk
let mut app_pk_path = fixture_path.clone();
app_pk_path.push("app_vk.bitcode");
fs::write(app_pk_path, bitcode::serialize(&app_vk)?)?;

let mut agg_pk_path = fixture_path.clone();
agg_pk_path.push("agg_pk.bitcode");
Expand Down
14 changes: 13 additions & 1 deletion reproduce.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,17 @@ export CENO_GPU_CACHE_LEVEL=0
export RUSTFLAGS="-C target-feature=+avx2"
export RUST_LOG=info,ceno_zkvm=debug

if [ -f "fixtures/app_vk.bitcode" ]; then
echo "App VK fixture already exists."
else
cargo run --features "jemalloc" --config net.git-fetch-with-cli=true \
--bin ceno-reth-benchmark-bin --profile release -- \
--block-number 23587691 \
--rpc-url https://eth-mainnet.g.alchemy.com/v2/dpJmxzwalHmaOsZwAB-Djvz2N651QahS \
--fixtures-path fixtures --cache-dir block_data --output-dir output \
--mode generate-fixtures 2>&1 | tee fixture_generation.log
fi

# 1. generate app proof in release mode
if [ -f "output/app_proof.bitcode" ]; then
echo "App proof already exists, skipping generation."
Expand All @@ -18,5 +29,6 @@ fi
cargo run --features "jemalloc,gpu" --config net.git-fetch-with-cli=true \
--bin ceno-reth-benchmark-bin --release -- --block-number 23587691 \
--rpc-url https://eth-mainnet.g.alchemy.com/v2/dpJmxzwalHmaOsZwAB-Djvz2N651QahS \
--cache-dir block_data --output-dir output --app-proofs output/app_proof.bitcode \
--app-vk-path fixtures/app_vk.bitcode --app-proofs output/app_proof.bitcode \
--cache-dir block_data --output-dir output \
--mode prove-stark-only 2>&1 | tee stark.log