Repository navigation
Conversation
…of the library
circuits/binnums/ holds a second version of the library in which every
port that carries a number as n bits is a BinaryNumber(n) bus instead of
`signal {binary} x[n]`, and the internal uses of Num2Bits/Bits2Num are
Num2Bin/Bin2Num. Nothing in circuits/ changes.
- Converted: MultiAND, BinSum, BinSub, Mux2..4, MultiMux2..4,
AliasCheck, CompConstant, Sign, BinaryCheckArray (output), the
scalar multiplication templates, Pedersen/Segment/Window4 (also
pedersen_old), EdDSAPedersenVerifier (msg), the sha256 templates,
SMTLevIns, SMTProcessor and SMTProcessorSM (fnc).
- A file is copied into binnums/ when its interface changes or when it
includes one that does (39 files, same layout as circuits/). Files not
affected (buses, montgomery, mux1, switcher, poseidon*, ...) are
included from circuits/.
- Template names are unchanged, so a circuit includes from circuits/ or
from circuits/binnums/, never both.
- Tests: test/circuits/binnums/ (42 circuits) and test/binnums/ (22 JS
files, describe names suffixed "(binnums)"). npm test runs both sets.
- circuits/README.md and CHANGES.txt describe the new directory.
All test circuits compile with circom 2.2.3; each binnums test circuit has
the same constraint counts as its original. npm test: 227 passing
(118 existing + 109 binnums).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Adds
circuits/binnums/, a second version of the library in which every port that carries a number asnbits is aBinaryNumber(n)bus instead of an arraysignal {binary} x[n]. Nothing incircuits/changes: the array-based API stays as it is.This replaces #160, which converted the existing templates in place.
What is in
circuits/binnums/BinaryNumber(n)(bitiisx.bits[i], still taggedbinary):MultiAND,BinSum,BinSubMux2..Mux4,MultiMux2..MultiMux4(selectors)AliasCheck,CompConstant,Sign,BinaryCheckArray(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,KSMTLevIns(levIns),SMTProcessorandSMTProcessorSM(fnc)Num2Bits/Bits2NumbecomeNum2Bin/Bin2Num.Num2Bits,Bits2Numand their_strictvariants keep their arrays.binnums/when its interface changes or when it includes one that does: 39 files, same layout ascircuits/. Files that are not affected (buses,montgomery,mux1,switcher,poseidon*,escalarmulw4table,smt/smtbuses,smt/smthash_poseidon, the SMT level and verifier state machine files) are included fromcircuits/.circuits/or fromcircuits/binnums/, never from both.Tests
test/circuits/binnums/: the 42 test circuits that depend on a converted file, pointing tocircuits/binnums/.test/binnums/: the 22 JS tests that drive them; theirdescribenames are suffixed(binnums).npm testnow runstest/*.jsandtest/binnums/*.js.binnumstest circuit has the same constraint counts as its original.npm test: 227 passing (118 existing + 109binnums).Documentation
circuits/README.md: new section describingbinnums/, the converted templates and the rule about includes.CHANGES.txt: one entry under Added.🤖 Generated with Claude Code