integration tests for 2 contracts updated

pull/7/head
Aniket 5 years ago committed by Aniket
parent febf8804ac
commit 8ccef1c5a9
  1. 7
      remix-analyzer/src/solidity-analyzer/index.ts
  2. 2
      remix-analyzer/src/solidity-analyzer/modules/assignAndCompare.ts
  3. 2
      remix-analyzer/src/solidity-analyzer/modules/blockBlockhash.ts
  4. 2
      remix-analyzer/src/solidity-analyzer/modules/checksEffectsInteraction.ts
  5. 6
      remix-analyzer/src/solidity-analyzer/modules/constantFunctions.ts
  6. 4
      remix-analyzer/src/solidity-analyzer/modules/etherTransferInLoop.ts
  7. 4
      remix-analyzer/src/solidity-analyzer/modules/forLoopIteratesOverDynamicArray.ts
  8. 11
      remix-analyzer/src/solidity-analyzer/modules/functionCallGraph.ts
  9. 2
      remix-analyzer/src/solidity-analyzer/modules/inlineAssembly.ts
  10. 2
      remix-analyzer/src/solidity-analyzer/modules/selfdestruct.ts
  11. 95
      remix-analyzer/src/solidity-analyzer/modules/staticAnalysisCommon.ts
  12. 2
      remix-analyzer/src/solidity-analyzer/modules/thisLocal.ts
  13. 3
      remix-analyzer/test/analysis/staticAnalysisCommon-test.ts
  14. 552
      remix-analyzer/test/analysis/staticAnalysisIntegration-test-0.5.0.ts
  15. 2
      remix-analyzer/test/analysis/test-contracts/solidity-v0.5/ballot.sol

