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

32 lines
1.1 KiB

--- opFns.js.orig 2016-12-19 15:10:12.000000000 -0800
+++ opFns.js 2016-12-19 15:15:51.000000000 -0800
@@ -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 = {
@@ -489,7 +490,7 @@
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))
+ //subGas(runState, new BN(numOfTopics * fees.logTopicGas.v + memLength * fees.logDataGas.v))
// add address
var log = [runState.address]
@@ -497,6 +498,11 @@
// add data
log.push(mem)
+ 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)
},