Skip to content

Commit 26a0012

Browse files
authored
Merge pull request #4681 from NomicFoundation/feature/add-support-for-solc-0.8.23
Add support for solc 0.8.23
2 parents 79fe92c + b1f8711 commit 26a0012

File tree

10 files changed

+66
-5
lines changed

10 files changed

+66
-5
lines changed

.changeset/dirty-pots-exercise.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"hardhat": patch
3+
---
4+
5+
Added support for solc 0.8.23

docs/src/content/hardhat-runner/docs/reference/solidity-support.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ These are the versions of Solidity that you can expect to fully work with Hardha
1313
- Any 0.5.x version starting from 0.5.1
1414
- Any 0.6.x version
1515
- Any 0.7.x version
16-
- Any 0.8.x version up to and including 0.8.22
16+
- Any 0.8.x version up to and including 0.8.23
1717

1818
We recommend against using Hardhat with newer, unsupported versions of Solidity. But if you need to do so; please read on.
1919

docs/src/model/markdown.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ export const withoutComments = (content: string) => {
104104
};
105105

106106
export const replacePlaceholders = (content: string) => {
107-
const recommendedSolcVersion = "0.8.19";
107+
const recommendedSolcVersion = "0.8.23";
108108
const latestPragma = "^0.8.0";
109109
const hardhatPackageJson = fs
110110
.readFileSync(
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
export const SUPPORTED_SOLIDITY_VERSION_RANGE = "<=0.8.22";
1+
export const SUPPORTED_SOLIDITY_VERSION_RANGE = "<=0.8.23";
22
export const FIRST_SOLC_VERSION_SUPPORTED = "0.5.1";

packages/hardhat-core/src/internal/solidity/compiler/solc-info.ts

+1
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ const defaultEvmTargets: { [key: string]: string } = {
5959
"0.8.20": "shanghai",
6060
"0.8.21": "shanghai",
6161
"0.8.22": "shanghai",
62+
"0.8.23": "shanghai",
6263
};
6364

6465
export function getEvmVersionFromSolcVersion(

packages/hardhat-core/test/builtin-tasks/compile.ts

+35
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import {
1919
getAllFilesMatchingSync,
2020
getRealPathSync,
2121
} from "../../src/internal/util/fs-utils";
22+
import { getLatestSupportedVersion } from "../internal/hardhat-network/stack-traces/compilers-list";
2223

2324
function assertFileExists(pathToFile: string) {
2425
assert.isTrue(
@@ -46,6 +47,40 @@ describe("compile task", function () {
4647
);
4748
}
4849

50+
describe("compile with latest solc version", function () {
51+
// The 'hardhat.config.js' and 'A.sol' files need to be updated each time a new solc version is released
52+
53+
useFixtureProject("compilation-latest-solc-version");
54+
useEnvironment();
55+
56+
it("should have the last version of solc in the 'hardhat.config.js' and 'A.sol' files", async function () {
57+
// Test to check that the last version of solc is being tested
58+
const userConfigSolcVersion = this.env.userConfig.solidity;
59+
60+
const lastSolcVersion = getLatestSupportedVersion();
61+
62+
assert.equal(
63+
userConfigSolcVersion,
64+
lastSolcVersion,
65+
`The version of solc in the user config is not the last one. Expected '${lastSolcVersion}' but got '${userConfigSolcVersion}'. Did you forget to update the test?`
66+
);
67+
});
68+
69+
it("should compile and emit artifacts using the latest solc version", async function () {
70+
await this.env.run("compile");
71+
72+
assertFileExists(path.join("artifacts", "contracts", "A.sol", "A.json"));
73+
assertBuildInfoExists(
74+
path.join("artifacts", "contracts", "A.sol", "A.dbg.json")
75+
);
76+
77+
const buildInfos = getBuildInfos();
78+
assert.lengthOf(buildInfos, 1);
79+
80+
assertValidJson(buildInfos[0]);
81+
});
82+
});
83+
4984
describe("project with single file", function () {
5085
useFixtureProject("compilation-single-file");
5186
useEnvironment();
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
artifacts/
2+
cache/
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
pragma solidity ^0.8.23;
2+
3+
contract A {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
module.exports = {
2+
solidity: "0.8.23",
3+
};

packages/hardhat-core/test/internal/hardhat-network/stack-traces/compilers-list.ts

+14-2
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,6 @@ export const solidityCompilers: SolidityCompiler[] = [
196196
{
197197
solidityVersion: "0.8.20",
198198
compilerPath: "soljson-v0.8.20+commit.a1b79de6.js",
199-
latestSolcVersion: true,
200199
},
201200
{
202201
solidityVersion: "0.8.20",
@@ -205,7 +204,6 @@ export const solidityCompilers: SolidityCompiler[] = [
205204
runs: 200,
206205
viaIR: true,
207206
},
208-
latestSolcVersion: true,
209207
},
210208
{
211209
solidityVersion: "0.8.21",
@@ -235,6 +233,20 @@ export const solidityCompilers: SolidityCompiler[] = [
235233
},
236234
latestSolcVersion: true,
237235
},
236+
{
237+
solidityVersion: "0.8.23",
238+
compilerPath: "soljson-v0.8.23+commit.f704f362.js",
239+
latestSolcVersion: true,
240+
},
241+
{
242+
solidityVersion: "0.8.23",
243+
compilerPath: "soljson-v0.8.23+commit.f704f362.js",
244+
optimizer: {
245+
runs: 200,
246+
viaIR: true,
247+
},
248+
latestSolcVersion: true,
249+
},
238250
];
239251

240252
export const getLatestSupportedVersion = () =>

0 commit comments

Comments
 (0)