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

Error when re-using the solc settings object #6204

Open
fvictorio opened this issue Jan 31, 2025 · 0 comments · May be fixed by #6212
Open

Error when re-using the solc settings object #6204

fvictorio opened this issue Jan 31, 2025 · 0 comments · May be fixed by #6212
Labels
status:ready This issue is ready to be worked on

Comments

@fvictorio
Copy link
Member

Re-using the solc settings object for versions that default to a different EVM version results in a very obscure error:

Invalid EVM version requested.

Reproduction steps

Create a Hardhat config with this content:

const compilerSettings = {}

module.exports = {
  solidity: {
    compilers: [
      { settings: compilerSettings, version: '0.5.17' },
      { settings: compilerSettings, version: '0.8.28' },
    ]
  }
};

And add two Solidity files:

// contracts/Foo.sol
// SPDX-License-Identifier: Unlicense
pragma solidity ^0.5.0;

contract Foo {}
// contracts/Bar.sol
// SPDX-License-Identifier: Unlicense
pragma solidity ^0.8.0;

contract Bar {}

Then run hh compile.

Notice that replacing the config with this makes the issue go away:

module.exports = {
  solidity: {
    compilers: [
      { settings: {}, version: '0.5.17' },
      { settings: {}, version: '0.8.28' },
    ]
  }
};

So it's very likely we are mutating something we shouldn't.

Thanks @shark0der for reporting this!

@github-actions github-actions bot added the status:ready This issue is ready to be worked on label Jan 31, 2025
@github-project-automation github-project-automation bot moved this to Backlog in Hardhat Jan 31, 2025
@kanej kanej moved this from Backlog to To-do in Hardhat Jan 31, 2025
@galargh galargh linked a pull request Jan 31, 2025 that will close this issue
3 tasks
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: To-do
Development

Successfully merging a pull request may close this issue.

1 participant