diff --git a/.changeset/ten-swans-wave.md b/.changeset/ten-swans-wave.md new file mode 100644 index 0000000000..5bf14d2fd7 --- /dev/null +++ b/.changeset/ten-swans-wave.md @@ -0,0 +1,5 @@ +--- +"hardhat": patch +--- + +Add support for Solidity 0.8.5. diff --git a/docs/reference/solidity-support.md b/docs/reference/solidity-support.md index f2637fe338..40cc44e8c9 100644 --- a/docs/reference/solidity-support.md +++ b/docs/reference/solidity-support.md @@ -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.4 +- Any 0.8.x version up to and including 0.8.5 We recommend against using Hardhat with newer, unsupported versions of Solidity. But if you need to do so; please read on. diff --git a/packages/hardhat-core/src/internal/hardhat-network/stack-traces/error-inferrer.ts b/packages/hardhat-core/src/internal/hardhat-network/stack-traces/error-inferrer.ts index 300449f9f0..86f8449a2e 100644 --- a/packages/hardhat-core/src/internal/hardhat-network/stack-traces/error-inferrer.ts +++ b/packages/hardhat-core/src/internal/hardhat-network/stack-traces/error-inferrer.ts @@ -191,6 +191,25 @@ export class ErrorInferrer { return true; } + // look TWO frames ahead to determine if this is a specific occurrence of + // a redundant CALLSTACK_ENTRY frame observed when using Solidity 0.8.5: + if ( + frame.type === StackTraceEntryType.CALLSTACK_ENTRY && + i + 2 < stacktrace.length && + stacktrace[i + 2].sourceReference !== undefined && + stacktrace[i + 2].type === StackTraceEntryType.RETURNDATA_SIZE_ERROR + ) { + // ! below for tsc. we confirmed existence in the enclosing conditional. + const thatSrcRef = stacktrace[i + 2].sourceReference!; + if ( + frame.sourceReference.range[0] === thatSrcRef.range[0] && + frame.sourceReference.range[1] === thatSrcRef.range[1] && + frame.sourceReference.line === thatSrcRef.line + ) { + return false; + } + } + // constructors contain the whole contract, so we ignore them if ( frame.sourceReference.function === "constructor" && diff --git a/packages/hardhat-core/src/internal/hardhat-network/stack-traces/solidityTracer.ts b/packages/hardhat-core/src/internal/hardhat-network/stack-traces/solidityTracer.ts index 8d7dd813cc..148a170cde 100644 --- a/packages/hardhat-core/src/internal/hardhat-network/stack-traces/solidityTracer.ts +++ b/packages/hardhat-core/src/internal/hardhat-network/stack-traces/solidityTracer.ts @@ -31,7 +31,7 @@ import { StackTraceEntryType, } from "./solidity-stack-trace"; -export const SUPPORTED_SOLIDITY_VERSION_RANGE = "<=0.8.4"; +export const SUPPORTED_SOLIDITY_VERSION_RANGE = "<=0.8.5"; export const FIRST_SOLC_VERSION_SUPPORTED = "0.5.1"; export class SolidityTracer { diff --git a/packages/hardhat-core/test/fixture-projects/solidity-config-warnings/multiple-unsupported-solc.js b/packages/hardhat-core/test/fixture-projects/solidity-config-warnings/multiple-unsupported-solc.js index 01f7a43b9b..60511addee 100644 --- a/packages/hardhat-core/test/fixture-projects/solidity-config-warnings/multiple-unsupported-solc.js +++ b/packages/hardhat-core/test/fixture-projects/solidity-config-warnings/multiple-unsupported-solc.js @@ -2,10 +2,10 @@ module.exports = { solidity: { compilers: [ { - version: "0.8.5", + version: "0.8.6", }, { - version: "0.8.6", + version: "0.8.7", }, ], }, diff --git a/packages/hardhat-core/test/fixture-projects/solidity-config-warnings/unsupported-new-solc.js b/packages/hardhat-core/test/fixture-projects/solidity-config-warnings/unsupported-new-solc.js index f28addce2c..f680b3981d 100644 --- a/packages/hardhat-core/test/fixture-projects/solidity-config-warnings/unsupported-new-solc.js +++ b/packages/hardhat-core/test/fixture-projects/solidity-config-warnings/unsupported-new-solc.js @@ -1,3 +1,3 @@ module.exports = { - solidity: "0.8.5", + solidity: "0.8.6", }; diff --git a/packages/hardhat-core/test/fixture-projects/solidity-config-warnings/unsupported-solc-in-override.js b/packages/hardhat-core/test/fixture-projects/solidity-config-warnings/unsupported-solc-in-override.js index 03e43225e5..bc602fdff2 100644 --- a/packages/hardhat-core/test/fixture-projects/solidity-config-warnings/unsupported-solc-in-override.js +++ b/packages/hardhat-core/test/fixture-projects/solidity-config-warnings/unsupported-solc-in-override.js @@ -6,7 +6,7 @@ module.exports = { }, ], overrides: { - "contracts/Foo.sol": { version: "0.8.5" }, + "contracts/Foo.sol": { version: "0.8.6" }, }, }, }; diff --git a/packages/hardhat-core/test/internal/hardhat-network/stack-traces/test.ts b/packages/hardhat-core/test/internal/hardhat-network/stack-traces/test.ts index a0ee9e05e3..cea47eccf9 100644 --- a/packages/hardhat-core/test/internal/hardhat-network/stack-traces/test.ts +++ b/packages/hardhat-core/test/internal/hardhat-network/stack-traces/test.ts @@ -737,10 +737,10 @@ const solidityCompilers = [ solidityVersion: "0.8.4", compilerPath: "soljson-v0.8.4+commit.c7e474f2.js", }, - // { - // solidityVersion: "0.8.5", - // compilerPath: "soljson-v0.8.5+commit.a4f2e591.js", - // }, + { + solidityVersion: "0.8.5", + compilerPath: "soljson-v0.8.5+commit.a4f2e591.js", + }, ]; const solidity05Compilers = solidityCompilers.filter(({ solidityVersion }) =>