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: error when re-using the solc settings object #6212

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

galargh
Copy link
Member

@galargh galargh commented Jan 31, 2025

  • 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.

Closes #6204

This fix ensures that we don't mutate the comiler.settings when resolving the compiler.

Copy link

changeset-bot bot commented Jan 31, 2025

🦋 Changeset detected

Latest commit: 6a341bd

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
hardhat Patch

Not sure what this means? Click here to learn what changesets are.

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

Copy link

vercel bot commented Jan 31, 2025

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 Jan 31, 2025 8:59pm

@github-actions github-actions bot added the status:ready This issue is ready to be worked on label Jan 31, 2025
@galargh galargh marked this pull request as draft January 31, 2025 20:28
@galargh
Copy link
Member Author

galargh commented Jan 31, 2025

I'm putting it back in draft because I don't fully understand what's going on.

We do a deep clone here -

That's way before solidity config resolution.

But then, if we have multiple compilers configured and they reuse the same settings object, then there is still only one settings object being mutated by each call to resolveConfig, even after the deep clone. It seems like the deep clone doesn't actually clone the settings separately. So if they were pointing at the same memory block before, they will still point at the same, but different, memory block after the deep clone.

I added a test case which can help showcase that - 6a341bd

This still solves the issue at hand, so we could merge it if we want the exact described problem fixed, but I think we might have to do more changes around how we perform user config deep clone in general.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status:ready This issue is ready to be worked on
Projects
Status: Backlog
Development

Successfully merging this pull request may close these issues.

Error when re-using the solc settings object
1 participant