Skip to content
Merged
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
1 change: 0 additions & 1 deletion Cargo.lock

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

1 change: 0 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@ tracing = { version = "0.1", features = [
tracing-forest = { version = "0.1.6" }
tracing-subscriber = { version = "0.3", features = ["env-filter"] }
uint = "0.8"
lazy_static = "1.5.0"

ceno_gpu = { path = "utils/cuda_hal", package = "cuda_hal" }

Expand Down
3 changes: 1 addition & 2 deletions ceno_zkvm/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ sumcheck.workspace = true
transcript.workspace = true
whir.workspace = true
witness.workspace = true
lazy_static.workspace = true

itertools.workspace = true
ndarray.workspace = true
Expand All @@ -49,12 +48,12 @@ derive = { path = "../derive" }
generic-array.workspace = true
generic_static = "0.2"
num.workspace = true
num-bigint = "0.4.6"
parse-size = "1.1"
rand.workspace = true
sp1-curves.workspace = true
tempfile = "3.14"
tiny-keccak.workspace = true
num-bigint = "0.4.6"

[target.'cfg(unix)'.dependencies]
tikv-jemalloc-ctl = { version = "0.6", features = ["stats"], optional = true }
Expand Down
28 changes: 13 additions & 15 deletions ceno_zkvm/src/gadgets/poseidon2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,25 +41,23 @@ impl<F: Field, const WIDTH: usize, const HALF_FULL_ROUNDS: usize, const PARTIAL_
fn from(value: Vec<F>) -> Self {
let mut iter = value.into_iter();
let mut beginning_full_round_constants = [[F::ZERO; WIDTH]; HALF_FULL_ROUNDS];
for round in 0..HALF_FULL_ROUNDS {
for i in 0..WIDTH {
beginning_full_round_constants[round][i] =
iter.next().expect("insufficient round constants");
}
}

beginning_full_round_constants.iter_mut().for_each(|arr| {
arr.iter_mut()
.for_each(|c| *c = iter.next().expect("insufficient round constants"))
});

let mut partial_round_constants = [F::ZERO; PARTIAL_ROUNDS];
for round in 0..PARTIAL_ROUNDS {
partial_round_constants[round] = iter.next().expect("insufficient round constants");
}

partial_round_constants
.iter_mut()
.for_each(|arr| *arr = iter.next().expect("insufficient round constants"));

let mut ending_full_round_constants = [[F::ZERO; WIDTH]; HALF_FULL_ROUNDS];
for round in 0..HALF_FULL_ROUNDS {
for i in 0..WIDTH {
ending_full_round_constants[round][i] =
iter.next().expect("insufficient round constants");
}
}
ending_full_round_constants.iter_mut().for_each(|arr| {
arr.iter_mut()
.for_each(|c| *c = iter.next().expect("insufficient round constants"))
});

assert!(iter.next().is_none(), "round constants are too many");

Expand Down
2 changes: 1 addition & 1 deletion ceno_zkvm/src/instructions/global.rs
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ pub struct GlobalChipInput<E: ExtensionField> {
}

impl<E: ExtensionField> GlobalChip<E> {
fn assign_instance<'a>(
fn assign_instance(
config: &GlobalConfig<E>,
instance: &mut [E::BaseField],
_lk_multiplicity: &mut LkMultiplicity,
Expand Down
2 changes: 1 addition & 1 deletion ceno_zkvm/src/instructions/riscv/rv32im/mmu.rs
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ impl<E: ExtensionField> MmuConfig<'_, E> {
&self.local_final_circuit,
&(shard_ctx, all_records.as_slice()),
)?;
witness.assign_global_chip_circuit(cs, &shard_ctx, &self.ram_bus_circuit)?;
witness.assign_global_chip_circuit(cs, shard_ctx, &self.ram_bus_circuit)?;

Ok(())
}
Expand Down
1 change: 1 addition & 0 deletions ceno_zkvm/src/scheme.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ pub struct PublicValues {
}

impl PublicValues {
#[allow(clippy::too_many_arguments)]
pub fn new(
exit_code: u32,
init_pc: u32,
Expand Down
20 changes: 9 additions & 11 deletions ceno_zkvm/src/scheme/cpu/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,7 @@ pub type TowerRelationOutput<E> = (
pub struct CpuEccProver;

impl CpuEccProver {
pub fn new() -> Self {
Self {}
}

pub fn create_ecc_proof<'a, E: ExtensionField>(
&self,
num_instances: usize,
xs: Vec<Arc<MultilinearExtension<'a, E>>>,
ys: Vec<Arc<MultilinearExtension<'a, E>>>,
Expand Down Expand Up @@ -299,7 +294,13 @@ impl<E: ExtensionField, PCS: PolynomialCommitmentScheme<E>> EccQuarkProver<CpuBa
invs: Vec<Arc<MultilinearExtension<'a, E>>>,
transcript: &mut impl Transcript<E>,
) -> Result<EccQuarkProof<E>, ZKVMError> {
Ok(CpuEccProver::new().create_ecc_proof(num_instances, xs, ys, invs, transcript))
Ok(CpuEccProver::create_ecc_proof(
num_instances,
xs,
ys,
invs,
transcript,
))
}
}

Expand Down Expand Up @@ -1224,8 +1225,7 @@ mod tests {
let (ys, s) = rest.split_at(SEPTIC_EXTENSION_DEGREE);

let mut transcript = BasicTranscript::new(b"test");
let prover = CpuEccProver::new();
let quark_proof = prover.create_ecc_proof(
let quark_proof = CpuEccProver::create_ecc_proof(
n_points,
xs.iter().cloned().map(Arc::new).collect_vec(),
ys.iter().cloned().map(Arc::new).collect_vec(),
Expand All @@ -1235,10 +1235,8 @@ mod tests {

assert_eq!(quark_proof.sum, final_sum);
let mut transcript = BasicTranscript::new(b"test");
let verifier = EccVerifier::new();
assert!(
verifier
.verify_ecc_proof(&quark_proof, &mut transcript)
EccVerifier::verify_ecc_proof(&quark_proof, &mut transcript)
.inspect_err(|err| println!("err {:?}", err))
.is_ok()
);
Expand Down
Loading
Loading