trailofbits / circomspect Goto Github PK
View Code? Open in Web Editor NEWA static analyzer and linter for the Circom zero-knowledge DSL
License: GNU General Public License v3.0
A static analyzer and linter for the Circom zero-knowledge DSL
License: GNU General Public License v3.0
I have a file which looks like this at the beginning
include "../node_modules/circomlib/circuits/poseidon.circom";
include "./merkleProof.circom"
include "./keypair.circom"
but when I analyse it, it gives
# circomspect transaction.circom
error: UnrecognizedToken { token: (93, Token(61, "include"), 100), expected: ["\")\"", "\",\"", "\";\""] }
┌─ /home/user/cash/circuits/transaction.circom:3:1
│
3 │ include "./keypair.circom"
│ ^^^^^^^ Invalid syntax
circomspect: 1 issue found.
However, the same file does compiles fine using npx circom -v
without giving other input files or input settings on the command line.
If the assigned signal is constrained elsewhere in the circuit, it is enough to emit an informational finding.
In particular, the following should not raise a warning.
warning: Using the signal assignment operator `<--` does not constrain the assigned signal.
┌─ /.../file.circom:72:9
│
72 │ m[i] <-- out[0][i];
│ ^^^^^^^^^^^^^^^^^^^^^^^^^ The assigned signal `m[i]` is not constrained here.
73 │ mRangeCheck[i] = Num2Bits(n);
74 │ mRangeCheck[i].in <== m[i];
│ -------------------------- The signal `q[i]` is constrained here.
│
= For more details, see https://github.com/trailofbits/circomspect/blob/main/doc/analysis_passes.md#signal-assignment.
The unconstrained-less-than
analysis pass should check if the input evaluates to a constant value before emitting a warning.
In particular, warnings like the following do not make any sense.
warning: Inputs to `LessThan` need to be constrained to ensure that they are non-negative
┌─ /.../file.circom:72:28
│
72 │ lt.in[1] <== 50 + 5;
│ ^^^^^^ `50 + 5` needs to be constrained to ensure that it is <= p/2.
│
= For more details, see https://github.com/trailofbits/circomspect/blob/main/doc/analysis_passes.md#unconstrained-less-than.
cargo install circomspect
cli
after cloning the repository, but same symptom happens. Compiling circomspect-program-structure v2.0.11 (/Users/sigridjin.eth/Documents/github/circomspect/program_structure)
error[E0658]: `let...else` statements are unstable
--> program_structure/src/intermediate_representation/expression_impl.rs:172:17
|
172 | / let Some(range) = cond.degree() else {
173 | | return result;
174 | | };
| |__________________^
|
= note: see issue #87335 <https://github.com/rust-lang/rust/issues/87335> for more information
Compiling circomspect-parser v2.0.11 (/Users/sigridjin.eth/Documents/github/circomspect/parser)
For more information about this error, try `rustc --explain E0658`.
error: could not compile `circomspect-program-structure` due to previous error
warning: build failed, waiting for other jobs to finish...
error: failed to compile `circomspect v0.7.2 (/Users/sigridjin.eth/Documents/github/circomspect/cli)`, intermediate artifacts can be found at `/Users/sigridjin.eth/Documents/github/circomspect/target`
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.