-
Notifications
You must be signed in to change notification settings - Fork 57
Fix build configuration for Foundry and Hardhat v3 #82
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
Merged
Conversation
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
Updates the project to support Hardhat v3 which defaults to ESM. - Sets "type": "module" in package.json. - Updates hardhat.config.js to use ESM export syntax. - Sets the correct network type for the hardhat network in config. This resolves Error HHE15 (invalid network config) and ensures 'npm run compile' works correctly alongside the Foundry build.
The previous examples assumed running from inside the test directory. Updated commands to work from the project root, matching the workflow established in this PR.
Add a self-reference in package.json to fix Hardhat compilation: `"@crytic/properties": "file:.",` Without this, `npm run compile` fails with: `The package "@crytic/properties" is not installed`"
pcaversaccio
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So I think this PR introduces a bug:
@openzeppelin/=lib/openzeppelin-contracts/contracts/
and you e.g. have here:
| import "@openzeppelin/contracts/utils/Address.sol"; |
which would resolve to lib/properties/lib/openzeppelin-contracts/contracts/contracts/utils/Address.sol which cannot be found (contracts/contracts).
The full error log from snekmate after testing:
Run forge test
Compiler run failed:
Error (6275): Source "lib/properties/lib/openzeppelin-contracts/contracts/contracts/utils/Address.sol" not found: File not found. Searched the following locations: "/home/runner/work/snekmate/snekmate", "/home/runner/work/snekmate/snekmate/src/snekmate", "/home/runner/work/snekmate/snekmate/src/snekmate/auth", "/home/runner/work/snekmate/snekmate/src/snekmate/extensions", "/home/runner/work/snekmate/snekmate/src/snekmate/governance", "/home/runner/work/snekmate/snekmate/src/snekmate/tokens", "/home/runner/work/snekmate/snekmate/src/snekmate/tokens/interfaces", "/home/runner/work/snekmate/snekmate/src/snekmate/utils".
ParserError: Source "lib/properties/lib/openzeppelin-contracts/contracts/contracts/utils/Address.sol" not found: File not found. Searched the following locations: "/home/runner/work/snekmate/snekmate", "/home/runner/work/snekmate/snekmate/src/snekmate", "/home/runner/work/snekmate/snekmate/src/snekmate/auth", "/home/runner/work/snekmate/snekmate/src/snekmate/extensions", "/home/runner/work/snekmate/snekmate/src/snekmate/governance", "/home/runner/work/snekmate/snekmate/src/snekmate/tokens", "/home/runner/work/snekmate/snekmate/src/snekmate/tokens/interfaces", "/home/runner/work/snekmate/snekmate/src/snekmate/utils".
--> lib/properties/contracts/ERC721/external/util/ERC721ExternalTestBase.sol:7:1:
|
7 | import "@openzeppelin/contracts/utils/Address.sol";
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Error (6275): Source "lib/properties/lib/openzeppelin-contracts/contracts/contracts/token/ERC721/utils/ERC721Holder.sol" not found: File not found. Searched the following locations: "/home/runner/work/snekmate/snekmate", "/home/runner/work/snekmate/snekmate/src/snekmate", "/home/runner/work/snekmate/snekmate/src/snekmate/auth", "/home/runner/work/snekmate/snekmate/src/snekmate/extensions", "/home/runner/work/snekmate/snekmate/src/snekmate/governance", "/home/runner/work/snekmate/snekmate/src/snekmate/tokens", "/home/runner/work/snekmate/snekmate/src/snekmate/tokens/interfaces", "/home/runner/work/snekmate/snekmate/src/snekmate/utils".
ParserError: Source "lib/properties/lib/openzeppelin-contracts/contracts/contracts/token/ERC721/utils/ERC721Holder.sol" not found: File not found. Searched the following locations: "/home/runner/work/snekmate/snekmate", "/home/runner/work/snekmate/snekmate/src/snekmate", "/home/runner/work/snekmate/snekmate/src/snekmate/auth", "/home/runner/work/snekmate/snekmate/src/snekmate/extensions", "/home/runner/work/snekmate/snekmate/src/snekmate/governance", "/home/runner/work/snekmate/snekmate/src/snekmate/tokens", "/home/runner/work/snekmate/snekmate/src/snekmate/tokens/interfaces", "/home/runner/work/snekmate/snekmate/src/snekmate/utils".
--> lib/properties/contracts/ERC721/external/util/MockReceiver.sol:4:1:
|
4 | import "@openzeppelin/contracts/token/ERC721/utils/ERC721Holder.sol";
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Error (6275): Source "lib/properties/lib/openzeppelin-contracts/contracts/contracts/token/ERC721/IERC721.sol" not found: File not found. Searched the following locations: "/home/runner/work/snekmate/snekmate", "/home/runner/work/snekmate/snekmate/src/snekmate", "/home/runner/work/snekmate/snekmate/src/snekmate/auth", "/home/runner/work/snekmate/snekmate/src/snekmate/extensions", "/home/runner/work/snekmate/snekmate/src/snekmate/governance", "/home/runner/work/snekmate/snekmate/src/snekmate/tokens", "/home/runner/work/snekmate/snekmate/src/snekmate/tokens/interfaces", "/home/runner/work/snekmate/snekmate/src/snekmate/utils".
ParserError: Source "lib/properties/lib/openzeppelin-contracts/contracts/contracts/token/ERC721/IERC721.sol" not found: File not found. Searched the following locations: "/home/runner/work/snekmate/snekmate", "/home/runner/work/snekmate/snekmate/src/snekmate", "/home/runner/work/snekmate/snekmate/src/snekmate/auth", "/home/runner/work/snekmate/snekmate/src/snekmate/extensions", "/home/runner/work/snekmate/snekmate/src/snekmate/governance", "/home/runner/work/snekmate/snekmate/src/snekmate/tokens", "/home/runner/work/snekmate/snekmate/src/snekmate/tokens/interfaces", "/home/runner/work/snekmate/snekmate/src/snekmate/utils".
--> lib/properties/contracts/ERC721/util/IERC721Internal.sol:4:1:
|
4 | import "@openzeppelin/contracts/token/ERC721/IERC721.sol";
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Error (6275): Source "lib/properties/lib/openzeppelin-contracts/contracts/contracts/token/ERC721/extensions/IERC721Enumerable.sol" not found: File not found. Searched the following locations: "/home/runner/work/snekmate/snekmate", "/home/runner/work/snekmate/snekmate/src/snekmate", "/home/runner/work/snekmate/snekmate/src/snekmate/auth", "/home/runner/work/snekmate/snekmate/src/snekmate/extensions", "/home/runner/work/snekmate/snekmate/src/snekmate/governance", "/home/runner/work/snekmate/snekmate/src/snekmate/tokens", "/home/runner/work/snekmate/snekmate/src/snekmate/tokens/interfaces", "/home/runner/work/snekmate/snekmate/src/snekmate/utils".
ParserError: Source "lib/properties/lib/openzeppelin-contracts/contracts/contracts/token/ERC721/extensions/IERC721Enumerable.sol" not found: File not found. Searched the following locations: "/home/runner/work/snekmate/snekmate", "/home/runner/work/snekmate/snekmate/src/snekmate", "/home/runner/work/snekmate/snekmate/src/snekmate/auth", "/home/runner/work/snekmate/snekmate/src/snekmate/extensions", "/home/runner/work/snekmate/snekmate/src/snekmate/governance", "/home/runner/work/snekmate/snekmate/src/snekmate/tokens", "/home/runner/work/snekmate/snekmate/src/snekmate/tokens/interfaces", "/home/runner/work/snekmate/snekmate/src/snekmate/utils".
--> lib/properties/contracts/ERC721/util/IERC721Internal.sol:5:1:
|
5 | import "@openzeppelin/contracts/token/ERC721/extensions/IERC721Enumerable.sol";
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
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.
Summary
This PR fixes build configuration issues for both Foundry and Hardhat environments, ensuring the repository works out-of-the-box for new users without manual setup steps.
Key Changes
remappings.txtand updatedtests/ERC4626/foundry/remappings.txtto correctly resolve dependencies (OpenZeppelin, Solmate) from the root directory."type": "module"topackage.json.hardhat.config.jsto ESM syntax (export default).edr-simulatednetwork configuration error.postinstallscript to automatically initialize theABDKMath64x64submodule uponnpm install.CLAUDE.mdwith accurate, root-relative commands for running Echidna and Medusa tests.Verification
forge buildpasses successfully.npm run compilepasses successfully.CryticERC20InternalHarness).CryticERC721InternalHarness).CryticERC4626InternalHarness).