Skip to content
Draft
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
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ jobs:

- name: Rerun doc generation with different args and copy into book directory
if: >-
github.event_name == 'push' &&
github.event_name == 'push' &&
github.ref == 'refs/heads/master' &&
matrix.rust_toolchain_version == needs.define-matrix.outputs.default_rust_version &&
matrix.os == needs.define-matrix.outputs.default_os
Expand All @@ -171,7 +171,7 @@ jobs:
- name: Deploy
uses: peaceiris/actions-gh-pages@4f9cc6602d3f66b9c108549d475ec49e8ef4d45e
if: >-
github.event_name == 'push' &&
github.event_name == 'push' &&
github.ref == 'refs/heads/master' &&
matrix.rust_toolchain_version == needs.define-matrix.outputs.default_rust_version &&
matrix.os == needs.define-matrix.outputs.default_os
Expand Down
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -53,3 +53,7 @@ o1vm/resources/programs/mips/src
o1vm/resources/programs/mips/bin

CLAUDE.md

# OCaml artefacts
_build
_opam
10 changes: 10 additions & 0 deletions Cargo.lock

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

4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -247,4 +247,8 @@ build-web: ## Compile the Kimchi library into WebAssembly to be used in the brow
--out-dir ${PLONK_WASM_WEB_OUTDIR} \
--rust-version ${NIGHTLY_RUST_VERSION}

.PHONY: build-ocaml-kimchi-stubs
build-ocaml-kimchi-stubs: ## Build the OCaml modules to call the Kimchi and Pasta primitives in Rust
dune build kimchi-stubs

.PHONY: all setup install-test-deps clean build release test-doc test-doc-with-coverage test test-with-coverage test-heavy test-heavy-with-coverage test-all test-all-with-coverage nextest nextest-with-coverage nextest-heavy nextest-heavy-with-coverage nextest-all nextest-all-with-coverage format lint generate-test-coverage-report generate-doc setup-riscv32-toolchain help fclean build-riscv32-programs build-mips-programs check-format
62 changes: 46 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,24 @@

[![dependency status](https://deps.rs/repo/github/o1-labs/proof-systems/status.svg?style=flat-square)](https://deps.rs/repo/github/o1-labs/proof-systems)

This repository contains **kimchi**, a general-purpose zero-knowledge proof system for proving the correct execution of programs.
This repository contains **kimchi**, a general-purpose zero-knowledge proof
system for proving the correct execution of programs.

You can read more about this project on the [Kimchi book](https://o1-labs.github.io/proof-systems), or for a lighter introduction in this [blogpost](https://minaprotocol.com/blog/kimchi-the-latest-update-to-minas-proof-system).
You can read more about this project on the [Kimchi
book](https://o1-labs.github.io/proof-systems), or for a lighter introduction in
this
[blogpost](https://minaprotocol.com/blog/kimchi-the-latest-update-to-minas-proof-system).

[See here for the rust documentation](https://o1-labs.github.io/proof-systems/rustdoc).

## User Warning

This project comes as is. We provide no guarantee of stability or support, as the crates closely follow the needs of the [Mina](<[https://](https://github.com/minaprotocol/mina)>) project.
This project comes as is. We provide no guarantee of stability or support, as
the crates closely follow the needs of the
[Mina](<[https://](https://github.com/minaprotocol/mina)>) project.

If you use this project in a production environment, it is your responsibility to perform a security audit to ensure that the software meets your requirements.
If you use this project in a production environment, it is your responsibility
to perform a security audit to ensure that the software meets your requirements.

## Performance

Expand Down Expand Up @@ -52,7 +59,8 @@ At the time of this writing:

The project is organized in the following way:

- [book/](book/). The mina book, RFCs, and specifications. [Available here in HTML](https://o1-labs.github.io/proof-systems).
- [book/](book/). The mina book, RFCs, and specifications. [Available here in
HTML](https://o1-labs.github.io/proof-systems).
- [curves/](curves/). The elliptic curves we use (for now just the pasta curves).
- [groupmap/](groupmap/). Used to convert elliptic curve elements to field elements.
- [hasher/](hasher/). Interfaces for mina hashing.
Expand All @@ -66,18 +74,20 @@ The project is organized in the following way:

## Contributing

Check [CONTRIBUTING.md](CONTRIBUTING.md) if you are interested in contributing to this project.
Check [CONTRIBUTING.md](CONTRIBUTING.md) if you are interested in contributing
to this project.

## Generate rustdoc locally

An effort is made to have the documentation being self-contained, referring to the mina book for more details when necessary.
You can build the rust documentation with
An effort is made to have the documentation being self-contained, referring to
the mina book for more details when necessary. You can build the rust
documentation with

<!-- This must be the same than the content in .github/workflows/gh-page.yml -->
<!-- This must be the same than the content in .github/workflows/ci.yml -->

```shell
rustup install nightly
RUSTDOCFLAGS="--enable-index-page -Zunstable-options" cargo +nightly doc --all --no-deps
make generate-doc
```

You can visualize the documentation by opening the file `target/doc/index.html`.
Expand All @@ -87,16 +97,36 @@ You can visualize the documentation by opening the file `target/doc/index.html`.
<!-- Please update this section if you add more workflows -->

- [CI](.github/workflows/ci.yml).
This workflow ensures that the entire project builds correctly, adheres to guidelines, and passes all necessary tests.
This workflow ensures that the entire project builds correctly, adheres to
guidelines, and passes all necessary tests.
- [Nightly tests with the code coverage](.github/workflows/ci-nightly.yml).
This workflow runs all the tests per scheduler or on-demand, generates and attaches the code coverage report to the job's execution results.
This workflow runs all the tests per scheduler or on-demand, generates and
attaches the code coverage report to the job's execution results.
- [Benchmarks](.github/workflows/benches.yml).
This workflow runs benchmarks when a pull request is labeled with "benchmark." It sets up the Rust and OCaml environments, installs necessary tools, and executes cargo criterion benchmarks on the kimchi crate. The benchmark results are then posted as a comment on the pull request for review.
This workflow runs benchmarks when a pull request is labeled with "benchmark."
It sets up the Rust and OCaml environments, installs necessary tools, and
executes cargo criterion benchmarks on the kimchi crate. The benchmark results
are then posted as a comment on the pull request for review.
- [Deploy Specifications & Docs to GitHub Pages](.github/workflows/gh-page.yml).
When CI passes on master, the documentation built from the rust code will be available by this [link](https://o1-labs.github.io/proof-systems/rustdoc) and the book will be available by this [link](https://o1-labs.github.io/proof-systems).
When CI passes on master, the documentation built from the rust code will be
available by this [link](https://o1-labs.github.io/proof-systems/rustdoc) and
the book will be available by this
[link](https://o1-labs.github.io/proof-systems).
- [MIPS Build and Package](.github/workflows/mips-build.yml)
This workflow runs the assembler and linker on the programs from the OpenMips test suite, and provides a link where you can download the artifacts (recommended if you don't have / can't install the required MIPS tooling). This workflow also runs the o1vm ELF parser on the artifacts to check that our parsing is working. Currently it is run via manual trigger only -- you can find the trigger in the [GitHub actions tab](https://github.com/o1-labs/proof-systems/actions/workflows/mips-build.yml) and the link to the artifacts will appear in logs of the `Upload Artifacts` stage.
This workflow runs the assembler and linker on the programs from the OpenMips
test suite, and provides a link where you can download the artifacts
(recommended if you don't have / can't install the required MIPS tooling).
This workflow also runs the o1vm ELF parser on the artifacts to check that our
parsing is working. Currently it is run via manual trigger only -- you can
find the trigger in the [GitHub actions
tab](https://github.com/o1-labs/proof-systems/actions/workflows/mips-build.yml)
and the link to the artifacts will appear in logs of the `Upload Artifacts`
stage.

## Nix for Dependencies (WIP)

If you have `nix` installed and in particular, `flakes` enabled, you can install the dependencies for these projects using nix. Simply `nix develop .` inside this directory to bring into scope `rustup`, `opam`, and `go` (along with a few other tools). You will have to manage the toolchains yourself using `rustup` and `opam`, in the current iteration.
If you have `nix` installed and in particular, `flakes` enabled, you can install
the dependencies for these projects using nix. Simply `nix develop .` inside
this directory to bring into scope `rustup`, `opam`, and `go` (along with a few
other tools). You will have to manage the toolchains yourself using `rustup` and
`opam`, in the current iteration.
9 changes: 9 additions & 0 deletions dune
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
;; create a `dune-build-root` file that contains the dune workspace root

(rule
(target dune-build-root)
(deps
; no sandbox, we want the path to the _build directory
(sandbox none))
(action
(system "printf \"%s\" $(realpath %{workspace_root}/..) > %{target}")))
37 changes: 37 additions & 0 deletions dune-project
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
(lang dune 3.0)

(generate_opam_files true)

(source (github o1-labs/profo-systems))
(license Apache-2.0)
(authors "O(1) Labs, LLC <[email protected]>")
(maintainers "O(1) Labs, LLC <[email protected]>")
(bug_reports "https://github.com/o1-labs/proof-systems/issues")
(homepage "https://github.com/o1-labs/proof-systems/")

(package
(name kimchi_types)
(synopsis "OCaml bindings to types defined in Kimchi")
(depends
(dune (>= 3.0))
(conf-rust (>= 0.1))
)
)

(package
(name kimchi_bindings)
(synopsis "OCaml bindings to Kimchi")
(depends
(dune (>= 3.0))
(conf-rust (>= 0.1))
)
)

(package
(name pasta_bindings)
(synopsis "OCaml bindings to the Pasta curves")
(depends
(dune (>= 3.0))
(conf-rust (>= 0.1))
)
)
46 changes: 46 additions & 0 deletions kimchi-stubs/.ocamlformat
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
profile=ocamlformat
quiet=false
max-iters=10
comment-check=true
wrap-fun-args=true
wrap-comments=false
type-decl=compact
space-around-variants=true
space-around-records=true
space-around-lists=true
space-around-arrays=true
single-case=compact
sequence-style=separator
sequence-blank-line=preserve-one
parse-docstrings=false
parens-tuple=always
parens-ite=false
ocp-indent-compat=false
module-item-spacing=sparse
max-indent=68
margin=80
let-module=compact
let-binding-spacing=compact
let-and=compact
leading-nested-match-parens=false
infix-precedence=indent
indicate-nested-or-patterns=space
indicate-multiline-delimiters=space
if-then-else=compact
field-space=loose
exp-grouping=parens
dock-collection-brackets=false
doc-comments-tag-only=default
doc-comments-padding=2
doc-comments=before
disable=false
cases-matching-exp-indent=normal
cases-exp-indent=4
break-sequences=false
break-separators=before
break-infix-before-func=true
break-infix=wrap
break-fun-sig=wrap
break-fun-decl=wrap
break-cases=nested
assignment-operator=end-line
4 changes: 4 additions & 0 deletions kimchi-stubs/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,7 @@ mina-curves = { workspace = true }
mina-poseidon = { workspace = true }
o1-utils = { workspace = true }
poly-commitment = { workspace = true, features = ["ocaml_types"] }

[[bin]]
name = "main"
path = "src/bin/main.rs"
11 changes: 11 additions & 0 deletions kimchi-stubs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# OCaml stubs for the Kimchi library

This libary generates OCaml stubs that can be used in OCaml projects to call the
Kimchi primitives.

## Setup dev environment

```
opam switch create ./ 4.14.0
opam install ocamlformat merlin
```
Loading
Loading