Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Set default circomspect library paths when versions allow #116

Merged
merged 4 commits into from
Jul 10, 2024

Conversation

sangaline
Copy link
Contributor

@sangaline sangaline commented Jul 8, 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

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:

sindri lint

to make sure that things work as expected.

@@ -32,6 +32,7 @@ const currentDirectoryPath = path.dirname(currentFilePath);
*/
export function checkCommandExists(command: string): Promise<boolean> {
return new Promise((resolve) => {
// TODO: Circomspect doesn't support this argument, so this will always fail for that command.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is an unrelated bug, I'll make a followup ticket.

@@ -130,7 +131,10 @@ export async function execCommand(
`"${process.env.SINDRI_FORCE_DOCKER}".`,
);
} else if (await checkCommandExists(command)) {
logger?.debug(`Executing the "${command}" command locally.`);
logger?.debug(
{ args, command },
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This and below are just making the logging more useful by including the command arguments.

Copy link
Member

@KPreisner KPreisner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@sangaline sangaline merged commit 72d20b7 into main Jul 10, 2024
6 checks passed
@sangaline sangaline deleted the ews-add-circomspect-library-path branch July 10, 2024 15:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants