Skip to content

Commit 767a334

Browse files
committed
Merge branch 'main' into release/v2.6.1
2 parents d2eb6b1 + a44b7cc commit 767a334

File tree

14 files changed

+164
-20
lines changed

14 files changed

+164
-20
lines changed

CHANGELOG.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
2121

2222
### Added
2323

24+
- Lazy mode for prover index computation. https://github.com/o1-labs/o1js/pull/2143
25+
- Added reverse functionality to `DynamicArray` and indexed `forEach` and `forEachReverse` variants.
2426
- Added `ZkProgram.analyzeSingleMethod(methodName: string)` to analyze a single method of a ZkProgram. https://github.com/o1-labs/o1js/pull/2217
2527
- This is an addition to `ZkProgram.analyzeMethods()` which analyzes all methods of a ZkProgram by executing them.
2628
- Now only a single method is analyzed at a time.
@@ -30,8 +32,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
3032
### Added
3133

3234
- API support for circuit chunking. https://github.com/o1-labs/o1js/pull/1905
33-
- still requires memory optimizations to be fully functional, and
34-
- proof-systems version still needs to be updated to include [this commit](https://github.com/o1-labs/proof-systems/pull/3222/commits/8c37c293f8159eed3676964ba47fc5dc0ae6ea1e)
35+
- work in progress, still requires memory optimizations to be fully functional
3536
- Dynamic array provable type. https://github.com/o1-labs/o1js/pull/1848
3637

3738
## [2.5.0](https://github.com/o1-labs/o1js/compare/6ff7f8470a...4e23a60)

flake.nix

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,12 @@
1616
nixConfig = {
1717
auto-optimize-store = true;
1818
max-jobs = "auto";
19-
#coppied from flake.nix in mina
19+
# taken from flake.nix in mina
2020
allow-import-from-derivation = "true";
21-
substituters =
21+
extra-substituters =
2222
[ "https://storage.googleapis.com/mina-nix-cache"
2323
];
24-
trusted-public-keys =
24+
extra-trusted-public-keys =
2525
[ "mina-nix-cache-1:djtioLfv2oxuK2lqPUgmZbf8bY8sK/BnYZCU2iU5Q10="
2626
"nix-cache.minaprotocol.org:fdcuDzmnM0Kbf7yU4yywBuUEJWClySc1WIF6t6Mm8h4="
2727
"nix-cache.minaprotocol.org:D3B1W+V7ND1Fmfii8EhbAbF1JXoe2Ct4N34OKChwk2c="

src/bindings.d.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -385,7 +385,7 @@ declare const Snarky: {
385385
/**
386386
* Generates a proving key and a verification key for the provable function `main`
387387
*/
388-
compile(main: Snarky.Main, publicInputSize: number): Snarky.Keypair;
388+
compile(main: Snarky.Main, publicInputSize: number, lazyMode: boolean): Snarky.Keypair;
389389

390390
/**
391391
* Proves a statement using the private input, public input and the keypair of the circuit.
@@ -703,6 +703,7 @@ declare const Pickles: {
703703
storable?: Pickles.Cache;
704704
overrideWrapDomain?: 0 | 1 | 2;
705705
numChunks?: number;
706+
lazyMode?: boolean;
706707
}
707708
) => {
708709
provers: MlArray<Pickles.Prover>;

src/bindings/js/web/worker-spec.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ function workerSpec(wasm) {
2222
undefined /* number */,
2323
// srs
2424
wasm.WasmFpSrs,
25+
// lazy_mode
26+
undefined /* boolean */,
2527
],
2628
res: wasm.WasmPastaFpPlonkIndex,
2729
},
@@ -39,6 +41,8 @@ function workerSpec(wasm) {
3941
undefined /* number */,
4042
// srs
4143
wasm.WasmFqSrs,
44+
// lazy_mode
45+
undefined /* boolean */,
4246
],
4347
res: wasm.WasmPastaFqPlonkIndex,
4448
},

src/bindings/ocaml/lib/pickles_bindings.ml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -618,7 +618,8 @@ let pickles_compile (choices : pickles_rule_js array)
618618
; publicOutputSize : int Js.prop
619619
; storable : Cache.js_storable Js.optdef_prop
620620
; overrideWrapDomain : int Js.optdef_prop
621-
; numChunks : int Js.optdef_prop >
621+
; numChunks : int Js.optdef_prop
622+
; lazyMode : bool Js.optdef_prop >
622623
Js.t ) =
623624
(* translate number of branches and recursively verified proofs from JS *)
624625
let branches = Array.length choices in
@@ -640,6 +641,7 @@ let pickles_compile (choices : pickles_rule_js array)
640641
let num_chunks =
641642
Js.Optdef.get config##.numChunks (fun () -> 1)
642643
in
644+
let lazy_mode = Js.Optdef.get config##.lazyMode (fun () -> false) in
643645
let (Choices choices) =
644646
Choices.of_js ~public_input_size ~public_output_size choices
645647
in
@@ -662,7 +664,7 @@ let pickles_compile (choices : pickles_rule_js array)
662664
, public_input_typ public_output_size ) )
663665
~auxiliary_typ:Typ.unit
664666
~max_proofs_verified:(module Max_proofs_verified)
665-
~name ~num_chunks ~choices ()
667+
~name ~num_chunks ~lazy_mode ~choices ()
666668
in
667669

668670
(* translate returned prover and verify functions to JS *)

src/bindings/ocaml/lib/pickles_bindings.mli

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,8 @@ val pickles :
6666
; publicOutputSize : int Js.prop
6767
; storable : Cache.js_storable Js.optdef_prop
6868
; overrideWrapDomain : int Js.optdef_prop
69-
; numChunks : int Js.optdef_prop >
69+
; numChunks : int Js.optdef_prop
70+
; lazyMode : bool Js.optdef_prop >
7071
Js.t
7172
-> < getVerificationKey :
7273
( unit

src/bindings/ocaml/lib/snarky_bindings.ml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -384,11 +384,11 @@ module Circuit = struct
384384
main'
385385
end
386386

387-
let compile main public_input_size =
387+
let compile main public_input_size lazy_mode =
388388
let input_typ = typ public_input_size in
389389
let return_typ = Impl.Typ.unit in
390390
let cs = Impl.constraint_system ~input_typ ~return_typ (Main.of_js main) in
391-
Impl.Keypair.generate ~prev_challenges:0 cs
391+
Impl.Keypair.generate ~lazy_mode ~prev_challenges:0 cs
392392

393393
let prove main public_input_size public_input keypair =
394394
let pk = Impl.Keypair.pk keypair in

src/bindings/ocaml/lib/snarky_bindings.mli

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,8 @@ val snarky :
249249
Js.t
250250
Js.readonly_prop
251251
; circuit :
252-
< compile : ((Field.t array -> unit) -> int -> Impl.Keypair.t) Js.meth
252+
< compile :
253+
((Field.t array -> unit) -> int -> bool -> Impl.Keypair.t) Js.meth
253254
; keypair :
254255
< getConstraintSystemJSON : (Impl.Keypair.t -> 'a) Js.meth
255256
; getVerificationKey :

src/bindings/scripts/download-bindings.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ set -e
77
REV=${REV:=$(git rev-parse HEAD)}
88
RUN_ID=$( \
99
gh run list --commit "${REV}" --json name,databaseId | \
10-
jq -r '.[] | select(.name == "Checks" or .name == "Build and upload bindings") | .databaseId' \
10+
jq -r '.[] | select(.name == "Checks" or .name == "Build and upload bindings") | .databaseId' | \
11+
head -1 \
1112
)
1213

1314
if [ -z "$RUN_ID" ]

src/lib/proof-system/circuit.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,13 @@ class Circuit {
2222
* const keypair = await MyCircuit.generateKeypair();
2323
* ```
2424
*/
25-
static async generateKeypair() {
25+
static async generateKeypair(lazyMode: boolean = false) {
2626
let main = mainFromCircuitData(this._main);
2727
let publicInputSize = this._main.publicInputType.sizeInFields();
2828
await initializeBindings();
2929
return prettifyStacktracePromise(
3030
withThreadPool(async () => {
31-
let keypair = Snarky.circuit.compile(main, publicInputSize);
31+
let keypair = Snarky.circuit.compile(main, publicInputSize, lazyMode);
3232
return new Keypair(keypair);
3333
})
3434
);

0 commit comments

Comments
 (0)