Skip to content

chore: small field golangci update#2502

Open
ivokub wants to merge 14 commits intoprover/dev-small-fieldsfrom
chore/golangci-update
Open

chore: small field golangci update#2502
ivokub wants to merge 14 commits intoprover/dev-small-fieldsfrom
chore/golangci-update

Conversation

@ivokub
Copy link
Contributor

@ivokub ivokub commented Feb 26, 2026

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

  • I wrote new tests for my new core changes.
  • I have successfully ran tests, style checker and build against my new changes locally.
  • I have informed the team of any breaking changes if there are any.

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, bumps golangci-lint to v2.10.1, updates go.mod to go 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 + append patterns with capacity-aware make(..., 0, n) (and a few //nolint:prealloc exceptions), including utils.Join now precomputing total capacity to avoid reallocations.

Makes a couple of non-trivial safety/behavior tweaks: checkFixedPermutation now validates non-empty/consistent dimensions before flattening, statesummary.padd now panics on undersized padding, and generated cgo headers are regenerated/adjusted for C/C++/MSVC compatibility (void prototypes, complex types, Go string helpers).

Written by Cursor Bugbot for commit 42e82ef. This will update automatically on new commits. Configure here.

@ivokub ivokub changed the title Chore/golangci update chore: small field golangci update Feb 26, 2026
@ivokub ivokub force-pushed the chore/golangci-update branch from f628767 to 42e82ef Compare March 2, 2026 15:38
Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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]))
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Fix in Cursor Fix in Web

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)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Additional Locations (2)

Fix in Cursor Fix in Web

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant