-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
feat: Soften duplicate contract name in the case contracts have identical ABIs #4695
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
base: main
Are you sure you want to change the base?
Conversation
…ical ABIs Foundry seems to duplicate some imported sub-files within a contract, for example: `<foundry root>/src/parts/primitives/Foo.sol` Is defined only once, and imported from `<foundry root>/src/Bar.sol` But ends up appearing twice in artifacts directory: ``` <foundry root>/out/Foo.sol/Foo.json <foundry root>/out/primitives/Foo.sol/Foo.json ``` In this case `getArtifactPaths()` in the Foundry plugin pick up the same contracts twice since they end up existing in multiple subdirectories of `out/`. I don't think there is a reliable to heuristic to de-duplicate them at this level. It seems like duck-typing contracts by the ABI should be fine and may help other plugin sources. it could always be disabled by default and enabled via an option at the cost of yet more config Signed-off-by: Silas Davis <[email protected]>
|
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
|
I just want to put this out for a sense check before going to town on the rest of contribution requirements, let me know what you think. |
|
A bit more on why these duplicates might be seen from foundry, These snippets are are target from two duplicated foundry artifacts. the first appears under "compilationTarget": {
"src/Foo.sol": "Foo"
},the second under "compilationTarget": {
"../project/src/Foo.sol": "Foo"
},Where we are compiling in the Foundry project |
|
I've implemented a similar fix in the |
dbb8093 to
5937456
Compare
27f0d04 to
7d15f06
Compare
Foundry seems to duplicate some imported sub-files within a contract, for example:
<foundry root>/src/parts/primitives/Foo.solIs defined only once, and imported from
<foundry root>/src/Bar.solBut ends up appearing twice in artifacts directory:
In this case
getArtifactPaths()in the Foundry plugin pick up the same contracts twice since they end up existing in multiple subdirectories ofout/. I don't think there is a reliable to heuristic to de-duplicate them at this level.It seems like duck-typing contracts by the ABI should be fine and may help other plugin sources. it could always be disabled by default and enabled via an option at the cost of yet more config