fix: traverse up to discover compilation framework config#676
Open
cats2101 wants to merge 1 commit intocrytic:masterfrom
Open
fix: traverse up to discover compilation framework config#676cats2101 wants to merge 1 commit intocrytic:masterfrom
cats2101 wants to merge 1 commit intocrytic:masterfrom
Conversation
When the target is a single Solidity file, search the ancestors of the working directory for a Foundry/Hardhat/Truffle/... project instead of only the working directory itself. This allows remappings and the expected solc version to be picked up when crytic-compile is invoked from a subdirectory of a project. Closes crytic#538
Author
|
Gentle ping — anything else needed here? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #538.
When the target is a single Solidity file and
crytic-compilefalls back to theSolcplatform, the code used to check only the working directory for a known compilation framework (Foundry, Hardhat, ...). If the user invokedcrytic-compilefrom a subdirectory of their project, the framework was not detected and remappings / solc version were silently dropped.This walks up the directory tree from the working directory and accepts the first ancestor that matches a non-Solc platform, then passes that directory to
platform.config(...)so the framework is queried at its actual root.Foundry already traverses upwards inside
Foundry.locate_project_root, so it was unaffected. Hardhat/Truffle/Dapp/Brownie/Waffle/Embark/Buidler/Etherlime only check the literal path they're given — those are the cases this change actually fixes.Changes
_locate_framework_roothelper that walks up from the working directory.platform.config(...), so framework-specific subprocesses (e.g.forge config --json) run at the project root.Tests
Added
tests/test_locate_framework_root.pycovering:(None, None)when no framework is present up to/hardhat_ignorekwarg disables detectionPre-existing
tests/test_library_linking.pyandtests/test_sourcify_proxy.pyfailures on my machine are unrelated (solc binary architecture mismatch insolc-select) and reproduce onmaster.