-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Unable to override compiler options for contracts in node_modules #6090
Comments
Hi again. Please have a look, it's been a big issue for us |
@theonekeyg you have to use the source name in the override, not the relative path. The source name in this case is what you'd use to import that module in one of your contracts, so Tentatively closing because I think that should do it, but let us know if it still doesn't work. |
@fvictorio Hi. I tried using source name to declare a contract override ( I pushed the branch for easy reproduction - https://github.com/theonekeyg/hardhat-overrides-bug/tree/try-with-source-name. Is there anything else I can try? |
The reason for that is that you have other contracts that import that contract, and those use the main compilation setting. The compilation unit for those contracts will use that setting, even if there is an override. For example, let's say you have a file tl;dr this is complex, and the best solution for your case will depend a lot on your project and what you are trying to achieve. |
You are correct, indeed the failing contract was imported by chain of imports. For my case, it'll be sufficient to make an interface of dependency and import that in main contracts instead. Thank you. |
Version of Hardhat
1.22.17
What happened?
I have a set of smart contracts that use npm package for some contract dependencies. One of the smart contracts in the npm package is failing the optimizer, therefore if I want to have optimizer enabled for my contracts, I have to somehow disable optimizer for failing contracts (because fails on optimizer revert the whole compilation).
I created a very simplistic repo showcasing the error, there I put exact setup that I face, I import the contract that does not suffer from optimization failures from the package that contains a contract that does fail. The result is that the whole optimization (and therefore compilation) step is failing, even thought I don't import the failing contract directly.
I try to use
solidity.overrides
to disable optimizer for the problematic contract, but it does not seem to produce any effect, the compilation still fails.Here's my hardhat.config.ts
Like I said this does not produce any effect, even in logs with
--verbose
it shows that it does not use compiler from overrides.Minimal reproduction steps
Clone the repo https://github.com/theonekeyg/hardhat-overrides-bug and run:
yarn install
yarn hardhat compile
Search terms
No response
The text was updated successfully, but these errors were encountered: