diff --git a/.github/workflows/IR.yml b/.github/workflows/IR.yml index 7b5d214a9..434cef75b 100644 --- a/.github/workflows/IR.yml +++ b/.github/workflows/IR.yml @@ -26,20 +26,14 @@ jobs: - name: Checkout Code uses: actions/checkout@v2 - - 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: | - python setup.py install - pip install deepdiff - pip install pytest==7.0.1 - pip install typing_extensions==4.1.1 - pip install importlib_metadata==4.8.3 - - pip install "solc-select>=v1.0.0b1" + pip install ".[dev]" solc-select install all solc-select use 0.8.11 diff --git a/.github/workflows/black.yml b/.github/workflows/black.yml index c1a999b80..b805c4d9d 100644 --- a/.github/workflows/black.yml +++ b/.github/workflows/black.yml @@ -22,16 +22,13 @@ jobs: - name: Checkout Code uses: actions/checkout@v2 - - 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: | - pip install . - pip install deepdiff numpy - mkdir -p .github/linters cp pyproject.toml .github/linters diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1252e385a..cc58ab718 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: @@ -28,7 +27,7 @@ jobs: "data_dependency", # "embark", "erc", - "etherlime", + # "etherlime", # "etherscan" "find_paths", "flat", @@ -44,32 +43,17 @@ jobs: - os: windows-2022 type: dapp # Requires nvm - - os: windows-2022 - type: etherlime - # Requires nvm - os: windows-2022 type: truffle 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: | - - python setup.py install - # Used by ci_test.sh - pip install deepdiff - - pip install "solc-select>=v1.0.0b1" + pip install ".[dev]" solc-select install all solc-select use 0.5.1 pip install typing_extensions==4.1.1 @@ -87,6 +71,7 @@ jobs: - name: Run Tests env: + PYTHONUTF8: 1 TEST_TYPE: ${{ matrix.type }} GITHUB_ETHERSCAN: ${{ secrets.GITHUB_ETHERSCAN }} run: | diff --git a/.github/workflows/detectors.yml b/.github/workflows/detectors.yml index 4d8109297..8f3b45d15 100644 --- a/.github/workflows/detectors.yml +++ b/.github/workflows/detectors.yml @@ -26,21 +26,15 @@ jobs: - name: Checkout Code uses: actions/checkout@v2 - - 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: | + pip install ".[dev]" - python setup.py install - pip install deepdiff - pip install pytest==7.0.1 - pip install typing_extensions==4.1.1 - pip install importlib_metadata==4.8.3 - - pip install "solc-select>=v1.0.0b1" solc-select install all solc-select use 0.7.3 - name: Test with pytest diff --git a/.github/workflows/features.yml b/.github/workflows/features.yml index a8548c866..8757d654a 100644 --- a/.github/workflows/features.yml +++ b/.github/workflows/features.yml @@ -26,21 +26,15 @@ jobs: - name: Checkout Code uses: actions/checkout@v2 - - 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: | + pip install ".[dev]" - python setup.py install - pip install deepdiff - pip install pytest==7.0.1 - pip install typing_extensions==4.1.1 - pip install importlib_metadata==4.8.3 - - pip install "solc-select>=v1.0.0b1" solc-select install all solc-select use 0.8.0 @@ -52,3 +46,4 @@ jobs: run: | pytest tests/test_features.py pytest tests/test_constant_folding_unary.py + pytest tests/slithir/test_ternary_expressions.py diff --git a/.github/workflows/linter.yml b/.github/workflows/linter.yml index c1b31a1c4..5d9ff9017 100644 --- a/.github/workflows/linter.yml +++ b/.github/workflows/linter.yml @@ -22,16 +22,13 @@ jobs: - name: Checkout Code uses: actions/checkout@v2 - - 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: | - pip install . - pip install deepdiff numpy - mkdir -p .github/linters cp pyproject.toml .github/linters diff --git a/.github/workflows/parser.yml b/.github/workflows/parser.yml index 4c3566904..5e11420cf 100644 --- a/.github/workflows/parser.yml +++ b/.github/workflows/parser.yml @@ -26,20 +26,14 @@ jobs: - name: Checkout Code uses: actions/checkout@v2 - - 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: | - - python setup.py install - pip install deepdiff - pip install pytest==7.0.1 - pip install typing_extensions==4.1.1 - pip install importlib_metadata==4.8.3 - pip install "solc-select>=v1.0.0b1" + pip install ".[dev]" - name: Install solc 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/.github/workflows/pylint.yml b/.github/workflows/pylint.yml index 692a981ab..04334a2d5 100644 --- a/.github/workflows/pylint.yml +++ b/.github/workflows/pylint.yml @@ -22,16 +22,13 @@ jobs: - name: Checkout Code uses: actions/checkout@v2 - - 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: | - pip install . - pip install deepdiff numpy - mkdir -p .github/linters cp pyproject.toml .github/linters diff --git a/.github/workflows/read_storage.yml b/.github/workflows/read_storage.yml new file mode 100644 index 000000000..8a423d6c2 --- /dev/null +++ b/.github/workflows/read_storage.yml @@ -0,0 +1,50 @@ +--- +name: Test slither-read-storage + +defaults: + run: + # To load bashrc + shell: bash -ieo pipefail {0} + +on: + pull_request: + branches: [master, dev] + schedule: + # run CI every day even if no PRs/merges occur + - cron: '0 12 * * *' + +jobs: + build: + name: Test slither-read-storage + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + - name: Setup node + uses: actions/setup-node@v2 + with: + node-version: '14' + + - name: Install ganache + run: npm install --global ganache + + - name: Set up Python 3.8 + uses: actions/setup-python@v2 + with: + python-version: 3.8 + + - name: Install python dependencies + run: | + pip install ".[dev]" + pip install web3 + solc-select install 0.8.1 + solc-select install 0.8.10 + solc-select use 0.8.1 + + - name: Run slither-read-storage + run: | + pytest tests/test_read_storage.py + + - name: Run storage layout tests + run: | + pytest tests/test_storage_layout.py diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index e93b2557c..798dcc96b 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -20,13 +20,28 @@ Some pull request guidelines: - Fill out the pull request description with a summary of what your patch does, key changes that have been made, and any further points of discussion, if applicable. - Title your pull request with a brief description of what it's changing. "Fixes #123" is a good comment to add to the description, but makes for an unclear title on its own. +## Directory Structure + +Below is a rough outline of slither's design: +```text +. +├── analyses # Provides additional info such as data dependency +├── core # Ties everything together +├── detectors # Rules that define and identify issues +├── slither.py # Main entry point +├── slithir # Contains the semantics of slither's intermediate representation +├── solc_parsing # Responsible for parsing the solc AST +├── tools # Miscellaneous tools built on top of slither +├── visitors # Parses expressions and converts to slithir +└── ... +``` + +A code walkthrough is available [here](https://www.youtube.com/watch?v=EUl3UlYSluU). + ## Development Environment Instructions for installing a development version of Slither can be found in our [wiki](https://github.com/crytic/slither/wiki/Developer-installation). -To run the unit tests, you need -- `deepdiff` installed (`pip install deepdiff`). -- `pycov` installed (`pip install pytest-cov`). -- [`solc-select`](https://github.com/crytic/solc-select) installed. +To run the unit tests, you need to clone this repository and run `pip install ".[dev]"`. ### Linters @@ -46,6 +61,7 @@ For each new detector, at least one regression tests must be present. - Create a test in `tests` - Update `ALL_TEST` in `tests/test_detectors.py` - Run `python ./tests/test_detectors.py --generate`. This will generate the json artifacts in `tests/expected_json`. Add the generated files to git. + - If updating an existing detector, identify the respective json artifacts and then delete them, or run `python ./tests/test_detectors.py --overwrite` instead. - Run `pytest ./tests/test_detectors.py` and check that everything worked. To see the tests coverage, run `pytest tests/test_detectors.py --cov=slither/detectors --cov-branch --cov-report html` 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..588ae6ee8 100644 --- a/README.md +++ b/README.md @@ -13,6 +13,7 @@ Slither is a Solidity static analysis framework written in Python 3. It runs a s - [Tools](#tools) - [How to Install](#how-to-install) - [Getting Help](#getting-help) +- [FAQ](#faq) - [Publications](#publications) ## Features @@ -40,9 +41,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 +55,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,10 +125,12 @@ 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 +77 | `arbitrary-send-erc20` | [Detect when `msg.sender` is not used as `from` in transferFrom](https://github.com/trailofbits/slither/wiki/Detector-Documentation#arbitrary-send-erc20) +78 | `arbitrary-send-erc20-permit` | [Detect when `msg.sender` is not used as `from` in transferFrom in conjuction with permit](https://github.com/trailofbits/slither/wiki/Detector-Documentation#arbitrary-send-erc20-permit) For more information, see - The [Detector Documentation](https://github.com/crytic/slither/wiki/Detector-Documentation) for details on each detector @@ -143,6 +149,7 @@ For more information, see - `cfg`: [Export the CFG of each functions](https://github.com/trailofbits/slither/wiki/Printer-documentation#cfg) - `function-summary`: [Print a summary of the functions](https://github.com/trailofbits/slither/wiki/Printer-documentation#function-summary) - `vars-and-auth`: [Print the state variables written and the authorization of the functions](https://github.com/crytic/slither/wiki/Printer-documentation#variables-written-and-authorization) +- `when-not-paused`: [Print functions that do not use `whenNotPaused` modifier](https://github.com/trailofbits/slither/wiki/Printer-documentation#when-not-paused). To run a printer, use `--print` and a comma-separated list of printers. @@ -155,6 +162,7 @@ See the [Printer documentation](https://github.com/crytic/slither/wiki/Printer-d - `slither-flat`: [Flatten a codebase](https://github.com/crytic/slither/wiki/Contract-Flattening) - `slither-check-erc`: [Check the ERC's conformance](https://github.com/crytic/slither/wiki/ERC-Conformance) - `slither-format`: [Automatic patch generation](https://github.com/crytic/slither/wiki/Slither-format) +- `slither-read-storage`: [Read storage values from contracts](./slither/tools/read_storage/README.md) See the [Tool documentation](https://github.com/crytic/slither/wiki/Tool-Documentation) for additional tools. @@ -162,7 +170,7 @@ See the [Tool documentation](https://github.com/crytic/slither/wiki/Tool-Documen ## How to install -Slither requires Python 3.6+ and [solc](https://github.com/ethereum/solidity/), the Solidity compiler. +Slither requires Python 3.8+ and [solc](https://github.com/ethereum/solidity/), the Solidity compiler. ### Using Pip @@ -181,7 +189,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 @@ -205,11 +213,23 @@ Feel free to stop by our [Slack channel](https://empireslacking.herokuapp.com) ( * The [SlithIR documentation](https://github.com/trailofbits/slither/wiki/SlithIR) describes the SlithIR intermediate representation. +## FAQ + +How do I exclude mocks or tests? +- View our documentation on [path filtering](https://github.com/crytic/slither/wiki/Usage#path-filtering). + +How do I fix "unknown file" or compilation issues? +- Because slither requires the solc AST, it must have all dependencies available. +If a contract has dependencies, `slither contract.sol` will fail. +Instead, use `slither .` in the parent directory of `contracts/` (you should see `contracts/` when you run `ls`). +If you have a `node_modules/` folder, it must be in the same directory as `contracts/`. To verify that this issue is related to slither, +run the compilation command for the framework you are using e.g `npx hardhat compile`. That must work successfully; +otherwise, slither's compilation engine, crytic-compile, cannot generate the AST. + ## License Slither is licensed and distributed under the AGPLv3 license. [Contact us](mailto:opensource@trailofbits.com) if you're looking for an exception to the terms. - ## Publications ### Trail of Bits publication @@ -225,5 +245,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/examples/scripts/taint_mapping.py b/examples/scripts/taint_mapping.py index feb843b20..75ed3d8df 100644 --- a/examples/scripts/taint_mapping.py +++ b/examples/scripts/taint_mapping.py @@ -10,6 +10,9 @@ from slither.slithir.variables.temporary import TemporaryVariable def visit_node(node, visited): + if node is None: + return + if node in visited: return diff --git a/plugin_example/setup.py b/plugin_example/setup.py index 9cef2aaf9..1bc065394 100644 --- a/plugin_example/setup.py +++ b/plugin_example/setup.py @@ -7,7 +7,7 @@ setup( author="Trail of Bits", version="0.0", packages=find_packages(), - python_requires=">=3.6", + python_requires=">=3.8", install_requires=["slither-analyzer==0.1"], entry_points={ "slither_analyzer.plugin": "slither my-plugin=slither_my_plugin:make_plugin", 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..7ef511759 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.8 install pybind11 +pip3.8 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 52084528e..993862f03 100644 --- a/setup.py +++ b/setup.py @@ -8,15 +8,26 @@ 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", + python_requires=">=3.8", install_requires=[ "prettytable>=0.7.2", "pysha3>=1.0.2", - # "crytic-compile>=0.2.2", + # "crytic-compile>=0.2.3", "crytic-compile", ], + extras_require={ + "dev": [ + "black==22.3.0", + "pylint==2.13.4", + "pytest", + "pytest-cov", + "deepdiff", + "numpy", + "solc-select>=v1.0.0b1", + ] + }, dependency_links=["git+https://github.com/crytic/crytic-compile.git@master#egg=crytic-compile"], license="AGPL-3.0", long_description=long_description, @@ -32,6 +43,7 @@ setup( "slither-check-kspec = slither.tools.kspec_coverage.__main__:main", "slither-prop = slither.tools.properties.__main__:main", "slither-mutate = slither.tools.mutator.__main__:main", + "slither-read-storage = slither.tools.read_storage.__main__:main", ] }, ) 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/compilation_unit.py b/slither/core/compilation_unit.py index d8582b31a..a2568a5de 100644 --- a/slither/core/compilation_unit.py +++ b/slither/core/compilation_unit.py @@ -251,7 +251,7 @@ class SlitherCompilationUnit(Context): slot = 0 offset = 0 for var in contract.state_variables_ordered: - if var.is_constant: + if var.is_constant or var.is_immutable: continue size, new_slot = var.type.storage_size diff --git a/slither/core/declarations/contract.py b/slither/core/declarations/contract.py index 2db1cd964..333d906fa 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 @@ -78,6 +80,7 @@ class Contract(SourceMapping): # pylint: disable=too-many-public-methods self._using_for: Dict[Union[str, Type], List[Type]] = {} self._kind: Optional[str] = None self._is_interface: bool = False + self._is_library: bool = False self._signatures: Optional[List[str]] = None self._signatures_declared: Optional[List[str]] = None @@ -144,6 +147,14 @@ class Contract(SourceMapping): # pylint: disable=too-many-public-methods def is_interface(self, is_interface: bool): self._is_interface = is_interface + @property + def is_library(self) -> bool: + return self._is_library + + @is_library.setter + def is_library(self, is_library: bool): + self._is_library = is_library + # endregion ################################################################################### ################################################################################### @@ -903,6 +914,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 +1010,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/function.py b/slither/core/declarations/function.py index 8983769cc..8ec5a00ae 100644 --- a/slither/core/declarations/function.py +++ b/slither/core/declarations/function.py @@ -538,7 +538,7 @@ class Function(SourceMapping, metaclass=ABCMeta): # pylint: disable=too-many-pu self._nodes = nodes @property - def entry_point(self) -> "Node": + def entry_point(self) -> Optional["Node"]: """ Node: Entry point of the function """ 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/array_type.py b/slither/core/solidity_types/array_type.py index 2f5a675f9..15b53eb03 100644 --- a/slither/core/solidity_types/array_type.py +++ b/slither/core/solidity_types/array_type.py @@ -39,9 +39,17 @@ class ArrayType(Type): return self._length @property - def lenght_value(self) -> Optional[Literal]: + def length_value(self) -> Optional[Literal]: return self._length_value + @property + def is_fixed_array(self) -> bool: + return bool(self.length) + + @property + def is_dynamic_array(self) -> bool: + return not self.is_fixed_array + @property def storage_size(self) -> Tuple[int, bool]: if self._length_value: diff --git a/slither/core/solidity_types/elementary_type.py b/slither/core/solidity_types/elementary_type.py index 4d5d21896..bff6b924e 100644 --- a/slither/core/solidity_types/elementary_type.py +++ b/slither/core/solidity_types/elementary_type.py @@ -127,10 +127,10 @@ Max_Byte = {k: 2 ** (8 * (i + 1)) - 1 for i, k in enumerate(Byte[2:])} Max_Byte["bytes"] = None Max_Byte["string"] = None Max_Byte["byte"] = 255 -Min_Byte = {k: 1 << (4 + 8 * i) for i, k in enumerate(Byte[2:])} +Min_Byte = {k: 0 for k in Byte} Min_Byte["bytes"] = 0x0 -Min_Byte["string"] = None -Min_Byte["byte"] = 0x10 +Min_Byte["string"] = 0x0 +Min_Byte["byte"] = 0x0 MaxValues = dict(dict(Max_Int, **Max_Uint), **Max_Byte) MinValues = dict(dict(Min_Int, **Min_Uint), **Min_Byte) @@ -193,7 +193,7 @@ class ElementaryType(Type): if t == "address": return int(160) if t.startswith("bytes") and t != "bytes": - return int(t[len("bytes") :]) + return int(t[len("bytes") :]) * 8 return None @property 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/calls_in_loop.py b/slither/detectors/statements/calls_in_loop.py index 7ea83f8fd..fdd0c6732 100644 --- a/slither/detectors/statements/calls_in_loop.py +++ b/slither/detectors/statements/calls_in_loop.py @@ -1,4 +1,4 @@ -from typing import List +from typing import List, Optional from slither.core.cfg.node import NodeType, Node from slither.detectors.abstract_detector import AbstractDetector, DetectorClassification from slither.core.declarations import Contract @@ -22,7 +22,11 @@ def detect_call_in_loop(contract: Contract) -> List[Node]: return ret -def call_in_loop(node: Node, in_loop_counter: int, visited: List[Node], ret: List[Node]) -> None: +def call_in_loop( + node: Optional[Node], in_loop_counter: int, visited: List[Node], ret: List[Node] +) -> None: + if node is None: + return if node in visited: return # shared visited diff --git a/slither/detectors/statements/costly_operations_in_loop.py b/slither/detectors/statements/costly_operations_in_loop.py index d10cfaaf0..930085cc6 100644 --- a/slither/detectors/statements/costly_operations_in_loop.py +++ b/slither/detectors/statements/costly_operations_in_loop.py @@ -1,4 +1,4 @@ -from typing import List +from typing import List, Optional from slither.core.cfg.node import NodeType, Node from slither.detectors.abstract_detector import AbstractDetector, DetectorClassification from slither.core.declarations import Contract @@ -17,8 +17,12 @@ def detect_costly_operations_in_loop(contract: Contract) -> List[Node]: def costly_operations_in_loop( - node: Node, in_loop_counter: int, visited: List[Node], ret: List[Node] + node: Optional[Node], in_loop_counter: int, visited: List[Node], ret: List[Node] ) -> None: + + if node is None: + return + if node in visited: return # shared visited diff --git a/slither/detectors/statements/delegatecall_in_loop.py b/slither/detectors/statements/delegatecall_in_loop.py index 58de0359b..b7bf70cbc 100644 --- a/slither/detectors/statements/delegatecall_in_loop.py +++ b/slither/detectors/statements/delegatecall_in_loop.py @@ -1,4 +1,4 @@ -from typing import List +from typing import List, Optional from slither.core.cfg.node import NodeType, Node from slither.detectors.abstract_detector import AbstractDetector, DetectorClassification from slither.slithir.operations import LowLevelCall, InternalCall @@ -15,8 +15,12 @@ def detect_delegatecall_in_loop(contract: Contract) -> List[Node]: def delegatecall_in_loop( - node: Node, in_loop_counter: int, visited: List[Node], results: List[Node] + node: Optional[Node], in_loop_counter: int, visited: List[Node], results: List[Node] ) -> None: + + if node is None: + return + if node in visited: return # shared visited diff --git a/slither/detectors/statements/msg_value_in_loop.py b/slither/detectors/statements/msg_value_in_loop.py index 5bd5c398c..bfd541201 100644 --- a/slither/detectors/statements/msg_value_in_loop.py +++ b/slither/detectors/statements/msg_value_in_loop.py @@ -1,4 +1,4 @@ -from typing import List +from typing import List, Optional from slither.core.cfg.node import NodeType, Node from slither.detectors.abstract_detector import AbstractDetector, DetectorClassification from slither.slithir.operations import InternalCall @@ -15,8 +15,12 @@ def detect_msg_value_in_loop(contract: Contract) -> List[Node]: def msg_value_in_loop( - node: Node, in_loop_counter: int, visited: List[Node], results: List[Node] + node: Optional[Node], in_loop_counter: int, visited: List[Node], results: List[Node] ) -> None: + + if node is None: + return + if node in visited: return # shared visited 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/detectors/variables/uninitialized_local_variables.py b/slither/detectors/variables/uninitialized_local_variables.py index 45c86c22d..7f7cb76e0 100644 --- a/slither/detectors/variables/uninitialized_local_variables.py +++ b/slither/detectors/variables/uninitialized_local_variables.py @@ -88,7 +88,11 @@ Bob calls `transfer`. As a result, all Ether is sent to the address `0x0` and is for contract in self.compilation_unit.contracts: for function in contract.functions: - if function.is_implemented and function.contract_declarer == contract: + if ( + function.is_implemented + and function.contract_declarer == contract + and function.entry_point + ): if function.contains_assembly: continue # dont consider storage variable, as they are detected by another detector diff --git a/slither/detectors/variables/uninitialized_storage_variables.py b/slither/detectors/variables/uninitialized_storage_variables.py index a84462f38..a0c35d80d 100644 --- a/slither/detectors/variables/uninitialized_storage_variables.py +++ b/slither/detectors/variables/uninitialized_storage_variables.py @@ -96,7 +96,7 @@ Bob calls `func`. As a result, `owner` is overridden to `0`. for contract in self.compilation_unit.contracts: for function in contract.functions: - if function.is_implemented: + if function.is_implemented and function.entry_point: uninitialized_storage_variables = [ v for v in function.local_variables if v.is_storage and v.uninitialized ] 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..eeddceb27 100644 --- a/slither/slithir/convert.py +++ b/slither/slithir/convert.py @@ -33,6 +33,7 @@ from slither.core.solidity_types.elementary_type import ( MaxValues, ) from slither.core.solidity_types.type import Type +from slither.core.solidity_types.type_alias import TypeAlias from slither.core.variables.function_type_variable import FunctionTypeVariable from slither.core.variables.state_variable import StateVariable from slither.core.variables.variable import Variable @@ -399,6 +400,13 @@ def propagate_type_and_convert_call(result, node): ins = new_ins result[idx] = ins + # If there's two consecutive type conversions, keep only the last + # ARG_CALL x call_data = [x] + # TMP_4 = CONVERT x to Fix call_data = [] + # TMP_5 = CONVERT TMP_4 to uint192 call_data = [TMP_5] + if isinstance(ins, TypeConversion) and ins.variable in call_data: + call_data.remove(ins.variable) + if isinstance(ins, Argument): # In case of dupplicate arguments we overwrite the value # This can happen because of addr.call.value(1).value(2) @@ -531,7 +539,9 @@ def propagate_types(ir, node: "Node"): # pylint: disable=too-many-locals return convert_type_of_high_and_internal_level_call(ir, contract) # Convert HighLevelCall to LowLevelCall - if isinstance(t, ElementaryType) and t.name == "address": + if (isinstance(t, ElementaryType) and t.name == "address") or ( + isinstance(t, TypeAlias) and t.underlying_type.name == "address" + ): # Cannot be a top level function with this. assert isinstance(node_function, FunctionContract) if ir.destination.name == "this": @@ -817,12 +827,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 +1395,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: @@ -1657,7 +1687,10 @@ def convert_constant_types(irs): if isinstance(ir.rvalue, TupleVariable): # TODO: fix missing Unpack conversion continue - if ir.rvalue.type.type not in ElementaryTypeInt: + if isinstance(ir.rvalue.type, TypeAlias): + ir.rvalue.set_type(ElementaryType(ir.lvalue.type.name)) + was_changed = True + elif ir.rvalue.type.type not in ElementaryTypeInt: ir.rvalue.set_type(ElementaryType(ir.lvalue.type.type)) was_changed = True if isinstance(ir, Binary): @@ -1676,6 +1709,7 @@ def convert_constant_types(irs): # TODO: add POP instruction break types = [p.type for p in func.parameters] + assert len(types) == len(ir.arguments) for idx, arg in enumerate(ir.arguments): t = types[idx] if isinstance(t, ElementaryType): diff --git a/slither/solc_parsing/declarations/contract.py b/slither/solc_parsing/declarations/contract.py index efc53f2aa..b7f938d1d 100644 --- a/slither/solc_parsing/declarations/contract.py +++ b/slither/solc_parsing/declarations/contract.py @@ -157,7 +157,10 @@ class ContractSolc(CallerContextExpression): if "contractKind" in attributes: if attributes["contractKind"] == "interface": self._contract.is_interface = True - self._contract.kind = attributes["contractKind"] + elif attributes["contractKind"] == "library": + self._contract.is_library = True + self._contract.contract_kind = attributes["contractKind"] + self._linearized_base_contracts = attributes["linearizedBaseContracts"] # self._contract.fullyImplemented = attributes["fullyImplemented"] diff --git a/slither/solc_parsing/expressions/expression_parsing.py b/slither/solc_parsing/expressions/expression_parsing.py index 759d3d6a2..fe26a0ea6 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] + ")" @@ -455,7 +455,6 @@ def parse_expression(expression: Dict, caller_context: CallerContextExpression) referenced_declaration = expression["referencedDeclaration"] else: referenced_declaration = None - var, was_created = find_variable(value, caller_context, referenced_declaration) if was_created: var.set_offset(src, caller_context.compilation_unit) diff --git a/slither/solc_parsing/slither_compilation_unit_solc.py b/slither/solc_parsing/slither_compilation_unit_solc.py index b7a9d4467..3054b4470 100644 --- a/slither/solc_parsing/slither_compilation_unit_solc.py +++ b/slither/solc_parsing/slither_compilation_unit_solc.py @@ -401,7 +401,7 @@ Please rename it, this name is reserved for Slither's internals""" father_constructors = [] # try: # Resolve linearized base contracts. - missing_inheritance = False + missing_inheritance = None for i in contract_parser.linearized_base_contracts[1:]: if i in contract_parser.remapping: @@ -418,7 +418,7 @@ Please rename it, this name is reserved for Slither's internals""" elif i in self._contracts_by_id: ancestors.append(self._contracts_by_id[i]) else: - missing_inheritance = True + missing_inheritance = i # Resolve immediate base contracts for i in contract_parser.baseContracts: @@ -432,7 +432,7 @@ Please rename it, this name is reserved for Slither's internals""" elif i in self._contracts_by_id: fathers.append(self._contracts_by_id[i]) else: - missing_inheritance = True + missing_inheritance = i # Resolve immediate base constructor calls for i in contract_parser.baseConstructorContractsCalled: @@ -446,7 +446,7 @@ Please rename it, this name is reserved for Slither's internals""" elif i in self._contracts_by_id: father_constructors.append(self._contracts_by_id[i]) else: - missing_inheritance = True + missing_inheritance = i contract_parser.underlying_contract.set_inheritance( ancestors, fathers, father_constructors @@ -456,7 +456,14 @@ Please rename it, this name is reserved for Slither's internals""" self._compilation_unit.contracts_with_missing_inheritance.add( contract_parser.underlying_contract ) - contract_parser.log_incorrect_parsing(f"Missing inheritance {contract_parser}") + txt = f"Missing inheritance {contract_parser.underlying_contract} ({contract_parser.compilation_unit.crytic_compile_compilation_unit.unique_id})\n" + txt += f"Missing inheritance ID: {missing_inheritance}\n" + if contract_parser.underlying_contract.inheritance: + txt += "Inheritance found:\n" + for contract_inherited in contract_parser.underlying_contract.inheritance: + txt += f"\t - {contract_inherited} (ID {contract_inherited.id})\n" + contract_parser.log_incorrect_parsing(txt) + contract_parser.set_is_analyzed(True) contract_parser.delete_content() @@ -679,12 +686,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..5891962d1 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 @@ -272,8 +272,12 @@ def parse_type( all_structuress = [c.structures for c in scope.contracts.values()] all_structures = [item for sublist in all_structuress for item in sublist] all_structures += structures_direct_access + enums_direct_access = [] - all_enums = scope.enums.values() + all_enumss = [c.enums for c in scope.contracts.values()] + all_enums = [item for sublist in all_enumss for item in sublist] + all_enums += scope.enums.values() + contracts = scope.contracts.values() functions = list(scope.functions) diff --git a/slither/solc_parsing/yul/parse_yul.py b/slither/solc_parsing/yul/parse_yul.py index 0c7b48091..31c74795d 100644 --- a/slither/solc_parsing/yul/parse_yul.py +++ b/slither/solc_parsing/yul/parse_yul.py @@ -737,7 +737,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: @@ -745,7 +745,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/flattening/__main__.py b/slither/tools/flattening/__main__.py index e0888f222..977b84896 100644 --- a/slither/tools/flattening/__main__.py +++ b/slither/tools/flattening/__main__.py @@ -79,6 +79,12 @@ def parse_args(): action="store_true", ) + group_patching.add_argument( + "--convert-library-to-internal", + help="Convert external or public functions to internal in library.", + action="store_true", + ) + group_patching.add_argument( "--remove-assert", help="Remove call to assert().", action="store_true" ) @@ -111,6 +117,7 @@ def main(): compilation_unit, external_to_public=args.convert_external, remove_assert=args.remove_assert, + convert_library_to_internal=args.convert_library_to_internal, private_to_internal=args.convert_private, export_path=args.dir, pragma_solidity=args.pragma_solidity, diff --git a/slither/tools/flattening/flattening.py b/slither/tools/flattening/flattening.py index f067bde6d..010103ca7 100644 --- a/slither/tools/flattening/flattening.py +++ b/slither/tools/flattening/flattening.py @@ -51,6 +51,7 @@ class Flattening: compilation_unit: SlitherCompilationUnit, external_to_public=False, remove_assert=False, + convert_library_to_internal=False, private_to_internal=False, export_path: Optional[str] = None, pragma_solidity: Optional[str] = None, @@ -61,6 +62,7 @@ class Flattening: self._external_to_public = external_to_public self._remove_assert = remove_assert self._use_abi_encoder_v2 = False + self._convert_library_to_internal = convert_library_to_internal self._private_to_internal = private_to_internal self._pragma_solidity = pragma_solidity @@ -111,7 +113,7 @@ class Flattening: to_patch = [] # interface must use external - if self._external_to_public and contract.contract_kind != "interface": + if self._external_to_public and not contract.is_interface: for f in contract.functions_declared: # fallback must be external if f.is_fallback or f.is_constructor_variables: @@ -146,6 +148,36 @@ class Flattening: ) ) + if self._convert_library_to_internal and contract.is_library: + for f in contract.functions_declared: + visibility = "" + if f.visibility in ["external", "public"]: + visibility = f.visibility + attributes_start = ( + f.parameters_src().source_mapping["start"] + + f.parameters_src().source_mapping["length"] + ) + attributes_end = f.returns_src().source_mapping["start"] + attributes = content[attributes_start:attributes_end] + regex = ( + re.search(r"((\sexternal)\s+)|(\sexternal)$|(\)external)$", attributes) + if visibility == "external" + else re.search(r"((\spublic)\s+)|(\spublic)$|(\)public)$", attributes) + ) + if regex: + to_patch.append( + Patch( + attributes_start + regex.span()[0] + 1, + "external_to_internal" + if visibility == "external" + else "public_to_internal", + ) + ) + else: + raise SlitherException( + f"{visibility} keyword not found {f.name} {attributes}" + ) + if self._private_to_internal: for variable in contract.state_variables_declared: if variable.visibility == "private": @@ -186,6 +218,10 @@ class Flattening: index = index - start if patch_type == "public_to_external": content = content[:index] + "public" + content[index + len("external") :] + elif patch_type == "external_to_internal": + content = content[:index] + "internal" + content[index + len("external") :] + elif patch_type == "public_to_internal": + content = content[:index] + "internal" + content[index + len("public") :] elif patch_type == "private_to_internal": content = content[:index] + "internal" + content[index + len("private") :] elif patch_type == "calldata_to_memory": 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 new file mode 100644 index 000000000..91491a364 --- /dev/null +++ b/slither/tools/read_storage/README.md @@ -0,0 +1,91 @@ +# Slither-read-storage + +Slither-read-storage is a tool to retrieve the storage slots and values of entire contracts or single variables. + +## Usage + +### CLI Interface + +```shell +positional arguments: + contract_source (DIR) ADDRESS The deployed contract address if verified on etherscan. Prepend project directory for unverified contracts. + +optional arguments: + --variable-name VARIABLE_NAME The name of the variable whose value will be returned. + --rpc-url RPC_URL An endpoint for web3 requests. + --key KEY The key/ index whose value will be returned from a mapping or array. + --deep-key DEEP_KEY The key/ index whose value will be returned from a deep mapping or multidimensional array. + --struct-var STRUCT_VAR The name of the variable whose value will be returned from a struct. + --storage-address STORAGE_ADDRESS The address of the storage contract (if a proxy pattern is used). + --contract-name CONTRACT_NAME The name of the logic contract. + --layout Toggle used to write a JSON file with the entire storage layout. + --value Toggle used to include values in output. + --max-depth MAX_DEPTH Max depth to search in data structure. +``` + +### Examples + +Retrieve the storage slots of a local contract: + +```shell +slither-read-storage file.sol 0x8ad599c3a0ff1de082011efddc58f1908eb6e6d8 --layout +``` + +Retrieve the storage slots of a contract verified on an Etherscan-like platform: + +```shell +slither-read-storage 0x8ad599c3a0ff1de082011efddc58f1908eb6e6d8 --layout +``` + +To retrieve the values as well, pass `--value` and `--rpc-url $RPC_URL`: + +```shell +slither-read-storage 0x8ad599c3a0ff1de082011efddc58f1908eb6e6d8 --layout --rpc-url $RPC_URL --value +``` + +To view only the slot of the `slot0` structure variable, pass `--variable-name slot0`: + +```shell +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 $RPC_URL --value --struct-var tick +``` + +Retrieve the ERC20 balance slot of an account: + +```shell +slither-read-storage 0xa2327a938Febf5FEC13baCFb16Ae10EcBc4cbDCF --variable-name balances --key 0xab5801a7d398351b8be11c439e05c5b3259aec9b +``` + +To retrieve the actual balance, pass `--variable-name balances` and `--key 0xab5801a7d398351b8be11c439e05c5b3259aec9b`. (`balances` is a `mapping(address => uint)`) +Since this contract uses the delegatecall-proxy pattern, the proxy address must be passed as the `--storage-address`. Otherwise, it is not required. + +```shell +slither-read-storage 0xa2327a938Febf5FEC13baCFb16Ae10EcBc4cbDCF --variable-name balances --key 0xab5801a7d398351b8be11c439e05c5b3259aec9b --storage-address 0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48 --rpc-url $RPC_URL --value +``` + +## Troubleshooting/FAQ + +- If the storage slots or values of a contract verified Etherscan are wrong, try passing `--contract $CONTRACT_NAME` explicitly. Otherwise, the storage may be retrieved from storage slots based off an unrelated contract (Etherscan includes these). (Also, make sure that the RPC is for the correct network.) + +- If Etherscan fails to return a source code, try passing `--etherscan-apikey $API_KEY` to avoid hitting a rate-limit. + +- How do I use this tool on other chains? + If an EVM chain has an Etherscan-like platform the crytic-compile supports, this tool supports it by making the following modifications. + Take Avalanche, for instance: + + ```shell + slither-read-storage avax:0x0000000000000000000000000000000000000000 --layout --value --rpc-url $AVAX_RPC_URL + ``` + +## Limitations + +- Requires source code. +- Only works on Solidity contracts. +- Cannot find variables with unstructured storage. +- Does not support all data types (please open an issue or PR). +- Mappings cannot be completely enumerated since all keys used historically are not immediately available. diff --git a/slither/tools/read_storage/__init__.py b/slither/tools/read_storage/__init__.py new file mode 100644 index 000000000..dbc1e5bc0 --- /dev/null +++ b/slither/tools/read_storage/__init__.py @@ -0,0 +1 @@ +from .read_storage import SlitherReadStorage diff --git a/slither/tools/read_storage/__main__.py b/slither/tools/read_storage/__main__.py new file mode 100644 index 000000000..6bf5788db --- /dev/null +++ b/slither/tools/read_storage/__main__.py @@ -0,0 +1,145 @@ +""" +Tool to read on-chain storage from EVM +""" +import json +import argparse + +from crytic_compile import cryticparser + +from slither import Slither +from slither.tools.read_storage.read_storage import SlitherReadStorage + + +def parse_args() -> argparse.Namespace: + """Parse the underlying arguments for the program. + Returns: + The arguments for the program. + """ + parser = argparse.ArgumentParser( + description="Read a variable's value from storage for a deployed contract", + usage=( + "\nTo retrieve a single variable's value:\n" + + "\tslither-read-storage $TARGET address --variable-name $NAME\n" + + "To retrieve a contract's storage layout:\n" + + "\tslither-read-storage $TARGET address --contract-name $NAME --layout\n" + + "To retrieve a contract's storage layout and values:\n" + + "\tslither-read-storage $TARGET address --contract-name $NAME --layout --values\n" + + "TARGET can be a contract address or project directory" + ), + ) + + parser.add_argument( + "contract_source", + help="The deployed contract address if verified on etherscan. Prepend project directory for unverified contracts.", + nargs="+", + ) + + parser.add_argument( + "--variable-name", + help="The name of the variable whose value will be returned.", + default=None, + ) + + parser.add_argument("--rpc-url", help="An endpoint for web3 requests.") + + parser.add_argument( + "--key", + help="The key/ index whose value will be returned from a mapping or array.", + default=None, + ) + + parser.add_argument( + "--deep-key", + help="The key/ index whose value will be returned from a deep mapping or multidimensional array.", + default=None, + ) + + parser.add_argument( + "--struct-var", + help="The name of the variable whose value will be returned from a struct.", + default=None, + ) + + parser.add_argument( + "--storage-address", + help="The address of the storage contract (if a proxy pattern is used).", + default=None, + ) + + parser.add_argument( + "--contract-name", + help="The name of the logic contract.", + default=None, + ) + + parser.add_argument( + "--layout", + action="store_true", + help="Toggle used to write a JSON file with the entire storage layout.", + ) + + parser.add_argument( + "--value", + action="store_true", + help="Toggle used to include values in output.", + ) + + parser.add_argument("--max-depth", help="Max depth to search in data structure.", default=20) + + cryticparser.init(parser) + + return parser.parse_args() + + +def main() -> None: + args = parse_args() + + if len(args.contract_source) == 2: + # Source code is file.sol or project directory + source_code, target = args.contract_source + slither = Slither(source_code, **vars(args)) + else: + # Source code is published and retrieved via etherscan + target = args.contract_source[0] + slither = Slither(target, **vars(args)) + + if args.contract_name: + contracts = slither.get_contract_from_name(args.contract_name) + else: + contracts = slither.contracts + + srs = SlitherReadStorage(contracts, args.max_depth) + + if args.rpc_url: + # Remove target prefix e.g. rinkeby:0x0 -> 0x0. + address = target[target.find(":") + 1 :] + # Default to implementation address unless a storage address is given. + if not args.storage_address: + args.storage_address = address + srs.storage_address = args.storage_address + + srs.rpc = args.rpc_url + + if args.layout: + srs.get_all_storage_variables() + srs.get_storage_layout() + else: + assert args.variable_name + # Use a lambda func to only return variables that have same name as target. + # x is a tuple (`Contract`, `StateVariable`). + srs.get_all_storage_variables(lambda x: bool(x[1].name == args.variable_name)) + srs.get_target_variables(**vars(args)) + + # To retrieve slot values an rpc url is required. + if args.value: + assert args.rpc_url + srs.get_slot_values() + + # Only write file if storage layout is used. + if len(srs.slot_info) > 1: + with open("storage_layout.json", "w", encoding="utf-8") as file: + json.dump(srs.slot_info, file, indent=4) + + +if __name__ == "__main__": + main() diff --git a/slither/tools/read_storage/read_storage.py b/slither/tools/read_storage/read_storage.py new file mode 100644 index 000000000..dbdda7183 --- /dev/null +++ b/slither/tools/read_storage/read_storage.py @@ -0,0 +1,551 @@ +import sys +import logging +from math import floor + +from typing import Callable, Optional, Tuple, Union, List, Dict + +try: + from typing import TypedDict +except ImportError: + # < Python 3.8 + from typing_extensions import TypedDict + +try: + from web3 import Web3 + from eth_typing.evm import ChecksumAddress + from eth_abi import decode_single, encode_abi + from eth_utils import keccak + from hexbytes import HexBytes + from .utils import ( + is_elementary, + is_array, + is_mapping, + is_struct, + is_user_defined_type, + get_offset_value, + get_storage_data, + coerce_type, + ) +except ImportError: + print("ERROR: in order to use slither-read-storage, you need to install web3") + print("$ pip3 install web3 --user\n") + sys.exit(-1) + +from slither.core.solidity_types.type import Type +from slither.core.solidity_types import ArrayType +from slither.core.declarations import Contract, StructureContract +from slither.core.variables.state_variable import StateVariable +from slither.core.variables.structure_variable import StructureVariable + + +logging.basicConfig() +logger = logging.getLogger("Slither-read-storage") +logger.setLevel(logging.INFO) + + +class SlotInfo(TypedDict): + type_string: str + slot: int + size: int + offset: int + value: Optional[Union[int, bool, str, ChecksumAddress, hex]] + elems: Optional[TypedDict] # same types as SlotInfo + + +class SlitherReadStorageException(Exception): + pass + + +# pylint: disable=too-many-instance-attributes +class SlitherReadStorage: + def __init__(self, contracts, max_depth): + self._contracts: List[Contract] = contracts + self._max_depth: int = max_depth + self._log: str = "" + self._slot_info: SlotInfo = {} + self._target_variables = [] + self._web3: Optional[Web3] = None + self._checksum_address: Optional[ChecksumAddress] = None + self.storage_address: Optional[str] = None + self.rpc: Optional[str] = None + + @property + def contracts(self) -> List[Contract]: + return self._contracts + + @property + def max_depth(self) -> int: + return int(self._max_depth) + + @property + def log(self) -> str: + return self._log + + @log.setter + def log(self, log) -> str: + self._log = log + + @property + def web3(self) -> Web3: + if not self._web3: + self._web3 = Web3(Web3.HTTPProvider(self.rpc)) + return self._web3 + + @property + def checksum_address(self) -> ChecksumAddress: + if not self._checksum_address: + self._checksum_address = self.web3.toChecksumAddress(self.storage_address) + return self._checksum_address + + @property + def target_variables(self) -> List[Tuple[Contract, StateVariable]]: + """Storage variables (not constant or immutable) and their associated contract.""" + return self._target_variables + + @property + def slot_info(self) -> SlotInfo: + """Contains the location, type, size, offset, and value of contract slots.""" + return self._slot_info + + def get_storage_layout(self) -> None: + """Retrieves the storage layout of entire contract.""" + tmp = {} + for contract, var in self.target_variables: + type_ = var.type + info = self.get_storage_slot(var, contract) + tmp[var.name] = info + + if is_user_defined_type(type_) and is_struct(type_.type): + tmp[var.name]["elems"] = self._all_struct_slots(var, contract) + continue + + if is_array(type_): + elems = self._all_array_slots(var, contract, type_, info["slot"]) + tmp[var.name]["elems"] = elems + + self._slot_info = tmp + + def get_storage_slot( + self, + target_variable: StateVariable, + contract: Contract, + **kwargs, + ) -> Union[SlotInfo, None]: + """Finds the storage slot of a variable in a given contract. + Args: + target_variable (`StateVariable`): The variable to retrieve the slot for. + contracts (`Contract`): The contract that contains the given state variable. + **kwargs: + key (str): Key of a mapping or index position if an array. + deep_key (str): Key of a mapping embedded within another mapping or secondary index if array. + struct_var (str): Structure variable name. + Returns: + (`SlotInfo`) | None : A dictionary of the slot information. + """ + + key = kwargs.get("key", None) + deep_key = kwargs.get("deep_key", None) + struct_var = kwargs.get("struct_var", None) + info = "" + var_log_name = target_variable.name + try: + int_slot, size, offset, type_to = self.get_variable_info(contract, target_variable) + except KeyError: + # Only the child contract of a parent contract will show up in the storage layout when inheritance is used + logger.info( + f"\nContract {contract} not found in storage layout. It is possibly a parent contract\n" + ) + return None + + slot = int.to_bytes(int_slot, 32, byteorder="big") + + if is_elementary(target_variable.type): + type_to = target_variable.type.name + + elif is_array(target_variable.type) and key: + info, type_to, slot, size, offset = self._find_array_slot( + target_variable, slot, key, deep_key=deep_key, struct_var=struct_var + ) + self.log += info + + elif is_user_defined_type(target_variable.type) and struct_var: + var_log_name = struct_var + elems = target_variable.type.type.elems_ordered + info, type_to, slot, size, offset = self._find_struct_var_slot(elems, slot, struct_var) + self.log += info + + elif is_mapping(target_variable.type) and key: + info, type_to, slot, size, offset = self._find_mapping_slot( + target_variable, slot, key, struct_var=struct_var, deep_key=deep_key + ) + self.log += info + + int_slot = int.from_bytes(slot, byteorder="big") + self.log += f"\nName: {var_log_name}\nType: {type_to}\nSlot: {int_slot}\n" + logger.info(self.log) + self.log = "" + return { + "type_string": type_to, + "slot": int_slot, + "size": size, + "offset": offset, + } + + def get_target_variables(self, **kwargs) -> None: + """ + Retrieves every instance of a given variable in a list of contracts. + Should be called after setting `target_variables` with `get_all_storage_variables()`. + **kwargs: + key (str): Key of a mapping or index position if an array. + deep_key (str): Key of a mapping embedded within another mapping or secondary index if array. + struct_var (str): Structure variable name. + """ + for contract, var in self.target_variables: + self._slot_info[f"{contract.name}.{var.name}"] = self.get_storage_slot( + var, contract, **kwargs + ) + + def get_slot_values(self) -> SlotInfo: + """ + Fetches the slot values and inserts them in slot info dictionary. + Returns: + (`SlotInfo`): The dictionary of slot info. + """ + stack = list(self.slot_info.items()) + while stack: + _, v = stack.pop() + if isinstance(v, dict): + stack.extend(v.items()) + if "slot" in v: + hex_bytes = get_storage_data(self.web3, self.checksum_address, v["slot"]) + v["value"] = self.convert_value_to_type( + hex_bytes, v["size"], v["offset"], v["type_string"] + ) + logger.info(f"\nValue: {v['value']}\n") + return self.slot_info + + def get_all_storage_variables(self, func: Callable = None) -> None: + """Fetches all storage variables from a list of contracts. + kwargs: + func (Callable, optional): A criteria to filter functions e.g. name. + """ + for contract in self.contracts: + self._target_variables.extend( + filter( + func, + [ + (contract, var) + for var in contract.variables + if not var.is_constant and not var.is_immutable + ], + ) + ) + + @staticmethod + def _find_struct_var_slot( + elems: List[StructureVariable], slot: bytes, struct_var: str + ) -> Tuple[str, str, bytes, int, int]: + """Finds the slot of a structure variable. + Args: + elems (List[StructureVariable]): Ordered list of structure variables. + slot (bytes): The slot of the struct to begin searching at. + struct_var (str): The target structure variable. + Returns: + info (str): Info about the target variable to log. + type_to (str): The type of the target variable. + slot (bytes): The storage location of the target variable. + size (int): The size (in bits) of the target variable. + offset (int): The size of other variables that share the same slot. + """ + slot = int.from_bytes(slot, "big") + offset = 0 + for var in elems: + size = var.type.size + if offset >= 256: + slot += 1 + offset = 0 + if struct_var == var.name: + type_to = var.type.name + break # found struct var + offset += size + + slot = int.to_bytes(slot, 32, byteorder="big") + info = f"\nStruct Variable: {struct_var}" + return info, type_to, slot, size, offset + + # pylint: disable=too-many-branches + @staticmethod + def _find_array_slot( + target_variable: StateVariable, + slot: bytes, + key: int, + deep_key: int = None, + struct_var: str = None, + ) -> Tuple[str, str, bytes]: + """Finds the slot of array's index. + Args: + target_variable (`StateVariable`): The array that contains the target variable. + slot (bytes): The starting slot of the array. + key (int): The target variable's index position. + deep_key (int, optional): Secondary index if nested array. + struct_var (str, optional): Structure variable name. + Returns: + info (str): Info about the target variable to log. + type_to (str): The type of the target variable. + slot (bytes): The storage location of the target variable. + """ + info = f"\nKey: {key}" + offset = 0 + size = 256 + + if is_array( + target_variable.type.type + ): # multidimensional array uint[i][], , uint[][i], or uint[][] + size = target_variable.type.type.type.size + type_to = target_variable.type.type.type.name + + if target_variable.type.is_fixed_array: # uint[][i] + slot_int = int.from_bytes(slot, "big") + int(key) + else: + slot = keccak(slot) + key = int(key) + if target_variable.type.type.is_fixed_array: # arr[i][] + key *= int(str(target_variable.type.type.length)) + slot_int = int.from_bytes(slot, "big") + key + + if not deep_key: + return info, type_to, int.to_bytes(slot_int, 32, "big"), size, offset + + info += f"\nDeep Key: {deep_key}" + if target_variable.type.type.is_dynamic_array: # uint[][] + # keccak256(keccak256(slot) + index) + floor(j / floor(256 / size)) + slot = keccak(int.to_bytes(slot_int, 32, "big")) + slot_int = int.from_bytes(slot, "big") + + # keccak256(slot) + index + floor(j / floor(256 / size)) + slot_int += floor(int(deep_key) / floor(256 / size)) # uint[i][] + + elif target_variable.type.is_fixed_array: + slot_int = int.from_bytes(slot, "big") + int(key) + if is_user_defined_type(target_variable.type.type): # struct[i] + type_to = target_variable.type.type.type.name + if not struct_var: + return info, type_to, int.to_bytes(slot_int, 32, "big"), size, offset + elems = target_variable.type.type.type.elems_ordered + slot = int.to_bytes(slot_int, 32, byteorder="big") + info_tmp, type_to, slot, size, offset = SlitherReadStorage._find_struct_var_slot( + elems, slot, struct_var + ) + info += info_tmp + + else: + type_to = target_variable.type.type.name + size = target_variable.type.type.size # bits + + elif is_user_defined_type(target_variable.type.type): # struct[] + slot = keccak(slot) + slot_int = int.from_bytes(slot, "big") + int(key) + type_to = target_variable.type.type.type.name + if not struct_var: + return info, type_to, int.to_bytes(slot_int, 32, "big"), size, offset + elems = target_variable.type.type.type.elems_ordered + slot = int.to_bytes(slot_int, 32, byteorder="big") + info_tmp, type_to, slot, size, offset = SlitherReadStorage._find_struct_var_slot( + elems, slot, struct_var + ) + info += info_tmp + + else: + slot = keccak(slot) + slot_int = int.from_bytes(slot, "big") + int(key) + type_to = target_variable.type.type.name + size = target_variable.type.type.size # bits + + slot = int.to_bytes(slot_int, 32, byteorder="big") + + return info, type_to, slot, size, offset + + @staticmethod + def _find_mapping_slot( + target_variable: StateVariable, + slot: bytes, + key: Union[int, str], + deep_key: Union[int, str] = None, + struct_var: str = None, + ) -> Tuple[str, str, bytes, int, int]: + """Finds the data slot of a target variable within a mapping. + target_variable (`StateVariable`): The mapping that contains the target variable. + slot (bytes): The starting slot of the mapping. + key (Union[int, str]): The key the variable is stored at. + deep_key (int, optional): Key of a mapping embedded within another mapping. + struct_var (str, optional): Structure variable name. + :returns: + log (str): Info about the target variable to log. + type_to (bytes): The type of the target variable. + slot (bytes): The storage location of the target variable. + size (int): The size (in bits) of the target variable. + offset (int): The size of other variables that share the same slot. + + """ + info = "" + offset = 0 + if key: + info += f"\nKey: {key}" + if deep_key: + info += f"\nDeep Key: {deep_key}" + + key_type = target_variable.type.type_from.name + assert key + if "int" in key_type: # without this eth_utils encoding fails + key = int(key) + key = coerce_type(key_type, key) + slot = keccak(encode_abi([key_type, "uint256"], [key, decode_single("uint256", slot)])) + + if is_user_defined_type(target_variable.type.type_to) and is_struct( + target_variable.type.type_to.type + ): # mapping(elem => struct) + assert struct_var + elems = target_variable.type.type_to.type.elems_ordered + info_tmp, type_to, slot, size, offset = SlitherReadStorage._find_struct_var_slot( + elems, slot, struct_var + ) + info += info_tmp + + elif is_mapping(target_variable.type.type_to): # mapping(elem => mapping(elem => ???)) + assert deep_key + key_type = target_variable.type.type_to.type_from.name + if "int" in key_type: # without this eth_utils encoding fails + deep_key = int(deep_key) + + # If deep map, will be keccak256(abi.encode(key1, keccak256(abi.encode(key0, uint(slot))))) + slot = keccak(encode_abi([key_type, "bytes32"], [deep_key, slot])) + + # mapping(elem => mapping(elem => elem)) + type_to = target_variable.type.type_to.type_to.type + byte_size, _ = target_variable.type.type_to.type_to.storage_size + size = byte_size * 8 # bits + offset = 0 + + if is_user_defined_type(target_variable.type.type_to.type_to) and is_struct( + target_variable.type.type_to.type_to.type + ): # mapping(elem => mapping(elem => struct)) + assert struct_var + elems = target_variable.type.type_to.type_to.type.elems_ordered + # If map struct, will be bytes32(uint256(keccak256(abi.encode(key1, keccak256(abi.encode(key0, uint(slot)))))) + structFieldDepth); + info_tmp, type_to, slot, size, offset = SlitherReadStorage._find_struct_var_slot( + elems, slot, struct_var + ) + info += info_tmp + + # TODO: suppory mapping with dynamic arrays + + else: # mapping(elem => elem) + type_to = target_variable.type.type_to.name # the value's elementary type + byte_size, _ = target_variable.type.type_to.storage_size + size = byte_size * 8 # bits + + return info, type_to, slot, size, offset + + @staticmethod + def get_variable_info( + contract: Contract, target_variable: StateVariable + ) -> Tuple[int, int, int, str]: + """Return slot, size, offset, and type.""" + type_to = str(target_variable.type) + byte_size, _ = target_variable.type.storage_size + size = byte_size * 8 # bits + (int_slot, offset) = contract.compilation_unit.storage_layout_of(contract, target_variable) + offset *= 8 # bits + logger.info( + f"\nContract '{contract.name}'\n{target_variable.canonical_name} with type {target_variable.type} is located at slot: {int_slot}\n" + ) + + return int_slot, size, offset, type_to + + @staticmethod + def convert_value_to_type( + hex_bytes: HexBytes, size: int, offset: int, type_to: str + ) -> Union[int, bool, str, ChecksumAddress, hex]: + """Convert slot data to type representation.""" + # Account for storage packing + offset_hex_bytes = get_offset_value(hex_bytes, offset, size) + try: + value = coerce_type(type_to, offset_hex_bytes) + except ValueError: + return coerce_type("int", offset_hex_bytes) + + return value + + def _all_struct_slots( + self, var: Union[StructureVariable, StructureContract], contract: Contract, key=None + ) -> Dict[str, SlotInfo]: + """Retrieves all members of a struct.""" + if isinstance(var.type.type, StructureContract): + struct_elems = var.type.type.elems_ordered + else: + struct_elems = var.type.type.type.elems_ordered + data = {} + for elem in struct_elems: + info = self.get_storage_slot( + var, + contract, + key=key, + struct_var=elem.name, + ) + data[elem.name] = info + + return data + + def _all_array_slots( + self, var: ArrayType, contract: Contract, type_: Type, slot: int + ) -> Dict[int, SlotInfo]: + """Retrieves all members of an array.""" + array_length = self._get_array_length(type_, slot) + elems = {} + if is_user_defined_type(type_.type): + for i in range(min(array_length, self.max_depth)): + elems[i] = self._all_struct_slots(var, contract, key=str(i)) + continue + + else: + for i in range(min(array_length, self.max_depth)): + info = self.get_storage_slot( + var, + contract, + key=str(i), + ) + elems[i] = info + + if is_array(type_.type): # multidimensional array + array_length = self._get_array_length(type_.type, info["slot"]) + + elems[i]["elems"] = {} + for j in range(min(array_length, self.max_depth)): + info = self.get_storage_slot( + var, + contract, + key=str(i), + deep_key=str(j), + ) + + elems[i]["elems"][j] = info + return elems + + def _get_array_length(self, type_: Type, slot: int = None) -> int: + """Gets the length of dynamic and fixed arrays. + Args: + type_ (`Type`): The array type. + slot (int, optional): Slot a dynamic array's length is stored at. + Returns: + (int): The length of the array. + """ + val = 0 + if self.rpc: + # The length of dynamic arrays is stored at the starting slot. + # Convert from hexadecimal to decimal. + val = int(get_storage_data(self.web3, self.checksum_address, slot).hex(), 16) + if is_array(type_): + if type_.is_fixed_array: + val = int(str(type_.length)) + + return val diff --git a/slither/tools/read_storage/utils/__init__.py b/slither/tools/read_storage/utils/__init__.py new file mode 100644 index 000000000..5d1cb0d74 --- /dev/null +++ b/slither/tools/read_storage/utils/__init__.py @@ -0,0 +1,11 @@ +from .utils import ( + is_elementary, + is_array, + is_enum, + is_mapping, + is_struct, + is_user_defined_type, + get_offset_value, + get_storage_data, + coerce_type, +) diff --git a/slither/tools/read_storage/utils/utils.py b/slither/tools/read_storage/utils/utils.py new file mode 100644 index 000000000..e14d763d8 --- /dev/null +++ b/slither/tools/read_storage/utils/utils.py @@ -0,0 +1,100 @@ +from typing import Union +from hexbytes import HexBytes +from eth_typing.evm import ChecksumAddress +from eth_utils import to_int, to_text, to_checksum_address + +from slither.core.declarations import Structure, Enum +from slither.core.solidity_types import ArrayType, MappingType, UserDefinedType, ElementaryType +from slither.core.variables.state_variable import StateVariable + + +def is_elementary(variable: StateVariable) -> bool: + """Returns whether variable is an elementary type.""" + return isinstance(variable, ElementaryType) + + +def is_array(variable: StateVariable) -> bool: + """Returns whether variable is an array.""" + return isinstance(variable, ArrayType) + + +def is_mapping(variable: StateVariable) -> bool: + """Returns whether variable is a mapping.""" + return isinstance(variable, MappingType) + + +def is_struct(variable: StateVariable) -> bool: + """Returns whether variable is a struct.""" + return isinstance(variable, Structure) + + +def is_enum(variable: StateVariable) -> bool: + """Returns whether variable is an enum.""" + return isinstance(variable, Enum) + + +def is_user_defined_type(variable: StateVariable) -> bool: + """Returns whether variable is a struct.""" + return isinstance(variable, UserDefinedType) + + +def get_offset_value(hex_bytes: HexBytes, offset: int, size: int) -> bytes: + """ + Trims slot data to only contain the target variable's. + Args: + hex_bytes (HexBytes): String representation of type + offset (int): The size (in bits) of other variables that share the same slot. + size (int): The size (in bits) of the target variable. + Returns: + (bytes): The target variable's trimmed data. + """ + size = int(size / 8) + offset = int(offset / 8) + if offset == 0: + value = hex_bytes[-size:] + else: + start = size + offset + value = hex_bytes[-start:-offset] + return value + + +def coerce_type(solidity_type: str, value: bytes) -> Union[int, bool, str, ChecksumAddress, hex]: + """ + Converts input to the indicated type. + Args: + solidity_type (str): String representation of type. + value (bytes): The value to be converted. + Returns: + (Union[int, bool, str, ChecksumAddress, hex]): The type representation of the value. + """ + if "int" in solidity_type: + converted_value = to_int(value) + elif "bool" in solidity_type: + converted_value = bool(to_int(value)) + elif "string" in solidity_type: + # length * 2 is stored in lower end bits + # TODO handle bytes and strings greater than 32 bytes + length = int(int.from_bytes(value[-2:], "big") / 2) + converted_value = to_text(value[:length]) + + elif "address" in solidity_type: + converted_value = to_checksum_address(value) + else: + converted_value = value.hex() + + return converted_value + + +def get_storage_data(web3, checksum_address: ChecksumAddress, slot: bytes) -> HexBytes: + """ + Retrieves the storage data from the blockchain at target address and slot. + Args: + web3: Web3 instance provider. + checksum_address (ChecksumAddress): The address to query. + slot (bytes): The slot to retrieve data from. + Returns: + (HexBytes): The slot's storage data. + """ + return bytes(web3.eth.get_storage_at(checksum_address, slot)).rjust( + 32, bytes(1) + ) # pad to 32 bytes 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/expression_manipulations.py b/slither/utils/expression_manipulations.py index 7b14fa8a5..1a300c39b 100644 --- a/slither/utils/expression_manipulations.py +++ b/slither/utils/expression_manipulations.py @@ -3,12 +3,14 @@ as they should be immutable """ import copy - +from typing import Union, Callable from slither.core.expressions import UnaryOperation from slither.core.expressions.assignment_operation import AssignmentOperation from slither.core.expressions.binary_operation import BinaryOperation from slither.core.expressions.call_expression import CallExpression from slither.core.expressions.conditional_expression import ConditionalExpression +from slither.core.expressions.elementary_type_name_expression import ElementaryTypeNameExpression +from slither.core.expressions.expression import Expression from slither.core.expressions.identifier import Identifier from slither.core.expressions.index_access import IndexAccess from slither.core.expressions.literal import Literal @@ -20,7 +22,9 @@ from slither.core.expressions.type_conversion import TypeConversion from slither.all_exceptions import SlitherException # pylint: disable=protected-access -def f_expressions(e, x): +def f_expressions( + e: AssignmentOperation, x: Union[Identifier, Literal, MemberAccess, IndexAccess] +) -> None: e._expressions.append(x) @@ -37,7 +41,7 @@ def f_called(e, x): class SplitTernaryExpression: - def __init__(self, expression): + def __init__(self, expression: Union[AssignmentOperation, ConditionalExpression]) -> None: if isinstance(expression, ConditionalExpression): self.true_expression = copy.copy(expression.then_expression) @@ -49,7 +53,13 @@ class SplitTernaryExpression: self.condition = None self.copy_expression(expression, self.true_expression, self.false_expression) - def apply_copy(self, next_expr, true_expression, false_expression, f): + def apply_copy( + self, + next_expr: Expression, + true_expression: Union[AssignmentOperation, MemberAccess], + false_expression: Union[AssignmentOperation, MemberAccess], + f: Callable, + ) -> bool: if isinstance(next_expr, ConditionalExpression): f(true_expression, copy.copy(next_expr.then_expression)) @@ -61,16 +71,20 @@ class SplitTernaryExpression: f(false_expression, copy.copy(next_expr)) return True + # pylint: disable=too-many-branches def copy_expression( - self, expression, true_expression, false_expression - ): # pylint: disable=too-many-branches + self, expression: Expression, true_expression: Expression, false_expression: Expression + ) -> None: if self.condition: return if isinstance(expression, ConditionalExpression): raise SlitherException("Nested ternary operator not handled") - if isinstance(expression, (Literal, Identifier, IndexAccess, NewArray, NewContract)): + if isinstance( + expression, + (Literal, Identifier, IndexAccess, NewArray, NewContract, ElementaryTypeNameExpression), + ): return # case of lib @@ -87,6 +101,12 @@ class SplitTernaryExpression: false_expression._expressions = [] for next_expr in expression.expressions: + if isinstance(next_expr, IndexAccess): + # create an index access for each branch + if isinstance(next_expr.expression_right, ConditionalExpression): + next_expr = _handle_ternary_access( + next_expr, true_expression, false_expression + ) if self.apply_copy(next_expr, true_expression, false_expression, f_expressions): # always on last arguments added self.copy_expression( @@ -115,16 +135,7 @@ class SplitTernaryExpression: false_expression.arguments[-1], ) - elif isinstance(expression, TypeConversion): - next_expr = expression.expression - if self.apply_copy(next_expr, true_expression, false_expression, f_expression): - self.copy_expression( - expression.expression, - true_expression.expression, - false_expression.expression, - ) - - elif isinstance(expression, UnaryOperation): + elif isinstance(expression, (TypeConversion, UnaryOperation)): next_expr = expression.expression if self.apply_copy(next_expr, true_expression, false_expression, f_expression): self.copy_expression( @@ -137,3 +148,35 @@ class SplitTernaryExpression: raise SlitherException( f"Ternary operation not handled {expression}({type(expression)})" ) + + +def _handle_ternary_access( + next_expr: IndexAccess, + true_expression: AssignmentOperation, + false_expression: AssignmentOperation, +): + """ + Conditional ternary accesses are split into two accesses, one true and one false + E.g. x[if cond ? 1 : 2] -> if cond { x[1] } else { x[2] } + """ + true_index_access = IndexAccess( + next_expr.expression_left, + next_expr.expression_right.then_expression, + next_expr.type, + ) + false_index_access = IndexAccess( + next_expr.expression_left, + next_expr.expression_right.else_expression, + next_expr.type, + ) + + f_expressions( + true_expression, + true_index_access, + ) + f_expressions( + false_expression, + false_index_access, + ) + + return next_expr.expression_right 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-0.8.4.sol-0.8.4-compact.zip b/tests/ast-parsing/compile/custom_error-0.8.4.sol-0.8.4-compact.zip index 913457a62..15e749a19 100644 Binary files a/tests/ast-parsing/compile/custom_error-0.8.4.sol-0.8.4-compact.zip and b/tests/ast-parsing/compile/custom_error-0.8.4.sol-0.8.4-compact.zip differ diff --git a/tests/ast-parsing/compile/custom_error-0.8.4.sol-0.8.5-compact.zip b/tests/ast-parsing/compile/custom_error-0.8.4.sol-0.8.5-compact.zip index 713a6a113..070019e18 100644 Binary files a/tests/ast-parsing/compile/custom_error-0.8.4.sol-0.8.5-compact.zip and b/tests/ast-parsing/compile/custom_error-0.8.4.sol-0.8.5-compact.zip differ diff --git a/tests/ast-parsing/compile/custom_error-0.8.4.sol-0.8.6-compact.zip b/tests/ast-parsing/compile/custom_error-0.8.4.sol-0.8.6-compact.zip index 2f3d091f8..e99b78ab6 100644 Binary files a/tests/ast-parsing/compile/custom_error-0.8.4.sol-0.8.6-compact.zip and b/tests/ast-parsing/compile/custom_error-0.8.4.sol-0.8.6-compact.zip differ diff --git a/tests/ast-parsing/compile/custom_error-0.8.4.sol-0.8.7-compact.zip b/tests/ast-parsing/compile/custom_error-0.8.4.sol-0.8.7-compact.zip index 97aa5d97a..42062d708 100644 Binary files a/tests/ast-parsing/compile/custom_error-0.8.4.sol-0.8.7-compact.zip and b/tests/ast-parsing/compile/custom_error-0.8.4.sol-0.8.7-compact.zip differ diff --git a/tests/ast-parsing/compile/custom_error-0.8.4.sol-0.8.8-compact.zip b/tests/ast-parsing/compile/custom_error-0.8.4.sol-0.8.8-compact.zip index d97e8eb0f..d11a080ff 100644 Binary files a/tests/ast-parsing/compile/custom_error-0.8.4.sol-0.8.8-compact.zip and b/tests/ast-parsing/compile/custom_error-0.8.4.sol-0.8.8-compact.zip differ diff --git a/tests/ast-parsing/compile/custom_error-0.8.4.sol-0.8.9-compact.zip b/tests/ast-parsing/compile/custom_error-0.8.4.sol-0.8.9-compact.zip index f732869b3..1b450a6e3 100644 Binary files a/tests/ast-parsing/compile/custom_error-0.8.4.sol-0.8.9-compact.zip and b/tests/ast-parsing/compile/custom_error-0.8.4.sol-0.8.9-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/ternary-with-max.sol-0.8.15-compact.zip b/tests/ast-parsing/compile/ternary-with-max.sol-0.8.15-compact.zip new file mode 100644 index 000000000..dc4cb99da Binary files /dev/null and b/tests/ast-parsing/compile/ternary-with-max.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/user_defined_types.sol-0.8.10-compact.zip b/tests/ast-parsing/compile/user_defined_types.sol-0.8.10-compact.zip deleted file mode 100644 index 245529e6b..000000000 Binary files a/tests/ast-parsing/compile/user_defined_types.sol-0.8.10-compact.zip and /dev/null differ diff --git a/tests/ast-parsing/compile/user_defined_types.sol-0.8.11-compact.zip b/tests/ast-parsing/compile/user_defined_types.sol-0.8.11-compact.zip deleted file mode 100644 index e89687d2b..000000000 Binary files a/tests/ast-parsing/compile/user_defined_types.sol-0.8.11-compact.zip and /dev/null differ diff --git a/tests/ast-parsing/compile/user_defined_types.sol-0.8.12-compact.zip b/tests/ast-parsing/compile/user_defined_types.sol-0.8.12-compact.zip deleted file mode 100644 index d58afe780..000000000 Binary files a/tests/ast-parsing/compile/user_defined_types.sol-0.8.12-compact.zip and /dev/null differ diff --git a/tests/ast-parsing/compile/user_defined_types.sol-0.8.8-compact.zip b/tests/ast-parsing/compile/user_defined_types.sol-0.8.8-compact.zip deleted file mode 100644 index 36924b8c2..000000000 Binary files a/tests/ast-parsing/compile/user_defined_types.sol-0.8.8-compact.zip and /dev/null differ diff --git a/tests/ast-parsing/compile/user_defined_value_type/argument-0.8.8.sol-0.8.10-compact.zip b/tests/ast-parsing/compile/user_defined_value_type/argument-0.8.8.sol-0.8.10-compact.zip new file mode 100644 index 000000000..a1d4b0919 Binary files /dev/null and b/tests/ast-parsing/compile/user_defined_value_type/argument-0.8.8.sol-0.8.10-compact.zip differ diff --git a/tests/ast-parsing/compile/user_defined_value_type/argument-0.8.8.sol-0.8.11-compact.zip b/tests/ast-parsing/compile/user_defined_value_type/argument-0.8.8.sol-0.8.11-compact.zip new file mode 100644 index 000000000..5b0bfc860 Binary files /dev/null and b/tests/ast-parsing/compile/user_defined_value_type/argument-0.8.8.sol-0.8.11-compact.zip differ diff --git a/tests/ast-parsing/compile/user_defined_value_type/argument-0.8.8.sol-0.8.12-compact.zip b/tests/ast-parsing/compile/user_defined_value_type/argument-0.8.8.sol-0.8.12-compact.zip new file mode 100644 index 000000000..c4be608bc Binary files /dev/null and b/tests/ast-parsing/compile/user_defined_value_type/argument-0.8.8.sol-0.8.12-compact.zip differ diff --git a/tests/ast-parsing/compile/user_defined_value_type/argument-0.8.8.sol-0.8.13-compact.zip b/tests/ast-parsing/compile/user_defined_value_type/argument-0.8.8.sol-0.8.13-compact.zip new file mode 100644 index 000000000..56841fbaf Binary files /dev/null and b/tests/ast-parsing/compile/user_defined_value_type/argument-0.8.8.sol-0.8.13-compact.zip differ diff --git a/tests/ast-parsing/compile/user_defined_value_type/argument-0.8.8.sol-0.8.14-compact.zip b/tests/ast-parsing/compile/user_defined_value_type/argument-0.8.8.sol-0.8.14-compact.zip new file mode 100644 index 000000000..131c5769e Binary files /dev/null and b/tests/ast-parsing/compile/user_defined_value_type/argument-0.8.8.sol-0.8.14-compact.zip differ diff --git a/tests/ast-parsing/compile/user_defined_value_type/argument-0.8.8.sol-0.8.15-compact.zip b/tests/ast-parsing/compile/user_defined_value_type/argument-0.8.8.sol-0.8.15-compact.zip new file mode 100644 index 000000000..f8bdf9dee Binary files /dev/null and b/tests/ast-parsing/compile/user_defined_value_type/argument-0.8.8.sol-0.8.15-compact.zip differ diff --git a/tests/ast-parsing/compile/user_defined_value_type/argument-0.8.8.sol-0.8.8-compact.zip b/tests/ast-parsing/compile/user_defined_value_type/argument-0.8.8.sol-0.8.8-compact.zip new file mode 100644 index 000000000..a74b49ac1 Binary files /dev/null and b/tests/ast-parsing/compile/user_defined_value_type/argument-0.8.8.sol-0.8.8-compact.zip differ diff --git a/tests/ast-parsing/compile/user_defined_value_type/calldata-0.8.8.sol-0.8.10-compact.zip b/tests/ast-parsing/compile/user_defined_value_type/calldata-0.8.8.sol-0.8.10-compact.zip new file mode 100644 index 000000000..57273022f Binary files /dev/null and b/tests/ast-parsing/compile/user_defined_value_type/calldata-0.8.8.sol-0.8.10-compact.zip differ diff --git a/tests/ast-parsing/compile/user_defined_value_type/calldata-0.8.8.sol-0.8.11-compact.zip b/tests/ast-parsing/compile/user_defined_value_type/calldata-0.8.8.sol-0.8.11-compact.zip new file mode 100644 index 000000000..c69a936a3 Binary files /dev/null and b/tests/ast-parsing/compile/user_defined_value_type/calldata-0.8.8.sol-0.8.11-compact.zip differ diff --git a/tests/ast-parsing/compile/user_defined_value_type/calldata-0.8.8.sol-0.8.12-compact.zip b/tests/ast-parsing/compile/user_defined_value_type/calldata-0.8.8.sol-0.8.12-compact.zip new file mode 100644 index 000000000..277036849 Binary files /dev/null and b/tests/ast-parsing/compile/user_defined_value_type/calldata-0.8.8.sol-0.8.12-compact.zip differ diff --git a/tests/ast-parsing/compile/user_defined_value_type/calldata-0.8.8.sol-0.8.13-compact.zip b/tests/ast-parsing/compile/user_defined_value_type/calldata-0.8.8.sol-0.8.13-compact.zip new file mode 100644 index 000000000..b17496fc4 Binary files /dev/null and b/tests/ast-parsing/compile/user_defined_value_type/calldata-0.8.8.sol-0.8.13-compact.zip differ diff --git a/tests/ast-parsing/compile/user_defined_value_type/calldata-0.8.8.sol-0.8.14-compact.zip b/tests/ast-parsing/compile/user_defined_value_type/calldata-0.8.8.sol-0.8.14-compact.zip new file mode 100644 index 000000000..fa8734b4e Binary files /dev/null and b/tests/ast-parsing/compile/user_defined_value_type/calldata-0.8.8.sol-0.8.14-compact.zip differ diff --git a/tests/ast-parsing/compile/user_defined_value_type/calldata-0.8.8.sol-0.8.15-compact.zip b/tests/ast-parsing/compile/user_defined_value_type/calldata-0.8.8.sol-0.8.15-compact.zip new file mode 100644 index 000000000..a43ca6b0f Binary files /dev/null and b/tests/ast-parsing/compile/user_defined_value_type/calldata-0.8.8.sol-0.8.15-compact.zip differ diff --git a/tests/ast-parsing/compile/user_defined_value_type/calldata-0.8.8.sol-0.8.8-compact.zip b/tests/ast-parsing/compile/user_defined_value_type/calldata-0.8.8.sol-0.8.8-compact.zip new file mode 100644 index 000000000..4b98a2bc6 Binary files /dev/null and b/tests/ast-parsing/compile/user_defined_value_type/calldata-0.8.8.sol-0.8.8-compact.zip differ diff --git a/tests/ast-parsing/compile/user_defined_value_type/constant-0.8.8.sol-0.8.10-compact.zip b/tests/ast-parsing/compile/user_defined_value_type/constant-0.8.8.sol-0.8.10-compact.zip new file mode 100644 index 000000000..4f7e800b1 Binary files /dev/null and b/tests/ast-parsing/compile/user_defined_value_type/constant-0.8.8.sol-0.8.10-compact.zip differ diff --git a/tests/ast-parsing/compile/user_defined_value_type/constant-0.8.8.sol-0.8.11-compact.zip b/tests/ast-parsing/compile/user_defined_value_type/constant-0.8.8.sol-0.8.11-compact.zip new file mode 100644 index 000000000..24b01b8df Binary files /dev/null and b/tests/ast-parsing/compile/user_defined_value_type/constant-0.8.8.sol-0.8.11-compact.zip differ diff --git a/tests/ast-parsing/compile/user_defined_value_type/constant-0.8.8.sol-0.8.12-compact.zip b/tests/ast-parsing/compile/user_defined_value_type/constant-0.8.8.sol-0.8.12-compact.zip new file mode 100644 index 000000000..43f760749 Binary files /dev/null and b/tests/ast-parsing/compile/user_defined_value_type/constant-0.8.8.sol-0.8.12-compact.zip differ diff --git a/tests/ast-parsing/compile/user_defined_value_type/constant-0.8.8.sol-0.8.13-compact.zip b/tests/ast-parsing/compile/user_defined_value_type/constant-0.8.8.sol-0.8.13-compact.zip new file mode 100644 index 000000000..647d124a4 Binary files /dev/null and b/tests/ast-parsing/compile/user_defined_value_type/constant-0.8.8.sol-0.8.13-compact.zip differ diff --git a/tests/ast-parsing/compile/user_defined_value_type/constant-0.8.8.sol-0.8.14-compact.zip b/tests/ast-parsing/compile/user_defined_value_type/constant-0.8.8.sol-0.8.14-compact.zip new file mode 100644 index 000000000..50f2cc275 Binary files /dev/null and b/tests/ast-parsing/compile/user_defined_value_type/constant-0.8.8.sol-0.8.14-compact.zip differ diff --git a/tests/ast-parsing/compile/user_defined_value_type/constant-0.8.8.sol-0.8.15-compact.zip b/tests/ast-parsing/compile/user_defined_value_type/constant-0.8.8.sol-0.8.15-compact.zip new file mode 100644 index 000000000..652617a3d Binary files /dev/null and b/tests/ast-parsing/compile/user_defined_value_type/constant-0.8.8.sol-0.8.15-compact.zip differ diff --git a/tests/ast-parsing/compile/user_defined_value_type/constant-0.8.8.sol-0.8.8-compact.zip b/tests/ast-parsing/compile/user_defined_value_type/constant-0.8.8.sol-0.8.8-compact.zip new file mode 100644 index 000000000..d98aa7751 Binary files /dev/null and b/tests/ast-parsing/compile/user_defined_value_type/constant-0.8.8.sol-0.8.8-compact.zip differ diff --git a/tests/ast-parsing/compile/user_defined_value_type/erc20-0.8.8.sol-0.8.10-compact.zip b/tests/ast-parsing/compile/user_defined_value_type/erc20-0.8.8.sol-0.8.10-compact.zip new file mode 100644 index 000000000..c65376963 Binary files /dev/null and b/tests/ast-parsing/compile/user_defined_value_type/erc20-0.8.8.sol-0.8.10-compact.zip differ diff --git a/tests/ast-parsing/compile/user_defined_value_type/erc20-0.8.8.sol-0.8.11-compact.zip b/tests/ast-parsing/compile/user_defined_value_type/erc20-0.8.8.sol-0.8.11-compact.zip new file mode 100644 index 000000000..51e60eb27 Binary files /dev/null and b/tests/ast-parsing/compile/user_defined_value_type/erc20-0.8.8.sol-0.8.11-compact.zip differ diff --git a/tests/ast-parsing/compile/user_defined_value_type/erc20-0.8.8.sol-0.8.12-compact.zip b/tests/ast-parsing/compile/user_defined_value_type/erc20-0.8.8.sol-0.8.12-compact.zip new file mode 100644 index 000000000..c9e8559cd Binary files /dev/null and b/tests/ast-parsing/compile/user_defined_value_type/erc20-0.8.8.sol-0.8.12-compact.zip differ diff --git a/tests/ast-parsing/compile/user_defined_value_type/erc20-0.8.8.sol-0.8.13-compact.zip b/tests/ast-parsing/compile/user_defined_value_type/erc20-0.8.8.sol-0.8.13-compact.zip new file mode 100644 index 000000000..36b5e0143 Binary files /dev/null and b/tests/ast-parsing/compile/user_defined_value_type/erc20-0.8.8.sol-0.8.13-compact.zip differ diff --git a/tests/ast-parsing/compile/user_defined_value_type/erc20-0.8.8.sol-0.8.14-compact.zip b/tests/ast-parsing/compile/user_defined_value_type/erc20-0.8.8.sol-0.8.14-compact.zip new file mode 100644 index 000000000..a0d3a394b Binary files /dev/null and b/tests/ast-parsing/compile/user_defined_value_type/erc20-0.8.8.sol-0.8.14-compact.zip differ diff --git a/tests/ast-parsing/compile/user_defined_value_type/erc20-0.8.8.sol-0.8.15-compact.zip b/tests/ast-parsing/compile/user_defined_value_type/erc20-0.8.8.sol-0.8.15-compact.zip new file mode 100644 index 000000000..41dd2566c Binary files /dev/null and b/tests/ast-parsing/compile/user_defined_value_type/erc20-0.8.8.sol-0.8.15-compact.zip differ diff --git a/tests/ast-parsing/compile/user_defined_value_type/erc20-0.8.8.sol-0.8.8-compact.zip b/tests/ast-parsing/compile/user_defined_value_type/erc20-0.8.8.sol-0.8.8-compact.zip new file mode 100644 index 000000000..1752e6322 Binary files /dev/null and b/tests/ast-parsing/compile/user_defined_value_type/erc20-0.8.8.sol-0.8.8-compact.zip differ diff --git a/tests/ast-parsing/compile/user_defined_value_type/in_parenthesis-0.8.8.sol-0.8.10-compact.zip b/tests/ast-parsing/compile/user_defined_value_type/in_parenthesis-0.8.8.sol-0.8.10-compact.zip new file mode 100644 index 000000000..0d3ca25a0 Binary files /dev/null and b/tests/ast-parsing/compile/user_defined_value_type/in_parenthesis-0.8.8.sol-0.8.10-compact.zip differ diff --git a/tests/ast-parsing/compile/user_defined_value_type/in_parenthesis-0.8.8.sol-0.8.11-compact.zip b/tests/ast-parsing/compile/user_defined_value_type/in_parenthesis-0.8.8.sol-0.8.11-compact.zip new file mode 100644 index 000000000..ec8b66df7 Binary files /dev/null and b/tests/ast-parsing/compile/user_defined_value_type/in_parenthesis-0.8.8.sol-0.8.11-compact.zip differ diff --git a/tests/ast-parsing/compile/user_defined_value_type/in_parenthesis-0.8.8.sol-0.8.12-compact.zip b/tests/ast-parsing/compile/user_defined_value_type/in_parenthesis-0.8.8.sol-0.8.12-compact.zip new file mode 100644 index 000000000..a9f8231db Binary files /dev/null and b/tests/ast-parsing/compile/user_defined_value_type/in_parenthesis-0.8.8.sol-0.8.12-compact.zip differ diff --git a/tests/ast-parsing/compile/user_defined_value_type/in_parenthesis-0.8.8.sol-0.8.13-compact.zip b/tests/ast-parsing/compile/user_defined_value_type/in_parenthesis-0.8.8.sol-0.8.13-compact.zip new file mode 100644 index 000000000..65636b54f Binary files /dev/null and b/tests/ast-parsing/compile/user_defined_value_type/in_parenthesis-0.8.8.sol-0.8.13-compact.zip differ diff --git a/tests/ast-parsing/compile/user_defined_value_type/in_parenthesis-0.8.8.sol-0.8.14-compact.zip b/tests/ast-parsing/compile/user_defined_value_type/in_parenthesis-0.8.8.sol-0.8.14-compact.zip new file mode 100644 index 000000000..aaff7aec6 Binary files /dev/null and b/tests/ast-parsing/compile/user_defined_value_type/in_parenthesis-0.8.8.sol-0.8.14-compact.zip differ diff --git a/tests/ast-parsing/compile/user_defined_value_type/in_parenthesis-0.8.8.sol-0.8.15-compact.zip b/tests/ast-parsing/compile/user_defined_value_type/in_parenthesis-0.8.8.sol-0.8.15-compact.zip new file mode 100644 index 000000000..b9272ba0c Binary files /dev/null and b/tests/ast-parsing/compile/user_defined_value_type/in_parenthesis-0.8.8.sol-0.8.15-compact.zip differ diff --git a/tests/ast-parsing/compile/user_defined_value_type/in_parenthesis-0.8.8.sol-0.8.8-compact.zip b/tests/ast-parsing/compile/user_defined_value_type/in_parenthesis-0.8.8.sol-0.8.8-compact.zip new file mode 100644 index 000000000..56b368c60 Binary files /dev/null and b/tests/ast-parsing/compile/user_defined_value_type/in_parenthesis-0.8.8.sol-0.8.8-compact.zip differ diff --git a/tests/ast-parsing/compile/user_defined_value_type/user_defined_types-0.8.8.sol-0.8.10-compact.zip b/tests/ast-parsing/compile/user_defined_value_type/user_defined_types-0.8.8.sol-0.8.10-compact.zip new file mode 100644 index 000000000..89a626934 Binary files /dev/null and b/tests/ast-parsing/compile/user_defined_value_type/user_defined_types-0.8.8.sol-0.8.10-compact.zip differ diff --git a/tests/ast-parsing/compile/user_defined_value_type/user_defined_types-0.8.8.sol-0.8.11-compact.zip b/tests/ast-parsing/compile/user_defined_value_type/user_defined_types-0.8.8.sol-0.8.11-compact.zip new file mode 100644 index 000000000..b261726c8 Binary files /dev/null and b/tests/ast-parsing/compile/user_defined_value_type/user_defined_types-0.8.8.sol-0.8.11-compact.zip differ diff --git a/tests/ast-parsing/compile/user_defined_value_type/user_defined_types-0.8.8.sol-0.8.12-compact.zip b/tests/ast-parsing/compile/user_defined_value_type/user_defined_types-0.8.8.sol-0.8.12-compact.zip new file mode 100644 index 000000000..751c2cf7c Binary files /dev/null and b/tests/ast-parsing/compile/user_defined_value_type/user_defined_types-0.8.8.sol-0.8.12-compact.zip differ diff --git a/tests/ast-parsing/compile/user_defined_value_type/user_defined_types-0.8.8.sol-0.8.13-compact.zip b/tests/ast-parsing/compile/user_defined_value_type/user_defined_types-0.8.8.sol-0.8.13-compact.zip new file mode 100644 index 000000000..3c05dbea0 Binary files /dev/null and b/tests/ast-parsing/compile/user_defined_value_type/user_defined_types-0.8.8.sol-0.8.13-compact.zip differ diff --git a/tests/ast-parsing/compile/user_defined_value_type/user_defined_types-0.8.8.sol-0.8.14-compact.zip b/tests/ast-parsing/compile/user_defined_value_type/user_defined_types-0.8.8.sol-0.8.14-compact.zip new file mode 100644 index 000000000..366277c68 Binary files /dev/null and b/tests/ast-parsing/compile/user_defined_value_type/user_defined_types-0.8.8.sol-0.8.14-compact.zip differ diff --git a/tests/ast-parsing/compile/user_defined_value_type/user_defined_types-0.8.8.sol-0.8.15-compact.zip b/tests/ast-parsing/compile/user_defined_value_type/user_defined_types-0.8.8.sol-0.8.15-compact.zip new file mode 100644 index 000000000..04156bb2a Binary files /dev/null and b/tests/ast-parsing/compile/user_defined_value_type/user_defined_types-0.8.8.sol-0.8.15-compact.zip differ diff --git a/tests/ast-parsing/compile/user_defined_value_type/user_defined_types-0.8.8.sol-0.8.8-compact.zip b/tests/ast-parsing/compile/user_defined_value_type/user_defined_types-0.8.8.sol-0.8.8-compact.zip new file mode 100644 index 000000000..658877ed7 Binary files /dev/null and b/tests/ast-parsing/compile/user_defined_value_type/user_defined_types-0.8.8.sol-0.8.8-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-0.8.4.sol b/tests/ast-parsing/custom_error-0.8.4.sol index d62f96e87..ea185de89 100644 --- a/tests/ast-parsing/custom_error-0.8.4.sol +++ b/tests/ast-parsing/custom_error-0.8.4.sol @@ -1,4 +1,8 @@ pragma solidity ^0.8.4; +interface I { + enum SomeEnum { ONE, TWO, THREE } + error ErrorWithEnum(SomeEnum e); +} struct St{ uint v; @@ -8,7 +12,8 @@ error ErrorSimple(); error ErrorWithArgs(uint, uint); error ErrorWithStruct(St s); -contract VendingMachine { + +contract VendingMachine is I { function err0() public { revert ErrorSimple(); @@ -19,10 +24,14 @@ contract VendingMachine { } function err2() public{ revert ErrorWithArgs(10+10, 10); + revert ErrorWithArgs(uint(SomeEnum.ONE), uint(SomeEnum.ONE)); } function err3() public{ revert('test'); } + function err4() public { + revert ErrorWithEnum(SomeEnum.ONE); + } } contract A{ @@ -43,3 +52,4 @@ contract B is A{ } } + 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-0.8.4.sol-0.8.4-compact.json b/tests/ast-parsing/expected/custom_error-0.8.4.sol-0.8.4-compact.json index 995b49f83..0a9029979 100644 --- a/tests/ast-parsing/expected/custom_error-0.8.4.sol-0.8.4-compact.json +++ b/tests/ast-parsing/expected/custom_error-0.8.4.sol-0.8.4-compact.json @@ -1,9 +1,11 @@ { + "I": {}, "VendingMachine": { "err0()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: EXPRESSION 1\n\"];\n}\n", "err1()": "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", - "err2()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: EXPRESSION 1\n\"];\n}\n", - "err3()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: EXPRESSION 1\n\"];\n}\n" + "err2()": "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", + "err3()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: EXPRESSION 1\n\"];\n}\n", + "err4()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: EXPRESSION 1\n\"];\n}\n" }, "A": { "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: EXPRESSION 1\n\"];\n}\n" diff --git a/tests/ast-parsing/expected/custom_error-0.8.4.sol-0.8.5-compact.json b/tests/ast-parsing/expected/custom_error-0.8.4.sol-0.8.5-compact.json index 995b49f83..0a9029979 100644 --- a/tests/ast-parsing/expected/custom_error-0.8.4.sol-0.8.5-compact.json +++ b/tests/ast-parsing/expected/custom_error-0.8.4.sol-0.8.5-compact.json @@ -1,9 +1,11 @@ { + "I": {}, "VendingMachine": { "err0()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: EXPRESSION 1\n\"];\n}\n", "err1()": "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", - "err2()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: EXPRESSION 1\n\"];\n}\n", - "err3()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: EXPRESSION 1\n\"];\n}\n" + "err2()": "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", + "err3()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: EXPRESSION 1\n\"];\n}\n", + "err4()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: EXPRESSION 1\n\"];\n}\n" }, "A": { "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: EXPRESSION 1\n\"];\n}\n" diff --git a/tests/ast-parsing/expected/custom_error-0.8.4.sol-0.8.6-compact.json b/tests/ast-parsing/expected/custom_error-0.8.4.sol-0.8.6-compact.json index 995b49f83..0a9029979 100644 --- a/tests/ast-parsing/expected/custom_error-0.8.4.sol-0.8.6-compact.json +++ b/tests/ast-parsing/expected/custom_error-0.8.4.sol-0.8.6-compact.json @@ -1,9 +1,11 @@ { + "I": {}, "VendingMachine": { "err0()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: EXPRESSION 1\n\"];\n}\n", "err1()": "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", - "err2()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: EXPRESSION 1\n\"];\n}\n", - "err3()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: EXPRESSION 1\n\"];\n}\n" + "err2()": "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", + "err3()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: EXPRESSION 1\n\"];\n}\n", + "err4()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: EXPRESSION 1\n\"];\n}\n" }, "A": { "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: EXPRESSION 1\n\"];\n}\n" diff --git a/tests/ast-parsing/expected/custom_error-0.8.4.sol-0.8.7-compact.json b/tests/ast-parsing/expected/custom_error-0.8.4.sol-0.8.7-compact.json index 995b49f83..0a9029979 100644 --- a/tests/ast-parsing/expected/custom_error-0.8.4.sol-0.8.7-compact.json +++ b/tests/ast-parsing/expected/custom_error-0.8.4.sol-0.8.7-compact.json @@ -1,9 +1,11 @@ { + "I": {}, "VendingMachine": { "err0()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: EXPRESSION 1\n\"];\n}\n", "err1()": "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", - "err2()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: EXPRESSION 1\n\"];\n}\n", - "err3()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: EXPRESSION 1\n\"];\n}\n" + "err2()": "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", + "err3()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: EXPRESSION 1\n\"];\n}\n", + "err4()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: EXPRESSION 1\n\"];\n}\n" }, "A": { "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: EXPRESSION 1\n\"];\n}\n" diff --git a/tests/ast-parsing/expected/custom_error-0.8.4.sol-0.8.8-compact.json b/tests/ast-parsing/expected/custom_error-0.8.4.sol-0.8.8-compact.json index 995b49f83..0a9029979 100644 --- a/tests/ast-parsing/expected/custom_error-0.8.4.sol-0.8.8-compact.json +++ b/tests/ast-parsing/expected/custom_error-0.8.4.sol-0.8.8-compact.json @@ -1,9 +1,11 @@ { + "I": {}, "VendingMachine": { "err0()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: EXPRESSION 1\n\"];\n}\n", "err1()": "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", - "err2()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: EXPRESSION 1\n\"];\n}\n", - "err3()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: EXPRESSION 1\n\"];\n}\n" + "err2()": "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", + "err3()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: EXPRESSION 1\n\"];\n}\n", + "err4()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: EXPRESSION 1\n\"];\n}\n" }, "A": { "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: EXPRESSION 1\n\"];\n}\n" diff --git a/tests/ast-parsing/expected/custom_error-0.8.4.sol-0.8.9-compact.json b/tests/ast-parsing/expected/custom_error-0.8.4.sol-0.8.9-compact.json index 995b49f83..0a9029979 100644 --- a/tests/ast-parsing/expected/custom_error-0.8.4.sol-0.8.9-compact.json +++ b/tests/ast-parsing/expected/custom_error-0.8.4.sol-0.8.9-compact.json @@ -1,9 +1,11 @@ { + "I": {}, "VendingMachine": { "err0()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: EXPRESSION 1\n\"];\n}\n", "err1()": "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", - "err2()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: EXPRESSION 1\n\"];\n}\n", - "err3()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: EXPRESSION 1\n\"];\n}\n" + "err2()": "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", + "err3()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: EXPRESSION 1\n\"];\n}\n", + "err4()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: EXPRESSION 1\n\"];\n}\n" }, "A": { "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: EXPRESSION 1\n\"];\n}\n" 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/ternary-with-max.sol-0.8.15-compact.json b/tests/ast-parsing/expected/ternary-with-max.sol-0.8.15-compact.json new file mode 100644 index 000000000..755f83c9e --- /dev/null +++ b/tests/ast-parsing/expected/ternary-with-max.sol-0.8.15-compact.json @@ -0,0 +1,5 @@ +{ + "TernaryWithMax": { + "f(bool)": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->2;\n2[label=\"Node Type: IF 2\n\"];\n2->3[label=\"True\"];\n2->4[label=\"False\"];\n3[label=\"Node Type: EXPRESSION 3\n\"];\n3->5;\n4[label=\"Node Type: EXPRESSION 4\n\"];\n4->5;\n5[label=\"Node Type: END_IF 5\n\"];\n}\n" + } +} \ 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/user_defined_value_type/argument-0.8.8.sol-0.8.10-compact.json b/tests/ast-parsing/expected/user_defined_value_type/argument-0.8.8.sol-0.8.10-compact.json new file mode 100644 index 000000000..cb45a229a --- /dev/null +++ b/tests/ast-parsing/expected/user_defined_value_type/argument-0.8.8.sol-0.8.10-compact.json @@ -0,0 +1,7 @@ +{ + "FixLib": { + "div(uint256,uint256)": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: RETURN 1\n\"];\n}\n", + "works(Fix)": "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", + "test(Fix)": "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/user_defined_value_type/argument-0.8.8.sol-0.8.11-compact.json b/tests/ast-parsing/expected/user_defined_value_type/argument-0.8.8.sol-0.8.11-compact.json new file mode 100644 index 000000000..cb45a229a --- /dev/null +++ b/tests/ast-parsing/expected/user_defined_value_type/argument-0.8.8.sol-0.8.11-compact.json @@ -0,0 +1,7 @@ +{ + "FixLib": { + "div(uint256,uint256)": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: RETURN 1\n\"];\n}\n", + "works(Fix)": "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", + "test(Fix)": "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/user_defined_value_type/argument-0.8.8.sol-0.8.12-compact.json b/tests/ast-parsing/expected/user_defined_value_type/argument-0.8.8.sol-0.8.12-compact.json new file mode 100644 index 000000000..cb45a229a --- /dev/null +++ b/tests/ast-parsing/expected/user_defined_value_type/argument-0.8.8.sol-0.8.12-compact.json @@ -0,0 +1,7 @@ +{ + "FixLib": { + "div(uint256,uint256)": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: RETURN 1\n\"];\n}\n", + "works(Fix)": "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", + "test(Fix)": "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/user_defined_value_type/argument-0.8.8.sol-0.8.13-compact.json b/tests/ast-parsing/expected/user_defined_value_type/argument-0.8.8.sol-0.8.13-compact.json new file mode 100644 index 000000000..cb45a229a --- /dev/null +++ b/tests/ast-parsing/expected/user_defined_value_type/argument-0.8.8.sol-0.8.13-compact.json @@ -0,0 +1,7 @@ +{ + "FixLib": { + "div(uint256,uint256)": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: RETURN 1\n\"];\n}\n", + "works(Fix)": "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", + "test(Fix)": "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/user_defined_value_type/argument-0.8.8.sol-0.8.14-compact.json b/tests/ast-parsing/expected/user_defined_value_type/argument-0.8.8.sol-0.8.14-compact.json new file mode 100644 index 000000000..cb45a229a --- /dev/null +++ b/tests/ast-parsing/expected/user_defined_value_type/argument-0.8.8.sol-0.8.14-compact.json @@ -0,0 +1,7 @@ +{ + "FixLib": { + "div(uint256,uint256)": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: RETURN 1\n\"];\n}\n", + "works(Fix)": "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", + "test(Fix)": "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/user_defined_value_type/argument-0.8.8.sol-0.8.15-compact.json b/tests/ast-parsing/expected/user_defined_value_type/argument-0.8.8.sol-0.8.15-compact.json new file mode 100644 index 000000000..cb45a229a --- /dev/null +++ b/tests/ast-parsing/expected/user_defined_value_type/argument-0.8.8.sol-0.8.15-compact.json @@ -0,0 +1,7 @@ +{ + "FixLib": { + "div(uint256,uint256)": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: RETURN 1\n\"];\n}\n", + "works(Fix)": "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", + "test(Fix)": "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/user_defined_value_type/argument-0.8.8.sol-0.8.8-compact.json b/tests/ast-parsing/expected/user_defined_value_type/argument-0.8.8.sol-0.8.8-compact.json new file mode 100644 index 000000000..cb45a229a --- /dev/null +++ b/tests/ast-parsing/expected/user_defined_value_type/argument-0.8.8.sol-0.8.8-compact.json @@ -0,0 +1,7 @@ +{ + "FixLib": { + "div(uint256,uint256)": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: RETURN 1\n\"];\n}\n", + "works(Fix)": "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", + "test(Fix)": "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/user_defined_value_type/calldata-0.8.8.sol-0.8.10-compact.json b/tests/ast-parsing/expected/user_defined_value_type/calldata-0.8.8.sol-0.8.10-compact.json new file mode 100644 index 000000000..3ebff8630 --- /dev/null +++ b/tests/ast-parsing/expected/user_defined_value_type/calldata-0.8.8.sol-0.8.10-compact.json @@ -0,0 +1,10 @@ +{ + "C": { + "f(MyAddress[])": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->3;\n1[label=\"Node Type: BEGIN_LOOP 1\n\"];\n1->4;\n2[label=\"Node Type: END_LOOP 2\n\"];\n2->7;\n3[label=\"Node Type: NEW VARIABLE 3\n\"];\n3->1;\n4[label=\"Node Type: IF_LOOP 4\n\"];\n4->5[label=\"True\"];\n4->2[label=\"False\"];\n5[label=\"Node Type: EXPRESSION 5\n\"];\n5->6;\n6[label=\"Node Type: EXPRESSION 6\n\"];\n6->4;\n7[label=\"Node Type: EXPRESSION 7\n\"];\n}\n", + "g(MyAddress[])": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->3;\n1[label=\"Node Type: BEGIN_LOOP 1\n\"];\n1->4;\n2[label=\"Node Type: END_LOOP 2\n\"];\n2->7;\n3[label=\"Node Type: NEW VARIABLE 3\n\"];\n3->1;\n4[label=\"Node Type: IF_LOOP 4\n\"];\n4->5[label=\"True\"];\n4->2[label=\"False\"];\n5[label=\"Node Type: EXPRESSION 5\n\"];\n5->6;\n6[label=\"Node Type: EXPRESSION 6\n\"];\n6->4;\n7[label=\"Node Type: EXPRESSION 7\n\"];\n}\n", + "test_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: 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\"];\n5->6;\n6[label=\"Node Type: EXPRESSION 6\n\"];\n6->7;\n7[label=\"Node Type: RETURN 7\n\"];\n}\n", + "test_g()": "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\"];\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: RETURN 10\n\"];\n}\n", + "clean()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: EXPRESSION 1\n\"];\n}\n", + "test_equality(MyAddress[])": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: EXPRESSION 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" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/user_defined_value_type/calldata-0.8.8.sol-0.8.11-compact.json b/tests/ast-parsing/expected/user_defined_value_type/calldata-0.8.8.sol-0.8.11-compact.json new file mode 100644 index 000000000..3ebff8630 --- /dev/null +++ b/tests/ast-parsing/expected/user_defined_value_type/calldata-0.8.8.sol-0.8.11-compact.json @@ -0,0 +1,10 @@ +{ + "C": { + "f(MyAddress[])": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->3;\n1[label=\"Node Type: BEGIN_LOOP 1\n\"];\n1->4;\n2[label=\"Node Type: END_LOOP 2\n\"];\n2->7;\n3[label=\"Node Type: NEW VARIABLE 3\n\"];\n3->1;\n4[label=\"Node Type: IF_LOOP 4\n\"];\n4->5[label=\"True\"];\n4->2[label=\"False\"];\n5[label=\"Node Type: EXPRESSION 5\n\"];\n5->6;\n6[label=\"Node Type: EXPRESSION 6\n\"];\n6->4;\n7[label=\"Node Type: EXPRESSION 7\n\"];\n}\n", + "g(MyAddress[])": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->3;\n1[label=\"Node Type: BEGIN_LOOP 1\n\"];\n1->4;\n2[label=\"Node Type: END_LOOP 2\n\"];\n2->7;\n3[label=\"Node Type: NEW VARIABLE 3\n\"];\n3->1;\n4[label=\"Node Type: IF_LOOP 4\n\"];\n4->5[label=\"True\"];\n4->2[label=\"False\"];\n5[label=\"Node Type: EXPRESSION 5\n\"];\n5->6;\n6[label=\"Node Type: EXPRESSION 6\n\"];\n6->4;\n7[label=\"Node Type: EXPRESSION 7\n\"];\n}\n", + "test_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: 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\"];\n5->6;\n6[label=\"Node Type: EXPRESSION 6\n\"];\n6->7;\n7[label=\"Node Type: RETURN 7\n\"];\n}\n", + "test_g()": "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\"];\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: RETURN 10\n\"];\n}\n", + "clean()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: EXPRESSION 1\n\"];\n}\n", + "test_equality(MyAddress[])": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: EXPRESSION 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" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/user_defined_value_type/calldata-0.8.8.sol-0.8.12-compact.json b/tests/ast-parsing/expected/user_defined_value_type/calldata-0.8.8.sol-0.8.12-compact.json new file mode 100644 index 000000000..3ebff8630 --- /dev/null +++ b/tests/ast-parsing/expected/user_defined_value_type/calldata-0.8.8.sol-0.8.12-compact.json @@ -0,0 +1,10 @@ +{ + "C": { + "f(MyAddress[])": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->3;\n1[label=\"Node Type: BEGIN_LOOP 1\n\"];\n1->4;\n2[label=\"Node Type: END_LOOP 2\n\"];\n2->7;\n3[label=\"Node Type: NEW VARIABLE 3\n\"];\n3->1;\n4[label=\"Node Type: IF_LOOP 4\n\"];\n4->5[label=\"True\"];\n4->2[label=\"False\"];\n5[label=\"Node Type: EXPRESSION 5\n\"];\n5->6;\n6[label=\"Node Type: EXPRESSION 6\n\"];\n6->4;\n7[label=\"Node Type: EXPRESSION 7\n\"];\n}\n", + "g(MyAddress[])": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->3;\n1[label=\"Node Type: BEGIN_LOOP 1\n\"];\n1->4;\n2[label=\"Node Type: END_LOOP 2\n\"];\n2->7;\n3[label=\"Node Type: NEW VARIABLE 3\n\"];\n3->1;\n4[label=\"Node Type: IF_LOOP 4\n\"];\n4->5[label=\"True\"];\n4->2[label=\"False\"];\n5[label=\"Node Type: EXPRESSION 5\n\"];\n5->6;\n6[label=\"Node Type: EXPRESSION 6\n\"];\n6->4;\n7[label=\"Node Type: EXPRESSION 7\n\"];\n}\n", + "test_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: 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\"];\n5->6;\n6[label=\"Node Type: EXPRESSION 6\n\"];\n6->7;\n7[label=\"Node Type: RETURN 7\n\"];\n}\n", + "test_g()": "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\"];\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: RETURN 10\n\"];\n}\n", + "clean()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: EXPRESSION 1\n\"];\n}\n", + "test_equality(MyAddress[])": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: EXPRESSION 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" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/user_defined_value_type/calldata-0.8.8.sol-0.8.13-compact.json b/tests/ast-parsing/expected/user_defined_value_type/calldata-0.8.8.sol-0.8.13-compact.json new file mode 100644 index 000000000..3ebff8630 --- /dev/null +++ b/tests/ast-parsing/expected/user_defined_value_type/calldata-0.8.8.sol-0.8.13-compact.json @@ -0,0 +1,10 @@ +{ + "C": { + "f(MyAddress[])": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->3;\n1[label=\"Node Type: BEGIN_LOOP 1\n\"];\n1->4;\n2[label=\"Node Type: END_LOOP 2\n\"];\n2->7;\n3[label=\"Node Type: NEW VARIABLE 3\n\"];\n3->1;\n4[label=\"Node Type: IF_LOOP 4\n\"];\n4->5[label=\"True\"];\n4->2[label=\"False\"];\n5[label=\"Node Type: EXPRESSION 5\n\"];\n5->6;\n6[label=\"Node Type: EXPRESSION 6\n\"];\n6->4;\n7[label=\"Node Type: EXPRESSION 7\n\"];\n}\n", + "g(MyAddress[])": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->3;\n1[label=\"Node Type: BEGIN_LOOP 1\n\"];\n1->4;\n2[label=\"Node Type: END_LOOP 2\n\"];\n2->7;\n3[label=\"Node Type: NEW VARIABLE 3\n\"];\n3->1;\n4[label=\"Node Type: IF_LOOP 4\n\"];\n4->5[label=\"True\"];\n4->2[label=\"False\"];\n5[label=\"Node Type: EXPRESSION 5\n\"];\n5->6;\n6[label=\"Node Type: EXPRESSION 6\n\"];\n6->4;\n7[label=\"Node Type: EXPRESSION 7\n\"];\n}\n", + "test_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: 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\"];\n5->6;\n6[label=\"Node Type: EXPRESSION 6\n\"];\n6->7;\n7[label=\"Node Type: RETURN 7\n\"];\n}\n", + "test_g()": "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\"];\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: RETURN 10\n\"];\n}\n", + "clean()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: EXPRESSION 1\n\"];\n}\n", + "test_equality(MyAddress[])": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: EXPRESSION 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" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/user_defined_value_type/calldata-0.8.8.sol-0.8.14-compact.json b/tests/ast-parsing/expected/user_defined_value_type/calldata-0.8.8.sol-0.8.14-compact.json new file mode 100644 index 000000000..3ebff8630 --- /dev/null +++ b/tests/ast-parsing/expected/user_defined_value_type/calldata-0.8.8.sol-0.8.14-compact.json @@ -0,0 +1,10 @@ +{ + "C": { + "f(MyAddress[])": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->3;\n1[label=\"Node Type: BEGIN_LOOP 1\n\"];\n1->4;\n2[label=\"Node Type: END_LOOP 2\n\"];\n2->7;\n3[label=\"Node Type: NEW VARIABLE 3\n\"];\n3->1;\n4[label=\"Node Type: IF_LOOP 4\n\"];\n4->5[label=\"True\"];\n4->2[label=\"False\"];\n5[label=\"Node Type: EXPRESSION 5\n\"];\n5->6;\n6[label=\"Node Type: EXPRESSION 6\n\"];\n6->4;\n7[label=\"Node Type: EXPRESSION 7\n\"];\n}\n", + "g(MyAddress[])": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->3;\n1[label=\"Node Type: BEGIN_LOOP 1\n\"];\n1->4;\n2[label=\"Node Type: END_LOOP 2\n\"];\n2->7;\n3[label=\"Node Type: NEW VARIABLE 3\n\"];\n3->1;\n4[label=\"Node Type: IF_LOOP 4\n\"];\n4->5[label=\"True\"];\n4->2[label=\"False\"];\n5[label=\"Node Type: EXPRESSION 5\n\"];\n5->6;\n6[label=\"Node Type: EXPRESSION 6\n\"];\n6->4;\n7[label=\"Node Type: EXPRESSION 7\n\"];\n}\n", + "test_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: 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\"];\n5->6;\n6[label=\"Node Type: EXPRESSION 6\n\"];\n6->7;\n7[label=\"Node Type: RETURN 7\n\"];\n}\n", + "test_g()": "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\"];\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: RETURN 10\n\"];\n}\n", + "clean()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: EXPRESSION 1\n\"];\n}\n", + "test_equality(MyAddress[])": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: EXPRESSION 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" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/user_defined_value_type/calldata-0.8.8.sol-0.8.15-compact.json b/tests/ast-parsing/expected/user_defined_value_type/calldata-0.8.8.sol-0.8.15-compact.json new file mode 100644 index 000000000..3ebff8630 --- /dev/null +++ b/tests/ast-parsing/expected/user_defined_value_type/calldata-0.8.8.sol-0.8.15-compact.json @@ -0,0 +1,10 @@ +{ + "C": { + "f(MyAddress[])": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->3;\n1[label=\"Node Type: BEGIN_LOOP 1\n\"];\n1->4;\n2[label=\"Node Type: END_LOOP 2\n\"];\n2->7;\n3[label=\"Node Type: NEW VARIABLE 3\n\"];\n3->1;\n4[label=\"Node Type: IF_LOOP 4\n\"];\n4->5[label=\"True\"];\n4->2[label=\"False\"];\n5[label=\"Node Type: EXPRESSION 5\n\"];\n5->6;\n6[label=\"Node Type: EXPRESSION 6\n\"];\n6->4;\n7[label=\"Node Type: EXPRESSION 7\n\"];\n}\n", + "g(MyAddress[])": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->3;\n1[label=\"Node Type: BEGIN_LOOP 1\n\"];\n1->4;\n2[label=\"Node Type: END_LOOP 2\n\"];\n2->7;\n3[label=\"Node Type: NEW VARIABLE 3\n\"];\n3->1;\n4[label=\"Node Type: IF_LOOP 4\n\"];\n4->5[label=\"True\"];\n4->2[label=\"False\"];\n5[label=\"Node Type: EXPRESSION 5\n\"];\n5->6;\n6[label=\"Node Type: EXPRESSION 6\n\"];\n6->4;\n7[label=\"Node Type: EXPRESSION 7\n\"];\n}\n", + "test_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: 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\"];\n5->6;\n6[label=\"Node Type: EXPRESSION 6\n\"];\n6->7;\n7[label=\"Node Type: RETURN 7\n\"];\n}\n", + "test_g()": "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\"];\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: RETURN 10\n\"];\n}\n", + "clean()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: EXPRESSION 1\n\"];\n}\n", + "test_equality(MyAddress[])": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: EXPRESSION 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" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/user_defined_value_type/calldata-0.8.8.sol-0.8.8-compact.json b/tests/ast-parsing/expected/user_defined_value_type/calldata-0.8.8.sol-0.8.8-compact.json new file mode 100644 index 000000000..3ebff8630 --- /dev/null +++ b/tests/ast-parsing/expected/user_defined_value_type/calldata-0.8.8.sol-0.8.8-compact.json @@ -0,0 +1,10 @@ +{ + "C": { + "f(MyAddress[])": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->3;\n1[label=\"Node Type: BEGIN_LOOP 1\n\"];\n1->4;\n2[label=\"Node Type: END_LOOP 2\n\"];\n2->7;\n3[label=\"Node Type: NEW VARIABLE 3\n\"];\n3->1;\n4[label=\"Node Type: IF_LOOP 4\n\"];\n4->5[label=\"True\"];\n4->2[label=\"False\"];\n5[label=\"Node Type: EXPRESSION 5\n\"];\n5->6;\n6[label=\"Node Type: EXPRESSION 6\n\"];\n6->4;\n7[label=\"Node Type: EXPRESSION 7\n\"];\n}\n", + "g(MyAddress[])": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->3;\n1[label=\"Node Type: BEGIN_LOOP 1\n\"];\n1->4;\n2[label=\"Node Type: END_LOOP 2\n\"];\n2->7;\n3[label=\"Node Type: NEW VARIABLE 3\n\"];\n3->1;\n4[label=\"Node Type: IF_LOOP 4\n\"];\n4->5[label=\"True\"];\n4->2[label=\"False\"];\n5[label=\"Node Type: EXPRESSION 5\n\"];\n5->6;\n6[label=\"Node Type: EXPRESSION 6\n\"];\n6->4;\n7[label=\"Node Type: EXPRESSION 7\n\"];\n}\n", + "test_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: 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\"];\n5->6;\n6[label=\"Node Type: EXPRESSION 6\n\"];\n6->7;\n7[label=\"Node Type: RETURN 7\n\"];\n}\n", + "test_g()": "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\"];\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: RETURN 10\n\"];\n}\n", + "clean()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: EXPRESSION 1\n\"];\n}\n", + "test_equality(MyAddress[])": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: EXPRESSION 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" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/user_defined_value_type/constant-0.8.8.sol-0.8.10-compact.json b/tests/ast-parsing/expected/user_defined_value_type/constant-0.8.8.sol-0.8.10-compact.json new file mode 100644 index 000000000..0008a4469 --- /dev/null +++ b/tests/ast-parsing/expected/user_defined_value_type/constant-0.8.8.sol-0.8.10-compact.json @@ -0,0 +1,3 @@ +{ + "C": {} +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/user_defined_value_type/constant-0.8.8.sol-0.8.11-compact.json b/tests/ast-parsing/expected/user_defined_value_type/constant-0.8.8.sol-0.8.11-compact.json new file mode 100644 index 000000000..0008a4469 --- /dev/null +++ b/tests/ast-parsing/expected/user_defined_value_type/constant-0.8.8.sol-0.8.11-compact.json @@ -0,0 +1,3 @@ +{ + "C": {} +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/user_defined_value_type/constant-0.8.8.sol-0.8.12-compact.json b/tests/ast-parsing/expected/user_defined_value_type/constant-0.8.8.sol-0.8.12-compact.json new file mode 100644 index 000000000..0008a4469 --- /dev/null +++ b/tests/ast-parsing/expected/user_defined_value_type/constant-0.8.8.sol-0.8.12-compact.json @@ -0,0 +1,3 @@ +{ + "C": {} +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/user_defined_value_type/constant-0.8.8.sol-0.8.13-compact.json b/tests/ast-parsing/expected/user_defined_value_type/constant-0.8.8.sol-0.8.13-compact.json new file mode 100644 index 000000000..0008a4469 --- /dev/null +++ b/tests/ast-parsing/expected/user_defined_value_type/constant-0.8.8.sol-0.8.13-compact.json @@ -0,0 +1,3 @@ +{ + "C": {} +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/user_defined_value_type/constant-0.8.8.sol-0.8.14-compact.json b/tests/ast-parsing/expected/user_defined_value_type/constant-0.8.8.sol-0.8.14-compact.json new file mode 100644 index 000000000..0008a4469 --- /dev/null +++ b/tests/ast-parsing/expected/user_defined_value_type/constant-0.8.8.sol-0.8.14-compact.json @@ -0,0 +1,3 @@ +{ + "C": {} +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/user_defined_value_type/constant-0.8.8.sol-0.8.15-compact.json b/tests/ast-parsing/expected/user_defined_value_type/constant-0.8.8.sol-0.8.15-compact.json new file mode 100644 index 000000000..0008a4469 --- /dev/null +++ b/tests/ast-parsing/expected/user_defined_value_type/constant-0.8.8.sol-0.8.15-compact.json @@ -0,0 +1,3 @@ +{ + "C": {} +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/user_defined_value_type/constant-0.8.8.sol-0.8.8-compact.json b/tests/ast-parsing/expected/user_defined_value_type/constant-0.8.8.sol-0.8.8-compact.json new file mode 100644 index 000000000..0008a4469 --- /dev/null +++ b/tests/ast-parsing/expected/user_defined_value_type/constant-0.8.8.sol-0.8.8-compact.json @@ -0,0 +1,3 @@ +{ + "C": {} +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/user_defined_value_type/erc20-0.8.8.sol-0.8.10-compact.json b/tests/ast-parsing/expected/user_defined_value_type/erc20-0.8.8.sol-0.8.10-compact.json new file mode 100644 index 000000000..d8c9a5943 --- /dev/null +++ b/tests/ast-parsing/expected/user_defined_value_type/erc20-0.8.8.sol-0.8.10-compact.json @@ -0,0 +1,22 @@ +{ + "FixedMath": { + "add(UFixed18,UFixed18)": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: RETURN 1\n\"];\n}\n", + "sub(UFixed18,UFixed18)": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: RETURN 1\n\"];\n}\n" + }, + "ERC20": { + "constructor()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: EXPRESSION 1\n\"];\n}\n", + "totalSupply()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: RETURN 1\n\"];\n}\n", + "balanceOf(address)": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: RETURN 1\n\"];\n}\n", + "allowance(address,address)": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: RETURN 1\n\"];\n}\n", + "transfer(address,UFixed18)": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: EXPRESSION 1\n\"];\n1->2;\n2[label=\"Node Type: RETURN 2\n\"];\n}\n", + "approve(address,UFixed18)": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: EXPRESSION 1\n\"];\n1->2;\n2[label=\"Node Type: RETURN 2\n\"];\n}\n", + "transferFrom(address,address,UFixed18)": "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: RETURN 3\n\"];\n}\n", + "increaseAllowance(address,UFixed18)": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: EXPRESSION 1\n\"];\n1->2;\n2[label=\"Node Type: RETURN 2\n\"];\n}\n", + "decreaseAllowance(address,UFixed18)": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: EXPRESSION 1\n\"];\n1->2;\n2[label=\"Node Type: RETURN 2\n\"];\n}\n", + "_transfer(address,address,UFixed18)": "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", + "_mint(address,UFixed18)": "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", + "_burn(address,UFixed18)": "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", + "_approve(address,address,UFixed18)": "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", + "_burnFrom(address,UFixed18)": "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/user_defined_value_type/erc20-0.8.8.sol-0.8.11-compact.json b/tests/ast-parsing/expected/user_defined_value_type/erc20-0.8.8.sol-0.8.11-compact.json new file mode 100644 index 000000000..d8c9a5943 --- /dev/null +++ b/tests/ast-parsing/expected/user_defined_value_type/erc20-0.8.8.sol-0.8.11-compact.json @@ -0,0 +1,22 @@ +{ + "FixedMath": { + "add(UFixed18,UFixed18)": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: RETURN 1\n\"];\n}\n", + "sub(UFixed18,UFixed18)": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: RETURN 1\n\"];\n}\n" + }, + "ERC20": { + "constructor()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: EXPRESSION 1\n\"];\n}\n", + "totalSupply()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: RETURN 1\n\"];\n}\n", + "balanceOf(address)": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: RETURN 1\n\"];\n}\n", + "allowance(address,address)": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: RETURN 1\n\"];\n}\n", + "transfer(address,UFixed18)": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: EXPRESSION 1\n\"];\n1->2;\n2[label=\"Node Type: RETURN 2\n\"];\n}\n", + "approve(address,UFixed18)": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: EXPRESSION 1\n\"];\n1->2;\n2[label=\"Node Type: RETURN 2\n\"];\n}\n", + "transferFrom(address,address,UFixed18)": "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: RETURN 3\n\"];\n}\n", + "increaseAllowance(address,UFixed18)": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: EXPRESSION 1\n\"];\n1->2;\n2[label=\"Node Type: RETURN 2\n\"];\n}\n", + "decreaseAllowance(address,UFixed18)": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: EXPRESSION 1\n\"];\n1->2;\n2[label=\"Node Type: RETURN 2\n\"];\n}\n", + "_transfer(address,address,UFixed18)": "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", + "_mint(address,UFixed18)": "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", + "_burn(address,UFixed18)": "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", + "_approve(address,address,UFixed18)": "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", + "_burnFrom(address,UFixed18)": "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/user_defined_value_type/erc20-0.8.8.sol-0.8.12-compact.json b/tests/ast-parsing/expected/user_defined_value_type/erc20-0.8.8.sol-0.8.12-compact.json new file mode 100644 index 000000000..d8c9a5943 --- /dev/null +++ b/tests/ast-parsing/expected/user_defined_value_type/erc20-0.8.8.sol-0.8.12-compact.json @@ -0,0 +1,22 @@ +{ + "FixedMath": { + "add(UFixed18,UFixed18)": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: RETURN 1\n\"];\n}\n", + "sub(UFixed18,UFixed18)": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: RETURN 1\n\"];\n}\n" + }, + "ERC20": { + "constructor()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: EXPRESSION 1\n\"];\n}\n", + "totalSupply()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: RETURN 1\n\"];\n}\n", + "balanceOf(address)": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: RETURN 1\n\"];\n}\n", + "allowance(address,address)": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: RETURN 1\n\"];\n}\n", + "transfer(address,UFixed18)": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: EXPRESSION 1\n\"];\n1->2;\n2[label=\"Node Type: RETURN 2\n\"];\n}\n", + "approve(address,UFixed18)": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: EXPRESSION 1\n\"];\n1->2;\n2[label=\"Node Type: RETURN 2\n\"];\n}\n", + "transferFrom(address,address,UFixed18)": "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: RETURN 3\n\"];\n}\n", + "increaseAllowance(address,UFixed18)": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: EXPRESSION 1\n\"];\n1->2;\n2[label=\"Node Type: RETURN 2\n\"];\n}\n", + "decreaseAllowance(address,UFixed18)": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: EXPRESSION 1\n\"];\n1->2;\n2[label=\"Node Type: RETURN 2\n\"];\n}\n", + "_transfer(address,address,UFixed18)": "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", + "_mint(address,UFixed18)": "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", + "_burn(address,UFixed18)": "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", + "_approve(address,address,UFixed18)": "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", + "_burnFrom(address,UFixed18)": "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/user_defined_value_type/erc20-0.8.8.sol-0.8.13-compact.json b/tests/ast-parsing/expected/user_defined_value_type/erc20-0.8.8.sol-0.8.13-compact.json new file mode 100644 index 000000000..d8c9a5943 --- /dev/null +++ b/tests/ast-parsing/expected/user_defined_value_type/erc20-0.8.8.sol-0.8.13-compact.json @@ -0,0 +1,22 @@ +{ + "FixedMath": { + "add(UFixed18,UFixed18)": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: RETURN 1\n\"];\n}\n", + "sub(UFixed18,UFixed18)": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: RETURN 1\n\"];\n}\n" + }, + "ERC20": { + "constructor()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: EXPRESSION 1\n\"];\n}\n", + "totalSupply()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: RETURN 1\n\"];\n}\n", + "balanceOf(address)": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: RETURN 1\n\"];\n}\n", + "allowance(address,address)": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: RETURN 1\n\"];\n}\n", + "transfer(address,UFixed18)": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: EXPRESSION 1\n\"];\n1->2;\n2[label=\"Node Type: RETURN 2\n\"];\n}\n", + "approve(address,UFixed18)": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: EXPRESSION 1\n\"];\n1->2;\n2[label=\"Node Type: RETURN 2\n\"];\n}\n", + "transferFrom(address,address,UFixed18)": "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: RETURN 3\n\"];\n}\n", + "increaseAllowance(address,UFixed18)": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: EXPRESSION 1\n\"];\n1->2;\n2[label=\"Node Type: RETURN 2\n\"];\n}\n", + "decreaseAllowance(address,UFixed18)": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: EXPRESSION 1\n\"];\n1->2;\n2[label=\"Node Type: RETURN 2\n\"];\n}\n", + "_transfer(address,address,UFixed18)": "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", + "_mint(address,UFixed18)": "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", + "_burn(address,UFixed18)": "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", + "_approve(address,address,UFixed18)": "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", + "_burnFrom(address,UFixed18)": "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/user_defined_value_type/erc20-0.8.8.sol-0.8.14-compact.json b/tests/ast-parsing/expected/user_defined_value_type/erc20-0.8.8.sol-0.8.14-compact.json new file mode 100644 index 000000000..d8c9a5943 --- /dev/null +++ b/tests/ast-parsing/expected/user_defined_value_type/erc20-0.8.8.sol-0.8.14-compact.json @@ -0,0 +1,22 @@ +{ + "FixedMath": { + "add(UFixed18,UFixed18)": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: RETURN 1\n\"];\n}\n", + "sub(UFixed18,UFixed18)": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: RETURN 1\n\"];\n}\n" + }, + "ERC20": { + "constructor()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: EXPRESSION 1\n\"];\n}\n", + "totalSupply()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: RETURN 1\n\"];\n}\n", + "balanceOf(address)": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: RETURN 1\n\"];\n}\n", + "allowance(address,address)": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: RETURN 1\n\"];\n}\n", + "transfer(address,UFixed18)": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: EXPRESSION 1\n\"];\n1->2;\n2[label=\"Node Type: RETURN 2\n\"];\n}\n", + "approve(address,UFixed18)": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: EXPRESSION 1\n\"];\n1->2;\n2[label=\"Node Type: RETURN 2\n\"];\n}\n", + "transferFrom(address,address,UFixed18)": "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: RETURN 3\n\"];\n}\n", + "increaseAllowance(address,UFixed18)": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: EXPRESSION 1\n\"];\n1->2;\n2[label=\"Node Type: RETURN 2\n\"];\n}\n", + "decreaseAllowance(address,UFixed18)": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: EXPRESSION 1\n\"];\n1->2;\n2[label=\"Node Type: RETURN 2\n\"];\n}\n", + "_transfer(address,address,UFixed18)": "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", + "_mint(address,UFixed18)": "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", + "_burn(address,UFixed18)": "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", + "_approve(address,address,UFixed18)": "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", + "_burnFrom(address,UFixed18)": "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/user_defined_value_type/erc20-0.8.8.sol-0.8.15-compact.json b/tests/ast-parsing/expected/user_defined_value_type/erc20-0.8.8.sol-0.8.15-compact.json new file mode 100644 index 000000000..d8c9a5943 --- /dev/null +++ b/tests/ast-parsing/expected/user_defined_value_type/erc20-0.8.8.sol-0.8.15-compact.json @@ -0,0 +1,22 @@ +{ + "FixedMath": { + "add(UFixed18,UFixed18)": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: RETURN 1\n\"];\n}\n", + "sub(UFixed18,UFixed18)": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: RETURN 1\n\"];\n}\n" + }, + "ERC20": { + "constructor()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: EXPRESSION 1\n\"];\n}\n", + "totalSupply()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: RETURN 1\n\"];\n}\n", + "balanceOf(address)": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: RETURN 1\n\"];\n}\n", + "allowance(address,address)": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: RETURN 1\n\"];\n}\n", + "transfer(address,UFixed18)": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: EXPRESSION 1\n\"];\n1->2;\n2[label=\"Node Type: RETURN 2\n\"];\n}\n", + "approve(address,UFixed18)": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: EXPRESSION 1\n\"];\n1->2;\n2[label=\"Node Type: RETURN 2\n\"];\n}\n", + "transferFrom(address,address,UFixed18)": "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: RETURN 3\n\"];\n}\n", + "increaseAllowance(address,UFixed18)": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: EXPRESSION 1\n\"];\n1->2;\n2[label=\"Node Type: RETURN 2\n\"];\n}\n", + "decreaseAllowance(address,UFixed18)": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: EXPRESSION 1\n\"];\n1->2;\n2[label=\"Node Type: RETURN 2\n\"];\n}\n", + "_transfer(address,address,UFixed18)": "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", + "_mint(address,UFixed18)": "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", + "_burn(address,UFixed18)": "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", + "_approve(address,address,UFixed18)": "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", + "_burnFrom(address,UFixed18)": "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/user_defined_value_type/erc20-0.8.8.sol-0.8.8-compact.json b/tests/ast-parsing/expected/user_defined_value_type/erc20-0.8.8.sol-0.8.8-compact.json new file mode 100644 index 000000000..d8c9a5943 --- /dev/null +++ b/tests/ast-parsing/expected/user_defined_value_type/erc20-0.8.8.sol-0.8.8-compact.json @@ -0,0 +1,22 @@ +{ + "FixedMath": { + "add(UFixed18,UFixed18)": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: RETURN 1\n\"];\n}\n", + "sub(UFixed18,UFixed18)": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: RETURN 1\n\"];\n}\n" + }, + "ERC20": { + "constructor()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: EXPRESSION 1\n\"];\n}\n", + "totalSupply()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: RETURN 1\n\"];\n}\n", + "balanceOf(address)": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: RETURN 1\n\"];\n}\n", + "allowance(address,address)": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: RETURN 1\n\"];\n}\n", + "transfer(address,UFixed18)": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: EXPRESSION 1\n\"];\n1->2;\n2[label=\"Node Type: RETURN 2\n\"];\n}\n", + "approve(address,UFixed18)": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: EXPRESSION 1\n\"];\n1->2;\n2[label=\"Node Type: RETURN 2\n\"];\n}\n", + "transferFrom(address,address,UFixed18)": "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: RETURN 3\n\"];\n}\n", + "increaseAllowance(address,UFixed18)": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: EXPRESSION 1\n\"];\n1->2;\n2[label=\"Node Type: RETURN 2\n\"];\n}\n", + "decreaseAllowance(address,UFixed18)": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: EXPRESSION 1\n\"];\n1->2;\n2[label=\"Node Type: RETURN 2\n\"];\n}\n", + "_transfer(address,address,UFixed18)": "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", + "_mint(address,UFixed18)": "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", + "_burn(address,UFixed18)": "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", + "_approve(address,address,UFixed18)": "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", + "_burnFrom(address,UFixed18)": "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/user_defined_value_type/in_parenthesis-0.8.8.sol-0.8.10-compact.json b/tests/ast-parsing/expected/user_defined_value_type/in_parenthesis-0.8.8.sol-0.8.10-compact.json new file mode 100644 index 000000000..272a4265d --- /dev/null +++ b/tests/ast-parsing/expected/user_defined_value_type/in_parenthesis-0.8.8.sol-0.8.10-compact.json @@ -0,0 +1,14 @@ +{ + "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\"];\n}\n" + }, + "FixedMath": { + "add(UFixed,UFixed)": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: RETURN 1\n\"];\n}\n", + "mul(UFixed,uint256)": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: RETURN 1\n\"];\n}\n", + "floor(UFixed)": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: RETURN 1\n\"];\n}\n", + "toUFixed(uint256)": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: RETURN 1\n\"];\n}\n" + }, + "Greeter": { + "constructor(string)": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/user_defined_value_type/in_parenthesis-0.8.8.sol-0.8.11-compact.json b/tests/ast-parsing/expected/user_defined_value_type/in_parenthesis-0.8.8.sol-0.8.11-compact.json new file mode 100644 index 000000000..272a4265d --- /dev/null +++ b/tests/ast-parsing/expected/user_defined_value_type/in_parenthesis-0.8.8.sol-0.8.11-compact.json @@ -0,0 +1,14 @@ +{ + "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\"];\n}\n" + }, + "FixedMath": { + "add(UFixed,UFixed)": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: RETURN 1\n\"];\n}\n", + "mul(UFixed,uint256)": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: RETURN 1\n\"];\n}\n", + "floor(UFixed)": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: RETURN 1\n\"];\n}\n", + "toUFixed(uint256)": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: RETURN 1\n\"];\n}\n" + }, + "Greeter": { + "constructor(string)": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/user_defined_value_type/in_parenthesis-0.8.8.sol-0.8.12-compact.json b/tests/ast-parsing/expected/user_defined_value_type/in_parenthesis-0.8.8.sol-0.8.12-compact.json new file mode 100644 index 000000000..272a4265d --- /dev/null +++ b/tests/ast-parsing/expected/user_defined_value_type/in_parenthesis-0.8.8.sol-0.8.12-compact.json @@ -0,0 +1,14 @@ +{ + "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\"];\n}\n" + }, + "FixedMath": { + "add(UFixed,UFixed)": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: RETURN 1\n\"];\n}\n", + "mul(UFixed,uint256)": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: RETURN 1\n\"];\n}\n", + "floor(UFixed)": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: RETURN 1\n\"];\n}\n", + "toUFixed(uint256)": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: RETURN 1\n\"];\n}\n" + }, + "Greeter": { + "constructor(string)": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/user_defined_value_type/in_parenthesis-0.8.8.sol-0.8.13-compact.json b/tests/ast-parsing/expected/user_defined_value_type/in_parenthesis-0.8.8.sol-0.8.13-compact.json new file mode 100644 index 000000000..272a4265d --- /dev/null +++ b/tests/ast-parsing/expected/user_defined_value_type/in_parenthesis-0.8.8.sol-0.8.13-compact.json @@ -0,0 +1,14 @@ +{ + "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\"];\n}\n" + }, + "FixedMath": { + "add(UFixed,UFixed)": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: RETURN 1\n\"];\n}\n", + "mul(UFixed,uint256)": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: RETURN 1\n\"];\n}\n", + "floor(UFixed)": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: RETURN 1\n\"];\n}\n", + "toUFixed(uint256)": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: RETURN 1\n\"];\n}\n" + }, + "Greeter": { + "constructor(string)": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/user_defined_value_type/in_parenthesis-0.8.8.sol-0.8.14-compact.json b/tests/ast-parsing/expected/user_defined_value_type/in_parenthesis-0.8.8.sol-0.8.14-compact.json new file mode 100644 index 000000000..272a4265d --- /dev/null +++ b/tests/ast-parsing/expected/user_defined_value_type/in_parenthesis-0.8.8.sol-0.8.14-compact.json @@ -0,0 +1,14 @@ +{ + "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\"];\n}\n" + }, + "FixedMath": { + "add(UFixed,UFixed)": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: RETURN 1\n\"];\n}\n", + "mul(UFixed,uint256)": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: RETURN 1\n\"];\n}\n", + "floor(UFixed)": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: RETURN 1\n\"];\n}\n", + "toUFixed(uint256)": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: RETURN 1\n\"];\n}\n" + }, + "Greeter": { + "constructor(string)": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/user_defined_value_type/in_parenthesis-0.8.8.sol-0.8.15-compact.json b/tests/ast-parsing/expected/user_defined_value_type/in_parenthesis-0.8.8.sol-0.8.15-compact.json new file mode 100644 index 000000000..272a4265d --- /dev/null +++ b/tests/ast-parsing/expected/user_defined_value_type/in_parenthesis-0.8.8.sol-0.8.15-compact.json @@ -0,0 +1,14 @@ +{ + "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\"];\n}\n" + }, + "FixedMath": { + "add(UFixed,UFixed)": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: RETURN 1\n\"];\n}\n", + "mul(UFixed,uint256)": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: RETURN 1\n\"];\n}\n", + "floor(UFixed)": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: RETURN 1\n\"];\n}\n", + "toUFixed(uint256)": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: RETURN 1\n\"];\n}\n" + }, + "Greeter": { + "constructor(string)": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/user_defined_value_type/in_parenthesis-0.8.8.sol-0.8.8-compact.json b/tests/ast-parsing/expected/user_defined_value_type/in_parenthesis-0.8.8.sol-0.8.8-compact.json new file mode 100644 index 000000000..272a4265d --- /dev/null +++ b/tests/ast-parsing/expected/user_defined_value_type/in_parenthesis-0.8.8.sol-0.8.8-compact.json @@ -0,0 +1,14 @@ +{ + "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\"];\n}\n" + }, + "FixedMath": { + "add(UFixed,UFixed)": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: RETURN 1\n\"];\n}\n", + "mul(UFixed,uint256)": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: RETURN 1\n\"];\n}\n", + "floor(UFixed)": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: RETURN 1\n\"];\n}\n", + "toUFixed(uint256)": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: RETURN 1\n\"];\n}\n" + }, + "Greeter": { + "constructor(string)": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/user_defined_value_type/user_defined_types-0.8.8.sol-0.8.10-compact.json b/tests/ast-parsing/expected/user_defined_value_type/user_defined_types-0.8.8.sol-0.8.10-compact.json new file mode 100644 index 000000000..06367c7cd --- /dev/null +++ b/tests/ast-parsing/expected/user_defined_value_type/user_defined_types-0.8.8.sol-0.8.10-compact.json @@ -0,0 +1,10 @@ +{ + "B": { + "u()": "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: NEW VARIABLE 1\n\"];\n}\n" + }, + "D": {}, + "C": { + "f(Left[])": "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/user_defined_value_type/user_defined_types-0.8.8.sol-0.8.11-compact.json b/tests/ast-parsing/expected/user_defined_value_type/user_defined_types-0.8.8.sol-0.8.11-compact.json new file mode 100644 index 000000000..06367c7cd --- /dev/null +++ b/tests/ast-parsing/expected/user_defined_value_type/user_defined_types-0.8.8.sol-0.8.11-compact.json @@ -0,0 +1,10 @@ +{ + "B": { + "u()": "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: NEW VARIABLE 1\n\"];\n}\n" + }, + "D": {}, + "C": { + "f(Left[])": "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/user_defined_value_type/user_defined_types-0.8.8.sol-0.8.12-compact.json b/tests/ast-parsing/expected/user_defined_value_type/user_defined_types-0.8.8.sol-0.8.12-compact.json new file mode 100644 index 000000000..06367c7cd --- /dev/null +++ b/tests/ast-parsing/expected/user_defined_value_type/user_defined_types-0.8.8.sol-0.8.12-compact.json @@ -0,0 +1,10 @@ +{ + "B": { + "u()": "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: NEW VARIABLE 1\n\"];\n}\n" + }, + "D": {}, + "C": { + "f(Left[])": "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/user_defined_value_type/user_defined_types-0.8.8.sol-0.8.13-compact.json b/tests/ast-parsing/expected/user_defined_value_type/user_defined_types-0.8.8.sol-0.8.13-compact.json new file mode 100644 index 000000000..06367c7cd --- /dev/null +++ b/tests/ast-parsing/expected/user_defined_value_type/user_defined_types-0.8.8.sol-0.8.13-compact.json @@ -0,0 +1,10 @@ +{ + "B": { + "u()": "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: NEW VARIABLE 1\n\"];\n}\n" + }, + "D": {}, + "C": { + "f(Left[])": "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/user_defined_value_type/user_defined_types-0.8.8.sol-0.8.14-compact.json b/tests/ast-parsing/expected/user_defined_value_type/user_defined_types-0.8.8.sol-0.8.14-compact.json new file mode 100644 index 000000000..06367c7cd --- /dev/null +++ b/tests/ast-parsing/expected/user_defined_value_type/user_defined_types-0.8.8.sol-0.8.14-compact.json @@ -0,0 +1,10 @@ +{ + "B": { + "u()": "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: NEW VARIABLE 1\n\"];\n}\n" + }, + "D": {}, + "C": { + "f(Left[])": "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/user_defined_value_type/user_defined_types-0.8.8.sol-0.8.15-compact.json b/tests/ast-parsing/expected/user_defined_value_type/user_defined_types-0.8.8.sol-0.8.15-compact.json new file mode 100644 index 000000000..06367c7cd --- /dev/null +++ b/tests/ast-parsing/expected/user_defined_value_type/user_defined_types-0.8.8.sol-0.8.15-compact.json @@ -0,0 +1,10 @@ +{ + "B": { + "u()": "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: NEW VARIABLE 1\n\"];\n}\n" + }, + "D": {}, + "C": { + "f(Left[])": "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/user_defined_value_type/user_defined_types-0.8.8.sol-0.8.8-compact.json b/tests/ast-parsing/expected/user_defined_value_type/user_defined_types-0.8.8.sol-0.8.8-compact.json new file mode 100644 index 000000000..06367c7cd --- /dev/null +++ b/tests/ast-parsing/expected/user_defined_value_type/user_defined_types-0.8.8.sol-0.8.8-compact.json @@ -0,0 +1,10 @@ +{ + "B": { + "u()": "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: NEW VARIABLE 1\n\"];\n}\n" + }, + "D": {}, + "C": { + "f(Left[])": "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/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/ast-parsing/ternary-with-max.sol b/tests/ast-parsing/ternary-with-max.sol new file mode 100644 index 000000000..6eadf3cfd --- /dev/null +++ b/tests/ast-parsing/ternary-with-max.sol @@ -0,0 +1,7 @@ +contract TernaryWithMax { + function f( + bool condition + ) external returns(uint256 res) { + res = type(uint256).max / (condition ? 10 : 1) ; + } +} diff --git a/tests/ast-parsing/user_defined_value_type/argument-0.8.8.sol b/tests/ast-parsing/user_defined_value_type/argument-0.8.8.sol new file mode 100644 index 000000000..8d511db7a --- /dev/null +++ b/tests/ast-parsing/user_defined_value_type/argument-0.8.8.sol @@ -0,0 +1,15 @@ +type Fix is int192; + + +contract FixLib { + function div(uint256 numerator, uint256 divisor) public pure returns (uint256) { + return numerator / divisor; + } + function works(Fix x) external pure returns (uint256) { + uint256 y = uint192(Fix.unwrap(x)); + return div(y, 1e18); + } + function test(Fix x) external pure returns (uint256) { + return div(uint192(Fix.unwrap(x)), 1e18); + } +} diff --git a/tests/ast-parsing/user_defined_value_type/calldata-0.8.8.sol b/tests/ast-parsing/user_defined_value_type/calldata-0.8.8.sol new file mode 100644 index 000000000..dff2146e8 --- /dev/null +++ b/tests/ast-parsing/user_defined_value_type/calldata-0.8.8.sol @@ -0,0 +1,49 @@ +pragma abicoder v2; +type MyAddress is address; + +contract C { + MyAddress[] public addresses; + function f(MyAddress[] calldata _addresses) external { + for (uint i = 0; i < _addresses.length; i++) { + MyAddress.unwrap(_addresses[i]).call(""); + } + addresses = _addresses; + } + function g(MyAddress[] memory _addresses) external { + for (uint i = 0; i < _addresses.length; i++) { + MyAddress.unwrap(_addresses[i]).call(""); + } + addresses = _addresses; + } + function test_f() external returns (bool) { + clean(); + MyAddress[] memory test = new MyAddress[](3); + test[0] = MyAddress.wrap(address(21)); + test[1] = MyAddress.wrap(address(22)); + test[2] = MyAddress.wrap(address(23)); + // this.f(test); + test_equality(test); + return true; + } + function test_g() external returns (bool) { + clean(); + MyAddress[] memory test = new MyAddress[](5); + test[0] = MyAddress.wrap(address(24)); + test[1] = MyAddress.wrap(address(25)); + test[2] = MyAddress.wrap(address(26)); + test[3] = MyAddress.wrap(address(27)); + test[4] = MyAddress.wrap(address(28)); + this.g(test); + test_equality(test); + return true; + } + function clean() internal { + delete addresses; + } + function test_equality(MyAddress[] memory _addresses) internal view { + require (_addresses.length == addresses.length); + for (uint i = 0; i < _addresses.length; i++) { + require(MyAddress.unwrap(_addresses[i]) == MyAddress.unwrap(addresses[i])); + } + } +} diff --git a/tests/ast-parsing/user_defined_value_type/constant-0.8.8.sol b/tests/ast-parsing/user_defined_value_type/constant-0.8.8.sol new file mode 100644 index 000000000..0ea1e5df8 --- /dev/null +++ b/tests/ast-parsing/user_defined_value_type/constant-0.8.8.sol @@ -0,0 +1,7 @@ +type T is int224; + +contract C { + T constant public s = T.wrap(int224(165521356710917456517261742455526507355687727119203895813322792776)); + T constant public t = s; + int224 constant public u = T.unwrap(t); +} diff --git a/tests/ast-parsing/user_defined_value_type/erc20-0.8.8.sol b/tests/ast-parsing/user_defined_value_type/erc20-0.8.8.sol new file mode 100644 index 000000000..29f315d5d --- /dev/null +++ b/tests/ast-parsing/user_defined_value_type/erc20-0.8.8.sol @@ -0,0 +1,107 @@ +type UFixed18 is uint256; + +library FixedMath +{ + function add(UFixed18 a, UFixed18 b) internal pure returns (UFixed18 c) { + return UFixed18.wrap(UFixed18.unwrap(a) + UFixed18.unwrap(b)); + } + function sub(UFixed18 a, UFixed18 b) internal pure returns (UFixed18 c) { + return UFixed18.wrap(UFixed18.unwrap(a) - UFixed18.unwrap(b)); + } +} + +contract ERC20 { + using FixedMath for UFixed18; + + event Transfer(address indexed from, address indexed to, UFixed18 value); + event Approval(address indexed owner, address indexed spender, UFixed18 value); + + mapping (address => UFixed18) private _balances; + mapping (address => mapping (address => UFixed18)) private _allowances; + UFixed18 private _totalSupply; + + constructor() { + _mint(msg.sender, UFixed18.wrap(20)); + } + + function totalSupply() public view returns (UFixed18) { + return _totalSupply; + } + + function balanceOf(address owner) public view returns (UFixed18) { + return _balances[owner]; + } + + function allowance(address owner, address spender) public view returns (UFixed18) { + return _allowances[owner][spender]; + } + + function transfer(address to, UFixed18 value) public returns (bool) { + _transfer(msg.sender, to, value); + return true; + } + + function approve(address spender, UFixed18 value) public returns (bool) { + _approve(msg.sender, spender, value); + return true; + } + + function transferFrom(address from, address to, UFixed18 value) public returns (bool) { + _transfer(from, to, value); + // The subtraction here will revert on overflow. + _approve(from, msg.sender, _allowances[from][msg.sender].sub(value)); + return true; + } + + function increaseAllowance(address spender, UFixed18 addedValue) public returns (bool) { + // The addition here will revert on overflow. + _approve(msg.sender, spender, _allowances[msg.sender][spender].add(addedValue)); + return true; + } + + function decreaseAllowance(address spender, UFixed18 subtractedValue) public returns (bool) { + // The subtraction here will revert on overflow. + _approve(msg.sender, spender, _allowances[msg.sender][spender].sub(subtractedValue)); + return true; + } + + function _transfer(address from, address to, UFixed18 value) internal { + require(to != address(0), "ERC20: transfer to the zero address"); + + // The subtraction and addition here will revert on overflow. + _balances[from] = _balances[from].sub(value); + _balances[to] = _balances[to].add(value); + emit Transfer(from, to, value); + } + + function _mint(address account, UFixed18 value) internal { + require(account != address(0), "ERC20: mint to the zero address"); + + // The additions here will revert on overflow. + _totalSupply = _totalSupply.add(value); + _balances[account] = _balances[account].add(value); + emit Transfer(address(0), account, value); + } + + function _burn(address account, UFixed18 value) internal { + require(account != address(0), "ERC20: burn from the zero address"); + + // The subtractions here will revert on overflow. + _totalSupply = _totalSupply.sub(value); + _balances[account] = _balances[account].sub(value); + emit Transfer(account, address(0), value); + } + + function _approve(address owner, address spender, UFixed18 value) internal { + require(owner != address(0), "ERC20: approve from the zero address"); + require(spender != address(0), "ERC20: approve to the zero address"); + + _allowances[owner][spender] = value; + emit Approval(owner, spender, value); + } + + function _burnFrom(address account, UFixed18 value) internal { + _burn(account, value); + _approve(account, msg.sender, _allowances[account][msg.sender].sub(value)); + } +} diff --git a/tests/ast-parsing/user_defined_value_type/in_parenthesis-0.8.8.sol b/tests/ast-parsing/user_defined_value_type/in_parenthesis-0.8.8.sol new file mode 100644 index 000000000..739221fb9 --- /dev/null +++ b/tests/ast-parsing/user_defined_value_type/in_parenthesis-0.8.8.sol @@ -0,0 +1,48 @@ +type MyInt is int; +contract C { + function f() public returns (MyInt a, int b) { + (MyInt).wrap; + a = (MyInt).wrap(5); + (MyInt).unwrap; + b = (MyInt).unwrap((MyInt).wrap(10)); + } +} + +// Represent a 18 decimal, 256 bit wide fixed point type +// using a user defined value type. +type UFixed is uint256; + +/// A minimal library to do fixed point operations on UFixed. +library FixedMath { + uint constant multiplier = 10**18; + + /// Adds two UFixed numbers. Reverts on overflow, + /// relying on checked arithmetic on uint256. + function add(UFixed a, UFixed b) internal pure returns (UFixed) { + return UFixed.wrap(UFixed.unwrap(a) + UFixed.unwrap(b)); + } + /// Multiplies UFixed and uint256. Reverts on overflow, + /// relying on checked arithmetic on uint256. + function mul(UFixed a, uint256 b) internal pure returns (UFixed) { + return UFixed.wrap(UFixed.unwrap(a) * b); + } + /// Take the floor of a UFixed number. + /// @return the largest integer that does not exceed `a`. + function floor(UFixed a) internal pure returns (uint256) { + return UFixed.unwrap(a) / multiplier; + } + /// Turns a uint256 into a UFixed of the same value. + /// Reverts if the integer is too large. + function toUFixed(uint256 a) internal pure returns (UFixed) { + return UFixed.wrap(a * multiplier); + } +} + + +contract Greeter { + using FixedMath for UFixed; + UFixed public someValue; + + constructor(string memory _greeting) { + } +} diff --git a/tests/ast-parsing/user_defined_types.sol b/tests/ast-parsing/user_defined_value_type/user_defined_types-0.8.8.sol similarity index 100% rename from tests/ast-parsing/user_defined_types.sol rename to tests/ast-parsing/user_defined_value_type/user_defined_types-0.8.8.sol 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.6.11/arbitrary_send.sol.0.6.11.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.6.11/arbitrary_send.sol.0.6.11.ArbitrarySend.json rename to tests/detectors/arbitrary-send-eth/0.5.16/arbitrary_send_eth.sol.0.5.16.ArbitrarySendEth.json index cde2f95aa..814e44e93 100644 --- a/tests/detectors/arbitrary-send/0.6.11/arbitrary_send.sol.0.6.11.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.6.11/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.6.11/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.6.11/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.6.11/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.6.11/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.6.11/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.6.11/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.6.11/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.6.11/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.6.11/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.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.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.6.11/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.6.11/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.6.11/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.6.11/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.6.11/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.6.11/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.6.11/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.6.11/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.6.11/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.6.11/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.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.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.7.6/arbitrary_send.sol.0.7.6.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.7.6/arbitrary_send.sol.0.7.6.ArbitrarySend.json rename to tests/detectors/arbitrary-send-eth/0.6.11/arbitrary_send_eth.sol.0.6.11.ArbitrarySendEth.json index 0f0fe4d57..af4d54ece 100644 --- a/tests/detectors/arbitrary-send/0.7.6/arbitrary_send.sol.0.7.6.ArbitrarySend.json +++ b/tests/detectors/arbitrary-send-eth/0.6.11/arbitrary_send_eth.sol.0.6.11.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.6.11/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.6.11/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.6.11/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.6.11/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.6.11/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.6.11/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.6.11/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.6.11/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.6.11/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.6.11/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.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" }, @@ -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.6.11/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.6.11/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.6.11/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.6.11/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.6.11/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.6.11/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.6.11/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.6.11/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.6.11/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.6.11/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.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.5.16/arbitrary_send.sol.0.5.16.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.5.16/arbitrary_send.sol.0.5.16.ArbitrarySend.json rename to tests/detectors/arbitrary-send-eth/0.7.6/arbitrary_send_eth.sol.0.7.6.ArbitrarySendEth.json index cfb1bcc13..56afe8cb5 100644 --- a/tests/detectors/arbitrary-send/0.5.16/arbitrary_send.sol.0.5.16.ArbitrarySend.json +++ b/tests/detectors/arbitrary-send-eth/0.7.6/arbitrary_send_eth.sol.0.7.6.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.7.6/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.7.6/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.7.6/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.7.6/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.7.6/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.7.6/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.7.6/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.7.6/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.7.6/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.7.6/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.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" }, @@ -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.7.6/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.7.6/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.7.6/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.7.6/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.7.6/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.7.6/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.7.6/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.7.6/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.7.6/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.7.6/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.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/deprecated-standards/0.4.25/deprecated_calls.sol b/tests/detectors/deprecated-standards/0.4.25/deprecated_calls.sol new file mode 100644 index 000000000..57ed13641 --- /dev/null +++ b/tests/detectors/deprecated-standards/0.4.25/deprecated_calls.sol @@ -0,0 +1,10 @@ +contract Test { + + function functionWithDeprecatedThrow() public constant { + // Deprecated: Change msg.gas -> gasleft() + if(msg.gas == msg.value) { + // Deprecated: Change throw -> revert() + throw; + } + } +} \ No newline at end of file diff --git a/tests/detectors/deprecated-standards/0.4.25/deprecated_calls.sol.0.4.25.DeprecatedStandards.json b/tests/detectors/deprecated-standards/0.4.25/deprecated_calls.sol.0.4.25.DeprecatedStandards.json new file mode 100644 index 000000000..ad121123d --- /dev/null +++ b/tests/detectors/deprecated-standards/0.4.25/deprecated_calls.sol.0.4.25.DeprecatedStandards.json @@ -0,0 +1,176 @@ +[ + [ + { + "elements": [ + { + "type": "node", + "name": "msg.gas == msg.value", + "source_mapping": { + "start": 140, + "length": 20, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/deprecated-standards/0.4.25/deprecated_calls.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/deprecated-standards/0.4.25/deprecated_calls.sol", + "is_dependency": false, + "lines": [ + 5 + ], + "starting_column": 12, + "ending_column": 32 + }, + "type_specific_fields": { + "parent": { + "type": "function", + "name": "functionWithDeprecatedThrow", + "source_mapping": { + "start": 21, + "length": 229, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/deprecated-standards/0.4.25/deprecated_calls.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/deprecated-standards/0.4.25/deprecated_calls.sol", + "is_dependency": false, + "lines": [ + 3, + 4, + 5, + 6, + 7, + 8, + 9 + ], + "starting_column": 5, + "ending_column": 6 + }, + "type_specific_fields": { + "parent": { + "type": "contract", + "name": "Test", + "source_mapping": { + "start": 0, + "length": 252, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/deprecated-standards/0.4.25/deprecated_calls.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/deprecated-standards/0.4.25/deprecated_calls.sol", + "is_dependency": false, + "lines": [ + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10, + 11 + ], + "starting_column": 1, + "ending_column": 0 + } + }, + "signature": "functionWithDeprecatedThrow()" + } + } + } + } + ], + "description": "Deprecated standard detected msg.gas == msg.value (tests/detectors/deprecated-standards/0.4.25/deprecated_calls.sol#5):\n\t- Usage of \"msg.gas\" should be replaced with \"gasleft()\"\n", + "markdown": "Deprecated standard detected [msg.gas == msg.value](tests/detectors/deprecated-standards/0.4.25/deprecated_calls.sol#L5):\n\t- Usage of \"msg.gas\" should be replaced with \"gasleft()\"\n", + "first_markdown_element": "tests/detectors/deprecated-standards/0.4.25/deprecated_calls.sol#L5", + "id": "e779713eabc28919356310f06b9413a8a3b7e9e713026d6cfae2d9f6839c1e57", + "check": "deprecated-standards", + "impact": "Informational", + "confidence": "High" + }, + { + "elements": [ + { + "type": "node", + "name": "", + "source_mapping": { + "start": 228, + "length": 5, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/deprecated-standards/0.4.25/deprecated_calls.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/deprecated-standards/0.4.25/deprecated_calls.sol", + "is_dependency": false, + "lines": [ + 7 + ], + "starting_column": 13, + "ending_column": 18 + }, + "type_specific_fields": { + "parent": { + "type": "function", + "name": "functionWithDeprecatedThrow", + "source_mapping": { + "start": 21, + "length": 229, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/deprecated-standards/0.4.25/deprecated_calls.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/deprecated-standards/0.4.25/deprecated_calls.sol", + "is_dependency": false, + "lines": [ + 3, + 4, + 5, + 6, + 7, + 8, + 9 + ], + "starting_column": 5, + "ending_column": 6 + }, + "type_specific_fields": { + "parent": { + "type": "contract", + "name": "Test", + "source_mapping": { + "start": 0, + "length": 252, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/deprecated-standards/0.4.25/deprecated_calls.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/deprecated-standards/0.4.25/deprecated_calls.sol", + "is_dependency": false, + "lines": [ + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10, + 11 + ], + "starting_column": 1, + "ending_column": 0 + } + }, + "signature": "functionWithDeprecatedThrow()" + } + } + } + } + ], + "description": "Deprecated standard detected THROW (tests/detectors/deprecated-standards/0.4.25/deprecated_calls.sol#7):\n\t- Usage of \"throw\" should be replaced with \"revert()\"\n", + "markdown": "Deprecated standard detected [THROW](tests/detectors/deprecated-standards/0.4.25/deprecated_calls.sol#L7):\n\t- Usage of \"throw\" should be replaced with \"revert()\"\n", + "first_markdown_element": "tests/detectors/deprecated-standards/0.4.25/deprecated_calls.sol#L7", + "id": "5fbf4a42467953d0fd8d0661cbb4eeb81d4b40f69ae3820196bf10c4be53044e", + "check": "deprecated-standards", + "impact": "Informational", + "confidence": "High" + } + ] +] \ No newline at end of file diff --git a/tests/detectors/divide-before-multiply/0.4.25/divide_before_multiply.sol b/tests/detectors/divide-before-multiply/0.4.25/divide_before_multiply.sol new file mode 100644 index 000000000..baf27a44e --- /dev/null +++ b/tests/detectors/divide-before-multiply/0.4.25/divide_before_multiply.sol @@ -0,0 +1,5 @@ +contract A { + function f(uint a, uint b, uint c) public returns (uint) { + return (a / b) * c; + } +} \ No newline at end of file diff --git a/tests/detectors/divide-before-multiply/0.4.25/divide_before_multiply.sol.0.4.25.DivideBeforeMultiply.json b/tests/detectors/divide-before-multiply/0.4.25/divide_before_multiply.sol.0.4.25.DivideBeforeMultiply.json new file mode 100644 index 000000000..529f9444b --- /dev/null +++ b/tests/detectors/divide-before-multiply/0.4.25/divide_before_multiply.sol.0.4.25.DivideBeforeMultiply.json @@ -0,0 +1,127 @@ +[ + [ + { + "elements": [ + { + "type": "function", + "name": "f", + "source_mapping": { + "start": 14, + "length": 92, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/divide-before-multiply/0.4.25/divide_before_multiply.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/divide-before-multiply/0.4.25/divide_before_multiply.sol", + "is_dependency": false, + "lines": [ + 2, + 3, + 4 + ], + "starting_column": 2, + "ending_column": 6 + }, + "type_specific_fields": { + "parent": { + "type": "contract", + "name": "A", + "source_mapping": { + "start": 0, + "length": 108, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/divide-before-multiply/0.4.25/divide_before_multiply.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/divide-before-multiply/0.4.25/divide_before_multiply.sol", + "is_dependency": false, + "lines": [ + 1, + 2, + 3, + 4, + 5, + 6 + ], + "starting_column": 1, + "ending_column": 0 + } + }, + "signature": "f(uint256,uint256,uint256)" + } + }, + { + "type": "node", + "name": "(a / b) * c", + "source_mapping": { + "start": 81, + "length": 18, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/divide-before-multiply/0.4.25/divide_before_multiply.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/divide-before-multiply/0.4.25/divide_before_multiply.sol", + "is_dependency": false, + "lines": [ + 3 + ], + "starting_column": 9, + "ending_column": 27 + }, + "type_specific_fields": { + "parent": { + "type": "function", + "name": "f", + "source_mapping": { + "start": 14, + "length": 92, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/divide-before-multiply/0.4.25/divide_before_multiply.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/divide-before-multiply/0.4.25/divide_before_multiply.sol", + "is_dependency": false, + "lines": [ + 2, + 3, + 4 + ], + "starting_column": 2, + "ending_column": 6 + }, + "type_specific_fields": { + "parent": { + "type": "contract", + "name": "A", + "source_mapping": { + "start": 0, + "length": 108, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/divide-before-multiply/0.4.25/divide_before_multiply.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/divide-before-multiply/0.4.25/divide_before_multiply.sol", + "is_dependency": false, + "lines": [ + 1, + 2, + 3, + 4, + 5, + 6 + ], + "starting_column": 1, + "ending_column": 0 + } + }, + "signature": "f(uint256,uint256,uint256)" + } + } + } + } + ], + "description": "A.f(uint256,uint256,uint256) (tests/detectors/divide-before-multiply/0.4.25/divide_before_multiply.sol#2-4) performs a multiplication on the result of a division:\n\t-(a / b) * c (tests/detectors/divide-before-multiply/0.4.25/divide_before_multiply.sol#3)\n", + "markdown": "[A.f(uint256,uint256,uint256)](tests/detectors/divide-before-multiply/0.4.25/divide_before_multiply.sol#L2-L4) performs a multiplication on the result of a division:\n\t-[(a / b) * c](tests/detectors/divide-before-multiply/0.4.25/divide_before_multiply.sol#L3)\n", + "first_markdown_element": "tests/detectors/divide-before-multiply/0.4.25/divide_before_multiply.sol#L2-L4", + "id": "fe40e2f72824d1270402b09af057ec7364af1ad2f8c48ef4df72fc27012b3186", + "check": "divide-before-multiply", + "impact": "Medium", + "confidence": "Medium" + } + ] +] \ No newline at end of file diff --git a/tests/detectors/divide-before-multiply/0.5.16/divide_before_multiply.sol b/tests/detectors/divide-before-multiply/0.5.16/divide_before_multiply.sol new file mode 100644 index 000000000..baf27a44e --- /dev/null +++ b/tests/detectors/divide-before-multiply/0.5.16/divide_before_multiply.sol @@ -0,0 +1,5 @@ +contract A { + function f(uint a, uint b, uint c) public returns (uint) { + return (a / b) * c; + } +} \ No newline at end of file diff --git a/tests/detectors/divide-before-multiply/0.5.16/divide_before_multiply.sol.0.5.16.DivideBeforeMultiply.json b/tests/detectors/divide-before-multiply/0.5.16/divide_before_multiply.sol.0.5.16.DivideBeforeMultiply.json new file mode 100644 index 000000000..4421fa0ef --- /dev/null +++ b/tests/detectors/divide-before-multiply/0.5.16/divide_before_multiply.sol.0.5.16.DivideBeforeMultiply.json @@ -0,0 +1,127 @@ +[ + [ + { + "elements": [ + { + "type": "function", + "name": "f", + "source_mapping": { + "start": 14, + "length": 92, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/divide-before-multiply/0.5.16/divide_before_multiply.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/divide-before-multiply/0.5.16/divide_before_multiply.sol", + "is_dependency": false, + "lines": [ + 2, + 3, + 4 + ], + "starting_column": 2, + "ending_column": 6 + }, + "type_specific_fields": { + "parent": { + "type": "contract", + "name": "A", + "source_mapping": { + "start": 0, + "length": 108, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/divide-before-multiply/0.5.16/divide_before_multiply.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/divide-before-multiply/0.5.16/divide_before_multiply.sol", + "is_dependency": false, + "lines": [ + 1, + 2, + 3, + 4, + 5, + 6 + ], + "starting_column": 1, + "ending_column": 0 + } + }, + "signature": "f(uint256,uint256,uint256)" + } + }, + { + "type": "node", + "name": "(a / b) * c", + "source_mapping": { + "start": 81, + "length": 18, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/divide-before-multiply/0.5.16/divide_before_multiply.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/divide-before-multiply/0.5.16/divide_before_multiply.sol", + "is_dependency": false, + "lines": [ + 3 + ], + "starting_column": 9, + "ending_column": 27 + }, + "type_specific_fields": { + "parent": { + "type": "function", + "name": "f", + "source_mapping": { + "start": 14, + "length": 92, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/divide-before-multiply/0.5.16/divide_before_multiply.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/divide-before-multiply/0.5.16/divide_before_multiply.sol", + "is_dependency": false, + "lines": [ + 2, + 3, + 4 + ], + "starting_column": 2, + "ending_column": 6 + }, + "type_specific_fields": { + "parent": { + "type": "contract", + "name": "A", + "source_mapping": { + "start": 0, + "length": 108, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/divide-before-multiply/0.5.16/divide_before_multiply.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/divide-before-multiply/0.5.16/divide_before_multiply.sol", + "is_dependency": false, + "lines": [ + 1, + 2, + 3, + 4, + 5, + 6 + ], + "starting_column": 1, + "ending_column": 0 + } + }, + "signature": "f(uint256,uint256,uint256)" + } + } + } + } + ], + "description": "A.f(uint256,uint256,uint256) (tests/detectors/divide-before-multiply/0.5.16/divide_before_multiply.sol#2-4) performs a multiplication on the result of a division:\n\t-(a / b) * c (tests/detectors/divide-before-multiply/0.5.16/divide_before_multiply.sol#3)\n", + "markdown": "[A.f(uint256,uint256,uint256)](tests/detectors/divide-before-multiply/0.5.16/divide_before_multiply.sol#L2-L4) performs a multiplication on the result of a division:\n\t-[(a / b) * c](tests/detectors/divide-before-multiply/0.5.16/divide_before_multiply.sol#L3)\n", + "first_markdown_element": "tests/detectors/divide-before-multiply/0.5.16/divide_before_multiply.sol#L2-L4", + "id": "a484421df5c9ebf3dc3d8bcec6701ab3065e03b21e294c4972142c4503f2fccb", + "check": "divide-before-multiply", + "impact": "Medium", + "confidence": "Medium" + } + ] +] \ No newline at end of file diff --git a/tests/detectors/divide-before-multiply/0.6.11/divide_before_multiply.sol b/tests/detectors/divide-before-multiply/0.6.11/divide_before_multiply.sol new file mode 100644 index 000000000..baf27a44e --- /dev/null +++ b/tests/detectors/divide-before-multiply/0.6.11/divide_before_multiply.sol @@ -0,0 +1,5 @@ +contract A { + function f(uint a, uint b, uint c) public returns (uint) { + return (a / b) * c; + } +} \ No newline at end of file diff --git a/tests/detectors/divide-before-multiply/0.6.11/divide_before_multiply.sol.0.6.11.DivideBeforeMultiply.json b/tests/detectors/divide-before-multiply/0.6.11/divide_before_multiply.sol.0.6.11.DivideBeforeMultiply.json new file mode 100644 index 000000000..564cac140 --- /dev/null +++ b/tests/detectors/divide-before-multiply/0.6.11/divide_before_multiply.sol.0.6.11.DivideBeforeMultiply.json @@ -0,0 +1,127 @@ +[ + [ + { + "elements": [ + { + "type": "function", + "name": "f", + "source_mapping": { + "start": 14, + "length": 92, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/divide-before-multiply/0.6.11/divide_before_multiply.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/divide-before-multiply/0.6.11/divide_before_multiply.sol", + "is_dependency": false, + "lines": [ + 2, + 3, + 4 + ], + "starting_column": 2, + "ending_column": 6 + }, + "type_specific_fields": { + "parent": { + "type": "contract", + "name": "A", + "source_mapping": { + "start": 0, + "length": 108, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/divide-before-multiply/0.6.11/divide_before_multiply.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/divide-before-multiply/0.6.11/divide_before_multiply.sol", + "is_dependency": false, + "lines": [ + 1, + 2, + 3, + 4, + 5, + 6 + ], + "starting_column": 1, + "ending_column": 0 + } + }, + "signature": "f(uint256,uint256,uint256)" + } + }, + { + "type": "node", + "name": "(a / b) * c", + "source_mapping": { + "start": 81, + "length": 18, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/divide-before-multiply/0.6.11/divide_before_multiply.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/divide-before-multiply/0.6.11/divide_before_multiply.sol", + "is_dependency": false, + "lines": [ + 3 + ], + "starting_column": 9, + "ending_column": 27 + }, + "type_specific_fields": { + "parent": { + "type": "function", + "name": "f", + "source_mapping": { + "start": 14, + "length": 92, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/divide-before-multiply/0.6.11/divide_before_multiply.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/divide-before-multiply/0.6.11/divide_before_multiply.sol", + "is_dependency": false, + "lines": [ + 2, + 3, + 4 + ], + "starting_column": 2, + "ending_column": 6 + }, + "type_specific_fields": { + "parent": { + "type": "contract", + "name": "A", + "source_mapping": { + "start": 0, + "length": 108, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/divide-before-multiply/0.6.11/divide_before_multiply.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/divide-before-multiply/0.6.11/divide_before_multiply.sol", + "is_dependency": false, + "lines": [ + 1, + 2, + 3, + 4, + 5, + 6 + ], + "starting_column": 1, + "ending_column": 0 + } + }, + "signature": "f(uint256,uint256,uint256)" + } + } + } + } + ], + "description": "A.f(uint256,uint256,uint256) (tests/detectors/divide-before-multiply/0.6.11/divide_before_multiply.sol#2-4) performs a multiplication on the result of a division:\n\t-(a / b) * c (tests/detectors/divide-before-multiply/0.6.11/divide_before_multiply.sol#3)\n", + "markdown": "[A.f(uint256,uint256,uint256)](tests/detectors/divide-before-multiply/0.6.11/divide_before_multiply.sol#L2-L4) performs a multiplication on the result of a division:\n\t-[(a / b) * c](tests/detectors/divide-before-multiply/0.6.11/divide_before_multiply.sol#L3)\n", + "first_markdown_element": "tests/detectors/divide-before-multiply/0.6.11/divide_before_multiply.sol#L2-L4", + "id": "9010aa3fdf8f7689d4c4d4ea0bcd771668212100e5427e48644ed7337de03a6d", + "check": "divide-before-multiply", + "impact": "Medium", + "confidence": "Medium" + } + ] +] \ No newline at end of file diff --git a/tests/detectors/divide-before-multiply/0.7.6/divide_before_multiply.sol b/tests/detectors/divide-before-multiply/0.7.6/divide_before_multiply.sol new file mode 100644 index 000000000..baf27a44e --- /dev/null +++ b/tests/detectors/divide-before-multiply/0.7.6/divide_before_multiply.sol @@ -0,0 +1,5 @@ +contract A { + function f(uint a, uint b, uint c) public returns (uint) { + return (a / b) * c; + } +} \ No newline at end of file diff --git a/tests/detectors/divide-before-multiply/0.7.6/divide_before_multiply.sol.0.7.6.DivideBeforeMultiply.json b/tests/detectors/divide-before-multiply/0.7.6/divide_before_multiply.sol.0.7.6.DivideBeforeMultiply.json new file mode 100644 index 000000000..23dd10c28 --- /dev/null +++ b/tests/detectors/divide-before-multiply/0.7.6/divide_before_multiply.sol.0.7.6.DivideBeforeMultiply.json @@ -0,0 +1,127 @@ +[ + [ + { + "elements": [ + { + "type": "function", + "name": "f", + "source_mapping": { + "start": 14, + "length": 92, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/divide-before-multiply/0.7.6/divide_before_multiply.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/divide-before-multiply/0.7.6/divide_before_multiply.sol", + "is_dependency": false, + "lines": [ + 2, + 3, + 4 + ], + "starting_column": 2, + "ending_column": 6 + }, + "type_specific_fields": { + "parent": { + "type": "contract", + "name": "A", + "source_mapping": { + "start": 0, + "length": 108, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/divide-before-multiply/0.7.6/divide_before_multiply.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/divide-before-multiply/0.7.6/divide_before_multiply.sol", + "is_dependency": false, + "lines": [ + 1, + 2, + 3, + 4, + 5, + 6 + ], + "starting_column": 1, + "ending_column": 0 + } + }, + "signature": "f(uint256,uint256,uint256)" + } + }, + { + "type": "node", + "name": "(a / b) * c", + "source_mapping": { + "start": 81, + "length": 18, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/divide-before-multiply/0.7.6/divide_before_multiply.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/divide-before-multiply/0.7.6/divide_before_multiply.sol", + "is_dependency": false, + "lines": [ + 3 + ], + "starting_column": 9, + "ending_column": 27 + }, + "type_specific_fields": { + "parent": { + "type": "function", + "name": "f", + "source_mapping": { + "start": 14, + "length": 92, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/divide-before-multiply/0.7.6/divide_before_multiply.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/divide-before-multiply/0.7.6/divide_before_multiply.sol", + "is_dependency": false, + "lines": [ + 2, + 3, + 4 + ], + "starting_column": 2, + "ending_column": 6 + }, + "type_specific_fields": { + "parent": { + "type": "contract", + "name": "A", + "source_mapping": { + "start": 0, + "length": 108, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/divide-before-multiply/0.7.6/divide_before_multiply.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/divide-before-multiply/0.7.6/divide_before_multiply.sol", + "is_dependency": false, + "lines": [ + 1, + 2, + 3, + 4, + 5, + 6 + ], + "starting_column": 1, + "ending_column": 0 + } + }, + "signature": "f(uint256,uint256,uint256)" + } + } + } + } + ], + "description": "A.f(uint256,uint256,uint256) (tests/detectors/divide-before-multiply/0.7.6/divide_before_multiply.sol#2-4) performs a multiplication on the result of a division:\n\t-(a / b) * c (tests/detectors/divide-before-multiply/0.7.6/divide_before_multiply.sol#3)\n", + "markdown": "[A.f(uint256,uint256,uint256)](tests/detectors/divide-before-multiply/0.7.6/divide_before_multiply.sol#L2-L4) performs a multiplication on the result of a division:\n\t-[(a / b) * c](tests/detectors/divide-before-multiply/0.7.6/divide_before_multiply.sol#L3)\n", + "first_markdown_element": "tests/detectors/divide-before-multiply/0.7.6/divide_before_multiply.sol#L2-L4", + "id": "9bc6cb85ece6cd57fa946707784180957080ad5f9575abc17af218f0d2801f77", + "check": "divide-before-multiply", + "impact": "Medium", + "confidence": "Medium" + } + ] +] \ No newline at end of file diff --git a/tests/detectors/enum-conversion/0.4.2/enum_conversion.sol b/tests/detectors/enum-conversion/0.4.2/enum_conversion.sol new file mode 100644 index 000000000..7a72084eb --- /dev/null +++ b/tests/detectors/enum-conversion/0.4.2/enum_conversion.sol @@ -0,0 +1,9 @@ +pragma solidity 0.4.2; + contract Test{ + + enum E{a} + + function bug(uint a) public returns(E){ + return E(a); + } +} \ No newline at end of file diff --git a/tests/detectors/enum-conversion/0.4.2/enum_conversion.sol.0.4.2.EnumConversion.json b/tests/detectors/enum-conversion/0.4.2/enum_conversion.sol.0.4.2.EnumConversion.json new file mode 100644 index 000000000..8eab7b7df --- /dev/null +++ b/tests/detectors/enum-conversion/0.4.2/enum_conversion.sol.0.4.2.EnumConversion.json @@ -0,0 +1,222 @@ +[ + [ + { + "elements": [ + { + "type": "node", + "name": "Test.E(a)", + "source_mapping": { + "start": 118, + "length": 11, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/enum-conversion/0.4.2/enum_conversion.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/enum-conversion/0.4.2/enum_conversion.sol", + "is_dependency": false, + "lines": [ + 7 + ], + "starting_column": 9, + "ending_column": 20 + }, + "type_specific_fields": { + "parent": { + "type": "function", + "name": "bug", + "source_mapping": { + "start": 70, + "length": 69, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/enum-conversion/0.4.2/enum_conversion.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/enum-conversion/0.4.2/enum_conversion.sol", + "is_dependency": false, + "lines": [ + 6, + 7, + 8 + ], + "starting_column": 5, + "ending_column": 6 + }, + "type_specific_fields": { + "parent": { + "type": "contract", + "name": "Test", + "source_mapping": { + "start": 27, + "length": 114, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/enum-conversion/0.4.2/enum_conversion.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/enum-conversion/0.4.2/enum_conversion.sol", + "is_dependency": false, + "lines": [ + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10 + ], + "starting_column": 5, + "ending_column": 0 + } + }, + "signature": "bug(uint256)" + } + } + } + }, + { + "type": "variable", + "name": "a", + "source_mapping": { + "start": 83, + "length": 6, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/enum-conversion/0.4.2/enum_conversion.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/enum-conversion/0.4.2/enum_conversion.sol", + "is_dependency": false, + "lines": [ + 6 + ], + "starting_column": 18, + "ending_column": 24 + }, + "type_specific_fields": { + "parent": { + "type": "function", + "name": "bug", + "source_mapping": { + "start": 70, + "length": 69, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/enum-conversion/0.4.2/enum_conversion.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/enum-conversion/0.4.2/enum_conversion.sol", + "is_dependency": false, + "lines": [ + 6, + 7, + 8 + ], + "starting_column": 5, + "ending_column": 6 + }, + "type_specific_fields": { + "parent": { + "type": "contract", + "name": "Test", + "source_mapping": { + "start": 27, + "length": 114, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/enum-conversion/0.4.2/enum_conversion.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/enum-conversion/0.4.2/enum_conversion.sol", + "is_dependency": false, + "lines": [ + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10 + ], + "starting_column": 5, + "ending_column": 0 + } + }, + "signature": "bug(uint256)" + } + } + } + }, + { + "type": "node", + "name": "Test.E(a)", + "source_mapping": { + "start": 118, + "length": 11, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/enum-conversion/0.4.2/enum_conversion.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/enum-conversion/0.4.2/enum_conversion.sol", + "is_dependency": false, + "lines": [ + 7 + ], + "starting_column": 9, + "ending_column": 20 + }, + "type_specific_fields": { + "parent": { + "type": "function", + "name": "bug", + "source_mapping": { + "start": 70, + "length": 69, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/enum-conversion/0.4.2/enum_conversion.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/enum-conversion/0.4.2/enum_conversion.sol", + "is_dependency": false, + "lines": [ + 6, + 7, + 8 + ], + "starting_column": 5, + "ending_column": 6 + }, + "type_specific_fields": { + "parent": { + "type": "contract", + "name": "Test", + "source_mapping": { + "start": 27, + "length": 114, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/enum-conversion/0.4.2/enum_conversion.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/enum-conversion/0.4.2/enum_conversion.sol", + "is_dependency": false, + "lines": [ + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10 + ], + "starting_column": 5, + "ending_column": 0 + } + }, + "signature": "bug(uint256)" + } + } + } + } + ], + "description": "Test.E(a) (tests/detectors/enum-conversion/0.4.2/enum_conversion.sol#7) has a dangerous enum conversion\n\t- Variable: Test.bug(uint256).a (tests/detectors/enum-conversion/0.4.2/enum_conversion.sol#6) of type: uint256\n\t- Enum conversion: Test.E(a) (tests/detectors/enum-conversion/0.4.2/enum_conversion.sol#7)\n", + "markdown": "[Test.E(a)](tests/detectors/enum-conversion/0.4.2/enum_conversion.sol#L7) has a dangerous enum conversion\n\t- Variable: [Test.bug(uint256).a](tests/detectors/enum-conversion/0.4.2/enum_conversion.sol#L6) of type: uint256\n\t- Enum conversion: [Test.E(a)](tests/detectors/enum-conversion/0.4.2/enum_conversion.sol#L7)\n", + "first_markdown_element": "tests/detectors/enum-conversion/0.4.2/enum_conversion.sol#L7", + "id": "f16bcdd6943fe3ff7ed6cc9b729ed5f95f61375509c7cce6646efa44c69860b7", + "check": "enum-conversion", + "impact": "Medium", + "confidence": "High" + } + ] +] \ No newline at end of file diff --git a/tests/detectors/incorrect-shift/0.4.25/shift_parameter_mixup.sol b/tests/detectors/incorrect-shift/0.4.25/shift_parameter_mixup.sol new file mode 100644 index 000000000..89a9210ad --- /dev/null +++ b/tests/detectors/incorrect-shift/0.4.25/shift_parameter_mixup.sol @@ -0,0 +1,8 @@ +contract C { + + function f() internal returns (uint a) { + assembly { + a := shr(a, 8) + } + } +} \ No newline at end of file diff --git a/tests/detectors/incorrect-shift/0.4.25/shift_parameter_mixup.sol.0.4.25.ShiftParameterMixup.json b/tests/detectors/incorrect-shift/0.4.25/shift_parameter_mixup.sol.0.4.25.ShiftParameterMixup.json new file mode 100644 index 000000000..5825bcacc --- /dev/null +++ b/tests/detectors/incorrect-shift/0.4.25/shift_parameter_mixup.sol.0.4.25.ShiftParameterMixup.json @@ -0,0 +1,3 @@ +[ + [] +] \ No newline at end of file diff --git a/tests/detectors/incorrect-shift/0.5.16/shift_parameter_mixup.sol b/tests/detectors/incorrect-shift/0.5.16/shift_parameter_mixup.sol new file mode 100644 index 000000000..89a9210ad --- /dev/null +++ b/tests/detectors/incorrect-shift/0.5.16/shift_parameter_mixup.sol @@ -0,0 +1,8 @@ +contract C { + + function f() internal returns (uint a) { + assembly { + a := shr(a, 8) + } + } +} \ No newline at end of file diff --git a/tests/detectors/incorrect-shift/0.5.16/shift_parameter_mixup.sol.0.5.16.ShiftParameterMixup.json b/tests/detectors/incorrect-shift/0.5.16/shift_parameter_mixup.sol.0.5.16.ShiftParameterMixup.json new file mode 100644 index 000000000..5825bcacc --- /dev/null +++ b/tests/detectors/incorrect-shift/0.5.16/shift_parameter_mixup.sol.0.5.16.ShiftParameterMixup.json @@ -0,0 +1,3 @@ +[ + [] +] \ No newline at end of file diff --git a/tests/detectors/incorrect-shift/0.6.11/shift_parameter_mixup.sol b/tests/detectors/incorrect-shift/0.6.11/shift_parameter_mixup.sol new file mode 100644 index 000000000..89a9210ad --- /dev/null +++ b/tests/detectors/incorrect-shift/0.6.11/shift_parameter_mixup.sol @@ -0,0 +1,8 @@ +contract C { + + function f() internal returns (uint a) { + assembly { + a := shr(a, 8) + } + } +} \ No newline at end of file diff --git a/tests/detectors/incorrect-shift/0.6.11/shift_parameter_mixup.sol.0.6.11.ShiftParameterMixup.json b/tests/detectors/incorrect-shift/0.6.11/shift_parameter_mixup.sol.0.6.11.ShiftParameterMixup.json new file mode 100644 index 000000000..e6a1c784f --- /dev/null +++ b/tests/detectors/incorrect-shift/0.6.11/shift_parameter_mixup.sol.0.6.11.ShiftParameterMixup.json @@ -0,0 +1,135 @@ +[ + [ + { + "elements": [ + { + "type": "function", + "name": "f", + "source_mapping": { + "start": 19, + "length": 106, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/incorrect-shift/0.6.11/shift_parameter_mixup.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/incorrect-shift/0.6.11/shift_parameter_mixup.sol", + "is_dependency": false, + "lines": [ + 3, + 4, + 5, + 6, + 7 + ], + "starting_column": 5, + "ending_column": 6 + }, + "type_specific_fields": { + "parent": { + "type": "contract", + "name": "C", + "source_mapping": { + "start": 0, + "length": 128, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/incorrect-shift/0.6.11/shift_parameter_mixup.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/incorrect-shift/0.6.11/shift_parameter_mixup.sol", + "is_dependency": false, + "lines": [ + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8 + ], + "starting_column": 1, + "ending_column": 2 + } + }, + "signature": "f()" + } + }, + { + "type": "node", + "name": "a = 8 >> a", + "source_mapping": { + "start": 93, + "length": 14, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/incorrect-shift/0.6.11/shift_parameter_mixup.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/incorrect-shift/0.6.11/shift_parameter_mixup.sol", + "is_dependency": false, + "lines": [ + 5 + ], + "starting_column": 13, + "ending_column": 27 + }, + "type_specific_fields": { + "parent": { + "type": "function", + "name": "f", + "source_mapping": { + "start": 19, + "length": 106, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/incorrect-shift/0.6.11/shift_parameter_mixup.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/incorrect-shift/0.6.11/shift_parameter_mixup.sol", + "is_dependency": false, + "lines": [ + 3, + 4, + 5, + 6, + 7 + ], + "starting_column": 5, + "ending_column": 6 + }, + "type_specific_fields": { + "parent": { + "type": "contract", + "name": "C", + "source_mapping": { + "start": 0, + "length": 128, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/incorrect-shift/0.6.11/shift_parameter_mixup.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/incorrect-shift/0.6.11/shift_parameter_mixup.sol", + "is_dependency": false, + "lines": [ + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8 + ], + "starting_column": 1, + "ending_column": 2 + } + }, + "signature": "f()" + } + } + } + } + ], + "description": "C.f() (tests/detectors/incorrect-shift/0.6.11/shift_parameter_mixup.sol#3-7) contains an incorrect shift operation: a = 8 >> a (tests/detectors/incorrect-shift/0.6.11/shift_parameter_mixup.sol#5)\n", + "markdown": "[C.f()](tests/detectors/incorrect-shift/0.6.11/shift_parameter_mixup.sol#L3-L7) contains an incorrect shift operation: [a = 8 >> a](tests/detectors/incorrect-shift/0.6.11/shift_parameter_mixup.sol#L5)\n", + "first_markdown_element": "tests/detectors/incorrect-shift/0.6.11/shift_parameter_mixup.sol#L3-L7", + "id": "eefda017d078fd6c0cdb19b471ac8d0a96b2b3dba9bac04ac194270820a77301", + "check": "incorrect-shift", + "impact": "High", + "confidence": "High" + } + ] +] \ No newline at end of file diff --git a/tests/detectors/incorrect-shift/0.7.6/shift_parameter_mixup.sol b/tests/detectors/incorrect-shift/0.7.6/shift_parameter_mixup.sol new file mode 100644 index 000000000..89a9210ad --- /dev/null +++ b/tests/detectors/incorrect-shift/0.7.6/shift_parameter_mixup.sol @@ -0,0 +1,8 @@ +contract C { + + function f() internal returns (uint a) { + assembly { + a := shr(a, 8) + } + } +} \ No newline at end of file diff --git a/tests/detectors/incorrect-shift/0.7.6/shift_parameter_mixup.sol.0.7.6.ShiftParameterMixup.json b/tests/detectors/incorrect-shift/0.7.6/shift_parameter_mixup.sol.0.7.6.ShiftParameterMixup.json new file mode 100644 index 000000000..5960eb824 --- /dev/null +++ b/tests/detectors/incorrect-shift/0.7.6/shift_parameter_mixup.sol.0.7.6.ShiftParameterMixup.json @@ -0,0 +1,135 @@ +[ + [ + { + "elements": [ + { + "type": "function", + "name": "f", + "source_mapping": { + "start": 19, + "length": 106, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/incorrect-shift/0.7.6/shift_parameter_mixup.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/incorrect-shift/0.7.6/shift_parameter_mixup.sol", + "is_dependency": false, + "lines": [ + 3, + 4, + 5, + 6, + 7 + ], + "starting_column": 5, + "ending_column": 6 + }, + "type_specific_fields": { + "parent": { + "type": "contract", + "name": "C", + "source_mapping": { + "start": 0, + "length": 128, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/incorrect-shift/0.7.6/shift_parameter_mixup.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/incorrect-shift/0.7.6/shift_parameter_mixup.sol", + "is_dependency": false, + "lines": [ + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8 + ], + "starting_column": 1, + "ending_column": 2 + } + }, + "signature": "f()" + } + }, + { + "type": "node", + "name": "a = 8 >> a", + "source_mapping": { + "start": 93, + "length": 14, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/incorrect-shift/0.7.6/shift_parameter_mixup.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/incorrect-shift/0.7.6/shift_parameter_mixup.sol", + "is_dependency": false, + "lines": [ + 5 + ], + "starting_column": 13, + "ending_column": 27 + }, + "type_specific_fields": { + "parent": { + "type": "function", + "name": "f", + "source_mapping": { + "start": 19, + "length": 106, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/incorrect-shift/0.7.6/shift_parameter_mixup.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/incorrect-shift/0.7.6/shift_parameter_mixup.sol", + "is_dependency": false, + "lines": [ + 3, + 4, + 5, + 6, + 7 + ], + "starting_column": 5, + "ending_column": 6 + }, + "type_specific_fields": { + "parent": { + "type": "contract", + "name": "C", + "source_mapping": { + "start": 0, + "length": 128, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/incorrect-shift/0.7.6/shift_parameter_mixup.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/incorrect-shift/0.7.6/shift_parameter_mixup.sol", + "is_dependency": false, + "lines": [ + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8 + ], + "starting_column": 1, + "ending_column": 2 + } + }, + "signature": "f()" + } + } + } + } + ], + "description": "C.f() (tests/detectors/incorrect-shift/0.7.6/shift_parameter_mixup.sol#3-7) contains an incorrect shift operation: a = 8 >> a (tests/detectors/incorrect-shift/0.7.6/shift_parameter_mixup.sol#5)\n", + "markdown": "[C.f()](tests/detectors/incorrect-shift/0.7.6/shift_parameter_mixup.sol#L3-L7) contains an incorrect shift operation: [a = 8 >> a](tests/detectors/incorrect-shift/0.7.6/shift_parameter_mixup.sol#L5)\n", + "first_markdown_element": "tests/detectors/incorrect-shift/0.7.6/shift_parameter_mixup.sol#L3-L7", + "id": "8aa2292fd8d53a23f05aed92384dde452ea1f879d2422c4726b75a79a5aa6f81", + "check": "incorrect-shift", + "impact": "High", + "confidence": "High" + } + ] +] \ No newline at end of file diff --git a/tests/detectors/missing-inheritance/0.4.25/unimplemented_interface.sol b/tests/detectors/missing-inheritance/0.4.25/unimplemented_interface.sol new file mode 100644 index 000000000..58149d329 --- /dev/null +++ b/tests/detectors/missing-inheritance/0.4.25/unimplemented_interface.sol @@ -0,0 +1,9 @@ +interface ISomething { + function f1() external returns(uint); +} + +contract Something { + function f1() external returns(uint){ + return 42; + } +} \ No newline at end of file diff --git a/tests/detectors/missing-inheritance/0.4.25/unimplemented_interface.sol.0.4.25.MissingInheritance.json b/tests/detectors/missing-inheritance/0.4.25/unimplemented_interface.sol.0.4.25.MissingInheritance.json new file mode 100644 index 000000000..bb52cfa9b --- /dev/null +++ b/tests/detectors/missing-inheritance/0.4.25/unimplemented_interface.sol.0.4.25.MissingInheritance.json @@ -0,0 +1,58 @@ +[ + [ + { + "elements": [ + { + "type": "contract", + "name": "Something", + "source_mapping": { + "start": 68, + "length": 89, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/missing-inheritance/0.4.25/unimplemented_interface.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/missing-inheritance/0.4.25/unimplemented_interface.sol", + "is_dependency": false, + "lines": [ + 5, + 6, + 7, + 8, + 9, + 10 + ], + "starting_column": 1, + "ending_column": 0 + } + }, + { + "type": "contract", + "name": "ISomething", + "source_mapping": { + "start": 0, + "length": 66, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/missing-inheritance/0.4.25/unimplemented_interface.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/missing-inheritance/0.4.25/unimplemented_interface.sol", + "is_dependency": false, + "lines": [ + 1, + 2, + 3 + ], + "starting_column": 1, + "ending_column": 2 + } + } + ], + "description": "Something (tests/detectors/missing-inheritance/0.4.25/unimplemented_interface.sol#5-10) should inherit from ISomething (tests/detectors/missing-inheritance/0.4.25/unimplemented_interface.sol#1-3)\n", + "markdown": "[Something](tests/detectors/missing-inheritance/0.4.25/unimplemented_interface.sol#L5-L10) should inherit from [ISomething](tests/detectors/missing-inheritance/0.4.25/unimplemented_interface.sol#L1-L3)\n", + "first_markdown_element": "tests/detectors/missing-inheritance/0.4.25/unimplemented_interface.sol#L5-L10", + "id": "58962dc72a6c49524a027e8e1615ab92be30f1a0f5ef0eb4a029204687159649", + "check": "missing-inheritance", + "impact": "Informational", + "confidence": "High" + } + ] +] \ No newline at end of file diff --git a/tests/detectors/missing-inheritance/0.5.16/unimplemented_interface.sol b/tests/detectors/missing-inheritance/0.5.16/unimplemented_interface.sol new file mode 100644 index 000000000..58149d329 --- /dev/null +++ b/tests/detectors/missing-inheritance/0.5.16/unimplemented_interface.sol @@ -0,0 +1,9 @@ +interface ISomething { + function f1() external returns(uint); +} + +contract Something { + function f1() external returns(uint){ + return 42; + } +} \ No newline at end of file diff --git a/tests/detectors/missing-inheritance/0.5.16/unimplemented_interface.sol.0.5.16.MissingInheritance.json b/tests/detectors/missing-inheritance/0.5.16/unimplemented_interface.sol.0.5.16.MissingInheritance.json new file mode 100644 index 000000000..4dc27f5b5 --- /dev/null +++ b/tests/detectors/missing-inheritance/0.5.16/unimplemented_interface.sol.0.5.16.MissingInheritance.json @@ -0,0 +1,58 @@ +[ + [ + { + "elements": [ + { + "type": "contract", + "name": "Something", + "source_mapping": { + "start": 68, + "length": 89, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/missing-inheritance/0.5.16/unimplemented_interface.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/missing-inheritance/0.5.16/unimplemented_interface.sol", + "is_dependency": false, + "lines": [ + 5, + 6, + 7, + 8, + 9, + 10 + ], + "starting_column": 1, + "ending_column": 0 + } + }, + { + "type": "contract", + "name": "ISomething", + "source_mapping": { + "start": 0, + "length": 66, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/missing-inheritance/0.5.16/unimplemented_interface.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/missing-inheritance/0.5.16/unimplemented_interface.sol", + "is_dependency": false, + "lines": [ + 1, + 2, + 3 + ], + "starting_column": 1, + "ending_column": 2 + } + } + ], + "description": "Something (tests/detectors/missing-inheritance/0.5.16/unimplemented_interface.sol#5-10) should inherit from ISomething (tests/detectors/missing-inheritance/0.5.16/unimplemented_interface.sol#1-3)\n", + "markdown": "[Something](tests/detectors/missing-inheritance/0.5.16/unimplemented_interface.sol#L5-L10) should inherit from [ISomething](tests/detectors/missing-inheritance/0.5.16/unimplemented_interface.sol#L1-L3)\n", + "first_markdown_element": "tests/detectors/missing-inheritance/0.5.16/unimplemented_interface.sol#L5-L10", + "id": "58962dc72a6c49524a027e8e1615ab92be30f1a0f5ef0eb4a029204687159649", + "check": "missing-inheritance", + "impact": "Informational", + "confidence": "High" + } + ] +] \ No newline at end of file diff --git a/tests/detectors/missing-inheritance/0.6.11/unimplemented_interface.sol b/tests/detectors/missing-inheritance/0.6.11/unimplemented_interface.sol new file mode 100644 index 000000000..58149d329 --- /dev/null +++ b/tests/detectors/missing-inheritance/0.6.11/unimplemented_interface.sol @@ -0,0 +1,9 @@ +interface ISomething { + function f1() external returns(uint); +} + +contract Something { + function f1() external returns(uint){ + return 42; + } +} \ No newline at end of file diff --git a/tests/detectors/missing-inheritance/0.6.11/unimplemented_interface.sol.0.6.11.MissingInheritance.json b/tests/detectors/missing-inheritance/0.6.11/unimplemented_interface.sol.0.6.11.MissingInheritance.json new file mode 100644 index 000000000..800114e0c --- /dev/null +++ b/tests/detectors/missing-inheritance/0.6.11/unimplemented_interface.sol.0.6.11.MissingInheritance.json @@ -0,0 +1,58 @@ +[ + [ + { + "elements": [ + { + "type": "contract", + "name": "Something", + "source_mapping": { + "start": 68, + "length": 89, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/missing-inheritance/0.6.11/unimplemented_interface.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/missing-inheritance/0.6.11/unimplemented_interface.sol", + "is_dependency": false, + "lines": [ + 5, + 6, + 7, + 8, + 9, + 10 + ], + "starting_column": 1, + "ending_column": 0 + } + }, + { + "type": "contract", + "name": "ISomething", + "source_mapping": { + "start": 0, + "length": 66, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/missing-inheritance/0.6.11/unimplemented_interface.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/missing-inheritance/0.6.11/unimplemented_interface.sol", + "is_dependency": false, + "lines": [ + 1, + 2, + 3 + ], + "starting_column": 1, + "ending_column": 2 + } + } + ], + "description": "Something (tests/detectors/missing-inheritance/0.6.11/unimplemented_interface.sol#5-10) should inherit from ISomething (tests/detectors/missing-inheritance/0.6.11/unimplemented_interface.sol#1-3)\n", + "markdown": "[Something](tests/detectors/missing-inheritance/0.6.11/unimplemented_interface.sol#L5-L10) should inherit from [ISomething](tests/detectors/missing-inheritance/0.6.11/unimplemented_interface.sol#L1-L3)\n", + "first_markdown_element": "tests/detectors/missing-inheritance/0.6.11/unimplemented_interface.sol#L5-L10", + "id": "58962dc72a6c49524a027e8e1615ab92be30f1a0f5ef0eb4a029204687159649", + "check": "missing-inheritance", + "impact": "Informational", + "confidence": "High" + } + ] +] \ No newline at end of file diff --git a/tests/detectors/missing-inheritance/0.7.6/unimplemented_interface.sol b/tests/detectors/missing-inheritance/0.7.6/unimplemented_interface.sol new file mode 100644 index 000000000..58149d329 --- /dev/null +++ b/tests/detectors/missing-inheritance/0.7.6/unimplemented_interface.sol @@ -0,0 +1,9 @@ +interface ISomething { + function f1() external returns(uint); +} + +contract Something { + function f1() external returns(uint){ + return 42; + } +} \ No newline at end of file diff --git a/tests/detectors/missing-inheritance/0.7.6/unimplemented_interface.sol.0.7.6.MissingInheritance.json b/tests/detectors/missing-inheritance/0.7.6/unimplemented_interface.sol.0.7.6.MissingInheritance.json new file mode 100644 index 000000000..7746c4a37 --- /dev/null +++ b/tests/detectors/missing-inheritance/0.7.6/unimplemented_interface.sol.0.7.6.MissingInheritance.json @@ -0,0 +1,58 @@ +[ + [ + { + "elements": [ + { + "type": "contract", + "name": "Something", + "source_mapping": { + "start": 68, + "length": 89, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/missing-inheritance/0.7.6/unimplemented_interface.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/missing-inheritance/0.7.6/unimplemented_interface.sol", + "is_dependency": false, + "lines": [ + 5, + 6, + 7, + 8, + 9, + 10 + ], + "starting_column": 1, + "ending_column": 0 + } + }, + { + "type": "contract", + "name": "ISomething", + "source_mapping": { + "start": 0, + "length": 66, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/missing-inheritance/0.7.6/unimplemented_interface.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/missing-inheritance/0.7.6/unimplemented_interface.sol", + "is_dependency": false, + "lines": [ + 1, + 2, + 3 + ], + "starting_column": 1, + "ending_column": 2 + } + } + ], + "description": "Something (tests/detectors/missing-inheritance/0.7.6/unimplemented_interface.sol#5-10) should inherit from ISomething (tests/detectors/missing-inheritance/0.7.6/unimplemented_interface.sol#1-3)\n", + "markdown": "[Something](tests/detectors/missing-inheritance/0.7.6/unimplemented_interface.sol#L5-L10) should inherit from [ISomething](tests/detectors/missing-inheritance/0.7.6/unimplemented_interface.sol#L1-L3)\n", + "first_markdown_element": "tests/detectors/missing-inheritance/0.7.6/unimplemented_interface.sol#L5-L10", + "id": "58962dc72a6c49524a027e8e1615ab92be30f1a0f5ef0eb4a029204687159649", + "check": "missing-inheritance", + "impact": "Informational", + "confidence": "High" + } + ] +] \ No newline at end of file diff --git a/tests/detectors/multiple-constructors/0.4.22/multiple_constructor_schemes.sol b/tests/detectors/multiple-constructors/0.4.22/multiple_constructor_schemes.sol new file mode 100644 index 000000000..3703d71e5 --- /dev/null +++ b/tests/detectors/multiple-constructors/0.4.22/multiple_constructor_schemes.sol @@ -0,0 +1,13 @@ +contract A { + uint x; + constructor() public { + x = 0; + } + function A() public { + x = 1; + } + + function test() public returns(uint) { + return x; + } +} \ No newline at end of file diff --git a/tests/detectors/multiple-constructors/0.4.22/multiple_constructor_schemes.sol.0.4.22.MultipleConstructorSchemes.json b/tests/detectors/multiple-constructors/0.4.22/multiple_constructor_schemes.sol.0.4.22.MultipleConstructorSchemes.json new file mode 100644 index 000000000..cf72d53fb --- /dev/null +++ b/tests/detectors/multiple-constructors/0.4.22/multiple_constructor_schemes.sol.0.4.22.MultipleConstructorSchemes.json @@ -0,0 +1,154 @@ +[ + [ + { + "elements": [ + { + "type": "contract", + "name": "A", + "source_mapping": { + "start": 0, + "length": 193, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/multiple-constructors/0.4.22/multiple_constructor_schemes.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/multiple-constructors/0.4.22/multiple_constructor_schemes.sol", + "is_dependency": false, + "lines": [ + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10, + 11, + 12, + 13, + 14 + ], + "starting_column": 1, + "ending_column": 0 + } + }, + { + "type": "function", + "name": "constructor", + "source_mapping": { + "start": 29, + "length": 43, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/multiple-constructors/0.4.22/multiple_constructor_schemes.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/multiple-constructors/0.4.22/multiple_constructor_schemes.sol", + "is_dependency": false, + "lines": [ + 3, + 4, + 5 + ], + "starting_column": 5, + "ending_column": 6 + }, + "type_specific_fields": { + "parent": { + "type": "contract", + "name": "A", + "source_mapping": { + "start": 0, + "length": 193, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/multiple-constructors/0.4.22/multiple_constructor_schemes.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/multiple-constructors/0.4.22/multiple_constructor_schemes.sol", + "is_dependency": false, + "lines": [ + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10, + 11, + 12, + 13, + 14 + ], + "starting_column": 1, + "ending_column": 0 + } + }, + "signature": "constructor()" + } + }, + { + "type": "function", + "name": "A", + "source_mapping": { + "start": 77, + "length": 42, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/multiple-constructors/0.4.22/multiple_constructor_schemes.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/multiple-constructors/0.4.22/multiple_constructor_schemes.sol", + "is_dependency": false, + "lines": [ + 6, + 7, + 8 + ], + "starting_column": 5, + "ending_column": 6 + }, + "type_specific_fields": { + "parent": { + "type": "contract", + "name": "A", + "source_mapping": { + "start": 0, + "length": 193, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/multiple-constructors/0.4.22/multiple_constructor_schemes.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/multiple-constructors/0.4.22/multiple_constructor_schemes.sol", + "is_dependency": false, + "lines": [ + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10, + 11, + 12, + 13, + 14 + ], + "starting_column": 1, + "ending_column": 0 + } + }, + "signature": "A()" + } + } + ], + "description": "A (tests/detectors/multiple-constructors/0.4.22/multiple_constructor_schemes.sol#1-14) contains multiple constructors in the same contract:\n\t- A.constructor() (tests/detectors/multiple-constructors/0.4.22/multiple_constructor_schemes.sol#3-5)\n\t- A.A() (tests/detectors/multiple-constructors/0.4.22/multiple_constructor_schemes.sol#6-8)\n", + "markdown": "[A](tests/detectors/multiple-constructors/0.4.22/multiple_constructor_schemes.sol#L1-L14) contains multiple constructors in the same contract:\n\t- [A.constructor()](tests/detectors/multiple-constructors/0.4.22/multiple_constructor_schemes.sol#L3-L5)\n\t- [A.A()](tests/detectors/multiple-constructors/0.4.22/multiple_constructor_schemes.sol#L6-L8)\n", + "first_markdown_element": "tests/detectors/multiple-constructors/0.4.22/multiple_constructor_schemes.sol#L1-L14", + "id": "704cdb1c05e919913c22befaf077b9585bc75e31b5033fa46c930ad82dc6852e", + "check": "multiple-constructors", + "impact": "High", + "confidence": "High" + } + ] +] \ No newline at end of file diff --git a/tests/detectors/similar-names/0.4.25/similar_variables.sol b/tests/detectors/similar-names/0.4.25/similar_variables.sol new file mode 100644 index 000000000..57f969867 --- /dev/null +++ b/tests/detectors/similar-names/0.4.25/similar_variables.sol @@ -0,0 +1,7 @@ +contract Similar { + function f() public returns (uint) { + uint testVariable = 1; + uint textVariable = 2; + return testVariable + textVariable; + } +} \ No newline at end of file diff --git a/tests/detectors/similar-names/0.4.25/similar_variables.sol.0.4.25.SimilarVarsDetection.json b/tests/detectors/similar-names/0.4.25/similar_variables.sol.0.4.25.SimilarVarsDetection.json new file mode 100644 index 000000000..3393d1d06 --- /dev/null +++ b/tests/detectors/similar-names/0.4.25/similar_variables.sol.0.4.25.SimilarVarsDetection.json @@ -0,0 +1,155 @@ +[ + [ + { + "elements": [ + { + "type": "variable", + "name": "testVariable", + "source_mapping": { + "start": 69, + "length": 21, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/similar-names/0.4.25/similar_variables.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/similar-names/0.4.25/similar_variables.sol", + "is_dependency": false, + "lines": [ + 3 + ], + "starting_column": 9, + "ending_column": 30 + }, + "type_specific_fields": { + "parent": { + "type": "function", + "name": "f", + "source_mapping": { + "start": 23, + "length": 149, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/similar-names/0.4.25/similar_variables.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/similar-names/0.4.25/similar_variables.sol", + "is_dependency": false, + "lines": [ + 2, + 3, + 4, + 5, + 6 + ], + "starting_column": 5, + "ending_column": 6 + }, + "type_specific_fields": { + "parent": { + "type": "contract", + "name": "Similar", + "source_mapping": { + "start": 0, + "length": 174, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/similar-names/0.4.25/similar_variables.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/similar-names/0.4.25/similar_variables.sol", + "is_dependency": false, + "lines": [ + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8 + ], + "starting_column": 1, + "ending_column": 0 + } + }, + "signature": "f()" + } + } + } + }, + { + "type": "variable", + "name": "textVariable", + "source_mapping": { + "start": 100, + "length": 21, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/similar-names/0.4.25/similar_variables.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/similar-names/0.4.25/similar_variables.sol", + "is_dependency": false, + "lines": [ + 4 + ], + "starting_column": 9, + "ending_column": 30 + }, + "type_specific_fields": { + "parent": { + "type": "function", + "name": "f", + "source_mapping": { + "start": 23, + "length": 149, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/similar-names/0.4.25/similar_variables.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/similar-names/0.4.25/similar_variables.sol", + "is_dependency": false, + "lines": [ + 2, + 3, + 4, + 5, + 6 + ], + "starting_column": 5, + "ending_column": 6 + }, + "type_specific_fields": { + "parent": { + "type": "contract", + "name": "Similar", + "source_mapping": { + "start": 0, + "length": 174, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/similar-names/0.4.25/similar_variables.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/similar-names/0.4.25/similar_variables.sol", + "is_dependency": false, + "lines": [ + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8 + ], + "starting_column": 1, + "ending_column": 0 + } + }, + "signature": "f()" + } + } + } + } + ], + "description": "Variable Similar.f().testVariable (tests/detectors/similar-names/0.4.25/similar_variables.sol#3) is too similar to Similar.f().textVariable (tests/detectors/similar-names/0.4.25/similar_variables.sol#4)\n", + "markdown": "Variable [Similar.f().testVariable](tests/detectors/similar-names/0.4.25/similar_variables.sol#L3) is too similar to [Similar.f().textVariable](tests/detectors/similar-names/0.4.25/similar_variables.sol#L4)\n", + "first_markdown_element": "tests/detectors/similar-names/0.4.25/similar_variables.sol#L3", + "id": "2f767a2bb6f48a8435ce456e2d3ad859bdeccf66507735a14e20515e914038d5", + "check": "similar-names", + "impact": "Informational", + "confidence": "Medium" + } + ] +] \ No newline at end of file diff --git a/tests/detectors/similar-names/0.5.16/similar_variables.sol b/tests/detectors/similar-names/0.5.16/similar_variables.sol new file mode 100644 index 000000000..57f969867 --- /dev/null +++ b/tests/detectors/similar-names/0.5.16/similar_variables.sol @@ -0,0 +1,7 @@ +contract Similar { + function f() public returns (uint) { + uint testVariable = 1; + uint textVariable = 2; + return testVariable + textVariable; + } +} \ No newline at end of file diff --git a/tests/detectors/similar-names/0.5.16/similar_variables.sol.0.5.16.SimilarVarsDetection.json b/tests/detectors/similar-names/0.5.16/similar_variables.sol.0.5.16.SimilarVarsDetection.json new file mode 100644 index 000000000..543023e43 --- /dev/null +++ b/tests/detectors/similar-names/0.5.16/similar_variables.sol.0.5.16.SimilarVarsDetection.json @@ -0,0 +1,155 @@ +[ + [ + { + "elements": [ + { + "type": "variable", + "name": "testVariable", + "source_mapping": { + "start": 69, + "length": 21, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/similar-names/0.5.16/similar_variables.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/similar-names/0.5.16/similar_variables.sol", + "is_dependency": false, + "lines": [ + 3 + ], + "starting_column": 9, + "ending_column": 30 + }, + "type_specific_fields": { + "parent": { + "type": "function", + "name": "f", + "source_mapping": { + "start": 23, + "length": 149, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/similar-names/0.5.16/similar_variables.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/similar-names/0.5.16/similar_variables.sol", + "is_dependency": false, + "lines": [ + 2, + 3, + 4, + 5, + 6 + ], + "starting_column": 5, + "ending_column": 6 + }, + "type_specific_fields": { + "parent": { + "type": "contract", + "name": "Similar", + "source_mapping": { + "start": 0, + "length": 174, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/similar-names/0.5.16/similar_variables.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/similar-names/0.5.16/similar_variables.sol", + "is_dependency": false, + "lines": [ + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8 + ], + "starting_column": 1, + "ending_column": 0 + } + }, + "signature": "f()" + } + } + } + }, + { + "type": "variable", + "name": "textVariable", + "source_mapping": { + "start": 100, + "length": 21, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/similar-names/0.5.16/similar_variables.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/similar-names/0.5.16/similar_variables.sol", + "is_dependency": false, + "lines": [ + 4 + ], + "starting_column": 9, + "ending_column": 30 + }, + "type_specific_fields": { + "parent": { + "type": "function", + "name": "f", + "source_mapping": { + "start": 23, + "length": 149, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/similar-names/0.5.16/similar_variables.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/similar-names/0.5.16/similar_variables.sol", + "is_dependency": false, + "lines": [ + 2, + 3, + 4, + 5, + 6 + ], + "starting_column": 5, + "ending_column": 6 + }, + "type_specific_fields": { + "parent": { + "type": "contract", + "name": "Similar", + "source_mapping": { + "start": 0, + "length": 174, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/similar-names/0.5.16/similar_variables.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/similar-names/0.5.16/similar_variables.sol", + "is_dependency": false, + "lines": [ + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8 + ], + "starting_column": 1, + "ending_column": 0 + } + }, + "signature": "f()" + } + } + } + } + ], + "description": "Variable Similar.f().testVariable (tests/detectors/similar-names/0.5.16/similar_variables.sol#3) is too similar to Similar.f().textVariable (tests/detectors/similar-names/0.5.16/similar_variables.sol#4)\n", + "markdown": "Variable [Similar.f().testVariable](tests/detectors/similar-names/0.5.16/similar_variables.sol#L3) is too similar to [Similar.f().textVariable](tests/detectors/similar-names/0.5.16/similar_variables.sol#L4)\n", + "first_markdown_element": "tests/detectors/similar-names/0.5.16/similar_variables.sol#L3", + "id": "2f767a2bb6f48a8435ce456e2d3ad859bdeccf66507735a14e20515e914038d5", + "check": "similar-names", + "impact": "Informational", + "confidence": "Medium" + } + ] +] \ No newline at end of file diff --git a/tests/detectors/similar-names/0.6.11/similar_variables.sol b/tests/detectors/similar-names/0.6.11/similar_variables.sol new file mode 100644 index 000000000..57f969867 --- /dev/null +++ b/tests/detectors/similar-names/0.6.11/similar_variables.sol @@ -0,0 +1,7 @@ +contract Similar { + function f() public returns (uint) { + uint testVariable = 1; + uint textVariable = 2; + return testVariable + textVariable; + } +} \ No newline at end of file diff --git a/tests/detectors/similar-names/0.6.11/similar_variables.sol.0.6.11.SimilarVarsDetection.json b/tests/detectors/similar-names/0.6.11/similar_variables.sol.0.6.11.SimilarVarsDetection.json new file mode 100644 index 000000000..89aa1e5dc --- /dev/null +++ b/tests/detectors/similar-names/0.6.11/similar_variables.sol.0.6.11.SimilarVarsDetection.json @@ -0,0 +1,155 @@ +[ + [ + { + "elements": [ + { + "type": "variable", + "name": "testVariable", + "source_mapping": { + "start": 69, + "length": 21, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/similar-names/0.6.11/similar_variables.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/similar-names/0.6.11/similar_variables.sol", + "is_dependency": false, + "lines": [ + 3 + ], + "starting_column": 9, + "ending_column": 30 + }, + "type_specific_fields": { + "parent": { + "type": "function", + "name": "f", + "source_mapping": { + "start": 23, + "length": 149, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/similar-names/0.6.11/similar_variables.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/similar-names/0.6.11/similar_variables.sol", + "is_dependency": false, + "lines": [ + 2, + 3, + 4, + 5, + 6 + ], + "starting_column": 5, + "ending_column": 6 + }, + "type_specific_fields": { + "parent": { + "type": "contract", + "name": "Similar", + "source_mapping": { + "start": 0, + "length": 174, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/similar-names/0.6.11/similar_variables.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/similar-names/0.6.11/similar_variables.sol", + "is_dependency": false, + "lines": [ + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8 + ], + "starting_column": 1, + "ending_column": 0 + } + }, + "signature": "f()" + } + } + } + }, + { + "type": "variable", + "name": "textVariable", + "source_mapping": { + "start": 100, + "length": 21, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/similar-names/0.6.11/similar_variables.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/similar-names/0.6.11/similar_variables.sol", + "is_dependency": false, + "lines": [ + 4 + ], + "starting_column": 9, + "ending_column": 30 + }, + "type_specific_fields": { + "parent": { + "type": "function", + "name": "f", + "source_mapping": { + "start": 23, + "length": 149, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/similar-names/0.6.11/similar_variables.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/similar-names/0.6.11/similar_variables.sol", + "is_dependency": false, + "lines": [ + 2, + 3, + 4, + 5, + 6 + ], + "starting_column": 5, + "ending_column": 6 + }, + "type_specific_fields": { + "parent": { + "type": "contract", + "name": "Similar", + "source_mapping": { + "start": 0, + "length": 174, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/similar-names/0.6.11/similar_variables.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/similar-names/0.6.11/similar_variables.sol", + "is_dependency": false, + "lines": [ + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8 + ], + "starting_column": 1, + "ending_column": 0 + } + }, + "signature": "f()" + } + } + } + } + ], + "description": "Variable Similar.f().testVariable (tests/detectors/similar-names/0.6.11/similar_variables.sol#3) is too similar to Similar.f().textVariable (tests/detectors/similar-names/0.6.11/similar_variables.sol#4)\n", + "markdown": "Variable [Similar.f().testVariable](tests/detectors/similar-names/0.6.11/similar_variables.sol#L3) is too similar to [Similar.f().textVariable](tests/detectors/similar-names/0.6.11/similar_variables.sol#L4)\n", + "first_markdown_element": "tests/detectors/similar-names/0.6.11/similar_variables.sol#L3", + "id": "2f767a2bb6f48a8435ce456e2d3ad859bdeccf66507735a14e20515e914038d5", + "check": "similar-names", + "impact": "Informational", + "confidence": "Medium" + } + ] +] \ No newline at end of file diff --git a/tests/detectors/similar-names/0.7.6/similar_variables.sol b/tests/detectors/similar-names/0.7.6/similar_variables.sol new file mode 100644 index 000000000..57f969867 --- /dev/null +++ b/tests/detectors/similar-names/0.7.6/similar_variables.sol @@ -0,0 +1,7 @@ +contract Similar { + function f() public returns (uint) { + uint testVariable = 1; + uint textVariable = 2; + return testVariable + textVariable; + } +} \ No newline at end of file diff --git a/tests/detectors/similar-names/0.7.6/similar_variables.sol.0.7.6.SimilarVarsDetection.json b/tests/detectors/similar-names/0.7.6/similar_variables.sol.0.7.6.SimilarVarsDetection.json new file mode 100644 index 000000000..dd05b4133 --- /dev/null +++ b/tests/detectors/similar-names/0.7.6/similar_variables.sol.0.7.6.SimilarVarsDetection.json @@ -0,0 +1,155 @@ +[ + [ + { + "elements": [ + { + "type": "variable", + "name": "testVariable", + "source_mapping": { + "start": 69, + "length": 21, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/similar-names/0.7.6/similar_variables.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/similar-names/0.7.6/similar_variables.sol", + "is_dependency": false, + "lines": [ + 3 + ], + "starting_column": 9, + "ending_column": 30 + }, + "type_specific_fields": { + "parent": { + "type": "function", + "name": "f", + "source_mapping": { + "start": 23, + "length": 149, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/similar-names/0.7.6/similar_variables.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/similar-names/0.7.6/similar_variables.sol", + "is_dependency": false, + "lines": [ + 2, + 3, + 4, + 5, + 6 + ], + "starting_column": 5, + "ending_column": 6 + }, + "type_specific_fields": { + "parent": { + "type": "contract", + "name": "Similar", + "source_mapping": { + "start": 0, + "length": 174, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/similar-names/0.7.6/similar_variables.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/similar-names/0.7.6/similar_variables.sol", + "is_dependency": false, + "lines": [ + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8 + ], + "starting_column": 1, + "ending_column": 0 + } + }, + "signature": "f()" + } + } + } + }, + { + "type": "variable", + "name": "textVariable", + "source_mapping": { + "start": 100, + "length": 21, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/similar-names/0.7.6/similar_variables.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/similar-names/0.7.6/similar_variables.sol", + "is_dependency": false, + "lines": [ + 4 + ], + "starting_column": 9, + "ending_column": 30 + }, + "type_specific_fields": { + "parent": { + "type": "function", + "name": "f", + "source_mapping": { + "start": 23, + "length": 149, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/similar-names/0.7.6/similar_variables.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/similar-names/0.7.6/similar_variables.sol", + "is_dependency": false, + "lines": [ + 2, + 3, + 4, + 5, + 6 + ], + "starting_column": 5, + "ending_column": 6 + }, + "type_specific_fields": { + "parent": { + "type": "contract", + "name": "Similar", + "source_mapping": { + "start": 0, + "length": 174, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/similar-names/0.7.6/similar_variables.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/similar-names/0.7.6/similar_variables.sol", + "is_dependency": false, + "lines": [ + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8 + ], + "starting_column": 1, + "ending_column": 0 + } + }, + "signature": "f()" + } + } + } + } + ], + "description": "Variable Similar.f().testVariable (tests/detectors/similar-names/0.7.6/similar_variables.sol#3) is too similar to Similar.f().textVariable (tests/detectors/similar-names/0.7.6/similar_variables.sol#4)\n", + "markdown": "Variable [Similar.f().testVariable](tests/detectors/similar-names/0.7.6/similar_variables.sol#L3) is too similar to [Similar.f().textVariable](tests/detectors/similar-names/0.7.6/similar_variables.sol#L4)\n", + "first_markdown_element": "tests/detectors/similar-names/0.7.6/similar_variables.sol#L3", + "id": "2f767a2bb6f48a8435ce456e2d3ad859bdeccf66507735a14e20515e914038d5", + "check": "similar-names", + "impact": "Informational", + "confidence": "Medium" + } + ] +] \ No newline at end of file diff --git a/tests/detectors/tautology/0.4.25/type_based_tautology.sol b/tests/detectors/tautology/0.4.25/type_based_tautology.sol new file mode 100644 index 000000000..cfd3997c6 --- /dev/null +++ b/tests/detectors/tautology/0.4.25/type_based_tautology.sol @@ -0,0 +1,12 @@ +contract A { + function f(uint x) public returns (uint) { + if (x >= 0) { // bad -- always true + return 1; + } + return 7; + } + + function g(uint8 y) public returns (bool) { + return (y < 512); // bad! + } +} \ No newline at end of file diff --git a/tests/detectors/tautology/0.4.25/type_based_tautology.sol.0.4.25.TypeBasedTautology.json b/tests/detectors/tautology/0.4.25/type_based_tautology.sol.0.4.25.TypeBasedTautology.json new file mode 100644 index 000000000..1592c496c --- /dev/null +++ b/tests/detectors/tautology/0.4.25/type_based_tautology.sol.0.4.25.TypeBasedTautology.json @@ -0,0 +1,284 @@ +[ + [ + { + "elements": [ + { + "type": "function", + "name": "f", + "source_mapping": { + "start": 14, + "length": 133, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/tautology/0.4.25/type_based_tautology.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/tautology/0.4.25/type_based_tautology.sol", + "is_dependency": false, + "lines": [ + 2, + 3, + 4, + 5, + 6, + 7 + ], + "starting_column": 2, + "ending_column": 3 + }, + "type_specific_fields": { + "parent": { + "type": "contract", + "name": "A", + "source_mapping": { + "start": 0, + "length": 232, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/tautology/0.4.25/type_based_tautology.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/tautology/0.4.25/type_based_tautology.sol", + "is_dependency": false, + "lines": [ + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10, + 11, + 12, + 13 + ], + "starting_column": 1, + "ending_column": 0 + } + }, + "signature": "f(uint256)" + } + }, + { + "type": "node", + "name": "x >= 0", + "source_mapping": { + "start": 69, + "length": 6, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/tautology/0.4.25/type_based_tautology.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/tautology/0.4.25/type_based_tautology.sol", + "is_dependency": false, + "lines": [ + 3 + ], + "starting_column": 13, + "ending_column": 19 + }, + "type_specific_fields": { + "parent": { + "type": "function", + "name": "f", + "source_mapping": { + "start": 14, + "length": 133, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/tautology/0.4.25/type_based_tautology.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/tautology/0.4.25/type_based_tautology.sol", + "is_dependency": false, + "lines": [ + 2, + 3, + 4, + 5, + 6, + 7 + ], + "starting_column": 2, + "ending_column": 3 + }, + "type_specific_fields": { + "parent": { + "type": "contract", + "name": "A", + "source_mapping": { + "start": 0, + "length": 232, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/tautology/0.4.25/type_based_tautology.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/tautology/0.4.25/type_based_tautology.sol", + "is_dependency": false, + "lines": [ + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10, + 11, + 12, + 13 + ], + "starting_column": 1, + "ending_column": 0 + } + }, + "signature": "f(uint256)" + } + } + } + } + ], + "description": "A.f(uint256) (tests/detectors/tautology/0.4.25/type_based_tautology.sol#2-7) contains a tautology or contradiction:\n\t- x >= 0 (tests/detectors/tautology/0.4.25/type_based_tautology.sol#3)\n", + "markdown": "[A.f(uint256)](tests/detectors/tautology/0.4.25/type_based_tautology.sol#L2-L7) contains a tautology or contradiction:\n\t- [x >= 0](tests/detectors/tautology/0.4.25/type_based_tautology.sol#L3)\n", + "first_markdown_element": "tests/detectors/tautology/0.4.25/type_based_tautology.sol#L2-L7", + "id": "c9b8085dbb7e6d0dfc2ee5711ac45a70e4c0f494ac4efcae42a6b947e3170ddb", + "check": "tautology", + "impact": "Medium", + "confidence": "High" + }, + { + "elements": [ + { + "type": "function", + "name": "g", + "source_mapping": { + "start": 150, + "length": 80, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/tautology/0.4.25/type_based_tautology.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/tautology/0.4.25/type_based_tautology.sol", + "is_dependency": false, + "lines": [ + 9, + 10, + 11 + ], + "starting_column": 2, + "ending_column": 3 + }, + "type_specific_fields": { + "parent": { + "type": "contract", + "name": "A", + "source_mapping": { + "start": 0, + "length": 232, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/tautology/0.4.25/type_based_tautology.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/tautology/0.4.25/type_based_tautology.sol", + "is_dependency": false, + "lines": [ + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10, + 11, + 12, + 13 + ], + "starting_column": 1, + "ending_column": 0 + } + }, + "signature": "g(uint8)" + } + }, + { + "type": "node", + "name": "(y < 512)", + "source_mapping": { + "start": 202, + "length": 16, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/tautology/0.4.25/type_based_tautology.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/tautology/0.4.25/type_based_tautology.sol", + "is_dependency": false, + "lines": [ + 10 + ], + "starting_column": 9, + "ending_column": 25 + }, + "type_specific_fields": { + "parent": { + "type": "function", + "name": "g", + "source_mapping": { + "start": 150, + "length": 80, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/tautology/0.4.25/type_based_tautology.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/tautology/0.4.25/type_based_tautology.sol", + "is_dependency": false, + "lines": [ + 9, + 10, + 11 + ], + "starting_column": 2, + "ending_column": 3 + }, + "type_specific_fields": { + "parent": { + "type": "contract", + "name": "A", + "source_mapping": { + "start": 0, + "length": 232, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/tautology/0.4.25/type_based_tautology.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/tautology/0.4.25/type_based_tautology.sol", + "is_dependency": false, + "lines": [ + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10, + 11, + 12, + 13 + ], + "starting_column": 1, + "ending_column": 0 + } + }, + "signature": "g(uint8)" + } + } + } + } + ], + "description": "A.g(uint8) (tests/detectors/tautology/0.4.25/type_based_tautology.sol#9-11) contains a tautology or contradiction:\n\t- (y < 512) (tests/detectors/tautology/0.4.25/type_based_tautology.sol#10)\n", + "markdown": "[A.g(uint8)](tests/detectors/tautology/0.4.25/type_based_tautology.sol#L9-L11) contains a tautology or contradiction:\n\t- [(y < 512)](tests/detectors/tautology/0.4.25/type_based_tautology.sol#L10)\n", + "first_markdown_element": "tests/detectors/tautology/0.4.25/type_based_tautology.sol#L9-L11", + "id": "75dfe0b8776a8cf490a4e3f30366dec173fd0dc7418335f77c68ba5bca536382", + "check": "tautology", + "impact": "Medium", + "confidence": "High" + } + ] +] \ No newline at end of file diff --git a/tests/detectors/tautology/0.5.16/type_based_tautology.sol b/tests/detectors/tautology/0.5.16/type_based_tautology.sol new file mode 100644 index 000000000..cfd3997c6 --- /dev/null +++ b/tests/detectors/tautology/0.5.16/type_based_tautology.sol @@ -0,0 +1,12 @@ +contract A { + function f(uint x) public returns (uint) { + if (x >= 0) { // bad -- always true + return 1; + } + return 7; + } + + function g(uint8 y) public returns (bool) { + return (y < 512); // bad! + } +} \ No newline at end of file diff --git a/tests/detectors/tautology/0.5.16/type_based_tautology.sol.0.5.16.TypeBasedTautology.json b/tests/detectors/tautology/0.5.16/type_based_tautology.sol.0.5.16.TypeBasedTautology.json new file mode 100644 index 000000000..2b347f0e8 --- /dev/null +++ b/tests/detectors/tautology/0.5.16/type_based_tautology.sol.0.5.16.TypeBasedTautology.json @@ -0,0 +1,284 @@ +[ + [ + { + "elements": [ + { + "type": "function", + "name": "f", + "source_mapping": { + "start": 14, + "length": 133, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/tautology/0.5.16/type_based_tautology.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/tautology/0.5.16/type_based_tautology.sol", + "is_dependency": false, + "lines": [ + 2, + 3, + 4, + 5, + 6, + 7 + ], + "starting_column": 2, + "ending_column": 3 + }, + "type_specific_fields": { + "parent": { + "type": "contract", + "name": "A", + "source_mapping": { + "start": 0, + "length": 232, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/tautology/0.5.16/type_based_tautology.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/tautology/0.5.16/type_based_tautology.sol", + "is_dependency": false, + "lines": [ + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10, + 11, + 12, + 13 + ], + "starting_column": 1, + "ending_column": 0 + } + }, + "signature": "f(uint256)" + } + }, + { + "type": "node", + "name": "x >= 0", + "source_mapping": { + "start": 69, + "length": 6, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/tautology/0.5.16/type_based_tautology.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/tautology/0.5.16/type_based_tautology.sol", + "is_dependency": false, + "lines": [ + 3 + ], + "starting_column": 13, + "ending_column": 19 + }, + "type_specific_fields": { + "parent": { + "type": "function", + "name": "f", + "source_mapping": { + "start": 14, + "length": 133, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/tautology/0.5.16/type_based_tautology.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/tautology/0.5.16/type_based_tautology.sol", + "is_dependency": false, + "lines": [ + 2, + 3, + 4, + 5, + 6, + 7 + ], + "starting_column": 2, + "ending_column": 3 + }, + "type_specific_fields": { + "parent": { + "type": "contract", + "name": "A", + "source_mapping": { + "start": 0, + "length": 232, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/tautology/0.5.16/type_based_tautology.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/tautology/0.5.16/type_based_tautology.sol", + "is_dependency": false, + "lines": [ + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10, + 11, + 12, + 13 + ], + "starting_column": 1, + "ending_column": 0 + } + }, + "signature": "f(uint256)" + } + } + } + } + ], + "description": "A.f(uint256) (tests/detectors/tautology/0.5.16/type_based_tautology.sol#2-7) contains a tautology or contradiction:\n\t- x >= 0 (tests/detectors/tautology/0.5.16/type_based_tautology.sol#3)\n", + "markdown": "[A.f(uint256)](tests/detectors/tautology/0.5.16/type_based_tautology.sol#L2-L7) contains a tautology or contradiction:\n\t- [x >= 0](tests/detectors/tautology/0.5.16/type_based_tautology.sol#L3)\n", + "first_markdown_element": "tests/detectors/tautology/0.5.16/type_based_tautology.sol#L2-L7", + "id": "764eb2c7aa5cd1a30d16deb620e0dc3b8a9e9170978908bcc1f6fc1ac5a8daa1", + "check": "tautology", + "impact": "Medium", + "confidence": "High" + }, + { + "elements": [ + { + "type": "function", + "name": "g", + "source_mapping": { + "start": 150, + "length": 80, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/tautology/0.5.16/type_based_tautology.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/tautology/0.5.16/type_based_tautology.sol", + "is_dependency": false, + "lines": [ + 9, + 10, + 11 + ], + "starting_column": 2, + "ending_column": 3 + }, + "type_specific_fields": { + "parent": { + "type": "contract", + "name": "A", + "source_mapping": { + "start": 0, + "length": 232, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/tautology/0.5.16/type_based_tautology.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/tautology/0.5.16/type_based_tautology.sol", + "is_dependency": false, + "lines": [ + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10, + 11, + 12, + 13 + ], + "starting_column": 1, + "ending_column": 0 + } + }, + "signature": "g(uint8)" + } + }, + { + "type": "node", + "name": "(y < 512)", + "source_mapping": { + "start": 202, + "length": 16, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/tautology/0.5.16/type_based_tautology.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/tautology/0.5.16/type_based_tautology.sol", + "is_dependency": false, + "lines": [ + 10 + ], + "starting_column": 9, + "ending_column": 25 + }, + "type_specific_fields": { + "parent": { + "type": "function", + "name": "g", + "source_mapping": { + "start": 150, + "length": 80, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/tautology/0.5.16/type_based_tautology.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/tautology/0.5.16/type_based_tautology.sol", + "is_dependency": false, + "lines": [ + 9, + 10, + 11 + ], + "starting_column": 2, + "ending_column": 3 + }, + "type_specific_fields": { + "parent": { + "type": "contract", + "name": "A", + "source_mapping": { + "start": 0, + "length": 232, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/tautology/0.5.16/type_based_tautology.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/tautology/0.5.16/type_based_tautology.sol", + "is_dependency": false, + "lines": [ + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10, + 11, + 12, + 13 + ], + "starting_column": 1, + "ending_column": 0 + } + }, + "signature": "g(uint8)" + } + } + } + } + ], + "description": "A.g(uint8) (tests/detectors/tautology/0.5.16/type_based_tautology.sol#9-11) contains a tautology or contradiction:\n\t- (y < 512) (tests/detectors/tautology/0.5.16/type_based_tautology.sol#10)\n", + "markdown": "[A.g(uint8)](tests/detectors/tautology/0.5.16/type_based_tautology.sol#L9-L11) contains a tautology or contradiction:\n\t- [(y < 512)](tests/detectors/tautology/0.5.16/type_based_tautology.sol#L10)\n", + "first_markdown_element": "tests/detectors/tautology/0.5.16/type_based_tautology.sol#L9-L11", + "id": "0c29aa92764cb30104a4c4ba02e307d5949143b4cbfa2d8a52d9473140907872", + "check": "tautology", + "impact": "Medium", + "confidence": "High" + } + ] +] \ No newline at end of file diff --git a/tests/detectors/tautology/0.6.11/type_based_tautology.sol b/tests/detectors/tautology/0.6.11/type_based_tautology.sol new file mode 100644 index 000000000..cfd3997c6 --- /dev/null +++ b/tests/detectors/tautology/0.6.11/type_based_tautology.sol @@ -0,0 +1,12 @@ +contract A { + function f(uint x) public returns (uint) { + if (x >= 0) { // bad -- always true + return 1; + } + return 7; + } + + function g(uint8 y) public returns (bool) { + return (y < 512); // bad! + } +} \ No newline at end of file diff --git a/tests/detectors/tautology/0.6.11/type_based_tautology.sol.0.6.11.TypeBasedTautology.json b/tests/detectors/tautology/0.6.11/type_based_tautology.sol.0.6.11.TypeBasedTautology.json new file mode 100644 index 000000000..971033eae --- /dev/null +++ b/tests/detectors/tautology/0.6.11/type_based_tautology.sol.0.6.11.TypeBasedTautology.json @@ -0,0 +1,284 @@ +[ + [ + { + "elements": [ + { + "type": "function", + "name": "f", + "source_mapping": { + "start": 14, + "length": 133, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/tautology/0.6.11/type_based_tautology.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/tautology/0.6.11/type_based_tautology.sol", + "is_dependency": false, + "lines": [ + 2, + 3, + 4, + 5, + 6, + 7 + ], + "starting_column": 2, + "ending_column": 3 + }, + "type_specific_fields": { + "parent": { + "type": "contract", + "name": "A", + "source_mapping": { + "start": 0, + "length": 232, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/tautology/0.6.11/type_based_tautology.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/tautology/0.6.11/type_based_tautology.sol", + "is_dependency": false, + "lines": [ + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10, + 11, + 12, + 13 + ], + "starting_column": 1, + "ending_column": 0 + } + }, + "signature": "f(uint256)" + } + }, + { + "type": "node", + "name": "x >= 0", + "source_mapping": { + "start": 69, + "length": 6, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/tautology/0.6.11/type_based_tautology.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/tautology/0.6.11/type_based_tautology.sol", + "is_dependency": false, + "lines": [ + 3 + ], + "starting_column": 13, + "ending_column": 19 + }, + "type_specific_fields": { + "parent": { + "type": "function", + "name": "f", + "source_mapping": { + "start": 14, + "length": 133, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/tautology/0.6.11/type_based_tautology.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/tautology/0.6.11/type_based_tautology.sol", + "is_dependency": false, + "lines": [ + 2, + 3, + 4, + 5, + 6, + 7 + ], + "starting_column": 2, + "ending_column": 3 + }, + "type_specific_fields": { + "parent": { + "type": "contract", + "name": "A", + "source_mapping": { + "start": 0, + "length": 232, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/tautology/0.6.11/type_based_tautology.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/tautology/0.6.11/type_based_tautology.sol", + "is_dependency": false, + "lines": [ + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10, + 11, + 12, + 13 + ], + "starting_column": 1, + "ending_column": 0 + } + }, + "signature": "f(uint256)" + } + } + } + } + ], + "description": "A.f(uint256) (tests/detectors/tautology/0.6.11/type_based_tautology.sol#2-7) contains a tautology or contradiction:\n\t- x >= 0 (tests/detectors/tautology/0.6.11/type_based_tautology.sol#3)\n", + "markdown": "[A.f(uint256)](tests/detectors/tautology/0.6.11/type_based_tautology.sol#L2-L7) contains a tautology or contradiction:\n\t- [x >= 0](tests/detectors/tautology/0.6.11/type_based_tautology.sol#L3)\n", + "first_markdown_element": "tests/detectors/tautology/0.6.11/type_based_tautology.sol#L2-L7", + "id": "fec3df769045cbe4984e50b2f651f60ffc36b116bc7273a64f761e8fbfc674b9", + "check": "tautology", + "impact": "Medium", + "confidence": "High" + }, + { + "elements": [ + { + "type": "function", + "name": "g", + "source_mapping": { + "start": 150, + "length": 80, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/tautology/0.6.11/type_based_tautology.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/tautology/0.6.11/type_based_tautology.sol", + "is_dependency": false, + "lines": [ + 9, + 10, + 11 + ], + "starting_column": 2, + "ending_column": 3 + }, + "type_specific_fields": { + "parent": { + "type": "contract", + "name": "A", + "source_mapping": { + "start": 0, + "length": 232, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/tautology/0.6.11/type_based_tautology.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/tautology/0.6.11/type_based_tautology.sol", + "is_dependency": false, + "lines": [ + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10, + 11, + 12, + 13 + ], + "starting_column": 1, + "ending_column": 0 + } + }, + "signature": "g(uint8)" + } + }, + { + "type": "node", + "name": "(y < 512)", + "source_mapping": { + "start": 202, + "length": 16, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/tautology/0.6.11/type_based_tautology.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/tautology/0.6.11/type_based_tautology.sol", + "is_dependency": false, + "lines": [ + 10 + ], + "starting_column": 9, + "ending_column": 25 + }, + "type_specific_fields": { + "parent": { + "type": "function", + "name": "g", + "source_mapping": { + "start": 150, + "length": 80, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/tautology/0.6.11/type_based_tautology.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/tautology/0.6.11/type_based_tautology.sol", + "is_dependency": false, + "lines": [ + 9, + 10, + 11 + ], + "starting_column": 2, + "ending_column": 3 + }, + "type_specific_fields": { + "parent": { + "type": "contract", + "name": "A", + "source_mapping": { + "start": 0, + "length": 232, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/tautology/0.6.11/type_based_tautology.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/tautology/0.6.11/type_based_tautology.sol", + "is_dependency": false, + "lines": [ + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10, + 11, + 12, + 13 + ], + "starting_column": 1, + "ending_column": 0 + } + }, + "signature": "g(uint8)" + } + } + } + } + ], + "description": "A.g(uint8) (tests/detectors/tautology/0.6.11/type_based_tautology.sol#9-11) contains a tautology or contradiction:\n\t- (y < 512) (tests/detectors/tautology/0.6.11/type_based_tautology.sol#10)\n", + "markdown": "[A.g(uint8)](tests/detectors/tautology/0.6.11/type_based_tautology.sol#L9-L11) contains a tautology or contradiction:\n\t- [(y < 512)](tests/detectors/tautology/0.6.11/type_based_tautology.sol#L10)\n", + "first_markdown_element": "tests/detectors/tautology/0.6.11/type_based_tautology.sol#L9-L11", + "id": "51bc777574da16aab9aefb9d0294fdad9ef3a44136e9e7b1f7e05cfd9c1d4e54", + "check": "tautology", + "impact": "Medium", + "confidence": "High" + } + ] +] \ No newline at end of file diff --git a/tests/detectors/tautology/0.7.6/type_based_tautology.sol b/tests/detectors/tautology/0.7.6/type_based_tautology.sol new file mode 100644 index 000000000..cfd3997c6 --- /dev/null +++ b/tests/detectors/tautology/0.7.6/type_based_tautology.sol @@ -0,0 +1,12 @@ +contract A { + function f(uint x) public returns (uint) { + if (x >= 0) { // bad -- always true + return 1; + } + return 7; + } + + function g(uint8 y) public returns (bool) { + return (y < 512); // bad! + } +} \ No newline at end of file diff --git a/tests/detectors/tautology/0.7.6/type_based_tautology.sol.0.7.6.TypeBasedTautology.json b/tests/detectors/tautology/0.7.6/type_based_tautology.sol.0.7.6.TypeBasedTautology.json new file mode 100644 index 000000000..633bbaa05 --- /dev/null +++ b/tests/detectors/tautology/0.7.6/type_based_tautology.sol.0.7.6.TypeBasedTautology.json @@ -0,0 +1,284 @@ +[ + [ + { + "elements": [ + { + "type": "function", + "name": "f", + "source_mapping": { + "start": 14, + "length": 133, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/tautology/0.7.6/type_based_tautology.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/tautology/0.7.6/type_based_tautology.sol", + "is_dependency": false, + "lines": [ + 2, + 3, + 4, + 5, + 6, + 7 + ], + "starting_column": 2, + "ending_column": 3 + }, + "type_specific_fields": { + "parent": { + "type": "contract", + "name": "A", + "source_mapping": { + "start": 0, + "length": 232, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/tautology/0.7.6/type_based_tautology.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/tautology/0.7.6/type_based_tautology.sol", + "is_dependency": false, + "lines": [ + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10, + 11, + 12, + 13 + ], + "starting_column": 1, + "ending_column": 0 + } + }, + "signature": "f(uint256)" + } + }, + { + "type": "node", + "name": "x >= 0", + "source_mapping": { + "start": 69, + "length": 6, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/tautology/0.7.6/type_based_tautology.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/tautology/0.7.6/type_based_tautology.sol", + "is_dependency": false, + "lines": [ + 3 + ], + "starting_column": 13, + "ending_column": 19 + }, + "type_specific_fields": { + "parent": { + "type": "function", + "name": "f", + "source_mapping": { + "start": 14, + "length": 133, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/tautology/0.7.6/type_based_tautology.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/tautology/0.7.6/type_based_tautology.sol", + "is_dependency": false, + "lines": [ + 2, + 3, + 4, + 5, + 6, + 7 + ], + "starting_column": 2, + "ending_column": 3 + }, + "type_specific_fields": { + "parent": { + "type": "contract", + "name": "A", + "source_mapping": { + "start": 0, + "length": 232, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/tautology/0.7.6/type_based_tautology.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/tautology/0.7.6/type_based_tautology.sol", + "is_dependency": false, + "lines": [ + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10, + 11, + 12, + 13 + ], + "starting_column": 1, + "ending_column": 0 + } + }, + "signature": "f(uint256)" + } + } + } + } + ], + "description": "A.f(uint256) (tests/detectors/tautology/0.7.6/type_based_tautology.sol#2-7) contains a tautology or contradiction:\n\t- x >= 0 (tests/detectors/tautology/0.7.6/type_based_tautology.sol#3)\n", + "markdown": "[A.f(uint256)](tests/detectors/tautology/0.7.6/type_based_tautology.sol#L2-L7) contains a tautology or contradiction:\n\t- [x >= 0](tests/detectors/tautology/0.7.6/type_based_tautology.sol#L3)\n", + "first_markdown_element": "tests/detectors/tautology/0.7.6/type_based_tautology.sol#L2-L7", + "id": "e444c1c7287bff97cae3505472d10d8ef5e01aa1f2e7660c81a3beb11eeaea0e", + "check": "tautology", + "impact": "Medium", + "confidence": "High" + }, + { + "elements": [ + { + "type": "function", + "name": "g", + "source_mapping": { + "start": 150, + "length": 80, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/tautology/0.7.6/type_based_tautology.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/tautology/0.7.6/type_based_tautology.sol", + "is_dependency": false, + "lines": [ + 9, + 10, + 11 + ], + "starting_column": 2, + "ending_column": 3 + }, + "type_specific_fields": { + "parent": { + "type": "contract", + "name": "A", + "source_mapping": { + "start": 0, + "length": 232, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/tautology/0.7.6/type_based_tautology.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/tautology/0.7.6/type_based_tautology.sol", + "is_dependency": false, + "lines": [ + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10, + 11, + 12, + 13 + ], + "starting_column": 1, + "ending_column": 0 + } + }, + "signature": "g(uint8)" + } + }, + { + "type": "node", + "name": "(y < 512)", + "source_mapping": { + "start": 202, + "length": 16, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/tautology/0.7.6/type_based_tautology.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/tautology/0.7.6/type_based_tautology.sol", + "is_dependency": false, + "lines": [ + 10 + ], + "starting_column": 9, + "ending_column": 25 + }, + "type_specific_fields": { + "parent": { + "type": "function", + "name": "g", + "source_mapping": { + "start": 150, + "length": 80, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/tautology/0.7.6/type_based_tautology.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/tautology/0.7.6/type_based_tautology.sol", + "is_dependency": false, + "lines": [ + 9, + 10, + 11 + ], + "starting_column": 2, + "ending_column": 3 + }, + "type_specific_fields": { + "parent": { + "type": "contract", + "name": "A", + "source_mapping": { + "start": 0, + "length": 232, + "filename_used": "/GENERIC_PATH", + "filename_relative": "tests/detectors/tautology/0.7.6/type_based_tautology.sol", + "filename_absolute": "/GENERIC_PATH", + "filename_short": "tests/detectors/tautology/0.7.6/type_based_tautology.sol", + "is_dependency": false, + "lines": [ + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10, + 11, + 12, + 13 + ], + "starting_column": 1, + "ending_column": 0 + } + }, + "signature": "g(uint8)" + } + } + } + } + ], + "description": "A.g(uint8) (tests/detectors/tautology/0.7.6/type_based_tautology.sol#9-11) contains a tautology or contradiction:\n\t- (y < 512) (tests/detectors/tautology/0.7.6/type_based_tautology.sol#10)\n", + "markdown": "[A.g(uint8)](tests/detectors/tautology/0.7.6/type_based_tautology.sol#L9-L11) contains a tautology or contradiction:\n\t- [(y < 512)](tests/detectors/tautology/0.7.6/type_based_tautology.sol#L10)\n", + "first_markdown_element": "tests/detectors/tautology/0.7.6/type_based_tautology.sol#L9-L11", + "id": "036b1ecab6ee0dcb07806dbd8ffb05abf29941bbbcbb161da0013b31be51b3de", + "check": "tautology", + "impact": "Medium", + "confidence": "High" + } + ] +] \ No newline at end of file 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..79ffe9eba 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,10 +141,10 @@ } } ], - "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", + "id": "d85b90230632a30f7ffb5140a791d4a9ae8b0be045c5b27175f3c477e189c08c", "check": "unprotected-upgrade", "impact": "High", "confidence": "High" 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..d4f2addd9 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,10 +141,10 @@ } } ], - "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", + "id": "d85b90230632a30f7ffb5140a791d4a9ae8b0be045c5b27175f3c477e189c08c", "check": "unprotected-upgrade", "impact": "High", "confidence": "High" 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..0f46e3a9a 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,10 +141,10 @@ } } ], - "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", + "id": "d85b90230632a30f7ffb5140a791d4a9ae8b0be045c5b27175f3c477e189c08c", "check": "unprotected-upgrade", "impact": "High", "confidence": "High" 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..c101b3fc9 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,10 +141,10 @@ } } ], - "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", + "id": "d85b90230632a30f7ffb5140a791d4a9ae8b0be045c5b27175f3c477e189c08c", "check": "unprotected-upgrade", "impact": "High", "confidence": "High" diff --git a/tests/slithir/ternary_expressions.sol b/tests/slithir/ternary_expressions.sol new file mode 100644 index 000000000..c2e50b719 --- /dev/null +++ b/tests/slithir/ternary_expressions.sol @@ -0,0 +1,24 @@ +contract C { + // TODO + // 1) support variable declarations + //uint min = 1 > 0 ? 1 : 2; + // 2) suppory ternary index range access + // function e(bool cond, bytes calldata x) external { + // bytes memory a = x[cond ? 1 : 2 :]; + // } + function a(uint a, uint b) external { + (uint min, uint max) = a < b ? (a, b) : (b, a); + } + function b( address a, address b) external { + (address tokenA, address tokenB) = a < b ? (a, b) : (b, a); + } + + bytes char; + function c(bytes memory strAddress, uint i, uint padding, uint length) external { + char[0] = strAddress[i < padding + 2 ? i : 42 + i - length]; + } + + function d(bool cond, bytes calldata x) external { + bytes1 a = x[cond ? 1 : 2]; + } +} diff --git a/tests/slithir/test_ternary_expressions.py b/tests/slithir/test_ternary_expressions.py new file mode 100644 index 000000000..db5658787 --- /dev/null +++ b/tests/slithir/test_ternary_expressions.py @@ -0,0 +1,38 @@ +from slither import Slither +from slither.core.cfg.node import NodeType +from slither.slithir.operations import Assignment +from slither.core.expressions import AssignmentOperation, TupleExpression + +# pylint: disable=too-many-nested-blocks +def test_ternary_conversions() -> None: + """This tests that true and false sons define the same number of variables that the father node declares""" + slither = Slither("./tests/slithir/ternary_expressions.sol") + for contract in slither.contracts: + for function in contract.functions: + for node in function.nodes: + if node.type in [NodeType.IF, NodeType.IFLOOP]: + vars_declared = 0 + vars_assigned = 0 + + # Iterate over true and false son + for inner_node in node.sons: + # Count all variables declared + expression = inner_node.expression + if isinstance(expression, AssignmentOperation): + var_expr = expression.expression_left + # Only tuples declare more than one var + if isinstance(var_expr, TupleExpression): + vars_declared += len(var_expr.expressions) + else: + vars_declared += 1 + + for ir in inner_node.irs: + # Count all variables defined + if isinstance(ir, Assignment): + vars_assigned += 1 + + assert vars_declared == vars_assigned + + +if __name__ == "__main__": + test_ternary_conversions() diff --git a/tests/storage-layout/StorageLayout.abi b/tests/storage-layout/StorageLayout.abi new file mode 100644 index 000000000..a60ca0661 --- /dev/null +++ b/tests/storage-layout/StorageLayout.abi @@ -0,0 +1 @@ +[{"inputs":[],"name":"store","outputs":[],"stateMutability":"nonpayable","type":"function"}] \ No newline at end of file diff --git a/tests/storage-layout/StorageLayout.bin b/tests/storage-layout/StorageLayout.bin new file mode 100644 index 000000000..11163c2f0 --- /dev/null +++ b/tests/storage-layout/StorageLayout.bin @@ -0,0 +1 @@ +608060405260016000806101000a8154817effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff02191690837effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff16021790555060016000601f6101000a81548160ff02191690831515021790555060405180604001604052806000601f9054906101000a900460ff161515815260200160008054906101000a90047effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff167effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff16815250600160008201518160000160006101000a81548160ff02191690831515021790555060208201518160000160016101000a8154817effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff02191690837effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff16021790555050506040518060400160405280601481526020017f736c69746865722d726561642d73746f7261676500000000000000000000000081525060079080519060200190620001b6929190620002b2565b5060088060006101000a81548160ff021916908360ff1602179055507f6161616161616161000000000000000000000000000000000000000000000000600860016101000a81548167ffffffffffffffff021916908360c01c02179055506000600860096101000a81548160ff021916908360028111156200023d576200023c62000362565b5b021790555060016008600a6101000a81548160ff021916908360028111156200026b576200026a62000362565b5b021790555060026008600b6101000a81548160ff0219169083600281111562000299576200029862000362565b5b0217905550348015620002ab57600080fd5b50620003f6565b828054620002c090620003c0565b90600052602060002090601f016020900481019282620002e4576000855562000330565b82601f10620002ff57805160ff191683800117855562000330565b8280016001018555821562000330579182015b828111156200032f57825182559160200191906001019062000312565b5b5090506200033f919062000343565b5090565b5b808211156200035e57600081600090555060010162000344565b5090565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b60006002820490506001821680620003d957607f821691505b60208210811415620003f057620003ef62000391565b5b50919050565b610fd780620004066000396000f3fe608060405234801561001057600080fd5b506004361061002b5760003560e01c8063975057e714610030575b600080fd5b61003861003a565b005b600073ffffffffffffffffffffffffffffffffffffffff16600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461009557600080fd5b33600660006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506001600260008060009054906101000a90047effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff167effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000820160009054906101000a900460ff168160000160006101000a81548160ff0219169083151502179055506000820160019054906101000a90047effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff168160000160016101000a8154817effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff02191690837effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff160217905550905050600160036000600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008060009054906101000a90047effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff167effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000820160009054906101000a900460ff168160000160006101000a81548160ff0219169083151502179055506000820160019054906101000a90047effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff168160000160016101000a8154817effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff02191690837effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff160217905550905050600160046000600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006001815260200190815260200160002060006101000a81548160ff021916908315150217905550600160046000600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006002815260200190815260200160002060006101000a81548160ff0219169083151502179055506040518060600160405280600160ff168152602001600260ff168152602001600360ff1681525060099060036104b8929190610ddd565b50600c600990806001815401808255809150506001900390600052602060002090600302016000909190919091509060036104f4929190610e22565b50600c6040518060600160405280600460ff168152602001600560ff168152602001600660ff168152509080600181540180825580915050600190039060005260206000209060030201600090919091909150906003610555929190610ddd565b50600d60006003811061056b5761056a610f72565b5b0160079080600181540180825580915050600190039060005260206000200160009091909190915055600d6001600381106105a9576105a8610f72565b5b0160089080600181540180825580915050600190039060005260206000200160009091909190915055600d6001600381106105e7576105e6610f72565b5b0160099080600181540180825580915050600190039060005260206000200160009091909190915055600d60026003811061062557610624610f72565b5b01600a9080600181540180825580915050600190039060005260206000200160009091909190915055600d60026003811061066357610662610f72565b5b01600b9080600181540180825580915050600190039060005260206000200160009091909190915055600d6002600381106106a1576106a0610f72565b5b01600c908060018154018082558091505060019003906000526020600020016000909190919091505560106040518060200160405280600d60ff1681525090806001815401808255809150506001900390600052602060002001600090919091909150906001610712929190610e5f565b5060106040518060400160405280600e60ff168152602001600f60ff1681525090806001815401808255809150506001900390600052602060002001600090919091909150906002610765929190610eb1565b5060106040518060600160405280601060ff168152602001601160ff168152602001601260ff16815250908060018154018082558091505060019003906000526020600020016000909190919091509060036107c2929190610f03565b5060116001908060018154018082558091505060019003906000526020600020016000909190919091506000820160009054906101000a900460ff168160000160006101000a81548160ff0219169083151502179055506000820160019054906101000a90047effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff168160000160016101000a8154817effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff02191690837effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff160217905550505060116040518060400160405280600015158152602001600a7effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff168152509080600181540180825580915050600190039060005260206000200160009091909190915060008201518160000160006101000a81548160ff02191690831515021790555060208201518160000160016101000a8154817effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff02191690837effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff16021790555050506001601260006003811061099a57610999610f72565b5b016000820160009054906101000a900460ff168160000160006101000a81548160ff0219169083151502179055506000820160019054906101000a90047effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff168160000160016101000a8154817effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff02191690837effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1602179055509050506040518060400160405280600015158152602001600a7effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff168152506012600160038110610aa257610aa1610f72565b5b0160008201518160000160006101000a81548160ff02191690831515021790555060208201518160000160016101000a8154817effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff02191690837effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff16021790555090505060056000600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206011600081548110610b9957610b98610f72565b5b90600052602060002001908060018154018082558091505060019003906000526020600020016000909190919091506000820160009054906101000a900460ff168160000160006101000a81548160ff0219169083151502179055506000820160019054906101000a90047effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff168160000160016101000a8154817effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff02191690837effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff160217905550505060056000600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206011600181548110610cf557610cf4610f72565b5b90600052602060002001908060018154018082558091505060019003906000526020600020016000909190919091506000820160009054906101000a900460ff168160000160006101000a81548160ff0219169083151502179055506000820160019054906101000a90047effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff168160000160016101000a8154817effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff02191690837effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1602179055505050565b8260038101928215610e11579160200282015b82811115610e10578251829060ff16905591602001919060010190610df0565b5b509050610e1e9190610f55565b5090565b8260038101928215610e4e579182015b82811115610e4d578254825591600101919060010190610e32565b5b509050610e5b9190610f55565b5090565b828054828255906000526020600020908101928215610ea0579160200282015b82811115610e9f578251829060ff16905591602001919060010190610e7f565b5b509050610ead9190610f55565b5090565b828054828255906000526020600020908101928215610ef2579160200282015b82811115610ef1578251829060ff16905591602001919060010190610ed1565b5b509050610eff9190610f55565b5090565b828054828255906000526020600020908101928215610f44579160200282015b82811115610f43578251829060ff16905591602001919060010190610f23565b5b509050610f519190610f55565b5090565b5b80821115610f6e576000816000905550600101610f56565b5090565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fdfea26469706673582212201cafaf685feba709fe5b26911b38f3251b1d43d43cec2d0d839fb6ff480488d164736f6c634300080a0033 \ No newline at end of file diff --git a/tests/storage-layout/TEST_storage_layout.json b/tests/storage-layout/TEST_storage_layout.json new file mode 100644 index 000000000..e981b1782 --- /dev/null +++ b/tests/storage-layout/TEST_storage_layout.json @@ -0,0 +1,469 @@ +{ + "packedUint": { + "type_string": "uint248", + "slot": 0, + "size": 248, + "offset": 0, + "value": 1 + }, + "packedBool": { + "type_string": "bool", + "slot": 0, + "size": 8, + "offset": 248, + "value": true + }, + "_packedStruct": { + "type_string": "StorageLayout.PackedStruct", + "slot": 1, + "size": 256, + "offset": 0, + "elems": { + "b": { + "type_string": "bool", + "slot": 1, + "size": 8, + "offset": 0, + "value": true + }, + "a": { + "type_string": "uint248", + "slot": 1, + "size": 248, + "offset": 8, + "value": 1 + } + }, + "value": "0000000000000000000000000000000000000000000000000000000000000101" + }, + "mappingPackedStruct": { + "type_string": "mapping(uint256 => StorageLayout.PackedStruct)", + "slot": 2, + "size": 256, + "offset": 0, + "value": 0 + }, + "deepMappingPackedStruct": { + "type_string": "mapping(address => mapping(uint256 => StorageLayout.PackedStruct))", + "slot": 3, + "size": 256, + "offset": 0, + "value": 0 + }, + "deepMappingElementaryTypes": { + "type_string": "mapping(address => mapping(uint256 => bool))", + "slot": 4, + "size": 256, + "offset": 0, + "value": 0 + }, + "mappingDynamicArrayOfStructs": { + "type_string": "mapping(address => StorageLayout.PackedStruct[])", + "slot": 5, + "size": 256, + "offset": 0, + "value": 0 + }, + "_address": { + "type_string": "address", + "slot": 6, + "size": 160, + "offset": 0, + "value": "0xae17D2dD99e07CA3bF2571CCAcEAA9e2Aefc2Dc6" + }, + "_string": { + "type_string": "string", + "slot": 7, + "size": 256, + "offset": 0, + "value": "slither-read-storage" + }, + "packedUint8": { + "type_string": "uint8", + "slot": 8, + "size": 8, + "offset": 0, + "value": 8 + }, + "packedBytes": { + "type_string": "bytes8", + "slot": 8, + "size": 64, + "offset": 8, + "value": "6161616161616161" + }, + "_enumA": { + "type_string": "StorageLayout.Enum", + "slot": 8, + "size": 8, + "offset": 72, + "value": "00" + }, + "_enumB": { + "type_string": "StorageLayout.Enum", + "slot": 8, + "size": 8, + "offset": 80, + "value": "01" + }, + "_enumC": { + "type_string": "StorageLayout.Enum", + "slot": 8, + "size": 8, + "offset": 88, + "value": "02" + }, + "fixedArray": { + "type_string": "uint256[3]", + "slot": 9, + "size": 768, + "offset": 0, + "elems": { + "0": { + "type_string": "uint256", + "slot": 9, + "size": 256, + "offset": 0, + "value": 1 + }, + "1": { + "type_string": "uint256", + "slot": 10, + "size": 256, + "offset": 0, + "value": 2 + }, + "2": { + "type_string": "uint256", + "slot": 11, + "size": 256, + "offset": 0, + "value": 3 + } + }, + "value": 1 + }, + "dynamicArrayOfFixedArrays": { + "type_string": "uint256[3][]", + "slot": 12, + "size": 256, + "offset": 0, + "elems": { + "0": { + "type_string": "uint256", + "slot": 101051993584849178915136821395265346177868384823507754984078593667947067386055, + "size": 256, + "offset": 0, + "elems": { + "0": { + "type_string": "uint256", + "slot": 101051993584849178915136821395265346177868384823507754984078593667947067386055, + "size": 256, + "offset": 0, + "value": 1 + }, + "1": { + "type_string": "uint256", + "slot": 101051993584849178915136821395265346177868384823507754984078593667947067386056, + "size": 256, + "offset": 0, + "value": 2 + }, + "2": { + "type_string": "uint256", + "slot": 101051993584849178915136821395265346177868384823507754984078593667947067386057, + "size": 256, + "offset": 0, + "value": 3 + } + }, + "value": 1 + }, + "1": { + "type_string": "uint256", + "slot": 101051993584849178915136821395265346177868384823507754984078593667947067386058, + "size": 256, + "offset": 0, + "elems": { + "0": { + "type_string": "uint256", + "slot": 101051993584849178915136821395265346177868384823507754984078593667947067386058, + "size": 256, + "offset": 0, + "value": 4 + }, + "1": { + "type_string": "uint256", + "slot": 101051993584849178915136821395265346177868384823507754984078593667947067386059, + "size": 256, + "offset": 0, + "value": 5 + }, + "2": { + "type_string": "uint256", + "slot": 101051993584849178915136821395265346177868384823507754984078593667947067386060, + "size": 256, + "offset": 0, + "value": 6 + } + }, + "value": 4 + } + }, + "value": 2 + }, + "fixedArrayofDynamicArrays": { + "type_string": "uint256[][3]", + "slot": 13, + "size": 768, + "offset": 0, + "elems": { + "0": { + "type_string": "uint256", + "slot": 13, + "size": 256, + "offset": 0, + "elems": { + "0": { + "type_string": "uint256", + "slot": 97569884605916225051403212656556507955018248777258318895762758024193532305077, + "size": 256, + "offset": 0, + "value": 7 + } + }, + "value": 1 + }, + "1": { + "type_string": "uint256", + "slot": 14, + "size": 256, + "offset": 0, + "elems": { + "0": { + "type_string": "uint256", + "slot": 84800337471693920904250232874319843718400766719524250287777680170677855896573, + "size": 256, + "offset": 0, + "value": 8 + }, + "1": { + "type_string": "uint256", + "slot": 84800337471693920904250232874319843718400766719524250287777680170677855896574, + "size": 256, + "offset": 0, + "value": 9 + } + }, + "value": 2 + }, + "2": { + "type_string": "uint256", + "slot": 15, + "size": 256, + "offset": 0, + "elems": { + "0": { + "type_string": "uint256", + "slot": 63806209331542711802848847270949280092855778197726125910674179583545433573378, + "size": 256, + "offset": 0, + "value": 10 + }, + "1": { + "type_string": "uint256", + "slot": 63806209331542711802848847270949280092855778197726125910674179583545433573379, + "size": 256, + "offset": 0, + "value": 11 + }, + "2": { + "type_string": "uint256", + "slot": 63806209331542711802848847270949280092855778197726125910674179583545433573380, + "size": 256, + "offset": 0, + "value": 12 + } + }, + "value": 3 + } + }, + "value": 1 + }, + "multidimensionalArray": { + "type_string": "uint256[][]", + "slot": 16, + "size": 256, + "offset": 0, + "elems": { + "0": { + "type_string": "uint256", + "slot": 12396694973890998440467380340983585058878106250672390494374587083972727727730, + "size": 256, + "offset": 0, + "elems": { + "0": { + "type_string": "uint256", + "slot": 93856215500098298973000561543003607329881518401177956003908346942307446808932, + "size": 256, + "offset": 0, + "value": 13 + } + }, + "value": 1 + }, + "1": { + "type_string": "uint256", + "slot": 12396694973890998440467380340983585058878106250672390494374587083972727727731, + "size": 256, + "offset": 0, + "elems": { + "0": { + "type_string": "uint256", + "slot": 48332168562525185806884758054388614910060623018875025120987491603435926351511, + "size": 256, + "offset": 0, + "value": 14 + }, + "1": { + "type_string": "uint256", + "slot": 48332168562525185806884758054388614910060623018875025120987491603435926351512, + "size": 256, + "offset": 0, + "value": 15 + } + }, + "value": 2 + }, + "2": { + "type_string": "uint256", + "slot": 12396694973890998440467380340983585058878106250672390494374587083972727727732, + "size": 256, + "offset": 0, + "elems": { + "0": { + "type_string": "uint256", + "slot": 69037578548663760355678879060995014288537668748590083357305779656188235687653, + "size": 256, + "offset": 0, + "value": 16 + }, + "1": { + "type_string": "uint256", + "slot": 69037578548663760355678879060995014288537668748590083357305779656188235687654, + "size": 256, + "offset": 0, + "value": 17 + }, + "2": { + "type_string": "uint256", + "slot": 69037578548663760355678879060995014288537668748590083357305779656188235687655, + "size": 256, + "offset": 0, + "value": 18 + } + }, + "value": 3 + } + }, + "value": 3 + }, + "dynamicArrayOfStructs": { + "type_string": "StorageLayout.PackedStruct[]", + "slot": 17, + "size": 256, + "offset": 0, + "elems": { + "0": { + "b": { + "type_string": "bool", + "slot": 22581645139872629890233439717971975110198959689450188087151966948260709403752, + "size": 8, + "offset": 0, + "value": true + }, + "a": { + "type_string": "uint248", + "slot": 22581645139872629890233439717971975110198959689450188087151966948260709403752, + "size": 248, + "offset": 8, + "value": 1 + } + }, + "1": { + "b": { + "type_string": "bool", + "slot": 22581645139872629890233439717971975110198959689450188087151966948260709403753, + "size": 8, + "offset": 0, + "value": false + }, + "a": { + "type_string": "uint248", + "slot": 22581645139872629890233439717971975110198959689450188087151966948260709403753, + "size": 248, + "offset": 8, + "value": 10 + } + } + }, + "value": "0000000000000000000000000000000000000000000000000000000000000002" + }, + "fixedArrayOfStructs": { + "type_string": "StorageLayout.PackedStruct[3]", + "slot": 18, + "size": 768, + "offset": 0, + "elems": { + "0": { + "b": { + "type_string": "bool", + "slot": 18, + "size": 8, + "offset": 0, + "value": true + }, + "a": { + "type_string": "uint248", + "slot": 18, + "size": 248, + "offset": 8, + "value": 1 + } + }, + "1": { + "b": { + "type_string": "bool", + "slot": 19, + "size": 8, + "offset": 0, + "value": false + }, + "a": { + "type_string": "uint248", + "slot": 19, + "size": 248, + "offset": 8, + "value": 10 + } + }, + "2": { + "b": { + "type_string": "bool", + "slot": 20, + "size": 8, + "offset": 0, + "value": false + }, + "a": { + "type_string": "uint248", + "slot": 20, + "size": 248, + "offset": 8, + "value": 0 + } + } + }, + "value": "0000000000000000000000000000000000000000000000000000000000000101" + } +} diff --git a/tests/storage-layout/storage_layout-0.8.10.sol b/tests/storage-layout/storage_layout-0.8.10.sol new file mode 100644 index 000000000..28d1428eb --- /dev/null +++ b/tests/storage-layout/storage_layout-0.8.10.sol @@ -0,0 +1,74 @@ +// overwrite abi and bin: +// solc tests/storage-layout/storage_layout-0.8.10.sol --abi --bin -o tests/storage-layout --overwrite +contract StorageLayout { + uint248 packedUint = 1; + bool packedBool = true; + + struct PackedStruct { + bool b; + uint248 a; + } + PackedStruct _packedStruct = PackedStruct(packedBool, packedUint); + + mapping (uint => PackedStruct) mappingPackedStruct; + mapping (address => mapping (uint => PackedStruct)) deepMappingPackedStruct; + mapping (address => mapping (uint => bool)) deepMappingElementaryTypes; + mapping (address => PackedStruct[]) mappingDynamicArrayOfStructs; + + address _address; + string _string = "slither-read-storage"; + uint8 packedUint8 = 8; + bytes8 packedBytes = "aaaaaaaa"; + + enum Enum { + a, + b, + c + } + Enum _enumA = Enum.a; + Enum _enumB = Enum.b; + Enum _enumC = Enum.c; + + uint256[3] fixedArray; + uint256[3][] dynamicArrayOfFixedArrays; + uint[][3] fixedArrayofDynamicArrays; + uint[][] multidimensionalArray; + PackedStruct[] dynamicArrayOfStructs; + PackedStruct[3] fixedArrayOfStructs; + + function store() external { + require(_address == address(0)); + _address = msg.sender; + + mappingPackedStruct[packedUint] = _packedStruct; + + deepMappingPackedStruct[_address][packedUint] = _packedStruct; + + deepMappingElementaryTypes[_address][1] = true; + deepMappingElementaryTypes[_address][2] = true; + + fixedArray = [1, 2, 3]; + + dynamicArrayOfFixedArrays.push(fixedArray); + dynamicArrayOfFixedArrays.push([4, 5, 6]); + + fixedArrayofDynamicArrays[0].push(7); + fixedArrayofDynamicArrays[1].push(8); + fixedArrayofDynamicArrays[1].push(9); + fixedArrayofDynamicArrays[2].push(10); + fixedArrayofDynamicArrays[2].push(11); + fixedArrayofDynamicArrays[2].push(12); + + multidimensionalArray.push([13]); + multidimensionalArray.push([14, 15]); + multidimensionalArray.push([16, 17, 18]); + + dynamicArrayOfStructs.push(_packedStruct); + dynamicArrayOfStructs.push(PackedStruct(false, 10)); + fixedArrayOfStructs[0] = _packedStruct; + fixedArrayOfStructs[1] = PackedStruct(false, 10); + + mappingDynamicArrayOfStructs[_address].push(dynamicArrayOfStructs[0]); + mappingDynamicArrayOfStructs[_address].push(dynamicArrayOfStructs[1]); + } +} diff --git a/tests/test_ast_parsing.py b/tests/test_ast_parsing.py index eafe6a2f3..b3114ca40 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", @@ -402,8 +406,19 @@ ALL_TESTS = [ Test("custom_error_with_state_variable.sol", make_version(8, 4, 12)), Test("complex_imports/import_aliases/test.sol", VERSIONS_08), # 0.8.9 crashes on our testcase - Test("user_defined_types.sol", ["0.8.8"] + make_version(8, 10, 12)), + Test( + "user_defined_value_type/user_defined_types-0.8.8.sol", ["0.8.8"] + make_version(8, 10, 15) + ), + Test("user_defined_value_type/argument-0.8.8.sol", ["0.8.8"] + make_version(8, 10, 15)), + Test("user_defined_value_type/calldata-0.8.8.sol", ["0.8.8"] + make_version(8, 10, 15)), + Test("user_defined_value_type/constant-0.8.8.sol", ["0.8.8"] + make_version(8, 10, 15)), + Test("user_defined_value_type/erc20-0.8.8.sol", ["0.8.8"] + make_version(8, 10, 15)), + Test("user_defined_value_type/in_parenthesis-0.8.8.sol", ["0.8.8"] + make_version(8, 10, 15)), 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"]), + Test("ternary-with-max.sol", ["0.8.15"]), ] # create the output folder if needed try: diff --git a/tests/test_detectors.py b/tests/test_detectors.py index 30999389c..7aea45bbe 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( @@ -1217,6 +1217,122 @@ ALL_TEST_OBJECTS = [ "write-after-write.sol", "0.8.0", ), + Test( + all_detectors.ShiftParameterMixup, + "shift_parameter_mixup.sol", + "0.4.25", + ), + Test( + all_detectors.ShiftParameterMixup, + "shift_parameter_mixup.sol", + "0.5.16", + ), + Test( + all_detectors.ShiftParameterMixup, + "shift_parameter_mixup.sol", + "0.6.11", + ), + Test( + all_detectors.ShiftParameterMixup, + "shift_parameter_mixup.sol", + "0.7.6", + ), + Test( + all_detectors.MissingInheritance, + "unimplemented_interface.sol", + "0.4.25", + ), + Test( + all_detectors.MissingInheritance, + "unimplemented_interface.sol", + "0.5.16", + ), + Test( + all_detectors.MissingInheritance, + "unimplemented_interface.sol", + "0.6.11", + ), + Test( + all_detectors.MissingInheritance, + "unimplemented_interface.sol", + "0.7.6", + ), + # Does not work on the CI. Most likely because of solc 0.4.2? + # Test( + # all_detectors.EnumConversion, + # "enum_conversion.sol", + # "0.4.2", + # ), + Test( + all_detectors.MultipleConstructorSchemes, + "multiple_constructor_schemes.sol", + "0.4.22", + ), + Test( + all_detectors.DeprecatedStandards, + "deprecated_calls.sol", + "0.4.25", + ), + Test( + all_detectors.DivideBeforeMultiply, + "divide_before_multiply.sol", + "0.4.25", + ), + Test( + all_detectors.DivideBeforeMultiply, + "divide_before_multiply.sol", + "0.5.16", + ), + Test( + all_detectors.DivideBeforeMultiply, + "divide_before_multiply.sol", + "0.6.11", + ), + Test( + all_detectors.DivideBeforeMultiply, + "divide_before_multiply.sol", + "0.7.6", + ), + Test( + all_detectors.TypeBasedTautology, + "type_based_tautology.sol", + "0.4.25", + ), + Test( + all_detectors.TypeBasedTautology, + "type_based_tautology.sol", + "0.5.16", + ), + Test( + all_detectors.TypeBasedTautology, + "type_based_tautology.sol", + "0.6.11", + ), + Test( + all_detectors.TypeBasedTautology, + "type_based_tautology.sol", + "0.7.6", + ), + Test( + all_detectors.SimilarVarsDetection, + "similar_variables.sol", + "0.4.25", + ), + Test( + all_detectors.SimilarVarsDetection, + "similar_variables.sol", + "0.5.16", + ), + Test( + all_detectors.SimilarVarsDetection, + "similar_variables.sol", + "0.6.11", + ), + Test( + all_detectors.SimilarVarsDetection, + "similar_variables.sol", + "0.7.6", + ), Test( all_detectors.MsgValueInLoop, "msg_value_loop.sol", @@ -1272,6 +1388,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_read_storage.py b/tests/test_read_storage.py new file mode 100644 index 000000000..0dbbb5bf2 --- /dev/null +++ b/tests/test_read_storage.py @@ -0,0 +1,139 @@ +import re +import os +import sys +import json +import shutil +import subprocess +from time import sleep +from typing import Generator + +import pytest +from deepdiff import DeepDiff +from slither import Slither +from slither.tools.read_storage import SlitherReadStorage + +try: + from web3 import Web3 +except ImportError: + print("ERROR: in order to use slither-read-storage, you need to install web3") + print("$ pip3 install web3 --user\n") + sys.exit(-1) + +SLITHER_ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) +STORAGE_TEST_ROOT = os.path.join(SLITHER_ROOT, "tests", "storage-layout") + +# pylint: disable=too-few-public-methods +class GanacheInstance: + def __init__(self, provider: str, eth_address: str, eth_privkey: str): + self.provider = provider + self.eth_address = eth_address + self.eth_privkey = eth_privkey + + +@pytest.fixture(scope="module", name="web3") +def fixture_web3(ganache: GanacheInstance): + w3 = Web3(Web3.HTTPProvider(ganache.provider, request_kwargs={"timeout": 30})) + return w3 + + +@pytest.fixture(scope="module", name="ganache") +def fixture_ganache() -> Generator[GanacheInstance, None, None]: + """Fixture that runs ganache""" + if not shutil.which("ganache"): + raise Exception( + "ganache was not found in PATH, you can install it with `npm install -g ganache`" + ) + + # Address #1 when ganache is run with `--wallet.seed test`, it starts with 1000 ETH + eth_address = "0xae17D2dD99e07CA3bF2571CCAcEAA9e2Aefc2Dc6" + eth_privkey = "0xe48ba530a63326818e116be262fd39ae6dcddd89da4b1f578be8afd4e8894b8d" + eth = int(1e18 * 1e6) + port = 8545 + with subprocess.Popen( + f"""ganache + --port {port} + --chain.networkId 1 + --chain.chainId 1 + --account {eth_privkey},{eth} + """.replace( + "\n", " " + ), + shell=True, + ) as p: + + sleep(3) + yield GanacheInstance(f"http://127.0.0.1:{port}", eth_address, eth_privkey) + p.kill() + p.wait() + + +def get_source_file(file_path): + with open(file_path, "r", encoding="utf8") as f: + source = f.read() + + return source + + +def deploy_contract(w3, ganache, contract_bin, contract_abi): + """Deploy contract to the local ganache network""" + signed_txn = w3.eth.account.sign_transaction( + dict( + nonce=w3.eth.get_transaction_count(ganache.eth_address), + maxFeePerGas=20000000000, + maxPriorityFeePerGas=1, + gas=15000000, + to=b"", + data="0x" + contract_bin, + chainId=1, + ), + ganache.eth_privkey, + ) + tx_hash = w3.eth.send_raw_transaction(signed_txn.rawTransaction) + address = w3.eth.get_transaction_receipt(tx_hash)["contractAddress"] + contract = w3.eth.contract(address, abi=contract_abi) + return contract + + +# pylint: disable=too-many-locals +@pytest.mark.usefixtures("web3", "ganache") +def test_read_storage(web3, ganache): + assert web3.isConnected() + bin_path = os.path.join(STORAGE_TEST_ROOT, "StorageLayout.bin") + abi_path = os.path.join(STORAGE_TEST_ROOT, "StorageLayout.abi") + bytecode = get_source_file(bin_path) + abi = get_source_file(abi_path) + contract = deploy_contract(web3, ganache, bytecode, abi) + contract.functions.store().transact({"from": ganache.eth_address}) + address = contract.address + + sl = Slither(os.path.join(STORAGE_TEST_ROOT, "storage_layout-0.8.10.sol")) + contracts = sl.contracts + + srs = SlitherReadStorage(contracts, 100) + srs.rpc = ganache.provider + srs.storage_address = address + srs.get_all_storage_variables() + srs.get_storage_layout() + srs.get_slot_values() + with open("storage_layout.json", "w", encoding="utf-8") as file: + json.dump(srs.slot_info, file, indent=4) + + expected_file = os.path.join(STORAGE_TEST_ROOT, "TEST_storage_layout.json") + actual_file = os.path.join(SLITHER_ROOT, "storage_layout.json") + + with open(expected_file, "r", encoding="utf8") as f: + expected = json.load(f) + with open(actual_file, "r", encoding="utf8") as f: + actual = json.load(f) + + diff = DeepDiff(expected, actual, ignore_order=True, verbose_level=2, view="tree") + if diff: + for change in diff.get("values_changed", []): + path_list = re.findall(r"\['(.*?)'\]", change.path()) + path = "_".join(path_list) + with open(f"{path}_expected.txt", "w", encoding="utf8") as f: + f.write(change.t1) + with open(f"{path}_actual.txt", "w", encoding="utf8") as f: + f.write(change.t2) + + assert not diff 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(): """ diff --git a/tests/test_storage_layout.py b/tests/test_storage_layout.py new file mode 100644 index 000000000..525cd3b47 --- /dev/null +++ b/tests/test_storage_layout.py @@ -0,0 +1,39 @@ +import json +import os +import subprocess +from subprocess import PIPE, Popen + +from slither import Slither + +SLITHER_ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) +STORAGE_TEST_ROOT = os.path.join(SLITHER_ROOT, "tests", "storage-layout") + +# the storage layout has not yet changed between solidity versions so we will test with one version of the compiler + + +def test_storage_layout(): + subprocess.run(["solc-select", "use", "0.8.10"], stdout=subprocess.PIPE, check=True) + + test_item = os.path.join(STORAGE_TEST_ROOT, "storage_layout-0.8.10.sol") + + sl = Slither(test_item, solc_force_legacy_json=False, disallow_partial=True) + + with Popen(["solc", test_item, "--storage-layout"], stdout=PIPE) as process: + for line in process.stdout: # parse solc output + if '{"storage":[{' in line.decode("utf-8"): # find the storage layout + layout = iter(json.loads(line)["storage"]) + while True: + try: + for contract in sl.contracts: + curr_var = next(layout) + var_name = curr_var["label"] + sl_name = contract.variables_as_dict[var_name] + slot, offset = contract.compilation_unit.storage_layout_of( + contract, sl_name + ) + assert slot == int(curr_var["slot"]) + assert offset == int(curr_var["offset"]) + except StopIteration: + break + except KeyError as e: + print(f"not found {e} ")