@ -18,7 +18,9 @@ export default class staticAnalysisRunner {
// Also provide convenience analysis via the AST walker.
const walker = new AstWalker()
for (let k in compilationResult.sources) {
walker.walk(compilationResult.sources[k].AST, {'*': (node) => {
// console.log('Ast in walker---', compilationResult.sources[k])
walker.walkFull(compilationResult.sources[k].ast,
(node) => {
modules.map((item, i) => {
if (item.mod.visit !== undefined) {
try {
@ -31,7 +33,8 @@ export default class staticAnalysisRunner {
}
})
return true
}})
}
)
}
// Here, modules can just collect the results from the AST walk,

@ -11,7 +11,7 @@ export default class assignAndCompare implements AnalyzerModule {
algorithm: ModuleAlgorithm = algorithm.EXACT
visit (node: BlockAstNode | IfStatementAstNode | WhileStatementAstNode | ForStatementAstNode): void {
if (isSubScopeWithTopLevelUnAssignedBinOp(node)) getUnAssignedTopLevelBinOps(node).forEach((n) => this.warningNodes.push(n))
if (node && node.nodeType && isSubScopeWithTopLevelUnAssignedBinOp(node)) getUnAssignedTopLevelBinOps(node).forEach((n) => this.warningNodes.push(n))
}
report (compilationResults: CompilationResult): ReportObj[] {

@ -11,7 +11,7 @@ export default class blockBlockhash implements AnalyzerModule {
algorithm: ModuleAlgorithm = algorithm.EXACT
visit (node: FunctionCallAstNode): void {
if (isBlockBlockHashAccess(node)) this.warningNodes.push(node)
if (node.nodeType === 'FunctionCall' && isBlockBlockHashAccess(node)) this.warningNodes.push(node)
}
report (compilationResults: CompilationResult): ReportObj[] {

@ -43,7 +43,7 @@ export default class checksEffectsInteraction implements AnalyzerModule {
comments += (multipleContractsWithSameName) ? 'Note: Import aliases are currently not supported by this static analysis.' : ''
warnings.push({
warning: `Potential Violation of Checks-Effects-Interaction pattern in ${funcName}: Could potentially lead to re-entrancy vulnerability. ${comments}`,
location: func['src'],
location: func.node['src'],
more: 'http://solidity.readthedocs.io/en/develop/security-considerations.html#re-entrancy'
})
}

@ -64,13 +64,13 @@ export default class constantFunctions implements AnalyzerModule {
if (func['potentiallyshouldBeConst']) {
warnings.push({
warning: `${funcName} : Potentially should be constant but is not. ${comments}`,
location: func['src'],
location: func.node['src'],
more: 'http://solidity.readthedocs.io/en/develop/contracts.html#constant-functions'
})
} else {
warnings.push({
warning: `${funcName} : Is constant but potentially should not be. ${comments}`,
location: func['src'],
location: func.node['src'],
more: 'http://solidity.readthedocs.io/en/develop/contracts.html#constant-functions'
})
}
@ -88,7 +88,7 @@ export default class constantFunctions implements AnalyzerModule {
return contract.stateVariables.concat(func.localVariables.filter(isStorageVariableDeclaration))
}
private checkIfShouldBeConstant (startFuncName: string, context): boolean {
private checkIfShouldBeConstant (startFuncName: string, context: Context): boolean {
return !analyseCallGraph(context.callGraph, startFuncName, context, this.isConstBreaker.bind(this))
}

@ -12,11 +12,11 @@ export default class etherTransferInLoop implements AnalyzerModule {
visit (node: ForStatementAstNode | WhileStatementAstNode): void {
let transferNodes: ExpressionStatementAstNode[] = []
if(node.body.nodeType === 'Block')
if(node.body && node.body.nodeType === 'Block')
transferNodes = node.body.statements.filter(child => ( child.nodeType === 'ExpressionStatement' &&
child.expression.nodeType === 'FunctionCall' && isTransfer(child.expression.expression)))
// When loop body is described without braces
else if(node.body.nodeType === 'ExpressionStatement' && node.body.expression.nodeType === 'FunctionCall' && isTransfer(node.body.expression.expression))
else if(node.body && node.body.nodeType === 'ExpressionStatement' && node.body.expression.nodeType === 'FunctionCall' && isTransfer(node.body.expression.expression))
transferNodes.push(node.body)
if (transferNodes.length > 0) {
this.relevantNodes.push(...transferNodes)

@ -13,9 +13,9 @@ export default class forLoopIteratesOverDynamicArray implements AnalyzerModule {
visit (node: ForStatementAstNode): void {
const { condition } = node
// Check if condition is `i < array.length - 1`
if ((condition.nodeType === "BinaryOperation" && condition.rightExpression.nodeType === "BinaryOperation" && isDynamicArrayLengthAccess(condition.rightExpression.leftExpression)) ||
if ((condition && condition.nodeType === "BinaryOperation" && condition.rightExpression.nodeType === "BinaryOperation" && isDynamicArrayLengthAccess(condition.rightExpression.leftExpression)) ||
// or condition is `i < array.length`
(condition.nodeType === "BinaryOperation" && isDynamicArrayLengthAccess(condition.rightExpression))) {
(condition && condition.nodeType === "BinaryOperation" && isDynamicArrayLengthAccess(condition.rightExpression))) {
this.relevantNodes.push(node)
}
}

@ -1,8 +1,7 @@
'use strict'
import { FunctionHLAst, ContractHLAst, FunctionCallGraph, ContractCallGraph } from "types"
const common = require('./staticAnalysisCommon')
import { isLocalCallGraphRelevantNode, isExternalDirectCall, getFullQualifiedFunctionCallIdent, getFullQuallyfiedFuncDefinitionIdent, getContractName } from './staticAnalysisCommon'
function buildLocalFuncCallGraphInternal (functions: FunctionHLAst[], nodeFilter: any , extractNodeIdent: any, extractFuncDefIdent: Function): Record<string, FunctionCallGraph> {
const callGraph: Record<string, FunctionCallGraph> = {}
@ -44,11 +43,11 @@ function buildLocalFuncCallGraphInternal (functions: FunctionHLAst[], nodeFilter
export function buildGlobalFuncCallGraph (contracts: ContractHLAst[]): Record<string, ContractCallGraph> {
const callGraph: Record<string, ContractCallGraph> = {}
contracts.forEach((contract) => {
const filterNodes: Function = (node) => { return common.isLocalCallGraphRelevantNode(node) || common.isExternalDirectCall(node) }
const getNodeIdent: Function = (node) => { return common.getFullQualifiedFunctionCallIdent(contract.node, node) }
const getFunDefIdent: Function = (funcDef) => { return common.getFullQuallyfiedFuncDefinitionIdent(contract.node, funcDef.node, funcDef.parameters) }
const filterNodes: Function = (node) => { return isLocalCallGraphRelevantNode(node) || isExternalDirectCall(node) }
const getNodeIdent: Function = (node) => { return getFullQualifiedFunctionCallIdent(contract.node, node) }
const getFunDefIdent: Function = (funcDef) => { return getFullQuallyfiedFuncDefinitionIdent(contract.node, funcDef.node, funcDef.parameters) }
callGraph[common.getContractName(contract.node)] = { contract: contract, functions: buildLocalFuncCallGraphInternal(contract.functions, filterNodes, getNodeIdent, getFunDefIdent) }
callGraph[getContractName(contract.node)] = { contract: contract, functions: buildLocalFuncCallGraphInternal(contract.functions, filterNodes, getNodeIdent, getFunDefIdent) }
})
return callGraph

@ -10,7 +10,7 @@ export default class inlineAssembly implements AnalyzerModule {
algorithm: ModuleAlgorithm = algorithm.EXACT
visit (node: InlineAssemblyAstNode): void {
this.inlineAssNodes.push(node)
if(node.nodeType === 'InlineAssembly') this.inlineAssNodes.push(node)
}
report (compilationResults: CompilationResult): ReportObj[] {

@ -13,7 +13,7 @@ export default class selfdestruct implements AnalyzerModule {
abstractAst: AbstractAst = new AbstractAst()
visit: Function = this.abstractAst.build_visit(
(node: any) => isStatement(node) || isSelfdestructCall(node.expression)
(node: any) => isStatement(node) || ( node.nodeType=== 'FunctionCall' && isSelfdestructCall(node.expression) )
)
report: Function = this.abstractAst.build_report(this._report.bind(this))

@ -1,33 +1,61 @@
'use strict'
import { FunctionDefinitionAstNode, ModifierDefinitionAstNode, ParameterListAstNode, ForStatementAstNode, WhileStatementAstNode, VariableDeclarationAstNode, ContractDefinitionAstNode, InheritanceSpecifierAstNode, MemberAccessAstNode, BinaryOperationAstNode, FunctionCallAstNode, ExpressionStatementAstNode, UnaryOperationAstNode, IdentifierAstNode, MappingAstNode, IndexAccessAstNode, UserDefinedTypeNameAstNode, BlockAstNode, AssignmentAstNode, InlineAssemblyAstNode, IfStatementAstNode } from "types"
import { util } from 'remix-lib'
const nodeTypes = {
IDENTIFIER: 'Identifier',
MEMBERACCESS: 'MemberAccess',
FUNCTIONCALL: 'FunctionCall',
SOURCEUNIT: 'SourceUnit',
PRAGMADIRECTIVE: 'PragmaDirective',
IMPORTDIRECTIVE: 'ImportDirective',
CONTRACTDEFINITION: 'ContractDefinition',
INHERITANCESPECIFIER: 'InheritanceSpecifier',
USINGFORDIRECTIVE: 'UsingForDirective',
STRUCTDEFINITION: 'StructDefinition',
ENUMDEFINITION: 'EnumDefinition',
ENUMVALUE: 'EnumValue',
PARAMETERLIST: 'ParameterList',
OVERRIDESPECIFIER: 'OverrideSpecifier',
FUNCTIONDEFINITION: 'FunctionDefinition',
VARIABLEDECLARATION: 'VariableDeclaration',
ASSIGNMENT: 'Assignment',
CONTRACTDEFINITION: 'ContractDefinition',
UNARYOPERATION: 'UnaryOperation',
BINARYOPERATION: 'BinaryOperation',
EXPRESSIONSTATEMENT: 'ExpressionStatement',
MODIFIERDEFINITION: 'ModifierDefinition',
MODIFIERINVOCATION: 'ModifierInvocation',
INHERITANCESPECIFIER: 'InheritanceSpecifier',
EVENTDEFINITION: 'EventDefinition',
ELEMENTARYTYPENAME: 'ElementaryTypeName',
USERDEFINEDTYPENAME: 'UserDefinedTypeName',
FUNCTIONTYPENAME: 'FunctionTypeName',
MAPPING: 'Mapping',
ARRAYTYPENAME: 'ArrayTypeName',
INLINEASSEMBLY: 'InlineAssembly',
BLOCK: 'Block',
NEWEXPRESSION: 'NewExpression',
RETURN: 'Return',
PLACEHOLDERSTATEMENT: 'PlaceholderStatement',
IFSTATEMENT: 'IfStatement',
FORSTATEMENT: 'ForStatement',
TRYCATCHCLAUSE: 'TryCatchClause',
TRYSTATEMENT: 'TryStatement',
WHILESTATEMENT: 'WhileStatement',
DOWHILESTATEMENT: 'DoWhileStatement',
ELEMENTARYTYPENAMEEXPRESSION: 'ElementaryTypeNameExpression'
FORSTATEMENT: 'ForStatement',
CONTINUE: 'Continue',
BREAK: 'Break',
RETURN: 'Return',
THROW: 'Throw',
EMITSTATEMENT: 'EmitStatement',
VARIABLEDECLARATIONSTATEMENT: 'VariableDeclarationStatement',
EXPRESSIONSTATEMENT: 'ExpressionStatement',
CONDITIONAL: 'Conditional',
ASSIGNMENT: 'Assignment',
TUPLEEXPRESSION: 'TupleExpression',
UNARYOPERATION: 'UnaryOperation',
BINARYOPERATION: 'BinaryOperation',
FUNCTIONCALL: 'FunctionCall',
FUNCTIONCALLOPTIONS: 'FunctionCallOptions',
NEWEXPRESSION: 'NewExpression',
MEMBERACCESS: 'MemberAccess',
INDEXACCESS: 'IndexAccess',
INDEXRANGEACCESS: 'IndexRangeAccess',
ELEMENTARYTYPENAMEEXPRESSION: 'ElementaryTypeNameExpression',
LITERAL: 'Literal',
IDENTIFIER: 'Identifier',
STRUCTUREDDOCUMENTATION: 'StructuredDocumentation'
}
const basicTypes = {
@ -401,7 +429,7 @@ function getUnAssignedTopLevelBinOps (subScope: BlockAstNode | IfStatementAstNod
if(subScope.nodeType === 'Block')
result = subScope.statements.filter(isBinaryOpInExpression)
// for 'without braces' loops
else if (isSubScopeStatement(subScope)) {
else if (subScope && subScope.nodeType && isSubScopeStatement(subScope)) {
if (subScope.nodeType === 'IfStatement'){
if((subScope.trueBody.nodeType === "ExpressionStatement" && isBinaryOpInExpression(subScope.trueBody)))
result.push(subScope.trueBody)
@ -519,7 +547,7 @@ function isBuiltinFunctionCall (node: FunctionCallAstNode): boolean {
// console.log('isBuiltinFunctionCall isLocalCall', isLocalCall(node))
// console.log('isBuiltinFunctionCall getLocalCallName', getLocalCallName(node))
// console.log('isBuiltinFunctionCall getFunctionCallTypeParameterType', getFunctionCallTypeParameterType(node))
return (isLocalCall(node) && builtinFunctions[getLocalCallName(node) + '(' + getFunctionCallTypeParameterType(node) + ')'] === true) || isAbiNamespaceCall(node)
return (node.nodeType === 'FunctionCall' && isLocalCall(node) && builtinFunctions[getLocalCallName(node) + '(' + getFunctionCallTypeParameterType(node) + ')'] === true) || isAbiNamespaceCall(node)
}
/**
@ -564,6 +592,7 @@ function isRequireCall (node: FunctionCallAstNode): boolean {
* @return {bool}
*/
function isStorageVariableDeclaration (node: VariableDeclarationAstNode): boolean {
// console.log('storage variable----------', new RegExp(basicRegex.REFTYPE).test(node.typeDescriptions.typeIdentifier))
return node.storageLocation === 'storage' && new RegExp(basicRegex.REFTYPE).test(node.typeDescriptions.typeIdentifier)
}
@ -652,20 +681,21 @@ function isSubScopeWithTopLevelUnAssignedBinOp (node: BlockAstNode | IfStatement
if(node.nodeType === 'Block')
return node.statements.some(isBinaryOpInExpression)
// for 'without braces' loops
else if (isSubScopeStatement(node)) {
else if (node && node.nodeType && isSubScopeStatement(node)) {
if (node.nodeType === 'IfStatement')
return (node.trueBody.nodeType === "ExpressionStatement" && isBinaryOpInExpression(node.trueBody)) ||
(node.falseBody.nodeType === "ExpressionStatement" && isBinaryOpInExpression(node.falseBody))
return (node.trueBody && node.trueBody.nodeType === "ExpressionStatement" && isBinaryOpInExpression(node.trueBody)) ||
(node.falseBody && node.falseBody.nodeType === "ExpressionStatement" && isBinaryOpInExpression(node.falseBody))
else
return node.body.nodeType === "ExpressionStatement" && isBinaryOpInExpression(node.body)
return node.body && node.body.nodeType === "ExpressionStatement" && isBinaryOpInExpression(node.body)
}
}
function isSubScopeStatement (node: IfStatementAstNode | WhileStatementAstNode | ForStatementAstNode): boolean {
if(node.nodeType === 'IfStatement')
return !nodeType(node.trueBody, exactMatch(nodeTypes.BLOCK)) && !nodeType(node.falseBody, exactMatch(nodeTypes.BLOCK))
return (node.trueBody && node.trueBody.nodeType && !nodeType(node.trueBody, exactMatch(nodeTypes.BLOCK))) ||
(node.falseBody && node.falseBody.nodeType && !nodeType(node.falseBody, exactMatch(nodeTypes.BLOCK)))
else
return !nodeType(node.body, exactMatch(nodeTypes.BLOCK))
return node.body && node.body.nodeType && !nodeType(node.body, exactMatch(nodeTypes.BLOCK))
}
/**
@ -809,7 +839,8 @@ function isSuperLocalCall (node: MemberAccessAstNode): boolean {
* @return {bool}
*/
function isLocalCall (node: FunctionCallAstNode): boolean {
return node.kind === 'functionCall' &&
return node.nodeType === 'FunctionCall' &&
node.kind === 'functionCall' &&
node.expression.nodeType === 'Identifier' &&
expressionTypeDescription(node, basicRegex.FUNCTIONTYPE) &&
!expressionTypeDescription(node, basicRegex.EXTERNALFUNCTIONTYPE)
@ -952,15 +983,17 @@ function isBytesLengthCheck (node: MemberAccessAstNode): boolean {
// #################### Complex Node Identification - Private
function isMemberAccess (node: MemberAccessAstNode, retType: string, accessor: string| undefined, accessorType: string, memberName: string | undefined): boolean {
if(node && nodeType(node, exactMatch('MemberAccess'))) {
const nodeTypeDef: boolean = typeDescription(node, retType)
console.log('MemberAccess typeDef ->',nodeTypeDef)
// console.log('MemberAccess typeDef ->',nodeTypeDef)
const nodeMemName: boolean = memName(node, memberName)
console.log('MemberAccess nodeMemName ->',nodeMemName)
// console.log('MemberAccess nodeMemName ->',nodeMemName)
const nodeExpMemName: boolean = memName(node.expression, accessor)
console.log('MemberAccess nodeExpMemName ->',nodeExpMemName)
// console.log('MemberAccess nodeExpMemName ->',nodeExpMemName)
const nodeExpTypeDef: boolean = expressionTypeDescription(node, accessorType)
console.log('MemberAccess nodeExpTypeDef ->',nodeExpTypeDef)
// console.log('MemberAccess nodeExpTypeDef ->',nodeExpTypeDef)
return nodeTypeDef && nodeMemName && nodeExpTypeDef && nodeExpMemName
} else return false
}
function isSpecialVariableAccess (node: MemberAccessAstNode, varType: any): boolean {
@ -989,11 +1022,15 @@ function typeDescription (node: any, typeRegex: string): boolean {
return new RegExp(typeRegex).test(node.typeDescriptions.typeString)
}
function nodeType (node, typeRegex) {
function nodeType (node: any, typeRegex: string) {
return new RegExp(typeRegex).test(node.nodeType)
}
function memName (node, memNameRegex) {
function nodeTypeIn (node: any, typeRegex: string[]){
return typeRegex.some((typeRegex) => nodeType (node, typeRegex))
}
function memName (node: any, memNameRegex: any) {
// const regex = new RegExp(memNameRegex)
return (node && !memNameRegex) || new RegExp(memNameRegex).test(node.name) || new RegExp(memNameRegex).test(node.memberName)
}

@ -11,7 +11,7 @@ export default class thisLocal implements AnalyzerModule {
algorithm: ModuleAlgorithm = algorithm.EXACT
visit (node: MemberAccessAstNode): void {
if (isThisLocalCall(node)) this.warningNodes.push(node)
if (node.nodeType === 'MemberAccess' && isThisLocalCall(node)) this.warningNodes.push(node)
}
report (compilationResults: CompilationResult): ReportObj[] {

@ -266,9 +266,8 @@ test('staticAnalysisCommon.getFullQuallyfiedFuncDefinitionIdent', function (t) {
// #################### Complex Node Identification
test('staticAnalysisCommon.isBuiltinFunctionCall', function (t) {
t.plan(2)
t.plan(1)
t.ok(common.isBuiltinFunctionCall(selfdestruct), 'selfdestruct is builtin')
t.throws(() => common.isBuiltinFunctionCall(localCall), Error, 'local call is not builtin')
})
test('staticAnalysisCommon.isStorageVariableDeclaration', function (t) {

@ -1,17 +1,17 @@
// import { default as test} from "tape"
// import { helpers } from 'remix-lib'
// import { readFileSync } from 'fs'
// import { join } from 'path'
// import { default as StatRunner } from '../../dist/src/solidity-analyzer'
// import { install, require as requireNPMmodule } from 'npm-install-version'
// install('solc@0.5.0')
// const compiler = requireNPMmodule('solc@0.5.0')
// const {compilerInput } = helpers.compiler
// const folder = 'solidity-v0.5'
// const testFiles = [
// 'KingOfTheEtherThrone.sol',
// 'assembly.sol',
import { default as test} from "tape"
import { helpers } from 'remix-lib'
import { readFileSync } from 'fs'
import { join } from 'path'
import { default as StatRunner } from '../../dist/src/solidity-analyzer'
import { install, require as requireNPMmodule } from 'npm-install-version'
install('solc@0.5.0')
const compiler = requireNPMmodule('solc@0.5.0')
const {compilerInput } = helpers.compiler
const folder = 'solidity-v0.5'
const testFiles = [
'KingOfTheEtherThrone.sol',
'assembly.sol',
// 'ballot.sol',
// 'ballot_reentrant.sol',
// 'ballot_withoutWarnings.sol',
@ -36,23 +36,27 @@
// 'stringBytesLength.sol',
// 'etherTransferInLoop.sol',
// 'forLoopIteratesOverDynamicArray.sol'
// ]
]
// var testFileAsts = {}
var testFileAsts = {}
// testFiles.forEach((fileName) => {
// var content = readFileSync(join(__dirname, 'test-contracts/' + folder, fileName), 'utf8')
// testFileAsts[fileName] = JSON.parse(compiler.compile(compilerInput(content)))
// })
testFiles.forEach((fileName) => {
var content = readFileSync(join(__dirname, 'test-contracts/' + folder, fileName), 'utf8')
testFileAsts[fileName] = JSON.parse(compiler.compile(compilerInput(content)))
})
// console.log(testFileAsts['ballot.sol'].sources['test.sol'].ast.nodes[1].nodes)
// test('Integration test thisLocal.js', function (t) {
test('Integration test thisLocal.js', function (t) {
// console.log('testFileAsts---------',testFileAsts)
// t.plan(testFiles.length)
t.plan(2)
// var module = require('../../dist/src/solidity-analyzer/modules/thisLocal').default
var module = require('../../dist/src/solidity-analyzer/modules/thisLocal').default
// var lengthCheck = {
// 'KingOfTheEtherThrone.sol': 0,
// 'assembly.sol': 0,
var lengthCheck = {
'KingOfTheEtherThrone.sol': 0,
'assembly.sol': 0,
// 'ballot.sol': 0,
// 'ballot_reentrant.sol': 1,
// 'ballot_withoutWarnings.sol': 0,
@ -77,21 +81,21 @@
// 'stringBytesLength.sol': 0,
// 'etherTransferInLoop.sol': 0,
// 'forLoopIteratesOverDynamicArray.sol': 0
// }
}
// runModuleOnFiles(module, t, (file, report) => {
// t.equal(report.length, lengthCheck[file], `${file} has right amount of this local warnings`)
// })
// })
runModuleOnFiles(module, t, (file, report) => {
t.equal(report.length, lengthCheck[file], `${file} has right amount of this local warnings`)
})
})
// test('Integration test checksEffectsInteraction.js', function (t) {
// t.plan(testFiles.length)
test('Integration test checksEffectsInteraction.js', function (t) {
t.plan(2)
// var module = require('../../dist/src/solidity-analyzer/modules/checksEffectsInteraction').default
var module = require('../../dist/src/solidity-analyzer/modules/checksEffectsInteraction').default
// var lengthCheck = {
// 'KingOfTheEtherThrone.sol': 1,
// 'assembly.sol': 1,
var lengthCheck = {
'KingOfTheEtherThrone.sol': 1,
'assembly.sol': 1,
// 'ballot.sol': 0,
// 'ballot_reentrant.sol': 1,
// 'ballot_withoutWarnings.sol': 0,
@ -116,21 +120,21 @@
// 'stringBytesLength.sol': 0,
// 'etherTransferInLoop.sol': 0,
// 'forLoopIteratesOverDynamicArray.sol': 0
// }
}
// runModuleOnFiles(module, t, (file, report) => {
// t.equal(report.length, lengthCheck[file], `${file} has right amount of checks-effects-interaction warnings`)
// })
// })
runModuleOnFiles(module, t, (file, report) => {
t.equal(report.length, lengthCheck[file], `${file} has right amount of checks-effects-interaction warnings`)
})
})
// test('Integration test constantFunctions.js', function (t) {
// t.plan(testFiles.length)
test('Integration test constantFunctions.js', function (t) {
t.plan(2)
// var module = require('../../dist/src/solidity-analyzer/modules/constantFunctions').default
var module = require('../../dist/src/solidity-analyzer/modules/constantFunctions').default
// var lengthCheck = {
// 'KingOfTheEtherThrone.sol': 0,
// 'assembly.sol': 0,
var lengthCheck = {
'KingOfTheEtherThrone.sol': 0,
'assembly.sol': 0,
// 'ballot.sol': 0,
// 'ballot_reentrant.sol': 0,
// 'ballot_withoutWarnings.sol': 0,
@ -155,21 +159,21 @@
// 'stringBytesLength.sol': 0,
// 'etherTransferInLoop.sol': 0,
// 'forLoopIteratesOverDynamicArray.sol': 0
// }
}
// runModuleOnFiles(module, t, (file, report) => {
// t.equal(report.length, lengthCheck[file], `${file} has right amount of constant warnings`)
// })
// })
runModuleOnFiles(module, t, (file, report) => {
t.equal(report.length, lengthCheck[file], `${file} has right amount of constant warnings`)
})
})
// test('Integration test inlineAssembly.js', function (t) {
// t.plan(testFiles.length)
test('Integration test inlineAssembly.js', function (t) {
t.plan(2)
// var module = require('../../dist/src/solidity-analyzer/modules/inlineAssembly').default
var module = require('../../dist/src/solidity-analyzer/modules/inlineAssembly').default
// var lengthCheck = {
// 'KingOfTheEtherThrone.sol': 0,
// 'assembly.sol': 2,
var lengthCheck = {
'KingOfTheEtherThrone.sol': 0,
'assembly.sol': 2,
// 'ballot.sol': 0,
// 'ballot_reentrant.sol': 0,
// 'ballot_withoutWarnings.sol': 0,
@ -194,21 +198,21 @@
// 'stringBytesLength.sol': 0,
// 'etherTransferInLoop.sol': 0,
// 'forLoopIteratesOverDynamicArray.sol': 0
// }
}
// runModuleOnFiles(module, t, (file, report) => {
// t.equal(report.length, lengthCheck[file], `${file} has right amount of inline assembly warnings`)
// })
// })
runModuleOnFiles(module, t, (file, report) => {
t.equal(report.length, lengthCheck[file], `${file} has right amount of inline assembly warnings`)
})
})
// test('Integration test txOrigin.js', function (t) {
// t.plan(testFiles.length)
test('Integration test txOrigin.js', function (t) {
t.plan(2)
// var module = require('../../dist/src/solidity-analyzer/modules/txOrigin').default
var module = require('../../dist/src/solidity-analyzer/modules/txOrigin').default
// var lengthCheck = {
// 'KingOfTheEtherThrone.sol': 0,
// 'assembly.sol': 1,
var lengthCheck = {
'KingOfTheEtherThrone.sol': 0,
'assembly.sol': 1,
// 'ballot.sol': 0,
// 'ballot_reentrant.sol': 0,
// 'ballot_withoutWarnings.sol': 0,
@ -233,21 +237,21 @@
// 'stringBytesLength.sol': 0,
// 'etherTransferInLoop.sol': 0,
// 'forLoopIteratesOverDynamicArray.sol': 0
// }
}
// runModuleOnFiles(module, t, (file, report) => {
// t.equal(report.length, lengthCheck[file], `${file} has right amount of tx.origin warnings`)
// })
// })
runModuleOnFiles(module, t, (file, report) => {
t.equal(report.length, lengthCheck[file], `${file} has right amount of tx.origin warnings`)
})
})
// test('Integration test gasCosts.js', function (t) {
// t.plan(testFiles.length)
test('Integration test gasCosts.js', function (t) {
t.plan(2)
// var module = require('../../dist/src/solidity-analyzer/modules/gasCosts').default
var module = require('../../dist/src/solidity-analyzer/modules/gasCosts').default
// var lengthCheck = {
// 'KingOfTheEtherThrone.sol': 2,
// 'assembly.sol': 2,
var lengthCheck = {
'KingOfTheEtherThrone.sol': 2,
'assembly.sol': 2,
// 'ballot.sol': 3,
// 'ballot_reentrant.sol': 2,
// 'ballot_withoutWarnings.sol': 0,
@ -272,21 +276,21 @@
// 'stringBytesLength.sol': 1,
// 'etherTransferInLoop.sol': 3,
// 'forLoopIteratesOverDynamicArray.sol': 2
// }
}
// runModuleOnFiles(module, t, (file, report) => {
// t.equal(report.length, lengthCheck[file], `${file} has right amount of gasCost warnings`)
// })
// })
runModuleOnFiles(module, t, (file, report) => {
t.equal(report.length, lengthCheck[file], `${file} has right amount of gasCost warnings`)
})
})
// test('Integration test similarVariableNames.js', function (t) {
// t.plan(testFiles.length)
test('Integration test similarVariableNames.js', function (t) {
t.plan(2)
// var module = require('../../dist/src/solidity-analyzer/modules/similarVariableNames').default
var module = require('../../dist/src/solidity-analyzer/modules/similarVariableNames').default
// var lengthCheck = {
// 'KingOfTheEtherThrone.sol': 0,
// 'assembly.sol': 0,
var lengthCheck = {
'KingOfTheEtherThrone.sol': 0,
'assembly.sol': 0,
// 'ballot.sol': 2,
// 'ballot_reentrant.sol': 11,
// 'ballot_withoutWarnings.sol': 0,
@ -311,60 +315,21 @@
// 'stringBytesLength.sol': 0,
// 'etherTransferInLoop.sol': 0,
// 'forLoopIteratesOverDynamicArray.sol': 0
// }
}
// runModuleOnFiles(module, t, (file, report) => {
// t.equal(report.length, lengthCheck[file], `${file} has right amount of similarVariableNames warnings`)
// })
// })
runModuleOnFiles(module, t, (file, report) => {
t.equal(report.length, lengthCheck[file], `${file} has right amount of similarVariableNames warnings`)
})
})
// test('Integration test inlineAssembly.js', function (t) {
// t.plan(testFiles.length)
test('Integration test blockTimestamp.js', function (t) {
t.plan(2)
// var module = require('../../dist/src/solidity-analyzer/modules/inlineAssembly').default
var module = require('../../dist/src/solidity-analyzer/modules/blockTimestamp').default
// var lengthCheck = {
// 'KingOfTheEtherThrone.sol': 0,
// 'assembly.sol': 2,
// 'ballot.sol': 0,
// 'ballot_reentrant.sol': 0,
// 'ballot_withoutWarnings.sol': 0,
// 'cross_contract.sol': 0,
// 'inheritance.sol': 0,
// 'modifier1.sol': 0,
// 'modifier2.sol': 0,
// 'notReentrant.sol': 0,
// 'structReentrant.sol': 0,
// 'thisLocal.sol': 0,
// 'globals.sol': 0,
// 'library.sol': 0,
// 'transfer.sol': 0,
// 'ctor.sol': 0,
// 'forgottenReturn.sol': 0,
// 'selfdestruct.sol': 0,
// 'deleteDynamicArray.sol': 0,
// 'deleteFromDynamicArray.sol': 0,
// 'blockLevelCompare.sol': 0,
// 'intDivisionTruncate.sol': 0,
// 'ERC20.sol': 0,
// 'stringBytesLength.sol': 0,
// 'etherTransferInLoop.sol': 0,
// 'forLoopIteratesOverDynamicArray.sol': 0
// }
// runModuleOnFiles(module, t, (file, report) => {
// t.equal(report.length, lengthCheck[file], `${file} has right amount of inlineAssembly warnings`)
// })
// })
// test('Integration test blockTimestamp.js', function (t) {
// t.plan(testFiles.length)
// var module = require('../../dist/src/solidity-analyzer/modules/blockTimestamp').default
// var lengthCheck = {
// 'KingOfTheEtherThrone.sol': 1,
// 'assembly.sol': 0,
var lengthCheck = {
'KingOfTheEtherThrone.sol': 1,
'assembly.sol': 0,
// 'ballot.sol': 0,
// 'ballot_reentrant.sol': 3,
// 'ballot_withoutWarnings.sol': 0,
@ -389,21 +354,21 @@
// 'stringBytesLength.sol': 0,
// 'etherTransferInLoop.sol': 0,
// 'forLoopIteratesOverDynamicArray.sol': 0
// }
}
// runModuleOnFiles(module, t, (file, report) => {
// t.equal(report.length, lengthCheck[file], `${file} has right amount of blockTimestamp warnings`)
// })
// })
runModuleOnFiles(module, t, (file, report) => {
t.equal(report.length, lengthCheck[file], `${file} has right amount of blockTimestamp warnings`)
})
})
// test('Integration test lowLevelCalls.js', function (t) {
// t.plan(testFiles.length)
test('Integration test lowLevelCalls.js', function (t) {
t.plan(2)
// var module = require('../../dist/src/solidity-analyzer/modules/lowLevelCalls').default
var module = require('../../dist/src/solidity-analyzer/modules/lowLevelCalls').default
// var lengthCheck = {
// 'KingOfTheEtherThrone.sol': 1,
// 'assembly.sol': 1,
var lengthCheck = {
'KingOfTheEtherThrone.sol': 1,
'assembly.sol': 1,
// 'ballot.sol': 0,
// 'ballot_reentrant.sol': 7,
// 'ballot_withoutWarnings.sol': 0,
@ -428,21 +393,21 @@
// 'stringBytesLength.sol': 0,
// 'etherTransferInLoop.sol': 0,
// 'forLoopIteratesOverDynamicArray.sol': 0
// }
}
// runModuleOnFiles(module, t, (file, report) => {
// t.equal(report.length, lengthCheck[file], `${file} has right amount of lowLevelCalls warnings`)
// })
// })
runModuleOnFiles(module, t, (file, report) => {
t.equal(report.length, lengthCheck[file], `${file} has right amount of lowLevelCalls warnings`)
})
})
// test('Integration test blockBlockhash.js', function (t) {
// t.plan(testFiles.length)
test('Integration test blockBlockhash.js', function (t) {
t.plan(2)
// var module = require('../../dist/src/solidity-analyzer/modules/blockBlockhash').default
var module = require('../../dist/src/solidity-analyzer/modules/blockBlockhash').default
// var lengthCheck = {
// 'KingOfTheEtherThrone.sol': 0,
// 'assembly.sol': 0,
var lengthCheck = {
'KingOfTheEtherThrone.sol': 0,
'assembly.sol': 0,
// 'ballot.sol': 0,
// 'ballot_reentrant.sol': 0,
// 'ballot_withoutWarnings.sol': 0,
@ -467,12 +432,12 @@
// 'stringBytesLength.sol': 0,
// 'etherTransferInLoop.sol': 0,
// 'forLoopIteratesOverDynamicArray.sol': 0
// }
}
// runModuleOnFiles(module, t, (file, report) => {
// t.equal(report.length, lengthCheck[file], `${file} has right amount of blockBlockhash warnings`)
// })
// })
runModuleOnFiles(module, t, (file, report) => {
t.equal(report.length, lengthCheck[file], `${file} has right amount of blockBlockhash warnings`)
})
})
// /*
@ -517,14 +482,14 @@
// })
// */
// test('Integration test selfdestruct.js', function (t) {
// t.plan(testFiles.length)
test('Integration test selfdestruct.js', function (t) {
t.plan(2)
// var module = require('../../dist/src/solidity-analyzer/modules/selfdestruct').default
var module = require('../../dist/src/solidity-analyzer/modules/selfdestruct').default
// var lengthCheck = {
// 'KingOfTheEtherThrone.sol': 0,
// 'assembly.sol': 0,
var lengthCheck = {
'KingOfTheEtherThrone.sol': 0,
'assembly.sol': 0,
// 'ballot.sol': 0,
// 'ballot_reentrant.sol': 0,
// 'ballot_withoutWarnings.sol': 0,
@ -549,21 +514,21 @@
// 'stringBytesLength.sol': 0,
// 'etherTransferInLoop.sol': 0,
// 'forLoopIteratesOverDynamicArray.sol': 0
// }
}
// runModuleOnFiles(module, t, (file, report) => {
// t.equal(report.length, lengthCheck[file], `${file} has right amount of selfdestruct warnings`)
// })
// })
runModuleOnFiles(module, t, (file, report) => {
t.equal(report.length, lengthCheck[file], `${file} has right amount of selfdestruct warnings`)
})
})
// test('Integration test guardConditions.js', function (t) {
// t.plan(testFiles.length)
test('Integration test guardConditions.js', function (t) {
t.plan(2)
// var module = require('../../dist/src/solidity-analyzer/modules/guardConditions').default
var module = require('../../dist/src/solidity-analyzer/modules/guardConditions').default
// var lengthCheck = {
// 'KingOfTheEtherThrone.sol': 0,
// 'assembly.sol': 1,
var lengthCheck = {
'KingOfTheEtherThrone.sol': 0,
'assembly.sol': 1,
// 'ballot.sol': 0,
// 'ballot_reentrant.sol': 0,
// 'ballot_withoutWarnings.sol': 0,
@ -588,21 +553,21 @@
// 'stringBytesLength.sol': 0,
// 'etherTransferInLoop.sol': 0,
// 'forLoopIteratesOverDynamicArray.sol': 0
// }
}
// runModuleOnFiles(module, t, (file, report) => {
// t.equal(report.length, lengthCheck[file], `${file} has right amount of guardCondition warnings`)
// })
// })
runModuleOnFiles(module, t, (file, report) => {
t.equal(report.length, lengthCheck[file], `${file} has right amount of guardCondition warnings`)
})
})
// test('Integration test deleteDynamicArrays.js', function (t) {
// t.plan(testFiles.length)
test('Integration test deleteDynamicArrays.js', function (t) {
t.plan(2)
// var module = require('../../dist/src/solidity-analyzer/modules/deleteDynamicArrays').default
var module = require('../../dist/src/solidity-analyzer/modules/deleteDynamicArrays').default
// var lengthCheck = {
// 'KingOfTheEtherThrone.sol': 0,
// 'assembly.sol': 0,
var lengthCheck = {
'KingOfTheEtherThrone.sol': 0,
'assembly.sol': 0,
// 'ballot.sol': 0,
// 'ballot_reentrant.sol': 0,
// 'ballot_withoutWarnings.sol': 0,
@ -627,21 +592,21 @@
// 'stringBytesLength.sol': 0,
// 'etherTransferInLoop.sol': 0,
// 'forLoopIteratesOverDynamicArray.sol': 0
// }
}
// runModuleOnFiles(module, t, (file, report) => {
// t.equal(report.length, lengthCheck[file], `${file} has right amount of deleteDynamicArrays warnings`)
// })
// })
runModuleOnFiles(module, t, (file, report) => {
t.equal(report.length, lengthCheck[file], `${file} has right amount of deleteDynamicArrays warnings`)
})
})
// test('Integration test deleteFromDynamicArray.js', function (t) {
// t.plan(testFiles.length)
test('Integration test deleteFromDynamicArray.js', function (t) {
t.plan(2)
// var module = require('../../dist/src/solidity-analyzer/modules/deleteFromDynamicArray').default
var module = require('../../dist/src/solidity-analyzer/modules/deleteFromDynamicArray').default
// var lengthCheck = {
// 'KingOfTheEtherThrone.sol': 0,
// 'assembly.sol': 0,
var lengthCheck = {
'KingOfTheEtherThrone.sol': 0,
'assembly.sol': 0,
// 'ballot.sol': 0,
// 'ballot_reentrant.sol': 0,
// 'ballot_withoutWarnings.sol': 0,
@ -666,21 +631,21 @@
// 'stringBytesLength.sol': 0,
// 'etherTransferInLoop.sol': 0,
// 'forLoopIteratesOverDynamicArray.sol': 0
// }
}
// runModuleOnFiles(module, t, (file, report) => {
// t.equal(report.length, lengthCheck[file], `${file} has right amount of deleteFromDynamicArray warnings`)
// })
// })
runModuleOnFiles(module, t, (file, report) => {
t.equal(report.length, lengthCheck[file], `${file} has right amount of deleteFromDynamicArray warnings`)
})
})
// test('Integration test assignAndCompare.js', function (t) {
// t.plan(testFiles.length)
test('Integration test assignAndCompare.js', function (t) {
t.plan(2)
// var module = require('../../dist/src/solidity-analyzer/modules/assignAndCompare').default
var module = require('../../dist/src/solidity-analyzer/modules/assignAndCompare').default
// var lengthCheck = {
// 'KingOfTheEtherThrone.sol': 0,
// 'assembly.sol': 0,
var lengthCheck = {
'KingOfTheEtherThrone.sol': 0,
'assembly.sol': 0,
// 'ballot.sol': 0,
// 'ballot_reentrant.sol': 0,
// 'ballot_withoutWarnings.sol': 0,
@ -705,21 +670,21 @@
// 'stringBytesLength.sol': 0,
// 'etherTransferInLoop.sol': 0,
// 'forLoopIteratesOverDynamicArray.sol': 0
// }
}
// runModuleOnFiles(module, t, (file, report) => {
// t.equal(report.length, lengthCheck[file], `${file} has right amount of assignAndCompare warnings`)
// })
// })
runModuleOnFiles(module, t, (file, report) => {
t.equal(report.length, lengthCheck[file], `${file} has right amount of assignAndCompare warnings`)
})
})
// test('Integration test intDivisionTruncate.js', function (t) {
// t.plan(testFiles.length)
test('Integration test intDivisionTruncate.js', function (t) {
t.plan(2)
// var module = require('../../dist/src/solidity-analyzer/modules/intDivisionTruncate').default
var module = require('../../dist/src/solidity-analyzer/modules/intDivisionTruncate').default
// var lengthCheck = {
// 'KingOfTheEtherThrone.sol': 0,
// 'assembly.sol': 0,
var lengthCheck = {
'KingOfTheEtherThrone.sol': 0,
'assembly.sol': 0,
// 'ballot.sol': 0,
// 'ballot_reentrant.sol': 0,
// 'ballot_withoutWarnings.sol': 0,
@ -744,21 +709,21 @@
// 'stringBytesLength.sol': 0,
// 'etherTransferInLoop.sol': 0,
// 'forLoopIteratesOverDynamicArray.sol': 0
// }
}
// runModuleOnFiles(module, t, (file, report) => {
// t.equal(report.length, lengthCheck[file], `${file} has right amount of intDivisionTruncate warnings`)
// })
// })
runModuleOnFiles(module, t, (file, report) => {
t.equal(report.length, lengthCheck[file], `${file} has right amount of intDivisionTruncate warnings`)
})
})
// test('Integration test erc20Decimal.js', function (t) {
// t.plan(testFiles.length)
test('Integration test erc20Decimal.js', function (t) {
t.plan(2)
// var module = require('../../dist/src/solidity-analyzer/modules/erc20Decimals').default
var module = require('../../dist/src/solidity-analyzer/modules/erc20Decimals').default
// var lengthCheck = {
// 'KingOfTheEtherThrone.sol': 0,
// 'assembly.sol': 0,
var lengthCheck = {
'KingOfTheEtherThrone.sol': 0,
'assembly.sol': 0,
// 'ballot.sol': 0,
// 'ballot_reentrant.sol': 0,
// 'ballot_withoutWarnings.sol': 0,
@ -783,21 +748,21 @@
// 'stringBytesLength.sol': 0,
// 'etherTransferInLoop.sol': 0,
// 'forLoopIteratesOverDynamicArray.sol': 0
// }
}
// runModuleOnFiles(module, t, (file, report) => {
// t.equal(report.length, lengthCheck[file], `${file} has right amount of erc20Decimals warnings`)
// })
// })
runModuleOnFiles(module, t, (file, report) => {
t.equal(report.length, lengthCheck[file], `${file} has right amount of erc20Decimals warnings`)
})
})
// test('Integration test stringBytesLength.js', function (t) {
// t.plan(testFiles.length)
test('Integration test stringBytesLength.js', function (t) {
t.plan(2)
// var module = require('../../dist/src/solidity-analyzer/modules/stringBytesLength').default
var module = require('../../dist/src/solidity-analyzer/modules/stringBytesLength').default
// var lengthCheck = {
// 'KingOfTheEtherThrone.sol': 0,
// 'assembly.sol': 0,
var lengthCheck = {
'KingOfTheEtherThrone.sol': 0,
'assembly.sol': 0,
// 'ballot.sol': 0,
// 'ballot_reentrant.sol': 0,
// 'ballot_withoutWarnings.sol': 0,
@ -822,21 +787,21 @@
// 'stringBytesLength.sol': 1,
// 'etherTransferInLoop.sol': 0,
// 'forLoopIteratesOverDynamicArray.sol': 0
// }
}
// runModuleOnFiles(module, t, (file, report) => {
// t.equal(report.length, lengthCheck[file], `${file} has right amount of stringBytesLength warnings`)
// })
// })
runModuleOnFiles(module, t, (file, report) => {
t.equal(report.length, lengthCheck[file], `${file} has right amount of stringBytesLength warnings`)
})
})
// test('Integration test etherTransferInLoop.js', function (t) {
// t.plan(testFiles.length)
test('Integration test etherTransferInLoop.js', function (t) {
t.plan(2)
// var module = require('../../dist/src/solidity-analyzer/modules/etherTransferInLoop').default
var module = require('../../dist/src/solidity-analyzer/modules/etherTransferInLoop').default
// var lengthCheck = {
// 'KingOfTheEtherThrone.sol': 0,
// 'assembly.sol': 0,
var lengthCheck = {
'KingOfTheEtherThrone.sol': 0,
'assembly.sol': 0,
// 'ballot.sol': 0,
// 'ballot_reentrant.sol': 0,
// 'ballot_withoutWarnings.sol': 0,
@ -861,21 +826,21 @@
// 'stringBytesLength.sol': 0,
// 'etherTransferInLoop.sol': 3,
// 'forLoopIteratesOverDynamicArray.sol': 0
// }
}
// runModuleOnFiles(module, t, (file, report) => {
// t.equal(report.length, lengthCheck[file], `${file} has right amount of etherTransferInLoop warnings`)
// })
// })
runModuleOnFiles(module, t, (file, report) => {
t.equal(report.length, lengthCheck[file], `${file} has right amount of etherTransferInLoop warnings`)
})
})
// test('Integration test forLoopIteratesOverDynamicArray.js', function (t) {
// t.plan(testFiles.length)
test('Integration test forLoopIteratesOverDynamicArray.js', function (t) {
t.plan(2)
// var module = require('../../dist/src/solidity-analyzer/modules/forLoopIteratesOverDynamicArray').default
var module = require('../../dist/src/solidity-analyzer/modules/forLoopIteratesOverDynamicArray').default
// var lengthCheck = {
// 'KingOfTheEtherThrone.sol': 0,
// 'assembly.sol': 0,
var lengthCheck = {
'KingOfTheEtherThrone.sol': 0,
'assembly.sol': 0,
// 'ballot.sol': 2,
// 'ballot_reentrant.sol': 1,
// 'ballot_withoutWarnings.sol': 0,
@ -900,23 +865,24 @@
// 'stringBytesLength.sol': 0,
// 'etherTransferInLoop.sol': 0,
// 'forLoopIteratesOverDynamicArray.sol': 2
// }
// runModuleOnFiles(module, t, (file, report) => {
// t.equal(report.length, lengthCheck[file], `${file} has right amount of forLoopIteratesOverDynamicArray warnings`)
// })
// })
// // #################### Helpers
// function runModuleOnFiles (Module, t, cb) {
// var statRunner = new StatRunner()
// testFiles.forEach((fileName) => {
// statRunner.runWithModuleList(testFileAsts[fileName], [{ name: new Module().name, mod: new Module() }], (reports) => {
// let report = reports[0].report
// if (report.some((x) => x['warning'].includes('INTERNAL ERROR'))) {
// t.comment('Error while executing Module: ' + JSON.stringify(report))
// }
// cb(fileName, report)
// })
// })
// }
}
runModuleOnFiles(module, t, (file, report) => {
t.equal(report.length, lengthCheck[file], `${file} has right amount of forLoopIteratesOverDynamicArray warnings`)
})
})
// #################### Helpers
function runModuleOnFiles (Module, t, cb) {
var statRunner = new StatRunner()
testFiles.forEach((fileName) => {
statRunner.runWithModuleList(testFileAsts[fileName], [{ name: new Module().name, mod: new Module() }], (reports) => {
let report = reports[0].report
// console.log('reports----', report)
if (report.some((x) => x['warning'].includes('INTERNAL ERROR'))) {
t.comment('Error while executing Module: ' + JSON.stringify(report))
}
cb(fileName, report)
})
})
}

@ -121,7 +121,7 @@ contract Ballot {
/// @dev Computes the winning proposal taking all
/// previous votes into account.
function winningProposal() view public
function winningProposal() public view
returns (uint winningProposal)
{
uint winningVoteCount = 0;

Loading…
Cancel
Save