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.
Resolves #54.
This branch relies on an update to sim-circuit, so you might need to
cargo update
to make it work.Adds all infix ops
Notably, this includes
AIntDiv
which is possibly different fromADiv
. For our purposes, division generally means modular division. To reduce confusion, we should perhaps take the position that it always means modular division, since explicit integer division is now available if that's the intention. Currentlysim-circuit
implements division as integer division, so the two operations are the same.In circom
a / b
is (modular) division, anda \ b
is integer division.Discord discussion thread.
Fixes running & debugging individual tests in VS Code (and possibly other IDEs)
Prior to this PR, running a test involved command line argument processing because building a circuit requires an
Input
, andInput::new
reads the command line. This breaks VS Code's functionality for running individual tests because it passes arguments that are unrecognized by that system, which is intended for the CLI, not tests.I was similarly caught by this issue in the wasm-support branch (demo here), since there is no command line in the browser. The changes to
input.rs
here are based on the work from that branch, so this will reduce the changes needed later for wasm support.Now
Input::new
is a pure function (well except maybe some platform-specificPath
gotchas), andmain.rs
instead usesinput_processing::generate_input
, which replicates the old behavior (including command line processing).Possible underconstrained bug
During testing, I was struck by the way we ignore signal outputs that are not assigned any values. I added this test:
Currently this just outputs
vec![]
. I'm guessing it should be an error instead, but I left it as a TODO.Add test for
x == x
fixed by sim-circuit updateMy test for all infix ops contains several examples of using the same input on both sides of the op.
x == x
may be a little weird but it's perfectly valid and meaningful in other cases likex * x
.sim-circuit
was incorrectly generatingCyclicDependencyDetected
for this, so I added a more specific test that covers the issue.