You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The problem is that this makes it impossible to host invariant tests under test/invariants and compile them using Foundry. The only alternative is to pass --foundry-compile-all to crytic-compile, which will then fall back to a forge build --build-info command. However, this will compile ALL Solidity files, which is also undesired, since in most cases the majority of files are unit and fuzz test files.
This results in a significant slowdown of the invariant testing process, and forces security researchers to either move invariant tests to src/, which is semantically incorrect, or to compile everything and waste time.
This feature request suggests introducing a configuration parameter in Foundry that allows specifying a subdirectory for compilation. This can be achieved by extending the forge build command with an option to compile only the specified subdirectory, such as forge build --dir test/invariants. This way, we could either update crytic-compile or simply pass --ignore-compile to these tools, relying on Foundry's subdirectory compilation.
Additional context
No response
The text was updated successfully, but these errors were encountered:
Happy to coordinate on how best to update this as the binary of --foundry-compile-all probably isn't the best solution for fuzzers despite working well for Slither. For background, the reason we force a clean and recompile by default in crytic-compile is the caching logic in Foundry is not robust yet, resulting in strange failures that are really hard to troubleshoot
It seems caching was disabled recently if build info is requested which would present a problem trying to workaround this with --ignore-compile (see #7379). We had a really rough time initially trying to use Foundry's native cache (e.g. gakonst/ethers-rs#1995) and the build info was much more stable since it was based off Hardhat's artifacts
Component
Forge
Describe the feature you would like
While working invariant testing projects with Echidna/Medusa, I often encounter a compilation issue related to Foundry's default project structure.
By default, Echidna/Medusa uses crytic-compile to compile a project using Foundry if
.
is passed as the target. This results in aforge build --build-info --skip */test/** */script/** --force
command.The problem is that this makes it impossible to host invariant tests under
test/invariants
and compile them using Foundry. The only alternative is to pass--foundry-compile-all
to crytic-compile, which will then fall back to aforge build --build-info
command. However, this will compile ALL Solidity files, which is also undesired, since in most cases the majority of files are unit and fuzz test files.This results in a significant slowdown of the invariant testing process, and forces security researchers to either move invariant tests to
src/
, which is semantically incorrect, or to compile everything and waste time.This feature request suggests introducing a configuration parameter in Foundry that allows specifying a subdirectory for compilation. This can be achieved by extending the forge build command with an option to compile only the specified subdirectory, such as
forge build --dir test/invariants
. This way, we could either update crytic-compile or simply pass--ignore-compile
to these tools, relying on Foundry's subdirectory compilation.Additional context
No response
The text was updated successfully, but these errors were encountered: