Merge branch 'dev-missing-irs-conversion' into dev-slither-format-tool-only-new

pull/238/head
Josselin 5 years ago
commit c3e111aac4
  1. 2
      scripts/tests_generate_expected_json_4.sh
  2. 2
      scripts/travis_test_etherscan.sh
  3. 2
      slither/core/declarations/function.py
  4. 2
      slither/detectors/variables/possible_const_state_variables.py
  5. 1
      slither/solc_parsing/declarations/contract.py
  6. 80
      tests/expected_json/deprecated_calls.deprecated-standards.json
  7. 4
      tests/expected_json/deprecated_calls.deprecated-standards.txt
  8. 2
      utils/similarity/encode.py

@ -21,7 +21,7 @@ generate_expected_json(){
}
#generate_expected_json tests/deprecated_calls.sol "deprecated-standards"
generate_expected_json tests/deprecated_calls.sol "deprecated-standards"
#generate_expected_json tests/erc20_indexed.sol "erc20-indexed"
#generate_expected_json tests/incorrect_erc20_interface.sol "erc20-interface"
#generate_expected_json tests/incorrect_erc721_interface.sol "erc721-interface"

@ -18,7 +18,7 @@ fi
slither rinkeby:0xFe05820C5A92D9bc906D4A46F662dbeba794d3b7 --solc "./solc-0.4.25"
if [ $? -ne 76 ]
if [ $? -ne 75 ]
then
echo "Etherscan test failed"
exit -1

@ -122,7 +122,7 @@ class Function(ChildContract, ChildInheritance, SourceMapping):
elif self._function_type == FunctionType.FALLBACK:
return 'fallback'
elif self._function_type == FunctionType.CONSTRUCTOR_VARIABLES:
return 'slither_constructor_variables'
return 'slitherConstructorVariables'
return self._name
@property

@ -76,7 +76,7 @@ class ConstCandidateStateVars(AbstractDetector):
all_functions = [c.all_functions_called for c in self.slither.contracts]
all_functions = list(set([item for sublist in all_functions for item in sublist]))
all_variables_written = [f.state_variables_written for f in all_functions]
all_variables_written = [f.state_variables_written for f in all_functions if not f.is_constructor_variables]
all_variables_written = set([item for sublist in all_variables_written for item in sublist])
constable_variables = [v for v in all_non_constant_elementary_variables

@ -377,7 +377,6 @@ class ContractSolc04(Contract):
node.set_offset(variable.source_mapping, self.slither)
node.set_function(func)
func.add_node(node)
print(variable.expression)
expression = AssignmentOperation(Identifier(variable),
variable.expression,
AssignmentOperationType.ASSIGN,

@ -692,6 +692,86 @@
}
}
]
},
{
"check": "deprecated-standards",
"impact": "Informational",
"confidence": "High",
"description": "Deprecated standard detected @ tests/deprecated_calls.sol#2:\n\t- Usage of \"block.blockhash()\" should be replaced with \"blockhash()\"\n",
"elements": [
{
"type": "node",
"name": "globalBlockHash = block.blockhash(0)",
"source_mapping": {
"start": 48,
"length": 44,
"filename_used": "/home/travis/build/crytic/slither/tests/deprecated_calls.sol",
"filename_relative": "tests/deprecated_calls.sol",
"filename_absolute": "/home/travis/build/crytic/slither/tests/deprecated_calls.sol",
"filename_short": "tests/deprecated_calls.sol",
"is_dependency": false,
"lines": [
2
],
"starting_column": 5,
"ending_column": 49
},
"type_specific_fields": {
"parent": {
"type": "function",
"name": "slitherConstructorVariables",
"source_mapping": null,
"type_specific_fields": {
"parent": {
"type": "contract",
"name": "ContractWithDeprecatedReferences",
"source_mapping": {
"start": 0,
"length": 906,
"filename_used": "/home/travis/build/crytic/slither/tests/deprecated_calls.sol",
"filename_relative": "tests/deprecated_calls.sol",
"filename_absolute": "/home/travis/build/crytic/slither/tests/deprecated_calls.sol",
"filename_short": "tests/deprecated_calls.sol",
"is_dependency": false,
"lines": [
1,
2,
3,
4,
5,
6,
7,
8,
9,
10,
11,
12,
13,
14,
15,
16,
17,
18,
19,
20,
21,
22,
23,
24,
25,
26,
27
],
"starting_column": 1,
"ending_column": null
}
},
"signature": "slitherConstructorVariables()"
}
}
}
}
]
}
]
}

@ -13,5 +13,7 @@ Deprecated standard detected @ tests/deprecated_calls.sol#22:
- Usage of "callcode" should be replaced with "delegatecall"
Deprecated standard detected @ tests/deprecated_calls.sol#25:
- Usage of "suicide()" should be replaced with "selfdestruct()"
Deprecated standard detected @ tests/deprecated_calls.sol#2:
- Usage of "block.blockhash()" should be replaced with "blockhash()"
Reference: https://github.com/crytic/slither/wiki/Detector-Documentation#deprecated-standards
INFO:Slither:tests/deprecated_calls.sol analyzed (1 contracts), 7 result(s) found
INFO:Slither:tests/deprecated_calls.sol analyzed (1 contracts), 8 result(s) found

@ -195,7 +195,7 @@ def encode_contract(cfilename, **kwargs):
# Iterate over all the functions
for function in contract.functions_declared:
if function.nodes == []:
if function.nodes == [] or function.is_constructor_variables:
continue
x = (cfilename,contract.name,function.name)

Loading…
Cancel
Save