From b841f774b1de6f519fdc89b1b53b9377f5c631b5 Mon Sep 17 00:00:00 2001 From: Geometer1729 <16kuhnb@gmail.com> Date: Tue, 19 Aug 2025 16:29:42 -0400 Subject: [PATCH 01/16] try to update mina --- bisect-mina-by-prs.sh | 99 ++++++++++++++++++++++ flake.lock | 54 +++++------- flake.nix | 72 ++++++++++++++-- src/bindings/ocaml/lib/consistency_test.ml | 5 +- src/bindings/ocaml/lib/local_ledger.ml | 4 +- src/mina | 2 +- 6 files changed, 190 insertions(+), 46 deletions(-) create mode 100755 bisect-mina-by-prs.sh diff --git a/bisect-mina-by-prs.sh b/bisect-mina-by-prs.sh new file mode 100755 index 0000000000..b3ae3a6453 --- /dev/null +++ b/bisect-mina-by-prs.sh @@ -0,0 +1,99 @@ +#!/usr/bin/env bash + +set -e + +advance_prs(){ + count=${1:-1} + + # Navigate to mina submodule + pushd src/mina + + # Get current commit + current_commit=$(git rev-parse HEAD) + + # Get all merge commits that contain "Merge pull request" in chronological order + commit=$(git log --oneline --grep="Merge pull request" compatible --reverse \ + | sed '1,/'"$(git rev-parse --short HEAD)"'/d' \ + | sed -n "$count"'{p;q}' \ + | cut -d' ' -f1 + ) + + # Get the commit message for informative output + commit_msg=$(git log --oneline -1 $commit) + + echo "Updating mina submodule to next PR: $commit_msg" + + # Checkout the next merge commit + git checkout $commit + git reset --hard --recurse-submodules + + # Go back to parent repo and update submodule reference + popd +} + +rebuild(){ + nom build . + #git clean -fdx && \ + #nix run .\#generate-bindings --refresh && \ + #nix develop --refresh --command npm ci && \ + #nix develop --refresh --command npm run build +} + +run_test(){ + # Replace with any test that fails + #nix develop --command timeout 300s ./run ./src/examples/zkprogram/program.ts --bundle + nix flake check --refresh +} + + +reset_mina(){ + prev=$(git rev-parse HEAD) + sub_sha=$(git ls-tree $prev src/mina | awk '{print $3}') + git -C src/mina checkout $sub_sha + git -C src/mina reset --hard --recurse-submodules + +} + +check_num_prs(){ + reset_mina + #echo "SANITY CHECK" + #rebuild && run_test + #echo "END SANITY CHECK" + advance_prs "$1" + rebuild && run_test +} + +reset_mina +num_prs=$( \ + git -C src/mina log --oneline --grep="Merge pull request" compatible --reverse \ + | sed '1,/'"$(git -C src/mina rev-parse --short HEAD)"'/d' \ + | wc -l) + +echo $num_prs + +low=0 +high=$num_prs + +while (( low < high -1 )); do + mid=$(( (low + high + 1) / 2 )) + echo TESTING $mid + if check_num_prs $mid + then + echo "$(git -C src/mina rev-parse HEAD) - Works" >> builds.log + low=$(( mid )) + else + high=$(( mid )) + echo "$(git -C src/mina rev-parse HEAD) - Fails" >> builds.log + fi + echo $low $mid $high +done + +reset_mina +advance_prs $low +works=$(git -C src/mina rev-parse HEAD) +reset_mina +advance_prs $high +breaks=$(git -C src/mina rev-parse HEAD) +echo Works at $works +echo Broken at $breaks +echo Broken by $(git -C src/mina log --oneline -1 $breaks) diff --git a/flake.lock b/flake.lock index 5b8fb86428..43b5abb12e 100644 --- a/flake.lock +++ b/flake.lock @@ -6,15 +6,16 @@ "flake-utils" ], "nixpkgs": [ - "nixpkgs-mina" + "mina", + "nixpkgs" ] }, "locked": { - "lastModified": 1724407960, - "narHash": "sha256-pUKTVMYEtsD1AGlHFTdPourowt+tJ3htKhRu7VALFzc=", + "lastModified": 1742933373, + "narHash": "sha256-sW6ZheQeXe+GULDKLcgRJN4eucP3IXWHz0bHL9KKU1w=", "owner": "o1-labs", "repo": "describe-dune", - "rev": "be828239c05671209e979f9d5c2e3094e3be7a46", + "rev": "ba71baa26329399ca2f1d158f15e7c32bba1d072", "type": "github" }, "original": { @@ -54,7 +55,8 @@ "flake-utils" ], "nixpkgs": [ - "nixpkgs-mina" + "mina", + "nixpkgs" ] }, "locked": { @@ -127,11 +129,11 @@ "systems": "systems" }, "locked": { - "lastModified": 1710146030, - "narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=", + "lastModified": 1731533236, + "narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=", "owner": "numtide", "repo": "flake-utils", - "rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a", + "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b", "type": "github" }, "original": { @@ -369,22 +371,6 @@ "type": "github" } }, - "nixpkgs-mina": { - "locked": { - "lastModified": 1747635552, - "narHash": "sha256-2wAd20JLiHzcqSt7MGza4hN4rdV/c6Ed/13gN7HZJ9U=", - "owner": "nixos", - "repo": "nixpkgs", - "rev": "74b4de8529c4ce6f17b80c97728fddd627097809", - "type": "github" - }, - "original": { - "owner": "nixos", - "ref": "nixos-24.11-small", - "repo": "nixpkgs", - "type": "github" - } - }, "nixpkgs-mozilla": { "flake": false, "locked": { @@ -404,11 +390,11 @@ "nixpkgs-mozilla_2": { "flake": false, "locked": { - "lastModified": 1704373101, - "narHash": "sha256-+gi59LRWRQmwROrmE1E2b3mtocwueCQqZ60CwLG+gbg=", + "lastModified": 1744624473, + "narHash": "sha256-S6zT/w5SyAkJ//dYdjbrXgm+6Vkd/k7qqUl4WgZ6jjk=", "owner": "mozilla", "repo": "nixpkgs-mozilla", - "rev": "9b11a87c0cc54e308fa83aac5b4ee1816d5418a2", + "rev": "2292d4b35aa854e312ad2e95c4bb5c293656f21a", "type": "github" }, "original": { @@ -452,11 +438,11 @@ "o1-opam-repository": { "flake": false, "locked": { - "lastModified": 1715294616, - "narHash": "sha256-W2p9Vs8PqpKGvMByxVqpxAljjpEMqNcuNnjMBAAKicI=", + "lastModified": 1749055102, + "narHash": "sha256-JEeAGWyzlWbUoYwav7mpFY/aYuZ/qay7xirnp+2pWGs=", "owner": "o1-labs", "repo": "opam-repository", - "rev": "38d6995e307c82b3c0b3bc86a867213db724d1c5", + "rev": "677657206d9da47987a4eff8087c1f3a258908f3", "type": "github" }, "original": { @@ -514,16 +500,17 @@ "opam-repository": { "flake": false, "locked": { - "lastModified": 1708601497, - "narHash": "sha256-mDYINTjOiYLN4wT5fGlWTvHFQdWkzY46XUuZWKgmJxY=", + "lastModified": 1750360330, + "narHash": "sha256-sizv8xZ/E/OgsE/ak9Oo+iEuBpzvUs08T0S+yXXzaDs=", "owner": "ocaml", "repo": "opam-repository", - "rev": "90d8c520a4f0b035ac51e267a8b33739c5a78b5a", + "rev": "08d8c16c16dc6b23a5278b06dff0ac6c7a217356", "type": "github" }, "original": { "owner": "ocaml", "repo": "opam-repository", + "rev": "08d8c16c16dc6b23a5278b06dff0ac6c7a217356", "type": "github" } }, @@ -555,7 +542,6 @@ "dune-nix": "dune-nix", "flake-utils": "flake-utils", "mina": "mina", - "nixpkgs-mina": "nixpkgs-mina", "nixpkgs-mozilla": "nixpkgs-mozilla_2" } }, diff --git a/flake.nix b/flake.nix index a08bd158ff..7524da39e9 100644 --- a/flake.nix +++ b/flake.nix @@ -2,16 +2,15 @@ description = "o1js - TypeScript framework for zk-SNARKs and zkApps"; inputs = { self.submodules = true; - nixpkgs-mina.url = "github:nixos/nixpkgs/nixos-24.11-small"; mina.url = ./src/mina; mina.inputs.dune-nix.follows = "dune-nix"; nixpkgs-mozilla.url = "github:mozilla/nixpkgs-mozilla"; nixpkgs-mozilla.flake = false; describe-dune.url = "github:o1-labs/describe-dune"; - describe-dune.inputs.nixpkgs.follows = "nixpkgs-mina"; + describe-dune.inputs.nixpkgs.follows = "mina/nixpkgs"; describe-dune.inputs.flake-utils.follows = "flake-utils"; dune-nix.url = "github:o1-labs/dune-nix?ref=brian/relative-flakes-fix"; - dune-nix.inputs.nixpkgs.follows = "nixpkgs-mina"; + dune-nix.inputs.nixpkgs.follows = "mina/nixpkgs"; dune-nix.inputs.flake-utils.follows = "flake-utils"; flake-utils.url = "github:numtide/flake-utils"; }; @@ -29,13 +28,13 @@ "nix-cache.minaprotocol.org:D3B1W+V7ND1Fmfii8EhbAbF1JXoe2Ct4N34OKChwk2c=" ]; }; - outputs = { self, nixpkgs-mina, flake-utils, ... }@inputs: + outputs = { self, flake-utils, ... }@inputs: flake-utils.lib.eachDefaultSystem (system: let - pkgs = ((nixpkgs-mina.legacyPackages."${system}".extend + pkgs = ((inputs.mina.inputs.nixpkgs.legacyPackages."${system}".extend (import inputs.nixpkgs-mozilla)).extend inputs.mina.overlays.rust).extend - (final: prev: { inherit (nixpkgs-mina.legacyPackages."${system}") + (final: prev: { inherit (inputs.mina.inputs.nixpkgs.legacyPackages."${system}") nodePackages nodejs; }); dune-nix = inputs.dune-nix.lib.${system}; describe-dune = inputs.describe-dune.defaultPackage.${system}; @@ -76,6 +75,8 @@ (builtins.attrNames minaDeps_)); commonOverrides = { DUNE_PROFILE = "dev"; + OCAML_WARN_ERROR = ""; + WARN_ERROR = ""; buildInputs = [ mina.base-libs ] ++ mina.external-libs ++ pkgs.lib.attrVals minaDeps mina.pkgs; }; @@ -141,7 +142,7 @@ o1js-npm-deps = pkgs.buildNpmPackage { - name = "o1js"; + name = "o1js-npm-deps"; src = with pkgs.lib.fileset; (toSource { root = ./.; @@ -240,6 +241,8 @@ EXPORT_TEST_VECTORS = "${test-vectors}/bin/export_test_vectors"; SKIP_MINA_COMMIT = true; JUST_BINDINGS = true; + OCAMLPARAM = "_,w=-67"; + DUNE_BUILD_OPTIONS = "--promote-install-files"; buildInputs = (with pkgs; [ rustupWrapper @@ -272,6 +275,24 @@ popd ''; }; + + o1js = pkgs.buildNpmPackage + { + name = "o1js"; + src = with pkgs.lib.fileset; + (toSource { + root = ./.; + fileset = unions [ + ./. + ]; + }); + npmDepsHash = builtins.readFile ./npmDepsHash; + preBuild = '' + cp -r ${bindings}/* ./src/bindings + ls src/bindings/compiled/ + chmod +w -R src/bindings/compiled + ''; + }; in { formatter = pkgs.nixfmt; @@ -303,6 +324,8 @@ # TODO build from ./ocaml root, not ./. (after fixing a bug in dune-nix) packages = { inherit dune-description bindings; + npm-deps = o1js-npm-deps; + default = o1js; bindings-tar = pkgs.stdenv.mkDerivation { name = "bindings.tar.gz"; src = bindings; @@ -314,7 +337,40 @@ tar czf $out . ''; }; - npm-deps = o1js-npm-deps; + }; + checks = { + default = pkgs.stdenv.mkDerivation { + name = "o1js-checks"; + src = with pkgs.lib.fileset; + (toSource { + root = ./.; + fileset = unions [ + ./. + ]; + }); + nativeBuildInputs = bindings-pkgs ++ [ o1js ]; + patchPhase = '' + patchShebangs ./src/bindings/scripts/ + patchShebangs ./src/bindings/crypto/test-vectors/ + patchShebangs *.sh + ''; + buildPhase = '' + cp -r ${o1js-npm-deps}/lib/node_modules ./ + chmod +w -R ./node_modules + + cp -r ${bindings}/* ./src/bindings/ + chmod +w -R ./src/bindings/compiled + + ln -sf node_bindings ./src/bindings/compiled/_node_bindings + npm run dev + + npm run test + ''; + installPhase = '' + mkdir -p $out + echo "Test finished." > $out/result.txt + ''; + }; }; apps = { update-npm-deps = { diff --git a/src/bindings/ocaml/lib/consistency_test.ml b/src/bindings/ocaml/lib/consistency_test.ml index 03ac425216..fafa14b097 100644 --- a/src/bindings/ocaml/lib/consistency_test.ml +++ b/src/bindings/ocaml/lib/consistency_test.ml @@ -170,7 +170,7 @@ module Hash_from_json = struct (network_id : Js.js_string Js.t) = let signature_kind = get_network_id_of_js_string network_id in let tx = - Zkapp_command.write_all_proofs_to_disk ~proof_cache_db + Zkapp_command.write_all_proofs_to_disk ~signature_kind ~proof_cache_db @@ Zkapp_command.of_json @@ Yojson.Safe.from_string @@ Js.to_string tx_json in @@ -206,8 +206,9 @@ module Hash_from_json = struct let zkapp_public_input (tx_json : Js.js_string Js.t) (account_update_index : int) = + let signature_kind = Mina_signature_kind_type.Testnet in let tx = - Zkapp_command.write_all_proofs_to_disk ~proof_cache_db + Zkapp_command.write_all_proofs_to_disk ~signature_kind ~proof_cache_db @@ Zkapp_command.of_json @@ Yojson.Safe.from_string @@ Js.to_string tx_json in diff --git a/src/bindings/ocaml/lib/local_ledger.ml b/src/bindings/ocaml/lib/local_ledger.ml index 8b1833d3d1..7151f4415c 100644 --- a/src/bindings/ocaml/lib/local_ledger.ml +++ b/src/bindings/ocaml/lib/local_ledger.ml @@ -230,11 +230,13 @@ let proof_cache_db = Proof_cache_tag.create_identity_db () let apply_zkapp_command_transaction l (txn : Zkapp_command.Stable.Latest.t) (account_creation_fee : string) (network_state : Mina_base.Zkapp_precondition.Protocol_state.View.t) = - let txn = Zkapp_command.write_all_proofs_to_disk ~proof_cache_db txn in + let signature_kind = Mina_signature_kind_type.Testnet in + let txn = Zkapp_command.write_all_proofs_to_disk ~signature_kind ~proof_cache_db txn in check_account_update_signatures txn ; let ledger = l##.value in let application_result = Transaction_logic.apply_zkapp_command_unchecked + ~signature_kind ~global_slot:network_state.global_slot_since_genesis ~state_view:network_state ~constraint_constants: diff --git a/src/mina b/src/mina index a645bf8c9c..670e0fc6cf 160000 --- a/src/mina +++ b/src/mina @@ -1 +1 @@ -Subproject commit a645bf8c9c3c477a94415d6c7495016c4724c4e8 +Subproject commit 670e0fc6cfd67d8806c7891ba2cec0013852fa6b From 07dccd98773c6bae0dd7f5f9bf9c49273e1c73d8 Mon Sep 17 00:00:00 2001 From: Geometer1729 <16kuhnb@gmail.com> Date: Tue, 19 Aug 2025 16:51:48 -0400 Subject: [PATCH 02/16] revert mina --- src/mina | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mina b/src/mina index 670e0fc6cf..2f371788d4 160000 --- a/src/mina +++ b/src/mina @@ -1 +1 @@ -Subproject commit 670e0fc6cfd67d8806c7891ba2cec0013852fa6b +Subproject commit 2f371788d467ec257a3201b4ad312c34ed2c2435 From 932db7cd040327fcf1adf2b4419a8ca3ae9f2d4e Mon Sep 17 00:00:00 2001 From: Geometer1729 <16kuhnb@gmail.com> Date: Tue, 19 Aug 2025 20:03:52 -0400 Subject: [PATCH 03/16] safe update --- flake.nix | 2 +- src/bindings/ocaml/lib/local_ledger.ml | 2 +- src/mina | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/flake.nix b/flake.nix index 7524da39e9..4207550d90 100644 --- a/flake.nix +++ b/flake.nix @@ -364,7 +364,7 @@ ln -sf node_bindings ./src/bindings/compiled/_node_bindings npm run dev - npm run test + timeout 600s npm run test ''; installPhase = '' mkdir -p $out diff --git a/src/bindings/ocaml/lib/local_ledger.ml b/src/bindings/ocaml/lib/local_ledger.ml index 7151f4415c..2e2650d643 100644 --- a/src/bindings/ocaml/lib/local_ledger.ml +++ b/src/bindings/ocaml/lib/local_ledger.ml @@ -236,7 +236,7 @@ let apply_zkapp_command_transaction l (txn : Zkapp_command.Stable.Latest.t) let ledger = l##.value in let application_result = Transaction_logic.apply_zkapp_command_unchecked - ~signature_kind + (* ~signature_kind *) ~global_slot:network_state.global_slot_since_genesis ~state_view:network_state ~constraint_constants: diff --git a/src/mina b/src/mina index 2f371788d4..f62af9479f 160000 --- a/src/mina +++ b/src/mina @@ -1 +1 @@ -Subproject commit 2f371788d467ec257a3201b4ad312c34ed2c2435 +Subproject commit f62af9479ff39c4f5f04e8f1d70f64c88c59e803 From ff22fb0cf1386afc160677b757610601d5a19fb4 Mon Sep 17 00:00:00 2001 From: Geometer1729 <16kuhnb@gmail.com> Date: Tue, 19 Aug 2025 20:50:07 -0400 Subject: [PATCH 04/16] full update? --- src/mina | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mina b/src/mina index f62af9479f..670e0fc6cf 160000 --- a/src/mina +++ b/src/mina @@ -1 +1 @@ -Subproject commit f62af9479ff39c4f5f04e8f1d70f64c88c59e803 +Subproject commit 670e0fc6cfd67d8806c7891ba2cec0013852fa6b From b6e5d9d84c448696f6cbe9d16703bf20532420c4 Mon Sep 17 00:00:00 2001 From: Geometer1729 <16kuhnb@gmail.com> Date: Tue, 19 Aug 2025 21:25:15 -0400 Subject: [PATCH 05/16] add back argument --- src/bindings/ocaml/lib/local_ledger.ml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/bindings/ocaml/lib/local_ledger.ml b/src/bindings/ocaml/lib/local_ledger.ml index 2e2650d643..7151f4415c 100644 --- a/src/bindings/ocaml/lib/local_ledger.ml +++ b/src/bindings/ocaml/lib/local_ledger.ml @@ -236,7 +236,7 @@ let apply_zkapp_command_transaction l (txn : Zkapp_command.Stable.Latest.t) let ledger = l##.value in let application_result = Transaction_logic.apply_zkapp_command_unchecked - (* ~signature_kind *) + ~signature_kind ~global_slot:network_state.global_slot_since_genesis ~state_view:network_state ~constraint_constants: From 1857f13cc1ee4f001fbe443e24481d75ca8ded30 Mon Sep 17 00:00:00 2001 From: Geometer1729 <16kuhnb@gmail.com> Date: Wed, 20 Aug 2025 15:08:41 -0400 Subject: [PATCH 06/16] --no-eval-cache, revert --- bisect-mina-by-prs.sh | 4 ++-- src/bindings/ocaml/lib/local_ledger.ml | 2 +- src/mina | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/bisect-mina-by-prs.sh b/bisect-mina-by-prs.sh index b3ae3a6453..7e9eff573c 100755 --- a/bisect-mina-by-prs.sh +++ b/bisect-mina-by-prs.sh @@ -32,7 +32,7 @@ advance_prs(){ } rebuild(){ - nom build . + nom build . --no-eval-cache #git clean -fdx && \ #nix run .\#generate-bindings --refresh && \ #nix develop --refresh --command npm ci && \ @@ -42,7 +42,7 @@ rebuild(){ run_test(){ # Replace with any test that fails #nix develop --command timeout 300s ./run ./src/examples/zkprogram/program.ts --bundle - nix flake check --refresh + nom flake check --no-eval-cache } diff --git a/src/bindings/ocaml/lib/local_ledger.ml b/src/bindings/ocaml/lib/local_ledger.ml index 7151f4415c..2e2650d643 100644 --- a/src/bindings/ocaml/lib/local_ledger.ml +++ b/src/bindings/ocaml/lib/local_ledger.ml @@ -236,7 +236,7 @@ let apply_zkapp_command_transaction l (txn : Zkapp_command.Stable.Latest.t) let ledger = l##.value in let application_result = Transaction_logic.apply_zkapp_command_unchecked - ~signature_kind + (* ~signature_kind *) ~global_slot:network_state.global_slot_since_genesis ~state_view:network_state ~constraint_constants: diff --git a/src/mina b/src/mina index 670e0fc6cf..f62af9479f 160000 --- a/src/mina +++ b/src/mina @@ -1 +1 @@ -Subproject commit 670e0fc6cfd67d8806c7891ba2cec0013852fa6b +Subproject commit f62af9479ff39c4f5f04e8f1d70f64c88c59e803 From bc6fa606979409216f686411ba27c991e2298383 Mon Sep 17 00:00:00 2001 From: Geometer1729 <16kuhnb@gmail.com> Date: Fri, 22 Aug 2025 10:28:16 -0400 Subject: [PATCH 07/16] try to fix some stuff --- .envrc | 2 +- bisect-mina-by-prs.sh | 2 +- flake.nix | 22 +++++++++++++++++++--- src/bindings/ocaml/lib/local_ledger.ml | 2 +- src/mina | 2 +- 5 files changed, 23 insertions(+), 7 deletions(-) diff --git a/.envrc b/.envrc index 3550a30f2d..f662f826e3 100644 --- a/.envrc +++ b/.envrc @@ -1 +1 @@ -use flake +use flake . --no-eval-cache diff --git a/bisect-mina-by-prs.sh b/bisect-mina-by-prs.sh index 7e9eff573c..942fc9bae7 100755 --- a/bisect-mina-by-prs.sh +++ b/bisect-mina-by-prs.sh @@ -42,7 +42,7 @@ rebuild(){ run_test(){ # Replace with any test that fails #nix develop --command timeout 300s ./run ./src/examples/zkprogram/program.ts --bundle - nom flake check --no-eval-cache + nix flake check --no-eval-cache } diff --git a/flake.nix b/flake.nix index 4207550d90..a421398b9a 100644 --- a/flake.nix +++ b/flake.nix @@ -102,12 +102,13 @@ }; }; }; + # TODO this should really auto update from mina rust-channel = ((pkgs.rustChannelOf { channel = "nightly"; - date = "2024-06-13"; - sha256 = "sha256-s5nlYcYG9EuO2HK2BU3PkI928DZBKCTJ4U9bz3RX1t4="; + date = "2024-09-05"; + sha256 = "sha256-3aoA7PuH09g8F+60uTUQhnHrb/ARDLueSOD08ZVsWe0="; }).rust.override { targets = [ @@ -234,6 +235,7 @@ KIMCHI_STUBS KIMCHI_STUBS_STATIC_LIB ; + PREBUILT_KIMCHI_BINDINGS_JS_WEB = "${mina.files.src-lib-crypto-kimchi_bindings-js-web}/src/lib/crypto/kimchi_bindings/js/web"; PREBUILT_KIMCHI_BINDINGS_JS_NODE_JS = @@ -261,6 +263,10 @@ rustup toolchain link nix ${rust-channel'} cp -r ${o1js-npm-deps}/lib/node_modules/ . + # Set WASM-specific build flags for consistent panic handling and threading + export RUSTFLAGS="--cfg=web_sys_unstable_apis" + export CARGO_TARGET_WASM32_UNKNOWN_UNKNOWN_RUSTFLAGS="-C target-feature=+atomics,+bulk-memory,+mutable-globals -C link-arg=--max-memory=4294967296 -C panic=abort -C opt-level=3 -C debug-assertions=off" + mkdir -p src/bindings/compiled/node_bindings echo '// this file exists to prevent TS from type-checking `o1js_node.bc.cjs`' \ > src/bindings/compiled/node_bindings/o1js_node.bc.d.cts @@ -308,11 +314,20 @@ else { packages = [ rustupWrapper mina.base-libs ] ++ bindings-pkgs; + OCAMLPARAM = "_,w=-67"; + DUNE_BUILD_OPTIONS = "--promote-install-files"; + LD_LIBRARY_PATH = "${pkgs.bzip2.out}/lib:$LD_LIBRARY_PATH"; + + + shellHook = '' RUSTUP_HOME=$(pwd)/.rustup export RUSTUP_HOME # fixes linking issue with wasm-pack export LD_LIBRARY_PATH="${pkgs.bzip2.out}/lib:$LD_LIBRARY_PATH" + # Set WASM-specific build flags for consistent panic handling and threading + export RUSTFLAGS="--cfg=web_sys_unstable_apis" + export CARGO_TARGET_WASM32_UNKNOWN_UNKNOWN_RUSTFLAGS="-C target-feature=+atomics,+bulk-memory,+mutable-globals -C link-arg=--max-memory=4294967296 -C panic=abort -C opt-level=3 -C debug-assertions=off" # TODO ideally we shouldn't install toolchains like this in a devshell rustup toolchain install nightly-x86_64-unknown-linux-gnu rustup toolchain link nix ${rust-channel'} @@ -364,7 +379,8 @@ ln -sf node_bindings ./src/bindings/compiled/_node_bindings npm run dev - timeout 600s npm run test + #timeout 600s npm run test + timeout 30s ./run ./src/examples/zkprogram/program.ts --bundle ''; installPhase = '' mkdir -p $out diff --git a/src/bindings/ocaml/lib/local_ledger.ml b/src/bindings/ocaml/lib/local_ledger.ml index 2e2650d643..7151f4415c 100644 --- a/src/bindings/ocaml/lib/local_ledger.ml +++ b/src/bindings/ocaml/lib/local_ledger.ml @@ -236,7 +236,7 @@ let apply_zkapp_command_transaction l (txn : Zkapp_command.Stable.Latest.t) let ledger = l##.value in let application_result = Transaction_logic.apply_zkapp_command_unchecked - (* ~signature_kind *) + ~signature_kind ~global_slot:network_state.global_slot_since_genesis ~state_view:network_state ~constraint_constants: diff --git a/src/mina b/src/mina index f62af9479f..305e301a0b 160000 --- a/src/mina +++ b/src/mina @@ -1 +1 @@ -Subproject commit f62af9479ff39c4f5f04e8f1d70f64c88c59e803 +Subproject commit 305e301a0bca8cc8b94aa2c2eaca7f6b7fb16447 From b4bf0aa2a20f76772fddd99947c12ad8375e6d14 Mon Sep 17 00:00:00 2001 From: Geometer1729 <16kuhnb@gmail.com> Date: Mon, 25 Aug 2025 10:44:53 -0400 Subject: [PATCH 08/16] use node 22 it just works --- flake.nix | 46 ++-------------------------------------------- 1 file changed, 2 insertions(+), 44 deletions(-) diff --git a/flake.nix b/flake.nix index a997de113b..4318182561 100644 --- a/flake.nix +++ b/flake.nix @@ -130,7 +130,7 @@ }; bindings-pkgs = with pkgs; [ - nodejs + nodejs_22 # Use newer Node.js with better WASM support nodePackages.npm nodePackages.prettier typescript @@ -263,10 +263,6 @@ rustup toolchain link nix ${rust-channel'} cp -r ${o1js-npm-deps}/lib/node_modules/ . - # Set WASM-specific build flags for consistent panic handling and threading - export RUSTFLAGS="--cfg=web_sys_unstable_apis" - export CARGO_TARGET_WASM32_UNKNOWN_UNKNOWN_RUSTFLAGS="-C target-feature=+atomics,+bulk-memory,+mutable-globals -C link-arg=--max-memory=4294967296 -C panic=abort -C opt-level=3 -C debug-assertions=off" - mkdir -p src/bindings/compiled/node_bindings echo '// this file exists to prevent TS from type-checking `o1js_node.bc.cjs`' \ > src/bindings/compiled/node_bindings/o1js_node.bc.d.cts @@ -318,15 +314,12 @@ DUNE_BUILD_OPTIONS = "--promote-install-files"; LD_LIBRARY_PATH = "${pkgs.bzip2.out}/lib:$LD_LIBRARY_PATH"; - - shellHook = '' RUSTUP_HOME=$(pwd)/.rustup export RUSTUP_HOME # fixes linking issue with wasm-pack export LD_LIBRARY_PATH="${pkgs.bzip2.out}/lib:$LD_LIBRARY_PATH" - # Set WASM-specific build flags for consistent panic handling and threading - export RUSTFLAGS="--cfg=web_sys_unstable_apis" + export CARGO_TARGET_WASM32_UNKNOWN_UNKNOWN_RUSTFLAGS="-C target-feature=+atomics,+bulk-memory,+mutable-globals -C link-arg=--max-memory=4294967296 -C panic=abort -C opt-level=3 -C debug-assertions=off" # TODO ideally we shouldn't install toolchains like this in a devshell rustup toolchain install nightly-x86_64-unknown-linux-gnu @@ -353,41 +346,6 @@ ''; }; }; - checks = { - default = pkgs.stdenv.mkDerivation { - name = "o1js-checks"; - src = with pkgs.lib.fileset; - (toSource { - root = ./.; - fileset = unions [ - ./. - ]; - }); - nativeBuildInputs = bindings-pkgs ++ [ o1js ]; - patchPhase = '' - patchShebangs ./src/bindings/scripts/ - patchShebangs ./src/bindings/crypto/test-vectors/ - patchShebangs *.sh - ''; - buildPhase = '' - cp -r ${o1js-npm-deps}/lib/node_modules ./ - chmod +w -R ./node_modules - - cp -r ${bindings}/* ./src/bindings/ - chmod +w -R ./src/bindings/compiled - - ln -sf node_bindings ./src/bindings/compiled/_node_bindings - npm run dev - - #timeout 600s npm run test - timeout 30s ./run ./src/examples/zkprogram/program.ts --bundle - ''; - installPhase = '' - mkdir -p $out - echo "Test finished." > $out/result.txt - ''; - }; - }; apps = { update-npm-deps = { type = "app"; From 725ffd19659c6835b777663c632d746080450103 Mon Sep 17 00:00:00 2001 From: Geometer1729 <16kuhnb@gmail.com> Date: Mon, 25 Aug 2025 11:51:28 -0400 Subject: [PATCH 09/16] remove export that wasn't needed --- flake.nix | 2 -- 1 file changed, 2 deletions(-) diff --git a/flake.nix b/flake.nix index 4318182561..cdfbe2d724 100644 --- a/flake.nix +++ b/flake.nix @@ -319,8 +319,6 @@ export RUSTUP_HOME # fixes linking issue with wasm-pack export LD_LIBRARY_PATH="${pkgs.bzip2.out}/lib:$LD_LIBRARY_PATH" - - export CARGO_TARGET_WASM32_UNKNOWN_UNKNOWN_RUSTFLAGS="-C target-feature=+atomics,+bulk-memory,+mutable-globals -C link-arg=--max-memory=4294967296 -C panic=abort -C opt-level=3 -C debug-assertions=off" # TODO ideally we shouldn't install toolchains like this in a devshell rustup toolchain install nightly-x86_64-unknown-linux-gnu rustup toolchain link nix ${rust-channel'} From 219f4dbc9f236bebf64ac5a5f7cbcecacf9f6aa9 Mon Sep 17 00:00:00 2001 From: Geometer1729 <16kuhnb@gmail.com> Date: Mon, 25 Aug 2025 11:53:13 -0400 Subject: [PATCH 10/16] remove unneeded format change --- src/bindings/ocaml/lib/local_ledger.ml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/bindings/ocaml/lib/local_ledger.ml b/src/bindings/ocaml/lib/local_ledger.ml index 7151f4415c..650fbcf79c 100644 --- a/src/bindings/ocaml/lib/local_ledger.ml +++ b/src/bindings/ocaml/lib/local_ledger.ml @@ -231,7 +231,9 @@ let apply_zkapp_command_transaction l (txn : Zkapp_command.Stable.Latest.t) (account_creation_fee : string) (network_state : Mina_base.Zkapp_precondition.Protocol_state.View.t) = let signature_kind = Mina_signature_kind_type.Testnet in - let txn = Zkapp_command.write_all_proofs_to_disk ~signature_kind ~proof_cache_db txn in + let txn = + Zkapp_command.write_all_proofs_to_disk ~signature_kind ~proof_cache_db txn + in check_account_update_signatures txn ; let ledger = l##.value in let application_result = From d0e3b4e9755e499ef216c83389bf301786319146 Mon Sep 17 00:00:00 2001 From: Geometer1729 <16kuhnb@gmail.com> Date: Mon, 25 Aug 2025 12:13:02 -0400 Subject: [PATCH 11/16] clean up overlays remove nolonger needed one --- flake.nix | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/flake.nix b/flake.nix index cdfbe2d724..fdca8db425 100644 --- a/flake.nix +++ b/flake.nix @@ -31,11 +31,13 @@ outputs = { self, flake-utils, ... }@inputs: flake-utils.lib.eachDefaultSystem (system: let - pkgs = ((inputs.mina.inputs.nixpkgs.legacyPackages."${system}".extend - (import inputs.nixpkgs-mozilla)).extend - inputs.mina.overlays.rust).extend - (final: prev: { inherit (inputs.mina.inputs.nixpkgs.legacyPackages."${system}") - nodePackages nodejs; }); + pkgs = import inputs.mina.inputs.nixpkgs { + inherit system; + overlays = [ + (import inputs.nixpkgs-mozilla) + inputs.mina.overlays.rust + ]; + }; dune-nix = inputs.dune-nix.lib.${system}; describe-dune = inputs.describe-dune.defaultPackage.${system}; dune-description = pkgs.stdenv.mkDerivation { From 630287d5f8c5e32e2ea56dd77d5b89ca11a4c4cb Mon Sep 17 00:00:00 2001 From: Geometer1729 <16kuhnb@gmail.com> Date: Mon, 25 Aug 2025 12:20:30 -0400 Subject: [PATCH 12/16] clean up script --- bisect-mina-by-prs.sh | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-) diff --git a/bisect-mina-by-prs.sh b/bisect-mina-by-prs.sh index 942fc9bae7..ef46e09541 100755 --- a/bisect-mina-by-prs.sh +++ b/bisect-mina-by-prs.sh @@ -32,17 +32,16 @@ advance_prs(){ } rebuild(){ - nom build . --no-eval-cache - #git clean -fdx && \ - #nix run .\#generate-bindings --refresh && \ - #nix develop --refresh --command npm ci && \ - #nix develop --refresh --command npm run build + git clean -fdx && \ + nix run .\#generate-bindings --refresh --no-eval-cache && \ + nix develop --refresh --no-eval-cache --command npm ci && \ + nix develop --command npm run build } run_test(){ + nix develop --refresh --no-eval-cache --command \ + npm run test # Replace with any test that fails - #nix develop --command timeout 300s ./run ./src/examples/zkprogram/program.ts --bundle - nix flake check --no-eval-cache } @@ -56,9 +55,6 @@ reset_mina(){ check_num_prs(){ reset_mina - #echo "SANITY CHECK" - #rebuild && run_test - #echo "END SANITY CHECK" advance_prs "$1" rebuild && run_test } @@ -76,16 +72,15 @@ high=$num_prs while (( low < high -1 )); do mid=$(( (low + high + 1) / 2 )) - echo TESTING $mid + echo Fails $high Passes $low TESTING $mid if check_num_prs $mid then - echo "$(git -C src/mina rev-parse HEAD) - Works" >> builds.log + echo "$(git -C src/mina rev-parse HEAD) - Works" >> /tmp/o1js-builds.log low=$(( mid )) else high=$(( mid )) - echo "$(git -C src/mina rev-parse HEAD) - Fails" >> builds.log + echo "$(git -C src/mina rev-parse HEAD) - Fails" >> /tmp/o1js-builds.log fi - echo $low $mid $high done reset_mina From 0bd865908481013648e701299a2fdad21c413d1c Mon Sep 17 00:00:00 2001 From: Geometer1729 <16kuhnb@gmail.com> Date: Mon, 25 Aug 2025 12:26:07 -0400 Subject: [PATCH 13/16] update mina again --- src/mina | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mina b/src/mina index 305e301a0b..8b24db9bfb 160000 --- a/src/mina +++ b/src/mina @@ -1 +1 @@ -Subproject commit 305e301a0bca8cc8b94aa2c2eaca7f6b7fb16447 +Subproject commit 8b24db9bfbd5af19f6104bfc44ea1760954dbad8 From 36a65aa23a8929621e0b50d79fbfc0057db3a82b Mon Sep 17 00:00:00 2001 From: Geometer1729 <16kuhnb@gmail.com> Date: Mon, 25 Aug 2025 13:05:17 -0400 Subject: [PATCH 14/16] use node 22 in CI --- .github/workflows/checks.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml index 36d9913404..916dd2214b 100644 --- a/.github/workflows/checks.yml +++ b/.github/workflows/checks.yml @@ -130,7 +130,7 @@ jobs: Lint-Format-and-TypoCheck: strategy: matrix: - node: [20] + node: [22] if: github.event.pull_request.labels.*.name != 'skip-lint' runs-on: ubuntu-latest @@ -329,7 +329,7 @@ jobs: - name: Setup Node.JS ${{ matrix.node }} uses: actions/setup-node@v4 with: - node-version: 20 + node-version: 22 # TODO matrixing this requires changing branch protection rules - name: Restore npm cache From 9245c8cf7c90719b71c9050b8b508ad772028d74 Mon Sep 17 00:00:00 2001 From: Geometer1729 <16kuhnb@gmail.com> Date: Mon, 25 Aug 2025 13:40:40 -0400 Subject: [PATCH 15/16] use nodejs 22 everywhere --- .github/actions/build/action.yml | 2 +- .github/actions/live-tests-shared/action.yml | 2 +- .github/workflows/checks.yml | 4 ++++ .github/workflows/push_main.yml | 6 +++--- .github/workflows/release.yml | 2 +- 5 files changed, 10 insertions(+), 6 deletions(-) diff --git a/.github/actions/build/action.yml b/.github/actions/build/action.yml index 6005c4b0a9..4a81858dc0 100644 --- a/.github/actions/build/action.yml +++ b/.github/actions/build/action.yml @@ -66,7 +66,7 @@ runs: - name: Setup Node uses: actions/setup-node@v4 with: - node-version: '20' + node-version: '22' - name: use proof_systems_commit if provided if: ${{ inputs.proof_systems_commit != '' }} diff --git a/.github/actions/live-tests-shared/action.yml b/.github/actions/live-tests-shared/action.yml index 6dda1b2f85..877de2f820 100644 --- a/.github/actions/live-tests-shared/action.yml +++ b/.github/actions/live-tests-shared/action.yml @@ -16,7 +16,7 @@ runs: - name: Setup Node uses: actions/setup-node@v4 with: - node-version: '20' + node-version: '22' - name: Build o1js and execute tests env: USE_CUSTOM_LOCAL_NETWORK: 'true' diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml index 916dd2214b..4e05fba4e2 100644 --- a/.github/workflows/checks.yml +++ b/.github/workflows/checks.yml @@ -257,6 +257,10 @@ jobs: cache_id: ${{ secrets.NIX_CACHE_GCP_ID }} nar_secret: ${{ secrets.NIX_CACHE_NAR_SECRET }} gcp_secret: ${{ secrets.NIX_CACHE_GCP_SECRET }} + - name: Setup Node.JS ${{ matrix.node }} + uses: actions/setup-node@v4 + with: + node-version: 22 - name: Count tests id: count_tests run: | diff --git a/.github/workflows/push_main.yml b/.github/workflows/push_main.yml index c8f658dcc1..eeee10c76b 100644 --- a/.github/workflows/push_main.yml +++ b/.github/workflows/push_main.yml @@ -18,7 +18,7 @@ jobs: Build-Doc: strategy: matrix: - node: [20] + node: [22] if: github.ref == 'refs/heads/main' runs-on: ubuntu-latest steps: @@ -74,7 +74,7 @@ jobs: Pkg-pr-new: strategy: matrix: - node: [20] + node: [22] runs-on: [ubuntu-latest] steps: @@ -118,7 +118,7 @@ jobs: - name: Setup Node uses: actions/setup-node@v4 with: - node-version: '20' + node-version: '22' - name: Build o1js run: | diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index d8b11daa28..04f3dbfbfc 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -25,7 +25,7 @@ jobs: - name: Set up Node.js uses: actions/setup-node@v4 with: - node-version: '18' + node-version: '22' - name: Configure Git run: | From 73fa2eac243dd8373b928ddee21a9768bf743146 Mon Sep 17 00:00:00 2001 From: Geometer1729 <16kuhnb@gmail.com> Date: Tue, 26 Aug 2025 10:57:16 -0400 Subject: [PATCH 16/16] format --- CHANGELOG.md | 1 - flake.lock | 58 +++++----------------- src/bindings/crypto/finite-field.ts | 4 +- src/index.ts | 6 +-- src/lib/proof-system/zkfunction.ts | 12 ++--- src/lib/proof-system/zkprogram.ts | 41 +++++++-------- src/lib/util/types.ts | 2 +- src/mina-signer/src/signature.unit-test.ts | 2 +- 8 files changed, 45 insertions(+), 81 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 97e553e9ed..4a33f402f5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -25,7 +25,6 @@ This project adheres to ### Added - ### Changed - Updated Rust nightly version from `2024-06-13` to `2024-09-05` to match the diff --git a/flake.lock b/flake.lock index 43b5abb12e..49836b16b9 100644 --- a/flake.lock +++ b/flake.lock @@ -2,13 +2,8 @@ "nodes": { "describe-dune": { "inputs": { - "flake-utils": [ - "flake-utils" - ], - "nixpkgs": [ - "mina", - "nixpkgs" - ] + "flake-utils": ["flake-utils"], + "nixpkgs": ["mina", "nixpkgs"] }, "locked": { "lastModified": 1742933373, @@ -26,14 +21,8 @@ }, "describe-dune_2": { "inputs": { - "flake-utils": [ - "mina", - "utils" - ], - "nixpkgs": [ - "mina", - "nixpkgs" - ] + "flake-utils": ["mina", "utils"], + "nixpkgs": ["mina", "nixpkgs"] }, "locked": { "lastModified": 1742933373, @@ -51,13 +40,8 @@ }, "dune-nix": { "inputs": { - "flake-utils": [ - "flake-utils" - ], - "nixpkgs": [ - "mina", - "nixpkgs" - ] + "flake-utils": ["flake-utils"], + "nixpkgs": ["mina", "nixpkgs"] }, "locked": { "lastModified": 1753462905, @@ -204,10 +188,7 @@ }, "gitignore-nix": { "inputs": { - "nixpkgs": [ - "mina", - "nixpkgs" - ] + "nixpkgs": ["mina", "nixpkgs"] }, "locked": { "lastModified": 1660459072, @@ -226,9 +207,7 @@ "mina": { "inputs": { "describe-dune": "describe-dune_2", - "dune-nix": [ - "dune-nix" - ], + "dune-nix": ["dune-nix"], "flake-buildkite-pipeline": "flake-buildkite-pipeline", "flake-compat": "flake-compat", "flockenzeit": "flockenzeit", @@ -303,10 +282,7 @@ }, "nix-npm-buildPackage": { "inputs": { - "nixpkgs": [ - "mina", - "nixpkgs" - ] + "nixpkgs": ["mina", "nixpkgs"] }, "locked": { "lastModified": 1670813451, @@ -456,15 +432,9 @@ "flake-compat": "flake-compat_2", "flake-utils": "flake-utils_3", "mirage-opam-overlays": "mirage-opam-overlays", - "nixpkgs": [ - "mina", - "nixpkgs" - ], + "nixpkgs": ["mina", "nixpkgs"], "opam-overlays": "opam-overlays", - "opam-repository": [ - "mina", - "opam-repository" - ], + "opam-repository": ["mina", "opam-repository"], "opam2json": "opam2json" }, "locked": { @@ -516,11 +486,7 @@ }, "opam2json": { "inputs": { - "nixpkgs": [ - "mina", - "opam-nix", - "nixpkgs" - ] + "nixpkgs": ["mina", "opam-nix", "nixpkgs"] }, "locked": { "lastModified": 1671540003, diff --git a/src/bindings/crypto/finite-field.ts b/src/bindings/crypto/finite-field.ts index a12cd24ef4..fe8b86f470 100644 --- a/src/bindings/crypto/finite-field.ts +++ b/src/bindings/crypto/finite-field.ts @@ -137,8 +137,8 @@ function fastInverse(x: bigint, p: bigint, n: number, kmax: bigint, twoToMinusKm u = unew >> wn; v = vnew >> wn; - if (u < 0) ((u = -u), (f0n = -f0n), (g0n = -g0n)); - if (v < 0) ((v = -v), (f1n = -f1n), (g1n = -g1n)); + if (u < 0) (u = -u), (f0n = -f0n), (g0n = -g0n); + if (v < 0) (v = -v), (f1n = -f1n), (g1n = -g1n); let rnew = r * f0n + s * g0n; let snew = s * g1n + r * f1n; diff --git a/src/index.ts b/src/index.ts index f9233757f8..3e9a96706e 100644 --- a/src/index.ts +++ b/src/index.ts @@ -152,7 +152,7 @@ namespace Experimental { export type MinaProgramMethodReturn< State extends V2_.StateLayout = 'GenericState', Event = Field[], - Action = Field[] + Action = Field[], > = V2_.MinaProgramMethodReturn; export type StateDefinition = V2_.StateDefinition; export type ZkappCommandAuthorizationEnvironment = V2_.ZkappCommandAuthorizationEnvironment; @@ -160,7 +160,7 @@ namespace Experimental { State extends StateLayout, Event, Action, - MethodPrivateInputs extends { [key: string]: V2_.ProvableTuple } + MethodPrivateInputs extends { [key: string]: V2_.ProvableTuple }, > = V2_.MinaProgram; export type DynamicProvable

