From 1b6564d5d99f1285cbda0cd9f5edceb38fd40722 Mon Sep 17 00:00:00 2001 From: Geometer1729 <16kuhnb@gmail.com> Date: Wed, 18 Dec 2024 15:12:54 -0500 Subject: [PATCH 01/10] add action to upload a patch when bindings differ --- .github/workflows/build-bindings.yml | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/.github/workflows/build-bindings.yml b/.github/workflows/build-bindings.yml index 38e8f821e..7fd7bf539 100644 --- a/.github/workflows/build-bindings.yml +++ b/.github/workflows/build-bindings.yml @@ -39,3 +39,18 @@ jobs: run: | nix-store --gc --print-dead nix-store --optimise + patch-upload: + needs: nix-build + if: ${{ failure() }} + runs-on: [sdk-self-hosted-linux-amd64-build-system] + steps: + - name: generate patch + run: | + cd src/bindings + git add . + git diff HEAD > bindings.patch + - name: Upload patch + uses: actions/upload-artifact@v4 + with: + name: bindings.patch + path: src/bindings/bindings.patch From dacd84c3ae2d4f6ace913b15bacf54b018acc2fa Mon Sep 17 00:00:00 2001 From: Geometer1729 <16kuhnb@gmail.com> Date: Wed, 18 Dec 2024 15:22:03 -0500 Subject: [PATCH 02/10] add dummy file to bindings to test ci --- src/bindings | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/bindings b/src/bindings index a5a0883f0..59ba4b5e9 160000 --- a/src/bindings +++ b/src/bindings @@ -1 +1 @@ -Subproject commit a5a0883f033afd4c9fd4bf96a5e0b8ebd92a87c9 +Subproject commit 59ba4b5e9d74839d1655c21aca8582a0c68b4bdc From 6be1480d47f6d70cca731345af19529acd788618 Mon Sep 17 00:00:00 2001 From: Geometer1729 <16kuhnb@gmail.com> Date: Wed, 18 Dec 2024 15:36:12 -0500 Subject: [PATCH 03/10] bindings diff that will actually trip ci --- src/bindings | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/bindings b/src/bindings index 59ba4b5e9..1e5c04509 160000 --- a/src/bindings +++ b/src/bindings @@ -1 +1 @@ -Subproject commit 59ba4b5e9d74839d1655c21aca8582a0c68b4bdc +Subproject commit 1e5c0450950627341f14cf1ce5d7213f2bbd0565 From 9b04ffaa0cf0a0874e70cbe5fe2bb93e137a25cd Mon Sep 17 00:00:00 2001 From: Geometer1729 <16kuhnb@gmail.com> Date: Wed, 18 Dec 2024 15:39:25 -0500 Subject: [PATCH 04/10] fix bindings ref --- src/bindings | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/bindings b/src/bindings index 1e5c04509..74ac5f5e0 160000 --- a/src/bindings +++ b/src/bindings @@ -1 +1 @@ -Subproject commit 1e5c0450950627341f14cf1ce5d7213f2bbd0565 +Subproject commit 74ac5f5e055b66a92cf88b6d9970d5103f1dbaaa From 7e99bba3538b072bfdcf8c5d4fe5d6c57a79a234 Mon Sep 17 00:00:00 2001 From: Geometer1729 <16kuhnb@gmail.com> Date: Wed, 18 Dec 2024 15:47:09 -0500 Subject: [PATCH 05/10] change path for patch and apply patch from github --- .github/workflows/build-bindings.yml | 4 ++-- src/bindings | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build-bindings.yml b/.github/workflows/build-bindings.yml index 7fd7bf539..5595c7df9 100644 --- a/.github/workflows/build-bindings.yml +++ b/.github/workflows/build-bindings.yml @@ -48,9 +48,9 @@ jobs: run: | cd src/bindings git add . - git diff HEAD > bindings.patch + git diff HEAD > ../../bindings.patch - name: Upload patch uses: actions/upload-artifact@v4 with: name: bindings.patch - path: src/bindings/bindings.patch + path: bindings.patch diff --git a/src/bindings b/src/bindings index 74ac5f5e0..58e02003f 160000 --- a/src/bindings +++ b/src/bindings @@ -1 +1 @@ -Subproject commit 74ac5f5e055b66a92cf88b6d9970d5103f1dbaaa +Subproject commit 58e02003f5a7889cf17025762ebfc81ac0d4b3d3 From 8fa9a0454815f9424c3593a46b1c17ce8a6b0db5 Mon Sep 17 00:00:00 2001 From: Geometer1729 <16kuhnb@gmail.com> Date: Wed, 18 Dec 2024 15:48:32 -0500 Subject: [PATCH 06/10] revert bindings to make sure new path works --- src/bindings | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/bindings b/src/bindings index 58e02003f..74ac5f5e0 160000 --- a/src/bindings +++ b/src/bindings @@ -1 +1 @@ -Subproject commit 58e02003f5a7889cf17025762ebfc81ac0d4b3d3 +Subproject commit 74ac5f5e055b66a92cf88b6d9970d5103f1dbaaa From d6e52c15259f2d60c96c211560b14eb30caabf26 Mon Sep 17 00:00:00 2001 From: Geometer1729 <16kuhnb@gmail.com> Date: Wed, 18 Dec 2024 15:52:09 -0500 Subject: [PATCH 07/10] restore bindings --- src/bindings | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/bindings b/src/bindings index 74ac5f5e0..58e02003f 160000 --- a/src/bindings +++ b/src/bindings @@ -1 +1 @@ -Subproject commit 74ac5f5e055b66a92cf88b6d9970d5103f1dbaaa +Subproject commit 58e02003f5a7889cf17025762ebfc81ac0d4b3d3 From 03595d4ff048fd479a06e4529096fd2e1ebffdbf Mon Sep 17 00:00:00 2001 From: Geometer1729 <16kuhnb@gmail.com> Date: Wed, 18 Dec 2024 15:59:41 -0500 Subject: [PATCH 08/10] just point bindings at main --- src/bindings | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/bindings b/src/bindings index 58e02003f..f157000fa 160000 --- a/src/bindings +++ b/src/bindings @@ -1 +1 @@ -Subproject commit 58e02003f5a7889cf17025762ebfc81ac0d4b3d3 +Subproject commit f157000fadd98f3699ed573ce7a3e3be784f6022 From 3d2854a84f576ae16bead9c4684fa4edb4fee484 Mon Sep 17 00:00:00 2001 From: Geometer1729 <16kuhnb@gmail.com> Date: Thu, 19 Dec 2024 09:23:56 -0500 Subject: [PATCH 09/10] add documentation for bindings patch (and break bindings) --- .github/workflows/build-bindings.yml | 2 ++ README-dev.md | 14 ++++++++++++++ src/bindings | 2 +- 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build-bindings.yml b/.github/workflows/build-bindings.yml index 5595c7df9..4a42d71a0 100644 --- a/.github/workflows/build-bindings.yml +++ b/.github/workflows/build-bindings.yml @@ -30,6 +30,8 @@ jobs: nix run o1js#update-bindings --max-jobs 4 #fail if this changes any files cd src/bindings + echo If this check fails you can download a patch from the patch-upload job + echo "https://github.com/o1-labs/o1js/blob/main/README-dev.md#build-scripts" git diff --exit-code - name: add build to gc-root if on main if: github.ref == 'refs/heads/main' diff --git a/README-dev.md b/README-dev.md index 8d1ec0fbb..6a7e08107 100644 --- a/README-dev.md +++ b/README-dev.md @@ -86,6 +86,20 @@ In addition to building the OCaml and Rust code, the build script also generates o1js uses these types to ensure that the constants used in the protocol are consistent with the OCaml source files. +### Bindings check in ci + +If the bindings check fails in CI it will upload a patch you can use to update the bindings without having to rebuild locally. +This can also be helpful when the bindings don't build identically, as unfortunately often happens. + +To use this patch: +- Click details on the `Build o1js bindings / build-bindings-ubunutu` job +- Go to the `patch-upload` job and expand the logs for `Upload patch` +- Download the file linked in the last line of the logs ie. +`Artifact download URL: https://github.com/o1-labs/o1js/actions/runs/12401083741/artifacts/2339952965` +- unzip it +- navigate to `src/bindings` +- run `git apply path/to/bindings.patch` + ## Development ### Branching Policy diff --git a/src/bindings b/src/bindings index f157000fa..74ac5f5e0 160000 --- a/src/bindings +++ b/src/bindings @@ -1 +1 @@ -Subproject commit f157000fadd98f3699ed573ce7a3e3be784f6022 +Subproject commit 74ac5f5e055b66a92cf88b6d9970d5103f1dbaaa From 19886d8e8ab7dd6e3eae34351d4a8892cff8610d Mon Sep 17 00:00:00 2001 From: Geometer1729 <16kuhnb@gmail.com> Date: Thu, 19 Dec 2024 09:30:13 -0500 Subject: [PATCH 10/10] fix link and restore bindings --- .github/workflows/build-bindings.yml | 2 +- src/bindings | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-bindings.yml b/.github/workflows/build-bindings.yml index 4a42d71a0..4f66ee7c6 100644 --- a/.github/workflows/build-bindings.yml +++ b/.github/workflows/build-bindings.yml @@ -31,7 +31,7 @@ jobs: #fail if this changes any files cd src/bindings echo If this check fails you can download a patch from the patch-upload job - echo "https://github.com/o1-labs/o1js/blob/main/README-dev.md#build-scripts" + echo "https://github.com/o1-labs/o1js/blob/main/README-dev.md#bindings-check-in-ci" git diff --exit-code - name: add build to gc-root if on main if: github.ref == 'refs/heads/main' diff --git a/src/bindings b/src/bindings index 74ac5f5e0..a5a0883f0 160000 --- a/src/bindings +++ b/src/bindings @@ -1 +1 @@ -Subproject commit 74ac5f5e055b66a92cf88b6d9970d5103f1dbaaa +Subproject commit a5a0883f033afd4c9fd4bf96a5e0b8ebd92a87c9