Even better...

truffle-plugin-optimise
Alex 5 years ago
parent 98fa171800
commit 1da0356c42
  1. 3
      lib/collector.js

@ -1,5 +1,5 @@
const web3Utils = require('web3-utils') const web3Utils = require('web3-utils')
const limit = web3Utils.toBN(2).pow(web3Utils.toBN(236))
/** /**
* Writes data from the VM step to the in-memory * Writes data from the VM step to the in-memory
* coverage map constructed by the Instrumenter. * coverage map constructed by the Instrumenter.
@ -22,6 +22,7 @@ class DataCollector {
try { try {
if (this.validOpcodes[info.opcode.name] && info.stack.length > 0){ if (this.validOpcodes[info.opcode.name] && info.stack.length > 0){
const idx = info.stack.length - 1; const idx = info.stack.length - 1;
if (info.stack[idx].lt(limit)) return;
let hash = "0x" + info.stack[idx].toString(16,64); let hash = "0x" + info.stack[idx].toString(16,64);
if(this.instrumentationData[hash]){ if(this.instrumentationData[hash]){
this.instrumentationData[hash].hits++; this.instrumentationData[hash].hits++;

Loading…
Cancel
Save