Skip to content

Commit

Permalink
Merge pull request #5740 from NomicFoundation/support-solc-0.8.27
Browse files Browse the repository at this point in the history
feat: add support for solc versions 0.8.25, 0.8.26, and 0.8.27
  • Loading branch information
schaable authored Sep 16, 2024
2 parents d725c09 + 0e30f4c commit 74b1bfe
Show file tree
Hide file tree
Showing 19 changed files with 67 additions and 23 deletions.
5 changes: 5 additions & 0 deletions .changeset/dull-icons-float.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"hardhat": patch
---

Added support for solc versions 0.8.25, 0.8.26, and 0.8.27
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ These are the versions of Solidity that you can expect to fully work with Hardha
- Any 0.5.x version starting from 0.5.1
- Any 0.6.x version
- Any 0.7.x version
- Any 0.8.x version up to and including 0.8.24
- Any 0.8.x version up to and including 0.8.27

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

Expand Down
2 changes: 1 addition & 1 deletion docs/src/model/markdown.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ export const withoutComments = (content: string) => {
};

export const replacePlaceholders = (content: string) => {
const recommendedSolcVersion = "0.8.24";
const recommendedSolcVersion = "0.8.27";
const latestPragma = "^0.8.0";
const hardhatPackageJson = fs
.readFileSync(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.24;
pragma solidity ^0.8.27;

// Uncomment this line to use console.log
// import "hardhat/console.sol";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ require("@nomicfoundation/hardhat-toolbox");

/** @type import('hardhat/config').HardhatUserConfig */
module.exports = {
solidity: "0.8.24",
solidity: "0.8.27",
};
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.24;
pragma solidity ^0.8.27;

// Uncomment this line to use console.log
// import "hardhat/console.sol";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ require("@nomicfoundation/hardhat-toolbox");

/** @type import('hardhat/config').HardhatUserConfig */
module.exports = {
solidity: "0.8.24",
solidity: "0.8.27",
};
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.24;
pragma solidity ^0.8.27;

// Uncomment this line to use console.log
// import "hardhat/console.sol";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import type { HardhatUserConfig } from "hardhat/config";
import "@nomicfoundation/hardhat-toolbox-viem";

const config: HardhatUserConfig = {
solidity: "0.8.24",
solidity: "0.8.27",
};

export default config;
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.24;
pragma solidity ^0.8.27;

// Uncomment this line to use console.log
// import "hardhat/console.sol";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { HardhatUserConfig } from "hardhat/config";
import "@nomicfoundation/hardhat-toolbox";

const config: HardhatUserConfig = {
solidity: "0.8.24",
solidity: "0.8.27",
};

export default config;
2 changes: 1 addition & 1 deletion packages/hardhat-core/src/internal/cli/project-creation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ async function printRecommendedDepsInstallationInstructions(
// exported so we can test that it uses the latest supported version of solidity
export const EMPTY_HARDHAT_CONFIG = `/** @type import('hardhat/config').HardhatUserConfig */
module.exports = {
solidity: "0.8.24",
solidity: "0.8.27",
};
`;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
export const SUPPORTED_SOLIDITY_VERSION_RANGE = "<=0.8.24";
export const SUPPORTED_SOLIDITY_VERSION_RANGE = "<=0.8.27";
export const FIRST_SOLC_VERSION_SUPPORTED = "0.5.1";
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,9 @@ const defaultEvmTargets: { [key: string]: string } = {
"0.8.22": "shanghai",
"0.8.23": "shanghai",
"0.8.24": "shanghai",
"0.8.25": "cancun",
"0.8.26": "cancun",
"0.8.27": "cancun",
};

export function getEvmVersionFromSolcVersion(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
pragma solidity ^0.8.24;
pragma solidity ^0.8.27;

contract A {}
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module.exports = {
solidity: "0.8.24",
solidity: "0.8.27",
};
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,6 @@ export const solidityCompilers: SolidityCompiler[] = [
{
solidityVersion: "0.8.22",
compilerPath: "soljson-v0.8.22+commit.4fc1097e.js",
latestSolcVersion: true,
},
{
solidityVersion: "0.8.22",
Expand All @@ -229,12 +228,10 @@ export const solidityCompilers: SolidityCompiler[] = [
runs: 200,
viaIR: true,
},
latestSolcVersion: true,
},
{
solidityVersion: "0.8.23",
compilerPath: "soljson-v0.8.23+commit.f704f362.js",
latestSolcVersion: true,
},
{
solidityVersion: "0.8.23",
Expand All @@ -243,12 +240,10 @@ export const solidityCompilers: SolidityCompiler[] = [
runs: 200,
viaIR: true,
},
latestSolcVersion: true,
},
{
solidityVersion: "0.8.24",
compilerPath: "soljson-v0.8.24+commit.e11b9ed9.js",
latestSolcVersion: true,
},
{
solidityVersion: "0.8.24",
Expand All @@ -257,6 +252,47 @@ export const solidityCompilers: SolidityCompiler[] = [
runs: 200,
viaIR: true,
},
},
{
solidityVersion: "0.8.25",
compilerPath: "soljson-v0.8.25+commit.b61c2a91.js",
latestSolcVersion: true,
},
{
solidityVersion: "0.8.25",
compilerPath: "soljson-v0.8.25+commit.b61c2a91.js",
optimizer: {
runs: 200,
viaIR: true,
},
latestSolcVersion: true,
},
{
solidityVersion: "0.8.26",
compilerPath: "soljson-v0.8.26+commit.8a97fa7a.js",
latestSolcVersion: true,
},
{
solidityVersion: "0.8.26",
compilerPath: "soljson-v0.8.26+commit.8a97fa7a.js",
optimizer: {
runs: 200,
viaIR: true,
},
latestSolcVersion: true,
},
{
solidityVersion: "0.8.27",
compilerPath: "soljson-v0.8.27+commit.40a35a09.js",
latestSolcVersion: true,
},
{
solidityVersion: "0.8.27",
compilerPath: "soljson-v0.8.27+commit.40a35a09.js",
optimizer: {
runs: 200,
viaIR: true,
},
latestSolcVersion: true,
},
];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export async function instantiateProvider(
tracingConfig: TracingConfig
): Promise<EdrProviderWrapper> {
const config = {
hardfork: "shanghai",
hardfork: "cancun",
chainId: 1,
networkId: 1,
blockGasLimit: 10_000_000,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -544,16 +544,14 @@ async function runTest(
);
}

compareConsoleLogs(logger.lines, tx.consoleLogs);

const vmTraceDecoder = (provider as any)._vmTraceDecoder as VmTraceDecoder;
const decodedTrace = vmTraceDecoder.tryToDecodeMessageTrace(trace);

try {
if (tx.stackTrace === undefined) {
assert.isFalse(
trace.exit.isError(),
`Transaction ${txIndex} shouldn't have failed`
`Transaction ${txIndex} shouldn't have failed (${trace.exit.getReason()})`
);
} else {
assert.isDefined(
Expand Down Expand Up @@ -588,6 +586,8 @@ async function runTest(
throw err;
}
}

compareConsoleLogs(logger.lines, tx.consoleLogs);
}
}

Expand Down

0 comments on commit 74b1bfe

Please sign in to comment.