Skip to content

HH415: Ambigious source name when remappings are used within sources.  #4399

@panukettu

Description

@panukettu

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:

const config: HardhatUserConfig = {
  solidity: "0.8.19",
  paths: {
    sources: "./src/contracts",
  },
};

foundry.toml:

[profile.default]
src = 'src/contracts'
out = 'out'
libs = ['node_modules', 'lib']
test = 'test'
cache_path = 'cache_forge'
remappings = [
    'in-sources/=src/contracts/examples/',
    'outside-sources/=src/other/',
]

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

Metadata

Metadata

Assignees

Type

Projects

Status

Backlog

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions