|
|
|
@ -49,18 +49,6 @@ class DataCollector { |
|
|
|
|
} catch (err) { /*Ignore*/ }; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// Temporarily disabled because some relevant traces aren't available
|
|
|
|
|
/** |
|
|
|
|
* Converts pushData value to string and registers in instrumentation map. |
|
|
|
|
* @param {HardhatEVMTraceInstruction} instruction |
|
|
|
|
*/ |
|
|
|
|
/*trackHardhatEVMInstruction(instruction){ |
|
|
|
|
if (instruction && instruction.pushData){ |
|
|
|
|
let hash = `0x` + instruction.pushData.toString('hex'); |
|
|
|
|
this._registerHash(hash) |
|
|
|
|
} |
|
|
|
|
}*/ |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Normalizes has string and marks hit. |
|
|
|
|
* @param {String} hash bytes32 hash |
|
|
|
@ -78,20 +66,6 @@ class DataCollector { |
|
|
|
|
} |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// Detect and recover from viaIR mangled hashes by left-padding single `0`
|
|
|
|
|
if(this.viaIR && hash.length === 18) { |
|
|
|
|
hash = hash.slice(2); |
|
|
|
|
hash = '0' + hash; |
|
|
|
|
hash = hash.slice(0,16); |
|
|
|
|
hash = '0x' + hash; |
|
|
|
|
if(this.instrumentationData[hash]){ |
|
|
|
|
if (this.lastHash !== hash) { |
|
|
|
|
this.lastHash = hash; |
|
|
|
|
this.instrumentationData[hash].hits++ |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
@ -107,6 +81,15 @@ class DataCollector { |
|
|
|
|
// but it doesn't preserve leading zeroes when it does this
|
|
|
|
|
if (this.viaIR && hash.length >= 18) { |
|
|
|
|
hash = hash.slice(0,18); |
|
|
|
|
|
|
|
|
|
// Detect and recover from viaIR mangled hashes by left-padding single `0`
|
|
|
|
|
if(!this.instrumentationData[hash]) { |
|
|
|
|
hash = hash.slice(2); |
|
|
|
|
hash = '0' + hash; |
|
|
|
|
hash = hash.slice(0,16); |
|
|
|
|
hash = '0x' + hash; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} else if (hash.length < 18 && hash.length > 11){ |
|
|
|
|
hash = hash.slice(2); |
|
|
|
|
while(hash.length < 16) hash = '0' + hash; |
|
|
|
@ -124,4 +107,4 @@ class DataCollector { |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
module.exports = DataCollector; |
|
|
|
|
module.exports = DataCollector; |
|
|
|
|