fix(gnark-ffi): align Go toolchain with go.mod and skip VCS stamping#2771
Open
wstran wants to merge 2 commits into
Open
fix(gnark-ffi): align Go toolchain with go.mod and skip VCS stamping#2771wstran wants to merge 2 commits into
wstran wants to merge 2 commits into
Conversation
5e78674 to
f36cca5
Compare
Author
|
Retargeted from |
The gnark-ffi Go module declares `go 1.24.0` but CI workflows pin `go-version: "1.22"` and `^1.22.1`. Go 1.22 then auto-downloads the 1.24 toolchain on every build via GOTOOLCHAIN, adding a network dependency on go.dev and ~10 seconds to each run. Switch setup-go to `go-version-file: crates/recursion/gnark-ffi/go/go.mod` so the action installs the exact version required by go.mod. Future go.mod bumps propagate to CI without separate edits.
`go build` defaults to embedding VCS metadata (Go 1.18+), which requires git to be runnable in the module directory. This fails with cryptic `error obtaining VCS status: exit status 128` whenever git cannot run, e.g. Docker bind-mount UID mismatches or sandboxed CI runners with restricted git config. The build output is a static C archive linked into the Rust binary; embedded Go VCS metadata is unused. Pass `-buildvcs=false` to skip it.
f36cca5 to
9cde723
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
Two related production-friction issues in the gnark-ffi Go build:
1. CI Go version drifted from
go.modThe gnark-ffi Go module declares
go 1.24.0(since #998 / Dec 2025) but CI configuration still pins:.github/actions/setup/action.yml:go-version: \"1.22\".github/workflows/release.yml(×2):go-version: \"^1.22.1\"When Go 1.22 builds against a
go 1.24.0go.mod,GOTOOLCHAIN=auto(default since Go 1.21) silently downloads the 1.24 toolchain on every run. Locally reproducible:Costs:
go.dev(network dependency)apt golang= Go 1.19), parsing fails before toolchain switch can run:invalid go version '1.24.0': must match format 1.232.
go buildaborts with cryptic VCS error in restricted environmentsSince Go 1.18,
go builddefaults to embedding VCS metadata, which requiresgitto be runnable in the module directory. In Docker bind-mount setups (UID mismatch between host and container) or sandboxed CI environments, this fails:The build output is a static C archive linked into the Rust binary; embedded Go VCS metadata is never consumed. The Rust binary already carries its own VCS info via
vergen-style stamping at the Rust layer.Changes
CI (
action.yml+release.yml×2): replacego-versionwithgo-version-file: \"crates/recursion/gnark-ffi/go/go.mod\". setup-go reads thegodirective directly, eliminating drift and the auto-toolchain download. Future go.mod bumps propagate to CI without separate edits.crates/recursion/gnark-ffi/build.rs: pass-buildvcs=falsetogo build. Removes the git-runnability requirement and the cryptic failure mode without changing the produced artifact.Verification
Reproduced locally on
rust:1.91-slim-bookworm(Debian, Go 1.19 from apt) and with Go 1.22 / 1.24 from the official tarball:cargo +nightly fmt --check --allpasses.cargo check -p sp1-recursion-gnark-ffi --features nativepasses after the build.rs change.Notes
.ais only ever read viago version -m, which is not part of any SP1 release path.go-version-fileis supported byactions/setup-gov3+ (current pin is v5).cache-dependency-path: \"**/go.sum\".