Skip to content
Merged
Show file tree
Hide file tree
Changes from 8 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
32 changes: 18 additions & 14 deletions ceno_cli/src/commands/common_args/ceno.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@ use ceno_host::{CenoStdin, memory_from_file};
use ceno_zkvm::{
e2e::*,
scheme::{
constants::MAX_NUM_VARIABLES, create_backend, create_prover,
mock_prover::LkMultiplicityKey, verifier::ZKVMVerifier,
constants::MAX_NUM_VARIABLES,
create_backend, create_prover,
mock_prover::LkMultiplicityKey,
verifier::{RiscvMemStateConfig, ZKVMVerifier},
},
};
use clap::Args;
Expand Down Expand Up @@ -354,7 +356,7 @@ fn run_elf_inner<
compilation_options: &CompilationOptions,
elf_path: P,
checkpoint: Checkpoint,
) -> anyhow::Result<E2ECheckpointResult<E, PCS>> {
) -> anyhow::Result<E2ECheckpointResult<E, PCS, RiscvMemStateConfig>> {
let elf_path = elf_path.as_ref();
let elf_bytes =
std::fs::read(elf_path).context(format!("failed to read {}", elf_path.display()))?;
Expand Down Expand Up @@ -410,17 +412,19 @@ fn run_elf_inner<
);

let backend = create_backend(options.max_num_variables, options.security_level);
Ok(run_e2e_with_checkpoint::<E, PCS, _, _>(
create_prover(backend.clone()),
program,
platform,
multi_prover,
&hints,
&public_io,
options.max_steps,
checkpoint,
options.shard_id.map(|v| v as usize),
))
Ok(
run_e2e_with_checkpoint::<E, PCS, _, _, RiscvMemStateConfig>(
create_prover(backend.clone()),
program,
platform,
multi_prover,
&hints,
&public_io,
options.max_steps,
checkpoint,
options.shard_id.map(|v| v as usize),
),
)
}

fn keygen_inner<
Expand Down
7 changes: 5 additions & 2 deletions ceno_cli/src/commands/verify.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@ use crate::utils::print_cargo_message;
use anyhow::{Context, bail};
use ceno_zkvm::{
e2e::{FieldType, PcsKind, verify},
scheme::{ZKVMProof, verifier::ZKVMVerifier},
scheme::{
ZKVMProof,
verifier::{RiscvMemStateConfig, ZKVMVerifier},
},
structs::ZKVMVerifyingKey,
};
use clap::Parser;
Expand Down Expand Up @@ -66,7 +69,7 @@ fn run_inner<E: ExtensionField, PCS: PolynomialCommitmentScheme<E> + Serialize>(
);

let start = std::time::Instant::now();
let vk: ZKVMVerifyingKey<E, PCS> =
let vk: ZKVMVerifyingKey<E, PCS, RiscvMemStateConfig> =
bincode::deserialize_from(File::open(&args.vk).context("Failed to open vk file")?)
.context("Failed to deserialize vk file")?;
print_cargo_message(
Expand Down
15 changes: 9 additions & 6 deletions ceno_cli/src/sdk.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,11 @@ use ceno_recursion::{
use ceno_zkvm::{
e2e::{MultiProver, run_e2e_proof, setup_program},
scheme::{
ZKVMProof, create_backend, create_prover, hal::ProverDevice,
mock_prover::LkMultiplicityKey, prover::ZKVMProver, verifier::ZKVMVerifier,
ZKVMProof, create_backend, create_prover,
hal::ProverDevice,
mock_prover::LkMultiplicityKey,
prover::ZKVMProver,
verifier::{RiscvMemStateConfig, ZKVMVerifier},
},
structs::{ZKVMProvingKey, ZKVMVerifyingKey},
};
Expand Down Expand Up @@ -51,7 +54,7 @@ pub struct Sdk<

// base(app) layer
pub zkvm_pk: Option<Arc<ZKVMProvingKey<E, PCS>>>,
pub zkvm_vk: Option<ZKVMVerifyingKey<E, PCS>>,
pub zkvm_vk: Option<ZKVMVerifyingKey<E, PCS, RiscvMemStateConfig>>,
pub zkvm_prover: Option<ZKVMProver<E, PCS, PB, PD>>,

// aggregation
Expand Down Expand Up @@ -104,7 +107,7 @@ where
}

// allow us to read the app vk from file and then set it
pub fn set_app_vk(&mut self, vk: ZKVMVerifyingKey<E, PCS>) {
pub fn set_app_vk(&mut self, vk: ZKVMVerifyingKey<E, PCS, RiscvMemStateConfig>) {
self.zkvm_vk = Some(vk);
}

Expand Down Expand Up @@ -164,7 +167,7 @@ where
self.zkvm_pk.clone().expect("zkvm pk is not set")
}

pub fn get_app_vk(&self) -> ZKVMVerifyingKey<E, PCS> {
pub fn get_app_vk(&self) -> ZKVMVerifyingKey<E, PCS, RiscvMemStateConfig> {
self.zkvm_vk.clone().expect("zkvm vk is not set")
}

Expand All @@ -176,7 +179,7 @@ where
self.agg_pk.as_ref().expect("agg pk is not set").get_vk()
}

pub fn create_zkvm_verifier(&self) -> ZKVMVerifier<E, PCS> {
pub fn create_zkvm_verifier(&self) -> ZKVMVerifier<E, PCS, RiscvMemStateConfig> {
let Some(app_vk) = self.zkvm_vk.clone() else {
panic!("empty zkvm vk");
};
Expand Down
6 changes: 3 additions & 3 deletions ceno_emul/src/platform.rs
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
use crate::addr::{Addr, RegIdx};
use core::fmt::{self, Formatter};
use once_cell::sync::Lazy;
use serde::{Deserialize, Serialize};
use std::{collections::BTreeSet, fmt::Display, ops::Range, sync::Arc};

use crate::addr::{Addr, RegIdx};

/// The Platform struct holds the parameters of the VM.
/// It defines:
/// - the layout of virtual memory,
/// - special addresses, such as the initial PC,
/// - codes of environment calls.
#[derive(Clone, Debug)]
#[derive(Clone, Debug, Serialize, Deserialize)]
pub struct Platform {
pub rom: Range<Addr>,
pub prog_data: Arc<BTreeSet<Addr>>,
Expand Down
Loading