@ -4,6 +4,7 @@ const path = require('path');
const istanbul = require('istanbul');
const util = require('util');
const assert = require('assert');
const memdown = require('memdown');
const Instrumenter = require('./instrumenter');
const Coverage = require('./coverage');
@ -123,6 +124,7 @@ class App {
this.providerOptions.gasLimit = this.gasLimitString;
this.providerOptions.allowUnlimitedContractSize = true;
this.providerOptions.db = memdown();
// Try to launch provider and attach to vm step of
// either plugin's ganache or a provider passed via options
@ -3,21 +3,24 @@ const web3Utils = require('web3-utils')
class DataCollector {
constructor(instrumentationData={}){
this.instrumentationData = instrumentationData;
this.validOpcodes = {
"PUSH1": true,
}
step(info){
const self = this;
if (typeof info !== 'object' || !info.opcode ) return;
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();
hash = this._normalizeHash(hash);
if (info.opcode.name.includes("PUSH1") && info.stack.length > 0){
hash = self._normalizeHash(hash);
if(self.instrumentationData[hash]){
self.instrumentationData[hash].hits++;
if(this.instrumentationData[hash]){
this.instrumentationData[hash].hits++;
} catch (err) { /*Ignore*/ };
_setInstrumentationData(data){
@ -27,6 +27,7 @@
"global-modules": "^2.0.0",
"globby": "^10.0.1",
"istanbul": "^0.4.5",
"memdown": "^5.0.0",
"node-dir": "^0.1.17",
"node-emoji": "^1.10.0",
"req-cwd": "^1.0.1",
@ -30,14 +30,14 @@ echo ">>>>> checkout provider-benchmarks branch"
git checkout provider-benchmarks
# Swap installed coverage for PR branch version
echo ">>>>> npm install"
npm install
echo ">>>>> yarn install"
yarn install
echo ">>>>> npm uninstall --save-dev solidity-coverage"
npm uninstall --save-dev solidity-coverage
echo ">>>>> yarn remove --dev solidity-coverage"
yarn remove --dev solidity-coverage
echo ">>>>> npm install --save-dev PR_PATH"
npm install --save-dev "$PR_PATH"
echo ">>>>> yarn add -dev $PR_PATH"
yarn add -dev "$PR_PATH"
# Track perf
time npx truffle run coverage