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.
Add
Operation::IntegerDivide
This is a bit awkward because it's currently the same as
Operation::Divide
. However I think it's helpful to set up this distinction so that we can treat them differently in the future. In circomDivide
means division within the finite field (eg 1/2 is 3 in modulo 5, since 3*2=1 mod 5). Because the available operations depends on the MPC backend, I think we should parameterize sim-circuit over the number system, but I'll make a discussion for this elsewhere.Discord discussion thread.
Fix input counting bug when constructing graph for Kahn's Algorithm
I was getting
CircuitError::CyclicDependencyDetected
for this circuit:(This issue came up because the test I wrote for all infix ops contained several examples like this.)
I discovered the reason for this was that a
HashSet
is used for the dependencies of each node. This meant that when inserting a duplicate dependency, it was ignored by the hashset but the in-degree was still incremented. Kahn's Algorithm requires that in-degree can be decremented for each edge (including multiple edges from the same input) rather than each distinct dependency.