Merge branch 'dev' into dev-doc

pull/1494/head
Josselin Feist 2 years ago
commit e3c69e12aa
  1. 17
      slither/core/declarations/contract.py
  2. 1
      slither/core/declarations/solidity_variables.py
  3. 1
      slither/detectors/all_detectors.py
  4. 29
      slither/detectors/naming_convention/naming_convention.py
  5. 2
      slither/detectors/operations/missing_events_arithmetic.py
  6. 60
      slither/detectors/variables/var_read_using_this.py
  7. 4
      slither/printers/functions/authorization.py
  8. 6
      slither/printers/summary/data_depenency.py
  9. 18
      slither/printers/summary/function.py
  10. 2
      slither/printers/summary/modifier_calls.py
  11. 2
      slither/printers/summary/require_calls.py
  12. 5
      slither/slithir/convert.py
  13. 1
      slither/slithir/operations/__init__.py
  14. 27
      slither/slithir/operations/push.py
  15. 9
      slither/slithir/utils/ssa.py
  16. 21
      slither/solc_parsing/declarations/contract.py
  17. 3
      slither/tools/similarity/encode.py
  18. 2
      slither/tools/upgradeability/checks/variables_order.py
  19. 16
      tests/custom_comments/upgrade.sol
  20. 2
      tests/detectors/naming-convention/0.4.25/naming_convention.sol
  21. 300
      tests/detectors/naming-convention/0.4.25/naming_convention.sol.0.4.25.NamingConvention.json
  22. 2
      tests/detectors/naming-convention/0.5.16/naming_convention.sol
  23. 300
      tests/detectors/naming-convention/0.5.16/naming_convention.sol.0.5.16.NamingConvention.json
  24. 2
      tests/detectors/naming-convention/0.6.11/naming_convention.sol
  25. 300
      tests/detectors/naming-convention/0.6.11/naming_convention.sol.0.6.11.NamingConvention.json
  26. 2
      tests/detectors/naming-convention/0.7.6/naming_convention.sol
  27. 300
      tests/detectors/naming-convention/0.7.6/naming_convention.sol.0.7.6.NamingConvention.json
  28. 33
      tests/detectors/var-read-using-this/0.4.25/var_read_using_this.sol
  29. 3
      tests/detectors/var-read-using-this/0.4.25/var_read_using_this.sol.0.4.25.VarReadUsingThis.json
  30. 39
      tests/detectors/var-read-using-this/0.5.16/var_read_using_this.sol
  31. 736
      tests/detectors/var-read-using-this/0.5.16/var_read_using_this.sol.0.5.16.VarReadUsingThis.json
  32. 39
      tests/detectors/var-read-using-this/0.6.11/var_read_using_this.sol
  33. 736
      tests/detectors/var-read-using-this/0.6.11/var_read_using_this.sol.0.6.11.VarReadUsingThis.json
  34. 39
      tests/detectors/var-read-using-this/0.7.6/var_read_using_this.sol
  35. 736
      tests/detectors/var-read-using-this/0.7.6/var_read_using_this.sol.0.7.6.VarReadUsingThis.json
  36. 39
      tests/detectors/var-read-using-this/0.8.15/var_read_using_this.sol
  37. 736
      tests/detectors/var-read-using-this/0.8.15/var_read_using_this.sol.0.8.15.VarReadUsingThis.json
  38. 21
      tests/test_detectors.py
  39. 29
      tests/test_features.py

@ -88,6 +88,7 @@ class Contract(SourceMapping): # pylint: disable=too-many-public-methods
self._is_upgradeable: Optional[bool] = None
self._is_upgradeable_proxy: Optional[bool] = None
self._upgradeable_version: Optional[str] = None
self.is_top_level = False # heavily used, so no @property
@ -1221,6 +1222,10 @@ class Contract(SourceMapping): # pylint: disable=too-many-public-methods
break
return self._is_upgradeable
@is_upgradeable.setter
def is_upgradeable(self, upgradeable: bool):
self._is_upgradeable = upgradeable
@property
def is_upgradeable_proxy(self) -> bool:
from slither.core.cfg.node import NodeType
@ -1246,6 +1251,18 @@ class Contract(SourceMapping): # pylint: disable=too-many-public-methods
return self._is_upgradeable_proxy
return self._is_upgradeable_proxy
@is_upgradeable_proxy.setter
def is_upgradeable_proxy(self, upgradeable_proxy: bool):
self._is_upgradeable_proxy = upgradeable_proxy
@property
def upgradeable_version(self) -> Optional[str]:
return self._upgradeable_version
@upgradeable_version.setter
def upgradeable_version(self, version_name: str):
self._upgradeable_version = version_name
# endregion
###################################################################################
###################################################################################

@ -70,6 +70,7 @@ SOLIDITY_FUNCTIONS: Dict[str, List[str]] = {
"abi.encodePacked()": ["bytes"],
"abi.encodeWithSelector()": ["bytes"],
"abi.encodeWithSignature()": ["bytes"],
"abi.encodeCall()": ["bytes"],
"bytes.concat()": ["bytes"],
"string.concat()": ["string"],
# abi.decode returns an a list arbitrary types

@ -3,6 +3,7 @@ from .examples.backdoor import Backdoor
from .variables.uninitialized_state_variables import UninitializedStateVarsDetection
from .variables.uninitialized_storage_variables import UninitializedStorageVars
from .variables.uninitialized_local_variables import UninitializedLocalVars
from .variables.var_read_using_this import VarReadUsingThis
from .attributes.constant_pragma import ConstantPragma
from .attributes.incorrect_solc import IncorrectSolc
from .attributes.locked_ether import LockedEther

@ -119,22 +119,21 @@ Solidity defines a [naming convention](https://solidity.readthedocs.io/en/v0.4.2
for var in contract.state_variables_declared:
if self.should_avoid_name(var.name):
if not self.is_upper_case_with_underscores(var.name):
info = [
"Variable ",
var,
" used l, O, I, which should not be used\n",
]
info = [
"Variable ",
var,
" is single letter l, O, or I, which should not be used\n",
]
res = self.generate_result(info)
res.add(
var,
{
"target": "variable",
"convention": "l_O_I_should_not_be_used",
},
)
results.append(res)
res = self.generate_result(info)
res.add(
var,
{
"target": "variable",
"convention": "l_O_I_should_not_be_used",
},
)
results.append(res)
if var.is_constant is True:
# For ERC20 compatibility

@ -42,7 +42,7 @@ contract C {
}
}
```
`updateOwner()` has no event, so it is difficult to track off-chain changes in the buy price.
`setBuyPrice()` does not emit an event, so it is difficult to track changes in the value of `buyPrice` off-chain.
"""
# endregion wiki_exploit_scenario

@ -0,0 +1,60 @@
from typing import List
from slither.core.cfg.node import Node
from slither.core.declarations import Function, SolidityVariable
from slither.detectors.abstract_detector import AbstractDetector, DetectorClassification
from slither.slithir.operations.high_level_call import HighLevelCall
class VarReadUsingThis(AbstractDetector):
ARGUMENT = "var-read-using-this"
HELP = "Contract reads its own variable using `this`"
IMPACT = DetectorClassification.OPTIMIZATION
CONFIDENCE = DetectorClassification.HIGH
WIKI = "https://github.com/crytic/slither/wiki/Vulnerabilities-Description#public-variable-read-in-external-context"
WIKI_TITLE = "Public variable read in external context"
WIKI_DESCRIPTION = "The contract reads its own variable using `this`, adding overhead of an unnecessary STATICCALL."
WIKI_EXPLOIT_SCENARIO = """
```solidity
contract C {
mapping(uint => address) public myMap;
function test(uint x) external returns(address) {
return this.myMap(x);
}
}
```
"""
WIKI_RECOMMENDATION = "Read the variable directly from storage instead of calling the contract."
def _detect(self):
results = []
for c in self.contracts:
for func in c.functions:
for node in self._detect_var_read_using_this(func):
info = [
"The function ",
func,
" reads ",
node,
" with `this` which adds an extra STATICCALL.\n",
]
json = self.generate_result(info)
results.append(json)
return results
@staticmethod
def _detect_var_read_using_this(func: Function) -> List[Node]:
results: List[Node] = []
for node in func.nodes:
for ir in node.irs:
if isinstance(ir, HighLevelCall):
if (
ir.destination == SolidityVariable("this")
and ir.is_static_call()
and ir.function.visibility == "public"
):
results.append(node)
return sorted(results, key=lambda x: x.node_id)

@ -54,8 +54,8 @@ class PrinterWrittenVariablesAndAuthorization(AbstractPrinter):
table.add_row(
[
function.name,
str(state_variables_written),
str(msg_sender_condition),
str(sorted(state_variables_written)),
str(sorted(msg_sender_condition)),
]
)
all_tables.append((contract.name, table))

@ -42,7 +42,7 @@ class DataDependency(AbstractPrinter):
txt += f"\nContract {c.name}\n"
table = MyPrettyTable(["Variable", "Dependencies"])
for v in c.state_variables:
table.add_row([v.name, _get(v, c)])
table.add_row([v.name, sorted(_get(v, c))])
txt += str(table)
@ -51,9 +51,9 @@ class DataDependency(AbstractPrinter):
txt += f"\nFunction {f.full_name}\n"
table = MyPrettyTable(["Variable", "Dependencies"])
for v in f.variables:
table.add_row([v.name, _get(v, f)])
table.add_row([v.name, sorted(_get(v, f))])
for v in c.state_variables:
table.add_row([v.canonical_name, _get(v, f)])
table.add_row([v.canonical_name, sorted(_get(v, f))])
txt += str(table)
self.info(txt)

@ -60,15 +60,15 @@ class FunctionSummary(AbstractPrinter):
internal_calls,
external_calls,
) in func_summaries:
read = self._convert(read)
write = self._convert(write)
internal_calls = self._convert(internal_calls)
external_calls = self._convert(external_calls)
read = self._convert(sorted(read))
write = self._convert(sorted(write))
internal_calls = self._convert(sorted(internal_calls))
external_calls = self._convert(sorted(external_calls))
table.add_row(
[
f_name,
visi,
modifiers,
sorted(modifiers),
read,
write,
internal_calls,
@ -96,10 +96,10 @@ class FunctionSummary(AbstractPrinter):
internal_calls,
external_calls,
) in modif_summaries:
read = self._convert(read)
write = self._convert(write)
internal_calls = self._convert(internal_calls)
external_calls = self._convert(external_calls)
read = self._convert(sorted(read))
write = self._convert(sorted(write))
internal_calls = self._convert(sorted(internal_calls))
external_calls = self._convert(sorted(external_calls))
table.add_row([f_name, visi, read, write, internal_calls, external_calls])
txt += "\n\n" + str(table)
txt += "\n"

@ -35,7 +35,7 @@ class Modifiers(AbstractPrinter):
for (_, call) in function.all_library_calls():
if isinstance(call, Function):
modifiers += call.modifiers
table.add_row([function.name, [m.name for m in set(modifiers)]])
table.add_row([function.name, sorted([m.name for m in set(modifiers)])])
txt += "\n" + str(table)
self.info(txt)
all_txt += txt

@ -48,7 +48,7 @@ class RequireOrAssert(AbstractPrinter):
table.add_row(
[
function.name,
self._convert([str(m.expression) for m in set(require)]),
self._convert(sorted([str(m.expression) for m in set(require)])),
]
)
txt += "\n" + str(table)

@ -60,7 +60,6 @@ from slither.slithir.operations import (
NewElementaryType,
NewStructure,
OperationWithLValue,
Push,
Return,
Send,
SolidityCall,
@ -745,9 +744,6 @@ def propagate_types(ir, node: "Node"): # pylint: disable=too-many-locals
ir.lvalue.set_type(ir.type)
elif isinstance(ir, NewStructure):
ir.lvalue.set_type(UserDefinedType(ir.structure))
elif isinstance(ir, Push):
# No change required
pass
elif isinstance(ir, Send):
ir.lvalue.set_type(ElementaryType("bool"))
elif isinstance(ir, SolidityCall):
@ -1139,6 +1135,7 @@ def can_be_solidity_func(ir) -> bool:
"encodePacked",
"encodeWithSelector",
"encodeWithSignature",
"encodeCall",
"decode",
]

@ -18,7 +18,6 @@ from .new_elementary_type import NewElementaryType
from .new_contract import NewContract
from .new_structure import NewStructure
from .operation import Operation
from .push import Push
from .return_operation import Return
from .send import Send
from .solidity_call import SolidityCall

@ -1,27 +0,0 @@
from slither.core.declarations import Function
from slither.slithir.operations.lvalue import OperationWithLValue
from slither.slithir.utils.utils import is_valid_lvalue, is_valid_rvalue
class Push(OperationWithLValue):
def __init__(self, array, value):
super().__init__()
assert is_valid_rvalue(value) or isinstance(value, Function)
assert is_valid_lvalue(array)
self._value = value
self._lvalue = array
@property
def read(self):
return [self._value]
@property
def array(self):
return self._lvalue
@property
def value(self):
return self._value
def __str__(self):
return f"PUSH {self.value} in {self.lvalue}"

@ -36,7 +36,6 @@ from slither.slithir.operations import (
OperationWithLValue,
Phi,
PhiCallback,
Push,
Return,
Send,
SolidityCall,
@ -690,7 +689,9 @@ def copy_ir(ir, *instances):
return Delete(lvalue, variable)
if isinstance(ir, EventCall):
name = ir.name
return EventCall(name)
new_ir = EventCall(name)
new_ir.arguments = get_arguments(ir, *instances)
return new_ir
if isinstance(ir, HighLevelCall): # include LibraryCall
destination = get_variable(ir, lambda x: x.destination, *instances)
function_name = ir.function_name
@ -778,10 +779,6 @@ def copy_ir(ir, *instances):
return new_ir
if isinstance(ir, Nop):
return Nop()
if isinstance(ir, Push):
array = get_variable(ir, lambda x: x.array, *instances)
lvalue = get_variable(ir, lambda x: x.lvalue, *instances)
return Push(array, lvalue)
if isinstance(ir, Return):
values = get_rec_values(ir, lambda x: x.values, *instances)
return Return(values)

@ -1,4 +1,5 @@
import logging
import re
from typing import List, Dict, Callable, TYPE_CHECKING, Union, Set
from slither.core.declarations import Modifier, Event, EnumContract, StructureContract, Function
@ -65,8 +66,10 @@ class ContractSolc(CallerContextExpression):
# Export info
if self.is_compact_ast:
self._contract.name = self._data["name"]
self._handle_comment(self._data)
else:
self._contract.name = self._data["attributes"][self.get_key()]
self._handle_comment(self._data["attributes"])
self._contract.id = self._data["id"]
@ -699,6 +702,24 @@ class ContractSolc(CallerContextExpression):
self._usingForNotParsed = []
self._customErrorParsed = []
def _handle_comment(self, attributes: Dict) -> None:
if (
"documentation" in attributes
and attributes["documentation"] is not None
and "text" in attributes["documentation"]
):
candidates = attributes["documentation"]["text"].replace("\n", ",").split(",")
for candidate in candidates:
if "@custom:security isDelegatecallProxy" in candidate:
self._contract.is_upgradeable_proxy = True
if "@custom:security isUpgradeable" in candidate:
self._contract.is_upgradeable = True
version_name = re.search(r"@custom:version name=([\w-]+)", candidate)
if version_name:
self._contract.upgradeable_version = version_name.group(1)
# endregion
###################################################################################
###################################################################################

@ -31,7 +31,6 @@ from slither.slithir.operations import (
NewContract,
NewElementaryType,
SolidityCall,
Push,
Delete,
EventCall,
LibraryCall,
@ -163,8 +162,6 @@ def encode_ir(ir): # pylint: disable=too-many-branches
return f"new_array({ntype(ir.array_type)})"
if isinstance(ir, NewElementaryType):
return f"new_elementary({ntype(ir.type)})"
if isinstance(ir, Push):
return f"push({encode_ir(ir.value)},{encode_ir(ir.lvalue)})"
if isinstance(ir, Delete):
return f"delete({encode_ir(ir.lvalue)},{encode_ir(ir.variable)})"
if isinstance(ir, SolidityCall):

@ -236,7 +236,7 @@ Avoid variables in the proxy. If a variable is in the proxy, ensure it has the s
if len(order2) <= len(order1):
return []
idx = len(order2) - len(order1)
idx = len(order1)
while idx < len(order2):
variable2 = order2[idx]

@ -0,0 +1,16 @@
/// @custom:security isDelegatecallProxy
contract Proxy{
}
/// @custom:security isUpgradeable
/// @custom:version name=version-0
contract V0{
}
/// @custom:security isUpgradeable
/// @custom:version name=version_1
contract V1{
}

@ -65,6 +65,8 @@ contract T {
uint constant M = 1;
uint l = 1;
uint O = 1;
uint I = 1;
}
contract ParameterNameEmptyString {

@ -98,6 +98,207 @@
"impact": "Informational",
"confidence": "High"
},
{
"elements": [
{
"type": "variable",
"name": "I",
"source_mapping": {
"start": 932,
"length": 10,
"filename_relative": "tests/detectors/naming-convention/0.4.25/naming_convention.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/naming-convention/0.4.25/naming_convention.sol",
"is_dependency": false,
"lines": [
69
],
"starting_column": 5,
"ending_column": 15
},
"type_specific_fields": {
"parent": {
"type": "contract",
"name": "T",
"source_mapping": {
"start": 692,
"length": 253,
"filename_relative": "tests/detectors/naming-convention/0.4.25/naming_convention.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/naming-convention/0.4.25/naming_convention.sol",
"is_dependency": false,
"lines": [
54,
55,
56,
57,
58,
59,
60,
61,
62,
63,
64,
65,
66,
67,
68,
69,
70
],
"starting_column": 1,
"ending_column": 2
}
}
},
"additional_fields": {
"target": "variable",
"convention": "mixedCase"
}
}
],
"description": "Variable T.I (tests/detectors/naming-convention/0.4.25/naming_convention.sol#69) is not in mixedCase\n",
"markdown": "Variable [T.I](tests/detectors/naming-convention/0.4.25/naming_convention.sol#L69) is not in mixedCase\n",
"first_markdown_element": "tests/detectors/naming-convention/0.4.25/naming_convention.sol#L69",
"id": "12df12bbda2059673d356e5c32ec4e8a037a3821c9fa42b831a9144437cb79f9",
"check": "naming-convention",
"impact": "Informational",
"confidence": "High"
},
{
"elements": [
{
"type": "variable",
"name": "I",
"source_mapping": {
"start": 932,
"length": 10,
"filename_relative": "tests/detectors/naming-convention/0.4.25/naming_convention.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/naming-convention/0.4.25/naming_convention.sol",
"is_dependency": false,
"lines": [
69
],
"starting_column": 5,
"ending_column": 15
},
"type_specific_fields": {
"parent": {
"type": "contract",
"name": "T",
"source_mapping": {
"start": 692,
"length": 253,
"filename_relative": "tests/detectors/naming-convention/0.4.25/naming_convention.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/naming-convention/0.4.25/naming_convention.sol",
"is_dependency": false,
"lines": [
54,
55,
56,
57,
58,
59,
60,
61,
62,
63,
64,
65,
66,
67,
68,
69,
70
],
"starting_column": 1,
"ending_column": 2
}
}
},
"additional_fields": {
"target": "variable",
"convention": "l_O_I_should_not_be_used"
}
}
],
"description": "Variable T.I (tests/detectors/naming-convention/0.4.25/naming_convention.sol#69) is single letter l, O, or I, which should not be used\n",
"markdown": "Variable [T.I](tests/detectors/naming-convention/0.4.25/naming_convention.sol#L69) is single letter l, O, or I, which should not be used\n",
"first_markdown_element": "tests/detectors/naming-convention/0.4.25/naming_convention.sol#L69",
"id": "2ac65aa5bb560436d64f16e164aaab90dbbf38d683bfdfdfb42eeb225fc51759",
"check": "naming-convention",
"impact": "Informational",
"confidence": "High"
},
{
"elements": [
{
"type": "variable",
"name": "O",
"source_mapping": {
"start": 916,
"length": 10,
"filename_relative": "tests/detectors/naming-convention/0.4.25/naming_convention.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/naming-convention/0.4.25/naming_convention.sol",
"is_dependency": false,
"lines": [
68
],
"starting_column": 5,
"ending_column": 15
},
"type_specific_fields": {
"parent": {
"type": "contract",
"name": "T",
"source_mapping": {
"start": 692,
"length": 253,
"filename_relative": "tests/detectors/naming-convention/0.4.25/naming_convention.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/naming-convention/0.4.25/naming_convention.sol",
"is_dependency": false,
"lines": [
54,
55,
56,
57,
58,
59,
60,
61,
62,
63,
64,
65,
66,
67,
68,
69,
70
],
"starting_column": 1,
"ending_column": 2
}
}
},
"additional_fields": {
"target": "variable",
"convention": "mixedCase"
}
}
],
"description": "Variable T.O (tests/detectors/naming-convention/0.4.25/naming_convention.sol#68) is not in mixedCase\n",
"markdown": "Variable [T.O](tests/detectors/naming-convention/0.4.25/naming_convention.sol#L68) is not in mixedCase\n",
"first_markdown_element": "tests/detectors/naming-convention/0.4.25/naming_convention.sol#L68",
"id": "2de986dda91f7c7e3a51470aa43abfa2c6fd363b742d1bbd38d5287ae179b83a",
"check": "naming-convention",
"impact": "Informational",
"confidence": "High"
},
{
"elements": [
{
@ -505,7 +706,7 @@
"name": "T",
"source_mapping": {
"start": 692,
"length": 221,
"length": 253,
"filename_relative": "tests/detectors/naming-convention/0.4.25/naming_convention.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/naming-convention/0.4.25/naming_convention.sol",
@ -525,7 +726,9 @@
65,
66,
67,
68
68,
69,
70
],
"starting_column": 1,
"ending_column": 2
@ -573,7 +776,7 @@
"name": "T",
"source_mapping": {
"start": 692,
"length": 221,
"length": 253,
"filename_relative": "tests/detectors/naming-convention/0.4.25/naming_convention.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/naming-convention/0.4.25/naming_convention.sol",
@ -593,7 +796,9 @@
65,
66,
67,
68
68,
69,
70
],
"starting_column": 1,
"ending_column": 2
@ -715,16 +920,16 @@
"elements": [
{
"type": "variable",
"name": "l",
"name": "O",
"source_mapping": {
"start": 900,
"start": 916,
"length": 10,
"filename_relative": "tests/detectors/naming-convention/0.4.25/naming_convention.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/naming-convention/0.4.25/naming_convention.sol",
"is_dependency": false,
"lines": [
67
68
],
"starting_column": 5,
"ending_column": 15
@ -735,7 +940,7 @@
"name": "T",
"source_mapping": {
"start": 692,
"length": 221,
"length": 253,
"filename_relative": "tests/detectors/naming-convention/0.4.25/naming_convention.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/naming-convention/0.4.25/naming_convention.sol",
@ -755,7 +960,9 @@
65,
66,
67,
68
68,
69,
70
],
"starting_column": 1,
"ending_column": 2
@ -768,10 +975,10 @@
}
}
],
"description": "Variable T.l (tests/detectors/naming-convention/0.4.25/naming_convention.sol#67) used l, O, I, which should not be used\n",
"markdown": "Variable [T.l](tests/detectors/naming-convention/0.4.25/naming_convention.sol#L67) used l, O, I, which should not be used\n",
"first_markdown_element": "tests/detectors/naming-convention/0.4.25/naming_convention.sol#L67",
"id": "b595f9e6d03b8b501b7c4a9bf8ff0ad9bf11448a25f53d63ab5031c95f8ae89c",
"description": "Variable T.O (tests/detectors/naming-convention/0.4.25/naming_convention.sol#68) is single letter l, O, or I, which should not be used\n",
"markdown": "Variable [T.O](tests/detectors/naming-convention/0.4.25/naming_convention.sol#L68) is single letter l, O, or I, which should not be used\n",
"first_markdown_element": "tests/detectors/naming-convention/0.4.25/naming_convention.sol#L68",
"id": "b341001642225c62eae76fef9879c80003b3134b3bc627d9b1912ebcd190304b",
"check": "naming-convention",
"impact": "Informational",
"confidence": "High"
@ -975,6 +1182,73 @@
"impact": "Informational",
"confidence": "High"
},
{
"elements": [
{
"type": "variable",
"name": "l",
"source_mapping": {
"start": 900,
"length": 10,
"filename_relative": "tests/detectors/naming-convention/0.4.25/naming_convention.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/naming-convention/0.4.25/naming_convention.sol",
"is_dependency": false,
"lines": [
67
],
"starting_column": 5,
"ending_column": 15
},
"type_specific_fields": {
"parent": {
"type": "contract",
"name": "T",
"source_mapping": {
"start": 692,
"length": 253,
"filename_relative": "tests/detectors/naming-convention/0.4.25/naming_convention.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/naming-convention/0.4.25/naming_convention.sol",
"is_dependency": false,
"lines": [
54,
55,
56,
57,
58,
59,
60,
61,
62,
63,
64,
65,
66,
67,
68,
69,
70
],
"starting_column": 1,
"ending_column": 2
}
}
},
"additional_fields": {
"target": "variable",
"convention": "l_O_I_should_not_be_used"
}
}
],
"description": "Variable T.l (tests/detectors/naming-convention/0.4.25/naming_convention.sol#67) is single letter l, O, or I, which should not be used\n",
"markdown": "Variable [T.l](tests/detectors/naming-convention/0.4.25/naming_convention.sol#L67) is single letter l, O, or I, which should not be used\n",
"first_markdown_element": "tests/detectors/naming-convention/0.4.25/naming_convention.sol#L67",
"id": "cb8668afe6ed1284c935ac95f8f9cb1407f96226fe741e7310d104d5f10a0fc6",
"check": "naming-convention",
"impact": "Informational",
"confidence": "High"
},
{
"elements": [
{

@ -65,6 +65,8 @@ contract T {
uint constant M = 1;
uint l = 1;
uint O = 1;
uint I = 1;
}
contract ParameterNameEmptyString {

@ -98,6 +98,207 @@
"impact": "Informational",
"confidence": "High"
},
{
"elements": [
{
"type": "variable",
"name": "I",
"source_mapping": {
"start": 932,
"length": 10,
"filename_relative": "tests/detectors/naming-convention/0.5.16/naming_convention.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/naming-convention/0.5.16/naming_convention.sol",
"is_dependency": false,
"lines": [
69
],
"starting_column": 5,
"ending_column": 15
},
"type_specific_fields": {
"parent": {
"type": "contract",
"name": "T",
"source_mapping": {
"start": 692,
"length": 253,
"filename_relative": "tests/detectors/naming-convention/0.5.16/naming_convention.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/naming-convention/0.5.16/naming_convention.sol",
"is_dependency": false,
"lines": [
54,
55,
56,
57,
58,
59,
60,
61,
62,
63,
64,
65,
66,
67,
68,
69,
70
],
"starting_column": 1,
"ending_column": 2
}
}
},
"additional_fields": {
"target": "variable",
"convention": "mixedCase"
}
}
],
"description": "Variable T.I (tests/detectors/naming-convention/0.5.16/naming_convention.sol#69) is not in mixedCase\n",
"markdown": "Variable [T.I](tests/detectors/naming-convention/0.5.16/naming_convention.sol#L69) is not in mixedCase\n",
"first_markdown_element": "tests/detectors/naming-convention/0.5.16/naming_convention.sol#L69",
"id": "12df12bbda2059673d356e5c32ec4e8a037a3821c9fa42b831a9144437cb79f9",
"check": "naming-convention",
"impact": "Informational",
"confidence": "High"
},
{
"elements": [
{
"type": "variable",
"name": "I",
"source_mapping": {
"start": 932,
"length": 10,
"filename_relative": "tests/detectors/naming-convention/0.5.16/naming_convention.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/naming-convention/0.5.16/naming_convention.sol",
"is_dependency": false,
"lines": [
69
],
"starting_column": 5,
"ending_column": 15
},
"type_specific_fields": {
"parent": {
"type": "contract",
"name": "T",
"source_mapping": {
"start": 692,
"length": 253,
"filename_relative": "tests/detectors/naming-convention/0.5.16/naming_convention.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/naming-convention/0.5.16/naming_convention.sol",
"is_dependency": false,
"lines": [
54,
55,
56,
57,
58,
59,
60,
61,
62,
63,
64,
65,
66,
67,
68,
69,
70
],
"starting_column": 1,
"ending_column": 2
}
}
},
"additional_fields": {
"target": "variable",
"convention": "l_O_I_should_not_be_used"
}
}
],
"description": "Variable T.I (tests/detectors/naming-convention/0.5.16/naming_convention.sol#69) is single letter l, O, or I, which should not be used\n",
"markdown": "Variable [T.I](tests/detectors/naming-convention/0.5.16/naming_convention.sol#L69) is single letter l, O, or I, which should not be used\n",
"first_markdown_element": "tests/detectors/naming-convention/0.5.16/naming_convention.sol#L69",
"id": "2ac65aa5bb560436d64f16e164aaab90dbbf38d683bfdfdfb42eeb225fc51759",
"check": "naming-convention",
"impact": "Informational",
"confidence": "High"
},
{
"elements": [
{
"type": "variable",
"name": "O",
"source_mapping": {
"start": 916,
"length": 10,
"filename_relative": "tests/detectors/naming-convention/0.5.16/naming_convention.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/naming-convention/0.5.16/naming_convention.sol",
"is_dependency": false,
"lines": [
68
],
"starting_column": 5,
"ending_column": 15
},
"type_specific_fields": {
"parent": {
"type": "contract",
"name": "T",
"source_mapping": {
"start": 692,
"length": 253,
"filename_relative": "tests/detectors/naming-convention/0.5.16/naming_convention.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/naming-convention/0.5.16/naming_convention.sol",
"is_dependency": false,
"lines": [
54,
55,
56,
57,
58,
59,
60,
61,
62,
63,
64,
65,
66,
67,
68,
69,
70
],
"starting_column": 1,
"ending_column": 2
}
}
},
"additional_fields": {
"target": "variable",
"convention": "mixedCase"
}
}
],
"description": "Variable T.O (tests/detectors/naming-convention/0.5.16/naming_convention.sol#68) is not in mixedCase\n",
"markdown": "Variable [T.O](tests/detectors/naming-convention/0.5.16/naming_convention.sol#L68) is not in mixedCase\n",
"first_markdown_element": "tests/detectors/naming-convention/0.5.16/naming_convention.sol#L68",
"id": "2de986dda91f7c7e3a51470aa43abfa2c6fd363b742d1bbd38d5287ae179b83a",
"check": "naming-convention",
"impact": "Informational",
"confidence": "High"
},
{
"elements": [
{
@ -505,7 +706,7 @@
"name": "T",
"source_mapping": {
"start": 692,
"length": 221,
"length": 253,
"filename_relative": "tests/detectors/naming-convention/0.5.16/naming_convention.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/naming-convention/0.5.16/naming_convention.sol",
@ -525,7 +726,9 @@
65,
66,
67,
68
68,
69,
70
],
"starting_column": 1,
"ending_column": 2
@ -573,7 +776,7 @@
"name": "T",
"source_mapping": {
"start": 692,
"length": 221,
"length": 253,
"filename_relative": "tests/detectors/naming-convention/0.5.16/naming_convention.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/naming-convention/0.5.16/naming_convention.sol",
@ -593,7 +796,9 @@
65,
66,
67,
68
68,
69,
70
],
"starting_column": 1,
"ending_column": 2
@ -715,16 +920,16 @@
"elements": [
{
"type": "variable",
"name": "l",
"name": "O",
"source_mapping": {
"start": 900,
"start": 916,
"length": 10,
"filename_relative": "tests/detectors/naming-convention/0.5.16/naming_convention.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/naming-convention/0.5.16/naming_convention.sol",
"is_dependency": false,
"lines": [
67
68
],
"starting_column": 5,
"ending_column": 15
@ -735,7 +940,7 @@
"name": "T",
"source_mapping": {
"start": 692,
"length": 221,
"length": 253,
"filename_relative": "tests/detectors/naming-convention/0.5.16/naming_convention.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/naming-convention/0.5.16/naming_convention.sol",
@ -755,7 +960,9 @@
65,
66,
67,
68
68,
69,
70
],
"starting_column": 1,
"ending_column": 2
@ -768,10 +975,10 @@
}
}
],
"description": "Variable T.l (tests/detectors/naming-convention/0.5.16/naming_convention.sol#67) used l, O, I, which should not be used\n",
"markdown": "Variable [T.l](tests/detectors/naming-convention/0.5.16/naming_convention.sol#L67) used l, O, I, which should not be used\n",
"first_markdown_element": "tests/detectors/naming-convention/0.5.16/naming_convention.sol#L67",
"id": "b595f9e6d03b8b501b7c4a9bf8ff0ad9bf11448a25f53d63ab5031c95f8ae89c",
"description": "Variable T.O (tests/detectors/naming-convention/0.5.16/naming_convention.sol#68) is single letter l, O, or I, which should not be used\n",
"markdown": "Variable [T.O](tests/detectors/naming-convention/0.5.16/naming_convention.sol#L68) is single letter l, O, or I, which should not be used\n",
"first_markdown_element": "tests/detectors/naming-convention/0.5.16/naming_convention.sol#L68",
"id": "b341001642225c62eae76fef9879c80003b3134b3bc627d9b1912ebcd190304b",
"check": "naming-convention",
"impact": "Informational",
"confidence": "High"
@ -975,6 +1182,73 @@
"impact": "Informational",
"confidence": "High"
},
{
"elements": [
{
"type": "variable",
"name": "l",
"source_mapping": {
"start": 900,
"length": 10,
"filename_relative": "tests/detectors/naming-convention/0.5.16/naming_convention.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/naming-convention/0.5.16/naming_convention.sol",
"is_dependency": false,
"lines": [
67
],
"starting_column": 5,
"ending_column": 15
},
"type_specific_fields": {
"parent": {
"type": "contract",
"name": "T",
"source_mapping": {
"start": 692,
"length": 253,
"filename_relative": "tests/detectors/naming-convention/0.5.16/naming_convention.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/naming-convention/0.5.16/naming_convention.sol",
"is_dependency": false,
"lines": [
54,
55,
56,
57,
58,
59,
60,
61,
62,
63,
64,
65,
66,
67,
68,
69,
70
],
"starting_column": 1,
"ending_column": 2
}
}
},
"additional_fields": {
"target": "variable",
"convention": "l_O_I_should_not_be_used"
}
}
],
"description": "Variable T.l (tests/detectors/naming-convention/0.5.16/naming_convention.sol#67) is single letter l, O, or I, which should not be used\n",
"markdown": "Variable [T.l](tests/detectors/naming-convention/0.5.16/naming_convention.sol#L67) is single letter l, O, or I, which should not be used\n",
"first_markdown_element": "tests/detectors/naming-convention/0.5.16/naming_convention.sol#L67",
"id": "cb8668afe6ed1284c935ac95f8f9cb1407f96226fe741e7310d104d5f10a0fc6",
"check": "naming-convention",
"impact": "Informational",
"confidence": "High"
},
{
"elements": [
{

@ -65,6 +65,8 @@ contract T {
uint constant M = 1;
uint l = 1;
uint O = 1;
uint I = 1;
}
contract ParameterNameEmptyString {

@ -98,6 +98,207 @@
"impact": "Informational",
"confidence": "High"
},
{
"elements": [
{
"type": "variable",
"name": "I",
"source_mapping": {
"start": 932,
"length": 10,
"filename_relative": "tests/detectors/naming-convention/0.6.11/naming_convention.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/naming-convention/0.6.11/naming_convention.sol",
"is_dependency": false,
"lines": [
69
],
"starting_column": 5,
"ending_column": 15
},
"type_specific_fields": {
"parent": {
"type": "contract",
"name": "T",
"source_mapping": {
"start": 692,
"length": 253,
"filename_relative": "tests/detectors/naming-convention/0.6.11/naming_convention.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/naming-convention/0.6.11/naming_convention.sol",
"is_dependency": false,
"lines": [
54,
55,
56,
57,
58,
59,
60,
61,
62,
63,
64,
65,
66,
67,
68,
69,
70
],
"starting_column": 1,
"ending_column": 2
}
}
},
"additional_fields": {
"target": "variable",
"convention": "mixedCase"
}
}
],
"description": "Variable T.I (tests/detectors/naming-convention/0.6.11/naming_convention.sol#69) is not in mixedCase\n",
"markdown": "Variable [T.I](tests/detectors/naming-convention/0.6.11/naming_convention.sol#L69) is not in mixedCase\n",
"first_markdown_element": "tests/detectors/naming-convention/0.6.11/naming_convention.sol#L69",
"id": "12df12bbda2059673d356e5c32ec4e8a037a3821c9fa42b831a9144437cb79f9",
"check": "naming-convention",
"impact": "Informational",
"confidence": "High"
},
{
"elements": [
{
"type": "variable",
"name": "I",
"source_mapping": {
"start": 932,
"length": 10,
"filename_relative": "tests/detectors/naming-convention/0.6.11/naming_convention.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/naming-convention/0.6.11/naming_convention.sol",
"is_dependency": false,
"lines": [
69
],
"starting_column": 5,
"ending_column": 15
},
"type_specific_fields": {
"parent": {
"type": "contract",
"name": "T",
"source_mapping": {
"start": 692,
"length": 253,
"filename_relative": "tests/detectors/naming-convention/0.6.11/naming_convention.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/naming-convention/0.6.11/naming_convention.sol",
"is_dependency": false,
"lines": [
54,
55,
56,
57,
58,
59,
60,
61,
62,
63,
64,
65,
66,
67,
68,
69,
70
],
"starting_column": 1,
"ending_column": 2
}
}
},
"additional_fields": {
"target": "variable",
"convention": "l_O_I_should_not_be_used"
}
}
],
"description": "Variable T.I (tests/detectors/naming-convention/0.6.11/naming_convention.sol#69) is single letter l, O, or I, which should not be used\n",
"markdown": "Variable [T.I](tests/detectors/naming-convention/0.6.11/naming_convention.sol#L69) is single letter l, O, or I, which should not be used\n",
"first_markdown_element": "tests/detectors/naming-convention/0.6.11/naming_convention.sol#L69",
"id": "2ac65aa5bb560436d64f16e164aaab90dbbf38d683bfdfdfb42eeb225fc51759",
"check": "naming-convention",
"impact": "Informational",
"confidence": "High"
},
{
"elements": [
{
"type": "variable",
"name": "O",
"source_mapping": {
"start": 916,
"length": 10,
"filename_relative": "tests/detectors/naming-convention/0.6.11/naming_convention.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/naming-convention/0.6.11/naming_convention.sol",
"is_dependency": false,
"lines": [
68
],
"starting_column": 5,
"ending_column": 15
},
"type_specific_fields": {
"parent": {
"type": "contract",
"name": "T",
"source_mapping": {
"start": 692,
"length": 253,
"filename_relative": "tests/detectors/naming-convention/0.6.11/naming_convention.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/naming-convention/0.6.11/naming_convention.sol",
"is_dependency": false,
"lines": [
54,
55,
56,
57,
58,
59,
60,
61,
62,
63,
64,
65,
66,
67,
68,
69,
70
],
"starting_column": 1,
"ending_column": 2
}
}
},
"additional_fields": {
"target": "variable",
"convention": "mixedCase"
}
}
],
"description": "Variable T.O (tests/detectors/naming-convention/0.6.11/naming_convention.sol#68) is not in mixedCase\n",
"markdown": "Variable [T.O](tests/detectors/naming-convention/0.6.11/naming_convention.sol#L68) is not in mixedCase\n",
"first_markdown_element": "tests/detectors/naming-convention/0.6.11/naming_convention.sol#L68",
"id": "2de986dda91f7c7e3a51470aa43abfa2c6fd363b742d1bbd38d5287ae179b83a",
"check": "naming-convention",
"impact": "Informational",
"confidence": "High"
},
{
"elements": [
{
@ -505,7 +706,7 @@
"name": "T",
"source_mapping": {
"start": 692,
"length": 221,
"length": 253,
"filename_relative": "tests/detectors/naming-convention/0.6.11/naming_convention.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/naming-convention/0.6.11/naming_convention.sol",
@ -525,7 +726,9 @@
65,
66,
67,
68
68,
69,
70
],
"starting_column": 1,
"ending_column": 2
@ -573,7 +776,7 @@
"name": "T",
"source_mapping": {
"start": 692,
"length": 221,
"length": 253,
"filename_relative": "tests/detectors/naming-convention/0.6.11/naming_convention.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/naming-convention/0.6.11/naming_convention.sol",
@ -593,7 +796,9 @@
65,
66,
67,
68
68,
69,
70
],
"starting_column": 1,
"ending_column": 2
@ -715,16 +920,16 @@
"elements": [
{
"type": "variable",
"name": "l",
"name": "O",
"source_mapping": {
"start": 900,
"start": 916,
"length": 10,
"filename_relative": "tests/detectors/naming-convention/0.6.11/naming_convention.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/naming-convention/0.6.11/naming_convention.sol",
"is_dependency": false,
"lines": [
67
68
],
"starting_column": 5,
"ending_column": 15
@ -735,7 +940,7 @@
"name": "T",
"source_mapping": {
"start": 692,
"length": 221,
"length": 253,
"filename_relative": "tests/detectors/naming-convention/0.6.11/naming_convention.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/naming-convention/0.6.11/naming_convention.sol",
@ -755,7 +960,9 @@
65,
66,
67,
68
68,
69,
70
],
"starting_column": 1,
"ending_column": 2
@ -768,10 +975,10 @@
}
}
],
"description": "Variable T.l (tests/detectors/naming-convention/0.6.11/naming_convention.sol#67) used l, O, I, which should not be used\n",
"markdown": "Variable [T.l](tests/detectors/naming-convention/0.6.11/naming_convention.sol#L67) used l, O, I, which should not be used\n",
"first_markdown_element": "tests/detectors/naming-convention/0.6.11/naming_convention.sol#L67",
"id": "b595f9e6d03b8b501b7c4a9bf8ff0ad9bf11448a25f53d63ab5031c95f8ae89c",
"description": "Variable T.O (tests/detectors/naming-convention/0.6.11/naming_convention.sol#68) is single letter l, O, or I, which should not be used\n",
"markdown": "Variable [T.O](tests/detectors/naming-convention/0.6.11/naming_convention.sol#L68) is single letter l, O, or I, which should not be used\n",
"first_markdown_element": "tests/detectors/naming-convention/0.6.11/naming_convention.sol#L68",
"id": "b341001642225c62eae76fef9879c80003b3134b3bc627d9b1912ebcd190304b",
"check": "naming-convention",
"impact": "Informational",
"confidence": "High"
@ -975,6 +1182,73 @@
"impact": "Informational",
"confidence": "High"
},
{
"elements": [
{
"type": "variable",
"name": "l",
"source_mapping": {
"start": 900,
"length": 10,
"filename_relative": "tests/detectors/naming-convention/0.6.11/naming_convention.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/naming-convention/0.6.11/naming_convention.sol",
"is_dependency": false,
"lines": [
67
],
"starting_column": 5,
"ending_column": 15
},
"type_specific_fields": {
"parent": {
"type": "contract",
"name": "T",
"source_mapping": {
"start": 692,
"length": 253,
"filename_relative": "tests/detectors/naming-convention/0.6.11/naming_convention.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/naming-convention/0.6.11/naming_convention.sol",
"is_dependency": false,
"lines": [
54,
55,
56,
57,
58,
59,
60,
61,
62,
63,
64,
65,
66,
67,
68,
69,
70
],
"starting_column": 1,
"ending_column": 2
}
}
},
"additional_fields": {
"target": "variable",
"convention": "l_O_I_should_not_be_used"
}
}
],
"description": "Variable T.l (tests/detectors/naming-convention/0.6.11/naming_convention.sol#67) is single letter l, O, or I, which should not be used\n",
"markdown": "Variable [T.l](tests/detectors/naming-convention/0.6.11/naming_convention.sol#L67) is single letter l, O, or I, which should not be used\n",
"first_markdown_element": "tests/detectors/naming-convention/0.6.11/naming_convention.sol#L67",
"id": "cb8668afe6ed1284c935ac95f8f9cb1407f96226fe741e7310d104d5f10a0fc6",
"check": "naming-convention",
"impact": "Informational",
"confidence": "High"
},
{
"elements": [
{

@ -65,6 +65,8 @@ contract T {
uint constant M = 1;
uint l = 1;
uint O = 1;
uint I = 1;
}
contract ParameterNameEmptyString {

@ -98,6 +98,207 @@
"impact": "Informational",
"confidence": "High"
},
{
"elements": [
{
"type": "variable",
"name": "I",
"source_mapping": {
"start": 932,
"length": 10,
"filename_relative": "tests/detectors/naming-convention/0.7.6/naming_convention.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/naming-convention/0.7.6/naming_convention.sol",
"is_dependency": false,
"lines": [
69
],
"starting_column": 5,
"ending_column": 15
},
"type_specific_fields": {
"parent": {
"type": "contract",
"name": "T",
"source_mapping": {
"start": 692,
"length": 253,
"filename_relative": "tests/detectors/naming-convention/0.7.6/naming_convention.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/naming-convention/0.7.6/naming_convention.sol",
"is_dependency": false,
"lines": [
54,
55,
56,
57,
58,
59,
60,
61,
62,
63,
64,
65,
66,
67,
68,
69,
70
],
"starting_column": 1,
"ending_column": 2
}
}
},
"additional_fields": {
"target": "variable",
"convention": "mixedCase"
}
}
],
"description": "Variable T.I (tests/detectors/naming-convention/0.7.6/naming_convention.sol#69) is not in mixedCase\n",
"markdown": "Variable [T.I](tests/detectors/naming-convention/0.7.6/naming_convention.sol#L69) is not in mixedCase\n",
"first_markdown_element": "tests/detectors/naming-convention/0.7.6/naming_convention.sol#L69",
"id": "12df12bbda2059673d356e5c32ec4e8a037a3821c9fa42b831a9144437cb79f9",
"check": "naming-convention",
"impact": "Informational",
"confidence": "High"
},
{
"elements": [
{
"type": "variable",
"name": "I",
"source_mapping": {
"start": 932,
"length": 10,
"filename_relative": "tests/detectors/naming-convention/0.7.6/naming_convention.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/naming-convention/0.7.6/naming_convention.sol",
"is_dependency": false,
"lines": [
69
],
"starting_column": 5,
"ending_column": 15
},
"type_specific_fields": {
"parent": {
"type": "contract",
"name": "T",
"source_mapping": {
"start": 692,
"length": 253,
"filename_relative": "tests/detectors/naming-convention/0.7.6/naming_convention.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/naming-convention/0.7.6/naming_convention.sol",
"is_dependency": false,
"lines": [
54,
55,
56,
57,
58,
59,
60,
61,
62,
63,
64,
65,
66,
67,
68,
69,
70
],
"starting_column": 1,
"ending_column": 2
}
}
},
"additional_fields": {
"target": "variable",
"convention": "l_O_I_should_not_be_used"
}
}
],
"description": "Variable T.I (tests/detectors/naming-convention/0.7.6/naming_convention.sol#69) is single letter l, O, or I, which should not be used\n",
"markdown": "Variable [T.I](tests/detectors/naming-convention/0.7.6/naming_convention.sol#L69) is single letter l, O, or I, which should not be used\n",
"first_markdown_element": "tests/detectors/naming-convention/0.7.6/naming_convention.sol#L69",
"id": "2ac65aa5bb560436d64f16e164aaab90dbbf38d683bfdfdfb42eeb225fc51759",
"check": "naming-convention",
"impact": "Informational",
"confidence": "High"
},
{
"elements": [
{
"type": "variable",
"name": "O",
"source_mapping": {
"start": 916,
"length": 10,
"filename_relative": "tests/detectors/naming-convention/0.7.6/naming_convention.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/naming-convention/0.7.6/naming_convention.sol",
"is_dependency": false,
"lines": [
68
],
"starting_column": 5,
"ending_column": 15
},
"type_specific_fields": {
"parent": {
"type": "contract",
"name": "T",
"source_mapping": {
"start": 692,
"length": 253,
"filename_relative": "tests/detectors/naming-convention/0.7.6/naming_convention.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/naming-convention/0.7.6/naming_convention.sol",
"is_dependency": false,
"lines": [
54,
55,
56,
57,
58,
59,
60,
61,
62,
63,
64,
65,
66,
67,
68,
69,
70
],
"starting_column": 1,
"ending_column": 2
}
}
},
"additional_fields": {
"target": "variable",
"convention": "mixedCase"
}
}
],
"description": "Variable T.O (tests/detectors/naming-convention/0.7.6/naming_convention.sol#68) is not in mixedCase\n",
"markdown": "Variable [T.O](tests/detectors/naming-convention/0.7.6/naming_convention.sol#L68) is not in mixedCase\n",
"first_markdown_element": "tests/detectors/naming-convention/0.7.6/naming_convention.sol#L68",
"id": "2de986dda91f7c7e3a51470aa43abfa2c6fd363b742d1bbd38d5287ae179b83a",
"check": "naming-convention",
"impact": "Informational",
"confidence": "High"
},
{
"elements": [
{
@ -505,7 +706,7 @@
"name": "T",
"source_mapping": {
"start": 692,
"length": 221,
"length": 253,
"filename_relative": "tests/detectors/naming-convention/0.7.6/naming_convention.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/naming-convention/0.7.6/naming_convention.sol",
@ -525,7 +726,9 @@
65,
66,
67,
68
68,
69,
70
],
"starting_column": 1,
"ending_column": 2
@ -573,7 +776,7 @@
"name": "T",
"source_mapping": {
"start": 692,
"length": 221,
"length": 253,
"filename_relative": "tests/detectors/naming-convention/0.7.6/naming_convention.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/naming-convention/0.7.6/naming_convention.sol",
@ -593,7 +796,9 @@
65,
66,
67,
68
68,
69,
70
],
"starting_column": 1,
"ending_column": 2
@ -715,16 +920,16 @@
"elements": [
{
"type": "variable",
"name": "l",
"name": "O",
"source_mapping": {
"start": 900,
"start": 916,
"length": 10,
"filename_relative": "tests/detectors/naming-convention/0.7.6/naming_convention.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/naming-convention/0.7.6/naming_convention.sol",
"is_dependency": false,
"lines": [
67
68
],
"starting_column": 5,
"ending_column": 15
@ -735,7 +940,7 @@
"name": "T",
"source_mapping": {
"start": 692,
"length": 221,
"length": 253,
"filename_relative": "tests/detectors/naming-convention/0.7.6/naming_convention.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/naming-convention/0.7.6/naming_convention.sol",
@ -755,7 +960,9 @@
65,
66,
67,
68
68,
69,
70
],
"starting_column": 1,
"ending_column": 2
@ -768,10 +975,10 @@
}
}
],
"description": "Variable T.l (tests/detectors/naming-convention/0.7.6/naming_convention.sol#67) used l, O, I, which should not be used\n",
"markdown": "Variable [T.l](tests/detectors/naming-convention/0.7.6/naming_convention.sol#L67) used l, O, I, which should not be used\n",
"first_markdown_element": "tests/detectors/naming-convention/0.7.6/naming_convention.sol#L67",
"id": "b595f9e6d03b8b501b7c4a9bf8ff0ad9bf11448a25f53d63ab5031c95f8ae89c",
"description": "Variable T.O (tests/detectors/naming-convention/0.7.6/naming_convention.sol#68) is single letter l, O, or I, which should not be used\n",
"markdown": "Variable [T.O](tests/detectors/naming-convention/0.7.6/naming_convention.sol#L68) is single letter l, O, or I, which should not be used\n",
"first_markdown_element": "tests/detectors/naming-convention/0.7.6/naming_convention.sol#L68",
"id": "b341001642225c62eae76fef9879c80003b3134b3bc627d9b1912ebcd190304b",
"check": "naming-convention",
"impact": "Informational",
"confidence": "High"
@ -975,6 +1182,73 @@
"impact": "Informational",
"confidence": "High"
},
{
"elements": [
{
"type": "variable",
"name": "l",
"source_mapping": {
"start": 900,
"length": 10,
"filename_relative": "tests/detectors/naming-convention/0.7.6/naming_convention.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/naming-convention/0.7.6/naming_convention.sol",
"is_dependency": false,
"lines": [
67
],
"starting_column": 5,
"ending_column": 15
},
"type_specific_fields": {
"parent": {
"type": "contract",
"name": "T",
"source_mapping": {
"start": 692,
"length": 253,
"filename_relative": "tests/detectors/naming-convention/0.7.6/naming_convention.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/naming-convention/0.7.6/naming_convention.sol",
"is_dependency": false,
"lines": [
54,
55,
56,
57,
58,
59,
60,
61,
62,
63,
64,
65,
66,
67,
68,
69,
70
],
"starting_column": 1,
"ending_column": 2
}
}
},
"additional_fields": {
"target": "variable",
"convention": "l_O_I_should_not_be_used"
}
}
],
"description": "Variable T.l (tests/detectors/naming-convention/0.7.6/naming_convention.sol#67) is single letter l, O, or I, which should not be used\n",
"markdown": "Variable [T.l](tests/detectors/naming-convention/0.7.6/naming_convention.sol#L67) is single letter l, O, or I, which should not be used\n",
"first_markdown_element": "tests/detectors/naming-convention/0.7.6/naming_convention.sol#L67",
"id": "cb8668afe6ed1284c935ac95f8f9cb1407f96226fe741e7310d104d5f10a0fc6",
"check": "naming-convention",
"impact": "Informational",
"confidence": "High"
},
{
"elements": [
{

@ -0,0 +1,33 @@
contract VarReadUsingThis {
address public erc20;
mapping(uint => address) public myMap;
function bad1(uint x) external returns(address) {
return this.myMap(x);
}
function bad2() external returns(address) {
return this.erc20();
}
function bad3() external returns(address) {
if (this.erc20() == address(0)) revert();
}
function bad4() internal returns(address) {
for (uint x; x < 10; x++) {
address local = this.erc20();
}
}
function good1(uint x) external returns(address) {
return myMap[x];
}
function good2() external returns(address) {
return erc20;
}
function good3() external returns(address) {
if (erc20 == address(0)) revert();
}
function good4() internal returns(address) {
for (uint x; x < 10; x++) {
address local = erc20;
}
}
}

@ -0,0 +1,39 @@
contract VarReadUsingThis {
address public erc20;
mapping(uint => address) public myMap;
function bad1(uint x) external returns(address) {
return this.myMap(x);
}
function bad2() external returns(address) {
return this.erc20();
}
function bad3() external returns(address) {
if (this.erc20() == address(0)) revert();
}
function bad4() internal returns(address) {
for (uint x; x < 10; x++) {
address local = this.erc20();
}
}
function good1(uint x) external returns(address) {
return myMap[x];
}
function good2() external returns(address) {
return erc20;
}
function good3() external returns(address) {
if (erc20 == address(0)) revert();
}
function good4() internal returns(address) {
for (uint x; x < 10; x++) {
address local = erc20;
}
}
function mapExternal(uint x) external view returns(address) {
return myMap[x];
}
function good5(uint x) external returns(address) {
this.mapExternal(x);
}
}

@ -0,0 +1,736 @@
[
[
{
"elements": [
{
"type": "function",
"name": "bad3",
"source_mapping": {
"start": 275,
"length": 99,
"filename_relative": "tests/detectors/var-read-using-this/0.5.16/var_read_using_this.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/var-read-using-this/0.5.16/var_read_using_this.sol",
"is_dependency": false,
"lines": [
11,
12,
13
],
"starting_column": 5,
"ending_column": 6
},
"type_specific_fields": {
"parent": {
"type": "contract",
"name": "VarReadUsingThis",
"source_mapping": {
"start": 1,
"length": 1107,
"filename_relative": "tests/detectors/var-read-using-this/0.5.16/var_read_using_this.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/var-read-using-this/0.5.16/var_read_using_this.sol",
"is_dependency": false,
"lines": [
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,
28,
29,
30,
31,
32,
33,
34,
35,
36,
37,
38,
39
],
"starting_column": 1,
"ending_column": 2
}
},
"signature": "bad3()"
}
},
{
"type": "node",
"name": "this.erc20() == address(0)",
"source_mapping": {
"start": 331,
"length": 26,
"filename_relative": "tests/detectors/var-read-using-this/0.5.16/var_read_using_this.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/var-read-using-this/0.5.16/var_read_using_this.sol",
"is_dependency": false,
"lines": [
12
],
"starting_column": 13,
"ending_column": 39
},
"type_specific_fields": {
"parent": {
"type": "function",
"name": "bad3",
"source_mapping": {
"start": 275,
"length": 99,
"filename_relative": "tests/detectors/var-read-using-this/0.5.16/var_read_using_this.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/var-read-using-this/0.5.16/var_read_using_this.sol",
"is_dependency": false,
"lines": [
11,
12,
13
],
"starting_column": 5,
"ending_column": 6
},
"type_specific_fields": {
"parent": {
"type": "contract",
"name": "VarReadUsingThis",
"source_mapping": {
"start": 1,
"length": 1107,
"filename_relative": "tests/detectors/var-read-using-this/0.5.16/var_read_using_this.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/var-read-using-this/0.5.16/var_read_using_this.sol",
"is_dependency": false,
"lines": [
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,
28,
29,
30,
31,
32,
33,
34,
35,
36,
37,
38,
39
],
"starting_column": 1,
"ending_column": 2
}
},
"signature": "bad3()"
}
}
}
}
],
"description": "The function VarReadUsingThis.bad3() (tests/detectors/var-read-using-this/0.5.16/var_read_using_this.sol#11-13) reads this.erc20() == address(0) (tests/detectors/var-read-using-this/0.5.16/var_read_using_this.sol#12) with `this` which adds an extra STATICCALL.\n",
"markdown": "The function [VarReadUsingThis.bad3()](tests/detectors/var-read-using-this/0.5.16/var_read_using_this.sol#L11-L13) reads [this.erc20() == address(0)](tests/detectors/var-read-using-this/0.5.16/var_read_using_this.sol#L12) with `this` which adds an extra STATICCALL.\n",
"first_markdown_element": "tests/detectors/var-read-using-this/0.5.16/var_read_using_this.sol#L11-L13",
"id": "5556888563fa21301c242d57fbd8e08a35fc5d67171a88b9a2737c14be9c6f7f",
"check": "var-read-using-this",
"impact": "Optimization",
"confidence": "High"
},
{
"elements": [
{
"type": "function",
"name": "bad2",
"source_mapping": {
"start": 192,
"length": 78,
"filename_relative": "tests/detectors/var-read-using-this/0.5.16/var_read_using_this.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/var-read-using-this/0.5.16/var_read_using_this.sol",
"is_dependency": false,
"lines": [
8,
9,
10
],
"starting_column": 5,
"ending_column": 6
},
"type_specific_fields": {
"parent": {
"type": "contract",
"name": "VarReadUsingThis",
"source_mapping": {
"start": 1,
"length": 1107,
"filename_relative": "tests/detectors/var-read-using-this/0.5.16/var_read_using_this.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/var-read-using-this/0.5.16/var_read_using_this.sol",
"is_dependency": false,
"lines": [
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,
28,
29,
30,
31,
32,
33,
34,
35,
36,
37,
38,
39
],
"starting_column": 1,
"ending_column": 2
}
},
"signature": "bad2()"
}
},
{
"type": "node",
"name": "this.erc20()",
"source_mapping": {
"start": 244,
"length": 19,
"filename_relative": "tests/detectors/var-read-using-this/0.5.16/var_read_using_this.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/var-read-using-this/0.5.16/var_read_using_this.sol",
"is_dependency": false,
"lines": [
9
],
"starting_column": 9,
"ending_column": 28
},
"type_specific_fields": {
"parent": {
"type": "function",
"name": "bad2",
"source_mapping": {
"start": 192,
"length": 78,
"filename_relative": "tests/detectors/var-read-using-this/0.5.16/var_read_using_this.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/var-read-using-this/0.5.16/var_read_using_this.sol",
"is_dependency": false,
"lines": [
8,
9,
10
],
"starting_column": 5,
"ending_column": 6
},
"type_specific_fields": {
"parent": {
"type": "contract",
"name": "VarReadUsingThis",
"source_mapping": {
"start": 1,
"length": 1107,
"filename_relative": "tests/detectors/var-read-using-this/0.5.16/var_read_using_this.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/var-read-using-this/0.5.16/var_read_using_this.sol",
"is_dependency": false,
"lines": [
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,
28,
29,
30,
31,
32,
33,
34,
35,
36,
37,
38,
39
],
"starting_column": 1,
"ending_column": 2
}
},
"signature": "bad2()"
}
}
}
}
],
"description": "The function VarReadUsingThis.bad2() (tests/detectors/var-read-using-this/0.5.16/var_read_using_this.sol#8-10) reads this.erc20() (tests/detectors/var-read-using-this/0.5.16/var_read_using_this.sol#9) with `this` which adds an extra STATICCALL.\n",
"markdown": "The function [VarReadUsingThis.bad2()](tests/detectors/var-read-using-this/0.5.16/var_read_using_this.sol#L8-L10) reads [this.erc20()](tests/detectors/var-read-using-this/0.5.16/var_read_using_this.sol#L9) with `this` which adds an extra STATICCALL.\n",
"first_markdown_element": "tests/detectors/var-read-using-this/0.5.16/var_read_using_this.sol#L8-L10",
"id": "a55229af8750117389299ed9f759d5036882a2396a52087bb2a42c5ed8abaec1",
"check": "var-read-using-this",
"impact": "Optimization",
"confidence": "High"
},
{
"elements": [
{
"type": "function",
"name": "bad1",
"source_mapping": {
"start": 102,
"length": 85,
"filename_relative": "tests/detectors/var-read-using-this/0.5.16/var_read_using_this.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/var-read-using-this/0.5.16/var_read_using_this.sol",
"is_dependency": false,
"lines": [
5,
6,
7
],
"starting_column": 5,
"ending_column": 6
},
"type_specific_fields": {
"parent": {
"type": "contract",
"name": "VarReadUsingThis",
"source_mapping": {
"start": 1,
"length": 1107,
"filename_relative": "tests/detectors/var-read-using-this/0.5.16/var_read_using_this.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/var-read-using-this/0.5.16/var_read_using_this.sol",
"is_dependency": false,
"lines": [
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,
28,
29,
30,
31,
32,
33,
34,
35,
36,
37,
38,
39
],
"starting_column": 1,
"ending_column": 2
}
},
"signature": "bad1(uint256)"
}
},
{
"type": "node",
"name": "this.myMap(x)",
"source_mapping": {
"start": 160,
"length": 20,
"filename_relative": "tests/detectors/var-read-using-this/0.5.16/var_read_using_this.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/var-read-using-this/0.5.16/var_read_using_this.sol",
"is_dependency": false,
"lines": [
6
],
"starting_column": 9,
"ending_column": 29
},
"type_specific_fields": {
"parent": {
"type": "function",
"name": "bad1",
"source_mapping": {
"start": 102,
"length": 85,
"filename_relative": "tests/detectors/var-read-using-this/0.5.16/var_read_using_this.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/var-read-using-this/0.5.16/var_read_using_this.sol",
"is_dependency": false,
"lines": [
5,
6,
7
],
"starting_column": 5,
"ending_column": 6
},
"type_specific_fields": {
"parent": {
"type": "contract",
"name": "VarReadUsingThis",
"source_mapping": {
"start": 1,
"length": 1107,
"filename_relative": "tests/detectors/var-read-using-this/0.5.16/var_read_using_this.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/var-read-using-this/0.5.16/var_read_using_this.sol",
"is_dependency": false,
"lines": [
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,
28,
29,
30,
31,
32,
33,
34,
35,
36,
37,
38,
39
],
"starting_column": 1,
"ending_column": 2
}
},
"signature": "bad1(uint256)"
}
}
}
}
],
"description": "The function VarReadUsingThis.bad1(uint256) (tests/detectors/var-read-using-this/0.5.16/var_read_using_this.sol#5-7) reads this.myMap(x) (tests/detectors/var-read-using-this/0.5.16/var_read_using_this.sol#6) with `this` which adds an extra STATICCALL.\n",
"markdown": "The function [VarReadUsingThis.bad1(uint256)](tests/detectors/var-read-using-this/0.5.16/var_read_using_this.sol#L5-L7) reads [this.myMap(x)](tests/detectors/var-read-using-this/0.5.16/var_read_using_this.sol#L6) with `this` which adds an extra STATICCALL.\n",
"first_markdown_element": "tests/detectors/var-read-using-this/0.5.16/var_read_using_this.sol#L5-L7",
"id": "e810f17bcfdf391a48e66ef70c4aafcc205c882b28d0588b26f1d45742580df6",
"check": "var-read-using-this",
"impact": "Optimization",
"confidence": "High"
},
{
"elements": [
{
"type": "function",
"name": "bad4",
"source_mapping": {
"start": 379,
"length": 138,
"filename_relative": "tests/detectors/var-read-using-this/0.5.16/var_read_using_this.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/var-read-using-this/0.5.16/var_read_using_this.sol",
"is_dependency": false,
"lines": [
14,
15,
16,
17,
18
],
"starting_column": 5,
"ending_column": 6
},
"type_specific_fields": {
"parent": {
"type": "contract",
"name": "VarReadUsingThis",
"source_mapping": {
"start": 1,
"length": 1107,
"filename_relative": "tests/detectors/var-read-using-this/0.5.16/var_read_using_this.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/var-read-using-this/0.5.16/var_read_using_this.sol",
"is_dependency": false,
"lines": [
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,
28,
29,
30,
31,
32,
33,
34,
35,
36,
37,
38,
39
],
"starting_column": 1,
"ending_column": 2
}
},
"signature": "bad4()"
}
},
{
"type": "node",
"name": "local = this.erc20()",
"source_mapping": {
"start": 471,
"length": 28,
"filename_relative": "tests/detectors/var-read-using-this/0.5.16/var_read_using_this.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/var-read-using-this/0.5.16/var_read_using_this.sol",
"is_dependency": false,
"lines": [
16
],
"starting_column": 13,
"ending_column": 41
},
"type_specific_fields": {
"parent": {
"type": "function",
"name": "bad4",
"source_mapping": {
"start": 379,
"length": 138,
"filename_relative": "tests/detectors/var-read-using-this/0.5.16/var_read_using_this.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/var-read-using-this/0.5.16/var_read_using_this.sol",
"is_dependency": false,
"lines": [
14,
15,
16,
17,
18
],
"starting_column": 5,
"ending_column": 6
},
"type_specific_fields": {
"parent": {
"type": "contract",
"name": "VarReadUsingThis",
"source_mapping": {
"start": 1,
"length": 1107,
"filename_relative": "tests/detectors/var-read-using-this/0.5.16/var_read_using_this.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/var-read-using-this/0.5.16/var_read_using_this.sol",
"is_dependency": false,
"lines": [
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,
28,
29,
30,
31,
32,
33,
34,
35,
36,
37,
38,
39
],
"starting_column": 1,
"ending_column": 2
}
},
"signature": "bad4()"
}
}
}
}
],
"description": "The function VarReadUsingThis.bad4() (tests/detectors/var-read-using-this/0.5.16/var_read_using_this.sol#14-18) reads local = this.erc20() (tests/detectors/var-read-using-this/0.5.16/var_read_using_this.sol#16) with `this` which adds an extra STATICCALL.\n",
"markdown": "The function [VarReadUsingThis.bad4()](tests/detectors/var-read-using-this/0.5.16/var_read_using_this.sol#L14-L18) reads [local = this.erc20()](tests/detectors/var-read-using-this/0.5.16/var_read_using_this.sol#L16) with `this` which adds an extra STATICCALL.\n",
"first_markdown_element": "tests/detectors/var-read-using-this/0.5.16/var_read_using_this.sol#L14-L18",
"id": "fe997df3fdea17b13139a239ecdcdb64a2f6482aa9dacc62f845ef30591c8e4c",
"check": "var-read-using-this",
"impact": "Optimization",
"confidence": "High"
}
]
]

@ -0,0 +1,39 @@
contract VarReadUsingThis {
address public erc20;
mapping(uint => address) public myMap;
function bad1(uint x) external returns(address) {
return this.myMap(x);
}
function bad2() external returns(address) {
return this.erc20();
}
function bad3() external returns(address) {
if (this.erc20() == address(0)) revert();
}
function bad4() internal returns(address) {
for (uint x; x < 10; x++) {
address local = this.erc20();
}
}
function good1(uint x) external returns(address) {
return myMap[x];
}
function good2() external returns(address) {
return erc20;
}
function good3() external returns(address) {
if (erc20 == address(0)) revert();
}
function good4() internal returns(address) {
for (uint x; x < 10; x++) {
address local = erc20;
}
}
function mapExternal(uint x) external view returns(address) {
return myMap[x];
}
function good5(uint x) external returns(address) {
this.mapExternal(x);
}
}

@ -0,0 +1,736 @@
[
[
{
"elements": [
{
"type": "function",
"name": "bad3",
"source_mapping": {
"start": 275,
"length": 99,
"filename_relative": "tests/detectors/var-read-using-this/0.6.11/var_read_using_this.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/var-read-using-this/0.6.11/var_read_using_this.sol",
"is_dependency": false,
"lines": [
11,
12,
13
],
"starting_column": 5,
"ending_column": 6
},
"type_specific_fields": {
"parent": {
"type": "contract",
"name": "VarReadUsingThis",
"source_mapping": {
"start": 1,
"length": 1103,
"filename_relative": "tests/detectors/var-read-using-this/0.6.11/var_read_using_this.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/var-read-using-this/0.6.11/var_read_using_this.sol",
"is_dependency": false,
"lines": [
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,
28,
29,
30,
31,
32,
33,
34,
35,
36,
37,
38,
39
],
"starting_column": 1,
"ending_column": 2
}
},
"signature": "bad3()"
}
},
{
"type": "node",
"name": "this.erc20() == address(0)",
"source_mapping": {
"start": 331,
"length": 26,
"filename_relative": "tests/detectors/var-read-using-this/0.6.11/var_read_using_this.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/var-read-using-this/0.6.11/var_read_using_this.sol",
"is_dependency": false,
"lines": [
12
],
"starting_column": 13,
"ending_column": 39
},
"type_specific_fields": {
"parent": {
"type": "function",
"name": "bad3",
"source_mapping": {
"start": 275,
"length": 99,
"filename_relative": "tests/detectors/var-read-using-this/0.6.11/var_read_using_this.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/var-read-using-this/0.6.11/var_read_using_this.sol",
"is_dependency": false,
"lines": [
11,
12,
13
],
"starting_column": 5,
"ending_column": 6
},
"type_specific_fields": {
"parent": {
"type": "contract",
"name": "VarReadUsingThis",
"source_mapping": {
"start": 1,
"length": 1103,
"filename_relative": "tests/detectors/var-read-using-this/0.6.11/var_read_using_this.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/var-read-using-this/0.6.11/var_read_using_this.sol",
"is_dependency": false,
"lines": [
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,
28,
29,
30,
31,
32,
33,
34,
35,
36,
37,
38,
39
],
"starting_column": 1,
"ending_column": 2
}
},
"signature": "bad3()"
}
}
}
}
],
"description": "The function VarReadUsingThis.bad3() (tests/detectors/var-read-using-this/0.6.11/var_read_using_this.sol#11-13) reads this.erc20() == address(0) (tests/detectors/var-read-using-this/0.6.11/var_read_using_this.sol#12) with `this` which adds an extra STATICCALL.\n",
"markdown": "The function [VarReadUsingThis.bad3()](tests/detectors/var-read-using-this/0.6.11/var_read_using_this.sol#L11-L13) reads [this.erc20() == address(0)](tests/detectors/var-read-using-this/0.6.11/var_read_using_this.sol#L12) with `this` which adds an extra STATICCALL.\n",
"first_markdown_element": "tests/detectors/var-read-using-this/0.6.11/var_read_using_this.sol#L11-L13",
"id": "314f90a4989ea75cc274e1f5f46036968c2ecdaaf8fa84913e7db4ef1ffe5bb8",
"check": "var-read-using-this",
"impact": "Optimization",
"confidence": "High"
},
{
"elements": [
{
"type": "function",
"name": "bad4",
"source_mapping": {
"start": 379,
"length": 138,
"filename_relative": "tests/detectors/var-read-using-this/0.6.11/var_read_using_this.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/var-read-using-this/0.6.11/var_read_using_this.sol",
"is_dependency": false,
"lines": [
14,
15,
16,
17,
18
],
"starting_column": 5,
"ending_column": 6
},
"type_specific_fields": {
"parent": {
"type": "contract",
"name": "VarReadUsingThis",
"source_mapping": {
"start": 1,
"length": 1103,
"filename_relative": "tests/detectors/var-read-using-this/0.6.11/var_read_using_this.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/var-read-using-this/0.6.11/var_read_using_this.sol",
"is_dependency": false,
"lines": [
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,
28,
29,
30,
31,
32,
33,
34,
35,
36,
37,
38,
39
],
"starting_column": 1,
"ending_column": 2
}
},
"signature": "bad4()"
}
},
{
"type": "node",
"name": "local = this.erc20()",
"source_mapping": {
"start": 471,
"length": 28,
"filename_relative": "tests/detectors/var-read-using-this/0.6.11/var_read_using_this.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/var-read-using-this/0.6.11/var_read_using_this.sol",
"is_dependency": false,
"lines": [
16
],
"starting_column": 13,
"ending_column": 41
},
"type_specific_fields": {
"parent": {
"type": "function",
"name": "bad4",
"source_mapping": {
"start": 379,
"length": 138,
"filename_relative": "tests/detectors/var-read-using-this/0.6.11/var_read_using_this.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/var-read-using-this/0.6.11/var_read_using_this.sol",
"is_dependency": false,
"lines": [
14,
15,
16,
17,
18
],
"starting_column": 5,
"ending_column": 6
},
"type_specific_fields": {
"parent": {
"type": "contract",
"name": "VarReadUsingThis",
"source_mapping": {
"start": 1,
"length": 1103,
"filename_relative": "tests/detectors/var-read-using-this/0.6.11/var_read_using_this.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/var-read-using-this/0.6.11/var_read_using_this.sol",
"is_dependency": false,
"lines": [
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,
28,
29,
30,
31,
32,
33,
34,
35,
36,
37,
38,
39
],
"starting_column": 1,
"ending_column": 2
}
},
"signature": "bad4()"
}
}
}
}
],
"description": "The function VarReadUsingThis.bad4() (tests/detectors/var-read-using-this/0.6.11/var_read_using_this.sol#14-18) reads local = this.erc20() (tests/detectors/var-read-using-this/0.6.11/var_read_using_this.sol#16) with `this` which adds an extra STATICCALL.\n",
"markdown": "The function [VarReadUsingThis.bad4()](tests/detectors/var-read-using-this/0.6.11/var_read_using_this.sol#L14-L18) reads [local = this.erc20()](tests/detectors/var-read-using-this/0.6.11/var_read_using_this.sol#L16) with `this` which adds an extra STATICCALL.\n",
"first_markdown_element": "tests/detectors/var-read-using-this/0.6.11/var_read_using_this.sol#L14-L18",
"id": "5fd3f1f78f3532107d7e111d84310f3a0fa374fa407e43951d70fd00a752f76f",
"check": "var-read-using-this",
"impact": "Optimization",
"confidence": "High"
},
{
"elements": [
{
"type": "function",
"name": "bad1",
"source_mapping": {
"start": 102,
"length": 85,
"filename_relative": "tests/detectors/var-read-using-this/0.6.11/var_read_using_this.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/var-read-using-this/0.6.11/var_read_using_this.sol",
"is_dependency": false,
"lines": [
5,
6,
7
],
"starting_column": 5,
"ending_column": 6
},
"type_specific_fields": {
"parent": {
"type": "contract",
"name": "VarReadUsingThis",
"source_mapping": {
"start": 1,
"length": 1103,
"filename_relative": "tests/detectors/var-read-using-this/0.6.11/var_read_using_this.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/var-read-using-this/0.6.11/var_read_using_this.sol",
"is_dependency": false,
"lines": [
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,
28,
29,
30,
31,
32,
33,
34,
35,
36,
37,
38,
39
],
"starting_column": 1,
"ending_column": 2
}
},
"signature": "bad1(uint256)"
}
},
{
"type": "node",
"name": "this.myMap(x)",
"source_mapping": {
"start": 160,
"length": 20,
"filename_relative": "tests/detectors/var-read-using-this/0.6.11/var_read_using_this.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/var-read-using-this/0.6.11/var_read_using_this.sol",
"is_dependency": false,
"lines": [
6
],
"starting_column": 9,
"ending_column": 29
},
"type_specific_fields": {
"parent": {
"type": "function",
"name": "bad1",
"source_mapping": {
"start": 102,
"length": 85,
"filename_relative": "tests/detectors/var-read-using-this/0.6.11/var_read_using_this.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/var-read-using-this/0.6.11/var_read_using_this.sol",
"is_dependency": false,
"lines": [
5,
6,
7
],
"starting_column": 5,
"ending_column": 6
},
"type_specific_fields": {
"parent": {
"type": "contract",
"name": "VarReadUsingThis",
"source_mapping": {
"start": 1,
"length": 1103,
"filename_relative": "tests/detectors/var-read-using-this/0.6.11/var_read_using_this.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/var-read-using-this/0.6.11/var_read_using_this.sol",
"is_dependency": false,
"lines": [
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,
28,
29,
30,
31,
32,
33,
34,
35,
36,
37,
38,
39
],
"starting_column": 1,
"ending_column": 2
}
},
"signature": "bad1(uint256)"
}
}
}
}
],
"description": "The function VarReadUsingThis.bad1(uint256) (tests/detectors/var-read-using-this/0.6.11/var_read_using_this.sol#5-7) reads this.myMap(x) (tests/detectors/var-read-using-this/0.6.11/var_read_using_this.sol#6) with `this` which adds an extra STATICCALL.\n",
"markdown": "The function [VarReadUsingThis.bad1(uint256)](tests/detectors/var-read-using-this/0.6.11/var_read_using_this.sol#L5-L7) reads [this.myMap(x)](tests/detectors/var-read-using-this/0.6.11/var_read_using_this.sol#L6) with `this` which adds an extra STATICCALL.\n",
"first_markdown_element": "tests/detectors/var-read-using-this/0.6.11/var_read_using_this.sol#L5-L7",
"id": "a30c3d8ddb468d865fa69afe5b7b83164fc1a332933d4661765cc3781896c7cf",
"check": "var-read-using-this",
"impact": "Optimization",
"confidence": "High"
},
{
"elements": [
{
"type": "function",
"name": "bad2",
"source_mapping": {
"start": 192,
"length": 78,
"filename_relative": "tests/detectors/var-read-using-this/0.6.11/var_read_using_this.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/var-read-using-this/0.6.11/var_read_using_this.sol",
"is_dependency": false,
"lines": [
8,
9,
10
],
"starting_column": 5,
"ending_column": 6
},
"type_specific_fields": {
"parent": {
"type": "contract",
"name": "VarReadUsingThis",
"source_mapping": {
"start": 1,
"length": 1103,
"filename_relative": "tests/detectors/var-read-using-this/0.6.11/var_read_using_this.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/var-read-using-this/0.6.11/var_read_using_this.sol",
"is_dependency": false,
"lines": [
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,
28,
29,
30,
31,
32,
33,
34,
35,
36,
37,
38,
39
],
"starting_column": 1,
"ending_column": 2
}
},
"signature": "bad2()"
}
},
{
"type": "node",
"name": "this.erc20()",
"source_mapping": {
"start": 244,
"length": 19,
"filename_relative": "tests/detectors/var-read-using-this/0.6.11/var_read_using_this.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/var-read-using-this/0.6.11/var_read_using_this.sol",
"is_dependency": false,
"lines": [
9
],
"starting_column": 9,
"ending_column": 28
},
"type_specific_fields": {
"parent": {
"type": "function",
"name": "bad2",
"source_mapping": {
"start": 192,
"length": 78,
"filename_relative": "tests/detectors/var-read-using-this/0.6.11/var_read_using_this.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/var-read-using-this/0.6.11/var_read_using_this.sol",
"is_dependency": false,
"lines": [
8,
9,
10
],
"starting_column": 5,
"ending_column": 6
},
"type_specific_fields": {
"parent": {
"type": "contract",
"name": "VarReadUsingThis",
"source_mapping": {
"start": 1,
"length": 1103,
"filename_relative": "tests/detectors/var-read-using-this/0.6.11/var_read_using_this.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/var-read-using-this/0.6.11/var_read_using_this.sol",
"is_dependency": false,
"lines": [
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,
28,
29,
30,
31,
32,
33,
34,
35,
36,
37,
38,
39
],
"starting_column": 1,
"ending_column": 2
}
},
"signature": "bad2()"
}
}
}
}
],
"description": "The function VarReadUsingThis.bad2() (tests/detectors/var-read-using-this/0.6.11/var_read_using_this.sol#8-10) reads this.erc20() (tests/detectors/var-read-using-this/0.6.11/var_read_using_this.sol#9) with `this` which adds an extra STATICCALL.\n",
"markdown": "The function [VarReadUsingThis.bad2()](tests/detectors/var-read-using-this/0.6.11/var_read_using_this.sol#L8-L10) reads [this.erc20()](tests/detectors/var-read-using-this/0.6.11/var_read_using_this.sol#L9) with `this` which adds an extra STATICCALL.\n",
"first_markdown_element": "tests/detectors/var-read-using-this/0.6.11/var_read_using_this.sol#L8-L10",
"id": "ccc77ba655d341c0461ca4f4040afe19c379b2333e52648b12f793aaf7f0ead8",
"check": "var-read-using-this",
"impact": "Optimization",
"confidence": "High"
}
]
]

@ -0,0 +1,39 @@
contract VarReadUsingThis {
address public erc20;
mapping(uint => address) public myMap;
function bad1(uint x) external returns(address) {
return this.myMap(x);
}
function bad2() external returns(address) {
return this.erc20();
}
function bad3() external returns(address) {
if (this.erc20() == address(0)) revert();
}
function bad4() internal returns(address) {
for (uint x; x < 10; x++) {
address local = this.erc20();
}
}
function good1(uint x) external returns(address) {
return myMap[x];
}
function good2() external returns(address) {
return erc20;
}
function good3() external returns(address) {
if (erc20 == address(0)) revert();
}
function good4() internal returns(address) {
for (uint x; x < 10; x++) {
address local = erc20;
}
}
function mapExternal(uint x) external view returns(address) {
return myMap[x];
}
function good5(uint x) external returns(address) {
this.mapExternal(x);
}
}

@ -0,0 +1,736 @@
[
[
{
"elements": [
{
"type": "function",
"name": "bad3",
"source_mapping": {
"start": 275,
"length": 99,
"filename_relative": "tests/detectors/var-read-using-this/0.7.6/var_read_using_this.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/var-read-using-this/0.7.6/var_read_using_this.sol",
"is_dependency": false,
"lines": [
11,
12,
13
],
"starting_column": 5,
"ending_column": 6
},
"type_specific_fields": {
"parent": {
"type": "contract",
"name": "VarReadUsingThis",
"source_mapping": {
"start": 1,
"length": 1103,
"filename_relative": "tests/detectors/var-read-using-this/0.7.6/var_read_using_this.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/var-read-using-this/0.7.6/var_read_using_this.sol",
"is_dependency": false,
"lines": [
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,
28,
29,
30,
31,
32,
33,
34,
35,
36,
37,
38,
39
],
"starting_column": 1,
"ending_column": 2
}
},
"signature": "bad3()"
}
},
{
"type": "node",
"name": "this.erc20() == address(0)",
"source_mapping": {
"start": 331,
"length": 26,
"filename_relative": "tests/detectors/var-read-using-this/0.7.6/var_read_using_this.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/var-read-using-this/0.7.6/var_read_using_this.sol",
"is_dependency": false,
"lines": [
12
],
"starting_column": 13,
"ending_column": 39
},
"type_specific_fields": {
"parent": {
"type": "function",
"name": "bad3",
"source_mapping": {
"start": 275,
"length": 99,
"filename_relative": "tests/detectors/var-read-using-this/0.7.6/var_read_using_this.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/var-read-using-this/0.7.6/var_read_using_this.sol",
"is_dependency": false,
"lines": [
11,
12,
13
],
"starting_column": 5,
"ending_column": 6
},
"type_specific_fields": {
"parent": {
"type": "contract",
"name": "VarReadUsingThis",
"source_mapping": {
"start": 1,
"length": 1103,
"filename_relative": "tests/detectors/var-read-using-this/0.7.6/var_read_using_this.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/var-read-using-this/0.7.6/var_read_using_this.sol",
"is_dependency": false,
"lines": [
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,
28,
29,
30,
31,
32,
33,
34,
35,
36,
37,
38,
39
],
"starting_column": 1,
"ending_column": 2
}
},
"signature": "bad3()"
}
}
}
}
],
"description": "The function VarReadUsingThis.bad3() (tests/detectors/var-read-using-this/0.7.6/var_read_using_this.sol#11-13) reads this.erc20() == address(0) (tests/detectors/var-read-using-this/0.7.6/var_read_using_this.sol#12) with `this` which adds an extra STATICCALL.\n",
"markdown": "The function [VarReadUsingThis.bad3()](tests/detectors/var-read-using-this/0.7.6/var_read_using_this.sol#L11-L13) reads [this.erc20() == address(0)](tests/detectors/var-read-using-this/0.7.6/var_read_using_this.sol#L12) with `this` which adds an extra STATICCALL.\n",
"first_markdown_element": "tests/detectors/var-read-using-this/0.7.6/var_read_using_this.sol#L11-L13",
"id": "1a8ed403cb8c6104a99c9dabdfb64e55282eaedf2c2d8b20fd3b366c49443639",
"check": "var-read-using-this",
"impact": "Optimization",
"confidence": "High"
},
{
"elements": [
{
"type": "function",
"name": "bad2",
"source_mapping": {
"start": 192,
"length": 78,
"filename_relative": "tests/detectors/var-read-using-this/0.7.6/var_read_using_this.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/var-read-using-this/0.7.6/var_read_using_this.sol",
"is_dependency": false,
"lines": [
8,
9,
10
],
"starting_column": 5,
"ending_column": 6
},
"type_specific_fields": {
"parent": {
"type": "contract",
"name": "VarReadUsingThis",
"source_mapping": {
"start": 1,
"length": 1103,
"filename_relative": "tests/detectors/var-read-using-this/0.7.6/var_read_using_this.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/var-read-using-this/0.7.6/var_read_using_this.sol",
"is_dependency": false,
"lines": [
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,
28,
29,
30,
31,
32,
33,
34,
35,
36,
37,
38,
39
],
"starting_column": 1,
"ending_column": 2
}
},
"signature": "bad2()"
}
},
{
"type": "node",
"name": "this.erc20()",
"source_mapping": {
"start": 244,
"length": 19,
"filename_relative": "tests/detectors/var-read-using-this/0.7.6/var_read_using_this.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/var-read-using-this/0.7.6/var_read_using_this.sol",
"is_dependency": false,
"lines": [
9
],
"starting_column": 9,
"ending_column": 28
},
"type_specific_fields": {
"parent": {
"type": "function",
"name": "bad2",
"source_mapping": {
"start": 192,
"length": 78,
"filename_relative": "tests/detectors/var-read-using-this/0.7.6/var_read_using_this.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/var-read-using-this/0.7.6/var_read_using_this.sol",
"is_dependency": false,
"lines": [
8,
9,
10
],
"starting_column": 5,
"ending_column": 6
},
"type_specific_fields": {
"parent": {
"type": "contract",
"name": "VarReadUsingThis",
"source_mapping": {
"start": 1,
"length": 1103,
"filename_relative": "tests/detectors/var-read-using-this/0.7.6/var_read_using_this.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/var-read-using-this/0.7.6/var_read_using_this.sol",
"is_dependency": false,
"lines": [
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,
28,
29,
30,
31,
32,
33,
34,
35,
36,
37,
38,
39
],
"starting_column": 1,
"ending_column": 2
}
},
"signature": "bad2()"
}
}
}
}
],
"description": "The function VarReadUsingThis.bad2() (tests/detectors/var-read-using-this/0.7.6/var_read_using_this.sol#8-10) reads this.erc20() (tests/detectors/var-read-using-this/0.7.6/var_read_using_this.sol#9) with `this` which adds an extra STATICCALL.\n",
"markdown": "The function [VarReadUsingThis.bad2()](tests/detectors/var-read-using-this/0.7.6/var_read_using_this.sol#L8-L10) reads [this.erc20()](tests/detectors/var-read-using-this/0.7.6/var_read_using_this.sol#L9) with `this` which adds an extra STATICCALL.\n",
"first_markdown_element": "tests/detectors/var-read-using-this/0.7.6/var_read_using_this.sol#L8-L10",
"id": "5bddf45a7f968094e163217be36e0cf17b7455740755eec53a1e7b0a44fe63ac",
"check": "var-read-using-this",
"impact": "Optimization",
"confidence": "High"
},
{
"elements": [
{
"type": "function",
"name": "bad1",
"source_mapping": {
"start": 102,
"length": 85,
"filename_relative": "tests/detectors/var-read-using-this/0.7.6/var_read_using_this.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/var-read-using-this/0.7.6/var_read_using_this.sol",
"is_dependency": false,
"lines": [
5,
6,
7
],
"starting_column": 5,
"ending_column": 6
},
"type_specific_fields": {
"parent": {
"type": "contract",
"name": "VarReadUsingThis",
"source_mapping": {
"start": 1,
"length": 1103,
"filename_relative": "tests/detectors/var-read-using-this/0.7.6/var_read_using_this.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/var-read-using-this/0.7.6/var_read_using_this.sol",
"is_dependency": false,
"lines": [
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,
28,
29,
30,
31,
32,
33,
34,
35,
36,
37,
38,
39
],
"starting_column": 1,
"ending_column": 2
}
},
"signature": "bad1(uint256)"
}
},
{
"type": "node",
"name": "this.myMap(x)",
"source_mapping": {
"start": 160,
"length": 20,
"filename_relative": "tests/detectors/var-read-using-this/0.7.6/var_read_using_this.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/var-read-using-this/0.7.6/var_read_using_this.sol",
"is_dependency": false,
"lines": [
6
],
"starting_column": 9,
"ending_column": 29
},
"type_specific_fields": {
"parent": {
"type": "function",
"name": "bad1",
"source_mapping": {
"start": 102,
"length": 85,
"filename_relative": "tests/detectors/var-read-using-this/0.7.6/var_read_using_this.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/var-read-using-this/0.7.6/var_read_using_this.sol",
"is_dependency": false,
"lines": [
5,
6,
7
],
"starting_column": 5,
"ending_column": 6
},
"type_specific_fields": {
"parent": {
"type": "contract",
"name": "VarReadUsingThis",
"source_mapping": {
"start": 1,
"length": 1103,
"filename_relative": "tests/detectors/var-read-using-this/0.7.6/var_read_using_this.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/var-read-using-this/0.7.6/var_read_using_this.sol",
"is_dependency": false,
"lines": [
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,
28,
29,
30,
31,
32,
33,
34,
35,
36,
37,
38,
39
],
"starting_column": 1,
"ending_column": 2
}
},
"signature": "bad1(uint256)"
}
}
}
}
],
"description": "The function VarReadUsingThis.bad1(uint256) (tests/detectors/var-read-using-this/0.7.6/var_read_using_this.sol#5-7) reads this.myMap(x) (tests/detectors/var-read-using-this/0.7.6/var_read_using_this.sol#6) with `this` which adds an extra STATICCALL.\n",
"markdown": "The function [VarReadUsingThis.bad1(uint256)](tests/detectors/var-read-using-this/0.7.6/var_read_using_this.sol#L5-L7) reads [this.myMap(x)](tests/detectors/var-read-using-this/0.7.6/var_read_using_this.sol#L6) with `this` which adds an extra STATICCALL.\n",
"first_markdown_element": "tests/detectors/var-read-using-this/0.7.6/var_read_using_this.sol#L5-L7",
"id": "924c227bf74e70dda261578563193b90b60b70a1ad043716e1d98cbc49b87ceb",
"check": "var-read-using-this",
"impact": "Optimization",
"confidence": "High"
},
{
"elements": [
{
"type": "function",
"name": "bad4",
"source_mapping": {
"start": 379,
"length": 138,
"filename_relative": "tests/detectors/var-read-using-this/0.7.6/var_read_using_this.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/var-read-using-this/0.7.6/var_read_using_this.sol",
"is_dependency": false,
"lines": [
14,
15,
16,
17,
18
],
"starting_column": 5,
"ending_column": 6
},
"type_specific_fields": {
"parent": {
"type": "contract",
"name": "VarReadUsingThis",
"source_mapping": {
"start": 1,
"length": 1103,
"filename_relative": "tests/detectors/var-read-using-this/0.7.6/var_read_using_this.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/var-read-using-this/0.7.6/var_read_using_this.sol",
"is_dependency": false,
"lines": [
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,
28,
29,
30,
31,
32,
33,
34,
35,
36,
37,
38,
39
],
"starting_column": 1,
"ending_column": 2
}
},
"signature": "bad4()"
}
},
{
"type": "node",
"name": "local = this.erc20()",
"source_mapping": {
"start": 471,
"length": 28,
"filename_relative": "tests/detectors/var-read-using-this/0.7.6/var_read_using_this.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/var-read-using-this/0.7.6/var_read_using_this.sol",
"is_dependency": false,
"lines": [
16
],
"starting_column": 13,
"ending_column": 41
},
"type_specific_fields": {
"parent": {
"type": "function",
"name": "bad4",
"source_mapping": {
"start": 379,
"length": 138,
"filename_relative": "tests/detectors/var-read-using-this/0.7.6/var_read_using_this.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/var-read-using-this/0.7.6/var_read_using_this.sol",
"is_dependency": false,
"lines": [
14,
15,
16,
17,
18
],
"starting_column": 5,
"ending_column": 6
},
"type_specific_fields": {
"parent": {
"type": "contract",
"name": "VarReadUsingThis",
"source_mapping": {
"start": 1,
"length": 1103,
"filename_relative": "tests/detectors/var-read-using-this/0.7.6/var_read_using_this.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/var-read-using-this/0.7.6/var_read_using_this.sol",
"is_dependency": false,
"lines": [
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,
28,
29,
30,
31,
32,
33,
34,
35,
36,
37,
38,
39
],
"starting_column": 1,
"ending_column": 2
}
},
"signature": "bad4()"
}
}
}
}
],
"description": "The function VarReadUsingThis.bad4() (tests/detectors/var-read-using-this/0.7.6/var_read_using_this.sol#14-18) reads local = this.erc20() (tests/detectors/var-read-using-this/0.7.6/var_read_using_this.sol#16) with `this` which adds an extra STATICCALL.\n",
"markdown": "The function [VarReadUsingThis.bad4()](tests/detectors/var-read-using-this/0.7.6/var_read_using_this.sol#L14-L18) reads [local = this.erc20()](tests/detectors/var-read-using-this/0.7.6/var_read_using_this.sol#L16) with `this` which adds an extra STATICCALL.\n",
"first_markdown_element": "tests/detectors/var-read-using-this/0.7.6/var_read_using_this.sol#L14-L18",
"id": "e9b34de7b565a0e63e55b9c74eaf9a265c7f4c8ef866d7b7db17b815393f0477",
"check": "var-read-using-this",
"impact": "Optimization",
"confidence": "High"
}
]
]

@ -0,0 +1,39 @@
contract VarReadUsingThis {
address public erc20;
mapping(uint => address) public myMap;
function bad1(uint x) external returns(address) {
return this.myMap(x);
}
function bad2() external returns(address) {
return this.erc20();
}
function bad3() external returns(address) {
if (this.erc20() == address(0)) revert();
}
function bad4() internal returns(address) {
for (uint x; x < 10; x++) {
address local = this.erc20();
}
}
function good1(uint x) external returns(address) {
return myMap[x];
}
function good2() external returns(address) {
return erc20;
}
function good3() external returns(address) {
if (erc20 == address(0)) revert();
}
function good4() internal returns(address) {
for (uint x; x < 10; x++) {
address local = erc20;
}
}
function mapExternal(uint x) external view returns(address) {
return myMap[x];
}
function good5(uint x) external returns(address) {
this.mapExternal(x);
}
}

@ -0,0 +1,736 @@
[
[
{
"elements": [
{
"type": "function",
"name": "bad2",
"source_mapping": {
"start": 192,
"length": 78,
"filename_relative": "tests/detectors/var-read-using-this/0.8.15/var_read_using_this.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/var-read-using-this/0.8.15/var_read_using_this.sol",
"is_dependency": false,
"lines": [
8,
9,
10
],
"starting_column": 5,
"ending_column": 6
},
"type_specific_fields": {
"parent": {
"type": "contract",
"name": "VarReadUsingThis",
"source_mapping": {
"start": 1,
"length": 1103,
"filename_relative": "tests/detectors/var-read-using-this/0.8.15/var_read_using_this.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/var-read-using-this/0.8.15/var_read_using_this.sol",
"is_dependency": false,
"lines": [
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,
28,
29,
30,
31,
32,
33,
34,
35,
36,
37,
38,
39
],
"starting_column": 1,
"ending_column": 2
}
},
"signature": "bad2()"
}
},
{
"type": "node",
"name": "this.erc20()",
"source_mapping": {
"start": 244,
"length": 19,
"filename_relative": "tests/detectors/var-read-using-this/0.8.15/var_read_using_this.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/var-read-using-this/0.8.15/var_read_using_this.sol",
"is_dependency": false,
"lines": [
9
],
"starting_column": 9,
"ending_column": 28
},
"type_specific_fields": {
"parent": {
"type": "function",
"name": "bad2",
"source_mapping": {
"start": 192,
"length": 78,
"filename_relative": "tests/detectors/var-read-using-this/0.8.15/var_read_using_this.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/var-read-using-this/0.8.15/var_read_using_this.sol",
"is_dependency": false,
"lines": [
8,
9,
10
],
"starting_column": 5,
"ending_column": 6
},
"type_specific_fields": {
"parent": {
"type": "contract",
"name": "VarReadUsingThis",
"source_mapping": {
"start": 1,
"length": 1103,
"filename_relative": "tests/detectors/var-read-using-this/0.8.15/var_read_using_this.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/var-read-using-this/0.8.15/var_read_using_this.sol",
"is_dependency": false,
"lines": [
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,
28,
29,
30,
31,
32,
33,
34,
35,
36,
37,
38,
39
],
"starting_column": 1,
"ending_column": 2
}
},
"signature": "bad2()"
}
}
}
}
],
"description": "The function VarReadUsingThis.bad2() (tests/detectors/var-read-using-this/0.8.15/var_read_using_this.sol#8-10) reads this.erc20() (tests/detectors/var-read-using-this/0.8.15/var_read_using_this.sol#9) with `this` which adds an extra STATICCALL.\n",
"markdown": "The function [VarReadUsingThis.bad2()](tests/detectors/var-read-using-this/0.8.15/var_read_using_this.sol#L8-L10) reads [this.erc20()](tests/detectors/var-read-using-this/0.8.15/var_read_using_this.sol#L9) with `this` which adds an extra STATICCALL.\n",
"first_markdown_element": "tests/detectors/var-read-using-this/0.8.15/var_read_using_this.sol#L8-L10",
"id": "4e297ea309b8865f782db6a53fdaf5aaf37f768158deb69d2ec6106a8e7b8afd",
"check": "var-read-using-this",
"impact": "Optimization",
"confidence": "High"
},
{
"elements": [
{
"type": "function",
"name": "bad1",
"source_mapping": {
"start": 102,
"length": 85,
"filename_relative": "tests/detectors/var-read-using-this/0.8.15/var_read_using_this.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/var-read-using-this/0.8.15/var_read_using_this.sol",
"is_dependency": false,
"lines": [
5,
6,
7
],
"starting_column": 5,
"ending_column": 6
},
"type_specific_fields": {
"parent": {
"type": "contract",
"name": "VarReadUsingThis",
"source_mapping": {
"start": 1,
"length": 1103,
"filename_relative": "tests/detectors/var-read-using-this/0.8.15/var_read_using_this.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/var-read-using-this/0.8.15/var_read_using_this.sol",
"is_dependency": false,
"lines": [
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,
28,
29,
30,
31,
32,
33,
34,
35,
36,
37,
38,
39
],
"starting_column": 1,
"ending_column": 2
}
},
"signature": "bad1(uint256)"
}
},
{
"type": "node",
"name": "this.myMap(x)",
"source_mapping": {
"start": 160,
"length": 20,
"filename_relative": "tests/detectors/var-read-using-this/0.8.15/var_read_using_this.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/var-read-using-this/0.8.15/var_read_using_this.sol",
"is_dependency": false,
"lines": [
6
],
"starting_column": 9,
"ending_column": 29
},
"type_specific_fields": {
"parent": {
"type": "function",
"name": "bad1",
"source_mapping": {
"start": 102,
"length": 85,
"filename_relative": "tests/detectors/var-read-using-this/0.8.15/var_read_using_this.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/var-read-using-this/0.8.15/var_read_using_this.sol",
"is_dependency": false,
"lines": [
5,
6,
7
],
"starting_column": 5,
"ending_column": 6
},
"type_specific_fields": {
"parent": {
"type": "contract",
"name": "VarReadUsingThis",
"source_mapping": {
"start": 1,
"length": 1103,
"filename_relative": "tests/detectors/var-read-using-this/0.8.15/var_read_using_this.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/var-read-using-this/0.8.15/var_read_using_this.sol",
"is_dependency": false,
"lines": [
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,
28,
29,
30,
31,
32,
33,
34,
35,
36,
37,
38,
39
],
"starting_column": 1,
"ending_column": 2
}
},
"signature": "bad1(uint256)"
}
}
}
}
],
"description": "The function VarReadUsingThis.bad1(uint256) (tests/detectors/var-read-using-this/0.8.15/var_read_using_this.sol#5-7) reads this.myMap(x) (tests/detectors/var-read-using-this/0.8.15/var_read_using_this.sol#6) with `this` which adds an extra STATICCALL.\n",
"markdown": "The function [VarReadUsingThis.bad1(uint256)](tests/detectors/var-read-using-this/0.8.15/var_read_using_this.sol#L5-L7) reads [this.myMap(x)](tests/detectors/var-read-using-this/0.8.15/var_read_using_this.sol#L6) with `this` which adds an extra STATICCALL.\n",
"first_markdown_element": "tests/detectors/var-read-using-this/0.8.15/var_read_using_this.sol#L5-L7",
"id": "ce4d740b2da0b9b71f2dd3dd1c0903124f7be34009ede12a43dc33c6f28b9d28",
"check": "var-read-using-this",
"impact": "Optimization",
"confidence": "High"
},
{
"elements": [
{
"type": "function",
"name": "bad3",
"source_mapping": {
"start": 275,
"length": 99,
"filename_relative": "tests/detectors/var-read-using-this/0.8.15/var_read_using_this.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/var-read-using-this/0.8.15/var_read_using_this.sol",
"is_dependency": false,
"lines": [
11,
12,
13
],
"starting_column": 5,
"ending_column": 6
},
"type_specific_fields": {
"parent": {
"type": "contract",
"name": "VarReadUsingThis",
"source_mapping": {
"start": 1,
"length": 1103,
"filename_relative": "tests/detectors/var-read-using-this/0.8.15/var_read_using_this.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/var-read-using-this/0.8.15/var_read_using_this.sol",
"is_dependency": false,
"lines": [
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,
28,
29,
30,
31,
32,
33,
34,
35,
36,
37,
38,
39
],
"starting_column": 1,
"ending_column": 2
}
},
"signature": "bad3()"
}
},
{
"type": "node",
"name": "this.erc20() == address(0)",
"source_mapping": {
"start": 331,
"length": 26,
"filename_relative": "tests/detectors/var-read-using-this/0.8.15/var_read_using_this.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/var-read-using-this/0.8.15/var_read_using_this.sol",
"is_dependency": false,
"lines": [
12
],
"starting_column": 13,
"ending_column": 39
},
"type_specific_fields": {
"parent": {
"type": "function",
"name": "bad3",
"source_mapping": {
"start": 275,
"length": 99,
"filename_relative": "tests/detectors/var-read-using-this/0.8.15/var_read_using_this.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/var-read-using-this/0.8.15/var_read_using_this.sol",
"is_dependency": false,
"lines": [
11,
12,
13
],
"starting_column": 5,
"ending_column": 6
},
"type_specific_fields": {
"parent": {
"type": "contract",
"name": "VarReadUsingThis",
"source_mapping": {
"start": 1,
"length": 1103,
"filename_relative": "tests/detectors/var-read-using-this/0.8.15/var_read_using_this.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/var-read-using-this/0.8.15/var_read_using_this.sol",
"is_dependency": false,
"lines": [
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,
28,
29,
30,
31,
32,
33,
34,
35,
36,
37,
38,
39
],
"starting_column": 1,
"ending_column": 2
}
},
"signature": "bad3()"
}
}
}
}
],
"description": "The function VarReadUsingThis.bad3() (tests/detectors/var-read-using-this/0.8.15/var_read_using_this.sol#11-13) reads this.erc20() == address(0) (tests/detectors/var-read-using-this/0.8.15/var_read_using_this.sol#12) with `this` which adds an extra STATICCALL.\n",
"markdown": "The function [VarReadUsingThis.bad3()](tests/detectors/var-read-using-this/0.8.15/var_read_using_this.sol#L11-L13) reads [this.erc20() == address(0)](tests/detectors/var-read-using-this/0.8.15/var_read_using_this.sol#L12) with `this` which adds an extra STATICCALL.\n",
"first_markdown_element": "tests/detectors/var-read-using-this/0.8.15/var_read_using_this.sol#L11-L13",
"id": "d4602ee9be1e60f8ae80e6d0a867b532cb2ddef0ba44b25af8808a0ac5a6b828",
"check": "var-read-using-this",
"impact": "Optimization",
"confidence": "High"
},
{
"elements": [
{
"type": "function",
"name": "bad4",
"source_mapping": {
"start": 379,
"length": 138,
"filename_relative": "tests/detectors/var-read-using-this/0.8.15/var_read_using_this.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/var-read-using-this/0.8.15/var_read_using_this.sol",
"is_dependency": false,
"lines": [
14,
15,
16,
17,
18
],
"starting_column": 5,
"ending_column": 6
},
"type_specific_fields": {
"parent": {
"type": "contract",
"name": "VarReadUsingThis",
"source_mapping": {
"start": 1,
"length": 1103,
"filename_relative": "tests/detectors/var-read-using-this/0.8.15/var_read_using_this.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/var-read-using-this/0.8.15/var_read_using_this.sol",
"is_dependency": false,
"lines": [
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,
28,
29,
30,
31,
32,
33,
34,
35,
36,
37,
38,
39
],
"starting_column": 1,
"ending_column": 2
}
},
"signature": "bad4()"
}
},
{
"type": "node",
"name": "local = this.erc20()",
"source_mapping": {
"start": 471,
"length": 28,
"filename_relative": "tests/detectors/var-read-using-this/0.8.15/var_read_using_this.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/var-read-using-this/0.8.15/var_read_using_this.sol",
"is_dependency": false,
"lines": [
16
],
"starting_column": 13,
"ending_column": 41
},
"type_specific_fields": {
"parent": {
"type": "function",
"name": "bad4",
"source_mapping": {
"start": 379,
"length": 138,
"filename_relative": "tests/detectors/var-read-using-this/0.8.15/var_read_using_this.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/var-read-using-this/0.8.15/var_read_using_this.sol",
"is_dependency": false,
"lines": [
14,
15,
16,
17,
18
],
"starting_column": 5,
"ending_column": 6
},
"type_specific_fields": {
"parent": {
"type": "contract",
"name": "VarReadUsingThis",
"source_mapping": {
"start": 1,
"length": 1103,
"filename_relative": "tests/detectors/var-read-using-this/0.8.15/var_read_using_this.sol",
"filename_absolute": "/GENERIC_PATH",
"filename_short": "tests/detectors/var-read-using-this/0.8.15/var_read_using_this.sol",
"is_dependency": false,
"lines": [
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,
28,
29,
30,
31,
32,
33,
34,
35,
36,
37,
38,
39
],
"starting_column": 1,
"ending_column": 2
}
},
"signature": "bad4()"
}
}
}
}
],
"description": "The function VarReadUsingThis.bad4() (tests/detectors/var-read-using-this/0.8.15/var_read_using_this.sol#14-18) reads local = this.erc20() (tests/detectors/var-read-using-this/0.8.15/var_read_using_this.sol#16) with `this` which adds an extra STATICCALL.\n",
"markdown": "The function [VarReadUsingThis.bad4()](tests/detectors/var-read-using-this/0.8.15/var_read_using_this.sol#L14-L18) reads [local = this.erc20()](tests/detectors/var-read-using-this/0.8.15/var_read_using_this.sol#L16) with `this` which adds an extra STATICCALL.\n",
"first_markdown_element": "tests/detectors/var-read-using-this/0.8.15/var_read_using_this.sol#L14-L18",
"id": "fec10ba084a6322d0fbb895e6c7ca6bca380b48a54d2ecae92a017b8b41242bf",
"check": "var-read-using-this",
"impact": "Optimization",
"confidence": "High"
}
]
]

@ -1557,6 +1557,27 @@ ALL_TEST_OBJECTS = [
"permit_domain_state_var_collision.sol",
"0.8.0",
),
Test(
all_detectors.VarReadUsingThis,
"var_read_using_this.sol",
"0.4.25",
),
Test(
all_detectors.VarReadUsingThis,
"var_read_using_this.sol",
"0.5.16",
),
Test(all_detectors.VarReadUsingThis, "var_read_using_this.sol", "0.6.11"),
Test(
all_detectors.VarReadUsingThis,
"var_read_using_this.sol",
"0.7.6",
),
Test(
all_detectors.VarReadUsingThis,
"var_read_using_this.sol",
"0.8.15",
),
]

@ -9,7 +9,7 @@ from slither.detectors import all_detectors
from slither.detectors.abstract_detector import AbstractDetector
def _run_all_detectors(slither: Slither):
def _run_all_detectors(slither: Slither) -> None:
detectors = [getattr(all_detectors, name) for name in dir(all_detectors)]
detectors = [d for d in detectors if inspect.isclass(d) and issubclass(d, AbstractDetector)]
@ -19,7 +19,7 @@ def _run_all_detectors(slither: Slither):
slither.run_detectors()
def test_node():
def test_node() -> None:
# hardhat must have been installed in tests/test_node_modules
# For the CI its done through the github action config
@ -27,7 +27,7 @@ def test_node():
_run_all_detectors(slither)
def test_collision():
def test_collision() -> None:
standard_json = SolcStandardJson()
standard_json.add_source_file("./tests/collisions/a.sol")
@ -39,14 +39,33 @@ def test_collision():
_run_all_detectors(slither)
def test_cycle():
def test_cycle() -> None:
slither = Slither("./tests/test_cyclic_import/a.sol")
_run_all_detectors(slither)
def test_funcion_id_rec_structure():
def test_funcion_id_rec_structure() -> None:
solc_select.switch_global_version("0.8.0", always_install=True)
slither = Slither("./tests/function_ids/rec_struct-0.8.sol")
for compilation_unit in slither.compilation_units:
for function in compilation_unit.functions:
assert function.solidity_signature
def test_upgradeable_comments() -> None:
solc_select.switch_global_version("0.8.10", always_install=True)
slither = Slither("./tests/custom_comments/upgrade.sol")
compilation_unit = slither.compilation_units[0]
proxy = compilation_unit.get_contract_from_name("Proxy")[0]
assert proxy.is_upgradeable_proxy
v0 = compilation_unit.get_contract_from_name("V0")[0]
assert v0.is_upgradeable
print(v0.upgradeable_version)
assert v0.upgradeable_version == "version-0"
v1 = compilation_unit.get_contract_from_name("V1")[0]
assert v0.is_upgradeable
assert v1.upgradeable_version == "version_1"

Loading…
Cancel
Save