Skip to content
This repository was archived by the owner on Apr 25, 2025. It is now read-only.

Commit 256e160

Browse files
authored
Merge pull request #176 from o1-labs/merge-main-develop
Merge main and adapt TS bindings to develop
2 parents a753318 + 6598170 commit 256e160

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+127903
-128239
lines changed

.github/workflows/lint.yaml

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,8 @@ jobs:
1111
- name: Checkout
1212
uses: actions/checkout@v3
1313

14-
- name: Print prettier version
15-
uses: creyD/prettier_action@v4.3
16-
with:
17-
prettier_options: -v
18-
19-
- name: Prettify code
20-
uses: creyD/prettier_action@v4.3
21-
with:
22-
prettier_options: -c kimchi/js/**/*.js js/**/*.js
14+
- name: Run prettier
15+
run: |
16+
npm init -y
17+
npm i prettier
18+
npx prettier -c kimchi/js/**/*.js js/**/*.js

LICENSE

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ Parameters
99

1010
Licensor: O(1) Labs Operating Corporation
1111

12-
Licensed Work: snarkyjs-bindings, or any subsequent name assigned to this
13-
Github repository
12+
Licensed Work: o1js-bindings, or any subsequent name assigned to this
13+
GitHub repository
1414

1515
The Licensed Work is (c) 2021 O(1) Labs Operating Corporation
1616

@@ -22,11 +22,11 @@ Licensed Work solely for development or use of apps and smart contracts running
2222
on the Mina Protocol, or any app or smart contract that settles to the Mina
2323
Protocol.
2424

25-
2. For the avoidance of doubt, excluding snarkyjs-bindings, SnarkyJS (as
26-
implemented in the repository located at https://github.com/o1-labs/snarkyjs),
27-
continues to be licensed under Apache 2.0 as shown in the applicable Github
28-
repositories. Any use of this snarkyjs-bindings repository, without
29-
modification, as a transitive dependency or derivative of the use of SnarkyJS,
25+
2. For the avoidance of doubt, excluding o1js-bindings, o1js (as
26+
implemented in the repository located at https://github.com/o1-labs/o1js),
27+
continues to be licensed under Apache 2.0 as shown in the applicable GitHub
28+
repositories. Any use of this o1js-bindings repository, without
29+
modification, as a transitive dependency or derivative of the use of o1js,
3030
is permitted. Modification of the software in this repository is not permitted
3131
unless authorized under the Additional Use Grant #1 set forth above or #3 set
3232
forth below.

MINA_COMMIT

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
The mina commit used to generate the backends for node and web is
2-
0970329c483ad60fa63941e7e9a44b5014849557
2+
d37338b7f31a70fb81c2b1e9f1759727d8f04b69

README.md

Lines changed: 25 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,53 +1,55 @@
1-
# SnarkyJS bindings
1+
# o1js bindings
22

3-
This repository collects code needed by [SnarkyJS](https://github.com/o1-labs/snarkyjs) to bind to lower layers of the proof system and the Mina transaction logic, which are written in Rust and OCaml.
3+
This repository collects code required by [o1js](https://github.com/o1-labs/o1js) to bind to lower layers of the proof system and the Mina transaction logic, which are written in Rust and OCaml.
44

5-
The repo is included as a git submodule in the [SnarkyJS repo](https://github.com/o1-labs/snarkyjs) under `src/bindings`, and typically used from there.
5+
The repo is included as a git submodule in the [o1js repo](https://github.com/o1-labs/o1js) under `src/bindings` and is typically used from there.
66

77
**Directory structure**
88

9-
- `/compiled` - compiled JS and Wasm artifacts produced by `js_of_ocaml` and `wasm-bindgen` from Rust and OCaml source code. We keep these artifacts in the source tree so that developing on SnarkyJS can be done with standard JS tooling and doesn't require setting up the full OCaml/Rust build pipeline.
9+
- `/compiled` - compiled JS and Wasm artifacts produced by `js_of_ocaml` and `wasm-bindgen` from Rust and OCaml source code. We keep these artifacts in the source tree so that developing on o1js can be done with standard JS tooling and doesn't require setting up the full OCaml/Rust build pipeline.
1010
- `/crypto` - pure TS implementations of a subset of the crypto primitives we use, including finite field and elliptic curve arithmetic. This is used by mina-signer (a pure TS package) to hash and sign transactions.
11-
- `/js` - JS-side wrappers for the artifacts located in `/compiled`, which differs between the Node.js and web versions of SnarkyJS. Includes code for setting up workers to support using `rayon` in Rust.
11+
- `/js` - JS-side wrappers for the artifacts located in `/compiled`, which differs between the Node.js and web versions of o1js. Includes code for setting up workers to support using `rayon` in Rust.
1212
- `/kimchi` - bindings to the [Kimchi proof system](https://o1-labs.github.io/proof-systems/kimchi/overview.html) which is implemented in Rust. This contains a Wasm compatibility layer written in Rust as well as a `js_of_ocaml`-to-`wasm-bindgen` glue layer written in JS.
13-
- `/lib` - miscellaneous low-level TypeScript which underpins SnarkyJS and provides generic ways to connect with a proof system and blockchain protocol.
14-
- `/mina-transaction` - TS types and modules which specialize the generic tooling in `/lib` to Mina's zkApp protocol; mostly auto-generated from OCaml.
15-
- `/ocaml` - OCaml library exposing Snarky, Pickles and parts of the Mina transaction logic to JS. Also, OCaml scripts which help auto-generating TypeScript for Mina- and crypto-related types and constants.
16-
- `/scripts` - scripts which build parts of SnarkyJS from their OCaml and Rust sources, including the contents of `/compiled` and other generated TS files.
13+
- `/lib` - miscellaneous low-level TypeScript, which underpins o1js and provides generic ways to connect with a proof system and blockchain protocol.
14+
- `/mina-transaction` - TS types and modules that specialize the generic tooling in `/lib` to Mina's zkApp protocol; mostly auto-generated from OCaml.
15+
- `/ocaml` - OCaml library exposing Snarky, Pickles and parts of the Mina transaction logic to JS. Also, OCaml scripts that help auto-generate TypeScript for Mina- and crypto-related types and constants.
16+
- `/scripts` - scripts that build parts of o1js from their OCaml and Rust sources, including the contents of `/compiled` and other generated TS files.
1717
- `MINA_COMMIT` - commit hash pointing to the commit of the [Mina repo](https://github.com/MinaProtocol/mina) that build artifacts in this repo where generated from.
1818

19-
## Building the SnarkyJS bindings
19+
## Building the o1js bindings
2020

21-
To instrument the scripts and build the SnarkyJS bindings from source, you need to work from the [Mina monorepo](https://github.com/MinaProtocol/mina).
21+
To instrument the scripts and build the o1js bindings from source, you need to work from the [Mina monorepo](https://github.com/MinaProtocol/mina).
2222

23-
Inside the Mina repo, you'll find the [SnarkyJS repo](https://github.com/o1-labs/snarkyjs) as a git submodule under `src/lib/snarkyjs`. Inside `snarkyjs`, the `snarkyjs-bindings` repo is located at `src/bindings`. To make sure you have all nested submodules checked out, run (from the Mina root):
23+
Inside the Mina repo, you'll find the [o1js repo](https://github.com/o1-labs/o1js) as a git submodule under `src/lib/snarkyjs`. Inside `o1js`, the `o1js-bindings` repo is located at `src/bindings`. To make sure you have all nested submodules checked out, run (from the Mina root):
2424

2525
```sh
2626
git submodule update --init --recursive
2727
```
2828

29-
Then, switch to the SnarkyJS root in `src/lib/snarkyjs`. There are two different commands available, `npm run make` and `npm run bindings`, which you need for different purposes:
29+
Then, switch to the o1js root in `src/lib/snarkyjs`.
30+
31+
You use these two commands for different purposes:
3032

3133
```
3234
npm run make
3335
```
3436

35-
This command will
37+
This command:
3638

37-
- regenerate TS files in the snarkyjs-bindings source tree
38-
- build the JS/Wasm artifacts for Node.js (also contained in `/compiled/node-bindings`), but only move them to their place in the `snarkyjs/dist/node` folder which is not part of the source tree.
39+
- Regenerates TS files in the o1js-bindings source tree
40+
- Builds the JS/Wasm artifacts for Node.js (also contained in `/compiled/node-bindings`), but only moves them to their place in the `o1js/dist/node` folder, which is not part of the source tree.
3941

40-
> ℹ️ Use `npm run make` if you are developing on or testing the OCaml/Rust layers of SnarkyJS, and want to rebuild.
42+
> ℹ️ Use `npm run make` if you are developing on or testing the OCaml/Rust layers of o1js, and want to rebuild.
4143
4244
```
4345
npm run bindings
4446
```
4547

46-
This command will
48+
This command:
4749

48-
- do everything `npm run make` does, plus
49-
- build the web version of the SnarkyJS bindings, plus
50-
- place the generated artifacts in the source tree, under `/compiled`
51-
- update the `MINA_COMMIT` file
50+
- Does everything `npm run make` does, plus
51+
- Builds the web version of the o1js bindings, plus
52+
- Places the generated artifacts in the source tree under `/compiled`
53+
- Updates the `MINA_COMMIT` file
5254

53-
> ℹ️ Use `npm run bindings` to update the source tree after you have finished a batch of work / a PR which touches the OCaml/Rust layers. SnarkyJS CI depends on these artifacts, so this is a required step before merging such changes.
55+
> ℹ️ Use `npm run bindings` to update the source tree after you have finished a batch of work / a PR that touches the OCaml/Rust layers. o1js CI depends on these artifacts, so running this command is a required step before you can merge the changes.

0 commit comments

Comments
 (0)