Skip to content

Update the default outputSelection setting of solc to decrease the artifacts size#8121

Merged
alcuadrado merged 6 commits intomainfrom
output-selection-optimization
Apr 10, 2026
Merged

Update the default outputSelection setting of solc to decrease the artifacts size#8121
alcuadrado merged 6 commits intomainfrom
output-selection-optimization

Conversation

@alcuadrado
Copy link
Copy Markdown
Member

No description provided.

@alcuadrado alcuadrado added no docs needed This PR doesn't require links to documentation no peer bump needed labels Apr 10, 2026
Copilot AI review requested due to automatic review settings April 10, 2026 15:22
@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Apr 10, 2026

🦋 Changeset detected

Latest commit: 12a3a2e

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
Copy Markdown
Member

@schaable schaable left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. I left a nitpick and a question.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates Hardhat’s default Solidity compiler outputSelection to request a narrower, explicitly enumerated subset of outputs (instead of the broader evm.bytecode / evm.deployedBytecode / metadata), with the goal of reducing generated artifact/build-info output size.

Changes:

  • Introduce DEFAULT_OUTPUT_SELECTION and reuse it from both config resolution and compilation job solc-input construction.
  • Update compilation job behavior/tests to reflect the new default selector set (and removal of metadata).
  • Update ignition-core test fixtures that hardcode the build info id affected by the changed solc input.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
packages/ignition-core/test/helpers/execution-result-fixtures.ts Updates hardcoded build info id fixture values after solc input/outputSelection change.
packages/hardhat/test/internal/builtin-plugins/solidity/build-system/compilation-job.ts Updates expected outputSelection in tests to match the new defaults.
packages/hardhat/src/internal/builtin-plugins/solidity/constants.ts Adds shared DEFAULT_OUTPUT_SELECTION definition.
packages/hardhat/src/internal/builtin-plugins/solidity/config.ts Switches compiler config defaults to use DEFAULT_OUTPUT_SELECTION.
packages/hardhat/src/internal/builtin-plugins/solidity/build-system/compilation-job.ts Ensures compilation jobs always include the shared default selectors when building solc input.
.changeset/tiny-mangos-glow.md Adds a patch changeset entry for the Hardhat package.

Comment on lines +7 to +19
"*": [
"abi",
"evm.bytecode.linkReferences",
"evm.bytecode.object",
"evm.bytecode.opcodes",
"evm.bytecode.sourceMap",
"evm.deployedBytecode.immutableReferences",
"evm.deployedBytecode.linkReferences",
"evm.deployedBytecode.object",
"evm.deployedBytecode.opcodes",
"evm.deployedBytecode.sourceMap",
"evm.methodIdentifiers",
],
Copy link

Copilot AI Apr 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The default outputSelection now uses granular selectors (e.g. evm.deployedBytecode.immutableReferences, evm.bytecode.sourceMap, etc.). Since Hardhat supports compiling a wide range of solc versions (including older 0.4.x/0.5.x via solc-js), some of these selector paths may not be accepted by older compilers. Please add a regression test that compiles with the oldest supported solc version using the default settings (or gate/fallback the selector list by solc version) so compilation doesn’t fail on older versions.

Suggested change
"*": [
"abi",
"evm.bytecode.linkReferences",
"evm.bytecode.object",
"evm.bytecode.opcodes",
"evm.bytecode.sourceMap",
"evm.deployedBytecode.immutableReferences",
"evm.deployedBytecode.linkReferences",
"evm.deployedBytecode.object",
"evm.deployedBytecode.opcodes",
"evm.deployedBytecode.sourceMap",
"evm.methodIdentifiers",
],
"*": ["abi", "evm"],

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good point, i added tests for this

@alcuadrado alcuadrado force-pushed the output-selection-optimization branch from 1378ce0 to 12a3a2e Compare April 10, 2026 16:47
@alcuadrado alcuadrado enabled auto-merge April 10, 2026 16:53
@alcuadrado alcuadrado added this pull request to the merge queue Apr 10, 2026
Merged via the queue into main with commit 970c47b Apr 10, 2026
222 checks passed
@alcuadrado alcuadrado deleted the output-selection-optimization branch April 10, 2026 17:06
@github-actions github-actions Bot mentioned this pull request Apr 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

no docs needed This PR doesn't require links to documentation no peer bump needed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants