diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1252e385a..f2a295452 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -3,8 +3,7 @@ name: CI defaults: run: - # To load bashrc - shell: bash -ieo pipefail {0} + shell: bash on: push: @@ -52,16 +51,10 @@ jobs: steps: - uses: actions/checkout@v1 - - name: Set up shell - if: runner.os == 'Windows' - run: | - echo 'C:\msys64\mingw64\bin' >> "$GITHUB_PATH" - echo 'C:\msys64\usr\bin' >> "$GITHUB_PATH" - - - name: Set up Python 3.6 + - name: Set up Python 3.8 uses: actions/setup-python@v3 with: - python-version: 3.6 + python-version: 3.8 - name: Install dependencies run: | @@ -87,6 +80,7 @@ jobs: - name: Run Tests env: + PYTHONUTF8: 1 TEST_TYPE: ${{ matrix.type }} GITHUB_ETHERSCAN: ${{ secrets.GITHUB_ETHERSCAN }} run: | diff --git a/.github/workflows/pip-audit.yml b/.github/workflows/pip-audit.yml index c14674ce7..d0fcb419c 100644 --- a/.github/workflows/pip-audit.yml +++ b/.github/workflows/pip-audit.yml @@ -11,18 +11,25 @@ on: jobs: audit: runs-on: ubuntu-latest + steps: - name: Checkout repository - uses: actions/checkout@v2 - - name: Set up Python 3.10 - uses: actions/setup-python@v3 + uses: actions/checkout@v3 + + - name: Install Python + uses: actions/setup-python@v4 with: python-version: "3.10" - - name: Install pip-audit + + - name: Install Slither run: | + python -m venv /tmp/pip-audit-env + source /tmp/pip-audit-env/bin/activate + python -m pip install --upgrade pip - python -m pip install pip-audit - - name: Run pip-audit - run: | python -m pip install . - pip-audit --desc -v + + - name: Run pip-audit + uses: trailofbits/gh-action-pip-audit@v0.0.4 + with: + virtual-environment: /tmp/pip-audit-env diff --git a/Dockerfile b/Dockerfile index 1d35709c5..369bcf865 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM ubuntu:bionic +FROM ubuntu:focal LABEL name=slither LABEL src="https://github.com/trailofbits/slither" @@ -6,11 +6,12 @@ LABEL creator=trailofbits LABEL dockerfile_maintenance=trailofbits LABEL desc="Static Analyzer for Solidity" -RUN apt-get update \ - && apt-get upgrade -y \ - && apt-get install -y git python3 python3-setuptools wget software-properties-common +RUN export DEBIAN_FRONTEND=noninteractive \ + && apt-get update \ + && apt-get upgrade -yq \ + && apt-get install -yq gcc git python3 python3-dev python3-setuptools wget software-properties-common -RUN wget https://github.com/ethereum/solidity/releases/download/v0.4.25/solc-static-linux \ +RUN wget -q https://github.com/ethereum/solidity/releases/download/v0.4.25/solc-static-linux \ && chmod +x solc-static-linux \ && mv solc-static-linux /usr/bin/solc diff --git a/README.md b/README.md index b160cd9be..d7b9332a2 100644 --- a/README.md +++ b/README.md @@ -40,9 +40,12 @@ Run Slither on a single file: slither tests/uninitialized.sol ``` -For GitHub action integration, see [slither-action](https://github.com/marketplace/actions/slither-action). For additional configuration, see the [usage](https://github.com/trailofbits/slither/wiki/Usage) documentation. +### Integration +- For GitHub action integration, use [slither-action](https://github.com/marketplace/actions/slither-action). +- To generate a Markdown report, use `slither [target] --checklist`. +- To generate a Markdown with GitHub source code highlighting, use `slither [target] --checklist --markdown-root https://github.com/ORG/REPO/blob/COMMIT/` (replace `ORG`, `REPO`, `COMMIT`) -Use [solc-select](https://github.com/crytic/solc-select) if your contracts require older versions of solc. +Use [solc-select](https://github.com/crytic/solc-select) if your contracts require older versions of solc. For additional configuration, see the [usage](https://github.com/trailofbits/slither/wiki/Usage) documentation. ### Detectors @@ -51,7 +54,7 @@ Num | Detector | What it Detects | Impact | Confidence --- | --- | --- | --- | --- 1 | `abiencoderv2-array` | [Storage abiencoderv2 array](https://github.com/crytic/slither/wiki/Detector-Documentation#storage-abiencoderv2-array) | High | High 2 | `array-by-reference` | [Modifying storage array by value](https://github.com/crytic/slither/wiki/Detector-Documentation#modifying-storage-array-by-value) | High | High -3 | `incorrect-shift` | [The order of parameters in a shift instruction is incorrect.](https://github.com/crytic/slither/wiki/Detector-Documentation#shift-parameter-mixup) | High | High +3 | `incorrect-shift` | [The order of parameters in a shift instruction is incorrect.](https://github.com/crytic/slither/wiki/Detector-Documentation#incorrect-shift-in-assembly) | High | High 4 | `multiple-constructors` | [Multiple constructor schemes](https://github.com/crytic/slither/wiki/Detector-Documentation#multiple-constructor-schemes) | High | High 5 | `name-reused` | [Contract's name reused](https://github.com/crytic/slither/wiki/Detector-Documentation#name-reused) | High | High 6 | `public-mappings-nested` | [Public mappings with nested variables](https://github.com/crytic/slither/wiki/Detector-Documentation#public-mappings-with-nested-variables) | High | High @@ -121,7 +124,7 @@ Num | Detector | What it Detects | Impact | Confidence 70 | `costly-loop` | [Costly operations in a loop](https://github.com/crytic/slither/wiki/Detector-Documentation#costly-operations-inside-a-loop) | Informational | Medium 71 | `dead-code` | [Functions that are not used](https://github.com/crytic/slither/wiki/Detector-Documentation#dead-code) | Informational | Medium 72 | `reentrancy-unlimited-gas` | [Reentrancy vulnerabilities through send and transfer](https://github.com/crytic/slither/wiki/Detector-Documentation#reentrancy-vulnerabilities-4) | Informational | Medium -73 | `similar-names` | [Variable names are too similar](https://github.com/crytic/slither/wiki/Detector-Documentation#variable-names-are-too-similar) | Informational | Medium +73 | `similar-names` | [Variable names are too similar](https://github.com/crytic/slither/wiki/Detector-Documentation#variable-names-too-similar) | Informational | Medium 74 | `too-many-digits` | [Conformance to numeric notation best practices](https://github.com/crytic/slither/wiki/Detector-Documentation#too-many-digits) | Informational | Medium 75 | `constable-states` | [State variables that could be declared constant](https://github.com/crytic/slither/wiki/Detector-Documentation#state-variables-that-could-be-declared-constant) | Optimization | High 76 | `external-function` | [Public function that could be declared external](https://github.com/crytic/slither/wiki/Detector-Documentation#public-function-that-could-be-declared-external) | Optimization | High @@ -181,7 +184,7 @@ We recommend using a Python virtual environment, as detailed in the [Developer I ### Using Docker -Use the [`eth-security-toolbox`](https://github.com/trailofbits/eth-security-toolbox/) docker image. It includes all of our security tools and every major version of Solidity in a single image. `/home/share` will be mounted to `/share` in the container. +Use the [`eth-security-toolbox`](https://github.com/trailofbits/eth-security-toolbox/) docker image. It includes all of our security tools and every major version of Solidity in a single image. `/home/share` will be mounted to `/share` in the container. ```bash docker pull trailofbits/eth-security-toolbox @@ -225,5 +228,8 @@ Title | Usage | Authors | Venue [Smart Contract Repair](https://arxiv.org/pdf/1912.05823.pdf) | Rely on Slither’s vulnerabilities detectors | Xiao Liang Yu, Omar Al-Bataineh, David Lo, Abhik Roychoudhury | TOSEM 20 [Demystifying Loops in Smart Contracts](https://www.microsoft.com/en-us/research/uploads/prod/2020/08/loops_solidity__camera_ready-5f3fec3f15c69.pdf) | Leverage data dependency through Slither | Ben Mariano, Yanju Chen, Yu Feng, Shuvendu Lahiri, Isil Dillig | ASE 20 [Trace-Based Dynamic Gas Estimation of Loops in Smart Contracts](https://ieeexplore.ieee.org/stamp/stamp.jsp?arnumber=9268144) | Use Slither’s CFG to detect loops | Chunmiao Li, Shijie Nie, Yang Cao, Yijun Yu, Zhenjiang Hu | IEEE Open J. Comput. Soc. 1 (2020) +[SAILFISH: Vetting Smart Contract State-Inconsistency Bugs in Seconds](https://arxiv.org/pdf/2104.08638.pdf) | Rely on SlithIR to build a *storage dependency graph* | Priyanka Bose, Dipanjan Das, Yanju Chen, Yu Feng, Christopher Kruegel, and Giovanni Vigna | S&P 22 +[SolType: Refinement Types for Arithmetic Overflow in Solidity](https://arxiv.org/abs/2110.00677) | Use Slither as frontend to build refinement type system | Bryan Tan, Benjamin Mariano, Shuvendu K. Lahiri, Isil Dillig, Yu Feng | POPL 22 +[Do Not Rug on Me: Leveraging Machine Learning Techniques for Automated Scam Detection](https://www.mdpi.com/2227-7390/10/6/949) | Use Slither to extract tokens' features (mintable, pausable, ..) | Mazorra, Bruno, Victor Adan, and Vanesa Daza | Mathematics 10.6 (2022) -If you are using Slither on an academic work, consider applying to the [Crytic $10k Research Prize](https://blog.trailofbits.com/2019/11/13/announcing-the-crytic-10k-research-prize/). +If you are using Slither on an academic work, consider applying to the [Crytic $10k Research Prize](https://blog.trailofbits.com/2019/11/13/announcing-the-crytic-10k-research-prize/). \ No newline at end of file diff --git a/scripts/ci_test_kspec.sh b/scripts/ci_test_kspec.sh index cb0a131a8..3bd827e69 100755 --- a/scripts/ci_test_kspec.sh +++ b/scripts/ci_test_kspec.sh @@ -7,7 +7,7 @@ slither-check-kspec "$DIR_TESTS/safeAdd/safeAdd.sol" "$DIR_TESTS/safeAdd/spec.md DIFF=$(diff test_1.txt "$DIR_TESTS/test_1.txt") if [ "$DIFF" != "" ] then - echo "slither-check-upgradeability 1 failed" + echo "slither-check-kspec 1 failed" cat test_1.txt echo "" cat "$DIR_TESTS/test_1.txt" diff --git a/scripts/ci_test_simil.sh b/scripts/ci_test_simil.sh index bad5fd067..1d405191e 100755 --- a/scripts/ci_test_simil.sh +++ b/scripts/ci_test_simil.sh @@ -2,8 +2,8 @@ ### Install requisites -pip3.6 install pybind11 -pip3.6 install https://github.com/facebookresearch/fastText/archive/0.2.0.zip +pip3 install pybind11 +pip3 install https://github.com/facebookresearch/fastText/archive/0.2.0.zip ### Test slither-simil diff --git a/scripts/ci_test_truffle.sh b/scripts/ci_test_truffle.sh index e9a843848..a28e1d2c3 100755 --- a/scripts/ci_test_truffle.sh +++ b/scripts/ci_test_truffle.sh @@ -15,7 +15,7 @@ npm install -g truffle truffle unbox metacoin slither . -if [ $? -eq 9 ] +if [ $? -eq 6 ] then exit 0 fi diff --git a/setup.py b/setup.py index fb2744abc..1069f8aef 100644 --- a/setup.py +++ b/setup.py @@ -8,16 +8,16 @@ setup( description="Slither is a Solidity static analysis framework written in Python 3.", url="https://github.com/crytic/slither", author="Trail of Bits", - version="0.8.2", + version="0.8.3", packages=find_packages(), python_requires=">=3.6", install_requires=[ "prettytable>=0.7.2", "pysha3>=1.0.2", - "crytic-compile>=0.2.3", - # "crytic-compile", + # "crytic-compile>=0.2.3", + "crytic-compile", ], - # dependency_links=["git+https://github.com/crytic/crytic-compile.git@master#egg=crytic-compile"], + dependency_links=["git+https://github.com/crytic/crytic-compile.git@master#egg=crytic-compile"], license="AGPL-3.0", long_description=long_description, entry_points={ diff --git a/slither/__main__.py b/slither/__main__.py index bc34e7081..f6f84feeb 100644 --- a/slither/__main__.py +++ b/slither/__main__.py @@ -299,6 +299,9 @@ def parse_args(detector_classes, printer_classes): # pylint: disable=too-many-s group_detector = parser.add_argument_group("Detectors") group_printer = parser.add_argument_group("Printers") + group_checklist = parser.add_argument_group( + "Checklist (consider using https://github.com/crytic/slither-action)" + ) group_misc = parser.add_argument_group("Additional options") group_detector.add_argument( @@ -312,7 +315,7 @@ def parse_args(detector_classes, printer_classes): # pylint: disable=too-many-s group_printer.add_argument( "--print", - help="Comma-separated list fo contract information printers, " + help="Comma-separated list of contract information printers, " f"available printers: {', '.join(d.ARGUMENT for d in printer_classes)}", action="store", dest="printers_to_run", @@ -392,6 +395,28 @@ def parse_args(detector_classes, printer_classes): # pylint: disable=too-many-s default=defaults_flag_in_config["show_ignored_findings"], ) + group_checklist.add_argument( + "--checklist", + help="Generate a markdown page with the detector results", + action="store_true", + default=False, + ) + + group_checklist.add_argument( + "--checklist-limit", + help="Limite the number of results per detector in the markdown file", + action="store", + default="", + ) + + group_checklist.add_argument( + "--markdown-root", + type=check_and_sanitize_markdown_root, + help="URL for markdown generation", + action="store", + default="", + ) + group_misc.add_argument( "--json", help='Export the results as a JSON file ("--json -" to export to stdout)', @@ -429,14 +454,6 @@ def parse_args(detector_classes, printer_classes): # pylint: disable=too-many-s default=defaults_flag_in_config["zip_type"], ) - group_misc.add_argument( - "--markdown-root", - type=check_and_sanitize_markdown_root, - help="URL for markdown generation", - action="store", - default="", - ) - group_misc.add_argument( "--disable-color", help="Disable output colorization", @@ -487,12 +504,6 @@ def parse_args(detector_classes, printer_classes): # pylint: disable=too-many-s parser.add_argument("--markdown", help=argparse.SUPPRESS, action=OutputMarkdown, default=False) - group_misc.add_argument( - "--checklist", help=argparse.SUPPRESS, action="store_true", default=False - ) - - group_misc.add_argument("--checklist-limit", help=argparse.SUPPRESS, action="store", default="") - parser.add_argument( "--wiki-detectors", help=argparse.SUPPRESS, action=OutputWiki, default=False ) @@ -648,7 +659,7 @@ def main_impl(all_detector_classes, all_printer_classes): cp.enable() # Set colorization option - set_colorization_enabled(not args.disable_color) + set_colorization_enabled(False if args.disable_color else sys.stdout.isatty()) # Define some variables for potential JSON output json_results = {} diff --git a/slither/core/cfg/node.py b/slither/core/cfg/node.py index a031e5a6b..5a824491b 100644 --- a/slither/core/cfg/node.py +++ b/slither/core/cfg/node.py @@ -39,12 +39,11 @@ from slither.slithir.variables import ( TupleVariable, ) from slither.all_exceptions import SlitherException -from slither.core.declarations import Contract +from slither.core.declarations import Contract, Function from slither.core.expressions.expression import Expression if TYPE_CHECKING: - from slither.core.declarations import Function from slither.slithir.variables.variable import SlithIRVariable from slither.core.compilation_unit import SlitherCompilationUnit from slither.utils.type_helpers import ( @@ -917,6 +916,7 @@ class Node(SourceMapping, ChildFunction): # pylint: disable=too-many-public-met ) elif isinstance(ir, LibraryCall): assert isinstance(ir.destination, Contract) + assert isinstance(ir.function, Function) self._high_level_calls.append((ir.destination, ir.function)) self._library_calls.append((ir.destination, ir.function)) diff --git a/slither/core/children/child_node.py b/slither/core/children/child_node.py index 1c745f414..c1fffd49a 100644 --- a/slither/core/children/child_node.py +++ b/slither/core/children/child_node.py @@ -28,4 +28,4 @@ class ChildNode: @property def compilation_unit(self) -> "SlitherCompilationUnit": - return self.contract.compilation_unit + return self.node.compilation_unit diff --git a/slither/core/declarations/contract.py b/slither/core/declarations/contract.py index 2db1cd964..c82cbc446 100644 --- a/slither/core/declarations/contract.py +++ b/slither/core/declarations/contract.py @@ -21,6 +21,8 @@ from slither.utils.erc import ( ERC777_signatures, ERC1155_signatures, ERC2612_signatures, + ERC1363_signatures, + ERC4524_signatures, ERC4626_signatures, ) from slither.utils.tests_pattern import is_test_contract @@ -903,6 +905,7 @@ class Contract(SourceMapping): # pylint: disable=too-many-public-methods ("ERC721", self.is_erc721), ("ERC777", self.is_erc777), ("ERC2612", self.is_erc2612), + ("ERC1363", self.is_erc1363), ("ERC4626", self.is_erc4626), ] @@ -998,6 +1001,26 @@ class Contract(SourceMapping): # pylint: disable=too-many-public-methods full_names = self.functions_signatures return all(s in full_names for s in ERC2612_signatures) + def is_erc1363(self) -> bool: + """ + Check if the contract is an erc1363 + + Note: it does not check for correct return values + :return: Returns a true if the contract is an erc1363 + """ + full_names = self.functions_signatures + return all(s in full_names for s in ERC1363_signatures) + + def is_erc4524(self) -> bool: + """ + Check if the contract is an erc4524 + + Note: it does not check for correct return values + :return: Returns a true if the contract is an erc4524 + """ + full_names = self.functions_signatures + return all(s in full_names for s in ERC4524_signatures) + @property def is_token(self) -> bool: """ diff --git a/slither/core/declarations/enum.py b/slither/core/declarations/enum.py index 76a43dc4d..c53c1c38d 100644 --- a/slither/core/declarations/enum.py +++ b/slither/core/declarations/enum.py @@ -9,6 +9,9 @@ class Enum(SourceMapping): self._name = name self._canonical_name = canonical_name self._values = values + self._min = 0 + # The max value of an Enum is the index of the last element + self._max = len(values) - 1 @property def canonical_name(self) -> str: @@ -22,5 +25,13 @@ class Enum(SourceMapping): def values(self) -> List[str]: return self._values + @property + def min(self) -> int: + return self._min + + @property + def max(self) -> int: + return self._max + def __str__(self): return self.name diff --git a/slither/core/declarations/solidity_variables.py b/slither/core/declarations/solidity_variables.py index 08ff0c7bc..f57e2a787 100644 --- a/slither/core/declarations/solidity_variables.py +++ b/slither/core/declarations/solidity_variables.py @@ -104,7 +104,7 @@ class SolidityVariable(Context): # dev function, will be removed once the code is stable def _check_name(self, name: str): # pylint: disable=no-self-use - assert name in SOLIDITY_VARIABLES or name.endswith("_slot") or name.endswith("_offset") + assert name in SOLIDITY_VARIABLES or name.endswith(("_slot", "_offset")) @property def state_variable(self): diff --git a/slither/core/slither_core.py b/slither/core/slither_core.py index 2a76f3e6e..f154ba5a4 100644 --- a/slither/core/slither_core.py +++ b/slither/core/slither_core.py @@ -4,6 +4,7 @@ import json import logging import os +import pathlib import posixpath import re from typing import Optional, Dict, List, Set, Union @@ -218,8 +219,12 @@ class SlitherCore(Context): for elem in r["elements"] if "source_mapping" in elem ] - source_mapping_elements = map( - lambda x: posixpath.normpath(x) if x else x, source_mapping_elements + + # Use POSIX-style paths so that filter_paths works across different + # OSes. Convert to a list so elements don't get consumed and are lost + # while evaluating the first pattern + source_mapping_elements = list( + map(lambda x: pathlib.Path(x).resolve().as_posix() if x else x, source_mapping_elements) ) matching = False diff --git a/slither/core/solidity_types/type_information.py b/slither/core/solidity_types/type_information.py index 0ede1f6d0..ccc84e8c1 100644 --- a/slither/core/solidity_types/type_information.py +++ b/slither/core/solidity_types/type_information.py @@ -13,8 +13,9 @@ class TypeInformation(Type): def __init__(self, c): # pylint: disable=import-outside-toplevel from slither.core.declarations.contract import Contract + from slither.core.declarations.enum import Enum - assert isinstance(c, (Contract, ElementaryType)) + assert isinstance(c, (Contract, ElementaryType, Enum)) super().__init__() self._type = c diff --git a/slither/detectors/all_detectors.py b/slither/detectors/all_detectors.py index e287c258f..a79dcaf51 100644 --- a/slither/detectors/all_detectors.py +++ b/slither/detectors/all_detectors.py @@ -6,7 +6,9 @@ from .variables.uninitialized_local_variables import UninitializedLocalVars from .attributes.constant_pragma import ConstantPragma from .attributes.incorrect_solc import IncorrectSolc from .attributes.locked_ether import LockedEther -from .functions.arbitrary_send import ArbitrarySend +from .functions.arbitrary_send_eth import ArbitrarySendEth +from .erc.erc20.arbitrary_send_erc20_no_permit import ArbitrarySendErc20NoPermit +from .erc.erc20.arbitrary_send_erc20_permit import ArbitrarySendErc20Permit from .functions.suicidal import Suicidal # from .functions.complex_function import ComplexFunction @@ -34,7 +36,7 @@ from .shadowing.builtin_symbols import BuiltinSymbolShadowing from .operations.block_timestamp import Timestamp from .statements.calls_in_loop import MultipleCallsInLoop from .statements.incorrect_strict_equality import IncorrectStrictEquality -from .erc.incorrect_erc20_interface import IncorrectERC20InterfaceDetection +from .erc.erc20.incorrect_erc20_interface import IncorrectERC20InterfaceDetection from .erc.incorrect_erc721_interface import IncorrectERC721InterfaceDetection from .erc.unindexed_event_parameters import UnindexedERC20EventParameters from .statements.deprecated_calls import DeprecatedStandards diff --git a/slither/detectors/assembly/shift_parameter_mixup.py b/slither/detectors/assembly/shift_parameter_mixup.py index a8c172ce6..65a35d8c3 100644 --- a/slither/detectors/assembly/shift_parameter_mixup.py +++ b/slither/detectors/assembly/shift_parameter_mixup.py @@ -13,7 +13,9 @@ class ShiftParameterMixup(AbstractDetector): IMPACT = DetectorClassification.HIGH CONFIDENCE = DetectorClassification.HIGH - WIKI = "https://github.com/crytic/slither/wiki/Detector-Documentation#shift-parameter-mixup" + WIKI = ( + "https://github.com/crytic/slither/wiki/Detector-Documentation#incorrect-shift-in-assembly" + ) WIKI_TITLE = "Incorrect shift in assembly." WIKI_DESCRIPTION = "Detect if the values in a shift operation are reversed" diff --git a/slither/detectors/attributes/incorrect_solc.py b/slither/detectors/attributes/incorrect_solc.py index ad8aebdec..5292c19e3 100644 --- a/slither/detectors/attributes/incorrect_solc.py +++ b/slither/detectors/attributes/incorrect_solc.py @@ -14,7 +14,7 @@ from slither.formatters.attributes.incorrect_solc import custom_format # 4: version number # pylint: disable=anomalous-backslash-in-string -PATTERN = re.compile("(\^|>|>=|<|<=)?([ ]+)?(\d+)\.(\d+)\.(\d+)") +PATTERN = re.compile(r"(\^|>|>=|<|<=)?([ ]+)?(\d+)\.(\d+)\.(\d+)") class IncorrectSolc(AbstractDetector): diff --git a/slither/detectors/erc/erc20/__init__.py b/slither/detectors/erc/erc20/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/slither/detectors/erc/erc20/arbitrary_send_erc20.py b/slither/detectors/erc/erc20/arbitrary_send_erc20.py new file mode 100644 index 000000000..7aeaa1139 --- /dev/null +++ b/slither/detectors/erc/erc20/arbitrary_send_erc20.py @@ -0,0 +1,95 @@ +from typing import List +from slither.core.cfg.node import Node +from slither.core.declarations.solidity_variables import SolidityVariable +from slither.slithir.operations import HighLevelCall, LibraryCall +from slither.core.declarations import Contract, Function, SolidityVariableComposed +from slither.analyses.data_dependency.data_dependency import is_dependent +from slither.core.compilation_unit import SlitherCompilationUnit + + +class ArbitrarySendErc20: + """Detects instances where ERC20 can be sent from an arbitrary from address.""" + + def __init__(self, compilation_unit: SlitherCompilationUnit): + self._compilation_unit = compilation_unit + self._no_permit_results: List[Node] = [] + self._permit_results: List[Node] = [] + + @property + def compilation_unit(self) -> SlitherCompilationUnit: + return self._compilation_unit + + @property + def no_permit_results(self) -> List[Node]: + return self._no_permit_results + + @property + def permit_results(self) -> List[Node]: + return self._permit_results + + def _detect_arbitrary_from(self, contract: Contract): + for f in contract.functions: + all_high_level_calls = [ + f_called[1].solidity_signature + for f_called in f.high_level_calls + if isinstance(f_called[1], Function) + ] + all_library_calls = [f_called[1].solidity_signature for f_called in f.library_calls] + if ( + "transferFrom(address,address,uint256)" in all_high_level_calls + or "safeTransferFrom(address,address,address,uint256)" in all_library_calls + ): + if ( + "permit(address,address,uint256,uint256,uint8,bytes32,bytes32)" + in all_high_level_calls + ): + ArbitrarySendErc20._arbitrary_from(f.nodes, self._permit_results) + else: + ArbitrarySendErc20._arbitrary_from(f.nodes, self._no_permit_results) + + @staticmethod + def _arbitrary_from(nodes: List[Node], results: List[Node]): + """Finds instances of (safe)transferFrom that do not use msg.sender or address(this) as from parameter.""" + for node in nodes: + for ir in node.irs: + if ( + isinstance(ir, HighLevelCall) + and isinstance(ir.function, Function) + and ir.function.solidity_signature == "transferFrom(address,address,uint256)" + and not ( + is_dependent( + ir.arguments[0], + SolidityVariableComposed("msg.sender"), + node.function.contract, + ) + or is_dependent( + ir.arguments[0], + SolidityVariable("this"), + node.function.contract, + ) + ) + ): + results.append(ir.node) + elif ( + isinstance(ir, LibraryCall) + and ir.function.solidity_signature + == "safeTransferFrom(address,address,address,uint256)" + and not ( + is_dependent( + ir.arguments[1], + SolidityVariableComposed("msg.sender"), + node.function.contract, + ) + or is_dependent( + ir.arguments[1], + SolidityVariable("this"), + node.function.contract, + ) + ) + ): + results.append(ir.node) + + def detect(self): + """Detect transfers that use arbitrary `from` parameter.""" + for c in self.compilation_unit.contracts_derived: + self._detect_arbitrary_from(c) diff --git a/slither/detectors/erc/erc20/arbitrary_send_erc20_no_permit.py b/slither/detectors/erc/erc20/arbitrary_send_erc20_no_permit.py new file mode 100644 index 000000000..8e29ecbef --- /dev/null +++ b/slither/detectors/erc/erc20/arbitrary_send_erc20_no_permit.py @@ -0,0 +1,45 @@ +from typing import List +from slither.detectors.abstract_detector import AbstractDetector, DetectorClassification +from slither.utils.output import Output +from .arbitrary_send_erc20 import ArbitrarySendErc20 + + +class ArbitrarySendErc20NoPermit(AbstractDetector): + """ + Detect when `msg.sender` is not used as `from` in transferFrom + """ + + ARGUMENT = "arbitrary-send-erc20" + HELP = "transferFrom uses arbitrary `from`" + IMPACT = DetectorClassification.HIGH + CONFIDENCE = DetectorClassification.HIGH + + WIKI = "https://github.com/trailofbits/slither/wiki/Detector-Documentation#arbitrary-send-erc20" + + WIKI_TITLE = "Arbitrary `from` in transferFrom" + WIKI_DESCRIPTION = "Detect when `msg.sender` is not used as `from` in transferFrom." + WIKI_EXPLOIT_SCENARIO = """ +```solidity + function a(address from, address to, uint256 amount) public { + erc20.transferFrom(from, to, am); + } +``` +Alice approves this contract to spend her ERC20 tokens. Bob can call `a` and specify Alice's address as the `from` parameter in `transferFrom`, allowing him to transfer Alice's tokens to himself.""" + + WIKI_RECOMMENDATION = """ +Use `msg.sender` as `from` in transferFrom. +""" + + def _detect(self) -> List[Output]: + """""" + results: List[Output] = [] + + arbitrary_sends = ArbitrarySendErc20(self.compilation_unit) + arbitrary_sends.detect() + for node in arbitrary_sends.no_permit_results: + func = node.function + info = [func, " uses arbitrary from in transferFrom: ", node, "\n"] + res = self.generate_result(info) + results.append(res) + + return results diff --git a/slither/detectors/erc/erc20/arbitrary_send_erc20_permit.py b/slither/detectors/erc/erc20/arbitrary_send_erc20_permit.py new file mode 100644 index 000000000..48e80772b --- /dev/null +++ b/slither/detectors/erc/erc20/arbitrary_send_erc20_permit.py @@ -0,0 +1,53 @@ +from typing import List +from slither.detectors.abstract_detector import AbstractDetector, DetectorClassification +from slither.utils.output import Output +from .arbitrary_send_erc20 import ArbitrarySendErc20 + + +class ArbitrarySendErc20Permit(AbstractDetector): + """ + Detect when `msg.sender` is not used as `from` in transferFrom along with the use of permit. + """ + + ARGUMENT = "arbitrary-send-erc20-permit" + HELP = "transferFrom uses arbitrary from with permit" + IMPACT = DetectorClassification.HIGH + CONFIDENCE = DetectorClassification.MEDIUM + + WIKI = "https://github.com/trailofbits/slither/wiki/Detector-Documentation#arbitrary-send-erc20-permit" + + WIKI_TITLE = "Arbitrary `from` in transferFrom used with permit" + WIKI_DESCRIPTION = ( + "Detect when `msg.sender` is not used as `from` in transferFrom and permit is used." + ) + WIKI_EXPLOIT_SCENARIO = """ +```solidity + function bad(address from, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s, address to) public { + erc20.permit(from, address(this), value, deadline, v, r, s); + erc20.transferFrom(from, to, value); + } +``` +If an ERC20 token does not implement permit and has a fallback function e.g. WETH, transferFrom allows an attacker to transfer all tokens approved for this contract.""" + + WIKI_RECOMMENDATION = """ +Ensure that the underlying ERC20 token correctly implements a permit function. +""" + + def _detect(self) -> List[Output]: + """""" + results: List[Output] = [] + + arbitrary_sends = ArbitrarySendErc20(self.compilation_unit) + arbitrary_sends.detect() + for node in arbitrary_sends.permit_results: + func = node.function + info = [ + func, + " uses arbitrary from in transferFrom in combination with permit: ", + node, + "\n", + ] + res = self.generate_result(info) + results.append(res) + + return results diff --git a/slither/detectors/erc/incorrect_erc20_interface.py b/slither/detectors/erc/erc20/incorrect_erc20_interface.py similarity index 100% rename from slither/detectors/erc/incorrect_erc20_interface.py rename to slither/detectors/erc/erc20/incorrect_erc20_interface.py diff --git a/slither/detectors/functions/arbitrary_send.py b/slither/detectors/functions/arbitrary_send_eth.py similarity index 97% rename from slither/detectors/functions/arbitrary_send.py rename to slither/detectors/functions/arbitrary_send_eth.py index 3a7118bbf..e1752bbdb 100644 --- a/slither/detectors/functions/arbitrary_send.py +++ b/slither/detectors/functions/arbitrary_send_eth.py @@ -90,8 +90,8 @@ def detect_arbitrary_send(contract: Contract): return ret -class ArbitrarySend(AbstractDetector): - ARGUMENT = "arbitrary-send" +class ArbitrarySendEth(AbstractDetector): + ARGUMENT = "arbitrary-send-eth" HELP = "Functions that send Ether to arbitrary destinations" IMPACT = DetectorClassification.HIGH CONFIDENCE = DetectorClassification.MEDIUM @@ -104,7 +104,7 @@ class ArbitrarySend(AbstractDetector): # region wiki_exploit_scenario WIKI_EXPLOIT_SCENARIO = """ ```solidity -contract ArbitrarySend{ +contract ArbitrarySendEth{ address destination; function setDestination(){ destination = msg.sender; diff --git a/slither/detectors/naming_convention/naming_convention.py b/slither/detectors/naming_convention/naming_convention.py index 34aba8dc2..706f4ae6c 100644 --- a/slither/detectors/naming_convention/naming_convention.py +++ b/slither/detectors/naming_convention/naming_convention.py @@ -94,7 +94,7 @@ Solidity defines a [naming convention](https://solidity.readthedocs.io/en/v0.4.2 "private", ] and self.is_mixed_case_with_underscore(func.name): continue - if func.name.startswith("echidna_") or func.name.startswith("crytic_"): + if func.name.startswith(("echidna_", "crytic_")): continue info = ["Function ", func, " is not in mixedCase\n"] diff --git a/slither/detectors/statements/too_many_digits.py b/slither/detectors/statements/too_many_digits.py index 734bc4e30..6e4cc4cd9 100644 --- a/slither/detectors/statements/too_many_digits.py +++ b/slither/detectors/statements/too_many_digits.py @@ -2,9 +2,19 @@ Module detecting numbers with too many digits. """ +import re from slither.detectors.abstract_detector import AbstractDetector, DetectorClassification from slither.slithir.variables import Constant +_HEX_ADDRESS_REGEXP = re.compile("(0[xX])?[0-9a-fA-F]{40}") + + +def is_hex_address(value) -> bool: + """ + Checks if the given string of text type is an address in hexadecimal encoded form. + """ + return _HEX_ADDRESS_REGEXP.fullmatch(value) is not None + class TooManyDigits(AbstractDetector): """ @@ -58,7 +68,7 @@ Use: if isinstance(read, Constant): # read.value can return an int or a str. Convert it to str value_as_str = read.original_value - if "00000" in value_as_str: + if "00000" in value_as_str and not is_hex_address(value_as_str): # Info to be printed ret.append(node) return ret diff --git a/slither/detectors/statements/unprotected_upgradeable.py b/slither/detectors/statements/unprotected_upgradeable.py index f39eb31a4..89abaa34b 100644 --- a/slither/detectors/statements/unprotected_upgradeable.py +++ b/slither/detectors/statements/unprotected_upgradeable.py @@ -102,7 +102,7 @@ class UnprotectedUpgradeable(AbstractDetector): info = ( [ contract, - " is an upgradeable contract that does not protect its initiliaze functions: ", + " is an upgradeable contract that does not protect its initialize functions: ", ] + initialize_functions + [ diff --git a/slither/detectors/variables/similar_variables.py b/slither/detectors/variables/similar_variables.py index 0b247434c..bab2d0acc 100644 --- a/slither/detectors/variables/similar_variables.py +++ b/slither/detectors/variables/similar_variables.py @@ -17,7 +17,9 @@ class SimilarVarsDetection(AbstractDetector): IMPACT = DetectorClassification.INFORMATIONAL CONFIDENCE = DetectorClassification.MEDIUM - WIKI = "https://github.com/crytic/slither/wiki/Detector-Documentation#variable-names-are-too-similar" + WIKI = ( + "https://github.com/crytic/slither/wiki/Detector-Documentation#variable-names-too-similar" + ) WIKI_TITLE = "Variable names too similar" WIKI_DESCRIPTION = "Detect variables with names that are too similar." diff --git a/slither/formatters/attributes/constant_pragma.py b/slither/formatters/attributes/constant_pragma.py index 572ad2fdf..251dd07ae 100644 --- a/slither/formatters/attributes/constant_pragma.py +++ b/slither/formatters/attributes/constant_pragma.py @@ -13,7 +13,7 @@ REPLACEMENT_VERSIONS = ["^0.4.25", "^0.5.3"] # 2: version number # 3: version number # 4: version number -PATTERN = re.compile("(\^|>|>=|<|<=)?([ ]+)?(\d+)\.(\d+)\.(\d+)") +PATTERN = re.compile(r"(\^|>|>=|<|<=)?([ ]+)?(\d+)\.(\d+)\.(\d+)") def custom_format(slither, result): diff --git a/slither/formatters/attributes/incorrect_solc.py b/slither/formatters/attributes/incorrect_solc.py index 0315d2285..de0025138 100644 --- a/slither/formatters/attributes/incorrect_solc.py +++ b/slither/formatters/attributes/incorrect_solc.py @@ -13,8 +13,7 @@ REPLACEMENT_VERSIONS = ["^0.4.25", "^0.5.3"] # 3: version number # 4: version number -# pylint: disable=anomalous-backslash-in-string -PATTERN = re.compile("(\^|>|>=|<|<=)?([ ]+)?(\d+)\.(\d+)\.(\d+)") +PATTERN = re.compile(r"(\^|>|>=|<|<=)?([ ]+)?(\d+)\.(\d+)\.(\d+)") def custom_format(slither, result): diff --git a/slither/formatters/naming_convention/naming_convention.py b/slither/formatters/naming_convention/naming_convention.py index daef287fa..d7720cc5a 100644 --- a/slither/formatters/naming_convention/naming_convention.py +++ b/slither/formatters/naming_convention/naming_convention.py @@ -300,10 +300,10 @@ def _patch(compilation_unit: SlitherCompilationUnit, result, element, _target): # group 2: beginning of the to type # nested mapping are within the group 1 # RE_MAPPING = '[ ]*mapping[ ]*\([ ]*([\=\>\(\) a-zA-Z0-9\._\[\]]*)[ ]*=>[ ]*([a-zA-Z0-9\._\[\]]*)\)' -RE_MAPPING_FROM = b"([a-zA-Z0-9\._\[\]]*)" -RE_MAPPING_TO = b"([\=\>\(\) a-zA-Z0-9\._\[\]\ ]*)" +RE_MAPPING_FROM = rb"([a-zA-Z0-9\._\[\]]*)" +RE_MAPPING_TO = rb"([\=\>\(\) a-zA-Z0-9\._\[\]\ ]*)" RE_MAPPING = ( - b"[ ]*mapping[ ]*\([ ]*" + RE_MAPPING_FROM + b"[ ]*" + b"=>" + b"[ ]*" + RE_MAPPING_TO + b"\)" + rb"[ ]*mapping[ ]*\([ ]*" + RE_MAPPING_FROM + b"[ ]*" + b"=>" + b"[ ]*" + RE_MAPPING_TO + rb"\)" ) diff --git a/slither/printers/summary/variable_order.py b/slither/printers/summary/variable_order.py index f976441e3..9dc9e77c2 100644 --- a/slither/printers/summary/variable_order.py +++ b/slither/printers/summary/variable_order.py @@ -28,7 +28,7 @@ class VariableOrder(AbstractPrinter): txt += f"\n{contract.name}:\n" table = MyPrettyTable(["Name", "Type", "Slot", "Offset"]) for variable in contract.state_variables_ordered: - if not variable.is_constant: + if not variable.is_constant and not variable.is_immutable: slot, offset = contract.compilation_unit.storage_layout_of(contract, variable) table.add_row([variable.canonical_name, str(variable.type), slot, offset]) diff --git a/slither/slither.py b/slither/slither.py index 6c4caaa99..4ad9bda19 100644 --- a/slither/slither.py +++ b/slither/slither.py @@ -53,7 +53,7 @@ class Slither(SlitherCore): # pylint: disable=too-many-instance-attributes Keyword Args: solc (str): solc binary location (default 'solc') disable_solc_warnings (bool): True to disable solc warnings (default false) - solc_arguments (str): solc arguments (default '') + solc_args (str): solc arguments (default '') ast_format (str): ast format (default '--ast-compact-json') filter_paths (list(str)): list of path to filter (default []) triage_mode (bool): if true, switch to triage mode (default false) diff --git a/slither/slithir/convert.py b/slither/slithir/convert.py index 663d96abe..505d5a765 100644 --- a/slither/slithir/convert.py +++ b/slither/slithir/convert.py @@ -817,12 +817,28 @@ def extract_tmp_call(ins: TmpCall, contract: Optional[Contract]): # pylint: dis # lib L { event E()} # ... # emit L.E(); - if str(ins.ori.variable_right) in [f.name for f in ins.ori.variable_left.events]: + if str(ins.ori.variable_right) in ins.ori.variable_left.events_as_dict: eventcall = EventCall(ins.ori.variable_right) eventcall.set_expression(ins.expression) eventcall.call_id = ins.call_id return eventcall + # lib Lib { error Error()} ... revert Lib.Error() + if str(ins.ori.variable_right) in ins.ori.variable_left.custom_errors_as_dict: + custom_error = ins.ori.variable_left.custom_errors_as_dict[ + str(ins.ori.variable_right) + ] + assert isinstance( + custom_error, + CustomError, + ) + sol_function = SolidityCustomRevert(custom_error) + solidity_call = SolidityCall( + sol_function, ins.nbr_arguments, ins.lvalue, ins.type_call + ) + solidity_call.set_expression(ins.expression) + return solidity_call + libcall = LibraryCall( ins.ori.variable_left, ins.ori.variable_right, @@ -1369,7 +1385,11 @@ def convert_type_library_call(ir: HighLevelCall, lib_contract: Contract): if len(candidates) == 1: func = candidates[0] - if func is None: + # We can discard if there are arguments here because libraries only support constant variables + # And constant variables cannot have non-value type + # i.e. "uint[2] constant arr = [1,2];" is not possible in Solidity + # If this were to change, the following condition might be broken + if func is None and not ir.arguments: # TODO: handle collision with multiple state variables/functions func = lib_contract.get_state_variable_from_name(ir.function_name) if func is None and candidates: diff --git a/slither/solc_parsing/expressions/expression_parsing.py b/slither/solc_parsing/expressions/expression_parsing.py index 759d3d6a2..e5c26a548 100644 --- a/slither/solc_parsing/expressions/expression_parsing.py +++ b/slither/solc_parsing/expressions/expression_parsing.py @@ -445,7 +445,7 @@ def parse_expression(expression: Dict, caller_context: CallerContextExpression) t = expression["attributes"]["type"] if t: - found = re.findall("[struct|enum|function|modifier] \(([\[\] ()a-zA-Z0-9\.,_]*)\)", t) + found = re.findall(r"[struct|enum|function|modifier] \(([\[\] ()a-zA-Z0-9\.,_]*)\)", t) assert len(found) <= 1 if found: value = value + "(" + found[0] + ")" diff --git a/slither/solc_parsing/slither_compilation_unit_solc.py b/slither/solc_parsing/slither_compilation_unit_solc.py index b7a9d4467..a2813d6df 100644 --- a/slither/solc_parsing/slither_compilation_unit_solc.py +++ b/slither/solc_parsing/slither_compilation_unit_solc.py @@ -679,12 +679,12 @@ Please rename it, this name is reserved for Slither's internals""" for func in contract.functions + contract.modifiers: try: func.generate_slithir_and_analyze() - except AttributeError: + except AttributeError as e: # This can happens for example if there is a call to an interface # And the interface is redefined due to contract's name reuse # But the available version misses some functions self._underlying_contract_to_parser[contract].log_incorrect_parsing( - f"Impossible to generate IR for {contract.name}.{func.name}" + f"Impossible to generate IR for {contract.name}.{func.name}:\n {e}" ) contract.convert_expression_to_slithir_ssa() diff --git a/slither/solc_parsing/solidity_types/type_parsing.py b/slither/solc_parsing/solidity_types/type_parsing.py index f052bba05..413339611 100644 --- a/slither/solc_parsing/solidity_types/type_parsing.py +++ b/slither/solc_parsing/solidity_types/type_parsing.py @@ -112,7 +112,7 @@ def _find_from_type_name( # pylint: disable=too-many-locals,too-many-branches,t if not var_type: if name.startswith("function "): found = re.findall( - "function \(([ ()\[\]a-zA-Z0-9\.,]*?)\)(?: payable)?(?: (?:external|internal|pure|view))?(?: returns \(([a-zA-Z0-9() \.,]*)\))?", + r"function \(([ ()\[\]a-zA-Z0-9\.,]*?)\)(?: payable)?(?: (?:external|internal|pure|view))?(?: returns \(([a-zA-Z0-9() \.,]*)\))?", name, ) assert len(found) == 1 @@ -159,10 +159,10 @@ def _find_from_type_name( # pylint: disable=too-many-locals,too-many-branches,t if name.startswith("mapping("): # nested mapping declared with var if name.count("mapping(") == 1: - found = re.findall("mapping\(([a-zA-Z0-9\.]*) => ([ a-zA-Z0-9\.\[\]]*)\)", name) + found = re.findall(r"mapping\(([a-zA-Z0-9\.]*) => ([ a-zA-Z0-9\.\[\]]*)\)", name) else: found = re.findall( - "mapping\(([a-zA-Z0-9\.]*) => (mapping\([=> a-zA-Z0-9\.\[\]]*\))\)", + r"mapping\(([a-zA-Z0-9\.]*) => (mapping\([=> a-zA-Z0-9\.\[\]]*\))\)", name, ) assert len(found) == 1 diff --git a/slither/solc_parsing/yul/parse_yul.py b/slither/solc_parsing/yul/parse_yul.py index 8b62dbdc9..7bd4f4e1f 100644 --- a/slither/solc_parsing/yul/parse_yul.py +++ b/slither/solc_parsing/yul/parse_yul.py @@ -738,7 +738,7 @@ def _parse_yul_magic_suffixes(name: str, root: YulScope) -> Optional[Expression] # Currently SlithIR doesnt support raw access to memory # So things like .offset/.slot will return the variable # Instaed of the actual offset/slot - if name.endswith("_slot") or name.endswith(".slot"): + if name.endswith(("_slot", ".slot")): potential_name = name[:-5] variable_found = _check_for_state_variable_name(root, potential_name) if variable_found: @@ -746,7 +746,7 @@ def _parse_yul_magic_suffixes(name: str, root: YulScope) -> Optional[Expression] var = root.function.get_local_variable_from_name(potential_name) if var and var.is_storage: return Identifier(var) - if name.endswith("_offset") or name.endswith(".offset"): + if name.endswith(("_offset", ".offset")): potential_name = name[:-7] variable_found = _check_for_state_variable_name(root, potential_name) if variable_found: diff --git a/slither/tools/erc_conformance/erc/ercs.py b/slither/tools/erc_conformance/erc/ercs.py index 1c64dc4a7..afc9a698a 100644 --- a/slither/tools/erc_conformance/erc/ercs.py +++ b/slither/tools/erc_conformance/erc/ercs.py @@ -192,9 +192,10 @@ def generic_erc_checks(contract, erc_functions, erc_events, ret, explored=None): logger.info("## Check functions") for erc_function in erc_functions: _check_signature(erc_function, contract, ret) - logger.info("\n## Check events") - for erc_event in erc_events: - _check_events(erc_event, contract, ret) + if erc_events: + logger.info("\n## Check events") + for erc_event in erc_events: + _check_events(erc_event, contract, ret) logger.info("\n") diff --git a/slither/tools/kspec_coverage/analysis.py b/slither/tools/kspec_coverage/analysis.py index 92d9e49d8..3d513d22f 100755 --- a/slither/tools/kspec_coverage/analysis.py +++ b/slither/tools/kspec_coverage/analysis.py @@ -22,8 +22,8 @@ def _get_all_covered_kspec_functions(target: str) -> Set[Tuple[str, str]]: # Create a set of our discovered functions which are covered covered_functions: Set[Tuple[str, str]] = set() - BEHAVIOUR_PATTERN = re.compile("behaviour\s+(\S+)\s+of\s+(\S+)") - INTERFACE_PATTERN = re.compile("interface\s+([^\r\n]+)") + BEHAVIOUR_PATTERN = re.compile(r"behaviour\s+(\S+)\s+of\s+(\S+)") + INTERFACE_PATTERN = re.compile(r"interface\s+([^\r\n]+)") # Read the file contents with open(target, "r", encoding="utf8") as target_file: diff --git a/slither/tools/read_storage/README.md b/slither/tools/read_storage/README.md index 8d9b70fcb..91491a364 100644 --- a/slither/tools/read_storage/README.md +++ b/slither/tools/read_storage/README.md @@ -46,13 +46,13 @@ slither-read-storage 0x8ad599c3a0ff1de082011efddc58f1908eb6e6d8 --layout --rpc-u To view only the slot of the `slot0` structure variable, pass `--variable-name slot0`: ```shell -slither-read-storage 0x8ad599c3a0ff1de082011efddc58f1908eb6e6d8 --variable-name slot0 --rpc-url https://mainnet.infura.io/v3/04942f7970ef41cc847a147bc64e460e --value +slither-read-storage 0x8ad599c3a0ff1de082011efddc58f1908eb6e6d8 --variable-name slot0 --rpc-url $RPC_URL --value ``` To view a member of the `slot0` struct, pass `--struct-var tick` ```shell -slither-read-storage 0x8ad599c3a0ff1de082011efddc58f1908eb6e6d8 --variable-name slot0 --rpc-url https://mainnet.infura.io/v3/04942f7970ef41cc847a147bc64e460e --value --struct-var tick +slither-read-storage 0x8ad599c3a0ff1de082011efddc58f1908eb6e6d8 --variable-name slot0 --rpc-url $RPC_URL --value --struct-var tick ``` Retrieve the ERC20 balance slot of an account: diff --git a/slither/tools/upgradeability/checks/initialization.py b/slither/tools/upgradeability/checks/initialization.py index d8f6876ef..2055a322a 100644 --- a/slither/tools/upgradeability/checks/initialization.py +++ b/slither/tools/upgradeability/checks/initialization.py @@ -15,7 +15,7 @@ class MultipleInitTarget(Exception): pass -def _has_initiliaze_modifier(function: Function): +def _has_initialize_modifier(function: Function): if not function.modifiers: return False return any((m.name == "initializer") for m in function.modifiers) @@ -25,7 +25,7 @@ def _get_initialize_functions(contract): return [ f for f in contract.functions - if (f.name == "initialize" or _has_initiliaze_modifier(f)) and f.is_implemented + if (f.name == "initialize" or _has_initialize_modifier(f)) and f.is_implemented ] @@ -313,7 +313,7 @@ contract DerivedDerived is Derived{ } ``` -`Base.initialize(uint)` is called two times in `DerivedDerived.initiliaze` execution, leading to a potential corruption. +`Base.initialize(uint)` is called two times in `DerivedDerived.initialize` execution, leading to a potential corruption. """ # endregion wiki_exploit_scenario diff --git a/slither/utils/colors.py b/slither/utils/colors.py index aff4fa373..14fc4b345 100644 --- a/slither/utils/colors.py +++ b/slither/utils/colors.py @@ -1,5 +1,6 @@ from functools import partial import platform +import sys class Colors: # pylint: disable=too-few-public-methods @@ -73,7 +74,7 @@ def set_colorization_enabled(enabled: bool): if enabled and platform.system() == "Windows": Colors.COLORIZATION_ENABLED = enable_windows_virtual_terminal_sequences() else: - # This is not windows so we can enable color immediately. + # This is not windows, or colorization is being disabled, so we can adjust the state immediately. Colors.COLORIZATION_ENABLED = enabled @@ -83,6 +84,5 @@ red = partial(colorize, Colors.RED) blue = partial(colorize, Colors.BLUE) magenta = partial(colorize, Colors.MAGENTA) -# We enable colorization by default (this call is important as it will enable color mode on Windows by default), -# regardless of whether Slither is interacted with from CLI or another script. -set_colorization_enabled(True) +# We enable colorization by default if the output is a tty +set_colorization_enabled(sys.stdout.isatty()) diff --git a/slither/utils/erc.py b/slither/utils/erc.py index af91886fd..0b8c99bb4 100644 --- a/slither/utils/erc.py +++ b/slither/utils/erc.py @@ -340,6 +340,53 @@ ERC2612 = [ ERC2612_signatures = erc_to_signatures(ERC2612) +# Review +# https://eips.ethereum.org/EIPS/eip-1363 +# Must have ERC20 and ERC165 + +ERC1363_EVENTS = [] +ERC1363 = ( + [ + ERC("transferAndCall", ["address", "uint256"], "bool", False, True, []), + ERC("transferAndCall", ["address", "uint256", "bytes"], "bool", False, True, []), + ERC("transferFromAndCall", ["address", "address", "uint256"], "bool", False, True, []), + ERC( + "transferFromAndCall", + ["address", "address", "uint256", "bytes"], + "bool", + False, + True, + [], + ), + ERC("approveAndCall", ["address", "uint256"], "bool", False, True, []), + ERC("approveAndCall", ["address", "uint256", "bytes"], "bool", False, True, []), + ] + + ERC20 + + ERC165 +) + +ERC1363_signatures = erc_to_signatures(ERC1363) + +# Review +# https://eips.ethereum.org/EIPS/eip-4524 +# Must have ERC20 and ERC165 + +ERC4524_EVENTS = [] +ERC4524 = ( + [ + ERC("safeTransfer", ["address", "uint256"], "bool", False, True, []), + ERC("safeTransfer", ["address", "uint256", "bytes"], "bool", False, True, []), + ERC("safeTransferFrom", ["address", "address", "uint256"], "bool", False, True, []), + ERC( + "safeTransferFrom", ["address", "address", "uint256", "bytes"], "bool", False, True, [] + ), + ] + + ERC20 + + ERC165 +) + +ERC4524_signatures = erc_to_signatures(ERC4524) + # Final # https://eips.ethereum.org/EIPS/eip-4626 # Must have ERC20 @@ -405,5 +452,7 @@ ERCS = { "ERC777": (ERC777, ERC777_EVENTS), "ERC1155": (ERC1155, ERC1155_EVENTS), "ERC2612": (ERC2612, ERC2612_EVENTS), + "ERC1363": (ERC1363, ERC1363_EVENTS), + "ERC4524": (ERC4524, ERC4524_EVENTS), "ERC4626": (ERC4626, ERC4626_EVENTS), } diff --git a/slither/utils/integer_conversion.py b/slither/utils/integer_conversion.py index d4a3b4847..8481e8641 100644 --- a/slither/utils/integer_conversion.py +++ b/slither/utils/integer_conversion.py @@ -7,7 +7,7 @@ from slither.exceptions import SlitherError def convert_string_to_int(val: Union[str, int]) -> int: if isinstance(val, int): return val - if val.startswith("0x") or val.startswith("0X"): + if val.startswith(("0x", "0X")): return int(val, 16) if "e" in val or "E" in val: diff --git a/slither/utils/output.py b/slither/utils/output.py index 16c9f5bbf..6ee59b4c6 100644 --- a/slither/utils/output.py +++ b/slither/utils/output.py @@ -160,7 +160,7 @@ def output_to_sarif( ], } - for detector in results["detectors"]: + for detector in results.get("detectors", []): _output_result_to_sarif(detector, detectors_classes, sarif) if filename == "-": diff --git a/slither/visitors/slithir/expression_to_slithir.py b/slither/visitors/slithir/expression_to_slithir.py index 0029c29ed..3c4595b92 100644 --- a/slither/visitors/slithir/expression_to_slithir.py +++ b/slither/visitors/slithir/expression_to_slithir.py @@ -9,6 +9,7 @@ from slither.core.declarations import ( SolidityFunction, Contract, ) +from slither.core.declarations.enum import Enum from slither.core.expressions import ( AssignmentOperationType, UnaryOperationType, @@ -403,18 +404,25 @@ class ExpressionToSlithIR(ExpressionVisitor): assert len(expression.expression.arguments) == 1 val = TemporaryVariable(self._node) type_expression_found = expression.expression.arguments[0] - assert isinstance(type_expression_found, ElementaryTypeNameExpression) - type_found = type_expression_found.type - if expression.member_name == "min:": + if isinstance(type_expression_found, ElementaryTypeNameExpression): + type_found = type_expression_found.type + constant_type = type_found + else: + # type(enum).max/min + assert isinstance(type_expression_found, Identifier) + type_found = type_expression_found.value + assert isinstance(type_found, Enum) + constant_type = None + if expression.member_name == "min": op = Assignment( val, - Constant(str(type_found.min), type_found), + Constant(str(type_found.min), constant_type), type_found, ) else: op = Assignment( val, - Constant(str(type_found.max), type_found), + Constant(str(type_found.max), constant_type), type_found, ) self._result.append(op) diff --git a/tests/ast-parsing/compile/assembly-all.sol-0.8.13-compact.zip b/tests/ast-parsing/compile/assembly-all.sol-0.8.13-compact.zip new file mode 100644 index 000000000..87ef389a3 Binary files /dev/null and b/tests/ast-parsing/compile/assembly-all.sol-0.8.13-compact.zip differ diff --git a/tests/ast-parsing/compile/assembly-all.sol-0.8.14-compact.zip b/tests/ast-parsing/compile/assembly-all.sol-0.8.14-compact.zip new file mode 100644 index 000000000..20246078f Binary files /dev/null and b/tests/ast-parsing/compile/assembly-all.sol-0.8.14-compact.zip differ diff --git a/tests/ast-parsing/compile/assembly-all.sol-0.8.15-compact.zip b/tests/ast-parsing/compile/assembly-all.sol-0.8.15-compact.zip new file mode 100644 index 000000000..30420079b Binary files /dev/null and b/tests/ast-parsing/compile/assembly-all.sol-0.8.15-compact.zip differ diff --git a/tests/ast-parsing/compile/assignment-0.4.7.sol-0.8.13-compact.zip b/tests/ast-parsing/compile/assignment-0.4.7.sol-0.8.13-compact.zip new file mode 100644 index 000000000..56a56a4aa Binary files /dev/null and b/tests/ast-parsing/compile/assignment-0.4.7.sol-0.8.13-compact.zip differ diff --git a/tests/ast-parsing/compile/assignment-0.4.7.sol-0.8.14-compact.zip b/tests/ast-parsing/compile/assignment-0.4.7.sol-0.8.14-compact.zip new file mode 100644 index 000000000..fe97cd497 Binary files /dev/null and b/tests/ast-parsing/compile/assignment-0.4.7.sol-0.8.14-compact.zip differ diff --git a/tests/ast-parsing/compile/assignment-0.4.7.sol-0.8.15-compact.zip b/tests/ast-parsing/compile/assignment-0.4.7.sol-0.8.15-compact.zip new file mode 100644 index 000000000..5861d82d6 Binary files /dev/null and b/tests/ast-parsing/compile/assignment-0.4.7.sol-0.8.15-compact.zip differ diff --git a/tests/ast-parsing/compile/break-all.sol-0.8.13-compact.zip b/tests/ast-parsing/compile/break-all.sol-0.8.13-compact.zip new file mode 100644 index 000000000..a627f5cc4 Binary files /dev/null and b/tests/ast-parsing/compile/break-all.sol-0.8.13-compact.zip differ diff --git a/tests/ast-parsing/compile/break-all.sol-0.8.14-compact.zip b/tests/ast-parsing/compile/break-all.sol-0.8.14-compact.zip new file mode 100644 index 000000000..9f2efe6fa Binary files /dev/null and b/tests/ast-parsing/compile/break-all.sol-0.8.14-compact.zip differ diff --git a/tests/ast-parsing/compile/break-all.sol-0.8.15-compact.zip b/tests/ast-parsing/compile/break-all.sol-0.8.15-compact.zip new file mode 100644 index 000000000..33b07f2ec Binary files /dev/null and b/tests/ast-parsing/compile/break-all.sol-0.8.15-compact.zip differ diff --git a/tests/ast-parsing/compile/call_to_variable-all.sol-0.8.13-compact.zip b/tests/ast-parsing/compile/call_to_variable-all.sol-0.8.13-compact.zip new file mode 100644 index 000000000..b7b06e703 Binary files /dev/null and b/tests/ast-parsing/compile/call_to_variable-all.sol-0.8.13-compact.zip differ diff --git a/tests/ast-parsing/compile/call_to_variable-all.sol-0.8.14-compact.zip b/tests/ast-parsing/compile/call_to_variable-all.sol-0.8.14-compact.zip new file mode 100644 index 000000000..69f5fe692 Binary files /dev/null and b/tests/ast-parsing/compile/call_to_variable-all.sol-0.8.14-compact.zip differ diff --git a/tests/ast-parsing/compile/call_to_variable-all.sol-0.8.15-compact.zip b/tests/ast-parsing/compile/call_to_variable-all.sol-0.8.15-compact.zip new file mode 100644 index 000000000..664c1b379 Binary files /dev/null and b/tests/ast-parsing/compile/call_to_variable-all.sol-0.8.15-compact.zip differ diff --git a/tests/ast-parsing/compile/comment-all.sol-0.8.13-compact.zip b/tests/ast-parsing/compile/comment-all.sol-0.8.13-compact.zip new file mode 100644 index 000000000..69aa742a2 Binary files /dev/null and b/tests/ast-parsing/compile/comment-all.sol-0.8.13-compact.zip differ diff --git a/tests/ast-parsing/compile/comment-all.sol-0.8.14-compact.zip b/tests/ast-parsing/compile/comment-all.sol-0.8.14-compact.zip new file mode 100644 index 000000000..44cbee76c Binary files /dev/null and b/tests/ast-parsing/compile/comment-all.sol-0.8.14-compact.zip differ diff --git a/tests/ast-parsing/compile/comment-all.sol-0.8.15-compact.zip b/tests/ast-parsing/compile/comment-all.sol-0.8.15-compact.zip new file mode 100644 index 000000000..1424b07d8 Binary files /dev/null and b/tests/ast-parsing/compile/comment-all.sol-0.8.15-compact.zip differ diff --git a/tests/ast-parsing/compile/complex_imports/import_aliases/test.sol-0.8.13-compact.zip b/tests/ast-parsing/compile/complex_imports/import_aliases/test.sol-0.8.13-compact.zip new file mode 100644 index 000000000..735878448 Binary files /dev/null and b/tests/ast-parsing/compile/complex_imports/import_aliases/test.sol-0.8.13-compact.zip differ diff --git a/tests/ast-parsing/compile/complex_imports/import_aliases/test.sol-0.8.14-compact.zip b/tests/ast-parsing/compile/complex_imports/import_aliases/test.sol-0.8.14-compact.zip new file mode 100644 index 000000000..ac00a3c40 Binary files /dev/null and b/tests/ast-parsing/compile/complex_imports/import_aliases/test.sol-0.8.14-compact.zip differ diff --git a/tests/ast-parsing/compile/complex_imports/import_aliases/test.sol-0.8.15-compact.zip b/tests/ast-parsing/compile/complex_imports/import_aliases/test.sol-0.8.15-compact.zip new file mode 100644 index 000000000..59c2d7d46 Binary files /dev/null and b/tests/ast-parsing/compile/complex_imports/import_aliases/test.sol-0.8.15-compact.zip differ diff --git a/tests/ast-parsing/compile/conditional-all.sol-0.8.13-compact.zip b/tests/ast-parsing/compile/conditional-all.sol-0.8.13-compact.zip new file mode 100644 index 000000000..b421fef9f Binary files /dev/null and b/tests/ast-parsing/compile/conditional-all.sol-0.8.13-compact.zip differ diff --git a/tests/ast-parsing/compile/conditional-all.sol-0.8.14-compact.zip b/tests/ast-parsing/compile/conditional-all.sol-0.8.14-compact.zip new file mode 100644 index 000000000..53fac4b2b Binary files /dev/null and b/tests/ast-parsing/compile/conditional-all.sol-0.8.14-compact.zip differ diff --git a/tests/ast-parsing/compile/conditional-all.sol-0.8.15-compact.zip b/tests/ast-parsing/compile/conditional-all.sol-0.8.15-compact.zip new file mode 100644 index 000000000..e3e2adef6 Binary files /dev/null and b/tests/ast-parsing/compile/conditional-all.sol-0.8.15-compact.zip differ diff --git a/tests/ast-parsing/compile/continue-all.sol-0.8.13-compact.zip b/tests/ast-parsing/compile/continue-all.sol-0.8.13-compact.zip new file mode 100644 index 000000000..c34c7794e Binary files /dev/null and b/tests/ast-parsing/compile/continue-all.sol-0.8.13-compact.zip differ diff --git a/tests/ast-parsing/compile/continue-all.sol-0.8.14-compact.zip b/tests/ast-parsing/compile/continue-all.sol-0.8.14-compact.zip new file mode 100644 index 000000000..fe086dd31 Binary files /dev/null and b/tests/ast-parsing/compile/continue-all.sol-0.8.14-compact.zip differ diff --git a/tests/ast-parsing/compile/continue-all.sol-0.8.15-compact.zip b/tests/ast-parsing/compile/continue-all.sol-0.8.15-compact.zip new file mode 100644 index 000000000..03b7d5b7d Binary files /dev/null and b/tests/ast-parsing/compile/continue-all.sol-0.8.15-compact.zip differ diff --git a/tests/ast-parsing/compile/contract-0.6.0.sol-0.8.13-compact.zip b/tests/ast-parsing/compile/contract-0.6.0.sol-0.8.13-compact.zip new file mode 100644 index 000000000..b3397b955 Binary files /dev/null and b/tests/ast-parsing/compile/contract-0.6.0.sol-0.8.13-compact.zip differ diff --git a/tests/ast-parsing/compile/contract-0.6.0.sol-0.8.14-compact.zip b/tests/ast-parsing/compile/contract-0.6.0.sol-0.8.14-compact.zip new file mode 100644 index 000000000..9f1f52b6d Binary files /dev/null and b/tests/ast-parsing/compile/contract-0.6.0.sol-0.8.14-compact.zip differ diff --git a/tests/ast-parsing/compile/contract-0.6.0.sol-0.8.15-compact.zip b/tests/ast-parsing/compile/contract-0.6.0.sol-0.8.15-compact.zip new file mode 100644 index 000000000..5fc388cc6 Binary files /dev/null and b/tests/ast-parsing/compile/contract-0.6.0.sol-0.8.15-compact.zip differ diff --git a/tests/ast-parsing/compile/custom_error-0.4.0.sol-0.8.13-compact.zip b/tests/ast-parsing/compile/custom_error-0.4.0.sol-0.8.13-compact.zip new file mode 100644 index 000000000..5f5fdd9ea Binary files /dev/null and b/tests/ast-parsing/compile/custom_error-0.4.0.sol-0.8.13-compact.zip differ diff --git a/tests/ast-parsing/compile/custom_error-0.4.0.sol-0.8.14-compact.zip b/tests/ast-parsing/compile/custom_error-0.4.0.sol-0.8.14-compact.zip new file mode 100644 index 000000000..15f1623cc Binary files /dev/null and b/tests/ast-parsing/compile/custom_error-0.4.0.sol-0.8.14-compact.zip differ diff --git a/tests/ast-parsing/compile/custom_error-0.4.0.sol-0.8.15-compact.zip b/tests/ast-parsing/compile/custom_error-0.4.0.sol-0.8.15-compact.zip new file mode 100644 index 000000000..a08315095 Binary files /dev/null and b/tests/ast-parsing/compile/custom_error-0.4.0.sol-0.8.15-compact.zip differ diff --git a/tests/ast-parsing/compile/custom_error_with_state_variable.sol-0.8.10-compact.zip b/tests/ast-parsing/compile/custom_error_with_state_variable.sol-0.8.10-compact.zip index 01047e8a4..e73171e2c 100644 Binary files a/tests/ast-parsing/compile/custom_error_with_state_variable.sol-0.8.10-compact.zip and b/tests/ast-parsing/compile/custom_error_with_state_variable.sol-0.8.10-compact.zip differ diff --git a/tests/ast-parsing/compile/custom_error_with_state_variable.sol-0.8.11-compact.zip b/tests/ast-parsing/compile/custom_error_with_state_variable.sol-0.8.11-compact.zip index bd6e4601b..a125cbf64 100644 Binary files a/tests/ast-parsing/compile/custom_error_with_state_variable.sol-0.8.11-compact.zip and b/tests/ast-parsing/compile/custom_error_with_state_variable.sol-0.8.11-compact.zip differ diff --git a/tests/ast-parsing/compile/custom_error_with_state_variable.sol-0.8.12-compact.zip b/tests/ast-parsing/compile/custom_error_with_state_variable.sol-0.8.12-compact.zip index 280e34a23..0980aa872 100644 Binary files a/tests/ast-parsing/compile/custom_error_with_state_variable.sol-0.8.12-compact.zip and b/tests/ast-parsing/compile/custom_error_with_state_variable.sol-0.8.12-compact.zip differ diff --git a/tests/ast-parsing/compile/custom_error_with_state_variable.sol-0.8.4-compact.zip b/tests/ast-parsing/compile/custom_error_with_state_variable.sol-0.8.4-compact.zip index 6f266328a..ced46fe30 100644 Binary files a/tests/ast-parsing/compile/custom_error_with_state_variable.sol-0.8.4-compact.zip and b/tests/ast-parsing/compile/custom_error_with_state_variable.sol-0.8.4-compact.zip differ diff --git a/tests/ast-parsing/compile/custom_error_with_state_variable.sol-0.8.5-compact.zip b/tests/ast-parsing/compile/custom_error_with_state_variable.sol-0.8.5-compact.zip index 4a40284c5..1c1f762dc 100644 Binary files a/tests/ast-parsing/compile/custom_error_with_state_variable.sol-0.8.5-compact.zip and b/tests/ast-parsing/compile/custom_error_with_state_variable.sol-0.8.5-compact.zip differ diff --git a/tests/ast-parsing/compile/custom_error_with_state_variable.sol-0.8.6-compact.zip b/tests/ast-parsing/compile/custom_error_with_state_variable.sol-0.8.6-compact.zip index 2018f2bc0..f01a2afb9 100644 Binary files a/tests/ast-parsing/compile/custom_error_with_state_variable.sol-0.8.6-compact.zip and b/tests/ast-parsing/compile/custom_error_with_state_variable.sol-0.8.6-compact.zip differ diff --git a/tests/ast-parsing/compile/custom_error_with_state_variable.sol-0.8.7-compact.zip b/tests/ast-parsing/compile/custom_error_with_state_variable.sol-0.8.7-compact.zip index 32caea70c..8584364ee 100644 Binary files a/tests/ast-parsing/compile/custom_error_with_state_variable.sol-0.8.7-compact.zip and b/tests/ast-parsing/compile/custom_error_with_state_variable.sol-0.8.7-compact.zip differ diff --git a/tests/ast-parsing/compile/custom_error_with_state_variable.sol-0.8.8-compact.zip b/tests/ast-parsing/compile/custom_error_with_state_variable.sol-0.8.8-compact.zip index 9db379a58..f2792f8c6 100644 Binary files a/tests/ast-parsing/compile/custom_error_with_state_variable.sol-0.8.8-compact.zip and b/tests/ast-parsing/compile/custom_error_with_state_variable.sol-0.8.8-compact.zip differ diff --git a/tests/ast-parsing/compile/custom_error_with_state_variable.sol-0.8.9-compact.zip b/tests/ast-parsing/compile/custom_error_with_state_variable.sol-0.8.9-compact.zip index f7978ae92..3bb519f00 100644 Binary files a/tests/ast-parsing/compile/custom_error_with_state_variable.sol-0.8.9-compact.zip and b/tests/ast-parsing/compile/custom_error_with_state_variable.sol-0.8.9-compact.zip differ diff --git a/tests/ast-parsing/compile/dowhile-0.4.5.sol-0.8.13-compact.zip b/tests/ast-parsing/compile/dowhile-0.4.5.sol-0.8.13-compact.zip new file mode 100644 index 000000000..8d6cd4f91 Binary files /dev/null and b/tests/ast-parsing/compile/dowhile-0.4.5.sol-0.8.13-compact.zip differ diff --git a/tests/ast-parsing/compile/dowhile-0.4.5.sol-0.8.14-compact.zip b/tests/ast-parsing/compile/dowhile-0.4.5.sol-0.8.14-compact.zip new file mode 100644 index 000000000..273da3edb Binary files /dev/null and b/tests/ast-parsing/compile/dowhile-0.4.5.sol-0.8.14-compact.zip differ diff --git a/tests/ast-parsing/compile/dowhile-0.4.5.sol-0.8.15-compact.zip b/tests/ast-parsing/compile/dowhile-0.4.5.sol-0.8.15-compact.zip new file mode 100644 index 000000000..5a34a9fa0 Binary files /dev/null and b/tests/ast-parsing/compile/dowhile-0.4.5.sol-0.8.15-compact.zip differ diff --git a/tests/ast-parsing/compile/emit-0.5.0.sol-0.8.13-compact.zip b/tests/ast-parsing/compile/emit-0.5.0.sol-0.8.13-compact.zip new file mode 100644 index 000000000..c2847ecbc Binary files /dev/null and b/tests/ast-parsing/compile/emit-0.5.0.sol-0.8.13-compact.zip differ diff --git a/tests/ast-parsing/compile/emit-0.5.0.sol-0.8.14-compact.zip b/tests/ast-parsing/compile/emit-0.5.0.sol-0.8.14-compact.zip new file mode 100644 index 000000000..7e285e335 Binary files /dev/null and b/tests/ast-parsing/compile/emit-0.5.0.sol-0.8.14-compact.zip differ diff --git a/tests/ast-parsing/compile/emit-0.5.0.sol-0.8.15-compact.zip b/tests/ast-parsing/compile/emit-0.5.0.sol-0.8.15-compact.zip new file mode 100644 index 000000000..511c40b94 Binary files /dev/null and b/tests/ast-parsing/compile/emit-0.5.0.sol-0.8.15-compact.zip differ diff --git a/tests/ast-parsing/compile/enum-0.8.0.sol-0.8.13-compact.zip b/tests/ast-parsing/compile/enum-0.8.0.sol-0.8.13-compact.zip new file mode 100644 index 000000000..0535039b0 Binary files /dev/null and b/tests/ast-parsing/compile/enum-0.8.0.sol-0.8.13-compact.zip differ diff --git a/tests/ast-parsing/compile/enum-0.8.0.sol-0.8.14-compact.zip b/tests/ast-parsing/compile/enum-0.8.0.sol-0.8.14-compact.zip new file mode 100644 index 000000000..7b9bf9990 Binary files /dev/null and b/tests/ast-parsing/compile/enum-0.8.0.sol-0.8.14-compact.zip differ diff --git a/tests/ast-parsing/compile/enum-0.8.0.sol-0.8.15-compact.zip b/tests/ast-parsing/compile/enum-0.8.0.sol-0.8.15-compact.zip new file mode 100644 index 000000000..560485005 Binary files /dev/null and b/tests/ast-parsing/compile/enum-0.8.0.sol-0.8.15-compact.zip differ diff --git a/tests/ast-parsing/compile/event-all.sol-0.8.13-compact.zip b/tests/ast-parsing/compile/event-all.sol-0.8.13-compact.zip new file mode 100644 index 000000000..8df293c03 Binary files /dev/null and b/tests/ast-parsing/compile/event-all.sol-0.8.13-compact.zip differ diff --git a/tests/ast-parsing/compile/event-all.sol-0.8.14-compact.zip b/tests/ast-parsing/compile/event-all.sol-0.8.14-compact.zip new file mode 100644 index 000000000..4ac15f98f Binary files /dev/null and b/tests/ast-parsing/compile/event-all.sol-0.8.14-compact.zip differ diff --git a/tests/ast-parsing/compile/event-all.sol-0.8.15-compact.zip b/tests/ast-parsing/compile/event-all.sol-0.8.15-compact.zip new file mode 100644 index 000000000..f934cfe02 Binary files /dev/null and b/tests/ast-parsing/compile/event-all.sol-0.8.15-compact.zip differ diff --git a/tests/ast-parsing/compile/for-all.sol-0.8.13-compact.zip b/tests/ast-parsing/compile/for-all.sol-0.8.13-compact.zip new file mode 100644 index 000000000..a0f36910f Binary files /dev/null and b/tests/ast-parsing/compile/for-all.sol-0.8.13-compact.zip differ diff --git a/tests/ast-parsing/compile/for-all.sol-0.8.14-compact.zip b/tests/ast-parsing/compile/for-all.sol-0.8.14-compact.zip new file mode 100644 index 000000000..be8cabc87 Binary files /dev/null and b/tests/ast-parsing/compile/for-all.sol-0.8.14-compact.zip differ diff --git a/tests/ast-parsing/compile/for-all.sol-0.8.15-compact.zip b/tests/ast-parsing/compile/for-all.sol-0.8.15-compact.zip new file mode 100644 index 000000000..61da5bf91 Binary files /dev/null and b/tests/ast-parsing/compile/for-all.sol-0.8.15-compact.zip differ diff --git a/tests/ast-parsing/compile/free_functions/libraries_from_free.sol-0.8.12-compact.zip b/tests/ast-parsing/compile/free_functions/libraries_from_free.sol-0.8.12-compact.zip new file mode 100644 index 000000000..13d54539f Binary files /dev/null and b/tests/ast-parsing/compile/free_functions/libraries_from_free.sol-0.8.12-compact.zip differ diff --git a/tests/ast-parsing/compile/free_functions/library_constant_function_collision.sol-0.8.12-compact.zip b/tests/ast-parsing/compile/free_functions/library_constant_function_collision.sol-0.8.12-compact.zip new file mode 100644 index 000000000..da8a53503 Binary files /dev/null and b/tests/ast-parsing/compile/free_functions/library_constant_function_collision.sol-0.8.12-compact.zip differ diff --git a/tests/ast-parsing/compile/free_functions/new_operator.sol-0.8.12-compact.zip b/tests/ast-parsing/compile/free_functions/new_operator.sol-0.8.12-compact.zip new file mode 100644 index 000000000..7135e729d Binary files /dev/null and b/tests/ast-parsing/compile/free_functions/new_operator.sol-0.8.12-compact.zip differ diff --git a/tests/ast-parsing/compile/function-0.7.1.sol-0.8.13-compact.zip b/tests/ast-parsing/compile/function-0.7.1.sol-0.8.13-compact.zip new file mode 100644 index 000000000..d49dc3e3e Binary files /dev/null and b/tests/ast-parsing/compile/function-0.7.1.sol-0.8.13-compact.zip differ diff --git a/tests/ast-parsing/compile/function-0.7.1.sol-0.8.14-compact.zip b/tests/ast-parsing/compile/function-0.7.1.sol-0.8.14-compact.zip new file mode 100644 index 000000000..546cb8f3f Binary files /dev/null and b/tests/ast-parsing/compile/function-0.7.1.sol-0.8.14-compact.zip differ diff --git a/tests/ast-parsing/compile/function-0.7.1.sol-0.8.15-compact.zip b/tests/ast-parsing/compile/function-0.7.1.sol-0.8.15-compact.zip new file mode 100644 index 000000000..bb40cc0ff Binary files /dev/null and b/tests/ast-parsing/compile/function-0.7.1.sol-0.8.15-compact.zip differ diff --git a/tests/ast-parsing/compile/functioncall-0.8.0.sol-0.8.13-compact.zip b/tests/ast-parsing/compile/functioncall-0.8.0.sol-0.8.13-compact.zip new file mode 100644 index 000000000..628f409cb Binary files /dev/null and b/tests/ast-parsing/compile/functioncall-0.8.0.sol-0.8.13-compact.zip differ diff --git a/tests/ast-parsing/compile/functioncall-0.8.0.sol-0.8.14-compact.zip b/tests/ast-parsing/compile/functioncall-0.8.0.sol-0.8.14-compact.zip new file mode 100644 index 000000000..34cf27caf Binary files /dev/null and b/tests/ast-parsing/compile/functioncall-0.8.0.sol-0.8.14-compact.zip differ diff --git a/tests/ast-parsing/compile/functioncall-0.8.0.sol-0.8.15-compact.zip b/tests/ast-parsing/compile/functioncall-0.8.0.sol-0.8.15-compact.zip new file mode 100644 index 000000000..bc951a89d Binary files /dev/null and b/tests/ast-parsing/compile/functioncall-0.8.0.sol-0.8.15-compact.zip differ diff --git a/tests/ast-parsing/compile/if-all.sol-0.8.13-compact.zip b/tests/ast-parsing/compile/if-all.sol-0.8.13-compact.zip new file mode 100644 index 000000000..309ebec22 Binary files /dev/null and b/tests/ast-parsing/compile/if-all.sol-0.8.13-compact.zip differ diff --git a/tests/ast-parsing/compile/if-all.sol-0.8.14-compact.zip b/tests/ast-parsing/compile/if-all.sol-0.8.14-compact.zip new file mode 100644 index 000000000..184f82753 Binary files /dev/null and b/tests/ast-parsing/compile/if-all.sol-0.8.14-compact.zip differ diff --git a/tests/ast-parsing/compile/if-all.sol-0.8.15-compact.zip b/tests/ast-parsing/compile/if-all.sol-0.8.15-compact.zip new file mode 100644 index 000000000..1851aff07 Binary files /dev/null and b/tests/ast-parsing/compile/if-all.sol-0.8.15-compact.zip differ diff --git a/tests/ast-parsing/compile/import_interface_with_struct_from_top_level-0.7.6.sol-0.8.13-compact.zip b/tests/ast-parsing/compile/import_interface_with_struct_from_top_level-0.7.6.sol-0.8.13-compact.zip new file mode 100644 index 000000000..2a75f5def Binary files /dev/null and b/tests/ast-parsing/compile/import_interface_with_struct_from_top_level-0.7.6.sol-0.8.13-compact.zip differ diff --git a/tests/ast-parsing/compile/import_interface_with_struct_from_top_level-0.7.6.sol-0.8.14-compact.zip b/tests/ast-parsing/compile/import_interface_with_struct_from_top_level-0.7.6.sol-0.8.14-compact.zip new file mode 100644 index 000000000..9a4b41040 Binary files /dev/null and b/tests/ast-parsing/compile/import_interface_with_struct_from_top_level-0.7.6.sol-0.8.14-compact.zip differ diff --git a/tests/ast-parsing/compile/import_interface_with_struct_from_top_level-0.7.6.sol-0.8.15-compact.zip b/tests/ast-parsing/compile/import_interface_with_struct_from_top_level-0.7.6.sol-0.8.15-compact.zip new file mode 100644 index 000000000..0f89b6922 Binary files /dev/null and b/tests/ast-parsing/compile/import_interface_with_struct_from_top_level-0.7.6.sol-0.8.15-compact.zip differ diff --git a/tests/ast-parsing/compile/indexaccess-all.sol-0.8.13-compact.zip b/tests/ast-parsing/compile/indexaccess-all.sol-0.8.13-compact.zip new file mode 100644 index 000000000..0f1e4e6be Binary files /dev/null and b/tests/ast-parsing/compile/indexaccess-all.sol-0.8.13-compact.zip differ diff --git a/tests/ast-parsing/compile/indexaccess-all.sol-0.8.14-compact.zip b/tests/ast-parsing/compile/indexaccess-all.sol-0.8.14-compact.zip new file mode 100644 index 000000000..c4d10cccf Binary files /dev/null and b/tests/ast-parsing/compile/indexaccess-all.sol-0.8.14-compact.zip differ diff --git a/tests/ast-parsing/compile/indexaccess-all.sol-0.8.15-compact.zip b/tests/ast-parsing/compile/indexaccess-all.sol-0.8.15-compact.zip new file mode 100644 index 000000000..baca125cf Binary files /dev/null and b/tests/ast-parsing/compile/indexaccess-all.sol-0.8.15-compact.zip differ diff --git a/tests/ast-parsing/compile/indexrangeaccess-0.6.1.sol-0.8.13-compact.zip b/tests/ast-parsing/compile/indexrangeaccess-0.6.1.sol-0.8.13-compact.zip new file mode 100644 index 000000000..6ffaad923 Binary files /dev/null and b/tests/ast-parsing/compile/indexrangeaccess-0.6.1.sol-0.8.13-compact.zip differ diff --git a/tests/ast-parsing/compile/indexrangeaccess-0.6.1.sol-0.8.14-compact.zip b/tests/ast-parsing/compile/indexrangeaccess-0.6.1.sol-0.8.14-compact.zip new file mode 100644 index 000000000..5d81df8d1 Binary files /dev/null and b/tests/ast-parsing/compile/indexrangeaccess-0.6.1.sol-0.8.14-compact.zip differ diff --git a/tests/ast-parsing/compile/indexrangeaccess-0.6.1.sol-0.8.15-compact.zip b/tests/ast-parsing/compile/indexrangeaccess-0.6.1.sol-0.8.15-compact.zip new file mode 100644 index 000000000..f96cc28d8 Binary files /dev/null and b/tests/ast-parsing/compile/indexrangeaccess-0.6.1.sol-0.8.15-compact.zip differ diff --git a/tests/ast-parsing/compile/library_implicit_conversion-0.5.0.sol-0.8.13-compact.zip b/tests/ast-parsing/compile/library_implicit_conversion-0.5.0.sol-0.8.13-compact.zip new file mode 100644 index 000000000..a32f87daf Binary files /dev/null and b/tests/ast-parsing/compile/library_implicit_conversion-0.5.0.sol-0.8.13-compact.zip differ diff --git a/tests/ast-parsing/compile/library_implicit_conversion-0.5.0.sol-0.8.14-compact.zip b/tests/ast-parsing/compile/library_implicit_conversion-0.5.0.sol-0.8.14-compact.zip new file mode 100644 index 000000000..198deded1 Binary files /dev/null and b/tests/ast-parsing/compile/library_implicit_conversion-0.5.0.sol-0.8.14-compact.zip differ diff --git a/tests/ast-parsing/compile/library_implicit_conversion-0.5.0.sol-0.8.15-compact.zip b/tests/ast-parsing/compile/library_implicit_conversion-0.5.0.sol-0.8.15-compact.zip new file mode 100644 index 000000000..34a12d8c8 Binary files /dev/null and b/tests/ast-parsing/compile/library_implicit_conversion-0.5.0.sol-0.8.15-compact.zip differ diff --git a/tests/ast-parsing/compile/memberaccess-0.5.3.sol-0.8.13-compact.zip b/tests/ast-parsing/compile/memberaccess-0.5.3.sol-0.8.13-compact.zip new file mode 100644 index 000000000..dc52106f9 Binary files /dev/null and b/tests/ast-parsing/compile/memberaccess-0.5.3.sol-0.8.13-compact.zip differ diff --git a/tests/ast-parsing/compile/memberaccess-0.5.3.sol-0.8.14-compact.zip b/tests/ast-parsing/compile/memberaccess-0.5.3.sol-0.8.14-compact.zip new file mode 100644 index 000000000..1849ae733 Binary files /dev/null and b/tests/ast-parsing/compile/memberaccess-0.5.3.sol-0.8.14-compact.zip differ diff --git a/tests/ast-parsing/compile/memberaccess-0.5.3.sol-0.8.15-compact.zip b/tests/ast-parsing/compile/memberaccess-0.5.3.sol-0.8.15-compact.zip new file mode 100644 index 000000000..e94964608 Binary files /dev/null and b/tests/ast-parsing/compile/memberaccess-0.5.3.sol-0.8.15-compact.zip differ diff --git a/tests/ast-parsing/compile/minmax-0.6.8.sol-0.6.8-compact.zip b/tests/ast-parsing/compile/minmax-0.6.8.sol-0.6.8-compact.zip index f7a88ba89..212d4fc53 100644 Binary files a/tests/ast-parsing/compile/minmax-0.6.8.sol-0.6.8-compact.zip and b/tests/ast-parsing/compile/minmax-0.6.8.sol-0.6.8-compact.zip differ diff --git a/tests/ast-parsing/compile/minmax-0.6.8.sol-0.6.8-legacy.zip b/tests/ast-parsing/compile/minmax-0.6.8.sol-0.6.8-legacy.zip index 7c6610e62..97a4c65a6 100644 Binary files a/tests/ast-parsing/compile/minmax-0.6.8.sol-0.6.8-legacy.zip and b/tests/ast-parsing/compile/minmax-0.6.8.sol-0.6.8-legacy.zip differ diff --git a/tests/ast-parsing/compile/minmax-0.6.8.sol-0.6.9-compact.zip b/tests/ast-parsing/compile/minmax-0.6.8.sol-0.6.9-compact.zip index 36c5dfe14..89e2e05fd 100644 Binary files a/tests/ast-parsing/compile/minmax-0.6.8.sol-0.6.9-compact.zip and b/tests/ast-parsing/compile/minmax-0.6.8.sol-0.6.9-compact.zip differ diff --git a/tests/ast-parsing/compile/minmax-0.6.8.sol-0.6.9-legacy.zip b/tests/ast-parsing/compile/minmax-0.6.8.sol-0.6.9-legacy.zip index 9aaebf2d6..8689e5052 100644 Binary files a/tests/ast-parsing/compile/minmax-0.6.8.sol-0.6.9-legacy.zip and b/tests/ast-parsing/compile/minmax-0.6.8.sol-0.6.9-legacy.zip differ diff --git a/tests/ast-parsing/compile/minmax-0.6.8.sol-0.7.0-compact.zip b/tests/ast-parsing/compile/minmax-0.6.8.sol-0.7.0-compact.zip index 40c8f7ae1..110a18177 100644 Binary files a/tests/ast-parsing/compile/minmax-0.6.8.sol-0.7.0-compact.zip and b/tests/ast-parsing/compile/minmax-0.6.8.sol-0.7.0-compact.zip differ diff --git a/tests/ast-parsing/compile/minmax-0.6.8.sol-0.7.0-legacy.zip b/tests/ast-parsing/compile/minmax-0.6.8.sol-0.7.0-legacy.zip index 36a1e0199..b21025df0 100644 Binary files a/tests/ast-parsing/compile/minmax-0.6.8.sol-0.7.0-legacy.zip and b/tests/ast-parsing/compile/minmax-0.6.8.sol-0.7.0-legacy.zip differ diff --git a/tests/ast-parsing/compile/minmax-0.6.8.sol-0.7.1-compact.zip b/tests/ast-parsing/compile/minmax-0.6.8.sol-0.7.1-compact.zip index 96b0d941e..bde89e724 100644 Binary files a/tests/ast-parsing/compile/minmax-0.6.8.sol-0.7.1-compact.zip and b/tests/ast-parsing/compile/minmax-0.6.8.sol-0.7.1-compact.zip differ diff --git a/tests/ast-parsing/compile/minmax-0.6.8.sol-0.7.1-legacy.zip b/tests/ast-parsing/compile/minmax-0.6.8.sol-0.7.1-legacy.zip index b41b27e5a..fe72a70bd 100644 Binary files a/tests/ast-parsing/compile/minmax-0.6.8.sol-0.7.1-legacy.zip and b/tests/ast-parsing/compile/minmax-0.6.8.sol-0.7.1-legacy.zip differ diff --git a/tests/ast-parsing/compile/minmax-0.6.8.sol-0.7.2-compact.zip b/tests/ast-parsing/compile/minmax-0.6.8.sol-0.7.2-compact.zip index 0fb23d4c2..2a003aaf5 100644 Binary files a/tests/ast-parsing/compile/minmax-0.6.8.sol-0.7.2-compact.zip and b/tests/ast-parsing/compile/minmax-0.6.8.sol-0.7.2-compact.zip differ diff --git a/tests/ast-parsing/compile/minmax-0.6.8.sol-0.7.2-legacy.zip b/tests/ast-parsing/compile/minmax-0.6.8.sol-0.7.2-legacy.zip index 29d5bc9c8..f3e120bc8 100644 Binary files a/tests/ast-parsing/compile/minmax-0.6.8.sol-0.7.2-legacy.zip and b/tests/ast-parsing/compile/minmax-0.6.8.sol-0.7.2-legacy.zip differ diff --git a/tests/ast-parsing/compile/minmax-0.6.8.sol-0.7.3-compact.zip b/tests/ast-parsing/compile/minmax-0.6.8.sol-0.7.3-compact.zip index 2dbf4ac6f..4dce33e80 100644 Binary files a/tests/ast-parsing/compile/minmax-0.6.8.sol-0.7.3-compact.zip and b/tests/ast-parsing/compile/minmax-0.6.8.sol-0.7.3-compact.zip differ diff --git a/tests/ast-parsing/compile/minmax-0.6.8.sol-0.7.3-legacy.zip b/tests/ast-parsing/compile/minmax-0.6.8.sol-0.7.3-legacy.zip index eb04ccbb5..054f96726 100644 Binary files a/tests/ast-parsing/compile/minmax-0.6.8.sol-0.7.3-legacy.zip and b/tests/ast-parsing/compile/minmax-0.6.8.sol-0.7.3-legacy.zip differ diff --git a/tests/ast-parsing/compile/minmax-0.6.8.sol-0.7.4-compact.zip b/tests/ast-parsing/compile/minmax-0.6.8.sol-0.7.4-compact.zip index 0d10f765b..0dbba1f16 100644 Binary files a/tests/ast-parsing/compile/minmax-0.6.8.sol-0.7.4-compact.zip and b/tests/ast-parsing/compile/minmax-0.6.8.sol-0.7.4-compact.zip differ diff --git a/tests/ast-parsing/compile/minmax-0.6.8.sol-0.7.4-legacy.zip b/tests/ast-parsing/compile/minmax-0.6.8.sol-0.7.4-legacy.zip index 811fe7c94..1c7e2f7a5 100644 Binary files a/tests/ast-parsing/compile/minmax-0.6.8.sol-0.7.4-legacy.zip and b/tests/ast-parsing/compile/minmax-0.6.8.sol-0.7.4-legacy.zip differ diff --git a/tests/ast-parsing/compile/minmax-0.6.8.sol-0.7.5-compact.zip b/tests/ast-parsing/compile/minmax-0.6.8.sol-0.7.5-compact.zip index fd8c2c3ae..74f16709c 100644 Binary files a/tests/ast-parsing/compile/minmax-0.6.8.sol-0.7.5-compact.zip and b/tests/ast-parsing/compile/minmax-0.6.8.sol-0.7.5-compact.zip differ diff --git a/tests/ast-parsing/compile/minmax-0.6.8.sol-0.7.5-legacy.zip b/tests/ast-parsing/compile/minmax-0.6.8.sol-0.7.5-legacy.zip index 1913a1038..7aab66bc1 100644 Binary files a/tests/ast-parsing/compile/minmax-0.6.8.sol-0.7.5-legacy.zip and b/tests/ast-parsing/compile/minmax-0.6.8.sol-0.7.5-legacy.zip differ diff --git a/tests/ast-parsing/compile/minmax-0.6.8.sol-0.7.6-compact.zip b/tests/ast-parsing/compile/minmax-0.6.8.sol-0.7.6-compact.zip index 791749c90..53dd96e8b 100644 Binary files a/tests/ast-parsing/compile/minmax-0.6.8.sol-0.7.6-compact.zip and b/tests/ast-parsing/compile/minmax-0.6.8.sol-0.7.6-compact.zip differ diff --git a/tests/ast-parsing/compile/minmax-0.6.8.sol-0.7.6-legacy.zip b/tests/ast-parsing/compile/minmax-0.6.8.sol-0.7.6-legacy.zip index ad4d19653..e884265b2 100644 Binary files a/tests/ast-parsing/compile/minmax-0.6.8.sol-0.7.6-legacy.zip and b/tests/ast-parsing/compile/minmax-0.6.8.sol-0.7.6-legacy.zip differ diff --git a/tests/ast-parsing/compile/minmax-0.6.8.sol-0.8.0-compact.zip b/tests/ast-parsing/compile/minmax-0.6.8.sol-0.8.0-compact.zip index a42598ac4..61710f589 100644 Binary files a/tests/ast-parsing/compile/minmax-0.6.8.sol-0.8.0-compact.zip and b/tests/ast-parsing/compile/minmax-0.6.8.sol-0.8.0-compact.zip differ diff --git a/tests/ast-parsing/compile/minmax-0.6.8.sol-0.8.1-compact.zip b/tests/ast-parsing/compile/minmax-0.6.8.sol-0.8.1-compact.zip index ad92dff36..36cbf94d3 100644 Binary files a/tests/ast-parsing/compile/minmax-0.6.8.sol-0.8.1-compact.zip and b/tests/ast-parsing/compile/minmax-0.6.8.sol-0.8.1-compact.zip differ diff --git a/tests/ast-parsing/compile/minmax-0.6.8.sol-0.8.10-compact.zip b/tests/ast-parsing/compile/minmax-0.6.8.sol-0.8.10-compact.zip index f2cd5f3b8..139bb5a72 100644 Binary files a/tests/ast-parsing/compile/minmax-0.6.8.sol-0.8.10-compact.zip and b/tests/ast-parsing/compile/minmax-0.6.8.sol-0.8.10-compact.zip differ diff --git a/tests/ast-parsing/compile/minmax-0.6.8.sol-0.8.11-compact.zip b/tests/ast-parsing/compile/minmax-0.6.8.sol-0.8.11-compact.zip index 9684a5596..ad793dde6 100644 Binary files a/tests/ast-parsing/compile/minmax-0.6.8.sol-0.8.11-compact.zip and b/tests/ast-parsing/compile/minmax-0.6.8.sol-0.8.11-compact.zip differ diff --git a/tests/ast-parsing/compile/minmax-0.6.8.sol-0.8.12-compact.zip b/tests/ast-parsing/compile/minmax-0.6.8.sol-0.8.12-compact.zip index 30273f66a..25312c516 100644 Binary files a/tests/ast-parsing/compile/minmax-0.6.8.sol-0.8.12-compact.zip and b/tests/ast-parsing/compile/minmax-0.6.8.sol-0.8.12-compact.zip differ diff --git a/tests/ast-parsing/compile/minmax-0.6.8.sol-0.8.13-compact.zip b/tests/ast-parsing/compile/minmax-0.6.8.sol-0.8.13-compact.zip new file mode 100644 index 000000000..37bbb2b45 Binary files /dev/null and b/tests/ast-parsing/compile/minmax-0.6.8.sol-0.8.13-compact.zip differ diff --git a/tests/ast-parsing/compile/minmax-0.6.8.sol-0.8.14-compact.zip b/tests/ast-parsing/compile/minmax-0.6.8.sol-0.8.14-compact.zip new file mode 100644 index 000000000..682a042bf Binary files /dev/null and b/tests/ast-parsing/compile/minmax-0.6.8.sol-0.8.14-compact.zip differ diff --git a/tests/ast-parsing/compile/minmax-0.6.8.sol-0.8.15-compact.zip b/tests/ast-parsing/compile/minmax-0.6.8.sol-0.8.15-compact.zip new file mode 100644 index 000000000..5ef0bb8c4 Binary files /dev/null and b/tests/ast-parsing/compile/minmax-0.6.8.sol-0.8.15-compact.zip differ diff --git a/tests/ast-parsing/compile/minmax-0.6.8.sol-0.8.2-compact.zip b/tests/ast-parsing/compile/minmax-0.6.8.sol-0.8.2-compact.zip index fc45594a7..6124ab496 100644 Binary files a/tests/ast-parsing/compile/minmax-0.6.8.sol-0.8.2-compact.zip and b/tests/ast-parsing/compile/minmax-0.6.8.sol-0.8.2-compact.zip differ diff --git a/tests/ast-parsing/compile/minmax-0.6.8.sol-0.8.3-compact.zip b/tests/ast-parsing/compile/minmax-0.6.8.sol-0.8.3-compact.zip index 011120806..d5499c21a 100644 Binary files a/tests/ast-parsing/compile/minmax-0.6.8.sol-0.8.3-compact.zip and b/tests/ast-parsing/compile/minmax-0.6.8.sol-0.8.3-compact.zip differ diff --git a/tests/ast-parsing/compile/minmax-0.6.8.sol-0.8.4-compact.zip b/tests/ast-parsing/compile/minmax-0.6.8.sol-0.8.4-compact.zip index c432b7ce9..f8a2a13f5 100644 Binary files a/tests/ast-parsing/compile/minmax-0.6.8.sol-0.8.4-compact.zip and b/tests/ast-parsing/compile/minmax-0.6.8.sol-0.8.4-compact.zip differ diff --git a/tests/ast-parsing/compile/minmax-0.6.8.sol-0.8.5-compact.zip b/tests/ast-parsing/compile/minmax-0.6.8.sol-0.8.5-compact.zip index 71329fdf9..f39df616e 100644 Binary files a/tests/ast-parsing/compile/minmax-0.6.8.sol-0.8.5-compact.zip and b/tests/ast-parsing/compile/minmax-0.6.8.sol-0.8.5-compact.zip differ diff --git a/tests/ast-parsing/compile/minmax-0.6.8.sol-0.8.6-compact.zip b/tests/ast-parsing/compile/minmax-0.6.8.sol-0.8.6-compact.zip index a89f399a1..1e2b0588f 100644 Binary files a/tests/ast-parsing/compile/minmax-0.6.8.sol-0.8.6-compact.zip and b/tests/ast-parsing/compile/minmax-0.6.8.sol-0.8.6-compact.zip differ diff --git a/tests/ast-parsing/compile/minmax-0.6.8.sol-0.8.7-compact.zip b/tests/ast-parsing/compile/minmax-0.6.8.sol-0.8.7-compact.zip index 1de597e91..36ab7e423 100644 Binary files a/tests/ast-parsing/compile/minmax-0.6.8.sol-0.8.7-compact.zip and b/tests/ast-parsing/compile/minmax-0.6.8.sol-0.8.7-compact.zip differ diff --git a/tests/ast-parsing/compile/minmax-0.6.8.sol-0.8.8-compact.zip b/tests/ast-parsing/compile/minmax-0.6.8.sol-0.8.8-compact.zip index 692b7992f..478dc6ac0 100644 Binary files a/tests/ast-parsing/compile/minmax-0.6.8.sol-0.8.8-compact.zip and b/tests/ast-parsing/compile/minmax-0.6.8.sol-0.8.8-compact.zip differ diff --git a/tests/ast-parsing/compile/minmax-0.6.8.sol-0.8.9-compact.zip b/tests/ast-parsing/compile/minmax-0.6.8.sol-0.8.9-compact.zip index 96c9f3f84..9cf7c7c73 100644 Binary files a/tests/ast-parsing/compile/minmax-0.6.8.sol-0.8.9-compact.zip and b/tests/ast-parsing/compile/minmax-0.6.8.sol-0.8.9-compact.zip differ diff --git a/tests/ast-parsing/compile/minmax-0.8.8.sol-0.8.10-compact.zip b/tests/ast-parsing/compile/minmax-0.8.8.sol-0.8.10-compact.zip new file mode 100644 index 000000000..ee8fe76d7 Binary files /dev/null and b/tests/ast-parsing/compile/minmax-0.8.8.sol-0.8.10-compact.zip differ diff --git a/tests/ast-parsing/compile/minmax-0.8.8.sol-0.8.11-compact.zip b/tests/ast-parsing/compile/minmax-0.8.8.sol-0.8.11-compact.zip new file mode 100644 index 000000000..9a3cabe1d Binary files /dev/null and b/tests/ast-parsing/compile/minmax-0.8.8.sol-0.8.11-compact.zip differ diff --git a/tests/ast-parsing/compile/minmax-0.8.8.sol-0.8.12-compact.zip b/tests/ast-parsing/compile/minmax-0.8.8.sol-0.8.12-compact.zip new file mode 100644 index 000000000..6a8bb4278 Binary files /dev/null and b/tests/ast-parsing/compile/minmax-0.8.8.sol-0.8.12-compact.zip differ diff --git a/tests/ast-parsing/compile/minmax-0.8.8.sol-0.8.13-compact.zip b/tests/ast-parsing/compile/minmax-0.8.8.sol-0.8.13-compact.zip new file mode 100644 index 000000000..c8e666786 Binary files /dev/null and b/tests/ast-parsing/compile/minmax-0.8.8.sol-0.8.13-compact.zip differ diff --git a/tests/ast-parsing/compile/minmax-0.8.8.sol-0.8.14-compact.zip b/tests/ast-parsing/compile/minmax-0.8.8.sol-0.8.14-compact.zip new file mode 100644 index 000000000..717a27094 Binary files /dev/null and b/tests/ast-parsing/compile/minmax-0.8.8.sol-0.8.14-compact.zip differ diff --git a/tests/ast-parsing/compile/minmax-0.8.8.sol-0.8.15-compact.zip b/tests/ast-parsing/compile/minmax-0.8.8.sol-0.8.15-compact.zip new file mode 100644 index 000000000..02d59d00c Binary files /dev/null and b/tests/ast-parsing/compile/minmax-0.8.8.sol-0.8.15-compact.zip differ diff --git a/tests/ast-parsing/compile/minmax-0.8.8.sol-0.8.8-compact.zip b/tests/ast-parsing/compile/minmax-0.8.8.sol-0.8.8-compact.zip new file mode 100644 index 000000000..068aae413 Binary files /dev/null and b/tests/ast-parsing/compile/minmax-0.8.8.sol-0.8.8-compact.zip differ diff --git a/tests/ast-parsing/compile/minmax-0.8.8.sol-0.8.9-compact.zip b/tests/ast-parsing/compile/minmax-0.8.8.sol-0.8.9-compact.zip new file mode 100644 index 000000000..fe9073e03 Binary files /dev/null and b/tests/ast-parsing/compile/minmax-0.8.8.sol-0.8.9-compact.zip differ diff --git a/tests/ast-parsing/compile/modifier-all.sol-0.8.13-compact.zip b/tests/ast-parsing/compile/modifier-all.sol-0.8.13-compact.zip new file mode 100644 index 000000000..7845c49f6 Binary files /dev/null and b/tests/ast-parsing/compile/modifier-all.sol-0.8.13-compact.zip differ diff --git a/tests/ast-parsing/compile/modifier-all.sol-0.8.14-compact.zip b/tests/ast-parsing/compile/modifier-all.sol-0.8.14-compact.zip new file mode 100644 index 000000000..cdc342f12 Binary files /dev/null and b/tests/ast-parsing/compile/modifier-all.sol-0.8.14-compact.zip differ diff --git a/tests/ast-parsing/compile/modifier-all.sol-0.8.15-compact.zip b/tests/ast-parsing/compile/modifier-all.sol-0.8.15-compact.zip new file mode 100644 index 000000000..d4d53a419 Binary files /dev/null and b/tests/ast-parsing/compile/modifier-all.sol-0.8.15-compact.zip differ diff --git a/tests/ast-parsing/compile/newexpression-0.5.0.sol-0.8.13-compact.zip b/tests/ast-parsing/compile/newexpression-0.5.0.sol-0.8.13-compact.zip new file mode 100644 index 000000000..e1d764253 Binary files /dev/null and b/tests/ast-parsing/compile/newexpression-0.5.0.sol-0.8.13-compact.zip differ diff --git a/tests/ast-parsing/compile/newexpression-0.5.0.sol-0.8.14-compact.zip b/tests/ast-parsing/compile/newexpression-0.5.0.sol-0.8.14-compact.zip new file mode 100644 index 000000000..bb0b279b7 Binary files /dev/null and b/tests/ast-parsing/compile/newexpression-0.5.0.sol-0.8.14-compact.zip differ diff --git a/tests/ast-parsing/compile/newexpression-0.5.0.sol-0.8.15-compact.zip b/tests/ast-parsing/compile/newexpression-0.5.0.sol-0.8.15-compact.zip new file mode 100644 index 000000000..96749d0f2 Binary files /dev/null and b/tests/ast-parsing/compile/newexpression-0.5.0.sol-0.8.15-compact.zip differ diff --git a/tests/ast-parsing/compile/pragma-0.8.0.sol-0.8.13-compact.zip b/tests/ast-parsing/compile/pragma-0.8.0.sol-0.8.13-compact.zip new file mode 100644 index 000000000..37c80b75b Binary files /dev/null and b/tests/ast-parsing/compile/pragma-0.8.0.sol-0.8.13-compact.zip differ diff --git a/tests/ast-parsing/compile/pragma-0.8.0.sol-0.8.14-compact.zip b/tests/ast-parsing/compile/pragma-0.8.0.sol-0.8.14-compact.zip new file mode 100644 index 000000000..60fcc04d0 Binary files /dev/null and b/tests/ast-parsing/compile/pragma-0.8.0.sol-0.8.14-compact.zip differ diff --git a/tests/ast-parsing/compile/pragma-0.8.0.sol-0.8.15-compact.zip b/tests/ast-parsing/compile/pragma-0.8.0.sol-0.8.15-compact.zip new file mode 100644 index 000000000..d2c5e04e1 Binary files /dev/null and b/tests/ast-parsing/compile/pragma-0.8.0.sol-0.8.15-compact.zip differ diff --git a/tests/ast-parsing/compile/push-all.sol-0.8.13-compact.zip b/tests/ast-parsing/compile/push-all.sol-0.8.13-compact.zip new file mode 100644 index 000000000..1582a5954 Binary files /dev/null and b/tests/ast-parsing/compile/push-all.sol-0.8.13-compact.zip differ diff --git a/tests/ast-parsing/compile/push-all.sol-0.8.14-compact.zip b/tests/ast-parsing/compile/push-all.sol-0.8.14-compact.zip new file mode 100644 index 000000000..a6c6125c1 Binary files /dev/null and b/tests/ast-parsing/compile/push-all.sol-0.8.14-compact.zip differ diff --git a/tests/ast-parsing/compile/push-all.sol-0.8.15-compact.zip b/tests/ast-parsing/compile/push-all.sol-0.8.15-compact.zip new file mode 100644 index 000000000..4b8c2ebbb Binary files /dev/null and b/tests/ast-parsing/compile/push-all.sol-0.8.15-compact.zip differ diff --git a/tests/ast-parsing/compile/return-all.sol-0.8.13-compact.zip b/tests/ast-parsing/compile/return-all.sol-0.8.13-compact.zip new file mode 100644 index 000000000..6416b40fc Binary files /dev/null and b/tests/ast-parsing/compile/return-all.sol-0.8.13-compact.zip differ diff --git a/tests/ast-parsing/compile/return-all.sol-0.8.14-compact.zip b/tests/ast-parsing/compile/return-all.sol-0.8.14-compact.zip new file mode 100644 index 000000000..80f7e0ea8 Binary files /dev/null and b/tests/ast-parsing/compile/return-all.sol-0.8.14-compact.zip differ diff --git a/tests/ast-parsing/compile/return-all.sol-0.8.15-compact.zip b/tests/ast-parsing/compile/return-all.sol-0.8.15-compact.zip new file mode 100644 index 000000000..5140c6dcc Binary files /dev/null and b/tests/ast-parsing/compile/return-all.sol-0.8.15-compact.zip differ diff --git a/tests/ast-parsing/compile/scope-0.5.0.sol-0.8.13-compact.zip b/tests/ast-parsing/compile/scope-0.5.0.sol-0.8.13-compact.zip new file mode 100644 index 000000000..137082108 Binary files /dev/null and b/tests/ast-parsing/compile/scope-0.5.0.sol-0.8.13-compact.zip differ diff --git a/tests/ast-parsing/compile/scope-0.5.0.sol-0.8.14-compact.zip b/tests/ast-parsing/compile/scope-0.5.0.sol-0.8.14-compact.zip new file mode 100644 index 000000000..c7d44dedc Binary files /dev/null and b/tests/ast-parsing/compile/scope-0.5.0.sol-0.8.14-compact.zip differ diff --git a/tests/ast-parsing/compile/scope-0.5.0.sol-0.8.15-compact.zip b/tests/ast-parsing/compile/scope-0.5.0.sol-0.8.15-compact.zip new file mode 100644 index 000000000..949a82255 Binary files /dev/null and b/tests/ast-parsing/compile/scope-0.5.0.sol-0.8.15-compact.zip differ diff --git a/tests/ast-parsing/compile/struct-0.6.0.sol-0.8.13-compact.zip b/tests/ast-parsing/compile/struct-0.6.0.sol-0.8.13-compact.zip new file mode 100644 index 000000000..cf71c5cec Binary files /dev/null and b/tests/ast-parsing/compile/struct-0.6.0.sol-0.8.13-compact.zip differ diff --git a/tests/ast-parsing/compile/struct-0.6.0.sol-0.8.14-compact.zip b/tests/ast-parsing/compile/struct-0.6.0.sol-0.8.14-compact.zip new file mode 100644 index 000000000..55eda1a92 Binary files /dev/null and b/tests/ast-parsing/compile/struct-0.6.0.sol-0.8.14-compact.zip differ diff --git a/tests/ast-parsing/compile/struct-0.6.0.sol-0.8.15-compact.zip b/tests/ast-parsing/compile/struct-0.6.0.sol-0.8.15-compact.zip new file mode 100644 index 000000000..2d93f3613 Binary files /dev/null and b/tests/ast-parsing/compile/struct-0.6.0.sol-0.8.15-compact.zip differ diff --git a/tests/ast-parsing/compile/throw-0.5.0.sol-0.8.13-compact.zip b/tests/ast-parsing/compile/throw-0.5.0.sol-0.8.13-compact.zip new file mode 100644 index 000000000..782b152fa Binary files /dev/null and b/tests/ast-parsing/compile/throw-0.5.0.sol-0.8.13-compact.zip differ diff --git a/tests/ast-parsing/compile/throw-0.5.0.sol-0.8.14-compact.zip b/tests/ast-parsing/compile/throw-0.5.0.sol-0.8.14-compact.zip new file mode 100644 index 000000000..69ebe019b Binary files /dev/null and b/tests/ast-parsing/compile/throw-0.5.0.sol-0.8.14-compact.zip differ diff --git a/tests/ast-parsing/compile/throw-0.5.0.sol-0.8.15-compact.zip b/tests/ast-parsing/compile/throw-0.5.0.sol-0.8.15-compact.zip new file mode 100644 index 000000000..19b0b183a Binary files /dev/null and b/tests/ast-parsing/compile/throw-0.5.0.sol-0.8.15-compact.zip differ diff --git a/tests/ast-parsing/compile/top-level-0.7.4.sol-0.8.13-compact.zip b/tests/ast-parsing/compile/top-level-0.7.4.sol-0.8.13-compact.zip new file mode 100644 index 000000000..b52cd422b Binary files /dev/null and b/tests/ast-parsing/compile/top-level-0.7.4.sol-0.8.13-compact.zip differ diff --git a/tests/ast-parsing/compile/top-level-0.7.4.sol-0.8.14-compact.zip b/tests/ast-parsing/compile/top-level-0.7.4.sol-0.8.14-compact.zip new file mode 100644 index 000000000..7900e8f7c Binary files /dev/null and b/tests/ast-parsing/compile/top-level-0.7.4.sol-0.8.14-compact.zip differ diff --git a/tests/ast-parsing/compile/top-level-0.7.4.sol-0.8.15-compact.zip b/tests/ast-parsing/compile/top-level-0.7.4.sol-0.8.15-compact.zip new file mode 100644 index 000000000..417dd85a6 Binary files /dev/null and b/tests/ast-parsing/compile/top-level-0.7.4.sol-0.8.15-compact.zip differ diff --git a/tests/ast-parsing/compile/top-level-import-0.7.1.sol-0.8.13-compact.zip b/tests/ast-parsing/compile/top-level-import-0.7.1.sol-0.8.13-compact.zip new file mode 100644 index 000000000..e8e2147cd Binary files /dev/null and b/tests/ast-parsing/compile/top-level-import-0.7.1.sol-0.8.13-compact.zip differ diff --git a/tests/ast-parsing/compile/top-level-import-0.7.1.sol-0.8.14-compact.zip b/tests/ast-parsing/compile/top-level-import-0.7.1.sol-0.8.14-compact.zip new file mode 100644 index 000000000..73779b9a0 Binary files /dev/null and b/tests/ast-parsing/compile/top-level-import-0.7.1.sol-0.8.14-compact.zip differ diff --git a/tests/ast-parsing/compile/top-level-import-0.7.1.sol-0.8.15-compact.zip b/tests/ast-parsing/compile/top-level-import-0.7.1.sol-0.8.15-compact.zip new file mode 100644 index 000000000..39c85beb3 Binary files /dev/null and b/tests/ast-parsing/compile/top-level-import-0.7.1.sol-0.8.15-compact.zip differ diff --git a/tests/ast-parsing/compile/top-level-import-bis-0.7.1.sol-0.8.13-compact.zip b/tests/ast-parsing/compile/top-level-import-bis-0.7.1.sol-0.8.13-compact.zip new file mode 100644 index 000000000..9db0ebf8c Binary files /dev/null and b/tests/ast-parsing/compile/top-level-import-bis-0.7.1.sol-0.8.13-compact.zip differ diff --git a/tests/ast-parsing/compile/top-level-import-bis-0.7.1.sol-0.8.14-compact.zip b/tests/ast-parsing/compile/top-level-import-bis-0.7.1.sol-0.8.14-compact.zip new file mode 100644 index 000000000..8d24a1e66 Binary files /dev/null and b/tests/ast-parsing/compile/top-level-import-bis-0.7.1.sol-0.8.14-compact.zip differ diff --git a/tests/ast-parsing/compile/top-level-import-bis-0.7.1.sol-0.8.15-compact.zip b/tests/ast-parsing/compile/top-level-import-bis-0.7.1.sol-0.8.15-compact.zip new file mode 100644 index 000000000..48a253f3d Binary files /dev/null and b/tests/ast-parsing/compile/top-level-import-bis-0.7.1.sol-0.8.15-compact.zip differ diff --git a/tests/ast-parsing/compile/top-level-nested-import-0.7.1.sol-0.8.13-compact.zip b/tests/ast-parsing/compile/top-level-nested-import-0.7.1.sol-0.8.13-compact.zip new file mode 100644 index 000000000..0070f96c4 Binary files /dev/null and b/tests/ast-parsing/compile/top-level-nested-import-0.7.1.sol-0.8.13-compact.zip differ diff --git a/tests/ast-parsing/compile/top-level-nested-import-0.7.1.sol-0.8.14-compact.zip b/tests/ast-parsing/compile/top-level-nested-import-0.7.1.sol-0.8.14-compact.zip new file mode 100644 index 000000000..a30137b08 Binary files /dev/null and b/tests/ast-parsing/compile/top-level-nested-import-0.7.1.sol-0.8.14-compact.zip differ diff --git a/tests/ast-parsing/compile/top-level-nested-import-0.7.1.sol-0.8.15-compact.zip b/tests/ast-parsing/compile/top-level-nested-import-0.7.1.sol-0.8.15-compact.zip new file mode 100644 index 000000000..26353193d Binary files /dev/null and b/tests/ast-parsing/compile/top-level-nested-import-0.7.1.sol-0.8.15-compact.zip differ diff --git a/tests/ast-parsing/compile/top_level_variable-0.8.0.sol-0.8.13-compact.zip b/tests/ast-parsing/compile/top_level_variable-0.8.0.sol-0.8.13-compact.zip new file mode 100644 index 000000000..8a141b5fd Binary files /dev/null and b/tests/ast-parsing/compile/top_level_variable-0.8.0.sol-0.8.13-compact.zip differ diff --git a/tests/ast-parsing/compile/top_level_variable-0.8.0.sol-0.8.14-compact.zip b/tests/ast-parsing/compile/top_level_variable-0.8.0.sol-0.8.14-compact.zip new file mode 100644 index 000000000..7048a6264 Binary files /dev/null and b/tests/ast-parsing/compile/top_level_variable-0.8.0.sol-0.8.14-compact.zip differ diff --git a/tests/ast-parsing/compile/top_level_variable-0.8.0.sol-0.8.15-compact.zip b/tests/ast-parsing/compile/top_level_variable-0.8.0.sol-0.8.15-compact.zip new file mode 100644 index 000000000..81f8f6716 Binary files /dev/null and b/tests/ast-parsing/compile/top_level_variable-0.8.0.sol-0.8.15-compact.zip differ diff --git a/tests/ast-parsing/compile/top_level_variable2-0.8.0.sol-0.8.13-compact.zip b/tests/ast-parsing/compile/top_level_variable2-0.8.0.sol-0.8.13-compact.zip new file mode 100644 index 000000000..12d6382aa Binary files /dev/null and b/tests/ast-parsing/compile/top_level_variable2-0.8.0.sol-0.8.13-compact.zip differ diff --git a/tests/ast-parsing/compile/top_level_variable2-0.8.0.sol-0.8.14-compact.zip b/tests/ast-parsing/compile/top_level_variable2-0.8.0.sol-0.8.14-compact.zip new file mode 100644 index 000000000..40233c756 Binary files /dev/null and b/tests/ast-parsing/compile/top_level_variable2-0.8.0.sol-0.8.14-compact.zip differ diff --git a/tests/ast-parsing/compile/top_level_variable2-0.8.0.sol-0.8.15-compact.zip b/tests/ast-parsing/compile/top_level_variable2-0.8.0.sol-0.8.15-compact.zip new file mode 100644 index 000000000..586bd97a8 Binary files /dev/null and b/tests/ast-parsing/compile/top_level_variable2-0.8.0.sol-0.8.15-compact.zip differ diff --git a/tests/ast-parsing/compile/trycatch-0.6.0.sol-0.8.13-compact.zip b/tests/ast-parsing/compile/trycatch-0.6.0.sol-0.8.13-compact.zip new file mode 100644 index 000000000..d0f3c1b4c Binary files /dev/null and b/tests/ast-parsing/compile/trycatch-0.6.0.sol-0.8.13-compact.zip differ diff --git a/tests/ast-parsing/compile/trycatch-0.6.0.sol-0.8.14-compact.zip b/tests/ast-parsing/compile/trycatch-0.6.0.sol-0.8.14-compact.zip new file mode 100644 index 000000000..8b16ed85a Binary files /dev/null and b/tests/ast-parsing/compile/trycatch-0.6.0.sol-0.8.14-compact.zip differ diff --git a/tests/ast-parsing/compile/trycatch-0.6.0.sol-0.8.15-compact.zip b/tests/ast-parsing/compile/trycatch-0.6.0.sol-0.8.15-compact.zip new file mode 100644 index 000000000..3950995d1 Binary files /dev/null and b/tests/ast-parsing/compile/trycatch-0.6.0.sol-0.8.15-compact.zip differ diff --git a/tests/ast-parsing/compile/tupleexpression-0.5.3.sol-0.8.13-compact.zip b/tests/ast-parsing/compile/tupleexpression-0.5.3.sol-0.8.13-compact.zip new file mode 100644 index 000000000..0b2a0f6ec Binary files /dev/null and b/tests/ast-parsing/compile/tupleexpression-0.5.3.sol-0.8.13-compact.zip differ diff --git a/tests/ast-parsing/compile/tupleexpression-0.5.3.sol-0.8.14-compact.zip b/tests/ast-parsing/compile/tupleexpression-0.5.3.sol-0.8.14-compact.zip new file mode 100644 index 000000000..3de857506 Binary files /dev/null and b/tests/ast-parsing/compile/tupleexpression-0.5.3.sol-0.8.14-compact.zip differ diff --git a/tests/ast-parsing/compile/tupleexpression-0.5.3.sol-0.8.15-compact.zip b/tests/ast-parsing/compile/tupleexpression-0.5.3.sol-0.8.15-compact.zip new file mode 100644 index 000000000..fb4545107 Binary files /dev/null and b/tests/ast-parsing/compile/tupleexpression-0.5.3.sol-0.8.15-compact.zip differ diff --git a/tests/ast-parsing/compile/unaryexpression-0.5.0.sol-0.8.13-compact.zip b/tests/ast-parsing/compile/unaryexpression-0.5.0.sol-0.8.13-compact.zip new file mode 100644 index 000000000..08f57c70f Binary files /dev/null and b/tests/ast-parsing/compile/unaryexpression-0.5.0.sol-0.8.13-compact.zip differ diff --git a/tests/ast-parsing/compile/unaryexpression-0.5.0.sol-0.8.14-compact.zip b/tests/ast-parsing/compile/unaryexpression-0.5.0.sol-0.8.14-compact.zip new file mode 100644 index 000000000..e9876b839 Binary files /dev/null and b/tests/ast-parsing/compile/unaryexpression-0.5.0.sol-0.8.14-compact.zip differ diff --git a/tests/ast-parsing/compile/unaryexpression-0.5.0.sol-0.8.15-compact.zip b/tests/ast-parsing/compile/unaryexpression-0.5.0.sol-0.8.15-compact.zip new file mode 100644 index 000000000..2dafaf643 Binary files /dev/null and b/tests/ast-parsing/compile/unaryexpression-0.5.0.sol-0.8.15-compact.zip differ diff --git a/tests/ast-parsing/compile/unchecked-0.8.0.sol-0.8.13-compact.zip b/tests/ast-parsing/compile/unchecked-0.8.0.sol-0.8.13-compact.zip new file mode 100644 index 000000000..56c527b01 Binary files /dev/null and b/tests/ast-parsing/compile/unchecked-0.8.0.sol-0.8.13-compact.zip differ diff --git a/tests/ast-parsing/compile/unchecked-0.8.0.sol-0.8.14-compact.zip b/tests/ast-parsing/compile/unchecked-0.8.0.sol-0.8.14-compact.zip new file mode 100644 index 000000000..8b4ca708a Binary files /dev/null and b/tests/ast-parsing/compile/unchecked-0.8.0.sol-0.8.14-compact.zip differ diff --git a/tests/ast-parsing/compile/unchecked-0.8.0.sol-0.8.15-compact.zip b/tests/ast-parsing/compile/unchecked-0.8.0.sol-0.8.15-compact.zip new file mode 100644 index 000000000..00fa5b640 Binary files /dev/null and b/tests/ast-parsing/compile/unchecked-0.8.0.sol-0.8.15-compact.zip differ diff --git a/tests/ast-parsing/compile/units_and_global_variables-0.8.0.sol-0.8.13-compact.zip b/tests/ast-parsing/compile/units_and_global_variables-0.8.0.sol-0.8.13-compact.zip new file mode 100644 index 000000000..94a3448cf Binary files /dev/null and b/tests/ast-parsing/compile/units_and_global_variables-0.8.0.sol-0.8.13-compact.zip differ diff --git a/tests/ast-parsing/compile/units_and_global_variables-0.8.0.sol-0.8.14-compact.zip b/tests/ast-parsing/compile/units_and_global_variables-0.8.0.sol-0.8.14-compact.zip new file mode 100644 index 000000000..8286203ce Binary files /dev/null and b/tests/ast-parsing/compile/units_and_global_variables-0.8.0.sol-0.8.14-compact.zip differ diff --git a/tests/ast-parsing/compile/units_and_global_variables-0.8.0.sol-0.8.15-compact.zip b/tests/ast-parsing/compile/units_and_global_variables-0.8.0.sol-0.8.15-compact.zip new file mode 100644 index 000000000..4259f0ebe Binary files /dev/null and b/tests/ast-parsing/compile/units_and_global_variables-0.8.0.sol-0.8.15-compact.zip differ diff --git a/tests/ast-parsing/compile/using-for-0.4.1.sol-0.8.13-compact.zip b/tests/ast-parsing/compile/using-for-0.4.1.sol-0.8.13-compact.zip new file mode 100644 index 000000000..dd3068c7f Binary files /dev/null and b/tests/ast-parsing/compile/using-for-0.4.1.sol-0.8.13-compact.zip differ diff --git a/tests/ast-parsing/compile/using-for-0.4.1.sol-0.8.14-compact.zip b/tests/ast-parsing/compile/using-for-0.4.1.sol-0.8.14-compact.zip new file mode 100644 index 000000000..22e37251d Binary files /dev/null and b/tests/ast-parsing/compile/using-for-0.4.1.sol-0.8.14-compact.zip differ diff --git a/tests/ast-parsing/compile/using-for-0.4.1.sol-0.8.15-compact.zip b/tests/ast-parsing/compile/using-for-0.4.1.sol-0.8.15-compact.zip new file mode 100644 index 000000000..f6aeaaba7 Binary files /dev/null and b/tests/ast-parsing/compile/using-for-0.4.1.sol-0.8.15-compact.zip differ diff --git a/tests/ast-parsing/compile/variable-0.8.0.sol-0.8.13-compact.zip b/tests/ast-parsing/compile/variable-0.8.0.sol-0.8.13-compact.zip new file mode 100644 index 000000000..87e778600 Binary files /dev/null and b/tests/ast-parsing/compile/variable-0.8.0.sol-0.8.13-compact.zip differ diff --git a/tests/ast-parsing/compile/variable-0.8.0.sol-0.8.14-compact.zip b/tests/ast-parsing/compile/variable-0.8.0.sol-0.8.14-compact.zip new file mode 100644 index 000000000..28d524570 Binary files /dev/null and b/tests/ast-parsing/compile/variable-0.8.0.sol-0.8.14-compact.zip differ diff --git a/tests/ast-parsing/compile/variable-0.8.0.sol-0.8.15-compact.zip b/tests/ast-parsing/compile/variable-0.8.0.sol-0.8.15-compact.zip new file mode 100644 index 000000000..d3db72a58 Binary files /dev/null and b/tests/ast-parsing/compile/variable-0.8.0.sol-0.8.15-compact.zip differ diff --git a/tests/ast-parsing/compile/variabledeclaration-0.5.0.sol-0.8.13-compact.zip b/tests/ast-parsing/compile/variabledeclaration-0.5.0.sol-0.8.13-compact.zip new file mode 100644 index 000000000..c6aa3e7c0 Binary files /dev/null and b/tests/ast-parsing/compile/variabledeclaration-0.5.0.sol-0.8.13-compact.zip differ diff --git a/tests/ast-parsing/compile/variabledeclaration-0.5.0.sol-0.8.14-compact.zip b/tests/ast-parsing/compile/variabledeclaration-0.5.0.sol-0.8.14-compact.zip new file mode 100644 index 000000000..298087fea Binary files /dev/null and b/tests/ast-parsing/compile/variabledeclaration-0.5.0.sol-0.8.14-compact.zip differ diff --git a/tests/ast-parsing/compile/variabledeclaration-0.5.0.sol-0.8.15-compact.zip b/tests/ast-parsing/compile/variabledeclaration-0.5.0.sol-0.8.15-compact.zip new file mode 100644 index 000000000..090799067 Binary files /dev/null and b/tests/ast-parsing/compile/variabledeclaration-0.5.0.sol-0.8.15-compact.zip differ diff --git a/tests/ast-parsing/compile/while-all.sol-0.8.13-compact.zip b/tests/ast-parsing/compile/while-all.sol-0.8.13-compact.zip new file mode 100644 index 000000000..7e2899ab1 Binary files /dev/null and b/tests/ast-parsing/compile/while-all.sol-0.8.13-compact.zip differ diff --git a/tests/ast-parsing/compile/while-all.sol-0.8.14-compact.zip b/tests/ast-parsing/compile/while-all.sol-0.8.14-compact.zip new file mode 100644 index 000000000..6c038e5bf Binary files /dev/null and b/tests/ast-parsing/compile/while-all.sol-0.8.14-compact.zip differ diff --git a/tests/ast-parsing/compile/while-all.sol-0.8.15-compact.zip b/tests/ast-parsing/compile/while-all.sol-0.8.15-compact.zip new file mode 100644 index 000000000..f086f8bc8 Binary files /dev/null and b/tests/ast-parsing/compile/while-all.sol-0.8.15-compact.zip differ diff --git a/tests/ast-parsing/compile/yul-0.8.0.sol-0.8.13-compact.zip b/tests/ast-parsing/compile/yul-0.8.0.sol-0.8.13-compact.zip new file mode 100644 index 000000000..783d4e0ef Binary files /dev/null and b/tests/ast-parsing/compile/yul-0.8.0.sol-0.8.13-compact.zip differ diff --git a/tests/ast-parsing/compile/yul-0.8.0.sol-0.8.14-compact.zip b/tests/ast-parsing/compile/yul-0.8.0.sol-0.8.14-compact.zip new file mode 100644 index 000000000..a36880635 Binary files /dev/null and b/tests/ast-parsing/compile/yul-0.8.0.sol-0.8.14-compact.zip differ diff --git a/tests/ast-parsing/compile/yul-0.8.0.sol-0.8.15-compact.zip b/tests/ast-parsing/compile/yul-0.8.0.sol-0.8.15-compact.zip new file mode 100644 index 000000000..cb145b39d Binary files /dev/null and b/tests/ast-parsing/compile/yul-0.8.0.sol-0.8.15-compact.zip differ diff --git a/tests/ast-parsing/custom_error_with_state_variable.sol b/tests/ast-parsing/custom_error_with_state_variable.sol index 3c38202f4..b05c2ef60 100644 --- a/tests/ast-parsing/custom_error_with_state_variable.sol +++ b/tests/ast-parsing/custom_error_with_state_variable.sol @@ -9,5 +9,14 @@ error ErrorWithParam(uint256 value); uint256 constant ONE = 1; uint256 constant TWO = ONE + 1; function foo() pure { revert ErrorWithParam(0); } -contract Bar { } + +library CustomErrors { + error LibraryError(); +} + +contract Bar { + function baz() external { + revert CustomErrors.LibraryError(); + } +} diff --git a/tests/ast-parsing/expected/assembly-all.sol-0.8.13-compact.json b/tests/ast-parsing/expected/assembly-all.sol-0.8.13-compact.json new file mode 100644 index 000000000..d0a1cb33e --- /dev/null +++ b/tests/ast-parsing/expected/assembly-all.sol-0.8.13-compact.json @@ -0,0 +1,5 @@ +{ + "C": { + "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: INLINE ASM 1\n\"];\n1->2;\n2[label=\"Node Type: NEW VARIABLE 2\n\"];\n2->3;\n3[label=\"Node Type: EXPRESSION 3\n\"];\n3->4;\n4[label=\"Node Type: INLINE ASM 4\n\"];\n4->5;\n5[label=\"Node Type: NEW VARIABLE 5\n\"];\n5->6;\n6[label=\"Node Type: EXPRESSION 6\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/assembly-all.sol-0.8.14-compact.json b/tests/ast-parsing/expected/assembly-all.sol-0.8.14-compact.json new file mode 100644 index 000000000..d0a1cb33e --- /dev/null +++ b/tests/ast-parsing/expected/assembly-all.sol-0.8.14-compact.json @@ -0,0 +1,5 @@ +{ + "C": { + "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: INLINE ASM 1\n\"];\n1->2;\n2[label=\"Node Type: NEW VARIABLE 2\n\"];\n2->3;\n3[label=\"Node Type: EXPRESSION 3\n\"];\n3->4;\n4[label=\"Node Type: INLINE ASM 4\n\"];\n4->5;\n5[label=\"Node Type: NEW VARIABLE 5\n\"];\n5->6;\n6[label=\"Node Type: EXPRESSION 6\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/assembly-all.sol-0.8.15-compact.json b/tests/ast-parsing/expected/assembly-all.sol-0.8.15-compact.json new file mode 100644 index 000000000..d0a1cb33e --- /dev/null +++ b/tests/ast-parsing/expected/assembly-all.sol-0.8.15-compact.json @@ -0,0 +1,5 @@ +{ + "C": { + "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: INLINE ASM 1\n\"];\n1->2;\n2[label=\"Node Type: NEW VARIABLE 2\n\"];\n2->3;\n3[label=\"Node Type: EXPRESSION 3\n\"];\n3->4;\n4[label=\"Node Type: INLINE ASM 4\n\"];\n4->5;\n5[label=\"Node Type: NEW VARIABLE 5\n\"];\n5->6;\n6[label=\"Node Type: EXPRESSION 6\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/assignment-0.4.7.sol-0.8.13-compact.json b/tests/ast-parsing/expected/assignment-0.4.7.sol-0.8.13-compact.json new file mode 100644 index 000000000..8f9f9857b --- /dev/null +++ b/tests/ast-parsing/expected/assignment-0.4.7.sol-0.8.13-compact.json @@ -0,0 +1,5 @@ +{ + "C": { + "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: NEW VARIABLE 1\n\"];\n1->2;\n2[label=\"Node Type: EXPRESSION 2\n\"];\n2->3;\n3[label=\"Node Type: EXPRESSION 3\n\"];\n3->4;\n4[label=\"Node Type: EXPRESSION 4\n\"];\n4->5;\n5[label=\"Node Type: EXPRESSION 5\n\"];\n5->6;\n6[label=\"Node Type: EXPRESSION 6\n\"];\n6->7;\n7[label=\"Node Type: EXPRESSION 7\n\"];\n7->8;\n8[label=\"Node Type: EXPRESSION 8\n\"];\n8->9;\n9[label=\"Node Type: EXPRESSION 9\n\"];\n9->10;\n10[label=\"Node Type: EXPRESSION 10\n\"];\n10->11;\n11[label=\"Node Type: EXPRESSION 11\n\"];\n11->12;\n12[label=\"Node Type: EXPRESSION 12\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/assignment-0.4.7.sol-0.8.14-compact.json b/tests/ast-parsing/expected/assignment-0.4.7.sol-0.8.14-compact.json new file mode 100644 index 000000000..8f9f9857b --- /dev/null +++ b/tests/ast-parsing/expected/assignment-0.4.7.sol-0.8.14-compact.json @@ -0,0 +1,5 @@ +{ + "C": { + "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: NEW VARIABLE 1\n\"];\n1->2;\n2[label=\"Node Type: EXPRESSION 2\n\"];\n2->3;\n3[label=\"Node Type: EXPRESSION 3\n\"];\n3->4;\n4[label=\"Node Type: EXPRESSION 4\n\"];\n4->5;\n5[label=\"Node Type: EXPRESSION 5\n\"];\n5->6;\n6[label=\"Node Type: EXPRESSION 6\n\"];\n6->7;\n7[label=\"Node Type: EXPRESSION 7\n\"];\n7->8;\n8[label=\"Node Type: EXPRESSION 8\n\"];\n8->9;\n9[label=\"Node Type: EXPRESSION 9\n\"];\n9->10;\n10[label=\"Node Type: EXPRESSION 10\n\"];\n10->11;\n11[label=\"Node Type: EXPRESSION 11\n\"];\n11->12;\n12[label=\"Node Type: EXPRESSION 12\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/assignment-0.4.7.sol-0.8.15-compact.json b/tests/ast-parsing/expected/assignment-0.4.7.sol-0.8.15-compact.json new file mode 100644 index 000000000..8f9f9857b --- /dev/null +++ b/tests/ast-parsing/expected/assignment-0.4.7.sol-0.8.15-compact.json @@ -0,0 +1,5 @@ +{ + "C": { + "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: NEW VARIABLE 1\n\"];\n1->2;\n2[label=\"Node Type: EXPRESSION 2\n\"];\n2->3;\n3[label=\"Node Type: EXPRESSION 3\n\"];\n3->4;\n4[label=\"Node Type: EXPRESSION 4\n\"];\n4->5;\n5[label=\"Node Type: EXPRESSION 5\n\"];\n5->6;\n6[label=\"Node Type: EXPRESSION 6\n\"];\n6->7;\n7[label=\"Node Type: EXPRESSION 7\n\"];\n7->8;\n8[label=\"Node Type: EXPRESSION 8\n\"];\n8->9;\n9[label=\"Node Type: EXPRESSION 9\n\"];\n9->10;\n10[label=\"Node Type: EXPRESSION 10\n\"];\n10->11;\n11[label=\"Node Type: EXPRESSION 11\n\"];\n11->12;\n12[label=\"Node Type: EXPRESSION 12\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/break-all.sol-0.8.13-compact.json b/tests/ast-parsing/expected/break-all.sol-0.8.13-compact.json new file mode 100644 index 000000000..b9b7fc93e --- /dev/null +++ b/tests/ast-parsing/expected/break-all.sol-0.8.13-compact.json @@ -0,0 +1,5 @@ +{ + "C": { + "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: NEW VARIABLE 1\n\"];\n1->4;\n2[label=\"Node Type: BEGIN_LOOP 2\n\"];\n2->5;\n3[label=\"Node Type: END_LOOP 3\n\"];\n3->13;\n4[label=\"Node Type: NEW VARIABLE 4\n\"];\n4->2;\n5[label=\"Node Type: IF_LOOP 5\n\"];\n5->6[label=\"True\"];\n5->3[label=\"False\"];\n6[label=\"Node Type: IF 6\n\"];\n6->7[label=\"True\"];\n6->8[label=\"False\"];\n7[label=\"Node Type: BREAK 7\n\"];\n7->3;\n8[label=\"Node Type: END_IF 8\n\"];\n8->9;\n9[label=\"Node Type: EXPRESSION 9\n\"];\n9->10;\n10[label=\"Node Type: EXPRESSION 10\n\"];\n10->5;\n11[label=\"Node Type: BEGIN_LOOP 11\n\"];\n11->14;\n12[label=\"Node Type: END_LOOP 12\n\"];\n13[label=\"Node Type: NEW VARIABLE 13\n\"];\n13->11;\n14[label=\"Node Type: IF_LOOP 14\n\"];\n14->17[label=\"True\"];\n14->12[label=\"False\"];\n15[label=\"Node Type: BEGIN_LOOP 15\n\"];\n15->18;\n16[label=\"Node Type: END_LOOP 16\n\"];\n16->24;\n17[label=\"Node Type: NEW VARIABLE 17\n\"];\n17->15;\n18[label=\"Node Type: IF_LOOP 18\n\"];\n18->19[label=\"True\"];\n18->16[label=\"False\"];\n19[label=\"Node Type: IF 19\n\"];\n19->20[label=\"True\"];\n19->21[label=\"False\"];\n20[label=\"Node Type: BREAK 20\n\"];\n20->16;\n21[label=\"Node Type: END_IF 21\n\"];\n21->22;\n22[label=\"Node Type: EXPRESSION 22\n\"];\n22->23;\n23[label=\"Node Type: EXPRESSION 23\n\"];\n23->18;\n24[label=\"Node Type: EXPRESSION 24\n\"];\n24->14;\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/break-all.sol-0.8.14-compact.json b/tests/ast-parsing/expected/break-all.sol-0.8.14-compact.json new file mode 100644 index 000000000..b9b7fc93e --- /dev/null +++ b/tests/ast-parsing/expected/break-all.sol-0.8.14-compact.json @@ -0,0 +1,5 @@ +{ + "C": { + "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: NEW VARIABLE 1\n\"];\n1->4;\n2[label=\"Node Type: BEGIN_LOOP 2\n\"];\n2->5;\n3[label=\"Node Type: END_LOOP 3\n\"];\n3->13;\n4[label=\"Node Type: NEW VARIABLE 4\n\"];\n4->2;\n5[label=\"Node Type: IF_LOOP 5\n\"];\n5->6[label=\"True\"];\n5->3[label=\"False\"];\n6[label=\"Node Type: IF 6\n\"];\n6->7[label=\"True\"];\n6->8[label=\"False\"];\n7[label=\"Node Type: BREAK 7\n\"];\n7->3;\n8[label=\"Node Type: END_IF 8\n\"];\n8->9;\n9[label=\"Node Type: EXPRESSION 9\n\"];\n9->10;\n10[label=\"Node Type: EXPRESSION 10\n\"];\n10->5;\n11[label=\"Node Type: BEGIN_LOOP 11\n\"];\n11->14;\n12[label=\"Node Type: END_LOOP 12\n\"];\n13[label=\"Node Type: NEW VARIABLE 13\n\"];\n13->11;\n14[label=\"Node Type: IF_LOOP 14\n\"];\n14->17[label=\"True\"];\n14->12[label=\"False\"];\n15[label=\"Node Type: BEGIN_LOOP 15\n\"];\n15->18;\n16[label=\"Node Type: END_LOOP 16\n\"];\n16->24;\n17[label=\"Node Type: NEW VARIABLE 17\n\"];\n17->15;\n18[label=\"Node Type: IF_LOOP 18\n\"];\n18->19[label=\"True\"];\n18->16[label=\"False\"];\n19[label=\"Node Type: IF 19\n\"];\n19->20[label=\"True\"];\n19->21[label=\"False\"];\n20[label=\"Node Type: BREAK 20\n\"];\n20->16;\n21[label=\"Node Type: END_IF 21\n\"];\n21->22;\n22[label=\"Node Type: EXPRESSION 22\n\"];\n22->23;\n23[label=\"Node Type: EXPRESSION 23\n\"];\n23->18;\n24[label=\"Node Type: EXPRESSION 24\n\"];\n24->14;\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/break-all.sol-0.8.15-compact.json b/tests/ast-parsing/expected/break-all.sol-0.8.15-compact.json new file mode 100644 index 000000000..b9b7fc93e --- /dev/null +++ b/tests/ast-parsing/expected/break-all.sol-0.8.15-compact.json @@ -0,0 +1,5 @@ +{ + "C": { + "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: NEW VARIABLE 1\n\"];\n1->4;\n2[label=\"Node Type: BEGIN_LOOP 2\n\"];\n2->5;\n3[label=\"Node Type: END_LOOP 3\n\"];\n3->13;\n4[label=\"Node Type: NEW VARIABLE 4\n\"];\n4->2;\n5[label=\"Node Type: IF_LOOP 5\n\"];\n5->6[label=\"True\"];\n5->3[label=\"False\"];\n6[label=\"Node Type: IF 6\n\"];\n6->7[label=\"True\"];\n6->8[label=\"False\"];\n7[label=\"Node Type: BREAK 7\n\"];\n7->3;\n8[label=\"Node Type: END_IF 8\n\"];\n8->9;\n9[label=\"Node Type: EXPRESSION 9\n\"];\n9->10;\n10[label=\"Node Type: EXPRESSION 10\n\"];\n10->5;\n11[label=\"Node Type: BEGIN_LOOP 11\n\"];\n11->14;\n12[label=\"Node Type: END_LOOP 12\n\"];\n13[label=\"Node Type: NEW VARIABLE 13\n\"];\n13->11;\n14[label=\"Node Type: IF_LOOP 14\n\"];\n14->17[label=\"True\"];\n14->12[label=\"False\"];\n15[label=\"Node Type: BEGIN_LOOP 15\n\"];\n15->18;\n16[label=\"Node Type: END_LOOP 16\n\"];\n16->24;\n17[label=\"Node Type: NEW VARIABLE 17\n\"];\n17->15;\n18[label=\"Node Type: IF_LOOP 18\n\"];\n18->19[label=\"True\"];\n18->16[label=\"False\"];\n19[label=\"Node Type: IF 19\n\"];\n19->20[label=\"True\"];\n19->21[label=\"False\"];\n20[label=\"Node Type: BREAK 20\n\"];\n20->16;\n21[label=\"Node Type: END_IF 21\n\"];\n21->22;\n22[label=\"Node Type: EXPRESSION 22\n\"];\n22->23;\n23[label=\"Node Type: EXPRESSION 23\n\"];\n23->18;\n24[label=\"Node Type: EXPRESSION 24\n\"];\n24->14;\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/call_to_variable-all.sol-0.8.13-compact.json b/tests/ast-parsing/expected/call_to_variable-all.sol-0.8.13-compact.json new file mode 100644 index 000000000..113bb5a14 --- /dev/null +++ b/tests/ast-parsing/expected/call_to_variable-all.sol-0.8.13-compact.json @@ -0,0 +1,6 @@ +{ + "C": {}, + "D": { + "f(C)": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: EXPRESSION 1\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/call_to_variable-all.sol-0.8.14-compact.json b/tests/ast-parsing/expected/call_to_variable-all.sol-0.8.14-compact.json new file mode 100644 index 000000000..113bb5a14 --- /dev/null +++ b/tests/ast-parsing/expected/call_to_variable-all.sol-0.8.14-compact.json @@ -0,0 +1,6 @@ +{ + "C": {}, + "D": { + "f(C)": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: EXPRESSION 1\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/call_to_variable-all.sol-0.8.15-compact.json b/tests/ast-parsing/expected/call_to_variable-all.sol-0.8.15-compact.json new file mode 100644 index 000000000..113bb5a14 --- /dev/null +++ b/tests/ast-parsing/expected/call_to_variable-all.sol-0.8.15-compact.json @@ -0,0 +1,6 @@ +{ + "C": {}, + "D": { + "f(C)": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: EXPRESSION 1\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/comment-all.sol-0.8.13-compact.json b/tests/ast-parsing/expected/comment-all.sol-0.8.13-compact.json new file mode 100644 index 000000000..a53745acd --- /dev/null +++ b/tests/ast-parsing/expected/comment-all.sol-0.8.13-compact.json @@ -0,0 +1,5 @@ +{ + "A": { + "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/comment-all.sol-0.8.14-compact.json b/tests/ast-parsing/expected/comment-all.sol-0.8.14-compact.json new file mode 100644 index 000000000..a53745acd --- /dev/null +++ b/tests/ast-parsing/expected/comment-all.sol-0.8.14-compact.json @@ -0,0 +1,5 @@ +{ + "A": { + "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/comment-all.sol-0.8.15-compact.json b/tests/ast-parsing/expected/comment-all.sol-0.8.15-compact.json new file mode 100644 index 000000000..a53745acd --- /dev/null +++ b/tests/ast-parsing/expected/comment-all.sol-0.8.15-compact.json @@ -0,0 +1,5 @@ +{ + "A": { + "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/complex_imports/import_aliases/test.sol-0.8.13-compact.json b/tests/ast-parsing/expected/complex_imports/import_aliases/test.sol-0.8.13-compact.json new file mode 100644 index 000000000..6710349b1 --- /dev/null +++ b/tests/ast-parsing/expected/complex_imports/import_aliases/test.sol-0.8.13-compact.json @@ -0,0 +1,7 @@ +{ + "Test": {}, + "Lib": {}, + "C": { + "f(St)": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: EXPRESSION 1\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/complex_imports/import_aliases/test.sol-0.8.14-compact.json b/tests/ast-parsing/expected/complex_imports/import_aliases/test.sol-0.8.14-compact.json new file mode 100644 index 000000000..6710349b1 --- /dev/null +++ b/tests/ast-parsing/expected/complex_imports/import_aliases/test.sol-0.8.14-compact.json @@ -0,0 +1,7 @@ +{ + "Test": {}, + "Lib": {}, + "C": { + "f(St)": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: EXPRESSION 1\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/complex_imports/import_aliases/test.sol-0.8.15-compact.json b/tests/ast-parsing/expected/complex_imports/import_aliases/test.sol-0.8.15-compact.json new file mode 100644 index 000000000..6710349b1 --- /dev/null +++ b/tests/ast-parsing/expected/complex_imports/import_aliases/test.sol-0.8.15-compact.json @@ -0,0 +1,7 @@ +{ + "Test": {}, + "Lib": {}, + "C": { + "f(St)": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: EXPRESSION 1\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/conditional-all.sol-0.8.13-compact.json b/tests/ast-parsing/expected/conditional-all.sol-0.8.13-compact.json new file mode 100644 index 000000000..6ef3d40e7 --- /dev/null +++ b/tests/ast-parsing/expected/conditional-all.sol-0.8.13-compact.json @@ -0,0 +1,5 @@ +{ + "C": { + "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->6;\n6[label=\"Node Type: IF 6\n\"];\n6->7[label=\"True\"];\n6->8[label=\"False\"];\n7[label=\"Node Type: EXPRESSION 7\n\"];\n7->9;\n8[label=\"Node Type: EXPRESSION 8\n\"];\n8->9;\n9[label=\"Node Type: END_IF 9\n\"];\n9->10;\n10[label=\"Node Type: IF 10\n\"];\n10->11[label=\"True\"];\n10->12[label=\"False\"];\n11[label=\"Node Type: EXPRESSION 11\n\"];\n11->13;\n12[label=\"Node Type: EXPRESSION 12\n\"];\n12->13;\n13[label=\"Node Type: END_IF 13\n\"];\n13->14;\n14[label=\"Node Type: IF 14\n\"];\n14->16[label=\"True\"];\n14->26[label=\"False\"];\n16[label=\"Node Type: EXPRESSION 16\n\"];\n16->17;\n17[label=\"Node Type: END_IF 17\n\"];\n17->18;\n18[label=\"Node Type: IF 18\n\"];\n18->19[label=\"True\"];\n18->20[label=\"False\"];\n19[label=\"Node Type: EXPRESSION 19\n\"];\n19->21;\n20[label=\"Node Type: EXPRESSION 20\n\"];\n20->21;\n21[label=\"Node Type: END_IF 21\n\"];\n21->22;\n22[label=\"Node Type: IF 22\n\"];\n22->23[label=\"True\"];\n22->24[label=\"False\"];\n23[label=\"Node Type: EXPRESSION 23\n\"];\n23->25;\n24[label=\"Node Type: EXPRESSION 24\n\"];\n24->25;\n25[label=\"Node Type: END_IF 25\n\"];\n26[label=\"Node Type: IF 26\n\"];\n26->27[label=\"True\"];\n26->28[label=\"False\"];\n27[label=\"Node Type: EXPRESSION 27\n\"];\n27->29;\n28[label=\"Node Type: EXPRESSION 28\n\"];\n28->29;\n29[label=\"Node Type: END_IF 29\n\"];\n29->17;\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/conditional-all.sol-0.8.14-compact.json b/tests/ast-parsing/expected/conditional-all.sol-0.8.14-compact.json new file mode 100644 index 000000000..6ef3d40e7 --- /dev/null +++ b/tests/ast-parsing/expected/conditional-all.sol-0.8.14-compact.json @@ -0,0 +1,5 @@ +{ + "C": { + "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->6;\n6[label=\"Node Type: IF 6\n\"];\n6->7[label=\"True\"];\n6->8[label=\"False\"];\n7[label=\"Node Type: EXPRESSION 7\n\"];\n7->9;\n8[label=\"Node Type: EXPRESSION 8\n\"];\n8->9;\n9[label=\"Node Type: END_IF 9\n\"];\n9->10;\n10[label=\"Node Type: IF 10\n\"];\n10->11[label=\"True\"];\n10->12[label=\"False\"];\n11[label=\"Node Type: EXPRESSION 11\n\"];\n11->13;\n12[label=\"Node Type: EXPRESSION 12\n\"];\n12->13;\n13[label=\"Node Type: END_IF 13\n\"];\n13->14;\n14[label=\"Node Type: IF 14\n\"];\n14->16[label=\"True\"];\n14->26[label=\"False\"];\n16[label=\"Node Type: EXPRESSION 16\n\"];\n16->17;\n17[label=\"Node Type: END_IF 17\n\"];\n17->18;\n18[label=\"Node Type: IF 18\n\"];\n18->19[label=\"True\"];\n18->20[label=\"False\"];\n19[label=\"Node Type: EXPRESSION 19\n\"];\n19->21;\n20[label=\"Node Type: EXPRESSION 20\n\"];\n20->21;\n21[label=\"Node Type: END_IF 21\n\"];\n21->22;\n22[label=\"Node Type: IF 22\n\"];\n22->23[label=\"True\"];\n22->24[label=\"False\"];\n23[label=\"Node Type: EXPRESSION 23\n\"];\n23->25;\n24[label=\"Node Type: EXPRESSION 24\n\"];\n24->25;\n25[label=\"Node Type: END_IF 25\n\"];\n26[label=\"Node Type: IF 26\n\"];\n26->27[label=\"True\"];\n26->28[label=\"False\"];\n27[label=\"Node Type: EXPRESSION 27\n\"];\n27->29;\n28[label=\"Node Type: EXPRESSION 28\n\"];\n28->29;\n29[label=\"Node Type: END_IF 29\n\"];\n29->17;\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/conditional-all.sol-0.8.15-compact.json b/tests/ast-parsing/expected/conditional-all.sol-0.8.15-compact.json new file mode 100644 index 000000000..6ef3d40e7 --- /dev/null +++ b/tests/ast-parsing/expected/conditional-all.sol-0.8.15-compact.json @@ -0,0 +1,5 @@ +{ + "C": { + "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->6;\n6[label=\"Node Type: IF 6\n\"];\n6->7[label=\"True\"];\n6->8[label=\"False\"];\n7[label=\"Node Type: EXPRESSION 7\n\"];\n7->9;\n8[label=\"Node Type: EXPRESSION 8\n\"];\n8->9;\n9[label=\"Node Type: END_IF 9\n\"];\n9->10;\n10[label=\"Node Type: IF 10\n\"];\n10->11[label=\"True\"];\n10->12[label=\"False\"];\n11[label=\"Node Type: EXPRESSION 11\n\"];\n11->13;\n12[label=\"Node Type: EXPRESSION 12\n\"];\n12->13;\n13[label=\"Node Type: END_IF 13\n\"];\n13->14;\n14[label=\"Node Type: IF 14\n\"];\n14->16[label=\"True\"];\n14->26[label=\"False\"];\n16[label=\"Node Type: EXPRESSION 16\n\"];\n16->17;\n17[label=\"Node Type: END_IF 17\n\"];\n17->18;\n18[label=\"Node Type: IF 18\n\"];\n18->19[label=\"True\"];\n18->20[label=\"False\"];\n19[label=\"Node Type: EXPRESSION 19\n\"];\n19->21;\n20[label=\"Node Type: EXPRESSION 20\n\"];\n20->21;\n21[label=\"Node Type: END_IF 21\n\"];\n21->22;\n22[label=\"Node Type: IF 22\n\"];\n22->23[label=\"True\"];\n22->24[label=\"False\"];\n23[label=\"Node Type: EXPRESSION 23\n\"];\n23->25;\n24[label=\"Node Type: EXPRESSION 24\n\"];\n24->25;\n25[label=\"Node Type: END_IF 25\n\"];\n26[label=\"Node Type: IF 26\n\"];\n26->27[label=\"True\"];\n26->28[label=\"False\"];\n27[label=\"Node Type: EXPRESSION 27\n\"];\n27->29;\n28[label=\"Node Type: EXPRESSION 28\n\"];\n28->29;\n29[label=\"Node Type: END_IF 29\n\"];\n29->17;\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/continue-all.sol-0.8.13-compact.json b/tests/ast-parsing/expected/continue-all.sol-0.8.13-compact.json new file mode 100644 index 000000000..bba15d9bd --- /dev/null +++ b/tests/ast-parsing/expected/continue-all.sol-0.8.13-compact.json @@ -0,0 +1,5 @@ +{ + "C": { + "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: NEW VARIABLE 1\n\"];\n1->4;\n2[label=\"Node Type: BEGIN_LOOP 2\n\"];\n2->5;\n3[label=\"Node Type: END_LOOP 3\n\"];\n3->13;\n4[label=\"Node Type: NEW VARIABLE 4\n\"];\n4->2;\n5[label=\"Node Type: IF_LOOP 5\n\"];\n5->6[label=\"True\"];\n5->3[label=\"False\"];\n6[label=\"Node Type: IF 6\n\"];\n6->7[label=\"True\"];\n6->8[label=\"False\"];\n7[label=\"Node Type: CONTINUE 7\n\"];\n7->2;\n8[label=\"Node Type: END_IF 8\n\"];\n8->9;\n9[label=\"Node Type: EXPRESSION 9\n\"];\n9->10;\n10[label=\"Node Type: EXPRESSION 10\n\"];\n10->5;\n11[label=\"Node Type: BEGIN_LOOP 11\n\"];\n11->14;\n12[label=\"Node Type: END_LOOP 12\n\"];\n13[label=\"Node Type: NEW VARIABLE 13\n\"];\n13->11;\n14[label=\"Node Type: IF_LOOP 14\n\"];\n14->17[label=\"True\"];\n14->12[label=\"False\"];\n15[label=\"Node Type: BEGIN_LOOP 15\n\"];\n15->18;\n16[label=\"Node Type: END_LOOP 16\n\"];\n16->24;\n17[label=\"Node Type: NEW VARIABLE 17\n\"];\n17->15;\n18[label=\"Node Type: IF_LOOP 18\n\"];\n18->19[label=\"True\"];\n18->16[label=\"False\"];\n19[label=\"Node Type: IF 19\n\"];\n19->20[label=\"True\"];\n19->21[label=\"False\"];\n20[label=\"Node Type: CONTINUE 20\n\"];\n20->15;\n21[label=\"Node Type: END_IF 21\n\"];\n21->22;\n22[label=\"Node Type: EXPRESSION 22\n\"];\n22->23;\n23[label=\"Node Type: EXPRESSION 23\n\"];\n23->18;\n24[label=\"Node Type: EXPRESSION 24\n\"];\n24->14;\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/continue-all.sol-0.8.14-compact.json b/tests/ast-parsing/expected/continue-all.sol-0.8.14-compact.json new file mode 100644 index 000000000..bba15d9bd --- /dev/null +++ b/tests/ast-parsing/expected/continue-all.sol-0.8.14-compact.json @@ -0,0 +1,5 @@ +{ + "C": { + "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: NEW VARIABLE 1\n\"];\n1->4;\n2[label=\"Node Type: BEGIN_LOOP 2\n\"];\n2->5;\n3[label=\"Node Type: END_LOOP 3\n\"];\n3->13;\n4[label=\"Node Type: NEW VARIABLE 4\n\"];\n4->2;\n5[label=\"Node Type: IF_LOOP 5\n\"];\n5->6[label=\"True\"];\n5->3[label=\"False\"];\n6[label=\"Node Type: IF 6\n\"];\n6->7[label=\"True\"];\n6->8[label=\"False\"];\n7[label=\"Node Type: CONTINUE 7\n\"];\n7->2;\n8[label=\"Node Type: END_IF 8\n\"];\n8->9;\n9[label=\"Node Type: EXPRESSION 9\n\"];\n9->10;\n10[label=\"Node Type: EXPRESSION 10\n\"];\n10->5;\n11[label=\"Node Type: BEGIN_LOOP 11\n\"];\n11->14;\n12[label=\"Node Type: END_LOOP 12\n\"];\n13[label=\"Node Type: NEW VARIABLE 13\n\"];\n13->11;\n14[label=\"Node Type: IF_LOOP 14\n\"];\n14->17[label=\"True\"];\n14->12[label=\"False\"];\n15[label=\"Node Type: BEGIN_LOOP 15\n\"];\n15->18;\n16[label=\"Node Type: END_LOOP 16\n\"];\n16->24;\n17[label=\"Node Type: NEW VARIABLE 17\n\"];\n17->15;\n18[label=\"Node Type: IF_LOOP 18\n\"];\n18->19[label=\"True\"];\n18->16[label=\"False\"];\n19[label=\"Node Type: IF 19\n\"];\n19->20[label=\"True\"];\n19->21[label=\"False\"];\n20[label=\"Node Type: CONTINUE 20\n\"];\n20->15;\n21[label=\"Node Type: END_IF 21\n\"];\n21->22;\n22[label=\"Node Type: EXPRESSION 22\n\"];\n22->23;\n23[label=\"Node Type: EXPRESSION 23\n\"];\n23->18;\n24[label=\"Node Type: EXPRESSION 24\n\"];\n24->14;\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/continue-all.sol-0.8.15-compact.json b/tests/ast-parsing/expected/continue-all.sol-0.8.15-compact.json new file mode 100644 index 000000000..bba15d9bd --- /dev/null +++ b/tests/ast-parsing/expected/continue-all.sol-0.8.15-compact.json @@ -0,0 +1,5 @@ +{ + "C": { + "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: NEW VARIABLE 1\n\"];\n1->4;\n2[label=\"Node Type: BEGIN_LOOP 2\n\"];\n2->5;\n3[label=\"Node Type: END_LOOP 3\n\"];\n3->13;\n4[label=\"Node Type: NEW VARIABLE 4\n\"];\n4->2;\n5[label=\"Node Type: IF_LOOP 5\n\"];\n5->6[label=\"True\"];\n5->3[label=\"False\"];\n6[label=\"Node Type: IF 6\n\"];\n6->7[label=\"True\"];\n6->8[label=\"False\"];\n7[label=\"Node Type: CONTINUE 7\n\"];\n7->2;\n8[label=\"Node Type: END_IF 8\n\"];\n8->9;\n9[label=\"Node Type: EXPRESSION 9\n\"];\n9->10;\n10[label=\"Node Type: EXPRESSION 10\n\"];\n10->5;\n11[label=\"Node Type: BEGIN_LOOP 11\n\"];\n11->14;\n12[label=\"Node Type: END_LOOP 12\n\"];\n13[label=\"Node Type: NEW VARIABLE 13\n\"];\n13->11;\n14[label=\"Node Type: IF_LOOP 14\n\"];\n14->17[label=\"True\"];\n14->12[label=\"False\"];\n15[label=\"Node Type: BEGIN_LOOP 15\n\"];\n15->18;\n16[label=\"Node Type: END_LOOP 16\n\"];\n16->24;\n17[label=\"Node Type: NEW VARIABLE 17\n\"];\n17->15;\n18[label=\"Node Type: IF_LOOP 18\n\"];\n18->19[label=\"True\"];\n18->16[label=\"False\"];\n19[label=\"Node Type: IF 19\n\"];\n19->20[label=\"True\"];\n19->21[label=\"False\"];\n20[label=\"Node Type: CONTINUE 20\n\"];\n20->15;\n21[label=\"Node Type: END_IF 21\n\"];\n21->22;\n22[label=\"Node Type: EXPRESSION 22\n\"];\n22->23;\n23[label=\"Node Type: EXPRESSION 23\n\"];\n23->18;\n24[label=\"Node Type: EXPRESSION 24\n\"];\n24->14;\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/contract-0.6.0.sol-0.8.13-compact.json b/tests/ast-parsing/expected/contract-0.6.0.sol-0.8.13-compact.json new file mode 100644 index 000000000..1df28fb3d --- /dev/null +++ b/tests/ast-parsing/expected/contract-0.6.0.sol-0.8.13-compact.json @@ -0,0 +1,19 @@ +{ + "A": {}, + "B": { + "constructor(uint256)": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n" + }, + "C": { + "constructor(uint256)": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n" + }, + "D": { + "constructor(uint256)": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n", + "constructor()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: EXPRESSION 1\n\"];\n}\n" + }, + "E": { + "constructor(uint256)": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n" + }, + "F": {}, + "G": {}, + "H": {} +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/contract-0.6.0.sol-0.8.14-compact.json b/tests/ast-parsing/expected/contract-0.6.0.sol-0.8.14-compact.json new file mode 100644 index 000000000..1df28fb3d --- /dev/null +++ b/tests/ast-parsing/expected/contract-0.6.0.sol-0.8.14-compact.json @@ -0,0 +1,19 @@ +{ + "A": {}, + "B": { + "constructor(uint256)": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n" + }, + "C": { + "constructor(uint256)": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n" + }, + "D": { + "constructor(uint256)": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n", + "constructor()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: EXPRESSION 1\n\"];\n}\n" + }, + "E": { + "constructor(uint256)": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n" + }, + "F": {}, + "G": {}, + "H": {} +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/contract-0.6.0.sol-0.8.15-compact.json b/tests/ast-parsing/expected/contract-0.6.0.sol-0.8.15-compact.json new file mode 100644 index 000000000..1df28fb3d --- /dev/null +++ b/tests/ast-parsing/expected/contract-0.6.0.sol-0.8.15-compact.json @@ -0,0 +1,19 @@ +{ + "A": {}, + "B": { + "constructor(uint256)": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n" + }, + "C": { + "constructor(uint256)": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n" + }, + "D": { + "constructor(uint256)": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n", + "constructor()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: EXPRESSION 1\n\"];\n}\n" + }, + "E": { + "constructor(uint256)": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n" + }, + "F": {}, + "G": {}, + "H": {} +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/custom_error-0.4.0.sol-0.8.13-compact.json b/tests/ast-parsing/expected/custom_error-0.4.0.sol-0.8.13-compact.json new file mode 100644 index 000000000..9e26dfeeb --- /dev/null +++ b/tests/ast-parsing/expected/custom_error-0.4.0.sol-0.8.13-compact.json @@ -0,0 +1 @@ +{} \ No newline at end of file diff --git a/tests/ast-parsing/expected/custom_error-0.4.0.sol-0.8.14-compact.json b/tests/ast-parsing/expected/custom_error-0.4.0.sol-0.8.14-compact.json new file mode 100644 index 000000000..9e26dfeeb --- /dev/null +++ b/tests/ast-parsing/expected/custom_error-0.4.0.sol-0.8.14-compact.json @@ -0,0 +1 @@ +{} \ No newline at end of file diff --git a/tests/ast-parsing/expected/custom_error-0.4.0.sol-0.8.15-compact.json b/tests/ast-parsing/expected/custom_error-0.4.0.sol-0.8.15-compact.json new file mode 100644 index 000000000..9e26dfeeb --- /dev/null +++ b/tests/ast-parsing/expected/custom_error-0.4.0.sol-0.8.15-compact.json @@ -0,0 +1 @@ +{} \ No newline at end of file diff --git a/tests/ast-parsing/expected/custom_error_with_state_variable.sol-0.8.10-compact.json b/tests/ast-parsing/expected/custom_error_with_state_variable.sol-0.8.10-compact.json index 4355f9aef..34f391b5c 100644 --- a/tests/ast-parsing/expected/custom_error_with_state_variable.sol-0.8.10-compact.json +++ b/tests/ast-parsing/expected/custom_error_with_state_variable.sol-0.8.10-compact.json @@ -1,3 +1,6 @@ { - "Bar": {} + "CustomErrors": {}, + "Bar": { + "baz()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: EXPRESSION 1\n\"];\n}\n" + } } \ No newline at end of file diff --git a/tests/ast-parsing/expected/custom_error_with_state_variable.sol-0.8.11-compact.json b/tests/ast-parsing/expected/custom_error_with_state_variable.sol-0.8.11-compact.json index 4355f9aef..34f391b5c 100644 --- a/tests/ast-parsing/expected/custom_error_with_state_variable.sol-0.8.11-compact.json +++ b/tests/ast-parsing/expected/custom_error_with_state_variable.sol-0.8.11-compact.json @@ -1,3 +1,6 @@ { - "Bar": {} + "CustomErrors": {}, + "Bar": { + "baz()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: EXPRESSION 1\n\"];\n}\n" + } } \ No newline at end of file diff --git a/tests/ast-parsing/expected/custom_error_with_state_variable.sol-0.8.12-compact.json b/tests/ast-parsing/expected/custom_error_with_state_variable.sol-0.8.12-compact.json index 4355f9aef..34f391b5c 100644 --- a/tests/ast-parsing/expected/custom_error_with_state_variable.sol-0.8.12-compact.json +++ b/tests/ast-parsing/expected/custom_error_with_state_variable.sol-0.8.12-compact.json @@ -1,3 +1,6 @@ { - "Bar": {} + "CustomErrors": {}, + "Bar": { + "baz()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: EXPRESSION 1\n\"];\n}\n" + } } \ No newline at end of file diff --git a/tests/ast-parsing/expected/custom_error_with_state_variable.sol-0.8.4-compact.json b/tests/ast-parsing/expected/custom_error_with_state_variable.sol-0.8.4-compact.json index 4355f9aef..34f391b5c 100644 --- a/tests/ast-parsing/expected/custom_error_with_state_variable.sol-0.8.4-compact.json +++ b/tests/ast-parsing/expected/custom_error_with_state_variable.sol-0.8.4-compact.json @@ -1,3 +1,6 @@ { - "Bar": {} + "CustomErrors": {}, + "Bar": { + "baz()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: EXPRESSION 1\n\"];\n}\n" + } } \ No newline at end of file diff --git a/tests/ast-parsing/expected/custom_error_with_state_variable.sol-0.8.5-compact.json b/tests/ast-parsing/expected/custom_error_with_state_variable.sol-0.8.5-compact.json index 4355f9aef..34f391b5c 100644 --- a/tests/ast-parsing/expected/custom_error_with_state_variable.sol-0.8.5-compact.json +++ b/tests/ast-parsing/expected/custom_error_with_state_variable.sol-0.8.5-compact.json @@ -1,3 +1,6 @@ { - "Bar": {} + "CustomErrors": {}, + "Bar": { + "baz()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: EXPRESSION 1\n\"];\n}\n" + } } \ No newline at end of file diff --git a/tests/ast-parsing/expected/custom_error_with_state_variable.sol-0.8.6-compact.json b/tests/ast-parsing/expected/custom_error_with_state_variable.sol-0.8.6-compact.json index 4355f9aef..34f391b5c 100644 --- a/tests/ast-parsing/expected/custom_error_with_state_variable.sol-0.8.6-compact.json +++ b/tests/ast-parsing/expected/custom_error_with_state_variable.sol-0.8.6-compact.json @@ -1,3 +1,6 @@ { - "Bar": {} + "CustomErrors": {}, + "Bar": { + "baz()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: EXPRESSION 1\n\"];\n}\n" + } } \ No newline at end of file diff --git a/tests/ast-parsing/expected/custom_error_with_state_variable.sol-0.8.7-compact.json b/tests/ast-parsing/expected/custom_error_with_state_variable.sol-0.8.7-compact.json index 4355f9aef..34f391b5c 100644 --- a/tests/ast-parsing/expected/custom_error_with_state_variable.sol-0.8.7-compact.json +++ b/tests/ast-parsing/expected/custom_error_with_state_variable.sol-0.8.7-compact.json @@ -1,3 +1,6 @@ { - "Bar": {} + "CustomErrors": {}, + "Bar": { + "baz()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: EXPRESSION 1\n\"];\n}\n" + } } \ No newline at end of file diff --git a/tests/ast-parsing/expected/custom_error_with_state_variable.sol-0.8.8-compact.json b/tests/ast-parsing/expected/custom_error_with_state_variable.sol-0.8.8-compact.json index 4355f9aef..34f391b5c 100644 --- a/tests/ast-parsing/expected/custom_error_with_state_variable.sol-0.8.8-compact.json +++ b/tests/ast-parsing/expected/custom_error_with_state_variable.sol-0.8.8-compact.json @@ -1,3 +1,6 @@ { - "Bar": {} + "CustomErrors": {}, + "Bar": { + "baz()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: EXPRESSION 1\n\"];\n}\n" + } } \ No newline at end of file diff --git a/tests/ast-parsing/expected/custom_error_with_state_variable.sol-0.8.9-compact.json b/tests/ast-parsing/expected/custom_error_with_state_variable.sol-0.8.9-compact.json index 4355f9aef..34f391b5c 100644 --- a/tests/ast-parsing/expected/custom_error_with_state_variable.sol-0.8.9-compact.json +++ b/tests/ast-parsing/expected/custom_error_with_state_variable.sol-0.8.9-compact.json @@ -1,3 +1,6 @@ { - "Bar": {} + "CustomErrors": {}, + "Bar": { + "baz()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: EXPRESSION 1\n\"];\n}\n" + } } \ No newline at end of file diff --git a/tests/ast-parsing/expected/dowhile-0.4.5.sol-0.8.13-compact.json b/tests/ast-parsing/expected/dowhile-0.4.5.sol-0.8.13-compact.json new file mode 100644 index 000000000..1cf317575 --- /dev/null +++ b/tests/ast-parsing/expected/dowhile-0.4.5.sol-0.8.13-compact.json @@ -0,0 +1,5 @@ +{ + "C": { + "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: NEW VARIABLE 1\n\"];\n1->2;\n2[label=\"Node Type: BEGIN_LOOP 2\n\"];\n2->4;\n3[label=\"Node Type: IF_LOOP 3\n\"];\n3->4[label=\"True\"];\n3->5[label=\"False\"];\n4[label=\"Node Type: EXPRESSION 4\n\"];\n4->3;\n5[label=\"Node Type: END_LOOP 5\n\"];\n5->6;\n6[label=\"Node Type: EXPRESSION 6\n\"];\n6->7;\n7[label=\"Node Type: BEGIN_LOOP 7\n\"];\n7->9;\n8[label=\"Node Type: IF_LOOP 8\n\"];\n8->9[label=\"True\"];\n8->10[label=\"False\"];\n9[label=\"Node Type: EXPRESSION 9\n\"];\n9->8;\n10[label=\"Node Type: END_LOOP 10\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/dowhile-0.4.5.sol-0.8.14-compact.json b/tests/ast-parsing/expected/dowhile-0.4.5.sol-0.8.14-compact.json new file mode 100644 index 000000000..1cf317575 --- /dev/null +++ b/tests/ast-parsing/expected/dowhile-0.4.5.sol-0.8.14-compact.json @@ -0,0 +1,5 @@ +{ + "C": { + "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: NEW VARIABLE 1\n\"];\n1->2;\n2[label=\"Node Type: BEGIN_LOOP 2\n\"];\n2->4;\n3[label=\"Node Type: IF_LOOP 3\n\"];\n3->4[label=\"True\"];\n3->5[label=\"False\"];\n4[label=\"Node Type: EXPRESSION 4\n\"];\n4->3;\n5[label=\"Node Type: END_LOOP 5\n\"];\n5->6;\n6[label=\"Node Type: EXPRESSION 6\n\"];\n6->7;\n7[label=\"Node Type: BEGIN_LOOP 7\n\"];\n7->9;\n8[label=\"Node Type: IF_LOOP 8\n\"];\n8->9[label=\"True\"];\n8->10[label=\"False\"];\n9[label=\"Node Type: EXPRESSION 9\n\"];\n9->8;\n10[label=\"Node Type: END_LOOP 10\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/dowhile-0.4.5.sol-0.8.15-compact.json b/tests/ast-parsing/expected/dowhile-0.4.5.sol-0.8.15-compact.json new file mode 100644 index 000000000..1cf317575 --- /dev/null +++ b/tests/ast-parsing/expected/dowhile-0.4.5.sol-0.8.15-compact.json @@ -0,0 +1,5 @@ +{ + "C": { + "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: NEW VARIABLE 1\n\"];\n1->2;\n2[label=\"Node Type: BEGIN_LOOP 2\n\"];\n2->4;\n3[label=\"Node Type: IF_LOOP 3\n\"];\n3->4[label=\"True\"];\n3->5[label=\"False\"];\n4[label=\"Node Type: EXPRESSION 4\n\"];\n4->3;\n5[label=\"Node Type: END_LOOP 5\n\"];\n5->6;\n6[label=\"Node Type: EXPRESSION 6\n\"];\n6->7;\n7[label=\"Node Type: BEGIN_LOOP 7\n\"];\n7->9;\n8[label=\"Node Type: IF_LOOP 8\n\"];\n8->9[label=\"True\"];\n8->10[label=\"False\"];\n9[label=\"Node Type: EXPRESSION 9\n\"];\n9->8;\n10[label=\"Node Type: END_LOOP 10\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/emit-0.5.0.sol-0.8.13-compact.json b/tests/ast-parsing/expected/emit-0.5.0.sol-0.8.13-compact.json new file mode 100644 index 000000000..b043ced39 --- /dev/null +++ b/tests/ast-parsing/expected/emit-0.5.0.sol-0.8.13-compact.json @@ -0,0 +1,5 @@ +{ + "C": { + "emitWithKeyword()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: EXPRESSION 1\n\"];\n1->2;\n2[label=\"Node Type: EXPRESSION 2\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/emit-0.5.0.sol-0.8.14-compact.json b/tests/ast-parsing/expected/emit-0.5.0.sol-0.8.14-compact.json new file mode 100644 index 000000000..b043ced39 --- /dev/null +++ b/tests/ast-parsing/expected/emit-0.5.0.sol-0.8.14-compact.json @@ -0,0 +1,5 @@ +{ + "C": { + "emitWithKeyword()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: EXPRESSION 1\n\"];\n1->2;\n2[label=\"Node Type: EXPRESSION 2\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/emit-0.5.0.sol-0.8.15-compact.json b/tests/ast-parsing/expected/emit-0.5.0.sol-0.8.15-compact.json new file mode 100644 index 000000000..b043ced39 --- /dev/null +++ b/tests/ast-parsing/expected/emit-0.5.0.sol-0.8.15-compact.json @@ -0,0 +1,5 @@ +{ + "C": { + "emitWithKeyword()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: EXPRESSION 1\n\"];\n1->2;\n2[label=\"Node Type: EXPRESSION 2\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/enum-0.8.0.sol-0.8.13-compact.json b/tests/ast-parsing/expected/enum-0.8.0.sol-0.8.13-compact.json new file mode 100644 index 000000000..0008a4469 --- /dev/null +++ b/tests/ast-parsing/expected/enum-0.8.0.sol-0.8.13-compact.json @@ -0,0 +1,3 @@ +{ + "C": {} +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/enum-0.8.0.sol-0.8.14-compact.json b/tests/ast-parsing/expected/enum-0.8.0.sol-0.8.14-compact.json new file mode 100644 index 000000000..0008a4469 --- /dev/null +++ b/tests/ast-parsing/expected/enum-0.8.0.sol-0.8.14-compact.json @@ -0,0 +1,3 @@ +{ + "C": {} +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/enum-0.8.0.sol-0.8.15-compact.json b/tests/ast-parsing/expected/enum-0.8.0.sol-0.8.15-compact.json new file mode 100644 index 000000000..0008a4469 --- /dev/null +++ b/tests/ast-parsing/expected/enum-0.8.0.sol-0.8.15-compact.json @@ -0,0 +1,3 @@ +{ + "C": {} +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/event-all.sol-0.8.13-compact.json b/tests/ast-parsing/expected/event-all.sol-0.8.13-compact.json new file mode 100644 index 000000000..0008a4469 --- /dev/null +++ b/tests/ast-parsing/expected/event-all.sol-0.8.13-compact.json @@ -0,0 +1,3 @@ +{ + "C": {} +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/event-all.sol-0.8.14-compact.json b/tests/ast-parsing/expected/event-all.sol-0.8.14-compact.json new file mode 100644 index 000000000..0008a4469 --- /dev/null +++ b/tests/ast-parsing/expected/event-all.sol-0.8.14-compact.json @@ -0,0 +1,3 @@ +{ + "C": {} +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/event-all.sol-0.8.15-compact.json b/tests/ast-parsing/expected/event-all.sol-0.8.15-compact.json new file mode 100644 index 000000000..0008a4469 --- /dev/null +++ b/tests/ast-parsing/expected/event-all.sol-0.8.15-compact.json @@ -0,0 +1,3 @@ +{ + "C": {} +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/for-all.sol-0.8.13-compact.json b/tests/ast-parsing/expected/for-all.sol-0.8.13-compact.json new file mode 100644 index 000000000..fe24348d8 --- /dev/null +++ b/tests/ast-parsing/expected/for-all.sol-0.8.13-compact.json @@ -0,0 +1,15 @@ +{ + "C": { + "normalLoopBlockBody()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: NEW VARIABLE 1\n\"];\n1->4;\n2[label=\"Node Type: BEGIN_LOOP 2\n\"];\n2->5;\n3[label=\"Node Type: END_LOOP 3\n\"];\n4[label=\"Node Type: NEW VARIABLE 4\n\"];\n4->2;\n5[label=\"Node Type: IF_LOOP 5\n\"];\n5->6[label=\"True\"];\n5->3[label=\"False\"];\n6[label=\"Node Type: EXPRESSION 6\n\"];\n6->7;\n7[label=\"Node Type: EXPRESSION 7\n\"];\n7->5;\n}\n", + "normalLoopExprBody()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: NEW VARIABLE 1\n\"];\n1->4;\n2[label=\"Node Type: BEGIN_LOOP 2\n\"];\n2->5;\n3[label=\"Node Type: END_LOOP 3\n\"];\n4[label=\"Node Type: NEW VARIABLE 4\n\"];\n4->2;\n5[label=\"Node Type: IF_LOOP 5\n\"];\n5->6[label=\"True\"];\n5->3[label=\"False\"];\n6[label=\"Node Type: EXPRESSION 6\n\"];\n6->7;\n7[label=\"Node Type: EXPRESSION 7\n\"];\n7->5;\n}\n", + "normalLoopNoBody()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: NEW VARIABLE 1\n\"];\n1->4;\n2[label=\"Node Type: BEGIN_LOOP 2\n\"];\n2->5;\n3[label=\"Node Type: END_LOOP 3\n\"];\n4[label=\"Node Type: NEW VARIABLE 4\n\"];\n4->2;\n5[label=\"Node Type: IF_LOOP 5\n\"];\n5->6[label=\"True\"];\n5->3[label=\"False\"];\n6[label=\"Node Type: EXPRESSION 6\n\"];\n6->5;\n}\n", + "loopNoPre()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: NEW VARIABLE 1\n\"];\n1->2;\n2[label=\"Node Type: NEW VARIABLE 2\n\"];\n2->3;\n3[label=\"Node Type: BEGIN_LOOP 3\n\"];\n3->5;\n4[label=\"Node Type: END_LOOP 4\n\"];\n5[label=\"Node Type: IF_LOOP 5\n\"];\n5->6[label=\"True\"];\n5->4[label=\"False\"];\n6[label=\"Node Type: EXPRESSION 6\n\"];\n6->7;\n7[label=\"Node Type: EXPRESSION 7\n\"];\n7->5;\n}\n", + "loopNoCond()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: NEW VARIABLE 1\n\"];\n1->4;\n2[label=\"Node Type: BEGIN_LOOP 2\n\"];\n2->5;\n3[label=\"Node Type: END_LOOP 3\n\"];\n4[label=\"Node Type: NEW VARIABLE 4\n\"];\n4->2;\n5[label=\"Node Type: IF 5\n\"];\n5->6[label=\"True\"];\n5->7[label=\"False\"];\n6[label=\"Node Type: BREAK 6\n\"];\n6->3;\n7[label=\"Node Type: END_IF 7\n\"];\n7->8;\n8[label=\"Node Type: EXPRESSION 8\n\"];\n8->9;\n9[label=\"Node Type: EXPRESSION 9\n\"];\n9->2;\n}\n", + "loopNoPost()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: NEW VARIABLE 1\n\"];\n1->4;\n2[label=\"Node Type: BEGIN_LOOP 2\n\"];\n2->5;\n3[label=\"Node Type: END_LOOP 3\n\"];\n4[label=\"Node Type: NEW VARIABLE 4\n\"];\n4->2;\n5[label=\"Node Type: IF_LOOP 5\n\"];\n5->6[label=\"True\"];\n5->3[label=\"False\"];\n6[label=\"Node Type: EXPRESSION 6\n\"];\n6->7;\n7[label=\"Node Type: EXPRESSION 7\n\"];\n7->5;\n}\n", + "loopNoPreCond()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: NEW VARIABLE 1\n\"];\n1->2;\n2[label=\"Node Type: NEW VARIABLE 2\n\"];\n2->3;\n3[label=\"Node Type: BEGIN_LOOP 3\n\"];\n3->5;\n4[label=\"Node Type: END_LOOP 4\n\"];\n5[label=\"Node Type: IF 5\n\"];\n5->6[label=\"True\"];\n5->7[label=\"False\"];\n6[label=\"Node Type: BREAK 6\n\"];\n6->4;\n7[label=\"Node Type: END_IF 7\n\"];\n7->8;\n8[label=\"Node Type: EXPRESSION 8\n\"];\n8->9;\n9[label=\"Node Type: EXPRESSION 9\n\"];\n9->3;\n}\n", + "loopNoPrePost()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: NEW VARIABLE 1\n\"];\n1->2;\n2[label=\"Node Type: NEW VARIABLE 2\n\"];\n2->3;\n3[label=\"Node Type: BEGIN_LOOP 3\n\"];\n3->5;\n4[label=\"Node Type: END_LOOP 4\n\"];\n5[label=\"Node Type: IF_LOOP 5\n\"];\n5->6[label=\"True\"];\n5->4[label=\"False\"];\n6[label=\"Node Type: EXPRESSION 6\n\"];\n6->7;\n7[label=\"Node Type: EXPRESSION 7\n\"];\n7->5;\n}\n", + "loopNoCondPost()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: NEW VARIABLE 1\n\"];\n1->4;\n2[label=\"Node Type: BEGIN_LOOP 2\n\"];\n2->5;\n3[label=\"Node Type: END_LOOP 3\n\"];\n4[label=\"Node Type: NEW VARIABLE 4\n\"];\n4->2;\n5[label=\"Node Type: IF 5\n\"];\n5->6[label=\"True\"];\n5->7[label=\"False\"];\n6[label=\"Node Type: BREAK 6\n\"];\n6->3;\n7[label=\"Node Type: END_IF 7\n\"];\n7->8;\n8[label=\"Node Type: EXPRESSION 8\n\"];\n8->9;\n9[label=\"Node Type: EXPRESSION 9\n\"];\n9->2;\n}\n", + "loopNoPreCondPost()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: NEW VARIABLE 1\n\"];\n1->2;\n2[label=\"Node Type: NEW VARIABLE 2\n\"];\n2->3;\n3[label=\"Node Type: BEGIN_LOOP 3\n\"];\n3->5;\n4[label=\"Node Type: END_LOOP 4\n\"];\n5[label=\"Node Type: IF 5\n\"];\n5->6[label=\"True\"];\n5->7[label=\"False\"];\n6[label=\"Node Type: BREAK 6\n\"];\n6->4;\n7[label=\"Node Type: END_IF 7\n\"];\n7->8;\n8[label=\"Node Type: EXPRESSION 8\n\"];\n8->9;\n9[label=\"Node Type: EXPRESSION 9\n\"];\n9->3;\n}\n", + "loopNoPreCondPostBody()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: BEGIN_LOOP 1\n\"];\n1->1;\n1->2;\n2[label=\"Node Type: END_LOOP 2\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/for-all.sol-0.8.14-compact.json b/tests/ast-parsing/expected/for-all.sol-0.8.14-compact.json new file mode 100644 index 000000000..fe24348d8 --- /dev/null +++ b/tests/ast-parsing/expected/for-all.sol-0.8.14-compact.json @@ -0,0 +1,15 @@ +{ + "C": { + "normalLoopBlockBody()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: NEW VARIABLE 1\n\"];\n1->4;\n2[label=\"Node Type: BEGIN_LOOP 2\n\"];\n2->5;\n3[label=\"Node Type: END_LOOP 3\n\"];\n4[label=\"Node Type: NEW VARIABLE 4\n\"];\n4->2;\n5[label=\"Node Type: IF_LOOP 5\n\"];\n5->6[label=\"True\"];\n5->3[label=\"False\"];\n6[label=\"Node Type: EXPRESSION 6\n\"];\n6->7;\n7[label=\"Node Type: EXPRESSION 7\n\"];\n7->5;\n}\n", + "normalLoopExprBody()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: NEW VARIABLE 1\n\"];\n1->4;\n2[label=\"Node Type: BEGIN_LOOP 2\n\"];\n2->5;\n3[label=\"Node Type: END_LOOP 3\n\"];\n4[label=\"Node Type: NEW VARIABLE 4\n\"];\n4->2;\n5[label=\"Node Type: IF_LOOP 5\n\"];\n5->6[label=\"True\"];\n5->3[label=\"False\"];\n6[label=\"Node Type: EXPRESSION 6\n\"];\n6->7;\n7[label=\"Node Type: EXPRESSION 7\n\"];\n7->5;\n}\n", + "normalLoopNoBody()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: NEW VARIABLE 1\n\"];\n1->4;\n2[label=\"Node Type: BEGIN_LOOP 2\n\"];\n2->5;\n3[label=\"Node Type: END_LOOP 3\n\"];\n4[label=\"Node Type: NEW VARIABLE 4\n\"];\n4->2;\n5[label=\"Node Type: IF_LOOP 5\n\"];\n5->6[label=\"True\"];\n5->3[label=\"False\"];\n6[label=\"Node Type: EXPRESSION 6\n\"];\n6->5;\n}\n", + "loopNoPre()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: NEW VARIABLE 1\n\"];\n1->2;\n2[label=\"Node Type: NEW VARIABLE 2\n\"];\n2->3;\n3[label=\"Node Type: BEGIN_LOOP 3\n\"];\n3->5;\n4[label=\"Node Type: END_LOOP 4\n\"];\n5[label=\"Node Type: IF_LOOP 5\n\"];\n5->6[label=\"True\"];\n5->4[label=\"False\"];\n6[label=\"Node Type: EXPRESSION 6\n\"];\n6->7;\n7[label=\"Node Type: EXPRESSION 7\n\"];\n7->5;\n}\n", + "loopNoCond()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: NEW VARIABLE 1\n\"];\n1->4;\n2[label=\"Node Type: BEGIN_LOOP 2\n\"];\n2->5;\n3[label=\"Node Type: END_LOOP 3\n\"];\n4[label=\"Node Type: NEW VARIABLE 4\n\"];\n4->2;\n5[label=\"Node Type: IF 5\n\"];\n5->6[label=\"True\"];\n5->7[label=\"False\"];\n6[label=\"Node Type: BREAK 6\n\"];\n6->3;\n7[label=\"Node Type: END_IF 7\n\"];\n7->8;\n8[label=\"Node Type: EXPRESSION 8\n\"];\n8->9;\n9[label=\"Node Type: EXPRESSION 9\n\"];\n9->2;\n}\n", + "loopNoPost()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: NEW VARIABLE 1\n\"];\n1->4;\n2[label=\"Node Type: BEGIN_LOOP 2\n\"];\n2->5;\n3[label=\"Node Type: END_LOOP 3\n\"];\n4[label=\"Node Type: NEW VARIABLE 4\n\"];\n4->2;\n5[label=\"Node Type: IF_LOOP 5\n\"];\n5->6[label=\"True\"];\n5->3[label=\"False\"];\n6[label=\"Node Type: EXPRESSION 6\n\"];\n6->7;\n7[label=\"Node Type: EXPRESSION 7\n\"];\n7->5;\n}\n", + "loopNoPreCond()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: NEW VARIABLE 1\n\"];\n1->2;\n2[label=\"Node Type: NEW VARIABLE 2\n\"];\n2->3;\n3[label=\"Node Type: BEGIN_LOOP 3\n\"];\n3->5;\n4[label=\"Node Type: END_LOOP 4\n\"];\n5[label=\"Node Type: IF 5\n\"];\n5->6[label=\"True\"];\n5->7[label=\"False\"];\n6[label=\"Node Type: BREAK 6\n\"];\n6->4;\n7[label=\"Node Type: END_IF 7\n\"];\n7->8;\n8[label=\"Node Type: EXPRESSION 8\n\"];\n8->9;\n9[label=\"Node Type: EXPRESSION 9\n\"];\n9->3;\n}\n", + "loopNoPrePost()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: NEW VARIABLE 1\n\"];\n1->2;\n2[label=\"Node Type: NEW VARIABLE 2\n\"];\n2->3;\n3[label=\"Node Type: BEGIN_LOOP 3\n\"];\n3->5;\n4[label=\"Node Type: END_LOOP 4\n\"];\n5[label=\"Node Type: IF_LOOP 5\n\"];\n5->6[label=\"True\"];\n5->4[label=\"False\"];\n6[label=\"Node Type: EXPRESSION 6\n\"];\n6->7;\n7[label=\"Node Type: EXPRESSION 7\n\"];\n7->5;\n}\n", + "loopNoCondPost()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: NEW VARIABLE 1\n\"];\n1->4;\n2[label=\"Node Type: BEGIN_LOOP 2\n\"];\n2->5;\n3[label=\"Node Type: END_LOOP 3\n\"];\n4[label=\"Node Type: NEW VARIABLE 4\n\"];\n4->2;\n5[label=\"Node Type: IF 5\n\"];\n5->6[label=\"True\"];\n5->7[label=\"False\"];\n6[label=\"Node Type: BREAK 6\n\"];\n6->3;\n7[label=\"Node Type: END_IF 7\n\"];\n7->8;\n8[label=\"Node Type: EXPRESSION 8\n\"];\n8->9;\n9[label=\"Node Type: EXPRESSION 9\n\"];\n9->2;\n}\n", + "loopNoPreCondPost()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: NEW VARIABLE 1\n\"];\n1->2;\n2[label=\"Node Type: NEW VARIABLE 2\n\"];\n2->3;\n3[label=\"Node Type: BEGIN_LOOP 3\n\"];\n3->5;\n4[label=\"Node Type: END_LOOP 4\n\"];\n5[label=\"Node Type: IF 5\n\"];\n5->6[label=\"True\"];\n5->7[label=\"False\"];\n6[label=\"Node Type: BREAK 6\n\"];\n6->4;\n7[label=\"Node Type: END_IF 7\n\"];\n7->8;\n8[label=\"Node Type: EXPRESSION 8\n\"];\n8->9;\n9[label=\"Node Type: EXPRESSION 9\n\"];\n9->3;\n}\n", + "loopNoPreCondPostBody()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: BEGIN_LOOP 1\n\"];\n1->1;\n1->2;\n2[label=\"Node Type: END_LOOP 2\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/for-all.sol-0.8.15-compact.json b/tests/ast-parsing/expected/for-all.sol-0.8.15-compact.json new file mode 100644 index 000000000..fe24348d8 --- /dev/null +++ b/tests/ast-parsing/expected/for-all.sol-0.8.15-compact.json @@ -0,0 +1,15 @@ +{ + "C": { + "normalLoopBlockBody()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: NEW VARIABLE 1\n\"];\n1->4;\n2[label=\"Node Type: BEGIN_LOOP 2\n\"];\n2->5;\n3[label=\"Node Type: END_LOOP 3\n\"];\n4[label=\"Node Type: NEW VARIABLE 4\n\"];\n4->2;\n5[label=\"Node Type: IF_LOOP 5\n\"];\n5->6[label=\"True\"];\n5->3[label=\"False\"];\n6[label=\"Node Type: EXPRESSION 6\n\"];\n6->7;\n7[label=\"Node Type: EXPRESSION 7\n\"];\n7->5;\n}\n", + "normalLoopExprBody()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: NEW VARIABLE 1\n\"];\n1->4;\n2[label=\"Node Type: BEGIN_LOOP 2\n\"];\n2->5;\n3[label=\"Node Type: END_LOOP 3\n\"];\n4[label=\"Node Type: NEW VARIABLE 4\n\"];\n4->2;\n5[label=\"Node Type: IF_LOOP 5\n\"];\n5->6[label=\"True\"];\n5->3[label=\"False\"];\n6[label=\"Node Type: EXPRESSION 6\n\"];\n6->7;\n7[label=\"Node Type: EXPRESSION 7\n\"];\n7->5;\n}\n", + "normalLoopNoBody()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: NEW VARIABLE 1\n\"];\n1->4;\n2[label=\"Node Type: BEGIN_LOOP 2\n\"];\n2->5;\n3[label=\"Node Type: END_LOOP 3\n\"];\n4[label=\"Node Type: NEW VARIABLE 4\n\"];\n4->2;\n5[label=\"Node Type: IF_LOOP 5\n\"];\n5->6[label=\"True\"];\n5->3[label=\"False\"];\n6[label=\"Node Type: EXPRESSION 6\n\"];\n6->5;\n}\n", + "loopNoPre()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: NEW VARIABLE 1\n\"];\n1->2;\n2[label=\"Node Type: NEW VARIABLE 2\n\"];\n2->3;\n3[label=\"Node Type: BEGIN_LOOP 3\n\"];\n3->5;\n4[label=\"Node Type: END_LOOP 4\n\"];\n5[label=\"Node Type: IF_LOOP 5\n\"];\n5->6[label=\"True\"];\n5->4[label=\"False\"];\n6[label=\"Node Type: EXPRESSION 6\n\"];\n6->7;\n7[label=\"Node Type: EXPRESSION 7\n\"];\n7->5;\n}\n", + "loopNoCond()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: NEW VARIABLE 1\n\"];\n1->4;\n2[label=\"Node Type: BEGIN_LOOP 2\n\"];\n2->5;\n3[label=\"Node Type: END_LOOP 3\n\"];\n4[label=\"Node Type: NEW VARIABLE 4\n\"];\n4->2;\n5[label=\"Node Type: IF 5\n\"];\n5->6[label=\"True\"];\n5->7[label=\"False\"];\n6[label=\"Node Type: BREAK 6\n\"];\n6->3;\n7[label=\"Node Type: END_IF 7\n\"];\n7->8;\n8[label=\"Node Type: EXPRESSION 8\n\"];\n8->9;\n9[label=\"Node Type: EXPRESSION 9\n\"];\n9->2;\n}\n", + "loopNoPost()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: NEW VARIABLE 1\n\"];\n1->4;\n2[label=\"Node Type: BEGIN_LOOP 2\n\"];\n2->5;\n3[label=\"Node Type: END_LOOP 3\n\"];\n4[label=\"Node Type: NEW VARIABLE 4\n\"];\n4->2;\n5[label=\"Node Type: IF_LOOP 5\n\"];\n5->6[label=\"True\"];\n5->3[label=\"False\"];\n6[label=\"Node Type: EXPRESSION 6\n\"];\n6->7;\n7[label=\"Node Type: EXPRESSION 7\n\"];\n7->5;\n}\n", + "loopNoPreCond()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: NEW VARIABLE 1\n\"];\n1->2;\n2[label=\"Node Type: NEW VARIABLE 2\n\"];\n2->3;\n3[label=\"Node Type: BEGIN_LOOP 3\n\"];\n3->5;\n4[label=\"Node Type: END_LOOP 4\n\"];\n5[label=\"Node Type: IF 5\n\"];\n5->6[label=\"True\"];\n5->7[label=\"False\"];\n6[label=\"Node Type: BREAK 6\n\"];\n6->4;\n7[label=\"Node Type: END_IF 7\n\"];\n7->8;\n8[label=\"Node Type: EXPRESSION 8\n\"];\n8->9;\n9[label=\"Node Type: EXPRESSION 9\n\"];\n9->3;\n}\n", + "loopNoPrePost()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: NEW VARIABLE 1\n\"];\n1->2;\n2[label=\"Node Type: NEW VARIABLE 2\n\"];\n2->3;\n3[label=\"Node Type: BEGIN_LOOP 3\n\"];\n3->5;\n4[label=\"Node Type: END_LOOP 4\n\"];\n5[label=\"Node Type: IF_LOOP 5\n\"];\n5->6[label=\"True\"];\n5->4[label=\"False\"];\n6[label=\"Node Type: EXPRESSION 6\n\"];\n6->7;\n7[label=\"Node Type: EXPRESSION 7\n\"];\n7->5;\n}\n", + "loopNoCondPost()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: NEW VARIABLE 1\n\"];\n1->4;\n2[label=\"Node Type: BEGIN_LOOP 2\n\"];\n2->5;\n3[label=\"Node Type: END_LOOP 3\n\"];\n4[label=\"Node Type: NEW VARIABLE 4\n\"];\n4->2;\n5[label=\"Node Type: IF 5\n\"];\n5->6[label=\"True\"];\n5->7[label=\"False\"];\n6[label=\"Node Type: BREAK 6\n\"];\n6->3;\n7[label=\"Node Type: END_IF 7\n\"];\n7->8;\n8[label=\"Node Type: EXPRESSION 8\n\"];\n8->9;\n9[label=\"Node Type: EXPRESSION 9\n\"];\n9->2;\n}\n", + "loopNoPreCondPost()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: NEW VARIABLE 1\n\"];\n1->2;\n2[label=\"Node Type: NEW VARIABLE 2\n\"];\n2->3;\n3[label=\"Node Type: BEGIN_LOOP 3\n\"];\n3->5;\n4[label=\"Node Type: END_LOOP 4\n\"];\n5[label=\"Node Type: IF 5\n\"];\n5->6[label=\"True\"];\n5->7[label=\"False\"];\n6[label=\"Node Type: BREAK 6\n\"];\n6->4;\n7[label=\"Node Type: END_IF 7\n\"];\n7->8;\n8[label=\"Node Type: EXPRESSION 8\n\"];\n8->9;\n9[label=\"Node Type: EXPRESSION 9\n\"];\n9->3;\n}\n", + "loopNoPreCondPostBody()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: BEGIN_LOOP 1\n\"];\n1->1;\n1->2;\n2[label=\"Node Type: END_LOOP 2\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/free_functions/libraries_from_free.sol-0.8.12-compact.json b/tests/ast-parsing/expected/free_functions/libraries_from_free.sol-0.8.12-compact.json new file mode 100644 index 000000000..a6707f586 --- /dev/null +++ b/tests/ast-parsing/expected/free_functions/libraries_from_free.sol-0.8.12-compact.json @@ -0,0 +1,9 @@ +{ + "L": { + "pub()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: RETURN 1\n\"];\n}\n", + "inter()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: RETURN 1\n\"];\n}\n" + }, + "C": { + "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: RETURN 1\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/free_functions/library_constant_function_collision.sol-0.8.12-compact.json b/tests/ast-parsing/expected/free_functions/library_constant_function_collision.sol-0.8.12-compact.json new file mode 100644 index 000000000..5bfc4f471 --- /dev/null +++ b/tests/ast-parsing/expected/free_functions/library_constant_function_collision.sol-0.8.12-compact.json @@ -0,0 +1,9 @@ +{ + "ExtendedMath": {}, + "IERC20": { + "decimals()": "digraph{\n}\n" + }, + "A": { + "test(address)": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: NEW VARIABLE 1\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/free_functions/new_operator.sol-0.8.12-compact.json b/tests/ast-parsing/expected/free_functions/new_operator.sol-0.8.12-compact.json new file mode 100644 index 000000000..198cdcd9c --- /dev/null +++ b/tests/ast-parsing/expected/free_functions/new_operator.sol-0.8.12-compact.json @@ -0,0 +1,6 @@ +{ + "C": {}, + "D": { + "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: RETURN 1\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/function-0.7.1.sol-0.8.13-compact.json b/tests/ast-parsing/expected/function-0.7.1.sol-0.8.13-compact.json new file mode 100644 index 000000000..50465d36d --- /dev/null +++ b/tests/ast-parsing/expected/function-0.7.1.sol-0.8.13-compact.json @@ -0,0 +1,52 @@ +{ + "C1": { + "constructor()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n", + "fallback()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n", + "receive()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n" + }, + "C2": { + "constructor()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n", + "fallback()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n", + "receive()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n" + }, + "C3": { + "constructor()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n", + "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: EXPRESSION 1\n\"];\n1->2;\n2[label=\"Node Type: EXPRESSION 2\n\"];\n}\n", + "modifierNoArgs()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: _ 1\n\"];\n}\n", + "modifierWithArgs(uint256)": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: _ 1\n\"];\n}\n" + }, + "C4": { + "hasArgs(uint256,uint256)": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n", + "hasReturns()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n", + "hasArgsAndReturns(uint256,uint256)": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n" + }, + "C5": { + "payableFunc()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n", + "externalFunc()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n", + "publicFunc()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n", + "internalFunc()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n", + "privateFunc()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n", + "pureFunc()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n", + "viewFunc()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n", + "abstractFunc()": "digraph{\n}\n" + }, + "C6": { + "abstractFunc()": "digraph{\n}\n", + "abstractFunc2()": "digraph{\n}\n" + }, + "C7": { + "abstractFunc3()": "digraph{\n}\n" + }, + "C8": { + "abstractFunc3()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n", + "abstractFunc()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n", + "abstractFunc2()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n", + "payableFunc()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n", + "externalFunc()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n", + "publicFunc()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n", + "internalFunc()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n", + "privateFunc()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n", + "pureFunc()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n", + "viewFunc()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/function-0.7.1.sol-0.8.14-compact.json b/tests/ast-parsing/expected/function-0.7.1.sol-0.8.14-compact.json new file mode 100644 index 000000000..50465d36d --- /dev/null +++ b/tests/ast-parsing/expected/function-0.7.1.sol-0.8.14-compact.json @@ -0,0 +1,52 @@ +{ + "C1": { + "constructor()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n", + "fallback()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n", + "receive()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n" + }, + "C2": { + "constructor()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n", + "fallback()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n", + "receive()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n" + }, + "C3": { + "constructor()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n", + "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: EXPRESSION 1\n\"];\n1->2;\n2[label=\"Node Type: EXPRESSION 2\n\"];\n}\n", + "modifierNoArgs()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: _ 1\n\"];\n}\n", + "modifierWithArgs(uint256)": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: _ 1\n\"];\n}\n" + }, + "C4": { + "hasArgs(uint256,uint256)": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n", + "hasReturns()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n", + "hasArgsAndReturns(uint256,uint256)": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n" + }, + "C5": { + "payableFunc()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n", + "externalFunc()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n", + "publicFunc()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n", + "internalFunc()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n", + "privateFunc()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n", + "pureFunc()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n", + "viewFunc()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n", + "abstractFunc()": "digraph{\n}\n" + }, + "C6": { + "abstractFunc()": "digraph{\n}\n", + "abstractFunc2()": "digraph{\n}\n" + }, + "C7": { + "abstractFunc3()": "digraph{\n}\n" + }, + "C8": { + "abstractFunc3()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n", + "abstractFunc()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n", + "abstractFunc2()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n", + "payableFunc()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n", + "externalFunc()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n", + "publicFunc()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n", + "internalFunc()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n", + "privateFunc()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n", + "pureFunc()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n", + "viewFunc()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/function-0.7.1.sol-0.8.15-compact.json b/tests/ast-parsing/expected/function-0.7.1.sol-0.8.15-compact.json new file mode 100644 index 000000000..50465d36d --- /dev/null +++ b/tests/ast-parsing/expected/function-0.7.1.sol-0.8.15-compact.json @@ -0,0 +1,52 @@ +{ + "C1": { + "constructor()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n", + "fallback()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n", + "receive()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n" + }, + "C2": { + "constructor()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n", + "fallback()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n", + "receive()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n" + }, + "C3": { + "constructor()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n", + "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: EXPRESSION 1\n\"];\n1->2;\n2[label=\"Node Type: EXPRESSION 2\n\"];\n}\n", + "modifierNoArgs()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: _ 1\n\"];\n}\n", + "modifierWithArgs(uint256)": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: _ 1\n\"];\n}\n" + }, + "C4": { + "hasArgs(uint256,uint256)": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n", + "hasReturns()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n", + "hasArgsAndReturns(uint256,uint256)": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n" + }, + "C5": { + "payableFunc()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n", + "externalFunc()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n", + "publicFunc()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n", + "internalFunc()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n", + "privateFunc()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n", + "pureFunc()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n", + "viewFunc()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n", + "abstractFunc()": "digraph{\n}\n" + }, + "C6": { + "abstractFunc()": "digraph{\n}\n", + "abstractFunc2()": "digraph{\n}\n" + }, + "C7": { + "abstractFunc3()": "digraph{\n}\n" + }, + "C8": { + "abstractFunc3()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n", + "abstractFunc()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n", + "abstractFunc2()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n", + "payableFunc()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n", + "externalFunc()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n", + "publicFunc()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n", + "internalFunc()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n", + "privateFunc()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n", + "pureFunc()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n", + "viewFunc()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/functioncall-0.8.0.sol-0.8.13-compact.json b/tests/ast-parsing/expected/functioncall-0.8.0.sol-0.8.13-compact.json new file mode 100644 index 000000000..f266b62b1 --- /dev/null +++ b/tests/ast-parsing/expected/functioncall-0.8.0.sol-0.8.13-compact.json @@ -0,0 +1,10 @@ +{ + "I": { + "constructor()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n" + }, + "C": { + "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: EXPRESSION 1\n\"];\n1->2;\n2[label=\"Node Type: EXPRESSION 2\n\"];\n2->3;\n3[label=\"Node Type: EXPRESSION 3\n\"];\n3->4;\n4[label=\"Node Type: EXPRESSION 4\n\"];\n4->5;\n5[label=\"Node Type: EXPRESSION 5\n\"];\n5->6;\n6[label=\"Node Type: EXPRESSION 6\n\"];\n6->7;\n7[label=\"Node Type: EXPRESSION 7\n\"];\n7->8;\n8[label=\"Node Type: EXPRESSION 8\n\"];\n8->9;\n9[label=\"Node Type: EXPRESSION 9\n\"];\n9->10;\n10[label=\"Node Type: NEW VARIABLE 10\n\"];\n10->11;\n11[label=\"Node Type: EXPRESSION 11\n\"];\n11->12;\n12[label=\"Node Type: EXPRESSION 12\n\"];\n12->13;\n13[label=\"Node Type: EXPRESSION 13\n\"];\n13->14;\n14[label=\"Node Type: EXPRESSION 14\n\"];\n14->15;\n15[label=\"Node Type: EXPRESSION 15\n\"];\n15->16;\n16[label=\"Node Type: EXPRESSION 16\n\"];\n16->17;\n17[label=\"Node Type: EXPRESSION 17\n\"];\n17->18;\n18[label=\"Node Type: EXPRESSION 18\n\"];\n18->19;\n19[label=\"Node Type: EXPRESSION 19\n\"];\n19->20;\n20[label=\"Node Type: EXPRESSION 20\n\"];\n}\n", + "publicTarget()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n", + "internalTarget(uint256,uint256)": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/functioncall-0.8.0.sol-0.8.14-compact.json b/tests/ast-parsing/expected/functioncall-0.8.0.sol-0.8.14-compact.json new file mode 100644 index 000000000..f266b62b1 --- /dev/null +++ b/tests/ast-parsing/expected/functioncall-0.8.0.sol-0.8.14-compact.json @@ -0,0 +1,10 @@ +{ + "I": { + "constructor()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n" + }, + "C": { + "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: EXPRESSION 1\n\"];\n1->2;\n2[label=\"Node Type: EXPRESSION 2\n\"];\n2->3;\n3[label=\"Node Type: EXPRESSION 3\n\"];\n3->4;\n4[label=\"Node Type: EXPRESSION 4\n\"];\n4->5;\n5[label=\"Node Type: EXPRESSION 5\n\"];\n5->6;\n6[label=\"Node Type: EXPRESSION 6\n\"];\n6->7;\n7[label=\"Node Type: EXPRESSION 7\n\"];\n7->8;\n8[label=\"Node Type: EXPRESSION 8\n\"];\n8->9;\n9[label=\"Node Type: EXPRESSION 9\n\"];\n9->10;\n10[label=\"Node Type: NEW VARIABLE 10\n\"];\n10->11;\n11[label=\"Node Type: EXPRESSION 11\n\"];\n11->12;\n12[label=\"Node Type: EXPRESSION 12\n\"];\n12->13;\n13[label=\"Node Type: EXPRESSION 13\n\"];\n13->14;\n14[label=\"Node Type: EXPRESSION 14\n\"];\n14->15;\n15[label=\"Node Type: EXPRESSION 15\n\"];\n15->16;\n16[label=\"Node Type: EXPRESSION 16\n\"];\n16->17;\n17[label=\"Node Type: EXPRESSION 17\n\"];\n17->18;\n18[label=\"Node Type: EXPRESSION 18\n\"];\n18->19;\n19[label=\"Node Type: EXPRESSION 19\n\"];\n19->20;\n20[label=\"Node Type: EXPRESSION 20\n\"];\n}\n", + "publicTarget()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n", + "internalTarget(uint256,uint256)": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/functioncall-0.8.0.sol-0.8.15-compact.json b/tests/ast-parsing/expected/functioncall-0.8.0.sol-0.8.15-compact.json new file mode 100644 index 000000000..f266b62b1 --- /dev/null +++ b/tests/ast-parsing/expected/functioncall-0.8.0.sol-0.8.15-compact.json @@ -0,0 +1,10 @@ +{ + "I": { + "constructor()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n" + }, + "C": { + "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: EXPRESSION 1\n\"];\n1->2;\n2[label=\"Node Type: EXPRESSION 2\n\"];\n2->3;\n3[label=\"Node Type: EXPRESSION 3\n\"];\n3->4;\n4[label=\"Node Type: EXPRESSION 4\n\"];\n4->5;\n5[label=\"Node Type: EXPRESSION 5\n\"];\n5->6;\n6[label=\"Node Type: EXPRESSION 6\n\"];\n6->7;\n7[label=\"Node Type: EXPRESSION 7\n\"];\n7->8;\n8[label=\"Node Type: EXPRESSION 8\n\"];\n8->9;\n9[label=\"Node Type: EXPRESSION 9\n\"];\n9->10;\n10[label=\"Node Type: NEW VARIABLE 10\n\"];\n10->11;\n11[label=\"Node Type: EXPRESSION 11\n\"];\n11->12;\n12[label=\"Node Type: EXPRESSION 12\n\"];\n12->13;\n13[label=\"Node Type: EXPRESSION 13\n\"];\n13->14;\n14[label=\"Node Type: EXPRESSION 14\n\"];\n14->15;\n15[label=\"Node Type: EXPRESSION 15\n\"];\n15->16;\n16[label=\"Node Type: EXPRESSION 16\n\"];\n16->17;\n17[label=\"Node Type: EXPRESSION 17\n\"];\n17->18;\n18[label=\"Node Type: EXPRESSION 18\n\"];\n18->19;\n19[label=\"Node Type: EXPRESSION 19\n\"];\n19->20;\n20[label=\"Node Type: EXPRESSION 20\n\"];\n}\n", + "publicTarget()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n", + "internalTarget(uint256,uint256)": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/if-all.sol-0.8.13-compact.json b/tests/ast-parsing/expected/if-all.sol-0.8.13-compact.json new file mode 100644 index 000000000..c0c884b4e --- /dev/null +++ b/tests/ast-parsing/expected/if-all.sol-0.8.13-compact.json @@ -0,0 +1,8 @@ +{ + "C": { + "ifWithoutElse()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: IF 1\n\"];\n1->2[label=\"True\"];\n1->3[label=\"False\"];\n2[label=\"Node Type: EXPRESSION 2\n\"];\n2->3;\n3[label=\"Node Type: END_IF 3\n\"];\n}\n", + "ifWithElse()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: IF 1\n\"];\n1->2[label=\"True\"];\n1->3[label=\"False\"];\n2[label=\"Node Type: EXPRESSION 2\n\"];\n2->4;\n3[label=\"Node Type: EXPRESSION 3\n\"];\n3->4;\n4[label=\"Node Type: END_IF 4\n\"];\n}\n", + "ifWithElseIf()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: IF 1\n\"];\n1->2[label=\"True\"];\n1->3[label=\"False\"];\n2[label=\"Node Type: EXPRESSION 2\n\"];\n2->9;\n3[label=\"Node Type: IF 3\n\"];\n3->4[label=\"True\"];\n3->5[label=\"False\"];\n4[label=\"Node Type: EXPRESSION 4\n\"];\n4->8;\n5[label=\"Node Type: IF 5\n\"];\n5->6[label=\"True\"];\n5->7[label=\"False\"];\n6[label=\"Node Type: EXPRESSION 6\n\"];\n6->7;\n7[label=\"Node Type: END_IF 7\n\"];\n7->8;\n8[label=\"Node Type: END_IF 8\n\"];\n8->9;\n9[label=\"Node Type: END_IF 9\n\"];\n}\n", + "ifWithElseIfElse()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: IF 1\n\"];\n1->2[label=\"True\"];\n1->3[label=\"False\"];\n2[label=\"Node Type: EXPRESSION 2\n\"];\n2->7;\n3[label=\"Node Type: IF 3\n\"];\n3->4[label=\"True\"];\n3->5[label=\"False\"];\n4[label=\"Node Type: EXPRESSION 4\n\"];\n4->6;\n5[label=\"Node Type: EXPRESSION 5\n\"];\n5->6;\n6[label=\"Node Type: END_IF 6\n\"];\n6->7;\n7[label=\"Node Type: END_IF 7\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/if-all.sol-0.8.14-compact.json b/tests/ast-parsing/expected/if-all.sol-0.8.14-compact.json new file mode 100644 index 000000000..c0c884b4e --- /dev/null +++ b/tests/ast-parsing/expected/if-all.sol-0.8.14-compact.json @@ -0,0 +1,8 @@ +{ + "C": { + "ifWithoutElse()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: IF 1\n\"];\n1->2[label=\"True\"];\n1->3[label=\"False\"];\n2[label=\"Node Type: EXPRESSION 2\n\"];\n2->3;\n3[label=\"Node Type: END_IF 3\n\"];\n}\n", + "ifWithElse()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: IF 1\n\"];\n1->2[label=\"True\"];\n1->3[label=\"False\"];\n2[label=\"Node Type: EXPRESSION 2\n\"];\n2->4;\n3[label=\"Node Type: EXPRESSION 3\n\"];\n3->4;\n4[label=\"Node Type: END_IF 4\n\"];\n}\n", + "ifWithElseIf()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: IF 1\n\"];\n1->2[label=\"True\"];\n1->3[label=\"False\"];\n2[label=\"Node Type: EXPRESSION 2\n\"];\n2->9;\n3[label=\"Node Type: IF 3\n\"];\n3->4[label=\"True\"];\n3->5[label=\"False\"];\n4[label=\"Node Type: EXPRESSION 4\n\"];\n4->8;\n5[label=\"Node Type: IF 5\n\"];\n5->6[label=\"True\"];\n5->7[label=\"False\"];\n6[label=\"Node Type: EXPRESSION 6\n\"];\n6->7;\n7[label=\"Node Type: END_IF 7\n\"];\n7->8;\n8[label=\"Node Type: END_IF 8\n\"];\n8->9;\n9[label=\"Node Type: END_IF 9\n\"];\n}\n", + "ifWithElseIfElse()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: IF 1\n\"];\n1->2[label=\"True\"];\n1->3[label=\"False\"];\n2[label=\"Node Type: EXPRESSION 2\n\"];\n2->7;\n3[label=\"Node Type: IF 3\n\"];\n3->4[label=\"True\"];\n3->5[label=\"False\"];\n4[label=\"Node Type: EXPRESSION 4\n\"];\n4->6;\n5[label=\"Node Type: EXPRESSION 5\n\"];\n5->6;\n6[label=\"Node Type: END_IF 6\n\"];\n6->7;\n7[label=\"Node Type: END_IF 7\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/if-all.sol-0.8.15-compact.json b/tests/ast-parsing/expected/if-all.sol-0.8.15-compact.json new file mode 100644 index 000000000..c0c884b4e --- /dev/null +++ b/tests/ast-parsing/expected/if-all.sol-0.8.15-compact.json @@ -0,0 +1,8 @@ +{ + "C": { + "ifWithoutElse()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: IF 1\n\"];\n1->2[label=\"True\"];\n1->3[label=\"False\"];\n2[label=\"Node Type: EXPRESSION 2\n\"];\n2->3;\n3[label=\"Node Type: END_IF 3\n\"];\n}\n", + "ifWithElse()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: IF 1\n\"];\n1->2[label=\"True\"];\n1->3[label=\"False\"];\n2[label=\"Node Type: EXPRESSION 2\n\"];\n2->4;\n3[label=\"Node Type: EXPRESSION 3\n\"];\n3->4;\n4[label=\"Node Type: END_IF 4\n\"];\n}\n", + "ifWithElseIf()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: IF 1\n\"];\n1->2[label=\"True\"];\n1->3[label=\"False\"];\n2[label=\"Node Type: EXPRESSION 2\n\"];\n2->9;\n3[label=\"Node Type: IF 3\n\"];\n3->4[label=\"True\"];\n3->5[label=\"False\"];\n4[label=\"Node Type: EXPRESSION 4\n\"];\n4->8;\n5[label=\"Node Type: IF 5\n\"];\n5->6[label=\"True\"];\n5->7[label=\"False\"];\n6[label=\"Node Type: EXPRESSION 6\n\"];\n6->7;\n7[label=\"Node Type: END_IF 7\n\"];\n7->8;\n8[label=\"Node Type: END_IF 8\n\"];\n8->9;\n9[label=\"Node Type: END_IF 9\n\"];\n}\n", + "ifWithElseIfElse()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: IF 1\n\"];\n1->2[label=\"True\"];\n1->3[label=\"False\"];\n2[label=\"Node Type: EXPRESSION 2\n\"];\n2->7;\n3[label=\"Node Type: IF 3\n\"];\n3->4[label=\"True\"];\n3->5[label=\"False\"];\n4[label=\"Node Type: EXPRESSION 4\n\"];\n4->6;\n5[label=\"Node Type: EXPRESSION 5\n\"];\n5->6;\n6[label=\"Node Type: END_IF 6\n\"];\n6->7;\n7[label=\"Node Type: END_IF 7\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/import_interface_with_struct_from_top_level-0.7.6.sol-0.8.13-compact.json b/tests/ast-parsing/expected/import_interface_with_struct_from_top_level-0.7.6.sol-0.8.13-compact.json new file mode 100644 index 000000000..355945be7 --- /dev/null +++ b/tests/ast-parsing/expected/import_interface_with_struct_from_top_level-0.7.6.sol-0.8.13-compact.json @@ -0,0 +1,3 @@ +{ + "I": {} +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/import_interface_with_struct_from_top_level-0.7.6.sol-0.8.14-compact.json b/tests/ast-parsing/expected/import_interface_with_struct_from_top_level-0.7.6.sol-0.8.14-compact.json new file mode 100644 index 000000000..355945be7 --- /dev/null +++ b/tests/ast-parsing/expected/import_interface_with_struct_from_top_level-0.7.6.sol-0.8.14-compact.json @@ -0,0 +1,3 @@ +{ + "I": {} +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/import_interface_with_struct_from_top_level-0.7.6.sol-0.8.15-compact.json b/tests/ast-parsing/expected/import_interface_with_struct_from_top_level-0.7.6.sol-0.8.15-compact.json new file mode 100644 index 000000000..355945be7 --- /dev/null +++ b/tests/ast-parsing/expected/import_interface_with_struct_from_top_level-0.7.6.sol-0.8.15-compact.json @@ -0,0 +1,3 @@ +{ + "I": {} +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/indexaccess-all.sol-0.8.13-compact.json b/tests/ast-parsing/expected/indexaccess-all.sol-0.8.13-compact.json new file mode 100644 index 000000000..43190fcd6 --- /dev/null +++ b/tests/ast-parsing/expected/indexaccess-all.sol-0.8.13-compact.json @@ -0,0 +1,5 @@ +{ + "C": { + "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: NEW VARIABLE 1\n\"];\n1->2;\n2[label=\"Node Type: EXPRESSION 2\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/indexaccess-all.sol-0.8.14-compact.json b/tests/ast-parsing/expected/indexaccess-all.sol-0.8.14-compact.json new file mode 100644 index 000000000..43190fcd6 --- /dev/null +++ b/tests/ast-parsing/expected/indexaccess-all.sol-0.8.14-compact.json @@ -0,0 +1,5 @@ +{ + "C": { + "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: NEW VARIABLE 1\n\"];\n1->2;\n2[label=\"Node Type: EXPRESSION 2\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/indexaccess-all.sol-0.8.15-compact.json b/tests/ast-parsing/expected/indexaccess-all.sol-0.8.15-compact.json new file mode 100644 index 000000000..43190fcd6 --- /dev/null +++ b/tests/ast-parsing/expected/indexaccess-all.sol-0.8.15-compact.json @@ -0,0 +1,5 @@ +{ + "C": { + "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: NEW VARIABLE 1\n\"];\n1->2;\n2[label=\"Node Type: EXPRESSION 2\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/indexrangeaccess-0.6.1.sol-0.8.13-compact.json b/tests/ast-parsing/expected/indexrangeaccess-0.6.1.sol-0.8.13-compact.json new file mode 100644 index 000000000..f4529bc86 --- /dev/null +++ b/tests/ast-parsing/expected/indexrangeaccess-0.6.1.sol-0.8.13-compact.json @@ -0,0 +1,5 @@ +{ + "C": { + "f(bytes)": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: EXPRESSION 1\n\"];\n1->2;\n2[label=\"Node Type: EXPRESSION 2\n\"];\n2->3;\n3[label=\"Node Type: EXPRESSION 3\n\"];\n3->4;\n4[label=\"Node Type: EXPRESSION 4\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/indexrangeaccess-0.6.1.sol-0.8.14-compact.json b/tests/ast-parsing/expected/indexrangeaccess-0.6.1.sol-0.8.14-compact.json new file mode 100644 index 000000000..f4529bc86 --- /dev/null +++ b/tests/ast-parsing/expected/indexrangeaccess-0.6.1.sol-0.8.14-compact.json @@ -0,0 +1,5 @@ +{ + "C": { + "f(bytes)": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: EXPRESSION 1\n\"];\n1->2;\n2[label=\"Node Type: EXPRESSION 2\n\"];\n2->3;\n3[label=\"Node Type: EXPRESSION 3\n\"];\n3->4;\n4[label=\"Node Type: EXPRESSION 4\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/indexrangeaccess-0.6.1.sol-0.8.15-compact.json b/tests/ast-parsing/expected/indexrangeaccess-0.6.1.sol-0.8.15-compact.json new file mode 100644 index 000000000..f4529bc86 --- /dev/null +++ b/tests/ast-parsing/expected/indexrangeaccess-0.6.1.sol-0.8.15-compact.json @@ -0,0 +1,5 @@ +{ + "C": { + "f(bytes)": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: EXPRESSION 1\n\"];\n1->2;\n2[label=\"Node Type: EXPRESSION 2\n\"];\n2->3;\n3[label=\"Node Type: EXPRESSION 3\n\"];\n3->4;\n4[label=\"Node Type: EXPRESSION 4\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/library_implicit_conversion-0.5.0.sol-0.8.13-compact.json b/tests/ast-parsing/expected/library_implicit_conversion-0.5.0.sol-0.8.13-compact.json new file mode 100644 index 000000000..81b56547c --- /dev/null +++ b/tests/ast-parsing/expected/library_implicit_conversion-0.5.0.sol-0.8.13-compact.json @@ -0,0 +1,23 @@ +{ + "LibByte": { + "t(uint256,bytes1)": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: RETURN 1\n\"];\n}\n", + "t(uint256,bytes32)": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: RETURN 1\n\"];\n}\n" + }, + "TestByte": { + "test()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: NEW VARIABLE 1\n\"];\n1->2;\n2[label=\"Node Type: RETURN 2\n\"];\n}\n" + }, + "LibUint": { + "t(uint256,uint8)": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: RETURN 1\n\"];\n}\n", + "t(uint256,uint256)": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: RETURN 1\n\"];\n}\n" + }, + "TestUint": { + "test()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: NEW VARIABLE 1\n\"];\n1->2;\n2[label=\"Node Type: RETURN 2\n\"];\n}\n" + }, + "LibInt": { + "t(uint256,int8)": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: RETURN 1\n\"];\n}\n", + "t(uint256,int256)": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: RETURN 1\n\"];\n}\n" + }, + "TestUintWithVariableiAndConversion": { + "test()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: NEW VARIABLE 1\n\"];\n1->2;\n2[label=\"Node Type: NEW VARIABLE 2\n\"];\n2->3;\n3[label=\"Node Type: RETURN 3\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/library_implicit_conversion-0.5.0.sol-0.8.14-compact.json b/tests/ast-parsing/expected/library_implicit_conversion-0.5.0.sol-0.8.14-compact.json new file mode 100644 index 000000000..81b56547c --- /dev/null +++ b/tests/ast-parsing/expected/library_implicit_conversion-0.5.0.sol-0.8.14-compact.json @@ -0,0 +1,23 @@ +{ + "LibByte": { + "t(uint256,bytes1)": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: RETURN 1\n\"];\n}\n", + "t(uint256,bytes32)": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: RETURN 1\n\"];\n}\n" + }, + "TestByte": { + "test()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: NEW VARIABLE 1\n\"];\n1->2;\n2[label=\"Node Type: RETURN 2\n\"];\n}\n" + }, + "LibUint": { + "t(uint256,uint8)": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: RETURN 1\n\"];\n}\n", + "t(uint256,uint256)": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: RETURN 1\n\"];\n}\n" + }, + "TestUint": { + "test()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: NEW VARIABLE 1\n\"];\n1->2;\n2[label=\"Node Type: RETURN 2\n\"];\n}\n" + }, + "LibInt": { + "t(uint256,int8)": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: RETURN 1\n\"];\n}\n", + "t(uint256,int256)": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: RETURN 1\n\"];\n}\n" + }, + "TestUintWithVariableiAndConversion": { + "test()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: NEW VARIABLE 1\n\"];\n1->2;\n2[label=\"Node Type: NEW VARIABLE 2\n\"];\n2->3;\n3[label=\"Node Type: RETURN 3\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/library_implicit_conversion-0.5.0.sol-0.8.15-compact.json b/tests/ast-parsing/expected/library_implicit_conversion-0.5.0.sol-0.8.15-compact.json new file mode 100644 index 000000000..81b56547c --- /dev/null +++ b/tests/ast-parsing/expected/library_implicit_conversion-0.5.0.sol-0.8.15-compact.json @@ -0,0 +1,23 @@ +{ + "LibByte": { + "t(uint256,bytes1)": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: RETURN 1\n\"];\n}\n", + "t(uint256,bytes32)": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: RETURN 1\n\"];\n}\n" + }, + "TestByte": { + "test()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: NEW VARIABLE 1\n\"];\n1->2;\n2[label=\"Node Type: RETURN 2\n\"];\n}\n" + }, + "LibUint": { + "t(uint256,uint8)": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: RETURN 1\n\"];\n}\n", + "t(uint256,uint256)": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: RETURN 1\n\"];\n}\n" + }, + "TestUint": { + "test()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: NEW VARIABLE 1\n\"];\n1->2;\n2[label=\"Node Type: RETURN 2\n\"];\n}\n" + }, + "LibInt": { + "t(uint256,int8)": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: RETURN 1\n\"];\n}\n", + "t(uint256,int256)": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: RETURN 1\n\"];\n}\n" + }, + "TestUintWithVariableiAndConversion": { + "test()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: NEW VARIABLE 1\n\"];\n1->2;\n2[label=\"Node Type: NEW VARIABLE 2\n\"];\n2->3;\n3[label=\"Node Type: RETURN 3\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/memberaccess-0.5.3.sol-0.8.13-compact.json b/tests/ast-parsing/expected/memberaccess-0.5.3.sol-0.8.13-compact.json new file mode 100644 index 000000000..cc7fbbb8c --- /dev/null +++ b/tests/ast-parsing/expected/memberaccess-0.5.3.sol-0.8.13-compact.json @@ -0,0 +1,6 @@ +{ + "I": {}, + "C": { + "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: NEW VARIABLE 1\n\"];\n1->2;\n2[label=\"Node Type: EXPRESSION 2\n\"];\n2->3;\n3[label=\"Node Type: EXPRESSION 3\n\"];\n3->4;\n4[label=\"Node Type: EXPRESSION 4\n\"];\n4->5;\n5[label=\"Node Type: EXPRESSION 5\n\"];\n5->6;\n6[label=\"Node Type: EXPRESSION 6\n\"];\n6->7;\n7[label=\"Node Type: EXPRESSION 7\n\"];\n7->8;\n8[label=\"Node Type: EXPRESSION 8\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/memberaccess-0.5.3.sol-0.8.14-compact.json b/tests/ast-parsing/expected/memberaccess-0.5.3.sol-0.8.14-compact.json new file mode 100644 index 000000000..cc7fbbb8c --- /dev/null +++ b/tests/ast-parsing/expected/memberaccess-0.5.3.sol-0.8.14-compact.json @@ -0,0 +1,6 @@ +{ + "I": {}, + "C": { + "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: NEW VARIABLE 1\n\"];\n1->2;\n2[label=\"Node Type: EXPRESSION 2\n\"];\n2->3;\n3[label=\"Node Type: EXPRESSION 3\n\"];\n3->4;\n4[label=\"Node Type: EXPRESSION 4\n\"];\n4->5;\n5[label=\"Node Type: EXPRESSION 5\n\"];\n5->6;\n6[label=\"Node Type: EXPRESSION 6\n\"];\n6->7;\n7[label=\"Node Type: EXPRESSION 7\n\"];\n7->8;\n8[label=\"Node Type: EXPRESSION 8\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/memberaccess-0.5.3.sol-0.8.15-compact.json b/tests/ast-parsing/expected/memberaccess-0.5.3.sol-0.8.15-compact.json new file mode 100644 index 000000000..cc7fbbb8c --- /dev/null +++ b/tests/ast-parsing/expected/memberaccess-0.5.3.sol-0.8.15-compact.json @@ -0,0 +1,6 @@ +{ + "I": {}, + "C": { + "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: NEW VARIABLE 1\n\"];\n1->2;\n2[label=\"Node Type: EXPRESSION 2\n\"];\n2->3;\n3[label=\"Node Type: EXPRESSION 3\n\"];\n3->4;\n4[label=\"Node Type: EXPRESSION 4\n\"];\n4->5;\n5[label=\"Node Type: EXPRESSION 5\n\"];\n5->6;\n6[label=\"Node Type: EXPRESSION 6\n\"];\n6->7;\n7[label=\"Node Type: EXPRESSION 7\n\"];\n7->8;\n8[label=\"Node Type: EXPRESSION 8\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/minmax-0.6.8.sol-0.6.8-compact.json b/tests/ast-parsing/expected/minmax-0.6.8.sol-0.6.8-compact.json index 228af371a..5d52aa8ce 100644 --- a/tests/ast-parsing/expected/minmax-0.6.8.sol-0.6.8-compact.json +++ b/tests/ast-parsing/expected/minmax-0.6.8.sol-0.6.8-compact.json @@ -1,5 +1,3 @@ { - "C": { - "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: NEW VARIABLE 1\n\"];\n}\n" - } + "MinMax": {} } \ No newline at end of file diff --git a/tests/ast-parsing/expected/minmax-0.6.8.sol-0.6.8-legacy.json b/tests/ast-parsing/expected/minmax-0.6.8.sol-0.6.8-legacy.json index 228af371a..5d52aa8ce 100644 --- a/tests/ast-parsing/expected/minmax-0.6.8.sol-0.6.8-legacy.json +++ b/tests/ast-parsing/expected/minmax-0.6.8.sol-0.6.8-legacy.json @@ -1,5 +1,3 @@ { - "C": { - "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: NEW VARIABLE 1\n\"];\n}\n" - } + "MinMax": {} } \ No newline at end of file diff --git a/tests/ast-parsing/expected/minmax-0.6.8.sol-0.6.9-compact.json b/tests/ast-parsing/expected/minmax-0.6.8.sol-0.6.9-compact.json index 228af371a..5d52aa8ce 100644 --- a/tests/ast-parsing/expected/minmax-0.6.8.sol-0.6.9-compact.json +++ b/tests/ast-parsing/expected/minmax-0.6.8.sol-0.6.9-compact.json @@ -1,5 +1,3 @@ { - "C": { - "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: NEW VARIABLE 1\n\"];\n}\n" - } + "MinMax": {} } \ No newline at end of file diff --git a/tests/ast-parsing/expected/minmax-0.6.8.sol-0.6.9-legacy.json b/tests/ast-parsing/expected/minmax-0.6.8.sol-0.6.9-legacy.json index 228af371a..5d52aa8ce 100644 --- a/tests/ast-parsing/expected/minmax-0.6.8.sol-0.6.9-legacy.json +++ b/tests/ast-parsing/expected/minmax-0.6.8.sol-0.6.9-legacy.json @@ -1,5 +1,3 @@ { - "C": { - "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: NEW VARIABLE 1\n\"];\n}\n" - } + "MinMax": {} } \ No newline at end of file diff --git a/tests/ast-parsing/expected/minmax-0.6.8.sol-0.7.0-compact.json b/tests/ast-parsing/expected/minmax-0.6.8.sol-0.7.0-compact.json index 228af371a..5d52aa8ce 100644 --- a/tests/ast-parsing/expected/minmax-0.6.8.sol-0.7.0-compact.json +++ b/tests/ast-parsing/expected/minmax-0.6.8.sol-0.7.0-compact.json @@ -1,5 +1,3 @@ { - "C": { - "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: NEW VARIABLE 1\n\"];\n}\n" - } + "MinMax": {} } \ No newline at end of file diff --git a/tests/ast-parsing/expected/minmax-0.6.8.sol-0.7.0-legacy.json b/tests/ast-parsing/expected/minmax-0.6.8.sol-0.7.0-legacy.json index 228af371a..5d52aa8ce 100644 --- a/tests/ast-parsing/expected/minmax-0.6.8.sol-0.7.0-legacy.json +++ b/tests/ast-parsing/expected/minmax-0.6.8.sol-0.7.0-legacy.json @@ -1,5 +1,3 @@ { - "C": { - "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: NEW VARIABLE 1\n\"];\n}\n" - } + "MinMax": {} } \ No newline at end of file diff --git a/tests/ast-parsing/expected/minmax-0.6.8.sol-0.7.1-compact.json b/tests/ast-parsing/expected/minmax-0.6.8.sol-0.7.1-compact.json index 228af371a..5d52aa8ce 100644 --- a/tests/ast-parsing/expected/minmax-0.6.8.sol-0.7.1-compact.json +++ b/tests/ast-parsing/expected/minmax-0.6.8.sol-0.7.1-compact.json @@ -1,5 +1,3 @@ { - "C": { - "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: NEW VARIABLE 1\n\"];\n}\n" - } + "MinMax": {} } \ No newline at end of file diff --git a/tests/ast-parsing/expected/minmax-0.6.8.sol-0.7.1-legacy.json b/tests/ast-parsing/expected/minmax-0.6.8.sol-0.7.1-legacy.json index 228af371a..5d52aa8ce 100644 --- a/tests/ast-parsing/expected/minmax-0.6.8.sol-0.7.1-legacy.json +++ b/tests/ast-parsing/expected/minmax-0.6.8.sol-0.7.1-legacy.json @@ -1,5 +1,3 @@ { - "C": { - "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: NEW VARIABLE 1\n\"];\n}\n" - } + "MinMax": {} } \ No newline at end of file diff --git a/tests/ast-parsing/expected/minmax-0.6.8.sol-0.7.2-compact.json b/tests/ast-parsing/expected/minmax-0.6.8.sol-0.7.2-compact.json index 228af371a..5d52aa8ce 100644 --- a/tests/ast-parsing/expected/minmax-0.6.8.sol-0.7.2-compact.json +++ b/tests/ast-parsing/expected/minmax-0.6.8.sol-0.7.2-compact.json @@ -1,5 +1,3 @@ { - "C": { - "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: NEW VARIABLE 1\n\"];\n}\n" - } + "MinMax": {} } \ No newline at end of file diff --git a/tests/ast-parsing/expected/minmax-0.6.8.sol-0.7.2-legacy.json b/tests/ast-parsing/expected/minmax-0.6.8.sol-0.7.2-legacy.json index 228af371a..5d52aa8ce 100644 --- a/tests/ast-parsing/expected/minmax-0.6.8.sol-0.7.2-legacy.json +++ b/tests/ast-parsing/expected/minmax-0.6.8.sol-0.7.2-legacy.json @@ -1,5 +1,3 @@ { - "C": { - "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: NEW VARIABLE 1\n\"];\n}\n" - } + "MinMax": {} } \ No newline at end of file diff --git a/tests/ast-parsing/expected/minmax-0.6.8.sol-0.7.3-compact.json b/tests/ast-parsing/expected/minmax-0.6.8.sol-0.7.3-compact.json index 228af371a..5d52aa8ce 100644 --- a/tests/ast-parsing/expected/minmax-0.6.8.sol-0.7.3-compact.json +++ b/tests/ast-parsing/expected/minmax-0.6.8.sol-0.7.3-compact.json @@ -1,5 +1,3 @@ { - "C": { - "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: NEW VARIABLE 1\n\"];\n}\n" - } + "MinMax": {} } \ No newline at end of file diff --git a/tests/ast-parsing/expected/minmax-0.6.8.sol-0.7.3-legacy.json b/tests/ast-parsing/expected/minmax-0.6.8.sol-0.7.3-legacy.json index 228af371a..5d52aa8ce 100644 --- a/tests/ast-parsing/expected/minmax-0.6.8.sol-0.7.3-legacy.json +++ b/tests/ast-parsing/expected/minmax-0.6.8.sol-0.7.3-legacy.json @@ -1,5 +1,3 @@ { - "C": { - "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: NEW VARIABLE 1\n\"];\n}\n" - } + "MinMax": {} } \ No newline at end of file diff --git a/tests/ast-parsing/expected/minmax-0.6.8.sol-0.7.4-compact.json b/tests/ast-parsing/expected/minmax-0.6.8.sol-0.7.4-compact.json index 228af371a..5d52aa8ce 100644 --- a/tests/ast-parsing/expected/minmax-0.6.8.sol-0.7.4-compact.json +++ b/tests/ast-parsing/expected/minmax-0.6.8.sol-0.7.4-compact.json @@ -1,5 +1,3 @@ { - "C": { - "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: NEW VARIABLE 1\n\"];\n}\n" - } + "MinMax": {} } \ No newline at end of file diff --git a/tests/ast-parsing/expected/minmax-0.6.8.sol-0.7.4-legacy.json b/tests/ast-parsing/expected/minmax-0.6.8.sol-0.7.4-legacy.json index 228af371a..5d52aa8ce 100644 --- a/tests/ast-parsing/expected/minmax-0.6.8.sol-0.7.4-legacy.json +++ b/tests/ast-parsing/expected/minmax-0.6.8.sol-0.7.4-legacy.json @@ -1,5 +1,3 @@ { - "C": { - "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: NEW VARIABLE 1\n\"];\n}\n" - } + "MinMax": {} } \ No newline at end of file diff --git a/tests/ast-parsing/expected/minmax-0.6.8.sol-0.7.5-compact.json b/tests/ast-parsing/expected/minmax-0.6.8.sol-0.7.5-compact.json index 228af371a..5d52aa8ce 100644 --- a/tests/ast-parsing/expected/minmax-0.6.8.sol-0.7.5-compact.json +++ b/tests/ast-parsing/expected/minmax-0.6.8.sol-0.7.5-compact.json @@ -1,5 +1,3 @@ { - "C": { - "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: NEW VARIABLE 1\n\"];\n}\n" - } + "MinMax": {} } \ No newline at end of file diff --git a/tests/ast-parsing/expected/minmax-0.6.8.sol-0.7.5-legacy.json b/tests/ast-parsing/expected/minmax-0.6.8.sol-0.7.5-legacy.json index 228af371a..5d52aa8ce 100644 --- a/tests/ast-parsing/expected/minmax-0.6.8.sol-0.7.5-legacy.json +++ b/tests/ast-parsing/expected/minmax-0.6.8.sol-0.7.5-legacy.json @@ -1,5 +1,3 @@ { - "C": { - "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: NEW VARIABLE 1\n\"];\n}\n" - } + "MinMax": {} } \ No newline at end of file diff --git a/tests/ast-parsing/expected/minmax-0.6.8.sol-0.7.6-compact.json b/tests/ast-parsing/expected/minmax-0.6.8.sol-0.7.6-compact.json index 228af371a..5d52aa8ce 100644 --- a/tests/ast-parsing/expected/minmax-0.6.8.sol-0.7.6-compact.json +++ b/tests/ast-parsing/expected/minmax-0.6.8.sol-0.7.6-compact.json @@ -1,5 +1,3 @@ { - "C": { - "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: NEW VARIABLE 1\n\"];\n}\n" - } + "MinMax": {} } \ No newline at end of file diff --git a/tests/ast-parsing/expected/minmax-0.6.8.sol-0.7.6-legacy.json b/tests/ast-parsing/expected/minmax-0.6.8.sol-0.7.6-legacy.json index 228af371a..5d52aa8ce 100644 --- a/tests/ast-parsing/expected/minmax-0.6.8.sol-0.7.6-legacy.json +++ b/tests/ast-parsing/expected/minmax-0.6.8.sol-0.7.6-legacy.json @@ -1,5 +1,3 @@ { - "C": { - "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: NEW VARIABLE 1\n\"];\n}\n" - } + "MinMax": {} } \ No newline at end of file diff --git a/tests/ast-parsing/expected/minmax-0.6.8.sol-0.8.0-compact.json b/tests/ast-parsing/expected/minmax-0.6.8.sol-0.8.0-compact.json index 228af371a..5d52aa8ce 100644 --- a/tests/ast-parsing/expected/minmax-0.6.8.sol-0.8.0-compact.json +++ b/tests/ast-parsing/expected/minmax-0.6.8.sol-0.8.0-compact.json @@ -1,5 +1,3 @@ { - "C": { - "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: NEW VARIABLE 1\n\"];\n}\n" - } + "MinMax": {} } \ No newline at end of file diff --git a/tests/ast-parsing/expected/minmax-0.6.8.sol-0.8.1-compact.json b/tests/ast-parsing/expected/minmax-0.6.8.sol-0.8.1-compact.json index 228af371a..5d52aa8ce 100644 --- a/tests/ast-parsing/expected/minmax-0.6.8.sol-0.8.1-compact.json +++ b/tests/ast-parsing/expected/minmax-0.6.8.sol-0.8.1-compact.json @@ -1,5 +1,3 @@ { - "C": { - "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: NEW VARIABLE 1\n\"];\n}\n" - } + "MinMax": {} } \ No newline at end of file diff --git a/tests/ast-parsing/expected/minmax-0.6.8.sol-0.8.10-compact.json b/tests/ast-parsing/expected/minmax-0.6.8.sol-0.8.10-compact.json index 228af371a..5d52aa8ce 100644 --- a/tests/ast-parsing/expected/minmax-0.6.8.sol-0.8.10-compact.json +++ b/tests/ast-parsing/expected/minmax-0.6.8.sol-0.8.10-compact.json @@ -1,5 +1,3 @@ { - "C": { - "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: NEW VARIABLE 1\n\"];\n}\n" - } + "MinMax": {} } \ No newline at end of file diff --git a/tests/ast-parsing/expected/minmax-0.6.8.sol-0.8.11-compact.json b/tests/ast-parsing/expected/minmax-0.6.8.sol-0.8.11-compact.json index 228af371a..5d52aa8ce 100644 --- a/tests/ast-parsing/expected/minmax-0.6.8.sol-0.8.11-compact.json +++ b/tests/ast-parsing/expected/minmax-0.6.8.sol-0.8.11-compact.json @@ -1,5 +1,3 @@ { - "C": { - "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: NEW VARIABLE 1\n\"];\n}\n" - } + "MinMax": {} } \ No newline at end of file diff --git a/tests/ast-parsing/expected/minmax-0.6.8.sol-0.8.12-compact.json b/tests/ast-parsing/expected/minmax-0.6.8.sol-0.8.12-compact.json index 228af371a..5d52aa8ce 100644 --- a/tests/ast-parsing/expected/minmax-0.6.8.sol-0.8.12-compact.json +++ b/tests/ast-parsing/expected/minmax-0.6.8.sol-0.8.12-compact.json @@ -1,5 +1,3 @@ { - "C": { - "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: NEW VARIABLE 1\n\"];\n}\n" - } + "MinMax": {} } \ No newline at end of file diff --git a/tests/ast-parsing/expected/minmax-0.6.8.sol-0.8.13-compact.json b/tests/ast-parsing/expected/minmax-0.6.8.sol-0.8.13-compact.json new file mode 100644 index 000000000..228af371a --- /dev/null +++ b/tests/ast-parsing/expected/minmax-0.6.8.sol-0.8.13-compact.json @@ -0,0 +1,5 @@ +{ + "C": { + "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: NEW VARIABLE 1\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/minmax-0.6.8.sol-0.8.14-compact.json b/tests/ast-parsing/expected/minmax-0.6.8.sol-0.8.14-compact.json new file mode 100644 index 000000000..228af371a --- /dev/null +++ b/tests/ast-parsing/expected/minmax-0.6.8.sol-0.8.14-compact.json @@ -0,0 +1,5 @@ +{ + "C": { + "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: NEW VARIABLE 1\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/minmax-0.6.8.sol-0.8.15-compact.json b/tests/ast-parsing/expected/minmax-0.6.8.sol-0.8.15-compact.json new file mode 100644 index 000000000..228af371a --- /dev/null +++ b/tests/ast-parsing/expected/minmax-0.6.8.sol-0.8.15-compact.json @@ -0,0 +1,5 @@ +{ + "C": { + "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: NEW VARIABLE 1\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/minmax-0.6.8.sol-0.8.2-compact.json b/tests/ast-parsing/expected/minmax-0.6.8.sol-0.8.2-compact.json index 228af371a..5d52aa8ce 100644 --- a/tests/ast-parsing/expected/minmax-0.6.8.sol-0.8.2-compact.json +++ b/tests/ast-parsing/expected/minmax-0.6.8.sol-0.8.2-compact.json @@ -1,5 +1,3 @@ { - "C": { - "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: NEW VARIABLE 1\n\"];\n}\n" - } + "MinMax": {} } \ No newline at end of file diff --git a/tests/ast-parsing/expected/minmax-0.6.8.sol-0.8.3-compact.json b/tests/ast-parsing/expected/minmax-0.6.8.sol-0.8.3-compact.json index 228af371a..5d52aa8ce 100644 --- a/tests/ast-parsing/expected/minmax-0.6.8.sol-0.8.3-compact.json +++ b/tests/ast-parsing/expected/minmax-0.6.8.sol-0.8.3-compact.json @@ -1,5 +1,3 @@ { - "C": { - "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: NEW VARIABLE 1\n\"];\n}\n" - } + "MinMax": {} } \ No newline at end of file diff --git a/tests/ast-parsing/expected/minmax-0.6.8.sol-0.8.4-compact.json b/tests/ast-parsing/expected/minmax-0.6.8.sol-0.8.4-compact.json index 228af371a..5d52aa8ce 100644 --- a/tests/ast-parsing/expected/minmax-0.6.8.sol-0.8.4-compact.json +++ b/tests/ast-parsing/expected/minmax-0.6.8.sol-0.8.4-compact.json @@ -1,5 +1,3 @@ { - "C": { - "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: NEW VARIABLE 1\n\"];\n}\n" - } + "MinMax": {} } \ No newline at end of file diff --git a/tests/ast-parsing/expected/minmax-0.6.8.sol-0.8.5-compact.json b/tests/ast-parsing/expected/minmax-0.6.8.sol-0.8.5-compact.json index 228af371a..5d52aa8ce 100644 --- a/tests/ast-parsing/expected/minmax-0.6.8.sol-0.8.5-compact.json +++ b/tests/ast-parsing/expected/minmax-0.6.8.sol-0.8.5-compact.json @@ -1,5 +1,3 @@ { - "C": { - "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: NEW VARIABLE 1\n\"];\n}\n" - } + "MinMax": {} } \ No newline at end of file diff --git a/tests/ast-parsing/expected/minmax-0.6.8.sol-0.8.6-compact.json b/tests/ast-parsing/expected/minmax-0.6.8.sol-0.8.6-compact.json index 228af371a..5d52aa8ce 100644 --- a/tests/ast-parsing/expected/minmax-0.6.8.sol-0.8.6-compact.json +++ b/tests/ast-parsing/expected/minmax-0.6.8.sol-0.8.6-compact.json @@ -1,5 +1,3 @@ { - "C": { - "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: NEW VARIABLE 1\n\"];\n}\n" - } + "MinMax": {} } \ No newline at end of file diff --git a/tests/ast-parsing/expected/minmax-0.6.8.sol-0.8.7-compact.json b/tests/ast-parsing/expected/minmax-0.6.8.sol-0.8.7-compact.json index 228af371a..5d52aa8ce 100644 --- a/tests/ast-parsing/expected/minmax-0.6.8.sol-0.8.7-compact.json +++ b/tests/ast-parsing/expected/minmax-0.6.8.sol-0.8.7-compact.json @@ -1,5 +1,3 @@ { - "C": { - "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: NEW VARIABLE 1\n\"];\n}\n" - } + "MinMax": {} } \ No newline at end of file diff --git a/tests/ast-parsing/expected/minmax-0.6.8.sol-0.8.8-compact.json b/tests/ast-parsing/expected/minmax-0.6.8.sol-0.8.8-compact.json index 228af371a..5d52aa8ce 100644 --- a/tests/ast-parsing/expected/minmax-0.6.8.sol-0.8.8-compact.json +++ b/tests/ast-parsing/expected/minmax-0.6.8.sol-0.8.8-compact.json @@ -1,5 +1,3 @@ { - "C": { - "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: NEW VARIABLE 1\n\"];\n}\n" - } + "MinMax": {} } \ No newline at end of file diff --git a/tests/ast-parsing/expected/minmax-0.6.8.sol-0.8.9-compact.json b/tests/ast-parsing/expected/minmax-0.6.8.sol-0.8.9-compact.json index 228af371a..5d52aa8ce 100644 --- a/tests/ast-parsing/expected/minmax-0.6.8.sol-0.8.9-compact.json +++ b/tests/ast-parsing/expected/minmax-0.6.8.sol-0.8.9-compact.json @@ -1,5 +1,3 @@ { - "C": { - "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: NEW VARIABLE 1\n\"];\n}\n" - } + "MinMax": {} } \ No newline at end of file diff --git a/tests/ast-parsing/expected/minmax-0.8.8.sol-0.8.10-compact.json b/tests/ast-parsing/expected/minmax-0.8.8.sol-0.8.10-compact.json new file mode 100644 index 000000000..d52d0b185 --- /dev/null +++ b/tests/ast-parsing/expected/minmax-0.8.8.sol-0.8.10-compact.json @@ -0,0 +1,7 @@ +{ + "MinMax": { + "constructor()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: EXPRESSION 1\n\"];\n1->2;\n2[label=\"Node Type: EXPRESSION 2\n\"];\n2->3;\n3[label=\"Node Type: EXPRESSION 3\n\"];\n3->4;\n4[label=\"Node Type: EXPRESSION 4\n\"];\n}\n", + "min()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: RETURN 1\n\"];\n}\n", + "max()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: RETURN 1\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/minmax-0.8.8.sol-0.8.11-compact.json b/tests/ast-parsing/expected/minmax-0.8.8.sol-0.8.11-compact.json new file mode 100644 index 000000000..d52d0b185 --- /dev/null +++ b/tests/ast-parsing/expected/minmax-0.8.8.sol-0.8.11-compact.json @@ -0,0 +1,7 @@ +{ + "MinMax": { + "constructor()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: EXPRESSION 1\n\"];\n1->2;\n2[label=\"Node Type: EXPRESSION 2\n\"];\n2->3;\n3[label=\"Node Type: EXPRESSION 3\n\"];\n3->4;\n4[label=\"Node Type: EXPRESSION 4\n\"];\n}\n", + "min()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: RETURN 1\n\"];\n}\n", + "max()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: RETURN 1\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/minmax-0.8.8.sol-0.8.12-compact.json b/tests/ast-parsing/expected/minmax-0.8.8.sol-0.8.12-compact.json new file mode 100644 index 000000000..d52d0b185 --- /dev/null +++ b/tests/ast-parsing/expected/minmax-0.8.8.sol-0.8.12-compact.json @@ -0,0 +1,7 @@ +{ + "MinMax": { + "constructor()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: EXPRESSION 1\n\"];\n1->2;\n2[label=\"Node Type: EXPRESSION 2\n\"];\n2->3;\n3[label=\"Node Type: EXPRESSION 3\n\"];\n3->4;\n4[label=\"Node Type: EXPRESSION 4\n\"];\n}\n", + "min()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: RETURN 1\n\"];\n}\n", + "max()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: RETURN 1\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/minmax-0.8.8.sol-0.8.13-compact.json b/tests/ast-parsing/expected/minmax-0.8.8.sol-0.8.13-compact.json new file mode 100644 index 000000000..d52d0b185 --- /dev/null +++ b/tests/ast-parsing/expected/minmax-0.8.8.sol-0.8.13-compact.json @@ -0,0 +1,7 @@ +{ + "MinMax": { + "constructor()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: EXPRESSION 1\n\"];\n1->2;\n2[label=\"Node Type: EXPRESSION 2\n\"];\n2->3;\n3[label=\"Node Type: EXPRESSION 3\n\"];\n3->4;\n4[label=\"Node Type: EXPRESSION 4\n\"];\n}\n", + "min()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: RETURN 1\n\"];\n}\n", + "max()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: RETURN 1\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/minmax-0.8.8.sol-0.8.14-compact.json b/tests/ast-parsing/expected/minmax-0.8.8.sol-0.8.14-compact.json new file mode 100644 index 000000000..d52d0b185 --- /dev/null +++ b/tests/ast-parsing/expected/minmax-0.8.8.sol-0.8.14-compact.json @@ -0,0 +1,7 @@ +{ + "MinMax": { + "constructor()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: EXPRESSION 1\n\"];\n1->2;\n2[label=\"Node Type: EXPRESSION 2\n\"];\n2->3;\n3[label=\"Node Type: EXPRESSION 3\n\"];\n3->4;\n4[label=\"Node Type: EXPRESSION 4\n\"];\n}\n", + "min()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: RETURN 1\n\"];\n}\n", + "max()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: RETURN 1\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/minmax-0.8.8.sol-0.8.15-compact.json b/tests/ast-parsing/expected/minmax-0.8.8.sol-0.8.15-compact.json new file mode 100644 index 000000000..d52d0b185 --- /dev/null +++ b/tests/ast-parsing/expected/minmax-0.8.8.sol-0.8.15-compact.json @@ -0,0 +1,7 @@ +{ + "MinMax": { + "constructor()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: EXPRESSION 1\n\"];\n1->2;\n2[label=\"Node Type: EXPRESSION 2\n\"];\n2->3;\n3[label=\"Node Type: EXPRESSION 3\n\"];\n3->4;\n4[label=\"Node Type: EXPRESSION 4\n\"];\n}\n", + "min()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: RETURN 1\n\"];\n}\n", + "max()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: RETURN 1\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/minmax-0.8.8.sol-0.8.8-compact.json b/tests/ast-parsing/expected/minmax-0.8.8.sol-0.8.8-compact.json new file mode 100644 index 000000000..d52d0b185 --- /dev/null +++ b/tests/ast-parsing/expected/minmax-0.8.8.sol-0.8.8-compact.json @@ -0,0 +1,7 @@ +{ + "MinMax": { + "constructor()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: EXPRESSION 1\n\"];\n1->2;\n2[label=\"Node Type: EXPRESSION 2\n\"];\n2->3;\n3[label=\"Node Type: EXPRESSION 3\n\"];\n3->4;\n4[label=\"Node Type: EXPRESSION 4\n\"];\n}\n", + "min()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: RETURN 1\n\"];\n}\n", + "max()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: RETURN 1\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/minmax-0.8.8.sol-0.8.9-compact.json b/tests/ast-parsing/expected/minmax-0.8.8.sol-0.8.9-compact.json new file mode 100644 index 000000000..d52d0b185 --- /dev/null +++ b/tests/ast-parsing/expected/minmax-0.8.8.sol-0.8.9-compact.json @@ -0,0 +1,7 @@ +{ + "MinMax": { + "constructor()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: EXPRESSION 1\n\"];\n1->2;\n2[label=\"Node Type: EXPRESSION 2\n\"];\n2->3;\n3[label=\"Node Type: EXPRESSION 3\n\"];\n3->4;\n4[label=\"Node Type: EXPRESSION 4\n\"];\n}\n", + "min()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: RETURN 1\n\"];\n}\n", + "max()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: RETURN 1\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/modifier-all.sol-0.8.13-compact.json b/tests/ast-parsing/expected/modifier-all.sol-0.8.13-compact.json new file mode 100644 index 000000000..34aad8ef1 --- /dev/null +++ b/tests/ast-parsing/expected/modifier-all.sol-0.8.13-compact.json @@ -0,0 +1,8 @@ +{ + "C": { + "onePlaceholder()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: _ 1\n\"];\n}\n", + "multiplePlaceholders()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: _ 1\n\"];\n1->2;\n2[label=\"Node Type: _ 2\n\"];\n2->3;\n3[label=\"Node Type: _ 3\n\"];\n}\n", + "acceptsVar(uint256)": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: _ 1\n\"];\n}\n", + "noParams()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: _ 1\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/modifier-all.sol-0.8.14-compact.json b/tests/ast-parsing/expected/modifier-all.sol-0.8.14-compact.json new file mode 100644 index 000000000..34aad8ef1 --- /dev/null +++ b/tests/ast-parsing/expected/modifier-all.sol-0.8.14-compact.json @@ -0,0 +1,8 @@ +{ + "C": { + "onePlaceholder()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: _ 1\n\"];\n}\n", + "multiplePlaceholders()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: _ 1\n\"];\n1->2;\n2[label=\"Node Type: _ 2\n\"];\n2->3;\n3[label=\"Node Type: _ 3\n\"];\n}\n", + "acceptsVar(uint256)": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: _ 1\n\"];\n}\n", + "noParams()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: _ 1\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/modifier-all.sol-0.8.15-compact.json b/tests/ast-parsing/expected/modifier-all.sol-0.8.15-compact.json new file mode 100644 index 000000000..34aad8ef1 --- /dev/null +++ b/tests/ast-parsing/expected/modifier-all.sol-0.8.15-compact.json @@ -0,0 +1,8 @@ +{ + "C": { + "onePlaceholder()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: _ 1\n\"];\n}\n", + "multiplePlaceholders()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: _ 1\n\"];\n1->2;\n2[label=\"Node Type: _ 2\n\"];\n2->3;\n3[label=\"Node Type: _ 3\n\"];\n}\n", + "acceptsVar(uint256)": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: _ 1\n\"];\n}\n", + "noParams()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: _ 1\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/newexpression-0.5.0.sol-0.8.13-compact.json b/tests/ast-parsing/expected/newexpression-0.5.0.sol-0.8.13-compact.json new file mode 100644 index 000000000..e46dafe75 --- /dev/null +++ b/tests/ast-parsing/expected/newexpression-0.5.0.sol-0.8.13-compact.json @@ -0,0 +1,8 @@ +{ + "B": { + "constructor()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n" + }, + "C": { + "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: EXPRESSION 1\n\"];\n1->2;\n2[label=\"Node Type: EXPRESSION 2\n\"];\n2->3;\n3[label=\"Node Type: EXPRESSION 3\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/newexpression-0.5.0.sol-0.8.14-compact.json b/tests/ast-parsing/expected/newexpression-0.5.0.sol-0.8.14-compact.json new file mode 100644 index 000000000..e46dafe75 --- /dev/null +++ b/tests/ast-parsing/expected/newexpression-0.5.0.sol-0.8.14-compact.json @@ -0,0 +1,8 @@ +{ + "B": { + "constructor()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n" + }, + "C": { + "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: EXPRESSION 1\n\"];\n1->2;\n2[label=\"Node Type: EXPRESSION 2\n\"];\n2->3;\n3[label=\"Node Type: EXPRESSION 3\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/newexpression-0.5.0.sol-0.8.15-compact.json b/tests/ast-parsing/expected/newexpression-0.5.0.sol-0.8.15-compact.json new file mode 100644 index 000000000..e46dafe75 --- /dev/null +++ b/tests/ast-parsing/expected/newexpression-0.5.0.sol-0.8.15-compact.json @@ -0,0 +1,8 @@ +{ + "B": { + "constructor()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n" + }, + "C": { + "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: EXPRESSION 1\n\"];\n1->2;\n2[label=\"Node Type: EXPRESSION 2\n\"];\n2->3;\n3[label=\"Node Type: EXPRESSION 3\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/pragma-0.8.0.sol-0.8.13-compact.json b/tests/ast-parsing/expected/pragma-0.8.0.sol-0.8.13-compact.json new file mode 100644 index 000000000..0008a4469 --- /dev/null +++ b/tests/ast-parsing/expected/pragma-0.8.0.sol-0.8.13-compact.json @@ -0,0 +1,3 @@ +{ + "C": {} +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/pragma-0.8.0.sol-0.8.14-compact.json b/tests/ast-parsing/expected/pragma-0.8.0.sol-0.8.14-compact.json new file mode 100644 index 000000000..0008a4469 --- /dev/null +++ b/tests/ast-parsing/expected/pragma-0.8.0.sol-0.8.14-compact.json @@ -0,0 +1,3 @@ +{ + "C": {} +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/pragma-0.8.0.sol-0.8.15-compact.json b/tests/ast-parsing/expected/pragma-0.8.0.sol-0.8.15-compact.json new file mode 100644 index 000000000..0008a4469 --- /dev/null +++ b/tests/ast-parsing/expected/pragma-0.8.0.sol-0.8.15-compact.json @@ -0,0 +1,3 @@ +{ + "C": {} +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/push-all.sol-0.8.13-compact.json b/tests/ast-parsing/expected/push-all.sol-0.8.13-compact.json new file mode 100644 index 000000000..a1a35e654 --- /dev/null +++ b/tests/ast-parsing/expected/push-all.sol-0.8.13-compact.json @@ -0,0 +1,5 @@ +{ + "C": { + "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: EXPRESSION 1\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/push-all.sol-0.8.14-compact.json b/tests/ast-parsing/expected/push-all.sol-0.8.14-compact.json new file mode 100644 index 000000000..a1a35e654 --- /dev/null +++ b/tests/ast-parsing/expected/push-all.sol-0.8.14-compact.json @@ -0,0 +1,5 @@ +{ + "C": { + "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: EXPRESSION 1\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/push-all.sol-0.8.15-compact.json b/tests/ast-parsing/expected/push-all.sol-0.8.15-compact.json new file mode 100644 index 000000000..a1a35e654 --- /dev/null +++ b/tests/ast-parsing/expected/push-all.sol-0.8.15-compact.json @@ -0,0 +1,5 @@ +{ + "C": { + "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: EXPRESSION 1\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/return-all.sol-0.8.13-compact.json b/tests/ast-parsing/expected/return-all.sol-0.8.13-compact.json new file mode 100644 index 000000000..7eddd38f6 --- /dev/null +++ b/tests/ast-parsing/expected/return-all.sol-0.8.13-compact.json @@ -0,0 +1,9 @@ +{ + "C": { + "returnConstant()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: RETURN 1\n\"];\n}\n", + "returnVariable()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: NEW VARIABLE 1\n\"];\n1->2;\n2[label=\"Node Type: RETURN 2\n\"];\n}\n", + "returnTuple()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: NEW VARIABLE 1\n\"];\n1->2;\n2[label=\"Node Type: NEW VARIABLE 2\n\"];\n2->3;\n3[label=\"Node Type: RETURN 3\n\"];\n}\n", + "returnTernary()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: NEW VARIABLE 1\n\"];\n1->3;\n3[label=\"Node Type: IF 3\n\"];\n3->4[label=\"True\"];\n3->5[label=\"False\"];\n4[label=\"Node Type: RETURN 4\n\"];\n5[label=\"Node Type: RETURN 5\n\"];\n}\n", + "returnDelete()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: RETURN 1\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/return-all.sol-0.8.14-compact.json b/tests/ast-parsing/expected/return-all.sol-0.8.14-compact.json new file mode 100644 index 000000000..7eddd38f6 --- /dev/null +++ b/tests/ast-parsing/expected/return-all.sol-0.8.14-compact.json @@ -0,0 +1,9 @@ +{ + "C": { + "returnConstant()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: RETURN 1\n\"];\n}\n", + "returnVariable()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: NEW VARIABLE 1\n\"];\n1->2;\n2[label=\"Node Type: RETURN 2\n\"];\n}\n", + "returnTuple()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: NEW VARIABLE 1\n\"];\n1->2;\n2[label=\"Node Type: NEW VARIABLE 2\n\"];\n2->3;\n3[label=\"Node Type: RETURN 3\n\"];\n}\n", + "returnTernary()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: NEW VARIABLE 1\n\"];\n1->3;\n3[label=\"Node Type: IF 3\n\"];\n3->4[label=\"True\"];\n3->5[label=\"False\"];\n4[label=\"Node Type: RETURN 4\n\"];\n5[label=\"Node Type: RETURN 5\n\"];\n}\n", + "returnDelete()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: RETURN 1\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/return-all.sol-0.8.15-compact.json b/tests/ast-parsing/expected/return-all.sol-0.8.15-compact.json new file mode 100644 index 000000000..7eddd38f6 --- /dev/null +++ b/tests/ast-parsing/expected/return-all.sol-0.8.15-compact.json @@ -0,0 +1,9 @@ +{ + "C": { + "returnConstant()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: RETURN 1\n\"];\n}\n", + "returnVariable()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: NEW VARIABLE 1\n\"];\n1->2;\n2[label=\"Node Type: RETURN 2\n\"];\n}\n", + "returnTuple()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: NEW VARIABLE 1\n\"];\n1->2;\n2[label=\"Node Type: NEW VARIABLE 2\n\"];\n2->3;\n3[label=\"Node Type: RETURN 3\n\"];\n}\n", + "returnTernary()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: NEW VARIABLE 1\n\"];\n1->3;\n3[label=\"Node Type: IF 3\n\"];\n3->4[label=\"True\"];\n3->5[label=\"False\"];\n4[label=\"Node Type: RETURN 4\n\"];\n5[label=\"Node Type: RETURN 5\n\"];\n}\n", + "returnDelete()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: RETURN 1\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/scope-0.5.0.sol-0.8.13-compact.json b/tests/ast-parsing/expected/scope-0.5.0.sol-0.8.13-compact.json new file mode 100644 index 000000000..00c3dbb1a --- /dev/null +++ b/tests/ast-parsing/expected/scope-0.5.0.sol-0.8.13-compact.json @@ -0,0 +1,8 @@ +{ + "Scope": { + "nested_scope()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: NEW VARIABLE 1\n\"];\n1->2;\n2[label=\"Node Type: NEW VARIABLE 2\n\"];\n2->3;\n3[label=\"Node Type: NEW VARIABLE 3\n\"];\n}\n", + "if_scope()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: IF 1\n\"];\n1->2[label=\"True\"];\n1->3[label=\"False\"];\n2[label=\"Node Type: NEW VARIABLE 2\n\"];\n2->4;\n3[label=\"Node Type: NEW VARIABLE 3\n\"];\n3->4;\n4[label=\"Node Type: END_IF 4\n\"];\n}\n", + "while_scope()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: NEW VARIABLE 1\n\"];\n1->2;\n2[label=\"Node Type: BEGIN_LOOP 2\n\"];\n2->3;\n3[label=\"Node Type: IF_LOOP 3\n\"];\n3->4[label=\"True\"];\n3->5[label=\"False\"];\n4[label=\"Node Type: NEW VARIABLE 4\n\"];\n4->3;\n5[label=\"Node Type: END_LOOP 5\n\"];\n}\n", + "for_scope()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: NEW VARIABLE 1\n\"];\n1->4;\n2[label=\"Node Type: BEGIN_LOOP 2\n\"];\n2->5;\n3[label=\"Node Type: END_LOOP 3\n\"];\n4[label=\"Node Type: NEW VARIABLE 4\n\"];\n4->2;\n5[label=\"Node Type: IF_LOOP 5\n\"];\n5->6[label=\"True\"];\n5->3[label=\"False\"];\n6[label=\"Node Type: NEW VARIABLE 6\n\"];\n6->7;\n7[label=\"Node Type: EXPRESSION 7\n\"];\n7->5;\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/scope-0.5.0.sol-0.8.14-compact.json b/tests/ast-parsing/expected/scope-0.5.0.sol-0.8.14-compact.json new file mode 100644 index 000000000..00c3dbb1a --- /dev/null +++ b/tests/ast-parsing/expected/scope-0.5.0.sol-0.8.14-compact.json @@ -0,0 +1,8 @@ +{ + "Scope": { + "nested_scope()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: NEW VARIABLE 1\n\"];\n1->2;\n2[label=\"Node Type: NEW VARIABLE 2\n\"];\n2->3;\n3[label=\"Node Type: NEW VARIABLE 3\n\"];\n}\n", + "if_scope()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: IF 1\n\"];\n1->2[label=\"True\"];\n1->3[label=\"False\"];\n2[label=\"Node Type: NEW VARIABLE 2\n\"];\n2->4;\n3[label=\"Node Type: NEW VARIABLE 3\n\"];\n3->4;\n4[label=\"Node Type: END_IF 4\n\"];\n}\n", + "while_scope()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: NEW VARIABLE 1\n\"];\n1->2;\n2[label=\"Node Type: BEGIN_LOOP 2\n\"];\n2->3;\n3[label=\"Node Type: IF_LOOP 3\n\"];\n3->4[label=\"True\"];\n3->5[label=\"False\"];\n4[label=\"Node Type: NEW VARIABLE 4\n\"];\n4->3;\n5[label=\"Node Type: END_LOOP 5\n\"];\n}\n", + "for_scope()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: NEW VARIABLE 1\n\"];\n1->4;\n2[label=\"Node Type: BEGIN_LOOP 2\n\"];\n2->5;\n3[label=\"Node Type: END_LOOP 3\n\"];\n4[label=\"Node Type: NEW VARIABLE 4\n\"];\n4->2;\n5[label=\"Node Type: IF_LOOP 5\n\"];\n5->6[label=\"True\"];\n5->3[label=\"False\"];\n6[label=\"Node Type: NEW VARIABLE 6\n\"];\n6->7;\n7[label=\"Node Type: EXPRESSION 7\n\"];\n7->5;\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/scope-0.5.0.sol-0.8.15-compact.json b/tests/ast-parsing/expected/scope-0.5.0.sol-0.8.15-compact.json new file mode 100644 index 000000000..00c3dbb1a --- /dev/null +++ b/tests/ast-parsing/expected/scope-0.5.0.sol-0.8.15-compact.json @@ -0,0 +1,8 @@ +{ + "Scope": { + "nested_scope()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: NEW VARIABLE 1\n\"];\n1->2;\n2[label=\"Node Type: NEW VARIABLE 2\n\"];\n2->3;\n3[label=\"Node Type: NEW VARIABLE 3\n\"];\n}\n", + "if_scope()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: IF 1\n\"];\n1->2[label=\"True\"];\n1->3[label=\"False\"];\n2[label=\"Node Type: NEW VARIABLE 2\n\"];\n2->4;\n3[label=\"Node Type: NEW VARIABLE 3\n\"];\n3->4;\n4[label=\"Node Type: END_IF 4\n\"];\n}\n", + "while_scope()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: NEW VARIABLE 1\n\"];\n1->2;\n2[label=\"Node Type: BEGIN_LOOP 2\n\"];\n2->3;\n3[label=\"Node Type: IF_LOOP 3\n\"];\n3->4[label=\"True\"];\n3->5[label=\"False\"];\n4[label=\"Node Type: NEW VARIABLE 4\n\"];\n4->3;\n5[label=\"Node Type: END_LOOP 5\n\"];\n}\n", + "for_scope()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: NEW VARIABLE 1\n\"];\n1->4;\n2[label=\"Node Type: BEGIN_LOOP 2\n\"];\n2->5;\n3[label=\"Node Type: END_LOOP 3\n\"];\n4[label=\"Node Type: NEW VARIABLE 4\n\"];\n4->2;\n5[label=\"Node Type: IF_LOOP 5\n\"];\n5->6[label=\"True\"];\n5->3[label=\"False\"];\n6[label=\"Node Type: NEW VARIABLE 6\n\"];\n6->7;\n7[label=\"Node Type: EXPRESSION 7\n\"];\n7->5;\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/struct-0.6.0.sol-0.8.13-compact.json b/tests/ast-parsing/expected/struct-0.6.0.sol-0.8.13-compact.json new file mode 100644 index 000000000..0008a4469 --- /dev/null +++ b/tests/ast-parsing/expected/struct-0.6.0.sol-0.8.13-compact.json @@ -0,0 +1,3 @@ +{ + "C": {} +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/struct-0.6.0.sol-0.8.14-compact.json b/tests/ast-parsing/expected/struct-0.6.0.sol-0.8.14-compact.json new file mode 100644 index 000000000..0008a4469 --- /dev/null +++ b/tests/ast-parsing/expected/struct-0.6.0.sol-0.8.14-compact.json @@ -0,0 +1,3 @@ +{ + "C": {} +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/struct-0.6.0.sol-0.8.15-compact.json b/tests/ast-parsing/expected/struct-0.6.0.sol-0.8.15-compact.json new file mode 100644 index 000000000..0008a4469 --- /dev/null +++ b/tests/ast-parsing/expected/struct-0.6.0.sol-0.8.15-compact.json @@ -0,0 +1,3 @@ +{ + "C": {} +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/throw-0.5.0.sol-0.8.13-compact.json b/tests/ast-parsing/expected/throw-0.5.0.sol-0.8.13-compact.json new file mode 100644 index 000000000..0008a4469 --- /dev/null +++ b/tests/ast-parsing/expected/throw-0.5.0.sol-0.8.13-compact.json @@ -0,0 +1,3 @@ +{ + "C": {} +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/throw-0.5.0.sol-0.8.14-compact.json b/tests/ast-parsing/expected/throw-0.5.0.sol-0.8.14-compact.json new file mode 100644 index 000000000..0008a4469 --- /dev/null +++ b/tests/ast-parsing/expected/throw-0.5.0.sol-0.8.14-compact.json @@ -0,0 +1,3 @@ +{ + "C": {} +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/throw-0.5.0.sol-0.8.15-compact.json b/tests/ast-parsing/expected/throw-0.5.0.sol-0.8.15-compact.json new file mode 100644 index 000000000..0008a4469 --- /dev/null +++ b/tests/ast-parsing/expected/throw-0.5.0.sol-0.8.15-compact.json @@ -0,0 +1,3 @@ +{ + "C": {} +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/top-level-0.7.4.sol-0.8.13-compact.json b/tests/ast-parsing/expected/top-level-0.7.4.sol-0.8.13-compact.json new file mode 100644 index 000000000..9e26dfeeb --- /dev/null +++ b/tests/ast-parsing/expected/top-level-0.7.4.sol-0.8.13-compact.json @@ -0,0 +1 @@ +{} \ No newline at end of file diff --git a/tests/ast-parsing/expected/top-level-0.7.4.sol-0.8.14-compact.json b/tests/ast-parsing/expected/top-level-0.7.4.sol-0.8.14-compact.json new file mode 100644 index 000000000..9e26dfeeb --- /dev/null +++ b/tests/ast-parsing/expected/top-level-0.7.4.sol-0.8.14-compact.json @@ -0,0 +1 @@ +{} \ No newline at end of file diff --git a/tests/ast-parsing/expected/top-level-0.7.4.sol-0.8.15-compact.json b/tests/ast-parsing/expected/top-level-0.7.4.sol-0.8.15-compact.json new file mode 100644 index 000000000..9e26dfeeb --- /dev/null +++ b/tests/ast-parsing/expected/top-level-0.7.4.sol-0.8.15-compact.json @@ -0,0 +1 @@ +{} \ No newline at end of file diff --git a/tests/ast-parsing/expected/top-level-import-0.7.1.sol-0.8.13-compact.json b/tests/ast-parsing/expected/top-level-import-0.7.1.sol-0.8.13-compact.json new file mode 100644 index 000000000..a1a35e654 --- /dev/null +++ b/tests/ast-parsing/expected/top-level-import-0.7.1.sol-0.8.13-compact.json @@ -0,0 +1,5 @@ +{ + "C": { + "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: EXPRESSION 1\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/top-level-import-0.7.1.sol-0.8.14-compact.json b/tests/ast-parsing/expected/top-level-import-0.7.1.sol-0.8.14-compact.json new file mode 100644 index 000000000..a1a35e654 --- /dev/null +++ b/tests/ast-parsing/expected/top-level-import-0.7.1.sol-0.8.14-compact.json @@ -0,0 +1,5 @@ +{ + "C": { + "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: EXPRESSION 1\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/top-level-import-0.7.1.sol-0.8.15-compact.json b/tests/ast-parsing/expected/top-level-import-0.7.1.sol-0.8.15-compact.json new file mode 100644 index 000000000..a1a35e654 --- /dev/null +++ b/tests/ast-parsing/expected/top-level-import-0.7.1.sol-0.8.15-compact.json @@ -0,0 +1,5 @@ +{ + "C": { + "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: EXPRESSION 1\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/top-level-import-bis-0.7.1.sol-0.8.13-compact.json b/tests/ast-parsing/expected/top-level-import-bis-0.7.1.sol-0.8.13-compact.json new file mode 100644 index 000000000..a1a35e654 --- /dev/null +++ b/tests/ast-parsing/expected/top-level-import-bis-0.7.1.sol-0.8.13-compact.json @@ -0,0 +1,5 @@ +{ + "C": { + "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: EXPRESSION 1\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/top-level-import-bis-0.7.1.sol-0.8.14-compact.json b/tests/ast-parsing/expected/top-level-import-bis-0.7.1.sol-0.8.14-compact.json new file mode 100644 index 000000000..a1a35e654 --- /dev/null +++ b/tests/ast-parsing/expected/top-level-import-bis-0.7.1.sol-0.8.14-compact.json @@ -0,0 +1,5 @@ +{ + "C": { + "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: EXPRESSION 1\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/top-level-import-bis-0.7.1.sol-0.8.15-compact.json b/tests/ast-parsing/expected/top-level-import-bis-0.7.1.sol-0.8.15-compact.json new file mode 100644 index 000000000..a1a35e654 --- /dev/null +++ b/tests/ast-parsing/expected/top-level-import-bis-0.7.1.sol-0.8.15-compact.json @@ -0,0 +1,5 @@ +{ + "C": { + "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: EXPRESSION 1\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/top-level-nested-import-0.7.1.sol-0.8.13-compact.json b/tests/ast-parsing/expected/top-level-nested-import-0.7.1.sol-0.8.13-compact.json new file mode 100644 index 000000000..a1a35e654 --- /dev/null +++ b/tests/ast-parsing/expected/top-level-nested-import-0.7.1.sol-0.8.13-compact.json @@ -0,0 +1,5 @@ +{ + "C": { + "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: EXPRESSION 1\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/top-level-nested-import-0.7.1.sol-0.8.14-compact.json b/tests/ast-parsing/expected/top-level-nested-import-0.7.1.sol-0.8.14-compact.json new file mode 100644 index 000000000..a1a35e654 --- /dev/null +++ b/tests/ast-parsing/expected/top-level-nested-import-0.7.1.sol-0.8.14-compact.json @@ -0,0 +1,5 @@ +{ + "C": { + "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: EXPRESSION 1\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/top-level-nested-import-0.7.1.sol-0.8.15-compact.json b/tests/ast-parsing/expected/top-level-nested-import-0.7.1.sol-0.8.15-compact.json new file mode 100644 index 000000000..a1a35e654 --- /dev/null +++ b/tests/ast-parsing/expected/top-level-nested-import-0.7.1.sol-0.8.15-compact.json @@ -0,0 +1,5 @@ +{ + "C": { + "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: EXPRESSION 1\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/top_level_variable-0.8.0.sol-0.8.13-compact.json b/tests/ast-parsing/expected/top_level_variable-0.8.0.sol-0.8.13-compact.json new file mode 100644 index 000000000..35c752376 --- /dev/null +++ b/tests/ast-parsing/expected/top_level_variable-0.8.0.sol-0.8.13-compact.json @@ -0,0 +1,5 @@ +{ + "T": { + "g()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: EXPRESSION 1\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/top_level_variable-0.8.0.sol-0.8.14-compact.json b/tests/ast-parsing/expected/top_level_variable-0.8.0.sol-0.8.14-compact.json new file mode 100644 index 000000000..35c752376 --- /dev/null +++ b/tests/ast-parsing/expected/top_level_variable-0.8.0.sol-0.8.14-compact.json @@ -0,0 +1,5 @@ +{ + "T": { + "g()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: EXPRESSION 1\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/top_level_variable-0.8.0.sol-0.8.15-compact.json b/tests/ast-parsing/expected/top_level_variable-0.8.0.sol-0.8.15-compact.json new file mode 100644 index 000000000..35c752376 --- /dev/null +++ b/tests/ast-parsing/expected/top_level_variable-0.8.0.sol-0.8.15-compact.json @@ -0,0 +1,5 @@ +{ + "T": { + "g()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: EXPRESSION 1\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/top_level_variable2-0.8.0.sol-0.8.13-compact.json b/tests/ast-parsing/expected/top_level_variable2-0.8.0.sol-0.8.13-compact.json new file mode 100644 index 000000000..503a5cebd --- /dev/null +++ b/tests/ast-parsing/expected/top_level_variable2-0.8.0.sol-0.8.13-compact.json @@ -0,0 +1,8 @@ +{ + "T": { + "g()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: EXPRESSION 1\n\"];\n}\n" + }, + "T2": { + "h(uint256[10])": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/top_level_variable2-0.8.0.sol-0.8.14-compact.json b/tests/ast-parsing/expected/top_level_variable2-0.8.0.sol-0.8.14-compact.json new file mode 100644 index 000000000..503a5cebd --- /dev/null +++ b/tests/ast-parsing/expected/top_level_variable2-0.8.0.sol-0.8.14-compact.json @@ -0,0 +1,8 @@ +{ + "T": { + "g()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: EXPRESSION 1\n\"];\n}\n" + }, + "T2": { + "h(uint256[10])": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/top_level_variable2-0.8.0.sol-0.8.15-compact.json b/tests/ast-parsing/expected/top_level_variable2-0.8.0.sol-0.8.15-compact.json new file mode 100644 index 000000000..503a5cebd --- /dev/null +++ b/tests/ast-parsing/expected/top_level_variable2-0.8.0.sol-0.8.15-compact.json @@ -0,0 +1,8 @@ +{ + "T": { + "g()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: EXPRESSION 1\n\"];\n}\n" + }, + "T2": { + "h(uint256[10])": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/trycatch-0.6.0.sol-0.8.13-compact.json b/tests/ast-parsing/expected/trycatch-0.6.0.sol-0.8.13-compact.json new file mode 100644 index 000000000..6099f6be4 --- /dev/null +++ b/tests/ast-parsing/expected/trycatch-0.6.0.sol-0.8.13-compact.json @@ -0,0 +1,9 @@ +{ + "ERC20": { + "balanceOf(address)": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: RETURN 1\n\"];\n}\n" + }, + "C": { + "tryCatchFunctionCall()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: NEW VARIABLE 1\n\"];\n1->2;\n2[label=\"Node Type: TRY 2\n\"];\n2->3;\n2->5;\n2->7;\n3[label=\"Node Type: CATCH 3\n\"];\n3->4;\n4[label=\"Node Type: EXPRESSION 4\n\"];\n4->7;\n5[label=\"Node Type: CATCH 5\n\"];\n5->6;\n6[label=\"Node Type: EXPRESSION 6\n\"];\n6->7;\n7[label=\"Node Type: TRY 7\n\"];\n7->8;\n7->10;\n7->12;\n8[label=\"Node Type: CATCH 8\n\"];\n8->9;\n9[label=\"Node Type: EXPRESSION 9\n\"];\n9->12;\n10[label=\"Node Type: CATCH 10\n\"];\n10->11;\n11[label=\"Node Type: EXPRESSION 11\n\"];\n11->12;\n12[label=\"Node Type: TRY 12\n\"];\n12->13;\n12->15;\n12->17;\n12->19;\n13[label=\"Node Type: CATCH 13\n\"];\n13->14;\n14[label=\"Node Type: EXPRESSION 14\n\"];\n14->19;\n15[label=\"Node Type: CATCH 15\n\"];\n15->16;\n16[label=\"Node Type: EXPRESSION 16\n\"];\n16->19;\n17[label=\"Node Type: CATCH 17\n\"];\n17->18;\n18[label=\"Node Type: EXPRESSION 18\n\"];\n18->19;\n19[label=\"Node Type: TRY 19\n\"];\n19->20;\n19->21;\n20[label=\"Node Type: CATCH 20\n\"];\n21[label=\"Node Type: CATCH 21\n\"];\n21->22;\n22[label=\"Node Type: EXPRESSION 22\n\"];\n}\n", + "tryCatchContractDeployment()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: TRY 1\n\"];\n1->2;\n1->6;\n2[label=\"Node Type: CATCH 2\n\"];\n2->3;\n3[label=\"Node Type: TRY 3\n\"];\n3->4;\n3->5;\n4[label=\"Node Type: CATCH 4\n\"];\n5[label=\"Node Type: CATCH 5\n\"];\n6[label=\"Node Type: CATCH 6\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/trycatch-0.6.0.sol-0.8.14-compact.json b/tests/ast-parsing/expected/trycatch-0.6.0.sol-0.8.14-compact.json new file mode 100644 index 000000000..6099f6be4 --- /dev/null +++ b/tests/ast-parsing/expected/trycatch-0.6.0.sol-0.8.14-compact.json @@ -0,0 +1,9 @@ +{ + "ERC20": { + "balanceOf(address)": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: RETURN 1\n\"];\n}\n" + }, + "C": { + "tryCatchFunctionCall()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: NEW VARIABLE 1\n\"];\n1->2;\n2[label=\"Node Type: TRY 2\n\"];\n2->3;\n2->5;\n2->7;\n3[label=\"Node Type: CATCH 3\n\"];\n3->4;\n4[label=\"Node Type: EXPRESSION 4\n\"];\n4->7;\n5[label=\"Node Type: CATCH 5\n\"];\n5->6;\n6[label=\"Node Type: EXPRESSION 6\n\"];\n6->7;\n7[label=\"Node Type: TRY 7\n\"];\n7->8;\n7->10;\n7->12;\n8[label=\"Node Type: CATCH 8\n\"];\n8->9;\n9[label=\"Node Type: EXPRESSION 9\n\"];\n9->12;\n10[label=\"Node Type: CATCH 10\n\"];\n10->11;\n11[label=\"Node Type: EXPRESSION 11\n\"];\n11->12;\n12[label=\"Node Type: TRY 12\n\"];\n12->13;\n12->15;\n12->17;\n12->19;\n13[label=\"Node Type: CATCH 13\n\"];\n13->14;\n14[label=\"Node Type: EXPRESSION 14\n\"];\n14->19;\n15[label=\"Node Type: CATCH 15\n\"];\n15->16;\n16[label=\"Node Type: EXPRESSION 16\n\"];\n16->19;\n17[label=\"Node Type: CATCH 17\n\"];\n17->18;\n18[label=\"Node Type: EXPRESSION 18\n\"];\n18->19;\n19[label=\"Node Type: TRY 19\n\"];\n19->20;\n19->21;\n20[label=\"Node Type: CATCH 20\n\"];\n21[label=\"Node Type: CATCH 21\n\"];\n21->22;\n22[label=\"Node Type: EXPRESSION 22\n\"];\n}\n", + "tryCatchContractDeployment()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: TRY 1\n\"];\n1->2;\n1->6;\n2[label=\"Node Type: CATCH 2\n\"];\n2->3;\n3[label=\"Node Type: TRY 3\n\"];\n3->4;\n3->5;\n4[label=\"Node Type: CATCH 4\n\"];\n5[label=\"Node Type: CATCH 5\n\"];\n6[label=\"Node Type: CATCH 6\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/trycatch-0.6.0.sol-0.8.15-compact.json b/tests/ast-parsing/expected/trycatch-0.6.0.sol-0.8.15-compact.json new file mode 100644 index 000000000..6099f6be4 --- /dev/null +++ b/tests/ast-parsing/expected/trycatch-0.6.0.sol-0.8.15-compact.json @@ -0,0 +1,9 @@ +{ + "ERC20": { + "balanceOf(address)": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: RETURN 1\n\"];\n}\n" + }, + "C": { + "tryCatchFunctionCall()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: NEW VARIABLE 1\n\"];\n1->2;\n2[label=\"Node Type: TRY 2\n\"];\n2->3;\n2->5;\n2->7;\n3[label=\"Node Type: CATCH 3\n\"];\n3->4;\n4[label=\"Node Type: EXPRESSION 4\n\"];\n4->7;\n5[label=\"Node Type: CATCH 5\n\"];\n5->6;\n6[label=\"Node Type: EXPRESSION 6\n\"];\n6->7;\n7[label=\"Node Type: TRY 7\n\"];\n7->8;\n7->10;\n7->12;\n8[label=\"Node Type: CATCH 8\n\"];\n8->9;\n9[label=\"Node Type: EXPRESSION 9\n\"];\n9->12;\n10[label=\"Node Type: CATCH 10\n\"];\n10->11;\n11[label=\"Node Type: EXPRESSION 11\n\"];\n11->12;\n12[label=\"Node Type: TRY 12\n\"];\n12->13;\n12->15;\n12->17;\n12->19;\n13[label=\"Node Type: CATCH 13\n\"];\n13->14;\n14[label=\"Node Type: EXPRESSION 14\n\"];\n14->19;\n15[label=\"Node Type: CATCH 15\n\"];\n15->16;\n16[label=\"Node Type: EXPRESSION 16\n\"];\n16->19;\n17[label=\"Node Type: CATCH 17\n\"];\n17->18;\n18[label=\"Node Type: EXPRESSION 18\n\"];\n18->19;\n19[label=\"Node Type: TRY 19\n\"];\n19->20;\n19->21;\n20[label=\"Node Type: CATCH 20\n\"];\n21[label=\"Node Type: CATCH 21\n\"];\n21->22;\n22[label=\"Node Type: EXPRESSION 22\n\"];\n}\n", + "tryCatchContractDeployment()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: TRY 1\n\"];\n1->2;\n1->6;\n2[label=\"Node Type: CATCH 2\n\"];\n2->3;\n3[label=\"Node Type: TRY 3\n\"];\n3->4;\n3->5;\n4[label=\"Node Type: CATCH 4\n\"];\n5[label=\"Node Type: CATCH 5\n\"];\n6[label=\"Node Type: CATCH 6\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/tupleexpression-0.5.3.sol-0.8.13-compact.json b/tests/ast-parsing/expected/tupleexpression-0.5.3.sol-0.8.13-compact.json new file mode 100644 index 000000000..b5912e6b8 --- /dev/null +++ b/tests/ast-parsing/expected/tupleexpression-0.5.3.sol-0.8.13-compact.json @@ -0,0 +1,5 @@ +{ + "C": { + "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: NEW VARIABLE 1\n\"];\n1->2;\n2[label=\"Node Type: NEW VARIABLE 2\n\"];\n2->3;\n3[label=\"Node Type: EXPRESSION 3\n\"];\n3->4;\n4[label=\"Node Type: EXPRESSION 4\n\"];\n4->5;\n5[label=\"Node Type: EXPRESSION 5\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/tupleexpression-0.5.3.sol-0.8.14-compact.json b/tests/ast-parsing/expected/tupleexpression-0.5.3.sol-0.8.14-compact.json new file mode 100644 index 000000000..b5912e6b8 --- /dev/null +++ b/tests/ast-parsing/expected/tupleexpression-0.5.3.sol-0.8.14-compact.json @@ -0,0 +1,5 @@ +{ + "C": { + "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: NEW VARIABLE 1\n\"];\n1->2;\n2[label=\"Node Type: NEW VARIABLE 2\n\"];\n2->3;\n3[label=\"Node Type: EXPRESSION 3\n\"];\n3->4;\n4[label=\"Node Type: EXPRESSION 4\n\"];\n4->5;\n5[label=\"Node Type: EXPRESSION 5\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/tupleexpression-0.5.3.sol-0.8.15-compact.json b/tests/ast-parsing/expected/tupleexpression-0.5.3.sol-0.8.15-compact.json new file mode 100644 index 000000000..b5912e6b8 --- /dev/null +++ b/tests/ast-parsing/expected/tupleexpression-0.5.3.sol-0.8.15-compact.json @@ -0,0 +1,5 @@ +{ + "C": { + "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: NEW VARIABLE 1\n\"];\n1->2;\n2[label=\"Node Type: NEW VARIABLE 2\n\"];\n2->3;\n3[label=\"Node Type: EXPRESSION 3\n\"];\n3->4;\n4[label=\"Node Type: EXPRESSION 4\n\"];\n4->5;\n5[label=\"Node Type: EXPRESSION 5\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/unaryexpression-0.5.0.sol-0.8.13-compact.json b/tests/ast-parsing/expected/unaryexpression-0.5.0.sol-0.8.13-compact.json new file mode 100644 index 000000000..f7fcf9203 --- /dev/null +++ b/tests/ast-parsing/expected/unaryexpression-0.5.0.sol-0.8.13-compact.json @@ -0,0 +1,5 @@ +{ + "C": { + "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: NEW VARIABLE 1\n\"];\n1->2;\n2[label=\"Node Type: EXPRESSION 2\n\"];\n2->3;\n3[label=\"Node Type: EXPRESSION 3\n\"];\n3->4;\n4[label=\"Node Type: EXPRESSION 4\n\"];\n4->5;\n5[label=\"Node Type: EXPRESSION 5\n\"];\n5->6;\n6[label=\"Node Type: EXPRESSION 6\n\"];\n6->7;\n7[label=\"Node Type: NEW VARIABLE 7\n\"];\n7->8;\n8[label=\"Node Type: EXPRESSION 8\n\"];\n8->9;\n9[label=\"Node Type: EXPRESSION 9\n\"];\n9->10;\n10[label=\"Node Type: NEW VARIABLE 10\n\"];\n10->11;\n11[label=\"Node Type: EXPRESSION 11\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/unaryexpression-0.5.0.sol-0.8.14-compact.json b/tests/ast-parsing/expected/unaryexpression-0.5.0.sol-0.8.14-compact.json new file mode 100644 index 000000000..f7fcf9203 --- /dev/null +++ b/tests/ast-parsing/expected/unaryexpression-0.5.0.sol-0.8.14-compact.json @@ -0,0 +1,5 @@ +{ + "C": { + "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: NEW VARIABLE 1\n\"];\n1->2;\n2[label=\"Node Type: EXPRESSION 2\n\"];\n2->3;\n3[label=\"Node Type: EXPRESSION 3\n\"];\n3->4;\n4[label=\"Node Type: EXPRESSION 4\n\"];\n4->5;\n5[label=\"Node Type: EXPRESSION 5\n\"];\n5->6;\n6[label=\"Node Type: EXPRESSION 6\n\"];\n6->7;\n7[label=\"Node Type: NEW VARIABLE 7\n\"];\n7->8;\n8[label=\"Node Type: EXPRESSION 8\n\"];\n8->9;\n9[label=\"Node Type: EXPRESSION 9\n\"];\n9->10;\n10[label=\"Node Type: NEW VARIABLE 10\n\"];\n10->11;\n11[label=\"Node Type: EXPRESSION 11\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/unaryexpression-0.5.0.sol-0.8.15-compact.json b/tests/ast-parsing/expected/unaryexpression-0.5.0.sol-0.8.15-compact.json new file mode 100644 index 000000000..f7fcf9203 --- /dev/null +++ b/tests/ast-parsing/expected/unaryexpression-0.5.0.sol-0.8.15-compact.json @@ -0,0 +1,5 @@ +{ + "C": { + "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: NEW VARIABLE 1\n\"];\n1->2;\n2[label=\"Node Type: EXPRESSION 2\n\"];\n2->3;\n3[label=\"Node Type: EXPRESSION 3\n\"];\n3->4;\n4[label=\"Node Type: EXPRESSION 4\n\"];\n4->5;\n5[label=\"Node Type: EXPRESSION 5\n\"];\n5->6;\n6[label=\"Node Type: EXPRESSION 6\n\"];\n6->7;\n7[label=\"Node Type: NEW VARIABLE 7\n\"];\n7->8;\n8[label=\"Node Type: EXPRESSION 8\n\"];\n8->9;\n9[label=\"Node Type: EXPRESSION 9\n\"];\n9->10;\n10[label=\"Node Type: NEW VARIABLE 10\n\"];\n10->11;\n11[label=\"Node Type: EXPRESSION 11\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/unchecked-0.8.0.sol-0.8.13-compact.json b/tests/ast-parsing/expected/unchecked-0.8.0.sol-0.8.13-compact.json new file mode 100644 index 000000000..557c3d932 --- /dev/null +++ b/tests/ast-parsing/expected/unchecked-0.8.0.sol-0.8.13-compact.json @@ -0,0 +1,6 @@ +{ + "C": { + "f(uint256,uint256)": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: RETURN 1\n\"];\n}\n", + "g(uint256,uint256)": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: RETURN 1\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/unchecked-0.8.0.sol-0.8.14-compact.json b/tests/ast-parsing/expected/unchecked-0.8.0.sol-0.8.14-compact.json new file mode 100644 index 000000000..557c3d932 --- /dev/null +++ b/tests/ast-parsing/expected/unchecked-0.8.0.sol-0.8.14-compact.json @@ -0,0 +1,6 @@ +{ + "C": { + "f(uint256,uint256)": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: RETURN 1\n\"];\n}\n", + "g(uint256,uint256)": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: RETURN 1\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/unchecked-0.8.0.sol-0.8.15-compact.json b/tests/ast-parsing/expected/unchecked-0.8.0.sol-0.8.15-compact.json new file mode 100644 index 000000000..557c3d932 --- /dev/null +++ b/tests/ast-parsing/expected/unchecked-0.8.0.sol-0.8.15-compact.json @@ -0,0 +1,6 @@ +{ + "C": { + "f(uint256,uint256)": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: RETURN 1\n\"];\n}\n", + "g(uint256,uint256)": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: RETURN 1\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/units_and_global_variables-0.8.0.sol-0.8.13-compact.json b/tests/ast-parsing/expected/units_and_global_variables-0.8.0.sol-0.8.13-compact.json new file mode 100644 index 000000000..74226bae7 --- /dev/null +++ b/tests/ast-parsing/expected/units_and_global_variables-0.8.0.sol-0.8.13-compact.json @@ -0,0 +1,17 @@ +{ + "A": {}, + "I": {}, + "Test": { + "ether_unit()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: EXPRESSION 1\n\"];\n1->2;\n2[label=\"Node Type: EXPRESSION 2\n\"];\n}\n", + "time_unit()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: EXPRESSION 1\n\"];\n1->2;\n2[label=\"Node Type: EXPRESSION 2\n\"];\n2->3;\n3[label=\"Node Type: EXPRESSION 3\n\"];\n3->4;\n4[label=\"Node Type: EXPRESSION 4\n\"];\n4->5;\n5[label=\"Node Type: EXPRESSION 5\n\"];\n}\n", + "block_and_transactions()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: EXPRESSION 1\n\"];\n1->2;\n2[label=\"Node Type: EXPRESSION 2\n\"];\n2->3;\n3[label=\"Node Type: EXPRESSION 3\n\"];\n3->4;\n4[label=\"Node Type: EXPRESSION 4\n\"];\n4->5;\n5[label=\"Node Type: EXPRESSION 5\n\"];\n5->6;\n6[label=\"Node Type: EXPRESSION 6\n\"];\n6->7;\n7[label=\"Node Type: EXPRESSION 7\n\"];\n7->8;\n8[label=\"Node Type: EXPRESSION 8\n\"];\n8->9;\n9[label=\"Node Type: EXPRESSION 9\n\"];\n9->10;\n10[label=\"Node Type: EXPRESSION 10\n\"];\n10->11;\n11[label=\"Node Type: EXPRESSION 11\n\"];\n11->12;\n12[label=\"Node Type: EXPRESSION 12\n\"];\n12->13;\n13[label=\"Node Type: EXPRESSION 13\n\"];\n13->14;\n14[label=\"Node Type: EXPRESSION 14\n\"];\n14->15;\n15[label=\"Node Type: EXPRESSION 15\n\"];\n}\n", + "abi_encode()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: NEW VARIABLE 1\n\"];\n1->2;\n2[label=\"Node Type: EXPRESSION 2\n\"];\n2->3;\n3[label=\"Node Type: EXPRESSION 3\n\"];\n3->4;\n4[label=\"Node Type: EXPRESSION 4\n\"];\n4->5;\n5[label=\"Node Type: NEW VARIABLE 5\n\"];\n5->6;\n6[label=\"Node Type: EXPRESSION 6\n\"];\n6->7;\n7[label=\"Node Type: NEW VARIABLE 7\n\"];\n7->8;\n8[label=\"Node Type: EXPRESSION 8\n\"];\n}\n", + "error_handling()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: EXPRESSION 1\n\"];\n1->2;\n2[label=\"Node Type: EXPRESSION 2\n\"];\n2->3;\n3[label=\"Node Type: EXPRESSION 3\n\"];\n3->4;\n4[label=\"Node Type: EXPRESSION 4\n\"];\n4->5;\n5[label=\"Node Type: EXPRESSION 5\n\"];\n}\n", + "math_and_crypto()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: EXPRESSION 1\n\"];\n1->2;\n2[label=\"Node Type: EXPRESSION 2\n\"];\n2->3;\n3[label=\"Node Type: EXPRESSION 3\n\"];\n3->4;\n4[label=\"Node Type: EXPRESSION 4\n\"];\n4->5;\n5[label=\"Node Type: EXPRESSION 5\n\"];\n5->6;\n6[label=\"Node Type: NEW VARIABLE 6\n\"];\n6->7;\n7[label=\"Node Type: NEW VARIABLE 7\n\"];\n7->8;\n8[label=\"Node Type: NEW VARIABLE 8\n\"];\n8->9;\n9[label=\"Node Type: NEW VARIABLE 9\n\"];\n9->10;\n10[label=\"Node Type: EXPRESSION 10\n\"];\n}\n", + "address_related()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: NEW VARIABLE 1\n\"];\n1->2;\n2[label=\"Node Type: EXPRESSION 2\n\"];\n2->3;\n3[label=\"Node Type: EXPRESSION 3\n\"];\n3->4;\n4[label=\"Node Type: EXPRESSION 4\n\"];\n4->5;\n5[label=\"Node Type: EXPRESSION 5\n\"];\n5->6;\n6[label=\"Node Type: EXPRESSION 6\n\"];\n6->7;\n7[label=\"Node Type: EXPRESSION 7\n\"];\n7->8;\n8[label=\"Node Type: EXPRESSION 8\n\"];\n8->9;\n9[label=\"Node Type: EXPRESSION 9\n\"];\n}\n", + "return_addr()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n", + "address_edge_case()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: EXPRESSION 1\n\"];\n1->2;\n2[label=\"Node Type: EXPRESSION 2\n\"];\n2->3;\n3[label=\"Node Type: EXPRESSION 3\n\"];\n}\n", + "contract_related()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: EXPRESSION 1\n\"];\n1->2;\n2[label=\"Node Type: NEW VARIABLE 2\n\"];\n2->3;\n3[label=\"Node Type: EXPRESSION 3\n\"];\n}\n", + "type_related()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: EXPRESSION 1\n\"];\n1->2;\n2[label=\"Node Type: EXPRESSION 2\n\"];\n2->3;\n3[label=\"Node Type: EXPRESSION 3\n\"];\n3->4;\n4[label=\"Node Type: EXPRESSION 4\n\"];\n4->5;\n5[label=\"Node Type: EXPRESSION 5\n\"];\n5->6;\n6[label=\"Node Type: EXPRESSION 6\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/units_and_global_variables-0.8.0.sol-0.8.14-compact.json b/tests/ast-parsing/expected/units_and_global_variables-0.8.0.sol-0.8.14-compact.json new file mode 100644 index 000000000..74226bae7 --- /dev/null +++ b/tests/ast-parsing/expected/units_and_global_variables-0.8.0.sol-0.8.14-compact.json @@ -0,0 +1,17 @@ +{ + "A": {}, + "I": {}, + "Test": { + "ether_unit()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: EXPRESSION 1\n\"];\n1->2;\n2[label=\"Node Type: EXPRESSION 2\n\"];\n}\n", + "time_unit()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: EXPRESSION 1\n\"];\n1->2;\n2[label=\"Node Type: EXPRESSION 2\n\"];\n2->3;\n3[label=\"Node Type: EXPRESSION 3\n\"];\n3->4;\n4[label=\"Node Type: EXPRESSION 4\n\"];\n4->5;\n5[label=\"Node Type: EXPRESSION 5\n\"];\n}\n", + "block_and_transactions()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: EXPRESSION 1\n\"];\n1->2;\n2[label=\"Node Type: EXPRESSION 2\n\"];\n2->3;\n3[label=\"Node Type: EXPRESSION 3\n\"];\n3->4;\n4[label=\"Node Type: EXPRESSION 4\n\"];\n4->5;\n5[label=\"Node Type: EXPRESSION 5\n\"];\n5->6;\n6[label=\"Node Type: EXPRESSION 6\n\"];\n6->7;\n7[label=\"Node Type: EXPRESSION 7\n\"];\n7->8;\n8[label=\"Node Type: EXPRESSION 8\n\"];\n8->9;\n9[label=\"Node Type: EXPRESSION 9\n\"];\n9->10;\n10[label=\"Node Type: EXPRESSION 10\n\"];\n10->11;\n11[label=\"Node Type: EXPRESSION 11\n\"];\n11->12;\n12[label=\"Node Type: EXPRESSION 12\n\"];\n12->13;\n13[label=\"Node Type: EXPRESSION 13\n\"];\n13->14;\n14[label=\"Node Type: EXPRESSION 14\n\"];\n14->15;\n15[label=\"Node Type: EXPRESSION 15\n\"];\n}\n", + "abi_encode()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: NEW VARIABLE 1\n\"];\n1->2;\n2[label=\"Node Type: EXPRESSION 2\n\"];\n2->3;\n3[label=\"Node Type: EXPRESSION 3\n\"];\n3->4;\n4[label=\"Node Type: EXPRESSION 4\n\"];\n4->5;\n5[label=\"Node Type: NEW VARIABLE 5\n\"];\n5->6;\n6[label=\"Node Type: EXPRESSION 6\n\"];\n6->7;\n7[label=\"Node Type: NEW VARIABLE 7\n\"];\n7->8;\n8[label=\"Node Type: EXPRESSION 8\n\"];\n}\n", + "error_handling()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: EXPRESSION 1\n\"];\n1->2;\n2[label=\"Node Type: EXPRESSION 2\n\"];\n2->3;\n3[label=\"Node Type: EXPRESSION 3\n\"];\n3->4;\n4[label=\"Node Type: EXPRESSION 4\n\"];\n4->5;\n5[label=\"Node Type: EXPRESSION 5\n\"];\n}\n", + "math_and_crypto()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: EXPRESSION 1\n\"];\n1->2;\n2[label=\"Node Type: EXPRESSION 2\n\"];\n2->3;\n3[label=\"Node Type: EXPRESSION 3\n\"];\n3->4;\n4[label=\"Node Type: EXPRESSION 4\n\"];\n4->5;\n5[label=\"Node Type: EXPRESSION 5\n\"];\n5->6;\n6[label=\"Node Type: NEW VARIABLE 6\n\"];\n6->7;\n7[label=\"Node Type: NEW VARIABLE 7\n\"];\n7->8;\n8[label=\"Node Type: NEW VARIABLE 8\n\"];\n8->9;\n9[label=\"Node Type: NEW VARIABLE 9\n\"];\n9->10;\n10[label=\"Node Type: EXPRESSION 10\n\"];\n}\n", + "address_related()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: NEW VARIABLE 1\n\"];\n1->2;\n2[label=\"Node Type: EXPRESSION 2\n\"];\n2->3;\n3[label=\"Node Type: EXPRESSION 3\n\"];\n3->4;\n4[label=\"Node Type: EXPRESSION 4\n\"];\n4->5;\n5[label=\"Node Type: EXPRESSION 5\n\"];\n5->6;\n6[label=\"Node Type: EXPRESSION 6\n\"];\n6->7;\n7[label=\"Node Type: EXPRESSION 7\n\"];\n7->8;\n8[label=\"Node Type: EXPRESSION 8\n\"];\n8->9;\n9[label=\"Node Type: EXPRESSION 9\n\"];\n}\n", + "return_addr()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n", + "address_edge_case()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: EXPRESSION 1\n\"];\n1->2;\n2[label=\"Node Type: EXPRESSION 2\n\"];\n2->3;\n3[label=\"Node Type: EXPRESSION 3\n\"];\n}\n", + "contract_related()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: EXPRESSION 1\n\"];\n1->2;\n2[label=\"Node Type: NEW VARIABLE 2\n\"];\n2->3;\n3[label=\"Node Type: EXPRESSION 3\n\"];\n}\n", + "type_related()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: EXPRESSION 1\n\"];\n1->2;\n2[label=\"Node Type: EXPRESSION 2\n\"];\n2->3;\n3[label=\"Node Type: EXPRESSION 3\n\"];\n3->4;\n4[label=\"Node Type: EXPRESSION 4\n\"];\n4->5;\n5[label=\"Node Type: EXPRESSION 5\n\"];\n5->6;\n6[label=\"Node Type: EXPRESSION 6\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/units_and_global_variables-0.8.0.sol-0.8.15-compact.json b/tests/ast-parsing/expected/units_and_global_variables-0.8.0.sol-0.8.15-compact.json new file mode 100644 index 000000000..74226bae7 --- /dev/null +++ b/tests/ast-parsing/expected/units_and_global_variables-0.8.0.sol-0.8.15-compact.json @@ -0,0 +1,17 @@ +{ + "A": {}, + "I": {}, + "Test": { + "ether_unit()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: EXPRESSION 1\n\"];\n1->2;\n2[label=\"Node Type: EXPRESSION 2\n\"];\n}\n", + "time_unit()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: EXPRESSION 1\n\"];\n1->2;\n2[label=\"Node Type: EXPRESSION 2\n\"];\n2->3;\n3[label=\"Node Type: EXPRESSION 3\n\"];\n3->4;\n4[label=\"Node Type: EXPRESSION 4\n\"];\n4->5;\n5[label=\"Node Type: EXPRESSION 5\n\"];\n}\n", + "block_and_transactions()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: EXPRESSION 1\n\"];\n1->2;\n2[label=\"Node Type: EXPRESSION 2\n\"];\n2->3;\n3[label=\"Node Type: EXPRESSION 3\n\"];\n3->4;\n4[label=\"Node Type: EXPRESSION 4\n\"];\n4->5;\n5[label=\"Node Type: EXPRESSION 5\n\"];\n5->6;\n6[label=\"Node Type: EXPRESSION 6\n\"];\n6->7;\n7[label=\"Node Type: EXPRESSION 7\n\"];\n7->8;\n8[label=\"Node Type: EXPRESSION 8\n\"];\n8->9;\n9[label=\"Node Type: EXPRESSION 9\n\"];\n9->10;\n10[label=\"Node Type: EXPRESSION 10\n\"];\n10->11;\n11[label=\"Node Type: EXPRESSION 11\n\"];\n11->12;\n12[label=\"Node Type: EXPRESSION 12\n\"];\n12->13;\n13[label=\"Node Type: EXPRESSION 13\n\"];\n13->14;\n14[label=\"Node Type: EXPRESSION 14\n\"];\n14->15;\n15[label=\"Node Type: EXPRESSION 15\n\"];\n}\n", + "abi_encode()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: NEW VARIABLE 1\n\"];\n1->2;\n2[label=\"Node Type: EXPRESSION 2\n\"];\n2->3;\n3[label=\"Node Type: EXPRESSION 3\n\"];\n3->4;\n4[label=\"Node Type: EXPRESSION 4\n\"];\n4->5;\n5[label=\"Node Type: NEW VARIABLE 5\n\"];\n5->6;\n6[label=\"Node Type: EXPRESSION 6\n\"];\n6->7;\n7[label=\"Node Type: NEW VARIABLE 7\n\"];\n7->8;\n8[label=\"Node Type: EXPRESSION 8\n\"];\n}\n", + "error_handling()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: EXPRESSION 1\n\"];\n1->2;\n2[label=\"Node Type: EXPRESSION 2\n\"];\n2->3;\n3[label=\"Node Type: EXPRESSION 3\n\"];\n3->4;\n4[label=\"Node Type: EXPRESSION 4\n\"];\n4->5;\n5[label=\"Node Type: EXPRESSION 5\n\"];\n}\n", + "math_and_crypto()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: EXPRESSION 1\n\"];\n1->2;\n2[label=\"Node Type: EXPRESSION 2\n\"];\n2->3;\n3[label=\"Node Type: EXPRESSION 3\n\"];\n3->4;\n4[label=\"Node Type: EXPRESSION 4\n\"];\n4->5;\n5[label=\"Node Type: EXPRESSION 5\n\"];\n5->6;\n6[label=\"Node Type: NEW VARIABLE 6\n\"];\n6->7;\n7[label=\"Node Type: NEW VARIABLE 7\n\"];\n7->8;\n8[label=\"Node Type: NEW VARIABLE 8\n\"];\n8->9;\n9[label=\"Node Type: NEW VARIABLE 9\n\"];\n9->10;\n10[label=\"Node Type: EXPRESSION 10\n\"];\n}\n", + "address_related()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: NEW VARIABLE 1\n\"];\n1->2;\n2[label=\"Node Type: EXPRESSION 2\n\"];\n2->3;\n3[label=\"Node Type: EXPRESSION 3\n\"];\n3->4;\n4[label=\"Node Type: EXPRESSION 4\n\"];\n4->5;\n5[label=\"Node Type: EXPRESSION 5\n\"];\n5->6;\n6[label=\"Node Type: EXPRESSION 6\n\"];\n6->7;\n7[label=\"Node Type: EXPRESSION 7\n\"];\n7->8;\n8[label=\"Node Type: EXPRESSION 8\n\"];\n8->9;\n9[label=\"Node Type: EXPRESSION 9\n\"];\n}\n", + "return_addr()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n", + "address_edge_case()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: EXPRESSION 1\n\"];\n1->2;\n2[label=\"Node Type: EXPRESSION 2\n\"];\n2->3;\n3[label=\"Node Type: EXPRESSION 3\n\"];\n}\n", + "contract_related()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: EXPRESSION 1\n\"];\n1->2;\n2[label=\"Node Type: NEW VARIABLE 2\n\"];\n2->3;\n3[label=\"Node Type: EXPRESSION 3\n\"];\n}\n", + "type_related()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: EXPRESSION 1\n\"];\n1->2;\n2[label=\"Node Type: EXPRESSION 2\n\"];\n2->3;\n3[label=\"Node Type: EXPRESSION 3\n\"];\n3->4;\n4[label=\"Node Type: EXPRESSION 4\n\"];\n4->5;\n5[label=\"Node Type: EXPRESSION 5\n\"];\n5->6;\n6[label=\"Node Type: EXPRESSION 6\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/using-for-0.4.1.sol-0.8.13-compact.json b/tests/ast-parsing/expected/using-for-0.4.1.sol-0.8.13-compact.json new file mode 100644 index 000000000..27fa7c323 --- /dev/null +++ b/tests/ast-parsing/expected/using-for-0.4.1.sol-0.8.13-compact.json @@ -0,0 +1,9 @@ +{ + "L1": { + "f(uint256)": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: RETURN 1\n\"];\n}\n" + }, + "L2": { + "f(bytes32)": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: RETURN 1\n\"];\n}\n" + }, + "C": {} +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/using-for-0.4.1.sol-0.8.14-compact.json b/tests/ast-parsing/expected/using-for-0.4.1.sol-0.8.14-compact.json new file mode 100644 index 000000000..27fa7c323 --- /dev/null +++ b/tests/ast-parsing/expected/using-for-0.4.1.sol-0.8.14-compact.json @@ -0,0 +1,9 @@ +{ + "L1": { + "f(uint256)": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: RETURN 1\n\"];\n}\n" + }, + "L2": { + "f(bytes32)": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: RETURN 1\n\"];\n}\n" + }, + "C": {} +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/using-for-0.4.1.sol-0.8.15-compact.json b/tests/ast-parsing/expected/using-for-0.4.1.sol-0.8.15-compact.json new file mode 100644 index 000000000..27fa7c323 --- /dev/null +++ b/tests/ast-parsing/expected/using-for-0.4.1.sol-0.8.15-compact.json @@ -0,0 +1,9 @@ +{ + "L1": { + "f(uint256)": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: RETURN 1\n\"];\n}\n" + }, + "L2": { + "f(bytes32)": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: RETURN 1\n\"];\n}\n" + }, + "C": {} +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/variable-0.8.0.sol-0.8.13-compact.json b/tests/ast-parsing/expected/variable-0.8.0.sol-0.8.13-compact.json new file mode 100644 index 000000000..97689fda1 --- /dev/null +++ b/tests/ast-parsing/expected/variable-0.8.0.sol-0.8.13-compact.json @@ -0,0 +1,5 @@ +{ + "C": { + "basic()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: NEW VARIABLE 1\n\"];\n1->2;\n2[label=\"Node Type: NEW VARIABLE 2\n\"];\n2->3;\n3[label=\"Node Type: NEW VARIABLE 3\n\"];\n3->4;\n4[label=\"Node Type: NEW VARIABLE 4\n\"];\n4->5;\n5[label=\"Node Type: NEW VARIABLE 5\n\"];\n5->6;\n6[label=\"Node Type: NEW VARIABLE 6\n\"];\n6->7;\n7[label=\"Node Type: NEW VARIABLE 7\n\"];\n7->8;\n8[label=\"Node Type: NEW VARIABLE 8\n\"];\n8->9;\n9[label=\"Node Type: NEW VARIABLE 9\n\"];\n9->10;\n10[label=\"Node Type: NEW VARIABLE 10\n\"];\n10->11;\n11[label=\"Node Type: NEW VARIABLE 11\n\"];\n11->12;\n12[label=\"Node Type: NEW VARIABLE 12\n\"];\n12->13;\n13[label=\"Node Type: NEW VARIABLE 13\n\"];\n13->14;\n14[label=\"Node Type: NEW VARIABLE 14\n\"];\n14->15;\n15[label=\"Node Type: NEW VARIABLE 15\n\"];\n15->16;\n16[label=\"Node Type: NEW VARIABLE 16\n\"];\n16->17;\n17[label=\"Node Type: NEW VARIABLE 17\n\"];\n17->18;\n18[label=\"Node Type: NEW VARIABLE 18\n\"];\n18->19;\n19[label=\"Node Type: NEW VARIABLE 19\n\"];\n19->20;\n20[label=\"Node Type: NEW VARIABLE 20\n\"];\n20->21;\n21[label=\"Node Type: NEW VARIABLE 21\n\"];\n21->22;\n22[label=\"Node Type: NEW VARIABLE 22\n\"];\n22->23;\n23[label=\"Node Type: NEW VARIABLE 23\n\"];\n23->24;\n24[label=\"Node Type: NEW VARIABLE 24\n\"];\n24->25;\n25[label=\"Node Type: NEW VARIABLE 25\n\"];\n25->26;\n26[label=\"Node Type: NEW VARIABLE 26\n\"];\n26->27;\n27[label=\"Node Type: NEW VARIABLE 27\n\"];\n27->28;\n28[label=\"Node Type: NEW VARIABLE 28\n\"];\n28->29;\n29[label=\"Node Type: NEW VARIABLE 29\n\"];\n29->30;\n30[label=\"Node Type: NEW VARIABLE 30\n\"];\n30->31;\n31[label=\"Node Type: NEW VARIABLE 31\n\"];\n31->32;\n32[label=\"Node Type: NEW VARIABLE 32\n\"];\n32->33;\n33[label=\"Node Type: NEW VARIABLE 33\n\"];\n33->34;\n34[label=\"Node Type: NEW VARIABLE 34\n\"];\n34->35;\n35[label=\"Node Type: NEW VARIABLE 35\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/variable-0.8.0.sol-0.8.14-compact.json b/tests/ast-parsing/expected/variable-0.8.0.sol-0.8.14-compact.json new file mode 100644 index 000000000..97689fda1 --- /dev/null +++ b/tests/ast-parsing/expected/variable-0.8.0.sol-0.8.14-compact.json @@ -0,0 +1,5 @@ +{ + "C": { + "basic()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: NEW VARIABLE 1\n\"];\n1->2;\n2[label=\"Node Type: NEW VARIABLE 2\n\"];\n2->3;\n3[label=\"Node Type: NEW VARIABLE 3\n\"];\n3->4;\n4[label=\"Node Type: NEW VARIABLE 4\n\"];\n4->5;\n5[label=\"Node Type: NEW VARIABLE 5\n\"];\n5->6;\n6[label=\"Node Type: NEW VARIABLE 6\n\"];\n6->7;\n7[label=\"Node Type: NEW VARIABLE 7\n\"];\n7->8;\n8[label=\"Node Type: NEW VARIABLE 8\n\"];\n8->9;\n9[label=\"Node Type: NEW VARIABLE 9\n\"];\n9->10;\n10[label=\"Node Type: NEW VARIABLE 10\n\"];\n10->11;\n11[label=\"Node Type: NEW VARIABLE 11\n\"];\n11->12;\n12[label=\"Node Type: NEW VARIABLE 12\n\"];\n12->13;\n13[label=\"Node Type: NEW VARIABLE 13\n\"];\n13->14;\n14[label=\"Node Type: NEW VARIABLE 14\n\"];\n14->15;\n15[label=\"Node Type: NEW VARIABLE 15\n\"];\n15->16;\n16[label=\"Node Type: NEW VARIABLE 16\n\"];\n16->17;\n17[label=\"Node Type: NEW VARIABLE 17\n\"];\n17->18;\n18[label=\"Node Type: NEW VARIABLE 18\n\"];\n18->19;\n19[label=\"Node Type: NEW VARIABLE 19\n\"];\n19->20;\n20[label=\"Node Type: NEW VARIABLE 20\n\"];\n20->21;\n21[label=\"Node Type: NEW VARIABLE 21\n\"];\n21->22;\n22[label=\"Node Type: NEW VARIABLE 22\n\"];\n22->23;\n23[label=\"Node Type: NEW VARIABLE 23\n\"];\n23->24;\n24[label=\"Node Type: NEW VARIABLE 24\n\"];\n24->25;\n25[label=\"Node Type: NEW VARIABLE 25\n\"];\n25->26;\n26[label=\"Node Type: NEW VARIABLE 26\n\"];\n26->27;\n27[label=\"Node Type: NEW VARIABLE 27\n\"];\n27->28;\n28[label=\"Node Type: NEW VARIABLE 28\n\"];\n28->29;\n29[label=\"Node Type: NEW VARIABLE 29\n\"];\n29->30;\n30[label=\"Node Type: NEW VARIABLE 30\n\"];\n30->31;\n31[label=\"Node Type: NEW VARIABLE 31\n\"];\n31->32;\n32[label=\"Node Type: NEW VARIABLE 32\n\"];\n32->33;\n33[label=\"Node Type: NEW VARIABLE 33\n\"];\n33->34;\n34[label=\"Node Type: NEW VARIABLE 34\n\"];\n34->35;\n35[label=\"Node Type: NEW VARIABLE 35\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/variable-0.8.0.sol-0.8.15-compact.json b/tests/ast-parsing/expected/variable-0.8.0.sol-0.8.15-compact.json new file mode 100644 index 000000000..97689fda1 --- /dev/null +++ b/tests/ast-parsing/expected/variable-0.8.0.sol-0.8.15-compact.json @@ -0,0 +1,5 @@ +{ + "C": { + "basic()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: NEW VARIABLE 1\n\"];\n1->2;\n2[label=\"Node Type: NEW VARIABLE 2\n\"];\n2->3;\n3[label=\"Node Type: NEW VARIABLE 3\n\"];\n3->4;\n4[label=\"Node Type: NEW VARIABLE 4\n\"];\n4->5;\n5[label=\"Node Type: NEW VARIABLE 5\n\"];\n5->6;\n6[label=\"Node Type: NEW VARIABLE 6\n\"];\n6->7;\n7[label=\"Node Type: NEW VARIABLE 7\n\"];\n7->8;\n8[label=\"Node Type: NEW VARIABLE 8\n\"];\n8->9;\n9[label=\"Node Type: NEW VARIABLE 9\n\"];\n9->10;\n10[label=\"Node Type: NEW VARIABLE 10\n\"];\n10->11;\n11[label=\"Node Type: NEW VARIABLE 11\n\"];\n11->12;\n12[label=\"Node Type: NEW VARIABLE 12\n\"];\n12->13;\n13[label=\"Node Type: NEW VARIABLE 13\n\"];\n13->14;\n14[label=\"Node Type: NEW VARIABLE 14\n\"];\n14->15;\n15[label=\"Node Type: NEW VARIABLE 15\n\"];\n15->16;\n16[label=\"Node Type: NEW VARIABLE 16\n\"];\n16->17;\n17[label=\"Node Type: NEW VARIABLE 17\n\"];\n17->18;\n18[label=\"Node Type: NEW VARIABLE 18\n\"];\n18->19;\n19[label=\"Node Type: NEW VARIABLE 19\n\"];\n19->20;\n20[label=\"Node Type: NEW VARIABLE 20\n\"];\n20->21;\n21[label=\"Node Type: NEW VARIABLE 21\n\"];\n21->22;\n22[label=\"Node Type: NEW VARIABLE 22\n\"];\n22->23;\n23[label=\"Node Type: NEW VARIABLE 23\n\"];\n23->24;\n24[label=\"Node Type: NEW VARIABLE 24\n\"];\n24->25;\n25[label=\"Node Type: NEW VARIABLE 25\n\"];\n25->26;\n26[label=\"Node Type: NEW VARIABLE 26\n\"];\n26->27;\n27[label=\"Node Type: NEW VARIABLE 27\n\"];\n27->28;\n28[label=\"Node Type: NEW VARIABLE 28\n\"];\n28->29;\n29[label=\"Node Type: NEW VARIABLE 29\n\"];\n29->30;\n30[label=\"Node Type: NEW VARIABLE 30\n\"];\n30->31;\n31[label=\"Node Type: NEW VARIABLE 31\n\"];\n31->32;\n32[label=\"Node Type: NEW VARIABLE 32\n\"];\n32->33;\n33[label=\"Node Type: NEW VARIABLE 33\n\"];\n33->34;\n34[label=\"Node Type: NEW VARIABLE 34\n\"];\n34->35;\n35[label=\"Node Type: NEW VARIABLE 35\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/variabledeclaration-0.5.0.sol-0.8.13-compact.json b/tests/ast-parsing/expected/variabledeclaration-0.5.0.sol-0.8.13-compact.json new file mode 100644 index 000000000..f9182c607 --- /dev/null +++ b/tests/ast-parsing/expected/variabledeclaration-0.5.0.sol-0.8.13-compact.json @@ -0,0 +1,5 @@ +{ + "C": { + "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: NEW VARIABLE 1\n\"];\n1->2;\n2[label=\"Node Type: NEW VARIABLE 2\n\"];\n2->3;\n3[label=\"Node Type: NEW VARIABLE 3\n\"];\n3->4;\n4[label=\"Node Type: NEW VARIABLE 4\n\"];\n4->5;\n5[label=\"Node Type: NEW VARIABLE 5\n\"];\n5->6;\n6[label=\"Node Type: NEW VARIABLE 6\n\"];\n6->7;\n7[label=\"Node Type: NEW VARIABLE 7\n\"];\n7->8;\n8[label=\"Node Type: NEW VARIABLE 8\n\"];\n8->12;\n10[label=\"Node Type: NEW VARIABLE 10\n\"];\n10->11;\n11[label=\"Node Type: NEW VARIABLE 11\n\"];\n12[label=\"Node Type: IF 12\n\"];\n12->13[label=\"True\"];\n12->14[label=\"False\"];\n13[label=\"Node Type: EXPRESSION 13\n\"];\n13->15;\n14[label=\"Node Type: EXPRESSION 14\n\"];\n14->15;\n15[label=\"Node Type: END_IF 15\n\"];\n15->10;\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/variabledeclaration-0.5.0.sol-0.8.14-compact.json b/tests/ast-parsing/expected/variabledeclaration-0.5.0.sol-0.8.14-compact.json new file mode 100644 index 000000000..f9182c607 --- /dev/null +++ b/tests/ast-parsing/expected/variabledeclaration-0.5.0.sol-0.8.14-compact.json @@ -0,0 +1,5 @@ +{ + "C": { + "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: NEW VARIABLE 1\n\"];\n1->2;\n2[label=\"Node Type: NEW VARIABLE 2\n\"];\n2->3;\n3[label=\"Node Type: NEW VARIABLE 3\n\"];\n3->4;\n4[label=\"Node Type: NEW VARIABLE 4\n\"];\n4->5;\n5[label=\"Node Type: NEW VARIABLE 5\n\"];\n5->6;\n6[label=\"Node Type: NEW VARIABLE 6\n\"];\n6->7;\n7[label=\"Node Type: NEW VARIABLE 7\n\"];\n7->8;\n8[label=\"Node Type: NEW VARIABLE 8\n\"];\n8->12;\n10[label=\"Node Type: NEW VARIABLE 10\n\"];\n10->11;\n11[label=\"Node Type: NEW VARIABLE 11\n\"];\n12[label=\"Node Type: IF 12\n\"];\n12->13[label=\"True\"];\n12->14[label=\"False\"];\n13[label=\"Node Type: EXPRESSION 13\n\"];\n13->15;\n14[label=\"Node Type: EXPRESSION 14\n\"];\n14->15;\n15[label=\"Node Type: END_IF 15\n\"];\n15->10;\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/variabledeclaration-0.5.0.sol-0.8.15-compact.json b/tests/ast-parsing/expected/variabledeclaration-0.5.0.sol-0.8.15-compact.json new file mode 100644 index 000000000..f9182c607 --- /dev/null +++ b/tests/ast-parsing/expected/variabledeclaration-0.5.0.sol-0.8.15-compact.json @@ -0,0 +1,5 @@ +{ + "C": { + "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: NEW VARIABLE 1\n\"];\n1->2;\n2[label=\"Node Type: NEW VARIABLE 2\n\"];\n2->3;\n3[label=\"Node Type: NEW VARIABLE 3\n\"];\n3->4;\n4[label=\"Node Type: NEW VARIABLE 4\n\"];\n4->5;\n5[label=\"Node Type: NEW VARIABLE 5\n\"];\n5->6;\n6[label=\"Node Type: NEW VARIABLE 6\n\"];\n6->7;\n7[label=\"Node Type: NEW VARIABLE 7\n\"];\n7->8;\n8[label=\"Node Type: NEW VARIABLE 8\n\"];\n8->12;\n10[label=\"Node Type: NEW VARIABLE 10\n\"];\n10->11;\n11[label=\"Node Type: NEW VARIABLE 11\n\"];\n12[label=\"Node Type: IF 12\n\"];\n12->13[label=\"True\"];\n12->14[label=\"False\"];\n13[label=\"Node Type: EXPRESSION 13\n\"];\n13->15;\n14[label=\"Node Type: EXPRESSION 14\n\"];\n14->15;\n15[label=\"Node Type: END_IF 15\n\"];\n15->10;\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/while-all.sol-0.8.13-compact.json b/tests/ast-parsing/expected/while-all.sol-0.8.13-compact.json new file mode 100644 index 000000000..4d9657391 --- /dev/null +++ b/tests/ast-parsing/expected/while-all.sol-0.8.13-compact.json @@ -0,0 +1,5 @@ +{ + "C": { + "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: NEW VARIABLE 1\n\"];\n1->2;\n2[label=\"Node Type: BEGIN_LOOP 2\n\"];\n2->3;\n3[label=\"Node Type: IF_LOOP 3\n\"];\n3->4[label=\"True\"];\n3->5[label=\"False\"];\n4[label=\"Node Type: EXPRESSION 4\n\"];\n4->3;\n5[label=\"Node Type: END_LOOP 5\n\"];\n5->6;\n6[label=\"Node Type: EXPRESSION 6\n\"];\n6->7;\n7[label=\"Node Type: BEGIN_LOOP 7\n\"];\n7->8;\n8[label=\"Node Type: IF_LOOP 8\n\"];\n8->9[label=\"True\"];\n8->10[label=\"False\"];\n9[label=\"Node Type: EXPRESSION 9\n\"];\n9->8;\n10[label=\"Node Type: END_LOOP 10\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/while-all.sol-0.8.14-compact.json b/tests/ast-parsing/expected/while-all.sol-0.8.14-compact.json new file mode 100644 index 000000000..4d9657391 --- /dev/null +++ b/tests/ast-parsing/expected/while-all.sol-0.8.14-compact.json @@ -0,0 +1,5 @@ +{ + "C": { + "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: NEW VARIABLE 1\n\"];\n1->2;\n2[label=\"Node Type: BEGIN_LOOP 2\n\"];\n2->3;\n3[label=\"Node Type: IF_LOOP 3\n\"];\n3->4[label=\"True\"];\n3->5[label=\"False\"];\n4[label=\"Node Type: EXPRESSION 4\n\"];\n4->3;\n5[label=\"Node Type: END_LOOP 5\n\"];\n5->6;\n6[label=\"Node Type: EXPRESSION 6\n\"];\n6->7;\n7[label=\"Node Type: BEGIN_LOOP 7\n\"];\n7->8;\n8[label=\"Node Type: IF_LOOP 8\n\"];\n8->9[label=\"True\"];\n8->10[label=\"False\"];\n9[label=\"Node Type: EXPRESSION 9\n\"];\n9->8;\n10[label=\"Node Type: END_LOOP 10\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/while-all.sol-0.8.15-compact.json b/tests/ast-parsing/expected/while-all.sol-0.8.15-compact.json new file mode 100644 index 000000000..4d9657391 --- /dev/null +++ b/tests/ast-parsing/expected/while-all.sol-0.8.15-compact.json @@ -0,0 +1,5 @@ +{ + "C": { + "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: NEW VARIABLE 1\n\"];\n1->2;\n2[label=\"Node Type: BEGIN_LOOP 2\n\"];\n2->3;\n3[label=\"Node Type: IF_LOOP 3\n\"];\n3->4[label=\"True\"];\n3->5[label=\"False\"];\n4[label=\"Node Type: EXPRESSION 4\n\"];\n4->3;\n5[label=\"Node Type: END_LOOP 5\n\"];\n5->6;\n6[label=\"Node Type: EXPRESSION 6\n\"];\n6->7;\n7[label=\"Node Type: BEGIN_LOOP 7\n\"];\n7->8;\n8[label=\"Node Type: IF_LOOP 8\n\"];\n8->9[label=\"True\"];\n8->10[label=\"False\"];\n9[label=\"Node Type: EXPRESSION 9\n\"];\n9->8;\n10[label=\"Node Type: END_LOOP 10\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/yul-0.8.0.sol-0.8.13-compact.json b/tests/ast-parsing/expected/yul-0.8.0.sol-0.8.13-compact.json new file mode 100644 index 000000000..c7716d2db --- /dev/null +++ b/tests/ast-parsing/expected/yul-0.8.0.sol-0.8.13-compact.json @@ -0,0 +1,7 @@ +{ + "L": {}, + "C": { + "f(uint256,uint256[])": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: NEW VARIABLE 1\n\"];\n1->2;\n2[label=\"Node Type: NEW VARIABLE 2\n\"];\n2->3;\n3[label=\"Node Type: INLINE ASM 3\n\"];\n3->4;\n4[label=\"Node Type: NEW VARIABLE 4\n\"];\n4->5;\n5[label=\"Node Type: EXPRESSION 5\n\"];\n5->6;\n6[label=\"Node Type: NEW VARIABLE 6\n\"];\n6->7;\n7[label=\"Node Type: EXPRESSION 7\n\"];\n7->8;\n8[label=\"Node Type: NEW VARIABLE 8\n\"];\n8->9;\n9[label=\"Node Type: EXPRESSION 9\n\"];\n9->10;\n10[label=\"Node Type: NEW VARIABLE 10\n\"];\n10->11;\n11[label=\"Node Type: EXPRESSION 11\n\"];\n11->12;\n12[label=\"Node Type: EXPRESSION 12\n\"];\n12->13;\n13[label=\"Node Type: EXPRESSION 13\n\"];\n13->14;\n14[label=\"Node Type: EXPRESSION 14\n\"];\n14->15;\n15[label=\"Node Type: EXPRESSION 15\n\"];\n15->16;\n16[label=\"Node Type: NEW VARIABLE 16\n\"];\n16->17;\n17[label=\"Node Type: EXPRESSION 17\n\"];\n17->18;\n18[label=\"Node Type: NEW VARIABLE 18\n\"];\n18->19;\n19[label=\"Node Type: EXPRESSION 19\n\"];\n19->20;\n20[label=\"Node Type: NEW VARIABLE 20\n\"];\n20->21;\n21[label=\"Node Type: EXPRESSION 21\n\"];\n21->22;\n22[label=\"Node Type: NEW VARIABLE 22\n\"];\n22->23;\n23[label=\"Node Type: EXPRESSION 23\n\"];\n23->24;\n24[label=\"Node Type: EXPRESSION 24\n\"];\n24->25;\n25[label=\"Node Type: EXPRESSION 25\n\"];\n25->26;\n26[label=\"Node Type: EXPRESSION 26\n\"];\n26->27;\n27[label=\"Node Type: EXPRESSION 27\n\"];\n27->28;\n28[label=\"Node Type: NEW VARIABLE 28\n\"];\n28->29;\n29[label=\"Node Type: EXPRESSION 29\n\"];\n}\n", + "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: INLINE ASM 1\n\"];\n1->2;\n2[label=\"Node Type: EXPRESSION 2\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/yul-0.8.0.sol-0.8.14-compact.json b/tests/ast-parsing/expected/yul-0.8.0.sol-0.8.14-compact.json new file mode 100644 index 000000000..c7716d2db --- /dev/null +++ b/tests/ast-parsing/expected/yul-0.8.0.sol-0.8.14-compact.json @@ -0,0 +1,7 @@ +{ + "L": {}, + "C": { + "f(uint256,uint256[])": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: NEW VARIABLE 1\n\"];\n1->2;\n2[label=\"Node Type: NEW VARIABLE 2\n\"];\n2->3;\n3[label=\"Node Type: INLINE ASM 3\n\"];\n3->4;\n4[label=\"Node Type: NEW VARIABLE 4\n\"];\n4->5;\n5[label=\"Node Type: EXPRESSION 5\n\"];\n5->6;\n6[label=\"Node Type: NEW VARIABLE 6\n\"];\n6->7;\n7[label=\"Node Type: EXPRESSION 7\n\"];\n7->8;\n8[label=\"Node Type: NEW VARIABLE 8\n\"];\n8->9;\n9[label=\"Node Type: EXPRESSION 9\n\"];\n9->10;\n10[label=\"Node Type: NEW VARIABLE 10\n\"];\n10->11;\n11[label=\"Node Type: EXPRESSION 11\n\"];\n11->12;\n12[label=\"Node Type: EXPRESSION 12\n\"];\n12->13;\n13[label=\"Node Type: EXPRESSION 13\n\"];\n13->14;\n14[label=\"Node Type: EXPRESSION 14\n\"];\n14->15;\n15[label=\"Node Type: EXPRESSION 15\n\"];\n15->16;\n16[label=\"Node Type: NEW VARIABLE 16\n\"];\n16->17;\n17[label=\"Node Type: EXPRESSION 17\n\"];\n17->18;\n18[label=\"Node Type: NEW VARIABLE 18\n\"];\n18->19;\n19[label=\"Node Type: EXPRESSION 19\n\"];\n19->20;\n20[label=\"Node Type: NEW VARIABLE 20\n\"];\n20->21;\n21[label=\"Node Type: EXPRESSION 21\n\"];\n21->22;\n22[label=\"Node Type: NEW VARIABLE 22\n\"];\n22->23;\n23[label=\"Node Type: EXPRESSION 23\n\"];\n23->24;\n24[label=\"Node Type: EXPRESSION 24\n\"];\n24->25;\n25[label=\"Node Type: EXPRESSION 25\n\"];\n25->26;\n26[label=\"Node Type: EXPRESSION 26\n\"];\n26->27;\n27[label=\"Node Type: EXPRESSION 27\n\"];\n27->28;\n28[label=\"Node Type: NEW VARIABLE 28\n\"];\n28->29;\n29[label=\"Node Type: EXPRESSION 29\n\"];\n}\n", + "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: INLINE ASM 1\n\"];\n1->2;\n2[label=\"Node Type: EXPRESSION 2\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/yul-0.8.0.sol-0.8.15-compact.json b/tests/ast-parsing/expected/yul-0.8.0.sol-0.8.15-compact.json new file mode 100644 index 000000000..c7716d2db --- /dev/null +++ b/tests/ast-parsing/expected/yul-0.8.0.sol-0.8.15-compact.json @@ -0,0 +1,7 @@ +{ + "L": {}, + "C": { + "f(uint256,uint256[])": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: NEW VARIABLE 1\n\"];\n1->2;\n2[label=\"Node Type: NEW VARIABLE 2\n\"];\n2->3;\n3[label=\"Node Type: INLINE ASM 3\n\"];\n3->4;\n4[label=\"Node Type: NEW VARIABLE 4\n\"];\n4->5;\n5[label=\"Node Type: EXPRESSION 5\n\"];\n5->6;\n6[label=\"Node Type: NEW VARIABLE 6\n\"];\n6->7;\n7[label=\"Node Type: EXPRESSION 7\n\"];\n7->8;\n8[label=\"Node Type: NEW VARIABLE 8\n\"];\n8->9;\n9[label=\"Node Type: EXPRESSION 9\n\"];\n9->10;\n10[label=\"Node Type: NEW VARIABLE 10\n\"];\n10->11;\n11[label=\"Node Type: EXPRESSION 11\n\"];\n11->12;\n12[label=\"Node Type: EXPRESSION 12\n\"];\n12->13;\n13[label=\"Node Type: EXPRESSION 13\n\"];\n13->14;\n14[label=\"Node Type: EXPRESSION 14\n\"];\n14->15;\n15[label=\"Node Type: EXPRESSION 15\n\"];\n15->16;\n16[label=\"Node Type: NEW VARIABLE 16\n\"];\n16->17;\n17[label=\"Node Type: EXPRESSION 17\n\"];\n17->18;\n18[label=\"Node Type: NEW VARIABLE 18\n\"];\n18->19;\n19[label=\"Node Type: EXPRESSION 19\n\"];\n19->20;\n20[label=\"Node Type: NEW VARIABLE 20\n\"];\n20->21;\n21[label=\"Node Type: EXPRESSION 21\n\"];\n21->22;\n22[label=\"Node Type: NEW VARIABLE 22\n\"];\n22->23;\n23[label=\"Node Type: EXPRESSION 23\n\"];\n23->24;\n24[label=\"Node Type: EXPRESSION 24\n\"];\n24->25;\n25[label=\"Node Type: EXPRESSION 25\n\"];\n25->26;\n26[label=\"Node Type: EXPRESSION 26\n\"];\n26->27;\n27[label=\"Node Type: EXPRESSION 27\n\"];\n27->28;\n28[label=\"Node Type: NEW VARIABLE 28\n\"];\n28->29;\n29[label=\"Node Type: EXPRESSION 29\n\"];\n}\n", + "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: INLINE ASM 1\n\"];\n1->2;\n2[label=\"Node Type: EXPRESSION 2\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/free_functions/libraries_from_free.sol b/tests/ast-parsing/free_functions/libraries_from_free.sol new file mode 100644 index 000000000..2091ae771 --- /dev/null +++ b/tests/ast-parsing/free_functions/libraries_from_free.sol @@ -0,0 +1,18 @@ +library L { + function pub() public pure returns (uint) { + return 7; + } + function inter() internal pure returns (uint) { + return 8; + } +} + +function fu() pure returns (uint, uint) { + return (L.pub(), L.inter()); +} + +contract C { + function f() public pure returns (uint, uint) { + return fu(); + } +} diff --git a/tests/ast-parsing/free_functions/library_constant_function_collision.sol b/tests/ast-parsing/free_functions/library_constant_function_collision.sol new file mode 100644 index 000000000..8aaa2d788 --- /dev/null +++ b/tests/ast-parsing/free_functions/library_constant_function_collision.sol @@ -0,0 +1,14 @@ +library ExtendedMath { + uint256 constant decimals = 18; +} + +interface IERC20 { + function decimals() external view returns (uint8); +} + +contract A { + using ExtendedMath for *; + function test(address x) public { + uint8 decimals = IERC20(address(x)).decimals(); + } +} diff --git a/tests/ast-parsing/free_functions/new_operator.sol b/tests/ast-parsing/free_functions/new_operator.sol new file mode 100644 index 000000000..4b71d70c9 --- /dev/null +++ b/tests/ast-parsing/free_functions/new_operator.sol @@ -0,0 +1,13 @@ +contract C { + uint public x = 2; +} + +function test() returns (uint) { + return (new C()).x(); +} + +contract D { + function f() public returns (uint) { + return test(); + } +} diff --git a/tests/ast-parsing/minmax-0.6.8.sol b/tests/ast-parsing/minmax-0.6.8.sol index cb22b7d9b..ba5a9e6a9 100644 --- a/tests/ast-parsing/minmax-0.6.8.sol +++ b/tests/ast-parsing/minmax-0.6.8.sol @@ -1,9 +1,13 @@ -contract C{ - function f() public{ - uint a = type(uint).max; +contract MinMax { + uint a = type(uint).max; + uint b = type(uint).min; - } + int constant c = type(int).max; + int constant d = type(int).min; + + uint8 immutable i =type(uint8).max; + uint8 immutable j = type(uint8).min; } diff --git a/tests/ast-parsing/minmax-0.8.8.sol b/tests/ast-parsing/minmax-0.8.8.sol new file mode 100644 index 000000000..dc2f26665 --- /dev/null +++ b/tests/ast-parsing/minmax-0.8.8.sol @@ -0,0 +1,29 @@ +enum Enum { A, B, C, D } + +contract MinMax { + uint a = type(uint).max; + uint b = type(uint).min; + uint c = uint(type(Enum).min); + uint d = uint(type(Enum).max); + + int constant e = type(int).max; + int constant f = type(int).min; + uint constant g = uint(type(Enum).max); + uint constant h = uint(type(Enum).min); + + uint8 immutable i; + uint8 immutable j; + uint immutable k; + uint immutable l; + + constructor() { + i = type(uint8).max; + j = type(uint8).min; + k = uint(type(Enum).max); + l = uint(type(Enum).min); + } + + function min() public returns(uint) { return uint(type(Enum).min); } + function max() public returns(uint) { return uint(type(Enum).max); } +} + diff --git a/tests/check-kspec/test_1.txt b/tests/check-kspec/test_1.txt index ed0482c87..d93356685 100644 --- a/tests/check-kspec/test_1.txt +++ b/tests/check-kspec/test_1.txt @@ -1,7 +1,7 @@ ## Check for functions coverage -[✓] SafeAdd.add(uint256,uint256) - -[ ] (Missing function) SafeAdd.add_v2(uint256,uint256) - -[ ] (Unresolved) SafeAdd.addv2(uint256,uint256) - +[✓] SafeAdd.add(uint256,uint256) + +[ ] (Missing function) SafeAdd.add_v2(uint256,uint256) + +[ ] (Unresolved) SafeAdd.addv2(uint256,uint256) + diff --git a/tests/check-upgradeability/test_1.txt b/tests/check-upgradeability/test_1.txt index 5681c4619..48d8484a7 100644 --- a/tests/check-upgradeability/test_1.txt +++ b/tests/check-upgradeability/test_1.txt @@ -1,4 +1,4 @@ -INFO:Slither: +INFO:Slither: Initializable contract not found, the contract does not follow a standard initalization schema. -Reference: https://github.com/crytic/slither/wiki/Upgradeability-Checks#initializable-is-missing +Reference: https://github.com/crytic/slither/wiki/Upgradeability-Checks#initializable-is-missing INFO:Slither:1 findings, 12 detectors run diff --git a/tests/check-upgradeability/test_10.txt b/tests/check-upgradeability/test_10.txt index 1e0f99584..1527735c5 100644 --- a/tests/check-upgradeability/test_10.txt +++ b/tests/check-upgradeability/test_10.txt @@ -1,13 +1,13 @@ -INFO:Slither: +INFO:Slither: Initializable contract not found, the contract does not follow a standard initalization schema. -Reference: https://github.com/crytic/slither/wiki/Upgradeability-Checks#initializable-is-missing -INFO:Slither: +Reference: https://github.com/crytic/slither/wiki/Upgradeability-Checks#initializable-is-missing +INFO:Slither: ContractV1.destination (tests/check-upgradeability/contractV1.sol#2) was not constant but ContractV2.destination (tests/check-upgradeability/contract_v2_constant.sol#2) is. -Reference: https://github.com/crytic/slither/wiki/Upgradeability-Checks#variables-that-should-not-be-constant -INFO:Slither: +Reference: https://github.com/crytic/slither/wiki/Upgradeability-Checks#variables-that-should-not-be-constant +INFO:Slither: Variable missing in ContractV2 (tests/check-upgradeability/contract_v2_constant.sol#1-3): ContractV1.destination (tests/check-upgradeability/contractV1.sol#2) -Reference: https://github.com/crytic/slither/wiki/Upgradeability-Checks#missing-variables -INFO:Slither: +Reference: https://github.com/crytic/slither/wiki/Upgradeability-Checks#missing-variables +INFO:Slither: Initializable contract not found, the contract does not follow a standard initalization schema. -Reference: https://github.com/crytic/slither/wiki/Upgradeability-Checks#initializable-is-missing +Reference: https://github.com/crytic/slither/wiki/Upgradeability-Checks#initializable-is-missing INFO:Slither:4 findings, 18 detectors run diff --git a/tests/check-upgradeability/test_11.txt b/tests/check-upgradeability/test_11.txt index f6e8009f5..e2ad677b1 100644 --- a/tests/check-upgradeability/test_11.txt +++ b/tests/check-upgradeability/test_11.txt @@ -1,7 +1,7 @@ -INFO:Slither: +INFO:Slither: Initializable contract not found, the contract does not follow a standard initalization schema. -Reference: https://github.com/crytic/slither/wiki/Upgradeability-Checks#initializable-is-missing -INFO:Slither: +Reference: https://github.com/crytic/slither/wiki/Upgradeability-Checks#initializable-is-missing +INFO:Slither: ContractV1.destination (tests/check-upgradeability/contract_v1_var_init.sol#2) is a state variable with an initial value. -Reference: https://github.com/crytic/slither/wiki/Upgradeability-Checks#state-variable-initialized +Reference: https://github.com/crytic/slither/wiki/Upgradeability-Checks#state-variable-initialized INFO:Slither:2 findings, 8 detectors run diff --git a/tests/check-upgradeability/test_2.txt b/tests/check-upgradeability/test_2.txt index ecff55f48..7641e8335 100644 --- a/tests/check-upgradeability/test_2.txt +++ b/tests/check-upgradeability/test_2.txt @@ -1,7 +1,7 @@ -INFO:Slither: +INFO:Slither: Initializable contract not found, the contract does not follow a standard initalization schema. -Reference: https://github.com/crytic/slither/wiki/Upgradeability-Checks#initializable-is-missing -INFO:Slither: +Reference: https://github.com/crytic/slither/wiki/Upgradeability-Checks#initializable-is-missing +INFO:Slither: Initializable contract not found, the contract does not follow a standard initalization schema. -Reference: https://github.com/crytic/slither/wiki/Upgradeability-Checks#initializable-is-missing +Reference: https://github.com/crytic/slither/wiki/Upgradeability-Checks#initializable-is-missing INFO:Slither:2 findings, 22 detectors run diff --git a/tests/check-upgradeability/test_3.txt b/tests/check-upgradeability/test_3.txt index 8b40490a8..b3c7c0a15 100644 --- a/tests/check-upgradeability/test_3.txt +++ b/tests/check-upgradeability/test_3.txt @@ -1,23 +1,23 @@ -INFO:Slither: +INFO:Slither: Initializable contract not found, the contract does not follow a standard initalization schema. -Reference: https://github.com/crytic/slither/wiki/Upgradeability-Checks#initializable-is-missing -INFO:Slither: +Reference: https://github.com/crytic/slither/wiki/Upgradeability-Checks#initializable-is-missing +INFO:Slither: Different variables between ContractV2 (tests/check-upgradeability/contractV2_bug.sol#1-5) and Proxy (tests/check-upgradeability/proxy.sol#7-27) ContractV2.destination (tests/check-upgradeability/contractV2_bug.sol#2) Proxy.destination (tests/check-upgradeability/proxy.sol#9) -Reference: https://github.com/crytic/slither/wiki/Upgradeability-Checks#incorrect-variables-with-the-proxy -INFO:Slither: +Reference: https://github.com/crytic/slither/wiki/Upgradeability-Checks#incorrect-variables-with-the-proxy +INFO:Slither: Function shadowing found: ContractV2.myFunc (tests/check-upgradeability/contractV2_bug.sol#4) Proxy.myFunc() (tests/check-upgradeability/proxy.sol#11) -Reference: https://github.com/crytic/slither/wiki/Upgradeability-Checks#functions-shadowing -INFO:Slither: +Reference: https://github.com/crytic/slither/wiki/Upgradeability-Checks#functions-shadowing +INFO:Slither: Different variables between ContractV1 (tests/check-upgradeability/contractV1.sol#1-3) and ContractV2 (tests/check-upgradeability/contractV2_bug.sol#1-5) ContractV1.destination (tests/check-upgradeability/contractV1.sol#2) ContractV2.destination (tests/check-upgradeability/contractV2_bug.sol#2) -Reference: https://github.com/crytic/slither/wiki/Upgradeability-Checks#incorrect-variables-with-the-v2 -INFO:Slither: +Reference: https://github.com/crytic/slither/wiki/Upgradeability-Checks#incorrect-variables-with-the-v2 +INFO:Slither: Extra variables in ContractV2 (tests/check-upgradeability/contractV2_bug.sol#1-5): ContractV2.myFunc (tests/check-upgradeability/contractV2_bug.sol#4) -Reference: https://github.com/crytic/slither/wiki/Upgradeability-Checks#extra-variables-in-the-v2 -INFO:Slither: +Reference: https://github.com/crytic/slither/wiki/Upgradeability-Checks#extra-variables-in-the-v2 +INFO:Slither: Initializable contract not found, the contract does not follow a standard initalization schema. -Reference: https://github.com/crytic/slither/wiki/Upgradeability-Checks#initializable-is-missing +Reference: https://github.com/crytic/slither/wiki/Upgradeability-Checks#initializable-is-missing INFO:Slither:6 findings, 22 detectors run diff --git a/tests/check-upgradeability/test_4.txt b/tests/check-upgradeability/test_4.txt index 7411e06cb..4e32dc904 100644 --- a/tests/check-upgradeability/test_4.txt +++ b/tests/check-upgradeability/test_4.txt @@ -1,20 +1,20 @@ -INFO:Slither: +INFO:Slither: Initializable contract not found, the contract does not follow a standard initalization schema. -Reference: https://github.com/crytic/slither/wiki/Upgradeability-Checks#initializable-is-missing -INFO:Slither: +Reference: https://github.com/crytic/slither/wiki/Upgradeability-Checks#initializable-is-missing +INFO:Slither: Different variables between ContractV2 (tests/check-upgradeability/contractV2_bug2.sol#4-6) and Proxy (tests/check-upgradeability/proxy.sol#7-27) Base.val (tests/check-upgradeability/contractV2_bug2.sol#2) Proxy.destination (tests/check-upgradeability/proxy.sol#9) -Reference: https://github.com/crytic/slither/wiki/Upgradeability-Checks#incorrect-variables-with-the-proxy -INFO:Slither: +Reference: https://github.com/crytic/slither/wiki/Upgradeability-Checks#incorrect-variables-with-the-proxy +INFO:Slither: Different variables between ContractV1 (tests/check-upgradeability/contractV1.sol#1-3) and ContractV2 (tests/check-upgradeability/contractV2_bug2.sol#4-6) ContractV1.destination (tests/check-upgradeability/contractV1.sol#2) Base.val (tests/check-upgradeability/contractV2_bug2.sol#2) -Reference: https://github.com/crytic/slither/wiki/Upgradeability-Checks#incorrect-variables-with-the-v2 -INFO:Slither: +Reference: https://github.com/crytic/slither/wiki/Upgradeability-Checks#incorrect-variables-with-the-v2 +INFO:Slither: Extra variables in ContractV2 (tests/check-upgradeability/contractV2_bug2.sol#4-6): ContractV2.destination (tests/check-upgradeability/contractV2_bug2.sol#5) -Reference: https://github.com/crytic/slither/wiki/Upgradeability-Checks#extra-variables-in-the-v2 -INFO:Slither: +Reference: https://github.com/crytic/slither/wiki/Upgradeability-Checks#extra-variables-in-the-v2 +INFO:Slither: Initializable contract not found, the contract does not follow a standard initalization schema. -Reference: https://github.com/crytic/slither/wiki/Upgradeability-Checks#initializable-is-missing +Reference: https://github.com/crytic/slither/wiki/Upgradeability-Checks#initializable-is-missing INFO:Slither:5 findings, 22 detectors run diff --git a/tests/check-upgradeability/test_5.txt b/tests/check-upgradeability/test_5.txt index 99bdf0bab..805602ee4 100644 --- a/tests/check-upgradeability/test_5.txt +++ b/tests/check-upgradeability/test_5.txt @@ -1,4 +1,4 @@ -INFO:Slither: +INFO:Slither: Contract_no_bug (tests/check-upgradeability/contract_initialization.sol#11-17) needs to be initialized by Contract_no_bug.initialize() (tests/check-upgradeability/contract_initialization.sol#13-15). -Reference: https://github.com/crytic/slither/wiki/Upgradeability-Checks#initialize-function +Reference: https://github.com/crytic/slither/wiki/Upgradeability-Checks#initialize-function INFO:Slither:1 findings, 12 detectors run diff --git a/tests/check-upgradeability/test_6.txt b/tests/check-upgradeability/test_6.txt index 842708b8f..663cb62d0 100644 --- a/tests/check-upgradeability/test_6.txt +++ b/tests/check-upgradeability/test_6.txt @@ -1,7 +1,7 @@ -INFO:Slither: +INFO:Slither: Contract_lack_to_call_modifier (tests/check-upgradeability/contract_initialization.sol#19-24) needs to be initialized by Contract_lack_to_call_modifier.initialize() (tests/check-upgradeability/contract_initialization.sol#21-23). -Reference: https://github.com/crytic/slither/wiki/Upgradeability-Checks#initialize-function -INFO:Slither: +Reference: https://github.com/crytic/slither/wiki/Upgradeability-Checks#initialize-function +INFO:Slither: Contract_lack_to_call_modifier.initialize() (tests/check-upgradeability/contract_initialization.sol#21-23) does not call the initializer modifier. -Reference: https://github.com/crytic/slither/wiki/Upgradeability-Checks#initializer-is-not-called +Reference: https://github.com/crytic/slither/wiki/Upgradeability-Checks#initializer-is-not-called INFO:Slither:2 findings, 12 detectors run diff --git a/tests/check-upgradeability/test_7.txt b/tests/check-upgradeability/test_7.txt index 160cd95e4..9f232338e 100644 --- a/tests/check-upgradeability/test_7.txt +++ b/tests/check-upgradeability/test_7.txt @@ -1,7 +1,7 @@ -INFO:Slither: +INFO:Slither: Contract_not_called_super_init (tests/check-upgradeability/contract_initialization.sol#26-32) needs to be initialized by Contract_not_called_super_init.initialize() (tests/check-upgradeability/contract_initialization.sol#28-30). -Reference: https://github.com/crytic/slither/wiki/Upgradeability-Checks#initialize-function -INFO:Slither: +Reference: https://github.com/crytic/slither/wiki/Upgradeability-Checks#initialize-function +INFO:Slither: Missing call to Contract_no_bug.initialize() (tests/check-upgradeability/contract_initialization.sol#13-15) in Contract_not_called_super_init.initialize() (tests/check-upgradeability/contract_initialization.sol#28-30). -Reference: https://github.com/crytic/slither/wiki/Upgradeability-Checks#initialize-functions-are-not-called +Reference: https://github.com/crytic/slither/wiki/Upgradeability-Checks#initialize-functions-are-not-called INFO:Slither:2 findings, 12 detectors run diff --git a/tests/check-upgradeability/test_8.txt b/tests/check-upgradeability/test_8.txt index 6a7debd30..38c71e28c 100644 --- a/tests/check-upgradeability/test_8.txt +++ b/tests/check-upgradeability/test_8.txt @@ -1,4 +1,4 @@ -INFO:Slither: +INFO:Slither: Contract_no_bug_inherits (tests/check-upgradeability/contract_initialization.sol#34-40) needs to be initialized by Contract_no_bug_inherits.initialize() (tests/check-upgradeability/contract_initialization.sol#36-38). -Reference: https://github.com/crytic/slither/wiki/Upgradeability-Checks#initialize-function +Reference: https://github.com/crytic/slither/wiki/Upgradeability-Checks#initialize-function INFO:Slither:1 findings, 12 detectors run diff --git a/tests/check-upgradeability/test_9.txt b/tests/check-upgradeability/test_9.txt index 9c2fa353e..a67578a08 100644 --- a/tests/check-upgradeability/test_9.txt +++ b/tests/check-upgradeability/test_9.txt @@ -1,7 +1,7 @@ -INFO:Slither: +INFO:Slither: Contract_double_call (tests/check-upgradeability/contract_initialization.sol#42-49) needs to be initialized by Contract_double_call.initialize() (tests/check-upgradeability/contract_initialization.sol#44-47). -Reference: https://github.com/crytic/slither/wiki/Upgradeability-Checks#initialize-function -INFO:Slither: +Reference: https://github.com/crytic/slither/wiki/Upgradeability-Checks#initialize-function +INFO:Slither: Contract_no_bug.initialize() (tests/check-upgradeability/contract_initialization.sol#13-15) is called multiple times in Contract_double_call.initialize() (tests/check-upgradeability/contract_initialization.sol#44-47). -Reference: https://github.com/crytic/slither/wiki/Upgradeability-Checks#initialize-functions-are-called-multiple-times +Reference: https://github.com/crytic/slither/wiki/Upgradeability-Checks#initialize-functions-are-called-multiple-times INFO:Slither:2 findings, 12 detectors run diff --git a/tests/detectors/arbitrary-send-erc20-permit/0.4.25/arbitrary_send_erc20_permit.sol b/tests/detectors/arbitrary-send-erc20-permit/0.4.25/arbitrary_send_erc20_permit.sol new file mode 100644 index 000000000..4cc6bbe55 --- /dev/null +++ b/tests/detectors/arbitrary-send-erc20-permit/0.4.25/arbitrary_send_erc20_permit.sol @@ -0,0 +1,57 @@ +pragma solidity 0.4.25; + +library SafeERC20 { + function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {} +} + +interface IERC20 { + function transferFrom(address, address, uint256) external returns(bool); + function permit(address, address, uint256, uint256, uint8, bytes32, bytes32) external; +} + +contract ERC20 is IERC20 { + function transferFrom(address from, address to, uint256 amount) external returns(bool) { + return true; + } + function permit(address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) external {} +} + +contract C { + using SafeERC20 for IERC20; + + IERC20 erc20; + address notsend; + address send; + + constructor() public { + erc20 = new ERC20(); + notsend = address(0x3); + send = msg.sender; + } + + function bad1(address from, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s, address to) public { + erc20.permit(from, address(this), value, deadline, v, r, s); + erc20.transferFrom(from, to, value); + } + + // This is not detected + function bad2(address from, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s, address to) public { + int_transferFrom(from,value, deadline, v, r, s, to); + } + + function int_transferFrom(address from, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s, address to) internal { + erc20.permit(from, address(this), value, deadline, v, r, s); + erc20.transferFrom(from, to, value); + } + + function bad3(address from, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s, address to) external { + erc20.permit(from, address(this), value, deadline, v, r, s); + erc20.safeTransferFrom(from, to, value); + } + + function bad4(address from, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s, address to) external { + erc20.permit(from, address(this), value, deadline, v, r, s); + SafeERC20.safeTransferFrom(erc20, from, to, value); + } + +} diff --git a/tests/detectors/arbitrary-send-erc20-permit/0.4.25/arbitrary_send_erc20_permit.sol.0.4.25.ArbitrarySendErc20Permit.json b/tests/detectors/arbitrary-send-erc20-permit/0.4.25/arbitrary_send_erc20_permit.sol.0.4.25.ArbitrarySendErc20Permit.json new file mode 100644 index 000000000..e8486f5e1 --- /dev/null +++ b/tests/detectors/arbitrary-send-erc20-permit/0.4.25/arbitrary_send_erc20_permit.sol.0.4.25.ArbitrarySendErc20Permit.json @@ -0,0 +1,768 @@ +[ + [ + { + "elements": [ + { + "type": "function", + "name": "bad4", + "source_mapping": { + "start": 1794, + "length": 249, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/arbitrary-send-erc20-permit/0.4.25/arbitrary_send_erc20_permit.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/arbitrary-send-erc20-permit/0.4.25/arbitrary_send_erc20_permit.sol", + "is_dependency": false, + "lines": [ + 52, + 53, + 54, + 55 + ], + "starting_column": 5, + "ending_column": 6 + }, + "type_specific_fields": { + "parent": { + "type": "contract", + "name": "C", + "source_mapping": { + "start": 613, + "length": 1433, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/arbitrary-send-erc20-permit/0.4.25/arbitrary_send_erc20_permit.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/arbitrary-send-erc20-permit/0.4.25/arbitrary_send_erc20_permit.sol", + "is_dependency": false, + "lines": [ + 19, + 20, + 21, + 22, + 23, + 24, + 25, + 26, + 27, + 28, + 29, + 30, + 31, + 32, + 33, + 34, + 35, + 36, + 37, + 38, + 39, + 40, + 41, + 42, + 43, + 44, + 45, + 46, + 47, + 48, + 49, + 50, + 51, + 52, + 53, + 54, + 55, + 56, + 57 + ], + "starting_column": 1, + "ending_column": 2 + } + }, + "signature": "bad4(address,uint256,uint256,uint8,bytes32,bytes32,address)" + } + }, + { + "type": "node", + "name": "SafeERC20.safeTransferFrom(erc20,from,to,value)", + "source_mapping": { + "start": 1986, + "length": 50, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/arbitrary-send-erc20-permit/0.4.25/arbitrary_send_erc20_permit.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/arbitrary-send-erc20-permit/0.4.25/arbitrary_send_erc20_permit.sol", + "is_dependency": false, + "lines": [ + 54 + ], + "starting_column": 9, + "ending_column": 59 + }, + "type_specific_fields": { + "parent": { + "type": "function", + "name": "bad4", + "source_mapping": { + "start": 1794, + "length": 249, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/arbitrary-send-erc20-permit/0.4.25/arbitrary_send_erc20_permit.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/arbitrary-send-erc20-permit/0.4.25/arbitrary_send_erc20_permit.sol", + "is_dependency": false, + "lines": [ + 52, + 53, + 54, + 55 + ], + "starting_column": 5, + "ending_column": 6 + }, + "type_specific_fields": { + "parent": { + "type": "contract", + "name": "C", + "source_mapping": { + "start": 613, + "length": 1433, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/arbitrary-send-erc20-permit/0.4.25/arbitrary_send_erc20_permit.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/arbitrary-send-erc20-permit/0.4.25/arbitrary_send_erc20_permit.sol", + "is_dependency": false, + "lines": [ + 19, + 20, + 21, + 22, + 23, + 24, + 25, + 26, + 27, + 28, + 29, + 30, + 31, + 32, + 33, + 34, + 35, + 36, + 37, + 38, + 39, + 40, + 41, + 42, + 43, + 44, + 45, + 46, + 47, + 48, + 49, + 50, + 51, + 52, + 53, + 54, + 55, + 56, + 57 + ], + "starting_column": 1, + "ending_column": 2 + } + }, + "signature": "bad4(address,uint256,uint256,uint8,bytes32,bytes32,address)" + } + } + } + } + ], + "description": "C.bad4(address,uint256,uint256,uint8,bytes32,bytes32,address) (tests/detectors/arbitrary-send-erc20-permit/0.4.25/arbitrary_send_erc20_permit.sol#52-55) uses arbitrary from in transferFrom in combination with permit: SafeERC20.safeTransferFrom(erc20,from,to,value) (tests/detectors/arbitrary-send-erc20-permit/0.4.25/arbitrary_send_erc20_permit.sol#54)\n", + "markdown": "[C.bad4(address,uint256,uint256,uint8,bytes32,bytes32,address)](tests/detectors/arbitrary-send-erc20-permit/0.4.25/arbitrary_send_erc20_permit.sol#L52-L55) uses arbitrary from in transferFrom in combination with permit: [SafeERC20.safeTransferFrom(erc20,from,to,value)](tests/detectors/arbitrary-send-erc20-permit/0.4.25/arbitrary_send_erc20_permit.sol#L54)\n", + "first_markdown_element": "tests/detectors/arbitrary-send-erc20-permit/0.4.25/arbitrary_send_erc20_permit.sol#L52-L55", + "id": "22de0efa869fce1767af15469c8bcc95616478aec05625ab72283df0ad9fae55", + "check": "arbitrary-send-erc20-permit", + "impact": "High", + "confidence": "Medium" + }, + { + "elements": [ + { + "type": "function", + "name": "int_transferFrom", + "source_mapping": { + "start": 1294, + "length": 246, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/arbitrary-send-erc20-permit/0.4.25/arbitrary_send_erc20_permit.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/arbitrary-send-erc20-permit/0.4.25/arbitrary_send_erc20_permit.sol", + "is_dependency": false, + "lines": [ + 42, + 43, + 44, + 45 + ], + "starting_column": 5, + "ending_column": 6 + }, + "type_specific_fields": { + "parent": { + "type": "contract", + "name": "C", + "source_mapping": { + "start": 613, + "length": 1433, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/arbitrary-send-erc20-permit/0.4.25/arbitrary_send_erc20_permit.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/arbitrary-send-erc20-permit/0.4.25/arbitrary_send_erc20_permit.sol", + "is_dependency": false, + "lines": [ + 19, + 20, + 21, + 22, + 23, + 24, + 25, + 26, + 27, + 28, + 29, + 30, + 31, + 32, + 33, + 34, + 35, + 36, + 37, + 38, + 39, + 40, + 41, + 42, + 43, + 44, + 45, + 46, + 47, + 48, + 49, + 50, + 51, + 52, + 53, + 54, + 55, + 56, + 57 + ], + "starting_column": 1, + "ending_column": 2 + } + }, + "signature": "int_transferFrom(address,uint256,uint256,uint8,bytes32,bytes32,address)" + } + }, + { + "type": "node", + "name": "erc20.transferFrom(from,to,value)", + "source_mapping": { + "start": 1498, + "length": 35, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/arbitrary-send-erc20-permit/0.4.25/arbitrary_send_erc20_permit.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/arbitrary-send-erc20-permit/0.4.25/arbitrary_send_erc20_permit.sol", + "is_dependency": false, + "lines": [ + 44 + ], + "starting_column": 9, + "ending_column": 44 + }, + "type_specific_fields": { + "parent": { + "type": "function", + "name": "int_transferFrom", + "source_mapping": { + "start": 1294, + "length": 246, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/arbitrary-send-erc20-permit/0.4.25/arbitrary_send_erc20_permit.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/arbitrary-send-erc20-permit/0.4.25/arbitrary_send_erc20_permit.sol", + "is_dependency": false, + "lines": [ + 42, + 43, + 44, + 45 + ], + "starting_column": 5, + "ending_column": 6 + }, + "type_specific_fields": { + "parent": { + "type": "contract", + "name": "C", + "source_mapping": { + "start": 613, + "length": 1433, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/arbitrary-send-erc20-permit/0.4.25/arbitrary_send_erc20_permit.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/arbitrary-send-erc20-permit/0.4.25/arbitrary_send_erc20_permit.sol", + "is_dependency": false, + "lines": [ + 19, + 20, + 21, + 22, + 23, + 24, + 25, + 26, + 27, + 28, + 29, + 30, + 31, + 32, + 33, + 34, + 35, + 36, + 37, + 38, + 39, + 40, + 41, + 42, + 43, + 44, + 45, + 46, + 47, + 48, + 49, + 50, + 51, + 52, + 53, + 54, + 55, + 56, + 57 + ], + "starting_column": 1, + "ending_column": 2 + } + }, + "signature": "int_transferFrom(address,uint256,uint256,uint8,bytes32,bytes32,address)" + } + } + } + } + ], + "description": "C.int_transferFrom(address,uint256,uint256,uint8,bytes32,bytes32,address) (tests/detectors/arbitrary-send-erc20-permit/0.4.25/arbitrary_send_erc20_permit.sol#42-45) uses arbitrary from in transferFrom in combination with permit: erc20.transferFrom(from,to,value) (tests/detectors/arbitrary-send-erc20-permit/0.4.25/arbitrary_send_erc20_permit.sol#44)\n", + "markdown": "[C.int_transferFrom(address,uint256,uint256,uint8,bytes32,bytes32,address)](tests/detectors/arbitrary-send-erc20-permit/0.4.25/arbitrary_send_erc20_permit.sol#L42-L45) uses arbitrary from in transferFrom in combination with permit: [erc20.transferFrom(from,to,value)](tests/detectors/arbitrary-send-erc20-permit/0.4.25/arbitrary_send_erc20_permit.sol#L44)\n", + "first_markdown_element": "tests/detectors/arbitrary-send-erc20-permit/0.4.25/arbitrary_send_erc20_permit.sol#L42-L45", + "id": "408ea319adfb46be330fd7775c13abf56f9d106eebcbcfe6574760309d93927e", + "check": "arbitrary-send-erc20-permit", + "impact": "High", + "confidence": "Medium" + }, + { + "elements": [ + { + "type": "function", + "name": "bad1", + "source_mapping": { + "start": 843, + "length": 232, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/arbitrary-send-erc20-permit/0.4.25/arbitrary_send_erc20_permit.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/arbitrary-send-erc20-permit/0.4.25/arbitrary_send_erc20_permit.sol", + "is_dependency": false, + "lines": [ + 32, + 33, + 34, + 35 + ], + "starting_column": 5, + "ending_column": 6 + }, + "type_specific_fields": { + "parent": { + "type": "contract", + "name": "C", + "source_mapping": { + "start": 613, + "length": 1433, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/arbitrary-send-erc20-permit/0.4.25/arbitrary_send_erc20_permit.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/arbitrary-send-erc20-permit/0.4.25/arbitrary_send_erc20_permit.sol", + "is_dependency": false, + "lines": [ + 19, + 20, + 21, + 22, + 23, + 24, + 25, + 26, + 27, + 28, + 29, + 30, + 31, + 32, + 33, + 34, + 35, + 36, + 37, + 38, + 39, + 40, + 41, + 42, + 43, + 44, + 45, + 46, + 47, + 48, + 49, + 50, + 51, + 52, + 53, + 54, + 55, + 56, + 57 + ], + "starting_column": 1, + "ending_column": 2 + } + }, + "signature": "bad1(address,uint256,uint256,uint8,bytes32,bytes32,address)" + } + }, + { + "type": "node", + "name": "erc20.transferFrom(from,to,value)", + "source_mapping": { + "start": 1033, + "length": 35, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/arbitrary-send-erc20-permit/0.4.25/arbitrary_send_erc20_permit.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/arbitrary-send-erc20-permit/0.4.25/arbitrary_send_erc20_permit.sol", + "is_dependency": false, + "lines": [ + 34 + ], + "starting_column": 9, + "ending_column": 44 + }, + "type_specific_fields": { + "parent": { + "type": "function", + "name": "bad1", + "source_mapping": { + "start": 843, + "length": 232, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/arbitrary-send-erc20-permit/0.4.25/arbitrary_send_erc20_permit.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/arbitrary-send-erc20-permit/0.4.25/arbitrary_send_erc20_permit.sol", + "is_dependency": false, + "lines": [ + 32, + 33, + 34, + 35 + ], + "starting_column": 5, + "ending_column": 6 + }, + "type_specific_fields": { + "parent": { + "type": "contract", + "name": "C", + "source_mapping": { + "start": 613, + "length": 1433, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/arbitrary-send-erc20-permit/0.4.25/arbitrary_send_erc20_permit.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/arbitrary-send-erc20-permit/0.4.25/arbitrary_send_erc20_permit.sol", + "is_dependency": false, + "lines": [ + 19, + 20, + 21, + 22, + 23, + 24, + 25, + 26, + 27, + 28, + 29, + 30, + 31, + 32, + 33, + 34, + 35, + 36, + 37, + 38, + 39, + 40, + 41, + 42, + 43, + 44, + 45, + 46, + 47, + 48, + 49, + 50, + 51, + 52, + 53, + 54, + 55, + 56, + 57 + ], + "starting_column": 1, + "ending_column": 2 + } + }, + "signature": "bad1(address,uint256,uint256,uint8,bytes32,bytes32,address)" + } + } + } + } + ], + "description": "C.bad1(address,uint256,uint256,uint8,bytes32,bytes32,address) (tests/detectors/arbitrary-send-erc20-permit/0.4.25/arbitrary_send_erc20_permit.sol#32-35) uses arbitrary from in transferFrom in combination with permit: erc20.transferFrom(from,to,value) (tests/detectors/arbitrary-send-erc20-permit/0.4.25/arbitrary_send_erc20_permit.sol#34)\n", + "markdown": "[C.bad1(address,uint256,uint256,uint8,bytes32,bytes32,address)](tests/detectors/arbitrary-send-erc20-permit/0.4.25/arbitrary_send_erc20_permit.sol#L32-L35) uses arbitrary from in transferFrom in combination with permit: [erc20.transferFrom(from,to,value)](tests/detectors/arbitrary-send-erc20-permit/0.4.25/arbitrary_send_erc20_permit.sol#L34)\n", + "first_markdown_element": "tests/detectors/arbitrary-send-erc20-permit/0.4.25/arbitrary_send_erc20_permit.sol#L32-L35", + "id": "82a43f5bf554d897b270abaac0ee62650383fe341adeff0d9c1c95b0040548a2", + "check": "arbitrary-send-erc20-permit", + "impact": "High", + "confidence": "Medium" + }, + { + "elements": [ + { + "type": "function", + "name": "bad3", + "source_mapping": { + "start": 1546, + "length": 238, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/arbitrary-send-erc20-permit/0.4.25/arbitrary_send_erc20_permit.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/arbitrary-send-erc20-permit/0.4.25/arbitrary_send_erc20_permit.sol", + "is_dependency": false, + "lines": [ + 47, + 48, + 49, + 50 + ], + "starting_column": 5, + "ending_column": 6 + }, + "type_specific_fields": { + "parent": { + "type": "contract", + "name": "C", + "source_mapping": { + "start": 613, + "length": 1433, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/arbitrary-send-erc20-permit/0.4.25/arbitrary_send_erc20_permit.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/arbitrary-send-erc20-permit/0.4.25/arbitrary_send_erc20_permit.sol", + "is_dependency": false, + "lines": [ + 19, + 20, + 21, + 22, + 23, + 24, + 25, + 26, + 27, + 28, + 29, + 30, + 31, + 32, + 33, + 34, + 35, + 36, + 37, + 38, + 39, + 40, + 41, + 42, + 43, + 44, + 45, + 46, + 47, + 48, + 49, + 50, + 51, + 52, + 53, + 54, + 55, + 56, + 57 + ], + "starting_column": 1, + "ending_column": 2 + } + }, + "signature": "bad3(address,uint256,uint256,uint8,bytes32,bytes32,address)" + } + }, + { + "type": "node", + "name": "erc20.safeTransferFrom(from,to,value)", + "source_mapping": { + "start": 1738, + "length": 39, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/arbitrary-send-erc20-permit/0.4.25/arbitrary_send_erc20_permit.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/arbitrary-send-erc20-permit/0.4.25/arbitrary_send_erc20_permit.sol", + "is_dependency": false, + "lines": [ + 49 + ], + "starting_column": 9, + "ending_column": 48 + }, + "type_specific_fields": { + "parent": { + "type": "function", + "name": "bad3", + "source_mapping": { + "start": 1546, + "length": 238, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/arbitrary-send-erc20-permit/0.4.25/arbitrary_send_erc20_permit.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/arbitrary-send-erc20-permit/0.4.25/arbitrary_send_erc20_permit.sol", + "is_dependency": false, + "lines": [ + 47, + 48, + 49, + 50 + ], + "starting_column": 5, + "ending_column": 6 + }, + "type_specific_fields": { + "parent": { + "type": "contract", + "name": "C", + "source_mapping": { + "start": 613, + "length": 1433, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/arbitrary-send-erc20-permit/0.4.25/arbitrary_send_erc20_permit.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/arbitrary-send-erc20-permit/0.4.25/arbitrary_send_erc20_permit.sol", + "is_dependency": false, + "lines": [ + 19, + 20, + 21, + 22, + 23, + 24, + 25, + 26, + 27, + 28, + 29, + 30, + 31, + 32, + 33, + 34, + 35, + 36, + 37, + 38, + 39, + 40, + 41, + 42, + 43, + 44, + 45, + 46, + 47, + 48, + 49, + 50, + 51, + 52, + 53, + 54, + 55, + 56, + 57 + ], + "starting_column": 1, + "ending_column": 2 + } + }, + "signature": "bad3(address,uint256,uint256,uint8,bytes32,bytes32,address)" + } + } + } + } + ], + "description": "C.bad3(address,uint256,uint256,uint8,bytes32,bytes32,address) (tests/detectors/arbitrary-send-erc20-permit/0.4.25/arbitrary_send_erc20_permit.sol#47-50) uses arbitrary from in transferFrom in combination with permit: erc20.safeTransferFrom(from,to,value) (tests/detectors/arbitrary-send-erc20-permit/0.4.25/arbitrary_send_erc20_permit.sol#49)\n", + "markdown": "[C.bad3(address,uint256,uint256,uint8,bytes32,bytes32,address)](tests/detectors/arbitrary-send-erc20-permit/0.4.25/arbitrary_send_erc20_permit.sol#L47-L50) uses arbitrary from in transferFrom in combination with permit: [erc20.safeTransferFrom(from,to,value)](tests/detectors/arbitrary-send-erc20-permit/0.4.25/arbitrary_send_erc20_permit.sol#L49)\n", + "first_markdown_element": "tests/detectors/arbitrary-send-erc20-permit/0.4.25/arbitrary_send_erc20_permit.sol#L47-L50", + "id": "f7695706feb3a8409e367a88028dfad8c64e1000f1f71d6e55074d0dcfbc2305", + "check": "arbitrary-send-erc20-permit", + "impact": "High", + "confidence": "Medium" + } + ] +] \ No newline at end of file diff --git a/tests/detectors/arbitrary-send-erc20-permit/0.5.16/arbitrary_send_erc20_permit.sol b/tests/detectors/arbitrary-send-erc20-permit/0.5.16/arbitrary_send_erc20_permit.sol new file mode 100644 index 000000000..4a020d262 --- /dev/null +++ b/tests/detectors/arbitrary-send-erc20-permit/0.5.16/arbitrary_send_erc20_permit.sol @@ -0,0 +1,57 @@ +pragma solidity 0.5.16; + +library SafeERC20 { + function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {} +} + +interface IERC20 { + function transferFrom(address, address, uint256) external returns(bool); + function permit(address, address, uint256, uint256, uint8, bytes32, bytes32) external; +} + +contract ERC20 is IERC20 { + function transferFrom(address from, address to, uint256 amount) external returns(bool) { + return true; + } + function permit(address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) external {} +} + +contract C { + using SafeERC20 for IERC20; + + IERC20 erc20; + address notsend; + address send; + + constructor() public { + erc20 = new ERC20(); + notsend = address(0x3); + send = msg.sender; + } + + function bad1(address from, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s, address to) public { + erc20.permit(from, address(this), value, deadline, v, r, s); + erc20.transferFrom(from, to, value); + } + + // This is not detected + function bad2(address from, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s, address to) public { + int_transferFrom(from,value, deadline, v, r, s, to); + } + + function int_transferFrom(address from, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s, address to) internal { + erc20.permit(from, address(this), value, deadline, v, r, s); + erc20.transferFrom(from, to, value); + } + + function bad3(address from, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s, address to) external { + erc20.permit(from, address(this), value, deadline, v, r, s); + erc20.safeTransferFrom(from, to, value); + } + + function bad4(address from, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s, address to) external { + erc20.permit(from, address(this), value, deadline, v, r, s); + SafeERC20.safeTransferFrom(erc20, from, to, value); + } + +} diff --git a/tests/detectors/arbitrary-send-erc20-permit/0.5.16/arbitrary_send_erc20_permit.sol.0.5.16.ArbitrarySendErc20Permit.json b/tests/detectors/arbitrary-send-erc20-permit/0.5.16/arbitrary_send_erc20_permit.sol.0.5.16.ArbitrarySendErc20Permit.json new file mode 100644 index 000000000..6452e06f9 --- /dev/null +++ b/tests/detectors/arbitrary-send-erc20-permit/0.5.16/arbitrary_send_erc20_permit.sol.0.5.16.ArbitrarySendErc20Permit.json @@ -0,0 +1,768 @@ +[ + [ + { + "elements": [ + { + "type": "function", + "name": "bad4", + "source_mapping": { + "start": 1794, + "length": 249, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/arbitrary-send-erc20-permit/0.5.16/arbitrary_send_erc20_permit.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/arbitrary-send-erc20-permit/0.5.16/arbitrary_send_erc20_permit.sol", + "is_dependency": false, + "lines": [ + 52, + 53, + 54, + 55 + ], + "starting_column": 5, + "ending_column": 6 + }, + "type_specific_fields": { + "parent": { + "type": "contract", + "name": "C", + "source_mapping": { + "start": 613, + "length": 1433, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/arbitrary-send-erc20-permit/0.5.16/arbitrary_send_erc20_permit.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/arbitrary-send-erc20-permit/0.5.16/arbitrary_send_erc20_permit.sol", + "is_dependency": false, + "lines": [ + 19, + 20, + 21, + 22, + 23, + 24, + 25, + 26, + 27, + 28, + 29, + 30, + 31, + 32, + 33, + 34, + 35, + 36, + 37, + 38, + 39, + 40, + 41, + 42, + 43, + 44, + 45, + 46, + 47, + 48, + 49, + 50, + 51, + 52, + 53, + 54, + 55, + 56, + 57 + ], + "starting_column": 1, + "ending_column": 2 + } + }, + "signature": "bad4(address,uint256,uint256,uint8,bytes32,bytes32,address)" + } + }, + { + "type": "node", + "name": "SafeERC20.safeTransferFrom(erc20,from,to,value)", + "source_mapping": { + "start": 1986, + "length": 50, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/arbitrary-send-erc20-permit/0.5.16/arbitrary_send_erc20_permit.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/arbitrary-send-erc20-permit/0.5.16/arbitrary_send_erc20_permit.sol", + "is_dependency": false, + "lines": [ + 54 + ], + "starting_column": 9, + "ending_column": 59 + }, + "type_specific_fields": { + "parent": { + "type": "function", + "name": "bad4", + "source_mapping": { + "start": 1794, + "length": 249, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/arbitrary-send-erc20-permit/0.5.16/arbitrary_send_erc20_permit.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/arbitrary-send-erc20-permit/0.5.16/arbitrary_send_erc20_permit.sol", + "is_dependency": false, + "lines": [ + 52, + 53, + 54, + 55 + ], + "starting_column": 5, + "ending_column": 6 + }, + "type_specific_fields": { + "parent": { + "type": "contract", + "name": "C", + "source_mapping": { + "start": 613, + "length": 1433, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/arbitrary-send-erc20-permit/0.5.16/arbitrary_send_erc20_permit.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/arbitrary-send-erc20-permit/0.5.16/arbitrary_send_erc20_permit.sol", + "is_dependency": false, + "lines": [ + 19, + 20, + 21, + 22, + 23, + 24, + 25, + 26, + 27, + 28, + 29, + 30, + 31, + 32, + 33, + 34, + 35, + 36, + 37, + 38, + 39, + 40, + 41, + 42, + 43, + 44, + 45, + 46, + 47, + 48, + 49, + 50, + 51, + 52, + 53, + 54, + 55, + 56, + 57 + ], + "starting_column": 1, + "ending_column": 2 + } + }, + "signature": "bad4(address,uint256,uint256,uint8,bytes32,bytes32,address)" + } + } + } + } + ], + "description": "C.bad4(address,uint256,uint256,uint8,bytes32,bytes32,address) (tests/detectors/arbitrary-send-erc20-permit/0.5.16/arbitrary_send_erc20_permit.sol#52-55) uses arbitrary from in transferFrom in combination with permit: SafeERC20.safeTransferFrom(erc20,from,to,value) (tests/detectors/arbitrary-send-erc20-permit/0.5.16/arbitrary_send_erc20_permit.sol#54)\n", + "markdown": "[C.bad4(address,uint256,uint256,uint8,bytes32,bytes32,address)](tests/detectors/arbitrary-send-erc20-permit/0.5.16/arbitrary_send_erc20_permit.sol#L52-L55) uses arbitrary from in transferFrom in combination with permit: [SafeERC20.safeTransferFrom(erc20,from,to,value)](tests/detectors/arbitrary-send-erc20-permit/0.5.16/arbitrary_send_erc20_permit.sol#L54)\n", + "first_markdown_element": "tests/detectors/arbitrary-send-erc20-permit/0.5.16/arbitrary_send_erc20_permit.sol#L52-L55", + "id": "57068db07fd7e67d0b63035936fad5a373fcb8f84bb6a58aa463278143db43fa", + "check": "arbitrary-send-erc20-permit", + "impact": "High", + "confidence": "Medium" + }, + { + "elements": [ + { + "type": "function", + "name": "bad1", + "source_mapping": { + "start": 843, + "length": 232, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/arbitrary-send-erc20-permit/0.5.16/arbitrary_send_erc20_permit.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/arbitrary-send-erc20-permit/0.5.16/arbitrary_send_erc20_permit.sol", + "is_dependency": false, + "lines": [ + 32, + 33, + 34, + 35 + ], + "starting_column": 5, + "ending_column": 6 + }, + "type_specific_fields": { + "parent": { + "type": "contract", + "name": "C", + "source_mapping": { + "start": 613, + "length": 1433, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/arbitrary-send-erc20-permit/0.5.16/arbitrary_send_erc20_permit.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/arbitrary-send-erc20-permit/0.5.16/arbitrary_send_erc20_permit.sol", + "is_dependency": false, + "lines": [ + 19, + 20, + 21, + 22, + 23, + 24, + 25, + 26, + 27, + 28, + 29, + 30, + 31, + 32, + 33, + 34, + 35, + 36, + 37, + 38, + 39, + 40, + 41, + 42, + 43, + 44, + 45, + 46, + 47, + 48, + 49, + 50, + 51, + 52, + 53, + 54, + 55, + 56, + 57 + ], + "starting_column": 1, + "ending_column": 2 + } + }, + "signature": "bad1(address,uint256,uint256,uint8,bytes32,bytes32,address)" + } + }, + { + "type": "node", + "name": "erc20.transferFrom(from,to,value)", + "source_mapping": { + "start": 1033, + "length": 35, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/arbitrary-send-erc20-permit/0.5.16/arbitrary_send_erc20_permit.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/arbitrary-send-erc20-permit/0.5.16/arbitrary_send_erc20_permit.sol", + "is_dependency": false, + "lines": [ + 34 + ], + "starting_column": 9, + "ending_column": 44 + }, + "type_specific_fields": { + "parent": { + "type": "function", + "name": "bad1", + "source_mapping": { + "start": 843, + "length": 232, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/arbitrary-send-erc20-permit/0.5.16/arbitrary_send_erc20_permit.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/arbitrary-send-erc20-permit/0.5.16/arbitrary_send_erc20_permit.sol", + "is_dependency": false, + "lines": [ + 32, + 33, + 34, + 35 + ], + "starting_column": 5, + "ending_column": 6 + }, + "type_specific_fields": { + "parent": { + "type": "contract", + "name": "C", + "source_mapping": { + "start": 613, + "length": 1433, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/arbitrary-send-erc20-permit/0.5.16/arbitrary_send_erc20_permit.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/arbitrary-send-erc20-permit/0.5.16/arbitrary_send_erc20_permit.sol", + "is_dependency": false, + "lines": [ + 19, + 20, + 21, + 22, + 23, + 24, + 25, + 26, + 27, + 28, + 29, + 30, + 31, + 32, + 33, + 34, + 35, + 36, + 37, + 38, + 39, + 40, + 41, + 42, + 43, + 44, + 45, + 46, + 47, + 48, + 49, + 50, + 51, + 52, + 53, + 54, + 55, + 56, + 57 + ], + "starting_column": 1, + "ending_column": 2 + } + }, + "signature": "bad1(address,uint256,uint256,uint8,bytes32,bytes32,address)" + } + } + } + } + ], + "description": "C.bad1(address,uint256,uint256,uint8,bytes32,bytes32,address) (tests/detectors/arbitrary-send-erc20-permit/0.5.16/arbitrary_send_erc20_permit.sol#32-35) uses arbitrary from in transferFrom in combination with permit: erc20.transferFrom(from,to,value) (tests/detectors/arbitrary-send-erc20-permit/0.5.16/arbitrary_send_erc20_permit.sol#34)\n", + "markdown": "[C.bad1(address,uint256,uint256,uint8,bytes32,bytes32,address)](tests/detectors/arbitrary-send-erc20-permit/0.5.16/arbitrary_send_erc20_permit.sol#L32-L35) uses arbitrary from in transferFrom in combination with permit: [erc20.transferFrom(from,to,value)](tests/detectors/arbitrary-send-erc20-permit/0.5.16/arbitrary_send_erc20_permit.sol#L34)\n", + "first_markdown_element": "tests/detectors/arbitrary-send-erc20-permit/0.5.16/arbitrary_send_erc20_permit.sol#L32-L35", + "id": "5983458eee02cf7d5484a82e17422dcdbd7b990305579e17d1252c0bb31e1cac", + "check": "arbitrary-send-erc20-permit", + "impact": "High", + "confidence": "Medium" + }, + { + "elements": [ + { + "type": "function", + "name": "bad3", + "source_mapping": { + "start": 1546, + "length": 238, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/arbitrary-send-erc20-permit/0.5.16/arbitrary_send_erc20_permit.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/arbitrary-send-erc20-permit/0.5.16/arbitrary_send_erc20_permit.sol", + "is_dependency": false, + "lines": [ + 47, + 48, + 49, + 50 + ], + "starting_column": 5, + "ending_column": 6 + }, + "type_specific_fields": { + "parent": { + "type": "contract", + "name": "C", + "source_mapping": { + "start": 613, + "length": 1433, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/arbitrary-send-erc20-permit/0.5.16/arbitrary_send_erc20_permit.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/arbitrary-send-erc20-permit/0.5.16/arbitrary_send_erc20_permit.sol", + "is_dependency": false, + "lines": [ + 19, + 20, + 21, + 22, + 23, + 24, + 25, + 26, + 27, + 28, + 29, + 30, + 31, + 32, + 33, + 34, + 35, + 36, + 37, + 38, + 39, + 40, + 41, + 42, + 43, + 44, + 45, + 46, + 47, + 48, + 49, + 50, + 51, + 52, + 53, + 54, + 55, + 56, + 57 + ], + "starting_column": 1, + "ending_column": 2 + } + }, + "signature": "bad3(address,uint256,uint256,uint8,bytes32,bytes32,address)" + } + }, + { + "type": "node", + "name": "erc20.safeTransferFrom(from,to,value)", + "source_mapping": { + "start": 1738, + "length": 39, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/arbitrary-send-erc20-permit/0.5.16/arbitrary_send_erc20_permit.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/arbitrary-send-erc20-permit/0.5.16/arbitrary_send_erc20_permit.sol", + "is_dependency": false, + "lines": [ + 49 + ], + "starting_column": 9, + "ending_column": 48 + }, + "type_specific_fields": { + "parent": { + "type": "function", + "name": "bad3", + "source_mapping": { + "start": 1546, + "length": 238, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/arbitrary-send-erc20-permit/0.5.16/arbitrary_send_erc20_permit.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/arbitrary-send-erc20-permit/0.5.16/arbitrary_send_erc20_permit.sol", + "is_dependency": false, + "lines": [ + 47, + 48, + 49, + 50 + ], + "starting_column": 5, + "ending_column": 6 + }, + "type_specific_fields": { + "parent": { + "type": "contract", + "name": "C", + "source_mapping": { + "start": 613, + "length": 1433, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/arbitrary-send-erc20-permit/0.5.16/arbitrary_send_erc20_permit.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/arbitrary-send-erc20-permit/0.5.16/arbitrary_send_erc20_permit.sol", + "is_dependency": false, + "lines": [ + 19, + 20, + 21, + 22, + 23, + 24, + 25, + 26, + 27, + 28, + 29, + 30, + 31, + 32, + 33, + 34, + 35, + 36, + 37, + 38, + 39, + 40, + 41, + 42, + 43, + 44, + 45, + 46, + 47, + 48, + 49, + 50, + 51, + 52, + 53, + 54, + 55, + 56, + 57 + ], + "starting_column": 1, + "ending_column": 2 + } + }, + "signature": "bad3(address,uint256,uint256,uint8,bytes32,bytes32,address)" + } + } + } + } + ], + "description": "C.bad3(address,uint256,uint256,uint8,bytes32,bytes32,address) (tests/detectors/arbitrary-send-erc20-permit/0.5.16/arbitrary_send_erc20_permit.sol#47-50) uses arbitrary from in transferFrom in combination with permit: erc20.safeTransferFrom(from,to,value) (tests/detectors/arbitrary-send-erc20-permit/0.5.16/arbitrary_send_erc20_permit.sol#49)\n", + "markdown": "[C.bad3(address,uint256,uint256,uint8,bytes32,bytes32,address)](tests/detectors/arbitrary-send-erc20-permit/0.5.16/arbitrary_send_erc20_permit.sol#L47-L50) uses arbitrary from in transferFrom in combination with permit: [erc20.safeTransferFrom(from,to,value)](tests/detectors/arbitrary-send-erc20-permit/0.5.16/arbitrary_send_erc20_permit.sol#L49)\n", + "first_markdown_element": "tests/detectors/arbitrary-send-erc20-permit/0.5.16/arbitrary_send_erc20_permit.sol#L47-L50", + "id": "a8f319ba65d6c81726b72d7593eb089ce9819d22856387250e009a43a98cf1c3", + "check": "arbitrary-send-erc20-permit", + "impact": "High", + "confidence": "Medium" + }, + { + "elements": [ + { + "type": "function", + "name": "int_transferFrom", + "source_mapping": { + "start": 1294, + "length": 246, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/arbitrary-send-erc20-permit/0.5.16/arbitrary_send_erc20_permit.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/arbitrary-send-erc20-permit/0.5.16/arbitrary_send_erc20_permit.sol", + "is_dependency": false, + "lines": [ + 42, + 43, + 44, + 45 + ], + "starting_column": 5, + "ending_column": 6 + }, + "type_specific_fields": { + "parent": { + "type": "contract", + "name": "C", + "source_mapping": { + "start": 613, + "length": 1433, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/arbitrary-send-erc20-permit/0.5.16/arbitrary_send_erc20_permit.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/arbitrary-send-erc20-permit/0.5.16/arbitrary_send_erc20_permit.sol", + "is_dependency": false, + "lines": [ + 19, + 20, + 21, + 22, + 23, + 24, + 25, + 26, + 27, + 28, + 29, + 30, + 31, + 32, + 33, + 34, + 35, + 36, + 37, + 38, + 39, + 40, + 41, + 42, + 43, + 44, + 45, + 46, + 47, + 48, + 49, + 50, + 51, + 52, + 53, + 54, + 55, + 56, + 57 + ], + "starting_column": 1, + "ending_column": 2 + } + }, + "signature": "int_transferFrom(address,uint256,uint256,uint8,bytes32,bytes32,address)" + } + }, + { + "type": "node", + "name": "erc20.transferFrom(from,to,value)", + "source_mapping": { + "start": 1498, + "length": 35, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/arbitrary-send-erc20-permit/0.5.16/arbitrary_send_erc20_permit.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/arbitrary-send-erc20-permit/0.5.16/arbitrary_send_erc20_permit.sol", + "is_dependency": false, + "lines": [ + 44 + ], + "starting_column": 9, + "ending_column": 44 + }, + "type_specific_fields": { + "parent": { + "type": "function", + "name": "int_transferFrom", + "source_mapping": { + "start": 1294, + "length": 246, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/arbitrary-send-erc20-permit/0.5.16/arbitrary_send_erc20_permit.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/arbitrary-send-erc20-permit/0.5.16/arbitrary_send_erc20_permit.sol", + "is_dependency": false, + "lines": [ + 42, + 43, + 44, + 45 + ], + "starting_column": 5, + "ending_column": 6 + }, + "type_specific_fields": { + "parent": { + "type": "contract", + "name": "C", + "source_mapping": { + "start": 613, + "length": 1433, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/arbitrary-send-erc20-permit/0.5.16/arbitrary_send_erc20_permit.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/arbitrary-send-erc20-permit/0.5.16/arbitrary_send_erc20_permit.sol", + "is_dependency": false, + "lines": [ + 19, + 20, + 21, + 22, + 23, + 24, + 25, + 26, + 27, + 28, + 29, + 30, + 31, + 32, + 33, + 34, + 35, + 36, + 37, + 38, + 39, + 40, + 41, + 42, + 43, + 44, + 45, + 46, + 47, + 48, + 49, + 50, + 51, + 52, + 53, + 54, + 55, + 56, + 57 + ], + "starting_column": 1, + "ending_column": 2 + } + }, + "signature": "int_transferFrom(address,uint256,uint256,uint8,bytes32,bytes32,address)" + } + } + } + } + ], + "description": "C.int_transferFrom(address,uint256,uint256,uint8,bytes32,bytes32,address) (tests/detectors/arbitrary-send-erc20-permit/0.5.16/arbitrary_send_erc20_permit.sol#42-45) uses arbitrary from in transferFrom in combination with permit: erc20.transferFrom(from,to,value) (tests/detectors/arbitrary-send-erc20-permit/0.5.16/arbitrary_send_erc20_permit.sol#44)\n", + "markdown": "[C.int_transferFrom(address,uint256,uint256,uint8,bytes32,bytes32,address)](tests/detectors/arbitrary-send-erc20-permit/0.5.16/arbitrary_send_erc20_permit.sol#L42-L45) uses arbitrary from in transferFrom in combination with permit: [erc20.transferFrom(from,to,value)](tests/detectors/arbitrary-send-erc20-permit/0.5.16/arbitrary_send_erc20_permit.sol#L44)\n", + "first_markdown_element": "tests/detectors/arbitrary-send-erc20-permit/0.5.16/arbitrary_send_erc20_permit.sol#L42-L45", + "id": "e3ed372c52b219322ca290ecfa79be96d7ea1b019af329a515c6c10b7a1cf03b", + "check": "arbitrary-send-erc20-permit", + "impact": "High", + "confidence": "Medium" + } + ] +] \ No newline at end of file diff --git a/tests/detectors/arbitrary-send-erc20-permit/0.6.11/arbitrary_send_erc20_permit.sol b/tests/detectors/arbitrary-send-erc20-permit/0.6.11/arbitrary_send_erc20_permit.sol new file mode 100644 index 000000000..0a9f80e7d --- /dev/null +++ b/tests/detectors/arbitrary-send-erc20-permit/0.6.11/arbitrary_send_erc20_permit.sol @@ -0,0 +1,57 @@ +pragma solidity 0.6.11; + +library SafeERC20 { + function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {} +} + +interface IERC20 { + function transferFrom(address, address, uint256) external returns(bool); + function permit(address, address, uint256, uint256, uint8, bytes32, bytes32) external; +} + +contract ERC20 is IERC20 { + function transferFrom(address from, address to, uint256 amount) external override returns(bool) { + return true; + } + function permit(address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) external override {} +} + +contract C { + using SafeERC20 for IERC20; + + IERC20 erc20; + address notsend; + address send; + + constructor() public { + erc20 = new ERC20(); + notsend = address(0x3); + send = msg.sender; + } + + function bad1(address from, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s, address to) public { + erc20.permit(from, address(this), value, deadline, v, r, s); + erc20.transferFrom(from, to, value); + } + + // This is not detected + function bad2(address from, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s, address to) public { + int_transferFrom(from,value, deadline, v, r, s, to); + } + + function int_transferFrom(address from, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s, address to) internal { + erc20.permit(from, address(this), value, deadline, v, r, s); + erc20.transferFrom(from, to, value); + } + + function bad3(address from, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s, address to) external { + erc20.permit(from, address(this), value, deadline, v, r, s); + erc20.safeTransferFrom(from, to, value); + } + + function bad4(address from, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s, address to) external { + erc20.permit(from, address(this), value, deadline, v, r, s); + SafeERC20.safeTransferFrom(erc20, from, to, value); + } + +} diff --git a/tests/detectors/arbitrary-send-erc20-permit/0.6.11/arbitrary_send_erc20_permit.sol.0.6.11.ArbitrarySendErc20Permit.json b/tests/detectors/arbitrary-send-erc20-permit/0.6.11/arbitrary_send_erc20_permit.sol.0.6.11.ArbitrarySendErc20Permit.json new file mode 100644 index 000000000..911573c67 --- /dev/null +++ b/tests/detectors/arbitrary-send-erc20-permit/0.6.11/arbitrary_send_erc20_permit.sol.0.6.11.ArbitrarySendErc20Permit.json @@ -0,0 +1,768 @@ +[ + [ + { + "elements": [ + { + "type": "function", + "name": "bad3", + "source_mapping": { + "start": 1564, + "length": 238, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/arbitrary-send-erc20-permit/0.6.11/arbitrary_send_erc20_permit.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/arbitrary-send-erc20-permit/0.6.11/arbitrary_send_erc20_permit.sol", + "is_dependency": false, + "lines": [ + 47, + 48, + 49, + 50 + ], + "starting_column": 5, + "ending_column": 6 + }, + "type_specific_fields": { + "parent": { + "type": "contract", + "name": "C", + "source_mapping": { + "start": 631, + "length": 1433, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/arbitrary-send-erc20-permit/0.6.11/arbitrary_send_erc20_permit.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/arbitrary-send-erc20-permit/0.6.11/arbitrary_send_erc20_permit.sol", + "is_dependency": false, + "lines": [ + 19, + 20, + 21, + 22, + 23, + 24, + 25, + 26, + 27, + 28, + 29, + 30, + 31, + 32, + 33, + 34, + 35, + 36, + 37, + 38, + 39, + 40, + 41, + 42, + 43, + 44, + 45, + 46, + 47, + 48, + 49, + 50, + 51, + 52, + 53, + 54, + 55, + 56, + 57 + ], + "starting_column": 1, + "ending_column": 2 + } + }, + "signature": "bad3(address,uint256,uint256,uint8,bytes32,bytes32,address)" + } + }, + { + "type": "node", + "name": "erc20.safeTransferFrom(from,to,value)", + "source_mapping": { + "start": 1756, + "length": 39, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/arbitrary-send-erc20-permit/0.6.11/arbitrary_send_erc20_permit.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/arbitrary-send-erc20-permit/0.6.11/arbitrary_send_erc20_permit.sol", + "is_dependency": false, + "lines": [ + 49 + ], + "starting_column": 9, + "ending_column": 48 + }, + "type_specific_fields": { + "parent": { + "type": "function", + "name": "bad3", + "source_mapping": { + "start": 1564, + "length": 238, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/arbitrary-send-erc20-permit/0.6.11/arbitrary_send_erc20_permit.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/arbitrary-send-erc20-permit/0.6.11/arbitrary_send_erc20_permit.sol", + "is_dependency": false, + "lines": [ + 47, + 48, + 49, + 50 + ], + "starting_column": 5, + "ending_column": 6 + }, + "type_specific_fields": { + "parent": { + "type": "contract", + "name": "C", + "source_mapping": { + "start": 631, + "length": 1433, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/arbitrary-send-erc20-permit/0.6.11/arbitrary_send_erc20_permit.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/arbitrary-send-erc20-permit/0.6.11/arbitrary_send_erc20_permit.sol", + "is_dependency": false, + "lines": [ + 19, + 20, + 21, + 22, + 23, + 24, + 25, + 26, + 27, + 28, + 29, + 30, + 31, + 32, + 33, + 34, + 35, + 36, + 37, + 38, + 39, + 40, + 41, + 42, + 43, + 44, + 45, + 46, + 47, + 48, + 49, + 50, + 51, + 52, + 53, + 54, + 55, + 56, + 57 + ], + "starting_column": 1, + "ending_column": 2 + } + }, + "signature": "bad3(address,uint256,uint256,uint8,bytes32,bytes32,address)" + } + } + } + } + ], + "description": "C.bad3(address,uint256,uint256,uint8,bytes32,bytes32,address) (tests/detectors/arbitrary-send-erc20-permit/0.6.11/arbitrary_send_erc20_permit.sol#47-50) uses arbitrary from in transferFrom in combination with permit: erc20.safeTransferFrom(from,to,value) (tests/detectors/arbitrary-send-erc20-permit/0.6.11/arbitrary_send_erc20_permit.sol#49)\n", + "markdown": "[C.bad3(address,uint256,uint256,uint8,bytes32,bytes32,address)](tests/detectors/arbitrary-send-erc20-permit/0.6.11/arbitrary_send_erc20_permit.sol#L47-L50) uses arbitrary from in transferFrom in combination with permit: [erc20.safeTransferFrom(from,to,value)](tests/detectors/arbitrary-send-erc20-permit/0.6.11/arbitrary_send_erc20_permit.sol#L49)\n", + "first_markdown_element": "tests/detectors/arbitrary-send-erc20-permit/0.6.11/arbitrary_send_erc20_permit.sol#L47-L50", + "id": "1caf8efb7dd42f74884b4ee8d8b44585eeaa5758776ef8ac1e31b8aa749eac26", + "check": "arbitrary-send-erc20-permit", + "impact": "High", + "confidence": "Medium" + }, + { + "elements": [ + { + "type": "function", + "name": "bad4", + "source_mapping": { + "start": 1812, + "length": 249, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/arbitrary-send-erc20-permit/0.6.11/arbitrary_send_erc20_permit.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/arbitrary-send-erc20-permit/0.6.11/arbitrary_send_erc20_permit.sol", + "is_dependency": false, + "lines": [ + 52, + 53, + 54, + 55 + ], + "starting_column": 5, + "ending_column": 6 + }, + "type_specific_fields": { + "parent": { + "type": "contract", + "name": "C", + "source_mapping": { + "start": 631, + "length": 1433, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/arbitrary-send-erc20-permit/0.6.11/arbitrary_send_erc20_permit.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/arbitrary-send-erc20-permit/0.6.11/arbitrary_send_erc20_permit.sol", + "is_dependency": false, + "lines": [ + 19, + 20, + 21, + 22, + 23, + 24, + 25, + 26, + 27, + 28, + 29, + 30, + 31, + 32, + 33, + 34, + 35, + 36, + 37, + 38, + 39, + 40, + 41, + 42, + 43, + 44, + 45, + 46, + 47, + 48, + 49, + 50, + 51, + 52, + 53, + 54, + 55, + 56, + 57 + ], + "starting_column": 1, + "ending_column": 2 + } + }, + "signature": "bad4(address,uint256,uint256,uint8,bytes32,bytes32,address)" + } + }, + { + "type": "node", + "name": "SafeERC20.safeTransferFrom(erc20,from,to,value)", + "source_mapping": { + "start": 2004, + "length": 50, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/arbitrary-send-erc20-permit/0.6.11/arbitrary_send_erc20_permit.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/arbitrary-send-erc20-permit/0.6.11/arbitrary_send_erc20_permit.sol", + "is_dependency": false, + "lines": [ + 54 + ], + "starting_column": 9, + "ending_column": 59 + }, + "type_specific_fields": { + "parent": { + "type": "function", + "name": "bad4", + "source_mapping": { + "start": 1812, + "length": 249, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/arbitrary-send-erc20-permit/0.6.11/arbitrary_send_erc20_permit.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/arbitrary-send-erc20-permit/0.6.11/arbitrary_send_erc20_permit.sol", + "is_dependency": false, + "lines": [ + 52, + 53, + 54, + 55 + ], + "starting_column": 5, + "ending_column": 6 + }, + "type_specific_fields": { + "parent": { + "type": "contract", + "name": "C", + "source_mapping": { + "start": 631, + "length": 1433, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/arbitrary-send-erc20-permit/0.6.11/arbitrary_send_erc20_permit.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/arbitrary-send-erc20-permit/0.6.11/arbitrary_send_erc20_permit.sol", + "is_dependency": false, + "lines": [ + 19, + 20, + 21, + 22, + 23, + 24, + 25, + 26, + 27, + 28, + 29, + 30, + 31, + 32, + 33, + 34, + 35, + 36, + 37, + 38, + 39, + 40, + 41, + 42, + 43, + 44, + 45, + 46, + 47, + 48, + 49, + 50, + 51, + 52, + 53, + 54, + 55, + 56, + 57 + ], + "starting_column": 1, + "ending_column": 2 + } + }, + "signature": "bad4(address,uint256,uint256,uint8,bytes32,bytes32,address)" + } + } + } + } + ], + "description": "C.bad4(address,uint256,uint256,uint8,bytes32,bytes32,address) (tests/detectors/arbitrary-send-erc20-permit/0.6.11/arbitrary_send_erc20_permit.sol#52-55) uses arbitrary from in transferFrom in combination with permit: SafeERC20.safeTransferFrom(erc20,from,to,value) (tests/detectors/arbitrary-send-erc20-permit/0.6.11/arbitrary_send_erc20_permit.sol#54)\n", + "markdown": "[C.bad4(address,uint256,uint256,uint8,bytes32,bytes32,address)](tests/detectors/arbitrary-send-erc20-permit/0.6.11/arbitrary_send_erc20_permit.sol#L52-L55) uses arbitrary from in transferFrom in combination with permit: [SafeERC20.safeTransferFrom(erc20,from,to,value)](tests/detectors/arbitrary-send-erc20-permit/0.6.11/arbitrary_send_erc20_permit.sol#L54)\n", + "first_markdown_element": "tests/detectors/arbitrary-send-erc20-permit/0.6.11/arbitrary_send_erc20_permit.sol#L52-L55", + "id": "cc58852f92580ac18db192412ec7e50667bf56d986349ae8fe6990f0b04f9f62", + "check": "arbitrary-send-erc20-permit", + "impact": "High", + "confidence": "Medium" + }, + { + "elements": [ + { + "type": "function", + "name": "int_transferFrom", + "source_mapping": { + "start": 1312, + "length": 246, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/arbitrary-send-erc20-permit/0.6.11/arbitrary_send_erc20_permit.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/arbitrary-send-erc20-permit/0.6.11/arbitrary_send_erc20_permit.sol", + "is_dependency": false, + "lines": [ + 42, + 43, + 44, + 45 + ], + "starting_column": 5, + "ending_column": 6 + }, + "type_specific_fields": { + "parent": { + "type": "contract", + "name": "C", + "source_mapping": { + "start": 631, + "length": 1433, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/arbitrary-send-erc20-permit/0.6.11/arbitrary_send_erc20_permit.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/arbitrary-send-erc20-permit/0.6.11/arbitrary_send_erc20_permit.sol", + "is_dependency": false, + "lines": [ + 19, + 20, + 21, + 22, + 23, + 24, + 25, + 26, + 27, + 28, + 29, + 30, + 31, + 32, + 33, + 34, + 35, + 36, + 37, + 38, + 39, + 40, + 41, + 42, + 43, + 44, + 45, + 46, + 47, + 48, + 49, + 50, + 51, + 52, + 53, + 54, + 55, + 56, + 57 + ], + "starting_column": 1, + "ending_column": 2 + } + }, + "signature": "int_transferFrom(address,uint256,uint256,uint8,bytes32,bytes32,address)" + } + }, + { + "type": "node", + "name": "erc20.transferFrom(from,to,value)", + "source_mapping": { + "start": 1516, + "length": 35, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/arbitrary-send-erc20-permit/0.6.11/arbitrary_send_erc20_permit.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/arbitrary-send-erc20-permit/0.6.11/arbitrary_send_erc20_permit.sol", + "is_dependency": false, + "lines": [ + 44 + ], + "starting_column": 9, + "ending_column": 44 + }, + "type_specific_fields": { + "parent": { + "type": "function", + "name": "int_transferFrom", + "source_mapping": { + "start": 1312, + "length": 246, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/arbitrary-send-erc20-permit/0.6.11/arbitrary_send_erc20_permit.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/arbitrary-send-erc20-permit/0.6.11/arbitrary_send_erc20_permit.sol", + "is_dependency": false, + "lines": [ + 42, + 43, + 44, + 45 + ], + "starting_column": 5, + "ending_column": 6 + }, + "type_specific_fields": { + "parent": { + "type": "contract", + "name": "C", + "source_mapping": { + "start": 631, + "length": 1433, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/arbitrary-send-erc20-permit/0.6.11/arbitrary_send_erc20_permit.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/arbitrary-send-erc20-permit/0.6.11/arbitrary_send_erc20_permit.sol", + "is_dependency": false, + "lines": [ + 19, + 20, + 21, + 22, + 23, + 24, + 25, + 26, + 27, + 28, + 29, + 30, + 31, + 32, + 33, + 34, + 35, + 36, + 37, + 38, + 39, + 40, + 41, + 42, + 43, + 44, + 45, + 46, + 47, + 48, + 49, + 50, + 51, + 52, + 53, + 54, + 55, + 56, + 57 + ], + "starting_column": 1, + "ending_column": 2 + } + }, + "signature": "int_transferFrom(address,uint256,uint256,uint8,bytes32,bytes32,address)" + } + } + } + } + ], + "description": "C.int_transferFrom(address,uint256,uint256,uint8,bytes32,bytes32,address) (tests/detectors/arbitrary-send-erc20-permit/0.6.11/arbitrary_send_erc20_permit.sol#42-45) uses arbitrary from in transferFrom in combination with permit: erc20.transferFrom(from,to,value) (tests/detectors/arbitrary-send-erc20-permit/0.6.11/arbitrary_send_erc20_permit.sol#44)\n", + "markdown": "[C.int_transferFrom(address,uint256,uint256,uint8,bytes32,bytes32,address)](tests/detectors/arbitrary-send-erc20-permit/0.6.11/arbitrary_send_erc20_permit.sol#L42-L45) uses arbitrary from in transferFrom in combination with permit: [erc20.transferFrom(from,to,value)](tests/detectors/arbitrary-send-erc20-permit/0.6.11/arbitrary_send_erc20_permit.sol#L44)\n", + "first_markdown_element": "tests/detectors/arbitrary-send-erc20-permit/0.6.11/arbitrary_send_erc20_permit.sol#L42-L45", + "id": "f75bec4e068adbca017ad00b355347aa0c337b30a807fa8e1b80577b031e68fd", + "check": "arbitrary-send-erc20-permit", + "impact": "High", + "confidence": "Medium" + }, + { + "elements": [ + { + "type": "function", + "name": "bad1", + "source_mapping": { + "start": 861, + "length": 232, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/arbitrary-send-erc20-permit/0.6.11/arbitrary_send_erc20_permit.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/arbitrary-send-erc20-permit/0.6.11/arbitrary_send_erc20_permit.sol", + "is_dependency": false, + "lines": [ + 32, + 33, + 34, + 35 + ], + "starting_column": 5, + "ending_column": 6 + }, + "type_specific_fields": { + "parent": { + "type": "contract", + "name": "C", + "source_mapping": { + "start": 631, + "length": 1433, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/arbitrary-send-erc20-permit/0.6.11/arbitrary_send_erc20_permit.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/arbitrary-send-erc20-permit/0.6.11/arbitrary_send_erc20_permit.sol", + "is_dependency": false, + "lines": [ + 19, + 20, + 21, + 22, + 23, + 24, + 25, + 26, + 27, + 28, + 29, + 30, + 31, + 32, + 33, + 34, + 35, + 36, + 37, + 38, + 39, + 40, + 41, + 42, + 43, + 44, + 45, + 46, + 47, + 48, + 49, + 50, + 51, + 52, + 53, + 54, + 55, + 56, + 57 + ], + "starting_column": 1, + "ending_column": 2 + } + }, + "signature": "bad1(address,uint256,uint256,uint8,bytes32,bytes32,address)" + } + }, + { + "type": "node", + "name": "erc20.transferFrom(from,to,value)", + "source_mapping": { + "start": 1051, + "length": 35, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/arbitrary-send-erc20-permit/0.6.11/arbitrary_send_erc20_permit.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/arbitrary-send-erc20-permit/0.6.11/arbitrary_send_erc20_permit.sol", + "is_dependency": false, + "lines": [ + 34 + ], + "starting_column": 9, + "ending_column": 44 + }, + "type_specific_fields": { + "parent": { + "type": "function", + "name": "bad1", + "source_mapping": { + "start": 861, + "length": 232, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/arbitrary-send-erc20-permit/0.6.11/arbitrary_send_erc20_permit.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/arbitrary-send-erc20-permit/0.6.11/arbitrary_send_erc20_permit.sol", + "is_dependency": false, + "lines": [ + 32, + 33, + 34, + 35 + ], + "starting_column": 5, + "ending_column": 6 + }, + "type_specific_fields": { + "parent": { + "type": "contract", + "name": "C", + "source_mapping": { + "start": 631, + "length": 1433, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/arbitrary-send-erc20-permit/0.6.11/arbitrary_send_erc20_permit.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/arbitrary-send-erc20-permit/0.6.11/arbitrary_send_erc20_permit.sol", + "is_dependency": false, + "lines": [ + 19, + 20, + 21, + 22, + 23, + 24, + 25, + 26, + 27, + 28, + 29, + 30, + 31, + 32, + 33, + 34, + 35, + 36, + 37, + 38, + 39, + 40, + 41, + 42, + 43, + 44, + 45, + 46, + 47, + 48, + 49, + 50, + 51, + 52, + 53, + 54, + 55, + 56, + 57 + ], + "starting_column": 1, + "ending_column": 2 + } + }, + "signature": "bad1(address,uint256,uint256,uint8,bytes32,bytes32,address)" + } + } + } + } + ], + "description": "C.bad1(address,uint256,uint256,uint8,bytes32,bytes32,address) (tests/detectors/arbitrary-send-erc20-permit/0.6.11/arbitrary_send_erc20_permit.sol#32-35) uses arbitrary from in transferFrom in combination with permit: erc20.transferFrom(from,to,value) (tests/detectors/arbitrary-send-erc20-permit/0.6.11/arbitrary_send_erc20_permit.sol#34)\n", + "markdown": "[C.bad1(address,uint256,uint256,uint8,bytes32,bytes32,address)](tests/detectors/arbitrary-send-erc20-permit/0.6.11/arbitrary_send_erc20_permit.sol#L32-L35) uses arbitrary from in transferFrom in combination with permit: [erc20.transferFrom(from,to,value)](tests/detectors/arbitrary-send-erc20-permit/0.6.11/arbitrary_send_erc20_permit.sol#L34)\n", + "first_markdown_element": "tests/detectors/arbitrary-send-erc20-permit/0.6.11/arbitrary_send_erc20_permit.sol#L32-L35", + "id": "f90e97c676187cd6d727064001123d8537f5d8253d0a66ab6798b4a1c250a425", + "check": "arbitrary-send-erc20-permit", + "impact": "High", + "confidence": "Medium" + } + ] +] \ No newline at end of file diff --git a/tests/detectors/arbitrary-send-erc20-permit/0.7.6/arbitrary_send_erc20_permit.sol b/tests/detectors/arbitrary-send-erc20-permit/0.7.6/arbitrary_send_erc20_permit.sol new file mode 100644 index 000000000..48e4e348c --- /dev/null +++ b/tests/detectors/arbitrary-send-erc20-permit/0.7.6/arbitrary_send_erc20_permit.sol @@ -0,0 +1,57 @@ +pragma solidity 0.7.6; + +library SafeERC20 { + function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {} +} + +interface IERC20 { + function transferFrom(address, address, uint256) external returns(bool); + function permit(address, address, uint256, uint256, uint8, bytes32, bytes32) external; +} + +contract ERC20 is IERC20 { + function transferFrom(address from, address to, uint256 amount) external override returns(bool) { + return true; + } + function permit(address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) external override {} +} + +contract C { + using SafeERC20 for IERC20; + + IERC20 erc20; + address notsend; + address send; + + constructor() public { + erc20 = new ERC20(); + notsend = address(0x3); + send = msg.sender; + } + + function bad1(address from, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s, address to) public { + erc20.permit(from, address(this), value, deadline, v, r, s); + erc20.transferFrom(from, to, value); + } + + // This is not detected + function bad2(address from, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s, address to) public { + int_transferFrom(from,value, deadline, v, r, s, to); + } + + function int_transferFrom(address from, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s, address to) internal { + erc20.permit(from, address(this), value, deadline, v, r, s); + erc20.transferFrom(from, to, value); + } + + function bad3(address from, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s, address to) external { + erc20.permit(from, address(this), value, deadline, v, r, s); + erc20.safeTransferFrom(from, to, value); + } + + function bad4(address from, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s, address to) external { + erc20.permit(from, address(this), value, deadline, v, r, s); + SafeERC20.safeTransferFrom(erc20, from, to, value); + } + +} diff --git a/tests/detectors/arbitrary-send-erc20-permit/0.7.6/arbitrary_send_erc20_permit.sol.0.7.6.ArbitrarySendErc20Permit.json b/tests/detectors/arbitrary-send-erc20-permit/0.7.6/arbitrary_send_erc20_permit.sol.0.7.6.ArbitrarySendErc20Permit.json new file mode 100644 index 000000000..f31ee33e1 --- /dev/null +++ b/tests/detectors/arbitrary-send-erc20-permit/0.7.6/arbitrary_send_erc20_permit.sol.0.7.6.ArbitrarySendErc20Permit.json @@ -0,0 +1,768 @@ +[ + [ + { + "elements": [ + { + "type": "function", + "name": "bad3", + "source_mapping": { + "start": 1563, + "length": 238, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/arbitrary-send-erc20-permit/0.7.6/arbitrary_send_erc20_permit.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/arbitrary-send-erc20-permit/0.7.6/arbitrary_send_erc20_permit.sol", + "is_dependency": false, + "lines": [ + 47, + 48, + 49, + 50 + ], + "starting_column": 5, + "ending_column": 6 + }, + "type_specific_fields": { + "parent": { + "type": "contract", + "name": "C", + "source_mapping": { + "start": 630, + "length": 1433, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/arbitrary-send-erc20-permit/0.7.6/arbitrary_send_erc20_permit.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/arbitrary-send-erc20-permit/0.7.6/arbitrary_send_erc20_permit.sol", + "is_dependency": false, + "lines": [ + 19, + 20, + 21, + 22, + 23, + 24, + 25, + 26, + 27, + 28, + 29, + 30, + 31, + 32, + 33, + 34, + 35, + 36, + 37, + 38, + 39, + 40, + 41, + 42, + 43, + 44, + 45, + 46, + 47, + 48, + 49, + 50, + 51, + 52, + 53, + 54, + 55, + 56, + 57 + ], + "starting_column": 1, + "ending_column": 2 + } + }, + "signature": "bad3(address,uint256,uint256,uint8,bytes32,bytes32,address)" + } + }, + { + "type": "node", + "name": "erc20.safeTransferFrom(from,to,value)", + "source_mapping": { + "start": 1755, + "length": 39, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/arbitrary-send-erc20-permit/0.7.6/arbitrary_send_erc20_permit.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/arbitrary-send-erc20-permit/0.7.6/arbitrary_send_erc20_permit.sol", + "is_dependency": false, + "lines": [ + 49 + ], + "starting_column": 9, + "ending_column": 48 + }, + "type_specific_fields": { + "parent": { + "type": "function", + "name": "bad3", + "source_mapping": { + "start": 1563, + "length": 238, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/arbitrary-send-erc20-permit/0.7.6/arbitrary_send_erc20_permit.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/arbitrary-send-erc20-permit/0.7.6/arbitrary_send_erc20_permit.sol", + "is_dependency": false, + "lines": [ + 47, + 48, + 49, + 50 + ], + "starting_column": 5, + "ending_column": 6 + }, + "type_specific_fields": { + "parent": { + "type": "contract", + "name": "C", + "source_mapping": { + "start": 630, + "length": 1433, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/arbitrary-send-erc20-permit/0.7.6/arbitrary_send_erc20_permit.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/arbitrary-send-erc20-permit/0.7.6/arbitrary_send_erc20_permit.sol", + "is_dependency": false, + "lines": [ + 19, + 20, + 21, + 22, + 23, + 24, + 25, + 26, + 27, + 28, + 29, + 30, + 31, + 32, + 33, + 34, + 35, + 36, + 37, + 38, + 39, + 40, + 41, + 42, + 43, + 44, + 45, + 46, + 47, + 48, + 49, + 50, + 51, + 52, + 53, + 54, + 55, + 56, + 57 + ], + "starting_column": 1, + "ending_column": 2 + } + }, + "signature": "bad3(address,uint256,uint256,uint8,bytes32,bytes32,address)" + } + } + } + } + ], + "description": "C.bad3(address,uint256,uint256,uint8,bytes32,bytes32,address) (tests/detectors/arbitrary-send-erc20-permit/0.7.6/arbitrary_send_erc20_permit.sol#47-50) uses arbitrary from in transferFrom in combination with permit: erc20.safeTransferFrom(from,to,value) (tests/detectors/arbitrary-send-erc20-permit/0.7.6/arbitrary_send_erc20_permit.sol#49)\n", + "markdown": "[C.bad3(address,uint256,uint256,uint8,bytes32,bytes32,address)](tests/detectors/arbitrary-send-erc20-permit/0.7.6/arbitrary_send_erc20_permit.sol#L47-L50) uses arbitrary from in transferFrom in combination with permit: [erc20.safeTransferFrom(from,to,value)](tests/detectors/arbitrary-send-erc20-permit/0.7.6/arbitrary_send_erc20_permit.sol#L49)\n", + "first_markdown_element": "tests/detectors/arbitrary-send-erc20-permit/0.7.6/arbitrary_send_erc20_permit.sol#L47-L50", + "id": "63dc39bd9025d9fa7d39e07342e5652c010ff424e6d31ed9d1559f225c417956", + "check": "arbitrary-send-erc20-permit", + "impact": "High", + "confidence": "Medium" + }, + { + "elements": [ + { + "type": "function", + "name": "bad4", + "source_mapping": { + "start": 1811, + "length": 249, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/arbitrary-send-erc20-permit/0.7.6/arbitrary_send_erc20_permit.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/arbitrary-send-erc20-permit/0.7.6/arbitrary_send_erc20_permit.sol", + "is_dependency": false, + "lines": [ + 52, + 53, + 54, + 55 + ], + "starting_column": 5, + "ending_column": 6 + }, + "type_specific_fields": { + "parent": { + "type": "contract", + "name": "C", + "source_mapping": { + "start": 630, + "length": 1433, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/arbitrary-send-erc20-permit/0.7.6/arbitrary_send_erc20_permit.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/arbitrary-send-erc20-permit/0.7.6/arbitrary_send_erc20_permit.sol", + "is_dependency": false, + "lines": [ + 19, + 20, + 21, + 22, + 23, + 24, + 25, + 26, + 27, + 28, + 29, + 30, + 31, + 32, + 33, + 34, + 35, + 36, + 37, + 38, + 39, + 40, + 41, + 42, + 43, + 44, + 45, + 46, + 47, + 48, + 49, + 50, + 51, + 52, + 53, + 54, + 55, + 56, + 57 + ], + "starting_column": 1, + "ending_column": 2 + } + }, + "signature": "bad4(address,uint256,uint256,uint8,bytes32,bytes32,address)" + } + }, + { + "type": "node", + "name": "SafeERC20.safeTransferFrom(erc20,from,to,value)", + "source_mapping": { + "start": 2003, + "length": 50, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/arbitrary-send-erc20-permit/0.7.6/arbitrary_send_erc20_permit.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/arbitrary-send-erc20-permit/0.7.6/arbitrary_send_erc20_permit.sol", + "is_dependency": false, + "lines": [ + 54 + ], + "starting_column": 9, + "ending_column": 59 + }, + "type_specific_fields": { + "parent": { + "type": "function", + "name": "bad4", + "source_mapping": { + "start": 1811, + "length": 249, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/arbitrary-send-erc20-permit/0.7.6/arbitrary_send_erc20_permit.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/arbitrary-send-erc20-permit/0.7.6/arbitrary_send_erc20_permit.sol", + "is_dependency": false, + "lines": [ + 52, + 53, + 54, + 55 + ], + "starting_column": 5, + "ending_column": 6 + }, + "type_specific_fields": { + "parent": { + "type": "contract", + "name": "C", + "source_mapping": { + "start": 630, + "length": 1433, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/arbitrary-send-erc20-permit/0.7.6/arbitrary_send_erc20_permit.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/arbitrary-send-erc20-permit/0.7.6/arbitrary_send_erc20_permit.sol", + "is_dependency": false, + "lines": [ + 19, + 20, + 21, + 22, + 23, + 24, + 25, + 26, + 27, + 28, + 29, + 30, + 31, + 32, + 33, + 34, + 35, + 36, + 37, + 38, + 39, + 40, + 41, + 42, + 43, + 44, + 45, + 46, + 47, + 48, + 49, + 50, + 51, + 52, + 53, + 54, + 55, + 56, + 57 + ], + "starting_column": 1, + "ending_column": 2 + } + }, + "signature": "bad4(address,uint256,uint256,uint8,bytes32,bytes32,address)" + } + } + } + } + ], + "description": "C.bad4(address,uint256,uint256,uint8,bytes32,bytes32,address) (tests/detectors/arbitrary-send-erc20-permit/0.7.6/arbitrary_send_erc20_permit.sol#52-55) uses arbitrary from in transferFrom in combination with permit: SafeERC20.safeTransferFrom(erc20,from,to,value) (tests/detectors/arbitrary-send-erc20-permit/0.7.6/arbitrary_send_erc20_permit.sol#54)\n", + "markdown": "[C.bad4(address,uint256,uint256,uint8,bytes32,bytes32,address)](tests/detectors/arbitrary-send-erc20-permit/0.7.6/arbitrary_send_erc20_permit.sol#L52-L55) uses arbitrary from in transferFrom in combination with permit: [SafeERC20.safeTransferFrom(erc20,from,to,value)](tests/detectors/arbitrary-send-erc20-permit/0.7.6/arbitrary_send_erc20_permit.sol#L54)\n", + "first_markdown_element": "tests/detectors/arbitrary-send-erc20-permit/0.7.6/arbitrary_send_erc20_permit.sol#L52-L55", + "id": "7ebee7b534acb9d9502df84ba56fd0e90223cd262964c77cb9bee798eabd674b", + "check": "arbitrary-send-erc20-permit", + "impact": "High", + "confidence": "Medium" + }, + { + "elements": [ + { + "type": "function", + "name": "bad1", + "source_mapping": { + "start": 860, + "length": 232, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/arbitrary-send-erc20-permit/0.7.6/arbitrary_send_erc20_permit.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/arbitrary-send-erc20-permit/0.7.6/arbitrary_send_erc20_permit.sol", + "is_dependency": false, + "lines": [ + 32, + 33, + 34, + 35 + ], + "starting_column": 5, + "ending_column": 6 + }, + "type_specific_fields": { + "parent": { + "type": "contract", + "name": "C", + "source_mapping": { + "start": 630, + "length": 1433, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/arbitrary-send-erc20-permit/0.7.6/arbitrary_send_erc20_permit.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/arbitrary-send-erc20-permit/0.7.6/arbitrary_send_erc20_permit.sol", + "is_dependency": false, + "lines": [ + 19, + 20, + 21, + 22, + 23, + 24, + 25, + 26, + 27, + 28, + 29, + 30, + 31, + 32, + 33, + 34, + 35, + 36, + 37, + 38, + 39, + 40, + 41, + 42, + 43, + 44, + 45, + 46, + 47, + 48, + 49, + 50, + 51, + 52, + 53, + 54, + 55, + 56, + 57 + ], + "starting_column": 1, + "ending_column": 2 + } + }, + "signature": "bad1(address,uint256,uint256,uint8,bytes32,bytes32,address)" + } + }, + { + "type": "node", + "name": "erc20.transferFrom(from,to,value)", + "source_mapping": { + "start": 1050, + "length": 35, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/arbitrary-send-erc20-permit/0.7.6/arbitrary_send_erc20_permit.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/arbitrary-send-erc20-permit/0.7.6/arbitrary_send_erc20_permit.sol", + "is_dependency": false, + "lines": [ + 34 + ], + "starting_column": 9, + "ending_column": 44 + }, + "type_specific_fields": { + "parent": { + "type": "function", + "name": "bad1", + "source_mapping": { + "start": 860, + "length": 232, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/arbitrary-send-erc20-permit/0.7.6/arbitrary_send_erc20_permit.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/arbitrary-send-erc20-permit/0.7.6/arbitrary_send_erc20_permit.sol", + "is_dependency": false, + "lines": [ + 32, + 33, + 34, + 35 + ], + "starting_column": 5, + "ending_column": 6 + }, + "type_specific_fields": { + "parent": { + "type": "contract", + "name": "C", + "source_mapping": { + "start": 630, + "length": 1433, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/arbitrary-send-erc20-permit/0.7.6/arbitrary_send_erc20_permit.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/arbitrary-send-erc20-permit/0.7.6/arbitrary_send_erc20_permit.sol", + "is_dependency": false, + "lines": [ + 19, + 20, + 21, + 22, + 23, + 24, + 25, + 26, + 27, + 28, + 29, + 30, + 31, + 32, + 33, + 34, + 35, + 36, + 37, + 38, + 39, + 40, + 41, + 42, + 43, + 44, + 45, + 46, + 47, + 48, + 49, + 50, + 51, + 52, + 53, + 54, + 55, + 56, + 57 + ], + "starting_column": 1, + "ending_column": 2 + } + }, + "signature": "bad1(address,uint256,uint256,uint8,bytes32,bytes32,address)" + } + } + } + } + ], + "description": "C.bad1(address,uint256,uint256,uint8,bytes32,bytes32,address) (tests/detectors/arbitrary-send-erc20-permit/0.7.6/arbitrary_send_erc20_permit.sol#32-35) uses arbitrary from in transferFrom in combination with permit: erc20.transferFrom(from,to,value) (tests/detectors/arbitrary-send-erc20-permit/0.7.6/arbitrary_send_erc20_permit.sol#34)\n", + "markdown": "[C.bad1(address,uint256,uint256,uint8,bytes32,bytes32,address)](tests/detectors/arbitrary-send-erc20-permit/0.7.6/arbitrary_send_erc20_permit.sol#L32-L35) uses arbitrary from in transferFrom in combination with permit: [erc20.transferFrom(from,to,value)](tests/detectors/arbitrary-send-erc20-permit/0.7.6/arbitrary_send_erc20_permit.sol#L34)\n", + "first_markdown_element": "tests/detectors/arbitrary-send-erc20-permit/0.7.6/arbitrary_send_erc20_permit.sol#L32-L35", + "id": "ba2c627103717a52a46b52714313000eb4f9d96f57dfac874854a3747ace5a13", + "check": "arbitrary-send-erc20-permit", + "impact": "High", + "confidence": "Medium" + }, + { + "elements": [ + { + "type": "function", + "name": "int_transferFrom", + "source_mapping": { + "start": 1311, + "length": 246, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/arbitrary-send-erc20-permit/0.7.6/arbitrary_send_erc20_permit.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/arbitrary-send-erc20-permit/0.7.6/arbitrary_send_erc20_permit.sol", + "is_dependency": false, + "lines": [ + 42, + 43, + 44, + 45 + ], + "starting_column": 5, + "ending_column": 6 + }, + "type_specific_fields": { + "parent": { + "type": "contract", + "name": "C", + "source_mapping": { + "start": 630, + "length": 1433, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/arbitrary-send-erc20-permit/0.7.6/arbitrary_send_erc20_permit.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/arbitrary-send-erc20-permit/0.7.6/arbitrary_send_erc20_permit.sol", + "is_dependency": false, + "lines": [ + 19, + 20, + 21, + 22, + 23, + 24, + 25, + 26, + 27, + 28, + 29, + 30, + 31, + 32, + 33, + 34, + 35, + 36, + 37, + 38, + 39, + 40, + 41, + 42, + 43, + 44, + 45, + 46, + 47, + 48, + 49, + 50, + 51, + 52, + 53, + 54, + 55, + 56, + 57 + ], + "starting_column": 1, + "ending_column": 2 + } + }, + "signature": "int_transferFrom(address,uint256,uint256,uint8,bytes32,bytes32,address)" + } + }, + { + "type": "node", + "name": "erc20.transferFrom(from,to,value)", + "source_mapping": { + "start": 1515, + "length": 35, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/arbitrary-send-erc20-permit/0.7.6/arbitrary_send_erc20_permit.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/arbitrary-send-erc20-permit/0.7.6/arbitrary_send_erc20_permit.sol", + "is_dependency": false, + "lines": [ + 44 + ], + "starting_column": 9, + "ending_column": 44 + }, + "type_specific_fields": { + "parent": { + "type": "function", + "name": "int_transferFrom", + "source_mapping": { + "start": 1311, + "length": 246, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/arbitrary-send-erc20-permit/0.7.6/arbitrary_send_erc20_permit.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/arbitrary-send-erc20-permit/0.7.6/arbitrary_send_erc20_permit.sol", + "is_dependency": false, + "lines": [ + 42, + 43, + 44, + 45 + ], + "starting_column": 5, + "ending_column": 6 + }, + "type_specific_fields": { + "parent": { + "type": "contract", + "name": "C", + "source_mapping": { + "start": 630, + "length": 1433, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/arbitrary-send-erc20-permit/0.7.6/arbitrary_send_erc20_permit.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/arbitrary-send-erc20-permit/0.7.6/arbitrary_send_erc20_permit.sol", + "is_dependency": false, + "lines": [ + 19, + 20, + 21, + 22, + 23, + 24, + 25, + 26, + 27, + 28, + 29, + 30, + 31, + 32, + 33, + 34, + 35, + 36, + 37, + 38, + 39, + 40, + 41, + 42, + 43, + 44, + 45, + 46, + 47, + 48, + 49, + 50, + 51, + 52, + 53, + 54, + 55, + 56, + 57 + ], + "starting_column": 1, + "ending_column": 2 + } + }, + "signature": "int_transferFrom(address,uint256,uint256,uint8,bytes32,bytes32,address)" + } + } + } + } + ], + "description": "C.int_transferFrom(address,uint256,uint256,uint8,bytes32,bytes32,address) (tests/detectors/arbitrary-send-erc20-permit/0.7.6/arbitrary_send_erc20_permit.sol#42-45) uses arbitrary from in transferFrom in combination with permit: erc20.transferFrom(from,to,value) (tests/detectors/arbitrary-send-erc20-permit/0.7.6/arbitrary_send_erc20_permit.sol#44)\n", + "markdown": "[C.int_transferFrom(address,uint256,uint256,uint8,bytes32,bytes32,address)](tests/detectors/arbitrary-send-erc20-permit/0.7.6/arbitrary_send_erc20_permit.sol#L42-L45) uses arbitrary from in transferFrom in combination with permit: [erc20.transferFrom(from,to,value)](tests/detectors/arbitrary-send-erc20-permit/0.7.6/arbitrary_send_erc20_permit.sol#L44)\n", + "first_markdown_element": "tests/detectors/arbitrary-send-erc20-permit/0.7.6/arbitrary_send_erc20_permit.sol#L42-L45", + "id": "d56199ce2b7249389dffba8e53278f5ae32fbdda8a51cae8b5eb1cf2c09a0578", + "check": "arbitrary-send-erc20-permit", + "impact": "High", + "confidence": "Medium" + } + ] +] \ No newline at end of file diff --git a/tests/detectors/arbitrary-send-erc20-permit/0.8.0/arbitrary_send_erc20_permit.sol b/tests/detectors/arbitrary-send-erc20-permit/0.8.0/arbitrary_send_erc20_permit.sol new file mode 100644 index 000000000..99ecbe488 --- /dev/null +++ b/tests/detectors/arbitrary-send-erc20-permit/0.8.0/arbitrary_send_erc20_permit.sol @@ -0,0 +1,57 @@ +pragma solidity 0.8.0; + +library SafeERC20 { + function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {} +} + +interface IERC20 { + function transferFrom(address, address, uint256) external returns(bool); + function permit(address, address, uint256, uint256, uint8, bytes32, bytes32) external; +} + +contract ERC20 is IERC20 { + function transferFrom(address from, address to, uint256 amount) external override returns(bool) { + return true; + } + function permit(address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) external override {} +} + +contract C { + using SafeERC20 for IERC20; + + IERC20 erc20; + address notsend; + address send; + + constructor() public { + erc20 = new ERC20(); + notsend = address(0x3); + send = msg.sender; + } + + function bad1(address from, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s, address to) public { + erc20.permit(from, address(this), value, deadline, v, r, s); + erc20.transferFrom(from, to, value); + } + + // This is not detected + function bad2(address from, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s, address to) public { + int_transferFrom(from,value, deadline, v, r, s, to); + } + + function int_transferFrom(address from, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s, address to) internal { + erc20.permit(from, address(this), value, deadline, v, r, s); + erc20.transferFrom(from, to, value); + } + + function bad3(address from, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s, address to) external { + erc20.permit(from, address(this), value, deadline, v, r, s); + erc20.safeTransferFrom(from, to, value); + } + + function bad4(address from, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s, address to) external { + erc20.permit(from, address(this), value, deadline, v, r, s); + SafeERC20.safeTransferFrom(erc20, from, to, value); + } + +} diff --git a/tests/detectors/arbitrary-send-erc20-permit/0.8.0/arbitrary_send_erc20_permit.sol.0.8.0.ArbitrarySendErc20Permit.json b/tests/detectors/arbitrary-send-erc20-permit/0.8.0/arbitrary_send_erc20_permit.sol.0.8.0.ArbitrarySendErc20Permit.json new file mode 100644 index 000000000..8adf73c17 --- /dev/null +++ b/tests/detectors/arbitrary-send-erc20-permit/0.8.0/arbitrary_send_erc20_permit.sol.0.8.0.ArbitrarySendErc20Permit.json @@ -0,0 +1,768 @@ +[ + [ + { + "elements": [ + { + "type": "function", + "name": "bad4", + "source_mapping": { + "start": 1811, + "length": 249, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/arbitrary-send-erc20-permit/0.8.0/arbitrary_send_erc20_permit.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/arbitrary-send-erc20-permit/0.8.0/arbitrary_send_erc20_permit.sol", + "is_dependency": false, + "lines": [ + 52, + 53, + 54, + 55 + ], + "starting_column": 5, + "ending_column": 6 + }, + "type_specific_fields": { + "parent": { + "type": "contract", + "name": "C", + "source_mapping": { + "start": 630, + "length": 1433, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/arbitrary-send-erc20-permit/0.8.0/arbitrary_send_erc20_permit.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/arbitrary-send-erc20-permit/0.8.0/arbitrary_send_erc20_permit.sol", + "is_dependency": false, + "lines": [ + 19, + 20, + 21, + 22, + 23, + 24, + 25, + 26, + 27, + 28, + 29, + 30, + 31, + 32, + 33, + 34, + 35, + 36, + 37, + 38, + 39, + 40, + 41, + 42, + 43, + 44, + 45, + 46, + 47, + 48, + 49, + 50, + 51, + 52, + 53, + 54, + 55, + 56, + 57 + ], + "starting_column": 1, + "ending_column": 2 + } + }, + "signature": "bad4(address,uint256,uint256,uint8,bytes32,bytes32,address)" + } + }, + { + "type": "node", + "name": "SafeERC20.safeTransferFrom(erc20,from,to,value)", + "source_mapping": { + "start": 2003, + "length": 50, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/arbitrary-send-erc20-permit/0.8.0/arbitrary_send_erc20_permit.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/arbitrary-send-erc20-permit/0.8.0/arbitrary_send_erc20_permit.sol", + "is_dependency": false, + "lines": [ + 54 + ], + "starting_column": 9, + "ending_column": 59 + }, + "type_specific_fields": { + "parent": { + "type": "function", + "name": "bad4", + "source_mapping": { + "start": 1811, + "length": 249, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/arbitrary-send-erc20-permit/0.8.0/arbitrary_send_erc20_permit.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/arbitrary-send-erc20-permit/0.8.0/arbitrary_send_erc20_permit.sol", + "is_dependency": false, + "lines": [ + 52, + 53, + 54, + 55 + ], + "starting_column": 5, + "ending_column": 6 + }, + "type_specific_fields": { + "parent": { + "type": "contract", + "name": "C", + "source_mapping": { + "start": 630, + "length": 1433, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/arbitrary-send-erc20-permit/0.8.0/arbitrary_send_erc20_permit.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/arbitrary-send-erc20-permit/0.8.0/arbitrary_send_erc20_permit.sol", + "is_dependency": false, + "lines": [ + 19, + 20, + 21, + 22, + 23, + 24, + 25, + 26, + 27, + 28, + 29, + 30, + 31, + 32, + 33, + 34, + 35, + 36, + 37, + 38, + 39, + 40, + 41, + 42, + 43, + 44, + 45, + 46, + 47, + 48, + 49, + 50, + 51, + 52, + 53, + 54, + 55, + 56, + 57 + ], + "starting_column": 1, + "ending_column": 2 + } + }, + "signature": "bad4(address,uint256,uint256,uint8,bytes32,bytes32,address)" + } + } + } + } + ], + "description": "C.bad4(address,uint256,uint256,uint8,bytes32,bytes32,address) (tests/detectors/arbitrary-send-erc20-permit/0.8.0/arbitrary_send_erc20_permit.sol#52-55) uses arbitrary from in transferFrom in combination with permit: SafeERC20.safeTransferFrom(erc20,from,to,value) (tests/detectors/arbitrary-send-erc20-permit/0.8.0/arbitrary_send_erc20_permit.sol#54)\n", + "markdown": "[C.bad4(address,uint256,uint256,uint8,bytes32,bytes32,address)](tests/detectors/arbitrary-send-erc20-permit/0.8.0/arbitrary_send_erc20_permit.sol#L52-L55) uses arbitrary from in transferFrom in combination with permit: [SafeERC20.safeTransferFrom(erc20,from,to,value)](tests/detectors/arbitrary-send-erc20-permit/0.8.0/arbitrary_send_erc20_permit.sol#L54)\n", + "first_markdown_element": "tests/detectors/arbitrary-send-erc20-permit/0.8.0/arbitrary_send_erc20_permit.sol#L52-L55", + "id": "136a1b6c001d3ca4b1aab662556139786307e1bf4cb929f4c507d592eb38cb72", + "check": "arbitrary-send-erc20-permit", + "impact": "High", + "confidence": "Medium" + }, + { + "elements": [ + { + "type": "function", + "name": "int_transferFrom", + "source_mapping": { + "start": 1311, + "length": 246, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/arbitrary-send-erc20-permit/0.8.0/arbitrary_send_erc20_permit.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/arbitrary-send-erc20-permit/0.8.0/arbitrary_send_erc20_permit.sol", + "is_dependency": false, + "lines": [ + 42, + 43, + 44, + 45 + ], + "starting_column": 5, + "ending_column": 6 + }, + "type_specific_fields": { + "parent": { + "type": "contract", + "name": "C", + "source_mapping": { + "start": 630, + "length": 1433, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/arbitrary-send-erc20-permit/0.8.0/arbitrary_send_erc20_permit.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/arbitrary-send-erc20-permit/0.8.0/arbitrary_send_erc20_permit.sol", + "is_dependency": false, + "lines": [ + 19, + 20, + 21, + 22, + 23, + 24, + 25, + 26, + 27, + 28, + 29, + 30, + 31, + 32, + 33, + 34, + 35, + 36, + 37, + 38, + 39, + 40, + 41, + 42, + 43, + 44, + 45, + 46, + 47, + 48, + 49, + 50, + 51, + 52, + 53, + 54, + 55, + 56, + 57 + ], + "starting_column": 1, + "ending_column": 2 + } + }, + "signature": "int_transferFrom(address,uint256,uint256,uint8,bytes32,bytes32,address)" + } + }, + { + "type": "node", + "name": "erc20.transferFrom(from,to,value)", + "source_mapping": { + "start": 1515, + "length": 35, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/arbitrary-send-erc20-permit/0.8.0/arbitrary_send_erc20_permit.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/arbitrary-send-erc20-permit/0.8.0/arbitrary_send_erc20_permit.sol", + "is_dependency": false, + "lines": [ + 44 + ], + "starting_column": 9, + "ending_column": 44 + }, + "type_specific_fields": { + "parent": { + "type": "function", + "name": "int_transferFrom", + "source_mapping": { + "start": 1311, + "length": 246, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/arbitrary-send-erc20-permit/0.8.0/arbitrary_send_erc20_permit.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/arbitrary-send-erc20-permit/0.8.0/arbitrary_send_erc20_permit.sol", + "is_dependency": false, + "lines": [ + 42, + 43, + 44, + 45 + ], + "starting_column": 5, + "ending_column": 6 + }, + "type_specific_fields": { + "parent": { + "type": "contract", + "name": "C", + "source_mapping": { + "start": 630, + "length": 1433, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/arbitrary-send-erc20-permit/0.8.0/arbitrary_send_erc20_permit.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/arbitrary-send-erc20-permit/0.8.0/arbitrary_send_erc20_permit.sol", + "is_dependency": false, + "lines": [ + 19, + 20, + 21, + 22, + 23, + 24, + 25, + 26, + 27, + 28, + 29, + 30, + 31, + 32, + 33, + 34, + 35, + 36, + 37, + 38, + 39, + 40, + 41, + 42, + 43, + 44, + 45, + 46, + 47, + 48, + 49, + 50, + 51, + 52, + 53, + 54, + 55, + 56, + 57 + ], + "starting_column": 1, + "ending_column": 2 + } + }, + "signature": "int_transferFrom(address,uint256,uint256,uint8,bytes32,bytes32,address)" + } + } + } + } + ], + "description": "C.int_transferFrom(address,uint256,uint256,uint8,bytes32,bytes32,address) (tests/detectors/arbitrary-send-erc20-permit/0.8.0/arbitrary_send_erc20_permit.sol#42-45) uses arbitrary from in transferFrom in combination with permit: erc20.transferFrom(from,to,value) (tests/detectors/arbitrary-send-erc20-permit/0.8.0/arbitrary_send_erc20_permit.sol#44)\n", + "markdown": "[C.int_transferFrom(address,uint256,uint256,uint8,bytes32,bytes32,address)](tests/detectors/arbitrary-send-erc20-permit/0.8.0/arbitrary_send_erc20_permit.sol#L42-L45) uses arbitrary from in transferFrom in combination with permit: [erc20.transferFrom(from,to,value)](tests/detectors/arbitrary-send-erc20-permit/0.8.0/arbitrary_send_erc20_permit.sol#L44)\n", + "first_markdown_element": "tests/detectors/arbitrary-send-erc20-permit/0.8.0/arbitrary_send_erc20_permit.sol#L42-L45", + "id": "398cc3de119232bd6688c797ddfb4f84d7587dbf9f72f3056898bfc442a5fd85", + "check": "arbitrary-send-erc20-permit", + "impact": "High", + "confidence": "Medium" + }, + { + "elements": [ + { + "type": "function", + "name": "bad1", + "source_mapping": { + "start": 860, + "length": 232, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/arbitrary-send-erc20-permit/0.8.0/arbitrary_send_erc20_permit.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/arbitrary-send-erc20-permit/0.8.0/arbitrary_send_erc20_permit.sol", + "is_dependency": false, + "lines": [ + 32, + 33, + 34, + 35 + ], + "starting_column": 5, + "ending_column": 6 + }, + "type_specific_fields": { + "parent": { + "type": "contract", + "name": "C", + "source_mapping": { + "start": 630, + "length": 1433, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/arbitrary-send-erc20-permit/0.8.0/arbitrary_send_erc20_permit.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/arbitrary-send-erc20-permit/0.8.0/arbitrary_send_erc20_permit.sol", + "is_dependency": false, + "lines": [ + 19, + 20, + 21, + 22, + 23, + 24, + 25, + 26, + 27, + 28, + 29, + 30, + 31, + 32, + 33, + 34, + 35, + 36, + 37, + 38, + 39, + 40, + 41, + 42, + 43, + 44, + 45, + 46, + 47, + 48, + 49, + 50, + 51, + 52, + 53, + 54, + 55, + 56, + 57 + ], + "starting_column": 1, + "ending_column": 2 + } + }, + "signature": "bad1(address,uint256,uint256,uint8,bytes32,bytes32,address)" + } + }, + { + "type": "node", + "name": "erc20.transferFrom(from,to,value)", + "source_mapping": { + "start": 1050, + "length": 35, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/arbitrary-send-erc20-permit/0.8.0/arbitrary_send_erc20_permit.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/arbitrary-send-erc20-permit/0.8.0/arbitrary_send_erc20_permit.sol", + "is_dependency": false, + "lines": [ + 34 + ], + "starting_column": 9, + "ending_column": 44 + }, + "type_specific_fields": { + "parent": { + "type": "function", + "name": "bad1", + "source_mapping": { + "start": 860, + "length": 232, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/arbitrary-send-erc20-permit/0.8.0/arbitrary_send_erc20_permit.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/arbitrary-send-erc20-permit/0.8.0/arbitrary_send_erc20_permit.sol", + "is_dependency": false, + "lines": [ + 32, + 33, + 34, + 35 + ], + "starting_column": 5, + "ending_column": 6 + }, + "type_specific_fields": { + "parent": { + "type": "contract", + "name": "C", + "source_mapping": { + "start": 630, + "length": 1433, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/arbitrary-send-erc20-permit/0.8.0/arbitrary_send_erc20_permit.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/arbitrary-send-erc20-permit/0.8.0/arbitrary_send_erc20_permit.sol", + "is_dependency": false, + "lines": [ + 19, + 20, + 21, + 22, + 23, + 24, + 25, + 26, + 27, + 28, + 29, + 30, + 31, + 32, + 33, + 34, + 35, + 36, + 37, + 38, + 39, + 40, + 41, + 42, + 43, + 44, + 45, + 46, + 47, + 48, + 49, + 50, + 51, + 52, + 53, + 54, + 55, + 56, + 57 + ], + "starting_column": 1, + "ending_column": 2 + } + }, + "signature": "bad1(address,uint256,uint256,uint8,bytes32,bytes32,address)" + } + } + } + } + ], + "description": "C.bad1(address,uint256,uint256,uint8,bytes32,bytes32,address) (tests/detectors/arbitrary-send-erc20-permit/0.8.0/arbitrary_send_erc20_permit.sol#32-35) uses arbitrary from in transferFrom in combination with permit: erc20.transferFrom(from,to,value) (tests/detectors/arbitrary-send-erc20-permit/0.8.0/arbitrary_send_erc20_permit.sol#34)\n", + "markdown": "[C.bad1(address,uint256,uint256,uint8,bytes32,bytes32,address)](tests/detectors/arbitrary-send-erc20-permit/0.8.0/arbitrary_send_erc20_permit.sol#L32-L35) uses arbitrary from in transferFrom in combination with permit: [erc20.transferFrom(from,to,value)](tests/detectors/arbitrary-send-erc20-permit/0.8.0/arbitrary_send_erc20_permit.sol#L34)\n", + "first_markdown_element": "tests/detectors/arbitrary-send-erc20-permit/0.8.0/arbitrary_send_erc20_permit.sol#L32-L35", + "id": "429dd8afad02f0e6869b1de2a82bf36ab35aaf74ba5909de5facd767f4642f32", + "check": "arbitrary-send-erc20-permit", + "impact": "High", + "confidence": "Medium" + }, + { + "elements": [ + { + "type": "function", + "name": "bad3", + "source_mapping": { + "start": 1563, + "length": 238, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/arbitrary-send-erc20-permit/0.8.0/arbitrary_send_erc20_permit.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/arbitrary-send-erc20-permit/0.8.0/arbitrary_send_erc20_permit.sol", + "is_dependency": false, + "lines": [ + 47, + 48, + 49, + 50 + ], + "starting_column": 5, + "ending_column": 6 + }, + "type_specific_fields": { + "parent": { + "type": "contract", + "name": "C", + "source_mapping": { + "start": 630, + "length": 1433, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/arbitrary-send-erc20-permit/0.8.0/arbitrary_send_erc20_permit.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/arbitrary-send-erc20-permit/0.8.0/arbitrary_send_erc20_permit.sol", + "is_dependency": false, + "lines": [ + 19, + 20, + 21, + 22, + 23, + 24, + 25, + 26, + 27, + 28, + 29, + 30, + 31, + 32, + 33, + 34, + 35, + 36, + 37, + 38, + 39, + 40, + 41, + 42, + 43, + 44, + 45, + 46, + 47, + 48, + 49, + 50, + 51, + 52, + 53, + 54, + 55, + 56, + 57 + ], + "starting_column": 1, + "ending_column": 2 + } + }, + "signature": "bad3(address,uint256,uint256,uint8,bytes32,bytes32,address)" + } + }, + { + "type": "node", + "name": "erc20.safeTransferFrom(from,to,value)", + "source_mapping": { + "start": 1755, + "length": 39, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/arbitrary-send-erc20-permit/0.8.0/arbitrary_send_erc20_permit.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/arbitrary-send-erc20-permit/0.8.0/arbitrary_send_erc20_permit.sol", + "is_dependency": false, + "lines": [ + 49 + ], + "starting_column": 9, + "ending_column": 48 + }, + "type_specific_fields": { + "parent": { + "type": "function", + "name": "bad3", + "source_mapping": { + "start": 1563, + "length": 238, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/arbitrary-send-erc20-permit/0.8.0/arbitrary_send_erc20_permit.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/arbitrary-send-erc20-permit/0.8.0/arbitrary_send_erc20_permit.sol", + "is_dependency": false, + "lines": [ + 47, + 48, + 49, + 50 + ], + "starting_column": 5, + "ending_column": 6 + }, + "type_specific_fields": { + "parent": { + "type": "contract", + "name": "C", + "source_mapping": { + "start": 630, + "length": 1433, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/arbitrary-send-erc20-permit/0.8.0/arbitrary_send_erc20_permit.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/arbitrary-send-erc20-permit/0.8.0/arbitrary_send_erc20_permit.sol", + "is_dependency": false, + "lines": [ + 19, + 20, + 21, + 22, + 23, + 24, + 25, + 26, + 27, + 28, + 29, + 30, + 31, + 32, + 33, + 34, + 35, + 36, + 37, + 38, + 39, + 40, + 41, + 42, + 43, + 44, + 45, + 46, + 47, + 48, + 49, + 50, + 51, + 52, + 53, + 54, + 55, + 56, + 57 + ], + "starting_column": 1, + "ending_column": 2 + } + }, + "signature": "bad3(address,uint256,uint256,uint8,bytes32,bytes32,address)" + } + } + } + } + ], + "description": "C.bad3(address,uint256,uint256,uint8,bytes32,bytes32,address) (tests/detectors/arbitrary-send-erc20-permit/0.8.0/arbitrary_send_erc20_permit.sol#47-50) uses arbitrary from in transferFrom in combination with permit: erc20.safeTransferFrom(from,to,value) (tests/detectors/arbitrary-send-erc20-permit/0.8.0/arbitrary_send_erc20_permit.sol#49)\n", + "markdown": "[C.bad3(address,uint256,uint256,uint8,bytes32,bytes32,address)](tests/detectors/arbitrary-send-erc20-permit/0.8.0/arbitrary_send_erc20_permit.sol#L47-L50) uses arbitrary from in transferFrom in combination with permit: [erc20.safeTransferFrom(from,to,value)](tests/detectors/arbitrary-send-erc20-permit/0.8.0/arbitrary_send_erc20_permit.sol#L49)\n", + "first_markdown_element": "tests/detectors/arbitrary-send-erc20-permit/0.8.0/arbitrary_send_erc20_permit.sol#L47-L50", + "id": "7841a86248d8345520e98b963d59de36814b25e5fa3cef9e031c61d05a7feb2a", + "check": "arbitrary-send-erc20-permit", + "impact": "High", + "confidence": "Medium" + } + ] +] \ No newline at end of file diff --git a/tests/detectors/arbitrary-send-erc20/0.4.25/arbitrary_send_erc20.sol b/tests/detectors/arbitrary-send-erc20/0.4.25/arbitrary_send_erc20.sol new file mode 100644 index 000000000..8695d2de8 --- /dev/null +++ b/tests/detectors/arbitrary-send-erc20/0.4.25/arbitrary_send_erc20.sol @@ -0,0 +1,77 @@ +pragma solidity 0.4.25; + +library SafeERC20 { + function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {} +} + +interface IERC20 { + function transferFrom(address, address, uint256) external returns(bool); +} + +contract ERC20 is IERC20 { + function transferFrom(address from, address to, uint256 amount) external returns(bool) { + return true; + } +} + +contract C { + using SafeERC20 for IERC20; + + IERC20 erc20; + address notsend; + address send; + + constructor() public { + erc20 = new ERC20(); + notsend = address(0x3); + send = msg.sender; + } + + function good1(address to, uint256 am) public { + address from_msgsender = msg.sender; + erc20.transferFrom(from_msgsender, to, am); + } + + function bad1(address to, uint256 am) public { + erc20.transferFrom(notsend, to, am); + } + + function good2(address to, uint256 am) public { + address from_msgsender = msg.sender; + int_transferFrom(from_msgsender, to, am); + } + + // This is not detected + function bad2(address from, address to, uint256 am) public { + int_transferFrom(from, to, am); + } + + function int_transferFrom(address from, address to, uint256 amount) internal { + erc20.transferFrom(from, to, amount); + } + + function good3(address to, uint256 amount) external { + erc20.safeTransferFrom(msg.sender, to, amount); + } + + function bad3(address from, address to, uint256 amount) external { + erc20.safeTransferFrom(from, to, amount); + } + + function good4(address to, uint256 amount) external { + SafeERC20.safeTransferFrom(erc20, msg.sender, to, amount); + } + + function bad4(address from, address to, uint256 amount) external { + SafeERC20.safeTransferFrom(erc20, from, to, amount); + } + + function good5(address to, uint256 amount) external { + SafeERC20.safeTransferFrom(erc20, address(this), to, amount); + } + + function good6(address from, address to, uint256 amount) external { + erc20.safeTransferFrom(address(this), to, amount); + } + +} diff --git a/tests/detectors/arbitrary-send-erc20/0.4.25/arbitrary_send_erc20.sol.0.4.25.ArbitrarySendErc20NoPermit.json b/tests/detectors/arbitrary-send-erc20/0.4.25/arbitrary_send_erc20.sol.0.4.25.ArbitrarySendErc20NoPermit.json new file mode 100644 index 000000000..cf6feaa5a --- /dev/null +++ b/tests/detectors/arbitrary-send-erc20/0.4.25/arbitrary_send_erc20.sol.0.4.25.ArbitrarySendErc20NoPermit.json @@ -0,0 +1,703 @@ +[ + [ + { + "elements": [ + { + "type": "function", + "name": "bad1", + "source_mapping": { + "start": 780, + "length": 97, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/arbitrary-send-erc20/0.4.25/arbitrary_send_erc20.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/arbitrary-send-erc20/0.4.25/arbitrary_send_erc20.sol", + "is_dependency": false, + "lines": [ + 35, + 36, + 37 + ], + "starting_column": 5, + "ending_column": 6 + }, + "type_specific_fields": { + "parent": { + "type": "contract", + "name": "C", + "source_mapping": { + "start": 394, + "length": 1717, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/arbitrary-send-erc20/0.4.25/arbitrary_send_erc20.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/arbitrary-send-erc20/0.4.25/arbitrary_send_erc20.sol", + "is_dependency": false, + "lines": [ + 17, + 18, + 19, + 20, + 21, + 22, + 23, + 24, + 25, + 26, + 27, + 28, + 29, + 30, + 31, + 32, + 33, + 34, + 35, + 36, + 37, + 38, + 39, + 40, + 41, + 42, + 43, + 44, + 45, + 46, + 47, + 48, + 49, + 50, + 51, + 52, + 53, + 54, + 55, + 56, + 57, + 58, + 59, + 60, + 61, + 62, + 63, + 64, + 65, + 66, + 67, + 68, + 69, + 70, + 71, + 72, + 73, + 74, + 75, + 76, + 77 + ], + "starting_column": 1, + "ending_column": 2 + } + }, + "signature": "bad1(address,uint256)" + } + }, + { + "type": "node", + "name": "erc20.transferFrom(notsend,to,am)", + "source_mapping": { + "start": 835, + "length": 35, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/arbitrary-send-erc20/0.4.25/arbitrary_send_erc20.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/arbitrary-send-erc20/0.4.25/arbitrary_send_erc20.sol", + "is_dependency": false, + "lines": [ + 36 + ], + "starting_column": 9, + "ending_column": 44 + }, + "type_specific_fields": { + "parent": { + "type": "function", + "name": "bad1", + "source_mapping": { + "start": 780, + "length": 97, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/arbitrary-send-erc20/0.4.25/arbitrary_send_erc20.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/arbitrary-send-erc20/0.4.25/arbitrary_send_erc20.sol", + "is_dependency": false, + "lines": [ + 35, + 36, + 37 + ], + "starting_column": 5, + "ending_column": 6 + }, + "type_specific_fields": { + "parent": { + "type": "contract", + "name": "C", + "source_mapping": { + "start": 394, + "length": 1717, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/arbitrary-send-erc20/0.4.25/arbitrary_send_erc20.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/arbitrary-send-erc20/0.4.25/arbitrary_send_erc20.sol", + "is_dependency": false, + "lines": [ + 17, + 18, + 19, + 20, + 21, + 22, + 23, + 24, + 25, + 26, + 27, + 28, + 29, + 30, + 31, + 32, + 33, + 34, + 35, + 36, + 37, + 38, + 39, + 40, + 41, + 42, + 43, + 44, + 45, + 46, + 47, + 48, + 49, + 50, + 51, + 52, + 53, + 54, + 55, + 56, + 57, + 58, + 59, + 60, + 61, + 62, + 63, + 64, + 65, + 66, + 67, + 68, + 69, + 70, + 71, + 72, + 73, + 74, + 75, + 76, + 77 + ], + "starting_column": 1, + "ending_column": 2 + } + }, + "signature": "bad1(address,uint256)" + } + } + } + } + ], + "description": "C.bad1(address,uint256) (tests/detectors/arbitrary-send-erc20/0.4.25/arbitrary_send_erc20.sol#35-37) uses arbitrary from in transferFrom: erc20.transferFrom(notsend,to,am) (tests/detectors/arbitrary-send-erc20/0.4.25/arbitrary_send_erc20.sol#36)\n", + "markdown": "[C.bad1(address,uint256)](tests/detectors/arbitrary-send-erc20/0.4.25/arbitrary_send_erc20.sol#L35-L37) uses arbitrary from in transferFrom: [erc20.transferFrom(notsend,to,am)](tests/detectors/arbitrary-send-erc20/0.4.25/arbitrary_send_erc20.sol#L36)\n", + "first_markdown_element": "tests/detectors/arbitrary-send-erc20/0.4.25/arbitrary_send_erc20.sol#L35-L37", + "id": "430afa4e7855d25b1262162894fa21d58eea2571578d45de5399baf3eb438038", + "check": "arbitrary-send-erc20", + "impact": "High", + "confidence": "High" + }, + { + "elements": [ + { + "type": "function", + "name": "bad4", + "source_mapping": { + "start": 1702, + "length": 133, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/arbitrary-send-erc20/0.4.25/arbitrary_send_erc20.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/arbitrary-send-erc20/0.4.25/arbitrary_send_erc20.sol", + "is_dependency": false, + "lines": [ + 65, + 66, + 67 + ], + "starting_column": 5, + "ending_column": 6 + }, + "type_specific_fields": { + "parent": { + "type": "contract", + "name": "C", + "source_mapping": { + "start": 394, + "length": 1717, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/arbitrary-send-erc20/0.4.25/arbitrary_send_erc20.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/arbitrary-send-erc20/0.4.25/arbitrary_send_erc20.sol", + "is_dependency": false, + "lines": [ + 17, + 18, + 19, + 20, + 21, + 22, + 23, + 24, + 25, + 26, + 27, + 28, + 29, + 30, + 31, + 32, + 33, + 34, + 35, + 36, + 37, + 38, + 39, + 40, + 41, + 42, + 43, + 44, + 45, + 46, + 47, + 48, + 49, + 50, + 51, + 52, + 53, + 54, + 55, + 56, + 57, + 58, + 59, + 60, + 61, + 62, + 63, + 64, + 65, + 66, + 67, + 68, + 69, + 70, + 71, + 72, + 73, + 74, + 75, + 76, + 77 + ], + "starting_column": 1, + "ending_column": 2 + } + }, + "signature": "bad4(address,address,uint256)" + } + }, + { + "type": "node", + "name": "SafeERC20.safeTransferFrom(erc20,from,to,amount)", + "source_mapping": { + "start": 1777, + "length": 51, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/arbitrary-send-erc20/0.4.25/arbitrary_send_erc20.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/arbitrary-send-erc20/0.4.25/arbitrary_send_erc20.sol", + "is_dependency": false, + "lines": [ + 66 + ], + "starting_column": 9, + "ending_column": 60 + }, + "type_specific_fields": { + "parent": { + "type": "function", + "name": "bad4", + "source_mapping": { + "start": 1702, + "length": 133, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/arbitrary-send-erc20/0.4.25/arbitrary_send_erc20.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/arbitrary-send-erc20/0.4.25/arbitrary_send_erc20.sol", + "is_dependency": false, + "lines": [ + 65, + 66, + 67 + ], + "starting_column": 5, + "ending_column": 6 + }, + "type_specific_fields": { + "parent": { + "type": "contract", + "name": "C", + "source_mapping": { + "start": 394, + "length": 1717, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/arbitrary-send-erc20/0.4.25/arbitrary_send_erc20.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/arbitrary-send-erc20/0.4.25/arbitrary_send_erc20.sol", + "is_dependency": false, + "lines": [ + 17, + 18, + 19, + 20, + 21, + 22, + 23, + 24, + 25, + 26, + 27, + 28, + 29, + 30, + 31, + 32, + 33, + 34, + 35, + 36, + 37, + 38, + 39, + 40, + 41, + 42, + 43, + 44, + 45, + 46, + 47, + 48, + 49, + 50, + 51, + 52, + 53, + 54, + 55, + 56, + 57, + 58, + 59, + 60, + 61, + 62, + 63, + 64, + 65, + 66, + 67, + 68, + 69, + 70, + 71, + 72, + 73, + 74, + 75, + 76, + 77 + ], + "starting_column": 1, + "ending_column": 2 + } + }, + "signature": "bad4(address,address,uint256)" + } + } + } + } + ], + "description": "C.bad4(address,address,uint256) (tests/detectors/arbitrary-send-erc20/0.4.25/arbitrary_send_erc20.sol#65-67) uses arbitrary from in transferFrom: SafeERC20.safeTransferFrom(erc20,from,to,amount) (tests/detectors/arbitrary-send-erc20/0.4.25/arbitrary_send_erc20.sol#66)\n", + "markdown": "[C.bad4(address,address,uint256)](tests/detectors/arbitrary-send-erc20/0.4.25/arbitrary_send_erc20.sol#L65-L67) uses arbitrary from in transferFrom: [SafeERC20.safeTransferFrom(erc20,from,to,amount)](tests/detectors/arbitrary-send-erc20/0.4.25/arbitrary_send_erc20.sol#L66)\n", + "first_markdown_element": "tests/detectors/arbitrary-send-erc20/0.4.25/arbitrary_send_erc20.sol#L65-L67", + "id": "b2557d6385585034271b9873559de9cde4972e3207c43f260663f3d0e2a4d4a0", + "check": "arbitrary-send-erc20", + "impact": "High", + "confidence": "High" + }, + { + "elements": [ + { + "type": "function", + "name": "bad3", + "source_mapping": { + "start": 1434, + "length": 122, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/arbitrary-send-erc20/0.4.25/arbitrary_send_erc20.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/arbitrary-send-erc20/0.4.25/arbitrary_send_erc20.sol", + "is_dependency": false, + "lines": [ + 57, + 58, + 59 + ], + "starting_column": 5, + "ending_column": 6 + }, + "type_specific_fields": { + "parent": { + "type": "contract", + "name": "C", + "source_mapping": { + "start": 394, + "length": 1717, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/arbitrary-send-erc20/0.4.25/arbitrary_send_erc20.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/arbitrary-send-erc20/0.4.25/arbitrary_send_erc20.sol", + "is_dependency": false, + "lines": [ + 17, + 18, + 19, + 20, + 21, + 22, + 23, + 24, + 25, + 26, + 27, + 28, + 29, + 30, + 31, + 32, + 33, + 34, + 35, + 36, + 37, + 38, + 39, + 40, + 41, + 42, + 43, + 44, + 45, + 46, + 47, + 48, + 49, + 50, + 51, + 52, + 53, + 54, + 55, + 56, + 57, + 58, + 59, + 60, + 61, + 62, + 63, + 64, + 65, + 66, + 67, + 68, + 69, + 70, + 71, + 72, + 73, + 74, + 75, + 76, + 77 + ], + "starting_column": 1, + "ending_column": 2 + } + }, + "signature": "bad3(address,address,uint256)" + } + }, + { + "type": "node", + "name": "erc20.safeTransferFrom(from,to,amount)", + "source_mapping": { + "start": 1509, + "length": 40, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/arbitrary-send-erc20/0.4.25/arbitrary_send_erc20.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/arbitrary-send-erc20/0.4.25/arbitrary_send_erc20.sol", + "is_dependency": false, + "lines": [ + 58 + ], + "starting_column": 9, + "ending_column": 49 + }, + "type_specific_fields": { + "parent": { + "type": "function", + "name": "bad3", + "source_mapping": { + "start": 1434, + "length": 122, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/arbitrary-send-erc20/0.4.25/arbitrary_send_erc20.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/arbitrary-send-erc20/0.4.25/arbitrary_send_erc20.sol", + "is_dependency": false, + "lines": [ + 57, + 58, + 59 + ], + "starting_column": 5, + "ending_column": 6 + }, + "type_specific_fields": { + "parent": { + "type": "contract", + "name": "C", + "source_mapping": { + "start": 394, + "length": 1717, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/arbitrary-send-erc20/0.4.25/arbitrary_send_erc20.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/arbitrary-send-erc20/0.4.25/arbitrary_send_erc20.sol", + "is_dependency": false, + "lines": [ + 17, + 18, + 19, + 20, + 21, + 22, + 23, + 24, + 25, + 26, + 27, + 28, + 29, + 30, + 31, + 32, + 33, + 34, + 35, + 36, + 37, + 38, + 39, + 40, + 41, + 42, + 43, + 44, + 45, + 46, + 47, + 48, + 49, + 50, + 51, + 52, + 53, + 54, + 55, + 56, + 57, + 58, + 59, + 60, + 61, + 62, + 63, + 64, + 65, + 66, + 67, + 68, + 69, + 70, + 71, + 72, + 73, + 74, + 75, + 76, + 77 + ], + "starting_column": 1, + "ending_column": 2 + } + }, + "signature": "bad3(address,address,uint256)" + } + } + } + } + ], + "description": "C.bad3(address,address,uint256) (tests/detectors/arbitrary-send-erc20/0.4.25/arbitrary_send_erc20.sol#57-59) uses arbitrary from in transferFrom: erc20.safeTransferFrom(from,to,amount) (tests/detectors/arbitrary-send-erc20/0.4.25/arbitrary_send_erc20.sol#58)\n", + "markdown": "[C.bad3(address,address,uint256)](tests/detectors/arbitrary-send-erc20/0.4.25/arbitrary_send_erc20.sol#L57-L59) uses arbitrary from in transferFrom: [erc20.safeTransferFrom(from,to,amount)](tests/detectors/arbitrary-send-erc20/0.4.25/arbitrary_send_erc20.sol#L58)\n", + "first_markdown_element": "tests/detectors/arbitrary-send-erc20/0.4.25/arbitrary_send_erc20.sol#L57-L59", + "id": "e7271d3fa958d20a025419c070ea1010431487e98e30fa2db65db9bf54a13665", + "check": "arbitrary-send-erc20", + "impact": "High", + "confidence": "High" + } + ] +] \ No newline at end of file diff --git a/tests/detectors/arbitrary-send-erc20/0.5.16/arbitrary_send_erc20.sol b/tests/detectors/arbitrary-send-erc20/0.5.16/arbitrary_send_erc20.sol new file mode 100644 index 000000000..6cf214805 --- /dev/null +++ b/tests/detectors/arbitrary-send-erc20/0.5.16/arbitrary_send_erc20.sol @@ -0,0 +1,77 @@ +pragma solidity 0.5.16; + +library SafeERC20 { + function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {} +} + +interface IERC20 { + function transferFrom(address, address, uint256) external returns(bool); +} + +contract ERC20 is IERC20 { + function transferFrom(address from, address to, uint256 amount) external returns(bool) { + return true; + } +} + +contract C { + using SafeERC20 for IERC20; + + IERC20 erc20; + address notsend; + address send; + + constructor() public { + erc20 = new ERC20(); + notsend = address(0x3); + send = msg.sender; + } + + function good1(address to, uint256 am) public { + address from_msgsender = msg.sender; + erc20.transferFrom(from_msgsender, to, am); + } + + function bad1(address to, uint256 am) public { + erc20.transferFrom(notsend, to, am); + } + + function good2(address to, uint256 am) public { + address from_msgsender = msg.sender; + int_transferFrom(from_msgsender, to, am); + } + + // This is not detected + function bad2(address from, address to, uint256 am) public { + int_transferFrom(from, to, am); + } + + function int_transferFrom(address from, address to, uint256 amount) internal { + erc20.transferFrom(from, to, amount); + } + + function good3(address to, uint256 amount) external { + erc20.safeTransferFrom(msg.sender, to, amount); + } + + function bad3(address from, address to, uint256 amount) external { + erc20.safeTransferFrom(from, to, amount); + } + + function good4(address to, uint256 amount) external { + SafeERC20.safeTransferFrom(erc20, msg.sender, to, amount); + } + + function bad4(address from, address to, uint256 amount) external { + SafeERC20.safeTransferFrom(erc20, from, to, amount); + } + + function good5(address to, uint256 amount) external { + SafeERC20.safeTransferFrom(erc20, address(this), to, amount); + } + + function good6(address from, address to, uint256 amount) external { + erc20.safeTransferFrom(address(this), to, amount); + } + +} diff --git a/tests/detectors/arbitrary-send-erc20/0.5.16/arbitrary_send_erc20.sol.0.5.16.ArbitrarySendErc20NoPermit.json b/tests/detectors/arbitrary-send-erc20/0.5.16/arbitrary_send_erc20.sol.0.5.16.ArbitrarySendErc20NoPermit.json new file mode 100644 index 000000000..18a210262 --- /dev/null +++ b/tests/detectors/arbitrary-send-erc20/0.5.16/arbitrary_send_erc20.sol.0.5.16.ArbitrarySendErc20NoPermit.json @@ -0,0 +1,703 @@ +[ + [ + { + "elements": [ + { + "type": "function", + "name": "bad4", + "source_mapping": { + "start": 1702, + "length": 133, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/arbitrary-send-erc20/0.5.16/arbitrary_send_erc20.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/arbitrary-send-erc20/0.5.16/arbitrary_send_erc20.sol", + "is_dependency": false, + "lines": [ + 65, + 66, + 67 + ], + "starting_column": 5, + "ending_column": 6 + }, + "type_specific_fields": { + "parent": { + "type": "contract", + "name": "C", + "source_mapping": { + "start": 394, + "length": 1717, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/arbitrary-send-erc20/0.5.16/arbitrary_send_erc20.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/arbitrary-send-erc20/0.5.16/arbitrary_send_erc20.sol", + "is_dependency": false, + "lines": [ + 17, + 18, + 19, + 20, + 21, + 22, + 23, + 24, + 25, + 26, + 27, + 28, + 29, + 30, + 31, + 32, + 33, + 34, + 35, + 36, + 37, + 38, + 39, + 40, + 41, + 42, + 43, + 44, + 45, + 46, + 47, + 48, + 49, + 50, + 51, + 52, + 53, + 54, + 55, + 56, + 57, + 58, + 59, + 60, + 61, + 62, + 63, + 64, + 65, + 66, + 67, + 68, + 69, + 70, + 71, + 72, + 73, + 74, + 75, + 76, + 77 + ], + "starting_column": 1, + "ending_column": 2 + } + }, + "signature": "bad4(address,address,uint256)" + } + }, + { + "type": "node", + "name": "SafeERC20.safeTransferFrom(erc20,from,to,amount)", + "source_mapping": { + "start": 1777, + "length": 51, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/arbitrary-send-erc20/0.5.16/arbitrary_send_erc20.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/arbitrary-send-erc20/0.5.16/arbitrary_send_erc20.sol", + "is_dependency": false, + "lines": [ + 66 + ], + "starting_column": 9, + "ending_column": 60 + }, + "type_specific_fields": { + "parent": { + "type": "function", + "name": "bad4", + "source_mapping": { + "start": 1702, + "length": 133, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/arbitrary-send-erc20/0.5.16/arbitrary_send_erc20.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/arbitrary-send-erc20/0.5.16/arbitrary_send_erc20.sol", + "is_dependency": false, + "lines": [ + 65, + 66, + 67 + ], + "starting_column": 5, + "ending_column": 6 + }, + "type_specific_fields": { + "parent": { + "type": "contract", + "name": "C", + "source_mapping": { + "start": 394, + "length": 1717, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/arbitrary-send-erc20/0.5.16/arbitrary_send_erc20.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/arbitrary-send-erc20/0.5.16/arbitrary_send_erc20.sol", + "is_dependency": false, + "lines": [ + 17, + 18, + 19, + 20, + 21, + 22, + 23, + 24, + 25, + 26, + 27, + 28, + 29, + 30, + 31, + 32, + 33, + 34, + 35, + 36, + 37, + 38, + 39, + 40, + 41, + 42, + 43, + 44, + 45, + 46, + 47, + 48, + 49, + 50, + 51, + 52, + 53, + 54, + 55, + 56, + 57, + 58, + 59, + 60, + 61, + 62, + 63, + 64, + 65, + 66, + 67, + 68, + 69, + 70, + 71, + 72, + 73, + 74, + 75, + 76, + 77 + ], + "starting_column": 1, + "ending_column": 2 + } + }, + "signature": "bad4(address,address,uint256)" + } + } + } + } + ], + "description": "C.bad4(address,address,uint256) (tests/detectors/arbitrary-send-erc20/0.5.16/arbitrary_send_erc20.sol#65-67) uses arbitrary from in transferFrom: SafeERC20.safeTransferFrom(erc20,from,to,amount) (tests/detectors/arbitrary-send-erc20/0.5.16/arbitrary_send_erc20.sol#66)\n", + "markdown": "[C.bad4(address,address,uint256)](tests/detectors/arbitrary-send-erc20/0.5.16/arbitrary_send_erc20.sol#L65-L67) uses arbitrary from in transferFrom: [SafeERC20.safeTransferFrom(erc20,from,to,amount)](tests/detectors/arbitrary-send-erc20/0.5.16/arbitrary_send_erc20.sol#L66)\n", + "first_markdown_element": "tests/detectors/arbitrary-send-erc20/0.5.16/arbitrary_send_erc20.sol#L65-L67", + "id": "15a810d738734100851211c7e6bff65724d553eb693869575ec3d9c9bf47081c", + "check": "arbitrary-send-erc20", + "impact": "High", + "confidence": "High" + }, + { + "elements": [ + { + "type": "function", + "name": "bad1", + "source_mapping": { + "start": 780, + "length": 97, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/arbitrary-send-erc20/0.5.16/arbitrary_send_erc20.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/arbitrary-send-erc20/0.5.16/arbitrary_send_erc20.sol", + "is_dependency": false, + "lines": [ + 35, + 36, + 37 + ], + "starting_column": 5, + "ending_column": 6 + }, + "type_specific_fields": { + "parent": { + "type": "contract", + "name": "C", + "source_mapping": { + "start": 394, + "length": 1717, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/arbitrary-send-erc20/0.5.16/arbitrary_send_erc20.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/arbitrary-send-erc20/0.5.16/arbitrary_send_erc20.sol", + "is_dependency": false, + "lines": [ + 17, + 18, + 19, + 20, + 21, + 22, + 23, + 24, + 25, + 26, + 27, + 28, + 29, + 30, + 31, + 32, + 33, + 34, + 35, + 36, + 37, + 38, + 39, + 40, + 41, + 42, + 43, + 44, + 45, + 46, + 47, + 48, + 49, + 50, + 51, + 52, + 53, + 54, + 55, + 56, + 57, + 58, + 59, + 60, + 61, + 62, + 63, + 64, + 65, + 66, + 67, + 68, + 69, + 70, + 71, + 72, + 73, + 74, + 75, + 76, + 77 + ], + "starting_column": 1, + "ending_column": 2 + } + }, + "signature": "bad1(address,uint256)" + } + }, + { + "type": "node", + "name": "erc20.transferFrom(notsend,to,am)", + "source_mapping": { + "start": 835, + "length": 35, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/arbitrary-send-erc20/0.5.16/arbitrary_send_erc20.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/arbitrary-send-erc20/0.5.16/arbitrary_send_erc20.sol", + "is_dependency": false, + "lines": [ + 36 + ], + "starting_column": 9, + "ending_column": 44 + }, + "type_specific_fields": { + "parent": { + "type": "function", + "name": "bad1", + "source_mapping": { + "start": 780, + "length": 97, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/arbitrary-send-erc20/0.5.16/arbitrary_send_erc20.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/arbitrary-send-erc20/0.5.16/arbitrary_send_erc20.sol", + "is_dependency": false, + "lines": [ + 35, + 36, + 37 + ], + "starting_column": 5, + "ending_column": 6 + }, + "type_specific_fields": { + "parent": { + "type": "contract", + "name": "C", + "source_mapping": { + "start": 394, + "length": 1717, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/arbitrary-send-erc20/0.5.16/arbitrary_send_erc20.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/arbitrary-send-erc20/0.5.16/arbitrary_send_erc20.sol", + "is_dependency": false, + "lines": [ + 17, + 18, + 19, + 20, + 21, + 22, + 23, + 24, + 25, + 26, + 27, + 28, + 29, + 30, + 31, + 32, + 33, + 34, + 35, + 36, + 37, + 38, + 39, + 40, + 41, + 42, + 43, + 44, + 45, + 46, + 47, + 48, + 49, + 50, + 51, + 52, + 53, + 54, + 55, + 56, + 57, + 58, + 59, + 60, + 61, + 62, + 63, + 64, + 65, + 66, + 67, + 68, + 69, + 70, + 71, + 72, + 73, + 74, + 75, + 76, + 77 + ], + "starting_column": 1, + "ending_column": 2 + } + }, + "signature": "bad1(address,uint256)" + } + } + } + } + ], + "description": "C.bad1(address,uint256) (tests/detectors/arbitrary-send-erc20/0.5.16/arbitrary_send_erc20.sol#35-37) uses arbitrary from in transferFrom: erc20.transferFrom(notsend,to,am) (tests/detectors/arbitrary-send-erc20/0.5.16/arbitrary_send_erc20.sol#36)\n", + "markdown": "[C.bad1(address,uint256)](tests/detectors/arbitrary-send-erc20/0.5.16/arbitrary_send_erc20.sol#L35-L37) uses arbitrary from in transferFrom: [erc20.transferFrom(notsend,to,am)](tests/detectors/arbitrary-send-erc20/0.5.16/arbitrary_send_erc20.sol#L36)\n", + "first_markdown_element": "tests/detectors/arbitrary-send-erc20/0.5.16/arbitrary_send_erc20.sol#L35-L37", + "id": "6ca6aea5c4506ac7fa421c049e0bd41faa74317e303b94721bc64c2fc6e8f128", + "check": "arbitrary-send-erc20", + "impact": "High", + "confidence": "High" + }, + { + "elements": [ + { + "type": "function", + "name": "bad3", + "source_mapping": { + "start": 1434, + "length": 122, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/arbitrary-send-erc20/0.5.16/arbitrary_send_erc20.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/arbitrary-send-erc20/0.5.16/arbitrary_send_erc20.sol", + "is_dependency": false, + "lines": [ + 57, + 58, + 59 + ], + "starting_column": 5, + "ending_column": 6 + }, + "type_specific_fields": { + "parent": { + "type": "contract", + "name": "C", + "source_mapping": { + "start": 394, + "length": 1717, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/arbitrary-send-erc20/0.5.16/arbitrary_send_erc20.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/arbitrary-send-erc20/0.5.16/arbitrary_send_erc20.sol", + "is_dependency": false, + "lines": [ + 17, + 18, + 19, + 20, + 21, + 22, + 23, + 24, + 25, + 26, + 27, + 28, + 29, + 30, + 31, + 32, + 33, + 34, + 35, + 36, + 37, + 38, + 39, + 40, + 41, + 42, + 43, + 44, + 45, + 46, + 47, + 48, + 49, + 50, + 51, + 52, + 53, + 54, + 55, + 56, + 57, + 58, + 59, + 60, + 61, + 62, + 63, + 64, + 65, + 66, + 67, + 68, + 69, + 70, + 71, + 72, + 73, + 74, + 75, + 76, + 77 + ], + "starting_column": 1, + "ending_column": 2 + } + }, + "signature": "bad3(address,address,uint256)" + } + }, + { + "type": "node", + "name": "erc20.safeTransferFrom(from,to,amount)", + "source_mapping": { + "start": 1509, + "length": 40, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/arbitrary-send-erc20/0.5.16/arbitrary_send_erc20.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/arbitrary-send-erc20/0.5.16/arbitrary_send_erc20.sol", + "is_dependency": false, + "lines": [ + 58 + ], + "starting_column": 9, + "ending_column": 49 + }, + "type_specific_fields": { + "parent": { + "type": "function", + "name": "bad3", + "source_mapping": { + "start": 1434, + "length": 122, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/arbitrary-send-erc20/0.5.16/arbitrary_send_erc20.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/arbitrary-send-erc20/0.5.16/arbitrary_send_erc20.sol", + "is_dependency": false, + "lines": [ + 57, + 58, + 59 + ], + "starting_column": 5, + "ending_column": 6 + }, + "type_specific_fields": { + "parent": { + "type": "contract", + "name": "C", + "source_mapping": { + "start": 394, + "length": 1717, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/arbitrary-send-erc20/0.5.16/arbitrary_send_erc20.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/arbitrary-send-erc20/0.5.16/arbitrary_send_erc20.sol", + "is_dependency": false, + "lines": [ + 17, + 18, + 19, + 20, + 21, + 22, + 23, + 24, + 25, + 26, + 27, + 28, + 29, + 30, + 31, + 32, + 33, + 34, + 35, + 36, + 37, + 38, + 39, + 40, + 41, + 42, + 43, + 44, + 45, + 46, + 47, + 48, + 49, + 50, + 51, + 52, + 53, + 54, + 55, + 56, + 57, + 58, + 59, + 60, + 61, + 62, + 63, + 64, + 65, + 66, + 67, + 68, + 69, + 70, + 71, + 72, + 73, + 74, + 75, + 76, + 77 + ], + "starting_column": 1, + "ending_column": 2 + } + }, + "signature": "bad3(address,address,uint256)" + } + } + } + } + ], + "description": "C.bad3(address,address,uint256) (tests/detectors/arbitrary-send-erc20/0.5.16/arbitrary_send_erc20.sol#57-59) uses arbitrary from in transferFrom: erc20.safeTransferFrom(from,to,amount) (tests/detectors/arbitrary-send-erc20/0.5.16/arbitrary_send_erc20.sol#58)\n", + "markdown": "[C.bad3(address,address,uint256)](tests/detectors/arbitrary-send-erc20/0.5.16/arbitrary_send_erc20.sol#L57-L59) uses arbitrary from in transferFrom: [erc20.safeTransferFrom(from,to,amount)](tests/detectors/arbitrary-send-erc20/0.5.16/arbitrary_send_erc20.sol#L58)\n", + "first_markdown_element": "tests/detectors/arbitrary-send-erc20/0.5.16/arbitrary_send_erc20.sol#L57-L59", + "id": "773c84f15f90123743b54aca858695d11603109f4da52c487ee4ae161f09411b", + "check": "arbitrary-send-erc20", + "impact": "High", + "confidence": "High" + } + ] +] \ No newline at end of file diff --git a/tests/detectors/arbitrary-send-erc20/0.6.11/arbitrary_send_erc20.sol b/tests/detectors/arbitrary-send-erc20/0.6.11/arbitrary_send_erc20.sol new file mode 100644 index 000000000..a61e4f8ab --- /dev/null +++ b/tests/detectors/arbitrary-send-erc20/0.6.11/arbitrary_send_erc20.sol @@ -0,0 +1,77 @@ +pragma solidity 0.6.11; + +library SafeERC20 { + function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {} +} + +interface IERC20 { + function transferFrom(address, address, uint256) external returns(bool); +} + +contract ERC20 is IERC20 { + function transferFrom(address from, address to, uint256 amount) external override returns(bool) { + return true; + } +} + +contract C { + using SafeERC20 for IERC20; + + IERC20 erc20; + address notsend; + address send; + + constructor() public { + erc20 = new ERC20(); + notsend = address(0x3); + send = msg.sender; + } + + function good1(address to, uint256 am) public { + address from_msgsender = msg.sender; + erc20.transferFrom(from_msgsender, to, am); + } + + function bad1(address to, uint256 am) public { + erc20.transferFrom(notsend, to, am); + } + + function good2(address to, uint256 am) public { + address from_msgsender = msg.sender; + int_transferFrom(from_msgsender, to, am); + } + + // This is not detected + function bad2(address from, address to, uint256 am) public { + int_transferFrom(from, to, am); + } + + function int_transferFrom(address from, address to, uint256 amount) internal { + erc20.transferFrom(from, to, amount); + } + + function good3(address to, uint256 amount) external { + erc20.safeTransferFrom(msg.sender, to, amount); + } + + function bad3(address from, address to, uint256 amount) external { + erc20.safeTransferFrom(from, to, amount); + } + + function good4(address to, uint256 amount) external { + SafeERC20.safeTransferFrom(erc20, msg.sender, to, amount); + } + + function bad4(address from, address to, uint256 amount) external { + SafeERC20.safeTransferFrom(erc20, from, to, amount); + } + + function good5(address to, uint256 amount) external { + SafeERC20.safeTransferFrom(erc20, address(this), to, amount); + } + + function good6(address from, address to, uint256 amount) external { + erc20.safeTransferFrom(address(this), to, amount); + } + +} diff --git a/tests/detectors/arbitrary-send-erc20/0.6.11/arbitrary_send_erc20.sol.0.6.11.ArbitrarySendErc20NoPermit.json b/tests/detectors/arbitrary-send-erc20/0.6.11/arbitrary_send_erc20.sol.0.6.11.ArbitrarySendErc20NoPermit.json new file mode 100644 index 000000000..8d6b2a67d --- /dev/null +++ b/tests/detectors/arbitrary-send-erc20/0.6.11/arbitrary_send_erc20.sol.0.6.11.ArbitrarySendErc20NoPermit.json @@ -0,0 +1,703 @@ +[ + [ + { + "elements": [ + { + "type": "function", + "name": "bad1", + "source_mapping": { + "start": 789, + "length": 97, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/arbitrary-send-erc20/0.6.11/arbitrary_send_erc20.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/arbitrary-send-erc20/0.6.11/arbitrary_send_erc20.sol", + "is_dependency": false, + "lines": [ + 35, + 36, + 37 + ], + "starting_column": 5, + "ending_column": 6 + }, + "type_specific_fields": { + "parent": { + "type": "contract", + "name": "C", + "source_mapping": { + "start": 403, + "length": 1721, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/arbitrary-send-erc20/0.6.11/arbitrary_send_erc20.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/arbitrary-send-erc20/0.6.11/arbitrary_send_erc20.sol", + "is_dependency": false, + "lines": [ + 17, + 18, + 19, + 20, + 21, + 22, + 23, + 24, + 25, + 26, + 27, + 28, + 29, + 30, + 31, + 32, + 33, + 34, + 35, + 36, + 37, + 38, + 39, + 40, + 41, + 42, + 43, + 44, + 45, + 46, + 47, + 48, + 49, + 50, + 51, + 52, + 53, + 54, + 55, + 56, + 57, + 58, + 59, + 60, + 61, + 62, + 63, + 64, + 65, + 66, + 67, + 68, + 69, + 70, + 71, + 72, + 73, + 74, + 75, + 76, + 77 + ], + "starting_column": 1, + "ending_column": 2 + } + }, + "signature": "bad1(address,uint256)" + } + }, + { + "type": "node", + "name": "erc20.transferFrom(notsend,to,am)", + "source_mapping": { + "start": 844, + "length": 35, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/arbitrary-send-erc20/0.6.11/arbitrary_send_erc20.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/arbitrary-send-erc20/0.6.11/arbitrary_send_erc20.sol", + "is_dependency": false, + "lines": [ + 36 + ], + "starting_column": 9, + "ending_column": 44 + }, + "type_specific_fields": { + "parent": { + "type": "function", + "name": "bad1", + "source_mapping": { + "start": 789, + "length": 97, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/arbitrary-send-erc20/0.6.11/arbitrary_send_erc20.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/arbitrary-send-erc20/0.6.11/arbitrary_send_erc20.sol", + "is_dependency": false, + "lines": [ + 35, + 36, + 37 + ], + "starting_column": 5, + "ending_column": 6 + }, + "type_specific_fields": { + "parent": { + "type": "contract", + "name": "C", + "source_mapping": { + "start": 403, + "length": 1721, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/arbitrary-send-erc20/0.6.11/arbitrary_send_erc20.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/arbitrary-send-erc20/0.6.11/arbitrary_send_erc20.sol", + "is_dependency": false, + "lines": [ + 17, + 18, + 19, + 20, + 21, + 22, + 23, + 24, + 25, + 26, + 27, + 28, + 29, + 30, + 31, + 32, + 33, + 34, + 35, + 36, + 37, + 38, + 39, + 40, + 41, + 42, + 43, + 44, + 45, + 46, + 47, + 48, + 49, + 50, + 51, + 52, + 53, + 54, + 55, + 56, + 57, + 58, + 59, + 60, + 61, + 62, + 63, + 64, + 65, + 66, + 67, + 68, + 69, + 70, + 71, + 72, + 73, + 74, + 75, + 76, + 77 + ], + "starting_column": 1, + "ending_column": 2 + } + }, + "signature": "bad1(address,uint256)" + } + } + } + } + ], + "description": "C.bad1(address,uint256) (tests/detectors/arbitrary-send-erc20/0.6.11/arbitrary_send_erc20.sol#35-37) uses arbitrary from in transferFrom: erc20.transferFrom(notsend,to,am) (tests/detectors/arbitrary-send-erc20/0.6.11/arbitrary_send_erc20.sol#36)\n", + "markdown": "[C.bad1(address,uint256)](tests/detectors/arbitrary-send-erc20/0.6.11/arbitrary_send_erc20.sol#L35-L37) uses arbitrary from in transferFrom: [erc20.transferFrom(notsend,to,am)](tests/detectors/arbitrary-send-erc20/0.6.11/arbitrary_send_erc20.sol#L36)\n", + "first_markdown_element": "tests/detectors/arbitrary-send-erc20/0.6.11/arbitrary_send_erc20.sol#L35-L37", + "id": "040cf50981f6e1dea1f7a19f0115811be1347e0637f0ca85d789ae612a509322", + "check": "arbitrary-send-erc20", + "impact": "High", + "confidence": "High" + }, + { + "elements": [ + { + "type": "function", + "name": "bad4", + "source_mapping": { + "start": 1711, + "length": 133, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/arbitrary-send-erc20/0.6.11/arbitrary_send_erc20.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/arbitrary-send-erc20/0.6.11/arbitrary_send_erc20.sol", + "is_dependency": false, + "lines": [ + 65, + 66, + 67 + ], + "starting_column": 5, + "ending_column": 6 + }, + "type_specific_fields": { + "parent": { + "type": "contract", + "name": "C", + "source_mapping": { + "start": 403, + "length": 1721, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/arbitrary-send-erc20/0.6.11/arbitrary_send_erc20.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/arbitrary-send-erc20/0.6.11/arbitrary_send_erc20.sol", + "is_dependency": false, + "lines": [ + 17, + 18, + 19, + 20, + 21, + 22, + 23, + 24, + 25, + 26, + 27, + 28, + 29, + 30, + 31, + 32, + 33, + 34, + 35, + 36, + 37, + 38, + 39, + 40, + 41, + 42, + 43, + 44, + 45, + 46, + 47, + 48, + 49, + 50, + 51, + 52, + 53, + 54, + 55, + 56, + 57, + 58, + 59, + 60, + 61, + 62, + 63, + 64, + 65, + 66, + 67, + 68, + 69, + 70, + 71, + 72, + 73, + 74, + 75, + 76, + 77 + ], + "starting_column": 1, + "ending_column": 2 + } + }, + "signature": "bad4(address,address,uint256)" + } + }, + { + "type": "node", + "name": "SafeERC20.safeTransferFrom(erc20,from,to,amount)", + "source_mapping": { + "start": 1786, + "length": 51, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/arbitrary-send-erc20/0.6.11/arbitrary_send_erc20.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/arbitrary-send-erc20/0.6.11/arbitrary_send_erc20.sol", + "is_dependency": false, + "lines": [ + 66 + ], + "starting_column": 9, + "ending_column": 60 + }, + "type_specific_fields": { + "parent": { + "type": "function", + "name": "bad4", + "source_mapping": { + "start": 1711, + "length": 133, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/arbitrary-send-erc20/0.6.11/arbitrary_send_erc20.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/arbitrary-send-erc20/0.6.11/arbitrary_send_erc20.sol", + "is_dependency": false, + "lines": [ + 65, + 66, + 67 + ], + "starting_column": 5, + "ending_column": 6 + }, + "type_specific_fields": { + "parent": { + "type": "contract", + "name": "C", + "source_mapping": { + "start": 403, + "length": 1721, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/arbitrary-send-erc20/0.6.11/arbitrary_send_erc20.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/arbitrary-send-erc20/0.6.11/arbitrary_send_erc20.sol", + "is_dependency": false, + "lines": [ + 17, + 18, + 19, + 20, + 21, + 22, + 23, + 24, + 25, + 26, + 27, + 28, + 29, + 30, + 31, + 32, + 33, + 34, + 35, + 36, + 37, + 38, + 39, + 40, + 41, + 42, + 43, + 44, + 45, + 46, + 47, + 48, + 49, + 50, + 51, + 52, + 53, + 54, + 55, + 56, + 57, + 58, + 59, + 60, + 61, + 62, + 63, + 64, + 65, + 66, + 67, + 68, + 69, + 70, + 71, + 72, + 73, + 74, + 75, + 76, + 77 + ], + "starting_column": 1, + "ending_column": 2 + } + }, + "signature": "bad4(address,address,uint256)" + } + } + } + } + ], + "description": "C.bad4(address,address,uint256) (tests/detectors/arbitrary-send-erc20/0.6.11/arbitrary_send_erc20.sol#65-67) uses arbitrary from in transferFrom: SafeERC20.safeTransferFrom(erc20,from,to,amount) (tests/detectors/arbitrary-send-erc20/0.6.11/arbitrary_send_erc20.sol#66)\n", + "markdown": "[C.bad4(address,address,uint256)](tests/detectors/arbitrary-send-erc20/0.6.11/arbitrary_send_erc20.sol#L65-L67) uses arbitrary from in transferFrom: [SafeERC20.safeTransferFrom(erc20,from,to,amount)](tests/detectors/arbitrary-send-erc20/0.6.11/arbitrary_send_erc20.sol#L66)\n", + "first_markdown_element": "tests/detectors/arbitrary-send-erc20/0.6.11/arbitrary_send_erc20.sol#L65-L67", + "id": "61438092d2da6c23ecfa13e5e55c489e538249e47bddd9335b533d28a242aea1", + "check": "arbitrary-send-erc20", + "impact": "High", + "confidence": "High" + }, + { + "elements": [ + { + "type": "function", + "name": "bad3", + "source_mapping": { + "start": 1443, + "length": 122, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/arbitrary-send-erc20/0.6.11/arbitrary_send_erc20.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/arbitrary-send-erc20/0.6.11/arbitrary_send_erc20.sol", + "is_dependency": false, + "lines": [ + 57, + 58, + 59 + ], + "starting_column": 5, + "ending_column": 6 + }, + "type_specific_fields": { + "parent": { + "type": "contract", + "name": "C", + "source_mapping": { + "start": 403, + "length": 1721, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/arbitrary-send-erc20/0.6.11/arbitrary_send_erc20.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/arbitrary-send-erc20/0.6.11/arbitrary_send_erc20.sol", + "is_dependency": false, + "lines": [ + 17, + 18, + 19, + 20, + 21, + 22, + 23, + 24, + 25, + 26, + 27, + 28, + 29, + 30, + 31, + 32, + 33, + 34, + 35, + 36, + 37, + 38, + 39, + 40, + 41, + 42, + 43, + 44, + 45, + 46, + 47, + 48, + 49, + 50, + 51, + 52, + 53, + 54, + 55, + 56, + 57, + 58, + 59, + 60, + 61, + 62, + 63, + 64, + 65, + 66, + 67, + 68, + 69, + 70, + 71, + 72, + 73, + 74, + 75, + 76, + 77 + ], + "starting_column": 1, + "ending_column": 2 + } + }, + "signature": "bad3(address,address,uint256)" + } + }, + { + "type": "node", + "name": "erc20.safeTransferFrom(from,to,amount)", + "source_mapping": { + "start": 1518, + "length": 40, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/arbitrary-send-erc20/0.6.11/arbitrary_send_erc20.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/arbitrary-send-erc20/0.6.11/arbitrary_send_erc20.sol", + "is_dependency": false, + "lines": [ + 58 + ], + "starting_column": 9, + "ending_column": 49 + }, + "type_specific_fields": { + "parent": { + "type": "function", + "name": "bad3", + "source_mapping": { + "start": 1443, + "length": 122, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/arbitrary-send-erc20/0.6.11/arbitrary_send_erc20.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/arbitrary-send-erc20/0.6.11/arbitrary_send_erc20.sol", + "is_dependency": false, + "lines": [ + 57, + 58, + 59 + ], + "starting_column": 5, + "ending_column": 6 + }, + "type_specific_fields": { + "parent": { + "type": "contract", + "name": "C", + "source_mapping": { + "start": 403, + "length": 1721, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/arbitrary-send-erc20/0.6.11/arbitrary_send_erc20.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/arbitrary-send-erc20/0.6.11/arbitrary_send_erc20.sol", + "is_dependency": false, + "lines": [ + 17, + 18, + 19, + 20, + 21, + 22, + 23, + 24, + 25, + 26, + 27, + 28, + 29, + 30, + 31, + 32, + 33, + 34, + 35, + 36, + 37, + 38, + 39, + 40, + 41, + 42, + 43, + 44, + 45, + 46, + 47, + 48, + 49, + 50, + 51, + 52, + 53, + 54, + 55, + 56, + 57, + 58, + 59, + 60, + 61, + 62, + 63, + 64, + 65, + 66, + 67, + 68, + 69, + 70, + 71, + 72, + 73, + 74, + 75, + 76, + 77 + ], + "starting_column": 1, + "ending_column": 2 + } + }, + "signature": "bad3(address,address,uint256)" + } + } + } + } + ], + "description": "C.bad3(address,address,uint256) (tests/detectors/arbitrary-send-erc20/0.6.11/arbitrary_send_erc20.sol#57-59) uses arbitrary from in transferFrom: erc20.safeTransferFrom(from,to,amount) (tests/detectors/arbitrary-send-erc20/0.6.11/arbitrary_send_erc20.sol#58)\n", + "markdown": "[C.bad3(address,address,uint256)](tests/detectors/arbitrary-send-erc20/0.6.11/arbitrary_send_erc20.sol#L57-L59) uses arbitrary from in transferFrom: [erc20.safeTransferFrom(from,to,amount)](tests/detectors/arbitrary-send-erc20/0.6.11/arbitrary_send_erc20.sol#L58)\n", + "first_markdown_element": "tests/detectors/arbitrary-send-erc20/0.6.11/arbitrary_send_erc20.sol#L57-L59", + "id": "8551e9d33fdd4f73f1eb7776480b2e8cd2cf9c897b52285c3a287caab6822ce3", + "check": "arbitrary-send-erc20", + "impact": "High", + "confidence": "High" + } + ] +] \ No newline at end of file diff --git a/tests/detectors/arbitrary-send-erc20/0.7.6/arbitrary_send_erc20.sol b/tests/detectors/arbitrary-send-erc20/0.7.6/arbitrary_send_erc20.sol new file mode 100644 index 000000000..0ceff0f66 --- /dev/null +++ b/tests/detectors/arbitrary-send-erc20/0.7.6/arbitrary_send_erc20.sol @@ -0,0 +1,77 @@ +pragma solidity 0.7.6; + +library SafeERC20 { + function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {} +} + +interface IERC20 { + function transferFrom(address, address, uint256) external returns(bool); +} + +contract ERC20 is IERC20 { + function transferFrom(address from, address to, uint256 amount) external override returns(bool) { + return true; + } +} + +contract C { + using SafeERC20 for IERC20; + + IERC20 erc20; + address notsend; + address send; + + constructor() { + erc20 = new ERC20(); + notsend = address(0x3); + send = msg.sender; + } + + function good1(address to, uint256 am) public { + address from_msgsender = msg.sender; + erc20.transferFrom(from_msgsender, to, am); + } + + function bad1(address to, uint256 am) public { + erc20.transferFrom(notsend, to, am); + } + + function good2(address to, uint256 am) public { + address from_msgsender = msg.sender; + int_transferFrom(from_msgsender, to, am); + } + + // This is not detected + function bad2(address from, address to, uint256 am) public { + int_transferFrom(from, to, am); + } + + function int_transferFrom(address from, address to, uint256 amount) internal { + erc20.transferFrom(from, to, amount); + } + + function good3(address to, uint256 amount) external { + erc20.safeTransferFrom(msg.sender, to, amount); + } + + function bad3(address from, address to, uint256 amount) external { + erc20.safeTransferFrom(from, to, amount); + } + + function good4(address to, uint256 amount) external { + SafeERC20.safeTransferFrom(erc20, msg.sender, to, amount); + } + + function bad4(address from, address to, uint256 amount) external { + SafeERC20.safeTransferFrom(erc20, from, to, amount); + } + + function good5(address to, uint256 amount) external { + SafeERC20.safeTransferFrom(erc20, address(this), to, amount); + } + + function good6(address from, address to, uint256 amount) external { + erc20.safeTransferFrom(address(this), to, amount); + } + +} diff --git a/tests/detectors/arbitrary-send-erc20/0.7.6/arbitrary_send_erc20.sol.0.7.6.ArbitrarySendErc20NoPermit.json b/tests/detectors/arbitrary-send-erc20/0.7.6/arbitrary_send_erc20.sol.0.7.6.ArbitrarySendErc20NoPermit.json new file mode 100644 index 000000000..72b78d67a --- /dev/null +++ b/tests/detectors/arbitrary-send-erc20/0.7.6/arbitrary_send_erc20.sol.0.7.6.ArbitrarySendErc20NoPermit.json @@ -0,0 +1,703 @@ +[ + [ + { + "elements": [ + { + "type": "function", + "name": "bad3", + "source_mapping": { + "start": 1435, + "length": 122, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/arbitrary-send-erc20/0.7.6/arbitrary_send_erc20.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/arbitrary-send-erc20/0.7.6/arbitrary_send_erc20.sol", + "is_dependency": false, + "lines": [ + 57, + 58, + 59 + ], + "starting_column": 5, + "ending_column": 6 + }, + "type_specific_fields": { + "parent": { + "type": "contract", + "name": "C", + "source_mapping": { + "start": 402, + "length": 1710, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/arbitrary-send-erc20/0.7.6/arbitrary_send_erc20.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/arbitrary-send-erc20/0.7.6/arbitrary_send_erc20.sol", + "is_dependency": false, + "lines": [ + 17, + 18, + 19, + 20, + 21, + 22, + 23, + 24, + 25, + 26, + 27, + 28, + 29, + 30, + 31, + 32, + 33, + 34, + 35, + 36, + 37, + 38, + 39, + 40, + 41, + 42, + 43, + 44, + 45, + 46, + 47, + 48, + 49, + 50, + 51, + 52, + 53, + 54, + 55, + 56, + 57, + 58, + 59, + 60, + 61, + 62, + 63, + 64, + 65, + 66, + 67, + 68, + 69, + 70, + 71, + 72, + 73, + 74, + 75, + 76, + 77 + ], + "starting_column": 1, + "ending_column": 2 + } + }, + "signature": "bad3(address,address,uint256)" + } + }, + { + "type": "node", + "name": "erc20.safeTransferFrom(from,to,amount)", + "source_mapping": { + "start": 1510, + "length": 40, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/arbitrary-send-erc20/0.7.6/arbitrary_send_erc20.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/arbitrary-send-erc20/0.7.6/arbitrary_send_erc20.sol", + "is_dependency": false, + "lines": [ + 58 + ], + "starting_column": 9, + "ending_column": 49 + }, + "type_specific_fields": { + "parent": { + "type": "function", + "name": "bad3", + "source_mapping": { + "start": 1435, + "length": 122, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/arbitrary-send-erc20/0.7.6/arbitrary_send_erc20.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/arbitrary-send-erc20/0.7.6/arbitrary_send_erc20.sol", + "is_dependency": false, + "lines": [ + 57, + 58, + 59 + ], + "starting_column": 5, + "ending_column": 6 + }, + "type_specific_fields": { + "parent": { + "type": "contract", + "name": "C", + "source_mapping": { + "start": 402, + "length": 1710, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/arbitrary-send-erc20/0.7.6/arbitrary_send_erc20.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/arbitrary-send-erc20/0.7.6/arbitrary_send_erc20.sol", + "is_dependency": false, + "lines": [ + 17, + 18, + 19, + 20, + 21, + 22, + 23, + 24, + 25, + 26, + 27, + 28, + 29, + 30, + 31, + 32, + 33, + 34, + 35, + 36, + 37, + 38, + 39, + 40, + 41, + 42, + 43, + 44, + 45, + 46, + 47, + 48, + 49, + 50, + 51, + 52, + 53, + 54, + 55, + 56, + 57, + 58, + 59, + 60, + 61, + 62, + 63, + 64, + 65, + 66, + 67, + 68, + 69, + 70, + 71, + 72, + 73, + 74, + 75, + 76, + 77 + ], + "starting_column": 1, + "ending_column": 2 + } + }, + "signature": "bad3(address,address,uint256)" + } + } + } + } + ], + "description": "C.bad3(address,address,uint256) (tests/detectors/arbitrary-send-erc20/0.7.6/arbitrary_send_erc20.sol#57-59) uses arbitrary from in transferFrom: erc20.safeTransferFrom(from,to,amount) (tests/detectors/arbitrary-send-erc20/0.7.6/arbitrary_send_erc20.sol#58)\n", + "markdown": "[C.bad3(address,address,uint256)](tests/detectors/arbitrary-send-erc20/0.7.6/arbitrary_send_erc20.sol#L57-L59) uses arbitrary from in transferFrom: [erc20.safeTransferFrom(from,to,amount)](tests/detectors/arbitrary-send-erc20/0.7.6/arbitrary_send_erc20.sol#L58)\n", + "first_markdown_element": "tests/detectors/arbitrary-send-erc20/0.7.6/arbitrary_send_erc20.sol#L57-L59", + "id": "27c4a0e1a038beb0c01c86e07f1aef592f96907d330bcf899bde6632a9022327", + "check": "arbitrary-send-erc20", + "impact": "High", + "confidence": "High" + }, + { + "elements": [ + { + "type": "function", + "name": "bad1", + "source_mapping": { + "start": 781, + "length": 97, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/arbitrary-send-erc20/0.7.6/arbitrary_send_erc20.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/arbitrary-send-erc20/0.7.6/arbitrary_send_erc20.sol", + "is_dependency": false, + "lines": [ + 35, + 36, + 37 + ], + "starting_column": 5, + "ending_column": 6 + }, + "type_specific_fields": { + "parent": { + "type": "contract", + "name": "C", + "source_mapping": { + "start": 402, + "length": 1710, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/arbitrary-send-erc20/0.7.6/arbitrary_send_erc20.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/arbitrary-send-erc20/0.7.6/arbitrary_send_erc20.sol", + "is_dependency": false, + "lines": [ + 17, + 18, + 19, + 20, + 21, + 22, + 23, + 24, + 25, + 26, + 27, + 28, + 29, + 30, + 31, + 32, + 33, + 34, + 35, + 36, + 37, + 38, + 39, + 40, + 41, + 42, + 43, + 44, + 45, + 46, + 47, + 48, + 49, + 50, + 51, + 52, + 53, + 54, + 55, + 56, + 57, + 58, + 59, + 60, + 61, + 62, + 63, + 64, + 65, + 66, + 67, + 68, + 69, + 70, + 71, + 72, + 73, + 74, + 75, + 76, + 77 + ], + "starting_column": 1, + "ending_column": 2 + } + }, + "signature": "bad1(address,uint256)" + } + }, + { + "type": "node", + "name": "erc20.transferFrom(notsend,to,am)", + "source_mapping": { + "start": 836, + "length": 35, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/arbitrary-send-erc20/0.7.6/arbitrary_send_erc20.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/arbitrary-send-erc20/0.7.6/arbitrary_send_erc20.sol", + "is_dependency": false, + "lines": [ + 36 + ], + "starting_column": 9, + "ending_column": 44 + }, + "type_specific_fields": { + "parent": { + "type": "function", + "name": "bad1", + "source_mapping": { + "start": 781, + "length": 97, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/arbitrary-send-erc20/0.7.6/arbitrary_send_erc20.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/arbitrary-send-erc20/0.7.6/arbitrary_send_erc20.sol", + "is_dependency": false, + "lines": [ + 35, + 36, + 37 + ], + "starting_column": 5, + "ending_column": 6 + }, + "type_specific_fields": { + "parent": { + "type": "contract", + "name": "C", + "source_mapping": { + "start": 402, + "length": 1710, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/arbitrary-send-erc20/0.7.6/arbitrary_send_erc20.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/arbitrary-send-erc20/0.7.6/arbitrary_send_erc20.sol", + "is_dependency": false, + "lines": [ + 17, + 18, + 19, + 20, + 21, + 22, + 23, + 24, + 25, + 26, + 27, + 28, + 29, + 30, + 31, + 32, + 33, + 34, + 35, + 36, + 37, + 38, + 39, + 40, + 41, + 42, + 43, + 44, + 45, + 46, + 47, + 48, + 49, + 50, + 51, + 52, + 53, + 54, + 55, + 56, + 57, + 58, + 59, + 60, + 61, + 62, + 63, + 64, + 65, + 66, + 67, + 68, + 69, + 70, + 71, + 72, + 73, + 74, + 75, + 76, + 77 + ], + "starting_column": 1, + "ending_column": 2 + } + }, + "signature": "bad1(address,uint256)" + } + } + } + } + ], + "description": "C.bad1(address,uint256) (tests/detectors/arbitrary-send-erc20/0.7.6/arbitrary_send_erc20.sol#35-37) uses arbitrary from in transferFrom: erc20.transferFrom(notsend,to,am) (tests/detectors/arbitrary-send-erc20/0.7.6/arbitrary_send_erc20.sol#36)\n", + "markdown": "[C.bad1(address,uint256)](tests/detectors/arbitrary-send-erc20/0.7.6/arbitrary_send_erc20.sol#L35-L37) uses arbitrary from in transferFrom: [erc20.transferFrom(notsend,to,am)](tests/detectors/arbitrary-send-erc20/0.7.6/arbitrary_send_erc20.sol#L36)\n", + "first_markdown_element": "tests/detectors/arbitrary-send-erc20/0.7.6/arbitrary_send_erc20.sol#L35-L37", + "id": "820841ccd8aee0469f9719d62ad01054b71a758a1d6924ed6a19ea078ff8350a", + "check": "arbitrary-send-erc20", + "impact": "High", + "confidence": "High" + }, + { + "elements": [ + { + "type": "function", + "name": "bad4", + "source_mapping": { + "start": 1703, + "length": 133, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/arbitrary-send-erc20/0.7.6/arbitrary_send_erc20.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/arbitrary-send-erc20/0.7.6/arbitrary_send_erc20.sol", + "is_dependency": false, + "lines": [ + 65, + 66, + 67 + ], + "starting_column": 5, + "ending_column": 6 + }, + "type_specific_fields": { + "parent": { + "type": "contract", + "name": "C", + "source_mapping": { + "start": 402, + "length": 1710, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/arbitrary-send-erc20/0.7.6/arbitrary_send_erc20.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/arbitrary-send-erc20/0.7.6/arbitrary_send_erc20.sol", + "is_dependency": false, + "lines": [ + 17, + 18, + 19, + 20, + 21, + 22, + 23, + 24, + 25, + 26, + 27, + 28, + 29, + 30, + 31, + 32, + 33, + 34, + 35, + 36, + 37, + 38, + 39, + 40, + 41, + 42, + 43, + 44, + 45, + 46, + 47, + 48, + 49, + 50, + 51, + 52, + 53, + 54, + 55, + 56, + 57, + 58, + 59, + 60, + 61, + 62, + 63, + 64, + 65, + 66, + 67, + 68, + 69, + 70, + 71, + 72, + 73, + 74, + 75, + 76, + 77 + ], + "starting_column": 1, + "ending_column": 2 + } + }, + "signature": "bad4(address,address,uint256)" + } + }, + { + "type": "node", + "name": "SafeERC20.safeTransferFrom(erc20,from,to,amount)", + "source_mapping": { + "start": 1778, + "length": 51, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/arbitrary-send-erc20/0.7.6/arbitrary_send_erc20.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/arbitrary-send-erc20/0.7.6/arbitrary_send_erc20.sol", + "is_dependency": false, + "lines": [ + 66 + ], + "starting_column": 9, + "ending_column": 60 + }, + "type_specific_fields": { + "parent": { + "type": "function", + "name": "bad4", + "source_mapping": { + "start": 1703, + "length": 133, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/arbitrary-send-erc20/0.7.6/arbitrary_send_erc20.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/arbitrary-send-erc20/0.7.6/arbitrary_send_erc20.sol", + "is_dependency": false, + "lines": [ + 65, + 66, + 67 + ], + "starting_column": 5, + "ending_column": 6 + }, + "type_specific_fields": { + "parent": { + "type": "contract", + "name": "C", + "source_mapping": { + "start": 402, + "length": 1710, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/arbitrary-send-erc20/0.7.6/arbitrary_send_erc20.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/arbitrary-send-erc20/0.7.6/arbitrary_send_erc20.sol", + "is_dependency": false, + "lines": [ + 17, + 18, + 19, + 20, + 21, + 22, + 23, + 24, + 25, + 26, + 27, + 28, + 29, + 30, + 31, + 32, + 33, + 34, + 35, + 36, + 37, + 38, + 39, + 40, + 41, + 42, + 43, + 44, + 45, + 46, + 47, + 48, + 49, + 50, + 51, + 52, + 53, + 54, + 55, + 56, + 57, + 58, + 59, + 60, + 61, + 62, + 63, + 64, + 65, + 66, + 67, + 68, + 69, + 70, + 71, + 72, + 73, + 74, + 75, + 76, + 77 + ], + "starting_column": 1, + "ending_column": 2 + } + }, + "signature": "bad4(address,address,uint256)" + } + } + } + } + ], + "description": "C.bad4(address,address,uint256) (tests/detectors/arbitrary-send-erc20/0.7.6/arbitrary_send_erc20.sol#65-67) uses arbitrary from in transferFrom: SafeERC20.safeTransferFrom(erc20,from,to,amount) (tests/detectors/arbitrary-send-erc20/0.7.6/arbitrary_send_erc20.sol#66)\n", + "markdown": "[C.bad4(address,address,uint256)](tests/detectors/arbitrary-send-erc20/0.7.6/arbitrary_send_erc20.sol#L65-L67) uses arbitrary from in transferFrom: [SafeERC20.safeTransferFrom(erc20,from,to,amount)](tests/detectors/arbitrary-send-erc20/0.7.6/arbitrary_send_erc20.sol#L66)\n", + "first_markdown_element": "tests/detectors/arbitrary-send-erc20/0.7.6/arbitrary_send_erc20.sol#L65-L67", + "id": "9ecb2b9df9554b9ebdbcfd058eb44ba4f1524b285b676063432d5ede48aee5ad", + "check": "arbitrary-send-erc20", + "impact": "High", + "confidence": "High" + } + ] +] \ No newline at end of file diff --git a/tests/detectors/arbitrary-send-erc20/0.8.0/arbitrary_send_erc20.sol b/tests/detectors/arbitrary-send-erc20/0.8.0/arbitrary_send_erc20.sol new file mode 100644 index 000000000..19dcf3f15 --- /dev/null +++ b/tests/detectors/arbitrary-send-erc20/0.8.0/arbitrary_send_erc20.sol @@ -0,0 +1,77 @@ +pragma solidity 0.8.0; + +library SafeERC20 { + function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {} +} + +interface IERC20 { + function transferFrom(address, address, uint256) external returns(bool); +} + +contract ERC20 is IERC20 { + function transferFrom(address from, address to, uint256 amount) external override returns(bool) { + return true; + } +} + +contract C { + using SafeERC20 for IERC20; + + IERC20 erc20; + address notsend; + address send; + + constructor() { + erc20 = new ERC20(); + notsend = address(0x3); + send = msg.sender; + } + + function good1(address to, uint256 am) public { + address from_msgsender = msg.sender; + erc20.transferFrom(from_msgsender, to, am); + } + + function bad1(address to, uint256 am) public { + erc20.transferFrom(notsend, to, am); + } + + function good2(address to, uint256 am) public { + address from_msgsender = msg.sender; + int_transferFrom(from_msgsender, to, am); + } + + // This is not detected + function bad2(address from, address to, uint256 am) public { + int_transferFrom(from, to, am); + } + + function int_transferFrom(address from, address to, uint256 amount) internal { + erc20.transferFrom(from, to, amount); + } + + function good3(address to, uint256 amount) external { + erc20.safeTransferFrom(msg.sender, to, amount); + } + + function bad3(address from, address to, uint256 amount) external { + erc20.safeTransferFrom(from, to, amount); + } + + function good4(address to, uint256 amount) external { + SafeERC20.safeTransferFrom(erc20, msg.sender, to, amount); + } + + function bad4(address from, address to, uint256 amount) external { + SafeERC20.safeTransferFrom(erc20, from, to, amount); + } + + function good5(address to, uint256 amount) external { + SafeERC20.safeTransferFrom(erc20, address(this), to, amount); + } + + function good6(address from, address to, uint256 amount) external { + erc20.safeTransferFrom(address(this), to, amount); + } + +} diff --git a/tests/detectors/arbitrary-send-erc20/0.8.0/arbitrary_send_erc20.sol.0.8.0.ArbitrarySendErc20NoPermit.json b/tests/detectors/arbitrary-send-erc20/0.8.0/arbitrary_send_erc20.sol.0.8.0.ArbitrarySendErc20NoPermit.json new file mode 100644 index 000000000..de242ae4e --- /dev/null +++ b/tests/detectors/arbitrary-send-erc20/0.8.0/arbitrary_send_erc20.sol.0.8.0.ArbitrarySendErc20NoPermit.json @@ -0,0 +1,703 @@ +[ + [ + { + "elements": [ + { + "type": "function", + "name": "bad3", + "source_mapping": { + "start": 1435, + "length": 122, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/arbitrary-send-erc20/0.8.0/arbitrary_send_erc20.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/arbitrary-send-erc20/0.8.0/arbitrary_send_erc20.sol", + "is_dependency": false, + "lines": [ + 57, + 58, + 59 + ], + "starting_column": 5, + "ending_column": 6 + }, + "type_specific_fields": { + "parent": { + "type": "contract", + "name": "C", + "source_mapping": { + "start": 402, + "length": 1710, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/arbitrary-send-erc20/0.8.0/arbitrary_send_erc20.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/arbitrary-send-erc20/0.8.0/arbitrary_send_erc20.sol", + "is_dependency": false, + "lines": [ + 17, + 18, + 19, + 20, + 21, + 22, + 23, + 24, + 25, + 26, + 27, + 28, + 29, + 30, + 31, + 32, + 33, + 34, + 35, + 36, + 37, + 38, + 39, + 40, + 41, + 42, + 43, + 44, + 45, + 46, + 47, + 48, + 49, + 50, + 51, + 52, + 53, + 54, + 55, + 56, + 57, + 58, + 59, + 60, + 61, + 62, + 63, + 64, + 65, + 66, + 67, + 68, + 69, + 70, + 71, + 72, + 73, + 74, + 75, + 76, + 77 + ], + "starting_column": 1, + "ending_column": 2 + } + }, + "signature": "bad3(address,address,uint256)" + } + }, + { + "type": "node", + "name": "erc20.safeTransferFrom(from,to,amount)", + "source_mapping": { + "start": 1510, + "length": 40, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/arbitrary-send-erc20/0.8.0/arbitrary_send_erc20.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/arbitrary-send-erc20/0.8.0/arbitrary_send_erc20.sol", + "is_dependency": false, + "lines": [ + 58 + ], + "starting_column": 9, + "ending_column": 49 + }, + "type_specific_fields": { + "parent": { + "type": "function", + "name": "bad3", + "source_mapping": { + "start": 1435, + "length": 122, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/arbitrary-send-erc20/0.8.0/arbitrary_send_erc20.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/arbitrary-send-erc20/0.8.0/arbitrary_send_erc20.sol", + "is_dependency": false, + "lines": [ + 57, + 58, + 59 + ], + "starting_column": 5, + "ending_column": 6 + }, + "type_specific_fields": { + "parent": { + "type": "contract", + "name": "C", + "source_mapping": { + "start": 402, + "length": 1710, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/arbitrary-send-erc20/0.8.0/arbitrary_send_erc20.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/arbitrary-send-erc20/0.8.0/arbitrary_send_erc20.sol", + "is_dependency": false, + "lines": [ + 17, + 18, + 19, + 20, + 21, + 22, + 23, + 24, + 25, + 26, + 27, + 28, + 29, + 30, + 31, + 32, + 33, + 34, + 35, + 36, + 37, + 38, + 39, + 40, + 41, + 42, + 43, + 44, + 45, + 46, + 47, + 48, + 49, + 50, + 51, + 52, + 53, + 54, + 55, + 56, + 57, + 58, + 59, + 60, + 61, + 62, + 63, + 64, + 65, + 66, + 67, + 68, + 69, + 70, + 71, + 72, + 73, + 74, + 75, + 76, + 77 + ], + "starting_column": 1, + "ending_column": 2 + } + }, + "signature": "bad3(address,address,uint256)" + } + } + } + } + ], + "description": "C.bad3(address,address,uint256) (tests/detectors/arbitrary-send-erc20/0.8.0/arbitrary_send_erc20.sol#57-59) uses arbitrary from in transferFrom: erc20.safeTransferFrom(from,to,amount) (tests/detectors/arbitrary-send-erc20/0.8.0/arbitrary_send_erc20.sol#58)\n", + "markdown": "[C.bad3(address,address,uint256)](tests/detectors/arbitrary-send-erc20/0.8.0/arbitrary_send_erc20.sol#L57-L59) uses arbitrary from in transferFrom: [erc20.safeTransferFrom(from,to,amount)](tests/detectors/arbitrary-send-erc20/0.8.0/arbitrary_send_erc20.sol#L58)\n", + "first_markdown_element": "tests/detectors/arbitrary-send-erc20/0.8.0/arbitrary_send_erc20.sol#L57-L59", + "id": "196b46419f55696599f4a533ea4915c3b1c39be679d8e2ab15a60b7a0238d52c", + "check": "arbitrary-send-erc20", + "impact": "High", + "confidence": "High" + }, + { + "elements": [ + { + "type": "function", + "name": "bad4", + "source_mapping": { + "start": 1703, + "length": 133, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/arbitrary-send-erc20/0.8.0/arbitrary_send_erc20.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/arbitrary-send-erc20/0.8.0/arbitrary_send_erc20.sol", + "is_dependency": false, + "lines": [ + 65, + 66, + 67 + ], + "starting_column": 5, + "ending_column": 6 + }, + "type_specific_fields": { + "parent": { + "type": "contract", + "name": "C", + "source_mapping": { + "start": 402, + "length": 1710, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/arbitrary-send-erc20/0.8.0/arbitrary_send_erc20.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/arbitrary-send-erc20/0.8.0/arbitrary_send_erc20.sol", + "is_dependency": false, + "lines": [ + 17, + 18, + 19, + 20, + 21, + 22, + 23, + 24, + 25, + 26, + 27, + 28, + 29, + 30, + 31, + 32, + 33, + 34, + 35, + 36, + 37, + 38, + 39, + 40, + 41, + 42, + 43, + 44, + 45, + 46, + 47, + 48, + 49, + 50, + 51, + 52, + 53, + 54, + 55, + 56, + 57, + 58, + 59, + 60, + 61, + 62, + 63, + 64, + 65, + 66, + 67, + 68, + 69, + 70, + 71, + 72, + 73, + 74, + 75, + 76, + 77 + ], + "starting_column": 1, + "ending_column": 2 + } + }, + "signature": "bad4(address,address,uint256)" + } + }, + { + "type": "node", + "name": "SafeERC20.safeTransferFrom(erc20,from,to,amount)", + "source_mapping": { + "start": 1778, + "length": 51, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/arbitrary-send-erc20/0.8.0/arbitrary_send_erc20.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/arbitrary-send-erc20/0.8.0/arbitrary_send_erc20.sol", + "is_dependency": false, + "lines": [ + 66 + ], + "starting_column": 9, + "ending_column": 60 + }, + "type_specific_fields": { + "parent": { + "type": "function", + "name": "bad4", + "source_mapping": { + "start": 1703, + "length": 133, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/arbitrary-send-erc20/0.8.0/arbitrary_send_erc20.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/arbitrary-send-erc20/0.8.0/arbitrary_send_erc20.sol", + "is_dependency": false, + "lines": [ + 65, + 66, + 67 + ], + "starting_column": 5, + "ending_column": 6 + }, + "type_specific_fields": { + "parent": { + "type": "contract", + "name": "C", + "source_mapping": { + "start": 402, + "length": 1710, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/arbitrary-send-erc20/0.8.0/arbitrary_send_erc20.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/arbitrary-send-erc20/0.8.0/arbitrary_send_erc20.sol", + "is_dependency": false, + "lines": [ + 17, + 18, + 19, + 20, + 21, + 22, + 23, + 24, + 25, + 26, + 27, + 28, + 29, + 30, + 31, + 32, + 33, + 34, + 35, + 36, + 37, + 38, + 39, + 40, + 41, + 42, + 43, + 44, + 45, + 46, + 47, + 48, + 49, + 50, + 51, + 52, + 53, + 54, + 55, + 56, + 57, + 58, + 59, + 60, + 61, + 62, + 63, + 64, + 65, + 66, + 67, + 68, + 69, + 70, + 71, + 72, + 73, + 74, + 75, + 76, + 77 + ], + "starting_column": 1, + "ending_column": 2 + } + }, + "signature": "bad4(address,address,uint256)" + } + } + } + } + ], + "description": "C.bad4(address,address,uint256) (tests/detectors/arbitrary-send-erc20/0.8.0/arbitrary_send_erc20.sol#65-67) uses arbitrary from in transferFrom: SafeERC20.safeTransferFrom(erc20,from,to,amount) (tests/detectors/arbitrary-send-erc20/0.8.0/arbitrary_send_erc20.sol#66)\n", + "markdown": "[C.bad4(address,address,uint256)](tests/detectors/arbitrary-send-erc20/0.8.0/arbitrary_send_erc20.sol#L65-L67) uses arbitrary from in transferFrom: [SafeERC20.safeTransferFrom(erc20,from,to,amount)](tests/detectors/arbitrary-send-erc20/0.8.0/arbitrary_send_erc20.sol#L66)\n", + "first_markdown_element": "tests/detectors/arbitrary-send-erc20/0.8.0/arbitrary_send_erc20.sol#L65-L67", + "id": "6ba2ac6eeef603310a4b4f7931ab44fadb3a242517096e17c5f1e39f0f4b83cf", + "check": "arbitrary-send-erc20", + "impact": "High", + "confidence": "High" + }, + { + "elements": [ + { + "type": "function", + "name": "bad1", + "source_mapping": { + "start": 781, + "length": 97, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/arbitrary-send-erc20/0.8.0/arbitrary_send_erc20.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/arbitrary-send-erc20/0.8.0/arbitrary_send_erc20.sol", + "is_dependency": false, + "lines": [ + 35, + 36, + 37 + ], + "starting_column": 5, + "ending_column": 6 + }, + "type_specific_fields": { + "parent": { + "type": "contract", + "name": "C", + "source_mapping": { + "start": 402, + "length": 1710, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/arbitrary-send-erc20/0.8.0/arbitrary_send_erc20.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/arbitrary-send-erc20/0.8.0/arbitrary_send_erc20.sol", + "is_dependency": false, + "lines": [ + 17, + 18, + 19, + 20, + 21, + 22, + 23, + 24, + 25, + 26, + 27, + 28, + 29, + 30, + 31, + 32, + 33, + 34, + 35, + 36, + 37, + 38, + 39, + 40, + 41, + 42, + 43, + 44, + 45, + 46, + 47, + 48, + 49, + 50, + 51, + 52, + 53, + 54, + 55, + 56, + 57, + 58, + 59, + 60, + 61, + 62, + 63, + 64, + 65, + 66, + 67, + 68, + 69, + 70, + 71, + 72, + 73, + 74, + 75, + 76, + 77 + ], + "starting_column": 1, + "ending_column": 2 + } + }, + "signature": "bad1(address,uint256)" + } + }, + { + "type": "node", + "name": "erc20.transferFrom(notsend,to,am)", + "source_mapping": { + "start": 836, + "length": 35, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/arbitrary-send-erc20/0.8.0/arbitrary_send_erc20.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/arbitrary-send-erc20/0.8.0/arbitrary_send_erc20.sol", + "is_dependency": false, + "lines": [ + 36 + ], + "starting_column": 9, + "ending_column": 44 + }, + "type_specific_fields": { + "parent": { + "type": "function", + "name": "bad1", + "source_mapping": { + "start": 781, + "length": 97, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/arbitrary-send-erc20/0.8.0/arbitrary_send_erc20.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/arbitrary-send-erc20/0.8.0/arbitrary_send_erc20.sol", + "is_dependency": false, + "lines": [ + 35, + 36, + 37 + ], + "starting_column": 5, + "ending_column": 6 + }, + "type_specific_fields": { + "parent": { + "type": "contract", + "name": "C", + "source_mapping": { + "start": 402, + "length": 1710, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/arbitrary-send-erc20/0.8.0/arbitrary_send_erc20.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/arbitrary-send-erc20/0.8.0/arbitrary_send_erc20.sol", + "is_dependency": false, + "lines": [ + 17, + 18, + 19, + 20, + 21, + 22, + 23, + 24, + 25, + 26, + 27, + 28, + 29, + 30, + 31, + 32, + 33, + 34, + 35, + 36, + 37, + 38, + 39, + 40, + 41, + 42, + 43, + 44, + 45, + 46, + 47, + 48, + 49, + 50, + 51, + 52, + 53, + 54, + 55, + 56, + 57, + 58, + 59, + 60, + 61, + 62, + 63, + 64, + 65, + 66, + 67, + 68, + 69, + 70, + 71, + 72, + 73, + 74, + 75, + 76, + 77 + ], + "starting_column": 1, + "ending_column": 2 + } + }, + "signature": "bad1(address,uint256)" + } + } + } + } + ], + "description": "C.bad1(address,uint256) (tests/detectors/arbitrary-send-erc20/0.8.0/arbitrary_send_erc20.sol#35-37) uses arbitrary from in transferFrom: erc20.transferFrom(notsend,to,am) (tests/detectors/arbitrary-send-erc20/0.8.0/arbitrary_send_erc20.sol#36)\n", + "markdown": "[C.bad1(address,uint256)](tests/detectors/arbitrary-send-erc20/0.8.0/arbitrary_send_erc20.sol#L35-L37) uses arbitrary from in transferFrom: [erc20.transferFrom(notsend,to,am)](tests/detectors/arbitrary-send-erc20/0.8.0/arbitrary_send_erc20.sol#L36)\n", + "first_markdown_element": "tests/detectors/arbitrary-send-erc20/0.8.0/arbitrary_send_erc20.sol#L35-L37", + "id": "8972d014c645b3a3783400fb2a6a38b20ea38973481025b6f99b3c15c9e63868", + "check": "arbitrary-send-erc20", + "impact": "High", + "confidence": "High" + } + ] +] \ No newline at end of file diff --git a/tests/detectors/arbitrary-send-erc20/0.8.0/arbitrary_send_erc20_inheritance.sol b/tests/detectors/arbitrary-send-erc20/0.8.0/arbitrary_send_erc20_inheritance.sol new file mode 100644 index 000000000..c74ab0fa0 --- /dev/null +++ b/tests/detectors/arbitrary-send-erc20/0.8.0/arbitrary_send_erc20_inheritance.sol @@ -0,0 +1,16 @@ +pragma solidity 0.8.0; + +library Safe { + function safeTransferFrom(address token, address from, address to, uint256 amount) internal {} +} + +contract T { + using Safe for address; + address erc20; + + function bad(address from) public { + erc20.safeTransferFrom(from, address(0x1), 90); + } +} + +contract A is T {} diff --git a/tests/detectors/arbitrary-send-erc20/0.8.0/arbitrary_send_erc20_inheritance.sol.0.8.0.ArbitrarySendErc20NoPermit.json b/tests/detectors/arbitrary-send-erc20/0.8.0/arbitrary_send_erc20_inheritance.sol.0.8.0.ArbitrarySendErc20NoPermit.json new file mode 100644 index 000000000..e89b664bb --- /dev/null +++ b/tests/detectors/arbitrary-send-erc20/0.8.0/arbitrary_send_erc20_inheritance.sol.0.8.0.ArbitrarySendErc20NoPermit.json @@ -0,0 +1,131 @@ +[ + [ + { + "elements": [ + { + "type": "function", + "name": "bad", + "source_mapping": { + "start": 196, + "length": 88, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/arbitrary-send-erc20/0.8.0/arbitrary_send_erc20_inheritance.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/arbitrary-send-erc20/0.8.0/arbitrary_send_erc20_inheritance.sol", + "is_dependency": false, + "lines": [ + 11, + 12, + 13 + ], + "starting_column": 2, + "ending_column": 3 + }, + "type_specific_fields": { + "parent": { + "type": "contract", + "name": "T", + "source_mapping": { + "start": 138, + "length": 149, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/arbitrary-send-erc20/0.8.0/arbitrary_send_erc20_inheritance.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/arbitrary-send-erc20/0.8.0/arbitrary_send_erc20_inheritance.sol", + "is_dependency": false, + "lines": [ + 7, + 8, + 9, + 10, + 11, + 12, + 13, + 14 + ], + "starting_column": 1, + "ending_column": 2 + } + }, + "signature": "bad(address)" + } + }, + { + "type": "node", + "name": "erc20.safeTransferFrom(from,address(0x1),90)", + "source_mapping": { + "start": 234, + "length": 46, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/arbitrary-send-erc20/0.8.0/arbitrary_send_erc20_inheritance.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/arbitrary-send-erc20/0.8.0/arbitrary_send_erc20_inheritance.sol", + "is_dependency": false, + "lines": [ + 12 + ], + "starting_column": 3, + "ending_column": 49 + }, + "type_specific_fields": { + "parent": { + "type": "function", + "name": "bad", + "source_mapping": { + "start": 196, + "length": 88, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/arbitrary-send-erc20/0.8.0/arbitrary_send_erc20_inheritance.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/arbitrary-send-erc20/0.8.0/arbitrary_send_erc20_inheritance.sol", + "is_dependency": false, + "lines": [ + 11, + 12, + 13 + ], + "starting_column": 2, + "ending_column": 3 + }, + "type_specific_fields": { + "parent": { + "type": "contract", + "name": "T", + "source_mapping": { + "start": 138, + "length": 149, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/arbitrary-send-erc20/0.8.0/arbitrary_send_erc20_inheritance.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/arbitrary-send-erc20/0.8.0/arbitrary_send_erc20_inheritance.sol", + "is_dependency": false, + "lines": [ + 7, + 8, + 9, + 10, + 11, + 12, + 13, + 14 + ], + "starting_column": 1, + "ending_column": 2 + } + }, + "signature": "bad(address)" + } + } + } + } + ], + "description": "T.bad(address) (tests/detectors/arbitrary-send-erc20/0.8.0/arbitrary_send_erc20_inheritance.sol#11-13) uses arbitrary from in transferFrom: erc20.safeTransferFrom(from,address(0x1),90) (tests/detectors/arbitrary-send-erc20/0.8.0/arbitrary_send_erc20_inheritance.sol#12)\n", + "markdown": "[T.bad(address)](tests/detectors/arbitrary-send-erc20/0.8.0/arbitrary_send_erc20_inheritance.sol#L11-L13) uses arbitrary from in transferFrom: [erc20.safeTransferFrom(from,address(0x1),90)](tests/detectors/arbitrary-send-erc20/0.8.0/arbitrary_send_erc20_inheritance.sol#L12)\n", + "first_markdown_element": "tests/detectors/arbitrary-send-erc20/0.8.0/arbitrary_send_erc20_inheritance.sol#L11-L13", + "id": "51845f69be45c4d9b97ff3e01cbc5bf55d1c1cddcc4776f39e22dd803a241e46", + "check": "arbitrary-send-erc20", + "impact": "High", + "confidence": "High" + } + ] +] \ No newline at end of file diff --git a/tests/detectors/arbitrary-send/0.4.25/arbitrary_send.sol b/tests/detectors/arbitrary-send-eth/0.4.25/arbitrary_send_eth.sol similarity index 100% rename from tests/detectors/arbitrary-send/0.4.25/arbitrary_send.sol rename to tests/detectors/arbitrary-send-eth/0.4.25/arbitrary_send_eth.sol diff --git a/tests/detectors/arbitrary-send/0.4.25/arbitrary_send.sol.0.4.25.ArbitrarySend.json b/tests/detectors/arbitrary-send-eth/0.4.25/arbitrary_send_eth.sol.0.4.25.ArbitrarySendEth.json similarity index 88% rename from tests/detectors/arbitrary-send/0.4.25/arbitrary_send.sol.0.4.25.ArbitrarySend.json rename to tests/detectors/arbitrary-send-eth/0.4.25/arbitrary_send_eth.sol.0.4.25.ArbitrarySendEth.json index b215f0e96..15685f8fc 100644 --- a/tests/detectors/arbitrary-send/0.4.25/arbitrary_send.sol.0.4.25.ArbitrarySend.json +++ b/tests/detectors/arbitrary-send-eth/0.4.25/arbitrary_send_eth.sol.0.4.25.ArbitrarySendEth.json @@ -4,19 +4,19 @@ "elements": [ { "type": "function", - "name": "indirect", + "name": "direct", "source_mapping": { - "start": 301, - "length": 82, + "start": 147, + "length": 79, "filename_used": "/GENERIC_PATH", - "filename_relative": "tests/detectors/arbitrary-send/0.4.25/arbitrary_send.sol", + "filename_relative": "tests/detectors/arbitrary-send-eth/0.4.25/arbitrary_send_eth.sol", "filename_absolute": "/GENERIC_PATH", - "filename_short": "tests/detectors/arbitrary-send/0.4.25/arbitrary_send.sol", + "filename_short": "tests/detectors/arbitrary-send-eth/0.4.25/arbitrary_send_eth.sol", "is_dependency": false, "lines": [ - 19, - 20, - 21 + 11, + 12, + 13 ], "starting_column": 5, "ending_column": 6 @@ -29,9 +29,9 @@ "start": 0, "length": 869, "filename_used": "/GENERIC_PATH", - "filename_relative": "tests/detectors/arbitrary-send/0.4.25/arbitrary_send.sol", + "filename_relative": "tests/detectors/arbitrary-send-eth/0.4.25/arbitrary_send_eth.sol", "filename_absolute": "/GENERIC_PATH", - "filename_short": "tests/detectors/arbitrary-send/0.4.25/arbitrary_send.sol", + "filename_short": "tests/detectors/arbitrary-send-eth/0.4.25/arbitrary_send_eth.sol", "is_dependency": false, "lines": [ 1, @@ -80,42 +80,42 @@ "ending_column": 2 } }, - "signature": "indirect()" + "signature": "direct()" } }, { "type": "node", - "name": "destination.send(address(this).balance)", + "name": "msg.sender.send(address(this).balance)", "source_mapping": { - "start": 337, - "length": 39, + "start": 181, + "length": 38, "filename_used": "/GENERIC_PATH", - "filename_relative": "tests/detectors/arbitrary-send/0.4.25/arbitrary_send.sol", + "filename_relative": "tests/detectors/arbitrary-send-eth/0.4.25/arbitrary_send_eth.sol", "filename_absolute": "/GENERIC_PATH", - "filename_short": "tests/detectors/arbitrary-send/0.4.25/arbitrary_send.sol", + "filename_short": "tests/detectors/arbitrary-send-eth/0.4.25/arbitrary_send_eth.sol", "is_dependency": false, "lines": [ - 20 + 12 ], "starting_column": 9, - "ending_column": 48 + "ending_column": 47 }, "type_specific_fields": { "parent": { "type": "function", - "name": "indirect", + "name": "direct", "source_mapping": { - "start": 301, - "length": 82, + "start": 147, + "length": 79, "filename_used": "/GENERIC_PATH", - "filename_relative": "tests/detectors/arbitrary-send/0.4.25/arbitrary_send.sol", + "filename_relative": "tests/detectors/arbitrary-send-eth/0.4.25/arbitrary_send_eth.sol", "filename_absolute": "/GENERIC_PATH", - "filename_short": "tests/detectors/arbitrary-send/0.4.25/arbitrary_send.sol", + "filename_short": "tests/detectors/arbitrary-send-eth/0.4.25/arbitrary_send_eth.sol", "is_dependency": false, "lines": [ - 19, - 20, - 21 + 11, + 12, + 13 ], "starting_column": 5, "ending_column": 6 @@ -128,9 +128,9 @@ "start": 0, "length": 869, "filename_used": "/GENERIC_PATH", - "filename_relative": "tests/detectors/arbitrary-send/0.4.25/arbitrary_send.sol", + "filename_relative": "tests/detectors/arbitrary-send-eth/0.4.25/arbitrary_send_eth.sol", "filename_absolute": "/GENERIC_PATH", - "filename_short": "tests/detectors/arbitrary-send/0.4.25/arbitrary_send.sol", + "filename_short": "tests/detectors/arbitrary-send-eth/0.4.25/arbitrary_send_eth.sol", "is_dependency": false, "lines": [ 1, @@ -179,17 +179,17 @@ "ending_column": 2 } }, - "signature": "indirect()" + "signature": "direct()" } } } } ], - "description": "Test.indirect() (tests/detectors/arbitrary-send/0.4.25/arbitrary_send.sol#19-21) sends eth to arbitrary user\n\tDangerous calls:\n\t- destination.send(address(this).balance) (tests/detectors/arbitrary-send/0.4.25/arbitrary_send.sol#20)\n", - "markdown": "[Test.indirect()](tests/detectors/arbitrary-send/0.4.25/arbitrary_send.sol#L19-L21) sends eth to arbitrary user\n\tDangerous calls:\n\t- [destination.send(address(this).balance)](tests/detectors/arbitrary-send/0.4.25/arbitrary_send.sol#L20)\n", - "first_markdown_element": "tests/detectors/arbitrary-send/0.4.25/arbitrary_send.sol#L19-L21", - "id": "4759805615df746a3d8a6c068ce885d2c18c46edf411f83ae004593958caafe7", - "check": "arbitrary-send", + "description": "Test.direct() (tests/detectors/arbitrary-send-eth/0.4.25/arbitrary_send_eth.sol#11-13) sends eth to arbitrary user\n\tDangerous calls:\n\t- msg.sender.send(address(this).balance) (tests/detectors/arbitrary-send-eth/0.4.25/arbitrary_send_eth.sol#12)\n", + "markdown": "[Test.direct()](tests/detectors/arbitrary-send-eth/0.4.25/arbitrary_send_eth.sol#L11-L13) sends eth to arbitrary user\n\tDangerous calls:\n\t- [msg.sender.send(address(this).balance)](tests/detectors/arbitrary-send-eth/0.4.25/arbitrary_send_eth.sol#L12)\n", + "first_markdown_element": "tests/detectors/arbitrary-send-eth/0.4.25/arbitrary_send_eth.sol#L11-L13", + "id": "672bdccd2e85fb88deee03d312d533259b73ca932965ae09e5b24a3b546c4ad2", + "check": "arbitrary-send-eth", "impact": "High", "confidence": "Medium" }, @@ -197,19 +197,19 @@ "elements": [ { "type": "function", - "name": "direct", + "name": "indirect", "source_mapping": { - "start": 147, - "length": 79, + "start": 301, + "length": 82, "filename_used": "/GENERIC_PATH", - "filename_relative": "tests/detectors/arbitrary-send/0.4.25/arbitrary_send.sol", + "filename_relative": "tests/detectors/arbitrary-send-eth/0.4.25/arbitrary_send_eth.sol", "filename_absolute": "/GENERIC_PATH", - "filename_short": "tests/detectors/arbitrary-send/0.4.25/arbitrary_send.sol", + "filename_short": "tests/detectors/arbitrary-send-eth/0.4.25/arbitrary_send_eth.sol", "is_dependency": false, "lines": [ - 11, - 12, - 13 + 19, + 20, + 21 ], "starting_column": 5, "ending_column": 6 @@ -222,9 +222,9 @@ "start": 0, "length": 869, "filename_used": "/GENERIC_PATH", - "filename_relative": "tests/detectors/arbitrary-send/0.4.25/arbitrary_send.sol", + "filename_relative": "tests/detectors/arbitrary-send-eth/0.4.25/arbitrary_send_eth.sol", "filename_absolute": "/GENERIC_PATH", - "filename_short": "tests/detectors/arbitrary-send/0.4.25/arbitrary_send.sol", + "filename_short": "tests/detectors/arbitrary-send-eth/0.4.25/arbitrary_send_eth.sol", "is_dependency": false, "lines": [ 1, @@ -273,42 +273,42 @@ "ending_column": 2 } }, - "signature": "direct()" + "signature": "indirect()" } }, { "type": "node", - "name": "msg.sender.send(address(this).balance)", + "name": "destination.send(address(this).balance)", "source_mapping": { - "start": 181, - "length": 38, + "start": 337, + "length": 39, "filename_used": "/GENERIC_PATH", - "filename_relative": "tests/detectors/arbitrary-send/0.4.25/arbitrary_send.sol", + "filename_relative": "tests/detectors/arbitrary-send-eth/0.4.25/arbitrary_send_eth.sol", "filename_absolute": "/GENERIC_PATH", - "filename_short": "tests/detectors/arbitrary-send/0.4.25/arbitrary_send.sol", + "filename_short": "tests/detectors/arbitrary-send-eth/0.4.25/arbitrary_send_eth.sol", "is_dependency": false, "lines": [ - 12 + 20 ], "starting_column": 9, - "ending_column": 47 + "ending_column": 48 }, "type_specific_fields": { "parent": { "type": "function", - "name": "direct", + "name": "indirect", "source_mapping": { - "start": 147, - "length": 79, + "start": 301, + "length": 82, "filename_used": "/GENERIC_PATH", - "filename_relative": "tests/detectors/arbitrary-send/0.4.25/arbitrary_send.sol", + "filename_relative": "tests/detectors/arbitrary-send-eth/0.4.25/arbitrary_send_eth.sol", "filename_absolute": "/GENERIC_PATH", - "filename_short": "tests/detectors/arbitrary-send/0.4.25/arbitrary_send.sol", + "filename_short": "tests/detectors/arbitrary-send-eth/0.4.25/arbitrary_send_eth.sol", "is_dependency": false, "lines": [ - 11, - 12, - 13 + 19, + 20, + 21 ], "starting_column": 5, "ending_column": 6 @@ -321,9 +321,9 @@ "start": 0, "length": 869, "filename_used": "/GENERIC_PATH", - "filename_relative": "tests/detectors/arbitrary-send/0.4.25/arbitrary_send.sol", + "filename_relative": "tests/detectors/arbitrary-send-eth/0.4.25/arbitrary_send_eth.sol", "filename_absolute": "/GENERIC_PATH", - "filename_short": "tests/detectors/arbitrary-send/0.4.25/arbitrary_send.sol", + "filename_short": "tests/detectors/arbitrary-send-eth/0.4.25/arbitrary_send_eth.sol", "is_dependency": false, "lines": [ 1, @@ -372,17 +372,17 @@ "ending_column": 2 } }, - "signature": "direct()" + "signature": "indirect()" } } } } ], - "description": "Test.direct() (tests/detectors/arbitrary-send/0.4.25/arbitrary_send.sol#11-13) sends eth to arbitrary user\n\tDangerous calls:\n\t- msg.sender.send(address(this).balance) (tests/detectors/arbitrary-send/0.4.25/arbitrary_send.sol#12)\n", - "markdown": "[Test.direct()](tests/detectors/arbitrary-send/0.4.25/arbitrary_send.sol#L11-L13) sends eth to arbitrary user\n\tDangerous calls:\n\t- [msg.sender.send(address(this).balance)](tests/detectors/arbitrary-send/0.4.25/arbitrary_send.sol#L12)\n", - "first_markdown_element": "tests/detectors/arbitrary-send/0.4.25/arbitrary_send.sol#L11-L13", - "id": "477cc1ab9fa3d2263400e47d09146eaed3e478f5eecf7856b59d49a2a5093a1c", - "check": "arbitrary-send", + "description": "Test.indirect() (tests/detectors/arbitrary-send-eth/0.4.25/arbitrary_send_eth.sol#19-21) sends eth to arbitrary user\n\tDangerous calls:\n\t- destination.send(address(this).balance) (tests/detectors/arbitrary-send-eth/0.4.25/arbitrary_send_eth.sol#20)\n", + "markdown": "[Test.indirect()](tests/detectors/arbitrary-send-eth/0.4.25/arbitrary_send_eth.sol#L19-L21) sends eth to arbitrary user\n\tDangerous calls:\n\t- [destination.send(address(this).balance)](tests/detectors/arbitrary-send-eth/0.4.25/arbitrary_send_eth.sol#L20)\n", + "first_markdown_element": "tests/detectors/arbitrary-send-eth/0.4.25/arbitrary_send_eth.sol#L19-L21", + "id": "9d50facc8382e844e7381f8ca9e389061bd0302345047de2407e0ad7b046687d", + "check": "arbitrary-send-eth", "impact": "High", "confidence": "Medium" } diff --git a/tests/detectors/arbitrary-send/0.5.16/arbitrary_send.sol b/tests/detectors/arbitrary-send-eth/0.5.16/arbitrary_send_eth.sol similarity index 100% rename from tests/detectors/arbitrary-send/0.5.16/arbitrary_send.sol rename to tests/detectors/arbitrary-send-eth/0.5.16/arbitrary_send_eth.sol diff --git a/tests/detectors/arbitrary-send/0.5.16/arbitrary_send.sol.0.5.16.ArbitrarySend.json b/tests/detectors/arbitrary-send-eth/0.5.16/arbitrary_send_eth.sol.0.5.16.ArbitrarySendEth.json similarity index 88% rename from tests/detectors/arbitrary-send/0.5.16/arbitrary_send.sol.0.5.16.ArbitrarySend.json rename to tests/detectors/arbitrary-send-eth/0.5.16/arbitrary_send_eth.sol.0.5.16.ArbitrarySendEth.json index cfb1bcc13..814e44e93 100644 --- a/tests/detectors/arbitrary-send/0.5.16/arbitrary_send.sol.0.5.16.ArbitrarySend.json +++ b/tests/detectors/arbitrary-send-eth/0.5.16/arbitrary_send_eth.sol.0.5.16.ArbitrarySendEth.json @@ -9,9 +9,9 @@ "start": 162, "length": 79, "filename_used": "/GENERIC_PATH", - "filename_relative": "tests/detectors/arbitrary-send/0.5.16/arbitrary_send.sol", + "filename_relative": "tests/detectors/arbitrary-send-eth/0.5.16/arbitrary_send_eth.sol", "filename_absolute": "/GENERIC_PATH", - "filename_short": "tests/detectors/arbitrary-send/0.5.16/arbitrary_send.sol", + "filename_short": "tests/detectors/arbitrary-send-eth/0.5.16/arbitrary_send_eth.sol", "is_dependency": false, "lines": [ 11, @@ -29,9 +29,9 @@ "start": 0, "length": 884, "filename_used": "/GENERIC_PATH", - "filename_relative": "tests/detectors/arbitrary-send/0.5.16/arbitrary_send.sol", + "filename_relative": "tests/detectors/arbitrary-send-eth/0.5.16/arbitrary_send_eth.sol", "filename_absolute": "/GENERIC_PATH", - "filename_short": "tests/detectors/arbitrary-send/0.5.16/arbitrary_send.sol", + "filename_short": "tests/detectors/arbitrary-send-eth/0.5.16/arbitrary_send_eth.sol", "is_dependency": false, "lines": [ 1, @@ -90,9 +90,9 @@ "start": 196, "length": 38, "filename_used": "/GENERIC_PATH", - "filename_relative": "tests/detectors/arbitrary-send/0.5.16/arbitrary_send.sol", + "filename_relative": "tests/detectors/arbitrary-send-eth/0.5.16/arbitrary_send_eth.sol", "filename_absolute": "/GENERIC_PATH", - "filename_short": "tests/detectors/arbitrary-send/0.5.16/arbitrary_send.sol", + "filename_short": "tests/detectors/arbitrary-send-eth/0.5.16/arbitrary_send_eth.sol", "is_dependency": false, "lines": [ 12 @@ -108,9 +108,9 @@ "start": 162, "length": 79, "filename_used": "/GENERIC_PATH", - "filename_relative": "tests/detectors/arbitrary-send/0.5.16/arbitrary_send.sol", + "filename_relative": "tests/detectors/arbitrary-send-eth/0.5.16/arbitrary_send_eth.sol", "filename_absolute": "/GENERIC_PATH", - "filename_short": "tests/detectors/arbitrary-send/0.5.16/arbitrary_send.sol", + "filename_short": "tests/detectors/arbitrary-send-eth/0.5.16/arbitrary_send_eth.sol", "is_dependency": false, "lines": [ 11, @@ -128,9 +128,9 @@ "start": 0, "length": 884, "filename_used": "/GENERIC_PATH", - "filename_relative": "tests/detectors/arbitrary-send/0.5.16/arbitrary_send.sol", + "filename_relative": "tests/detectors/arbitrary-send-eth/0.5.16/arbitrary_send_eth.sol", "filename_absolute": "/GENERIC_PATH", - "filename_short": "tests/detectors/arbitrary-send/0.5.16/arbitrary_send.sol", + "filename_short": "tests/detectors/arbitrary-send-eth/0.5.16/arbitrary_send_eth.sol", "is_dependency": false, "lines": [ 1, @@ -185,11 +185,11 @@ } } ], - "description": "Test.direct() (tests/detectors/arbitrary-send/0.5.16/arbitrary_send.sol#11-13) sends eth to arbitrary user\n\tDangerous calls:\n\t- msg.sender.send(address(this).balance) (tests/detectors/arbitrary-send/0.5.16/arbitrary_send.sol#12)\n", - "markdown": "[Test.direct()](tests/detectors/arbitrary-send/0.5.16/arbitrary_send.sol#L11-L13) sends eth to arbitrary user\n\tDangerous calls:\n\t- [msg.sender.send(address(this).balance)](tests/detectors/arbitrary-send/0.5.16/arbitrary_send.sol#L12)\n", - "first_markdown_element": "tests/detectors/arbitrary-send/0.5.16/arbitrary_send.sol#L11-L13", - "id": "9531cafd91af4d7b54f22fa933dae983077df1c51bd855c2516ffee812911f43", - "check": "arbitrary-send", + "description": "Test.direct() (tests/detectors/arbitrary-send-eth/0.5.16/arbitrary_send_eth.sol#11-13) sends eth to arbitrary user\n\tDangerous calls:\n\t- msg.sender.send(address(this).balance) (tests/detectors/arbitrary-send-eth/0.5.16/arbitrary_send_eth.sol#12)\n", + "markdown": "[Test.direct()](tests/detectors/arbitrary-send-eth/0.5.16/arbitrary_send_eth.sol#L11-L13) sends eth to arbitrary user\n\tDangerous calls:\n\t- [msg.sender.send(address(this).balance)](tests/detectors/arbitrary-send-eth/0.5.16/arbitrary_send_eth.sol#L12)\n", + "first_markdown_element": "tests/detectors/arbitrary-send-eth/0.5.16/arbitrary_send_eth.sol#L11-L13", + "id": "7ded1859293ad51d129850d2f19669c7d38f4687a6e2afa8d93534d5f2a9a0ad", + "check": "arbitrary-send-eth", "impact": "High", "confidence": "Medium" }, @@ -202,9 +202,9 @@ "start": 316, "length": 82, "filename_used": "/GENERIC_PATH", - "filename_relative": "tests/detectors/arbitrary-send/0.5.16/arbitrary_send.sol", + "filename_relative": "tests/detectors/arbitrary-send-eth/0.5.16/arbitrary_send_eth.sol", "filename_absolute": "/GENERIC_PATH", - "filename_short": "tests/detectors/arbitrary-send/0.5.16/arbitrary_send.sol", + "filename_short": "tests/detectors/arbitrary-send-eth/0.5.16/arbitrary_send_eth.sol", "is_dependency": false, "lines": [ 19, @@ -222,9 +222,9 @@ "start": 0, "length": 884, "filename_used": "/GENERIC_PATH", - "filename_relative": "tests/detectors/arbitrary-send/0.5.16/arbitrary_send.sol", + "filename_relative": "tests/detectors/arbitrary-send-eth/0.5.16/arbitrary_send_eth.sol", "filename_absolute": "/GENERIC_PATH", - "filename_short": "tests/detectors/arbitrary-send/0.5.16/arbitrary_send.sol", + "filename_short": "tests/detectors/arbitrary-send-eth/0.5.16/arbitrary_send_eth.sol", "is_dependency": false, "lines": [ 1, @@ -283,9 +283,9 @@ "start": 352, "length": 39, "filename_used": "/GENERIC_PATH", - "filename_relative": "tests/detectors/arbitrary-send/0.5.16/arbitrary_send.sol", + "filename_relative": "tests/detectors/arbitrary-send-eth/0.5.16/arbitrary_send_eth.sol", "filename_absolute": "/GENERIC_PATH", - "filename_short": "tests/detectors/arbitrary-send/0.5.16/arbitrary_send.sol", + "filename_short": "tests/detectors/arbitrary-send-eth/0.5.16/arbitrary_send_eth.sol", "is_dependency": false, "lines": [ 20 @@ -301,9 +301,9 @@ "start": 316, "length": 82, "filename_used": "/GENERIC_PATH", - "filename_relative": "tests/detectors/arbitrary-send/0.5.16/arbitrary_send.sol", + "filename_relative": "tests/detectors/arbitrary-send-eth/0.5.16/arbitrary_send_eth.sol", "filename_absolute": "/GENERIC_PATH", - "filename_short": "tests/detectors/arbitrary-send/0.5.16/arbitrary_send.sol", + "filename_short": "tests/detectors/arbitrary-send-eth/0.5.16/arbitrary_send_eth.sol", "is_dependency": false, "lines": [ 19, @@ -321,9 +321,9 @@ "start": 0, "length": 884, "filename_used": "/GENERIC_PATH", - "filename_relative": "tests/detectors/arbitrary-send/0.5.16/arbitrary_send.sol", + "filename_relative": "tests/detectors/arbitrary-send-eth/0.5.16/arbitrary_send_eth.sol", "filename_absolute": "/GENERIC_PATH", - "filename_short": "tests/detectors/arbitrary-send/0.5.16/arbitrary_send.sol", + "filename_short": "tests/detectors/arbitrary-send-eth/0.5.16/arbitrary_send_eth.sol", "is_dependency": false, "lines": [ 1, @@ -378,11 +378,11 @@ } } ], - "description": "Test.indirect() (tests/detectors/arbitrary-send/0.5.16/arbitrary_send.sol#19-21) sends eth to arbitrary user\n\tDangerous calls:\n\t- destination.send(address(this).balance) (tests/detectors/arbitrary-send/0.5.16/arbitrary_send.sol#20)\n", - "markdown": "[Test.indirect()](tests/detectors/arbitrary-send/0.5.16/arbitrary_send.sol#L19-L21) sends eth to arbitrary user\n\tDangerous calls:\n\t- [destination.send(address(this).balance)](tests/detectors/arbitrary-send/0.5.16/arbitrary_send.sol#L20)\n", - "first_markdown_element": "tests/detectors/arbitrary-send/0.5.16/arbitrary_send.sol#L19-L21", - "id": "f1395ebf21de9f8fb2c5d254c5990cce55b239c05a6a5e074813f58c6cd32834", - "check": "arbitrary-send", + "description": "Test.indirect() (tests/detectors/arbitrary-send-eth/0.5.16/arbitrary_send_eth.sol#19-21) sends eth to arbitrary user\n\tDangerous calls:\n\t- destination.send(address(this).balance) (tests/detectors/arbitrary-send-eth/0.5.16/arbitrary_send_eth.sol#20)\n", + "markdown": "[Test.indirect()](tests/detectors/arbitrary-send-eth/0.5.16/arbitrary_send_eth.sol#L19-L21) sends eth to arbitrary user\n\tDangerous calls:\n\t- [destination.send(address(this).balance)](tests/detectors/arbitrary-send-eth/0.5.16/arbitrary_send_eth.sol#L20)\n", + "first_markdown_element": "tests/detectors/arbitrary-send-eth/0.5.16/arbitrary_send_eth.sol#L19-L21", + "id": "d27379ff48eebb6c568308104d444dc8f6b5ed5eae53f6c937aec9fb15cf6464", + "check": "arbitrary-send-eth", "impact": "High", "confidence": "Medium" } diff --git a/tests/detectors/arbitrary-send/0.6.11/arbitrary_send.sol b/tests/detectors/arbitrary-send-eth/0.6.11/arbitrary_send_eth.sol similarity index 100% rename from tests/detectors/arbitrary-send/0.6.11/arbitrary_send.sol rename to tests/detectors/arbitrary-send-eth/0.6.11/arbitrary_send_eth.sol diff --git a/tests/detectors/arbitrary-send/0.6.11/arbitrary_send.sol.0.6.11.ArbitrarySend.json b/tests/detectors/arbitrary-send-eth/0.6.11/arbitrary_send_eth.sol.0.6.11.ArbitrarySendEth.json similarity index 88% rename from tests/detectors/arbitrary-send/0.6.11/arbitrary_send.sol.0.6.11.ArbitrarySend.json rename to tests/detectors/arbitrary-send-eth/0.6.11/arbitrary_send_eth.sol.0.6.11.ArbitrarySendEth.json index cde2f95aa..af4d54ece 100644 --- a/tests/detectors/arbitrary-send/0.6.11/arbitrary_send.sol.0.6.11.ArbitrarySend.json +++ b/tests/detectors/arbitrary-send-eth/0.6.11/arbitrary_send_eth.sol.0.6.11.ArbitrarySendEth.json @@ -9,9 +9,9 @@ "start": 162, "length": 79, "filename_used": "/GENERIC_PATH", - "filename_relative": "tests/detectors/arbitrary-send/0.6.11/arbitrary_send.sol", + "filename_relative": "tests/detectors/arbitrary-send-eth/0.6.11/arbitrary_send_eth.sol", "filename_absolute": "/GENERIC_PATH", - "filename_short": "tests/detectors/arbitrary-send/0.6.11/arbitrary_send.sol", + "filename_short": "tests/detectors/arbitrary-send-eth/0.6.11/arbitrary_send_eth.sol", "is_dependency": false, "lines": [ 11, @@ -29,9 +29,9 @@ "start": 0, "length": 884, "filename_used": "/GENERIC_PATH", - "filename_relative": "tests/detectors/arbitrary-send/0.6.11/arbitrary_send.sol", + "filename_relative": "tests/detectors/arbitrary-send-eth/0.6.11/arbitrary_send_eth.sol", "filename_absolute": "/GENERIC_PATH", - "filename_short": "tests/detectors/arbitrary-send/0.6.11/arbitrary_send.sol", + "filename_short": "tests/detectors/arbitrary-send-eth/0.6.11/arbitrary_send_eth.sol", "is_dependency": false, "lines": [ 1, @@ -90,9 +90,9 @@ "start": 196, "length": 38, "filename_used": "/GENERIC_PATH", - "filename_relative": "tests/detectors/arbitrary-send/0.6.11/arbitrary_send.sol", + "filename_relative": "tests/detectors/arbitrary-send-eth/0.6.11/arbitrary_send_eth.sol", "filename_absolute": "/GENERIC_PATH", - "filename_short": "tests/detectors/arbitrary-send/0.6.11/arbitrary_send.sol", + "filename_short": "tests/detectors/arbitrary-send-eth/0.6.11/arbitrary_send_eth.sol", "is_dependency": false, "lines": [ 12 @@ -108,9 +108,9 @@ "start": 162, "length": 79, "filename_used": "/GENERIC_PATH", - "filename_relative": "tests/detectors/arbitrary-send/0.6.11/arbitrary_send.sol", + "filename_relative": "tests/detectors/arbitrary-send-eth/0.6.11/arbitrary_send_eth.sol", "filename_absolute": "/GENERIC_PATH", - "filename_short": "tests/detectors/arbitrary-send/0.6.11/arbitrary_send.sol", + "filename_short": "tests/detectors/arbitrary-send-eth/0.6.11/arbitrary_send_eth.sol", "is_dependency": false, "lines": [ 11, @@ -128,9 +128,9 @@ "start": 0, "length": 884, "filename_used": "/GENERIC_PATH", - "filename_relative": "tests/detectors/arbitrary-send/0.6.11/arbitrary_send.sol", + "filename_relative": "tests/detectors/arbitrary-send-eth/0.6.11/arbitrary_send_eth.sol", "filename_absolute": "/GENERIC_PATH", - "filename_short": "tests/detectors/arbitrary-send/0.6.11/arbitrary_send.sol", + "filename_short": "tests/detectors/arbitrary-send-eth/0.6.11/arbitrary_send_eth.sol", "is_dependency": false, "lines": [ 1, @@ -185,11 +185,11 @@ } } ], - "description": "Test.direct() (tests/detectors/arbitrary-send/0.6.11/arbitrary_send.sol#11-13) sends eth to arbitrary user\n\tDangerous calls:\n\t- msg.sender.send(address(this).balance) (tests/detectors/arbitrary-send/0.6.11/arbitrary_send.sol#12)\n", - "markdown": "[Test.direct()](tests/detectors/arbitrary-send/0.6.11/arbitrary_send.sol#L11-L13) sends eth to arbitrary user\n\tDangerous calls:\n\t- [msg.sender.send(address(this).balance)](tests/detectors/arbitrary-send/0.6.11/arbitrary_send.sol#L12)\n", - "first_markdown_element": "tests/detectors/arbitrary-send/0.6.11/arbitrary_send.sol#L11-L13", - "id": "8a1de239f630f10fef9ef6a9c439fc10aad2f6caba7ee43d1a7f7bacf6028f1e", - "check": "arbitrary-send", + "description": "Test.direct() (tests/detectors/arbitrary-send-eth/0.6.11/arbitrary_send_eth.sol#11-13) sends eth to arbitrary user\n\tDangerous calls:\n\t- msg.sender.send(address(this).balance) (tests/detectors/arbitrary-send-eth/0.6.11/arbitrary_send_eth.sol#12)\n", + "markdown": "[Test.direct()](tests/detectors/arbitrary-send-eth/0.6.11/arbitrary_send_eth.sol#L11-L13) sends eth to arbitrary user\n\tDangerous calls:\n\t- [msg.sender.send(address(this).balance)](tests/detectors/arbitrary-send-eth/0.6.11/arbitrary_send_eth.sol#L12)\n", + "first_markdown_element": "tests/detectors/arbitrary-send-eth/0.6.11/arbitrary_send_eth.sol#L11-L13", + "id": "51e87e03fc48363e666bb99c1d15beccb50464e1c170eeea5b76ec6fcde643e7", + "check": "arbitrary-send-eth", "impact": "High", "confidence": "Medium" }, @@ -202,9 +202,9 @@ "start": 316, "length": 82, "filename_used": "/GENERIC_PATH", - "filename_relative": "tests/detectors/arbitrary-send/0.6.11/arbitrary_send.sol", + "filename_relative": "tests/detectors/arbitrary-send-eth/0.6.11/arbitrary_send_eth.sol", "filename_absolute": "/GENERIC_PATH", - "filename_short": "tests/detectors/arbitrary-send/0.6.11/arbitrary_send.sol", + "filename_short": "tests/detectors/arbitrary-send-eth/0.6.11/arbitrary_send_eth.sol", "is_dependency": false, "lines": [ 19, @@ -222,9 +222,9 @@ "start": 0, "length": 884, "filename_used": "/GENERIC_PATH", - "filename_relative": "tests/detectors/arbitrary-send/0.6.11/arbitrary_send.sol", + "filename_relative": "tests/detectors/arbitrary-send-eth/0.6.11/arbitrary_send_eth.sol", "filename_absolute": "/GENERIC_PATH", - "filename_short": "tests/detectors/arbitrary-send/0.6.11/arbitrary_send.sol", + "filename_short": "tests/detectors/arbitrary-send-eth/0.6.11/arbitrary_send_eth.sol", "is_dependency": false, "lines": [ 1, @@ -283,9 +283,9 @@ "start": 352, "length": 39, "filename_used": "/GENERIC_PATH", - "filename_relative": "tests/detectors/arbitrary-send/0.6.11/arbitrary_send.sol", + "filename_relative": "tests/detectors/arbitrary-send-eth/0.6.11/arbitrary_send_eth.sol", "filename_absolute": "/GENERIC_PATH", - "filename_short": "tests/detectors/arbitrary-send/0.6.11/arbitrary_send.sol", + "filename_short": "tests/detectors/arbitrary-send-eth/0.6.11/arbitrary_send_eth.sol", "is_dependency": false, "lines": [ 20 @@ -301,9 +301,9 @@ "start": 316, "length": 82, "filename_used": "/GENERIC_PATH", - "filename_relative": "tests/detectors/arbitrary-send/0.6.11/arbitrary_send.sol", + "filename_relative": "tests/detectors/arbitrary-send-eth/0.6.11/arbitrary_send_eth.sol", "filename_absolute": "/GENERIC_PATH", - "filename_short": "tests/detectors/arbitrary-send/0.6.11/arbitrary_send.sol", + "filename_short": "tests/detectors/arbitrary-send-eth/0.6.11/arbitrary_send_eth.sol", "is_dependency": false, "lines": [ 19, @@ -321,9 +321,9 @@ "start": 0, "length": 884, "filename_used": "/GENERIC_PATH", - "filename_relative": "tests/detectors/arbitrary-send/0.6.11/arbitrary_send.sol", + "filename_relative": "tests/detectors/arbitrary-send-eth/0.6.11/arbitrary_send_eth.sol", "filename_absolute": "/GENERIC_PATH", - "filename_short": "tests/detectors/arbitrary-send/0.6.11/arbitrary_send.sol", + "filename_short": "tests/detectors/arbitrary-send-eth/0.6.11/arbitrary_send_eth.sol", "is_dependency": false, "lines": [ 1, @@ -378,11 +378,11 @@ } } ], - "description": "Test.indirect() (tests/detectors/arbitrary-send/0.6.11/arbitrary_send.sol#19-21) sends eth to arbitrary user\n\tDangerous calls:\n\t- destination.send(address(this).balance) (tests/detectors/arbitrary-send/0.6.11/arbitrary_send.sol#20)\n", - "markdown": "[Test.indirect()](tests/detectors/arbitrary-send/0.6.11/arbitrary_send.sol#L19-L21) sends eth to arbitrary user\n\tDangerous calls:\n\t- [destination.send(address(this).balance)](tests/detectors/arbitrary-send/0.6.11/arbitrary_send.sol#L20)\n", - "first_markdown_element": "tests/detectors/arbitrary-send/0.6.11/arbitrary_send.sol#L19-L21", - "id": "f272e05d9741895fc22051ed09afa6ce4af8ad4cd74b3452224dfb29eb4b9df6", - "check": "arbitrary-send", + "description": "Test.indirect() (tests/detectors/arbitrary-send-eth/0.6.11/arbitrary_send_eth.sol#19-21) sends eth to arbitrary user\n\tDangerous calls:\n\t- destination.send(address(this).balance) (tests/detectors/arbitrary-send-eth/0.6.11/arbitrary_send_eth.sol#20)\n", + "markdown": "[Test.indirect()](tests/detectors/arbitrary-send-eth/0.6.11/arbitrary_send_eth.sol#L19-L21) sends eth to arbitrary user\n\tDangerous calls:\n\t- [destination.send(address(this).balance)](tests/detectors/arbitrary-send-eth/0.6.11/arbitrary_send_eth.sol#L20)\n", + "first_markdown_element": "tests/detectors/arbitrary-send-eth/0.6.11/arbitrary_send_eth.sol#L19-L21", + "id": "0ec491130aac4e23e6d47193bff49ed6029330bca373454b4e34ffba0a2baea6", + "check": "arbitrary-send-eth", "impact": "High", "confidence": "Medium" } diff --git a/tests/detectors/arbitrary-send/0.7.6/arbitrary_send.sol b/tests/detectors/arbitrary-send-eth/0.7.6/arbitrary_send_eth.sol similarity index 100% rename from tests/detectors/arbitrary-send/0.7.6/arbitrary_send.sol rename to tests/detectors/arbitrary-send-eth/0.7.6/arbitrary_send_eth.sol diff --git a/tests/detectors/arbitrary-send/0.7.6/arbitrary_send.sol.0.7.6.ArbitrarySend.json b/tests/detectors/arbitrary-send-eth/0.7.6/arbitrary_send_eth.sol.0.7.6.ArbitrarySendEth.json similarity index 88% rename from tests/detectors/arbitrary-send/0.7.6/arbitrary_send.sol.0.7.6.ArbitrarySend.json rename to tests/detectors/arbitrary-send-eth/0.7.6/arbitrary_send_eth.sol.0.7.6.ArbitrarySendEth.json index 0f0fe4d57..56afe8cb5 100644 --- a/tests/detectors/arbitrary-send/0.7.6/arbitrary_send.sol.0.7.6.ArbitrarySend.json +++ b/tests/detectors/arbitrary-send-eth/0.7.6/arbitrary_send_eth.sol.0.7.6.ArbitrarySendEth.json @@ -4,19 +4,19 @@ "elements": [ { "type": "function", - "name": "indirect", + "name": "direct", "source_mapping": { - "start": 316, - "length": 82, + "start": 162, + "length": 79, "filename_used": "/GENERIC_PATH", - "filename_relative": "tests/detectors/arbitrary-send/0.7.6/arbitrary_send.sol", + "filename_relative": "tests/detectors/arbitrary-send-eth/0.7.6/arbitrary_send_eth.sol", "filename_absolute": "/GENERIC_PATH", - "filename_short": "tests/detectors/arbitrary-send/0.7.6/arbitrary_send.sol", + "filename_short": "tests/detectors/arbitrary-send-eth/0.7.6/arbitrary_send_eth.sol", "is_dependency": false, "lines": [ - 19, - 20, - 21 + 11, + 12, + 13 ], "starting_column": 5, "ending_column": 6 @@ -29,9 +29,9 @@ "start": 0, "length": 884, "filename_used": "/GENERIC_PATH", - "filename_relative": "tests/detectors/arbitrary-send/0.7.6/arbitrary_send.sol", + "filename_relative": "tests/detectors/arbitrary-send-eth/0.7.6/arbitrary_send_eth.sol", "filename_absolute": "/GENERIC_PATH", - "filename_short": "tests/detectors/arbitrary-send/0.7.6/arbitrary_send.sol", + "filename_short": "tests/detectors/arbitrary-send-eth/0.7.6/arbitrary_send_eth.sol", "is_dependency": false, "lines": [ 1, @@ -80,42 +80,42 @@ "ending_column": 2 } }, - "signature": "indirect()" + "signature": "direct()" } }, { "type": "node", - "name": "destination.send(address(this).balance)", + "name": "msg.sender.send(address(this).balance)", "source_mapping": { - "start": 352, - "length": 39, + "start": 196, + "length": 38, "filename_used": "/GENERIC_PATH", - "filename_relative": "tests/detectors/arbitrary-send/0.7.6/arbitrary_send.sol", + "filename_relative": "tests/detectors/arbitrary-send-eth/0.7.6/arbitrary_send_eth.sol", "filename_absolute": "/GENERIC_PATH", - "filename_short": "tests/detectors/arbitrary-send/0.7.6/arbitrary_send.sol", + "filename_short": "tests/detectors/arbitrary-send-eth/0.7.6/arbitrary_send_eth.sol", "is_dependency": false, "lines": [ - 20 + 12 ], "starting_column": 9, - "ending_column": 48 + "ending_column": 47 }, "type_specific_fields": { "parent": { "type": "function", - "name": "indirect", + "name": "direct", "source_mapping": { - "start": 316, - "length": 82, + "start": 162, + "length": 79, "filename_used": "/GENERIC_PATH", - "filename_relative": "tests/detectors/arbitrary-send/0.7.6/arbitrary_send.sol", + "filename_relative": "tests/detectors/arbitrary-send-eth/0.7.6/arbitrary_send_eth.sol", "filename_absolute": "/GENERIC_PATH", - "filename_short": "tests/detectors/arbitrary-send/0.7.6/arbitrary_send.sol", + "filename_short": "tests/detectors/arbitrary-send-eth/0.7.6/arbitrary_send_eth.sol", "is_dependency": false, "lines": [ - 19, - 20, - 21 + 11, + 12, + 13 ], "starting_column": 5, "ending_column": 6 @@ -128,9 +128,9 @@ "start": 0, "length": 884, "filename_used": "/GENERIC_PATH", - "filename_relative": "tests/detectors/arbitrary-send/0.7.6/arbitrary_send.sol", + "filename_relative": "tests/detectors/arbitrary-send-eth/0.7.6/arbitrary_send_eth.sol", "filename_absolute": "/GENERIC_PATH", - "filename_short": "tests/detectors/arbitrary-send/0.7.6/arbitrary_send.sol", + "filename_short": "tests/detectors/arbitrary-send-eth/0.7.6/arbitrary_send_eth.sol", "is_dependency": false, "lines": [ 1, @@ -179,17 +179,17 @@ "ending_column": 2 } }, - "signature": "indirect()" + "signature": "direct()" } } } } ], - "description": "Test.indirect() (tests/detectors/arbitrary-send/0.7.6/arbitrary_send.sol#19-21) sends eth to arbitrary user\n\tDangerous calls:\n\t- destination.send(address(this).balance) (tests/detectors/arbitrary-send/0.7.6/arbitrary_send.sol#20)\n", - "markdown": "[Test.indirect()](tests/detectors/arbitrary-send/0.7.6/arbitrary_send.sol#L19-L21) sends eth to arbitrary user\n\tDangerous calls:\n\t- [destination.send(address(this).balance)](tests/detectors/arbitrary-send/0.7.6/arbitrary_send.sol#L20)\n", - "first_markdown_element": "tests/detectors/arbitrary-send/0.7.6/arbitrary_send.sol#L19-L21", - "id": "3bf41470de6f5fec21d1da5741e7d63ee1d3b63cfd2646d697274f4495e3f1a9", - "check": "arbitrary-send", + "description": "Test.direct() (tests/detectors/arbitrary-send-eth/0.7.6/arbitrary_send_eth.sol#11-13) sends eth to arbitrary user\n\tDangerous calls:\n\t- msg.sender.send(address(this).balance) (tests/detectors/arbitrary-send-eth/0.7.6/arbitrary_send_eth.sol#12)\n", + "markdown": "[Test.direct()](tests/detectors/arbitrary-send-eth/0.7.6/arbitrary_send_eth.sol#L11-L13) sends eth to arbitrary user\n\tDangerous calls:\n\t- [msg.sender.send(address(this).balance)](tests/detectors/arbitrary-send-eth/0.7.6/arbitrary_send_eth.sol#L12)\n", + "first_markdown_element": "tests/detectors/arbitrary-send-eth/0.7.6/arbitrary_send_eth.sol#L11-L13", + "id": "76af03df5e6d33df8978a2cc00dfe944236aca69ad1b7f107580da1b76121082", + "check": "arbitrary-send-eth", "impact": "High", "confidence": "Medium" }, @@ -197,19 +197,19 @@ "elements": [ { "type": "function", - "name": "direct", + "name": "indirect", "source_mapping": { - "start": 162, - "length": 79, + "start": 316, + "length": 82, "filename_used": "/GENERIC_PATH", - "filename_relative": "tests/detectors/arbitrary-send/0.7.6/arbitrary_send.sol", + "filename_relative": "tests/detectors/arbitrary-send-eth/0.7.6/arbitrary_send_eth.sol", "filename_absolute": "/GENERIC_PATH", - "filename_short": "tests/detectors/arbitrary-send/0.7.6/arbitrary_send.sol", + "filename_short": "tests/detectors/arbitrary-send-eth/0.7.6/arbitrary_send_eth.sol", "is_dependency": false, "lines": [ - 11, - 12, - 13 + 19, + 20, + 21 ], "starting_column": 5, "ending_column": 6 @@ -222,9 +222,9 @@ "start": 0, "length": 884, "filename_used": "/GENERIC_PATH", - "filename_relative": "tests/detectors/arbitrary-send/0.7.6/arbitrary_send.sol", + "filename_relative": "tests/detectors/arbitrary-send-eth/0.7.6/arbitrary_send_eth.sol", "filename_absolute": "/GENERIC_PATH", - "filename_short": "tests/detectors/arbitrary-send/0.7.6/arbitrary_send.sol", + "filename_short": "tests/detectors/arbitrary-send-eth/0.7.6/arbitrary_send_eth.sol", "is_dependency": false, "lines": [ 1, @@ -273,42 +273,42 @@ "ending_column": 2 } }, - "signature": "direct()" + "signature": "indirect()" } }, { "type": "node", - "name": "msg.sender.send(address(this).balance)", + "name": "destination.send(address(this).balance)", "source_mapping": { - "start": 196, - "length": 38, + "start": 352, + "length": 39, "filename_used": "/GENERIC_PATH", - "filename_relative": "tests/detectors/arbitrary-send/0.7.6/arbitrary_send.sol", + "filename_relative": "tests/detectors/arbitrary-send-eth/0.7.6/arbitrary_send_eth.sol", "filename_absolute": "/GENERIC_PATH", - "filename_short": "tests/detectors/arbitrary-send/0.7.6/arbitrary_send.sol", + "filename_short": "tests/detectors/arbitrary-send-eth/0.7.6/arbitrary_send_eth.sol", "is_dependency": false, "lines": [ - 12 + 20 ], "starting_column": 9, - "ending_column": 47 + "ending_column": 48 }, "type_specific_fields": { "parent": { "type": "function", - "name": "direct", + "name": "indirect", "source_mapping": { - "start": 162, - "length": 79, + "start": 316, + "length": 82, "filename_used": "/GENERIC_PATH", - "filename_relative": "tests/detectors/arbitrary-send/0.7.6/arbitrary_send.sol", + "filename_relative": "tests/detectors/arbitrary-send-eth/0.7.6/arbitrary_send_eth.sol", "filename_absolute": "/GENERIC_PATH", - "filename_short": "tests/detectors/arbitrary-send/0.7.6/arbitrary_send.sol", + "filename_short": "tests/detectors/arbitrary-send-eth/0.7.6/arbitrary_send_eth.sol", "is_dependency": false, "lines": [ - 11, - 12, - 13 + 19, + 20, + 21 ], "starting_column": 5, "ending_column": 6 @@ -321,9 +321,9 @@ "start": 0, "length": 884, "filename_used": "/GENERIC_PATH", - "filename_relative": "tests/detectors/arbitrary-send/0.7.6/arbitrary_send.sol", + "filename_relative": "tests/detectors/arbitrary-send-eth/0.7.6/arbitrary_send_eth.sol", "filename_absolute": "/GENERIC_PATH", - "filename_short": "tests/detectors/arbitrary-send/0.7.6/arbitrary_send.sol", + "filename_short": "tests/detectors/arbitrary-send-eth/0.7.6/arbitrary_send_eth.sol", "is_dependency": false, "lines": [ 1, @@ -372,17 +372,17 @@ "ending_column": 2 } }, - "signature": "direct()" + "signature": "indirect()" } } } } ], - "description": "Test.direct() (tests/detectors/arbitrary-send/0.7.6/arbitrary_send.sol#11-13) sends eth to arbitrary user\n\tDangerous calls:\n\t- msg.sender.send(address(this).balance) (tests/detectors/arbitrary-send/0.7.6/arbitrary_send.sol#12)\n", - "markdown": "[Test.direct()](tests/detectors/arbitrary-send/0.7.6/arbitrary_send.sol#L11-L13) sends eth to arbitrary user\n\tDangerous calls:\n\t- [msg.sender.send(address(this).balance)](tests/detectors/arbitrary-send/0.7.6/arbitrary_send.sol#L12)\n", - "first_markdown_element": "tests/detectors/arbitrary-send/0.7.6/arbitrary_send.sol#L11-L13", - "id": "90d9178119fb586af18c2298136d7f1af4d33a9b702b94d2ca0fcdbe6ee783c6", - "check": "arbitrary-send", + "description": "Test.indirect() (tests/detectors/arbitrary-send-eth/0.7.6/arbitrary_send_eth.sol#19-21) sends eth to arbitrary user\n\tDangerous calls:\n\t- destination.send(address(this).balance) (tests/detectors/arbitrary-send-eth/0.7.6/arbitrary_send_eth.sol#20)\n", + "markdown": "[Test.indirect()](tests/detectors/arbitrary-send-eth/0.7.6/arbitrary_send_eth.sol#L19-L21) sends eth to arbitrary user\n\tDangerous calls:\n\t- [destination.send(address(this).balance)](tests/detectors/arbitrary-send-eth/0.7.6/arbitrary_send_eth.sol#L20)\n", + "first_markdown_element": "tests/detectors/arbitrary-send-eth/0.7.6/arbitrary_send_eth.sol#L19-L21", + "id": "2e1bd6d1260cf35450734eb2027a2d964f61858a3aabd0cb459c22cb4da9956b", + "check": "arbitrary-send-eth", "impact": "High", "confidence": "Medium" } diff --git a/tests/detectors/too-many-digits/0.4.25/too_many_digits.sol b/tests/detectors/too-many-digits/0.4.25/too_many_digits.sol index cd35366a9..523be3490 100644 --- a/tests/detectors/too-many-digits/0.4.25/too_many_digits.sol +++ b/tests/detectors/too-many-digits/0.4.25/too_many_digits.sol @@ -37,4 +37,7 @@ contract C { uint x = 1 ether; } + function good2() external { + address x = 0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e; + } } diff --git a/tests/detectors/too-many-digits/0.4.25/too_many_digits.sol.0.4.25.TooManyDigits.json b/tests/detectors/too-many-digits/0.4.25/too_many_digits.sol.0.4.25.TooManyDigits.json index 1ece15736..00a01bfab 100644 --- a/tests/detectors/too-many-digits/0.4.25/too_many_digits.sol.0.4.25.TooManyDigits.json +++ b/tests/detectors/too-many-digits/0.4.25/too_many_digits.sol.0.4.25.TooManyDigits.json @@ -31,7 +31,7 @@ "name": "C", "source_mapping": { "start": 28, - "length": 897, + "length": 999, "filename_used": "/GENERIC_PATH", "filename_relative": "tests/detectors/too-many-digits/0.4.25/too_many_digits.sol", "filename_absolute": "/GENERIC_PATH", @@ -75,7 +75,10 @@ 37, 38, 39, - 40 + 40, + 41, + 42, + 43 ], "starting_column": 1, "ending_column": 2 @@ -131,7 +134,7 @@ "name": "C", "source_mapping": { "start": 28, - "length": 897, + "length": 999, "filename_used": "/GENERIC_PATH", "filename_relative": "tests/detectors/too-many-digits/0.4.25/too_many_digits.sol", "filename_absolute": "/GENERIC_PATH", @@ -175,7 +178,10 @@ 37, 38, 39, - 40 + 40, + 41, + 42, + 43 ], "starting_column": 1, "ending_column": 2 @@ -224,7 +230,7 @@ "name": "C", "source_mapping": { "start": 28, - "length": 897, + "length": 999, "filename_used": "/GENERIC_PATH", "filename_relative": "tests/detectors/too-many-digits/0.4.25/too_many_digits.sol", "filename_absolute": "/GENERIC_PATH", @@ -268,7 +274,10 @@ 37, 38, 39, - 40 + 40, + 41, + 42, + 43 ], "starting_column": 1, "ending_column": 2 @@ -322,7 +331,7 @@ "name": "C", "source_mapping": { "start": 28, - "length": 897, + "length": 999, "filename_used": "/GENERIC_PATH", "filename_relative": "tests/detectors/too-many-digits/0.4.25/too_many_digits.sol", "filename_absolute": "/GENERIC_PATH", @@ -366,7 +375,10 @@ 37, 38, 39, - 40 + 40, + 41, + 42, + 43 ], "starting_column": 1, "ending_column": 2 @@ -417,7 +429,7 @@ "name": "C", "source_mapping": { "start": 28, - "length": 897, + "length": 999, "filename_used": "/GENERIC_PATH", "filename_relative": "tests/detectors/too-many-digits/0.4.25/too_many_digits.sol", "filename_absolute": "/GENERIC_PATH", @@ -461,7 +473,10 @@ 37, 38, 39, - 40 + 40, + 41, + 42, + 43 ], "starting_column": 1, "ending_column": 2 @@ -517,7 +532,7 @@ "name": "C", "source_mapping": { "start": 28, - "length": 897, + "length": 999, "filename_used": "/GENERIC_PATH", "filename_relative": "tests/detectors/too-many-digits/0.4.25/too_many_digits.sol", "filename_absolute": "/GENERIC_PATH", @@ -561,7 +576,10 @@ 37, 38, 39, - 40 + 40, + 41, + 42, + 43 ], "starting_column": 1, "ending_column": 2 @@ -612,7 +630,7 @@ "name": "C", "source_mapping": { "start": 28, - "length": 897, + "length": 999, "filename_used": "/GENERIC_PATH", "filename_relative": "tests/detectors/too-many-digits/0.4.25/too_many_digits.sol", "filename_absolute": "/GENERIC_PATH", @@ -656,7 +674,10 @@ 37, 38, 39, - 40 + 40, + 41, + 42, + 43 ], "starting_column": 1, "ending_column": 2 @@ -712,7 +733,7 @@ "name": "C", "source_mapping": { "start": 28, - "length": 897, + "length": 999, "filename_used": "/GENERIC_PATH", "filename_relative": "tests/detectors/too-many-digits/0.4.25/too_many_digits.sol", "filename_absolute": "/GENERIC_PATH", @@ -756,7 +777,10 @@ 37, 38, 39, - 40 + 40, + 41, + 42, + 43 ], "starting_column": 1, "ending_column": 2 @@ -807,7 +831,7 @@ "name": "C", "source_mapping": { "start": 28, - "length": 897, + "length": 999, "filename_used": "/GENERIC_PATH", "filename_relative": "tests/detectors/too-many-digits/0.4.25/too_many_digits.sol", "filename_absolute": "/GENERIC_PATH", @@ -851,7 +875,10 @@ 37, 38, 39, - 40 + 40, + 41, + 42, + 43 ], "starting_column": 1, "ending_column": 2 @@ -907,7 +934,7 @@ "name": "C", "source_mapping": { "start": 28, - "length": 897, + "length": 999, "filename_used": "/GENERIC_PATH", "filename_relative": "tests/detectors/too-many-digits/0.4.25/too_many_digits.sol", "filename_absolute": "/GENERIC_PATH", @@ -951,7 +978,10 @@ 37, 38, 39, - 40 + 40, + 41, + 42, + 43 ], "starting_column": 1, "ending_column": 2 diff --git a/tests/detectors/too-many-digits/0.5.16/too_many_digits.sol b/tests/detectors/too-many-digits/0.5.16/too_many_digits.sol index cd35366a9..523be3490 100644 --- a/tests/detectors/too-many-digits/0.5.16/too_many_digits.sol +++ b/tests/detectors/too-many-digits/0.5.16/too_many_digits.sol @@ -37,4 +37,7 @@ contract C { uint x = 1 ether; } + function good2() external { + address x = 0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e; + } } diff --git a/tests/detectors/too-many-digits/0.5.16/too_many_digits.sol.0.5.16.TooManyDigits.json b/tests/detectors/too-many-digits/0.5.16/too_many_digits.sol.0.5.16.TooManyDigits.json index 012c9cb75..abd400cb4 100644 --- a/tests/detectors/too-many-digits/0.5.16/too_many_digits.sol.0.5.16.TooManyDigits.json +++ b/tests/detectors/too-many-digits/0.5.16/too_many_digits.sol.0.5.16.TooManyDigits.json @@ -31,7 +31,7 @@ "name": "C", "source_mapping": { "start": 28, - "length": 897, + "length": 999, "filename_used": "/GENERIC_PATH", "filename_relative": "tests/detectors/too-many-digits/0.5.16/too_many_digits.sol", "filename_absolute": "/GENERIC_PATH", @@ -75,7 +75,10 @@ 37, 38, 39, - 40 + 40, + 41, + 42, + 43 ], "starting_column": 1, "ending_column": 2 @@ -131,7 +134,7 @@ "name": "C", "source_mapping": { "start": 28, - "length": 897, + "length": 999, "filename_used": "/GENERIC_PATH", "filename_relative": "tests/detectors/too-many-digits/0.5.16/too_many_digits.sol", "filename_absolute": "/GENERIC_PATH", @@ -175,7 +178,10 @@ 37, 38, 39, - 40 + 40, + 41, + 42, + 43 ], "starting_column": 1, "ending_column": 2 @@ -224,7 +230,7 @@ "name": "C", "source_mapping": { "start": 28, - "length": 897, + "length": 999, "filename_used": "/GENERIC_PATH", "filename_relative": "tests/detectors/too-many-digits/0.5.16/too_many_digits.sol", "filename_absolute": "/GENERIC_PATH", @@ -268,7 +274,10 @@ 37, 38, 39, - 40 + 40, + 41, + 42, + 43 ], "starting_column": 1, "ending_column": 2 @@ -322,7 +331,7 @@ "name": "C", "source_mapping": { "start": 28, - "length": 897, + "length": 999, "filename_used": "/GENERIC_PATH", "filename_relative": "tests/detectors/too-many-digits/0.5.16/too_many_digits.sol", "filename_absolute": "/GENERIC_PATH", @@ -366,7 +375,10 @@ 37, 38, 39, - 40 + 40, + 41, + 42, + 43 ], "starting_column": 1, "ending_column": 2 @@ -417,7 +429,7 @@ "name": "C", "source_mapping": { "start": 28, - "length": 897, + "length": 999, "filename_used": "/GENERIC_PATH", "filename_relative": "tests/detectors/too-many-digits/0.5.16/too_many_digits.sol", "filename_absolute": "/GENERIC_PATH", @@ -461,7 +473,10 @@ 37, 38, 39, - 40 + 40, + 41, + 42, + 43 ], "starting_column": 1, "ending_column": 2 @@ -517,7 +532,7 @@ "name": "C", "source_mapping": { "start": 28, - "length": 897, + "length": 999, "filename_used": "/GENERIC_PATH", "filename_relative": "tests/detectors/too-many-digits/0.5.16/too_many_digits.sol", "filename_absolute": "/GENERIC_PATH", @@ -561,7 +576,10 @@ 37, 38, 39, - 40 + 40, + 41, + 42, + 43 ], "starting_column": 1, "ending_column": 2 @@ -612,7 +630,7 @@ "name": "C", "source_mapping": { "start": 28, - "length": 897, + "length": 999, "filename_used": "/GENERIC_PATH", "filename_relative": "tests/detectors/too-many-digits/0.5.16/too_many_digits.sol", "filename_absolute": "/GENERIC_PATH", @@ -656,7 +674,10 @@ 37, 38, 39, - 40 + 40, + 41, + 42, + 43 ], "starting_column": 1, "ending_column": 2 @@ -712,7 +733,7 @@ "name": "C", "source_mapping": { "start": 28, - "length": 897, + "length": 999, "filename_used": "/GENERIC_PATH", "filename_relative": "tests/detectors/too-many-digits/0.5.16/too_many_digits.sol", "filename_absolute": "/GENERIC_PATH", @@ -756,7 +777,10 @@ 37, 38, 39, - 40 + 40, + 41, + 42, + 43 ], "starting_column": 1, "ending_column": 2 @@ -807,7 +831,7 @@ "name": "C", "source_mapping": { "start": 28, - "length": 897, + "length": 999, "filename_used": "/GENERIC_PATH", "filename_relative": "tests/detectors/too-many-digits/0.5.16/too_many_digits.sol", "filename_absolute": "/GENERIC_PATH", @@ -851,7 +875,10 @@ 37, 38, 39, - 40 + 40, + 41, + 42, + 43 ], "starting_column": 1, "ending_column": 2 @@ -907,7 +934,7 @@ "name": "C", "source_mapping": { "start": 28, - "length": 897, + "length": 999, "filename_used": "/GENERIC_PATH", "filename_relative": "tests/detectors/too-many-digits/0.5.16/too_many_digits.sol", "filename_absolute": "/GENERIC_PATH", @@ -951,7 +978,10 @@ 37, 38, 39, - 40 + 40, + 41, + 42, + 43 ], "starting_column": 1, "ending_column": 2 diff --git a/tests/detectors/too-many-digits/0.6.11/too_many_digits.sol b/tests/detectors/too-many-digits/0.6.11/too_many_digits.sol index cd35366a9..315212c81 100644 --- a/tests/detectors/too-many-digits/0.6.11/too_many_digits.sol +++ b/tests/detectors/too-many-digits/0.6.11/too_many_digits.sol @@ -36,5 +36,9 @@ contract C { uint x = 1 ether; } + + function good2() external { + address x = 0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e; + } } diff --git a/tests/detectors/too-many-digits/0.6.11/too_many_digits.sol.0.6.11.TooManyDigits.json b/tests/detectors/too-many-digits/0.6.11/too_many_digits.sol.0.6.11.TooManyDigits.json index 4e96d8149..1a97ebd7b 100644 --- a/tests/detectors/too-many-digits/0.6.11/too_many_digits.sol.0.6.11.TooManyDigits.json +++ b/tests/detectors/too-many-digits/0.6.11/too_many_digits.sol.0.6.11.TooManyDigits.json @@ -31,7 +31,7 @@ "name": "C", "source_mapping": { "start": 28, - "length": 897, + "length": 1000, "filename_used": "/GENERIC_PATH", "filename_relative": "tests/detectors/too-many-digits/0.6.11/too_many_digits.sol", "filename_absolute": "/GENERIC_PATH", @@ -75,7 +75,11 @@ 37, 38, 39, - 40 + 40, + 41, + 42, + 43, + 44 ], "starting_column": 1, "ending_column": 2 @@ -131,7 +135,7 @@ "name": "C", "source_mapping": { "start": 28, - "length": 897, + "length": 1000, "filename_used": "/GENERIC_PATH", "filename_relative": "tests/detectors/too-many-digits/0.6.11/too_many_digits.sol", "filename_absolute": "/GENERIC_PATH", @@ -175,7 +179,11 @@ 37, 38, 39, - 40 + 40, + 41, + 42, + 43, + 44 ], "starting_column": 1, "ending_column": 2 @@ -224,7 +232,7 @@ "name": "C", "source_mapping": { "start": 28, - "length": 897, + "length": 1000, "filename_used": "/GENERIC_PATH", "filename_relative": "tests/detectors/too-many-digits/0.6.11/too_many_digits.sol", "filename_absolute": "/GENERIC_PATH", @@ -268,7 +276,11 @@ 37, 38, 39, - 40 + 40, + 41, + 42, + 43, + 44 ], "starting_column": 1, "ending_column": 2 @@ -322,7 +334,7 @@ "name": "C", "source_mapping": { "start": 28, - "length": 897, + "length": 1000, "filename_used": "/GENERIC_PATH", "filename_relative": "tests/detectors/too-many-digits/0.6.11/too_many_digits.sol", "filename_absolute": "/GENERIC_PATH", @@ -366,7 +378,11 @@ 37, 38, 39, - 40 + 40, + 41, + 42, + 43, + 44 ], "starting_column": 1, "ending_column": 2 @@ -417,7 +433,7 @@ "name": "C", "source_mapping": { "start": 28, - "length": 897, + "length": 1000, "filename_used": "/GENERIC_PATH", "filename_relative": "tests/detectors/too-many-digits/0.6.11/too_many_digits.sol", "filename_absolute": "/GENERIC_PATH", @@ -461,7 +477,11 @@ 37, 38, 39, - 40 + 40, + 41, + 42, + 43, + 44 ], "starting_column": 1, "ending_column": 2 @@ -517,7 +537,7 @@ "name": "C", "source_mapping": { "start": 28, - "length": 897, + "length": 1000, "filename_used": "/GENERIC_PATH", "filename_relative": "tests/detectors/too-many-digits/0.6.11/too_many_digits.sol", "filename_absolute": "/GENERIC_PATH", @@ -561,7 +581,11 @@ 37, 38, 39, - 40 + 40, + 41, + 42, + 43, + 44 ], "starting_column": 1, "ending_column": 2 @@ -612,7 +636,7 @@ "name": "C", "source_mapping": { "start": 28, - "length": 897, + "length": 1000, "filename_used": "/GENERIC_PATH", "filename_relative": "tests/detectors/too-many-digits/0.6.11/too_many_digits.sol", "filename_absolute": "/GENERIC_PATH", @@ -656,7 +680,11 @@ 37, 38, 39, - 40 + 40, + 41, + 42, + 43, + 44 ], "starting_column": 1, "ending_column": 2 @@ -712,7 +740,7 @@ "name": "C", "source_mapping": { "start": 28, - "length": 897, + "length": 1000, "filename_used": "/GENERIC_PATH", "filename_relative": "tests/detectors/too-many-digits/0.6.11/too_many_digits.sol", "filename_absolute": "/GENERIC_PATH", @@ -756,7 +784,11 @@ 37, 38, 39, - 40 + 40, + 41, + 42, + 43, + 44 ], "starting_column": 1, "ending_column": 2 @@ -807,7 +839,7 @@ "name": "C", "source_mapping": { "start": 28, - "length": 897, + "length": 1000, "filename_used": "/GENERIC_PATH", "filename_relative": "tests/detectors/too-many-digits/0.6.11/too_many_digits.sol", "filename_absolute": "/GENERIC_PATH", @@ -851,7 +883,11 @@ 37, 38, 39, - 40 + 40, + 41, + 42, + 43, + 44 ], "starting_column": 1, "ending_column": 2 @@ -907,7 +943,7 @@ "name": "C", "source_mapping": { "start": 28, - "length": 897, + "length": 1000, "filename_used": "/GENERIC_PATH", "filename_relative": "tests/detectors/too-many-digits/0.6.11/too_many_digits.sol", "filename_absolute": "/GENERIC_PATH", @@ -951,7 +987,11 @@ 37, 38, 39, - 40 + 40, + 41, + 42, + 43, + 44 ], "starting_column": 1, "ending_column": 2 diff --git a/tests/detectors/too-many-digits/0.7.6/too_many_digits.sol b/tests/detectors/too-many-digits/0.7.6/too_many_digits.sol index 48cbfdb55..dfd4979b7 100644 --- a/tests/detectors/too-many-digits/0.7.6/too_many_digits.sol +++ b/tests/detectors/too-many-digits/0.7.6/too_many_digits.sol @@ -1,4 +1,4 @@ -// pragma solidity ^0.5.1; + contract C { uint balance; @@ -36,4 +36,7 @@ contract C { uint x = 1 ether; } + function good2() external { + address x = 0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e; + } } diff --git a/tests/detectors/too-many-digits/0.7.6/too_many_digits.sol.0.7.6.TooManyDigits.json b/tests/detectors/too-many-digits/0.7.6/too_many_digits.sol.0.7.6.TooManyDigits.json index eb97dc505..372b28886 100644 --- a/tests/detectors/too-many-digits/0.7.6/too_many_digits.sol.0.7.6.TooManyDigits.json +++ b/tests/detectors/too-many-digits/0.7.6/too_many_digits.sol.0.7.6.TooManyDigits.json @@ -6,7 +6,7 @@ "type": "function", "name": "f", "source_mapping": { - "start": 177, + "start": 151, "length": 195, "filename_used": "/GENERIC_PATH", "filename_relative": "tests/detectors/too-many-digits/0.7.6/too_many_digits.sol", @@ -30,8 +30,8 @@ "type": "contract", "name": "C", "source_mapping": { - "start": 28, - "length": 815, + "start": 2, + "length": 917, "filename_used": "/GENERIC_PATH", "filename_relative": "tests/detectors/too-many-digits/0.7.6/too_many_digits.sol", "filename_absolute": "/GENERIC_PATH", @@ -74,7 +74,10 @@ 36, 37, 38, - 39 + 39, + 40, + 41, + 42 ], "starting_column": 1, "ending_column": 2 @@ -87,7 +90,7 @@ "type": "node", "name": "x2 = 0x0000000000001", "source_mapping": { - "start": 237, + "start": 211, "length": 25, "filename_used": "/GENERIC_PATH", "filename_relative": "tests/detectors/too-many-digits/0.7.6/too_many_digits.sol", @@ -105,7 +108,7 @@ "type": "function", "name": "f", "source_mapping": { - "start": 177, + "start": 151, "length": 195, "filename_used": "/GENERIC_PATH", "filename_relative": "tests/detectors/too-many-digits/0.7.6/too_many_digits.sol", @@ -129,8 +132,8 @@ "type": "contract", "name": "C", "source_mapping": { - "start": 28, - "length": 815, + "start": 2, + "length": 917, "filename_used": "/GENERIC_PATH", "filename_relative": "tests/detectors/too-many-digits/0.7.6/too_many_digits.sol", "filename_absolute": "/GENERIC_PATH", @@ -173,7 +176,10 @@ 36, 37, 38, - 39 + 39, + 40, + 41, + 42 ], "starting_column": 1, "ending_column": 2 @@ -199,7 +205,7 @@ "type": "function", "name": "f", "source_mapping": { - "start": 177, + "start": 151, "length": 195, "filename_used": "/GENERIC_PATH", "filename_relative": "tests/detectors/too-many-digits/0.7.6/too_many_digits.sol", @@ -223,8 +229,8 @@ "type": "contract", "name": "C", "source_mapping": { - "start": 28, - "length": 815, + "start": 2, + "length": 917, "filename_used": "/GENERIC_PATH", "filename_relative": "tests/detectors/too-many-digits/0.7.6/too_many_digits.sol", "filename_absolute": "/GENERIC_PATH", @@ -267,7 +273,10 @@ 36, 37, 38, - 39 + 39, + 40, + 41, + 42 ], "starting_column": 1, "ending_column": 2 @@ -280,7 +289,7 @@ "type": "node", "name": "x3 = 1000000000000000000", "source_mapping": { - "start": 272, + "start": 246, "length": 29, "filename_used": "/GENERIC_PATH", "filename_relative": "tests/detectors/too-many-digits/0.7.6/too_many_digits.sol", @@ -298,7 +307,7 @@ "type": "function", "name": "f", "source_mapping": { - "start": 177, + "start": 151, "length": 195, "filename_used": "/GENERIC_PATH", "filename_relative": "tests/detectors/too-many-digits/0.7.6/too_many_digits.sol", @@ -322,8 +331,8 @@ "type": "contract", "name": "C", "source_mapping": { - "start": 28, - "length": 815, + "start": 2, + "length": 917, "filename_used": "/GENERIC_PATH", "filename_relative": "tests/detectors/too-many-digits/0.7.6/too_many_digits.sol", "filename_absolute": "/GENERIC_PATH", @@ -366,7 +375,10 @@ 36, 37, 38, - 39 + 39, + 40, + 41, + 42 ], "starting_column": 1, "ending_column": 2 @@ -392,7 +404,7 @@ "type": "function", "name": "f", "source_mapping": { - "start": 177, + "start": 151, "length": 195, "filename_used": "/GENERIC_PATH", "filename_relative": "tests/detectors/too-many-digits/0.7.6/too_many_digits.sol", @@ -416,8 +428,8 @@ "type": "contract", "name": "C", "source_mapping": { - "start": 28, - "length": 815, + "start": 2, + "length": 917, "filename_used": "/GENERIC_PATH", "filename_relative": "tests/detectors/too-many-digits/0.7.6/too_many_digits.sol", "filename_absolute": "/GENERIC_PATH", @@ -460,7 +472,10 @@ 36, 37, 38, - 39 + 39, + 40, + 41, + 42 ], "starting_column": 1, "ending_column": 2 @@ -473,7 +488,7 @@ "type": "node", "name": "x1 = 0x000001", "source_mapping": { - "start": 209, + "start": 183, "length": 18, "filename_used": "/GENERIC_PATH", "filename_relative": "tests/detectors/too-many-digits/0.7.6/too_many_digits.sol", @@ -491,7 +506,7 @@ "type": "function", "name": "f", "source_mapping": { - "start": 177, + "start": 151, "length": 195, "filename_used": "/GENERIC_PATH", "filename_relative": "tests/detectors/too-many-digits/0.7.6/too_many_digits.sol", @@ -515,8 +530,8 @@ "type": "contract", "name": "C", "source_mapping": { - "start": 28, - "length": 815, + "start": 2, + "length": 917, "filename_used": "/GENERIC_PATH", "filename_relative": "tests/detectors/too-many-digits/0.7.6/too_many_digits.sol", "filename_absolute": "/GENERIC_PATH", @@ -559,7 +574,10 @@ 36, 37, 38, - 39 + 39, + 40, + 41, + 42 ], "starting_column": 1, "ending_column": 2 @@ -585,7 +603,7 @@ "type": "function", "name": "f", "source_mapping": { - "start": 177, + "start": 151, "length": 195, "filename_used": "/GENERIC_PATH", "filename_relative": "tests/detectors/too-many-digits/0.7.6/too_many_digits.sol", @@ -609,8 +627,8 @@ "type": "contract", "name": "C", "source_mapping": { - "start": 28, - "length": 815, + "start": 2, + "length": 917, "filename_used": "/GENERIC_PATH", "filename_relative": "tests/detectors/too-many-digits/0.7.6/too_many_digits.sol", "filename_absolute": "/GENERIC_PATH", @@ -653,7 +671,10 @@ 36, 37, 38, - 39 + 39, + 40, + 41, + 42 ], "starting_column": 1, "ending_column": 2 @@ -666,7 +687,7 @@ "type": "node", "name": "x4 = 100000", "source_mapping": { - "start": 311, + "start": 285, "length": 16, "filename_used": "/GENERIC_PATH", "filename_relative": "tests/detectors/too-many-digits/0.7.6/too_many_digits.sol", @@ -684,7 +705,7 @@ "type": "function", "name": "f", "source_mapping": { - "start": 177, + "start": 151, "length": 195, "filename_used": "/GENERIC_PATH", "filename_relative": "tests/detectors/too-many-digits/0.7.6/too_many_digits.sol", @@ -708,8 +729,8 @@ "type": "contract", "name": "C", "source_mapping": { - "start": 28, - "length": 815, + "start": 2, + "length": 917, "filename_used": "/GENERIC_PATH", "filename_relative": "tests/detectors/too-many-digits/0.7.6/too_many_digits.sol", "filename_absolute": "/GENERIC_PATH", @@ -752,7 +773,10 @@ 36, 37, 38, - 39 + 39, + 40, + 41, + 42 ], "starting_column": 1, "ending_column": 2 @@ -778,7 +802,7 @@ "type": "function", "name": "h", "source_mapping": { - "start": 456, + "start": 430, "length": 113, "filename_used": "/GENERIC_PATH", "filename_relative": "tests/detectors/too-many-digits/0.7.6/too_many_digits.sol", @@ -800,8 +824,8 @@ "type": "contract", "name": "C", "source_mapping": { - "start": 28, - "length": 815, + "start": 2, + "length": 917, "filename_used": "/GENERIC_PATH", "filename_relative": "tests/detectors/too-many-digits/0.7.6/too_many_digits.sol", "filename_absolute": "/GENERIC_PATH", @@ -844,7 +868,10 @@ 36, 37, 38, - 39 + 39, + 40, + 41, + 42 ], "starting_column": 1, "ending_column": 2 @@ -857,7 +884,7 @@ "type": "node", "name": "x2 = 100000", "source_mapping": { - "start": 512, + "start": 486, "length": 16, "filename_used": "/GENERIC_PATH", "filename_relative": "tests/detectors/too-many-digits/0.7.6/too_many_digits.sol", @@ -875,7 +902,7 @@ "type": "function", "name": "h", "source_mapping": { - "start": 456, + "start": 430, "length": 113, "filename_used": "/GENERIC_PATH", "filename_relative": "tests/detectors/too-many-digits/0.7.6/too_many_digits.sol", @@ -897,8 +924,8 @@ "type": "contract", "name": "C", "source_mapping": { - "start": 28, - "length": 815, + "start": 2, + "length": 917, "filename_used": "/GENERIC_PATH", "filename_relative": "tests/detectors/too-many-digits/0.7.6/too_many_digits.sol", "filename_absolute": "/GENERIC_PATH", @@ -941,7 +968,10 @@ 36, 37, 38, - 39 + 39, + 40, + 41, + 42 ], "starting_column": 1, "ending_column": 2 diff --git a/tests/detectors/uninitialized-state/0.4.25/uninitialized.sol b/tests/detectors/uninitialized-state/0.4.25/uninitialized.sol index 26b4c9110..de0e9a7f7 100644 --- a/tests/detectors/uninitialized-state/0.4.25/uninitialized.sol +++ b/tests/detectors/uninitialized-state/0.4.25/uninitialized.sol @@ -43,16 +43,16 @@ contract Test2 { using Lib for Lib.MyStruct; Lib.MyStruct st; - Lib.MyStruct stInitiliazed; + Lib.MyStruct stinitialized; uint v; // v is used as parameter of the lib, but is never init function init(){ - stInitiliazed.set(v); + stinitialized.set(v); } function use(){ // random operation to use the structure - require(st.val == stInitiliazed.val); + require(st.val == stinitialized.val); } } diff --git a/tests/detectors/uninitialized-state/0.5.16/uninitialized.sol b/tests/detectors/uninitialized-state/0.5.16/uninitialized.sol index 7b5fbb5d9..209b28591 100644 --- a/tests/detectors/uninitialized-state/0.5.16/uninitialized.sol +++ b/tests/detectors/uninitialized-state/0.5.16/uninitialized.sol @@ -43,16 +43,16 @@ contract Test2 { using Lib for Lib.MyStruct; Lib.MyStruct st; - Lib.MyStruct stInitiliazed; + Lib.MyStruct stinitialized; uint v; // v is used as parameter of the lib, but is never init function init() public{ - stInitiliazed.set(v); + stinitialized.set(v); } function use() view public{ // random operation to use the structure - require(st.val == stInitiliazed.val); + require(st.val == stinitialized.val); } } diff --git a/tests/detectors/uninitialized-state/0.6.11/uninitialized.sol b/tests/detectors/uninitialized-state/0.6.11/uninitialized.sol index 7b5fbb5d9..209b28591 100644 --- a/tests/detectors/uninitialized-state/0.6.11/uninitialized.sol +++ b/tests/detectors/uninitialized-state/0.6.11/uninitialized.sol @@ -43,16 +43,16 @@ contract Test2 { using Lib for Lib.MyStruct; Lib.MyStruct st; - Lib.MyStruct stInitiliazed; + Lib.MyStruct stinitialized; uint v; // v is used as parameter of the lib, but is never init function init() public{ - stInitiliazed.set(v); + stinitialized.set(v); } function use() view public{ // random operation to use the structure - require(st.val == stInitiliazed.val); + require(st.val == stinitialized.val); } } diff --git a/tests/detectors/uninitialized-state/0.7.6/uninitialized.sol b/tests/detectors/uninitialized-state/0.7.6/uninitialized.sol index 7b5fbb5d9..209b28591 100644 --- a/tests/detectors/uninitialized-state/0.7.6/uninitialized.sol +++ b/tests/detectors/uninitialized-state/0.7.6/uninitialized.sol @@ -43,16 +43,16 @@ contract Test2 { using Lib for Lib.MyStruct; Lib.MyStruct st; - Lib.MyStruct stInitiliazed; + Lib.MyStruct stinitialized; uint v; // v is used as parameter of the lib, but is never init function init() public{ - stInitiliazed.set(v); + stinitialized.set(v); } function use() view public{ // random operation to use the structure - require(st.val == stInitiliazed.val); + require(st.val == stinitialized.val); } } diff --git a/tests/detectors/unprotected-upgrade/0.4.25/Buggy.sol.0.4.25.UnprotectedUpgradeable.json b/tests/detectors/unprotected-upgrade/0.4.25/Buggy.sol.0.4.25.UnprotectedUpgradeable.json index 28fd9cd3c..f5b7d583b 100644 --- a/tests/detectors/unprotected-upgrade/0.4.25/Buggy.sol.0.4.25.UnprotectedUpgradeable.json +++ b/tests/detectors/unprotected-upgrade/0.4.25/Buggy.sol.0.4.25.UnprotectedUpgradeable.json @@ -141,8 +141,8 @@ } } ], - "description": "Buggy (tests/detectors/unprotected-upgrade/0.4.25/Buggy.sol#3-15) is an upgradeable contract that does not protect its initiliaze functions: Buggy.initialize() (tests/detectors/unprotected-upgrade/0.4.25/Buggy.sol#6-9). Anyone can delete the contract with: Buggy.kill() (tests/detectors/unprotected-upgrade/0.4.25/Buggy.sol#10-13)", - "markdown": "[Buggy](tests/detectors/unprotected-upgrade/0.4.25/Buggy.sol#L3-L15) is an upgradeable contract that does not protect its initiliaze functions: [Buggy.initialize()](tests/detectors/unprotected-upgrade/0.4.25/Buggy.sol#L6-L9). Anyone can delete the contract with: [Buggy.kill()](tests/detectors/unprotected-upgrade/0.4.25/Buggy.sol#L10-L13)", + "description": "Buggy (tests/detectors/unprotected-upgrade/0.4.25/Buggy.sol#3-15) is an upgradeable contract that does not protect its initialize functions: Buggy.initialize() (tests/detectors/unprotected-upgrade/0.4.25/Buggy.sol#6-9). Anyone can delete the contract with: Buggy.kill() (tests/detectors/unprotected-upgrade/0.4.25/Buggy.sol#10-13)", + "markdown": "[Buggy](tests/detectors/unprotected-upgrade/0.4.25/Buggy.sol#L3-L15) is an upgradeable contract that does not protect its initialize functions: [Buggy.initialize()](tests/detectors/unprotected-upgrade/0.4.25/Buggy.sol#L6-L9). Anyone can delete the contract with: [Buggy.kill()](tests/detectors/unprotected-upgrade/0.4.25/Buggy.sol#L10-L13)", "first_markdown_element": "tests/detectors/unprotected-upgrade/0.4.25/Buggy.sol#L3-L15", "id": "aceca400ce0b482809a70df612af22e24d154c5c89c24d630ec0ee5a366d09fe", "check": "unprotected-upgrade", diff --git a/tests/detectors/unprotected-upgrade/0.5.16/Buggy.sol.0.5.16.UnprotectedUpgradeable.json b/tests/detectors/unprotected-upgrade/0.5.16/Buggy.sol.0.5.16.UnprotectedUpgradeable.json index d5452021e..4f5015bf5 100644 --- a/tests/detectors/unprotected-upgrade/0.5.16/Buggy.sol.0.5.16.UnprotectedUpgradeable.json +++ b/tests/detectors/unprotected-upgrade/0.5.16/Buggy.sol.0.5.16.UnprotectedUpgradeable.json @@ -141,8 +141,8 @@ } } ], - "description": "Buggy (tests/detectors/unprotected-upgrade/0.5.16/Buggy.sol#3-15) is an upgradeable contract that does not protect its initiliaze functions: Buggy.initialize() (tests/detectors/unprotected-upgrade/0.5.16/Buggy.sol#6-9). Anyone can delete the contract with: Buggy.kill() (tests/detectors/unprotected-upgrade/0.5.16/Buggy.sol#10-13)", - "markdown": "[Buggy](tests/detectors/unprotected-upgrade/0.5.16/Buggy.sol#L3-L15) is an upgradeable contract that does not protect its initiliaze functions: [Buggy.initialize()](tests/detectors/unprotected-upgrade/0.5.16/Buggy.sol#L6-L9). Anyone can delete the contract with: [Buggy.kill()](tests/detectors/unprotected-upgrade/0.5.16/Buggy.sol#L10-L13)", + "description": "Buggy (tests/detectors/unprotected-upgrade/0.5.16/Buggy.sol#3-15) is an upgradeable contract that does not protect its initialize functions: Buggy.initialize() (tests/detectors/unprotected-upgrade/0.5.16/Buggy.sol#6-9). Anyone can delete the contract with: Buggy.kill() (tests/detectors/unprotected-upgrade/0.5.16/Buggy.sol#10-13)", + "markdown": "[Buggy](tests/detectors/unprotected-upgrade/0.5.16/Buggy.sol#L3-L15) is an upgradeable contract that does not protect its initialize functions: [Buggy.initialize()](tests/detectors/unprotected-upgrade/0.5.16/Buggy.sol#L6-L9). Anyone can delete the contract with: [Buggy.kill()](tests/detectors/unprotected-upgrade/0.5.16/Buggy.sol#L10-L13)", "first_markdown_element": "tests/detectors/unprotected-upgrade/0.5.16/Buggy.sol#L3-L15", "id": "aceca400ce0b482809a70df612af22e24d154c5c89c24d630ec0ee5a366d09fe", "check": "unprotected-upgrade", diff --git a/tests/detectors/unprotected-upgrade/0.6.11/Buggy.sol.0.6.11.UnprotectedUpgradeable.json b/tests/detectors/unprotected-upgrade/0.6.11/Buggy.sol.0.6.11.UnprotectedUpgradeable.json index b0fe359e4..57aa43c6c 100644 --- a/tests/detectors/unprotected-upgrade/0.6.11/Buggy.sol.0.6.11.UnprotectedUpgradeable.json +++ b/tests/detectors/unprotected-upgrade/0.6.11/Buggy.sol.0.6.11.UnprotectedUpgradeable.json @@ -141,8 +141,8 @@ } } ], - "description": "Buggy (tests/detectors/unprotected-upgrade/0.6.11/Buggy.sol#3-15) is an upgradeable contract that does not protect its initiliaze functions: Buggy.initialize() (tests/detectors/unprotected-upgrade/0.6.11/Buggy.sol#6-9). Anyone can delete the contract with: Buggy.kill() (tests/detectors/unprotected-upgrade/0.6.11/Buggy.sol#10-13)", - "markdown": "[Buggy](tests/detectors/unprotected-upgrade/0.6.11/Buggy.sol#L3-L15) is an upgradeable contract that does not protect its initiliaze functions: [Buggy.initialize()](tests/detectors/unprotected-upgrade/0.6.11/Buggy.sol#L6-L9). Anyone can delete the contract with: [Buggy.kill()](tests/detectors/unprotected-upgrade/0.6.11/Buggy.sol#L10-L13)", + "description": "Buggy (tests/detectors/unprotected-upgrade/0.6.11/Buggy.sol#3-15) is an upgradeable contract that does not protect its initialize functions: Buggy.initialize() (tests/detectors/unprotected-upgrade/0.6.11/Buggy.sol#6-9). Anyone can delete the contract with: Buggy.kill() (tests/detectors/unprotected-upgrade/0.6.11/Buggy.sol#10-13)", + "markdown": "[Buggy](tests/detectors/unprotected-upgrade/0.6.11/Buggy.sol#L3-L15) is an upgradeable contract that does not protect its initialize functions: [Buggy.initialize()](tests/detectors/unprotected-upgrade/0.6.11/Buggy.sol#L6-L9). Anyone can delete the contract with: [Buggy.kill()](tests/detectors/unprotected-upgrade/0.6.11/Buggy.sol#L10-L13)", "first_markdown_element": "tests/detectors/unprotected-upgrade/0.6.11/Buggy.sol#L3-L15", "id": "aceca400ce0b482809a70df612af22e24d154c5c89c24d630ec0ee5a366d09fe", "check": "unprotected-upgrade", diff --git a/tests/detectors/unprotected-upgrade/0.7.6/Buggy.sol.0.7.6.UnprotectedUpgradeable.json b/tests/detectors/unprotected-upgrade/0.7.6/Buggy.sol.0.7.6.UnprotectedUpgradeable.json index 10f2a2b28..e2f23109e 100644 --- a/tests/detectors/unprotected-upgrade/0.7.6/Buggy.sol.0.7.6.UnprotectedUpgradeable.json +++ b/tests/detectors/unprotected-upgrade/0.7.6/Buggy.sol.0.7.6.UnprotectedUpgradeable.json @@ -141,8 +141,8 @@ } } ], - "description": "Buggy (tests/detectors/unprotected-upgrade/0.7.6/Buggy.sol#3-15) is an upgradeable contract that does not protect its initiliaze functions: Buggy.initialize() (tests/detectors/unprotected-upgrade/0.7.6/Buggy.sol#6-9). Anyone can delete the contract with: Buggy.kill() (tests/detectors/unprotected-upgrade/0.7.6/Buggy.sol#10-13)", - "markdown": "[Buggy](tests/detectors/unprotected-upgrade/0.7.6/Buggy.sol#L3-L15) is an upgradeable contract that does not protect its initiliaze functions: [Buggy.initialize()](tests/detectors/unprotected-upgrade/0.7.6/Buggy.sol#L6-L9). Anyone can delete the contract with: [Buggy.kill()](tests/detectors/unprotected-upgrade/0.7.6/Buggy.sol#L10-L13)", + "description": "Buggy (tests/detectors/unprotected-upgrade/0.7.6/Buggy.sol#3-15) is an upgradeable contract that does not protect its initialize functions: Buggy.initialize() (tests/detectors/unprotected-upgrade/0.7.6/Buggy.sol#6-9). Anyone can delete the contract with: Buggy.kill() (tests/detectors/unprotected-upgrade/0.7.6/Buggy.sol#10-13)", + "markdown": "[Buggy](tests/detectors/unprotected-upgrade/0.7.6/Buggy.sol#L3-L15) is an upgradeable contract that does not protect its initialize functions: [Buggy.initialize()](tests/detectors/unprotected-upgrade/0.7.6/Buggy.sol#L6-L9). Anyone can delete the contract with: [Buggy.kill()](tests/detectors/unprotected-upgrade/0.7.6/Buggy.sol#L10-L13)", "first_markdown_element": "tests/detectors/unprotected-upgrade/0.7.6/Buggy.sol#L3-L15", "id": "aceca400ce0b482809a70df612af22e24d154c5c89c24d630ec0ee5a366d09fe", "check": "unprotected-upgrade", diff --git a/tests/test_ast_parsing.py b/tests/test_ast_parsing.py index eafe6a2f3..ed83e2b20 100644 --- a/tests/test_ast_parsing.py +++ b/tests/test_ast_parsing.py @@ -60,7 +60,7 @@ VERSIONS_04 = make_version(4, 0, 26) VERSIONS_05 = make_version(5, 0, 17) VERSIONS_06 = make_version(6, 0, 12) VERSIONS_07 = make_version(7, 0, 6) -VERSIONS_08 = make_version(8, 0, 12) +VERSIONS_08 = make_version(8, 0, 15) ALL_VERSIONS = VERSIONS_04 + VERSIONS_05 + VERSIONS_06 + VERSIONS_07 + VERSIONS_08 @@ -310,6 +310,10 @@ ALL_TESTS = [ "minmax-0.6.8.sol", make_version(6, 8, 9) + VERSIONS_07 + VERSIONS_08, ), + Test( + "minmax-0.8.8.sol", + make_version(8, 8, 15), + ), Test("dowhile-0.4.0.sol", VERSIONS_04), Test( "dowhile-0.4.5.sol", @@ -404,6 +408,9 @@ ALL_TESTS = [ # 0.8.9 crashes on our testcase Test("user_defined_types.sol", ["0.8.8"] + make_version(8, 10, 12)), Test("bytes_call.sol", ["0.8.12"]), + Test("free_functions/libraries_from_free.sol", ["0.8.12"]), + Test("free_functions/new_operator.sol", ["0.8.12"]), + Test("free_functions/library_constant_function_collision.sol", ["0.8.12"]), ] # create the output folder if needed try: diff --git a/tests/test_detectors.py b/tests/test_detectors.py index 30999389c..c01594f5f 100644 --- a/tests/test_detectors.py +++ b/tests/test_detectors.py @@ -396,23 +396,23 @@ ALL_TEST_OBJECTS = [ Test(all_detectors.LockedEther, "locked_ether.sol", "0.6.11"), Test(all_detectors.LockedEther, "locked_ether.sol", "0.7.6"), Test( - all_detectors.ArbitrarySend, - "arbitrary_send.sol", + all_detectors.ArbitrarySendEth, + "arbitrary_send_eth.sol", "0.4.25", ), Test( - all_detectors.ArbitrarySend, - "arbitrary_send.sol", + all_detectors.ArbitrarySendEth, + "arbitrary_send_eth.sol", "0.5.16", ), Test( - all_detectors.ArbitrarySend, - "arbitrary_send.sol", + all_detectors.ArbitrarySendEth, + "arbitrary_send_eth.sol", "0.6.11", ), Test( - all_detectors.ArbitrarySend, - "arbitrary_send.sol", + all_detectors.ArbitrarySendEth, + "arbitrary_send_eth.sol", "0.7.6", ), Test( @@ -1272,6 +1272,61 @@ ALL_TEST_OBJECTS = [ "comment.sol", "0.8.2", ), + Test( + all_detectors.ArbitrarySendErc20NoPermit, + "arbitrary_send_erc20.sol", + "0.4.25", + ), + Test( + all_detectors.ArbitrarySendErc20NoPermit, + "arbitrary_send_erc20.sol", + "0.5.16", + ), + Test( + all_detectors.ArbitrarySendErc20NoPermit, + "arbitrary_send_erc20.sol", + "0.6.11", + ), + Test( + all_detectors.ArbitrarySendErc20NoPermit, + "arbitrary_send_erc20.sol", + "0.7.6", + ), + Test( + all_detectors.ArbitrarySendErc20NoPermit, + "arbitrary_send_erc20.sol", + "0.8.0", + ), + Test( + all_detectors.ArbitrarySendErc20NoPermit, + "arbitrary_send_erc20_inheritance.sol", + "0.8.0", + ), + Test( + all_detectors.ArbitrarySendErc20Permit, + "arbitrary_send_erc20_permit.sol", + "0.4.25", + ), + Test( + all_detectors.ArbitrarySendErc20Permit, + "arbitrary_send_erc20_permit.sol", + "0.5.16", + ), + Test( + all_detectors.ArbitrarySendErc20Permit, + "arbitrary_send_erc20_permit.sol", + "0.6.11", + ), + Test( + all_detectors.ArbitrarySendErc20Permit, + "arbitrary_send_erc20_permit.sol", + "0.7.6", + ), + Test( + all_detectors.ArbitrarySendErc20Permit, + "arbitrary_send_erc20_permit.sol", + "0.8.0", + ), ] diff --git a/tests/test_ssa_generation.py b/tests/test_ssa_generation.py index 69bac2802..f002ec4e1 100644 --- a/tests/test_ssa_generation.py +++ b/tests/test_ssa_generation.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines import os import pathlib from argparse import ArgumentTypeError @@ -25,10 +26,15 @@ from slither.slithir.operations import ( Binary, BinaryType, InternalCall, + Index, ) from slither.slithir.utils.ssa import is_used_later -from slither.slithir.variables import Constant, ReferenceVariable, LocalIRVariable, StateIRVariable - +from slither.slithir.variables import ( + Constant, + ReferenceVariable, + LocalIRVariable, + StateIRVariable, +) # Directory of currently executing script. Will be used as basis for temporary file names. SCRIPT_DIR = pathlib.Path(getsourcefile(lambda: 0)).parent @@ -782,6 +788,127 @@ def test_multiple_named_args_returns(): ) +@pytest.mark.xfail(reason="Tests for wanted state of SSA IR, not current.") +def test_memory_array(): + src = """ + contract MemArray { + struct A { + uint val1; + uint val2; + } + + function test_array() internal { + A[] memory a= new A[](4); + // Create REF_0 -> a_1[2] + accept_array_entry(a[2]); + + // Create REF_1 -> a_1[3] + accept_array_entry(a[3]); + + A memory alocal; + accept_array_entry(alocal); + + } + + // val_1 = ϕ(val_0, REF_0, REF_1, alocal_1) + // val_0 is an unknown external value + function accept_array_entry(A memory val) public returns (uint) { + uint zero = 0; + b(zero); + // Create REF_2 -> val_1.val1 + return b(val.val1); + } + + function b(uint arg) public returns (uint){ + // arg_1 = ϕ(arg_0, zero_1, REF_2) + return arg + 1; + } + }""" + with slither_from_source(src) as slither: + c = slither.contracts[0] + + ftest_array, faccept, fb = c.functions + + # Locate REF_0/REF_1/alocal (they are all args to the call) + accept_args = [x.arguments[0] for x in get_ssa_of_type(ftest_array, InternalCall)] + + # Check entrypoint of accept_array_entry, it should contain a phi-node + # of expected rvalues + [phi_entry_accept] = get_ssa_of_type(faccept.entry_point, Phi) + for arg in accept_args: + assert arg in phi_entry_accept.rvalues + # NOTE(hbrodin): There should be an additional val_0 in the phi-node. + # That additional val_0 indicates an external caller of this function. + assert len(phi_entry_accept.rvalues) == len(accept_args) + 1 + + # Args used to invoke b + b_args = [x.arguments[0] for x in get_ssa_of_type(faccept, InternalCall)] + + # Check entrypoint of B, it should contain a phi-node of expected + # rvalues + [phi_entry_b] = get_ssa_of_type(fb.entry_point, Phi) + for arg in b_args: + assert arg in phi_entry_b.rvalues + + # NOTE(hbrodin): There should be an additional arg_0 (see comment about phi_entry_accept). + assert len(phi_entry_b.rvalues) == len(b_args) + 1 + + +@pytest.mark.xfail(reason="Tests for wanted state of SSA IR, not current.") +def test_storage_array(): + src = """ + contract StorageArray { + struct A { + uint val1; + uint val2; + } + + // NOTE(hbrodin): a is never written, should only become a_0. Same for astorage (astorage_0). Phi-nodes at entry + // should only add new versions of a state variable if it is actually written. + A[] a; + A astorage; + + function test_array() internal { + accept_array_entry(a[2]); + accept_array_entry(a[3]); + accept_array_entry(astorage); + } + + function accept_array_entry(A storage val) internal returns (uint) { + // val is either a[2], a[3] or astorage_0. Ideally this could be identified. + uint five = 5; + + // NOTE(hbrodin): If the following line is enabled, there would ideally be a phi-node representing writes + // to either a or astorage. + //val.val2 = 4; + b(five); + return b(val.val1); + } + + function b(uint value) public returns (uint){ + // Expect a phi-node at the entrypoint + // value_1 = ϕ(value_0, five_0, REF_x), where REF_x is the reference to val.val1 in accept_array_entry. + return value + 1; + } + }""" + with slither_from_source(src) as slither: + c = slither.contracts[0] + _dump_functions(c) + ftest, faccept, fb = c.functions + + # None of a/astorage is written so expect that there are no phi-nodes at entrypoint. + assert len(get_ssa_of_type(ftest.entry_point, Phi)) == 0 + + # Expect all references to start from index 0 (no writes) + assert all(x.variable_left.index == 0 for x in get_ssa_of_type(ftest, Index)) + + [phi_entry_accept] = get_ssa_of_type(faccept.entry_point, Phi) + assert len(phi_entry_accept.rvalues) == 3 # See comment in b above + + [phi_entry_b] = get_ssa_of_type(fb.entry_point, Phi) + assert len(phi_entry_b.rvalues) == 3 # See comment in b above + + @pytest.mark.skip(reason="Fails in current slither version. Fix in #1102.") def test_issue_468(): """