Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
B
baas-ide
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
guxukai
baas-ide
Commits
2fce136c
Commit
2fce136c
authored
Mar 16, 2020
by
aniket-engg
Committed by
Aniket
Mar 24, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
two more contract integration tests updated
parent
f78d1267
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
93 additions
and
128 deletions
+93
-128
checksEffectsInteraction.ts
...src/solidity-analyzer/modules/checksEffectsInteraction.ts
+1
-1
staticAnalysisCommon.ts
...zer/src/solidity-analyzer/modules/staticAnalysisCommon.ts
+9
-1
staticAnalysisIntegration-test-0.5.0.ts
...zer/test/analysis/staticAnalysisIntegration-test-0.5.0.ts
+83
-126
No files found.
remix-analyzer/src/solidity-analyzer/modules/checksEffectsInteraction.ts
View file @
2fce136c
...
@@ -78,7 +78,7 @@ export default class checksEffectsInteraction implements AnalyzerModule {
...
@@ -78,7 +78,7 @@ export default class checksEffectsInteraction implements AnalyzerModule {
private
isLocalCallWithStateChange
(
node
:
FunctionCallAstNode
,
context
:
Context
):
boolean
{
private
isLocalCallWithStateChange
(
node
:
FunctionCallAstNode
,
context
:
Context
):
boolean
{
if
(
isLocalCallGraphRelevantNode
(
node
))
{
if
(
isLocalCallGraphRelevantNode
(
node
))
{
const
func
=
resolveCallGraphSymbol
(
context
.
callGraph
,
getFullQualifiedFunctionCallIdent
(
context
.
currentContract
.
node
,
node
))
const
func
=
resolveCallGraphSymbol
(
context
.
callGraph
,
getFullQualifiedFunctionCallIdent
(
context
.
currentContract
.
node
,
node
))
return
!
func
||
(
func
&&
func
.
node
[
'changesState'
])
return
!
func
||
(
func
&&
func
[
'changesState'
])
}
}
return
false
return
false
}
}
...
...
remix-analyzer/src/solidity-analyzer/modules/staticAnalysisCommon.ts
View file @
2fce136c
...
@@ -169,6 +169,7 @@ function getFunctionCallType (func: FunctionCallAstNode): string {
...
@@ -169,6 +169,7 @@ function getFunctionCallType (func: FunctionCallAstNode): string {
* @return {string} variable name written to
* @return {string} variable name written to
*/
*/
function
getEffectedVariableName
(
effectNode
:
AssignmentAstNode
|
UnaryOperationAstNode
):
string
{
function
getEffectedVariableName
(
effectNode
:
AssignmentAstNode
|
UnaryOperationAstNode
):
string
{
// console.log('getEffectedVariableName---effectNode---', effectNode)
if
(
!
isEffect
(
effectNode
))
throw
new
Error
(
'staticAnalysisCommon.js: not an effect Node'
)
if
(
!
isEffect
(
effectNode
))
throw
new
Error
(
'staticAnalysisCommon.js: not an effect Node'
)
if
(
effectNode
.
nodeType
===
'Assignment'
||
effectNode
.
nodeType
===
'UnaryOperation'
)
{
if
(
effectNode
.
nodeType
===
'Assignment'
||
effectNode
.
nodeType
===
'UnaryOperation'
)
{
const
IdentNode
=
findFirstSubNodeLTR
(
effectNode
,
exactMatch
(
nodeTypes
.
IDENTIFIER
))
const
IdentNode
=
findFirstSubNodeLTR
(
effectNode
,
exactMatch
(
nodeTypes
.
IDENTIFIER
))
...
@@ -623,7 +624,10 @@ function isStorageVariableDeclaration (node: VariableDeclarationAstNode): boolea
...
@@ -623,7 +624,10 @@ function isStorageVariableDeclaration (node: VariableDeclarationAstNode): boolea
* @return {bool}
* @return {bool}
*/
*/
function
isInteraction
(
node
:
FunctionCallAstNode
):
boolean
{
function
isInteraction
(
node
:
FunctionCallAstNode
):
boolean
{
return
isLLCall
(
node
.
expression
)
||
isLLSend
(
node
.
expression
)
||
isExternalDirectCall
(
node
)
||
isTransfer
(
node
.
expression
)
// console.log('Inside isInteraction----------', node)
return
isLLCall
(
node
.
expression
)
||
isLLSend
(
node
.
expression
)
||
isExternalDirectCall
(
node
)
||
isTransfer
(
node
.
expression
)
||
// to cover case of address.call.value.gas , See: inheritance.sol
(
node
.
expression
&&
node
.
expression
.
expression
&&
isLLCall
(
node
.
expression
.
expression
))
}
}
/**
/**
...
@@ -906,6 +910,9 @@ function isLLSend (node: MemberAccessAstNode): boolean {
...
@@ -906,6 +910,9 @@ function isLLSend (node: MemberAccessAstNode): boolean {
* @return {bool}
* @return {bool}
*/
*/
function
isLLCall
(
node
:
MemberAccessAstNode
):
boolean
{
function
isLLCall
(
node
:
MemberAccessAstNode
):
boolean
{
// if(node && node.nodeType === 'MemberAccess' && node.memberName !== 'call' &&
// node.expression && node.expression.nodeType && nodeType(node.expression, exactMatch(nodeTypes.MEMBERACCESS)))
// node = node.expression;
return
isMemberAccess
(
node
,
return
isMemberAccess
(
node
,
exactMatch
(
util
.
escapeRegExp
(
lowLevelCallTypes
.
CALL
.
type
)),
exactMatch
(
util
.
escapeRegExp
(
lowLevelCallTypes
.
CALL
.
type
)),
undefined
,
exactMatch
(
basicTypes
.
ADDRESS
),
exactMatch
(
lowLevelCallTypes
.
CALL
.
ident
))
||
undefined
,
exactMatch
(
basicTypes
.
ADDRESS
),
exactMatch
(
lowLevelCallTypes
.
CALL
.
ident
))
||
...
@@ -1008,6 +1015,7 @@ function isBytesLengthCheck (node: MemberAccessAstNode): boolean {
...
@@ -1008,6 +1015,7 @@ function isBytesLengthCheck (node: MemberAccessAstNode): boolean {
function
isMemberAccess
(
node
:
MemberAccessAstNode
,
retType
:
string
,
accessor
:
string
|
undefined
,
accessorType
:
string
,
memberName
:
string
|
undefined
):
boolean
{
function
isMemberAccess
(
node
:
MemberAccessAstNode
,
retType
:
string
,
accessor
:
string
|
undefined
,
accessorType
:
string
,
memberName
:
string
|
undefined
):
boolean
{
if
(
node
&&
nodeType
(
node
,
exactMatch
(
'MemberAccess'
)))
{
if
(
node
&&
nodeType
(
node
,
exactMatch
(
'MemberAccess'
)))
{
// console.log('node inside memberaccess------', node)
const
nodeTypeDef
:
boolean
=
typeDescription
(
node
,
retType
)
const
nodeTypeDef
:
boolean
=
typeDescription
(
node
,
retType
)
// console.log('MemberAccess typeDef ->',nodeTypeDef)
// console.log('MemberAccess typeDef ->',nodeTypeDef)
const
nodeMemName
:
boolean
=
memName
(
node
,
memberName
)
const
nodeMemName
:
boolean
=
memName
(
node
,
memberName
)
...
...
remix-analyzer/test/analysis/staticAnalysisIntegration-test-0.5.0.ts
View file @
2fce136c
...
@@ -14,9 +14,9 @@ const testFiles = [
...
@@ -14,9 +14,9 @@ const testFiles = [
'assembly.sol'
,
'assembly.sol'
,
'ballot.sol'
,
'ballot.sol'
,
'ballot_reentrant.sol'
,
'ballot_reentrant.sol'
,
//
'ballot_withoutWarnings.sol',
'ballot_withoutWarnings.sol'
,
//
'cross_contract.sol',
'cross_contract.sol'
,
//
'inheritance.sol',
'inheritance.sol'
,
// 'modifier1.sol',
// 'modifier1.sol',
// 'modifier2.sol',
// 'modifier2.sol',
// 'notReentrant.sol',
// 'notReentrant.sol',
...
@@ -50,7 +50,7 @@ testFiles.forEach((fileName) => {
...
@@ -50,7 +50,7 @@ testFiles.forEach((fileName) => {
test
(
'Integration test thisLocal.js'
,
function
(
t
)
{
test
(
'Integration test thisLocal.js'
,
function
(
t
)
{
// console.log('testFileAsts---------',testFileAsts)
// console.log('testFileAsts---------',testFileAsts)
// t.plan(testFiles.length)
// t.plan(testFiles.length)
t
.
plan
(
4
)
t
.
plan
(
7
)
var
module
=
require
(
'../../dist/src/solidity-analyzer/modules/thisLocal'
).
default
var
module
=
require
(
'../../dist/src/solidity-analyzer/modules/thisLocal'
).
default
...
@@ -59,9 +59,9 @@ test('Integration test thisLocal.js', function (t) {
...
@@ -59,9 +59,9 @@ test('Integration test thisLocal.js', function (t) {
'assembly.sol'
:
0
,
'assembly.sol'
:
0
,
'ballot.sol'
:
0
,
'ballot.sol'
:
0
,
'ballot_reentrant.sol'
:
1
,
'ballot_reentrant.sol'
:
1
,
//
'ballot_withoutWarnings.sol': 0,
'ballot_withoutWarnings.sol'
:
0
,
//
'cross_contract.sol': 0,
'cross_contract.sol'
:
0
,
//
'inheritance.sol': 0,
'inheritance.sol'
:
0
,
// 'modifier1.sol': 0,
// 'modifier1.sol': 0,
// 'modifier2.sol': 0,
// 'modifier2.sol': 0,
// 'notReentrant.sol': 0,
// 'notReentrant.sol': 0,
...
@@ -89,7 +89,7 @@ test('Integration test thisLocal.js', function (t) {
...
@@ -89,7 +89,7 @@ test('Integration test thisLocal.js', function (t) {
})
})
test
(
'Integration test checksEffectsInteraction.js'
,
function
(
t
)
{
test
(
'Integration test checksEffectsInteraction.js'
,
function
(
t
)
{
t
.
plan
(
4
)
t
.
plan
(
7
)
var
module
=
require
(
'../../dist/src/solidity-analyzer/modules/checksEffectsInteraction'
).
default
var
module
=
require
(
'../../dist/src/solidity-analyzer/modules/checksEffectsInteraction'
).
default
...
@@ -98,9 +98,9 @@ test('Integration test checksEffectsInteraction.js', function (t) {
...
@@ -98,9 +98,9 @@ test('Integration test checksEffectsInteraction.js', function (t) {
'assembly.sol'
:
1
,
'assembly.sol'
:
1
,
'ballot.sol'
:
0
,
'ballot.sol'
:
0
,
'ballot_reentrant.sol'
:
1
,
'ballot_reentrant.sol'
:
1
,
//
'ballot_withoutWarnings.sol': 0,
'ballot_withoutWarnings.sol'
:
0
,
//
'cross_contract.sol': 0,
'cross_contract.sol'
:
0
,
//
'inheritance.sol': 1,
'inheritance.sol'
:
1
,
// 'modifier1.sol': 0,
// 'modifier1.sol': 0,
// 'modifier2.sol': 0,
// 'modifier2.sol': 0,
// 'notReentrant.sol': 0,
// 'notReentrant.sol': 0,
...
@@ -128,7 +128,7 @@ test('Integration test checksEffectsInteraction.js', function (t) {
...
@@ -128,7 +128,7 @@ test('Integration test checksEffectsInteraction.js', function (t) {
})
})
test
(
'Integration test constantFunctions.js'
,
function
(
t
)
{
test
(
'Integration test constantFunctions.js'
,
function
(
t
)
{
t
.
plan
(
4
)
t
.
plan
(
7
)
var
module
=
require
(
'../../dist/src/solidity-analyzer/modules/constantFunctions'
).
default
var
module
=
require
(
'../../dist/src/solidity-analyzer/modules/constantFunctions'
).
default
...
@@ -137,9 +137,9 @@ test('Integration test constantFunctions.js', function (t) {
...
@@ -137,9 +137,9 @@ test('Integration test constantFunctions.js', function (t) {
'assembly.sol'
:
0
,
'assembly.sol'
:
0
,
'ballot.sol'
:
0
,
'ballot.sol'
:
0
,
'ballot_reentrant.sol'
:
0
,
'ballot_reentrant.sol'
:
0
,
//
'ballot_withoutWarnings.sol': 0,
'ballot_withoutWarnings.sol'
:
0
,
//
'cross_contract.sol': 0,
'cross_contract.sol'
:
0
,
//
'inheritance.sol': 0,
'inheritance.sol'
:
0
,
// 'modifier1.sol': 1,
// 'modifier1.sol': 1,
// 'modifier2.sol': 0,
// 'modifier2.sol': 0,
// 'notReentrant.sol': 0,
// 'notReentrant.sol': 0,
...
@@ -167,7 +167,7 @@ test('Integration test constantFunctions.js', function (t) {
...
@@ -167,7 +167,7 @@ test('Integration test constantFunctions.js', function (t) {
})
})
test
(
'Integration test inlineAssembly.js'
,
function
(
t
)
{
test
(
'Integration test inlineAssembly.js'
,
function
(
t
)
{
t
.
plan
(
4
)
t
.
plan
(
7
)
var
module
=
require
(
'../../dist/src/solidity-analyzer/modules/inlineAssembly'
).
default
var
module
=
require
(
'../../dist/src/solidity-analyzer/modules/inlineAssembly'
).
default
...
@@ -176,9 +176,9 @@ test('Integration test inlineAssembly.js', function (t) {
...
@@ -176,9 +176,9 @@ test('Integration test inlineAssembly.js', function (t) {
'assembly.sol'
:
2
,
'assembly.sol'
:
2
,
'ballot.sol'
:
0
,
'ballot.sol'
:
0
,
'ballot_reentrant.sol'
:
0
,
'ballot_reentrant.sol'
:
0
,
//
'ballot_withoutWarnings.sol': 0,
'ballot_withoutWarnings.sol'
:
0
,
//
'cross_contract.sol': 0,
'cross_contract.sol'
:
0
,
//
'inheritance.sol': 0,
'inheritance.sol'
:
0
,
// 'modifier1.sol': 0,
// 'modifier1.sol': 0,
// 'modifier2.sol': 0,
// 'modifier2.sol': 0,
// 'notReentrant.sol': 0,
// 'notReentrant.sol': 0,
...
@@ -206,7 +206,7 @@ test('Integration test inlineAssembly.js', function (t) {
...
@@ -206,7 +206,7 @@ test('Integration test inlineAssembly.js', function (t) {
})
})
test
(
'Integration test txOrigin.js'
,
function
(
t
)
{
test
(
'Integration test txOrigin.js'
,
function
(
t
)
{
t
.
plan
(
4
)
t
.
plan
(
7
)
var
module
=
require
(
'../../dist/src/solidity-analyzer/modules/txOrigin'
).
default
var
module
=
require
(
'../../dist/src/solidity-analyzer/modules/txOrigin'
).
default
...
@@ -215,9 +215,9 @@ test('Integration test txOrigin.js', function (t) {
...
@@ -215,9 +215,9 @@ test('Integration test txOrigin.js', function (t) {
'assembly.sol'
:
1
,
'assembly.sol'
:
1
,
'ballot.sol'
:
0
,
'ballot.sol'
:
0
,
'ballot_reentrant.sol'
:
0
,
'ballot_reentrant.sol'
:
0
,
//
'ballot_withoutWarnings.sol': 0,
'ballot_withoutWarnings.sol'
:
0
,
//
'cross_contract.sol': 0,
'cross_contract.sol'
:
0
,
//
'inheritance.sol': 0,
'inheritance.sol'
:
0
,
// 'modifier1.sol': 0,
// 'modifier1.sol': 0,
// 'modifier2.sol': 0,
// 'modifier2.sol': 0,
// 'notReentrant.sol': 0,
// 'notReentrant.sol': 0,
...
@@ -245,7 +245,7 @@ test('Integration test txOrigin.js', function (t) {
...
@@ -245,7 +245,7 @@ test('Integration test txOrigin.js', function (t) {
})
})
test
(
'Integration test gasCosts.js'
,
function
(
t
)
{
test
(
'Integration test gasCosts.js'
,
function
(
t
)
{
t
.
plan
(
4
)
t
.
plan
(
7
)
var
module
=
require
(
'../../dist/src/solidity-analyzer/modules/gasCosts'
).
default
var
module
=
require
(
'../../dist/src/solidity-analyzer/modules/gasCosts'
).
default
...
@@ -254,9 +254,9 @@ test('Integration test gasCosts.js', function (t) {
...
@@ -254,9 +254,9 @@ test('Integration test gasCosts.js', function (t) {
'assembly.sol'
:
2
,
'assembly.sol'
:
2
,
'ballot.sol'
:
3
,
'ballot.sol'
:
3
,
'ballot_reentrant.sol'
:
2
,
'ballot_reentrant.sol'
:
2
,
//
'ballot_withoutWarnings.sol': 0,
'ballot_withoutWarnings.sol'
:
0
,
//
'cross_contract.sol': 1,
'cross_contract.sol'
:
1
,
//
'inheritance.sol': 1,
'inheritance.sol'
:
1
,
// 'modifier1.sol': 0,
// 'modifier1.sol': 0,
// 'modifier2.sol': 1,
// 'modifier2.sol': 1,
// 'notReentrant.sol': 1,
// 'notReentrant.sol': 1,
...
@@ -284,7 +284,7 @@ test('Integration test gasCosts.js', function (t) {
...
@@ -284,7 +284,7 @@ test('Integration test gasCosts.js', function (t) {
})
})
test
(
'Integration test similarVariableNames.js'
,
function
(
t
)
{
test
(
'Integration test similarVariableNames.js'
,
function
(
t
)
{
t
.
plan
(
4
)
t
.
plan
(
7
)
var
module
=
require
(
'../../dist/src/solidity-analyzer/modules/similarVariableNames'
).
default
var
module
=
require
(
'../../dist/src/solidity-analyzer/modules/similarVariableNames'
).
default
...
@@ -293,9 +293,9 @@ test('Integration test similarVariableNames.js', function (t) {
...
@@ -293,9 +293,9 @@ test('Integration test similarVariableNames.js', function (t) {
'assembly.sol'
:
0
,
'assembly.sol'
:
0
,
'ballot.sol'
:
2
,
'ballot.sol'
:
2
,
'ballot_reentrant.sol'
:
11
,
'ballot_reentrant.sol'
:
11
,
//
'ballot_withoutWarnings.sol': 0,
'ballot_withoutWarnings.sol'
:
0
,
//
'cross_contract.sol': 0,
'cross_contract.sol'
:
0
,
//
'inheritance.sol': 0,
'inheritance.sol'
:
0
,
// 'modifier1.sol': 0,
// 'modifier1.sol': 0,
// 'modifier2.sol': 0,
// 'modifier2.sol': 0,
// 'notReentrant.sol': 1,
// 'notReentrant.sol': 1,
...
@@ -323,7 +323,7 @@ test('Integration test similarVariableNames.js', function (t) {
...
@@ -323,7 +323,7 @@ test('Integration test similarVariableNames.js', function (t) {
})
})
test
(
'Integration test blockTimestamp.js'
,
function
(
t
)
{
test
(
'Integration test blockTimestamp.js'
,
function
(
t
)
{
t
.
plan
(
4
)
t
.
plan
(
7
)
var
module
=
require
(
'../../dist/src/solidity-analyzer/modules/blockTimestamp'
).
default
var
module
=
require
(
'../../dist/src/solidity-analyzer/modules/blockTimestamp'
).
default
...
@@ -332,9 +332,9 @@ test('Integration test blockTimestamp.js', function (t) {
...
@@ -332,9 +332,9 @@ test('Integration test blockTimestamp.js', function (t) {
'assembly.sol'
:
0
,
'assembly.sol'
:
0
,
'ballot.sol'
:
0
,
'ballot.sol'
:
0
,
'ballot_reentrant.sol'
:
3
,
'ballot_reentrant.sol'
:
3
,
//
'ballot_withoutWarnings.sol': 0,
'ballot_withoutWarnings.sol'
:
0
,
//
'cross_contract.sol': 0,
'cross_contract.sol'
:
0
,
//
'inheritance.sol': 0,
'inheritance.sol'
:
0
,
// 'modifier1.sol': 0,
// 'modifier1.sol': 0,
// 'modifier2.sol': 0,
// 'modifier2.sol': 0,
// 'notReentrant.sol': 0,
// 'notReentrant.sol': 0,
...
@@ -362,7 +362,7 @@ test('Integration test blockTimestamp.js', function (t) {
...
@@ -362,7 +362,7 @@ test('Integration test blockTimestamp.js', function (t) {
})
})
test
(
'Integration test lowLevelCalls.js'
,
function
(
t
)
{
test
(
'Integration test lowLevelCalls.js'
,
function
(
t
)
{
t
.
plan
(
4
)
t
.
plan
(
7
)
var
module
=
require
(
'../../dist/src/solidity-analyzer/modules/lowLevelCalls'
).
default
var
module
=
require
(
'../../dist/src/solidity-analyzer/modules/lowLevelCalls'
).
default
...
@@ -371,9 +371,9 @@ test('Integration test lowLevelCalls.js', function (t) {
...
@@ -371,9 +371,9 @@ test('Integration test lowLevelCalls.js', function (t) {
'assembly.sol'
:
1
,
'assembly.sol'
:
1
,
'ballot.sol'
:
0
,
'ballot.sol'
:
0
,
'ballot_reentrant.sol'
:
7
,
'ballot_reentrant.sol'
:
7
,
//
'ballot_withoutWarnings.sol': 0,
'ballot_withoutWarnings.sol'
:
0
,
//
'cross_contract.sol': 1,
'cross_contract.sol'
:
1
,
//
'inheritance.sol': 1,
'inheritance.sol'
:
1
,
// 'modifier1.sol': 0,
// 'modifier1.sol': 0,
// 'modifier2.sol': 0,
// 'modifier2.sol': 0,
// 'notReentrant.sol': 1,
// 'notReentrant.sol': 1,
...
@@ -401,7 +401,7 @@ test('Integration test lowLevelCalls.js', function (t) {
...
@@ -401,7 +401,7 @@ test('Integration test lowLevelCalls.js', function (t) {
})
})
test
(
'Integration test blockBlockhash.js'
,
function
(
t
)
{
test
(
'Integration test blockBlockhash.js'
,
function
(
t
)
{
t
.
plan
(
4
)
t
.
plan
(
7
)
var
module
=
require
(
'../../dist/src/solidity-analyzer/modules/blockBlockhash'
).
default
var
module
=
require
(
'../../dist/src/solidity-analyzer/modules/blockBlockhash'
).
default
...
@@ -410,9 +410,9 @@ test('Integration test blockBlockhash.js', function (t) {
...
@@ -410,9 +410,9 @@ test('Integration test blockBlockhash.js', function (t) {
'assembly.sol'
:
0
,
'assembly.sol'
:
0
,
'ballot.sol'
:
0
,
'ballot.sol'
:
0
,
'ballot_reentrant.sol'
:
0
,
'ballot_reentrant.sol'
:
0
,
//
'ballot_withoutWarnings.sol': 0,
'ballot_withoutWarnings.sol'
:
0
,
//
'cross_contract.sol': 0,
'cross_contract.sol'
:
0
,
//
'inheritance.sol': 0,
'inheritance.sol'
:
0
,
// 'modifier1.sol': 0,
// 'modifier1.sol': 0,
// 'modifier2.sol': 0,
// 'modifier2.sol': 0,
// 'notReentrant.sol': 0,
// 'notReentrant.sol': 0,
...
@@ -439,51 +439,8 @@ test('Integration test blockBlockhash.js', function (t) {
...
@@ -439,51 +439,8 @@ test('Integration test blockBlockhash.js', function (t) {
})
})
})
})
// /*
// ! No return gives compilation error with solidity 0.5.0
// test('Integration test noReturn.js', function (t) {
// t.plan(testFiles.length)
// var module = require('../../dist/src/solidity-analyzer/modules/noReturn')
// var lengthCheck = {
// 'KingOfTheEtherThrone.sol': 0,
// 'assembly.sol': 1,
// 'ballot.sol': 0,
// 'ballot_reentrant.sol': 0,
// 'ballot_withoutWarnings.sol': 0,
// 'cross_contract.sol': 0,
// 'inheritance.sol': 0,
// 'modifier1.sol': 1,
// 'modifier2.sol': 0,
// 'notReentrant.sol': 0,
// 'structReentrant.sol': 0,
// 'thisLocal.sol': 1,
// 'globals.sol': 0,
// 'library.sol': 0,
// 'transfer.sol': 0,
// 'ctor.sol': 0,
// 'forgottenReturn.sol': 1,
// 'selfdestruct.sol': 0,
// 'deleteDynamicArray.sol': 0,
// 'deleteFromDynamicArray.sol': 0,
// 'blockLevelCompare.sol': 0,
// 'intDivisionTruncate.sol': 0,
// 'ERC20.sol': 0,
// 'stringBytesLength.sol': 0,
// 'forLoopIteratesOverDynamicArray.sol': 0
// }
// runModuleOnFiles(module, t, (file, report) => {
// t.equal(report.length, lengthCheck[file], `${file} has right amount of noReturn warnings`)
// })
// })
// */
test
(
'Integration test selfdestruct.js'
,
function
(
t
)
{
test
(
'Integration test selfdestruct.js'
,
function
(
t
)
{
t
.
plan
(
4
)
t
.
plan
(
7
)
var
module
=
require
(
'../../dist/src/solidity-analyzer/modules/selfdestruct'
).
default
var
module
=
require
(
'../../dist/src/solidity-analyzer/modules/selfdestruct'
).
default
...
@@ -492,9 +449,9 @@ test('Integration test selfdestruct.js', function (t) {
...
@@ -492,9 +449,9 @@ test('Integration test selfdestruct.js', function (t) {
'assembly.sol'
:
0
,
'assembly.sol'
:
0
,
'ballot.sol'
:
0
,
'ballot.sol'
:
0
,
'ballot_reentrant.sol'
:
0
,
'ballot_reentrant.sol'
:
0
,
//
'ballot_withoutWarnings.sol': 0,
'ballot_withoutWarnings.sol'
:
0
,
//
'cross_contract.sol': 0,
'cross_contract.sol'
:
0
,
//
'inheritance.sol': 0,
'inheritance.sol'
:
0
,
// 'modifier1.sol': 0,
// 'modifier1.sol': 0,
// 'modifier2.sol': 0,
// 'modifier2.sol': 0,
// 'notReentrant.sol': 0,
// 'notReentrant.sol': 0,
...
@@ -522,7 +479,7 @@ test('Integration test selfdestruct.js', function (t) {
...
@@ -522,7 +479,7 @@ test('Integration test selfdestruct.js', function (t) {
})
})
test
(
'Integration test guardConditions.js'
,
function
(
t
)
{
test
(
'Integration test guardConditions.js'
,
function
(
t
)
{
t
.
plan
(
4
)
t
.
plan
(
7
)
var
module
=
require
(
'../../dist/src/solidity-analyzer/modules/guardConditions'
).
default
var
module
=
require
(
'../../dist/src/solidity-analyzer/modules/guardConditions'
).
default
...
@@ -531,9 +488,9 @@ test('Integration test guardConditions.js', function (t) {
...
@@ -531,9 +488,9 @@ test('Integration test guardConditions.js', function (t) {
'assembly.sol'
:
1
,
'assembly.sol'
:
1
,
'ballot.sol'
:
0
,
'ballot.sol'
:
0
,
'ballot_reentrant.sol'
:
0
,
'ballot_reentrant.sol'
:
0
,
//
'ballot_withoutWarnings.sol': 0,
'ballot_withoutWarnings.sol'
:
0
,
//
'cross_contract.sol': 0,
'cross_contract.sol'
:
0
,
//
'inheritance.sol': 0,
'inheritance.sol'
:
0
,
// 'modifier1.sol': 0,
// 'modifier1.sol': 0,
// 'modifier2.sol': 0,
// 'modifier2.sol': 0,
// 'notReentrant.sol': 0,
// 'notReentrant.sol': 0,
...
@@ -561,7 +518,7 @@ test('Integration test guardConditions.js', function (t) {
...
@@ -561,7 +518,7 @@ test('Integration test guardConditions.js', function (t) {
})
})
test
(
'Integration test deleteDynamicArrays.js'
,
function
(
t
)
{
test
(
'Integration test deleteDynamicArrays.js'
,
function
(
t
)
{
t
.
plan
(
4
)
t
.
plan
(
7
)
var
module
=
require
(
'../../dist/src/solidity-analyzer/modules/deleteDynamicArrays'
).
default
var
module
=
require
(
'../../dist/src/solidity-analyzer/modules/deleteDynamicArrays'
).
default
...
@@ -570,9 +527,9 @@ test('Integration test deleteDynamicArrays.js', function (t) {
...
@@ -570,9 +527,9 @@ test('Integration test deleteDynamicArrays.js', function (t) {
'assembly.sol'
:
0
,
'assembly.sol'
:
0
,
'ballot.sol'
:
0
,
'ballot.sol'
:
0
,
'ballot_reentrant.sol'
:
0
,
'ballot_reentrant.sol'
:
0
,
//
'ballot_withoutWarnings.sol': 0,
'ballot_withoutWarnings.sol'
:
0
,
//
'cross_contract.sol': 0,
'cross_contract.sol'
:
0
,
//
'inheritance.sol': 0,
'inheritance.sol'
:
0
,
// 'modifier1.sol': 0,
// 'modifier1.sol': 0,
// 'modifier2.sol': 0,
// 'modifier2.sol': 0,
// 'notReentrant.sol': 0,
// 'notReentrant.sol': 0,
...
@@ -600,7 +557,7 @@ test('Integration test deleteDynamicArrays.js', function (t) {
...
@@ -600,7 +557,7 @@ test('Integration test deleteDynamicArrays.js', function (t) {
})
})
test
(
'Integration test deleteFromDynamicArray.js'
,
function
(
t
)
{
test
(
'Integration test deleteFromDynamicArray.js'
,
function
(
t
)
{
t
.
plan
(
4
)
t
.
plan
(
7
)
var
module
=
require
(
'../../dist/src/solidity-analyzer/modules/deleteFromDynamicArray'
).
default
var
module
=
require
(
'../../dist/src/solidity-analyzer/modules/deleteFromDynamicArray'
).
default
...
@@ -609,9 +566,9 @@ test('Integration test deleteFromDynamicArray.js', function (t) {
...
@@ -609,9 +566,9 @@ test('Integration test deleteFromDynamicArray.js', function (t) {
'assembly.sol'
:
0
,
'assembly.sol'
:
0
,
'ballot.sol'
:
0
,
'ballot.sol'
:
0
,
'ballot_reentrant.sol'
:
0
,
'ballot_reentrant.sol'
:
0
,
//
'ballot_withoutWarnings.sol': 0,
'ballot_withoutWarnings.sol'
:
0
,
//
'cross_contract.sol': 0,
'cross_contract.sol'
:
0
,
//
'inheritance.sol': 0,
'inheritance.sol'
:
0
,
// 'modifier1.sol': 0,
// 'modifier1.sol': 0,
// 'modifier2.sol': 0,
// 'modifier2.sol': 0,
// 'notReentrant.sol': 0,
// 'notReentrant.sol': 0,
...
@@ -639,7 +596,7 @@ test('Integration test deleteFromDynamicArray.js', function (t) {
...
@@ -639,7 +596,7 @@ test('Integration test deleteFromDynamicArray.js', function (t) {
})
})
test
(
'Integration test assignAndCompare.js'
,
function
(
t
)
{
test
(
'Integration test assignAndCompare.js'
,
function
(
t
)
{
t
.
plan
(
4
)
t
.
plan
(
7
)
var
module
=
require
(
'../../dist/src/solidity-analyzer/modules/assignAndCompare'
).
default
var
module
=
require
(
'../../dist/src/solidity-analyzer/modules/assignAndCompare'
).
default
...
@@ -648,9 +605,9 @@ test('Integration test assignAndCompare.js', function (t) {
...
@@ -648,9 +605,9 @@ test('Integration test assignAndCompare.js', function (t) {
'assembly.sol'
:
0
,
'assembly.sol'
:
0
,
'ballot.sol'
:
0
,
'ballot.sol'
:
0
,
'ballot_reentrant.sol'
:
0
,
'ballot_reentrant.sol'
:
0
,
//
'ballot_withoutWarnings.sol': 0,
'ballot_withoutWarnings.sol'
:
0
,
//
'cross_contract.sol': 0,
'cross_contract.sol'
:
0
,
//
'inheritance.sol': 0,
'inheritance.sol'
:
0
,
// 'modifier1.sol': 0,
// 'modifier1.sol': 0,
// 'modifier2.sol': 0,
// 'modifier2.sol': 0,
// 'notReentrant.sol': 0,
// 'notReentrant.sol': 0,
...
@@ -678,7 +635,7 @@ test('Integration test assignAndCompare.js', function (t) {
...
@@ -678,7 +635,7 @@ test('Integration test assignAndCompare.js', function (t) {
})
})
test
(
'Integration test intDivisionTruncate.js'
,
function
(
t
)
{
test
(
'Integration test intDivisionTruncate.js'
,
function
(
t
)
{
t
.
plan
(
4
)
t
.
plan
(
7
)
var
module
=
require
(
'../../dist/src/solidity-analyzer/modules/intDivisionTruncate'
).
default
var
module
=
require
(
'../../dist/src/solidity-analyzer/modules/intDivisionTruncate'
).
default
...
@@ -687,9 +644,9 @@ test('Integration test intDivisionTruncate.js', function (t) {
...
@@ -687,9 +644,9 @@ test('Integration test intDivisionTruncate.js', function (t) {
'assembly.sol'
:
0
,
'assembly.sol'
:
0
,
'ballot.sol'
:
0
,
'ballot.sol'
:
0
,
'ballot_reentrant.sol'
:
0
,
'ballot_reentrant.sol'
:
0
,
//
'ballot_withoutWarnings.sol': 0,
'ballot_withoutWarnings.sol'
:
0
,
//
'cross_contract.sol': 0,
'cross_contract.sol'
:
0
,
//
'inheritance.sol': 0,
'inheritance.sol'
:
0
,
// 'modifier1.sol': 0,
// 'modifier1.sol': 0,
// 'modifier2.sol': 0,
// 'modifier2.sol': 0,
// 'notReentrant.sol': 0,
// 'notReentrant.sol': 0,
...
@@ -717,7 +674,7 @@ test('Integration test intDivisionTruncate.js', function (t) {
...
@@ -717,7 +674,7 @@ test('Integration test intDivisionTruncate.js', function (t) {
})
})
test
(
'Integration test erc20Decimal.js'
,
function
(
t
)
{
test
(
'Integration test erc20Decimal.js'
,
function
(
t
)
{
t
.
plan
(
4
)
t
.
plan
(
7
)
var
module
=
require
(
'../../dist/src/solidity-analyzer/modules/erc20Decimals'
).
default
var
module
=
require
(
'../../dist/src/solidity-analyzer/modules/erc20Decimals'
).
default
...
@@ -726,9 +683,9 @@ test('Integration test erc20Decimal.js', function (t) {
...
@@ -726,9 +683,9 @@ test('Integration test erc20Decimal.js', function (t) {
'assembly.sol'
:
0
,
'assembly.sol'
:
0
,
'ballot.sol'
:
0
,
'ballot.sol'
:
0
,
'ballot_reentrant.sol'
:
0
,
'ballot_reentrant.sol'
:
0
,
//
'ballot_withoutWarnings.sol': 0,
'ballot_withoutWarnings.sol'
:
0
,
//
'cross_contract.sol': 0,
'cross_contract.sol'
:
0
,
//
'inheritance.sol': 0,
'inheritance.sol'
:
0
,
// 'modifier1.sol': 0,
// 'modifier1.sol': 0,
// 'modifier2.sol': 0,
// 'modifier2.sol': 0,
// 'notReentrant.sol': 0,
// 'notReentrant.sol': 0,
...
@@ -756,7 +713,7 @@ test('Integration test erc20Decimal.js', function (t) {
...
@@ -756,7 +713,7 @@ test('Integration test erc20Decimal.js', function (t) {
})
})
test
(
'Integration test stringBytesLength.js'
,
function
(
t
)
{
test
(
'Integration test stringBytesLength.js'
,
function
(
t
)
{
t
.
plan
(
4
)
t
.
plan
(
7
)
var
module
=
require
(
'../../dist/src/solidity-analyzer/modules/stringBytesLength'
).
default
var
module
=
require
(
'../../dist/src/solidity-analyzer/modules/stringBytesLength'
).
default
...
@@ -765,9 +722,9 @@ test('Integration test stringBytesLength.js', function (t) {
...
@@ -765,9 +722,9 @@ test('Integration test stringBytesLength.js', function (t) {
'assembly.sol'
:
0
,
'assembly.sol'
:
0
,
'ballot.sol'
:
0
,
'ballot.sol'
:
0
,
'ballot_reentrant.sol'
:
0
,
'ballot_reentrant.sol'
:
0
,
//
'ballot_withoutWarnings.sol': 0,
'ballot_withoutWarnings.sol'
:
0
,
//
'cross_contract.sol': 0,
'cross_contract.sol'
:
0
,
//
'inheritance.sol': 0,
'inheritance.sol'
:
0
,
// 'modifier1.sol': 0,
// 'modifier1.sol': 0,
// 'modifier2.sol': 0,
// 'modifier2.sol': 0,
// 'notReentrant.sol': 0,
// 'notReentrant.sol': 0,
...
@@ -795,7 +752,7 @@ test('Integration test stringBytesLength.js', function (t) {
...
@@ -795,7 +752,7 @@ test('Integration test stringBytesLength.js', function (t) {
})
})
test
(
'Integration test etherTransferInLoop.js'
,
function
(
t
)
{
test
(
'Integration test etherTransferInLoop.js'
,
function
(
t
)
{
t
.
plan
(
4
)
t
.
plan
(
7
)
var
module
=
require
(
'../../dist/src/solidity-analyzer/modules/etherTransferInLoop'
).
default
var
module
=
require
(
'../../dist/src/solidity-analyzer/modules/etherTransferInLoop'
).
default
...
@@ -804,9 +761,9 @@ test('Integration test etherTransferInLoop.js', function (t) {
...
@@ -804,9 +761,9 @@ test('Integration test etherTransferInLoop.js', function (t) {
'assembly.sol'
:
0
,
'assembly.sol'
:
0
,
'ballot.sol'
:
0
,
'ballot.sol'
:
0
,
'ballot_reentrant.sol'
:
0
,
'ballot_reentrant.sol'
:
0
,
//
'ballot_withoutWarnings.sol': 0,
'ballot_withoutWarnings.sol'
:
0
,
//
'cross_contract.sol': 0,
'cross_contract.sol'
:
0
,
//
'inheritance.sol': 0,
'inheritance.sol'
:
0
,
// 'modifier1.sol': 0,
// 'modifier1.sol': 0,
// 'modifier2.sol': 0,
// 'modifier2.sol': 0,
// 'notReentrant.sol': 0,
// 'notReentrant.sol': 0,
...
@@ -834,7 +791,7 @@ test('Integration test etherTransferInLoop.js', function (t) {
...
@@ -834,7 +791,7 @@ test('Integration test etherTransferInLoop.js', function (t) {
})
})
test
(
'Integration test forLoopIteratesOverDynamicArray.js'
,
function
(
t
)
{
test
(
'Integration test forLoopIteratesOverDynamicArray.js'
,
function
(
t
)
{
t
.
plan
(
4
)
t
.
plan
(
7
)
var
module
=
require
(
'../../dist/src/solidity-analyzer/modules/forLoopIteratesOverDynamicArray'
).
default
var
module
=
require
(
'../../dist/src/solidity-analyzer/modules/forLoopIteratesOverDynamicArray'
).
default
...
@@ -843,9 +800,9 @@ test('Integration test forLoopIteratesOverDynamicArray.js', function (t) {
...
@@ -843,9 +800,9 @@ test('Integration test forLoopIteratesOverDynamicArray.js', function (t) {
'assembly.sol'
:
0
,
'assembly.sol'
:
0
,
'ballot.sol'
:
2
,
'ballot.sol'
:
2
,
'ballot_reentrant.sol'
:
1
,
'ballot_reentrant.sol'
:
1
,
//
'ballot_withoutWarnings.sol': 0,
'ballot_withoutWarnings.sol'
:
0
,
//
'cross_contract.sol': 0,
'cross_contract.sol'
:
0
,
//
'inheritance.sol': 0,
'inheritance.sol'
:
0
,
// 'modifier1.sol': 0,
// 'modifier1.sol': 0,
// 'modifier2.sol': 0,
// 'modifier2.sol': 0,
// 'notReentrant.sol': 0,
// 'notReentrant.sol': 0,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment