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

24 lines
734 B

--- opFns.js.orig 2016-09-27 10:00:02.000000000 +0100
+++ opFns.js 2016-09-27 10:00:59.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 = {
@@ -507,6 +508,12 @@
// add data
log.push(mem)
+ //Added to allow tracking of instrumentation even for .call() and throw
+ let 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)
},