Conversation
ivokub
reviewed
May 2, 2026
ivokub
reviewed
May 2, 2026
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 41a9850. Configure here.
Collaborator
|
Review pass from 2026-05-07. Findings:
Verification run locally:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Description
This PR adds support for the
KB8curve (pronounced /k/ [b] nueve, although the extension is 8) over the KoalaBear field and introduces a native multiset hash built on top of it. The target use case is circuit-friendly multiset hashing for computations defined over the KoalaBear field, in particular zkVM memory arguments that will later be verified inside SNARK circuits.Concretely, this PR:
ecc.KB8curve and theecc/kb8packagefield/koalabearfor the base field and adds sharedE8support infield/koalabear/extensionskb8curve arithmetic, scalar field, generator config, and testsecc/kb8/multiset-hash, implementing the deterministicy-increment multiset hash onkb8kb8while keeping the rest of the repository greenThe multiset hash maps
uint16messages by searchingy = 256*m + kfork < 256, solving the resulting depressed cubic over the extension field, and accumulating mapped points onkb8. The final implementation uses recursive Cardano with binary Lucas sequences at every extension level.Type of change
How has this been tested?
The following checks pass locally:
go test ./field/koalabear/extensions ./ecc/kb8/...Additional validation performed during development:
Map(uint16)validation over all65536inputsHow has this been benchmarked?
Benchmarks were run locally on a MacBook Pro class machine (
darwin/arm64, Apple M5, 32GB RAM) with:Current results:
BenchmarkMap-10:28008 ns/opBenchmarkAccumulatorInsert-10:7330262 ns/opBenchmarkHash256-10:7159831 ns/opChecklist:
golangci-lintdoes not output errors locallyNote
High Risk
Adds a new elliptic-curve family (
KB8) plus extensive generated finite-field arithmetic (including asm paths) and hashing primitives; correctness issues here would impact cryptographic/security-sensitive operations and any consumers relying on curve/field behavior.Overview
Adds support for the new
ecc.KB8curve ID, wiring it into ID parsing/printing and exposing its scalar/base field moduli.Introduces a new
ecc/kb8subtree:fpis a thin alias over the existing KoalaBear base field, whilefradds a full generated scalar-field implementation (Montgomery arithmetic, inversion/Legendre/sqrt/cbrt, vector ops, and architecture-specific asm/purego backends) with comprehensive tests, including a regression forCbrt(0).Reviewed by Cursor Bugbot for commit 569c9ef. Bugbot is set up for automated code reviews on this repo. Configure here.