Skip to content

Commit 01a307f

Browse files
merge main and rebuild bindings
2 parents 0681caa + 17adf4b commit 01a307f

26 files changed

+738
-288
lines changed

.github/workflows/build-action.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -311,6 +311,11 @@ jobs:
311311
env:
312312
INPUT_TOKEN: ${{ secrets.NPM_TOKEN }}
313313

314+
- name: Configure Git
315+
run: |
316+
git config --local user.email "[email protected]"
317+
git config --local user.name "GitHub Action"
318+
314319
- name: Tag new version
315320
if: ${{ steps.publish.outputs.type }} # https://github.com/JS-DevTools/npm-publish?tab=readme-ov-file#action-output
316321
env:

.github/workflows/build-bindings.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ jobs:
3030
nix run o1js#update-bindings --max-jobs 4
3131
#fail if this changes any files
3232
cd src/bindings
33+
echo If this check fails you can download a patch from the patch-upload job
34+
echo "https://github.com/o1-labs/o1js/blob/main/README-dev.md#bindings-check-in-ci"
3335
git diff --exit-code
3436
- name: add build to gc-root if on main
3537
if: github.ref == 'refs/heads/main'
@@ -39,3 +41,18 @@ jobs:
3941
run: |
4042
nix-store --gc --print-dead
4143
nix-store --optimise
44+
patch-upload:
45+
needs: nix-build
46+
if: ${{ failure() }}
47+
runs-on: [sdk-self-hosted-linux-amd64-build-system]
48+
steps:
49+
- name: generate patch
50+
run: |
51+
cd src/bindings
52+
git add .
53+
git diff HEAD > ../../bindings.patch
54+
- name: Upload patch
55+
uses: actions/upload-artifact@v4
56+
with:
57+
name: bindings.patch
58+
path: bindings.patch

CHANGELOG.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,19 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
2222
### Added
2323

2424
- `ZkProgram` to support non-pure provable types as inputs and outputs https://github.com/o1-labs/o1js/pull/1828
25+
- API for recursively proving a ZkProgram method from within another https://github.com/o1-labs/o1js/pull/1931
26+
- `let recursive = Experimental.Recursive(program);`
27+
- `recursive.<methodName>(...args): Promise<PublicOutput>`
28+
- This also works within the same program, as long as the return value is type-annotated
2529
- Add `enforceTransactionLimits` parameter on Network https://github.com/o1-labs/o1js/issues/1910
2630
- Method for optional types to assert none https://github.com/o1-labs/o1js/pull/1922
2731
- Increased maximum supported amount of methods in a `SmartContract` or `ZkProgram` to 30. https://github.com/o1-labs/o1js/pull/1918
2832
- Expose low-level conversion methods `Proof.{_proofToBase64,_proofFromBase64}` https://github.com/o1-labs/o1js/pull/1928
33+
- Expore `maxProofsVerified()` and a `Proof` class directly on ZkPrograms https://github.com/o1-labs/o1js/pull/1933
34+
35+
### Changed
36+
37+
- Changed an internal type to improve IntelliSense on ZkProgram methods https://github.com/o1-labs/o1js/pull/1933
2938

3039
### Fixed
3140

@@ -35,6 +44,8 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
3544

3645
## [2.1.0](https://github.com/o1-labs/o1js/compare/b04520d...e1bac02) - 2024-11-13
3746

47+
### Added
48+
3849
- Support secp256r1 in elliptic curve and ECDSA gadgets https://github.com/o1-labs/o1js/pull/1885
3950

4051
### Fixed

README-dev.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,20 @@ In addition to building the OCaml and Rust code, the build script also generates
8686

8787
o1js uses these types to ensure that the constants used in the protocol are consistent with the OCaml source files.
8888

89+
### Bindings check in ci
90+
91+
If the bindings check fails in CI it will upload a patch you can use to update the bindings without having to rebuild locally.
92+
This can also be helpful when the bindings don't build identically, as unfortunately often happens.
93+
94+
To use this patch:
95+
- Click details on the `Build o1js bindings / build-bindings-ubunutu` job
96+
- Go to the `patch-upload` job and expand the logs for `Upload patch`
97+
- Download the file linked in the last line of the logs ie.
98+
`Artifact download URL: https://github.com/o1-labs/o1js/actions/runs/12401083741/artifacts/2339952965`
99+
- unzip it
100+
- navigate to `src/bindings`
101+
- run `git apply path/to/bindings.patch`
102+
89103
## Development
90104

91105
### Branching Policy

run-ci-tests.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ case $TEST_TYPE in
99
./run src/examples/zkapps/reducer/reducer-composite.ts --bundle
1010
./run src/examples/zkapps/composability.ts --bundle
1111
./run src/tests/fake-proof.ts
12+
./run src/tests/inductive-proofs-internal.ts --bundle
1213
./run tests/vk-regression/diverse-zk-program-run.ts --bundle
1314
;;
1415

run-minimal-mina-tests.sh

Lines changed: 0 additions & 6 deletions
This file was deleted.

src/examples/zkprogram/mututal-recursion.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,15 +47,13 @@ const add = ZkProgram({
4747
},
4848
});
4949

50-
const AddProof = ZkProgram.Proof(add);
51-
5250
const multiply = ZkProgram({
5351
name: 'multiply',
5452
publicInput: Undefined,
5553
publicOutput: Field,
5654
methods: {
5755
performMultiplication: {
58-
privateInputs: [Field, AddProof],
56+
privateInputs: [Field, add.Proof],
5957
async method(field: Field, addProof: Proof<Undefined, Field>) {
6058
addProof.verify();
6159
const multiplicationResult = addProof.publicOutput.mul(field);

src/examples/zkprogram/program-with-input.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,6 @@ MyProgram.publicOutputType satisfies Provable<void>;
3535
MyProgram.privateInputTypes;
3636
MyProgram.auxiliaryOutputTypes;
3737

38-
let MyProof = ZkProgram.Proof(MyProgram);
39-
4038
console.log('program digest', await MyProgram.digest());
4139

4240
console.log('compiling MyProgram...');
@@ -45,7 +43,7 @@ console.log('verification key', verificationKey.data.slice(0, 10) + '..');
4543

4644
console.log('proving base case...');
4745
let { proof } = await MyProgram.baseCase(Field(0));
48-
proof = await testJsonRoundtrip(MyProof, proof);
46+
proof = await testJsonRoundtrip(MyProgram.Proof, proof);
4947

5048
// type sanity check
5149
proof satisfies Proof<Field, void>;
@@ -60,7 +58,7 @@ console.log('ok (alternative)?', ok);
6058

6159
console.log('proving step 1...');
6260
let { proof: proof1 } = await MyProgram.inductiveCase(Field(1), proof);
63-
proof1 = await testJsonRoundtrip(MyProof, proof1);
61+
proof1 = await testJsonRoundtrip(MyProgram.Proof, proof1);
6462

6563
console.log('verify...');
6664
ok = await verify(proof1, verificationKey);
@@ -72,7 +70,7 @@ console.log('ok (alternative)?', ok);
7270

7371
console.log('proving step 2...');
7472
let { proof: proof2 } = await MyProgram.inductiveCase(Field(2), proof1);
75-
proof2 = await testJsonRoundtrip(MyProof, proof2);
73+
proof2 = await testJsonRoundtrip(MyProgram.Proof, proof2);
7674

7775
console.log('verify...');
7876
ok = await verify(proof2.toJSON(), verificationKey);

src/index.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,7 @@ import * as OffchainState_ from './lib/mina/actions/offchain-state.js';
148148
import * as BatchReducer_ from './lib/mina/actions/batch-reducer.js';
149149
import { Actionable } from './lib/mina/actions/offchain-state-serialization.js';
150150
import { InferProvable } from './lib/provable/types/struct.js';
151+
import { Recursive as Recursive_ } from './lib/proof-system/recursive.js';
151152
export { Experimental };
152153

153154
const Experimental_ = {
@@ -162,6 +163,8 @@ const Experimental_ = {
162163
namespace Experimental {
163164
export let memoizeWitness = Experimental_.memoizeWitness;
164165

166+
export let Recursive = Recursive_;
167+
165168
// indexed merkle map
166169
export let IndexedMerkleMap = Experimental_.IndexedMerkleMap;
167170
export type IndexedMerkleMap = IndexedMerkleMapBase;

0 commit comments

Comments
 (0)