Code coverage for Solidity smart-contracts
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
solidity-coverage/hookIntoEvents.patch

31 lines
1.0 KiB

--- opFns.js.orig 2016-07-04 17:29:54.000000000 +0100
+++ opFns.js 2016-09-30 12:30:33.000000000 +0100
@@ -6,6 +6,7 @@
const logTable = require('./logTable.js')
const ERROR = constants.ERROR
const MAX_INT = 9007199254740991
+const fs = require('fs');
// the opcode functions
module.exports = {
@@ -499,7 +500,6 @@
memLength = utils.bufferToInt(memLength)
const numOfTopics = runState.opCode - 0xa0
const mem = memLoad(runState, memOffset, memLength)
- subGas(runState, new BN(numOfTopics * fees.logTopicGas.v + memLength * fees.logDataGas.v))
// add address
var log = [runState.address]
@@ -507,6 +507,12 @@
// add data
log.push(mem)
+ //Added to allow tracking of instrumentation even for .call() and throw
+ var toWrite = {};
+ toWrite.address= log[0].toString('hex');
+ toWrite.topics = log[1].map(function(x){return x.toString('hex')})
+ toWrite.data = log[2].toString('hex');
+ fs.appendFileSync('./allFiredEvents', JSON.stringify(toWrite) + '\n')
runState.logs.push(log)
},