Skip to content

refactor(prover): Remove redundant and unsafe utility functions#3273

Open
Tabaie wants to merge 3 commits into
mainfrom
prover/refac/pi-keccak-cleanup
Open

refactor(prover): Remove redundant and unsafe utility functions#3273
Tabaie wants to merge 3 commits into
mainfrom
prover/refac/pi-keccak-cleanup

Conversation

@Tabaie
Copy link
Copy Markdown
Contributor

@Tabaie Tabaie commented Jun 4, 2026

Removes some utility functions in the BLS12-377 Keccak prover that already exist in the root project. In particular removes the unsound and unused ToBytes function. Changes also include eliminating anything pertaining to an extension field in the BLS12-377 context.


Note

Low Risk
Mechanical import migration and removal of duplicate/unused helpers; main behavioral risk is subtle API differences in disjoint-set/collection usage in module discovery, which should be covered by existing tests.

Overview
This PR consolidates shared helpers by pointing the BLS12-377 Keccak prover at the monorepo-wide prover/utils package instead of the nested .../keccak/prover/utils copy. The diff is almost entirely import rewrites across circuits, crypto, maths, protocol, and zkevm code; behavior should stay the same for symbols that already lived in both places.

Tests and discovery: TestReduceBytes is dropped from circuits/internal/utils_test.go along with its BN254/random-byte setup—aligned with dropping duplicate or unsafe byte-reduction helpers from the local utils tree (e.g. unused ToBytes). In distributed module discovery, disjoint-set usage moves to prover/utils/collection (NewDisjointSetFromList, Ds.Parent instead of Ds.Rank), while keccak-local utils/collection Set types are kept under a kcollection alias.

Keccak-specific subpackages (utils/parallel, utils/arena, utils/gnarkutil, utils/types, etc.) are unchanged in this diff.

Reviewed by Cursor Bugbot for commit 83defd8. Bugbot is set up for automated code reviews on this repo. Configure here.

@Tabaie Tabaie requested review from AlexandreBelling and gusiri June 4, 2026 15:43
@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Jun 4, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 55.36%. Comparing base (8f2a5f5) to head (18526e4).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff            @@
##               main    #3273   +/-   ##
=========================================
  Coverage     55.36%   55.36%           
  Complexity     5247     5247           
=========================================
  Files          1126     1126           
  Lines         44644    44644           
  Branches       5356     5356           
=========================================
  Hits          24719    24719           
  Misses        19189    19189           
  Partials        736      736           
Flag Coverage Δ *Carryforward flag
hardhat 96.17% <ø> (ø)
kotlin 0.33% <ø> (ø) Carriedforward from 83defd8
lido-governance-monitor 97.61% <ø> (ø) Carriedforward from 83defd8
linea-native-libs 90.69% <ø> (ø) Carriedforward from 83defd8
linea-shared-utils 96.18% <ø> (ø) Carriedforward from 83defd8
native-yield-automation-service 97.68% <ø> (ø) Carriedforward from 83defd8
postman 99.92% <ø> (ø) Carriedforward from 83defd8
sdk-core 98.09% <ø> (ø) Carriedforward from 83defd8
sdk-ethers 89.83% <ø> (ø) Carriedforward from 83defd8
sdk-viem 99.45% <ø> (ø) Carriedforward from 83defd8
tracer 88.39% <ø> (ø) Carriedforward from 83defd8

*This pull request uses carry forward flags. Click here to find out more.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@Tabaie Tabaie added Prover Tag to use for all work impacting the prover P3: Low Issue priority: low Minor improvements The PR fixes typos or brings minor improvements go Pull requests that update Go code labels Jun 4, 2026
gusiri
gusiri previously approved these changes Jun 4, 2026
@Tabaie Tabaie requested a review from Copilot June 4, 2026 17:59
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot wasn't able to review this pull request because it exceeds the maximum number of files (300). Try reducing the number of changed files and requesting a review from Copilot again.

@Tabaie Tabaie requested a review from julien-marchand June 4, 2026 18:00
Copy link
Copy Markdown
Contributor

@AlexandreBelling AlexandreBelling left a comment

Choose a reason for hiding this comment

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

Approved on the basis that this should reduce the bug surface of the codebase.

@AlexandreBelling
Copy link
Copy Markdown
Contributor

Let's wait before the performances and bug fixes release is wrapped before merging.

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

Labels

go Pull requests that update Go code Minor improvements The PR fixes typos or brings minor improvements P3: Low Issue priority: low Prover Tag to use for all work impacting the prover

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants