repo
stringlengths
6
65
file_url
stringlengths
81
311
file_path
stringlengths
6
227
content
stringlengths
0
32.8k
language
stringclasses
1 value
license
stringclasses
7 values
commit_sha
stringlengths
40
40
retrieved_at
stringdate
2026-01-04 15:31:58
2026-01-04 20:25:31
truncated
bool
2 classes
scroll-tech/ceno
https://github.com/scroll-tech/ceno/blob/ce97cf805a131db43a6d3d56a2fd0506a6dc8431/ceno_recursion/src/aggregation/root.rs
ceno_recursion/src/aggregation/root.rs
// TODO: assert that the shard ram ec point is `PointAtInfinity` // let is_sum_x_zero = ec_sum.x.is_zero(builder); // let is_sum_y_zero = ec_sum.y.is_zero(builder); // builder.assert_usize_eq(is_sum_x_zero, Usize::from(1)); // builder.assert_usize_eq(is_sum_y_zero, Usize::from(1));
rust
Apache-2.0
ce97cf805a131db43a6d3d56a2fd0506a6dc8431
2026-01-04T20:23:30.257242Z
false
scroll-tech/ceno
https://github.com/scroll-tech/ceno/blob/ce97cf805a131db43a6d3d56a2fd0506a6dc8431/ceno_recursion/src/aggregation/types.rs
ceno_recursion/src/aggregation/types.rs
// TODO: enable this // #[derive(Debug, Clone, AlignedBorrow)] // pub struct ContinuationPvs<T> { // pub sum: SepticPoint<T>, // } // impl<C: Config> ContinuationPvs<Felt<C::F>> { // pub fn uninit(builder: &mut Builder<C>) -> Self { // todo!() // } // } // #[derive(Debug, Clone, AlignedBorrow)] //...
rust
Apache-2.0
ce97cf805a131db43a6d3d56a2fd0506a6dc8431
2026-01-04T20:23:30.257242Z
false
scroll-tech/ceno
https://github.com/scroll-tech/ceno/blob/ce97cf805a131db43a6d3d56a2fd0506a6dc8431/ceno_recursion/src/aggregation/mod.rs
ceno_recursion/src/aggregation/mod.rs
use crate::zkvm_verifier::{ binding::{E, F, ZKVMProofInput, ZKVMProofInputVariable}, verifier::verify_zkvm_proof, }; use ceno_zkvm::{ instructions::riscv::constants::{END_PC_IDX, EXIT_CODE_IDX, INIT_PC_IDX}, scheme::ZKVMProof, structs::ZKVMVerifyingKey, }; use ff_ext::BabyBearExt4; use mpcs::{Basefo...
rust
Apache-2.0
ce97cf805a131db43a6d3d56a2fd0506a6dc8431
2026-01-04T20:23:30.257242Z
false
scroll-tech/ceno
https://github.com/scroll-tech/ceno/blob/ce97cf805a131db43a6d3d56a2fd0506a6dc8431/ceno_recursion/src/basefold_verifier/field.rs
ceno_recursion/src/basefold_verifier/field.rs
const TWO_ADICITY: usize = 32; const TWO_ADIC_GENERATORS: [usize; 33] = [ 0x0000000000000001, 0xffffffff00000000, 0x0001000000000000, 0xfffffffeff000001, 0xefffffff00000001, 0x00003fffffffc000, 0x0000008000000000, 0xf80007ff08000001, 0xbf79143ce60ca966, 0x1905d02a5c411f4e, 0x...
rust
Apache-2.0
ce97cf805a131db43a6d3d56a2fd0506a6dc8431
2026-01-04T20:23:30.257242Z
false
scroll-tech/ceno
https://github.com/scroll-tech/ceno/blob/ce97cf805a131db43a6d3d56a2fd0506a6dc8431/ceno_recursion/src/basefold_verifier/query_phase.rs
ceno_recursion/src/basefold_verifier/query_phase.rs
use ff_ext::{BabyBearExt4, ExtensionField, PoseidonField}; use mpcs::basefold::structure::QueryOpeningProof as InnerQueryOpeningProof; use openvm_native_compiler::{asm::AsmConfig, prelude::*}; use openvm_native_compiler_derive::iter_zip; use openvm_native_recursion::{ hints::{Hintable, VecAutoHintable}, vars::H...
rust
Apache-2.0
ce97cf805a131db43a6d3d56a2fd0506a6dc8431
2026-01-04T20:23:30.257242Z
true
scroll-tech/ceno
https://github.com/scroll-tech/ceno/blob/ce97cf805a131db43a6d3d56a2fd0506a6dc8431/ceno_recursion/src/basefold_verifier/rs.rs
ceno_recursion/src/basefold_verifier/rs.rs
// Note: check all XXX comments! use std::{cell::RefCell, collections::BTreeMap}; use openvm_native_compiler::{asm::AsmConfig, prelude::*}; use openvm_native_recursion::hints::Hintable; use openvm_stark_sdk::p3_baby_bear::BabyBear; use p3::field::{FieldAlgebra, extension::BinomialExtensionField}; use serde::Deserializ...
rust
Apache-2.0
ce97cf805a131db43a6d3d56a2fd0506a6dc8431
2026-01-04T20:23:30.257242Z
false
scroll-tech/ceno
https://github.com/scroll-tech/ceno/blob/ce97cf805a131db43a6d3d56a2fd0506a6dc8431/ceno_recursion/src/basefold_verifier/mmcs.rs
ceno_recursion/src/basefold_verifier/mmcs.rs
use openvm_native_compiler::{asm::AsmConfig, prelude::*}; use openvm_native_recursion::{hints::Hintable, vars::HintSlice}; use openvm_stark_sdk::p3_baby_bear::BabyBear; use p3::field::extension::BinomialExtensionField; use crate::basefold_verifier::utils::{read_hint_slice, write_mmcs_proof}; use super::{hash::*, stru...
rust
Apache-2.0
ce97cf805a131db43a6d3d56a2fd0506a6dc8431
2026-01-04T20:23:30.257242Z
false
scroll-tech/ceno
https://github.com/scroll-tech/ceno/blob/ce97cf805a131db43a6d3d56a2fd0506a6dc8431/ceno_recursion/src/basefold_verifier/extension_mmcs.rs
ceno_recursion/src/basefold_verifier/extension_mmcs.rs
use openvm_native_compiler::{asm::AsmConfig, prelude::*}; use openvm_native_recursion::{hints::Hintable, vars::HintSlice}; use openvm_stark_sdk::p3_baby_bear::BabyBear; use p3::field::extension::BinomialExtensionField; use super::{mmcs::*, structs::*}; pub type F = BabyBear; pub type E = BinomialExtensionField<F, DEG...
rust
Apache-2.0
ce97cf805a131db43a6d3d56a2fd0506a6dc8431
2026-01-04T20:23:30.257242Z
false
scroll-tech/ceno
https://github.com/scroll-tech/ceno/blob/ce97cf805a131db43a6d3d56a2fd0506a6dc8431/ceno_recursion/src/basefold_verifier/structs.rs
ceno_recursion/src/basefold_verifier/structs.rs
use openvm_native_compiler::{asm::AsmConfig, ir::*}; use openvm_native_compiler_derive::DslVariable; use openvm_native_recursion::hints::{Hintable, VecAutoHintable}; use openvm_stark_sdk::p3_baby_bear::BabyBear; use p3::field::extension::BinomialExtensionField; pub const DEGREE: usize = 4; pub type F = BabyBear; pub ...
rust
Apache-2.0
ce97cf805a131db43a6d3d56a2fd0506a6dc8431
2026-01-04T20:23:30.257242Z
false
scroll-tech/ceno
https://github.com/scroll-tech/ceno/blob/ce97cf805a131db43a6d3d56a2fd0506a6dc8431/ceno_recursion/src/basefold_verifier/basefold.rs
ceno_recursion/src/basefold_verifier/basefold.rs
use itertools::Itertools; use mpcs::basefold::structure::BasefoldProof as InnerBasefoldProof; use openvm_native_compiler::{asm::AsmConfig, prelude::*}; use openvm_native_recursion::hints::{Hintable, VecAutoHintable}; use openvm_stark_sdk::p3_baby_bear::BabyBear; use p3::field::extension::BinomialExtensionField; use ser...
rust
Apache-2.0
ce97cf805a131db43a6d3d56a2fd0506a6dc8431
2026-01-04T20:23:30.257242Z
false
scroll-tech/ceno
https://github.com/scroll-tech/ceno/blob/ce97cf805a131db43a6d3d56a2fd0506a6dc8431/ceno_recursion/src/basefold_verifier/utils.rs
ceno_recursion/src/basefold_verifier/utils.rs
use openvm_native_compiler::ir::*; use openvm_native_recursion::vars::HintSlice; use p3::{babybear::BabyBear, field::FieldAlgebra}; use crate::basefold_verifier::mmcs::MmcsProof; // XXX: more efficient pow implementation pub fn pow<C: Config>(builder: &mut Builder<C>, base: Var<C::N>, exponent: Var<C::N>) -> Var<C::N...
rust
Apache-2.0
ce97cf805a131db43a6d3d56a2fd0506a6dc8431
2026-01-04T20:23:30.257242Z
false
scroll-tech/ceno
https://github.com/scroll-tech/ceno/blob/ce97cf805a131db43a6d3d56a2fd0506a6dc8431/ceno_recursion/src/basefold_verifier/mod.rs
ceno_recursion/src/basefold_verifier/mod.rs
#![allow(dead_code)] #![allow(unused_variables)] #![allow(unused_imports)] pub(crate) mod basefold; pub(crate) mod extension_mmcs; pub(crate) mod hash; pub(crate) mod mmcs; pub(crate) mod query_phase; pub(crate) mod rs; pub(crate) mod structs; // pub(crate) mod field; pub(crate) mod utils; pub(crate) mod verifier;
rust
Apache-2.0
ce97cf805a131db43a6d3d56a2fd0506a6dc8431
2026-01-04T20:23:30.257242Z
false
scroll-tech/ceno
https://github.com/scroll-tech/ceno/blob/ce97cf805a131db43a6d3d56a2fd0506a6dc8431/ceno_recursion/src/basefold_verifier/hash.rs
ceno_recursion/src/basefold_verifier/hash.rs
use openvm_native_compiler::{asm::AsmConfig, prelude::*}; use openvm_native_recursion::hints::{Hintable, VecAutoHintable}; use openvm_stark_sdk::p3_baby_bear::BabyBear; use p3::field::extension::BinomialExtensionField; use serde::Deserialize; use super::structs::DEGREE; pub const DIGEST_ELEMS: usize = 8; pub type F ...
rust
Apache-2.0
ce97cf805a131db43a6d3d56a2fd0506a6dc8431
2026-01-04T20:23:30.257242Z
false
scroll-tech/ceno
https://github.com/scroll-tech/ceno/blob/ce97cf805a131db43a6d3d56a2fd0506a6dc8431/ceno_recursion/src/basefold_verifier/verifier.rs
ceno_recursion/src/basefold_verifier/verifier.rs
use crate::{ basefold_verifier::query_phase::{QueryPhaseVerifierInputVariable, batch_verifier_query_phase}, transcript::{transcript_check_pow_witness, transcript_observe_label}, }; use super::{basefold::*, rs::*, utils::*}; use ff_ext::BabyBearExt4; use openvm_native_compiler::{asm::AsmConfig, ir::FromConstant...
rust
Apache-2.0
ce97cf805a131db43a6d3d56a2fd0506a6dc8431
2026-01-04T20:23:30.257242Z
false
scroll-tech/ceno
https://github.com/scroll-tech/ceno/blob/ce97cf805a131db43a6d3d56a2fd0506a6dc8431/ceno_recursion/src/tower_verifier/program.rs
ceno_recursion/src/tower_verifier/program.rs
use super::binding::{PointAndEvalVariable, PointVariable}; use crate::{ arithmetics::{ UniPolyExtrapolator, challenger_multi_observe, eq_eval, evaluate_at_point_degree_1, extend, exts_to_felts, reverse, }, tower_verifier::binding::IOPProverMessageVecVariable, transcript::transcript_obser...
rust
Apache-2.0
ce97cf805a131db43a6d3d56a2fd0506a6dc8431
2026-01-04T20:23:30.257242Z
false
scroll-tech/ceno
https://github.com/scroll-tech/ceno/blob/ce97cf805a131db43a6d3d56a2fd0506a6dc8431/ceno_recursion/src/tower_verifier/mod.rs
ceno_recursion/src/tower_verifier/mod.rs
pub(crate) mod binding; pub(crate) mod program;
rust
Apache-2.0
ce97cf805a131db43a6d3d56a2fd0506a6dc8431
2026-01-04T20:23:30.257242Z
false
scroll-tech/ceno
https://github.com/scroll-tech/ceno/blob/ce97cf805a131db43a6d3d56a2fd0506a6dc8431/ceno_recursion/src/tower_verifier/binding.rs
ceno_recursion/src/tower_verifier/binding.rs
use itertools::Itertools; use openvm_native_compiler::{ asm::AsmConfig, ir::{Array, Builder, Config}, prelude::*, }; use openvm_native_recursion::hints::{Hintable, VecAutoHintable}; pub type F = BabyBear; pub type E = BinomialExtensionField<F, 4>; pub type InnerConfig = AsmConfig<F, E>; use openvm_stark_ba...
rust
Apache-2.0
ce97cf805a131db43a6d3d56a2fd0506a6dc8431
2026-01-04T20:23:30.257242Z
false
scroll-tech/ceno
https://github.com/scroll-tech/ceno/blob/ce97cf805a131db43a6d3d56a2fd0506a6dc8431/ceno_recursion/src/zkvm_verifier/mod.rs
ceno_recursion/src/zkvm_verifier/mod.rs
pub mod binding; pub mod verifier;
rust
Apache-2.0
ce97cf805a131db43a6d3d56a2fd0506a6dc8431
2026-01-04T20:23:30.257242Z
false
scroll-tech/ceno
https://github.com/scroll-tech/ceno/blob/ce97cf805a131db43a6d3d56a2fd0506a6dc8431/ceno_recursion/src/zkvm_verifier/binding.rs
ceno_recursion/src/zkvm_verifier/binding.rs
use std::collections::BTreeMap; use crate::{ arithmetics::{ceil_log2, next_pow2_instance_padding}, basefold_verifier::basefold::{ BasefoldCommitment, BasefoldCommitmentVariable, BasefoldProof, BasefoldProofVariable, }, tower_verifier::binding::{ IOPProverMessage, IOPProverMessageVec, IO...
rust
Apache-2.0
ce97cf805a131db43a6d3d56a2fd0506a6dc8431
2026-01-04T20:23:30.257242Z
true
scroll-tech/ceno
https://github.com/scroll-tech/ceno/blob/ce97cf805a131db43a6d3d56a2fd0506a6dc8431/ceno_recursion/src/zkvm_verifier/verifier.rs
ceno_recursion/src/zkvm_verifier/verifier.rs
use super::binding::{ ClaimAndPoint, GKRClaimEvaluation, RotationClaim, ZKVMChipProofInputVariable, ZKVMProofInputVariable, }; use crate::{ arithmetics::{ PolyEvaluator, UniPolyExtrapolator, assert_ext_arr_eq, challenger_multi_observe, eq_eval, eval_ceno_expr_with_instance, eval_wellform_add...
rust
Apache-2.0
ce97cf805a131db43a6d3d56a2fd0506a6dc8431
2026-01-04T20:23:30.257242Z
true
scroll-tech/ceno
https://github.com/scroll-tech/ceno/blob/ce97cf805a131db43a6d3d56a2fd0506a6dc8431/ceno_recursion/src/arithmetics/mod.rs
ceno_recursion/src/arithmetics/mod.rs
#![allow(dead_code)] #![allow(unused_variables)] #![allow(unused_imports)] use ceno_zkvm::structs::{ChallengeId, WitnessId}; use ff_ext::{BabyBearExt4, ExtensionField, SmallField}; use itertools::Either; use multilinear_extensions::{Expression, Fixed, Instance}; use openvm_native_circuit::EXT_DEG; use openvm_native_co...
rust
Apache-2.0
ce97cf805a131db43a6d3d56a2fd0506a6dc8431
2026-01-04T20:23:30.257242Z
true
scroll-tech/ceno
https://github.com/scroll-tech/ceno/blob/ce97cf805a131db43a6d3d56a2fd0506a6dc8431/ceno_recursion/src/constants/mod.rs
ceno_recursion/src/constants/mod.rs
pub const OPCODE_KEYS: [(usize, usize, &str); 14] = [ (0, 0, "ADD"), (1, 1, "ADDI"), (3, 2, "ANDI"), (4, 3, "BEQ"), (8, 4, "BLTU"), (15, 5, "BNE"), (19, 6, "JALR"), (25, 7, "LW"), (32, 8, "ORI"), (42, 9, "SB"), (55, 10, "SRAI"), (57, 11, "SRLI"), (58, 12, "SUB"), ...
rust
Apache-2.0
ce97cf805a131db43a6d3d56a2fd0506a6dc8431
2026-01-04T20:23:30.257242Z
false
scroll-tech/ceno
https://github.com/scroll-tech/ceno/blob/ce97cf805a131db43a6d3d56a2fd0506a6dc8431/ceno_emul/src/dense_addr_space.rs
ceno_emul/src/dense_addr_space.rs
use crate::addr::WordAddr; /// Dense storage for addresses between `[base, end)`, addressed at word granularity. /// /// The region is pre-allocated up-front so lookups become simple index operations. #[derive(Debug)] pub(crate) struct DenseAddrSpace<T> { base: WordAddr, end: WordAddr, cells: Vec<T>, } im...
rust
Apache-2.0
ce97cf805a131db43a6d3d56a2fd0506a6dc8431
2026-01-04T20:23:30.257242Z
false
scroll-tech/ceno
https://github.com/scroll-tech/ceno/blob/ce97cf805a131db43a6d3d56a2fd0506a6dc8431/ceno_emul/src/rv32im.rs
ceno_emul/src/rv32im.rs
// Based on: https://github.com/risc0/risc0/blob/aeea62f0c8f4223abfba17d4c78cb7e15c513de2/risc0/circuit/rv32im/src/prove/emu/rv32im.rs // // Copyright 2024 RISC Zero, Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may...
rust
Apache-2.0
ce97cf805a131db43a6d3d56a2fd0506a6dc8431
2026-01-04T20:23:30.257242Z
false
scroll-tech/ceno
https://github.com/scroll-tech/ceno/blob/ce97cf805a131db43a6d3d56a2fd0506a6dc8431/ceno_emul/src/vm_state.rs
ceno_emul/src/vm_state.rs
use super::rv32im::EmuContext; use crate::{ PC_STEP_SIZE, Program, WORD_SIZE, addr::{ByteAddr, RegIdx, Word, WordAddr}, dense_addr_space::DenseAddrSpace, platform::Platform, rv32im::{Instruction, TrapCause}, syscalls::{SyscallEffects, handle_syscall}, tracer::{Change, FullTracer, Tracer}, };...
rust
Apache-2.0
ce97cf805a131db43a6d3d56a2fd0506a6dc8431
2026-01-04T20:23:30.257242Z
false
scroll-tech/ceno
https://github.com/scroll-tech/ceno/blob/ce97cf805a131db43a6d3d56a2fd0506a6dc8431/ceno_emul/src/lib.rs
ceno_emul/src/lib.rs
#![deny(clippy::cargo)] #![feature(step_trait)] mod addr; pub use addr::*; mod dense_addr_space; mod platform; pub use platform::{CENO_PLATFORM, Platform}; mod tracer; pub use tracer::{ Change, FullTracer, LatestAccesses, MemOp, NextAccessPair, NextCycleAccess, PreflightTracer, ReadOp, StepRecord, Tracer, Wr...
rust
Apache-2.0
ce97cf805a131db43a6d3d56a2fd0506a6dc8431
2026-01-04T20:23:30.257242Z
false
scroll-tech/ceno
https://github.com/scroll-tech/ceno/blob/ce97cf805a131db43a6d3d56a2fd0506a6dc8431/ceno_emul/src/syscalls.rs
ceno_emul/src/syscalls.rs
use crate::{RegIdx, Tracer, VMState, Word, WordAddr, WriteOp}; use anyhow::Result; pub mod bn254; pub mod keccak_permute; pub mod phantom; pub mod secp256k1; pub mod sha256; pub mod uint256; // Using the same function codes as sp1: // https://github.com/succinctlabs/sp1/blob/013c24ea2fa15a0e7ed94f7d11a7ada4baa39ab9/cr...
rust
Apache-2.0
ce97cf805a131db43a6d3d56a2fd0506a6dc8431
2026-01-04T20:23:30.257242Z
false
scroll-tech/ceno
https://github.com/scroll-tech/ceno/blob/ce97cf805a131db43a6d3d56a2fd0506a6dc8431/ceno_emul/src/platform.rs
ceno_emul/src/platform.rs
use core::fmt::{self, Formatter}; use once_cell::sync::Lazy; 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 ...
rust
Apache-2.0
ce97cf805a131db43a6d3d56a2fd0506a6dc8431
2026-01-04T20:23:30.257242Z
false
scroll-tech/ceno
https://github.com/scroll-tech/ceno/blob/ce97cf805a131db43a6d3d56a2fd0506a6dc8431/ceno_emul/src/host_utils.rs
ceno_emul/src/host_utils.rs
use std::iter::from_fn; use ceno_rt::INFO_OUT_ADDR as CENO_RT_INFO_OUT_ADDR; use itertools::Itertools; use crate::{ByteAddr, EmuContext, Tracer, VMState, Word, WordAddr}; const WORD_SIZE: usize = 4; const INFO_OUT_ADDR: WordAddr = ByteAddr(CENO_RT_INFO_OUT_ADDR).waddr(); pub fn read_all_messages<T: Tracer>(state: &...
rust
Apache-2.0
ce97cf805a131db43a6d3d56a2fd0506a6dc8431
2026-01-04T20:23:30.257242Z
false
scroll-tech/ceno
https://github.com/scroll-tech/ceno/blob/ce97cf805a131db43a6d3d56a2fd0506a6dc8431/ceno_emul/src/test_utils.rs
ceno_emul/src/test_utils.rs
use crate::{ CENO_PLATFORM, InsnKind, Instruction, Platform, Program, StepRecord, VMState, encode_rv32, encode_rv32u, syscalls::KECCAK_PERMUTE, }; use anyhow::Result; pub fn keccak_step() -> (StepRecord, Vec<Instruction>) { let instructions = vec![ // Call Keccak-f. load_immediate(Platform:...
rust
Apache-2.0
ce97cf805a131db43a6d3d56a2fd0506a6dc8431
2026-01-04T20:23:30.257242Z
false
scroll-tech/ceno
https://github.com/scroll-tech/ceno/blob/ce97cf805a131db43a6d3d56a2fd0506a6dc8431/ceno_emul/src/chunked_vec.rs
ceno_emul/src/chunked_vec.rs
use rayon::iter::{IntoParallelIterator, ParallelIterator}; use std::ops::{Index, IndexMut}; /// A growable vector divided into fixed-size chunks. /// /// This structure behaves similarly to a `Vec`, but allocates memory /// in discrete chunks of a fixed size rather than continuously. /// It is especially useful when t...
rust
Apache-2.0
ce97cf805a131db43a6d3d56a2fd0506a6dc8431
2026-01-04T20:23:30.257242Z
false
scroll-tech/ceno
https://github.com/scroll-tech/ceno/blob/ce97cf805a131db43a6d3d56a2fd0506a6dc8431/ceno_emul/src/tracer.rs
ceno_emul/src/tracer.rs
use crate::{ CENO_PLATFORM, InsnKind, Instruction, PC_STEP_SIZE, Platform, addr::{ByteAddr, Cycle, RegIdx, Word, WordAddr}, chunked_vec::ChunkedVec, dense_addr_space::DenseAddrSpace, encode_rv32, syscalls::{SyscallEffects, SyscallWitness}, }; use ceno_rt::WORD_SIZE; use smallvec::SmallVec; use s...
rust
Apache-2.0
ce97cf805a131db43a6d3d56a2fd0506a6dc8431
2026-01-04T20:23:30.257242Z
false
scroll-tech/ceno
https://github.com/scroll-tech/ceno/blob/ce97cf805a131db43a6d3d56a2fd0506a6dc8431/ceno_emul/src/utils.rs
ceno_emul/src/utils.rs
use itertools::{Itertools, izip}; use crate::{Change, EmuContext, Tracer, VMState, WORD_SIZE, Word, WordAddr, WriteOp}; /// Utilities for reading/manipulating a memory segment of fixed length pub struct MemoryView<'a, T: Tracer, const LENGTH: usize> { vm: &'a VMState<T>, start: WordAddr, writes: Option<[W...
rust
Apache-2.0
ce97cf805a131db43a6d3d56a2fd0506a6dc8431
2026-01-04T20:23:30.257242Z
false
scroll-tech/ceno
https://github.com/scroll-tech/ceno/blob/ce97cf805a131db43a6d3d56a2fd0506a6dc8431/ceno_emul/src/addr.rs
ceno_emul/src/addr.rs
// Based on: https://github.com/risc0/risc0/blob/aeea62f0c8f4223abfba17d4c78cb7e15c513de2/risc0/circuit/rv32im/src/prove/emu/addr.rs // // Copyright 2024 RISC Zero, Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may o...
rust
Apache-2.0
ce97cf805a131db43a6d3d56a2fd0506a6dc8431
2026-01-04T20:23:30.257242Z
false
scroll-tech/ceno
https://github.com/scroll-tech/ceno/blob/ce97cf805a131db43a6d3d56a2fd0506a6dc8431/ceno_emul/src/elf.rs
ceno_emul/src/elf.rs
// Based on: https://github.com/risc0/risc0/blob/6b6daeafa1545984aa28581fca56d9ef13dcbae6/risc0/binfmt/src/elf.rs // // Copyright 2024 RISC Zero, Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the...
rust
Apache-2.0
ce97cf805a131db43a6d3d56a2fd0506a6dc8431
2026-01-04T20:23:30.257242Z
false
scroll-tech/ceno
https://github.com/scroll-tech/ceno/blob/ce97cf805a131db43a6d3d56a2fd0506a6dc8431/ceno_emul/src/syscalls/keccak_permute.rs
ceno_emul/src/syscalls/keccak_permute.rs
use itertools::Itertools; use tiny_keccak::keccakf; use crate::{Change, EmuContext, Platform, Tracer, VMState, Word, WriteOp, utils::MemoryView}; use super::{SyscallEffects, SyscallSpec, SyscallWitness}; const KECCAK_CELLS: usize = 25; // u64 cells pub const KECCAK_WORDS: usize = KECCAK_CELLS * 2; // u32 words pub ...
rust
Apache-2.0
ce97cf805a131db43a6d3d56a2fd0506a6dc8431
2026-01-04T20:23:30.257242Z
false
scroll-tech/ceno
https://github.com/scroll-tech/ceno/blob/ce97cf805a131db43a6d3d56a2fd0506a6dc8431/ceno_emul/src/syscalls/sha256.rs
ceno_emul/src/syscalls/sha256.rs
use crate::{Change, EmuContext, Platform, Tracer, VMState, Word, WriteOp, utils::MemoryView}; use super::{SyscallEffects, SyscallSpec, SyscallWitness}; pub const SHA_EXTEND_WORDS: usize = 64; // u64 cells pub struct Sha256ExtendSpec; impl SyscallSpec for Sha256ExtendSpec { const NAME: &'static str = "SHA256_EXT...
rust
Apache-2.0
ce97cf805a131db43a6d3d56a2fd0506a6dc8431
2026-01-04T20:23:30.257242Z
false
scroll-tech/ceno
https://github.com/scroll-tech/ceno/blob/ce97cf805a131db43a6d3d56a2fd0506a6dc8431/ceno_emul/src/syscalls/secp256k1.rs
ceno_emul/src/syscalls/secp256k1.rs
use super::{SyscallEffects, SyscallSpec, SyscallWitness}; use crate::{ Change, EmuContext, Platform, Tracer, VMState, WORD_SIZE, Word, WriteOp, utils::MemoryView, }; use itertools::Itertools; use k256::{FieldBytes, elliptic_curve::PrimeField}; use std::iter; pub struct Secp256k1AddSpec; pub struct Secp256k1Double...
rust
Apache-2.0
ce97cf805a131db43a6d3d56a2fd0506a6dc8431
2026-01-04T20:23:30.257242Z
false
scroll-tech/ceno
https://github.com/scroll-tech/ceno/blob/ce97cf805a131db43a6d3d56a2fd0506a6dc8431/ceno_emul/src/syscalls/uint256.rs
ceno_emul/src/syscalls/uint256.rs
use crate::{ Change, EmuContext, Platform, SyscallSpec, Tracer, VMState, WriteOp, syscalls::{SyscallEffects, SyscallWitness}, utils::MemoryView, }; use itertools::Itertools; use num::{BigUint, One, Zero}; use sp1_curves::{ params::NumWords, uint256::U256Field, utils::{biguint_from_le_words, big...
rust
Apache-2.0
ce97cf805a131db43a6d3d56a2fd0506a6dc8431
2026-01-04T20:23:30.257242Z
false
scroll-tech/ceno
https://github.com/scroll-tech/ceno/blob/ce97cf805a131db43a6d3d56a2fd0506a6dc8431/ceno_emul/src/syscalls/phantom/mod.rs
ceno_emul/src/syscalls/phantom/mod.rs
use crate::{ Change, EmuContext, Platform, SyscallSpec, Tracer, VMState, WordAddr, WriteOp, syscalls::{SyscallEffects, SyscallWitness}, }; use itertools::Itertools; pub struct LogPcCycleSpec; impl SyscallSpec for LogPcCycleSpec { const NAME: &'static str = "LOG_PC_CYCLE"; const REG_OPS_COUNT: usize = ...
rust
Apache-2.0
ce97cf805a131db43a6d3d56a2fd0506a6dc8431
2026-01-04T20:23:30.257242Z
false
scroll-tech/ceno
https://github.com/scroll-tech/ceno/blob/ce97cf805a131db43a6d3d56a2fd0506a6dc8431/ceno_emul/src/syscalls/bn254/types.rs
ceno_emul/src/syscalls/bn254/types.rs
use itertools::Itertools; use substrate_bn::{AffineG1, Fq, Fq2, Fr, G1}; use crate::Word; pub const BN254_FP_WORDS: usize = 8; pub const BN254_FP2_WORDS: usize = 2 * BN254_FP_WORDS; pub const BN254_POINT_WORDS: usize = 2 * BN254_FP_WORDS; pub struct Bn254Fp(substrate_bn::Fq); impl From<[Word; BN254_FP_WORDS]> for B...
rust
Apache-2.0
ce97cf805a131db43a6d3d56a2fd0506a6dc8431
2026-01-04T20:23:30.257242Z
false
scroll-tech/ceno
https://github.com/scroll-tech/ceno/blob/ce97cf805a131db43a6d3d56a2fd0506a6dc8431/ceno_emul/src/syscalls/bn254/mod.rs
ceno_emul/src/syscalls/bn254/mod.rs
mod bn254_curve; mod bn254_fptower; mod types; pub use bn254_curve::{Bn254AddSpec, Bn254DoubleSpec, bn254_add, bn254_double}; pub use bn254_fptower::{ Bn254Fp2AddSpec, Bn254Fp2MulSpec, Bn254FpAddSpec, Bn254FpMulSpec, bn254_fp_add, bn254_fp_mul, bn254_fp2_add, bn254_fp2_mul, }; pub use types::{BN254_FP_WORDS,...
rust
Apache-2.0
ce97cf805a131db43a6d3d56a2fd0506a6dc8431
2026-01-04T20:23:30.257242Z
false
scroll-tech/ceno
https://github.com/scroll-tech/ceno/blob/ce97cf805a131db43a6d3d56a2fd0506a6dc8431/ceno_emul/src/syscalls/bn254/bn254_fptower.rs
ceno_emul/src/syscalls/bn254/bn254_fptower.rs
use itertools::Itertools; use crate::{ Change, EmuContext, Platform, SyscallSpec, Tracer, VMState, Word, WriteOp, syscalls::{ SyscallEffects, SyscallWitness, bn254::types::{Bn254Fp, Bn254Fp2}, }, utils::MemoryView, }; use super::types::{BN254_FP_WORDS, BN254_FP2_WORDS}; pub struct Bn2...
rust
Apache-2.0
ce97cf805a131db43a6d3d56a2fd0506a6dc8431
2026-01-04T20:23:30.257242Z
false
scroll-tech/ceno
https://github.com/scroll-tech/ceno/blob/ce97cf805a131db43a6d3d56a2fd0506a6dc8431/ceno_emul/src/syscalls/bn254/bn254_curve.rs
ceno_emul/src/syscalls/bn254/bn254_curve.rs
use crate::{ Change, EmuContext, Platform, SyscallSpec, Tracer, VMState, Word, WriteOp, syscalls::{SyscallEffects, SyscallWitness, bn254::types::Bn254Point}, utils::MemoryView, }; use super::types::BN254_POINT_WORDS; use itertools::Itertools; pub struct Bn254AddSpec; impl SyscallSpec for Bn254AddSpec { ...
rust
Apache-2.0
ce97cf805a131db43a6d3d56a2fd0506a6dc8431
2026-01-04T20:23:30.257242Z
false
scroll-tech/ceno
https://github.com/scroll-tech/ceno/blob/ce97cf805a131db43a6d3d56a2fd0506a6dc8431/ceno_emul/src/disassemble/mod.rs
ceno_emul/src/disassemble/mod.rs
use crate::rv32im::{InsnKind, Instruction}; use itertools::izip; use rrs_lib::{ InstructionProcessor, instruction_formats::{BType, IType, ITypeCSR, ITypeShamt, JType, RType, SType, UType}, process_instruction, }; /// A transpiler that converts the 32-bit encoded instructions into instructions. pub(crate) s...
rust
Apache-2.0
ce97cf805a131db43a6d3d56a2fd0506a6dc8431
2026-01-04T20:23:30.257242Z
false
scroll-tech/ceno
https://github.com/scroll-tech/ceno/blob/ce97cf805a131db43a6d3d56a2fd0506a6dc8431/ceno_emul/tests/test_vm_trace.rs
ceno_emul/tests/test_vm_trace.rs
#![allow(clippy::unusual_byte_groupings)] use anyhow::Result; use rustc_hash::FxHashMap; use std::{collections::BTreeMap, sync::Arc}; use ceno_emul::{ CENO_PLATFORM, Cycle, EmuContext, FullTracer as Tracer, InsnKind, Instruction, Platform, Program, StepRecord, VMState, WordAddr, encode_rv32, }; #[test] fn tes...
rust
Apache-2.0
ce97cf805a131db43a6d3d56a2fd0506a6dc8431
2026-01-04T20:23:30.257242Z
false
scroll-tech/ceno
https://github.com/scroll-tech/ceno/blob/ce97cf805a131db43a6d3d56a2fd0506a6dc8431/examples/examples/bn254_curve_syscalls.rs
examples/examples/bn254_curve_syscalls.rs
// Test addition of two curve points. Assert result inside the guest extern crate ceno_rt; use ceno_syscall::{syscall_bn254_add, syscall_bn254_double}; use substrate_bn::{AffineG1, Fr, G1, Group}; fn bytes_to_words(bytes: [u8; 64]) -> [u32; 16] { let mut bytes = bytes; // Reverse the order of bytes for each co...
rust
Apache-2.0
ce97cf805a131db43a6d3d56a2fd0506a6dc8431
2026-01-04T20:23:30.257242Z
false
scroll-tech/ceno
https://github.com/scroll-tech/ceno/blob/ce97cf805a131db43a6d3d56a2fd0506a6dc8431/examples/examples/keccak_syscall.rs
examples/examples/keccak_syscall.rs
//! Compute the Keccak permutation using a syscall. //! //! Iterate multiple times and log the state after each iteration. extern crate ceno_rt; use ceno_syscall::syscall_keccak_permute; const ITERATIONS: usize = 100; fn main() { let mut state = [0_u64; 25]; for i in 0..ITERATIONS { syscall_keccak_p...
rust
Apache-2.0
ce97cf805a131db43a6d3d56a2fd0506a6dc8431
2026-01-04T20:23:30.257242Z
false
scroll-tech/ceno
https://github.com/scroll-tech/ceno/blob/ce97cf805a131db43a6d3d56a2fd0506a6dc8431/examples/examples/bn254_patched_fp.rs
examples/examples/bn254_patched_fp.rs
extern crate ceno_rt; use bn::{Fq, Fq2}; use rand::{SeedableRng, rngs::StdRng}; fn to_unpatched_fq(val: Fq) -> substrate_bn::Fq { substrate_bn::Fq::from_u256(substrate_bn::arith::U256(val.into_u256().0)).unwrap() } fn to_unpatched_fq2(val: Fq2) -> substrate_bn::Fq2 { substrate_bn::Fq2::new( to_unpatc...
rust
Apache-2.0
ce97cf805a131db43a6d3d56a2fd0506a6dc8431
2026-01-04T20:23:30.257242Z
false
scroll-tech/ceno
https://github.com/scroll-tech/ceno/blob/ce97cf805a131db43a6d3d56a2fd0506a6dc8431/examples/examples/bn254_fptower_syscalls.rs
examples/examples/bn254_fptower_syscalls.rs
extern crate ceno_rt; use ceno_syscall::{ syscall_bn254_fp_addmod, syscall_bn254_fp_mulmod, syscall_bn254_fp2_addmod, syscall_bn254_fp2_mulmod, }; use rand::{SeedableRng, rngs::StdRng}; use substrate_bn::{Fq, Fq2}; fn bytes_to_words(bytes: [u8; 32]) -> [u32; 8] { std::array::from_fn(|i| u32::from_le_bytes(...
rust
Apache-2.0
ce97cf805a131db43a6d3d56a2fd0506a6dc8431
2026-01-04T20:23:30.257242Z
false
scroll-tech/ceno
https://github.com/scroll-tech/ceno/blob/ce97cf805a131db43a6d3d56a2fd0506a6dc8431/examples/examples/ceno_rt_panic.rs
examples/examples/ceno_rt_panic.rs
extern crate ceno_rt; fn main() { panic!("This is a panic message!"); }
rust
Apache-2.0
ce97cf805a131db43a6d3d56a2fd0506a6dc8431
2026-01-04T20:23:30.257242Z
false
scroll-tech/ceno
https://github.com/scroll-tech/ceno/blob/ce97cf805a131db43a6d3d56a2fd0506a6dc8431/examples/examples/is_prime.rs
examples/examples/is_prime.rs
extern crate ceno_rt; fn is_prime(n: u32) -> bool { if n < 2 { return false; } let mut i = 2; while i * i <= n { if n.is_multiple_of(i) { return false; } i += 1; } true } fn main() { let n: u32 = ceno_rt::read(); let mut cnt_primes = 0; ...
rust
Apache-2.0
ce97cf805a131db43a6d3d56a2fd0506a6dc8431
2026-01-04T20:23:30.257242Z
false
scroll-tech/ceno
https://github.com/scroll-tech/ceno/blob/ce97cf805a131db43a6d3d56a2fd0506a6dc8431/examples/examples/sha_extend_syscall.rs
examples/examples/sha_extend_syscall.rs
// Test addition of two curve points. Assert result inside the guest extern crate ceno_rt; use std::array; use ceno_syscall::syscall_sha256_extend; fn main() { let mut words: [u32; 64] = array::from_fn(|i| i as u32); let expected = [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 34013193, 675...
rust
Apache-2.0
ce97cf805a131db43a6d3d56a2fd0506a6dc8431
2026-01-04T20:23:30.257242Z
false
scroll-tech/ceno
https://github.com/scroll-tech/ceno/blob/ce97cf805a131db43a6d3d56a2fd0506a6dc8431/examples/examples/median.rs
examples/examples/median.rs
//! Find the median of a collection of numbers. //! //! Of course, we are asking our good friend, the host, for help, but we still need to verify the answer. extern crate ceno_rt; use ceno_rt::debug_println; #[cfg(debug_assertions)] use core::fmt::Write; fn main() { let numbers: Vec<u32> = ceno_rt::read(); let...
rust
Apache-2.0
ce97cf805a131db43a6d3d56a2fd0506a6dc8431
2026-01-04T20:23:30.257242Z
false
scroll-tech/ceno
https://github.com/scroll-tech/ceno/blob/ce97cf805a131db43a6d3d56a2fd0506a6dc8431/examples/examples/ceno_rt_io.rs
examples/examples/ceno_rt_io.rs
extern crate ceno_rt; use ceno_rt::debug_println; #[cfg(debug_assertions)] use core::fmt::Write; fn main() { debug_println!("📜📜📜 Hello, World!"); debug_println!("🌏🌍🌎"); }
rust
Apache-2.0
ce97cf805a131db43a6d3d56a2fd0506a6dc8431
2026-01-04T20:23:30.257242Z
false
scroll-tech/ceno
https://github.com/scroll-tech/ceno/blob/ce97cf805a131db43a6d3d56a2fd0506a6dc8431/examples/examples/syscalls.rs
examples/examples/syscalls.rs
extern crate ceno_rt; use std::array; use ceno_syscall::{ syscall_keccak_permute, syscall_secp256k1_add, syscall_secp256k1_decompress, syscall_secp256k1_double, syscall_sha256_extend, syscall_uint256_mul, }; /// One unit test for each implemented syscall /// Meant to be used identically in a sp1 guest to con...
rust
Apache-2.0
ce97cf805a131db43a6d3d56a2fd0506a6dc8431
2026-01-04T20:23:30.257242Z
false
scroll-tech/ceno
https://github.com/scroll-tech/ceno/blob/ce97cf805a131db43a6d3d56a2fd0506a6dc8431/examples/examples/keccak_lib.rs
examples/examples/keccak_lib.rs
//! Compute the Keccak-256. extern crate ceno_rt; use ceno_keccak::{Hasher, Keccak}; fn main() { let keccak = Keccak::v256(); let mut output = [0; 32]; let expected = b"\ \xc5\xd2\x46\x01\x86\xf7\x23\x3c\x92\x7e\x7d\xb2\xdc\xc7\x03\xc0\ \xe5\x00\xb6\x53\xca\x82\x27\x3b\x7b\xfa\xd8\x04\x5d...
rust
Apache-2.0
ce97cf805a131db43a6d3d56a2fd0506a6dc8431
2026-01-04T20:23:30.257242Z
false
scroll-tech/ceno
https://github.com/scroll-tech/ceno/blob/ce97cf805a131db43a6d3d56a2fd0506a6dc8431/examples/examples/ceno_rt_mem.rs
examples/examples/ceno_rt_mem.rs
// Use volatile functions to prevent compiler optimizations. use core::ptr::{read_volatile, write_volatile}; extern crate ceno_rt; const OUTPUT_ADDRESS: u32 = 0x3800_0000; #[inline(never)] fn main() { test_data_section(); let out = fibonacci_recurse(20, 0, 1); test_output(out); } /// Test the .data sect...
rust
Apache-2.0
ce97cf805a131db43a6d3d56a2fd0506a6dc8431
2026-01-04T20:23:30.257242Z
false
scroll-tech/ceno
https://github.com/scroll-tech/ceno/blob/ce97cf805a131db43a6d3d56a2fd0506a6dc8431/examples/examples/sorting.rs
examples/examples/sorting.rs
extern crate ceno_rt; use ceno_rt::debug_println; #[cfg(debug_assertions)] use core::fmt::Write; fn main() { let mut scratch: Vec<u32> = ceno_rt::read(); scratch.sort(); // Print any output you feel like, eg the first element of the sorted vector: debug_println!("{}", scratch[0]); }
rust
Apache-2.0
ce97cf805a131db43a6d3d56a2fd0506a6dc8431
2026-01-04T20:23:30.257242Z
false
scroll-tech/ceno
https://github.com/scroll-tech/ceno/blob/ce97cf805a131db43a6d3d56a2fd0506a6dc8431/examples/examples/ceno_rt_alloc.rs
examples/examples/ceno_rt_alloc.rs
use core::ptr::{addr_of, read_volatile}; extern crate ceno_rt; extern crate alloc; use alloc::{vec, vec::Vec}; static mut OUTPUT: u32 = 0; fn main() { // Test writing to a global variable. unsafe { OUTPUT = 0xf00d; black_box(addr_of!(OUTPUT)); } // Test writing to the heap. let ...
rust
Apache-2.0
ce97cf805a131db43a6d3d56a2fd0506a6dc8431
2026-01-04T20:23:30.257242Z
false
scroll-tech/ceno
https://github.com/scroll-tech/ceno/blob/ce97cf805a131db43a6d3d56a2fd0506a6dc8431/examples/examples/hints.rs
examples/examples/hints.rs
extern crate alloc; extern crate ceno_rt; use ceno_rt::debug_println; #[cfg(debug_assertions)] use core::fmt::Write; fn main() { let condition: bool = ceno_rt::read(); assert!(condition); #[cfg(debug_assertions)] { use alloc::string::String; let msg: String = ceno_rt::read(); de...
rust
Apache-2.0
ce97cf805a131db43a6d3d56a2fd0506a6dc8431
2026-01-04T20:23:30.257242Z
false
scroll-tech/ceno
https://github.com/scroll-tech/ceno/blob/ce97cf805a131db43a6d3d56a2fd0506a6dc8431/examples/examples/sha256.rs
examples/examples/sha256.rs
extern crate ceno_rt; use ceno_sha2::{Digest, Sha256}; // Example run (private input: 10 zero bytes) // RUST_LOG=info cargo run --release --package ceno_zkvm --bin e2e -- --profiling=3 --platform=ceno --public-io=30689455,3643278932,1489987339,1626711444,3610619649,1925764735,581441152,321290698 examples/target/riscv...
rust
Apache-2.0
ce97cf805a131db43a6d3d56a2fd0506a6dc8431
2026-01-04T20:23:30.257242Z
false
scroll-tech/ceno
https://github.com/scroll-tech/ceno/blob/ce97cf805a131db43a6d3d56a2fd0506a6dc8431/examples/examples/secp256k1_scalar_algebra.rs
examples/examples/secp256k1_scalar_algebra.rs
extern crate ceno_rt; use k256::{Scalar, elliptic_curve::Field}; fn main() { // test scalar invert let s = Scalar::random(rand::thread_rng()); let s_inv = s.invert().unwrap(); assert_eq!(s * s_inv, Scalar::ONE); }
rust
Apache-2.0
ce97cf805a131db43a6d3d56a2fd0506a6dc8431
2026-01-04T20:23:30.257242Z
false
scroll-tech/ceno
https://github.com/scroll-tech/ceno/blob/ce97cf805a131db43a6d3d56a2fd0506a6dc8431/examples/examples/secp256k1_ecrecover.rs
examples/examples/secp256k1_ecrecover.rs
// Test ecrecover of real world signatures from scroll mainnet. Assert result inside the guest. extern crate ceno_rt; use alloy_primitives::{Address, B256, address, b256, hex}; use ceno_crypto::secp256k1::secp256k1_ecrecover; const TEST_CASES: [(&[u8], u8, B256, Address); 5] = [ // (sig, recid, tx_hash, signer) ...
rust
Apache-2.0
ce97cf805a131db43a6d3d56a2fd0506a6dc8431
2026-01-04T20:23:30.257242Z
false
scroll-tech/ceno
https://github.com/scroll-tech/ceno/blob/ce97cf805a131db43a6d3d56a2fd0506a6dc8431/examples/examples/secp256k1.rs
examples/examples/secp256k1.rs
extern crate ceno_rt; #[allow(unused_imports)] use k256::{ ProjectivePoint, Scalar, elliptic_curve::{Group, ops::MulByGenerator}, }; fn main() { let scalar = Scalar::from(5u64); let a = ProjectivePoint::mul_by_generator(&scalar); let _ = a.double(); // -> syscall_secp256k1_double let scalar = ...
rust
Apache-2.0
ce97cf805a131db43a6d3d56a2fd0506a6dc8431
2026-01-04T20:23:30.257242Z
false
scroll-tech/ceno
https://github.com/scroll-tech/ceno/blob/ce97cf805a131db43a6d3d56a2fd0506a6dc8431/examples/examples/bn254_precompile.rs
examples/examples/bn254_precompile.rs
//! bn254 evm precompile from revm: //! https://github.com/bluealloy/revm/blob/10ff66da1576a3532db657d7b953abcd59ec44a3/crates/precompile/src/bn254.rs extern crate ceno_rt; use alloy_primitives::hex; use ceno_crypto::ceno_crypto; use revm_precompile::{ PrecompileError, bn254::{add::*, mul::*, pair::*, *}, }; ...
rust
Apache-2.0
ce97cf805a131db43a6d3d56a2fd0506a6dc8431
2026-01-04T20:23:30.257242Z
false
scroll-tech/ceno
https://github.com/scroll-tech/ceno/blob/ce97cf805a131db43a6d3d56a2fd0506a6dc8431/examples/examples/quadratic_sorting.rs
examples/examples/quadratic_sorting.rs
extern crate ceno_rt; fn sort<T: Ord>(slice: &mut [T]) { let len = slice.len(); for i in 0..len { for j in 0..len { if slice[j] > slice[i] { slice.swap(j, i); } } } } fn main() { let mut scratch: Vec<u32> = ceno_rt::read(); sort(&mut scratch)...
rust
Apache-2.0
ce97cf805a131db43a6d3d56a2fd0506a6dc8431
2026-01-04T20:23:30.257242Z
false
scroll-tech/ceno
https://github.com/scroll-tech/ceno/blob/ce97cf805a131db43a6d3d56a2fd0506a6dc8431/examples/examples/secp256k1_add_syscall.rs
examples/examples/secp256k1_add_syscall.rs
// Test addition of two curve points. Assert result inside the guest extern crate ceno_rt; use ceno_syscall::syscall_secp256k1_add; // Byte repr. of points from https://docs.rs/secp/latest/secp/#arithmetic-1 const P: [u8; 65] = [ 4, 180, 53, 9, 32, 85, 226, 220, 154, 20, 116, 218, 199, 119, 48, 44, 23, 45, 222, 10...
rust
Apache-2.0
ce97cf805a131db43a6d3d56a2fd0506a6dc8431
2026-01-04T20:23:30.257242Z
false
scroll-tech/ceno
https://github.com/scroll-tech/ceno/blob/ce97cf805a131db43a6d3d56a2fd0506a6dc8431/examples/examples/secp256k1_decompress_syscall.rs
examples/examples/secp256k1_decompress_syscall.rs
// Test decompression of curve point. Assert result inside the guest extern crate ceno_rt; use ceno_syscall::syscall_secp256k1_decompress; // Byte repr. of point P1 from https://docs.rs/secp/latest/secp/#arithmetic-1 const COMPRESSED: [u8; 33] = [ 2, 180, 53, 9, 32, 85, 226, 220, 154, 20, 116, 218, 199, 119, 48, 4...
rust
Apache-2.0
ce97cf805a131db43a6d3d56a2fd0506a6dc8431
2026-01-04T20:23:30.257242Z
false
scroll-tech/ceno
https://github.com/scroll-tech/ceno/blob/ce97cf805a131db43a6d3d56a2fd0506a6dc8431/examples/examples/fibonacci.rs
examples/examples/fibonacci.rs
extern crate ceno_rt; fn main() { // Compute the (1 << log_n) 'th fibonacci number, using normal Rust code. let log_n: u32 = ceno_rt::read(); let mut a = 0_u32; let mut b = 1_u32; let n = 1 << log_n; for _ in 0..n { let mut c = a + b; c %= 7919; // Modulus to prevent overflow. ...
rust
Apache-2.0
ce97cf805a131db43a6d3d56a2fd0506a6dc8431
2026-01-04T20:23:30.257242Z
false
scroll-tech/ceno
https://github.com/scroll-tech/ceno/blob/ce97cf805a131db43a6d3d56a2fd0506a6dc8431/examples/examples/uint256_mul_syscall.rs
examples/examples/uint256_mul_syscall.rs
extern crate ceno_rt; use ceno_syscall::syscall_uint256_mul; fn main() { let mut a_words: [u32; 8] = [ 0xF8EF7F4B, 0x16980341, 0x6044835, 0xD5CE47D3, 0xF33351FC, 0x74FCA157, 0xE35749FD, 0x9418A94B, ]; let b_and_modulus: [u32; 16] = [ 0xC8653C55, 0x9C14580B, 0xFFCFBEA7, 0xD04DA9F6, 0...
rust
Apache-2.0
ce97cf805a131db43a6d3d56a2fd0506a6dc8431
2026-01-04T20:23:30.257242Z
false
scroll-tech/ceno
https://github.com/scroll-tech/ceno/blob/ce97cf805a131db43a6d3d56a2fd0506a6dc8431/examples/examples/secp256k1_double_syscall.rs
examples/examples/secp256k1_double_syscall.rs
// Test double of a curve point via syscall extern crate ceno_rt; #[allow(unused_imports)] use k256::{ProjectivePoint, elliptic_curve::Group}; fn main() { #[allow(deprecated)] let g = ProjectivePoint::generator(); let _ = g.double(); }
rust
Apache-2.0
ce97cf805a131db43a6d3d56a2fd0506a6dc8431
2026-01-04T20:23:30.257242Z
false
scroll-tech/ceno
https://github.com/scroll-tech/ceno/blob/ce97cf805a131db43a6d3d56a2fd0506a6dc8431/examples/examples/keccak_no_syscall.rs
examples/examples/keccak_no_syscall.rs
use tiny_keccak::{Hasher, Keccak}; pub fn main() { let times = 100; let raw_preimage: Vec<u32> = ceno_rt::read(); let preimage: Vec<u8> = raw_preimage.iter().flat_map(|x| x.to_le_bytes()).collect(); for i in 0..times { let digest = keccak256(&preimage) .chunks_exact(4) ....
rust
Apache-2.0
ce97cf805a131db43a6d3d56a2fd0506a6dc8431
2026-01-04T20:23:30.257242Z
false
scroll-tech/ceno
https://github.com/scroll-tech/ceno/blob/ce97cf805a131db43a6d3d56a2fd0506a6dc8431/examples/examples/hashing.rs
examples/examples/hashing.rs
//! Here's an example that really makes use of the standard library and couldn't be done without. //! //! I mean `HashSet` really lives only in the proper standard library, and not in `alloc` or `core`. //! You could, of course, rerwite the example to use `alloc::collections::btree_set::BTreeSet` //! instead of `HashSe...
rust
Apache-2.0
ce97cf805a131db43a6d3d56a2fd0506a6dc8431
2026-01-04T20:23:30.257242Z
false
scroll-tech/ceno
https://github.com/scroll-tech/ceno/blob/ce97cf805a131db43a6d3d56a2fd0506a6dc8431/examples/examples/keccak_native.rs
examples/examples/keccak_native.rs
//! Compute the Keccak-256 using alloy-primitives with native-keccak hook. extern crate ceno_keccak; extern crate ceno_rt; // Make sure the native keccak hook is linked in. use alloy_primitives::keccak256; fn main() { let output = keccak256(b""); let expected = b"\ \xc5\xd2\x46\x01\x86\xf7\x23\x3c\x9...
rust
Apache-2.0
ce97cf805a131db43a6d3d56a2fd0506a6dc8431
2026-01-04T20:23:30.257242Z
false
scroll-tech/ceno
https://github.com/scroll-tech/ceno/blob/ce97cf805a131db43a6d3d56a2fd0506a6dc8431/examples/examples/ceno_rt_mini.rs
examples/examples/ceno_rt_mini.rs
extern crate ceno_rt; fn main() {}
rust
Apache-2.0
ce97cf805a131db43a6d3d56a2fd0506a6dc8431
2026-01-04T20:23:30.257242Z
false
scroll-tech/ceno
https://github.com/scroll-tech/ceno/blob/ce97cf805a131db43a6d3d56a2fd0506a6dc8431/ceno_zkvm/build.rs
ceno_zkvm/build.rs
use glob::glob; use std::{fs, path::Path}; fn main() -> Result<(), Box<dyn std::error::Error>> { // Path to the file that, when changed, should trigger a cache cleanup let watched_file = "src/scheme/mock_prover.rs"; // Path to the cache file to remove when the watched file changes let cache_file = "ta...
rust
Apache-2.0
ce97cf805a131db43a6d3d56a2fd0506a6dc8431
2026-01-04T20:23:30.257242Z
false
scroll-tech/ceno
https://github.com/scroll-tech/ceno/blob/ce97cf805a131db43a6d3d56a2fd0506a6dc8431/ceno_zkvm/src/stats.rs
ceno_zkvm/src/stats.rs
use crate::{ circuit_builder::{ConstraintSystem, NameSpace}, structs::{ComposedConstrainSystem, ZKVMConstraintSystem, ZKVMWitnesses}, utils, }; use ff_ext::ExtensionField; use itertools::Itertools; use multilinear_extensions::Expression; use prettytable::{Table, row}; use serde_json::json; use std::{ co...
rust
Apache-2.0
ce97cf805a131db43a6d3d56a2fd0506a6dc8431
2026-01-04T20:23:30.257242Z
false
scroll-tech/ceno
https://github.com/scroll-tech/ceno/blob/ce97cf805a131db43a6d3d56a2fd0506a6dc8431/ceno_zkvm/src/lib.rs
ceno_zkvm/src/lib.rs
#![deny(clippy::cargo)] #![feature(box_patterns)] #![feature(stmt_expr_attributes)] #![feature(variant_count)] pub mod error; pub mod instructions; pub mod scheme; pub mod tables; pub use utils::u64vec; mod chip_handler; pub mod circuit_builder; pub mod e2e; pub mod gadgets; mod keygen; pub mod precompiles; pub mod st...
rust
Apache-2.0
ce97cf805a131db43a6d3d56a2fd0506a6dc8431
2026-01-04T20:23:30.257242Z
false
scroll-tech/ceno
https://github.com/scroll-tech/ceno/blob/ce97cf805a131db43a6d3d56a2fd0506a6dc8431/ceno_zkvm/src/keygen.rs
ceno_zkvm/src/keygen.rs
use std::collections::BTreeMap; use crate::{ error::ZKVMError, structs::{ZKVMConstraintSystem, ZKVMFixedTraces, ZKVMProvingKey}, }; use ff_ext::ExtensionField; use mpcs::PolynomialCommitmentScheme; impl<E: ExtensionField> ZKVMConstraintSystem<E> { pub fn key_gen<PCS: PolynomialCommitmentScheme<E>>( ...
rust
Apache-2.0
ce97cf805a131db43a6d3d56a2fd0506a6dc8431
2026-01-04T20:23:30.257242Z
false
scroll-tech/ceno
https://github.com/scroll-tech/ceno/blob/ce97cf805a131db43a6d3d56a2fd0506a6dc8431/ceno_zkvm/src/witness.rs
ceno_zkvm/src/witness.rs
pub use witness::set_val; pub type LkMultiplicity = gkr_iop::utils::lk_multiplicity::LkMultiplicity;
rust
Apache-2.0
ce97cf805a131db43a6d3d56a2fd0506a6dc8431
2026-01-04T20:23:30.257242Z
false
scroll-tech/ceno
https://github.com/scroll-tech/ceno/blob/ce97cf805a131db43a6d3d56a2fd0506a6dc8431/ceno_zkvm/src/circuit_builder.rs
ceno_zkvm/src/circuit_builder.rs
pub type ConstraintSystem<E> = gkr_iop::circuit_builder::ConstraintSystem<E>; pub type NameSpace = gkr_iop::circuit_builder::NameSpace; pub type SetTableSpec = gkr_iop::circuit_builder::SetTableSpec; pub type CircuitBuilder<'a, E> = gkr_iop::circuit_builder::CircuitBuilder<'a, E>;
rust
Apache-2.0
ce97cf805a131db43a6d3d56a2fd0506a6dc8431
2026-01-04T20:23:30.257242Z
false
scroll-tech/ceno
https://github.com/scroll-tech/ceno/blob/ce97cf805a131db43a6d3d56a2fd0506a6dc8431/ceno_zkvm/src/structs.rs
ceno_zkvm/src/structs.rs
use crate::{ circuit_builder::{CircuitBuilder, ConstraintSystem}, e2e::{E2EProgramCtx, ShardContext}, error::ZKVMError, instructions::Instruction, scheme::septic_curve::SepticPoint, state::StateCircuit, tables::{ ECPoint, MemFinalRecord, RMMCollections, ShardRamCircuit, ShardRamInput...
rust
Apache-2.0
ce97cf805a131db43a6d3d56a2fd0506a6dc8431
2026-01-04T20:23:30.257242Z
false
scroll-tech/ceno
https://github.com/scroll-tech/ceno/blob/ce97cf805a131db43a6d3d56a2fd0506a6dc8431/ceno_zkvm/src/state.rs
ceno_zkvm/src/state.rs
use ff_ext::ExtensionField; use crate::{ chip_handler::general::PublicValuesQuery, circuit_builder::CircuitBuilder, error::ZKVMError, structs::RAMType, }; use multilinear_extensions::{Expression, ToExpr}; use p3::field::FieldAlgebra; pub trait StateCircuit<E: ExtensionField> { fn initial_global_state( ...
rust
Apache-2.0
ce97cf805a131db43a6d3d56a2fd0506a6dc8431
2026-01-04T20:23:30.257242Z
false
scroll-tech/ceno
https://github.com/scroll-tech/ceno/blob/ce97cf805a131db43a6d3d56a2fd0506a6dc8431/ceno_zkvm/src/uint.rs
ceno_zkvm/src/uint.rs
mod arithmetic; pub mod constants; mod logic; pub mod util; use crate::{ chip_handler::{AddressExpr, MemoryExpr, RegisterExpr}, circuit_builder::CircuitBuilder, error::UtilError, gadgets::{AssertLtConfig, SignedExtendConfig}, instructions::riscv::constants::UInt, utils::add_one_to_big_num, ...
rust
Apache-2.0
ce97cf805a131db43a6d3d56a2fd0506a6dc8431
2026-01-04T20:23:30.257242Z
false
scroll-tech/ceno
https://github.com/scroll-tech/ceno/blob/ce97cf805a131db43a6d3d56a2fd0506a6dc8431/ceno_zkvm/src/error.rs
ceno_zkvm/src/error.rs
use gkr_iop::error::{BackendError, CircuitBuilderError}; use mpcs::Error; #[derive(Debug)] pub enum UtilError { UIntError(Box<str>), } #[derive(Debug)] pub enum ZKVMError { CircuitError, CircuitBuilderError(CircuitBuilderError), BackendError(BackendError), UtilError(UtilError), WitnessNotFound...
rust
Apache-2.0
ce97cf805a131db43a6d3d56a2fd0506a6dc8431
2026-01-04T20:23:30.257242Z
false
scroll-tech/ceno
https://github.com/scroll-tech/ceno/blob/ce97cf805a131db43a6d3d56a2fd0506a6dc8431/ceno_zkvm/src/utils.rs
ceno_zkvm/src/utils.rs
use std::{ collections::HashMap, fmt::Display, hash::Hash, panic::{self, PanicHookInfo}, }; use ff_ext::ExtensionField; pub use gkr_iop::utils::i64_to_base; use itertools::Itertools; use p3::field::Field; #[cfg(feature = "u16limb_circuit")] use crate::instructions::riscv::constants::UINT_LIMBS; #[cfg(...
rust
Apache-2.0
ce97cf805a131db43a6d3d56a2fd0506a6dc8431
2026-01-04T20:23:30.257242Z
false
scroll-tech/ceno
https://github.com/scroll-tech/ceno/blob/ce97cf805a131db43a6d3d56a2fd0506a6dc8431/ceno_zkvm/src/e2e.rs
ceno_zkvm/src/e2e.rs
use crate::{ error::ZKVMError, instructions::riscv::{DummyExtraConfig, MemPadder, MmuConfig, Rv32imConfig}, scheme::{ PublicValues, ZKVMProof, constants::SEPTIC_EXTENSION_DEGREE, hal::ProverDevice, mock_prover::{LkMultiplicityKey, MockProver}, prover::ZKVMProver, ...
rust
Apache-2.0
ce97cf805a131db43a6d3d56a2fd0506a6dc8431
2026-01-04T20:23:30.257242Z
true
scroll-tech/ceno
https://github.com/scroll-tech/ceno/blob/ce97cf805a131db43a6d3d56a2fd0506a6dc8431/ceno_zkvm/src/scheme.rs
ceno_zkvm/src/scheme.rs
use crate::structs::EccQuarkProof; use ff_ext::ExtensionField; use gkr_iop::gkr::GKRProof; use itertools::Itertools; use mpcs::PolynomialCommitmentScheme; use p3::field::FieldAlgebra; use serde::{Deserialize, Serialize, de::DeserializeOwned}; use std::{ collections::{BTreeMap, HashMap}, fmt::{self, Debug}, ...
rust
Apache-2.0
ce97cf805a131db43a6d3d56a2fd0506a6dc8431
2026-01-04T20:23:30.257242Z
false
scroll-tech/ceno
https://github.com/scroll-tech/ceno/blob/ce97cf805a131db43a6d3d56a2fd0506a6dc8431/ceno_zkvm/src/instructions.rs
ceno_zkvm/src/instructions.rs
use crate::{ circuit_builder::CircuitBuilder, e2e::ShardContext, error::ZKVMError, structs::ProgramParams, tables::RMMCollections, witness::LkMultiplicity, }; use ceno_emul::StepRecord; use ff_ext::ExtensionField; use gkr_iop::{ chip::Chip, gkr::{GKRCircuit, layer::Layer}, selector::SelectorType, ...
rust
Apache-2.0
ce97cf805a131db43a6d3d56a2fd0506a6dc8431
2026-01-04T20:23:30.257242Z
false
scroll-tech/ceno
https://github.com/scroll-tech/ceno/blob/ce97cf805a131db43a6d3d56a2fd0506a6dc8431/ceno_zkvm/src/chip_handler.rs
ceno_zkvm/src/chip_handler.rs
use ff_ext::ExtensionField; use gkr_iop::{error::CircuitBuilderError, gadgets::AssertLtConfig}; use crate::instructions::riscv::constants::UINT_LIMBS; use multilinear_extensions::{Expression, ToExpr}; pub mod general; pub mod global_state; pub mod memory; pub mod register; pub trait GlobalStateRegisterMachineChipOpe...
rust
Apache-2.0
ce97cf805a131db43a6d3d56a2fd0506a6dc8431
2026-01-04T20:23:30.257242Z
false
scroll-tech/ceno
https://github.com/scroll-tech/ceno/blob/ce97cf805a131db43a6d3d56a2fd0506a6dc8431/ceno_zkvm/src/uint/arithmetic.rs
ceno_zkvm/src/uint/arithmetic.rs
use ff_ext::{ExtensionField, SmallField}; use gkr_iop::error::CircuitBuilderError; use itertools::{Itertools, izip}; use super::{UIntLimbs, UintLimb}; use crate::{ circuit_builder::CircuitBuilder, gadgets::AssertLtConfig, instructions::riscv::config::IsEqualConfig, }; use multilinear_extensions::{Expression, T...
rust
Apache-2.0
ce97cf805a131db43a6d3d56a2fd0506a6dc8431
2026-01-04T20:23:30.257242Z
true
scroll-tech/ceno
https://github.com/scroll-tech/ceno/blob/ce97cf805a131db43a6d3d56a2fd0506a6dc8431/ceno_zkvm/src/uint/util.rs
ceno_zkvm/src/uint/util.rs
// calculate the maximum number of combinations for stars and bars formula const fn max_combinations(degree: usize, num_cells: usize) -> usize { // compute factorial of n using usize const fn factorial(n: usize) -> usize { let mut result = 1; let mut i = 1; while i <= n { res...
rust
Apache-2.0
ce97cf805a131db43a6d3d56a2fd0506a6dc8431
2026-01-04T20:23:30.257242Z
false
scroll-tech/ceno
https://github.com/scroll-tech/ceno/blob/ce97cf805a131db43a6d3d56a2fd0506a6dc8431/ceno_zkvm/src/uint/constants.rs
ceno_zkvm/src/uint/constants.rs
use crate::utils::const_min; use super::{UIntLimbs, util::max_carry_word_for_multiplication}; use ff_ext::ExtensionField; impl<const TOTAL_BITS: usize, const CAPACITY: usize, E: ExtensionField> UIntLimbs<TOTAL_BITS, CAPACITY, E> { pub const TOTAL_BITS: usize = TOTAL_BITS; pub const LIMB_BITS: usize = CAP...
rust
Apache-2.0
ce97cf805a131db43a6d3d56a2fd0506a6dc8431
2026-01-04T20:23:30.257242Z
false
scroll-tech/ceno
https://github.com/scroll-tech/ceno/blob/ce97cf805a131db43a6d3d56a2fd0506a6dc8431/ceno_zkvm/src/uint/logic.rs
ceno_zkvm/src/uint/logic.rs
use ff_ext::ExtensionField; use gkr_iop::tables::OpsTable; use itertools::izip; use super::UIntLimbs; use crate::{ROMType, circuit_builder::CircuitBuilder, error::ZKVMError, witness::LkMultiplicity}; use multilinear_extensions::ToExpr; // Only implemented for u8 limbs. impl<const M: usize, E: ExtensionField> UIntLimb...
rust
Apache-2.0
ce97cf805a131db43a6d3d56a2fd0506a6dc8431
2026-01-04T20:23:30.257242Z
false
scroll-tech/ceno
https://github.com/scroll-tech/ceno/blob/ce97cf805a131db43a6d3d56a2fd0506a6dc8431/ceno_zkvm/src/chip_handler/general.rs
ceno_zkvm/src/chip_handler/general.rs
use ff_ext::ExtensionField; use gkr_iop::{error::CircuitBuilderError, tables::LookupTable}; use crate::{ circuit_builder::CircuitBuilder, instructions::riscv::constants::{ END_CYCLE_IDX, END_PC_IDX, EXIT_CODE_IDX, HEAP_LENGTH_IDX, HEAP_START_ADDR_IDX, HINT_LENGTH_IDX, HINT_START_ADDR_IDX, INIT_...
rust
Apache-2.0
ce97cf805a131db43a6d3d56a2fd0506a6dc8431
2026-01-04T20:23:30.257242Z
false
scroll-tech/ceno
https://github.com/scroll-tech/ceno/blob/ce97cf805a131db43a6d3d56a2fd0506a6dc8431/ceno_zkvm/src/chip_handler/global_state.rs
ceno_zkvm/src/chip_handler/global_state.rs
use ff_ext::ExtensionField; use gkr_iop::error::CircuitBuilderError; use super::GlobalStateRegisterMachineChipOperations; use crate::{circuit_builder::CircuitBuilder, structs::RAMType}; use multilinear_extensions::{Expression, ToExpr}; use p3::field::FieldAlgebra; impl<E: ExtensionField> GlobalStateRegisterMachineChi...
rust
Apache-2.0
ce97cf805a131db43a6d3d56a2fd0506a6dc8431
2026-01-04T20:23:30.257242Z
false
scroll-tech/ceno
https://github.com/scroll-tech/ceno/blob/ce97cf805a131db43a6d3d56a2fd0506a6dc8431/ceno_zkvm/src/chip_handler/register.rs
ceno_zkvm/src/chip_handler/register.rs
use ff_ext::ExtensionField; use gkr_iop::error::CircuitBuilderError; use crate::{circuit_builder::CircuitBuilder, gadgets::AssertLtConfig, structs::RAMType}; use multilinear_extensions::{Expression, ToExpr}; use super::{RegisterChipOperations, RegisterExpr}; impl<E: ExtensionField, NR: Into<String>, N: FnOnce() -> N...
rust
Apache-2.0
ce97cf805a131db43a6d3d56a2fd0506a6dc8431
2026-01-04T20:23:30.257242Z
false
scroll-tech/ceno
https://github.com/scroll-tech/ceno/blob/ce97cf805a131db43a6d3d56a2fd0506a6dc8431/ceno_zkvm/src/chip_handler/memory.rs
ceno_zkvm/src/chip_handler/memory.rs
use crate::{ chip_handler::{AddressExpr, MemoryChipOperations, MemoryExpr}, circuit_builder::CircuitBuilder, gadgets::AssertLtConfig, structs::RAMType, }; use ff_ext::ExtensionField; use gkr_iop::error::CircuitBuilderError; use multilinear_extensions::Expression; impl<E: ExtensionField, NR: Into<String...
rust
Apache-2.0
ce97cf805a131db43a6d3d56a2fd0506a6dc8431
2026-01-04T20:23:30.257242Z
false
scroll-tech/ceno
https://github.com/scroll-tech/ceno/blob/ce97cf805a131db43a6d3d56a2fd0506a6dc8431/ceno_zkvm/src/instructions/riscv.rs
ceno_zkvm/src/instructions/riscv.rs
use ceno_emul::InsnKind; mod rv32im; pub use rv32im::{ DummyExtraConfig, Rv32imConfig, mmu::{MemPadder, MmuConfig}, }; pub mod arith; pub mod arith_imm; pub mod branch; pub mod config; pub mod constants; pub mod div; pub mod dummy; pub mod ecall; pub mod ecall_base; pub mod jump; pub mod logic; pub mod logic_...
rust
Apache-2.0
ce97cf805a131db43a6d3d56a2fd0506a6dc8431
2026-01-04T20:23:30.257242Z
false