Repository navigation
Support LLZK fields that are not builtins - #20
Merged
Merged
Conversation
Selective backport of core/src changes from e4df243.
0xddom
force-pushed
the
shankara/llzk-non-builtin-field
branch
from
October 13, 2026 16:37
2536264 to
2eaad64
Compare
0xddom
force-pushed
the
shankara/llzk-non-builtin-field
branch
from
October 13, 2026 17:05
5e0beba to
39b9ce2
Compare
0xddom
force-pushed
the
shankara/llzk-non-builtin-field
branch
from
October 13, 2026 17:30
39b9ce2 to
f19a753
Compare
The runner always passed --llzk-field-name to LLZK as a builtin field, so circuits over other primes could not be emitted and a mislabeled field was silently accepted. For example, a circuit over BLS12-381's scalar field labeled `bn254` produced LLZK over BN254's prime. Builtin names are now checked against the circuit's prime and rejected on a mismatch. Any other name defines a field with the circuit's prime. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
0xddom
force-pushed
the
shankara/llzk-non-builtin-field
branch
from
October 13, 2026 18:00
f19a753 to
f42ac56
Compare
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.
Problem
The runner passed
--llzk-field-namestraight toLlzkParams::with_builtin_field, so:bn254, but the circuit is overmidnight_curves::Fq(BLS12-381 scalar, 524358…184513), so the LLZK output declared the wrong prime.Change
bn128,bn254,grumpkin,babybear,goldilocks,mersenne31,koalabear, the set registered by LLZK'sField::initKnownFields) are checked against the circuit's prime (ResolvedIRCircuit::prime). A mismatch is an error.LlzkParams::with_prime_field.--llzk-field-namenow has help text describing this.Testing
halo2curvesBN254FrandFq(matching builtins,bn128alias, Grumpkin as BN254's base field, mismatch, custom name).cargo test -p haloumi-extractor-runner --all-featurespasses.--llzk-field-name bls12-381produces#felt.field<"bls12-381", 52435875175126190479447740508185965837690552500527637822603658699938581184513>.Notes
backends.llzk.field.builtin, which reads oddly for non-builtin names. Renaming it is left for a follow-up.🤖 Generated with Claude Code