Repository navigation
Conversation
Ports that carried n bits as `signal {binary} x[n]` are now
`BinaryNumber(n)` buses, and internal uses of Num2Bits/Bits2Num are
replaced by Num2Bin/Bin2Num.
- Converted templates: MultiAND, Mux2..4, MultiMux2..4, BinSum, BinSub,
CompConstant, Sign, AliasCheck, BinaryCheckArray (output),
EscalarMul*, SegmentMul*, WindowMulFix, Pedersen, Segment, Window4,
EdDSAPedersenVerifier (msg), the sha256 templates, SMTLevIns,
SMTProcessor and SMTProcessorSM (fnc).
- Num2Bits -> Num2Bin in babyjub, comparators, eddsaposeidon, pointbits,
sha256_2 and MinValueCheck/MinMaxValueCheck. In pointbits the explicit
AliasCheck is dropped, since Num2Bin(254) already performs it.
- AliasCheck keeps the CompConstant implementation; only its input
becomes BinaryNumber(maxbits()).
- Test circuits updated to the new interfaces; the JS tests are
unchanged apart from one comment.
- CHANGES.txt: template counts, the reshaped-ports list and a new
migration note 7. Docstrings and circuits/README.md updated.
All 52 test circuits compile with circom 2.2.3 with the same constraint
counts as before; npm test: 118 passing.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Author
|
Closing this: I'll resubmit the BinaryNumber versions as a separate set under circuits/binnums/ instead of replacing the existing templates, so the array-based API stays as it is. |
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.
Converts the ports that carry a number in binary from arrays of
{binary}signals to theBinaryNumber(n)bus, and replaces internal uses ofNum2Bits/Bits2NumwithNum2Bin/Bin2Num.Changes
BinaryNumber(n)(previouslysignal {binary} x[n]):MultiANDMux2..Mux4,MultiMux2..MultiMux4(selectors).Mux1/MultiMux1keep their single-bit selector.BinSum,BinSubCompConstant,Sign; andAliasCheckBinaryCheckArray(output)EscalarMul,EscalarMulWindow,EscalarMulAny,SegmentMulAny,EscalarMulFix,SegmentMulFix,WindowMulFixPedersen,Segment,Window4(alsopedersen_old)EdDSAPedersenVerifier(msg)Sha256,Sha256compression,Ch_t,Maj_t,Xor3,RotR,ShR,SmallSigma,BigSigma,SigmaPlus,T1,T2,H,K.Sha256_2keeps its ports.SMTLevIns(levIns),SMTProcessorandSMTProcessorSM(fnc)Num2Bits→Num2Bininbabyjub,comparators,eddsaposeidon,pointbits,sha256_2andMinValueCheck/MinMaxValueCheck. InpointbitstheAliasCheckcalls that followedNum2Bits(254)are removed, becauseNum2Bin(254)already performs the alias check.AliasCheckkeeps itsCompConstantimplementation; only its input becomesBinaryNumber(maxbits()).Num2Bits,Bits2Numand their_strictvariants keep their array interface.