Skip to content

Commit

Permalink
Fixes for Hardhat 2.11.0 (#740)
Browse files Browse the repository at this point in the history
  • Loading branch information
cgewecke committed Sep 5, 2022
1 parent bc7d076 commit 05ab320
Show file tree
Hide file tree
Showing 8 changed files with 376 additions and 1,672 deletions.
6 changes: 3 additions & 3 deletions .circleci/config.yml
Expand Up @@ -12,15 +12,15 @@ step_install_nvm: &step_install_nvm
set +e
export NVM_DIR="/opt/circleci/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
nvm install v12.16.0
nvm alias default v12.16.0
nvm install v14.19.0
nvm alias default v14.19.0
echo 'export NVM_DIR="/opt/circleci/.nvm"' >> $BASH_ENV
echo "[ -s \"$NVM_DIR/nvm.sh\" ] && . \"$NVM_DIR/nvm.sh\"" >> $BASH_ENV
jobs:
unit-test:
docker:
- image: circleci/node:12
- image: circleci/node:14
steps:
- checkout
- run:
Expand Down
2 changes: 1 addition & 1 deletion lib/api.js
Expand Up @@ -289,7 +289,7 @@ class API {
while (cur._wrapped) {
cur = Object.assign({}, cur._wrapped)
}
cur._node._vm.on('step', self.collector.step.bind(self.collector))
cur._node._vm.evm.events.on('step', self.collector.step.bind(self.collector))
}

// Temporarily disabled because some relevant traces aren't available
Expand Down
4 changes: 1 addition & 3 deletions lib/collector.js
@@ -1,5 +1,3 @@
const web3Utils = require('web3-utils')

/**
* Writes data from the VM step to the in-memory
* coverage map constructed by the Instrumenter.
Expand All @@ -22,7 +20,7 @@ class DataCollector {
try {
if (this.validOpcodes[info.opcode.name] && info.stack.length > 0){
const idx = info.stack.length - 1;
let hash = web3Utils.toHex(info.stack[idx]).toString();
let hash = '0x' + info.stack[idx].toString(16);
this._registerHash(hash)
}
} catch (err) { /*Ignore*/ };
Expand Down
5 changes: 2 additions & 3 deletions package.json
Expand Up @@ -42,8 +42,7 @@
"recursive-readdir": "^2.2.2",
"sc-istanbul": "^0.4.5",
"semver": "^7.3.4",
"shelljs": "^0.8.3",
"web3-utils": "^1.3.0"
"shelljs": "^0.8.3"
},
"devDependencies": {
"@nomiclabs/hardhat-ethers": "^2.0.4",
Expand All @@ -56,7 +55,7 @@
"ethereum-waffle": "^3.4.0",
"ethers": "^5.5.3",
"ganache-cli": "6.12.2",
"hardhat": "^2.9.3",
"hardhat": "^2.11.0",
"hardhat-gas-reporter": "^1.0.1",
"nyc": "^14.1.1",
"solc": "^0.7.5"
Expand Down
3 changes: 3 additions & 0 deletions scripts/run-zeppelin.sh
Expand Up @@ -28,6 +28,9 @@ cd openzeppelin-contracts
echo ">>>>> npm install"
npm install

# Use HH Merge version
npm install hardhat@2.11.0 --save-dev

echo ">>>>> npm uninstall solidity-coverage --save-dev"
npm uninstall solidity-coverage --save-dev

Expand Down
38 changes: 19 additions & 19 deletions test/integration/projects/matrix/expectedMochaOutput.json
Expand Up @@ -7,6 +7,20 @@
"failures": 0
},
"tests": [
{
"title": "sends",
"fullTitle": "Contract: MatrixA sends",
"file": "test/matrix_a.js",
"currentRetry": 0,
"err": {}
},
{
"title": "calls",
"fullTitle": "Contract: MatrixA calls",
"file": "test/matrix_a.js",
"currentRetry": 0,
"err": {}
},
{
"title": "sends to A",
"fullTitle": "Contract: Matrix A and B sends to A",
Expand Down Expand Up @@ -34,7 +48,10 @@
"file": "test/matrix_a_b.js",
"currentRetry": 0,
"err": {}
},
}
],
"failures": [],
"passes": [
{
"title": "sends",
"fullTitle": "Contract: MatrixA sends",
Expand All @@ -48,10 +65,7 @@
"file": "test/matrix_a.js",
"currentRetry": 0,
"err": {}
}
],
"failures": [],
"passes": [
},
{
"title": "sends to A",
"fullTitle": "Contract: Matrix A and B sends to A",
Expand Down Expand Up @@ -79,20 +93,6 @@
"file": "test/matrix_a_b.js",
"currentRetry": 0,
"err": {}
},
{
"title": "sends",
"fullTitle": "Contract: MatrixA sends",
"file": "test/matrix_a.js",
"currentRetry": 0,
"err": {}
},
{
"title": "calls",
"fullTitle": "Contract: MatrixA calls",
"file": "test/matrix_a.js",
"currentRetry": 0,
"err": {}
}
]
}
Expand Down
@@ -1,13 +1,13 @@
{
"contracts/MatrixA.sol": {
"10": [
{
"title": "sends to A",
"file": "test/matrix_a_b.js"
},
{
"title": "sends",
"file": "test/matrix_a.js"
},
{
"title": "sends to A",
"file": "test/matrix_a_b.js"
}
],
"14": [
Expand Down

0 comments on commit 05ab320

Please sign in to comment.