-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
HH415: Ambigious source name when remappings are used within sources. #4399
Comments
As we do face the same, any update on the subject ? |
For the record, the reason we do this is that source names with duplicated content can lead to weird compilation errors in some scenarios. This doesn't happen with But we should re-visit this, it might be unnecessarily limiting. |
Right.. well it would be super if it could handle either this or include paths. |
I have a problem like this.
|
If you are using hardhat-foundry and imported an npm package and a foundry submodule in the same repo with different remappings, then this issue will most likely occur. It's possible to have an external library (such as OZ) referenced as both npm package and foundry submodule as long as you make sure that import names don't clash. For instance, with OZ contracts you can have the following package.json:
And install submodules with forge like this:
Update your remappings.txt to:
And in your Solidity files, import like this:
That being said, I think it's cleaner to have external libraries referenced either as a foundry submodule or an npm package and not both at the same time, but in some situations you might want to do that. |
hey what's the solution to solve this ? |
Running into this issue while using foundry remappings as stated previously. Remappings.txt:
HardhatError: HH415: Two different source names ('src/interfaces/IERC20.sol' and '~/interfaces/IERC20.sol') |
Same problem here when using hardhat with foundry. This is a deal breaker to using hardhat altogether for us. |
still using [email protected] in all projects affected by this |
[email protected] does not support Cancun (transient storage) :/ |
Yes, we stopped using it but legacy is pain |
Version of Hardhat
2.17.3
What happened?
Hardhat does not compile a hybrid foundry project if remappings resolve to folders inside project sources.
Minimal reproduction repo: https://github.com/panukettu/hh-foundry-repro
This does work with
[email protected]
+@nomicfoundation/[email protected]
.Minimal reproduction steps
hardhat config:
foundry.toml:
Now making an import eg.
import {Lock} from "in-sources/Lock.sol";
will result in:Error HH415: Two different source names ('src/contracts/examples/Lock.sol' and 'in-sources/Lock.sol') resolve to the same file
Search terms
remappings hardhat-foundry
The text was updated successfully, but these errors were encountered: