Skip to content

#1084 follow up: verifier check on dynamic init table#1223

Merged
kunxian-xia merged 16 commits intomasterfrom
feat/dynamic_heap_hint_check
Apr 22, 2026
Merged

#1084 follow up: verifier check on dynamic init table#1223
kunxian-xia merged 16 commits intomasterfrom
feat/dynamic_heap_hint_check

Conversation

@hero78119
Copy link
Copy Markdown
Collaborator

@hero78119 hero78119 commented Jan 12, 2026

Problem

Dynamic heap/hint init tables need verifier-side checks so shard continuation and dynamic-length constraints cannot be bypassed. This PR also needs to stay compatible with current master after the linker/public-io cleanup and the later single-shard debug verification support.

Design Rationale

Keep the memory-state verifier ISA-extensible by carrying RV32-specific heap/hint bounds in RV32imMemStateConfig, while enforcing continuation and dynamic-init checks in the native and recursion verifier paths. Merge on top of master instead of reverting master-only changes.

Change Highlights

  • ceno_zkvm
    • restore verifier checks for dynamic heap/hint init tables
    • enforce heap/hint continuation and proof-size checks across shards
    • keep ZKVMVerifier / ZKVMVerifyingKey extensible with a mem-state verifier generic
    • merge master single-shard e2e verification flow and fix its halt expectation for debug shard verification
  • ceno_recursion
    • restore heap/hint bound checks in aggregation leaf verification
    • merge shard-id plumbing for single-shard e2e_aggregate
  • ceno_emul / ceno_rt
    • reconcile this PR's memory layout swap with master's removal of the PUBLIC I/O linker term
    • fix emulator dense-memory bounds for the merged layout

Benchmark / Performance Impact

No intended performance change beyond verifier-side checks. Previous measurements on this work showed negligible overhead; no new benchmark run was needed for the merge-only follow-ups.

Benchmark command(s): not rerun for the merge-only follow-ups.

Environment (CPU/GPU, core count, rust toolchain, commit hash): validated on local dev environment at head 7da2e88.

raw data:

  • master: n/a
  • this PR: n/a

Testing

  • cargo make clippy
  • cargo check --config net.git-fetch-with-cli=true -p ceno_zkvm -p ceno_recursion --bins --release
  • cargo run --config net.git-fetch-with-cli=true --release --package ceno_zkvm --bin e2e -- --platform=ceno --max-cycle-per-shard=1600 examples/target/riscv32im-ceno-zkvm-elf/release/examples/keccak_syscall
  • cargo run --config net.git-fetch-with-cli=true --features gpu --release --package ceno_zkvm --bin e2e -- --platform=ceno --max-cycle-per-shard=1600 examples/target/riscv32im-ceno-zkvm-elf/release/examples/keccak_syscall
  • cargo run --config net.git-fetch-with-cli=true --release --package ceno_zkvm --bin e2e -- --platform=ceno --max-cycle-per-shard=1600 --shard-id=0 examples/target/riscv32im-ceno-zkvm-elf/release/examples/keccak_syscall

Risks and Rollout

Main risk is verifier semantic drift between full-trace verification and single-shard debug verification. This branch keeps them separate: full-trace verification still owns entry/continuation checks, while single-shard debug verification checks only the selected shard segment.

Follow-ups (optional)

  • add a dedicated regression for the single-shard non-halt case in CI if needed

Copilot Reviewer Directive (keep this section)

When Copilot reviews this PR, apply .github/copilot-instructions.md strictly.

Comment thread ceno_zkvm/src/tables/ram.rs Outdated
"HeapTable"
}

fn max_len(params: &ProgramParams) -> usize {
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no logic change, just make function impl order follow trait

Comment thread ceno_zkvm/src/tables/ram.rs Outdated
"HintsTable"
}

fn max_len(params: &ProgramParams) -> usize {
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no logic change, just make function impl order follow trait

name_fn: N,
assert_zero_expr: Expression<E>,
) -> Result<(), CircuitBuilderError> {
assert!(
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To check assert_eq(public_value[i], public_value[j]) within constrain, both are scalar thus degree is 0

@hero78119 hero78119 requested a review from kunxian-xia January 13, 2026 08:21
let chip_proofs =
builder.get(&zkvm_proof_input.chip_proofs, num_chips_verified.get_var());

let chip_proofs_len = chip_proofs.len();
Copy link
Copy Markdown
Collaborator Author

@hero78119 hero78119 Jan 13, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Soundness fix: this logic present in rust verifier but not in recursion verifier

.then(|builder| {
builder.assert_usize_eq(chip_proofs_len.clone(), Usize::from(1));
});
} else if circuit_vk.get_cs().with_omc_init_dyn() {
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dynamic init table only allow 1 chip proof per shard

@hero78119 hero78119 force-pushed the feat/dynamic_heap_hint_check branch from 97f5680 to d87ea19 Compare January 13, 2026 14:24
kunxian-xia and others added 3 commits January 15, 2026 20:58
Resolve the merge by combining PR 1223's memory-layout swap with master's removal of the PUBLIC I/O linker term. Keep the PR's dynamic heap/hint init and shard continuation verification semantics, preserve the ISA-extensible mem-state verifier generic with an RV32 default, and align benches with the current e2e API.
Bring in master changes from PR 1318 for single-shard e2e verification, keep the shard mem-state verification work on this branch, and fix the debug single-shard verifier to derive halt expectation from the selected shard proof rather than the full program exit code. Also take master's ceno-gpu dependency update.
@hero78119
Copy link
Copy Markdown
Collaborator Author

Update on the two merge follow-ups now on this PR head (7da2e88):

  • 7de491b merged current master into this branch while preserving the PR semantics.

    • kept the dynamic heap/hint init checks and shard continuation checks
    • kept the ISA-extensible mem-state verifier path via RV32imMemStateConfig
    • reconciled the intentional memory layout swap from this PR with master's removal of the PUBLIC I/O linker term
    • aligned benches and verifier plumbing with current master APIs
    • validated with cargo make clippy and CPU/GPU e2e on keccak_syscall
  • 7da2e88 merged the later master follow-up from PR support single-shard e2e verification #1318.

    • brought in single-shard e2e verification support
    • kept this PR's shard mem-state verification changes on top
    • fixed the single-shard debug verifier to derive expect_halt from the selected shard proof instead of the full program exit code
    • took master's ceno-gpu dependency update
    • validated with cargo check --config net.git-fetch-with-cli=true -p ceno_zkvm -p ceno_recursion --bins --release and single-shard e2e --shard-id=0

Net result: this PR is rebased onto current master semantics, keeps the shard continuation / dynamic-init verification work, and now also retains the newer single-shard debug verification flow.

@kunxian-xia kunxian-xia added this pull request to the merge queue Apr 22, 2026
Merged via the queue into master with commit 4fd159b Apr 22, 2026
4 checks passed
@kunxian-xia kunxian-xia deleted the feat/dynamic_heap_hint_check branch April 22, 2026 14:54
kunxian-xia added a commit that referenced this pull request Apr 23, 2026
…t/verifier-crypto-contract

Conflict in ceno_zkvm/src/scheme/verifier.rs: master's PR #1223 introduced
validate_mem_state covering both heap and hint continuation against the new
mem_state_verifier; took master's version since it subsumes this branch's
heap-only check and already returns ZKVMError rather than panicking, which
matches this branch's verifier-error contract.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants