Skip to content

Commit

Permalink
Merge branch 'master' into feature/remove-polymorphism
Browse files Browse the repository at this point in the history
  • Loading branch information
mrmr1993 authored Dec 16, 2024
2 parents 63a49c2 + 40279ef commit 2fe73de
Show file tree
Hide file tree
Showing 8 changed files with 48 additions and 77 deletions.
9 changes: 5 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: Check build

on:
[pull_request]
pull_request:

jobs:
check_build:
Expand All @@ -18,12 +18,13 @@ jobs:

steps:
- name: Get code
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Use OCaml ${{ matrix.ocaml-version }}
uses: avsm/setup-ocaml@v1
uses: ocaml/setup-ocaml@v3
with:
ocaml-version: ${{ matrix.ocaml-version }}
ocaml-compiler: ${{ matrix.ocaml-version }}
disable-cache: true

- name: Build
run: |
Expand Down
13 changes: 5 additions & 8 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
@@ -1,21 +1,18 @@
name: ci

on:
[pull_request]
pull_request:

jobs:
docker-build:
runs-on: ubuntu-latest
steps:
-
name: Checkout
uses: actions/checkout@v2
-
uses: docker/setup-buildx-action@v1
- name: Checkout
uses: actions/checkout@v4
- uses: docker/setup-buildx-action@v3
id: docker-build
with:
install: true
-
name: Build
- name: Build
run: |
docker build . # will run buildx
62 changes: 30 additions & 32 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -1,39 +1,37 @@
name: Deploy Docs to GitHub Pages

on:
push:
branches:
- master
push:
branches:
- master

jobs:
release:
name: GitHub Pages
runs-on: ubuntu-latest
release:
name: GitHub Pages
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v2

steps:
- name: Checkout Repository
uses: actions/checkout@v2
- name: Use OCaml "4.14.0"
uses: avsm/setup-ocaml@v1
with:
ocaml-version: 4.14.0

- name: Use OCaml "4.14.0"
uses: avsm/setup-ocaml@v1
with:
ocaml-version: 4.14.0

- name: Build Documentation
run: |
eval $(opam env)
opam pin add . -y
opam install odoc
make website
cd website/website
yarn
yarn build
pwd
ls
ls build
- name: Deploy
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./website/website/build/snarky
- name: Build Documentation
run: |
eval $(opam env)
opam pin add . -y
opam install odoc
make website
cd website/website
yarn
yarn build
pwd
ls
ls build
- name: Deploy
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./website/website/build/snarky
9 changes: 0 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,6 @@ test-website-build :
publish-website : website
./scripts/publish-website.sh

examples :
dune exec ./examples/election/election_main.exe
dune exec ./examples/merkle_update/merkle_update.exe
# tutorial.exe intentionally is unimplemented, but it should still compile
dune build ./examples/tutorial/tutorial.exe

examples-gpu :
dune exec ./examples/election_gpu/election_main.exe

reformat:
dune build @./fmt; dune promote

Expand Down
4 changes: 0 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,6 @@ opam pin add [email protected]:o1-labs/snarky.git
```
and answering yes to the prompts.

The best place to get started learning how to use the library are the annotated examples.
- [Election](examples/election/election_main.ml): shows how to use Snarky to verify an election was run honestly.
- [Merkle update](examples/merkle_update/merkle_update.ml): a simple example updating a Merkle tree.

## Design

The intention of this library is to allow writing snarks by writing what look
Expand Down
15 changes: 8 additions & 7 deletions src/base/snark0.ml
Original file line number Diff line number Diff line change
Expand Up @@ -641,7 +641,7 @@ struct
end
end

(** The main functor for the monadic interface.
(** The main functor for the monadic interface.
See [Run.Make] for the same thing but for the imperative interface. *)
module Make (Backend : Backend_intf.S) = struct
module Backend_extended = Backend_extended.Make (Backend)
Expand Down Expand Up @@ -1245,8 +1245,8 @@ module Run = struct
let inject_wrapper ~f x = f x in
inject_wrapper ~f (x a)

(** Caches the global [state] before running [f].
It is expected that [f] will reset the global state for its own use only,
(** Caches the global [state] before running [f].
It is expected that [f] will reset the global state for its own use only,
hence why we need to reset it after running [f].*)
let finalize_is_running f =
let cached_state = !state in
Expand Down Expand Up @@ -1321,16 +1321,17 @@ module Run = struct

let generate_witness ~input_typ ~return_typ x a : Proof_inputs.t =
finalize_is_running (fun () ->
let x = inject_wrapper x ~f:(fun x () -> mark_active ~f:x) in
Perform.generate_witness ~run:as_stateful ~input_typ ~return_typ x a )
let x_wrapped = inject_wrapper x ~f:(fun x () -> mark_active ~f:x) in
Perform.generate_witness ~run:as_stateful ~input_typ ~return_typ
x_wrapped a )

let generate_witness_conv (type out)
~(f : Proof_inputs.t -> 'r_value -> out) ~input_typ ~return_typ x input
: out =
finalize_is_running (fun () ->
let x = inject_wrapper x ~f:(fun x () -> mark_active ~f:x) in
let x_wrapped = inject_wrapper x ~f:(fun x () -> mark_active ~f:x) in
Perform.generate_witness_conv ~run:as_stateful ~f ~input_typ
~return_typ x input )
~return_typ x_wrapped input )

let generate_witness_manual ?handlers ~input_typ ~return_typ input =
let builder =
Expand Down
4 changes: 0 additions & 4 deletions website/docs/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,6 @@ opam pin add [email protected]:o1-labs/snarky.git
```
and answering yes to the prompts.

The best place to get started learning how to use the library are the annotated examples.
- [Election](examples/election/election_main.ml): shows how to use Snarky to verify an election was run honestly.
- [Merkle update](examples/merkle_update/merkle_update.ml): a simple example updating a Merkle tree.

## Design

The intention of this library is to allow writing snarks by writing what look
Expand Down
9 changes: 0 additions & 9 deletions website/docs/try-it-out.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,3 @@ project directory, run
```sh
dune exec src/try_me.exe
```

## Tutorials and examples

We believe a great way to learn is by doing! You can find our tutorial [on
GitHub](https://github.com/o1-labs/snarky/blob/master/examples/tutorial), as
well as
[some](https://github.com/o1-labs/snarky/tree/master/examples/merkle_update)
[examples](https://github.com/o1-labs/snarky/tree/master/examples/election) to
try out.

0 comments on commit 2fe73de

Please sign in to comment.