From 28ef50679926b536cc4b08696f287fe6a929622d Mon Sep 17 00:00:00 2001 From: "F. Eugene Aumson" Date: Tue, 2 Nov 2021 08:11:07 -0600 Subject: [PATCH 1/6] Support Solidity 0.8.8 --- docs/reference/solidity-support.md | 2 +- .../internal/hardhat-network/stack-traces/solidityTracer.ts | 2 +- .../solidity-config-warnings/multiple-unsupported-solc.js | 4 ++-- .../solidity-config-warnings/unsupported-new-solc.js | 2 +- .../solidity-config-warnings/unsupported-solc-in-override.js | 2 +- .../test/internal/hardhat-network/stack-traces/test.ts | 4 ++++ 6 files changed, 10 insertions(+), 6 deletions(-) diff --git a/docs/reference/solidity-support.md b/docs/reference/solidity-support.md index 167cf71345..e552334b05 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.7 +- Any 0.8.x version up to and including 0.8.8 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/solidityTracer.ts b/packages/hardhat-core/src/internal/hardhat-network/stack-traces/solidityTracer.ts index 90824afd63..06ad2c8f46 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.7"; +export const SUPPORTED_SOLIDITY_VERSION_RANGE = "<=0.8.8"; 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 d24e54fc23..15905fe927 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.8", + version: "0.8.9", }, { - version: "0.8.9", + version: "0.8.10", }, ], }, 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 8dd52de8c6..f06dd03fc5 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.8", + solidity: "0.8.9", }; 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 ea361a65b8..5ad765c4a7 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.8" }, + "contracts/Foo.sol": { version: "0.8.9" }, }, }, }; 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 356646ae23..ed85434501 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 @@ -749,6 +749,10 @@ const solidityCompilers = [ solidityVersion: "0.8.7", compilerPath: "soljson-v0.8.7+commit.e28d00a7.js", }, + { + solidityVersion: "0.8.8", + compilerPath: "soljson-v0.8.8+commit.dddeac2f.js", + }, ]; const solidity05Compilers = solidityCompilers.filter(({ solidityVersion }) => From 12158a06267f15cbcdb590933a5fd8a26c6bcb07 Mon Sep 17 00:00:00 2001 From: Franco Victorio Date: Tue, 2 Nov 2021 12:00:47 -0300 Subject: [PATCH 2/6] Add changeset --- .changeset/smooth-turkeys-grab.md | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 .changeset/smooth-turkeys-grab.md diff --git a/.changeset/smooth-turkeys-grab.md b/.changeset/smooth-turkeys-grab.md new file mode 100644 index 0000000000..2974a0f1f9 --- /dev/null +++ b/.changeset/smooth-turkeys-grab.md @@ -0,0 +1,6 @@ +--- +"hardhat": patch +"docs": patch +--- + +Added support for Solidity 0.8.8 From d7cc2bb00af90d0a623259b9d6e63a1d07f5011b Mon Sep 17 00:00:00 2001 From: "F. Eugene Aumson" Date: Tue, 2 Nov 2021 12:24:39 -0600 Subject: [PATCH 3/6] Remove pkg `docs` from changeset Co-authored-by: Patricio Palladino --- .changeset/smooth-turkeys-grab.md | 1 - 1 file changed, 1 deletion(-) diff --git a/.changeset/smooth-turkeys-grab.md b/.changeset/smooth-turkeys-grab.md index 2974a0f1f9..84329b3faa 100644 --- a/.changeset/smooth-turkeys-grab.md +++ b/.changeset/smooth-turkeys-grab.md @@ -1,6 +1,5 @@ --- "hardhat": patch -"docs": patch --- Added support for Solidity 0.8.8 From 2ffe6262ee9f87f619c54a602909fa2d474d85f5 Mon Sep 17 00:00:00 2001 From: "F. Eugene Aumson" Date: Wed, 3 Nov 2021 16:28:50 -0600 Subject: [PATCH 4/6] Add test w/ new User Defined Value Type lang feat. --- .../0_8/user-defined-value-types/c.sol | 12 ++++++++++++ .../0_8/user-defined-value-types/test.json | 16 ++++++++++++++++ 2 files changed, 28 insertions(+) create mode 100644 packages/hardhat-core/test/internal/hardhat-network/stack-traces/test-files/0_8/user-defined-value-types/c.sol create mode 100644 packages/hardhat-core/test/internal/hardhat-network/stack-traces/test-files/0_8/user-defined-value-types/test.json diff --git a/packages/hardhat-core/test/internal/hardhat-network/stack-traces/test-files/0_8/user-defined-value-types/c.sol b/packages/hardhat-core/test/internal/hardhat-network/stack-traces/test-files/0_8/user-defined-value-types/c.sol new file mode 100644 index 0000000000..8532998479 --- /dev/null +++ b/packages/hardhat-core/test/internal/hardhat-network/stack-traces/test-files/0_8/user-defined-value-types/c.sol @@ -0,0 +1,12 @@ +pragma solidity ^0.8.8; + +import "./../../../../../../../console.sol"; + +type UFixed is uint256; + +contract C { + function f(UFixed a) public returns (UFixed b) { + console.log("something"); + b = a; + } +} diff --git a/packages/hardhat-core/test/internal/hardhat-network/stack-traces/test-files/0_8/user-defined-value-types/test.json b/packages/hardhat-core/test/internal/hardhat-network/stack-traces/test-files/0_8/user-defined-value-types/test.json new file mode 100644 index 0000000000..f1248a5ab2 --- /dev/null +++ b/packages/hardhat-core/test/internal/hardhat-network/stack-traces/test-files/0_8/user-defined-value-types/test.json @@ -0,0 +1,16 @@ +{ + "solc": "^0.8.8", + "transactions": [ + { + "file": "c.sol", + "contract": "C", + "imports": ["/../../../../../../../console.sol"] + }, + { + "to": 0, + "function": "f", + "params": [1], + "consoleLogs": [["something"]] + } + ] +} From bb310306b64722ad7b88f8a6c4f3965b449ce212 Mon Sep 17 00:00:00 2001 From: "F. Eugene Aumson" Date: Wed, 3 Nov 2021 17:13:03 -0600 Subject: [PATCH 5/6] Test UserDefinedValueType via revert, not console --- .../test-files/0_8/user-defined-value-types/c.sol | 2 +- .../0_8/user-defined-value-types/test.json | 15 ++++++++++++++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/packages/hardhat-core/test/internal/hardhat-network/stack-traces/test-files/0_8/user-defined-value-types/c.sol b/packages/hardhat-core/test/internal/hardhat-network/stack-traces/test-files/0_8/user-defined-value-types/c.sol index 8532998479..d7ca835499 100644 --- a/packages/hardhat-core/test/internal/hardhat-network/stack-traces/test-files/0_8/user-defined-value-types/c.sol +++ b/packages/hardhat-core/test/internal/hardhat-network/stack-traces/test-files/0_8/user-defined-value-types/c.sol @@ -6,7 +6,7 @@ type UFixed is uint256; contract C { function f(UFixed a) public returns (UFixed b) { - console.log("something"); + require(false, "error reason"); b = a; } } diff --git a/packages/hardhat-core/test/internal/hardhat-network/stack-traces/test-files/0_8/user-defined-value-types/test.json b/packages/hardhat-core/test/internal/hardhat-network/stack-traces/test-files/0_8/user-defined-value-types/test.json index f1248a5ab2..7822845fe4 100644 --- a/packages/hardhat-core/test/internal/hardhat-network/stack-traces/test-files/0_8/user-defined-value-types/test.json +++ b/packages/hardhat-core/test/internal/hardhat-network/stack-traces/test-files/0_8/user-defined-value-types/test.json @@ -10,7 +10,20 @@ "to": 0, "function": "f", "params": [1], - "consoleLogs": [["something"]] + "stackTrace": [ + { + "type": "REVERT_ERROR", + "sourceReference": { + "function": "f", + "contract": "C", + "file": "c.sol", + "line": 9, + "range": [164, 194] + }, + "message": "error reason", + "isInvalidOpcodeError": false + } + ] } ] } From ba4bfc18efd3c0fba58a98b9821fd42db3ddd9f7 Mon Sep 17 00:00:00 2001 From: "F. Eugene Aumson" Date: Thu, 4 Nov 2021 06:37:57 -0600 Subject: [PATCH 6/6] test: remove now-unused console import Addresses review comment https://github.com/nomiclabs/hardhat/pull/2017#discussion_r742735858 --- .../test-files/0_8/user-defined-value-types/c.sol | 2 -- .../test-files/0_8/user-defined-value-types/test.json | 5 ++--- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/packages/hardhat-core/test/internal/hardhat-network/stack-traces/test-files/0_8/user-defined-value-types/c.sol b/packages/hardhat-core/test/internal/hardhat-network/stack-traces/test-files/0_8/user-defined-value-types/c.sol index d7ca835499..b8f53c68fb 100644 --- a/packages/hardhat-core/test/internal/hardhat-network/stack-traces/test-files/0_8/user-defined-value-types/c.sol +++ b/packages/hardhat-core/test/internal/hardhat-network/stack-traces/test-files/0_8/user-defined-value-types/c.sol @@ -1,7 +1,5 @@ pragma solidity ^0.8.8; -import "./../../../../../../../console.sol"; - type UFixed is uint256; contract C { diff --git a/packages/hardhat-core/test/internal/hardhat-network/stack-traces/test-files/0_8/user-defined-value-types/test.json b/packages/hardhat-core/test/internal/hardhat-network/stack-traces/test-files/0_8/user-defined-value-types/test.json index 7822845fe4..1c9c148152 100644 --- a/packages/hardhat-core/test/internal/hardhat-network/stack-traces/test-files/0_8/user-defined-value-types/test.json +++ b/packages/hardhat-core/test/internal/hardhat-network/stack-traces/test-files/0_8/user-defined-value-types/test.json @@ -3,8 +3,7 @@ "transactions": [ { "file": "c.sol", - "contract": "C", - "imports": ["/../../../../../../../console.sol"] + "contract": "C" }, { "to": 0, @@ -17,7 +16,7 @@ "function": "f", "contract": "C", "file": "c.sol", - "line": 9, + "line": 7, "range": [164, 194] }, "message": "error reason",