chore: small field golangci update#2502
chore: small field golangci update#2502ivokub wants to merge 14 commits intoprover/dev-small-fieldsfrom
Conversation
prover/zkevm/prover/statemanager/accumulatorsummary/accumulator_summary.go
Fixed
Show fixed
Hide fixed
f628767 to
42e82ef
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 2 potential issues.
Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
| // flattenBlocks flattens the input slice of blocks into a single slice of columns. | ||
| func flattenBlocks[T any](blocks [][poseidon2_koalabear.BlockSize]T) []T { | ||
| var res []T | ||
| res := make([]T, 0, len(blocks)*len(blocks[0])) |
There was a problem hiding this comment.
Capacity calculation panics on empty blocks input
Low Severity
The capacity calculation len(blocks)*len(blocks[0]) accesses blocks[0], which panics if blocks is empty. The old code (var res []T) gracefully returned nil for empty input. Since the element type is [poseidon2_koalabear.BlockSize]T (a fixed-size array), the constant BlockSize (already aliased in this file at line 18) can be used instead of len(blocks[0]), avoiding the index-out-of-range while keeping the preallocation benefit.
| fullCol := []field.Element{} | ||
| // Will carry the concatenation of the columns for the same entry j. | ||
| // All commitments share the same RS parameters, so columns[i][j] all have equal length. | ||
| fullCol := make([]field.Element, 0, len(columns[0][j])*numCommitments) |
There was a problem hiding this comment.
Capacity calculation panics when columns slice is empty
Low Severity
The capacity expression len(columns[0][j]) * numCommitments accesses columns[0] unconditionally. If columns is empty but entryList is non-empty, this panics with index-out-of-range. The old code ([]field.Element{}) handled this gracefully by producing an empty slice. The same pattern appears in GnarkCheckLinComb and assignOpenedColumns.


Update defined Go to align with gnark dependency. Also updates golangci-lint to the latest version to support Go 1.25 and Go 1.26.
Checklist
Note
Medium Risk
Mostly mechanical allocations/capacity pre-sizing and CI/tooling bumps, but it also touches verification logic (e.g., fixed-permutation input validation) and some ZK prover/circuit wiring, so regressions would surface at runtime if assumptions (like non-empty inputs) are violated.
Overview
Updates prover CI to Go
1.25.x, bumpsgolangci-linttov2.10.1, updatesgo.modtogo 1.25.7, adjusts.golangci.yml(new gosec excludes and additional excluded path), and removes the 32-bit/race test step.Across the prover, replaces many
[]T{}/var x []T+appendpatterns with capacity-awaremake(..., 0, n)(and a few//nolint:preallocexceptions), includingutils.Joinnow precomputing total capacity to avoid reallocations.Makes a couple of non-trivial safety/behavior tweaks:
checkFixedPermutationnow validates non-empty/consistent dimensions before flattening,statesummary.paddnow panics on undersized padding, and generated cgo headers are regenerated/adjusted for C/C++/MSVC compatibility (voidprototypes, complex types, Go string helpers).Written by Cursor Bugbot for commit 42e82ef. This will update automatically on new commits. Configure here.