From 9b4d00a16d89724c9b67fdf5e5c1661cb13d7499 Mon Sep 17 00:00:00 2001 From: Gautam Botrel Date: Tue, 10 Feb 2026 16:50:51 -0600 Subject: [PATCH 1/5] docs: update README.md --- README.md | 194 ++++++++++++++++++++++++------------------------------ 1 file changed, 86 insertions(+), 108 deletions(-) diff --git a/README.md b/README.md index a5dd4dbea9..ec557473a7 100644 --- a/README.md +++ b/README.md @@ -5,112 +5,82 @@ [![PkgGoDev](https://pkg.go.dev/badge/mod/github.com/consensys/gnark)](https://pkg.go.dev/mod/github.com/consensys/gnark) [![Documentation Status](https://readthedocs.com/projects/pegasys-gnark/badge/)][`gnark` User Documentation] [![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.5819104.svg)](https://doi.org/10.5281/zenodo.5819104) -`gnark` is a fast zk-SNARK library that offers a high-level API to design circuits. The library is open-source and developed under the Apache 2.0 license. +High-performance zk-SNARKs in Go. -`gnark` uses [`gnark-crypto`] for the finite-field arithmetic and out-circuit implementation of cryptographic algorithms. +`gnark` provides a high-level API to define circuits, then compile, prove, and verify with production-grade proving systems. It is open-source under Apache 2.0 and uses [`gnark-crypto`] for field arithmetic and cryptographic primitives. -`gnark` powers [`Linea zk-rollup`](https://linea.build). Include your project in the [known users](docs/KNOWN_USERS.md) section by opening a PR. +`gnark` powers [`Linea zk-rollup`](https://linea.build). Include your project in [known users](docs/KNOWN_USERS.md) by opening a PR. -## Useful Links - -* [`gnark` User Documentation] -* [`gnark` Playground] -* [`gnark` Issues] -* [`gnark` Benchmarks](https://docs.gnark.consensys.net/overview#gnark-is-fast) 🏁 -* [`gnark-announce`] - Announcement list for new releases and security patches - - -## `gnark` Users - -To get started with `gnark` and write your first circuit, follow [these instructions][`gnark` User Documentation]. - -Checkout the [online playground][`gnark` Playground] to compile circuits and visualize constraint systems. - - -## Security - -**`gnark` and [`gnark-crypto`] have been [extensively audited](#audits), but are provided as-is, we make no guarantees or warranties to their safety and reliability. In particular, `gnark` makes no security guarantees such as constant time implementation or side-channel attack resistance.** - -**To report a security bug, please refer to [`gnark` Security Policy](SECURITY.md).** - -Refer to [known security advisories](https://github.com/Consensys/gnark/security/advisories?state=published) for a list of known security issues. +## Why `gnark` -## Testing - -`gnark` employs the following testing procedures: -* unit testing - we test the primitives in unit tests -* circuit testing - we test the circuit implementation against several targets: - - test engine - instead of running the full prover and verifier stack, we run the computations only to ensure the completeness of the circuits - - proof engines - we compile the circuits, run the setup, prove and verify using native implementation - - Solidity verifier - in addition to the previous, we verify the proofs in Solidity verifier. See [`gnark-solidity-checker`] -* regression testing - we have implemented [tests for reported issues](internal/regression_tests) to avoid regressions -* constraint count testing - we have implemented [circuit size tests](internal/stats) to avoid regressions -* serialization testing - we check that [serialization round-trip is complete](io/roundtrip.go) -* side-effect testing - we check that circuit [compilation is deterministic](test/assert.go) -* fuzz testing: - - circuit input fuzzing - we provide random inputs to the circuit to cause solver error - - native input fuzzing - we provide random inputs to various native methods to cause errors. We have also stored initial fuzzing corpus for regression tests. - - circuit definition fuzzing - we cooperate with Consensys Diligence to fuzz the circuit definitions to find bugs in the `gnark` circuit compiler. +- Circuit development in idiomatic Go +- Fast proving and verification backends +- Reusable standard gadgets in `std/` +- Active security and regression testing culture -The tests are automatically run during every PR and merge commit. We run full test suite only for the Linux on `amd64` target, but run short tests both for Windows target (`amd64`) and macOS target (`arm64`). +## Useful Links -## Performance +- [`gnark` User Documentation] +- [`gnark` Playground] +- [`gnark` Issues] +- [`gnark` Benchmarks](https://docs.gnark.consensys.net/overview#gnark-is-fast) 🏁 +- [`gnark-announce`] - release and security announcements -`gnark` and `gnark-crypto` packages are optimized for 64bits architectures (x86 `amd64`) using assembly operations. We have a generic implementation of the same arithmetic algorithms for ARM backends (`arm64`). We do not implement vector operations. +## Quick Start -## Backwards compatibility +### Requirements -`gnark` tries to be backwards compatible when possible, however we do not guarantee that serialized object formats are static over different versions of `gnark`. Particularly - we do not have versioning implemented in the serialized formats, so using files between different versions of gnark may lead to undefined behaviour or even crash the program. +- Go `1.25+` (module target: `go 1.25.6`) -## Issues +### Install -`gnark` issues are tracked [in the GitHub issues tab][`gnark` Issues]. +```bash +go get github.com/consensys/gnark@latest +``` -**To report a security bug, please refer to [`gnark` Security Policy](SECURITY.md).** +### Run an example -If you have any questions, queries or comments, [GitHub discussions] is the place to find us. +```bash +go run ./examples/cubic +``` -You can also get in touch directly: gnark@consensys.net +To design your first circuit, follow the tutorial in [`gnark` User Documentation]. -## Release Notes +## Supported Proving Systems and Curves -[Release Notes](CHANGELOG.md) +`gnark` currently supports: -## Audits +- Groth16 +- PLONK -* [Kudelski Security - October 2022 - gnark-crypto (contracted by Algorand Foundation)](audits/2022-10%20-%20Kudelski%20-%20gnark-crypto.pdf) -* [Sigma Prime - May 2023 - gnark-crypto KZG (contracted by Ethereum Foundation)](audits/2024-05%20-%20Sigma%20Prime%20-%20kzg.pdf) -* [Consensys Diligence - June 2023 - gnark PLONK Solidity verifier](https://consensys.io/diligence/audits/2023/06/linea-plonk-verifier/) -* [LeastAuthority - August 2023 - gnark Groth16 Solidity verifier template (contracted by Worldcoin)](https://leastauthority.com/wp-content/uploads/2023/08/Worldcoin_Groth16_Verifier_in_EVM_Smart_Contract_Final_Audit_Report.pdf) -* [OpenZeppelin - November 2023 - gnark PLONK Solidity verifier template](https://blog.openzeppelin.com/linea-verifier-audit-1) -* [ZKSecurity.xyz - May 2024 - gnark standard library](audits/2024-05%20-%20zksecurity%20-%20gnark%20std.pdf) -* [OpenZeppelin - June 2024 - gnark PLONK prover and verifier](https://blog.openzeppelin.com/linea-prover-audit) -* [LeastAuthority - September 2024 - gnark general and GKR](audits/2024-09%20-%20Least%20Authority%20-%20arithm%20and%20GKR.pdf) -* [LeastAuthority - November 2024 - Linea zkEVM](audits/2024-11%20-%20Least%20Authority%20-%20Linea%20zkEVM.pdf) +on the following curves: -## Proving schemes and curves +- BN254 +- BLS12-381 +- BLS12-377 +- BW6-761 -Refer to [Proving schemes and curves] for more details. +Notes: -`gnark` support the following zk-SNARKs: +- Solidity verifier export support is curve-dependent (BN254 is the primary target). +- Serialized formats are not guaranteed to be stable across versions. -- [x] [Groth16](https://eprint.iacr.org/2016/260) -- [x] [PlonK](https://eprint.iacr.org/2019/953) +## GPU Acceleration (Experimental) -which can be instantiated with the following curves +`gnark` includes experimental GPU acceleration through Ingonyama's ICICLE backend for Groth16 on: -- [x] BN254 -- [x] BLS12-381 -- [x] BLS12-377 -- [x] BW6-761 +- BN254 +- BLS12-377 +- BLS12-381 +- BW6-761 -### Example +See [accelerated backend documentation](backend/accelerated/icicle/doc.go) and the [ICICLE repository](https://github.com/ingonyama-zk/icicle-gnark). -Refer to the [`gnark` User Documentation] +## Example Circuit -Here is what `x**3 + x + 5 = y` looks like +The circuit below encodes `x**3 + x + 5 == y`. -```golang +```go package main import ( @@ -120,17 +90,14 @@ import ( "github.com/consensys/gnark/frontend/cs/r1cs" ) -// CubicCircuit defines a simple circuit +// CubicCircuit defines a simple circuit. // x**3 + x + 5 == y type CubicCircuit struct { - // struct tags on a variable is optional - // default uses variable name and secret visibility. X frontend.Variable `gnark:"x"` Y frontend.Variable `gnark:",public"` } -// Define declares the circuit constraints -// x**3 + x + 5 == y +// Define declares the circuit constraints. func (circuit *CubicCircuit) Define(api frontend.API) error { x3 := api.Mul(circuit.X, circuit.X, circuit.X) api.AssertIsEqual(circuit.Y, api.Add(x3, circuit.X, 5)) @@ -138,46 +105,61 @@ func (circuit *CubicCircuit) Define(api frontend.API) error { } func main() { - // compiles our circuit into a R1CS var circuit CubicCircuit ccs, _ := frontend.Compile(ecc.BN254.ScalarField(), r1cs.NewBuilder, &circuit) - // groth16 zkSNARK: Setup pk, vk, _ := groth16.Setup(ccs) - // witness definition assignment := CubicCircuit{X: 3, Y: 35} witness, _ := frontend.NewWitness(&assignment, ecc.BN254.ScalarField()) publicWitness, _ := witness.Public() - // groth16: Prove & Verify proof, _ := groth16.Prove(ccs, pk, witness) - groth16.Verify(proof, vk, publicWitness) + _ = groth16.Verify(proof, vk, publicWitness) } - ``` -### GPU Support +## Security + +**`gnark` and [`gnark-crypto`] have been [extensively audited](#audits), but are provided as-is with no guarantees or warranties. In particular, `gnark` does not guarantee constant-time implementations or side-channel resistance.** -#### ICICLE Library +Report vulnerabilities via [Security Policy](SECURITY.md). Do **not** open public issues for security reports. -The following schemes and curves support experimental use of Ingonyama's ICICLE GPU library for low level zk-SNARK primitives such as MSM, NTT, and polynomial operations: +Published advisories are listed [here](https://github.com/Consensys/gnark/security/advisories?state=published). -- [x] [Groth16](https://eprint.iacr.org/2016/260) +## Testing -instantiated with the following curve(s) +CI runs formatting, generated-file, lint, and test checks on pull requests and pushes. -- [x] BN254 -- [x] BLS12-377 -- [x] BLS12-381 -- [x] BW6-761 +Common local commands: + +```bash +go test -short ./... +go test -tags=release_checks,solccheck . +go test -tags=prover_checks ./test/... ./examples/... +go test -run=NONE -fuzz=FuzzIntcomp -fuzztime=30s ./internal/backend/ioutils +go generate ./... +``` + +## Audits + +- [Kudelski Security - October 2022 - gnark-crypto (contracted by Algorand Foundation)](audits/2022-10%20-%20Kudelski%20-%20gnark-crypto.pdf) +- [Sigma Prime - May 2024 - gnark-crypto KZG (contracted by Ethereum Foundation)](audits/2024-05%20-%20Sigma%20Prime%20-%20kzg.pdf) +- [Consensys Diligence - June 2023 - gnark PLONK Solidity verifier](https://consensys.io/diligence/audits/2023/06/linea-plonk-verifier/) +- [LeastAuthority - August 2023 - gnark Groth16 Solidity verifier template (contracted by Worldcoin)](https://leastauthority.com/wp-content/uploads/2023/08/Worldcoin_Groth16_Verifier_in_EVM_Smart_Contract_Final_Audit_Report.pdf) +- [OpenZeppelin - November 2023 - gnark PLONK Solidity verifier template](https://blog.openzeppelin.com/linea-verifier-audit-1) +- [ZKSecurity.xyz - May 2024 - gnark standard library](audits/2024-05%20-%20zksecurity%20-%20gnark%20std.pdf) +- [OpenZeppelin - June 2024 - gnark PLONK prover and verifier](https://blog.openzeppelin.com/linea-prover-audit) +- [LeastAuthority - September 2024 - gnark general and GKR](audits/2024-09%20-%20Least%20Authority%20-%20arithm%20and%20GKR.pdf) +- [LeastAuthority - November 2024 - Linea zkEVM](audits/2024-11%20-%20Least%20Authority%20-%20Linea%20zkEVM.pdf) + +## Release Notes -For usage instructions see [accelerated backend documentation](backend/accelerated/icicle/doc.go) and [ICICLE repo](https://github.com/ingonyama-zk/icicle-gnark). +See [CHANGELOG.md](CHANGELOG.md). ## Citing -If you use `gnark` in your research a citation would be appreciated. -Please use the following BibTeX to cite the most recent release. +If you use `gnark` in research, please cite the latest release: ```bib @software{gnark-v0.14.0, @@ -198,22 +180,18 @@ Please use the following BibTeX to cite the most recent release. ## Contributing -Please read [CONTRIBUTING.md](CONTRIBUTING.md) for details on our [code of conduct](CODE_OF_CONDUCT.md), and the process for submitting pull requests to us. +See [CONTRIBUTING.md](CONTRIBUTING.md) and [CODE_OF_CONDUCT.md](CODE_OF_CONDUCT.md). ## Versioning -We use [SemVer](http://semver.org/) for versioning. For the versions available, see the [tags on this repository](https://github.com/Consensys/gnark/tags). +`gnark` follows [SemVer](http://semver.org/). Available versions are in [tags](https://github.com/Consensys/gnark/tags). ## License -This project is licensed under the Apache 2 License - see the [LICENSE](LICENSE) file for details +Licensed under Apache 2.0 (see [LICENSE](LICENSE)). [`gnark` Issues]: https://github.com/Consensys/gnark/issues [`gnark` Playground]: https://play.gnark.io [`gnark` User Documentation]: https://docs.gnark.consensys.net/ -[GitHub discussions]: https://github.com/Consensys/gnark/discussions -[Proving schemes and curves]: https://docs.gnark.consensys.net/Concepts/schemes_curves [`gnark-announce`]: https://groups.google.com/g/gnark-announce -[@gnark_team]: https://twitter.com/gnark_team [`gnark-crypto`]: https://github.com/Consensys/gnark-crypto -[`gnark-solidity-checker`]: https://github.com/Consensys/gnark-solidity-checker From 77ad9a38204ffe68cc803573b32061e6b31357f8 Mon Sep 17 00:00:00 2001 From: Gautam Botrel Date: Tue, 10 Feb 2026 17:27:22 -0600 Subject: [PATCH 2/5] reintroduce slack notif --- .github/workflows/pr.yml | 13 ++++ .github/workflows/push.yml | 13 ++++ .github/workflows/slack-notifications.yml | 84 +++++++++++++++++++++++ 3 files changed, 110 insertions(+) create mode 100644 .github/workflows/slack-notifications.yml diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index f3780f57ea..ce455f4e59 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -91,3 +91,16 @@ jobs: go test -json -v -p 4 -timeout=30m -tags=prover_checks ./test/... 2>&1 | gotestfmt -hide=all | tee -a /tmp/gotest.log go test -json -v -p 4 -timeout=30m -tags=prover_checks ./examples/... 2>&1 | gotestfmt -hide=all | tee -a /tmp/gotest.log go test -json -v -run=NONE -fuzz=FuzzIntcomp -fuzztime=30s ./internal/backend/ioutils 2>&1 | gotestfmt -hide=all | tee -a /tmp/gotest.log + + notify: + needs: test + if: always() + uses: ./.github/workflows/slack-notifications.yml + with: + status: ${{ needs.test.result == 'success' && 'success' || 'failure' }} + actor: ${{ github.actor }} + repository: ${{ github.repository }} + branch: ${{ github.head_ref }} + run_id: ${{ github.run_id }} + secrets: + SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }} diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index 989521cb2b..75f4f34e32 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -106,3 +106,16 @@ jobs: go test -v -p 4 -timeout=50m -tags=release_checks -race ./examples/cubic/... go test -v -p 4 -timeout=50m -tags=release_checks -short -race ./test/... go test -v -run=NONE -fuzz=FuzzIntcomp -fuzztime=30s ./internal/backend/ioutils + + notify: + needs: test + if: always() + uses: ./.github/workflows/slack-notifications.yml + with: + status: ${{ needs.test.result == 'success' && 'success' || 'failure' }} + actor: ${{ github.actor }} + repository: ${{ github.repository }} + branch: ${{ github.ref_name }} + run_id: ${{ github.run_id }} + secrets: + SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }} diff --git a/.github/workflows/slack-notifications.yml b/.github/workflows/slack-notifications.yml new file mode 100644 index 0000000000..46833a112a --- /dev/null +++ b/.github/workflows/slack-notifications.yml @@ -0,0 +1,84 @@ +name: Slack Notifications + +on: + workflow_call: + secrets: + SLACK_BOT_TOKEN: + required: true + inputs: + status: + description: 'The status of the workflow (success or failure)' + required: true + type: string + actor: + description: 'The GitHub actor' + required: true + type: string + repository: + description: 'The GitHub repository' + required: true + type: string + branch: + description: 'The branch name' + required: true + type: string + run_id: + description: 'The workflow run ID' + required: true + type: string + +jobs: + notify_slack: + runs-on: ubuntu-latest + steps: + - name: Post to Slack + run: | + if [ "${{ inputs.status }}" == "success" ]; then + payload=$(jq -n --arg repository "${{ inputs.repository }}" --arg branch "${{ inputs.branch }}" --arg actor "${{ inputs.actor }}" --arg run_id "${{ inputs.run_id }}" '{ + "channel": "team-gnark-build", + "text": "GitHub Action build result: success", + "blocks": [ + { + "type": "section", + "text": { + "type": "mrkdwn", + "text": ":large_green_circle: *All checks have passed:* *\($branch)* :white_check_mark:" + }, + }, + { + "type": "context", + "elements": [ + { + "type": "mrkdwn", + "text": "\($repository) -- \($actor) -- " + } + ] + } + ] + }') + else + payload=$(jq -n --arg repository "${{ inputs.repository }}" --arg branch "${{ inputs.branch }}" --arg actor "${{ inputs.actor }}" --arg run_id "${{ inputs.run_id }}" '{ + "channel": "team-gnark-build", + "text": "GitHub Action build result: failure", + "blocks": [ + { + "type": "section", + "text": { + "type": "mrkdwn", + "text": ":red_circle: *Failed run:* *\($branch)*" + }, + }, + { + "type": "context", + "elements": [ + { + "type": "mrkdwn", + "text": "\($repository) -- \($actor) -- " + } + ] + } + ] + }') + fi + response=$(curl -s -X POST -H 'Content-type: application/json; charset=utf-8' --data "$payload" https://slack.com/api/chat.postMessage -H "Authorization: Bearer ${{ secrets.SLACK_BOT_TOKEN }}" ) + shell: bash From 7141fbb444fd0f17e99056bc46bf599dcf451f6a Mon Sep 17 00:00:00 2001 From: Gautam Botrel Date: Tue, 10 Feb 2026 17:36:56 -0600 Subject: [PATCH 3/5] reintroduce slack notif and use go tools --- .github/workflows/pr.yml | 8 +------- .github/workflows/push.yml | 10 +--------- .../accelerated/icicle/internal/generator/main.go | 13 ++++++++++++- go.mod | 9 +++++++++ go.sum | 8 ++++++++ internal/generator/backend/main.go | 13 ++++++++++++- 6 files changed, 43 insertions(+), 18 deletions(-) diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index ce455f4e59..9a83830e17 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -27,14 +27,10 @@ jobs: go-version: ${{ env.GO_VERSION }} cache: true - - name: install deps - run: | - go install golang.org/x/tools/cmd/goimports@${{ env.GOIMPORTS_VERSION }} - go install github.com/klauspost/asmfmt/cmd/asmfmt@${{ env.ASMFMT_VERSION }} - name: gofmt run: if [[ -n $(gofmt -l .) ]]; then echo "please run gofmt"; exit 1; fi - name: goimports - run: if [[ -n $(goimports -l .) ]]; then echo "please run goimports"; exit 1; fi + run: if [[ -n $(go tool goimports -l .) ]]; then echo "please run goimports"; exit 1; fi - name: generated files should not be modified run: | go generate ./... @@ -67,8 +63,6 @@ jobs: - name: install deps run: | - go install golang.org/x/tools/cmd/goimports@${{ env.GOIMPORTS_VERSION }} - go install github.com/klauspost/asmfmt/cmd/asmfmt@${{ env.ASMFMT_VERSION }} go install github.com/consensys/gnark-solidity-checker@v0.1.0 go install github.com/ethereum/go-ethereum/cmd/abigen@v1.14.8 sudo add-apt-repository ppa:ethereum/ethereum diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index 75f4f34e32..3911c2030f 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -13,8 +13,6 @@ permissions: env: GO_VERSION: 1.25.x - GOIMPORTS_VERSION: v0.42.0 - ASMFMT_VERSION: v1.3.2 jobs: staticcheck: @@ -30,14 +28,10 @@ jobs: go-version: ${{ env.GO_VERSION }} cache: true - - name: install deps - run: | - go install golang.org/x/tools/cmd/goimports@${{ env.GOIMPORTS_VERSION }} - go install github.com/klauspost/asmfmt/cmd/asmfmt@${{ env.ASMFMT_VERSION }} - name: gofmt run: if [[ -n $(gofmt -l .) ]]; then echo "please run gofmt"; exit 1; fi - name: goimports - run: if [[ -n $(goimports -l .) ]]; then echo "please run goimports"; exit 1; fi + run: if [[ -n $(go tool goimports -l .) ]]; then echo "please run goimports"; exit 1; fi - name: generated files should not be modified run: | go generate ./... @@ -80,8 +74,6 @@ jobs: cache: true - name: install deps run: | - go install golang.org/x/tools/cmd/goimports@${{ env.GOIMPORTS_VERSION }} - go install github.com/klauspost/asmfmt/cmd/asmfmt@${{ env.ASMFMT_VERSION }} go install github.com/ethereum/go-ethereum/cmd/abigen@v1.14.8 - name: install solc deps if: startsWith(matrix.os, 'gha-runner-scale-set-ubuntu') == true diff --git a/backend/accelerated/icicle/internal/generator/main.go b/backend/accelerated/icicle/internal/generator/main.go index bf1d6d1af7..786855436c 100644 --- a/backend/accelerated/icicle/internal/generator/main.go +++ b/backend/accelerated/icicle/internal/generator/main.go @@ -66,7 +66,7 @@ func main() { } runCmd("gofmt", "-w", "../../groth16") - runCmd("goimports", "-w", "../../groth16") + runGoImports() } func runCmd(name string, arg ...string) { @@ -78,3 +78,14 @@ func runCmd(name string, arg ...string) { panic(err) } } + +func runGoImports() { + fmt.Println("go tool goimports", "-w", "../../groth16") + cmd := exec.Command("go", "tool", "goimports", "-w", "../../groth16") + cmd.Stdout = os.Stdout + cmd.Stderr = os.Stderr + if err := cmd.Run(); err != nil { + panic(err) + } + +} diff --git a/go.mod b/go.mod index 753d34278e..caa02e5bac 100644 --- a/go.mod +++ b/go.mod @@ -23,12 +23,21 @@ require ( require ( github.com/davecgh/go-spew v1.1.1 // indirect + github.com/klauspost/asmfmt v1.3.2 // indirect github.com/mattn/go-colorable v0.1.14 // indirect github.com/mattn/go-isatty v0.0.20 // indirect github.com/mmcloughlin/addchain v0.4.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect github.com/x448/float16 v0.8.4 // indirect + golang.org/x/mod v0.33.0 // indirect golang.org/x/sys v0.41.0 // indirect + golang.org/x/telemetry v0.0.0-20260209163413-e7419c687ee4 // indirect + golang.org/x/tools v0.42.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect rsc.io/tmplfunc v0.0.3 // indirect ) + +tool ( + github.com/klauspost/asmfmt/cmd/asmfmt + golang.org/x/tools/cmd/goimports +) diff --git a/go.sum b/go.sum index 71cf3c62e3..1eb1a51c4c 100644 --- a/go.sum +++ b/go.sum @@ -192,6 +192,8 @@ github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/X github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU= github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= +github.com/klauspost/asmfmt v1.3.2 h1:4Ri7ox3EwapiOjCki+hw14RyKk201CN4rzyCJRFLpK4= +github.com/klauspost/asmfmt v1.3.2/go.mod h1:AG8TuvYojzulgDAMCnYn50l/5QV3Bs/tp6j0HLHbNSE= github.com/kr/fs v0.1.0/go.mod h1:FFnZGqtBN9Gxj7eW1uZ42v5BccTP0vu6NEaFoC2HwRg= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= @@ -345,6 +347,8 @@ golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/mod v0.9.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= +golang.org/x/mod v0.33.0 h1:tHFzIWbBifEmbwtGz65eaWyGiGZatSrT9prnU8DbVL8= +golang.org/x/mod v0.33.0/go.mod h1:swjeQEj+6r7fODbD2cqrnje9PnziFuw4bmLbBZFrQ5w= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20181023162649-9b4f9f5ad519/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -463,6 +467,8 @@ golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.41.0 h1:Ivj+2Cp/ylzLiEU89QhWblYnOE9zerudt9Ftecq2C6k= golang.org/x/sys v0.41.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks= +golang.org/x/telemetry v0.0.0-20260209163413-e7419c687ee4 h1:bTLqdHv7xrGlFbvf5/TXNxy/iUwwdkjhqQTJDjW7aj0= +golang.org/x/telemetry v0.0.0-20260209163413-e7419c687ee4/go.mod h1:g5NllXBEermZrmR51cJDQxmJUHUOfRAaNyWBM+R+548= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= @@ -535,6 +541,8 @@ golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= golang.org/x/tools v0.7.0/go.mod h1:4pg6aUX35JBAogB10C9AtvVL+qowtN4pT3CGSQex14s= +golang.org/x/tools v0.42.0 h1:uNgphsn75Tdz5Ji2q36v/nsFSfR/9BRFvqhGBaJGd5k= +golang.org/x/tools v0.42.0/go.mod h1:Ma6lCIwGZvHK6XtgbswSoWroEkhugApmsXyrUmBhfr0= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= diff --git a/internal/generator/backend/main.go b/internal/generator/backend/main.go index 81d6a22c3c..d2c3be31db 100644 --- a/internal/generator/backend/main.go +++ b/internal/generator/backend/main.go @@ -242,7 +242,7 @@ func main() { runCmd("gofmt", "-w", "../../../") // run goimports on whole directory - runCmd("goimports", "-w", "../../../") + runGoImports() } func runCmd(name string, arg ...string) { @@ -253,6 +253,17 @@ func runCmd(name string, arg ...string) { assertNoError(cmd.Run()) } +func runGoImports() { + fmt.Println("go tool goimports", "-w", "../../../") + cmd := exec.Command("go", "tool", "goimports", "-w", "../../../") + cmd.Stdout = os.Stdout + cmd.Stderr = os.Stderr + if err := cmd.Run(); err != nil { + panic(err) + } + +} + type templateData struct { RootPath string CSPath string From bdf031260c7e06eb271fdb1d5baab64608239454 Mon Sep 17 00:00:00 2001 From: Gautam Botrel Date: Tue, 10 Feb 2026 17:40:16 -0600 Subject: [PATCH 4/5] build: update to latest gnark crypto --- go.mod | 2 +- go.sum | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/go.mod b/go.mod index caa02e5bac..5da4d99aa5 100644 --- a/go.mod +++ b/go.mod @@ -7,7 +7,7 @@ require ( github.com/blang/semver/v4 v4.0.0 github.com/consensys/bavard v0.2.2-0.20260118153501-cba9f5475432 github.com/consensys/compress v0.3.0 - github.com/consensys/gnark-crypto v0.19.3-0.20260210161253-243aa4749a4a + github.com/consensys/gnark-crypto v0.19.3-0.20260210233638-4abc1c162a65 github.com/fxamacker/cbor/v2 v2.9.0 github.com/google/go-cmp v0.7.0 github.com/google/pprof v0.0.0-20260202012954-cb029daf43ef diff --git a/go.sum b/go.sum index 1eb1a51c4c..46a0e8e981 100644 --- a/go.sum +++ b/go.sum @@ -63,6 +63,8 @@ github.com/consensys/compress v0.3.0 h1:HRIcHvWkW9C9req0ZWg7mhYHzBarohXhcszIwHON github.com/consensys/compress v0.3.0/go.mod h1:pyM+ZXiNUh7/0+AUjUf9RKUM6vSH7T/fsn5LLS0j1Tk= github.com/consensys/gnark-crypto v0.19.3-0.20260210161253-243aa4749a4a h1:ffO/ONCvDL2YXvYi2uGulGnaHmUFXTpJuCvvI8SJaXc= github.com/consensys/gnark-crypto v0.19.3-0.20260210161253-243aa4749a4a/go.mod h1:wCDVWxJD3czvDwVK2UcQZAPiWQSv37hx0YfQjteHNUM= +github.com/consensys/gnark-crypto v0.19.3-0.20260210233638-4abc1c162a65 h1:uqG0l8Ou1qcqu2S+vRNn1ye7tw92x3R1UFzYiJemHI0= +github.com/consensys/gnark-crypto v0.19.3-0.20260210233638-4abc1c162a65/go.mod h1:LlrRbe6b7BIune9Un5L6sRTUUWrAIIqGK+L0duYwpoM= github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= github.com/coreos/go-systemd/v22 v22.3.2/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= github.com/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= From 44a69e411efe8c48597c0d0516d5e050cbd9a371 Mon Sep 17 00:00:00 2001 From: Gautam Botrel Date: Tue, 10 Feb 2026 20:21:31 -0600 Subject: [PATCH 5/5] test: shorten pr workflow tests --- .github/workflows/pr.yml | 10 +++++----- integration_test.go | 4 ++++ std/evmprecompiles/05-expmod_test.go | 10 ++++++++-- std/evmprecompiles/10-kzg_point_evaluation_test.go | 3 +++ std/evmprecompiles/256-p256verify_test.go | 3 +++ 5 files changed, 23 insertions(+), 7 deletions(-) diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 9a83830e17..9b7f712a6c 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -80,11 +80,11 @@ jobs: - name: Run tests run: | set -euo pipefail - go test -json -v -p 4 -short -timeout=30m ./... 2>&1 | gotestfmt -hide=all | tee /tmp/gotest.log - go test -json -v -p 4 -timeout=30m -tags=release_checks,solccheck . 2>&1 | gotestfmt -hide=all | tee -a /tmp/gotest.log - go test -json -v -p 4 -timeout=30m -tags=prover_checks ./test/... 2>&1 | gotestfmt -hide=all | tee -a /tmp/gotest.log - go test -json -v -p 4 -timeout=30m -tags=prover_checks ./examples/... 2>&1 | gotestfmt -hide=all | tee -a /tmp/gotest.log - go test -json -v -run=NONE -fuzz=FuzzIntcomp -fuzztime=30s ./internal/backend/ioutils 2>&1 | gotestfmt -hide=all | tee -a /tmp/gotest.log + go test -short -json -v -p 4 -short -timeout=30m ./... 2>&1 | gotestfmt -hide=all | tee /tmp/gotest.log + go test -short -json -v -p 4 -timeout=30m -tags=release_checks,solccheck . 2>&1 | gotestfmt -hide=all | tee -a /tmp/gotest.log + go test -short -json -v -p 4 -timeout=30m -tags=prover_checks ./test/... 2>&1 | gotestfmt -hide=all | tee -a /tmp/gotest.log + go test -short -json -v -p 4 -timeout=30m -tags=prover_checks ./examples/... 2>&1 | gotestfmt -hide=all | tee -a /tmp/gotest.log + go test -short -json -v -run=NONE -fuzz=FuzzIntcomp -fuzztime=10s ./internal/backend/ioutils 2>&1 | gotestfmt -hide=all | tee -a /tmp/gotest.log notify: needs: test diff --git a/integration_test.go b/integration_test.go index 4c2fb49a25..ae49d2df90 100644 --- a/integration_test.go +++ b/integration_test.go @@ -27,6 +27,10 @@ func TestIntegrationAPI(t *testing.T) { name := keys[i] tData := circuits.Circuits[name] + if testing.Short() && name != "add" && name != "mul" && name != "commit" { + continue + } + assert.Run(func(assert *test.Assert) { opts := []test.TestingOption{ diff --git a/std/evmprecompiles/05-expmod_test.go b/std/evmprecompiles/05-expmod_test.go index f2cd24c905..a2dd3b0a10 100644 --- a/std/evmprecompiles/05-expmod_test.go +++ b/std/evmprecompiles/05-expmod_test.go @@ -51,7 +51,11 @@ func testInstance(edgeCases bool, base, exp, modulus, result *big.Int) error { func TestRandomInstance(t *testing.T) { assert := test.NewAssert(t) - for _, bits := range []int{256, 512, 1024, 2048, 4096} { + expBits := []int{256, 512, 1024, 2048, 4096} + if testing.Short() { + expBits = []int{256, 512} + } + for _, bits := range expBits { assert.Run(func(assert *test.Assert) { modulus := new(big.Int).Lsh(big.NewInt(1), uint(bits)) base, _ := rand.Int(rand.Reader, modulus) @@ -75,7 +79,9 @@ func TestEdgeCases(t *testing.T) { {big.NewInt(123), big.NewInt(123), big.NewInt(0), big.NewInt(0)}, // 123^123 = 0 mod 1 {big.NewInt(0), big.NewInt(123), big.NewInt(123), big.NewInt(0)}, // 0^123 = 0 mod 123 {big.NewInt(123), big.NewInt(0), big.NewInt(123), big.NewInt(1)}, // 123^0 = 1 mod 123 - + } + if testing.Short() { + testCases = testCases[:2] } for i, tc := range testCases { assert.Run(func(assert *test.Assert) { diff --git a/std/evmprecompiles/10-kzg_point_evaluation_test.go b/std/evmprecompiles/10-kzg_point_evaluation_test.go index 8c9320719f..4d3c8e1241 100644 --- a/std/evmprecompiles/10-kzg_point_evaluation_test.go +++ b/std/evmprecompiles/10-kzg_point_evaluation_test.go @@ -192,6 +192,9 @@ func runFailureCircuit16(_ *test.Assert, evaluationPoint fr.Element, claimedValu } func TestKzgPointEvaluationPrecompileFailure16(t *testing.T) { + if testing.Short() { + t.Skip("skipping test in short mode") + } assert := test.NewAssert(t) // setup loading diff --git a/std/evmprecompiles/256-p256verify_test.go b/std/evmprecompiles/256-p256verify_test.go index 585c6aaeab..cee2b8ad37 100644 --- a/std/evmprecompiles/256-p256verify_test.go +++ b/std/evmprecompiles/256-p256verify_test.go @@ -82,6 +82,9 @@ func TestP256VerifyCircuit(t *testing.T) { } func TestP256VerifyMockedArithmetization(t *testing.T) { + if testing.Short() { + t.Skip("skipping test in short mode") + } assert := test.NewAssert(t) data, err := os.ReadFile("test_vectors/p256verify_vectors.json") assert.NoError(err, "read vectors.json")