From 4797e47e818edfe8f615566aa97f33962fc5cc50 Mon Sep 17 00:00:00 2001 From: Geometer1729 <16kuhnb@gmail.com> Date: Thu, 21 Nov 2024 20:49:11 -0500 Subject: [PATCH 01/29] build bindings in derivation --- flake.lock | 488 ++++++++++++++++++++++++++++++++++++++++++++++++++- flake.nix | 165 +++++++++++++---- src/bindings | 2 +- 3 files changed, 615 insertions(+), 40 deletions(-) diff --git a/flake.lock b/flake.lock index 79916af26..189851c78 100644 --- a/flake.lock +++ b/flake.lock @@ -48,6 +48,31 @@ "type": "github" } }, + "describe-dune_3": { + "inputs": { + "flake-utils": [ + "mina-rev", + "utils" + ], + "nixpkgs": [ + "mina-rev", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1724407960, + "narHash": "sha256-pUKTVMYEtsD1AGlHFTdPourowt+tJ3htKhRu7VALFzc=", + "owner": "o1-labs", + "repo": "describe-dune", + "rev": "be828239c05671209e979f9d5c2e3094e3be7a46", + "type": "github" + }, + "original": { + "owner": "o1-labs", + "repo": "describe-dune", + "type": "github" + } + }, "dune-nix": { "inputs": { "flake-utils": [ @@ -96,6 +121,31 @@ "type": "github" } }, + "dune-nix_3": { + "inputs": { + "flake-utils": [ + "mina-rev", + "utils" + ], + "nixpkgs": [ + "mina-rev", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1724418497, + "narHash": "sha256-HjTh7o02QhGXmbxmpE5HRWei3H/pyh/NKCMCnucDaYs=", + "owner": "o1-labs", + "repo": "dune-nix", + "rev": "26dc164a4c3976888e13eabd73a210b78505820f", + "type": "github" + }, + "original": { + "owner": "o1-labs", + "repo": "dune-nix", + "type": "github" + } + }, "flake-buildkite-pipeline": { "inputs": { "nixpkgs-lib": "nixpkgs-lib" @@ -114,6 +164,24 @@ "type": "github" } }, + "flake-buildkite-pipeline_2": { + "inputs": { + "nixpkgs-lib": "nixpkgs-lib_2" + }, + "locked": { + "lastModified": 1665561509, + "narHash": "sha256-+9KQw0ftpNjezYwbUIcLAvDWekuGSBAs8I2XulcUkT4=", + "owner": "tweag", + "repo": "flake-buildkite-pipeline", + "rev": "c836a5a449973dd04a80f6741863ceb43ec414c9", + "type": "github" + }, + "original": { + "owner": "tweag", + "repo": "flake-buildkite-pipeline", + "type": "github" + } + }, "flake-compat": { "flake": false, "locked": { @@ -146,6 +214,38 @@ "type": "github" } }, + "flake-compat_3": { + "flake": false, + "locked": { + "lastModified": 1668681692, + "narHash": "sha256-Ht91NGdewz8IQLtWZ9LCeNXMSXHUss+9COoqu6JLmXU=", + "owner": "edolstra", + "repo": "flake-compat", + "rev": "009399224d5e398d03b22badca40a37ac85412a1", + "type": "github" + }, + "original": { + "owner": "edolstra", + "repo": "flake-compat", + "type": "github" + } + }, + "flake-compat_4": { + "flake": false, + "locked": { + "lastModified": 1627913399, + "narHash": "sha256-hY8g6H2KFL8ownSiFeMOjwPC8P0ueXpCVEbxgda3pko=", + "owner": "edolstra", + "repo": "flake-compat", + "rev": "12c64ca55c1014cdc1b16ed5a804aa8576601ff2", + "type": "github" + }, + "original": { + "owner": "edolstra", + "repo": "flake-compat", + "type": "github" + } + }, "flake-utils": { "inputs": { "systems": "systems" @@ -209,6 +309,51 @@ "type": "github" } }, + "flake-utils_5": { + "locked": { + "lastModified": 1623875721, + "narHash": "sha256-A8BU7bjS5GirpAUv4QA+QnJ4CceLHkcXdRp4xITDB0s=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "f7e004a55b120c02ecb6219596820fcd32ca8772", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "flake-utils_6": { + "locked": { + "lastModified": 1638122382, + "narHash": "sha256-sQzZzAbvKEqN9s0bzWuYmRaA03v40gaJ4+iL1LXjaeI=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "74f7e4319258e287b0f9cb95426c9853b282730b", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "flake-utils_7": { + "locked": { + "lastModified": 1644229661, + "narHash": "sha256-1YdnJAsNy69bpcjuoKdOYQX0YxZBiCYZo4Twxerqv7k=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "3cecb5b042f7f209c56ffd8371b2711a290ec797", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, "flockenzeit": { "locked": { "lastModified": 1671184471, @@ -224,6 +369,21 @@ "type": "github" } }, + "flockenzeit_2": { + "locked": { + "lastModified": 1671184471, + "narHash": "sha256-oTsIo40BxHG8ZcMNwJybV68F8CLNdfY9HKFzEBzeJ6A=", + "owner": "balsoft", + "repo": "Flockenzeit", + "rev": "0409dcd0cc87feebd211c529171d61b89f10d9b3", + "type": "github" + }, + "original": { + "owner": "balsoft", + "repo": "Flockenzeit", + "type": "github" + } + }, "gitignore-nix": { "inputs": { "nixpkgs": [ @@ -245,6 +405,27 @@ "type": "github" } }, + "gitignore-nix_2": { + "inputs": { + "nixpkgs": [ + "mina-rev", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1660459072, + "narHash": "sha256-8DFJjXG8zqoONA1vXtgeKXy68KdJL5UaXR8NtVMUbx8=", + "owner": "hercules-ci", + "repo": "gitignore.nix", + "rev": "a20de23b925fd8264fd7fad6454652e142fd7f73", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "gitignore.nix", + "type": "github" + } + }, "mina": { "inputs": { "describe-dune": "describe-dune_2", @@ -265,8 +446,8 @@ "utils": "utils" }, "locked": { - "lastModified": 1731611028, - "narHash": "sha256-sehBPO+H9mtShGb3KNhdDVHj0pogt/tmiL9tc2ICkaU=", + "lastModified": 1732222139, + "narHash": "sha256-4LLy5VMM5TK4LpQXEBiA8ziwYyqGx2ZAuunXGCDpraQ=", "path": "src/mina", "type": "path" }, @@ -275,6 +456,38 @@ "type": "path" } }, + "mina-rev": { + "inputs": { + "describe-dune": "describe-dune_3", + "dune-nix": "dune-nix_3", + "flake-buildkite-pipeline": "flake-buildkite-pipeline_2", + "flake-compat": "flake-compat_3", + "flockenzeit": "flockenzeit_2", + "gitignore-nix": "gitignore-nix_2", + "mix-to-nix": "mix-to-nix_2", + "nix-filter": "nix-filter_2", + "nix-npm-buildPackage": "nix-npm-buildPackage_2", + "nix-utils": "nix-utils_2", + "nixpkgs": "nixpkgs_4", + "nixpkgs-mozilla": "nixpkgs-mozilla_2", + "o1-opam-repository": "o1-opam-repository_2", + "opam-nix": "opam-nix_2", + "opam-repository": "opam-repository_2", + "utils": "utils_2" + }, + "locked": { + "lastModified": 1729507624, + "narHash": "sha256-DudL1W06R1K0HYyetAVZSzao5B5fjS/rS6cMfCBhiqE=", + "rev": "6899054b745c1323b9d5bcaa62c00bed2ad1ead3", + "revCount": 32900, + "type": "git", + "url": "file:src/mina" + }, + "original": { + "type": "git", + "url": "file:src/mina" + } + }, "mirage-opam-overlays": { "flake": false, "locked": { @@ -291,6 +504,22 @@ "type": "github" } }, + "mirage-opam-overlays_2": { + "flake": false, + "locked": { + "lastModified": 1661959605, + "narHash": "sha256-CPTuhYML3F4J58flfp3ZbMNhkRkVFKmBEYBZY5tnQwA=", + "owner": "dune-universe", + "repo": "mirage-opam-overlays", + "rev": "05f1c1823d891ce4d8adab91f5db3ac51d86dc0b", + "type": "github" + }, + "original": { + "owner": "dune-universe", + "repo": "mirage-opam-overlays", + "type": "github" + } + }, "mix-to-nix": { "locked": { "lastModified": 1643291492, @@ -306,6 +535,21 @@ "type": "github" } }, + "mix-to-nix_2": { + "locked": { + "lastModified": 1643291492, + "narHash": "sha256-B+VIFF8qDJhF5hVMc8PbY/WPzUtbGgjsV1eAxTt5GuQ=", + "owner": "serokell", + "repo": "mix-to-nix", + "rev": "f6f0172b3ac4d32c0e6050a7d805734de0b7adef", + "type": "github" + }, + "original": { + "owner": "serokell", + "repo": "mix-to-nix", + "type": "github" + } + }, "nix-filter": { "locked": { "lastModified": 1666547822, @@ -321,6 +565,21 @@ "type": "github" } }, + "nix-filter_2": { + "locked": { + "lastModified": 1666547822, + "narHash": "sha256-razwnAybPHyoAyhkKCwXdxihIqJi1G6e1XP4FQOJTEs=", + "owner": "numtide", + "repo": "nix-filter", + "rev": "1a3b735e13e90a8d2fd5629f2f8363bd7ffbbec7", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "nix-filter", + "type": "github" + } + }, "nix-npm-buildPackage": { "inputs": { "nixpkgs": [ @@ -342,6 +601,27 @@ "type": "github" } }, + "nix-npm-buildPackage_2": { + "inputs": { + "nixpkgs": [ + "mina-rev", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1670813451, + "narHash": "sha256-v0IvQ35CMKtPreGlxWb1FvFUraJNZd144+MbiDwGoAA=", + "owner": "serokell", + "repo": "nix-npm-buildpackage", + "rev": "ec0365cd14a3359a23b80a9e2531a09afc3488fc", + "type": "github" + }, + "original": { + "owner": "serokell", + "repo": "nix-npm-buildpackage", + "type": "github" + } + }, "nix-utils": { "inputs": { "flake-utils": "flake-utils_2", @@ -361,6 +641,25 @@ "type": "github" } }, + "nix-utils_2": { + "inputs": { + "flake-utils": "flake-utils_5", + "nixpkgs": "nixpkgs_3" + }, + "locked": { + "lastModified": 1632973430, + "narHash": "sha256-9G8zo+0nfYAALV5umCyQR/2hVUFNH10JropBkyxZGGw=", + "owner": "juliosueiras-nix", + "repo": "nix-utils", + "rev": "b44e1ffd726aa03056db9df469efb497d8b9871b", + "type": "github" + }, + "original": { + "owner": "juliosueiras-nix", + "repo": "nix-utils", + "type": "github" + } + }, "nixpkgs": { "locked": { "lastModified": 1629252929, @@ -391,6 +690,21 @@ "type": "github" } }, + "nixpkgs-lib_2": { + "locked": { + "lastModified": 1649551420, + "narHash": "sha256-J/Pn38rBZTszdtTHhhxroQaHADhd5TgbJ53F9j1WTIE=", + "owner": "nix-community", + "repo": "nixpkgs.lib", + "rev": "3a16841c57b0d3025b21b869cc921a119ce73033", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "nixpkgs.lib", + "type": "github" + } + }, "nixpkgs-mozilla": { "flake": false, "locked": { @@ -423,6 +737,22 @@ "type": "github" } }, + "nixpkgs-mozilla_3": { + "flake": false, + "locked": { + "lastModified": 1704373101, + "narHash": "sha256-+gi59LRWRQmwROrmE1E2b3mtocwueCQqZ60CwLG+gbg=", + "owner": "mozilla", + "repo": "nixpkgs-mozilla", + "rev": "9b11a87c0cc54e308fa83aac5b4ee1816d5418a2", + "type": "github" + }, + "original": { + "owner": "mozilla", + "repo": "nixpkgs-mozilla", + "type": "github" + } + }, "nixpkgs_2": { "locked": { "lastModified": 1713180868, @@ -440,6 +770,37 @@ } }, "nixpkgs_3": { + "locked": { + "lastModified": 1629252929, + "narHash": "sha256-Aj20gmGBs8TG7pyaQqgbsqAQ6cB+TVuL18Pk3DPBxcQ=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "3788c68def67ca7949e0864c27638d484389363d", + "type": "github" + }, + "original": { + "owner": "nixos", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_4": { + "locked": { + "lastModified": 1713180868, + "narHash": "sha256-5CSnPSCEWeUmrFiLuYIQIPQzPrpCB8x3VhE+oXLRO3k=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "140546acf30a8212a03a88ded8506413fa3b5d21", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-23.11-small", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_5": { "locked": { "lastModified": 1720535198, "narHash": "sha256-zwVvxrdIzralnSbcpghA92tWu2DV2lwv89xZc8MTrbg=", @@ -471,6 +832,22 @@ "type": "github" } }, + "o1-opam-repository_2": { + "flake": false, + "locked": { + "lastModified": 1715294616, + "narHash": "sha256-W2p9Vs8PqpKGvMByxVqpxAljjpEMqNcuNnjMBAAKicI=", + "owner": "o1-labs", + "repo": "opam-repository", + "rev": "38d6995e307c82b3c0b3bc86a867213db724d1c5", + "type": "github" + }, + "original": { + "owner": "o1-labs", + "repo": "opam-repository", + "type": "github" + } + }, "opam-nix": { "inputs": { "flake-compat": "flake-compat_2", @@ -501,6 +878,36 @@ "type": "github" } }, + "opam-nix_2": { + "inputs": { + "flake-compat": "flake-compat_4", + "flake-utils": "flake-utils_6", + "mirage-opam-overlays": "mirage-opam-overlays_2", + "nixpkgs": [ + "mina-rev", + "nixpkgs" + ], + "opam-overlays": "opam-overlays_2", + "opam-repository": [ + "mina-rev", + "opam-repository" + ], + "opam2json": "opam2json_2" + }, + "locked": { + "lastModified": 1712645768, + "narHash": "sha256-9dUh8nElGtC74Q4gIDV6DM0FKgF1oXh0PUkCxdbp+sg=", + "owner": "tweag", + "repo": "opam-nix", + "rev": "464863fba44c7ecc50bd1a2967274482a2c33daf", + "type": "github" + }, + "original": { + "owner": "tweag", + "repo": "opam-nix", + "type": "github" + } + }, "opam-overlays": { "flake": false, "locked": { @@ -517,6 +924,22 @@ "type": "github" } }, + "opam-overlays_2": { + "flake": false, + "locked": { + "lastModified": 1654162756, + "narHash": "sha256-RV68fUK+O3zTx61iiHIoS0LvIk0E4voMp+0SwRg6G6c=", + "owner": "dune-universe", + "repo": "opam-overlays", + "rev": "c8f6ef0fc5272f254df4a971a47de7848cc1c8a4", + "type": "github" + }, + "original": { + "owner": "dune-universe", + "repo": "opam-overlays", + "type": "github" + } + }, "opam-repository": { "flake": false, "locked": { @@ -533,6 +956,22 @@ "type": "github" } }, + "opam-repository_2": { + "flake": false, + "locked": { + "lastModified": 1708601497, + "narHash": "sha256-mDYINTjOiYLN4wT5fGlWTvHFQdWkzY46XUuZWKgmJxY=", + "owner": "ocaml", + "repo": "opam-repository", + "rev": "90d8c520a4f0b035ac51e267a8b33739c5a78b5a", + "type": "github" + }, + "original": { + "owner": "ocaml", + "repo": "opam-repository", + "type": "github" + } + }, "opam2json": { "inputs": { "nixpkgs": [ @@ -555,14 +994,37 @@ "type": "github" } }, + "opam2json_2": { + "inputs": { + "nixpkgs": [ + "mina-rev", + "opam-nix", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1671540003, + "narHash": "sha256-5pXfbUfpVABtKbii6aaI2EdAZTjHJ2QntEf0QD2O5AM=", + "owner": "tweag", + "repo": "opam2json", + "rev": "819d291ea95e271b0e6027679de6abb4d4f7f680", + "type": "github" + }, + "original": { + "owner": "tweag", + "repo": "opam2json", + "type": "github" + } + }, "root": { "inputs": { "describe-dune": "describe-dune", "dune-nix": "dune-nix", "flake-utils": "flake-utils", "mina": "mina", - "nixpkgs": "nixpkgs_3", - "nixpkgs-mozilla": "nixpkgs-mozilla_2" + "mina-rev": "mina-rev", + "nixpkgs": "nixpkgs_5", + "nixpkgs-mozilla": "nixpkgs-mozilla_3" } }, "systems": { @@ -597,6 +1059,24 @@ "repo": "flake-utils-plus", "type": "github" } + }, + "utils_2": { + "inputs": { + "flake-utils": "flake-utils_7" + }, + "locked": { + "lastModified": 1657226504, + "narHash": "sha256-GIYNjuq4mJlFgqKsZ+YrgzWm0IpA4axA3MCrdKYj7gs=", + "owner": "gytis-ivaskevicius", + "repo": "flake-utils-plus", + "rev": "2bf0f91643c2e5ae38c1b26893ac2927ac9bd82a", + "type": "github" + }, + "original": { + "owner": "gytis-ivaskevicius", + "repo": "flake-utils-plus", + "type": "github" + } } }, "root": "root", diff --git a/flake.nix b/flake.nix index dd7e4d3d4..dc525d063 100644 --- a/flake.nix +++ b/flake.nix @@ -3,6 +3,10 @@ inputs = { nixpkgs.url = "github:nixos/nixpkgs/nixos-23.11-small"; mina.url = "path:src/mina"; + # Nix doesn't seem to handle recursive submodules well + # so we import mina once not as a git repo so the submodules work + # but also as a git repo so the git rev is visible + mina-rev.url = "git+file:src/mina"; nixpkgs-mozilla.url = "github:mozilla/nixpkgs-mozilla"; nixpkgs-mozilla.flake = false; describe-dune.url = "github:o1-labs/describe-dune"; @@ -84,6 +88,42 @@ { targets = ["wasm32-unknown-unknown" "x86_64-unknown-linux-gnu" ]; extensions = [ "rust-src" ]; }); + rust-platform = pkgs.makeRustPlatform + { cargo = rust-channel; + rustc = rust-channel; + }; + + bindings-pkgs = with pkgs; + [ nodejs + nodePackages.npm + typescript + nodePackages.typescript-language-server + + #Rustup doesn't allow local toolchains to contain 'nightly' in the name + #so the toolchain is linked with the name nix and rustup is wrapped in a shellscript + #which calls the nix toolchain instead of the nightly one + (writeShellApplication + { name = "rustup"; + text = + '' + if [ "$1" = run ] && { [ "$2" = nightly-2023-09-01 ] || [ "$2" = 1.72-x86_64-unknowl-linux-gnu ]; } + then + echo USING NIX TOOLCHAIN + ${rustup}/bin/rustup run nix "''${@:3}" + else + echo escape rustup "$@" + ${rustup}/bin/rustup "$@" + fi + ''; + } + ) + rustup + wasm-pack + binaryen # provides wasm-opt + + dune_3 + ] ++ commonOverrides.buildInputs ; + inherit (nixpkgs) lib; # All the submodules required by .gitmodules submodules = map builtins.head (builtins.filter lib.isList @@ -111,6 +151,47 @@ command "nix-shell" }. ''; + + o1js-npm-deps = pkgs.buildNpmPackage + { name = "o1js"; + src = with pkgs.lib.fileset; + (toSource { + root = ./.; + fileset = unions [ + ./package.json + ./package-lock.json + ]; + }); + npmDepsHash = "sha256-UdzSaZJmr5k4voyKPA+9Odb6a2Ia9+3C5YQol9dSIDE="; + # The prepack script runs the build script, which we'd rather do in the build phase. + npmPackFlags = [ "--ignore-scripts" ]; + dontNpmBuild = true; + installPhase = '' + runHook preInstall + + mkdir -p $out/lib + cp -r node_modules $out/lib + + runHook postInstall + ''; + }; + test-vectors = rust-platform.buildRustPackage { + src = pkgs.lib.sourceByRegex ./src/mina/src + [ + "^lib(/crypto(/kimchi_bindings(/stubs(/.*)?)?)?)?$" + "^lib(/crypto(/proof-systems(/.*)?)?)?$" + ]; + sourceRoot = "source/lib/crypto/proof-systems/poseidon/export_test_vectors"; + patchPhase = + '' + cp ${./src/mina/src/lib/crypto/proof-systems/Cargo.lock} . + ''; + name = "export_test_vectors"; + version = "0.1.0"; + cargoSha256 = ""; + CARGO_TARGET_DIR = "./target"; + cargoLock = { lockFile = ./src/mina/src/lib/crypto/proof-systems/Cargo.lock ; }; + }; in { formatter = pkgs.nixfmt; inherit mina; @@ -124,48 +205,62 @@ export RUSTUP_HOME rustup toolchain link nix ${rust-channel} ''; - packages = with pkgs; - [ nodejs - nodePackages.npm - typescript - nodePackages.typescript-language-server + packages = bindings-pkgs; + }); - #Rustup doesn't allow local toolchains to contain 'nightly' in the name - #so the toolchain is linked with the name nix and rustup is wrapped in a shellscript - #which calls the nix toolchain instead of the nightly one - (writeShellApplication - { name = "rustup"; - text = - '' - if [ "$1" = run ] && [ "$2" = nightly-2023-09-01 ] - then - ${rustup}/bin/rustup run nix "''${@:3}" - else - ${rustup}/bin/rustup "$@" - fi - ''; - } - ) - rustup - wasm-pack - binaryen # provides wasm-opt - dune_3 - ] ++ commonOverrides.buildInputs ; - }); }; # TODO build from ./ocaml root, not ./. (after fixing a bug in dune-nix) packages = { - kim = pkgs.kimchi-rust-wasm; inherit dune-description; - bindings = prj.pkgs.o1js_bindings; + o1js-bindings = pkgs.stdenv.mkDerivation { + name = "o1js_bindings"; + src = ./.; + inherit (inputs.mina.devShells."${system}".default) + PLONK_WASM_NODEJS + PLONK_WASM_WEB + MARLIN_PLONK_STUBS + ; + 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 = + "${mina.files.src-lib-crypto-kimchi_bindings-js-node_js}/src/lib/crypto/kimchi_bindings/js/node_js"; + EXPORT_TEST_VECTORS = "${test-vectors}/bin/export_test_vectors"; + buildInputs = bindings-pkgs ++ [ pkgs.bash ]; + MINA_COMMIT = inputs.mina-rev.rev; + patchPhase = '' + patchShebangs ./src/bindings/scripts/ + patchShebangs ./src/bindings/crypto/test-vectors/ + ''; + buildPhase = + '' + RUSTUP_HOME=$(pwd)/.rustup + export RUSTUP_HOME + rustup toolchain link nix ${rust-channel} + cp -r ${o1js-npm-deps}/lib/node_modules/ . + + npm run build:update-bindings + mkdir $out + pushd ./src/bindings + cp -Lr ./compiled ./mina-transaction ./ocaml MINA_COMMIT $out + popd + ''; + }; + kimchi = pkgs.kimchi-rust-wasm; ocaml-js = prj.pkgs.__ocaml-js__; - default = pkgs.buildNpmPackage - { name = "o1js"; - src = ./.; - npmDepsHash = "sha256-++MTGDUVBccYN8LA2Xb0FkbrZ14ZyVCrDPESXa52AwQ="; - # TODO ideally re-build bindings here - }; + }; + apps = { + + update-bindings = { + type = "app"; + program = "${pkgs.writeShellApplication + { name = "update-bindings"; + text = + '' + cp -r ${self.packages."${system}".o1js-bindings}/* ./src/bindings + ''; + }}/bin/update-bindings"; + }; }; }); } diff --git a/src/bindings b/src/bindings index 2634cc0b1..1f81c1f69 160000 --- a/src/bindings +++ b/src/bindings @@ -1 +1 @@ -Subproject commit 2634cc0b113e02ffc692828568ed2fe4c6c65b6a +Subproject commit 1f81c1f6912d73bbd2b39ea44c41d10222496686 From 4a9c431e09be54338aecf0e7f46715fbcd8b6a01 Mon Sep 17 00:00:00 2001 From: Geometer1729 <16kuhnb@gmail.com> Date: Mon, 25 Nov 2024 16:37:06 -0500 Subject: [PATCH 02/29] fix node_bindings --- flake.nix | 3 ++- pin.sh | 1 + src/bindings | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/flake.nix b/flake.nix index dc525d063..514e2cd2a 100644 --- a/flake.nix +++ b/flake.nix @@ -242,7 +242,8 @@ npm run build:update-bindings mkdir $out pushd ./src/bindings - cp -Lr ./compiled ./mina-transaction ./ocaml MINA_COMMIT $out + rm -rf ./compiled/_node_bindings + cp -Lr ./compiled ./mina-transaction ./ocaml ./MINA_COMMIT $out popd ''; }; diff --git a/pin.sh b/pin.sh index 6815dbac8..c109f6733 100755 --- a/pin.sh +++ b/pin.sh @@ -10,4 +10,5 @@ git submodule sync && git submodule update --init --recursive nix registry add o1js "git+file://$ROOT?submodules=1" # update mina input to local submodule nix flake update mina --override-input mina 'path:src/mina' --flake '.?submodules=1' +nix flake update mina-rev --flake '.?submodules=1' popd diff --git a/src/bindings b/src/bindings index 1f81c1f69..7b62ab3d0 160000 --- a/src/bindings +++ b/src/bindings @@ -1 +1 @@ -Subproject commit 1f81c1f6912d73bbd2b39ea44c41d10222496686 +Subproject commit 7b62ab3d036cdd9ac6241c26f107cf05d5436125 From 05cbccf77f64be6c2a6745a9424d5c59d727d724 Mon Sep 17 00:00:00 2001 From: Geometer1729 <16kuhnb@gmail.com> Date: Mon, 25 Nov 2024 16:52:46 -0500 Subject: [PATCH 03/29] merge main in bindings --- src/bindings | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/bindings b/src/bindings index 7b62ab3d0..a5a5dc4ca 160000 --- a/src/bindings +++ b/src/bindings @@ -1 +1 @@ -Subproject commit 7b62ab3d036cdd9ac6241c26f107cf05d5436125 +Subproject commit a5a5dc4ca204285b8f088067c130f1d440f2a5b7 From d05a800703970a14c0e8c804edd49a760b42f207 Mon Sep 17 00:00:00 2001 From: Geometer1729 <16kuhnb@gmail.com> Date: Mon, 25 Nov 2024 16:54:35 -0500 Subject: [PATCH 04/29] use nix derivation in ci --- .github/workflows/build-bindings.yml | 6 +++--- flake.nix | 1 - 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build-bindings.yml b/.github/workflows/build-bindings.yml index 7ffc1a7cf..0f4070b49 100644 --- a/.github/workflows/build-bindings.yml +++ b/.github/workflows/build-bindings.yml @@ -1,4 +1,4 @@ -# Purpose: We want to build the o1js bindings in CI so that people in the +# Purpose: We want to build the o1js bindings in CI so that people in the # community can change them without being scared of breaking things, or # needing to do the complicated (without nix) build setup. @@ -7,7 +7,7 @@ name: Build o1js bindings on: pull_request: -jobs: +jobs: nix-build: name: build-bindings-ubuntu runs-on: [sdk-self-hosted-linux-amd64-build-system] @@ -22,4 +22,4 @@ jobs: # Until we restart the runner and the PATH gets updated from /etc/bash.bashrc export PATH="$PATH":/nix/var/nix/profiles/default/bin ./pin.sh - nix develop o1js --command bash -c "npm run build:update-bindings" + nix run o1js#update-bindings diff --git a/flake.nix b/flake.nix index 514e2cd2a..448235d0a 100644 --- a/flake.nix +++ b/flake.nix @@ -251,7 +251,6 @@ ocaml-js = prj.pkgs.__ocaml-js__; }; apps = { - update-bindings = { type = "app"; program = "${pkgs.writeShellApplication From f62c1b13bd2362f1359b6c6842fdd06f1c86a1bc Mon Sep 17 00:00:00 2001 From: Geometer1729 <16kuhnb@gmail.com> Date: Mon, 25 Nov 2024 18:25:29 -0500 Subject: [PATCH 05/29] update npmDepsHash --- flake.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/flake.nix b/flake.nix index 448235d0a..007158f4d 100644 --- a/flake.nix +++ b/flake.nix @@ -162,7 +162,7 @@ ./package-lock.json ]; }); - npmDepsHash = "sha256-UdzSaZJmr5k4voyKPA+9Odb6a2Ia9+3C5YQol9dSIDE="; + npmDepsHash = "sha256-8EPvXpOgn0nvm/pFKN3h6EMjabOeBqfy5optIfe8E8Q="; # The prepack script runs the build script, which we'd rather do in the build phase. npmPackFlags = [ "--ignore-scripts" ]; dontNpmBuild = true; From ad6caee35983b0c7fd8829ea1b3804a8dffa695f Mon Sep 17 00:00:00 2001 From: Geometer1729 <16kuhnb@gmail.com> Date: Tue, 26 Nov 2024 16:46:03 -0500 Subject: [PATCH 06/29] fix in bindings --- src/bindings | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/bindings b/src/bindings index a5a5dc4ca..3ac47e2d9 160000 --- a/src/bindings +++ b/src/bindings @@ -1 +1 @@ -Subproject commit a5a5dc4ca204285b8f088067c130f1d440f2a5b7 +Subproject commit 3ac47e2d9f3a12e8e5c0a6bb951fca9c83ea8733 From e144090f85f8da5dd3f64c57b09fe1a7d7743671 Mon Sep 17 00:00:00 2001 From: Geometer1729 <16kuhnb@gmail.com> Date: Tue, 26 Nov 2024 16:48:52 -0500 Subject: [PATCH 07/29] change pin.sh to hopefully fix issue in ci --- pin.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pin.sh b/pin.sh index c109f6733..410f7ec9a 100755 --- a/pin.sh +++ b/pin.sh @@ -9,6 +9,7 @@ git submodule sync && git submodule update --init --recursive # Add the flake registry entry nix registry add o1js "git+file://$ROOT?submodules=1" # update mina input to local submodule +# --override-input seems redundant but fixes a cacheing issue with local paths nix flake update mina --override-input mina 'path:src/mina' --flake '.?submodules=1' -nix flake update mina-rev --flake '.?submodules=1' +nix flake update mina-rev --flake --override-input mina-rev 'git+file:src/mina' '.?submodules=1' popd From e2e64a5291bc6180e3ca406a258dd66dedd95896 Mon Sep 17 00:00:00 2001 From: Geometer1729 <16kuhnb@gmail.com> Date: Tue, 26 Nov 2024 16:53:17 -0500 Subject: [PATCH 08/29] fix bindings commit --- src/bindings | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/bindings b/src/bindings index 3ac47e2d9..9d3472511 160000 --- a/src/bindings +++ b/src/bindings @@ -1 +1 @@ -Subproject commit 3ac47e2d9f3a12e8e5c0a6bb951fca9c83ea8733 +Subproject commit 9d347251170b7521c393e8220b246ec063a10630 From 291534cb29f5398502844f1e81d21a1727fbb6ef Mon Sep 17 00:00:00 2001 From: Geometer1729 <16kuhnb@gmail.com> Date: Tue, 26 Nov 2024 17:09:22 -0500 Subject: [PATCH 09/29] fix typo --- pin.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pin.sh b/pin.sh index 410f7ec9a..4641ccc40 100755 --- a/pin.sh +++ b/pin.sh @@ -11,5 +11,5 @@ nix registry add o1js "git+file://$ROOT?submodules=1" # update mina input to local submodule # --override-input seems redundant but fixes a cacheing issue with local paths nix flake update mina --override-input mina 'path:src/mina' --flake '.?submodules=1' -nix flake update mina-rev --flake --override-input mina-rev 'git+file:src/mina' '.?submodules=1' +nix flake update mina-rev --override-input mina-rev 'git+file:src/mina' --flake '.?submodules=1' popd From 9b0d399206b8d3e543298ac0703e2d4ac5abbe2d Mon Sep 17 00:00:00 2001 From: Geometer1729 <16kuhnb@gmail.com> Date: Tue, 26 Nov 2024 17:24:06 -0500 Subject: [PATCH 10/29] only use mina commit in app --- flake.lock | 484 +-------------------------------------------------- flake.nix | 11 +- pin.sh | 1 - src/bindings | 2 +- 4 files changed, 8 insertions(+), 490 deletions(-) diff --git a/flake.lock b/flake.lock index 189851c78..9b7d4e5d7 100644 --- a/flake.lock +++ b/flake.lock @@ -48,31 +48,6 @@ "type": "github" } }, - "describe-dune_3": { - "inputs": { - "flake-utils": [ - "mina-rev", - "utils" - ], - "nixpkgs": [ - "mina-rev", - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1724407960, - "narHash": "sha256-pUKTVMYEtsD1AGlHFTdPourowt+tJ3htKhRu7VALFzc=", - "owner": "o1-labs", - "repo": "describe-dune", - "rev": "be828239c05671209e979f9d5c2e3094e3be7a46", - "type": "github" - }, - "original": { - "owner": "o1-labs", - "repo": "describe-dune", - "type": "github" - } - }, "dune-nix": { "inputs": { "flake-utils": [ @@ -121,31 +96,6 @@ "type": "github" } }, - "dune-nix_3": { - "inputs": { - "flake-utils": [ - "mina-rev", - "utils" - ], - "nixpkgs": [ - "mina-rev", - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1724418497, - "narHash": "sha256-HjTh7o02QhGXmbxmpE5HRWei3H/pyh/NKCMCnucDaYs=", - "owner": "o1-labs", - "repo": "dune-nix", - "rev": "26dc164a4c3976888e13eabd73a210b78505820f", - "type": "github" - }, - "original": { - "owner": "o1-labs", - "repo": "dune-nix", - "type": "github" - } - }, "flake-buildkite-pipeline": { "inputs": { "nixpkgs-lib": "nixpkgs-lib" @@ -164,24 +114,6 @@ "type": "github" } }, - "flake-buildkite-pipeline_2": { - "inputs": { - "nixpkgs-lib": "nixpkgs-lib_2" - }, - "locked": { - "lastModified": 1665561509, - "narHash": "sha256-+9KQw0ftpNjezYwbUIcLAvDWekuGSBAs8I2XulcUkT4=", - "owner": "tweag", - "repo": "flake-buildkite-pipeline", - "rev": "c836a5a449973dd04a80f6741863ceb43ec414c9", - "type": "github" - }, - "original": { - "owner": "tweag", - "repo": "flake-buildkite-pipeline", - "type": "github" - } - }, "flake-compat": { "flake": false, "locked": { @@ -214,38 +146,6 @@ "type": "github" } }, - "flake-compat_3": { - "flake": false, - "locked": { - "lastModified": 1668681692, - "narHash": "sha256-Ht91NGdewz8IQLtWZ9LCeNXMSXHUss+9COoqu6JLmXU=", - "owner": "edolstra", - "repo": "flake-compat", - "rev": "009399224d5e398d03b22badca40a37ac85412a1", - "type": "github" - }, - "original": { - "owner": "edolstra", - "repo": "flake-compat", - "type": "github" - } - }, - "flake-compat_4": { - "flake": false, - "locked": { - "lastModified": 1627913399, - "narHash": "sha256-hY8g6H2KFL8ownSiFeMOjwPC8P0ueXpCVEbxgda3pko=", - "owner": "edolstra", - "repo": "flake-compat", - "rev": "12c64ca55c1014cdc1b16ed5a804aa8576601ff2", - "type": "github" - }, - "original": { - "owner": "edolstra", - "repo": "flake-compat", - "type": "github" - } - }, "flake-utils": { "inputs": { "systems": "systems" @@ -309,51 +209,6 @@ "type": "github" } }, - "flake-utils_5": { - "locked": { - "lastModified": 1623875721, - "narHash": "sha256-A8BU7bjS5GirpAUv4QA+QnJ4CceLHkcXdRp4xITDB0s=", - "owner": "numtide", - "repo": "flake-utils", - "rev": "f7e004a55b120c02ecb6219596820fcd32ca8772", - "type": "github" - }, - "original": { - "owner": "numtide", - "repo": "flake-utils", - "type": "github" - } - }, - "flake-utils_6": { - "locked": { - "lastModified": 1638122382, - "narHash": "sha256-sQzZzAbvKEqN9s0bzWuYmRaA03v40gaJ4+iL1LXjaeI=", - "owner": "numtide", - "repo": "flake-utils", - "rev": "74f7e4319258e287b0f9cb95426c9853b282730b", - "type": "github" - }, - "original": { - "owner": "numtide", - "repo": "flake-utils", - "type": "github" - } - }, - "flake-utils_7": { - "locked": { - "lastModified": 1644229661, - "narHash": "sha256-1YdnJAsNy69bpcjuoKdOYQX0YxZBiCYZo4Twxerqv7k=", - "owner": "numtide", - "repo": "flake-utils", - "rev": "3cecb5b042f7f209c56ffd8371b2711a290ec797", - "type": "github" - }, - "original": { - "owner": "numtide", - "repo": "flake-utils", - "type": "github" - } - }, "flockenzeit": { "locked": { "lastModified": 1671184471, @@ -369,21 +224,6 @@ "type": "github" } }, - "flockenzeit_2": { - "locked": { - "lastModified": 1671184471, - "narHash": "sha256-oTsIo40BxHG8ZcMNwJybV68F8CLNdfY9HKFzEBzeJ6A=", - "owner": "balsoft", - "repo": "Flockenzeit", - "rev": "0409dcd0cc87feebd211c529171d61b89f10d9b3", - "type": "github" - }, - "original": { - "owner": "balsoft", - "repo": "Flockenzeit", - "type": "github" - } - }, "gitignore-nix": { "inputs": { "nixpkgs": [ @@ -405,27 +245,6 @@ "type": "github" } }, - "gitignore-nix_2": { - "inputs": { - "nixpkgs": [ - "mina-rev", - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1660459072, - "narHash": "sha256-8DFJjXG8zqoONA1vXtgeKXy68KdJL5UaXR8NtVMUbx8=", - "owner": "hercules-ci", - "repo": "gitignore.nix", - "rev": "a20de23b925fd8264fd7fad6454652e142fd7f73", - "type": "github" - }, - "original": { - "owner": "hercules-ci", - "repo": "gitignore.nix", - "type": "github" - } - }, "mina": { "inputs": { "describe-dune": "describe-dune_2", @@ -456,38 +275,6 @@ "type": "path" } }, - "mina-rev": { - "inputs": { - "describe-dune": "describe-dune_3", - "dune-nix": "dune-nix_3", - "flake-buildkite-pipeline": "flake-buildkite-pipeline_2", - "flake-compat": "flake-compat_3", - "flockenzeit": "flockenzeit_2", - "gitignore-nix": "gitignore-nix_2", - "mix-to-nix": "mix-to-nix_2", - "nix-filter": "nix-filter_2", - "nix-npm-buildPackage": "nix-npm-buildPackage_2", - "nix-utils": "nix-utils_2", - "nixpkgs": "nixpkgs_4", - "nixpkgs-mozilla": "nixpkgs-mozilla_2", - "o1-opam-repository": "o1-opam-repository_2", - "opam-nix": "opam-nix_2", - "opam-repository": "opam-repository_2", - "utils": "utils_2" - }, - "locked": { - "lastModified": 1729507624, - "narHash": "sha256-DudL1W06R1K0HYyetAVZSzao5B5fjS/rS6cMfCBhiqE=", - "rev": "6899054b745c1323b9d5bcaa62c00bed2ad1ead3", - "revCount": 32900, - "type": "git", - "url": "file:src/mina" - }, - "original": { - "type": "git", - "url": "file:src/mina" - } - }, "mirage-opam-overlays": { "flake": false, "locked": { @@ -504,22 +291,6 @@ "type": "github" } }, - "mirage-opam-overlays_2": { - "flake": false, - "locked": { - "lastModified": 1661959605, - "narHash": "sha256-CPTuhYML3F4J58flfp3ZbMNhkRkVFKmBEYBZY5tnQwA=", - "owner": "dune-universe", - "repo": "mirage-opam-overlays", - "rev": "05f1c1823d891ce4d8adab91f5db3ac51d86dc0b", - "type": "github" - }, - "original": { - "owner": "dune-universe", - "repo": "mirage-opam-overlays", - "type": "github" - } - }, "mix-to-nix": { "locked": { "lastModified": 1643291492, @@ -535,21 +306,6 @@ "type": "github" } }, - "mix-to-nix_2": { - "locked": { - "lastModified": 1643291492, - "narHash": "sha256-B+VIFF8qDJhF5hVMc8PbY/WPzUtbGgjsV1eAxTt5GuQ=", - "owner": "serokell", - "repo": "mix-to-nix", - "rev": "f6f0172b3ac4d32c0e6050a7d805734de0b7adef", - "type": "github" - }, - "original": { - "owner": "serokell", - "repo": "mix-to-nix", - "type": "github" - } - }, "nix-filter": { "locked": { "lastModified": 1666547822, @@ -565,21 +321,6 @@ "type": "github" } }, - "nix-filter_2": { - "locked": { - "lastModified": 1666547822, - "narHash": "sha256-razwnAybPHyoAyhkKCwXdxihIqJi1G6e1XP4FQOJTEs=", - "owner": "numtide", - "repo": "nix-filter", - "rev": "1a3b735e13e90a8d2fd5629f2f8363bd7ffbbec7", - "type": "github" - }, - "original": { - "owner": "numtide", - "repo": "nix-filter", - "type": "github" - } - }, "nix-npm-buildPackage": { "inputs": { "nixpkgs": [ @@ -601,27 +342,6 @@ "type": "github" } }, - "nix-npm-buildPackage_2": { - "inputs": { - "nixpkgs": [ - "mina-rev", - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1670813451, - "narHash": "sha256-v0IvQ35CMKtPreGlxWb1FvFUraJNZd144+MbiDwGoAA=", - "owner": "serokell", - "repo": "nix-npm-buildpackage", - "rev": "ec0365cd14a3359a23b80a9e2531a09afc3488fc", - "type": "github" - }, - "original": { - "owner": "serokell", - "repo": "nix-npm-buildpackage", - "type": "github" - } - }, "nix-utils": { "inputs": { "flake-utils": "flake-utils_2", @@ -641,25 +361,6 @@ "type": "github" } }, - "nix-utils_2": { - "inputs": { - "flake-utils": "flake-utils_5", - "nixpkgs": "nixpkgs_3" - }, - "locked": { - "lastModified": 1632973430, - "narHash": "sha256-9G8zo+0nfYAALV5umCyQR/2hVUFNH10JropBkyxZGGw=", - "owner": "juliosueiras-nix", - "repo": "nix-utils", - "rev": "b44e1ffd726aa03056db9df469efb497d8b9871b", - "type": "github" - }, - "original": { - "owner": "juliosueiras-nix", - "repo": "nix-utils", - "type": "github" - } - }, "nixpkgs": { "locked": { "lastModified": 1629252929, @@ -690,21 +391,6 @@ "type": "github" } }, - "nixpkgs-lib_2": { - "locked": { - "lastModified": 1649551420, - "narHash": "sha256-J/Pn38rBZTszdtTHhhxroQaHADhd5TgbJ53F9j1WTIE=", - "owner": "nix-community", - "repo": "nixpkgs.lib", - "rev": "3a16841c57b0d3025b21b869cc921a119ce73033", - "type": "github" - }, - "original": { - "owner": "nix-community", - "repo": "nixpkgs.lib", - "type": "github" - } - }, "nixpkgs-mozilla": { "flake": false, "locked": { @@ -737,22 +423,6 @@ "type": "github" } }, - "nixpkgs-mozilla_3": { - "flake": false, - "locked": { - "lastModified": 1704373101, - "narHash": "sha256-+gi59LRWRQmwROrmE1E2b3mtocwueCQqZ60CwLG+gbg=", - "owner": "mozilla", - "repo": "nixpkgs-mozilla", - "rev": "9b11a87c0cc54e308fa83aac5b4ee1816d5418a2", - "type": "github" - }, - "original": { - "owner": "mozilla", - "repo": "nixpkgs-mozilla", - "type": "github" - } - }, "nixpkgs_2": { "locked": { "lastModified": 1713180868, @@ -770,37 +440,6 @@ } }, "nixpkgs_3": { - "locked": { - "lastModified": 1629252929, - "narHash": "sha256-Aj20gmGBs8TG7pyaQqgbsqAQ6cB+TVuL18Pk3DPBxcQ=", - "owner": "nixos", - "repo": "nixpkgs", - "rev": "3788c68def67ca7949e0864c27638d484389363d", - "type": "github" - }, - "original": { - "owner": "nixos", - "repo": "nixpkgs", - "type": "github" - } - }, - "nixpkgs_4": { - "locked": { - "lastModified": 1713180868, - "narHash": "sha256-5CSnPSCEWeUmrFiLuYIQIPQzPrpCB8x3VhE+oXLRO3k=", - "owner": "nixos", - "repo": "nixpkgs", - "rev": "140546acf30a8212a03a88ded8506413fa3b5d21", - "type": "github" - }, - "original": { - "owner": "nixos", - "ref": "nixos-23.11-small", - "repo": "nixpkgs", - "type": "github" - } - }, - "nixpkgs_5": { "locked": { "lastModified": 1720535198, "narHash": "sha256-zwVvxrdIzralnSbcpghA92tWu2DV2lwv89xZc8MTrbg=", @@ -832,22 +471,6 @@ "type": "github" } }, - "o1-opam-repository_2": { - "flake": false, - "locked": { - "lastModified": 1715294616, - "narHash": "sha256-W2p9Vs8PqpKGvMByxVqpxAljjpEMqNcuNnjMBAAKicI=", - "owner": "o1-labs", - "repo": "opam-repository", - "rev": "38d6995e307c82b3c0b3bc86a867213db724d1c5", - "type": "github" - }, - "original": { - "owner": "o1-labs", - "repo": "opam-repository", - "type": "github" - } - }, "opam-nix": { "inputs": { "flake-compat": "flake-compat_2", @@ -878,36 +501,6 @@ "type": "github" } }, - "opam-nix_2": { - "inputs": { - "flake-compat": "flake-compat_4", - "flake-utils": "flake-utils_6", - "mirage-opam-overlays": "mirage-opam-overlays_2", - "nixpkgs": [ - "mina-rev", - "nixpkgs" - ], - "opam-overlays": "opam-overlays_2", - "opam-repository": [ - "mina-rev", - "opam-repository" - ], - "opam2json": "opam2json_2" - }, - "locked": { - "lastModified": 1712645768, - "narHash": "sha256-9dUh8nElGtC74Q4gIDV6DM0FKgF1oXh0PUkCxdbp+sg=", - "owner": "tweag", - "repo": "opam-nix", - "rev": "464863fba44c7ecc50bd1a2967274482a2c33daf", - "type": "github" - }, - "original": { - "owner": "tweag", - "repo": "opam-nix", - "type": "github" - } - }, "opam-overlays": { "flake": false, "locked": { @@ -924,22 +517,6 @@ "type": "github" } }, - "opam-overlays_2": { - "flake": false, - "locked": { - "lastModified": 1654162756, - "narHash": "sha256-RV68fUK+O3zTx61iiHIoS0LvIk0E4voMp+0SwRg6G6c=", - "owner": "dune-universe", - "repo": "opam-overlays", - "rev": "c8f6ef0fc5272f254df4a971a47de7848cc1c8a4", - "type": "github" - }, - "original": { - "owner": "dune-universe", - "repo": "opam-overlays", - "type": "github" - } - }, "opam-repository": { "flake": false, "locked": { @@ -956,22 +533,6 @@ "type": "github" } }, - "opam-repository_2": { - "flake": false, - "locked": { - "lastModified": 1708601497, - "narHash": "sha256-mDYINTjOiYLN4wT5fGlWTvHFQdWkzY46XUuZWKgmJxY=", - "owner": "ocaml", - "repo": "opam-repository", - "rev": "90d8c520a4f0b035ac51e267a8b33739c5a78b5a", - "type": "github" - }, - "original": { - "owner": "ocaml", - "repo": "opam-repository", - "type": "github" - } - }, "opam2json": { "inputs": { "nixpkgs": [ @@ -994,37 +555,14 @@ "type": "github" } }, - "opam2json_2": { - "inputs": { - "nixpkgs": [ - "mina-rev", - "opam-nix", - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1671540003, - "narHash": "sha256-5pXfbUfpVABtKbii6aaI2EdAZTjHJ2QntEf0QD2O5AM=", - "owner": "tweag", - "repo": "opam2json", - "rev": "819d291ea95e271b0e6027679de6abb4d4f7f680", - "type": "github" - }, - "original": { - "owner": "tweag", - "repo": "opam2json", - "type": "github" - } - }, "root": { "inputs": { "describe-dune": "describe-dune", "dune-nix": "dune-nix", "flake-utils": "flake-utils", "mina": "mina", - "mina-rev": "mina-rev", - "nixpkgs": "nixpkgs_5", - "nixpkgs-mozilla": "nixpkgs-mozilla_3" + "nixpkgs": "nixpkgs_3", + "nixpkgs-mozilla": "nixpkgs-mozilla_2" } }, "systems": { @@ -1059,24 +597,6 @@ "repo": "flake-utils-plus", "type": "github" } - }, - "utils_2": { - "inputs": { - "flake-utils": "flake-utils_7" - }, - "locked": { - "lastModified": 1657226504, - "narHash": "sha256-GIYNjuq4mJlFgqKsZ+YrgzWm0IpA4axA3MCrdKYj7gs=", - "owner": "gytis-ivaskevicius", - "repo": "flake-utils-plus", - "rev": "2bf0f91643c2e5ae38c1b26893ac2927ac9bd82a", - "type": "github" - }, - "original": { - "owner": "gytis-ivaskevicius", - "repo": "flake-utils-plus", - "type": "github" - } } }, "root": "root", diff --git a/flake.nix b/flake.nix index 007158f4d..40ccdfe2e 100644 --- a/flake.nix +++ b/flake.nix @@ -3,10 +3,6 @@ inputs = { nixpkgs.url = "github:nixos/nixpkgs/nixos-23.11-small"; mina.url = "path:src/mina"; - # Nix doesn't seem to handle recursive submodules well - # so we import mina once not as a git repo so the submodules work - # but also as a git repo so the git rev is visible - mina-rev.url = "git+file:src/mina"; nixpkgs-mozilla.url = "github:mozilla/nixpkgs-mozilla"; nixpkgs-mozilla.flake = false; describe-dune.url = "github:o1-labs/describe-dune"; @@ -227,7 +223,7 @@ "${mina.files.src-lib-crypto-kimchi_bindings-js-node_js}/src/lib/crypto/kimchi_bindings/js/node_js"; EXPORT_TEST_VECTORS = "${test-vectors}/bin/export_test_vectors"; buildInputs = bindings-pkgs ++ [ pkgs.bash ]; - MINA_COMMIT = inputs.mina-rev.rev; + SKIP_MINA_COMMIT = true; patchPhase = '' patchShebangs ./src/bindings/scripts/ patchShebangs ./src/bindings/crypto/test-vectors/ @@ -243,7 +239,7 @@ mkdir $out pushd ./src/bindings rm -rf ./compiled/_node_bindings - cp -Lr ./compiled ./mina-transaction ./ocaml ./MINA_COMMIT $out + cp -Lr ./compiled ./mina-transaction ./ocaml $out popd ''; }; @@ -258,6 +254,9 @@ text = '' cp -r ${self.packages."${system}".o1js-bindings}/* ./src/bindings + MINA_COMMIT=$(git -C src/mina rev-parse HEAD) + echo "The mina commit used to generate the backends for node and web is" "$MINA_COMMIT" \ + > src/bindings/MINA_COMMIT ''; }}/bin/update-bindings"; }; diff --git a/pin.sh b/pin.sh index 4641ccc40..e56e8e442 100755 --- a/pin.sh +++ b/pin.sh @@ -11,5 +11,4 @@ nix registry add o1js "git+file://$ROOT?submodules=1" # update mina input to local submodule # --override-input seems redundant but fixes a cacheing issue with local paths nix flake update mina --override-input mina 'path:src/mina' --flake '.?submodules=1' -nix flake update mina-rev --override-input mina-rev 'git+file:src/mina' --flake '.?submodules=1' popd diff --git a/src/bindings b/src/bindings index 9d3472511..69299e08d 160000 --- a/src/bindings +++ b/src/bindings @@ -1 +1 @@ -Subproject commit 9d347251170b7521c393e8220b246ec063a10630 +Subproject commit 69299e08deefe3bd2381bfe5d9eafa183e904a15 From 98a60946fb6ebc9e5c0ff9279f1af2483eddb86a Mon Sep 17 00:00:00 2001 From: Geometer1729 <16kuhnb@gmail.com> Date: Mon, 2 Dec 2024 17:42:37 -0500 Subject: [PATCH 11/29] fixes in bindings derivation --- flake.nix | 36 +++++++++++++++++++++++++++++++++--- src/bindings | 2 +- 2 files changed, 34 insertions(+), 4 deletions(-) diff --git a/flake.nix b/flake.nix index 40ccdfe2e..cce269049 100644 --- a/flake.nix +++ b/flake.nix @@ -211,7 +211,30 @@ inherit dune-description; o1js-bindings = pkgs.stdenv.mkDerivation { name = "o1js_bindings"; - src = ./.; + src = with pkgs.lib.fileset; + (toSource { + root = ./.; + fileset = unions [ + ./src/mina + ./src/bindings/scripts + ./src/bindings/js + ./src/bindings/crypto + ./src/bindings/lib + ./src/bindings/mina-transaction/gen/dune + (fileFilter (file: file.hasExt "js") ./src/bindings/mina-transaction) + ./src/bindings/ocaml/lib + ./src/bindings/ocaml/dune + ./src/bindings/ocaml/dune-project + (fileFilter (file: file.hasExt "ml") ./src/bindings/ocaml) + ./package.json + ./package-lock.json + ./src/bindings/ocaml/jsoo_exports + ./dune-project + ./.prettierrc.cjs + ./src/build + ./src/snarky.d.ts + ]; + }); inherit (inputs.mina.devShells."${system}".default) PLONK_WASM_NODEJS PLONK_WASM_WEB @@ -224,6 +247,7 @@ EXPORT_TEST_VECTORS = "${test-vectors}/bin/export_test_vectors"; buildInputs = bindings-pkgs ++ [ pkgs.bash ]; SKIP_MINA_COMMIT = true; + JUST_BINDINGS = true; patchPhase = '' patchShebangs ./src/bindings/scripts/ patchShebangs ./src/bindings/crypto/test-vectors/ @@ -235,11 +259,17 @@ rustup toolchain link nix ${rust-channel} cp -r ${o1js-npm-deps}/lib/node_modules/ . + 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 + npm run build:update-bindings - mkdir $out + + mkdir -p $out/mina-transaction pushd ./src/bindings rm -rf ./compiled/_node_bindings - cp -Lr ./compiled ./mina-transaction ./ocaml $out + cp -Lr ./compiled $out + cp -Lr ./mina-transaction/gen $out/mina-transaction/ popd ''; }; diff --git a/src/bindings b/src/bindings index 69299e08d..74936c969 160000 --- a/src/bindings +++ b/src/bindings @@ -1 +1 @@ -Subproject commit 69299e08deefe3bd2381bfe5d9eafa183e904a15 +Subproject commit 74936c9693549153b8ec16b3f72907cf148311a0 From 6a305a3511da30a854a2b8e3348dbf44ab424607 Mon Sep 17 00:00:00 2001 From: Geometer1729 <16kuhnb@gmail.com> Date: Mon, 2 Dec 2024 20:21:26 -0500 Subject: [PATCH 12/29] add check that the bindings are the same --- .github/workflows/build-bindings.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/build-bindings.yml b/.github/workflows/build-bindings.yml index 63c360c27..75002fb8e 100644 --- a/.github/workflows/build-bindings.yml +++ b/.github/workflows/build-bindings.yml @@ -28,6 +28,8 @@ jobs: set -Eeu ./pin.sh nix run o1js#update-bindings + #fail if this changes any files + git -C src/bindings diff-index --exit-code HEAD - name: Cleanup the Nix store run: | nix-env --delete-generations old From d269cea2293a401935a26076a1ba451b1a537191 Mon Sep 17 00:00:00 2001 From: Geometer1729 <16kuhnb@gmail.com> Date: Mon, 2 Dec 2024 22:23:07 -0500 Subject: [PATCH 13/29] better error message when bindings differ --- .github/workflows/build-bindings.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build-bindings.yml b/.github/workflows/build-bindings.yml index 75002fb8e..66999dd93 100644 --- a/.github/workflows/build-bindings.yml +++ b/.github/workflows/build-bindings.yml @@ -29,7 +29,8 @@ jobs: ./pin.sh nix run o1js#update-bindings #fail if this changes any files - git -C src/bindings diff-index --exit-code HEAD + cd src/bindings + git diff-index --exit-code HEAD || (git submodule foreach git diff && exit 1) - name: Cleanup the Nix store run: | nix-env --delete-generations old From 8efce38e6c5b56950240c799fd5f028bba44055c Mon Sep 17 00:00:00 2001 From: Geometer1729 <16kuhnb@gmail.com> Date: Tue, 3 Dec 2024 13:18:02 -0500 Subject: [PATCH 14/29] try setting max-jobs --- .github/workflows/build-bindings.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-bindings.yml b/.github/workflows/build-bindings.yml index 66999dd93..655909214 100644 --- a/.github/workflows/build-bindings.yml +++ b/.github/workflows/build-bindings.yml @@ -27,7 +27,7 @@ jobs: run: | set -Eeu ./pin.sh - nix run o1js#update-bindings + nix run o1js#update-bindings --max-jobs 4 #fail if this changes any files cd src/bindings git diff-index --exit-code HEAD || (git submodule foreach git diff && exit 1) From 4a735cf42be01e4f5d46ce4f527a6a5d1c40be81 Mon Sep 17 00:00:00 2001 From: Geometer1729 <16kuhnb@gmail.com> Date: Tue, 3 Dec 2024 16:14:46 -0500 Subject: [PATCH 15/29] fix diff check I think --- .github/workflows/build-bindings.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-bindings.yml b/.github/workflows/build-bindings.yml index 655909214..73d266156 100644 --- a/.github/workflows/build-bindings.yml +++ b/.github/workflows/build-bindings.yml @@ -30,7 +30,7 @@ jobs: nix run o1js#update-bindings --max-jobs 4 #fail if this changes any files cd src/bindings - git diff-index --exit-code HEAD || (git submodule foreach git diff && exit 1) + git diff --exit-code - name: Cleanup the Nix store run: | nix-env --delete-generations old From f0f2440ec2e9145e45325ad08ac536f0fee54bc4 Mon Sep 17 00:00:00 2001 From: Geometer1729 <16kuhnb@gmail.com> Date: Tue, 3 Dec 2024 16:34:33 -0500 Subject: [PATCH 16/29] update mina without rebuilding bindings --- src/bindings | 2 +- src/mina | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/bindings b/src/bindings index 74936c969..fec4c019e 160000 --- a/src/bindings +++ b/src/bindings @@ -1 +1 @@ -Subproject commit 74936c9693549153b8ec16b3f72907cf148311a0 +Subproject commit fec4c019ef178e570482e72ee8b1a5530b81c3ff diff --git a/src/mina b/src/mina index 6899054b7..f820d28f0 160000 --- a/src/mina +++ b/src/mina @@ -1 +1 @@ -Subproject commit 6899054b745c1323b9d5bcaa62c00bed2ad1ead3 +Subproject commit f820d28f011f709af564aec5d93db07c761a948c From 74b9fe8e6bb0d0c91f32227320bc415034f985de Mon Sep 17 00:00:00 2001 From: Geometer1729 <16kuhnb@gmail.com> Date: Wed, 4 Dec 2024 09:55:55 -0500 Subject: [PATCH 17/29] update bindings --- flake.lock | 4 ++-- src/bindings | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/flake.lock b/flake.lock index 9b7d4e5d7..8212b48e9 100644 --- a/flake.lock +++ b/flake.lock @@ -265,8 +265,8 @@ "utils": "utils" }, "locked": { - "lastModified": 1732222139, - "narHash": "sha256-4LLy5VMM5TK4LpQXEBiA8ziwYyqGx2ZAuunXGCDpraQ=", + "lastModified": 1733261591, + "narHash": "sha256-1gbcNmug8xmcWM6QEUA3BkgSVWIpjAiT8SouiEu6gQg=", "path": "src/mina", "type": "path" }, diff --git a/src/bindings b/src/bindings index fec4c019e..bd373a595 160000 --- a/src/bindings +++ b/src/bindings @@ -1 +1 @@ -Subproject commit fec4c019ef178e570482e72ee8b1a5530b81c3ff +Subproject commit bd373a5955072dbad12069dd21bbf8e6a7fad7e4 From 79cc40fa698d08aaa99397542cb286b90c5e35cf Mon Sep 17 00:00:00 2001 From: Geometer1729 <16kuhnb@gmail.com> Date: Wed, 4 Dec 2024 10:49:29 -0500 Subject: [PATCH 18/29] merge bindings --- src/bindings | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/bindings b/src/bindings index bd373a595..51f5e4dc0 160000 --- a/src/bindings +++ b/src/bindings @@ -1 +1 @@ -Subproject commit bd373a5955072dbad12069dd21bbf8e6a7fad7e4 +Subproject commit 51f5e4dc04acafe6ac2f127ae1d1701369587671 From 8738e65defc75f5543db635f9c0c1f84e7ee0e00 Mon Sep 17 00:00:00 2001 From: Geometer1729 <16kuhnb@gmail.com> Date: Wed, 4 Dec 2024 11:59:20 -0500 Subject: [PATCH 19/29] add gc root when on main --- .github/workflows/build-bindings.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-bindings.yml b/.github/workflows/build-bindings.yml index 73d266156..2c2408411 100644 --- a/.github/workflows/build-bindings.yml +++ b/.github/workflows/build-bindings.yml @@ -31,9 +31,11 @@ jobs: #fail if this changes any files cd src/bindings git diff --exit-code + - name: add build to gc-root if on main + if: github.ref == 'refs/heads/main' + run: | + nix build o1js#o1js-bindings --out-link /var/o1js-bindings-gcroot - name: Cleanup the Nix store run: | - nix-env --delete-generations old - nix-collect-garbage -d --quiet nix-store --gc --print-dead nix-store --optimise From dfe49095ec46d95890e2f963fe33a8203281c21f Mon Sep 17 00:00:00 2001 From: Geometer1729 <16kuhnb@gmail.com> Date: Wed, 4 Dec 2024 12:41:37 -0500 Subject: [PATCH 20/29] test gc-root --- .github/workflows/build-bindings.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-bindings.yml b/.github/workflows/build-bindings.yml index 2c2408411..d1c9d5a89 100644 --- a/.github/workflows/build-bindings.yml +++ b/.github/workflows/build-bindings.yml @@ -32,9 +32,10 @@ jobs: cd src/bindings git diff --exit-code - name: add build to gc-root if on main - if: github.ref == 'refs/heads/main' + # enabeling on this branch for 1 commit to test it + #if: github.ref == 'refs/heads/main' run: | - nix build o1js#o1js-bindings --out-link /var/o1js-bindings-gcroot + nix build o1js#o1js-bindings --out-link /home/app/actions-runner/nix-cache/main-bindings-gcroot - name: Cleanup the Nix store run: | nix-store --gc --print-dead From 70ca77d7c0a63acf84557c34784fc1c8391ca34f Mon Sep 17 00:00:00 2001 From: Geometer1729 <16kuhnb@gmail.com> Date: Wed, 4 Dec 2024 18:35:05 -0500 Subject: [PATCH 21/29] back gc-root only for main --- .github/workflows/build-bindings.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-bindings.yml b/.github/workflows/build-bindings.yml index d1c9d5a89..f5d92f838 100644 --- a/.github/workflows/build-bindings.yml +++ b/.github/workflows/build-bindings.yml @@ -33,7 +33,7 @@ jobs: git diff --exit-code - name: add build to gc-root if on main # enabeling on this branch for 1 commit to test it - #if: github.ref == 'refs/heads/main' + if: github.ref == 'refs/heads/main' run: | nix build o1js#o1js-bindings --out-link /home/app/actions-runner/nix-cache/main-bindings-gcroot - name: Cleanup the Nix store From 96a17d77e688e9d8675f9e0fbc60fdbd958d8d62 Mon Sep 17 00:00:00 2001 From: Geometer1729 <16kuhnb@gmail.com> Date: Thu, 5 Dec 2024 13:35:44 -0500 Subject: [PATCH 22/29] update mina --- flake.lock | 4 ++-- src/bindings | 2 +- src/mina | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/flake.lock b/flake.lock index 8212b48e9..97819c650 100644 --- a/flake.lock +++ b/flake.lock @@ -265,8 +265,8 @@ "utils": "utils" }, "locked": { - "lastModified": 1733261591, - "narHash": "sha256-1gbcNmug8xmcWM6QEUA3BkgSVWIpjAiT8SouiEu6gQg=", + "lastModified": 1733421256, + "narHash": "sha256-X7sT6cQ7X2V5A/Q8FOnc0pDP24gca/FOMszeWRiC2mM=", "path": "src/mina", "type": "path" }, diff --git a/src/bindings b/src/bindings index 51f5e4dc0..68f63f577 160000 --- a/src/bindings +++ b/src/bindings @@ -1 +1 @@ -Subproject commit 51f5e4dc04acafe6ac2f127ae1d1701369587671 +Subproject commit 68f63f577a4673fdf1f47796330df329ffbafc0e diff --git a/src/mina b/src/mina index f820d28f0..a8ddeab40 160000 --- a/src/mina +++ b/src/mina @@ -1 +1 @@ -Subproject commit f820d28f011f709af564aec5d93db07c761a948c +Subproject commit a8ddeab40adf1412b98aec78508d1df38821c6bc From 7842a518e409ac5fc024a2ba0dd23f00f87f984f Mon Sep 17 00:00:00 2001 From: Geometer1729 <16kuhnb@gmail.com> Date: Thu, 5 Dec 2024 13:53:02 -0500 Subject: [PATCH 23/29] update bindings --- src/bindings | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/bindings b/src/bindings index 68f63f577..8afb48017 160000 --- a/src/bindings +++ b/src/bindings @@ -1 +1 @@ -Subproject commit 68f63f577a4673fdf1f47796330df329ffbafc0e +Subproject commit 8afb4801776db2bb58487e75b7586af01731e589 From c9857cc508241364a6387d7d5a2f4266b540b089 Mon Sep 17 00:00:00 2001 From: Geometer1729 <16kuhnb@gmail.com> Date: Thu, 5 Dec 2024 14:35:29 -0500 Subject: [PATCH 24/29] update+rebuild upgrade mina --- flake.lock | 4 ++-- src/bindings | 2 +- src/mina | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/flake.lock b/flake.lock index 97819c650..565e258b4 100644 --- a/flake.lock +++ b/flake.lock @@ -265,8 +265,8 @@ "utils": "utils" }, "locked": { - "lastModified": 1733421256, - "narHash": "sha256-X7sT6cQ7X2V5A/Q8FOnc0pDP24gca/FOMszeWRiC2mM=", + "lastModified": 1733427826, + "narHash": "sha256-geJjdLW0yIjrYdgTECVWx4yDuFA6/4YDqncVQQ5e1ac=", "path": "src/mina", "type": "path" }, diff --git a/src/bindings b/src/bindings index 8afb48017..dcea53ebf 160000 --- a/src/bindings +++ b/src/bindings @@ -1 +1 @@ -Subproject commit 8afb4801776db2bb58487e75b7586af01731e589 +Subproject commit dcea53ebf14770f5b5c0f57ed074fff9ce0a54b2 diff --git a/src/mina b/src/mina index a8ddeab40..b6f5f579c 160000 --- a/src/mina +++ b/src/mina @@ -1 +1 @@ -Subproject commit a8ddeab40adf1412b98aec78508d1df38821c6bc +Subproject commit b6f5f579c78bd9b4b6ab44b666a9183f74a360fa From 104387393657ce04787b8278d2f2467ebb54365b Mon Sep 17 00:00:00 2001 From: Geometer1729 <16kuhnb@gmail.com> Date: Thu, 5 Dec 2024 15:30:26 -0500 Subject: [PATCH 25/29] downgrade mina --- flake.lock | 4 ++-- src/bindings | 2 +- src/mina | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/flake.lock b/flake.lock index 565e258b4..49061b354 100644 --- a/flake.lock +++ b/flake.lock @@ -265,8 +265,8 @@ "utils": "utils" }, "locked": { - "lastModified": 1733427826, - "narHash": "sha256-geJjdLW0yIjrYdgTECVWx4yDuFA6/4YDqncVQQ5e1ac=", + "lastModified": 1733429866, + "narHash": "sha256-/ZEGYdZ2hLjBwdEzG/BIjlDehOjuGWmBqzD55nXfZoY=", "path": "src/mina", "type": "path" }, diff --git a/src/bindings b/src/bindings index dcea53ebf..181985212 160000 --- a/src/bindings +++ b/src/bindings @@ -1 +1 @@ -Subproject commit dcea53ebf14770f5b5c0f57ed074fff9ce0a54b2 +Subproject commit 181985212cd11d0f514a64f83d88490103e63d07 diff --git a/src/mina b/src/mina index b6f5f579c..6899054b7 160000 --- a/src/mina +++ b/src/mina @@ -1 +1 @@ -Subproject commit b6f5f579c78bd9b4b6ab44b666a9183f74a360fa +Subproject commit 6899054b745c1323b9d5bcaa62c00bed2ad1ead3 From 6e62e5d9ef181a6c0eae512dd61e1f88a7792e3d Mon Sep 17 00:00:00 2001 From: Geometer1729 <16kuhnb@gmail.com> Date: Wed, 11 Dec 2024 10:14:46 -0500 Subject: [PATCH 26/29] fix permision issue --- flake.nix | 1 + src/bindings | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/flake.nix b/flake.nix index cce269049..06126b807 100644 --- a/flake.nix +++ b/flake.nix @@ -284,6 +284,7 @@ text = '' cp -r ${self.packages."${system}".o1js-bindings}/* ./src/bindings + chmod +w -R src/bindings/compiled MINA_COMMIT=$(git -C src/mina rev-parse HEAD) echo "The mina commit used to generate the backends for node and web is" "$MINA_COMMIT" \ > src/bindings/MINA_COMMIT diff --git a/src/bindings b/src/bindings index 181985212..a5a0883f0 160000 --- a/src/bindings +++ b/src/bindings @@ -1 +1 @@ -Subproject commit 181985212cd11d0f514a64f83d88490103e63d07 +Subproject commit a5a0883f033afd4c9fd4bf96a5e0b8ebd92a87c9 From 504c22263e90f61cf0ae389a13644a827fc71960 Mon Sep 17 00:00:00 2001 From: Geometer1729 <16kuhnb@gmail.com> Date: Wed, 11 Dec 2024 10:32:13 -0500 Subject: [PATCH 27/29] update npmDepsHash --- flake.nix | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/flake.nix b/flake.nix index 06126b807..06b2172fe 100644 --- a/flake.nix +++ b/flake.nix @@ -158,6 +158,15 @@ ./package-lock.json ]; }); + # If you see 'ERROR: npmDepsHash is out of date' in ci + # set this to blank run ``nix build o1js#o1js-bindings` You should get an output like this: + # If you don't want to install nix you can also set it to "" and run ci to get the new hash + + # error: hash mismatch in fixed-output derivation '/nix/store/a03cg2az0b2cvjsp1wnr89clf31i79c1-o1js-npm-deps.drv': + # specified: sha256-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA= + # got: sha256-8EPvXpOgn0nvm/pFKN3h6EMjabOeBqfy5optIfe8E8Q= + # replace npmDepsHash bellow with the new hash + npmDepsHash = "sha256-8EPvXpOgn0nvm/pFKN3h6EMjabOeBqfy5optIfe8E8Q="; # The prepack script runs the build script, which we'd rather do in the build phase. npmPackFlags = [ "--ignore-scripts" ]; From 4e3fc935e6c8ca1797b58ae8cbdd412145f31efc Mon Sep 17 00:00:00 2001 From: Geometer1729 <16kuhnb@gmail.com> Date: Wed, 11 Dec 2024 10:56:08 -0500 Subject: [PATCH 28/29] update npmDepsHash again --- flake.nix | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/flake.nix b/flake.nix index 06b2172fe..cdca7f76a 100644 --- a/flake.nix +++ b/flake.nix @@ -159,15 +159,16 @@ ]; }); # If you see 'ERROR: npmDepsHash is out of date' in ci - # set this to blank run ``nix build o1js#o1js-bindings` You should get an output like this: + # set this to blank run ``nix build o1js#o1js-bindings` # If you don't want to install nix you can also set it to "" and run ci to get the new hash + # You should get an output like this: # error: hash mismatch in fixed-output derivation '/nix/store/a03cg2az0b2cvjsp1wnr89clf31i79c1-o1js-npm-deps.drv': # specified: sha256-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA= # got: sha256-8EPvXpOgn0nvm/pFKN3h6EMjabOeBqfy5optIfe8E8Q= # replace npmDepsHash bellow with the new hash - npmDepsHash = "sha256-8EPvXpOgn0nvm/pFKN3h6EMjabOeBqfy5optIfe8E8Q="; + npmDepsHash = "sha256-QLnSfX6JwYQXyHGNSxXdzqbhkbFl67sDrmlW/F6D/pw="; # The prepack script runs the build script, which we'd rather do in the build phase. npmPackFlags = [ "--ignore-scripts" ]; dontNpmBuild = true; From 20690d1390e510f290f05871ad07575688df1d7a Mon Sep 17 00:00:00 2001 From: Geometer1729 <16kuhnb@gmail.com> Date: Thu, 12 Dec 2024 13:28:38 -0500 Subject: [PATCH 29/29] address Matt's review --- .github/workflows/build-bindings.yml | 1 - flake.nix | 5 ++--- pin.sh | 2 +- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build-bindings.yml b/.github/workflows/build-bindings.yml index f5d92f838..38e8f821e 100644 --- a/.github/workflows/build-bindings.yml +++ b/.github/workflows/build-bindings.yml @@ -32,7 +32,6 @@ jobs: cd src/bindings git diff --exit-code - name: add build to gc-root if on main - # enabeling on this branch for 1 commit to test it if: github.ref == 'refs/heads/main' run: | nix build o1js#o1js-bindings --out-link /home/app/actions-runner/nix-cache/main-bindings-gcroot diff --git a/flake.nix b/flake.nix index cdca7f76a..74f10868a 100644 --- a/flake.nix +++ b/flake.nix @@ -104,10 +104,10 @@ '' if [ "$1" = run ] && { [ "$2" = nightly-2023-09-01 ] || [ "$2" = 1.72-x86_64-unknowl-linux-gnu ]; } then - echo USING NIX TOOLCHAIN + echo using nix toolchain ${rustup}/bin/rustup run nix "''${@:3}" else - echo escape rustup "$@" + echo using plain rustup "$@" ${rustup}/bin/rustup "$@" fi ''; @@ -184,7 +184,6 @@ test-vectors = rust-platform.buildRustPackage { src = pkgs.lib.sourceByRegex ./src/mina/src [ - "^lib(/crypto(/kimchi_bindings(/stubs(/.*)?)?)?)?$" "^lib(/crypto(/proof-systems(/.*)?)?)?$" ]; sourceRoot = "source/lib/crypto/proof-systems/poseidon/export_test_vectors"; diff --git a/pin.sh b/pin.sh index e56e8e442..4007b0d18 100755 --- a/pin.sh +++ b/pin.sh @@ -9,6 +9,6 @@ git submodule sync && git submodule update --init --recursive # Add the flake registry entry nix registry add o1js "git+file://$ROOT?submodules=1" # update mina input to local submodule -# --override-input seems redundant but fixes a cacheing issue with local paths +# --override-input seems redundant but fixes a caching issue with local paths nix flake update mina --override-input mina 'path:src/mina' --flake '.?submodules=1' popd