Commit 2fce136c authored by aniket-engg's avatar aniket-engg Committed by Aniket

two more contract integration tests updated

parent f78d1267
...@@ -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
} }
......
...@@ -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)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment