foundry icon indicating copy to clipboard operation
foundry copied to clipboard

Foundry recompiles all contracts even on a edit to a single file

Open aroralanuk opened this issue 2 years ago • 10 comments

Component

Forge

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

  • [x] Foundry
  • [X] Foundryup

What version of Foundry are you on?

forge 0.2.0 (e1eb912 2023-01-17T00:18:00.140138Z)

What command(s) is the bug in?

forge build

Operating System

macOS (Intel)

Describe the bug

Forge recompiles all files regardless of where an edit was made up the dependency tree.

Affects both forge build and forge test so I think it's more of compilation remapping issue vs a specific command issue.

aroralanuk avatar Jan 17 '23 15:01 aroralanuk

how can I reproduce this?

mattsse avatar Jan 17 '23 16:01 mattsse

run forge build

aroralanuk avatar Jan 18 '23 01:01 aroralanuk

I have the same issue on forge test -w. It seems intermittent. Sometimes its 125 files (everything) sometimes its ~30 files and sometimes just 1 file (the file I changed)

DrakeEvans avatar Jan 22 '23 18:01 DrakeEvans

run forge build

sorry, I should have been more clear.

Could you please provide a repro where you encountered this? Couldn't reproduce this myself.

Sometimes its 125 files (everything) sometimes its ~30 files and sometimes just 1 file (the file I changed)

is this 1 file imported somewhere else? see also forge tree

mattsse avatar Jan 22 '23 19:01 mattsse

Could you please provide a repro where you encountered this? Couldn't reproduce this myself.

https://github.com/aroralanuk/themis-contracts but you have do yarn install for the hyperlane dependency

aroralanuk avatar Jan 23 '23 01:01 aroralanuk

@mattsse This sounds like the behavior I described here https://github.com/gakonst/ethers-rs/issues/1995

0xalpharush avatar Jan 24 '23 04:01 0xalpharush

@mattsse we're experiencing the same issue in our project. I've created a minimal repro here: https://github.com/CarterAppleton/forge-multi-version-compile-issue-repro

lmk if there's other data I can produce to help

CarterAppleton avatar Feb 01 '23 02:02 CarterAppleton

Another datapoint - the repro occurs if we have 6.12 and 8.12 (or various other 8 versions), but does not happen for 8.12 and 8.16

CarterAppleton avatar Feb 08 '23 19:02 CarterAppleton

@CarterAppleton fwiw, I recently had to nuke the ~/svm directory after having issues getting foundry to download 0.8.18 and my issues seem resolved.

DrakeEvans avatar Feb 08 '23 19:02 DrakeEvans

Same issue, running forge 0.2.0 (ce22450 2024-03-06T00:17:08.159969000Z)

trojanMcAfee avatar Apr 22 '24 13:04 trojanMcAfee

Unable to reproduce with https://github.com/CarterAppleton/forge-multi-version-compile-issue-repro, correctly compiles only the corresponding files

There have been significant improvements to the way caches are handled so I'm assuming this has been fixed

Feel free to re-open if you encounter this again (cc @trojanMcAfee) with a minimal reproduction

zerosnacks avatar Jun 28 '24 09:06 zerosnacks

I have this issue even after foundryup today.

gpxl-dev avatar Jul 05 '24 15:07 gpxl-dev

I have this issue even after foundryup today.

@gpxl-dev Can you give me more details about your setup? A minimal reproduction would be appreciated

zerosnacks avatar Jul 05 '24 16:07 zerosnacks

@gpxl-dev Can you give me more details about your setup

Sorry for the vagueness, was in peak solidity frustration when I hit the issue.

I deleted cache, and out directories and it has started working now. I previously had tried forge cache clean which I'd assumed would delete the contents of the cache dir but maybe it does something else.

gpxl-dev avatar Jul 08 '24 08:07 gpxl-dev