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

fix(hardhat-foundry): config clashes condition #5983

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

wiasliaw
Copy link

  • Because this PR includes a bug fix, relevant tests have been included.
  • Because this PR includes a new feature, the change was previously discussed on an Issue or with someone from the team.
  • I didn't do anything of this.

if (config.paths.cache === foundryCachePath) {
config.paths.cache = "cache_hardhat";
}

The code above is to solve config collision between foundry and hardhat. However, the condition will cause a weird behavior when foundry config is the same as hardhat config.

i.e.

foundry config:

[profile.default]
cache_path = "sample_cache"

hardhat config:

/** @type import('hardhat/config').HardhatUserConfig */
module.exports = {
  paths: {
    cache: path.resolve(__dirname, "sample_cache"),
  }
}

Run hardhat compile and the cache folder will be generated in path {project_root}/cache_hardhat.

Copy link

changeset-bot bot commented Nov 26, 2024

⚠️ No Changeset found

Latest commit: 8f55685

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copy link

vercel bot commented Nov 26, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
hardhat ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 26, 2024 7:03am

@antico5
Copy link
Contributor

antico5 commented Dec 3, 2024

This is the intended behavior, we want to avoid foundry and hardhat using the same directory for cache, so when they are set to be the same, we change hardhat's cache directory to cache_hardhat. Is there a reason why you would want both caches to be on the same directory?

@wiasliaw
Copy link
Author

@antico5 sorry for replying late.

afaik, both hardhat and foundry use sloc for compilation. cache files should not be different with the same version of the solc.

@antico5
Copy link
Contributor

antico5 commented Dec 18, 2024

There might be cases where both could use the same cache directory without conflict, but it's wise to keep them separated to prevent potential clashes. E.g. you can specify different solc versions on the different frameworks. Also each framework may use the cache directory for other purposes besides just the solc cache and from that perspective it's convenient that they are on separate directories.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Backlog
Development

Successfully merging this pull request may close these issues.

3 participants