= V2_.DynamicProvable

; } @@ -212,7 +212,7 @@ namespace Experimental { export class BatchReducer< ActionType extends Actionable, BatchSize extends number = number, - Action = InferProvable + Action = InferProvable, > extends BatchReducer_.BatchReducer {} /** diff --git a/src/lib/proof-system/zkfunction.ts b/src/lib/proof-system/zkfunction.ts index ea4d729c7c..3c44ec4ba3 100644 --- a/src/lib/proof-system/zkfunction.ts +++ b/src/lib/proof-system/zkfunction.ts @@ -31,7 +31,7 @@ type ZkFunctionConfig = { type MainType< PublicInput, - PrivateInputs extends Tuple + PrivateInputs extends Tuple, > = PublicInput extends undefined ? (...args: TupleToInstances) => void : (publicInput: InferProvable, ...args: TupleToInstances) => void; @@ -41,12 +41,10 @@ type InferMainType = MainType< Config['privateInputTypes'] >; -type ProveMethodType = Get< - Config, - 'publicInputType' -> extends undefined - ? (...args: PrivateInputs) => Promise - : (publicInput: PublicInput, ...args: PrivateInputs) => Promise; +type ProveMethodType = + Get extends undefined + ? (...args: PrivateInputs) => Promise + : (publicInput: PublicInput, ...args: PrivateInputs) => Promise; function ZkFunction( config: Config & { diff --git a/src/lib/proof-system/zkprogram.ts b/src/lib/proof-system/zkprogram.ts index 3ca3ba52e1..df1c64dfca 100644 --- a/src/lib/proof-system/zkprogram.ts +++ b/src/lib/proof-system/zkprogram.ts @@ -225,7 +225,7 @@ type InferMethodType = { */ function ZkProgram< Config extends ConfigBaseType, - _ extends unknown = unknown // weird hack that makes methods infer correctly when their inputs are not annotated + _ extends unknown = unknown, // weird hack that makes methods infer correctly when their inputs are not annotated >( config: Config & { name: string; @@ -603,7 +603,7 @@ type ZkProgram< auxiliaryOutput?: ProvableType; }; }; - } + }, > = ReturnType>; /** @@ -1059,7 +1059,7 @@ function toFieldAndAuxConsts(type: Provable, value: T) { ZkProgram.Proof = function < PublicInputType extends FlexibleProvable, - PublicOutputType extends FlexibleProvable + PublicOutputType extends FlexibleProvable, >(program: { name: string; publicInputType: PublicInputType; @@ -1111,11 +1111,12 @@ function Prover() { // helper types -type Infer = T extends Subclass - ? InstanceType - : T extends ProvableType - ? InferProvableType - : never; +type Infer = + T extends Subclass + ? InstanceType + : T extends ProvableType + ? InferProvableType + : never; type TupleToInstances = { [I in keyof T]: Infer; @@ -1133,13 +1134,13 @@ type MethodReturnType = PublicOutput extends void auxiliaryOutput: AuxiliaryOutput; } : AuxiliaryOutput extends undefined - ? { - publicOutput: PublicOutput; - } - : { - publicOutput: PublicOutput; - auxiliaryOutput: AuxiliaryOutput; - }; + ? { + publicOutput: PublicOutput; + } + : { + publicOutput: PublicOutput; + auxiliaryOutput: AuxiliaryOutput; + }; type Method< PublicInput, @@ -1147,7 +1148,7 @@ type Method< MethodSignature extends { privateInputs: Tuple; auxiliaryOutput?: ProvableType; - } + }, > = PublicInput extends undefined ? { method( @@ -1176,7 +1177,7 @@ type RegularProver< PublicInputType, PublicOutput, Args extends Tuple, - AuxiliaryOutput + AuxiliaryOutput, > = ( publicInput: From, ...args: TupleFrom @@ -1190,7 +1191,7 @@ type Prover< PublicInputType, PublicOutput, Args extends Tuple, - AuxiliaryOutput + AuxiliaryOutput, > = PublicInput extends undefined ? (...args: TupleFrom) => Promise<{ proof: Proof; @@ -1210,8 +1211,8 @@ type ProvableOrVoid = A extends undefined ? typeof Void : ToProvable; type InferProvableOrUndefined = A extends undefined ? undefined : A extends ProvableType - ? InferProvable - : InferProvable | undefined; + ? InferProvable + : InferProvable | undefined; type InferProvableOrVoid = A extends undefined ? void : InferProvable; type UnwrapPromise

= P extends Promise ? T : never; diff --git a/src/lib/util/types.ts b/src/lib/util/types.ts index 00c56bebef..47f6fc1533 100644 --- a/src/lib/util/types.ts +++ b/src/lib/util/types.ts @@ -10,7 +10,7 @@ type AnyTuple = Tuple; type TupleMap, B> = [ ...{ [i in keyof T]: B; - } + }, ]; const Tuple = { diff --git a/src/mina-signer/src/signature.unit-test.ts b/src/mina-signer/src/signature.unit-test.ts index 7c1bd306e5..869fdee68a 100644 --- a/src/mina-signer/src/signature.unit-test.ts +++ b/src/mina-signer/src/signature.unit-test.ts @@ -75,7 +75,7 @@ let privateKeys = [ 19152183577529784585604205414612388832924448123778079866321952213819564835523n, 20617898261860919949586898353988281719931035849127590497832022423723702051831n, 28948022309329048855892746252171976963363056481941560715954676764349967630337n, // the keys below this line (including) are larger than p smaller than q - 28948022309329048855892746252171976963363056481941570345257461873688122665643n, // where p is the modulus of the base field + 28948022309329048855892746252171976963363056481941570345257461873688122665643n, // where p is the modulus of the base field 28948022309329048855892746252171976963363056481941579974560246983026277700950n, // and q is the modulus of the scalar field 28948022309329048855892746252171976963363056481941589603863032092364432736257n, 28948022309329048855892746252171976963363056481941599233165817201702587771563n,