Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

add library search functionality #21

Merged
merged 4 commits into from
Jun 20, 2024
Merged

add library search functionality #21

merged 4 commits into from
Jun 20, 2024

Conversation

incertia
Copy link
Contributor

@incertia incertia commented Apr 4, 2024

Adds a new argument vector specified with -L or --library to either add a library file or directory.

These "library paths" are then stored in the FileStack and when the time comes to include a file, we first try to resolve the file relative to the current file (current behavior). if that fails, we try to resolve the include in the order the libraries were specified. if the specified library path is a directory, it appends the include path if it does not start with . (this is currently stricter than what circom does) because IMO include "./path" should be meant for local includes only. if the specified library path is a file, we check that the filename is the same as the include path, which should not contain any directory separators.

i believe adding the library files to the FileStack will make the analysis aware of any templates inside, so if there is any additional work please let me know

@incertia incertia requested a review from fegge as a code owner April 4, 2024 05:43
@fegge fegge merged commit 791b50c into main Jun 20, 2024
3 of 4 checks passed
sangaline added a commit to Sindri-Labs/sindri-js that referenced this pull request Jul 10, 2024
Circomspect added support for a `-L`/`--library` search path flag in analogy to
Circom's `-l` argument (as of trailofbits/circomspect#21) that we use on the
backend with defaults of the project root and the `node_modules` subdirectory.
This PR updates the `sindri lint` command to check whether the current
Circomspect version supports the argument, and then to specify the same search
paths if the argument is supported. We'll probably end up making the search
paths configurable, but this makes the backend consistent with `sindri lint` in
the meantime.

For testing it manually, you can run

```bash
docker compose up -d
docker compose exec sindri-js bash
```

on the latest branch, change into a directory with one of our example Circom circuits that has been failing linting, and then run:

```bash
sindri lint
```

to make sure that things work as expected.

Merges #116

LGTM given by: @KPreisner
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants