Skip to content

Support solc prereleases - #8887

Open
Amxx wants to merge 1 commit into
NomicFoundation:mainfrom
Amxx:solc-prerelease-support
Open

Amxx wants to merge 1 commit into
NomicFoundation:mainfrom
Amxx:solc-prerelease-support

Conversation

@Amxx

@Amxx Amxx commented Nov 26, 2026

Copy link
Copy Markdown
Contributor

Closes #8886

Lets users opt into solc prerelease compilers published in the official binary lists, e.g.:

export default { solidity: { version: "0.9.0-pre.1" } };

Changes

@nomicfoundation/hardhat-utils

  • fast-semver.parseVersion(version, { allowPrerelease }): a new opt-in option that accepts and strips a -prerelease suffix. The default stays strict, so existing callers are unaffected.

hardhat

  • compiler/downloader.ts: builds are identified by getBuildVersion(build), which is version for releases and version-prerelease for prereleases. This replaces the prerelease === undefined filters in #getCompilerBuild and #shouldDownloadCompilerList. The zipped-Windows extraction directory and the download log line use the same identifier, so a prerelease never collides with its release.
  • solc-config-selection.ts: every satisfies / maxSatisfying / intersects call passes { includePrerelease: true }. Only configured compilers are candidates, so this changes nothing unless a prerelease is configured. With the flag, semver agrees with solc's own pragma check. I verified this against the 0.9.0-pre.1 binary for ^0.8.20, >=0.8.20, ^0.9.0, >=0.9.0 and >=0.8.20 <0.10.0.
  • solc-info.ts, compiler/compiler.ts, compiler/solcjs-wrapper.ts, coverage/instrumentation.ts: these feature-gate parses use allowPrerelease: true, so 0.9.0-pre.1 gates like 0.9.0.

Behaviour notes

  • "0.8.35" still resolves to the 0.8.35 release even though 0.8.35-pre.1 is in the list (covered by a test).
  • If both a release and a prerelease are configured and both satisfy a file's pragma, maxSatisfying picks the higher one, as for any other pair of configured compilers. Example: with ["0.8.35", "0.9.0-pre.1"] and pragma >=0.8.20, it picks 0.9.0-pre.1. This is intended: the prerelease was explicitly configured.
  • Out of scope: the build summary prints "Check solc X's doc for its default evm version" for any version missing from defaultEvmTargets, including 0.9.0. That's existing behaviour for new versions and is independent of this PR.

Tests

  • hardhat-utils/test/fast-semver.ts: allowPrerelease parsing.
  • solc-config-selection.ts: prerelease selection, prerelease override, and prerelease ranked below its release (^0.8.0, >=0.9.0, ^0.9.0 don't match).
  • compiler/downloader.ts (slow tests): 0.8.35 doesn't pick 0.8.35-pre.1; 0.9.0-pre.1 downloads and has version === "0.9.0-pre.1" and longVersion === "0.9.0-pre.1+commit.91c99213".
  • Manual end-to-end: a sample project with version: "0.9.0-pre.1" compiles a >=0.8.20 contract, and a ^0.8.20 file gets the usual HHE909 incompatibility error.

@changeset-bot

changeset-bot Bot commented Nov 26, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 8df3b12

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

This PR includes changesets to release 2 packages
Name Type
hardhat Minor
@nomicfoundation/hardhat-utils Minor

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

Comment on lines +46 to +48
const parsedInstrumentationVersion = parseVersion(instrumentationVersion, {
allowPrerelease: true,
});

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I am happy that pre-release version info isn't relevant for coverage. EDR will fallback to the latest solc version (used for parsing info for slang) if an unknown version is passed.

This branch has not been deployed

No deployments
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.

Support solc prerelease compilers (e.g. 0.9.0-pre.1)

2 participants