From 022d7d8115021d952c37b0c862e4dbe0f9600ac2 Mon Sep 17 00:00:00 2001 From: cgewecke Date: Sat, 28 Aug 2021 09:04:22 -0700 Subject: [PATCH] Use internal visibility for fn level hash method defs (#660) --- lib/injector.js | 2 +- scripts/run-nomiclabs.sh | 19 ------------------- test/units/assert.js | 12 ++++++------ test/units/function.js | 6 +++--- 4 files changed, 10 insertions(+), 29 deletions(-) diff --git a/lib/injector.js b/lib/injector.js index 2887ac9f..c2682f11 100644 --- a/lib/injector.js +++ b/lib/injector.js @@ -47,7 +47,7 @@ class Injector { _getHashMethodDefinition(id, contract){ const hash = web3Utils.keccak256(id).slice(0,10); const method = this._getMethodIdentifier(id); - return `\nfunction ${method}(bytes32 c__${hash}) public pure {}\n`; + return `\nfunction ${method}(bytes32 c__${hash}) internal pure {}\n`; } /** diff --git a/scripts/run-nomiclabs.sh b/scripts/run-nomiclabs.sh index 72a42efd..aed4c3e3 100755 --- a/scripts/run-nomiclabs.sh +++ b/scripts/run-nomiclabs.sh @@ -28,25 +28,6 @@ fi echo "PR_PATH >>>>> $PR_PATH" -echo "" -echo ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>" -echo "Simple buidler/buidler-trufflev5 " -echo ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>" -echo "" - -# Install buidler-e2e -git clone https://github.com/sc-forks/buidler-e2e.git -cd buidler-e2e -npm install --silent - -# Install and run solidity-coverage @ PR -npm install --save-dev --silent $PR_PATH -cat package.json - -npx buidler coverage - -verifyCoverageExists - echo "" echo ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>" echo "Simple hardhat/hardhat-trufflev5 " diff --git a/test/units/assert.js b/test/units/assert.js index 593bdee6..4060841b 100644 --- a/test/units/assert.js +++ b/test/units/assert.js @@ -26,14 +26,14 @@ describe('asserts and requires', () => { const mapping = coverage.generate(contract.data, util.pathPrefix); assert.deepEqual(mapping[util.filePath].l, { - 5: 1, + 5: 2, }); assert.deepEqual(mapping[util.filePath].b, {}); assert.deepEqual(mapping[util.filePath].s, { - 1: 1, + 1: 2, }); assert.deepEqual(mapping[util.filePath].f, { - 1: 1, + 1: 2, }); }); @@ -47,14 +47,14 @@ describe('asserts and requires', () => { const mapping = coverage.generate(contract.data, util.pathPrefix); assert.deepEqual(mapping[util.filePath].l, { - 5: 2, + 5: 4, }); assert.deepEqual(mapping[util.filePath].b, {}); assert.deepEqual(mapping[util.filePath].s, { - 1: 2, + 1: 4, }); assert.deepEqual(mapping[util.filePath].f, { - 1: 2, + 1: 4, }); }); diff --git a/test/units/function.js b/test/units/function.js index 5a193020..c4af6e01 100644 --- a/test/units/function.js +++ b/test/units/function.js @@ -101,14 +101,14 @@ describe('function declarations', () => { const mapping = coverage.generate(contract.data, util.pathPrefix); assert.deepEqual(mapping[util.filePath].l, { - 6: 1, 11: 1 + 6: 2, 11: 1 // Doubled line-hit }); assert.deepEqual(mapping[util.filePath].b, {}); assert.deepEqual(mapping[util.filePath].s, { - 1: 1, 2: 1 + 1: 2, 2: 1 }); assert.deepEqual(mapping[util.filePath].f, { - 1: 1, + 1: 2, 2: 1, }); });