Skip to content

Commit 05ab320

Browse files
authored
Fixes for Hardhat 2.11.0 (#740)
1 parent bc7d076 commit 05ab320

File tree

8 files changed

+376
-1672
lines changed

8 files changed

+376
-1672
lines changed

.circleci/config.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,15 @@ step_install_nvm: &step_install_nvm
1212
set +e
1313
export NVM_DIR="/opt/circleci/.nvm"
1414
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
15-
nvm install v12.16.0
16-
nvm alias default v12.16.0
15+
nvm install v14.19.0
16+
nvm alias default v14.19.0
1717
echo 'export NVM_DIR="/opt/circleci/.nvm"' >> $BASH_ENV
1818
echo "[ -s \"$NVM_DIR/nvm.sh\" ] && . \"$NVM_DIR/nvm.sh\"" >> $BASH_ENV
1919
2020
jobs:
2121
unit-test:
2222
docker:
23-
- image: circleci/node:12
23+
- image: circleci/node:14
2424
steps:
2525
- checkout
2626
- run:

lib/api.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,7 @@ class API {
289289
while (cur._wrapped) {
290290
cur = Object.assign({}, cur._wrapped)
291291
}
292-
cur._node._vm.on('step', self.collector.step.bind(self.collector))
292+
cur._node._vm.evm.events.on('step', self.collector.step.bind(self.collector))
293293
}
294294

295295
// Temporarily disabled because some relevant traces aren't available

lib/collector.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
const web3Utils = require('web3-utils')
2-
31
/**
42
* Writes data from the VM step to the in-memory
53
* coverage map constructed by the Instrumenter.
@@ -22,7 +20,7 @@ class DataCollector {
2220
try {
2321
if (this.validOpcodes[info.opcode.name] && info.stack.length > 0){
2422
const idx = info.stack.length - 1;
25-
let hash = web3Utils.toHex(info.stack[idx]).toString();
23+
let hash = '0x' + info.stack[idx].toString(16);
2624
this._registerHash(hash)
2725
}
2826
} catch (err) { /*Ignore*/ };

package.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,7 @@
4242
"recursive-readdir": "^2.2.2",
4343
"sc-istanbul": "^0.4.5",
4444
"semver": "^7.3.4",
45-
"shelljs": "^0.8.3",
46-
"web3-utils": "^1.3.0"
45+
"shelljs": "^0.8.3"
4746
},
4847
"devDependencies": {
4948
"@nomiclabs/hardhat-ethers": "^2.0.4",
@@ -56,7 +55,7 @@
5655
"ethereum-waffle": "^3.4.0",
5756
"ethers": "^5.5.3",
5857
"ganache-cli": "6.12.2",
59-
"hardhat": "^2.9.3",
58+
"hardhat": "^2.11.0",
6059
"hardhat-gas-reporter": "^1.0.1",
6160
"nyc": "^14.1.1",
6261
"solc": "^0.7.5"

scripts/run-zeppelin.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@ cd openzeppelin-contracts
2828
echo ">>>>> npm install"
2929
npm install
3030

31+
# Use HH Merge version
32+
npm install hardhat@2.11.0 --save-dev
33+
3134
echo ">>>>> npm uninstall solidity-coverage --save-dev"
3235
npm uninstall solidity-coverage --save-dev
3336

test/integration/projects/matrix/expectedMochaOutput.json

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,20 @@
77
"failures": 0
88
},
99
"tests": [
10+
{
11+
"title": "sends",
12+
"fullTitle": "Contract: MatrixA sends",
13+
"file": "test/matrix_a.js",
14+
"currentRetry": 0,
15+
"err": {}
16+
},
17+
{
18+
"title": "calls",
19+
"fullTitle": "Contract: MatrixA calls",
20+
"file": "test/matrix_a.js",
21+
"currentRetry": 0,
22+
"err": {}
23+
},
1024
{
1125
"title": "sends to A",
1226
"fullTitle": "Contract: Matrix A and B sends to A",
@@ -34,7 +48,10 @@
3448
"file": "test/matrix_a_b.js",
3549
"currentRetry": 0,
3650
"err": {}
37-
},
51+
}
52+
],
53+
"failures": [],
54+
"passes": [
3855
{
3956
"title": "sends",
4057
"fullTitle": "Contract: MatrixA sends",
@@ -48,10 +65,7 @@
4865
"file": "test/matrix_a.js",
4966
"currentRetry": 0,
5067
"err": {}
51-
}
52-
],
53-
"failures": [],
54-
"passes": [
68+
},
5569
{
5670
"title": "sends to A",
5771
"fullTitle": "Contract: Matrix A and B sends to A",
@@ -79,20 +93,6 @@
7993
"file": "test/matrix_a_b.js",
8094
"currentRetry": 0,
8195
"err": {}
82-
},
83-
{
84-
"title": "sends",
85-
"fullTitle": "Contract: MatrixA sends",
86-
"file": "test/matrix_a.js",
87-
"currentRetry": 0,
88-
"err": {}
89-
},
90-
{
91-
"title": "calls",
92-
"fullTitle": "Contract: MatrixA calls",
93-
"file": "test/matrix_a.js",
94-
"currentRetry": 0,
95-
"err": {}
9696
}
9797
]
9898
}

test/integration/projects/matrix/expectedTestMatrixHardhat.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
{
22
"contracts/MatrixA.sol": {
33
"10": [
4-
{
5-
"title": "sends to A",
6-
"file": "test/matrix_a_b.js"
7-
},
84
{
95
"title": "sends",
106
"file": "test/matrix_a.js"
7+
},
8+
{
9+
"title": "sends to A",
10+
"file": "test/matrix_a_b.js"
1111
}
1212
],
1313
"14": [

0 commit comments

Comments
 (0)