[Dev Tools] Foundry compilation failure #822
-
Team or ProjectNo response EnvironmentTestnet Select the Dev Tool you are usingFoundry Provide the version of the tool (if applicable)No response Provide a brief description of the functionality you're trying to implement and the issue you are running into.Compilation of my contract (attached below). Fails with this error on zksync-foundry:
Contract code:
I'm using OZ with commit hash Repo Link (Optional)No response Additional DetailsIssue posted on behalf of client. |
Beta Was this translation helpful? Give feedback.
Replies: 5 comments 5 replies
-
It appears that the error you're encountering during the compilation of your contract using Foundry on ZKsync is due to a misuse of the Here's how you can correct the issue:
Modify your contract code as follows: // SPDX-License-Identifier: None
pragma solidity ^0.8.28;
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/access/Ownable2Step.sol";
contract OptionResolver is Ownable2Step {
constructor () Ownable() {
// Constructor body if needed
}
}
If you continue to face issues or if the error persists, it might be helpful to review the OpenZeppelin documentation or the specific versions of the contracts you are using to ensure compatibility with your Solidity version and constructor expectations. For more detailed discussions and support, you can also visit the ZKsync developers discussions on Github. Your feedback helps us serve you better. If this fully addresses your question, please give it a thumbs up. If it doesn't, please give it a thumbs down. This will inform the community and team so we can improve our support. |
Beta Was this translation helpful? Give feedback.
-
Hello @cytadela8 This is based on your OZ dependency version. Please double check the version being used. Here is an example of the latest OZ dep being used in a foundry project with |
Beta Was this translation helpful? Give feedback.
-
I will look to create a min-example for a quick test and post back here. Also is that version required? |
Beta Was this translation helpful? Give feedback.
-
Here is a min-example that compiles fine with OZ version Steps to run:
Foundry-zksync version:
Perhaps can you add more details to the issue or try running |
Beta Was this translation helpful? Give feedback.
-
We found one more required step. You need to run:
|
Beta Was this translation helpful? Give feedback.
Hey @21a1ss3 👋
An update here, we've looked into the issue, and although we want to continue to investigate the compiler differences (evm / eravm) more closely I wanted to provide a solution in the meantime.
I've updated the min-example: https://github.com/dutterbutter/min-example-ownable which compiles successfully with
velodrome-finance/contracts
. Specifically, updated the remapping so OZ v5 is used correctly.Please check to see if this works for your use case and let me know. Thanks 🙏