pull/379/head
Vlad Silviu Farcas 5 years ago
parent ee31aed5f9
commit 2440b95fe8
  1. 3
      scripts/tests_generate_expected_json_4.sh
  2. 3
      scripts/tests_generate_expected_json_5.sh
  3. 3
      scripts/travis_test_4.sh
  4. 3
      scripts/travis_test_5.sh
  5. 2
      slither/detectors/attributes/const_functions_asm.py
  6. 2
      slither/detectors/attributes/const_functions_state.py
  7. 3
      slither/tools/slither_format/__main__.py
  8. 0
      tests/expected_json/constant-0.5.1.constant-function-asm.json
  9. 1
      tests/expected_json/constant-0.5.1.constant-function-asm.txt
  10. 5
      tests/expected_json/constant-0.5.1.constant-function-state.json
  11. 0
      tests/expected_json/constant-0.5.1.constant-function-state.txt
  12. 4
      tests/expected_json/constant-0.5.1.constant-function.txt
  13. 86
      tests/expected_json/constant.constant-function-asm.json
  14. 4
      tests/expected_json/constant.constant-function-asm.txt
  15. 78
      tests/expected_json/constant.constant-function-state.json
  16. 1
      tests/expected_json/constant.constant-function-state.txt

@ -46,7 +46,8 @@ generate_expected_json tests/reentrancy.sol "reentrancy-unlimited-gas"
#generate_expected_json tests/naming_convention.sol "naming-convention"
#generate_expected_json tests/uninitialized_local_variable.sol "uninitialized-local"
#generate_expected_json tests/controlled_delegatecall.sol "controlled-delegatecall"
#generate_expected_json tests/constant.sol "constant-function"
#generate_expected_json tests/constant.sol "constant-function-asm"
#generate_expected_json tests/constant.sol "constant-function-state"
#generate_expected_json tests/unused_return.sol "unused-return"
#generate_expected_json tests/shadowing_state_variable.sol "shadowing-state"
#generate_expected_json tests/shadowing_abstract.sol "shadowing-abstract"

@ -32,7 +32,8 @@ generate_expected_json(){
#generate_expected_json tests/arbitrary_send-0.5.1.sol "arbitrary-send"
#generate_expected_json tests/inline_assembly_contract-0.5.1.sol "assembly"
#generate_expected_json tests/inline_assembly_library-0.5.1.sol "assembly"
#generate_expected_json tests/constant-0.5.1.sol "constant-function"
#generate_expected_json tests/constant-0.5.1.sol "constant-function-asm"
#generate_expected_json tests/constant-0.5.1.sol "constant-function-state"
#generate_expected_json tests/incorrect_equality.sol "incorrect-equality"
#generate_expected_json tests/too_many_digits.sol "too-many-digits"
#generate_expected_json tests/unchecked_lowlevel-0.5.1.sol "unchecked-lowlevel"

@ -95,7 +95,8 @@ test_slither tests/naming_convention.sol "naming-convention"
#test_slither tests/complex_func.sol "complex-function"
test_slither tests/controlled_delegatecall.sol "controlled-delegatecall"
test_slither tests/uninitialized_local_variable.sol "uninitialized-local"
test_slither tests/constant.sol "constant-function"
test_slither tests/constant.sol "constant-function-asm"
test_slither tests/constant.sol "constant-function-state"
test_slither tests/unused_return.sol "unused-return"
test_slither tests/shadowing_abstract.sol "shadowing-abstract"
test_slither tests/shadowing_state_variable.sol "shadowing-state"

@ -91,7 +91,8 @@ test_slither tests/external_function_2.sol "external-function"
test_slither tests/naming_convention.sol "naming-convention"
#test_slither tests/complex_func.sol "complex-function"
test_slither tests/controlled_delegatecall.sol "controlled-delegatecall"
test_slither tests/constant-0.5.1.sol "constant-function"
test_slither tests/constant-0.5.1.sol "constant-function-asm"
test_slither tests/constant-0.5.1.sol "constant-function-state"
test_slither tests/unused_return.sol "unused-return"
test_slither tests/timestamp.sol "timestamp"
test_slither tests/incorrect_equality.sol "incorrect-equality"

@ -11,7 +11,7 @@ class ConstantFunctionsAsm(AbstractDetector):
Constant function detector
"""
ARGUMENT = 'constant-function' # run the detector with slither.py --ARGUMENT
ARGUMENT = 'constant-function-asm' # run the detector with slither.py --ARGUMENT
HELP = 'Constant functions changing the state' # help information
IMPACT = DetectorClassification.MEDIUM
CONFIDENCE = DetectorClassification.MEDIUM

@ -11,7 +11,7 @@ class ConstantFunctionsState(AbstractDetector):
Constant function detector
"""
ARGUMENT = 'constant-function' # run the detector with slither.py --ARGUMENT
ARGUMENT = 'constant-function-state' # run the detector with slither.py --ARGUMENT
HELP = 'Constant functions changing the state' # help information
IMPACT = DetectorClassification.MEDIUM
CONFIDENCE = DetectorClassification.MEDIUM

@ -16,7 +16,8 @@ available_detectors = ["unused-state",
"naming-convention",
"external-function",
"constable-states",
"constant-function"]
"constant-function-asm",
"constatnt-function-state"]
detectors_to_run = []

@ -0,0 +1,5 @@
{
"success": true,
"error": null,
"results": null
}

@ -1,4 +0,0 @@

Constant.test_assembly_bug() (tests/constant-0.5.1.sol#15-17) is declared view but contains assembly code
Reference: https://github.com/crytic/slither/wiki/Detector-Documentation#constant-functions-changing-the-state
tests/constant-0.5.1.sol analyzed (1 contracts with 1 detectors), 1 result(s) found

@ -0,0 +1,86 @@
{
"success": true,
"error": null,
"results": {
"detectors": [
{
"elements": [
{
"type": "function",
"name": "test_assembly_bug",
"source_mapping": {
"start": 324,
"length": 66,
"filename_used": "/home/travis/build/crytic/slither/tests/constant.sol",
"filename_relative": "tests/constant.sol",
"filename_absolute": "/home/travis/build/crytic/slither/tests/constant.sol",
"filename_short": "tests/constant.sol",
"is_dependency": false,
"lines": [
22,
23,
24
],
"starting_column": 5,
"ending_column": 6
},
"type_specific_fields": {
"parent": {
"type": "contract",
"name": "Constant",
"source_mapping": {
"start": 0,
"length": 392,
"filename_used": "/home/travis/build/crytic/slither/tests/constant.sol",
"filename_relative": "tests/constant.sol",
"filename_absolute": "/home/travis/build/crytic/slither/tests/constant.sol",
"filename_short": "tests/constant.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
],
"starting_column": 1,
"ending_column": 2
}
},
"signature": "test_assembly_bug()"
}
}
],
"description": "Constant.test_assembly_bug() (tests/constant.sol#22-24) is declared view but contains assembly code\n",
"markdown": "[Constant.test_assembly_bug()](tests/constant.sol#L22-L24) is declared view but contains assembly code\n",
"id": "1f892cae08b89096bdc4d6ecdf55a3adc4b4314390e054fe2547d9c8e9f76e23",
"additional_fields": {
"contains_assembly": true
},
"check": "constant-function-asm",
"impact": "Medium",
"confidence": "Medium"
}
]
}
}

@ -0,0 +1,4 @@

Constant.test_assembly_bug() (tests/constant.sol#22-24) is declared view but contains assembly code
Reference: https://github.com/crytic/slither/wiki/Detector-Documentation#constant-functions-changing-the-state
tests/constant.sol analyzed (1 contracts with 1 detectors), 3 result(s) found

@ -282,84 +282,6 @@
"check": "constant-function-state",
"impact": "Medium",
"confidence": "Medium"
},
{
"elements": [
{
"type": "function",
"name": "test_assembly_bug",
"source_mapping": {
"start": 324,
"length": 66,
"filename_used": "/home/travis/build/crytic/slither/tests/constant.sol",
"filename_relative": "tests/constant.sol",
"filename_absolute": "/home/travis/build/crytic/slither/tests/constant.sol",
"filename_short": "tests/constant.sol",
"is_dependency": false,
"lines": [
22,
23,
24
],
"starting_column": 5,
"ending_column": 6
},
"type_specific_fields": {
"parent": {
"type": "contract",
"name": "Constant",
"source_mapping": {
"start": 0,
"length": 392,
"filename_used": "/home/travis/build/crytic/slither/tests/constant.sol",
"filename_relative": "tests/constant.sol",
"filename_absolute": "/home/travis/build/crytic/slither/tests/constant.sol",
"filename_short": "tests/constant.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
],
"starting_column": 1,
"ending_column": 2
}
},
"signature": "test_assembly_bug()"
}
}
],
"description": "Constant.test_assembly_bug() (tests/constant.sol#22-24) is declared view but contains assembly code\n",
"markdown": "[Constant.test_assembly_bug()](tests/constant.sol#L22-L24) is declared view but contains assembly code\n",
"id": "1f892cae08b89096bdc4d6ecdf55a3adc4b4314390e054fe2547d9c8e9f76e23",
"additional_fields": {
"contains_assembly": true
},
"check": "constant-function-asm",
"impact": "Medium",
"confidence": "Medium"
}
]
}

@ -3,6 +3,5 @@ Constant.test_view_bug() (tests/constant.sol#5-7) is declared view but changes s
- Constant.a (tests/constant.sol#3)
Constant.test_constant_bug() (tests/constant.sol#9-11) is declared view but changes state variables:
- Constant.a (tests/constant.sol#3)
Constant.test_assembly_bug() (tests/constant.sol#22-24) is declared view but contains assembly code
Reference: https://github.com/crytic/slither/wiki/Detector-Documentation#constant-functions-changing-the-state
tests/constant.sol analyzed (1 contracts with 1 detectors), 3 result(s) found
Loading…
Cancel
Save