Skip to content

Conversation

@Soleimani193
Copy link
Contributor

@Soleimani193 Soleimani193 commented Oct 21, 2025

This PR implements the chi step of keccakf for migration to the small field.

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

Implements the chi step for small-field keccakf (KoalaBear), exports the RC pattern helper, refactors the linear-combination sub-protocol, and adds targeted tests.

  • ZK-EVM Keccakf (KoalaBear):
    • Chi step: new chi module building 8-bit linear combinations, applying chi logic, adding RC via RepeatedPattern, and producing witness (stateNextWitness).
    • Tests: chi_test validates reconstruction of the state post Chi+Iota over multiple permutations.
  • Sub-protocols:
    • LinearCombination: rename to exported LinearCombination, new ctor NewLinearCombination, compute via keccakf.BaseRecompose, and add DecomposeForTesting; add protocols_test.
  • Keccakf Lookups:
    • Export ValRCBase2Pattern and update usages/tests.
  • Dedicated Protocol:
    • Add TestRepeatedPatWithVerifCol using verifiercol.NewConstantCol with RepeatedPattern.

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

@Soleimani193 Soleimani193 self-assigned this Oct 21, 2025
@Soleimani193 Soleimani193 added the Prover Tag to use for all work impacting the prover label Oct 21, 2025
@Soleimani193 Soleimani193 changed the title defining chi constraints chi step of keccakf for small field Oct 21, 2025
@Soleimani193 Soleimani193 marked this pull request as ready for review October 28, 2025 09:18
@Soleimani193 Soleimani193 merged commit 17f0b50 into prover/dev-keccakf-migration-small-field Oct 28, 2025
23 of 26 checks passed
@Soleimani193 Soleimani193 deleted the prover/chi-keccakf-small-field branch October 28, 2025 09:19
chi.StateNext[x][y][0],
sym.Mul(2, chi.RC.Natural),
)
}
Copy link

Choose a reason for hiding this comment

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

Bug: Round Constant Addition Loop Error

The symbolic definition for the round constant addition in newChi repeatedly adds the constant to StateNext[0][0][0] due to a hardcoded z index within a loop. This multiple addition creates an inconsistency with the assignChi function, which correctly applies the constant once, causing proof verification to fail.

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

Prover Tag to use for all work impacting the prover

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants