From 2e6a32afaa9d09b4af2006079b8e308e70ea89f9 Mon Sep 17 00:00:00 2001 From: maru Date: Sun, 19 Oct 2025 06:12:33 +0000 Subject: [PATCH 01/11] Ensure golang input is up-to-date for nix flake The PR introducing the nix flake missed ensuring that the golang input from avalanchego reflected the update for 1.24.9. This change remedies that oversight and ensures that CI will catch it in the future. --- .github/workflows/ci.yaml | 8 ++++++++ ffi/flake.lock | 8 ++++---- ffi/go.mod | 2 +- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index f7c74b6bd..a7ad364c9 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -250,6 +250,14 @@ jobs: - uses: actions/checkout@v4 - uses: DeterminateSystems/nix-installer-action@786fff0690178f1234e4e1fe9b536e94f5433196 #v20 - uses: DeterminateSystems/magic-nix-cache-action@565684385bcd71bad329742eefe8d12f2e765b39 #v13 + - name: Check golang flake input is up to date + working-directory: ffi + run: | + nix flake lock --update-input golang + if ! git diff --exit-code flake.lock; then + echo "Error: ffi/flake.lock is out of date. Run 'nix flake lock --update-input golang' in the ffi directory and commit the changes." + exit 1 + fi - name: Test build equivalency between Nix and Cargo run: bash -x ./ffi/test-build-equivalency.sh - name: Test Go FFI bindings diff --git a/ffi/flake.lock b/ffi/flake.lock index e95d44ffe..2eda9b50c 100644 --- a/ffi/flake.lock +++ b/ffi/flake.lock @@ -39,17 +39,17 @@ }, "locked": { "dir": "nix/go", - "lastModified": 1760457933, - "narHash": "sha256-/OztRdmXd3cL6ycrzRYAgFkPTv9v5WWlcdtVlERaRKI=", + "lastModified": 1760973838, + "narHash": "sha256-UnngvRB45lUeWwot7cvB0MaedaQEQmcw+q8Y6WbeGtE=", "owner": "ava-labs", "repo": "avalanchego", - "rev": "edf67505fee7c95837c2220467de86fea0efc860", + "rev": "f10757d594eedf0f016bc1400739788c542f005f", "type": "github" }, "original": { "dir": "nix/go", "owner": "ava-labs", - "ref": "edf67505fee7c95837c2220467de86fea0efc860", + "ref": "f10757d594eedf0f016bc1400739788c542f005f", "repo": "avalanchego", "type": "github" } diff --git a/ffi/go.mod b/ffi/go.mod index be46486ab..9bab12492 100644 --- a/ffi/go.mod +++ b/ffi/go.mod @@ -4,7 +4,7 @@ go 1.24 // Changes to the toolchain version should be replicated in: // - ffi/go.mod (here) -// - ffi/flake.nix (update golang.url to a version of avalanchego's nix/go/flake.nix that uses the desired version) +// - ffi/flake.nix (update golang.url to a version of avalanchego's nix/go/flake.nix that uses the desired version and run `nix flake update --update-input golang`) // - ffi/tests/eth/go.mod // - ffi/tests/firewood/go.mod toolchain go1.24.9 From 795129636b38c7134e6232a39b0abc733f07177f Mon Sep 17 00:00:00 2001 From: maru Date: Sun, 19 Oct 2025 06:36:44 +0000 Subject: [PATCH 02/11] fixup: Update to use the non-deprecated flake update syntax --- .github/workflows/ci.yaml | 4 ++-- ffi/go.mod | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index a7ad364c9..0e554cf59 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -253,9 +253,9 @@ jobs: - name: Check golang flake input is up to date working-directory: ffi run: | - nix flake lock --update-input golang + nix flake update golang if ! git diff --exit-code flake.lock; then - echo "Error: ffi/flake.lock is out of date. Run 'nix flake lock --update-input golang' in the ffi directory and commit the changes." + echo "Error: ffi/flake.lock is out of date. Run 'nix flake update golang' in the ffi directory and commit the changes." exit 1 fi - name: Test build equivalency between Nix and Cargo diff --git a/ffi/go.mod b/ffi/go.mod index 9bab12492..9eaa265c2 100644 --- a/ffi/go.mod +++ b/ffi/go.mod @@ -4,7 +4,7 @@ go 1.24 // Changes to the toolchain version should be replicated in: // - ffi/go.mod (here) -// - ffi/flake.nix (update golang.url to a version of avalanchego's nix/go/flake.nix that uses the desired version and run `nix flake update --update-input golang`) +// - ffi/flake.nix (update golang.url to a version of avalanchego's nix/go/flake.nix that uses the desired version and run `nix flake update golang`) // - ffi/tests/eth/go.mod // - ffi/tests/firewood/go.mod toolchain go1.24.9 From 0dc23b75e33988fa8f644cce2a2f9a43bfe5ab00 Mon Sep 17 00:00:00 2001 From: maru Date: Thu, 9 Oct 2025 06:48:31 +0000 Subject: [PATCH 03/11] feat: Add just task runner to ensure reproducibility of CI --- .github/workflows/ci.yaml | 24 +++---------- ffi/flake.nix | 8 ++++- justfile | 71 +++++++++++++++++++++++++++++++++++++++ run-just.sh | 21 ++++++++++++ 4 files changed, 103 insertions(+), 21 deletions(-) create mode 100644 justfile create mode 100755 run-just.sh diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 0e554cf59..7e1accb1b 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -250,26 +250,10 @@ jobs: - uses: actions/checkout@v4 - uses: DeterminateSystems/nix-installer-action@786fff0690178f1234e4e1fe9b536e94f5433196 #v20 - uses: DeterminateSystems/magic-nix-cache-action@565684385bcd71bad329742eefe8d12f2e765b39 #v13 - - name: Check golang flake input is up to date - working-directory: ffi - run: | - nix flake update golang - if ! git diff --exit-code flake.lock; then - echo "Error: ffi/flake.lock is out of date. Run 'nix flake update golang' in the ffi directory and commit the changes." - exit 1 - fi - - name: Test build equivalency between Nix and Cargo - run: bash -x ./ffi/test-build-equivalency.sh - - name: Test Go FFI bindings - working-directory: ffi - # - cgocheck2 is expensive but provides complete pointer checks - # - use hash mode ethhash since the flake builds with `--features ethhash,logger` - # - run golang outside a nix shell to validate viability without the env setup performed by a nix shell - run: | - GOLANG="nix run $PWD#go" - cd result/ffi - GOEXPERIMENT=cgocheck2 TEST_FIREWOOD_HASH_MODE=ethhash ${GOLANG} test ./... - shell: bash + - name: Check that FFI flake is up-to-date + run: ./run-just.sh check-ffi-flake-current + - name: Test nix build of Golang FFI bindings + run: ./run-just.sh test-ffi-nix firewood-ethhash-differential-fuzz: needs: build diff --git a/ffi/flake.nix b/ffi/flake.nix index e2853cc0c..a7e3f97cf 100644 --- a/ffi/flake.nix +++ b/ffi/flake.nix @@ -116,13 +116,19 @@ program = "${go}/bin/go"; }; + apps.just = { + type = "app"; + program = "${pkgs.just}/bin/just"; + }; + devShells.default = craneLib.devShell { inputsFrom = [ firewood-ffi ]; packages = with pkgs; [ firewood-ffi - rustToolchain go + just + rustToolchain ]; shellHook = '' diff --git a/justfile b/justfile new file mode 100644 index 000000000..8711850d2 --- /dev/null +++ b/justfile @@ -0,0 +1,71 @@ +# List available recipes +default: + @just --list + +# Build ffi with nix +build-ffi-nix: check-nix + cd ffi && nix build + +# Check if the git branch is clean +check-clean-branch: + #!/usr/bin/env bash + set -euo pipefail + + git add --all + git update-index --really-refresh >> /dev/null + + # Show the status of the working tree. + git status --short + + # Exits if any uncommitted changes are found. + git diff-index --quiet HEAD + +# Check if the FFI flake (requires clean git tree) +check-ffi-flake-current: check-nix + #!/usr/bin/env bash + set -euo pipefail + cd ffi + nix flake lock --update-input golang + ./scripts/run_just.sh check-clean-branch + +# Check if nix is installed +check-nix: + #!/usr/bin/env bash + set -euo pipefail + if ! command -v nix &> /dev/null; then + echo "Error: 'nix' is not installed." >&2 + echo "" >&2 + echo "To install nix:" >&2 + echo " - Visit: https://github.com/DeterminateSystems/nix-installer" >&2 + echo " - Or run: curl --proto '=https' --tlsv1.2 -sSf -L https://install.determinate.systems/nix | sh -s -- install" >&2 + exit 1 + fi + +# Run all checks of ffi built with nix +test-ffi-nix: test-ffi-nix-build-equivalency test-ffi-nix-go-bindings + +# Test build equivalency between nix and cargo +test-ffi-nix-build-equivalency: check-nix + bash -x ./ffi/test-build-equivalency.sh + +# Test golang ffi bindings using the nix-built artifacts +test-ffi-nix-go-bindings: build-ffi-nix + #!/usr/bin/env bash + set -euo pipefail + + cd ffi + + # Need to capture the flake path before changing directories to + # result/ffi because `result` is a nix store symlink so ../../ + # won't resolve to the ffi path containing the flake. + FLAKE_PATH="$PWD" + + # This runs golang outside a nix shell to validate viability + # without the env setup performed by a nix shell + GO="nix run $PWD#go" + + cd result/ffi + + # - cgocheck2 is expensive but provides complete pointer checks + # - use hash mode ethhash since the flake builds with `--features ethhash,logger` + GOEXPERIMENT=cgocheck2 TEST_FIREWOOD_HASH_MODE=ethhash ${GO} test ./... diff --git a/run-just.sh b/run-just.sh new file mode 100755 index 000000000..3895e6c33 --- /dev/null +++ b/run-just.sh @@ -0,0 +1,21 @@ +#!/usr/bin/env bash +set -euo pipefail + +if command -v just &> /dev/null; then + exec just "$@" +elif command -v nix &> /dev/null; then + exec nix run ./ffi#just -- "$@" +else + echo "Error: Neither 'just' nor 'nix' is installed." >&2 + echo "" >&2 + echo "Please install one of the following:" >&2 + echo "" >&2 + echo "Option 1 - Install just:" >&2 + echo " - Visit: https://github.com/casey/just#installation" >&2 + echo " - Or use cargo: cargo install just" >&2 + echo "" >&2 + echo "Option 2 - Install nix:" >&2 + echo " - Visit: https://github.com/DeterminateSystems/nix-installer" >&2 + echo " - Or run: curl --proto '=https' --tlsv1.2 -sSf -L https://install.determinate.systems/nix | sh -s -- install" >&2 + exit 1 +fi From f544432e1509b6244ee881e5d6eef83601c08975 Mon Sep 17 00:00:00 2001 From: maru Date: Thu, 9 Oct 2025 07:00:27 +0000 Subject: [PATCH 04/11] fixup: Exclude justfile and run-just.sh for licence header check --- .github/check-license-headers.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/check-license-headers.yaml b/.github/check-license-headers.yaml index bd1af237e..d699e25ac 100644 --- a/.github/check-license-headers.yaml +++ b/.github/check-license-headers.yaml @@ -53,6 +53,8 @@ "cliff.toml", "clippy.toml", "**/tests/compile_*/**", + "justfile", + "run-just.sh", ], } ] From 0ce83e77d30ed0252ee0f3fb7d42bdb7e5d7d91c Mon Sep 17 00:00:00 2001 From: maru Date: Thu, 9 Oct 2025 07:11:46 +0000 Subject: [PATCH 05/11] fixup: Add output to differentiate test recipes --- justfile | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/justfile b/justfile index 8711850d2..bab1557c0 100644 --- a/justfile +++ b/justfile @@ -44,8 +44,13 @@ check-nix: # Run all checks of ffi built with nix test-ffi-nix: test-ffi-nix-build-equivalency test-ffi-nix-go-bindings -# Test build equivalency between nix and cargo +# Test ffi build equivalency between nix and cargo test-ffi-nix-build-equivalency: check-nix + #!/usr/bin/env bash + set -euo pipefail + + echo "Testing ffi build equivalency between nix and cargo" + bash -x ./ffi/test-build-equivalency.sh # Test golang ffi bindings using the nix-built artifacts @@ -53,6 +58,8 @@ test-ffi-nix-go-bindings: build-ffi-nix #!/usr/bin/env bash set -euo pipefail + echo "Running ffi tests against bindings built by nix..." + cd ffi # Need to capture the flake path before changing directories to From e3493bcb0a06504de2f97b9547c9fcaa02773f88 Mon Sep 17 00:00:00 2001 From: maru Date: Thu, 9 Oct 2025 07:18:54 +0000 Subject: [PATCH 06/11] fixup: Use flake path as intended --- justfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/justfile b/justfile index bab1557c0..0713858bb 100644 --- a/justfile +++ b/justfile @@ -26,7 +26,7 @@ check-ffi-flake-current: check-nix set -euo pipefail cd ffi nix flake lock --update-input golang - ./scripts/run_just.sh check-clean-branch + ../run-just.sh check-clean-branch # Check if nix is installed check-nix: @@ -69,7 +69,7 @@ test-ffi-nix-go-bindings: build-ffi-nix # This runs golang outside a nix shell to validate viability # without the env setup performed by a nix shell - GO="nix run $PWD#go" + GO="nix run $FLAKE_PATH#go" cd result/ffi From 262b823973c45c04d8a7be6f976cd769626eedfa Mon Sep 17 00:00:00 2001 From: maru Date: Sun, 19 Oct 2025 06:35:18 +0000 Subject: [PATCH 07/11] fixup: Update to use current flake update syntax --- justfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/justfile b/justfile index 0713858bb..f692245f9 100644 --- a/justfile +++ b/justfile @@ -25,7 +25,7 @@ check-ffi-flake-current: check-nix #!/usr/bin/env bash set -euo pipefail cd ffi - nix flake lock --update-input golang + nix flake update golang ../run-just.sh check-clean-branch # Check if nix is installed From efc90b646bceb9cd350c4c62fcfe30bcdd083f52 Mon Sep 17 00:00:00 2001 From: maru Date: Sun, 19 Oct 2025 06:40:10 +0000 Subject: [PATCH 08/11] fixup: Add separate command for updating the nix flake --- .github/workflows/ci.yaml | 2 +- ffi/go.mod | 2 +- justfile | 16 ++++++++++------ 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 7e1accb1b..9ce0b2e97 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -251,7 +251,7 @@ jobs: - uses: DeterminateSystems/nix-installer-action@786fff0690178f1234e4e1fe9b536e94f5433196 #v20 - uses: DeterminateSystems/magic-nix-cache-action@565684385bcd71bad329742eefe8d12f2e765b39 #v13 - name: Check that FFI flake is up-to-date - run: ./run-just.sh check-ffi-flake-current + run: ./run-just.sh check-ffi-flake - name: Test nix build of Golang FFI bindings run: ./run-just.sh test-ffi-nix diff --git a/ffi/go.mod b/ffi/go.mod index 9eaa265c2..8200ace65 100644 --- a/ffi/go.mod +++ b/ffi/go.mod @@ -4,7 +4,7 @@ go 1.24 // Changes to the toolchain version should be replicated in: // - ffi/go.mod (here) -// - ffi/flake.nix (update golang.url to a version of avalanchego's nix/go/flake.nix that uses the desired version and run `nix flake update golang`) +// - ffi/flake.nix (update golang.url to a version of avalanchego's nix/go/flake.nix that uses the desired version and run `just update-ffi-flake`) // - ffi/tests/eth/go.mod // - ffi/tests/firewood/go.mod toolchain go1.24.9 diff --git a/justfile b/justfile index f692245f9..1c0df3e9b 100644 --- a/justfile +++ b/justfile @@ -21,12 +21,9 @@ check-clean-branch: git diff-index --quiet HEAD # Check if the FFI flake (requires clean git tree) -check-ffi-flake-current: check-nix - #!/usr/bin/env bash - set -euo pipefail - cd ffi - nix flake update golang - ../run-just.sh check-clean-branch +check-ffi-flake: check-nix + ./run-just.sh update-check-ffi-flake + ./run-just.sh check-clean-branch # Check if nix is installed check-nix: @@ -76,3 +73,10 @@ test-ffi-nix-go-bindings: build-ffi-nix # - cgocheck2 is expensive but provides complete pointer checks # - use hash mode ethhash since the flake builds with `--features ethhash,logger` GOEXPERIMENT=cgocheck2 TEST_FIREWOOD_HASH_MODE=ethhash ${GO} test ./... + +# Ensure the FFI flake is up-to-date +update-check-ffi-flake: check-nix + #!/usr/bin/env bash + set -euo pipefail + cd ffi + nix flake update golang From 734c3c7675ed7569a543b927fb5fee9efcc12b42 Mon Sep 17 00:00:00 2001 From: maru Date: Sun, 19 Oct 2025 10:54:23 +0000 Subject: [PATCH 09/11] fixup: Move run script and fix update flake command name --- .github/check-license-headers.yaml | 2 +- .github/workflows/ci.yaml | 4 ++-- justfile | 10 ++++++---- run-just.sh => scripts/run-just.sh | 2 +- 4 files changed, 10 insertions(+), 8 deletions(-) rename run-just.sh => scripts/run-just.sh (94%) diff --git a/.github/check-license-headers.yaml b/.github/check-license-headers.yaml index d699e25ac..2ca80dbfd 100644 --- a/.github/check-license-headers.yaml +++ b/.github/check-license-headers.yaml @@ -54,7 +54,7 @@ "clippy.toml", "**/tests/compile_*/**", "justfile", - "run-just.sh", + "scripts/run-just.sh", ], } ] diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 9ce0b2e97..a632ae036 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -251,9 +251,9 @@ jobs: - uses: DeterminateSystems/nix-installer-action@786fff0690178f1234e4e1fe9b536e94f5433196 #v20 - uses: DeterminateSystems/magic-nix-cache-action@565684385bcd71bad329742eefe8d12f2e765b39 #v13 - name: Check that FFI flake is up-to-date - run: ./run-just.sh check-ffi-flake + run: ./scripts/run-just.sh check-ffi-flake - name: Test nix build of Golang FFI bindings - run: ./run-just.sh test-ffi-nix + run: ./scripts/run-just.sh test-ffi-nix firewood-ethhash-differential-fuzz: needs: build diff --git a/justfile b/justfile index 1c0df3e9b..e2d5acc77 100644 --- a/justfile +++ b/justfile @@ -1,6 +1,6 @@ # List available recipes default: - @just --list + ./scripts/run-just.sh --list # Build ffi with nix build-ffi-nix: check-nix @@ -22,8 +22,10 @@ check-clean-branch: # Check if the FFI flake (requires clean git tree) check-ffi-flake: check-nix - ./run-just.sh update-check-ffi-flake - ./run-just.sh check-clean-branch + #!/usr/bin/env bash + set -euo pipefail + ./scripts/run-just.sh update-ffi-flake + ./scripts/run-just.sh check-clean-branch # Check if nix is installed check-nix: @@ -75,7 +77,7 @@ test-ffi-nix-go-bindings: build-ffi-nix GOEXPERIMENT=cgocheck2 TEST_FIREWOOD_HASH_MODE=ethhash ${GO} test ./... # Ensure the FFI flake is up-to-date -update-check-ffi-flake: check-nix +update-ffi-flake: check-nix #!/usr/bin/env bash set -euo pipefail cd ffi diff --git a/run-just.sh b/scripts/run-just.sh similarity index 94% rename from run-just.sh rename to scripts/run-just.sh index 3895e6c33..377bffdcc 100755 --- a/run-just.sh +++ b/scripts/run-just.sh @@ -4,7 +4,7 @@ set -euo pipefail if command -v just &> /dev/null; then exec just "$@" elif command -v nix &> /dev/null; then - exec nix run ./ffi#just -- "$@" + exec nix run nixpkgs#just -- "$@" else echo "Error: Neither 'just' nor 'nix' is installed." >&2 echo "" >&2 From 86ab4ed2f5c54db040a0747f36b5932068c70965 Mon Sep 17 00:00:00 2001 From: maru Date: Mon, 20 Oct 2025 11:15:56 +0000 Subject: [PATCH 10/11] fixup: Add check for golang version consistency --- ffi/flake.nix | 6 ++++++ ffi/go.mod | 1 + justfile | 48 +++++++++++++++++++++++++++++++++++++++++++++++- 3 files changed, 54 insertions(+), 1 deletion(-) diff --git a/ffi/flake.nix b/ffi/flake.nix index a7e3f97cf..1b25a796c 100644 --- a/ffi/flake.nix +++ b/ffi/flake.nix @@ -116,6 +116,11 @@ program = "${go}/bin/go"; }; + apps.jq = { + type = "app"; + program = "${pkgs.jq}/bin/jq"; + }; + apps.just = { type = "app"; program = "${pkgs.just}/bin/just"; @@ -127,6 +132,7 @@ packages = with pkgs; [ firewood-ffi go + jq just rustToolchain ]; diff --git a/ffi/go.mod b/ffi/go.mod index 8200ace65..30ef658c3 100644 --- a/ffi/go.mod +++ b/ffi/go.mod @@ -7,6 +7,7 @@ go 1.24 // - ffi/flake.nix (update golang.url to a version of avalanchego's nix/go/flake.nix that uses the desired version and run `just update-ffi-flake`) // - ffi/tests/eth/go.mod // - ffi/tests/firewood/go.mod +// `just check-golang-version` validates that these versions are in sync and will run in CI as part of the ffi-nix job. toolchain go1.24.9 require ( diff --git a/justfile b/justfile index e2d5acc77..2155eaa04 100644 --- a/justfile +++ b/justfile @@ -27,6 +27,47 @@ check-ffi-flake: check-nix ./scripts/run-just.sh update-ffi-flake ./scripts/run-just.sh check-clean-branch +# Check if the golang version is set consistently for all (requires clean git tree) +check-golang-version: check-nix + #!/usr/bin/env bash + set -euo pipefail + + FAILED= + + cd ffi + + TOOLCHAIN_VERSION=$(nix develop --command bash -c "go mod edit -json | jq -r '.Toolchain'") + echo "toolchain version in ffi/go.mod is ${TOOLCHAIN_VERSION}" + + ETH_TESTS_VERSION=$(nix develop --command bash -c "cd tests/eth && go mod edit -json | jq -r '.Toolchain'") + echo "toolchain version in ffi/tests/eth/go.mod is ${ETH_TESTS_VERSION}" + + if [[ "${TOOLCHAIN_VERSION}" != "${ETH_TESTS_VERSION}" ]]; then + echo "❌ toolchain version in ffi/tests/eth/go.mod should be ${TOOLCHAIN_VERSION}" + FAILED=1 + fi + + FIREWOOD_TESTS_VERSION=$(nix develop --command bash -c "cd tests/firewood && go mod edit -json | jq -r '.Toolchain'") + echo "toolchain version in ffi/tests/firewood/go.mod is ${FIREWOOD_TESTS_VERSION}" + + if [[ "${TOOLCHAIN_VERSION}" != "${FIREWOOD_TESTS_VERSION}" ]]; then + echo "❌ toolchain version in ffi/tests/firewood/go.mod should be ${TOOLCHAIN_VERSION}" + FAILED=1 + fi + + NIX_VERSION=$(nix run .#go -- version | awk '{print $3}') + echo "golang provided by ffi/flake.nix is ${NIX_VERSION}" + + if [[ "${TOOLCHAIN_VERSION}" != "${NIX_VERSION}" ]]; then + echo "❌ golang provided by ffi/flake/nix should be ${TOOLCHAIN_VERSION}" + echo "It will be necessary to update the golang.url in ffi/flake.nix to point to a SHA of"\ + "AvalancheGo whose nix/go/flake.nix provides ${TOOLCHAIN_VERSION}." + fi + + if [[ -n "${FAILED}" ]]; then + exit 1 + fi + # Check if nix is installed check-nix: #!/usr/bin/env bash @@ -57,7 +98,7 @@ test-ffi-nix-go-bindings: build-ffi-nix #!/usr/bin/env bash set -euo pipefail - echo "Running ffi tests against bindings built by nix..." + echo "running ffi tests against bindings built by nix..." cd ffi @@ -81,4 +122,9 @@ update-ffi-flake: check-nix #!/usr/bin/env bash set -euo pipefail cd ffi + + echo "ensuring flake lock file is current for golang" nix flake update golang + + echo "checking for a consistent golang verion" + ../scripts/run-just.sh check-golang-version From b93f0da826d0bea19c0e0964246bd66586d3eef7 Mon Sep 17 00:00:00 2001 From: maru Date: Mon, 20 Oct 2025 11:26:55 +0000 Subject: [PATCH 11/11] fixup: Cleanup justfile comments --- justfile | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/justfile b/justfile index 2155eaa04..61b95cb48 100644 --- a/justfile +++ b/justfile @@ -20,18 +20,19 @@ check-clean-branch: # Exits if any uncommitted changes are found. git diff-index --quiet HEAD -# Check if the FFI flake (requires clean git tree) +# Check if the FFI flake is up-to-date (requires clean git tree) check-ffi-flake: check-nix #!/usr/bin/env bash set -euo pipefail ./scripts/run-just.sh update-ffi-flake ./scripts/run-just.sh check-clean-branch -# Check if the golang version is set consistently for all (requires clean git tree) +# Check if the golang version is set consistently (requires clean git tree) check-golang-version: check-nix #!/usr/bin/env bash set -euo pipefail + # Exit only at the end if any of the checks set FAILED=1 FAILED= cd ffi