Skip to content
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

Forge: duplicate filename artifact location collisions #7797

Closed
2 tasks done
adraffy opened this issue Apr 27, 2024 · 2 comments · Fixed by #7822
Closed
2 tasks done

Forge: duplicate filename artifact location collisions #7797

adraffy opened this issue Apr 27, 2024 · 2 comments · Fixed by #7822
Labels
T-bug Type: bug

Comments

@adraffy
Copy link

adraffy commented Apr 27, 2024

Component

Forge

Have you ensured that all of these are up to date?

  • Foundry
  • Foundryup

What version of Foundry are you on?

forge 0.2.0 (d431f74 2024-04-27T00:17:17.280985407Z)

What command(s) is the bug in?

forge build

Operating System

Linux

Describe the bug

I have two directories with a contract with the same name

  • src/A/C.sol
  • src/B/C.sol

Example scenario: developing a /v2/ rewrite of a /v1/ solution.

  1. forge build --force
    • out/A/C.sol/C.json
    • out/B/C.sol/C.json
  2. modify A/C.solforge build
    • out/C.sol/C.json ← corresponds to A
  3. modify B/C.solforge build
    • out/C.sol/C.json ← now corresponds to B

Incremental builds should either rely on the cached artifact layout, or the artifacts should all be nested inside some fully-expanded hashed layout, like out/${hash(absolute path)}/{file}.sol/{name}.json.

solidity-files-cache.json reflects change (2) but becomes bugged after (3) as there are now 2 cached artifacts with the same path but different sources.

IMO, these file locations should be somewhat predictable. The current solution of creating minimal directories when duplicates exist is weird.

@adraffy adraffy added the T-bug Type: bug label Apr 27, 2024
@mattsse
Copy link
Member

mattsse commented Apr 27, 2024

@klkvr I assume this is an edge case we're missing during caching preprocess

@0xalpharush
Copy link
Contributor

0xalpharush commented Apr 29, 2024

Not sure how closely related but a similar issue exists for duplicates when multiple compiler versions are used gakonst/ethers-rs#1995

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
T-bug Type: bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants