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

Improve foundry compilation #488

Merged
merged 15 commits into from
Oct 5, 2023
Merged

Improve foundry compilation #488

merged 15 commits into from
Oct 5, 2023

Conversation

smonicas
Copy link
Contributor

Add a new option --auto-compile which can be used to compile a single file. At the moment it's implemented only for foundry. It will try to get information such as solc version to use, remappings... and pass them to solc. Example we want to run slither on a single file we can do from the root directory slither src/MyFile.sol --auto-compile.
Automatically skip compiling tests and scripts, to compile everything use --foundry-compile-all.

Copy link
Member

@montyly montyly left a comment

Choose a reason for hiding this comment

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

I am wondering if we should invert the logic for --foundry-compile-all and do something like:

  • If there is a foundry project detected, and the target is a . sol file, then do the auto compile
  • Have the user use compile-force-framework solc if they dont want to do that

Because most likely the direct solc call will not work for most of the user anyway in a foundry project

What do you think?

@@ -154,6 +176,19 @@ def is_dependency(self, path: str) -> bool:
"""
return False

@staticmethod
Copy link
Member

Choose a reason for hiding this comment

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

What if we dont make it abstract, to avoid having a code duplication for all platforms, to just return None?

- Remove the auto flag, crytic-compile will directly use the auto feature if its on .sol file + the working director is a known platform
- Remove abstract from config to reduce code footprint
@montyly
Copy link
Member

montyly commented Oct 5, 2023

I made the proposed improvements (remove the auto flag, and make config not an abstract function)

@montyly montyly added this pull request to the merge queue Oct 5, 2023
Merged via the queue into dev with commit fa60e8d Oct 5, 2023
24 checks passed
@montyly montyly deleted the dev-auto-compile branch October 5, 2023 10:07
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.

2 participants