diff --git a/lib/modules/fuzzer/index.js b/lib/modules/fuzzer/index.js index 0a1d96863..7ff4dd6b9 100644 --- a/lib/modules/fuzzer/index.js +++ b/lib/modules/fuzzer/index.js @@ -5,7 +5,6 @@ const _ = require('underscore'); // generates random inputs based on the inputs of an ABI class ContractFuzzer { constructor(embark) { - //this.abi = abi; this.embark = embark; this.logger = embark.logger; this.events = embark.events; @@ -18,12 +17,13 @@ class ContractFuzzer { generateFuzz(iterations, contract) { const self = this; let fuzzMap = {}; - for (let i = 0; i < iterations; i++) contract.abiDefinition.filter((x) => x.inputs && x.inputs.length != 0).forEach((abiMethod) => { - let name = abiMethod.type === "constructor" ? "constructor" : abiMethod.name; - let inputTypes = abiMethod.inputs.map(input => input.type); - let fuzzedInputs = _.map(inputTypes, this.getTypeFuzz.bind(this)); - fuzzMap[name] = fuzzedInputs; - }); + for (let i = 0; i < iterations; i++) { + contract.abiDefinition.filter((x) => x.inputs && x.inputs.length != 0).forEach((abiMethod) => { + let name = abiMethod.type === "constructor" ? "constructor" : abiMethod.name; + let inputTypes = abiMethod.inputs.map(input => input.type); + fuzzMap[name] = inputTypes.map(input => this.getTypeFuzz.bind(this)); + }); + } for (let key in fuzzMap) self.logger.info(key + ":" + fuzzMap[key]); return fuzzMap; } @@ -102,8 +102,8 @@ class ContractFuzzer { this.generateFuzz(iterations, contract); }); return ""; - } - return false; + } + return false; }); } }