From 08ff0fb871b5adf5ebad8952fcd19bebf113ae17 Mon Sep 17 00:00:00 2001 From: cgewecke Date: Mon, 5 Sep 2022 12:53:16 -0700 Subject: [PATCH] Add handling for hh 2.11.0 --- .circleci/config.yml | 4 ++-- lib/api.js | 7 ++++++- lib/collector.js | 8 +++++++- scripts/run-zeppelin.sh | 3 +++ 4 files changed, 18 insertions(+), 4 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 6245ac5..7b72f6b 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -12,8 +12,8 @@ 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 diff --git a/lib/api.js b/lib/api.js index 33ce2b5..978dcda 100644 --- a/lib/api.js +++ b/lib/api.js @@ -282,7 +282,12 @@ class API { while (cur._wrapped) { cur = Object.assign({}, cur._wrapped) } - cur._node._vm.on('step', self.collector.step.bind(self.collector)) + + if (cur._node._vm.on) { + cur._node._vm.on('step', self.collector.step.bind(self.collector)) + } else { + cur._node._vm.evm.events.on('step', self.collector.step.bind(self.collector)) + } } // Temporarily disabled because some relevant traces aren't available diff --git a/lib/collector.js b/lib/collector.js index 077e492..5e36c0a 100644 --- a/lib/collector.js +++ b/lib/collector.js @@ -22,7 +22,13 @@ 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; + if (typeof info.stack[idx] === 'bigint') { + hash = '0x' + info.stack[idx].toString(16); + } else { + hash = web3Utils.toHex(info.stack[idx]).toString(); + } this._registerHash(hash) } } catch (err) { /*Ignore*/ }; diff --git a/scripts/run-zeppelin.sh b/scripts/run-zeppelin.sh index 2fe59e1..4fdd5b5 100755 --- a/scripts/run-zeppelin.sh +++ b/scripts/run-zeppelin.sh @@ -28,6 +28,9 @@ cd openzeppelin-contracts echo ">>>>> npm install" npm install +# Use HH Merge version to test dual vm patch +npm install hardhat@latest + echo ">>>>> npm uninstall solidity-coverage --save-dev" npm uninstall solidity-coverage --save-dev