Skip to content

Conversation

yczhangsjtu
Copy link
Collaborator

This is a draft and outline of the developer document for Ceno.

@yczhangsjtu
Copy link
Collaborator Author

To read the book, first install mdbook as follows:

cargo install mdbook

Then start a local server that serves the content:

cd docs
mdbook serve --open

As you saw in the previous chapter, you can run the program with `cargo ceno run`:

```sh
cargo ceno run --example fibonacci --hints=10 --public-io=4191
Copy link
Collaborator

Choose a reason for hiding this comment

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

showcase how to pass hints & public-io as files

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Hints from file is done. Public IO as file is not available yet.

@yczhangsjtu
Copy link
Collaborator Author

Some examples in the document failed. Summary of the current status:

  • The Fibonacci example:
    • Using --hints=10 prove and verify successfully
    • Using --hints-file hints.bin the prover fails and reports the same error message as the verifier in the next case
  • The example in generating-and-verifying-proofs.md:
    • Using --hints=5 the prover succeeds and claims the proof is verified successfully, but the verifier fails
    • Using --hints-file hints.bin the prover fails and reports the same error message as the verifier in the previous case

The hints file just contains the four bytes: 10 0 0 0 or 5 0 0 0

@kunxian-xia
Copy link
Collaborator

We need a tool to generate hints.bin automatically from the guest program.

"alloc",
"bytecheck",
] }
```
Copy link
Collaborator

@hero78119 hero78119 Sep 8, 2025

Choose a reason for hiding this comment

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

I think we need to add rust-toolchain.toml

[toolchain]
channel = "nightly-2025-03-25"
targets = ["riscv32im-unknown-none-elf"]
# We need the sources for build-std.
components = ["rust-src"]

specify as nightly build as currently we rely on some features not in stable channel. Otherwise it will suffer build failed

Now, run the program and generate a proof. You can provide input via the `--stdin` flag.

```bash
cargo ceno prove --hints=5 --public-io=8 --out-proof proof.bin
Copy link
Collaborator

@hero78119 hero78119 Sep 8, 2025

Choose a reason for hiding this comment

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

the root cause failed reported here #1054 (comment) is because in prove internally we generate new pk/vk pair each time, so we need to append "--out-vk vk.bin" prove command to force new generated vk are serialized thus the verify can use same key.

For why pk/vk non-deterministic is under investigating

Copy link
Collaborator

Choose a reason for hiding this comment

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

In "prove" we exposed few arguments which will generate and invalidate pk/vk in key gen phase, e.g. --field allow change different field which will break the fixed commitment happened in key-gen phase due to different field.

I suggest to simplify, we can temporarily remove keygen phase and only rely on prove, verify for documentation

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.

3 participants