diff --git a/.circleci/compare_bytecode_reports.sh b/.circleci/compare_bytecode_reports.sh new file mode 100755 index 000000000000..7574b0656c81 --- /dev/null +++ b/.circleci/compare_bytecode_reports.sh @@ -0,0 +1,60 @@ +#!/usr/bin/env bash +set -euo pipefail + +#------------------------------------------------------------------------------ +# Compares bytecode reports generated by prepare_report.py/.js. +# +# ------------------------------------------------------------------------------ +# This file is part of solidity. +# +# solidity is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# solidity is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with solidity. If not, see +# +# (c) 2023 solidity contributors. +#------------------------------------------------------------------------------ + +no_cli_platforms=( + emscripten +) +native_platforms=( + ubuntu2004-static + ubuntu + osx + osx_intel + windows +) +interfaces=( + cli + standard-json +) + +for preset in "$@"; do + report_files=() + for platform in "${no_cli_platforms[@]}"; do + report_files+=("bytecode-report-${platform}-${preset}.txt") + done + for platform in "${native_platforms[@]}"; do + for interface in "${interfaces[@]}"; do + report_files+=("bytecode-report-${platform}-${interface}-${preset}.txt") + done + done + + echo "Reports to compare:" + printf -- "- %s\n" "${report_files[@]}" + + if ! diff --brief --report-identical-files --from-file "${report_files[@]}"; then + diff --unified=0 --report-identical-files --from-file "${report_files[@]}" | head --lines 50 + zip "bytecode-reports-${preset}.zip" "${report_files[@]}" + exit 1 + fi +done diff --git a/.circleci/config.yml b/.circleci/config.yml index c11b5f8b45a3..722de138a41e 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -9,24 +9,25 @@ version: 2.1 parameters: ubuntu-2004-docker-image: type: string - # solbuildpackpusher/solidity-buildpack-deps:ubuntu2004-19 - default: "solbuildpackpusher/solidity-buildpack-deps@sha256:9c7d3be930936a70f0340d5e9fa9a0b8bf69e11192e7e2d37807afe1b7f55534" + # solbuildpackpusher/solidity-buildpack-deps:ubuntu2004-21 + default: "solbuildpackpusher/solidity-buildpack-deps@sha256:6f64c7b35aabddb416d28f621a3c4bbae768c257d6866f6a7f05f8225acc94f0" ubuntu-2204-docker-image: type: string - # solbuildpackpusher/solidity-buildpack-deps:ubuntu2204-4 - default: "solbuildpackpusher/solidity-buildpack-deps@sha256:7555c26c82fd0dcbc02cbd422b74468f8de1b7f2972b84fadcfa90f7371d6de5" + # solbuildpackpusher/solidity-buildpack-deps:ubuntu2204-6 + default: "solbuildpackpusher/solidity-buildpack-deps@sha256:6eee10420382588b274374c6a18cb2e5d4f8a9fef5cf440b3a1acfc32bf52837" ubuntu-2204-clang-docker-image: type: string - # solbuildpackpusher/solidity-buildpack-deps:ubuntu2204.clang-3 - default: "solbuildpackpusher/solidity-buildpack-deps@sha256:3d5efffd1e4c381041d1dff6331add86976373bde1c9dfca97ebd3d735e09dab" + # solbuildpackpusher/solidity-buildpack-deps:ubuntu2204.clang-5 + default: "solbuildpackpusher/solidity-buildpack-deps@sha256:e991421ce9f44d6476b29588fc355da1c3b3fedcc424fd12d844bbe310ad7851" ubuntu-clang-ossfuzz-docker-image: type: string - # solbuildpackpusher/solidity-buildpack-deps:ubuntu.clang.ossfuzz-1 - default: "solbuildpackpusher/solidity-buildpack-deps@sha256:d1bba750ab3f9ad9d28d45e332c2ec2126d248c1d619af369a3ef0c29f5936c3" + # solbuildpackpusher/solidity-buildpack-deps:ubuntu.clang.ossfuzz-4 + default: "solbuildpackpusher/solidity-buildpack-deps@sha256:b122ef9dca71a8f90b74f3ba13cda4453681506e4a4ff047e7bc2130c76b0d1e" emscripten-docker-image: type: string - # solbuildpackpusher/solidity-buildpack-deps:emscripten-15 - default: "solbuildpackpusher/solidity-buildpack-deps@sha256:e2729bd6c0734bb49d04e2688fec3dcf880394f351f69358dd2bd92c0f6fd309" + # NOTE: Please remember to update the `build_emscripten.sh` whenever the hash of this image changes. + # solbuildpackpusher/solidity-buildpack-deps:emscripten-16 + default: "solbuildpackpusher/solidity-buildpack-deps@sha256:19fcb5ac029bbc27ec36e10f7d14ea224d8010145f9690562ef084fd16146b0c" evm-version: type: string default: london @@ -75,22 +76,35 @@ commands: parameters: label: type: string + binary_type: + type: enum + enum: + - solcjs + - native + - osx_intel binary_path: type: string + preset: + type: string steps: - - run: mkdir test-cases/ - - run: cd test-cases && python3 ../scripts/isolate_tests.py ../test/ - - run: cd test-cases && python3 ../scripts/bytecodecompare/prepare_report.py << parameters.binary_path >> --interface standard-json --report-file "../bytecode-report-<< parameters.label >>-json.txt" - - run: cd test-cases && python3 ../scripts/bytecodecompare/prepare_report.py << parameters.binary_path >> --interface cli --report-file "../bytecode-report-<< parameters.label >>-cli.txt" + - run: + name: Generate bytecode reports for the selected preset + command: | + .circleci/parallel_bytecode_report.sh \ + "<< parameters.label >>" \ + "<< parameters.binary_type >>" \ + "${PWD}/<< parameters.binary_path >>" \ + "<< parameters.preset >>" - store_artifacts: - path: bytecode-report-<< parameters.label >>-json.txt + path: bytecode-report-<< parameters.label >>-standard-json-<< parameters.preset >>.txt - store_artifacts: - path: bytecode-report-<< parameters.label >>-cli.txt + path: bytecode-report-<< parameters.label >>-cli-<< parameters.preset >>.txt + - store_artifacts: + path: bytecode-report-<< parameters.label >>-<< parameters.preset >>.txt - persist_to_workspace: root: . paths: - - bytecode-report-<< parameters.label >>-json.txt - - bytecode-report-<< parameters.label >>-cli.txt + - bytecode-report-<< parameters.label >>*.txt - matrix_notify_failure_unless_pr install_python3: @@ -127,10 +141,15 @@ commands: command: | FOUNDRY_REPO="foundry-rs/foundry" FOUNDRY_VERSION="<< parameters.version >>" + # Make authenticated requests when the Github token is available + if [[ -n "$GITHUB_ACCESS_TOKEN" ]]; then + EXTRA_HEADERS=(--header 'Authorization: Bearer '"${GITHUB_ACCESS_TOKEN}") + fi FOUNDRY_RELEASE_SHA=$(curl \ --silent \ --fail \ --show-error \ + "${EXTRA_HEADERS[@]}" \ "https://api.github.com/repos/${FOUNDRY_REPO}/git/refs/tags/${FOUNDRY_VERSION}" \ | jq --raw-output .object.sha \ ) @@ -160,311 +179,425 @@ commands: paths: - << parameters.install_path >> -defaults: - # -------------------------------------------------------------------------- - # Build Templates + # Build Commands + + setup_prerelease_commit_hash: + steps: + - run: + name: Store commit hash and prerelease + command: | + if [[ $CIRCLE_BRANCH == release || -n $CIRCLE_TAG ]]; then + echo -n > prerelease.txt; + else + date -u +"nightly.%Y.%-m.%-d" > prerelease.txt; + fi + echo -n "$CIRCLE_SHA1" > commit_hash.txt + + run_build: + steps: + - run: + name: Build + command: scripts/ci/build.sh + + run_build_ossfuzz: + steps: + - run: + name: Build_ossfuzz + command: scripts/ci/build_ossfuzz.sh + + run_proofs: + steps: + - run: + name: Correctness proofs for optimization rules + command: scripts/run_proofs.sh + + run_soltest: + steps: + - run: + name: soltest + no_output_timeout: 30m + command: .circleci/soltest.sh - - setup_prerelease_commit_hash: &setup_prerelease_commit_hash - name: Store commit hash and prerelease - command: | - if [ "$CIRCLE_BRANCH" = release -o -n "$CIRCLE_TAG" ]; then echo -n > prerelease.txt; else date -u +"nightly.%Y.%-m.%-d" > prerelease.txt; fi - echo -n "$CIRCLE_SHA1" > commit_hash.txt + run_soltest_all: + steps: + - run: + name: soltest_all + no_output_timeout: 30m + command: .circleci/soltest_all.sh - - run_build: &run_build - name: Build - command: scripts/ci/build.sh + run_cmdline_tests: + steps: + - run: + name: command line tests + no_output_timeout: 30m + command: .circleci/parallel_cli_tests.py - - run_build_ossfuzz: &run_build_ossfuzz - name: Build_ossfuzz - command: scripts/ci/build_ossfuzz.sh + run_docs_pragma_min_version: + steps: + - run: + name: docs pragma version check + command: scripts/docs_version_pragma_check.sh - - run_proofs: &run_proofs - name: Correctness proofs for optimization rules - command: scripts/run_proofs.sh + # -------------------------------------------------------------------------- + # Artifact Commands - - run_soltest: &run_soltest - name: soltest - no_output_timeout: 30m - command: ./.circleci/soltest.sh + store_artifacts_solc: + description: Store compiled solc executable as artifact + steps: + - store_artifacts: + path: build/solc/solc + destination: solc - - run_soltest_all: &run_soltest_all - name: soltest_all - no_output_timeout: 30m - command: ./.circleci/soltest_all.sh + store_artifacts_yul_phaser: + steps: + - store_artifacts: + path: build/tools/yul-phaser + destination: yul-phaser - - run_cmdline_tests: &run_cmdline_tests - name: command line tests - no_output_timeout: 30m - command: ./test/cmdlineTests.sh + persist_executables_to_workspace: + description: Persist compiled target executables to workspace + steps: + - persist_to_workspace: + root: build + paths: + - solc/solc + - test/soltest + - test/tools/solfuzzer + + persist_executables_to_workspace_osx: + description: Persist compiled target executables to workspace on macOS + steps: + - persist_to_workspace: + root: . + paths: + - build/solc/solc + - build/test/soltest + - build/test/tools/solfuzzer - - run_docs_pragma_min_version: &run_docs_pragma_min_version - name: docs pragma version check - command: ./scripts/docs_version_pragma_check.sh + persist_ossfuzz_executables_to_workspace: + description: Persist compiled OSSFUZZ executables to workspace + steps: + - persist_to_workspace: + root: build + paths: + - test/tools/ossfuzz/abiv2_proto_ossfuzz + - test/tools/ossfuzz/abiv2_isabelle_ossfuzz + - test/tools/ossfuzz/const_opt_ossfuzz + - test/tools/ossfuzz/solc_mutator_ossfuzz + - test/tools/ossfuzz/solc_ossfuzz + - test/tools/ossfuzz/stack_reuse_codegen_ossfuzz + - test/tools/ossfuzz/strictasm_assembly_ossfuzz + - test/tools/ossfuzz/strictasm_diff_ossfuzz + - test/tools/ossfuzz/strictasm_opt_ossfuzz + - test/tools/ossfuzz/yul_proto_diff_ossfuzz + - test/tools/ossfuzz/yul_proto_diff_custom_mutate_ossfuzz + - test/tools/ossfuzz/yul_proto_ossfuzz + - test/tools/ossfuzz/sol_proto_ossfuzz + + store_artifacts_test_results: + description: Store test output dir as artifact + steps: + - store_artifacts: + path: test_results/ + destination: test_results/ # -------------------------------------------------------------------------- - # Artifacts Templates - - # compiled solc executable target - - artifacts_solc: &artifacts_solc - path: build/solc/solc - destination: solc - - # windows artifacts - - artifact_solc_windows: &artifact_solc_windows - path: upload/ - - - artifact_yul_phaser: &artifact_yul_phaser - path: build/tools/yul-phaser - destination: yul-phaser - - # compiled executable targets - - artifacts_executables: &artifacts_executables - root: build - paths: - - solc/solc - - test/soltest - - test/tools/solfuzzer - - # compiled OSSFUZZ targets - - artifacts_executables_ossfuzz: &artifacts_executables_ossfuzz - root: build - paths: - - test/tools/ossfuzz/abiv2_proto_ossfuzz - - test/tools/ossfuzz/abiv2_isabelle_ossfuzz - - test/tools/ossfuzz/const_opt_ossfuzz - - test/tools/ossfuzz/solc_mutator_ossfuzz - - test/tools/ossfuzz/solc_ossfuzz - - test/tools/ossfuzz/stack_reuse_codegen_ossfuzz - - test/tools/ossfuzz/strictasm_assembly_ossfuzz - - test/tools/ossfuzz/strictasm_diff_ossfuzz - - test/tools/ossfuzz/strictasm_opt_ossfuzz - - test/tools/ossfuzz/yul_proto_diff_ossfuzz - - test/tools/ossfuzz/yul_proto_diff_custom_mutate_ossfuzz - - test/tools/ossfuzz/yul_proto_ossfuzz - - test/tools/ossfuzz/sol_proto_ossfuzz - - # test result output directory - - artifacts_test_results: &artifacts_test_results - path: test_results/ - destination: test_results/ + # Complex Build Commands + + soltest: + steps: + - checkout + - attach_workspace: + at: build + # NOTE: Different build jobs produce different soltest executables (release/debug, + # clang/gcc, windows/linux/macos, etc.). The executable used by these steps comes from the + # attached workspace and we only see the items added to the workspace by jobs we depend on. + - run_soltest + - store_test_results: + path: test_results/ + - store_artifacts_test_results + - matrix_notify_failure_unless_pr + + test_lsp: + steps: + - checkout + - attach_workspace: + at: build + - run: + name: Install dependencies + command: pip install --user deepdiff colorama + - run: + name: Executing solc LSP test suite + command: test/lsp.py build/solc/solc --non-interactive + - matrix_notify_failure_unless_pr + + build: + steps: + - checkout + - run_build + - store_artifacts_solc + - store_artifacts_yul_phaser + - persist_executables_to_workspace + - matrix_notify_failure_unless_pr + + soltest_all: + steps: + - checkout + - attach_workspace: + at: build + - run_soltest_all + - store_test_results: + path: test_results/ + - store_artifacts_test_results + - matrix_notify_failure_unless_pr + + cmdline_tests: + steps: + - checkout + - attach_workspace: + at: build + - run_cmdline_tests + - store_test_results: + path: test_results/ + - store_artifacts_test_results + - matrix_notify_failure_unless_pr + + install_dependencies_osx: + # An extra cache key is used to only save the flag that communicates whether the cache exists. + # if this flag was set (the cache exist) we remove all files located in /usr/local & /opt/homebrew. + # With this simple trick restoring the cache is much faster. Otherwise CircleCI is generating + # warning messages if a file from the cache is overwriting an already existing file on disk. + # Restoring the cache is much faster if we remove all potentially conflicting files beforehand. + steps: + - restore_cache: + keys: + - osx-dependencies-cached-{{ arch }}-{{ checksum ".circleci/osx_install_dependencies.sh" }} + - run: + name: Installing dependencies / Restoring dependency cache + command: | + if [[ -f ~/osx-dependencies-cached ]]; then + echo "Dependency flag exists. Removing /usr/local/ and /opt/homebrew/. These directories will be restored from cache." + + # CircleCI is providing the circleci cli tools via some kind of symlink magic. + # So we just save the original symlinks and restore them later. + circleci_binary_path=$(command -v circleci) + circleci_agent_binary_path=$(command -v circleci-agent) + cp "${circleci_binary_path}" /tmp/circleci + cp "${circleci_agent_binary_path}" /tmp/circleci-agent + + # Homebrew is installed in /usr/local on intel macs, but in /opt/homebrew on apple silicon. + if [[ -d /opt/homebrew ]]; then + sudo rm -rf /opt/homebrew + sudo mkdir -p /opt/homebrew/bin + sudo chmod 777 /opt/{homebrew,homebrew/bin} + fi + # under macos /usr/local itself is read-only, so we just remove its sub-directories. + sudo rm -rf /usr/local/* + sudo mkdir -p /usr/local/bin + sudo chmod 777 /usr/{local,local/bin} + + mv /tmp/circleci "${circleci_binary_path}" + mv /tmp/circleci-agent "${circleci_agent_binary_path}" + fi + - restore_cache: + keys: + - osx-dependencies-{{ arch }}-{{ checksum ".circleci/osx_install_dependencies.sh" }} + # DO NOT EDIT between here and save_cache, but rather edit ./circleci/osx_install_dependencies.sh + # WARNING! If you do edit anything here instead, remember to invalidate the cache manually. + - run: + name: Install build dependencies + command: .circleci/osx_install_dependencies.sh + - run: + name: Mark dependencies as cached + command: touch ~/osx-dependencies-cached + - save_cache: + key: osx-dependencies-{{ arch }}-{{ checksum ".circleci/osx_install_dependencies.sh" }} + paths: + # Homebrew is installed in /usr/local on intel macs, but in /opt/homebrew on apple silicon. + - /usr/local + - /opt/homebrew + - save_cache: + key: osx-dependencies-cached-{{ arch }}-{{ checksum ".circleci/osx_install_dependencies.sh" }} + paths: + - ~/osx-dependencies-cached + +defaults: # -------------------------------------------------------------------------- - # Step Templates - - # store_test_results helper - - store_test_results: &store_test_results - path: test_results/ - - - steps_soltest: &steps_soltest - steps: - - checkout - - attach_workspace: - at: build - # NOTE: Different build jobs produce different soltest executables (release/debug, - # clang/gcc, windows/linux/macos, etc.). The executable used by these steps comes from the - # attached workspace and we only see the items added to the workspace by jobs we depend on. - - run: *run_soltest - - store_test_results: *store_test_results - - store_artifacts: *artifacts_test_results - - matrix_notify_failure_unless_pr - - - steps_test_lsp: &steps_test_lsp - steps: - - checkout - - attach_workspace: - at: build - - run: - name: Install dependencies - command: pip install --user deepdiff colorama - - run: - name: Executing solc LSP test suite - command: ./test/lsp.py ./build/solc/solc --non-interactive - - matrix_notify_failure_unless_pr - - - steps_build: &steps_build - steps: - - checkout - - run: *run_build - - store_artifacts: *artifacts_solc - - store_artifacts: *artifact_yul_phaser - - persist_to_workspace: *artifacts_executables - - matrix_notify_failure_unless_pr - - - steps_soltest_all: &steps_soltest_all - steps: - - checkout - - attach_workspace: - at: build - - run: *run_soltest_all - - store_test_results: *store_test_results - - store_artifacts: *artifacts_test_results - - matrix_notify_failure_unless_pr - - - steps_cmdline_tests: &steps_cmdline_tests - steps: - - checkout - - attach_workspace: - at: build - - run: *run_cmdline_tests - - store_test_results: *store_test_results - - store_artifacts: *artifacts_test_results - - matrix_notify_failure_unless_pr - - - steps_install_dependencies_osx: &steps_install_dependencies_osx - steps: - # FIXME: We used to cache dependencies on macOS but now it takes longer than just installing - # them each time. See https://github.com/ethereum/solidity/issues/12925. - - run: - name: Install build dependencies - command: ./.circleci/osx_install_dependencies.sh + # Matrix templates + + - bytecode_compare_env_presets: &bytecode_compare_env_presets + PRESETS: + legacy-optimize + legacy-no-optimize + via-ir-optimize + via-ir-no-optimize + + - bytecode_compare_preset_matrix: &bytecode_compare_preset_matrix + parameters: + preset: + # NOTE: Keep in sync with preset list in bytecode_compare_env_presets + - legacy-optimize + - legacy-no-optimize + - via-ir-optimize + - via-ir-no-optimize + # -------------------------------------------------------------------------- # -------------------------------------------------------------------------- # Base Image Templates - base_archlinux: &base_archlinux docker: - image: archlinux:base - environment: + environment: &base_archlinux_env TERM: xterm MAKEFLAGS: -j 3 + CPUs: 3 - base_archlinux_large: &base_archlinux_large - docker: - - image: archlinux:base + <<: *base_archlinux resource_class: large - environment: - TERM: xterm + environment: &base_archlinux_large_env + <<: *base_archlinux_env MAKEFLAGS: -j 5 + CPUs: 5 - base_cimg_small: &base_cimg_small docker: - image: cimg/base:current resource_class: small - environment: + environment: &base_cimg_small_env TERM: xterm MAKEFLAGS: -j 2 + CPUs: 2 - base_ems_large: &base_ems_large docker: - image: << pipeline.parameters.emscripten-docker-image >> resource_class: large - environment: + environment: &base_ems_large_env TERM: xterm MAKEFLAGS: -j 5 + CPUs: 5 - base_node_small: &base_node_small docker: - image: cimg/node:current resource_class: small - environment: + environment: &base_node_small_env TERM: xterm MAKEFLAGS: -j 2 + CPUs: 2 - base_osx: &base_osx macos: - xcode: "14.2.0" - resource_class: macos.x86.medium.gen2 - environment: + xcode: "15.0.0" + resource_class: macos.m1.medium.gen1 + environment: &base_osx_env TERM: xterm MAKEFLAGS: -j5 - - - base_osx_large: &base_osx_large - macos: - xcode: "14.2.0" - resource_class: large - environment: - TERM: xterm - MAKEFLAGS: -j10 + CPUs: 5 + ETH_EVMONE: /usr/local/lib/libevmone.dylib - base_python_small: &base_python_small docker: - image: cimg/python:3.6 resource_class: small - environment: + environment: &base_python_small_env TERM: xterm MAKEFLAGS: -j 2 + CPUs: 2 - base_ubuntu_clang: &base_ubuntu_clang docker: - image: << pipeline.parameters.ubuntu-clang-ossfuzz-docker-image >> - environment: + environment: &base_ubuntu_clang_env TERM: xterm MAKEFLAGS: -j 3 + CPUs: 3 - base_ubuntu_clang_small: &base_ubuntu_clang_small <<: *base_ubuntu_clang resource_class: small - environment: - TERM: xterm + environment: &base_ubuntu_clang_small_env + <<: *base_ubuntu_clang_env MAKEFLAGS: -j 2 + CPUs: 2 - base_ubuntu2004: &base_ubuntu2004 docker: - - image: << pipeline.parameters.ubuntu-2004-docker-image >> - environment: - TERM: xterm - MAKEFLAGS: -j 3 + - image: << pipeline.parameters.ubuntu-2004-docker-image >> + environment: &base_ubuntu2004_env + TERM: xterm + MAKEFLAGS: -j 3 + CPUs: 3 - base_ubuntu2004_small: &base_ubuntu2004_small <<: *base_ubuntu2004 resource_class: small - environment: - TERM: xterm - MAKEFLAGS: -j 2 + environment: &base_ubuntu2004_small_env + <<: *base_ubuntu2004_env + MAKEFLAGS: -j 2 + CPUs: 2 - base_ubuntu2004_xlarge: &base_ubuntu2004_xlarge <<: *base_ubuntu2004 resource_class: xlarge - environment: - TERM: xterm - MAKEFLAGS: -j 10 + environment: &base_ubuntu2004_xlarge_env + <<: *base_ubuntu2004_env + MAKEFLAGS: -j 10 + CPUs: 10 - base_ubuntu2204: &base_ubuntu2204 docker: - image: << pipeline.parameters.ubuntu-2204-docker-image >> - environment: + environment: &base_ubuntu2204_env TERM: xterm MAKEFLAGS: -j 3 + CPUs: 3 - base_ubuntu2204_clang: &base_ubuntu2204_clang docker: - image: << pipeline.parameters.ubuntu-2204-clang-docker-image >> - environment: + environment: &base_ubuntu2204_clang_env TERM: xterm CC: clang CXX: clang++ MAKEFLAGS: -j 3 + CPUs: 3 - base_ubuntu2204_clang_large: &base_ubuntu2204_clang_large <<: *base_ubuntu2204_clang resource_class: large - environment: - TERM: xterm - CC: clang - CXX: clang++ + environment: &base_ubuntu2204_clang_large_env + <<: *base_ubuntu2204_clang_env MAKEFLAGS: -j 5 + CPUs: 5 - base_ubuntu2204_small: &base_ubuntu2204_small <<: *base_ubuntu2204 resource_class: small - environment: - TERM: xterm + environment: &base_ubuntu2204_small_env + <<: *base_ubuntu2204_env MAKEFLAGS: -j 2 + CPUs: 2 - base_ubuntu2204_large: &base_ubuntu2204_large <<: *base_ubuntu2204 resource_class: large - environment: - TERM: xterm + environment: &base_ubuntu2204_large_env + <<: *base_ubuntu2204_env MAKEFLAGS: -j 5 + CPUs: 5 - base_ubuntu2204_xlarge: &base_ubuntu2204_xlarge <<: *base_ubuntu2204 resource_class: xlarge - environment: - TERM: xterm + environment: &base_ubuntu2204_xlarge_env + <<: *base_ubuntu2204_env MAKEFLAGS: -j 10 + CPUs: 10 - base_win: &base_win executor: @@ -483,7 +616,9 @@ defaults: - on_all_tags_and_branches: &on_all_tags_and_branches filters: tags: - only: /.*/ + only: /^tv.*/ + branches: + ignore: /.*/ - on_version_tags: &on_version_tags filters: @@ -570,6 +705,8 @@ defaults: # Parameterized Job Templates # Separate compile-only runs of those external tests where a full run takes much longer. + # Also see https://github.com/ethereum/solidity/pull/14234 for why we excluded those + # external tests from the nightly jobs. - job_ems_compile_ext_colony: &job_ems_compile_ext_colony <<: *requires_b_ems name: t_ems_compile_ext_colony @@ -584,13 +721,14 @@ defaults: name: t_native_test_ext_gnosis project: gnosis binary_type: native - image: cimg/node:16.18 + image: cimg/node:18.16 - job_native_test_ext_zeppelin: &job_native_test_ext_zeppelin <<: *requires_b_ubu_static name: t_native_test_ext_zeppelin project: zeppelin binary_type: native + image: cimg/node:18.16 resource_class: large - job_native_test_ext_ens: &job_native_test_ext_ens @@ -598,14 +736,14 @@ defaults: name: t_native_test_ext_ens project: ens binary_type: native - image: cimg/node:18.11 + image: cimg/node:18.16 - job_native_test_ext_trident: &job_native_test_ext_trident <<: *requires_b_ubu_static name: t_native_test_ext_trident project: trident binary_type: native - image: cimg/node:16.18 + image: cimg/node:18.16 - job_native_test_ext_euler: &job_native_test_ext_euler <<: *requires_b_ubu_static @@ -619,6 +757,7 @@ defaults: name: t_native_test_ext_yield_liquidator project: yield-liquidator binary_type: native + image: cimg/node:18.16 - job_native_test_ext_bleeps: &job_native_test_ext_bleeps <<: *requires_b_ubu_static @@ -632,34 +771,36 @@ defaults: name: t_native_test_ext_pool_together project: pool-together binary_type: native - image: cimg/node:16.18 + image: cimg/node:18.16 - job_native_test_ext_perpetual_pools: &job_native_test_ext_perpetual_pools <<: *requires_b_ubu_static name: t_native_test_ext_perpetual_pools project: perpetual-pools binary_type: native - image: cimg/node:18.11 + image: cimg/node:18.16 - job_native_test_ext_uniswap: &job_native_test_ext_uniswap <<: *requires_b_ubu_static name: t_native_test_ext_uniswap project: uniswap binary_type: native - image: cimg/node:16.18 + image: cimg/node:18.16 - job_native_test_ext_prb_math: &job_native_test_ext_prb_math <<: *requires_b_ubu_static name: t_native_test_ext_prb_math project: prb-math binary_type: native - image: cimg/node:18.11 + image: cimg/rust:1.74.0-node + resource_class: medium - job_native_test_ext_elementfi: &job_native_test_ext_elementfi <<: *requires_b_ubu_static name: t_native_test_ext_elementfi project: elementfi binary_type: native + image: cimg/node:18.16 resource_class: medium - job_native_test_ext_brink: &job_native_test_ext_brink @@ -667,14 +808,14 @@ defaults: name: t_native_test_ext_brink project: brink binary_type: native - image: cimg/node:18.11 + image: cimg/node:18.16 - job_native_test_ext_chainlink: &job_native_test_ext_chainlink <<: *requires_b_ubu_static name: t_native_test_ext_chainlink project: chainlink binary_type: native - image: cimg/node:16.18 + image: cimg/node:18.16 resource_class: large # Tests run out of memory on a smaller machine - job_native_test_ext_gp2: &job_native_test_ext_gp2 @@ -682,16 +823,7 @@ defaults: name: t_native_test_ext_gp2 project: gp2 binary_type: native - image: cimg/node:18.11 - - - job_ems_test_ext_colony: &job_ems_test_ext_colony - <<: *requires_b_ems - name: t_ems_test_ext_colony - project: colony - binary_type: solcjs - image: cimg/node:14.20 - resource_class: medium - python2: true + image: cimg/node:18.16 - job_b_ubu_asan_clang: &job_b_ubu_asan_clang <<: *on_all_tags_and_branches @@ -718,7 +850,11 @@ jobs: pip install --user codespell - run: name: Check spelling - command: ~/.local/bin/codespell --skip "*.enc,.git,Dockerfile*,LICENSE,codespell_whitelist.txt,codespell_ignored_lines.txt" --ignore-words ./scripts/codespell_whitelist.txt --exclude-file ./scripts/codespell_ignored_lines.txt + command: | + ~/.local/bin/codespell \ + --skip "*.enc,.git,Dockerfile*,LICENSE,codespell_whitelist.txt,codespell_ignored_lines.txt" \ + --ignore-words scripts/codespell_whitelist.txt \ + --exclude-file scripts/codespell_ignored_lines.txt - matrix_notify_failure_unless_pr chk_docs_examples: @@ -732,7 +868,7 @@ jobs: command: sudo npm install -g solhint - run: name: Test Docs examples - command: ./test/docsCodeStyle.sh + command: test/docsCodeStyle.sh - matrix_notify_failure_unless_pr chk_coding_style: @@ -746,13 +882,13 @@ jobs: sudo apt install -y shellcheck - run: name: Check for C++ coding style - command: ./scripts/check_style.sh + command: scripts/check_style.sh - run: name: checking shell scripts - command: ./scripts/chk_shellscripts/chk_shellscripts.sh + command: scripts/chk_shellscripts/chk_shellscripts.sh - run: name: Check for broken symlinks - command: ./scripts/check_symlinks.sh + command: scripts/check_symlinks.sh - matrix_notify_failure_unless_pr chk_errorcodes: @@ -761,7 +897,7 @@ jobs: - checkout - run: name: Check for error codes - command: ./scripts/error_codes.py --check + command: scripts/error_codes.py --check - matrix_notify_failure_unless_pr chk_pylint: @@ -781,7 +917,7 @@ jobs: - run: pylint --version - run: name: Linting Python Scripts - command: ./scripts/pylint_all.py + command: scripts/pylint_all.py - matrix_notify_failure_unless_pr chk_antlr_grammar: @@ -795,7 +931,7 @@ jobs: sudo apt install -y openjdk-17-jdk - run: name: Run tests - command: ./scripts/test_antlr_grammar.sh + command: scripts/test_antlr_grammar.sh - matrix_notify_failure_unless_pr chk_buglist: @@ -810,7 +946,7 @@ jobs: npm install mktemp - run: name: Test buglist - command: ./test/buglistTests.js + command: test/buglistTests.js - matrix_notify_failure_unless_pr chk_proofs: @@ -819,14 +955,14 @@ jobs: - checkout - install_python3: packages: z3-solver - - run: *run_proofs + - run_proofs - matrix_notify_failure_unless_pr chk_docs_pragma_min_version: <<: *base_ubuntu2204_small steps: - checkout - - run: *run_docs_pragma_min_version + - run_docs_pragma_min_version - matrix_notify_failure_unless_pr t_ubu_pyscripts: @@ -852,26 +988,27 @@ jobs: # this runs 2x faster on xlarge but takes 4x more resources (compared to medium). # Enough other jobs depend on it that it's worth it though. <<: *base_ubuntu2204_xlarge - <<: *steps_build + steps: + - build # x64 ASAN build, for testing for memory related bugs b_ubu_asan: &b_ubu_asan # Runs slightly faster on large and xlarge but we only run it nightly so efficiency matters more. <<: *base_ubuntu2204 environment: + <<: *base_ubuntu2204_env CMAKE_OPTIONS: -DSANITIZE=address - MAKEFLAGS: -j 3 CMAKE_BUILD_TYPE: Release - <<: *steps_build + steps: + - build b_ubu_clang: &b_ubu_clang <<: *base_ubuntu2204_clang_large environment: - TERM: xterm - CC: clang - CXX: clang++ + <<: *base_ubuntu2204_clang_large_env MAKEFLAGS: -j 10 - <<: *steps_build + steps: + - build b_ubu_san_clang: # This runs a bit faster on large and xlarge but on nightly efficiency matters more. @@ -880,18 +1017,16 @@ jobs: type: string <<: *base_ubuntu2204_clang environment: - TERM: xterm - CC: clang - CXX: clang++ - MAKEFLAGS: -j 3 + <<: *base_ubuntu2204_clang_env CMAKE_OPTIONS: << parameters.cmake_options >> - <<: *steps_build + steps: + - build b_ubu_force_release: &b_ubu_force_release <<: *b_ubu environment: + <<: *base_ubuntu2204_xlarge_env FORCE_RELEASE: ON - MAKEFLAGS: -j 10 b_ubu_static: # We temporarily keep building static release binaries on ubuntu 20.04 @@ -900,12 +1035,11 @@ jobs: # On large runs 2x faster than on medium. 3x on xlarge. <<: *base_ubuntu2004_xlarge environment: - TERM: xterm - MAKEFLAGS: -j 10 + <<: *base_ubuntu2204_xlarge_env CMAKE_OPTIONS: -DCMAKE_BUILD_TYPE=Release -DUSE_Z3_DLOPEN=ON -DUSE_CVC4=OFF -DSOLC_STATIC_STDLIBS=ON steps: - checkout - - run: *run_build + - run_build - run: name: strip binary command: strip build/solc/solc @@ -923,18 +1057,19 @@ jobs: # Runs ~30% faster on large but we only run it nightly so efficiency matters more. <<: *base_ubuntu2204 environment: + <<: *base_ubuntu2204_env COVERAGE: ON CMAKE_BUILD_TYPE: Debug - MAKEFLAGS: -j 3 steps: - checkout - - run: *run_build - - persist_to_workspace: *artifacts_executables + - run_build + - persist_executables_to_workspace - matrix_notify_failure_unless_pr t_ubu_codecov: <<: *base_ubuntu2204_large environment: + <<: *base_ubuntu2204_large_env EVM: << pipeline.parameters.evm-version >> OPTIMIZE: 1 steps: @@ -947,11 +1082,11 @@ jobs: - run: name: "Code Coverage: Syntax Tests" command: codecov --flags syntax --gcov-root build - - run: *run_soltest + - run_soltest - run: name: "Coverage: All" command: codecov --flags all --gcov-root build - - store_artifacts: *artifacts_test_results + - store_artifacts_test_results - matrix_notify_failure_unless_pr # Builds in C++20 mode and uses debug build in order to speed up. @@ -959,21 +1094,22 @@ jobs: b_ubu_cxx20: <<: *base_ubuntu2204_large environment: + <<: *base_ubuntu2204_large_env CMAKE_BUILD_TYPE: Debug CMAKE_OPTIONS: -DCMAKE_CXX_STANDARD=20 -DUSE_CVC4=OFF MAKEFLAGS: -j 10 steps: - checkout - - run: *run_build + - run_build - matrix_notify_failure_unless_pr b_ubu_ossfuzz: &b_ubu_ossfuzz <<: *base_ubuntu_clang steps: - checkout - - run: *setup_prerelease_commit_hash - - run: *run_build_ossfuzz - - persist_to_workspace: *artifacts_executables_ossfuzz + - setup_prerelease_commit_hash + - run_build_ossfuzz + - persist_ossfuzz_executables_to_workspace - matrix_notify_failure_unless_pr t_ubu_ossfuzz: &t_ubu_ossfuzz @@ -988,14 +1124,14 @@ jobs: git clone https://github.com/ethereum/solidity-fuzzing-corpus /tmp/solidity-fuzzing-corpus mkdir -p test_results scripts/regressions.py -o test_results - - store_test_results: *store_test_results - - store_artifacts: *artifacts_test_results + - store_test_results: + path: test_results/ + - store_artifacts_test_results b_archlinux: <<: *base_archlinux_large environment: - TERM: xterm - MAKEFLAGS: -j 5 + <<: *base_archlinux_large_env # This can be switched off if we run out of sync with Arch. USE_Z3: ON steps: @@ -1004,68 +1140,59 @@ jobs: command: | pacman --noconfirm -Syu --noprogressbar --needed base-devel boost cmake cvc4 git openssh tar - checkout - - run: *run_build - - store_artifacts: *artifacts_solc - - persist_to_workspace: *artifacts_executables + - run_build + - store_artifacts_solc + - persist_executables_to_workspace - matrix_notify_failure_unless_pr b_osx: <<: *base_osx environment: - TERM: xterm + <<: *base_osx_env CMAKE_BUILD_TYPE: Release - MAKEFLAGS: -j10 + CMAKE_OPTIONS: -DCMAKE_OSX_ARCHITECTURES:STRING=x86_64;arm64 steps: - checkout - - when: - condition: true - <<: *steps_install_dependencies_osx - - run: *run_build - - store_artifacts: *artifacts_solc - - store_artifacts: *artifact_yul_phaser - - persist_to_workspace: - root: . - paths: - - build/solc/solc - - build/test/soltest - - build/test/tools/solfuzzer + - install_dependencies_osx + - run_build + - store_artifacts_solc + - store_artifacts_yul_phaser + - persist_executables_to_workspace_osx - matrix_notify_failure_unless_pr t_osx_soltest: &t_osx_soltest <<: *base_osx environment: + <<: *base_osx_env EVM: << pipeline.parameters.evm-version >> OPTIMIZE: 0 - TERM: xterm steps: - checkout - - when: - condition: true - <<: *steps_install_dependencies_osx + - install_dependencies_osx - attach_workspace: at: . - - run: *run_soltest - - store_test_results: *store_test_results - - store_artifacts: *artifacts_test_results + - run_soltest + - store_test_results: + path: test_results/ + - store_artifacts_test_results - matrix_notify_failure_unless_pr t_osx_cli: <<: *base_osx + parallelism: 8 # Should match number of tests in .circleci/parallel_cli_tests.py steps: - checkout - - when: - condition: true - <<: *steps_install_dependencies_osx + - install_dependencies_osx - attach_workspace: at: . - - run: *run_cmdline_tests - - store_artifacts: *artifacts_test_results + - run_cmdline_tests + - store_artifacts_test_results - matrix_notify_failure_unless_pr b_ems: <<: *base_ems_large environment: - TERM: xterm + <<: *base_ems_large_env MAKEFLAGS: -j 10 steps: - checkout @@ -1090,10 +1217,10 @@ jobs: <<: *base_ubuntu2204_small steps: - checkout - - run: *setup_prerelease_commit_hash + - setup_prerelease_commit_hash - run: name: Build documentation - command: ./docs/docs.sh + command: docs/docs.sh - store_artifacts: path: docs/_build/html/ destination: docs-html @@ -1102,19 +1229,21 @@ jobs: t_ubu_soltest_all: &t_ubu_soltest_all <<: *base_ubuntu2204_large parallelism: 50 - <<: *steps_soltest_all + steps: + - soltest_all t_ubu_lsp: &t_ubu_lsp <<: *base_ubuntu2204_small - <<: *steps_test_lsp + steps: + - test_lsp t_archlinux_soltest: &t_archlinux_soltest <<: *base_archlinux parallelism: 20 environment: + <<: *base_archlinux_env EVM: << pipeline.parameters.evm-version >> OPTIMIZE: 0 - TERM: xterm # For Archlinux we do not have prebuilt docker images and we would need to build evmone from source, # thus we forgo semantics tests to speed things up. SOLTEST_FLAGS: --no-semantic-tests --no-smt @@ -1123,20 +1252,20 @@ jobs: name: Install runtime dependencies command: | pacman --noconfirm -Syu --noprogressbar --needed base-devel boost cmake z3 cvc4 git openssh tar - - when: - condition: true - <<: *steps_soltest + - soltest t_ubu_clang_soltest: &t_ubu_clang_soltest <<: *base_ubuntu2204_clang parallelism: 20 environment: + <<: *base_ubuntu2204_clang_env EVM: << pipeline.parameters.evm-version >> OPTIMIZE: 0 # The high parallelism in this job is causing the SMT tests to run out of memory, # so disabling for now. SOLTEST_FLAGS: --no-smt - <<: *steps_soltest + steps: + - soltest t_ubu_force_release_soltest_all: &t_ubu_force_release_soltest_all # NOTE: This definition is identical to t_ubu_soltest_all but in the workflow we make it depend on @@ -1145,7 +1274,9 @@ jobs: t_ubu_cli: &t_ubu_cli <<: *base_ubuntu2204_small - <<: *steps_cmdline_tests + parallelism: 8 # Should match number of tests in .circleci/parallel_cli_tests.py + steps: + - cmdline_tests t_ubu_force_release_cli: &t_ubu_force_release_cli <<: *t_ubu_cli @@ -1162,18 +1293,21 @@ jobs: t_ubu_asan_cli: # Runs slightly faster on medium but we only run it nightly so efficiency matters more. <<: *base_ubuntu2204 + parallelism: 8 # Should match number of tests in .circleci/parallel_cli_tests.py environment: - TERM: xterm + <<: *base_ubuntu2204_env ASAN_OPTIONS: check_initialization_order=true:detect_stack_use_after_return=true:strict_init_order=true:strict_string_checks=true:detect_invalid_pointer_pairs=2 # Suppress CLN memory leak. # See: https://github.com/ethereum/solidity/issues/13891 for details. LSAN_OPTIONS: suppressions=/root/project/.circleci/cln-asan.supp:print_suppressions=0 - <<: *steps_cmdline_tests + steps: + - cmdline_tests t_ubu_asan_soltest: <<: *base_ubuntu2204 parallelism: 20 environment: + <<: *base_ubuntu2204_env EVM: << pipeline.parameters.evm-version >> OPTIMIZE: 0 SOLTEST_FLAGS: --no-smt @@ -1181,29 +1315,36 @@ jobs: # Suppress CLN memory leak. # See: https://github.com/ethereum/solidity/issues/13891 for details. LSAN_OPTIONS: suppressions=/root/project/.circleci/cln-asan.supp - <<: *steps_soltest + steps: + - soltest t_ubu_asan_clang_soltest: <<: *base_ubuntu2204_clang parallelism: 20 environment: + <<: *base_ubuntu2204_clang_env EVM: << pipeline.parameters.evm-version >> OPTIMIZE: 0 SOLTEST_FLAGS: --no-smt ASAN_OPTIONS: check_initialization_order=true:detect_stack_use_after_return=true:strict_init_order=true:strict_string_checks=true:detect_invalid_pointer_pairs=2 - <<: *steps_soltest + steps: + - soltest t_ubu_ubsan_clang_soltest: <<: *base_ubuntu2204_clang parallelism: 20 environment: + <<: *base_ubuntu2204_clang_env EVM: << pipeline.parameters.evm-version >> SOLTEST_FLAGS: --no-smt - <<: *steps_soltest + steps: + - soltest t_ubu_ubsan_clang_cli: <<: *base_ubuntu2204_clang - <<: *steps_cmdline_tests + parallelism: 8 # Should match number of tests in .circleci/parallel_cli_tests.py + steps: + - cmdline_tests t_ems_solcjs: # Unlike other t_ems jobs this one actually runs 2x faster on medium (compared to small). @@ -1229,9 +1370,9 @@ jobs: t_ems_ext_hardhat: <<: *base_node_small docker: - - image: cimg/node:18.11 + - image: cimg/node:18.16 environment: - TERM: xterm + <<: *base_node_small_env HARDHAT_TESTS_SOLC_PATH: /tmp/workspace/soljson.js steps: - checkout @@ -1242,16 +1383,16 @@ jobs: name: Install dependencies command: | cd hardhat - yarn + pnpm install - run: name: Run hardhat-core test suite command: | HARDHAT_TESTS_SOLC_VERSION=$(scripts/get_version.sh) export HARDHAT_TESTS_SOLC_VERSION - # NOTE: This is expected to work without running `yarn build` first. + # NOTE: This is expected to work without running `pnpm build` first. cd hardhat/packages/hardhat-core - yarn test + pnpm test - matrix_notify_failure_unless_pr t_ext: @@ -1289,6 +1430,12 @@ jobs: - attach_workspace: at: /tmp/workspace - install_foundry + - run: + name: Ensure pnpm is installed if npm is present + command: | + if command -v npm &> /dev/null; then + sudo npm install -g pnpm + fi - install_python3: packages: requests - run: @@ -1427,7 +1574,8 @@ jobs: name: "Run solc.exe to make sure build was successful." command: .\build\solc\Release\solc.exe --version shell: powershell.exe - - store_artifacts: *artifact_solc_windows + - store_artifacts: + path: upload/ - persist_to_workspace: root: build paths: @@ -1456,61 +1604,86 @@ jobs: command: python -m pip install --user deepdiff colorama - run: name: Executing solc LSP test suite - command: python ./test/lsp.py .\build\solc\Release\solc.exe --non-interactive + command: python test/lsp.py build\solc\Release\solc.exe --non-interactive shell: powershell.exe - - store_test_results: *store_test_results - - store_artifacts: *artifacts_test_results + - store_test_results: + path: test_results/ + - store_artifacts_test_results - matrix_notify_failure_unless_pr # Note: b_bytecode_ubu_static is required because b_ubu_static and b_ubu # are currently built on different Ubuntu base images. # It can be safely removed once we move both to the same Ubuntu version. b_bytecode_ubu_static: + parameters: + preset: + type: string <<: *base_ubuntu2004_small - environment: - TERM: xterm - MAKEFLAGS: -j 2 - LC_ALL: C + parallelism: 2 # For prepare_bytecode_report steps: - checkout - attach_workspace: at: build - prepare_bytecode_report: label: "ubuntu2004-static" - binary_path: "../build/solc/solc-static-linux" + binary_type: native + binary_path: "build/solc/solc-static-linux" + preset: "<< parameters.preset >>" b_bytecode_ubu: + parameters: + preset: + type: string <<: *base_ubuntu2204_small - environment: - TERM: xterm - MAKEFLAGS: -j 2 - LC_ALL: C + parallelism: 2 # For prepare_bytecode_report steps: - checkout - attach_workspace: at: build - prepare_bytecode_report: label: "ubuntu" - binary_path: "../build/solc/solc" + binary_type: native + binary_path: "build/solc/solc" + preset: "<< parameters.preset >>" b_bytecode_osx: + parameters: + preset: + type: string <<: *base_osx - environment: - TERM: xterm - MAKEFLAGS: -j 5 - LC_ALL: C + parallelism: 2 # For prepare_bytecode_report steps: - checkout - attach_workspace: at: . - prepare_bytecode_report: label: "osx" - binary_path: "../build/solc/solc" + binary_type: native + binary_path: "build/solc/solc" + preset: "<< parameters.preset >>" + + b_bytecode_osx_intel: + parameters: + preset: + type: string + <<: *base_osx + parallelism: 2 # For prepare_bytecode_report + steps: + - checkout + - attach_workspace: + at: . + - prepare_bytecode_report: + label: "osx_intel" + binary_type: osx_intel + binary_path: "build/solc/solc" + preset: "<< parameters.preset >>" b_bytecode_win: + parameters: + preset: + type: string <<: *base_win - environment: - LC_ALL: C + parallelism: 2 # For prepare_bytecode_report steps: # NOTE: For bytecode generation we need the input files to be byte-for-byte identical on all # platforms so line ending conversions must absolutely be disabled. @@ -1522,57 +1695,39 @@ jobs: at: build - prepare_bytecode_report: label: "windows" - binary_path: "../build/solc/Release/solc.exe" + binary_type: native + binary_path: "build/solc/Release/solc.exe" + preset: "<< parameters.preset >>" b_bytecode_ems: + parameters: + preset: + type: string <<: *base_node_small - environment: - SOLC_EMSCRIPTEN: "On" - LC_ALL: C steps: - checkout - attach_workspace: at: emscripten_build/libsolc - - run: scripts/bytecodecompare/storebytecode.sh && mv -v report.txt bytecode-report-emscripten.txt - - store_artifacts: - path: bytecode-report-emscripten.txt - - persist_to_workspace: - root: . - paths: - - bytecode-report-emscripten.txt - - matrix_notify_failure_unless_pr + - prepare_bytecode_report: + label: "emscripten" + binary_type: solcjs + binary_path: "emscripten_build/libsolc/soljson.js" + preset: "<< parameters.preset >>" t_bytecode_compare: <<: *base_ubuntu2204_small environment: - REPORT_FILES: | - bytecode-report-emscripten.txt - bytecode-report-ubuntu2004-static-json.txt - bytecode-report-ubuntu2004-static-cli.txt - bytecode-report-ubuntu-json.txt - bytecode-report-ubuntu-cli.txt - bytecode-report-osx-json.txt - bytecode-report-osx-cli.txt - bytecode-report-windows-json.txt - bytecode-report-windows-cli.txt + <<: *base_ubuntu2204_small_env + <<: *bytecode_compare_env_presets steps: + - checkout - attach_workspace: at: . - - run: - name: Compare reports - command: diff --brief --report-identical-files --from-file $REPORT_FILES - - run: - name: Print diff - when: on_fail - command: diff --unified=0 --report-identical-files --from-file $REPORT_FILES | head --lines 50 - - run: - name: Bundle reports into a single package - when: on_fail - command: zip all-bytecode-reports.zip $REPORT_FILES + - run: .circleci/compare_bytecode_reports.sh $PRESETS - store_artifacts: # NOTE: store_artifacts does not support the 'when' attribute. # Fortunately when the artifact does not exist it just says "No artifact files found" and ignores it. - path: all-bytecode-reports.zip + path: bytecode-reports-*.zip - matrix_notify_failure_unless_pr c_release_binaries: @@ -1673,7 +1828,9 @@ workflows: - t_ext: *job_ems_compile_ext_colony - - t_ext: *job_native_test_ext_gnosis + # NOTE: We are disabling the gnosis test suite due to version discrepancies that are difficult to fix. + # Check again after (and if) https://github.com/safe-global/safe-contracts/pull/644 is merged. + #- t_ext: *job_native_test_ext_gnosis - t_ext: *job_native_test_ext_zeppelin - t_ext: *job_native_test_ext_ens - t_ext: *job_native_test_ext_yield_liquidator @@ -1682,7 +1839,8 @@ workflows: - t_ext: *job_native_test_ext_prb_math - t_ext: *job_native_test_ext_elementfi - t_ext: *job_native_test_ext_brink - - t_ext: *job_native_test_ext_gp2 + # NOTE: We are disabling gp2 tests due to constant failures. + # - t_ext: *job_native_test_ext_gp2 # NOTE: The external tests below were commented because they # depend on a specific version of hardhat which does not support shanghai EVM. #- t_ext: *job_native_test_ext_trident @@ -1695,16 +1853,21 @@ workflows: <<: *requires_nothing requires: - t_ems_compile_ext_colony - - t_native_test_ext_gnosis + # NOTE: We are disabling the gnosis test suite due to version discrepancies that are difficult to fix. + # Check again after (and if) https://github.com/safe-global/safe-contracts/pull/644 is merged. + #- t_native_test_ext_gnosis - t_native_test_ext_zeppelin - t_native_test_ext_ens - t_native_test_ext_yield_liquidator - t_native_test_ext_perpetual_pools - t_native_test_ext_uniswap - - t_native_test_ext_prb_math - t_native_test_ext_elementfi - t_native_test_ext_brink - - t_native_test_ext_gp2 + # NOTE: We are disabling gp2 tests due to constant failures. + #- t_native_test_ext_gp2 + # TODO: Dropping prb-math from the benchmarks since it is not implemented yet + # in the new Foundry external testing infrastructure. + # - t_native_test_ext_prb_math # NOTE: The external tests below were commented because they # depend on a specific version of hardhat which does not support shanghai EVM. #- t_native_test_ext_trident @@ -1719,32 +1882,43 @@ workflows: # Bytecode comparison: - b_bytecode_ubu_static: - <<: *requires_nothing + <<: *on_all_tags_and_branches + matrix: *bytecode_compare_preset_matrix requires: - b_ubu_static - b_bytecode_ubu: - <<: *requires_nothing + <<: *on_all_tags_and_branches + matrix: *bytecode_compare_preset_matrix requires: - b_ubu - b_bytecode_win: - <<: *requires_nothing + <<: *on_all_tags_and_branches + matrix: *bytecode_compare_preset_matrix requires: - b_win - b_bytecode_osx: - <<: *requires_nothing + <<: *on_all_tags_and_branches + matrix: *bytecode_compare_preset_matrix + requires: + - b_osx + - b_bytecode_osx_intel: + <<: *on_all_tags_and_branches + matrix: *bytecode_compare_preset_matrix requires: - b_osx - b_bytecode_ems: - <<: *requires_nothing + <<: *on_all_tags_and_branches + matrix: *bytecode_compare_preset_matrix requires: - b_ems - t_bytecode_compare: - <<: *requires_nothing + <<: *on_all_tags_and_branches requires: - b_bytecode_ubu_static - b_bytecode_ubu - b_bytecode_win - b_bytecode_osx + - b_bytecode_osx_intel - b_bytecode_ems # Final artifacts @@ -1755,35 +1929,3 @@ workflows: - b_osx - b_win - b_ems - -# nightly: -# -# triggers: -# - schedule: -# cron: "0 0 * * *" -# <<: *on_develop -# -# jobs: -# # OSSFUZZ builds and (regression) tests -# - b_ubu_ossfuzz: *requires_nothing -# - t_ubu_ossfuzz: *requires_b_ubu_ossfuzz -# -# # Code Coverage enabled build and tests -# - b_ubu_codecov: *requires_nothing -# - t_ubu_codecov: *requires_b_ubu_codecov -# -# # ASan build and tests -# - b_ubu_asan: *requires_nothing -# - b_ubu_san_clang: *job_b_ubu_asan_clang -# - t_ubu_asan_soltest: *requires_b_ubu_asan -# - t_ubu_asan_clang_soltest: *requires_b_ubu_asan_clang -# - t_ubu_asan_cli: *requires_b_ubu_asan -# -# # UBSan build and tests -# - b_ubu_san_clang: *job_b_ubu_ubsan_clang -# - t_ubu_ubsan_clang_soltest: *requires_b_ubu_ubsan_clang -# - t_ubu_ubsan_clang_cli: *requires_b_ubu_ubsan_clang -# -# # Emscripten build and tests that take more than 15 minutes to execute -# - b_ems: *requires_nothing -# - t_ext: *job_ems_test_ext_colony diff --git a/.circleci/osx_install_dependencies.sh b/.circleci/osx_install_dependencies.sh index 5e779700c9f6..4ca4a31d503b 100755 --- a/.circleci/osx_install_dependencies.sh +++ b/.circleci/osx_install_dependencies.sh @@ -26,12 +26,8 @@ # ------------------------------------------------------------------------------ # note that the following directories may be cached by circleci: -# - /usr/local/bin -# - /usr/local/sbin -# - /usr/local/lib -# - /usr/local/include -# - /usr/local/Cellar -# - /usr/local/Homebrew +# - /usr/local +# - /opt/homebrew set -eu @@ -52,32 +48,69 @@ function validate_checksum { if [ ! -f /usr/local/lib/libz3.a ] # if this file does not exists (cache was not restored), rebuild dependencies then - brew install boost + brew update + brew upgrade brew install cmake brew install wget brew install coreutils brew install diffutils - ./scripts/install_obsolete_jsoncpp_1_7_4.sh + brew install grep + + # writing to /usr/local/lib need administrative privileges. + sudo ./scripts/install_obsolete_jsoncpp_1_7_4.sh + + # boost + boost_version="1.84.0" + boost_package="boost_${boost_version//./_}.tar.bz2" + boost_dir="boost_${boost_version//./_}" + wget "https://boostorg.jfrog.io/artifactory/main/release/$boost_version/source/$boost_package" + tar xf "$boost_package" + rm "$boost_package" + cd "$boost_dir" + ./bootstrap.sh --with-toolset=clang --with-libraries=thread,system,filesystem,program_options,serialization,test + # the default number of jobs that b2 is taking, is the number of detected available CPU threads. + sudo ./b2 -a address-model=64 architecture=arm+x86 install + cd .. + sudo rm -rf "$boost_dir" # z3 z3_version="4.12.1" - z3_dir="z3-${z3_version}-x64-osx-10.16" - z3_package="${z3_dir}.zip" - wget "https://github.com/Z3Prover/z3/releases/download/z3-${z3_version}/${z3_package}" - validate_checksum "$z3_package" 7601f844de6d906235140d0f76cca58be7ac716f3e2c29c35845aa24b24f73b9 - unzip "$z3_package" + z3_dir="z3-z3-$z3_version" + z3_package="z3-$z3_version.tar.gz" + wget "https://github.com/Z3Prover/z3/archive/refs/tags/$z3_package" + validate_checksum "$z3_package" a3735fabf00e1341adcc70394993c05fd3e2ae167a3e9bb46045e33084eb64a3 + tar xf "$z3_package" rm "$z3_package" - cp "${z3_dir}/bin/libz3.a" /usr/local/lib - cp "${z3_dir}/bin/z3" /usr/local/bin - cp "${z3_dir}/include/"* /usr/local/include - rm -r "$z3_dir" + cd "$z3_dir" + mkdir build + cd build + cmake -DCMAKE_OSX_ARCHITECTURES:STRING="x86_64;arm64" -DZ3_BUILD_LIBZ3_SHARED=false .. + make -j + sudo make install + cd ../.. + rm -rf "$z3_dir" # evmone - evmone_version="0.10.0" - evmone_package="evmone-${evmone_version}-darwin-x86_64.tar.gz" - wget "https://github.com/ethereum/evmone/releases/download/v${evmone_version}/${evmone_package}" - validate_checksum "$evmone_package" 1b7773779287d7908baca6b8d556a98800cbd7d6e5c910b55fa507642bc0a15c - tar xzpf "$evmone_package" -C /usr/local - rm "$evmone_package" - + evmone_version="0.11.0" + if [[ $(uname -m) == 'arm64' ]] + then + # evmone does not provide any builds for apple silicon yet. so lets just build it locally. + # be aware that we are only building the arm version here, we don't build a universal binary. + git clone https://github.com/ethereum/evmone.git + cd evmone + git checkout "v${evmone_version}" + git submodule update --init + cmake -S . -B build + cmake --build build + cd build + sudo make install + cd ../.. + rm -rf evmone + else + evmone_package="evmone-${evmone_version}-darwin-x86_64.tar.gz" + wget "https://github.com/ethereum/evmone/releases/download/v${evmone_version}/${evmone_package}" + validate_checksum "$evmone_package" 83ed20676681d9a31bd30cac399ab7c615ccab8adb8087cc2c7e9cd22b4d2efc + tar xzpf "$evmone_package" -C /usr/local + rm "$evmone_package" + fi fi diff --git a/.circleci/parallel_bytecode_report.sh b/.circleci/parallel_bytecode_report.sh new file mode 100755 index 000000000000..d77b8a24f1ef --- /dev/null +++ b/.circleci/parallel_bytecode_report.sh @@ -0,0 +1,80 @@ +#!/usr/bin/env bash +set -euo pipefail + +#------------------------------------------------------------------------------ +# Splits all test source code into multiple files, generates bytecode and metadata +# for each file and combines it into a single report.txt file. +# +# The script is meant to be executed in CI on all supported platforms. All generated +# reports must be identical for a given compiler version. +# +# ------------------------------------------------------------------------------ +# This file is part of solidity. +# +# solidity is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# solidity is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with solidity. If not, see +# +# (c) 2023 solidity contributors. +#------------------------------------------------------------------------------ + +(( $# == 4 )) || { >&2 echo "Wrong number of arguments."; exit 1; } +label="$1" +binary_type="$2" +binary_path="$3" # This path must be absolute +preset="$4" + +[[ $binary_type == native || $binary_type == "osx_intel" || $binary_type == solcjs ]] || { >&2 echo "Invalid binary type: ${binary_type}"; exit 1; } + +# NOTE: Locale affects the order of the globbed files. +export LC_ALL=C + +mkdir test-cases/ +cd test-cases/ + +echo "Preparing input files" +python3 ../scripts/isolate_tests.py ../test/ + +# FIXME: These cases crash because of https://github.com/ethereum/solidity/issues/13583 +rm ./*_bytecode_too_large_*.sol ./*_combined_too_large_*.sol + +if [[ $binary_type == native || $binary_type == "osx_intel" ]]; then + interface=$(echo -e "standard-json\ncli" | circleci tests split) + echo "Selected interface: ${interface}" + + echo "Generating bytecode reports" + python3 ../scripts/bytecodecompare/prepare_report.py \ + "$binary_path" \ + --interface "$interface" \ + --preset "$preset" \ + --execution-arch "$binary_type" \ + --report-file "../bytecode-report-${label}-${interface}-${preset}.txt" +else + echo "Installing solc-js" + git clone --depth 1 https://github.com/ethereum/solc-js.git solc-js + cp "$binary_path" solc-js/soljson.js + + cd solc-js/ + npm install + npm run build + + cd .. + npm install ./solc-js/dist + + cp ../scripts/bytecodecompare/prepare_report.js . + + echo "Generating bytecode reports" + # shellcheck disable=SC2035 + ./prepare_report.js \ + --preset "$preset" \ + *.sol > "../bytecode-report-${label}-${preset}.txt" +fi diff --git a/.circleci/parallel_cli_tests.py b/.circleci/parallel_cli_tests.py new file mode 100755 index 000000000000..ef789218063a --- /dev/null +++ b/.circleci/parallel_cli_tests.py @@ -0,0 +1,45 @@ +#!/usr/bin/env python3 + +import subprocess +import sys + +# Slowest CLI tests, whose execution takes time on the order of minutes (as of June 2023). +# When adding/removing items here, remember to update `parallelism` value in jobs that run this script. +# TODO: We should switch to time-based splitting but that requires JUnit XML report support in cmdlineTests.sh. +tests_to_run_in_parallel = [ + '~ast_import_export', # ~7 min + '~ast_export_with_stop_after_parsing', # ~4 min + '~soljson_via_fuzzer', # ~3 min + '~via_ir_equivalence', # ~1 min + '~compilation_tests', # ~1 min + '~documentation_examples', # ~1 min + '*', # This item represents all the remaining tests +] + +# Ask CircleCI to select a subset of tests for this parallel execution. +# If `parallelism` in CI config is set correctly, we should get just one but we can handle any split. +selected_tests = subprocess.check_output( + ['circleci', 'tests', 'split'], + input='\n'.join(tests_to_run_in_parallel), + encoding='ascii', +).strip().split('\n') +selected_tests = set(selected_tests) - {''} +excluded_tests = set(tests_to_run_in_parallel) - selected_tests +assert selected_tests.issubset(set(tests_to_run_in_parallel)) + +if len(selected_tests) == 0: + print("No tests to run.") + sys.exit(0) + +if '*' in selected_tests: + filters = [arg for test_name in excluded_tests for arg in ['--exclude', test_name]] +else: + filters = list(selected_tests) + +subprocess.run( + ['test/cmdlineTests.sh'] + filters, + stdin=sys.stdin, + stdout=sys.stdout, + stderr=sys.stderr, + check=True, +) diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index 49acab231fa4..30c09039ef79 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -36,7 +36,7 @@ assignees: '' version is bumped to 0.5.0. 5. The 0.5.0 release is made. -This behaviour works well with the :ref:`version pragma `. +This behavior works well with the :ref:`version pragma `. diff --git a/docs/internals/optimizer.rst b/docs/internals/optimizer.rst index 9ede5ef2ac15..ab37872ffb17 100644 --- a/docs/internals/optimizer.rst +++ b/docs/internals/optimizer.rst @@ -27,7 +27,7 @@ optimized Yul IR for a Solidity source. Similarly, one can use ``solc --strict-a for a stand-alone Yul mode. .. note:: - The `peephole optimizer `_ and the inliner are always + The `peephole optimizer `_ is always enabled by default and can only be turned off via the :ref:`Standard JSON `. You can find more details on both optimizer modules and their optimization steps below. @@ -316,7 +316,6 @@ Abbreviation Full name ``L`` :ref:`load-resolver` ``M`` :ref:`loop-invariant-code-motion` ``r`` :ref:`redundant-assign-eliminator` -``R`` :ref:`reasoning-based-simplifier` - highly experimental ``m`` :ref:`rematerialiser` ``V`` :ref:`SSA-reverser` ``a`` :ref:`SSA-transform` @@ -330,10 +329,6 @@ Abbreviation Full name Some steps depend on properties ensured by ``BlockFlattener``, ``FunctionGrouper``, ``ForLoopInitRewriter``. For this reason the Yul optimizer always applies them before applying any steps supplied by the user. -The ReasoningBasedSimplifier is an optimizer step that is currently not enabled -in the default set of steps. It uses an SMT solver to simplify arithmetic expressions -and boolean conditions. It has not received thorough testing or validation yet and can produce -non-reproducible results, so please use with care! Selecting Optimizations ----------------------- @@ -575,7 +570,7 @@ It is not applied to loop iteration-condition, because the loop control flow doe this "outlining" of the inner expressions in all cases. We can sidestep this limitation by applying :ref:`for-loop-condition-into-body` to move the iteration condition into loop body. -The final program should be in a form such that (with the exception of loop conditions) +The final program should be in an *expression-split form*, where (with the exception of loop conditions) function calls cannot appear nested inside expressions and all function call arguments have to be variables. @@ -863,22 +858,6 @@ Works best if the code is in SSA form. Prerequisite: Disambiguator, ForLoopInitRewriter. -.. _reasoning-based-simplifier: - -ReasoningBasedSimplifier -^^^^^^^^^^^^^^^^^^^^^^^^ - -This optimizer uses SMT solvers to check whether ``if`` conditions are constant. - -- If ``constraints AND condition`` is UNSAT, the condition is never true and the whole body can be removed. -- If ``constraints AND NOT condition`` is UNSAT, the condition is always true and can be replaced by ``1``. - -The simplifications above can only be applied if the condition is movable. - -It is only effective on the EVM dialect, but safe to use on other dialects. - -Prerequisite: Disambiguator, SSATransform. - Statement-Scale Simplifications ------------------------------- @@ -1213,7 +1192,7 @@ This component can only be used on sources with unique names. FullInliner ^^^^^^^^^^^ -The Full Inliner replaces certain calls of certain functions +The FullInliner replaces certain calls of certain functions by the function's body. This is not very helpful in most cases, because it just increases the code size but does not have a benefit. Furthermore, code is usually very expensive and we would often rather have shorter @@ -1237,6 +1216,11 @@ we can run the optimizer on this specialized function. If it results in heavy gains, the specialized function is kept, otherwise the original function is used instead. +FunctionHoister and ExpressionSplitter are recommended as prerequisites since they make the step +more efficient, but are not required for correctness. +In particular, function calls with other function calls as arguments are not inlined, but running +ExpressionSplitter beforehand ensures that there are no such calls in the input. + Cleanup ------- @@ -1279,8 +1263,8 @@ This is a tiny step that helps in reversing the effects of the SSA transform if it is combined with the Common Subexpression Eliminator and the Unused Pruner. -The SSA form we generate is detrimental to code generation on the EVM and -WebAssembly alike because it generates many local variables. It would +The SSA form we generate is detrimental to code generation +because it produces many local variables. It would be better to just re-use existing variables with assignments instead of fresh variable declarations. @@ -1398,15 +1382,3 @@ into } The LiteralRematerialiser should be run before this step. - - -WebAssembly specific --------------------- - -MainFunction -^^^^^^^^^^^^ - -Changes the topmost block to be a function with a specific name ("main") which has no -inputs nor outputs. - -Depends on the Function Grouper. diff --git a/docs/introduction-to-smart-contracts.rst b/docs/introduction-to-smart-contracts.rst index acef49122f33..48768cb8bfed 100644 --- a/docs/introduction-to-smart-contracts.rst +++ b/docs/introduction-to-smart-contracts.rst @@ -282,7 +282,7 @@ the source account is also not modified. Furthermore, a transaction is always cryptographically signed by the sender (creator). This makes it straightforward to guard access to specific modifications of the database. In the example of the electronic currency, a simple check ensures that -only the person holding the keys to the account can transfer money from it. +only the person holding the keys to the account can transfer some compensation, e.g. Ether, from it. .. index:: ! block @@ -564,7 +564,7 @@ contracts, the Ether is forever lost. .. warning:: From version 0.8.18 and up, the use of ``selfdestruct`` in both Solidity and Yul will trigger a - deprecation warning, since the ``SELFDESTRUCT`` opcode will eventually undergo breaking changes in behaviour + deprecation warning, since the ``SELFDESTRUCT`` opcode will eventually undergo breaking changes in behavior as stated in `EIP-6049 `_. .. warning:: @@ -591,7 +591,7 @@ Precompiled Contracts There is a small set of contract addresses that are special: The address range between ``1`` and (including) ``8`` contains "precompiled contracts" that can be called as any other contract -but their behaviour (and their gas consumption) is not defined +but their behavior (and their gas consumption) is not defined by EVM code stored at that address (they do not contain code) but instead is implemented in the EVM execution environment itself. diff --git a/docs/ir-breaking-changes.rst b/docs/ir-breaking-changes.rst index 9cee46793284..4917cfc7158d 100644 --- a/docs/ir-breaking-changes.rst +++ b/docs/ir-breaking-changes.rst @@ -15,13 +15,13 @@ The IR-based code generator was introduced with an aim to not only allow code generation to be more transparent and auditable but also to enable more powerful optimization passes that span across functions. -You can enable it on the command line using ``--via-ir`` +You can enable it on the command-line using ``--via-ir`` or with the option ``{"viaIR": true}`` in standard-json and we encourage everyone to try it out! For several reasons, there are tiny semantic differences between the old and the IR-based code generator, mostly in areas where we would not -expect people to rely on this behaviour anyway. +expect people to rely on this behavior anyway. This section highlights the main differences between the old and the IR-based codegen. Semantic Only Changes @@ -30,6 +30,8 @@ Semantic Only Changes This section lists the changes that are semantic-only, thus potentially hiding new and different behavior in existing code. +.. _state-variable-initialization-order: + - The order of state variable initialization has changed in case of inheritance. The order used to be: diff --git a/docs/logo.svg b/docs/logo.svg index 86b9f4995b24..19391843b407 100644 --- a/docs/logo.svg +++ b/docs/logo.svg @@ -1,27 +1,8 @@ - - - - -Vector 1 -Created with Sketch. - - - - - - - - - - - - + + + + + + + diff --git a/docs/metadata.rst b/docs/metadata.rst index d71235653fd8..ede16a73fd8e 100644 --- a/docs/metadata.rst +++ b/docs/metadata.rst @@ -147,14 +147,14 @@ explanatory purposes. "useLiteralContent": true }, // Optional: Optimizer settings. The fields "enabled" and "runs" are deprecated - // and are only given for backwards-compatibility. + // and are only given for backward-compatibility. "optimizer": { "details": { "constantOptimizer": false, "cse": false, "deduplicate": false, - // inliner defaults to "true" - "inliner": true, + // inliner defaults to "false" + "inliner": false, // jumpdestRemover defaults to "true" "jumpdestRemover": true, "orderLiterals": false, @@ -241,7 +241,7 @@ relevant part of the bytecode can be decoded with a CBOR decoder. Check the `Metadata Playground `_ to see it in action. Whereas release builds of solc use a 3 byte encoding of the version as shown -above (one byte each for major, minor and patch version number), prerelease builds +above (one byte each for major, minor and patch version number), pre-release builds will instead use a complete version string including commit hash and build date. The commandline flag ``--no-cbor-metadata`` can be used to skip metadata diff --git a/docs/path-resolution.rst b/docs/path-resolution.rst index f63f5e79d07e..00831e609aa6 100644 --- a/docs/path-resolution.rst +++ b/docs/path-resolution.rst @@ -139,7 +139,7 @@ The initial content of the VFS depends on how you invoke the compiler: #. **Standard input** - On the command line it is also possible to provide the source by sending it to compiler's + On the command-line it is also possible to provide the source by sending it to compiler's standard input: .. code-block:: bash @@ -345,13 +345,13 @@ of the compiler. CLI Path Normalization and Stripping ------------------------------------ -On the command line the compiler behaves just as you would expect from any other program: +On the command-line the compiler behaves just as you would expect from any other program: it accepts paths in a format native to the platform and relative paths are relative to the current working directory. -The source unit names assigned to files whose paths are specified on the command line, however, +The source unit names assigned to files whose paths are specified on the command-line, however, should not change just because the project is being compiled on a different platform or because the compiler happens to have been invoked from a different directory. -To achieve this, paths to source files coming from the command line must be converted to a canonical +To achieve this, paths to source files coming from the command-line must be converted to a canonical form, and, if possible, made relative to the base path or one of the include paths. The normalization rules are as follows: @@ -408,7 +408,7 @@ The resulting file path becomes the source unit name. Prior to version 0.8.8, CLI path stripping was not performed and the only normalization applied was the conversion of path separators. When working with older versions of the compiler it is recommended to invoke the compiler from - the base path and to only use relative paths on the command line. + the base path and to only use relative paths on the command-line. .. index:: ! allowed paths, ! --allow-paths, remapping; target .. _allowed-paths: @@ -421,7 +421,7 @@ locations that are considered safe by default: - Outside of Standard JSON mode: - - The directories containing input files listed on the command line. + - The directories containing input files listed on the command-line. - The directories used as :ref:`remapping ` targets. If the target is not a directory (i.e does not end with ``/``, ``/.`` or ``/..``) the directory containing the target is used instead. @@ -551,7 +551,7 @@ you checked out to ``/project/dapp-bin_old``, then you can run: This means that all imports in ``module2`` point to the old version but imports in ``module1`` point to the new version. -Here are the detailed rules governing the behaviour of remappings: +Here are the detailed rules governing the behavior of remappings: #. **Remappings only affect the translation between import paths and source unit names.** diff --git a/docs/resources.rst b/docs/resources.rst index df0e45019747..84df74fb73cb 100644 --- a/docs/resources.rst +++ b/docs/resources.rst @@ -23,7 +23,7 @@ Integrated (Ethereum) Development Environments Python-based development and testing framework for smart contracts targeting the Ethereum Virtual Machine. * `Dapp `_ - Tool for building, testing and deploying smart contracts from the command line. + Tool for building, testing and deploying smart contracts from the command-line. * `Embark `_ Developer platform for building and deploying decentralized applications. @@ -71,7 +71,7 @@ Editor Integrations * Visual Studio Code (VS Code) - * `Ethereum Remix Visual Studio Code extension `_ + * `Ethereum Remix Visual Studio Code extension `_ Ethereum Remix extension pack for VS Code * `Solidity Visual Studio Code extension, by Juan Blanco `_ @@ -113,9 +113,6 @@ Solidity Tools * `leafleth `_ A documentation generator for Solidity smart-contracts. -* `PIET `_ - A tool to develop, audit and use Solidity smart contracts through a simple graphical interface. - * `Scaffold-ETH `_ Forkable Ethereum development stack focused on fast product iterations. diff --git a/docs/security-considerations.rst b/docs/security-considerations.rst index 30e0a0669c6b..c5b9b093c226 100644 --- a/docs/security-considerations.rst +++ b/docs/security-considerations.rst @@ -447,7 +447,7 @@ so help through off-chain computations might be needed there. If the self-check fails, the contract automatically switches into some kind of "failsafe" mode, which, for example, disables most of the features, hands over control to a fixed and trusted third party -or just converts the contract into a simple "give me back my money" contract. +or just converts the contract into a simple "give me back my Ether" contract. Ask for Peer Review =================== diff --git a/docs/smtchecker.rst b/docs/smtchecker.rst index 9c862e5309fa..f8085b63de6f 100644 --- a/docs/smtchecker.rst +++ b/docs/smtchecker.rst @@ -97,7 +97,7 @@ Overflow The contract above shows an overflow check example. The SMTChecker does not check underflow and overflow by default for Solidity >=0.8.7, -so we need to use the command line option ``--model-checker-targets "underflow,overflow"`` +so we need to use the command-line option ``--model-checker-targets "underflow,overflow"`` or the JSON option ``settings.modelChecker.targets = ["underflow", "overflow"]``. See :ref:`this section for targets configuration`. Here, it reports the following: @@ -412,7 +412,7 @@ is already "locked", so it would not be possible to change the value of ``x``, regardless of what the unknown called code does. If we "forget" to use the ``mutex`` modifier on function ``set``, the -SMTChecker is able to synthesize the behaviour of the externally called code so +SMTChecker is able to synthesize the behavior of the externally called code so that the assertion fails: .. code-block:: text @@ -636,7 +636,7 @@ expression type. It is also helpful to cast the called contract's variable as the type of the most derived type in case of inheritance. - .. code-block:: solidity +.. code-block:: solidity // SPDX-License-Identifier: GPL-3.0 pragma solidity >=0.8.0; @@ -697,8 +697,9 @@ storage for ``address`` variables, therefore if ``B.a`` had type ``address`` the encoding would assume that its storage does not change in between transactions to ``B``. - .. code-block:: solidity +.. code-block:: solidity + // SPDX-License-Identifier: GPL-3.0 pragma solidity >=0.8.0; contract A { @@ -750,7 +751,7 @@ and modulo operations inside Horn rules. Because of that, by default the Solidity division and modulo operations are encoded using the constraint ``a = b * d + m`` where ``d = a / b`` and ``m = a % b``. However, other solvers, such as Eldarica, prefer the syntactically precise operations. -The command line flag ``--model-checker-div-mod-no-slacks`` and the JSON option +The command-line flag ``--model-checker-div-mod-no-slacks`` and the JSON option ``settings.modelChecker.divModNoSlacks`` can be used to toggle the encoding depending on the used solver preferences. diff --git a/docs/style-guide.rst b/docs/style-guide.rst index 6173aecc6e72..266c1817f4f0 100644 --- a/docs/style-guide.rst +++ b/docs/style-guide.rst @@ -28,7 +28,7 @@ captures this concept well. A style guide is about consistency. Consistency with this style guide is important. Consistency within a project is more important. Consistency within one module or function is most important. - But most importantly: **know when to be inconsistent** -- sometimes the style guide just doesn't apply. When in doubt, use your best judgment. Look at other examples and decide what looks best. And don't hesitate to ask! + But most importantly: **know when to be inconsistent** -- sometimes the style guide just doesn't apply. When in doubt, use your best judgment. Look at other examples and decide what looks best. And do not hesitate to ask! *********** @@ -448,7 +448,7 @@ No: y = 2; longVariable = 3; -Don't include a whitespace in the receive and fallback functions: +Do not include a whitespace in the receive and fallback functions: Yes: diff --git a/docs/types/conversion.rst b/docs/types/conversion.rst index 02b1f2cb9241..dafb336bd01e 100644 --- a/docs/types/conversion.rst +++ b/docs/types/conversion.rst @@ -44,7 +44,7 @@ Explicit Conversions If the compiler does not allow implicit conversion but you are confident a conversion will work, an explicit type conversion is sometimes possible. This may -result in unexpected behaviour and allows you to bypass some security +result in unexpected behavior and allows you to bypass some security features of the compiler, so be sure to test that the result is what you want and expect! diff --git a/docs/types/reference-types.rst b/docs/types/reference-types.rst index 4ba2a65b1ce5..a136497e63aa 100644 --- a/docs/types/reference-types.rst +++ b/docs/types/reference-types.rst @@ -47,8 +47,8 @@ non-persistent area where function arguments are stored, and behaves mostly like .. _data-location-assignment: -Data location and assignment behaviour -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +Data location and assignment behavior +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Data locations are not only relevant for persistency of data, but also for the semantics of assignments: @@ -582,10 +582,10 @@ and the assignment will effectively garble the length of ``x``. To be safe, only enlarge bytes arrays by at most one element during a single assignment and do not simultaneously index-access the array in the same statement. -While the above describes the behaviour of dangling storage references in the +While the above describes the behavior of dangling storage references in the current version of the compiler, any code with dangling references should be -considered to have *undefined behaviour*. In particular, this means that -any future version of the compiler may change the behaviour of code that +considered to have *undefined behavior*. In particular, this means that +any future version of the compiler may change the behavior of code that involves dangling references. Be sure to avoid dangling references in your code! @@ -641,7 +641,7 @@ Array slices are useful to ABI-decode secondary data passed in function paramete /// after doing basic validation on the address argument. function forward(bytes calldata payload) external { bytes4 sig = bytes4(payload[:4]); - // Due to truncating behaviour, bytes4(payload) performs identically. + // Due to truncating behavior, bytes4(payload) performs identically. // bytes4 sig = bytes4(payload); if (sig == bytes4(keccak256("setOwner(address)"))) { address owner = abi.decode(payload[4:], (address)); diff --git a/docs/types/value-types.rst b/docs/types/value-types.rst index 60a11d6c30d6..9fcb49b2131a 100644 --- a/docs/types/value-types.rst +++ b/docs/types/value-types.rst @@ -140,7 +140,7 @@ Exponentiation Exponentiation is only available for unsigned types in the exponent. The resulting type of an exponentiation is always equal to the type of the base. Please take care that it is -large enough to hold the result and prepare for potential assertion failures or wrapping behaviour. +large enough to hold the result and prepare for potential assertion failures or wrapping behavior. .. note:: In checked mode, exponentiation only uses the comparatively cheap ``exp`` opcode for small bases. @@ -263,7 +263,7 @@ reverts on failure. There are some dangers in using ``send``: The transfer fails if the call stack depth is at 1024 (this can always be forced by the caller) and it also fails if the recipient runs out of gas. So in order to make safe Ether transfers, always check the return value of ``send``, use ``transfer`` or even better: - use a pattern where the recipient withdraws the money. + use a pattern where the recipient withdraws the Ether. * ``call``, ``delegatecall`` and ``staticcall`` diff --git a/docs/units-and-global-variables.rst b/docs/units-and-global-variables.rst index 84474a9da600..170f0a246a02 100644 --- a/docs/units-and-global-variables.rst +++ b/docs/units-and-global-variables.rst @@ -106,7 +106,7 @@ Block and Transaction Properties Both the timestamp and the block hash can be influenced by miners to some degree. Bad actors in the mining community can for example run a casino payout function on a chosen hash - and just retry a different hash if they did not receive any money. + and just retry a different hash if they did not receive any compensation, e.g. Trx. The current block timestamp must be strictly larger than the timestamp of the last block, but the only guarantee is that it will be somewhere between the timestamps of two @@ -234,7 +234,7 @@ Mathematical and Cryptographic Functions the ecrecover function remained unchanged. This is usually not a problem unless you require signatures to be unique or use them to identify items. - OpenZeppelin have a `ECDSA helper library `_ that you can use as a wrapper for ``ecrecover`` without this issue. + OpenZeppelin has an `ECDSA helper library `_ that you can use as a wrapper for ``ecrecover`` without this issue. .. note:: @@ -281,7 +281,7 @@ For more information, see the section on :ref:`address`. There are some dangers in using ``send``: The transfer fails if the call stack depth is at 1024 (this can always be forced by the caller) and it also fails if the recipient runs out of gas. So in order to make safe Trx transfers, always check the return value of ``send``, use ``transfer`` or even better: - Use a pattern where the recipient withdraws the money. + Use a pattern where the recipient withdraws the Trx. .. warning:: Due to the fact that the EVM considers a call to a non-existing contract to always succeed, @@ -335,7 +335,7 @@ Furthermore, all functions of the current contract are callable directly includi .. warning:: From version 0.8.18 and up, the use of ``selfdestruct`` in both Solidity and Yul will trigger a - deprecation warning, since the ``SELFDESTRUCT`` opcode will eventually undergo breaking changes in behaviour + deprecation warning, since the ``SELFDESTRUCT`` opcode will eventually undergo breaking changes in behavior as stated in `EIP-6049 `_. .. note:: @@ -379,7 +379,7 @@ The following properties are available for a contract type ``C``: In addition to the properties above, the following properties are available for an interface type ``I``: -``type(I).interfaceId``: +``type(I).interfaceId`` A ``bytes4`` value containing the `EIP-165 `_ interface identifier of the given interface ``I``. This identifier is defined as the ``XOR`` of all function selectors defined within the interface itself - excluding all inherited functions. diff --git a/docs/using-the-compiler.rst b/docs/using-the-compiler.rst index fa1a4ec32291..3c0c1a70b609 100644 --- a/docs/using-the-compiler.rst +++ b/docs/using-the-compiler.rst @@ -54,7 +54,7 @@ or ../ ` are treated as relative to the directories specified us Furthermore, the part of the path added via these options will not appear in the contract metadata. For security reasons the compiler has :ref:`restrictions on what directories it can access `. -Directories of source files specified on the command line and target paths of +Directories of source files specified on the command-line and target paths of remappings are automatically allowed to be accessed by the file reader, but everything else is rejected by default. Additional paths (and their subdirectories) can be allowed via the @@ -114,15 +114,15 @@ Setting the EVM Version to Target ********************************* When you compile your contract code you can specify the Ethereum virtual machine -version to compile for to avoid particular features or behaviours. +version to compile for to avoid particular features or behaviors. .. warning:: Compiling for the wrong EVM version can result in wrong, strange and failing - behaviour. Please ensure, especially if running a private chain, that you + behavior. Please ensure, especially if running a private chain, that you use matching EVM versions. -On the command line, you can select the EVM version as follows: +On the command-line, you can select the EVM version as follows: .. code-block:: shell @@ -227,7 +227,7 @@ Input Description "bzzr://56ab...", "ipfs://Qma...", "/tmp/path/to/file.sol" - // If files are used, their directories should be added to the command line via + // If files are used, their directories should be added to the command-line via // `--allow-paths `. ] // If language is set to "SolidityAST", an AST needs to be supplied under the "ast" key. @@ -272,9 +272,9 @@ Input Description // The peephole optimizer is always on if no details are given, // use details to switch it off. "peephole": true, - // The inliner is always on if no details are given, - // use details to switch it off. - "inliner": true, + // The inliner is always off if no details are given, + // use details to switch it on. + "inliner": false, // The unused jumpdest remover is always on if no details are given, // use details to switch it off. "jumpdestRemover": true, @@ -304,7 +304,7 @@ Input Description // optimization-sequence:clean-up-sequence. For more information see // "The Optimizer > Selecting Optimizations". // This field is optional, and if not provided, the default sequences for both - // optimization and clean-up are used. If only one of the options is provivded + // optimization and clean-up are used. If only one of the sequences is provided // the other will not be run. // If only the delimiter ":" is provided then neither the optimization nor the clean-up // sequence will be run. @@ -316,7 +316,8 @@ Input Description }, // Version of the EVM to compile for. // Affects type checking and code generation. Can be homestead, - // tangerineWhistle, spuriousDragon, byzantium, constantinople, petersburg, istanbul, berlin, london or paris + // tangerineWhistle, spuriousDragon, byzantium, constantinople, + // petersburg, istanbul, berlin, london, paris or shanghai (default) "evmVersion": "byzantium", // Optional: Change compilation pipeline to go through the Yul intermediate representation. // This is false by default. @@ -390,7 +391,9 @@ Input Description // userdoc - User documentation (natspec) // metadata - Metadata // ir - Yul intermediate representation of the code before optimization + // irAst - AST of Yul intermediate representation of the code before optimization // irOptimized - Intermediate representation after optimization + // irOptimizedAst - AST of intermediate representation after optimization // storageLayout - Slots, offsets and types of the contract's state variables. // evm.assembly - New assembly format // evm.legacyAssembly - Old-style assembly format in JSON @@ -404,10 +407,8 @@ Input Description // evm.deployedBytecode.immutableReferences - Map from AST ids to bytecode ranges that reference immutables // evm.methodIdentifiers - The list of function hashes // evm.gasEstimates - Function gas estimates - // ewasm.wast - Ewasm in WebAssembly S-expressions format - // ewasm.wasm - Ewasm in WebAssembly binary format // - // Note that using a using `evm`, `evm.bytecode`, `ewasm`, etc. will select every + // Note that using a using `evm`, `evm.bytecode`, etc. will select every // target part of that output. Additionally, `*` can be used as a wildcard to request everything. // "outputSelection": { @@ -501,7 +502,7 @@ Output Description // Mandatory: Error type, such as "TypeError", "InternalCompilerError", "Exception", etc. // See below for complete list of types. "type": "TypeError", - // Mandatory: Component where the error originated, such as "general", "ewasm", etc. + // Mandatory: Component where the error originated, such as "general" etc. "component": "general", // Mandatory ("error", "warning" or "info", but please note that this may be extended in the future) "severity": "error", @@ -538,8 +539,14 @@ Output Description "userdoc": {}, // Developer documentation (natspec) "devdoc": {}, - // Intermediate representation (string) + // Intermediate representation before optimization (string) "ir": "", + // AST of intermediate representation before optimization + "irAst": {/* ... */}, + // Intermediate representation after optimization (string) + "irOptimized": "", + // AST of intermediate representation after optimization + "irOptimizedAst": {/* ... */}, // See the Storage Layout documentation. "storageLayout": {"storage": [/* ... */], "types": {/* ... */} }, // EVM-related outputs @@ -617,13 +624,6 @@ Output Description "heavyLifting()": "infinite" } } - }, - // Ewasm related outputs - "ewasm": { - // S-expressions format - "wast": "", - // Binary format (hex string) - "wasm": "" } } } @@ -648,4 +648,4 @@ Error Types 12. ``FatalError``: Fatal error not processed correctly - this should be reported as an issue. 13. ``YulException``: Error during Yul code generation - this should be reported as an issue. 14. ``Warning``: A warning, which didn't stop the compilation, but should be addressed if possible. -15. ``Info``: Information that the compiler thinks the user might find useful, but is not dangerous and does not necessarily need to be addressed. \ No newline at end of file +15. ``Info``: Information that the compiler thinks the user might find useful, but is not dangerous and does not necessarily need to be addressed. diff --git a/docs/yul.rst b/docs/yul.rst index 07eaed08dfa4..3c94345e14d6 100644 --- a/docs/yul.rst +++ b/docs/yul.rst @@ -960,7 +960,7 @@ the ``dup`` and ``swap`` instructions as well as ``jump`` instructions, labels a .. warning:: From version 0.8.18 and up, the use of ``selfdestruct`` in both Solidity and Yul will trigger a - deprecation warning, since the ``SELFDESTRUCT`` opcode will eventually undergo breaking changes in behaviour + deprecation warning, since the ``SELFDESTRUCT`` opcode will eventually undergo breaking changes in behavior as stated in `EIP-6049 `_. In some internal dialects, there are additional functions: @@ -995,7 +995,7 @@ Its first and only argument must be a string literal and uniquely represents the Identifiers can be arbitrary but when the compiler produces Yul code from Solidity sources, it uses a library name qualified with the name of the source unit that defines that library. To link the code with a particular library address, the same identifier must be provided to the -``--libraries`` option on the command line. +``--libraries`` option on the command-line. For example this code @@ -1076,12 +1076,12 @@ or even opcodes unknown to the Solidity compiler, care has to be taken when using ``verbatim`` together with the optimizer. Even when the optimizer is switched off, the code generator has to determine the stack layout, which means that e.g. using ``verbatim`` to modify -the stack height can lead to undefined behaviour. +the stack height can lead to undefined behavior. The following is a non-exhaustive list of restrictions on verbatim bytecode that are not checked by the compiler. Violations of these restrictions can result in -undefined behaviour. +undefined behavior. - Control-flow should not jump into or out of verbatim blocks, but it can jump within the same verbatim block. @@ -1194,8 +1194,7 @@ An example Yul Object is shown below: // executing code is the constructor code) size := datasize("Contract1_deployed") offset := allocate(size) - // This will turn into a memory->memory copy for Ewasm and - // a codecopy for EVM + // This will turn into a codecopy for EVM datacopy(offset, dataoffset("Contract1_deployed"), size) return(offset, size) } diff --git a/libevmasm/Assembly.cpp b/libevmasm/Assembly.cpp index b9b946aa59df..f524aad66b8a 100644 --- a/libevmasm/Assembly.cpp +++ b/libevmasm/Assembly.cpp @@ -42,7 +42,6 @@ #include #include -using namespace std; using namespace solidity; using namespace solidity::evmasm; using namespace solidity::langutil; @@ -77,7 +76,7 @@ unsigned Assembly::codeSize(unsigned subTagSize) const namespace { -string locationFromSources(StringMap const& _sourceCodes, SourceLocation const& _location) +std::string locationFromSources(StringMap const& _sourceCodes, SourceLocation const& _location) { if (!_location.hasText() || _sourceCodes.empty()) return {}; @@ -92,7 +91,7 @@ string locationFromSources(StringMap const& _sourceCodes, SourceLocation const& class Functionalizer { public: - Functionalizer (ostream& _out, string const& _prefix, StringMap const& _sourceCodes, Assembly const& _assembly): + Functionalizer (std::ostream& _out, std::string const& _prefix, StringMap const& _sourceCodes, Assembly const& _assembly): m_out(_out), m_prefix(_prefix), m_sourceCodes(_sourceCodes), m_assembly(_assembly) {} @@ -105,7 +104,7 @@ class Functionalizer printLocation(_debugInfoSelection); } - string expression = _item.toAssemblyText(m_assembly); + std::string expression = _item.toAssemblyText(m_assembly); if (!( _item.canBeFunctional() && @@ -114,7 +113,7 @@ class Functionalizer )) { flush(); - m_out << m_prefix << (_item.type() == Tag ? "" : " ") << expression << endl; + m_out << m_prefix << (_item.type() == Tag ? "" : " ") << expression << std::endl; return; } if (_item.arguments() > 0) @@ -137,8 +136,8 @@ class Functionalizer void flush() { - for (string const& expression: m_pending) - m_out << m_prefix << " " << expression << endl; + for (std::string const& expression: m_pending) + m_out << m_prefix << " " << expression << std::endl; m_pending.clear(); } @@ -154,7 +153,7 @@ class Functionalizer if (m_location.sourceName) m_out << " " + escapeAndQuoteString(*m_location.sourceName); if (m_location.hasText()) - m_out << ":" << to_string(m_location.start) + ":" + to_string(m_location.end); + m_out << ":" << std::to_string(m_location.start) + ":" + std::to_string(m_location.end); } if (_debugInfoSelection.snippet) @@ -165,15 +164,15 @@ class Functionalizer m_out << locationFromSources(m_sourceCodes, m_location); } - m_out << " */" << endl; + m_out << " */" << std::endl; } private: strings m_pending; SourceLocation m_location; - ostream& m_out; - string const& m_prefix; + std::ostream& m_out; + std::string const& m_prefix; StringMap const& m_sourceCodes; Assembly const& m_assembly; }; @@ -181,9 +180,9 @@ class Functionalizer } void Assembly::assemblyStream( - ostream& _out, + std::ostream& _out, DebugInfoSelection const& _debugInfoSelection, - string const& _prefix, + std::string const& _prefix, StringMap const& _sourceCodes ) const { @@ -195,34 +194,34 @@ void Assembly::assemblyStream( if (!m_data.empty() || !m_subs.empty()) { - _out << _prefix << "stop" << endl; + _out << _prefix << "stop" << std::endl; for (auto const& i: m_data) if (u256(i.first) >= m_subs.size()) - _out << _prefix << "data_" << toHex(u256(i.first)) << " " << util::toHex(i.second) << endl; + _out << _prefix << "data_" << toHex(u256(i.first)) << " " << util::toHex(i.second) << std::endl; for (size_t i = 0; i < m_subs.size(); ++i) { - _out << endl << _prefix << "sub_" << i << ": assembly {\n"; + _out << std::endl << _prefix << "sub_" << i << ": assembly {\n"; m_subs[i]->assemblyStream(_out, _debugInfoSelection, _prefix + " ", _sourceCodes); - _out << _prefix << "}" << endl; + _out << _prefix << "}" << std::endl; } } if (m_auxiliaryData.size() > 0) - _out << endl << _prefix << "auxdata: 0x" << util::toHex(m_auxiliaryData) << endl; + _out << std::endl << _prefix << "auxdata: 0x" << util::toHex(m_auxiliaryData) << std::endl; } -string Assembly::assemblyString( +std::string Assembly::assemblyString( DebugInfoSelection const& _debugInfoSelection, StringMap const& _sourceCodes ) const { - ostringstream tmp; + std::ostringstream tmp; assemblyStream(tmp, _debugInfoSelection, "", _sourceCodes); return tmp.str(); } -Json::Value Assembly::assemblyJSON(map const& _sourceIndices, bool _includeSourceList) const +Json::Value Assembly::assemblyJSON(std::map const& _sourceIndices, bool _includeSourceList) const { Json::Value root; root[".code"] = Json::arrayValue; @@ -244,7 +243,7 @@ Json::Value Assembly::assemblyJSON(map const& _sourceIndices, jsonItem["end"] = item.location().end; if (item.m_modifierDepth != 0) jsonItem["modifierDepth"] = static_cast(item.m_modifierDepth); - string jumpType = item.getJumpTypeAsString(); + std::string jumpType = item.getJumpTypeAsString(); if (!jumpType.empty()) jsonItem["jumpType"] = jumpType; if (name == "PUSHLIB") @@ -286,8 +285,8 @@ Json::Value Assembly::assemblyJSON(map const& _sourceIndices, for (size_t i = 0; i < m_subs.size(); ++i) { - stringstream hexStr; - hexStr << hex << i; + std::stringstream hexStr; + hexStr << std::hex << i; data[hexStr.str()] = m_subs[i]->assemblyJSON(_sourceIndices, /*_includeSourceList = */false); } } @@ -298,7 +297,7 @@ Json::Value Assembly::assemblyJSON(map const& _sourceIndices, return root; } -AssemblyItem Assembly::namedTag(string const& _name, size_t _params, size_t _returns, optional _sourceID) +AssemblyItem Assembly::namedTag(std::string const& _name, size_t _params, size_t _returns, std::optional _sourceID) { assertThrow(!_name.empty(), AssemblyException, "Empty named tag."); if (m_namedTags.count(_name)) @@ -312,21 +311,21 @@ AssemblyItem Assembly::namedTag(string const& _name, size_t _params, size_t _ret return AssemblyItem{Tag, m_namedTags.at(_name).id}; } -AssemblyItem Assembly::newPushLibraryAddress(string const& _identifier) +AssemblyItem Assembly::newPushLibraryAddress(std::string const& _identifier) { h256 h(util::keccak256(_identifier)); m_libraries[h] = _identifier; return AssemblyItem{PushLibraryAddress, h}; } -AssemblyItem Assembly::newPushImmutable(string const& _identifier) +AssemblyItem Assembly::newPushImmutable(std::string const& _identifier) { h256 h(util::keccak256(_identifier)); m_immutables[h] = _identifier; return AssemblyItem{PushImmutable, h}; } -AssemblyItem Assembly::newImmutableAssignment(string const& _identifier) +AssemblyItem Assembly::newImmutableAssignment(std::string const& _identifier) { h256 h(util::keccak256(_identifier)); m_immutables[h] = _identifier; @@ -339,9 +338,9 @@ Assembly& Assembly::optimise(OptimiserSettings const& _settings) return *this; } -map const& Assembly::optimiseInternal( +std::map const& Assembly::optimiseInternal( OptimiserSettings const& _settings, - set _tagsReferencedFromOutside + std::set _tagsReferencedFromOutside ) { if (m_tagReplacements) @@ -352,7 +351,7 @@ map const& Assembly::optimiseInternal( { OptimiserSettings settings = _settings; Assembly& sub = *m_subs[subId]; - map const& subTagReplacements = sub.optimiseInternal( + std::map const& subTagReplacements = sub.optimiseInternal( settings, JumpdestRemover::referencedTags(m_items, subId) ); @@ -360,7 +359,7 @@ map const& Assembly::optimiseInternal( BlockDeduplicator::applyTagReplacement(m_items, subTagReplacements, subId); } - map tagReplacements; + std::map tagReplacements; // Iterate until no new optimisation possibilities are found. for (unsigned count = 1; count > 0;) { @@ -401,7 +400,7 @@ map const& Assembly::optimiseInternal( for (auto const& replacement: deduplicator.replacedTags()) { assertThrow( - replacement.first <= numeric_limits::max() && replacement.second <= numeric_limits::max(), + replacement.first <= std::numeric_limits::max() && replacement.second <= std::numeric_limits::max(), OptimizerException, "Invalid tag replacement." ); @@ -494,7 +493,7 @@ LinkerObject const& Assembly::assemble() const LinkerObject& ret = m_assembledObject; size_t subTagSize = 1; - map>> immutableReferencesBySub; + std::map>> immutableReferencesBySub; for (auto const& sub: m_subs) { auto const& linkerObject = sub->assemble(); @@ -508,7 +507,7 @@ LinkerObject const& Assembly::assemble() const immutableReferencesBySub = linkerObject.immutableReferences; } for (size_t tagPos: sub->m_tagPositionsInBytecode) - if (tagPos != numeric_limits::max() && tagPos > subTagSize) + if (tagPos != std::numeric_limits::max() && tagPos > subTagSize) subTagSize = tagPos; } @@ -531,11 +530,11 @@ LinkerObject const& Assembly::assemble() const ); unsigned bytesRequiredForCode = codeSize(static_cast(subTagSize)); - m_tagPositionsInBytecode = vector(m_usedTags, numeric_limits::max()); - map> tagRef; - multimap dataRef; - multimap subRef; - vector sizeRef; ///< Pointers to code locations where the size of the program is inserted + m_tagPositionsInBytecode = std::vector(m_usedTags, std::numeric_limits::max()); + std::map> tagRef; + std::multimap dataRef; + std::multimap subRef; + std::vector sizeRef; ///< Pointers to code locations where the size of the program is inserted unsigned bytesPerTag = numberEncodingSize(bytesRequiredForCode); uint8_t tagPush = static_cast(pushInstruction(bytesPerTag)); @@ -550,7 +549,7 @@ LinkerObject const& Assembly::assemble() const for (AssemblyItem const& i: m_items) { // store position of the invalid jump destination - if (i.type() != Tag && m_tagPositionsInBytecode[0] == numeric_limits::max()) + if (i.type() != Tag && m_tagPositionsInBytecode[0] == std::numeric_limits::max()) m_tagPositionsInBytecode[0] = ret.bytecode.size(); switch (i.type()) @@ -583,21 +582,21 @@ LinkerObject const& Assembly::assemble() const } case PushData: ret.bytecode.push_back(dataRefPush); - dataRef.insert(make_pair(h256(i.data()), ret.bytecode.size())); + dataRef.insert(std::make_pair(h256(i.data()), ret.bytecode.size())); ret.bytecode.resize(ret.bytecode.size() + bytesPerDataRef); break; case PushSub: - assertThrow(i.data() <= numeric_limits::max(), AssemblyException, ""); + assertThrow(i.data() <= std::numeric_limits::max(), AssemblyException, ""); ret.bytecode.push_back(dataRefPush); - subRef.insert(make_pair(static_cast(i.data()), ret.bytecode.size())); + subRef.insert(std::make_pair(static_cast(i.data()), ret.bytecode.size())); ret.bytecode.resize(ret.bytecode.size() + bytesPerDataRef); break; case PushSubSize: { - assertThrow(i.data() <= numeric_limits::max(), AssemblyException, ""); + assertThrow(i.data() <= std::numeric_limits::max(), AssemblyException, ""); auto s = subAssemblyById(static_cast(i.data()))->assemble().bytecode.size(); i.setPushedValue(u256(s)); - unsigned b = max(1, numberEncodingSize(s)); + unsigned b = std::max(1, numberEncodingSize(s)); ret.bytecode.push_back(static_cast(pushInstruction(b))); ret.bytecode.resize(ret.bytecode.size() + b); bytesRef byr(&ret.bytecode.back() + 1 - b, b); @@ -618,7 +617,7 @@ LinkerObject const& Assembly::assemble() const break; case PushImmutable: ret.bytecode.push_back(static_cast(Instruction::PUSH32)); - // Maps keccak back to the "identifier" string of that immutable. + // Maps keccak back to the "identifier" std::string of that immutable. ret.immutableReferences[i.data()].first = m_immutables.at(i.data()); // Record the bytecode offset of the PUSH32 argument. ret.immutableReferences[i.data()].second.emplace_back(ret.bytecode.size()); @@ -661,10 +660,10 @@ LinkerObject const& Assembly::assemble() const case Tag: { assertThrow(i.data() != 0, AssemblyException, "Invalid tag position."); - assertThrow(i.splitForeignPushTag().first == numeric_limits::max(), AssemblyException, "Foreign tag."); + assertThrow(i.splitForeignPushTag().first == std::numeric_limits::max(), AssemblyException, "Foreign tag."); size_t tagId = static_cast(i.data()); assertThrow(ret.bytecode.size() < 0xffffffffL, AssemblyException, "Tag too large."); - assertThrow(m_tagPositionsInBytecode[tagId] == numeric_limits::max(), AssemblyException, "Duplicate tag position."); + assertThrow(m_tagPositionsInBytecode[tagId] == std::numeric_limits::max(), AssemblyException, "Duplicate tag position."); m_tagPositionsInBytecode[tagId] = ret.bytecode.size(); ret.bytecode.push_back(static_cast(Instruction::JUMPDEST)); break; @@ -686,7 +685,7 @@ LinkerObject const& Assembly::assemble() const // Append an INVALID here to help tests find miscompilation. ret.bytecode.push_back(static_cast(Instruction::INVALID)); - map subAssemblyOffsets; + std::map subAssemblyOffsets; for (auto const& [subIdPath, bytecodeOffset]: subRef) { LinkerObject subObject = subAssemblyById(subIdPath)->assemble(); @@ -709,15 +708,15 @@ LinkerObject const& Assembly::assemble() const { size_t subId; size_t tagId; - tie(subId, tagId) = i.second; - assertThrow(subId == numeric_limits::max() || subId < m_subs.size(), AssemblyException, "Invalid sub id"); - vector const& tagPositions = - subId == numeric_limits::max() ? + std::tie(subId, tagId) = i.second; + assertThrow(subId == std::numeric_limits::max() || subId < m_subs.size(), AssemblyException, "Invalid sub id"); + std::vector const& tagPositions = + subId == std::numeric_limits::max() ? m_tagPositionsInBytecode : m_subs[subId]->m_tagPositionsInBytecode; assertThrow(tagId < tagPositions.size(), AssemblyException, "Reference to non-existing tag."); size_t pos = tagPositions[tagId]; - assertThrow(pos != numeric_limits::max(), AssemblyException, "Reference to tag without position."); + assertThrow(pos != std::numeric_limits::max(), AssemblyException, "Reference to tag without position."); assertThrow(numberEncodingSize(pos) <= bytesPerTag, AssemblyException, "Tag too large for reserved space."); bytesRef r(ret.bytecode.data() + i.first, bytesPerTag); toBigEndian(pos, r); @@ -725,7 +724,7 @@ LinkerObject const& Assembly::assemble() const for (auto const& [name, tagInfo]: m_namedTags) { size_t position = m_tagPositionsInBytecode.at(tagInfo.id); - optional tagIndex; + std::optional tagIndex; for (auto&& [index, item]: m_items | ranges::views::enumerate) if (item.type() == Tag && static_cast(item.data()) == tagInfo.id) { @@ -733,7 +732,7 @@ LinkerObject const& Assembly::assemble() const break; } ret.functionDebugData[name] = { - position == numeric_limits::max() ? nullopt : optional{position}, + position == std::numeric_limits::max() ? std::nullopt : std::optional{position}, tagIndex, tagInfo.sourceID, tagInfo.params, @@ -764,7 +763,7 @@ LinkerObject const& Assembly::assemble() const return ret; } -vector Assembly::decodeSubPath(size_t _subObjectId) const +std::vector Assembly::decodeSubPath(size_t _subObjectId) const { if (_subObjectId < m_subs.size()) return {_subObjectId}; @@ -779,7 +778,7 @@ vector Assembly::decodeSubPath(size_t _subObjectId) const return subIdPathIt->first; } -size_t Assembly::encodeSubPath(vector const& _subPath) +size_t Assembly::encodeSubPath(std::vector const& _subPath) { assertThrow(!_subPath.empty(), AssemblyException, ""); if (_subPath.size() == 1) @@ -790,7 +789,7 @@ size_t Assembly::encodeSubPath(vector const& _subPath) if (m_subPaths.find(_subPath) == m_subPaths.end()) { - size_t objectId = numeric_limits::max() - m_subPaths.size(); + size_t objectId = std::numeric_limits::max() - m_subPaths.size(); assertThrow(objectId >= m_subs.size(), AssemblyException, ""); m_subPaths[_subPath] = objectId; } @@ -800,7 +799,7 @@ size_t Assembly::encodeSubPath(vector const& _subPath) Assembly const* Assembly::subAssemblyById(size_t _subId) const { - vector subIds = decodeSubPath(_subId); + std::vector subIds = decodeSubPath(_subId); Assembly const* currentAssembly = this; for (size_t currentSubId: subIds) { diff --git a/libevmasm/AssemblyItem.cpp b/libevmasm/AssemblyItem.cpp index 5661fb94021e..6c2b673c697d 100644 --- a/libevmasm/AssemblyItem.cpp +++ b/libevmasm/AssemblyItem.cpp @@ -30,7 +30,7 @@ #include #include -using namespace std; +using namespace std::literals; using namespace solidity; using namespace solidity::evmasm; using namespace solidity::langutil; @@ -40,10 +40,10 @@ static_assert(sizeof(size_t) <= 8, "size_t must be at most 64-bits wide"); namespace { -string toStringInHex(u256 _value) +std::string toStringInHex(u256 _value) { - stringstream hexStr; - hexStr << uppercase << hex << _value; + std::stringstream hexStr; + hexStr << std::uppercase << std::hex << _value; return hexStr.str(); } @@ -60,16 +60,16 @@ AssemblyItem AssemblyItem::toSubAssemblyTag(size_t _subId) const return r; } -pair AssemblyItem::splitForeignPushTag() const +std::pair AssemblyItem::splitForeignPushTag() const { assertThrow(m_type == PushTag || m_type == Tag, util::Exception, ""); u256 combined = u256(data()); size_t subId = static_cast((combined >> 64) - 1); size_t tag = static_cast(combined & 0xffffffffffffffffULL); - return make_pair(subId, tag); + return std::make_pair(subId, tag); } -pair AssemblyItem::nameAndData(langutil::EVMVersion _evmVersion) const +std::pair AssemblyItem::nameAndData(langutil::EVMVersion _evmVersion) const { switch (type()) { @@ -111,7 +111,7 @@ void AssemblyItem::setPushTagSubIdAndTag(size_t _subId, size_t _tag) { assertThrow(m_type == PushTag || m_type == Tag, util::Exception, ""); u256 data = _tag; - if (_subId != numeric_limits::max()) + if (_subId != std::numeric_limits::max()) data |= (u256(_subId) + 1) << 64; setData(data); } @@ -124,7 +124,7 @@ size_t AssemblyItem::bytesRequired(size_t _addressLength, Precision _precision) case Tag: // 1 byte for the JUMPDEST return 1; case Push: - return 1 + max(1, numberEncodingSize(data())); + return 1 + std::max(1, numberEncodingSize(data())); case PushSubSize: case PushProgramSize: return 1 + 4; // worst case: a 16MB program @@ -158,7 +158,7 @@ size_t AssemblyItem::bytesRequired(size_t _addressLength, Precision _precision) return 2; } case VerbatimBytecode: - return get<2>(*m_verbatimBytecode).size(); + return std::get<2>(*m_verbatimBytecode).size(); default: break; } @@ -172,7 +172,7 @@ size_t AssemblyItem::arguments() const // the same across all EVM versions except for the instruction name. return static_cast(instructionInfo(instruction(), EVMVersion()).args); else if (type() == VerbatimBytecode) - return get<0>(*m_verbatimBytecode); + return std::get<0>(*m_verbatimBytecode); else if (type() == AssignImmutable) return 2; else @@ -200,7 +200,7 @@ size_t AssemblyItem::returnValues() const case Tag: return 0; case VerbatimBytecode: - return get<1>(*m_verbatimBytecode); + return std::get<1>(*m_verbatimBytecode); default: break; } @@ -233,7 +233,7 @@ bool AssemblyItem::canBeFunctional() const return false; } -string AssemblyItem::getJumpTypeAsString() const +std::string AssemblyItem::getJumpTypeAsString() const { switch (m_jumpType) { @@ -247,9 +247,9 @@ string AssemblyItem::getJumpTypeAsString() const } } -string AssemblyItem::toAssemblyText(Assembly const& _assembly) const +std::string AssemblyItem::toAssemblyText(Assembly const& _assembly) const { - string text; + std::string text; switch (type()) { case Operation: @@ -265,26 +265,26 @@ string AssemblyItem::toAssemblyText(Assembly const& _assembly) const { size_t sub{0}; size_t tag{0}; - tie(sub, tag) = splitForeignPushTag(); - if (sub == numeric_limits::max()) - text = string("tag_") + to_string(tag); + std::tie(sub, tag) = splitForeignPushTag(); + if (sub == std::numeric_limits::max()) + text = std::string("tag_") + std::to_string(tag); else - text = string("tag_") + to_string(sub) + "_" + to_string(tag); + text = std::string("tag_") + std::to_string(sub) + "_" + std::to_string(tag); break; } case Tag: assertThrow(data() < 0x10000, AssemblyException, "Declaration of sub-assembly tag."); - text = string("tag_") + to_string(static_cast(data())) + ":"; + text = std::string("tag_") + std::to_string(static_cast(data())) + ":"; break; case PushData: - text = string("data_") + toHex(data()); + text = std::string("data_") + toHex(data()); break; case PushSub: case PushSubSize: { - vector subPathComponents; + std::vector subPathComponents; for (size_t subPathComponentId: _assembly.decodeSubPath(static_cast(data()))) - subPathComponents.emplace_back("sub_" + to_string(subPathComponentId)); + subPathComponents.emplace_back("sub_" + std::to_string(subPathComponentId)); text = (type() == PushSub ? "dataOffset"s : "dataSize"s) + "(" + @@ -293,25 +293,25 @@ string AssemblyItem::toAssemblyText(Assembly const& _assembly) const break; } case PushProgramSize: - text = string("bytecodeSize"); + text = std::string("bytecodeSize"); break; case PushLibraryAddress: - text = string("linkerSymbol(\"") + toHex(data()) + string("\")"); + text = std::string("linkerSymbol(\"") + toHex(data()) + std::string("\")"); break; case PushDeployTimeAddress: - text = string("deployTimeAddress()"); + text = std::string("deployTimeAddress()"); break; case PushImmutable: - text = string("immutable(\"") + "0x" + util::toHex(toCompactBigEndian(data(), 1)) + "\")"; + text = std::string("immutable(\"") + "0x" + util::toHex(toCompactBigEndian(data(), 1)) + "\")"; break; case AssignImmutable: - text = string("assignImmutable(\"") + "0x" + util::toHex(toCompactBigEndian(data(), 1)) + "\")"; + text = std::string("assignImmutable(\"") + "0x" + util::toHex(toCompactBigEndian(data(), 1)) + "\")"; break; case UndefinedItem: assertThrow(false, AssemblyException, "Invalid assembly item."); break; case VerbatimBytecode: - text = string("verbatimbytecode_") + util::toHex(get<2>(*m_verbatimBytecode)); + text = std::string("verbatimbytecode_") + util::toHex(std::get<2>(*m_verbatimBytecode)); break; default: assertThrow(false, InvalidOpcode, ""); @@ -328,7 +328,7 @@ string AssemblyItem::toAssemblyText(Assembly const& _assembly) const } // Note: This method is exclusively used for debugging. -ostream& solidity::evmasm::operator<<(ostream& _out, AssemblyItem const& _item) +std::ostream& solidity::evmasm::operator<<(std::ostream& _out, AssemblyItem const& _item) { switch (_item.type()) { @@ -338,12 +338,12 @@ ostream& solidity::evmasm::operator<<(ostream& _out, AssemblyItem const& _item) _out << "\t" << _item.getJumpTypeAsString(); break; case Push: - _out << " PUSH " << hex << _item.data() << dec; + _out << " PUSH " << std::hex << _item.data() << std::dec; break; case PushTag: { size_t subId = _item.splitForeignPushTag().first; - if (subId == numeric_limits::max()) + if (subId == std::numeric_limits::max()) _out << " PushTag " << _item.splitForeignPushTag().second; else _out << " PushTag " << subId << ":" << _item.splitForeignPushTag().second; @@ -353,20 +353,20 @@ ostream& solidity::evmasm::operator<<(ostream& _out, AssemblyItem const& _item) _out << " Tag " << _item.data(); break; case PushData: - _out << " PushData " << hex << static_cast(_item.data()) << dec; + _out << " PushData " << std::hex << static_cast(_item.data()) << std::dec; break; case PushSub: - _out << " PushSub " << hex << static_cast(_item.data()) << dec; + _out << " PushSub " << std::hex << static_cast(_item.data()) << std::dec; break; case PushSubSize: - _out << " PushSubSize " << hex << static_cast(_item.data()) << dec; + _out << " PushSubSize " << std::hex << static_cast(_item.data()) << std::dec; break; case PushProgramSize: _out << " PushProgramSize"; break; case PushLibraryAddress: { - string hash(util::h256((_item.data())).hex()); + std::string hash(util::h256((_item.data())).hex()); _out << " PushLibraryAddress " << hash.substr(0, 8) + "..." + hash.substr(hash.length() - 8); break; } @@ -411,12 +411,12 @@ size_t AssemblyItem::opcodeCount() const noexcept } } -string AssemblyItem::computeSourceMapping( +std::string AssemblyItem::computeSourceMapping( AssemblyItems const& _items, - map const& _sourceIndicesMap + std::map const& _sourceIndicesMap ) { - string ret; + std::string ret; int prevStart = -1; int prevLength = -1; @@ -465,17 +465,17 @@ string AssemblyItem::computeSourceMapping( if (components-- > 0) { if (location.start != prevStart) - ret += to_string(location.start); + ret += std::to_string(location.start); if (components-- > 0) { ret += ':'; if (length != prevLength) - ret += to_string(length); + ret += std::to_string(length); if (components-- > 0) { ret += ':'; if (sourceIndex != prevSourceIndex) - ret += to_string(sourceIndex); + ret += std::to_string(sourceIndex); if (components-- > 0) { ret += ':'; @@ -485,7 +485,7 @@ string AssemblyItem::computeSourceMapping( { ret += ':'; if (modifierDepth != prevModifierDepth) - ret += to_string(modifierDepth); + ret += std::to_string(modifierDepth); } } } @@ -493,7 +493,7 @@ string AssemblyItem::computeSourceMapping( } if (item.opcodeCount() > 1) - ret += string(item.opcodeCount() - 1, ';'); + ret += std::string(item.opcodeCount() - 1, ';'); prevStart = location.start; prevLength = length; diff --git a/libevmasm/BlockDeduplicator.cpp b/libevmasm/BlockDeduplicator.cpp index 5f9fa768ffde..c978bae2bb39 100644 --- a/libevmasm/BlockDeduplicator.cpp +++ b/libevmasm/BlockDeduplicator.cpp @@ -30,7 +30,6 @@ #include #include -using namespace std; using namespace solidity; using namespace solidity::evmasm; @@ -49,7 +48,7 @@ bool BlockDeduplicator::deduplicate() ) return false; - function comparator = [&](size_t _i, size_t _j) + std::function comparator = [&](size_t _i, size_t _j) { if (_i == _j) return false; @@ -81,7 +80,7 @@ bool BlockDeduplicator::deduplicate() for (; ; ++iterations) { //@todo this should probably be optimized. - set> blocksSeen(comparator); + std::set> blocksSeen(comparator); for (size_t i = 0; i < m_items.size(); ++i) { if (m_items.at(i).type() != Tag) @@ -101,7 +100,7 @@ bool BlockDeduplicator::deduplicate() bool BlockDeduplicator::applyTagReplacement( AssemblyItems& _items, - map const& _replacements, + std::map const& _replacements, size_t _subId ) { @@ -111,7 +110,7 @@ bool BlockDeduplicator::applyTagReplacement( { size_t subId; size_t tagId; - tie(subId, tagId) = item.splitForeignPushTag(); + std::tie(subId, tagId) = item.splitForeignPushTag(); if (subId != _subId) continue; auto it = _replacements.find(tagId); diff --git a/libevmasm/CommonSubexpressionEliminator.cpp b/libevmasm/CommonSubexpressionEliminator.cpp index d097f3c725f0..de1e5a364aca 100644 --- a/libevmasm/CommonSubexpressionEliminator.cpp +++ b/libevmasm/CommonSubexpressionEliminator.cpp @@ -30,12 +30,11 @@ #include -using namespace std; using namespace solidity; using namespace solidity::evmasm; using namespace solidity::langutil; -vector CommonSubexpressionEliminator::getOptimizedItems() +std::vector CommonSubexpressionEliminator::getOptimizedItems() { optimizeBreakingItem(); @@ -52,11 +51,11 @@ vector CommonSubexpressionEliminator::getOptimizedItems() m_state = std::move(nextState); }); - map initialStackContents; - map targetStackContents; + std::map initialStackContents; + std::map targetStackContents; int minHeight = m_state.stackHeight() + 1; if (!m_state.stackElements().empty()) - minHeight = min(minHeight, m_state.stackElements().begin()->first); + minHeight = std::min(minHeight, m_state.stackElements().begin()->first); for (int height = minHeight; height <= m_initialState.stackHeight(); ++height) initialStackContents[height] = m_initialState.stackElement(height, SourceLocation()); for (int height = minHeight; height <= m_state.stackHeight(); ++height) @@ -125,19 +124,19 @@ void CommonSubexpressionEliminator::optimizeBreakingItem() CSECodeGenerator::CSECodeGenerator( ExpressionClasses& _expressionClasses, - vector const& _storeOperations + std::vector const& _storeOperations ): m_expressionClasses(_expressionClasses) { for (auto const& store: _storeOperations) - m_storeOperations[make_pair(store.target, store.slot)].push_back(store); + m_storeOperations[std::make_pair(store.target, store.slot)].push_back(store); } AssemblyItems CSECodeGenerator::generateCode( unsigned _initialSequenceNumber, int _initialStackHeight, - map const& _initialStack, - map const& _targetStackContents + std::map const& _initialStack, + std::map const& _targetStackContents ) { m_stackHeight = _initialStackHeight; @@ -156,7 +155,7 @@ AssemblyItems CSECodeGenerator::generateCode( } // store all needed sequenced expressions - set> sequencedExpressions; + std::set> sequencedExpressions; for (auto const& p: m_neededBy) for (auto id: {p.first, p.second}) if (unsigned seqNr = m_expressionClasses.representative(id).sequenceNumber) @@ -165,7 +164,7 @@ AssemblyItems CSECodeGenerator::generateCode( // @todo quick fix for now. Proper fix needs to choose representative with higher // sequence number during dependency analysis. assertThrow(seqNr >= _initialSequenceNumber, StackTooDeepException, util::stackTooDeepString); - sequencedExpressions.insert(make_pair(seqNr, id)); + sequencedExpressions.insert(std::make_pair(seqNr, id)); } // Perform all operations on storage and memory in order, if they are needed. @@ -230,7 +229,7 @@ void CSECodeGenerator::addDependencies(Id _c) for (Id argument: expr.arguments) { addDependencies(argument); - m_neededBy.insert(make_pair(argument, _c)); + m_neededBy.insert(std::make_pair(argument, _c)); } if (expr.item && expr.item->type() == Operation && ( expr.item->instruction() == Instruction::SLOAD || @@ -294,7 +293,7 @@ void CSECodeGenerator::addDependencies(Id _c) if (it->sequenceNumber < expr.sequenceNumber) latestStore = it->expression; addDependencies(latestStore); - m_neededBy.insert(make_pair(latestStore, _c)); + m_neededBy.insert(std::make_pair(latestStore, _c)); } } } @@ -331,7 +330,7 @@ void CSECodeGenerator::generateClassElement(Id _c, bool _allowSequenced) OptimizerException, "Undefined item requested but not available." ); - vector const& arguments = expr.arguments; + std::vector const& arguments = expr.arguments; for (Id arg: arguments | ranges::views::reverse) generateClassElement(arg); @@ -495,7 +494,7 @@ void CSECodeGenerator::appendOrRemoveSwap(int _fromPosition, SourceLocation cons m_classPositions[m_stack[m_stackHeight]].insert(_fromPosition); m_classPositions[m_stack[_fromPosition]].erase(_fromPosition); m_classPositions[m_stack[_fromPosition]].insert(m_stackHeight); - swap(m_stack[m_stackHeight], m_stack[_fromPosition]); + std::swap(m_stack[m_stackHeight], m_stack[_fromPosition]); } if (m_generatedItems.size() >= 2 && SemanticInformation::isSwapInstruction(m_generatedItems.back()) && diff --git a/libevmasm/ConstantOptimiser.cpp b/libevmasm/ConstantOptimiser.cpp index 5bce21cf1e10..62dbc803bbc2 100644 --- a/libevmasm/ConstantOptimiser.cpp +++ b/libevmasm/ConstantOptimiser.cpp @@ -24,7 +24,6 @@ #include #include -using namespace std; using namespace solidity; using namespace solidity::evmasm; @@ -39,11 +38,11 @@ unsigned ConstantOptimisationMethod::optimiseConstants( AssemblyItems& _items = _assembly.items(); unsigned optimisations = 0; - map pushes; + std::map pushes; for (AssemblyItem const& item: _items) if (item.type() == Push) pushes[item]++; - map pendingReplacements; + std::map pendingReplacements; for (auto it: pushes) { AssemblyItem const& item = it.first; @@ -108,7 +107,7 @@ size_t ConstantOptimisationMethod::bytesRequired(AssemblyItems const& _items) void ConstantOptimisationMethod::replaceConstants( AssemblyItems& _items, - map const& _replacements + std::map const& _replacements ) { AssemblyItems replaced; @@ -255,7 +254,7 @@ AssemblyItems ComputeMethod::findRepresentation(u256 const& _value) bool ComputeMethod::checkRepresentation(u256 const& _value, AssemblyItems const& _routine) const { // This is a tiny EVM that can only evaluate some instructions. - vector stack; + std::vector stack; for (AssemblyItem const& item: _routine) { switch (item.type()) diff --git a/libevmasm/ControlFlowGraph.cpp b/libevmasm/ControlFlowGraph.cpp index cb648f90f216..9d2927ed9ca4 100644 --- a/libevmasm/ControlFlowGraph.cpp +++ b/libevmasm/ControlFlowGraph.cpp @@ -31,7 +31,6 @@ #include #include -using namespace std; using namespace solidity; using namespace solidity::evmasm; @@ -64,7 +63,7 @@ void ControlFlowGraph::findLargestTag() { // Assert that it can be converted. BlockId(item.data()); - m_lastUsedId = max(unsigned(item.data()), m_lastUsedId); + m_lastUsedId = std::max(unsigned(item.data()), m_lastUsedId); } } @@ -111,7 +110,7 @@ void ControlFlowGraph::splitBlocks() void ControlFlowGraph::resolveNextLinks() { - map blockByBeginPos; + std::map blockByBeginPos; for (auto const& idAndBlock: m_blocks) if (idAndBlock.second.begin != idAndBlock.second.end) blockByBeginPos[idAndBlock.second.begin] = idAndBlock.first; @@ -138,8 +137,8 @@ void ControlFlowGraph::resolveNextLinks() void ControlFlowGraph::removeUnusedBlocks() { - vector blocksToProcess{BlockId::initial()}; - set neededBlocks{BlockId::initial()}; + std::vector blocksToProcess{BlockId::initial()}; + std::set neededBlocks{BlockId::initial()}; while (!blocksToProcess.empty()) { BasicBlock const& block = m_blocks.at(blocksToProcess.back()); @@ -219,16 +218,16 @@ void ControlFlowGraph::gatherKnowledge() { // @todo actually we know that memory is filled with zeros at the beginning, // we could make use of that. - KnownStatePointer emptyState = make_shared(); + KnownStatePointer emptyState = std::make_shared(); bool unknownJumpEncountered = false; struct WorkQueueItem { BlockId blockId; KnownStatePointer state; - set blocksSeen; + std::set blocksSeen; }; - vector workQueue{WorkQueueItem{BlockId::initial(), emptyState->copy(), set()}}; + std::vector workQueue{WorkQueueItem{BlockId::initial(), emptyState->copy(), std::set()}}; auto addWorkQueueItem = [&](WorkQueueItem const& _currentItem, BlockId _to, KnownStatePointer const& _state) { WorkQueueItem item; @@ -275,7 +274,7 @@ void ControlFlowGraph::gatherKnowledge() assertThrow(block.begin <= pc && pc == block.end - 1, OptimizerException, ""); //@todo in the case of JUMPI, add knowledge about the condition to the state // (for both values of the condition) - set tags = state->tagsInExpression( + std::set tags = state->tagsInExpression( state->stackElement(state->stackHeight(), langutil::SourceLocation{}) ); state->feedItem(m_items.at(pc++)); @@ -289,7 +288,7 @@ void ControlFlowGraph::gatherKnowledge() unknownJumpEncountered = true; for (auto const& it: m_blocks) if (it.second.begin < it.second.end && m_items[it.second.begin].type() == Tag) - workQueue.push_back(WorkQueueItem{it.first, emptyState->copy(), set()}); + workQueue.push_back(WorkQueueItem{it.first, emptyState->copy(), std::set()}); } } else @@ -321,16 +320,16 @@ void ControlFlowGraph::gatherKnowledge() BasicBlocks ControlFlowGraph::rebuildCode() { - map pushes; + std::map pushes; for (auto& idAndBlock: m_blocks) for (BlockId ref: idAndBlock.second.pushedTags) if (m_blocks.count(ref)) pushes[ref]++; - set blocksToAdd; + std::set blocksToAdd; for (auto it: m_blocks) blocksToAdd.insert(it.first); - set blocksAdded; + std::set blocksAdded; BasicBlocks blocks; for ( diff --git a/libevmasm/Disassemble.cpp b/libevmasm/Disassemble.cpp index f1c904b6998d..27e860661d63 100644 --- a/libevmasm/Disassemble.cpp +++ b/libevmasm/Disassemble.cpp @@ -22,7 +22,6 @@ #include #include -using namespace std; using namespace solidity; using namespace solidity::util; using namespace solidity::evmasm; @@ -31,7 +30,7 @@ using namespace solidity::evmasm; void solidity::evmasm::eachInstruction( bytes const& _mem, langutil::EVMVersion _evmVersion, - function const& _onInstruction + std::function const& _onInstruction ) { for (auto it = _mem.begin(); it < _mem.end(); ++it) @@ -58,9 +57,9 @@ void solidity::evmasm::eachInstruction( } } -string solidity::evmasm::disassemble(bytes const& _mem, langutil::EVMVersion _evmVersion, string const& _delimiter) +std::string solidity::evmasm::disassemble(bytes const& _mem, langutil::EVMVersion _evmVersion, std::string const& _delimiter) { - stringstream ret; + std::stringstream ret; eachInstruction(_mem, _evmVersion, [&](Instruction _instr, u256 const& _data) { if (!isValidInstruction(_instr)) ret << "0x" << std::uppercase << std::hex << static_cast(_instr) << _delimiter; diff --git a/libevmasm/ExpressionClasses.cpp b/libevmasm/ExpressionClasses.cpp index 8cd97b6a8942..dd66eea32840 100644 --- a/libevmasm/ExpressionClasses.cpp +++ b/libevmasm/ExpressionClasses.cpp @@ -34,7 +34,6 @@ #include #include -using namespace std; using namespace solidity; using namespace solidity::evmasm; using namespace solidity::langutil; @@ -58,10 +57,10 @@ bool ExpressionClasses::Expression::operator==(ExpressionClasses::Expression con std::tie(_other.item->data(), _other.arguments, _other.sequenceNumber); } -std::size_t ExpressionClasses::Expression::ExpressionHash::operator()(Expression const& _expression) const +size_t ExpressionClasses::Expression::ExpressionHash::operator()(Expression const& _expression) const { assertThrow(!!_expression.item, OptimizerException, ""); - std::size_t seed = 0; + size_t seed = 0; auto type = _expression.item->type(); boost::hash_combine(seed, type); @@ -171,7 +170,7 @@ bool ExpressionClasses::knownNonZero(Id _c) u256 const* ExpressionClasses::knownConstant(Id _c) { - map matchGroups; + std::map matchGroups; Pattern constant(Push); constant.setMatchGroup(1, matchGroups); if (!constant.matches(representative(_c), *this)) @@ -181,15 +180,15 @@ u256 const* ExpressionClasses::knownConstant(Id _c) AssemblyItem const* ExpressionClasses::storeItem(AssemblyItem const& _item) { - m_spareAssemblyItems.push_back(make_shared(_item)); + m_spareAssemblyItems.push_back(std::make_shared(_item)); return m_spareAssemblyItems.back().get(); } -string ExpressionClasses::fullDAGToString(ExpressionClasses::Id _id) const +std::string ExpressionClasses::fullDAGToString(ExpressionClasses::Id _id) const { Expression const& expr = representative(_id); - stringstream str; - str << dec << expr.id << ":"; + std::stringstream str; + str << std::dec << expr.id << ":"; if (expr.item) { str << *expr.item << "("; @@ -212,25 +211,25 @@ ExpressionClasses::Id ExpressionClasses::tryToSimplify(Expression const& _expr) _expr.item->type() != Operation || !SemanticInformation::isDeterministic(*_expr.item) ) - return numeric_limits::max(); + return std::numeric_limits::max(); if (auto match = rules.findFirstMatch(_expr, *this)) { // Debug info if (false) { - cout << "Simplifying " << *_expr.item << "("; + std::cout << "Simplifying " << *_expr.item << "("; for (Id arg: _expr.arguments) - cout << fullDAGToString(arg) << ", "; - cout << ")" << endl; - cout << "with rule " << match->pattern.toString() << endl; - cout << "to " << match->action().toString() << endl; + std::cout << fullDAGToString(arg) << ", "; + std::cout << ")" << std::endl; + std::cout << "with rule " << match->pattern.toString() << std::endl; + std::cout << "to " << match->action().toString() << std::endl; } return rebuildExpression(ExpressionTemplate(match->action(), _expr.item->location())); } - return numeric_limits::max(); + return std::numeric_limits::max(); } ExpressionClasses::Id ExpressionClasses::rebuildExpression(ExpressionTemplate const& _template) diff --git a/libevmasm/GasMeter.cpp b/libevmasm/GasMeter.cpp index ed1e0540718c..7a9f3c2e0095 100644 --- a/libevmasm/GasMeter.cpp +++ b/libevmasm/GasMeter.cpp @@ -20,7 +20,6 @@ #include -using namespace std; using namespace solidity; using namespace solidity::util; using namespace solidity::evmasm; @@ -32,7 +31,7 @@ GasMeter::GasConsumption& GasMeter::GasConsumption::operator+=(GasConsumption co if (isInfinite) return *this; bigint v = bigint(value) + _other.value; - if (v > numeric_limits::max()) + if (v > std::numeric_limits::max()) *this = infinite(); else value = u256(v); diff --git a/libevmasm/Inliner.cpp b/libevmasm/Inliner.cpp index d365e312a939..ded5172ddc3a 100644 --- a/libevmasm/Inliner.cpp +++ b/libevmasm/Inliner.cpp @@ -38,7 +38,6 @@ #include #include -using namespace std; using namespace solidity; using namespace solidity::evmasm; @@ -54,7 +53,7 @@ u256 executionCost(RangeType const& _itemRange, langutil::EVMVersion _evmVersion [&gasMeter](auto const& _item) { return gasMeter.estimateMax(_item, false); } ), GasMeter::GasConsumption()); if (gasConsumption.isInfinite) - return numeric_limits::max(); + return std::numeric_limits::max(); else return gasConsumption.value; } @@ -66,14 +65,14 @@ uint64_t codeSize(RangeType const& _itemRange) [](auto const& _item) { return _item.bytesRequired(2, Precision::Approximate); } ), 0u); } -/// @returns the tag id, if @a _item is a PushTag or Tag into the current subassembly, nullopt otherwise. -optional getLocalTag(AssemblyItem const& _item) +/// @returns the tag id, if @a _item is a PushTag or Tag into the current subassembly, std::nullopt otherwise. +std::optional getLocalTag(AssemblyItem const& _item) { if (_item.type() != PushTag && _item.type() != Tag) - return nullopt; + return std::nullopt; auto [subId, tag] = _item.splitForeignPushTag(); - if (subId != numeric_limits::max()) - return nullopt; + if (subId != std::numeric_limits::max()) + return std::nullopt; return tag; } } @@ -99,7 +98,7 @@ bool Inliner::isInlineCandidate(size_t _tag, ranges::span _i return true; } -map Inliner::determineInlinableBlocks(AssemblyItems const& _items) const +std::map Inliner::determineInlinableBlocks(AssemblyItems const& _items) const { std::map> inlinableBlockItems; std::map numPushTags; @@ -108,7 +107,7 @@ map Inliner::determineInlinableBlocks(AssemblyI { // The number of PushTags approximates the number of calls to a block. if (item.type() == PushTag) - if (optional tag = getLocalTag(item)) + if (std::optional tag = getLocalTag(item)) ++numPushTags[*tag]; // We can only inline blocks with straight control flow that end in a jump. @@ -116,7 +115,7 @@ map Inliner::determineInlinableBlocks(AssemblyI if (lastTag && SemanticInformation::breaksCSEAnalysisBlock(item, false)) { ranges::span block = _items | ranges::views::slice(*lastTag + 1, index + 1); - if (optional tag = getLocalTag(_items[*lastTag])) + if (std::optional tag = getLocalTag(_items[*lastTag])) if (isInlineCandidate(*tag, block)) inlinableBlockItems[*tag] = block; lastTag.reset(); @@ -130,7 +129,7 @@ map Inliner::determineInlinableBlocks(AssemblyI } // Store the number of PushTags alongside the assembly items and discard tags that are never pushed. - map result; + std::map result; for (auto&& [tag, items]: inlinableBlockItems) if (uint64_t const* numPushes = util::valueOrNullptr(numPushTags, tag)) result.emplace(tag, InlinableBlock{items, *numPushes}); @@ -199,7 +198,7 @@ bool Inliner::shouldInlineFullFunctionBody(size_t _tag, ranges::span Inliner::shouldInline(size_t _tag, AssemblyItem const& _jump, InlinableBlock const& _block) const +std::optional Inliner::shouldInline(size_t _tag, AssemblyItem const& _jump, InlinableBlock const& _block) const { assertThrow(_jump == Instruction::JUMP, OptimizerException, ""); AssemblyItem blockExit = _block.items.back(); @@ -232,7 +231,7 @@ optional Inliner::shouldInline(size_t _tag, AssemblyItem const& _j return blockExit; } - return nullopt; + return std::nullopt; } @@ -252,7 +251,7 @@ void Inliner::optimise() AssemblyItem const& nextItem = *next(it); if (item.type() == PushTag && nextItem == Instruction::JUMP) { - if (optional tag = getLocalTag(item)) + if (std::optional tag = getLocalTag(item)) if (auto* inlinableBlock = util::valueOrNullptr(inlinableBlocks, *tag)) if (auto exitItem = shouldInline(*tag, nextItem, *inlinableBlock)) { @@ -264,7 +263,7 @@ void Inliner::optimise() // We might increase the number of push tags to other blocks. for (AssemblyItem const& inlinedItem: inlinableBlock->items) if (inlinedItem.type() == PushTag) - if (optional duplicatedTag = getLocalTag(inlinedItem)) + if (std::optional duplicatedTag = getLocalTag(inlinedItem)) if (auto* block = util::valueOrNullptr(inlinableBlocks, *duplicatedTag)) ++block->pushTagCount; diff --git a/libevmasm/Instruction.cpp b/libevmasm/Instruction.cpp index 2da2c9611f71..0b96271c83e5 100644 --- a/libevmasm/Instruction.cpp +++ b/libevmasm/Instruction.cpp @@ -22,7 +22,6 @@ #include -using namespace std; using namespace solidity; using namespace solidity::util; using namespace solidity::evmasm; @@ -367,7 +366,7 @@ InstructionInfo solidity::evmasm::instructionInfo(Instruction _inst, langutil::E } catch (...) { - return InstructionInfo({"(_inst)) + ">", 0, 0, 0, false, Tier::Invalid}); + return InstructionInfo({"(_inst)) + ">", 0, 0, 0, false, Tier::Invalid}); } } diff --git a/libevmasm/JumpdestRemover.cpp b/libevmasm/JumpdestRemover.cpp index 2c0c5875efe7..7afa715a88df 100644 --- a/libevmasm/JumpdestRemover.cpp +++ b/libevmasm/JumpdestRemover.cpp @@ -26,14 +26,13 @@ #include -using namespace std; using namespace solidity; using namespace solidity::util; using namespace solidity::evmasm; -bool JumpdestRemover::optimise(set const& _tagsReferencedFromOutside) +bool JumpdestRemover::optimise(std::set const& _tagsReferencedFromOutside) { - set references{referencedTags(m_items, numeric_limits::max())}; + std::set references{referencedTags(m_items, std::numeric_limits::max())}; references.insert(_tagsReferencedFromOutside.begin(), _tagsReferencedFromOutside.end()); size_t initialSize = m_items.size(); @@ -46,7 +45,7 @@ bool JumpdestRemover::optimise(set const& _tagsReferencedFromOutside) if (_item.type() != Tag) return false; auto asmIdAndTag = _item.splitForeignPushTag(); - assertThrow(asmIdAndTag.first == numeric_limits::max(), OptimizerException, "Sub-assembly tag used as label."); + assertThrow(asmIdAndTag.first == std::numeric_limits::max(), OptimizerException, "Sub-assembly tag used as label."); size_t tag = asmIdAndTag.second; return !references.count(tag); } @@ -55,9 +54,9 @@ bool JumpdestRemover::optimise(set const& _tagsReferencedFromOutside) return m_items.size() != initialSize; } -set JumpdestRemover::referencedTags(AssemblyItems const& _items, size_t _subId) +std::set JumpdestRemover::referencedTags(AssemblyItems const& _items, size_t _subId) { - set ret; + std::set ret; for (auto const& item: _items) if (item.type() == PushTag) { diff --git a/libevmasm/KnownState.cpp b/libevmasm/KnownState.cpp index a2bda5af713e..91f798bf3890 100644 --- a/libevmasm/KnownState.cpp +++ b/libevmasm/KnownState.cpp @@ -28,17 +28,16 @@ #include -using namespace std; using namespace solidity; using namespace solidity::evmasm; using namespace solidity::langutil; -ostream& KnownState::stream(ostream& _out) const +std::ostream& KnownState::stream(std::ostream& _out) const { - auto streamExpressionClass = [this](ostream& _out, Id _id) + auto streamExpressionClass = [this](std::ostream& _out, Id _id) { auto const& expr = m_expressionClasses->representative(_id); - _out << " " << dec << _id << ": "; + _out << " " << std::dec << _id << ": "; if (!expr.item) _out << " no item"; else if (expr.item->type() == UndefinedItem) @@ -46,26 +45,26 @@ ostream& KnownState::stream(ostream& _out) const else _out << *expr.item; if (expr.sequenceNumber) - _out << "@" << dec << expr.sequenceNumber; + _out << "@" << std::dec << expr.sequenceNumber; _out << "("; for (Id arg: expr.arguments) - _out << dec << arg << ","; - _out << ")" << endl; + _out << std::dec << arg << ","; + _out << ")" << std::endl; }; - _out << "=== State ===" << endl; - _out << "Stack height: " << dec << m_stackHeight << endl; - _out << "Equivalence classes:" << endl; + _out << "=== State ===" << std::endl; + _out << "Stack height: " << std::dec << m_stackHeight << std::endl; + _out << "Equivalence classes:" << std::endl; for (Id eqClass = 0; eqClass < m_expressionClasses->size(); ++eqClass) streamExpressionClass(_out, eqClass); - _out << "Stack:" << endl; + _out << "Stack:" << std::endl; for (auto const& it: m_stackElements) { - _out << " " << dec << it.first << ": "; + _out << " " << std::dec << it.first << ": "; streamExpressionClass(_out, it.second); } - _out << "Storage:" << endl; + _out << "Storage:" << std::endl; for (auto const& it: m_storageContent) { _out << " "; @@ -73,7 +72,7 @@ ostream& KnownState::stream(ostream& _out) const _out << ": "; streamExpressionClass(_out, it.second); } - _out << "Memory:" << endl; + _out << "Memory:" << std::endl; for (auto const& it: m_memoryContent) { _out << " "; @@ -149,7 +148,7 @@ KnownState::StoreOperation KnownState::feedItem(AssemblyItem const& _item, bool ); else if (instruction != Instruction::POP) { - vector arguments(static_cast(info.args)); + std::vector arguments(static_cast(info.args)); for (size_t i = 0; i < static_cast(info.args); ++i) arguments[i] = stackElement(m_stackHeight - static_cast(i), _item.location()); switch (_item.instruction()) @@ -233,8 +232,8 @@ void KnownState::reduceToCommonKnowledge(KnownState const& _other, bool _combine ++it; else { - set theseTags = tagsInExpression(it->second); - set otherTags = tagsInExpression(other); + std::set theseTags = tagsInExpression(it->second); + std::set otherTags = tagsInExpression(other); if (!theseTags.empty() && !otherTags.empty()) { theseTags.insert(otherTags.begin(), otherTags.end()); @@ -251,7 +250,7 @@ void KnownState::reduceToCommonKnowledge(KnownState const& _other, bool _combine // Use the smaller stack height. Essential to terminate in case of loops. if (m_stackHeight > _other.m_stackHeight) { - map shiftedStack; + std::map shiftedStack; for (auto const& stackElement: m_stackElements) shiftedStack[stackElement.first - stackDiff] = stackElement.second; m_stackElements = std::move(shiftedStack); @@ -261,7 +260,7 @@ void KnownState::reduceToCommonKnowledge(KnownState const& _other, bool _combine intersect(m_storageContent, _other.m_storageContent); intersect(m_memoryContent, _other.m_memoryContent); if (_combineSequenceNumbers) - m_sequenceNumber = max(m_sequenceNumber, _other.m_sequenceNumber); + m_sequenceNumber = std::max(m_sequenceNumber, _other.m_sequenceNumber); } bool KnownState::operator==(KnownState const& _other) const @@ -316,7 +315,7 @@ void KnownState::swapStackElements( stackElement(_stackHeightA, _location); stackElement(_stackHeightB, _location); - swap(m_stackElements[_stackHeightA], m_stackElements[_stackHeightB]); + std::swap(m_stackElements[_stackHeightA], m_stackElements[_stackHeightB]); } KnownState::StoreOperation KnownState::storeInStorage( @@ -400,7 +399,7 @@ KnownState::Id KnownState::applyKeccak256( if (!l || *l > 128) return m_expressionClasses->find(keccak256Item, {_start, _length}, true, m_sequenceNumber); unsigned length = unsigned(*l); - vector arguments; + std::vector arguments; for (unsigned i = 0; i < length; i += 32) { Id slot = m_expressionClasses->find( @@ -426,19 +425,19 @@ KnownState::Id KnownState::applyKeccak256( return m_knownKeccak256Hashes[{arguments, length}] = v; } -set KnownState::tagsInExpression(KnownState::Id _expressionId) +std::set KnownState::tagsInExpression(KnownState::Id _expressionId) { if (m_tagUnions.left.count(_expressionId)) return m_tagUnions.left.at(_expressionId); // Might be a tag, then return the set of itself. ExpressionClasses::Expression expr = m_expressionClasses->representative(_expressionId); if (expr.item && expr.item->type() == PushTag) - return set({expr.item->data()}); + return std::set({expr.item->data()}); else - return set(); + return std::set(); } -KnownState::Id KnownState::tagUnion(set _tags) +KnownState::Id KnownState::tagUnion(std::set _tags) { if (m_tagUnions.right.count(_tags)) return m_tagUnions.right.at(_tags); diff --git a/libevmasm/LinkerObject.cpp b/libevmasm/LinkerObject.cpp index 5a0631e3295c..1b09f4ced0ae 100644 --- a/libevmasm/LinkerObject.cpp +++ b/libevmasm/LinkerObject.cpp @@ -24,7 +24,6 @@ #include #include -using namespace std; using namespace solidity; using namespace solidity::util; using namespace solidity::evmasm; @@ -36,24 +35,24 @@ void LinkerObject::append(LinkerObject const& _other) bytecode += _other.bytecode; } -void LinkerObject::link(map const& _libraryAddresses) +void LinkerObject::link(std::map const& _libraryAddresses) { std::map remainingRefs; for (auto const& linkRef: linkReferences) if (h160 const* address = matchLibrary(linkRef.second, _libraryAddresses)) - copy(address->data(), address->data() + 20, bytecode.begin() + vector::difference_type(linkRef.first)); + copy(address->data(), address->data() + 20, bytecode.begin() + std::vector::difference_type(linkRef.first)); else remainingRefs.insert(linkRef); linkReferences.swap(remainingRefs); } -string LinkerObject::toHex() const +std::string LinkerObject::toHex() const { - string hex = solidity::util::toHex(bytecode); + std::string hex = solidity::util::toHex(bytecode); for (auto const& ref: linkReferences) { size_t pos = ref.first * 2; - string hash = libraryPlaceholder(ref.second); + std::string hash = libraryPlaceholder(ref.second); hex[pos] = hex[pos + 1] = hex[pos + 38] = hex[pos + 39] = '_'; for (size_t i = 0; i < 36; ++i) hex[pos + 2 + i] = hash.at(i); @@ -61,15 +60,15 @@ string LinkerObject::toHex() const return hex; } -string LinkerObject::libraryPlaceholder(string const& _libraryName) +std::string LinkerObject::libraryPlaceholder(std::string const& _libraryName) { return "$" + keccak256(_libraryName).hex().substr(0, 34) + "$"; } h160 const* LinkerObject::matchLibrary( - string const& _linkRefName, - map const& _libraryAddresses + std::string const& _linkRefName, + std::map const& _libraryAddresses ) { auto it = _libraryAddresses.find(_linkRefName); diff --git a/libevmasm/PathGasMeter.cpp b/libevmasm/PathGasMeter.cpp index c165985cffb0..2acafea22cd4 100644 --- a/libevmasm/PathGasMeter.cpp +++ b/libevmasm/PathGasMeter.cpp @@ -24,7 +24,6 @@ #include #include -using namespace std; using namespace solidity; using namespace solidity::evmasm; @@ -38,17 +37,17 @@ PathGasMeter::PathGasMeter(AssemblyItems const& _items, langutil::EVMVersion _ev GasMeter::GasConsumption PathGasMeter::estimateMax( size_t _startIndex, - shared_ptr const& _state + std::shared_ptr const& _state ) { - auto path = make_unique(); + auto path = std::make_unique(); path->index = _startIndex; path->state = _state->copy(); queue(std::move(path)); GasMeter::GasConsumption gas; while (!m_queue.empty() && !gas.isInfinite) - gas = max(gas, handleQueueItem()); + gas = std::max(gas, handleQueueItem()); return gas; } @@ -67,10 +66,10 @@ GasMeter::GasConsumption PathGasMeter::handleQueueItem() { assertThrow(!m_queue.empty(), OptimizerException, ""); - unique_ptr path = std::move(m_queue.rbegin()->second); + std::unique_ptr path = std::move(m_queue.rbegin()->second); m_queue.erase(--m_queue.end()); - shared_ptr state = path->state; + std::shared_ptr state = path->state; GasMeter meter(state, m_evmVersion, path->largestMemoryAccess); ExpressionClasses& classes = state->expressionClasses(); GasMeter::GasConsumption gas = path->gas; @@ -82,7 +81,7 @@ GasMeter::GasConsumption PathGasMeter::handleQueueItem() // return the current gas value. return gas; - set jumpTags; + std::set jumpTags; for (; index < m_items.size() && !gas.isInfinite; ++index) { bool branchStops = false; @@ -121,7 +120,7 @@ GasMeter::GasConsumption PathGasMeter::handleQueueItem() for (u256 const& tag: jumpTags) { - auto newPath = make_unique(); + auto newPath = std::make_unique(); newPath->index = m_items.size(); if (m_tagPositions.count(tag)) newPath->index = m_tagPositions.at(tag); diff --git a/libevmasm/PeepholeOptimiser.cpp b/libevmasm/PeepholeOptimiser.cpp index 22d40c8ea1ac..e9231c0a56b0 100644 --- a/libevmasm/PeepholeOptimiser.cpp +++ b/libevmasm/PeepholeOptimiser.cpp @@ -25,7 +25,6 @@ #include #include -using namespace std; using namespace solidity; using namespace solidity::evmasm; @@ -38,7 +37,7 @@ struct OptimiserState { AssemblyItems const& items; size_t i; - back_insert_iterator out; + std::back_insert_iterator out; }; template @@ -55,8 +54,8 @@ struct SimplePeepholeOptimizerMethod template static bool applyRule( AssemblyItems::const_iterator _in, - back_insert_iterator _out, - index_sequence + std::back_insert_iterator _out, + std::index_sequence ) { return Method::applySimple(_in[Indices]..., _out); @@ -66,7 +65,7 @@ struct SimplePeepholeOptimizerMethod static constexpr size_t WindowSize = FunctionParameterCount::value - 1; if ( _state.i + WindowSize <= _state.items.size() && - applyRule(_state.items.begin() + static_cast(_state.i), _state.out, make_index_sequence{}) + applyRule(_state.items.begin() + static_cast(_state.i), _state.out, std::make_index_sequence{}) ) { _state.i += WindowSize; @@ -81,7 +80,7 @@ struct Identity: SimplePeepholeOptimizerMethod { static bool applySimple( AssemblyItem const& _item, - back_insert_iterator _out + std::back_insert_iterator _out ) { *_out = _item; @@ -94,7 +93,7 @@ struct PushPop: SimplePeepholeOptimizerMethod static bool applySimple( AssemblyItem const& _push, AssemblyItem const& _pop, - back_insert_iterator + std::back_insert_iterator ) { auto t = _push.type(); @@ -111,7 +110,7 @@ struct OpPop: SimplePeepholeOptimizerMethod static bool applySimple( AssemblyItem const& _op, AssemblyItem const& _pop, - back_insert_iterator _out + std::back_insert_iterator _out ) { if (_pop == Instruction::POP && _op.type() == Operation) @@ -133,7 +132,7 @@ struct OpStop: SimplePeepholeOptimizerMethod static bool applySimple( AssemblyItem const& _op, AssemblyItem const& _stop, - back_insert_iterator _out + std::back_insert_iterator _out ) { if (_stop == Instruction::STOP) @@ -164,7 +163,7 @@ struct OpReturnRevert: SimplePeepholeOptimizerMethod AssemblyItem const& _push, AssemblyItem const& _pushOrDup, AssemblyItem const& _returnRevert, - back_insert_iterator _out + std::back_insert_iterator _out ) { if ( @@ -191,7 +190,7 @@ struct DoubleSwap: SimplePeepholeOptimizerMethod static size_t applySimple( AssemblyItem const& _s1, AssemblyItem const& _s2, - back_insert_iterator + std::back_insert_iterator ) { return _s1 == _s2 && SemanticInformation::isSwapInstruction(_s1); @@ -203,7 +202,7 @@ struct DoublePush: SimplePeepholeOptimizerMethod static bool applySimple( AssemblyItem const& _push1, AssemblyItem const& _push2, - back_insert_iterator _out + std::back_insert_iterator _out ) { if (_push1.type() == Push && _push2.type() == Push && _push1.data() == _push2.data()) @@ -222,7 +221,7 @@ struct CommutativeSwap: SimplePeepholeOptimizerMethod static bool applySimple( AssemblyItem const& _swap, AssemblyItem const& _op, - back_insert_iterator _out + std::back_insert_iterator _out ) { // Remove SWAP1 if following instruction is commutative @@ -244,10 +243,10 @@ struct SwapComparison: SimplePeepholeOptimizerMethod static bool applySimple( AssemblyItem const& _swap, AssemblyItem const& _op, - back_insert_iterator _out + std::back_insert_iterator _out ) { - static map const swappableOps{ + static std::map const swappableOps{ { Instruction::LT, Instruction::GT }, { Instruction::GT, Instruction::LT }, { Instruction::SLT, Instruction::SGT }, @@ -274,7 +273,7 @@ struct DupSwap: SimplePeepholeOptimizerMethod static size_t applySimple( AssemblyItem const& _dupN, AssemblyItem const& _swapN, - back_insert_iterator _out + std::back_insert_iterator _out ) { if ( @@ -299,7 +298,7 @@ struct IsZeroIsZeroJumpI: SimplePeepholeOptimizerMethod AssemblyItem const& _iszero2, AssemblyItem const& _pushTag, AssemblyItem const& _jumpi, - back_insert_iterator _out + std::back_insert_iterator _out ) { if ( @@ -325,7 +324,7 @@ struct EqIsZeroJumpI: SimplePeepholeOptimizerMethod AssemblyItem const& _iszero, AssemblyItem const& _pushTag, AssemblyItem const& _jumpi, - back_insert_iterator _out + std::back_insert_iterator _out ) { if ( @@ -354,7 +353,7 @@ struct DoubleJump: SimplePeepholeOptimizerMethod AssemblyItem const& _pushTag2, AssemblyItem const& _jump, AssemblyItem const& _tag1, - back_insert_iterator _out + std::back_insert_iterator _out ) { if ( @@ -383,7 +382,7 @@ struct JumpToNext: SimplePeepholeOptimizerMethod AssemblyItem const& _pushTag, AssemblyItem const& _jump, AssemblyItem const& _tag, - back_insert_iterator _out + std::back_insert_iterator _out ) { if ( @@ -409,7 +408,7 @@ struct TagConjunctions: SimplePeepholeOptimizerMethod AssemblyItem const& _pushTag, AssemblyItem const& _pushConstant, AssemblyItem const& _and, - back_insert_iterator _out + std::back_insert_iterator _out ) { if (_and != Instruction::AND) @@ -444,7 +443,7 @@ struct TruthyAnd: SimplePeepholeOptimizerMethod AssemblyItem const& _push, AssemblyItem const& _not, AssemblyItem const& _and, - back_insert_iterator + std::back_insert_iterator ) { return ( diff --git a/libevmasm/SemanticInformation.cpp b/libevmasm/SemanticInformation.cpp index 6c9fd103f3c7..6154713ceaa3 100644 --- a/libevmasm/SemanticInformation.cpp +++ b/libevmasm/SemanticInformation.cpp @@ -25,11 +25,10 @@ #include #include -using namespace std; using namespace solidity; using namespace solidity::evmasm; -vector SemanticInformation::readWriteOperations(Instruction _instruction) +std::vector SemanticInformation::readWriteOperations(Instruction _instruction) { switch (_instruction) { @@ -111,7 +110,7 @@ vector SemanticInformation::readWriteOperations( case Instruction::DELEGATECALL: { size_t paramCount = static_cast(instructionInfo(_instruction, langutil::EVMVersion()).args); - vector operations{ + std::vector operations{ Operation{Location::Memory, Effect::Read, paramCount - 4, paramCount - 3, {}}, Operation{Location::Storage, Effect::Read, {}, {}, {}} }; @@ -130,7 +129,7 @@ vector SemanticInformation::readWriteOperations( } case Instruction::CREATE: case Instruction::CREATE2: - return vector{ + return std::vector{ Operation{ Location::Memory, Effect::Read, @@ -143,7 +142,7 @@ vector SemanticInformation::readWriteOperations( }; case Instruction::MSIZE: // This is just to satisfy the assert below. - return vector{}; + return std::vector{}; default: assertThrow(storage(_instruction) == None && memory(_instruction) == None, AssemblyException, ""); } diff --git a/libevmasm/SimplificationRules.cpp b/libevmasm/SimplificationRules.cpp index bcb8da3882ce..ef2d68c7fdaa 100644 --- a/libevmasm/SimplificationRules.cpp +++ b/libevmasm/SimplificationRules.cpp @@ -32,7 +32,6 @@ #include #include -using namespace std; using namespace solidity; using namespace solidity::evmasm; using namespace solidity::langutil; @@ -92,7 +91,7 @@ Rules::Rules() Y.setMatchGroup(6, m_matchGroups); Z.setMatchGroup(7, m_matchGroups); - addRules(simplificationRuleList(nullopt, A, B, C, W, X, Y, Z)); + addRules(simplificationRuleList(std::nullopt, A, B, C, W, X, Y, Z)); assertThrow(isInitialized(), OptimizerException, "Rule list not properly initialized."); } @@ -103,7 +102,7 @@ Pattern::Pattern(Instruction _instruction, std::initializer_list _argum { } -void Pattern::setMatchGroup(unsigned _group, map& _matchGroups) +void Pattern::setMatchGroup(unsigned _group, std::map& _matchGroups) { m_matchGroup = _group; m_matchGroups = &_matchGroups; @@ -135,9 +134,9 @@ AssemblyItem Pattern::toAssemblyItem(SourceLocation const& _location) const return AssemblyItem(m_type, data(), _location); } -string Pattern::toString() const +std::string Pattern::toString() const { - stringstream s; + std::stringstream s; switch (m_type) { case Operation: @@ -146,7 +145,7 @@ string Pattern::toString() const break; case Push: if (m_data) - s << "PUSH " << hex << data(); + s << "PUSH " << std::hex << data(); else s << "PUSH "; break; @@ -155,15 +154,15 @@ string Pattern::toString() const break; default: if (m_data) - s << "t=" << dec << m_type << " d=" << hex << data(); + s << "t=" << std::dec << m_type << " d=" << std::hex << data(); else - s << "t=" << dec << m_type << " d: nullptr"; + s << "t=" << std::dec << m_type << " d: nullptr"; break; } if (!m_requireDataMatch) s << " ~"; if (m_matchGroup) - s << "[" << dec << m_matchGroup << "]"; + s << "[" << std::dec << m_matchGroup << "]"; s << "("; for (Pattern const& p: m_arguments) s << p.toString() << ", "; @@ -216,9 +215,9 @@ ExpressionTemplate::ExpressionTemplate(Pattern const& _pattern, SourceLocation c arguments.emplace_back(arg, _location); } -string ExpressionTemplate::toString() const +std::string ExpressionTemplate::toString() const { - stringstream s; + std::stringstream s; if (hasId) s << id; else diff --git a/liblangutil/CharStream.cpp b/liblangutil/CharStream.cpp index 6ecd85bfed6d..c6b58ef64790 100644 --- a/liblangutil/CharStream.cpp +++ b/liblangutil/CharStream.cpp @@ -51,7 +51,6 @@ #include #include -using namespace std; using namespace solidity; using namespace solidity::langutil; @@ -79,21 +78,21 @@ char CharStream::setPosition(size_t _location) return get(); } -string CharStream::lineAtPosition(int _position) const +std::string CharStream::lineAtPosition(int _position) const { // if _position points to \n, it returns the line before the \n - using size_type = string::size_type; - size_type searchStart = min(m_source.size(), size_type(_position)); + using size_type = std::string::size_type; + size_type searchStart = std::min(m_source.size(), size_type(_position)); if (searchStart > 0) searchStart--; size_type lineStart = m_source.rfind('\n', searchStart); - if (lineStart == string::npos) + if (lineStart == std::string::npos) lineStart = 0; else lineStart++; - string line = m_source.substr( + std::string line = m_source.substr( lineStart, - min(m_source.find('\n', lineStart), m_source.size()) - lineStart + std::min(m_source.find('\n', lineStart), m_source.size()) - lineStart ); if (!line.empty() && line.back() == '\r') line.pop_back(); @@ -102,9 +101,9 @@ string CharStream::lineAtPosition(int _position) const LineColumn CharStream::translatePositionToLineColumn(int _position) const { - using size_type = string::size_type; - using diff_type = string::difference_type; - size_type searchPosition = min(m_source.size(), size_type(_position)); + using size_type = std::string::size_type; + using diff_type = std::string::difference_type; + size_type searchPosition = std::min(m_source.size(), size_type(_position)); int lineNumber = static_cast(count(m_source.begin(), m_source.begin() + diff_type(searchPosition), '\n')); size_type lineStart; if (searchPosition == 0) @@ -112,24 +111,24 @@ LineColumn CharStream::translatePositionToLineColumn(int _position) const else { lineStart = m_source.rfind('\n', searchPosition - 1); - lineStart = lineStart == string::npos ? 0 : lineStart + 1; + lineStart = lineStart == std::string::npos ? 0 : lineStart + 1; } return LineColumn{lineNumber, static_cast(searchPosition - lineStart)}; } -string_view CharStream::text(SourceLocation const& _location) const +std::string_view CharStream::text(SourceLocation const& _location) const { if (!_location.hasText()) return {}; solAssert(_location.sourceName && *_location.sourceName == m_name, ""); solAssert(static_cast(_location.end) <= m_source.size(), ""); - return string_view{m_source}.substr( + return std::string_view{m_source}.substr( static_cast(_location.start), static_cast(_location.end - _location.start) ); } -string CharStream::singleLineSnippet(string const& _sourceCode, SourceLocation const& _location) +std::string CharStream::singleLineSnippet(std::string const& _sourceCode, SourceLocation const& _location) { if (!_location.hasText()) return {}; @@ -137,39 +136,39 @@ string CharStream::singleLineSnippet(string const& _sourceCode, SourceLocation c if (static_cast(_location.start) >= _sourceCode.size()) return {}; - string cut = _sourceCode.substr(static_cast(_location.start), static_cast(_location.end - _location.start)); + std::string cut = _sourceCode.substr(static_cast(_location.start), static_cast(_location.end - _location.start)); auto newLinePos = cut.find_first_of("\n\r"); - if (newLinePos != string::npos) + if (newLinePos != std::string::npos) cut = cut.substr(0, newLinePos) + "..."; return cut; } -optional CharStream::translateLineColumnToPosition(LineColumn const& _lineColumn) const +std::optional CharStream::translateLineColumnToPosition(LineColumn const& _lineColumn) const { return translateLineColumnToPosition(m_source, _lineColumn); } -optional CharStream::translateLineColumnToPosition(std::string const& _text, LineColumn const& _input) +std::optional CharStream::translateLineColumnToPosition(std::string const& _text, LineColumn const& _input) { if (_input.line < 0) - return nullopt; + return std::nullopt; size_t offset = 0; for (int i = 0; i < _input.line; i++) { offset = _text.find('\n', offset); if (offset == _text.npos) - return nullopt; + return std::nullopt; offset++; // Skip linefeed. } size_t endOfLine = _text.find('\n', offset); - if (endOfLine == string::npos) + if (endOfLine == std::string::npos) endOfLine = _text.size(); if (offset + static_cast(_input.column) > endOfLine) - return nullopt; + return std::nullopt; return offset + static_cast(_input.column); } diff --git a/liblangutil/DebugInfoSelection.cpp b/liblangutil/DebugInfoSelection.cpp index 6ff023c01d86..88e09cdb7aa0 100644 --- a/liblangutil/DebugInfoSelection.cpp +++ b/liblangutil/DebugInfoSelection.cpp @@ -30,7 +30,6 @@ #include -using namespace std; using namespace solidity; using namespace solidity::langutil; using namespace solidity::util; @@ -50,7 +49,7 @@ DebugInfoSelection const DebugInfoSelection::Only(bool DebugInfoSelection::* _me return result; } -optional DebugInfoSelection::fromString(string_view _input) +std::optional DebugInfoSelection::fromString(std::string_view _input) { // TODO: Make more stuff constexpr and make it a static_assert(). solAssert(componentMap().count("all") == 0, ""); @@ -61,11 +60,11 @@ optional DebugInfoSelection::fromString(string_view _input) if (_input == "none") return None(); - return fromComponents(_input | ranges::views::split(',') | ranges::to>); + return fromComponents(_input | ranges::views::split(',') | ranges::to>); } -optional DebugInfoSelection::fromComponents( - vector const& _componentNames, +std::optional DebugInfoSelection::fromComponents( + std::vector const& _componentNames, bool _acceptWildcards ) { @@ -75,16 +74,16 @@ optional DebugInfoSelection::fromComponents( for (auto const& component: _componentNames) { if (component == "*") - return (_acceptWildcards ? make_optional(DebugInfoSelection::All()) : nullopt); + return (_acceptWildcards ? std::make_optional(DebugInfoSelection::All()) : std::nullopt); if (!selection.enable(component)) - return nullopt; + return std::nullopt; } return selection; } -bool DebugInfoSelection::enable(string _component) +bool DebugInfoSelection::enable(std::string _component) { auto memberIt = componentMap().find(boost::trim_copy(_component)); if (memberIt == componentMap().end()) @@ -146,9 +145,9 @@ bool DebugInfoSelection::operator==(DebugInfoSelection const& _other) const noex return true; } -ostream& langutil::operator<<(ostream& _stream, DebugInfoSelection const& _selection) +std::ostream& langutil::operator<<(std::ostream& _stream, DebugInfoSelection const& _selection) { - vector selectedComponentNames; + std::vector selectedComponentNames; for (auto const& [name, member]: _selection.componentMap()) if (_selection.*member) selectedComponentNames.push_back(name); diff --git a/liblangutil/ErrorReporter.cpp b/liblangutil/ErrorReporter.cpp index f99247b328c3..298e4f630f10 100644 --- a/liblangutil/ErrorReporter.cpp +++ b/liblangutil/ErrorReporter.cpp @@ -25,7 +25,6 @@ #include #include -using namespace std; using namespace solidity; using namespace solidity::langutil; @@ -37,7 +36,7 @@ ErrorReporter& ErrorReporter::operator=(ErrorReporter const& _errorReporter) return *this; } -void ErrorReporter::warning(ErrorId _error, string const& _description) +void ErrorReporter::warning(ErrorId _error, std::string const& _description) { error(_error, Error::Type::Warning, SourceLocation(), _description); } @@ -45,7 +44,7 @@ void ErrorReporter::warning(ErrorId _error, string const& _description) void ErrorReporter::warning( ErrorId _error, SourceLocation const& _location, - string const& _description + std::string const& _description ) { error(_error, Error::Type::Warning, _location, _description); @@ -54,27 +53,27 @@ void ErrorReporter::warning( void ErrorReporter::warning( ErrorId _error, SourceLocation const& _location, - string const& _description, + std::string const& _description, SecondarySourceLocation const& _secondaryLocation ) { error(_error, Error::Type::Warning, _location, _secondaryLocation, _description); } -void ErrorReporter::error(ErrorId _errorId, Error::Type _type, SourceLocation const& _location, string const& _description) +void ErrorReporter::error(ErrorId _errorId, Error::Type _type, SourceLocation const& _location, std::string const& _description) { if (checkForExcessiveErrors(_type)) return; - m_errorList.push_back(make_shared(_errorId, _type, _description, _location)); + m_errorList.push_back(std::make_shared(_errorId, _type, _description, _location)); } -void ErrorReporter::error(ErrorId _errorId, Error::Type _type, SourceLocation const& _location, SecondarySourceLocation const& _secondaryLocation, string const& _description) +void ErrorReporter::error(ErrorId _errorId, Error::Type _type, SourceLocation const& _location, SecondarySourceLocation const& _secondaryLocation, std::string const& _description) { if (checkForExcessiveErrors(_type)) return; - m_errorList.push_back(make_shared(_errorId, _type, _description, _location, _secondaryLocation)); + m_errorList.push_back(std::make_shared(_errorId, _type, _description, _location, _secondaryLocation)); } bool ErrorReporter::hasExcessiveErrors() const @@ -89,7 +88,7 @@ bool ErrorReporter::checkForExcessiveErrors(Error::Type _type) m_warningCount++; if (m_warningCount == c_maxWarningsAllowed) - m_errorList.push_back(make_shared(4591_error, Error::Type::Warning, "There are more than 256 warnings. Ignoring the rest.")); + m_errorList.push_back(std::make_shared(4591_error, Error::Type::Warning, "There are more than 256 warnings. Ignoring the rest.")); if (m_warningCount >= c_maxWarningsAllowed) return true; @@ -99,7 +98,7 @@ bool ErrorReporter::checkForExcessiveErrors(Error::Type _type) m_infoCount++; if (m_infoCount == c_maxInfosAllowed) - m_errorList.push_back(make_shared(2833_error, Error::Type::Info, "There are more than 256 infos. Ignoring the rest.")); + m_errorList.push_back(std::make_shared(2833_error, Error::Type::Info, "There are more than 256 infos. Ignoring the rest.")); if (m_infoCount >= c_maxInfosAllowed) return true; @@ -110,7 +109,7 @@ bool ErrorReporter::checkForExcessiveErrors(Error::Type _type) if (m_errorCount > c_maxErrorsAllowed) { - m_errorList.push_back(make_shared(4013_error, Error::Type::Warning, "There are more than 256 errors. Aborting.")); + m_errorList.push_back(std::make_shared(4013_error, Error::Type::Warning, "There are more than 256 errors. Aborting.")); BOOST_THROW_EXCEPTION(FatalError()); } } @@ -118,13 +117,13 @@ bool ErrorReporter::checkForExcessiveErrors(Error::Type _type) return false; } -void ErrorReporter::fatalError(ErrorId _error, Error::Type _type, SourceLocation const& _location, SecondarySourceLocation const& _secondaryLocation, string const& _description) +void ErrorReporter::fatalError(ErrorId _error, Error::Type _type, SourceLocation const& _location, SecondarySourceLocation const& _secondaryLocation, std::string const& _description) { error(_error, _type, _location, _secondaryLocation, _description); BOOST_THROW_EXCEPTION(FatalError()); } -void ErrorReporter::fatalError(ErrorId _error, Error::Type _type, SourceLocation const& _location, string const& _description) +void ErrorReporter::fatalError(ErrorId _error, Error::Type _type, SourceLocation const& _location, std::string const& _description) { error(_error, _type, _location, _description); BOOST_THROW_EXCEPTION(FatalError()); @@ -140,7 +139,7 @@ void ErrorReporter::clear() m_errorList.clear(); } -void ErrorReporter::declarationError(ErrorId _error, SourceLocation const& _location, SecondarySourceLocation const& _secondaryLocation, string const& _description) +void ErrorReporter::declarationError(ErrorId _error, SourceLocation const& _location, SecondarySourceLocation const& _secondaryLocation, std::string const& _description) { error( _error, @@ -151,7 +150,7 @@ void ErrorReporter::declarationError(ErrorId _error, SourceLocation const& _loca ); } -void ErrorReporter::declarationError(ErrorId _error, SourceLocation const& _location, string const& _description) +void ErrorReporter::declarationError(ErrorId _error, SourceLocation const& _location, std::string const& _description) { error( _error, @@ -170,7 +169,7 @@ void ErrorReporter::fatalDeclarationError(ErrorId _error, SourceLocation const& _description); } -void ErrorReporter::parserError(ErrorId _error, SourceLocation const& _location, string const& _description) +void ErrorReporter::parserError(ErrorId _error, SourceLocation const& _location, std::string const& _description) { error( _error, @@ -180,7 +179,7 @@ void ErrorReporter::parserError(ErrorId _error, SourceLocation const& _location, ); } -void ErrorReporter::fatalParserError(ErrorId _error, SourceLocation const& _location, string const& _description) +void ErrorReporter::fatalParserError(ErrorId _error, SourceLocation const& _location, std::string const& _description) { fatalError( _error, @@ -190,7 +189,7 @@ void ErrorReporter::fatalParserError(ErrorId _error, SourceLocation const& _loca ); } -void ErrorReporter::syntaxError(ErrorId _error, SourceLocation const& _location, string const& _description) +void ErrorReporter::syntaxError(ErrorId _error, SourceLocation const& _location, std::string const& _description) { error( _error, @@ -200,7 +199,7 @@ void ErrorReporter::syntaxError(ErrorId _error, SourceLocation const& _location, ); } -void ErrorReporter::typeError(ErrorId _error, SourceLocation const& _location, SecondarySourceLocation const& _secondaryLocation, string const& _description) +void ErrorReporter::typeError(ErrorId _error, SourceLocation const& _location, SecondarySourceLocation const& _secondaryLocation, std::string const& _description) { error( _error, @@ -211,7 +210,7 @@ void ErrorReporter::typeError(ErrorId _error, SourceLocation const& _location, S ); } -void ErrorReporter::typeError(ErrorId _error, SourceLocation const& _location, string const& _description) +void ErrorReporter::typeError(ErrorId _error, SourceLocation const& _location, std::string const& _description) { error( _error, @@ -222,7 +221,7 @@ void ErrorReporter::typeError(ErrorId _error, SourceLocation const& _location, s } -void ErrorReporter::fatalTypeError(ErrorId _error, SourceLocation const& _location, SecondarySourceLocation const& _secondaryLocation, string const& _description) +void ErrorReporter::fatalTypeError(ErrorId _error, SourceLocation const& _location, SecondarySourceLocation const& _secondaryLocation, std::string const& _description) { fatalError( _error, @@ -233,7 +232,7 @@ void ErrorReporter::fatalTypeError(ErrorId _error, SourceLocation const& _locati ); } -void ErrorReporter::fatalTypeError(ErrorId _error, SourceLocation const& _location, string const& _description) +void ErrorReporter::fatalTypeError(ErrorId _error, SourceLocation const& _location, std::string const& _description) { fatalError( _error, @@ -243,7 +242,7 @@ void ErrorReporter::fatalTypeError(ErrorId _error, SourceLocation const& _locati ); } -void ErrorReporter::docstringParsingError(ErrorId _error, SourceLocation const& _location, string const& _description) +void ErrorReporter::docstringParsingError(ErrorId _error, SourceLocation const& _location, std::string const& _description) { error( _error, @@ -256,13 +255,13 @@ void ErrorReporter::docstringParsingError(ErrorId _error, SourceLocation const& void ErrorReporter::info( ErrorId _error, SourceLocation const& _location, - string const& _description + std::string const& _description ) { error(_error, Error::Type::Info, _location, _description); } -void ErrorReporter::info(ErrorId _error, string const& _description) +void ErrorReporter::info(ErrorId _error, std::string const& _description) { error(_error, Error::Type::Info, SourceLocation(), _description); } diff --git a/liblangutil/Exceptions.cpp b/liblangutil/Exceptions.cpp index 92fe2589ace9..118720b74570 100644 --- a/liblangutil/Exceptions.cpp +++ b/liblangutil/Exceptions.cpp @@ -26,7 +26,6 @@ #include #include -using namespace std; using namespace solidity; using namespace solidity::langutil; diff --git a/liblangutil/ParserBase.cpp b/liblangutil/ParserBase.cpp index 91f67861ab7d..12a00d04f121 100644 --- a/liblangutil/ParserBase.cpp +++ b/liblangutil/ParserBase.cpp @@ -25,7 +25,6 @@ #include #include -using namespace std; using namespace solidity; using namespace solidity::langutil; @@ -44,7 +43,7 @@ Token ParserBase::peekNextToken() const return m_scanner->peekNextToken(); } -string ParserBase::currentLiteral() const +std::string ParserBase::currentLiteral() const { return m_scanner->currentLiteral(); } @@ -54,7 +53,7 @@ Token ParserBase::advance() return m_scanner->next(); } -string ParserBase::tokenName(Token _token) +std::string ParserBase::tokenName(Token _token) { if (_token == Token::Identifier) return "identifier"; @@ -76,7 +75,7 @@ void ParserBase::expectToken(Token _value, bool _advance) Token tok = m_scanner->currentToken(); if (tok != _value) { - string const expectedToken = ParserBase::tokenName(_value); + std::string const expectedToken = ParserBase::tokenName(_value); if (m_parserErrorRecovery) parserError(6635_error, "Expected " + expectedToken + " but got " + tokenName(tok)); else @@ -92,7 +91,7 @@ void ParserBase::expectToken(Token _value, bool _advance) advance(); } -void ParserBase::expectTokenOrConsumeUntil(Token _value, string const& _currentNodeName, bool _advance) +void ParserBase::expectTokenOrConsumeUntil(Token _value, std::string const& _currentNodeName, bool _advance) { solAssert(m_inParserRecovery, "The function is supposed to be called during parser recovery only."); @@ -104,12 +103,12 @@ void ParserBase::expectTokenOrConsumeUntil(Token _value, string const& _currentN while (m_scanner->currentToken() != _value && m_scanner->currentToken() != Token::EOS) advance(); - string const expectedToken = ParserBase::tokenName(_value); + std::string const expectedToken = ParserBase::tokenName(_value); if (m_scanner->currentToken() == Token::EOS) { // rollback to where the token started, and raise exception to be caught at a higher level. m_scanner->setPosition(static_cast(startPosition)); - string const msg = "In " + _currentNodeName + ", " + expectedToken + "is expected; got " + ParserBase::tokenName(tok) + " instead."; + std::string const msg = "In " + _currentNodeName + ", " + expectedToken + "is expected; got " + ParserBase::tokenName(tok) + " instead."; fatalParserError(1957_error, errorLoc, msg); } else @@ -120,7 +119,7 @@ void ParserBase::expectTokenOrConsumeUntil(Token _value, string const& _currentN } else { - string expectedToken = ParserBase::tokenName(_value); + std::string expectedToken = ParserBase::tokenName(_value); parserWarning(3347_error, "Recovered in " + _currentNodeName + " at " + expectedToken + "."); m_inParserRecovery = false; } @@ -142,32 +141,32 @@ void ParserBase::decreaseRecursionDepth() m_recursionDepth--; } -void ParserBase::parserWarning(ErrorId _error, string const& _description) +void ParserBase::parserWarning(ErrorId _error, std::string const& _description) { m_errorReporter.warning(_error, currentLocation(), _description); } -void ParserBase::parserWarning(ErrorId _error, SourceLocation const& _location, string const& _description) +void ParserBase::parserWarning(ErrorId _error, SourceLocation const& _location, std::string const& _description) { m_errorReporter.warning(_error, _location, _description); } -void ParserBase::parserError(ErrorId _error, SourceLocation const& _location, string const& _description) +void ParserBase::parserError(ErrorId _error, SourceLocation const& _location, std::string const& _description) { m_errorReporter.parserError(_error, _location, _description); } -void ParserBase::parserError(ErrorId _error, string const& _description) +void ParserBase::parserError(ErrorId _error, std::string const& _description) { parserError(_error, currentLocation(), _description); } -void ParserBase::fatalParserError(ErrorId _error, string const& _description) +void ParserBase::fatalParserError(ErrorId _error, std::string const& _description) { fatalParserError(_error, currentLocation(), _description); } -void ParserBase::fatalParserError(ErrorId _error, SourceLocation const& _location, string const& _description) +void ParserBase::fatalParserError(ErrorId _error, SourceLocation const& _location, std::string const& _description) { m_errorReporter.fatalParserError(_error, _location, _description); } diff --git a/liblangutil/Scanner.cpp b/liblangutil/Scanner.cpp index 1b9b2afac2d0..2d5607607a88 100644 --- a/liblangutil/Scanner.cpp +++ b/liblangutil/Scanner.cpp @@ -61,12 +61,11 @@ #include #include -using namespace std; namespace solidity::langutil { -string to_string(ScannerError _errorCode) +std::string to_string(ScannerError _errorCode) { switch (_errorCode) { @@ -92,7 +91,7 @@ string to_string(ScannerError _errorCode) } -ostream& operator<<(ostream& os, ScannerError _errorCode) +std::ostream& operator<<(std::ostream& os, ScannerError _errorCode) { return os << to_string(_errorCode); } @@ -275,12 +274,12 @@ namespace /// to the user. static ScannerError validateBiDiMarkup(CharStream& _stream, size_t _startPosition) { - static array, 5> constexpr directionalSequences{ - pair{"\xE2\x80\xAD", 1}, // U+202D (LRO - Left-to-Right Override) - pair{"\xE2\x80\xAE", 1}, // U+202E (RLO - Right-to-Left Override) - pair{"\xE2\x80\xAA", 1}, // U+202A (LRE - Left-to-Right Embedding) - pair{"\xE2\x80\xAB", 1}, // U+202B (RLE - Right-to-Left Embedding) - pair{"\xE2\x80\xAC", -1} // U+202C (PDF - Pop Directional Formatting + static std::array, 5> constexpr directionalSequences{ + std::pair{"\xE2\x80\xAD", 1}, // U+202D (LRO - Left-to-Right Override) + std::pair{"\xE2\x80\xAE", 1}, // U+202E (RLO - Right-to-Left Override) + std::pair{"\xE2\x80\xAA", 1}, // U+202A (LRE - Left-to-Right Embedding) + std::pair{"\xE2\x80\xAB", 1}, // U+202B (RLE - Right-to-Left Embedding) + std::pair{"\xE2\x80\xAC", -1} // U+202C (PDF - Pop Directional Formatting }; size_t endPosition = _stream.position(); @@ -712,7 +711,7 @@ void Scanner::scanToken() default: if (isIdentifierStart(m_char)) { - tie(token, m, n) = scanIdentifierOrKeyword(); + std::tie(token, m, n) = scanIdentifierOrKeyword(); // Special case for hexadecimal literals if (token == Token::Hex) @@ -757,7 +756,7 @@ void Scanner::scanToken() m_tokens[NextNext].location.end = static_cast(sourcePos()); m_tokens[NextNext].location.sourceName = m_sourceName; m_tokens[NextNext].token = token; - m_tokens[NextNext].extendedTokenInfo = make_tuple(m, n); + m_tokens[NextNext].extendedTokenInfo = std::make_tuple(m, n); } bool Scanner::scanEscape() @@ -1011,7 +1010,7 @@ Token Scanner::scanNumber(char _charSeen) return Token::Number; } -tuple Scanner::scanIdentifierOrKeyword() +std::tuple Scanner::scanIdentifierOrKeyword() { solAssert(isIdentifierStart(m_char), ""); LiteralScope literal(this, LITERAL_TYPE_STRING); diff --git a/liblangutil/SemVerHandler.cpp b/liblangutil/SemVerHandler.cpp index 6e85e2609d85..2358eec5ef0d 100644 --- a/liblangutil/SemVerHandler.cpp +++ b/liblangutil/SemVerHandler.cpp @@ -29,18 +29,18 @@ #include #include -using namespace std; +using namespace std::string_literals; using namespace solidity; using namespace solidity::langutil; using namespace solidity::util; -SemVerMatchExpressionParser::SemVerMatchExpressionParser(vector _tokens, vector _literals): +SemVerMatchExpressionParser::SemVerMatchExpressionParser(std::vector _tokens, std::vector _literals): m_tokens(std::move(_tokens)), m_literals(std::move(_literals)) { solAssert(m_tokens.size() == m_literals.size(), ""); } -SemVerVersion::SemVerVersion(string const& _versionString) +SemVerVersion::SemVerVersion(std::string const& _versionString) { auto i = _versionString.begin(); auto end = _versionString.end(); @@ -63,13 +63,13 @@ SemVerVersion::SemVerVersion(string const& _versionString) { auto prereleaseStart = ++i; while (i != end && *i != '+') ++i; - prerelease = string(prereleaseStart, i); + prerelease = std::string(prereleaseStart, i); } if (i != end && *i == '+') { auto buildStart = ++i; while (i != end) ++i; - build = string(buildStart, i); + build = std::string(buildStart, i); } if (i != end) solThrow(SemVerError, "Invalid versionString "s + _versionString); diff --git a/liblangutil/SourceLocation.cpp b/liblangutil/SourceLocation.cpp index 72f2506e8a02..61fe40f92627 100644 --- a/liblangutil/SourceLocation.cpp +++ b/liblangutil/SourceLocation.cpp @@ -25,14 +25,13 @@ using namespace solidity; using namespace solidity::langutil; -using namespace std; -SourceLocation solidity::langutil::parseSourceLocation(string const& _input, vector> const& _sourceNames) +SourceLocation solidity::langutil::parseSourceLocation(std::string const& _input, std::vector> const& _sourceNames) { // Expected input: "start:length:sourceindex" enum SrcElem: size_t { Start, Length, Index }; - vector pos; + std::vector pos; boost::algorithm::split(pos, _input, boost::is_any_of(":")); diff --git a/liblangutil/SourceReferenceExtractor.cpp b/liblangutil/SourceReferenceExtractor.cpp index 01f22a1f7790..9389a77aa695 100644 --- a/liblangutil/SourceReferenceExtractor.cpp +++ b/liblangutil/SourceReferenceExtractor.cpp @@ -24,7 +24,6 @@ #include #include -using namespace std; using namespace solidity; using namespace solidity::langutil; @@ -36,7 +35,7 @@ SourceReferenceExtractor::Message SourceReferenceExtractor::extract( { SourceLocation const* location = boost::get_error_info(_exception); - string const* message = boost::get_error_info(_exception); + std::string const* message = boost::get_error_info(_exception); SourceReference primary = extract(_charStreamProvider, location, message ? *message : ""); std::vector secondary; @@ -45,7 +44,7 @@ SourceReferenceExtractor::Message SourceReferenceExtractor::extract( for (auto const& info: secondaryLocation->infos) secondary.emplace_back(extract(_charStreamProvider, &info.second, info.first)); - return Message{std::move(primary), _typeOrSeverity, std::move(secondary), nullopt}; + return Message{std::move(primary), _typeOrSeverity, std::move(secondary), std::nullopt}; } SourceReferenceExtractor::Message SourceReferenceExtractor::extract( @@ -78,7 +77,7 @@ SourceReference SourceReferenceExtractor::extract( LineColumn end = charStream.translatePositionToLineColumn(_location->end); bool const isMultiline = start.line != end.line; - string line = charStream.lineAtPosition(_location->start); + std::string line = charStream.lineAtPosition(_location->start); int locationLength = isMultiline ? @@ -88,7 +87,7 @@ SourceReference SourceReferenceExtractor::extract( if (locationLength > 150) { auto const lhs = static_cast(start.column) + 35; - string::size_type const rhs = (isMultiline ? line.length() : static_cast(end.column)) - 35; + std::string::size_type const rhs = (isMultiline ? line.length() : static_cast(end.column)) - 35; line = line.substr(0, lhs) + " ... " + line.substr(rhs); end.column = start.column + 75; locationLength = 75; @@ -98,9 +97,9 @@ SourceReference SourceReferenceExtractor::extract( { int const len = static_cast(line.length()); line = line.substr( - static_cast(max(0, start.column - 35)), - static_cast(min(start.column, 35)) + static_cast( - min(locationLength + 35, len - start.column) + static_cast(std::max(0, start.column - 35)), + static_cast(std::min(start.column, 35)) + static_cast( + std::min(locationLength + 35, len - start.column) ) ); if (start.column + locationLength + 35 < len) @@ -119,7 +118,7 @@ SourceReference SourceReferenceExtractor::extract( interest, isMultiline, line, - min(start.column, static_cast(line.length())), - min(end.column, static_cast(line.length())) + std::min(start.column, static_cast(line.length())), + std::min(end.column, static_cast(line.length())) }; } diff --git a/liblangutil/SourceReferenceFormatter.cpp b/liblangutil/SourceReferenceFormatter.cpp index 4765b9fb24d9..76cb1df61a33 100644 --- a/liblangutil/SourceReferenceFormatter.cpp +++ b/liblangutil/SourceReferenceFormatter.cpp @@ -28,7 +28,6 @@ #include #include -using namespace std; using namespace solidity; using namespace solidity::langutil; using namespace solidity::util; @@ -114,15 +113,15 @@ void SourceReferenceFormatter::printSourceLocation(SourceReference const& _ref) return; // No line available, nothing else to print } - string line = std::to_string(_ref.position.line + 1); // one-based line number as string - string leftpad = string(line.size(), ' '); + std::string line = std::to_string(_ref.position.line + 1); // one-based line number as string + std::string leftpad = std::string(line.size(), ' '); // line 0: source name m_stream << leftpad; frameColored() << "-->"; m_stream << ' ' << _ref.sourceName << ':' << line << ':' << (_ref.position.column + 1) << ":\n"; - string_view text = _ref.text; + std::string_view text = _ref.text; if (m_charStreamProvider.charStream(_ref.sourceName).isImportedFromAST()) return; diff --git a/liblangutil/Token.cpp b/liblangutil/Token.cpp index 60b8aa798755..8a860791fa45 100644 --- a/liblangutil/Token.cpp +++ b/liblangutil/Token.cpp @@ -46,8 +46,6 @@ #include -using namespace std; - namespace solidity::langutil { @@ -71,25 +69,25 @@ std::string ElementaryTypeNameToken::toString(bool const& tokenValue) const void ElementaryTypeNameToken::assertDetails(Token _baseType, unsigned const& _first, unsigned const& _second) { - solAssert(TokenTraits::isElementaryTypeName(_baseType), "Expected elementary type name: " + string(TokenTraits::toString(_baseType))); + solAssert(TokenTraits::isElementaryTypeName(_baseType), "Expected elementary type name: " + std::string(TokenTraits::toString(_baseType))); if (_baseType == Token::BytesM) { solAssert(_second == 0, "There should not be a second size argument to type bytesM."); - solAssert(_first <= 32, "No elementary type bytes" + to_string(_first) + "."); + solAssert(_first <= 32, "No elementary type bytes" + std::to_string(_first) + "."); } else if (_baseType == Token::UIntM || _baseType == Token::IntM) { - solAssert(_second == 0, "There should not be a second size argument to type " + string(TokenTraits::toString(_baseType)) + "."); + solAssert(_second == 0, "There should not be a second size argument to type " + std::string(TokenTraits::toString(_baseType)) + "."); solAssert( _first <= 256 && _first % 8 == 0, - "No elementary type " + string(TokenTraits::toString(_baseType)) + to_string(_first) + "." + "No elementary type " + std::string(TokenTraits::toString(_baseType)) + std::to_string(_first) + "." ); } else if (_baseType == Token::UFixedMxN || _baseType == Token::FixedMxN) { solAssert( _first >= 8 && _first <= 256 && _first % 8 == 0 && _second <= 80, - "No elementary type " + string(TokenTraits::toString(_baseType)) + to_string(_first) + "x" + to_string(_second) + "." + "No elementary type " + std::string(TokenTraits::toString(_baseType)) + std::to_string(_first) + "x" + std::to_string(_second) + "." ); } else @@ -136,29 +134,29 @@ std::string friendlyName(Token tok) } -static Token keywordByName(string const& _name) +static Token keywordByName(std::string const& _name) { // The following macros are used inside TOKEN_LIST and cause non-keyword tokens to be ignored // and keywords to be put inside the keywords variable. #define KEYWORD(name, string, precedence) {string, Token::name}, #define TOKEN(name, string, precedence) - static map const keywords({TOKEN_LIST(TOKEN, KEYWORD)}); + static std::map const keywords({TOKEN_LIST(TOKEN, KEYWORD)}); #undef KEYWORD #undef TOKEN auto it = keywords.find(_name); return it == keywords.end() ? Token::Identifier : it->second; } -bool isYulKeyword(string const& _literal) +bool isYulKeyword(std::string const& _literal) { return _literal == "leave" || isYulKeyword(keywordByName(_literal)); } -tuple fromIdentifierOrKeyword(string const& _literal) +std::tuple fromIdentifierOrKeyword(std::string const& _literal) { // Used for `bytesM`, `uintM`, `intM`, `fixedMxN`, `ufixedMxN`. // M/N must be shortest representation. M can never be 0. N can be zero. - auto parseSize = [](string::const_iterator _begin, string::const_iterator _end) -> int + auto parseSize = [](std::string::const_iterator _begin, std::string::const_iterator _end) -> int { // No number. if (distance(_begin, _end) == 0) @@ -185,23 +183,23 @@ tuple fromIdentifierOrKeyword(string const& _ auto positionM = find_if(_literal.begin(), _literal.end(), util::isDigit); if (positionM != _literal.end()) { - string baseType(_literal.begin(), positionM); + std::string baseType(_literal.begin(), positionM); auto positionX = find_if_not(positionM, _literal.end(), util::isDigit); int m = parseSize(positionM, positionX); Token keyword = keywordByName(baseType); if (keyword == Token::Bytes) { if (0 < m && m <= 32 && positionX == _literal.end()) - return make_tuple(Token::BytesM, m, 0); + return std::make_tuple(Token::BytesM, m, 0); } else if (keyword == Token::UInt || keyword == Token::Int) { if (0 < m && m <= 256 && m % 8 == 0 && positionX == _literal.end()) { if (keyword == Token::UInt) - return make_tuple(Token::UIntM, m, 0); + return std::make_tuple(Token::UIntM, m, 0); else - return make_tuple(Token::IntM, m, 0); + return std::make_tuple(Token::IntM, m, 0); } } else if (keyword == Token::UFixed || keyword == Token::Fixed) @@ -218,16 +216,16 @@ tuple fromIdentifierOrKeyword(string const& _ 0 <= n && n <= 80 ) { if (keyword == Token::UFixed) - return make_tuple(Token::UFixedMxN, m, n); + return std::make_tuple(Token::UFixedMxN, m, n); else - return make_tuple(Token::FixedMxN, m, n); + return std::make_tuple(Token::FixedMxN, m, n); } } } - return make_tuple(Token::Identifier, 0, 0); + return std::make_tuple(Token::Identifier, 0, 0); } - return make_tuple(keywordByName(_literal), 0, 0); + return std::make_tuple(keywordByName(_literal), 0, 0); } } diff --git a/libsmtutil/CHCSmtLib2Interface.cpp b/libsmtutil/CHCSmtLib2Interface.cpp index e1f80e62bd92..ef7c56ac0c06 100644 --- a/libsmtutil/CHCSmtLib2Interface.cpp +++ b/libsmtutil/CHCSmtLib2Interface.cpp @@ -31,20 +31,19 @@ #include #include -using namespace std; using namespace solidity; using namespace solidity::util; using namespace solidity::frontend; using namespace solidity::smtutil; CHCSmtLib2Interface::CHCSmtLib2Interface( - map const& _queryResponses, + std::map const& _queryResponses, ReadCallback::Callback _smtCallback, SMTSolverChoice _enabledSolvers, - optional _queryTimeout + std::optional _queryTimeout ): CHCSolverInterface(_queryTimeout), - m_smtlib2(make_unique(_queryResponses, _smtCallback, m_queryTimeout)), + m_smtlib2(std::make_unique(_queryResponses, _smtCallback, m_queryTimeout)), m_queryResponses(std::move(_queryResponses)), m_smtCallback(_smtCallback), m_enabledSolvers(_enabledSolvers) @@ -66,8 +65,8 @@ void CHCSmtLib2Interface::registerRelation(Expression const& _expr) smtAssert(_expr.sort->kind == Kind::Function); if (!m_variables.count(_expr.name)) { - auto fSort = dynamic_pointer_cast(_expr.sort); - string domain = toSmtLibSort(fSort->domain); + auto fSort = std::dynamic_pointer_cast(_expr.sort); + std::string domain = toSmtLibSort(fSort->domain); // Relations are predicates which have implicit codomain Bool. m_variables.insert(_expr.name); write( @@ -89,25 +88,10 @@ void CHCSmtLib2Interface::addRule(Expression const& _expr, std::string const& /* ); } -tuple CHCSmtLib2Interface::query(Expression const& _block) +std::tuple CHCSmtLib2Interface::query(Expression const& _block) { - string accumulated{}; - swap(m_accumulatedOutput, accumulated); - solAssert(m_smtlib2, ""); - writeHeader(); - for (auto const& decl: m_smtlib2->userSorts() | ranges::views::values) - write(decl); - m_accumulatedOutput += accumulated; - - string queryRule = "(assert\n(forall " + forall() + "\n" + - "(=> " + _block.name + " false)" - "))"; - string response = querySolver( - m_accumulatedOutput + - queryRule + - "\n(check-sat)" - ); - swap(m_accumulatedOutput, accumulated); + std::string query = dumpQuery(_block); + std::string response = querySolver(query); CheckResult result; // TODO proper parsing @@ -123,7 +107,7 @@ tuple CHCSmtLib2Interface return {result, Expression(true), {}}; } -void CHCSmtLib2Interface::declareVariable(string const& _name, SortPointer const& _sort) +void CHCSmtLib2Interface::declareVariable(std::string const& _name, SortPointer const& _sort) { smtAssert(_sort); if (_sort->kind == Kind::Function) @@ -135,32 +119,25 @@ void CHCSmtLib2Interface::declareVariable(string const& _name, SortPointer const } } -string CHCSmtLib2Interface::toSmtLibSort(Sort const& _sort) +std::string CHCSmtLib2Interface::toSmtLibSort(Sort const& _sort) { if (!m_sortNames.count(&_sort)) m_sortNames[&_sort] = m_smtlib2->toSmtLibSort(_sort); return m_sortNames.at(&_sort); } -string CHCSmtLib2Interface::toSmtLibSort(vector const& _sorts) +std::string CHCSmtLib2Interface::toSmtLibSort(std::vector const& _sorts) { - string ssort("("); + std::string ssort("("); for (auto const& sort: _sorts) ssort += toSmtLibSort(*sort) + " "; ssort += ")"; return ssort; } -void CHCSmtLib2Interface::writeHeader() -{ - if (m_queryTimeout) - write("(set-option :timeout " + to_string(*m_queryTimeout) + ")"); - write("(set-logic HORN)\n"); -} - -string CHCSmtLib2Interface::forall() +std::string CHCSmtLib2Interface::forall() { - string vars("("); + std::string vars("("); for (auto const& [name, sort]: m_smtlib2->variables()) { solAssert(sort, ""); @@ -171,17 +148,17 @@ string CHCSmtLib2Interface::forall() return vars; } -void CHCSmtLib2Interface::declareFunction(string const& _name, SortPointer const& _sort) +void CHCSmtLib2Interface::declareFunction(std::string const& _name, SortPointer const& _sort) { smtAssert(_sort); smtAssert(_sort->kind == Kind::Function); // TODO Use domain and codomain as key as well if (!m_variables.count(_name)) { - auto fSort = dynamic_pointer_cast(_sort); + auto fSort = std::dynamic_pointer_cast(_sort); smtAssert(fSort->codomain); - string domain = toSmtLibSort(fSort->domain); - string codomain = toSmtLibSort(*fSort->codomain); + std::string domain = toSmtLibSort(fSort->domain); + std::string codomain = toSmtLibSort(*fSort->codomain); m_variables.insert(_name); write( "(declare-fun |" + @@ -195,12 +172,12 @@ void CHCSmtLib2Interface::declareFunction(string const& _name, SortPointer const } } -void CHCSmtLib2Interface::write(string _data) +void CHCSmtLib2Interface::write(std::string _data) { m_accumulatedOutput += std::move(_data) + "\n"; } -string CHCSmtLib2Interface::querySolver(string const& _input) +std::string CHCSmtLib2Interface::querySolver(std::string const& _input) { util::h256 inputHash = util::keccak256(_input); if (m_queryResponses.count(inputHash)) @@ -217,3 +194,32 @@ string CHCSmtLib2Interface::querySolver(string const& _input) m_unhandledQueries.push_back(_input); return "unknown\n"; } + +std::string CHCSmtLib2Interface::dumpQuery(Expression const& _expr) +{ + std::stringstream s; + + s + << createHeaderAndDeclarations() + << m_accumulatedOutput << std::endl + << createQueryAssertion(_expr.name) << std::endl + << "(check-sat)" << std::endl; + + return s.str(); +} + +std::string CHCSmtLib2Interface::createHeaderAndDeclarations() { + std::stringstream s; + if (m_queryTimeout) + s << "(set-option :timeout " + std::to_string(*m_queryTimeout) + ")\n"; + s << "(set-logic HORN)" << std::endl; + + for (auto const& decl: m_smtlib2->userSorts() | ranges::views::values) + s << decl << std::endl; + + return s.str(); +} + +std::string CHCSmtLib2Interface::createQueryAssertion(std::string name) { + return "(assert\n(forall " + forall() + "\n" + "(=> " + name + " false)))"; +} diff --git a/libsmtutil/CHCSmtLib2Interface.h b/libsmtutil/CHCSmtLib2Interface.h index 4748af8da6c6..0f3a68ee405d 100644 --- a/libsmtutil/CHCSmtLib2Interface.h +++ b/libsmtutil/CHCSmtLib2Interface.h @@ -51,6 +51,8 @@ class CHCSmtLib2Interface: public CHCSolverInterface void declareVariable(std::string const& _name, SortPointer const& _sort) override; + std::string dumpQuery(Expression const& _expr); + std::vector unhandledQueries() const { return m_unhandledQueries; } SMTLib2Interface* smtlib2Interface() const { return m_smtlib2.get(); } @@ -66,6 +68,9 @@ class CHCSmtLib2Interface: public CHCSolverInterface void write(std::string _data); + std::string createQueryAssertion(std::string name); + std::string createHeaderAndDeclarations(); + /// Communicates with the solver via the callback. Throws SMTSolverError on error. std::string querySolver(std::string const& _input); diff --git a/libsmtutil/CVC4Interface.cpp b/libsmtutil/CVC4Interface.cpp index 3c047782a4fc..f53c92ab5705 100644 --- a/libsmtutil/CVC4Interface.cpp +++ b/libsmtutil/CVC4Interface.cpp @@ -23,12 +23,11 @@ #include -using namespace std; using namespace solidity; using namespace solidity::util; using namespace solidity::smtutil; -CVC4Interface::CVC4Interface(optional _queryTimeout): +CVC4Interface::CVC4Interface(std::optional _queryTimeout): SolverInterface(_queryTimeout), m_solver(&m_context) { @@ -56,7 +55,7 @@ void CVC4Interface::pop() m_solver.pop(); } -void CVC4Interface::declareVariable(string const& _name, SortPointer const& _sort) +void CVC4Interface::declareVariable(std::string const& _name, SortPointer const& _sort) { smtAssert(_sort, ""); m_variables[_name] = m_context.mkVar(_name.c_str(), cvc4Sort(*_sort)); @@ -86,10 +85,10 @@ void CVC4Interface::addAssertion(Expression const& _expr) } } -pair> CVC4Interface::check(vector const& _expressionsToEvaluate) +std::pair> CVC4Interface::check(std::vector const& _expressionsToEvaluate) { CheckResult result; - vector values; + std::vector values; try { switch (m_solver.checkSat().isSat()) @@ -119,7 +118,7 @@ pair> CVC4Interface::check(vector const& values.clear(); } - return make_pair(result, values); + return std::make_pair(result, values); } CVC4::Expr CVC4Interface::toCVC4Expr(Expression const& _expr) @@ -128,13 +127,13 @@ CVC4::Expr CVC4Interface::toCVC4Expr(Expression const& _expr) if (_expr.arguments.empty() && m_variables.count(_expr.name)) return m_variables.at(_expr.name); - vector arguments; + std::vector arguments; for (auto const& arg: _expr.arguments) arguments.push_back(toCVC4Expr(arg)); try { - string const& n = _expr.name; + std::string const& n = _expr.name; // Function application if (!arguments.empty() && m_variables.count(_expr.name)) return m_context.mkExpr(CVC4::kind::APPLY_UF, m_variables.at(n), arguments); @@ -145,7 +144,7 @@ CVC4::Expr CVC4Interface::toCVC4Expr(Expression const& _expr) return m_context.mkConst(true); else if (n == "false") return m_context.mkConst(false); - else if (auto sortSort = dynamic_pointer_cast(_expr.sort)) + else if (auto sortSort = std::dynamic_pointer_cast(_expr.sort)) return m_context.mkVar(n, cvc4Sort(*sortSort->inner)); else try @@ -224,7 +223,7 @@ CVC4::Expr CVC4Interface::toCVC4Expr(Expression const& _expr) } else if (n == "bv2int") { - auto intSort = dynamic_pointer_cast(_expr.sort); + auto intSort = std::dynamic_pointer_cast(_expr.sort); smtAssert(intSort, ""); auto nat = m_context.mkExpr(CVC4::kind::BITVECTOR_TO_NAT, arguments[0]); if (!intSort->isSigned) @@ -254,13 +253,13 @@ CVC4::Expr CVC4Interface::toCVC4Expr(Expression const& _expr) return m_context.mkExpr(CVC4::kind::STORE, arguments[0], arguments[1], arguments[2]); else if (n == "const_array") { - shared_ptr sortSort = std::dynamic_pointer_cast(_expr.arguments[0].sort); + std::shared_ptr sortSort = std::dynamic_pointer_cast(_expr.arguments[0].sort); smtAssert(sortSort, ""); return m_context.mkConst(CVC4::ArrayStoreAll(cvc4Sort(*sortSort->inner), arguments[1])); } else if (n == "tuple_get") { - shared_ptr tupleSort = std::dynamic_pointer_cast(_expr.arguments[0].sort); + std::shared_ptr tupleSort = std::dynamic_pointer_cast(_expr.arguments[0].sort); smtAssert(tupleSort, ""); CVC4::DatatypeType tt = m_context.mkTupleType(cvc4Sort(tupleSort->components)); CVC4::Datatype const& dt = tt.getDatatype(); @@ -270,7 +269,7 @@ CVC4::Expr CVC4Interface::toCVC4Expr(Expression const& _expr) } else if (n == "tuple_constructor") { - shared_ptr tupleSort = std::dynamic_pointer_cast(_expr.sort); + std::shared_ptr tupleSort = std::dynamic_pointer_cast(_expr.sort); smtAssert(tupleSort, ""); CVC4::DatatypeType tt = m_context.mkTupleType(cvc4Sort(tupleSort->components)); CVC4::Datatype const& dt = tt.getDatatype(); @@ -328,9 +327,9 @@ CVC4::Type CVC4Interface::cvc4Sort(Sort const& _sort) return m_context.integerType(); } -vector CVC4Interface::cvc4Sort(vector const& _sorts) +std::vector CVC4Interface::cvc4Sort(std::vector const& _sorts) { - vector cvc4Sorts; + std::vector cvc4Sorts; for (auto const& _sort: _sorts) cvc4Sorts.push_back(cvc4Sort(*_sort)); return cvc4Sorts; diff --git a/libsmtutil/SMTLib2Interface.cpp b/libsmtutil/SMTLib2Interface.cpp index 3e117913aa0c..ac5645bf121b 100644 --- a/libsmtutil/SMTLib2Interface.cpp +++ b/libsmtutil/SMTLib2Interface.cpp @@ -33,16 +33,15 @@ #include #include -using namespace std; using namespace solidity; using namespace solidity::util; using namespace solidity::frontend; using namespace solidity::smtutil; SMTLib2Interface::SMTLib2Interface( - map _queryResponses, + std::map _queryResponses, ReadCallback::Callback _smtCallback, - optional _queryTimeout + std::optional _queryTimeout ): SolverInterface(_queryTimeout), m_queryResponses(std::move(_queryResponses)), @@ -59,7 +58,7 @@ void SMTLib2Interface::reset() m_userSorts.clear(); write("(set-option :produce-models true)"); if (m_queryTimeout) - write("(set-option :timeout " + to_string(*m_queryTimeout) + ")"); + write("(set-option :timeout " + std::to_string(*m_queryTimeout) + ")"); write("(set-logic ALL)"); } @@ -74,7 +73,7 @@ void SMTLib2Interface::pop() m_accumulatedOutput.pop_back(); } -void SMTLib2Interface::declareVariable(string const& _name, SortPointer const& _sort) +void SMTLib2Interface::declareVariable(std::string const& _name, SortPointer const& _sort) { smtAssert(_sort, ""); if (_sort->kind == Kind::Function) @@ -86,16 +85,16 @@ void SMTLib2Interface::declareVariable(string const& _name, SortPointer const& _ } } -void SMTLib2Interface::declareFunction(string const& _name, SortPointer const& _sort) +void SMTLib2Interface::declareFunction(std::string const& _name, SortPointer const& _sort) { smtAssert(_sort, ""); smtAssert(_sort->kind == Kind::Function, ""); // TODO Use domain and codomain as key as well if (!m_variables.count(_name)) { - auto const& fSort = dynamic_pointer_cast(_sort); - string domain = toSmtLibSort(fSort->domain); - string codomain = toSmtLibSort(*fSort->codomain); + auto const& fSort = std::dynamic_pointer_cast(_sort); + std::string domain = toSmtLibSort(fSort->domain); + std::string codomain = toSmtLibSort(*fSort->codomain); m_variables.emplace(_name, _sort); write( "(declare-fun |" + @@ -114,9 +113,9 @@ void SMTLib2Interface::addAssertion(Expression const& _expr) write("(assert " + toSExpr(_expr) + ")"); } -pair> SMTLib2Interface::check(vector const& _expressionsToEvaluate) +std::pair> SMTLib2Interface::check(std::vector const& _expressionsToEvaluate) { - string response = querySolver( + std::string response = querySolver( boost::algorithm::join(m_accumulatedOutput, "\n") + checkSatAndGetValuesCommand(_expressionsToEvaluate) ); @@ -132,13 +131,13 @@ pair> SMTLib2Interface::check(vector con else result = CheckResult::ERROR; - vector values; + std::vector values; if (result == CheckResult::SATISFIABLE && !_expressionsToEvaluate.empty()) values = parseValues(find(response.cbegin(), response.cend(), '\n'), response.cend()); - return make_pair(result, values); + return std::make_pair(result, values); } -string SMTLib2Interface::toSExpr(Expression const& _expr) +std::string SMTLib2Interface::toSExpr(Expression const& _expr) { if (_expr.arguments.empty()) return _expr.name; @@ -148,16 +147,16 @@ string SMTLib2Interface::toSExpr(Expression const& _expr) { size_t size = std::stoul(_expr.arguments[1].name); auto arg = toSExpr(_expr.arguments.front()); - auto int2bv = "(_ int2bv " + to_string(size) + ")"; + auto int2bv = "(_ int2bv " + std::to_string(size) + ")"; // Some solvers treat all BVs as unsigned, so we need to manually apply 2's complement if needed. - sexpr += string("ite ") + + sexpr += std::string("ite ") + "(>= " + arg + " 0) " + "(" + int2bv + " " + arg + ") " + "(bvneg (" + int2bv + " (- " + arg + ")))"; } else if (_expr.name == "bv2int") { - auto intSort = dynamic_pointer_cast(_expr.sort); + auto intSort = std::dynamic_pointer_cast(_expr.sort); smtAssert(intSort, ""); auto arg = toSExpr(_expr.arguments.front()); @@ -166,13 +165,13 @@ string SMTLib2Interface::toSExpr(Expression const& _expr) if (!intSort->isSigned) return nat; - auto bvSort = dynamic_pointer_cast(_expr.arguments.front().sort); + auto bvSort = std::dynamic_pointer_cast(_expr.arguments.front().sort); smtAssert(bvSort, ""); - auto size = to_string(bvSort->size); - auto pos = to_string(bvSort->size - 1); + auto size = std::to_string(bvSort->size); + auto pos = std::to_string(bvSort->size - 1); // Some solvers treat all BVs as unsigned, so we need to manually apply 2's complement if needed. - sexpr += string("ite ") + + sexpr += std::string("ite ") + "(= ((_ extract " + pos + " " + pos + ")" + arg + ") #b0) " + nat + " " + "(- (bv2nat (bvneg " + arg + ")))"; @@ -182,7 +181,7 @@ string SMTLib2Interface::toSExpr(Expression const& _expr) smtAssert(_expr.arguments.size() == 2, ""); auto sortSort = std::dynamic_pointer_cast(_expr.arguments.at(0).sort); smtAssert(sortSort, ""); - auto arraySort = dynamic_pointer_cast(sortSort->inner); + auto arraySort = std::dynamic_pointer_cast(sortSort->inner); smtAssert(arraySort, ""); sexpr += "(as const " + toSmtLibSort(*arraySort) + ") "; sexpr += toSExpr(_expr.arguments.at(1)); @@ -190,14 +189,14 @@ string SMTLib2Interface::toSExpr(Expression const& _expr) else if (_expr.name == "tuple_get") { smtAssert(_expr.arguments.size() == 2, ""); - auto tupleSort = dynamic_pointer_cast(_expr.arguments.at(0).sort); + auto tupleSort = std::dynamic_pointer_cast(_expr.arguments.at(0).sort); size_t index = std::stoul(_expr.arguments.at(1).name); smtAssert(index < tupleSort->members.size(), ""); sexpr += "|" + tupleSort->members.at(index) + "| " + toSExpr(_expr.arguments.at(0)); } else if (_expr.name == "tuple_constructor") { - auto tupleSort = dynamic_pointer_cast(_expr.sort); + auto tupleSort = std::dynamic_pointer_cast(_expr.sort); smtAssert(tupleSort, ""); sexpr += "|" + tupleSort->name + "|"; for (auto const& arg: _expr.arguments) @@ -213,7 +212,7 @@ string SMTLib2Interface::toSExpr(Expression const& _expr) return sexpr; } -string SMTLib2Interface::toSmtLibSort(Sort const& _sort) +std::string SMTLib2Interface::toSmtLibSort(Sort const& _sort) { switch (_sort.kind) { @@ -222,7 +221,7 @@ string SMTLib2Interface::toSmtLibSort(Sort const& _sort) case Kind::Bool: return "Bool"; case Kind::BitVector: - return "(_ BitVec " + to_string(dynamic_cast(_sort).size) + ")"; + return "(_ BitVec " + std::to_string(dynamic_cast(_sort).size) + ")"; case Kind::Array: { auto const& arraySort = dynamic_cast(_sort); @@ -232,11 +231,11 @@ string SMTLib2Interface::toSmtLibSort(Sort const& _sort) case Kind::Tuple: { auto const& tupleSort = dynamic_cast(_sort); - string tupleName = "|" + tupleSort.name + "|"; + std::string tupleName = "|" + tupleSort.name + "|"; auto isName = [&](auto entry) { return entry.first == tupleName; }; if (ranges::find_if(m_userSorts, isName) == m_userSorts.end()) { - string decl("(declare-datatypes ((" + tupleName + " 0)) (((" + tupleName); + std::string decl("(declare-datatypes ((" + tupleName + " 0)) (((" + tupleName); smtAssert(tupleSort.members.size() == tupleSort.components.size(), ""); for (unsigned i = 0; i < tupleSort.members.size(); ++i) decl += " (|" + tupleSort.members.at(i) + "| " + toSmtLibSort(*tupleSort.components.at(i)) + ")"; @@ -252,24 +251,24 @@ string SMTLib2Interface::toSmtLibSort(Sort const& _sort) } } -string SMTLib2Interface::toSmtLibSort(vector const& _sorts) +std::string SMTLib2Interface::toSmtLibSort(std::vector const& _sorts) { - string ssort("("); + std::string ssort("("); for (auto const& sort: _sorts) ssort += toSmtLibSort(*sort) + " "; ssort += ")"; return ssort; } -void SMTLib2Interface::write(string _data) +void SMTLib2Interface::write(std::string _data) { smtAssert(!m_accumulatedOutput.empty(), ""); m_accumulatedOutput.back() += std::move(_data) + "\n"; } -string SMTLib2Interface::checkSatAndGetValuesCommand(vector const& _expressionsToEvaluate) +std::string SMTLib2Interface::checkSatAndGetValuesCommand(std::vector const& _expressionsToEvaluate) { - string command; + std::string command; if (_expressionsToEvaluate.empty()) command = "(check-sat)\n"; else @@ -279,22 +278,22 @@ string SMTLib2Interface::checkSatAndGetValuesCommand(vector const& _ { auto const& e = _expressionsToEvaluate.at(i); smtAssert(e.sort->kind == Kind::Int || e.sort->kind == Kind::Bool, "Invalid sort for expression to evaluate."); - command += "(declare-const |EVALEXPR_" + to_string(i) + "| " + (e.sort->kind == Kind::Int ? "Int" : "Bool") + ")\n"; - command += "(assert (= |EVALEXPR_" + to_string(i) + "| " + toSExpr(e) + "))\n"; + command += "(declare-const |EVALEXPR_" + std::to_string(i) + "| " + (e.sort->kind == Kind::Int ? "Int" : "Bool") + ")\n"; + command += "(assert (= |EVALEXPR_" + std::to_string(i) + "| " + toSExpr(e) + "))\n"; } command += "(check-sat)\n"; command += "(get-value ("; for (size_t i = 0; i < _expressionsToEvaluate.size(); i++) - command += "|EVALEXPR_" + to_string(i) + "| "; + command += "|EVALEXPR_" + std::to_string(i) + "| "; command += "))\n"; } return command; } -vector SMTLib2Interface::parseValues(string::const_iterator _start, string::const_iterator _end) +std::vector SMTLib2Interface::parseValues(std::string::const_iterator _start, std::string::const_iterator _end) { - vector values; + std::vector values; while (_start < _end) { auto valStart = find(_start, _end, ' '); @@ -308,7 +307,7 @@ vector SMTLib2Interface::parseValues(string::const_iterator _start, stri return values; } -string SMTLib2Interface::querySolver(string const& _input) +std::string SMTLib2Interface::querySolver(std::string const& _input) { h256 inputHash = keccak256(_input); if (m_queryResponses.count(inputHash)) @@ -322,3 +321,9 @@ string SMTLib2Interface::querySolver(string const& _input) m_unhandledQueries.push_back(_input); return "unknown\n"; } + +std::string SMTLib2Interface::dumpQuery(std::vector const& _expressionsToEvaluate) +{ + return boost::algorithm::join(m_accumulatedOutput, "\n") + + checkSatAndGetValuesCommand(_expressionsToEvaluate); +} diff --git a/libsmtutil/SMTLib2Interface.h b/libsmtutil/SMTLib2Interface.h index 9454d551f30f..9ef8e94a8c0a 100644 --- a/libsmtutil/SMTLib2Interface.h +++ b/libsmtutil/SMTLib2Interface.h @@ -68,6 +68,8 @@ class SMTLib2Interface: public SolverInterface std::vector> const& userSorts() const { return m_userSorts; } + std::string dumpQuery(std::vector const& _expressionsToEvaluate); + private: void declareFunction(std::string const& _name, SortPointer const& _sort); diff --git a/libsmtutil/SMTPortfolio.cpp b/libsmtutil/SMTPortfolio.cpp index 77a404a4752f..76c69d0180a3 100644 --- a/libsmtutil/SMTPortfolio.cpp +++ b/libsmtutil/SMTPortfolio.cpp @@ -26,29 +26,30 @@ #endif #include -using namespace std; using namespace solidity; using namespace solidity::util; using namespace solidity::frontend; using namespace solidity::smtutil; SMTPortfolio::SMTPortfolio( - map _smtlib2Responses, + std::map _smtlib2Responses, frontend::ReadCallback::Callback _smtCallback, [[maybe_unused]] SMTSolverChoice _enabledSolvers, - optional _queryTimeout + std::optional _queryTimeout, + bool _printQuery ): SolverInterface(_queryTimeout) { + solAssert(!_printQuery || _enabledSolvers == smtutil::SMTSolverChoice::SMTLIB2(), "Only SMTLib2 solver can be enabled to print queries"); if (_enabledSolvers.smtlib2) - m_solvers.emplace_back(make_unique(std::move(_smtlib2Responses), std::move(_smtCallback), m_queryTimeout)); + m_solvers.emplace_back(std::make_unique(std::move(_smtlib2Responses), std::move(_smtCallback), m_queryTimeout)); #ifdef HAVE_Z3 if (_enabledSolvers.z3 && Z3Interface::available()) - m_solvers.emplace_back(make_unique(m_queryTimeout)); + m_solvers.emplace_back(std::make_unique(m_queryTimeout)); #endif #ifdef HAVE_CVC4 if (_enabledSolvers.cvc4) - m_solvers.emplace_back(make_unique(m_queryTimeout)); + m_solvers.emplace_back(std::make_unique(m_queryTimeout)); #endif } @@ -70,7 +71,7 @@ void SMTPortfolio::pop() s->pop(); } -void SMTPortfolio::declareVariable(string const& _name, SortPointer const& _sort) +void SMTPortfolio::declareVariable(std::string const& _name, SortPointer const& _sort) { smtAssert(_sort, ""); for (auto const& s: m_solvers) @@ -113,14 +114,14 @@ void SMTPortfolio::addAssertion(Expression const& _expr) * * If all solvers return ERROR, the result is ERROR. */ -pair> SMTPortfolio::check(vector const& _expressionsToEvaluate) +std::pair> SMTPortfolio::check(std::vector const& _expressionsToEvaluate) { CheckResult lastResult = CheckResult::ERROR; - vector finalValues; + std::vector finalValues; for (auto const& s: m_solvers) { CheckResult result; - vector values; + std::vector values; tie(result, values) = s->check(_expressionsToEvaluate); if (solverAnswered(result)) { @@ -138,10 +139,10 @@ pair> SMTPortfolio::check(vector const& else if (result == CheckResult::UNKNOWN && lastResult == CheckResult::ERROR) lastResult = result; } - return make_pair(lastResult, finalValues); + return std::make_pair(lastResult, finalValues); } -vector SMTPortfolio::unhandledQueries() +std::vector SMTPortfolio::unhandledQueries() { // This code assumes that the constructor guarantees that // SmtLib2Interface is in position 0, if enabled. @@ -155,3 +156,12 @@ bool SMTPortfolio::solverAnswered(CheckResult result) { return result == CheckResult::SATISFIABLE || result == CheckResult::UNSATISFIABLE; } + +std::string SMTPortfolio::dumpQuery(std::vector const& _expressionsToEvaluate) +{ + // This code assumes that the constructor guarantees that + // SmtLib2Interface is in position 0, if enabled. + auto smtlib2 = dynamic_cast(m_solvers.front().get()); + solAssert(smtlib2, "Must use SMTLib2 solver to dump queries"); + return smtlib2->dumpQuery(_expressionsToEvaluate); +} diff --git a/libsmtutil/SMTPortfolio.h b/libsmtutil/SMTPortfolio.h index 3d82756c3560..cdb33368e80a 100644 --- a/libsmtutil/SMTPortfolio.h +++ b/libsmtutil/SMTPortfolio.h @@ -46,7 +46,8 @@ class SMTPortfolio: public SolverInterface std::map _smtlib2Responses = {}, frontend::ReadCallback::Callback _smtCallback = {}, SMTSolverChoice _enabledSolvers = SMTSolverChoice::All(), - std::optional _queryTimeout = {} + std::optional _queryTimeout = {}, + bool _printQuery = false ); void reset() override; @@ -62,6 +63,9 @@ class SMTPortfolio: public SolverInterface std::vector unhandledQueries() override; size_t solvers() override { return m_solvers.size(); } + + std::string dumpQuery(std::vector const& _expressionsToEvaluate); + private: static bool solverAnswered(CheckResult result); diff --git a/libsmtutil/Sorts.cpp b/libsmtutil/Sorts.cpp index 543c7ba0f840..b45bb303c892 100644 --- a/libsmtutil/Sorts.cpp +++ b/libsmtutil/Sorts.cpp @@ -19,22 +19,20 @@ #include -using namespace std; - namespace solidity::smtutil { -shared_ptr const SortProvider::boolSort{make_shared(Kind::Bool)}; -shared_ptr const SortProvider::uintSort{make_shared(false)}; -shared_ptr const SortProvider::sintSort{make_shared(true)}; +std::shared_ptr const SortProvider::boolSort{std::make_shared(Kind::Bool)}; +std::shared_ptr const SortProvider::uintSort{std::make_shared(false)}; +std::shared_ptr const SortProvider::sintSort{std::make_shared(true)}; -shared_ptr SortProvider::intSort(bool _signed) +std::shared_ptr SortProvider::intSort(bool _signed) { if (_signed) return sintSort; return uintSort; } -shared_ptr const SortProvider::bitVectorSort{make_shared(256)}; +std::shared_ptr const SortProvider::bitVectorSort{std::make_shared(256)}; } diff --git a/libsmtutil/Z3CHCInterface.cpp b/libsmtutil/Z3CHCInterface.cpp index bfbc9841b6de..a25890e8d10a 100644 --- a/libsmtutil/Z3CHCInterface.cpp +++ b/libsmtutil/Z3CHCInterface.cpp @@ -23,21 +23,20 @@ #include #include -using namespace std; using namespace solidity; using namespace solidity::smtutil; -Z3CHCInterface::Z3CHCInterface(optional _queryTimeout): +Z3CHCInterface::Z3CHCInterface(std::optional _queryTimeout): CHCSolverInterface(_queryTimeout), - m_z3Interface(make_unique(m_queryTimeout)), + m_z3Interface(std::make_unique(m_queryTimeout)), m_context(m_z3Interface->context()), m_solver(*m_context) { Z3_get_version( - &get<0>(m_version), - &get<1>(m_version), - &get<2>(m_version), - &get<3>(m_version) + &std::get<0>(m_version), + &std::get<1>(m_version), + &std::get<2>(m_version), + &std::get<3>(m_version) ); // These need to be set globally. @@ -51,7 +50,7 @@ Z3CHCInterface::Z3CHCInterface(optional _queryTimeout): setSpacerOptions(); } -void Z3CHCInterface::declareVariable(string const& _name, SortPointer const& _sort) +void Z3CHCInterface::declareVariable(std::string const& _name, SortPointer const& _sort) { smtAssert(_sort, ""); m_z3Interface->declareVariable(_name, _sort); @@ -62,7 +61,7 @@ void Z3CHCInterface::registerRelation(Expression const& _expr) m_solver.register_relation(m_z3Interface->functions().at(_expr.name)); } -void Z3CHCInterface::addRule(Expression const& _expr, string const& _name) +void Z3CHCInterface::addRule(Expression const& _expr, std::string const& _name) { z3::expr rule = m_z3Interface->toZ3Expr(_expr); if (m_z3Interface->constants().empty()) @@ -77,7 +76,7 @@ void Z3CHCInterface::addRule(Expression const& _expr, string const& _name) } } -tuple Z3CHCInterface::query(Expression const& _expr) +std::tuple Z3CHCInterface::query(Expression const& _expr) { CheckResult result; try @@ -90,7 +89,7 @@ tuple Z3CHCInterface::que result = CheckResult::SATISFIABLE; // z3 version 4.8.8 modified Spacer to also return // proofs containing nonlinear clauses. - if (m_version >= tuple(4, 8, 8, 0)) + if (m_version >= std::tuple(4, 8, 8, 0)) { auto proof = m_solver.get_answer(); return {result, Expression(true), cexGraph(proof)}; @@ -113,7 +112,7 @@ tuple Z3CHCInterface::que } catch (z3::exception const& _err) { - set msgs{ + std::set msgs{ /// Resource limit (rlimit) exhausted. "max. resource limit exceeded", /// User given timeout exhausted. @@ -178,13 +177,13 @@ CHCSolverInterface::CexGraph Z3CHCInterface::cexGraph(z3::expr const& _proof) CexGraph graph; - stack proofStack; + std::stack proofStack; proofStack.push(_proof.arg(0)); auto const& root = proofStack.top(); graph.nodes.emplace(root.id(), m_z3Interface->fromZ3Expr(fact(root))); - set visited; + std::set visited; visited.insert(root.id()); while (!proofStack.empty()) @@ -227,16 +226,16 @@ z3::expr Z3CHCInterface::fact(z3::expr const& _node) return _node.arg(_node.num_args() - 1); } -string Z3CHCInterface::name(z3::expr const& _predicate) +std::string Z3CHCInterface::name(z3::expr const& _predicate) { smtAssert(_predicate.is_app(), ""); return _predicate.decl().name().str(); } -vector Z3CHCInterface::arguments(z3::expr const& _predicate) +std::vector Z3CHCInterface::arguments(z3::expr const& _predicate) { smtAssert(_predicate.is_app(), ""); - vector args; + std::vector args; for (unsigned i = 0; i < _predicate.num_args(); ++i) args.emplace_back(_predicate.arg(i).to_string()); return args; diff --git a/libsmtutil/Z3Interface.cpp b/libsmtutil/Z3Interface.cpp index 21b31d19f8de..a16e75668e40 100644 --- a/libsmtutil/Z3Interface.cpp +++ b/libsmtutil/Z3Interface.cpp @@ -26,7 +26,6 @@ #include #endif -using namespace std; using namespace solidity::smtutil; using namespace solidity::util; @@ -69,7 +68,7 @@ void Z3Interface::pop() m_solver.pop(); } -void Z3Interface::declareVariable(string const& _name, SortPointer const& _sort) +void Z3Interface::declareVariable(std::string const& _name, SortPointer const& _sort) { smtAssert(_sort, ""); if (_sort->kind == Kind::Function) @@ -80,7 +79,7 @@ void Z3Interface::declareVariable(string const& _name, SortPointer const& _sort) m_constants.emplace(_name, m_context.constant(_name.c_str(), z3Sort(*_sort))); } -void Z3Interface::declareFunction(string const& _name, Sort const& _sort) +void Z3Interface::declareFunction(std::string const& _name, Sort const& _sort) { smtAssert(_sort.kind == Kind::Function, ""); FunctionSort fSort = dynamic_cast(_sort); @@ -95,10 +94,10 @@ void Z3Interface::addAssertion(Expression const& _expr) m_solver.add(toZ3Expr(_expr)); } -pair> Z3Interface::check(vector const& _expressionsToEvaluate) +std::pair> Z3Interface::check(std::vector const& _expressionsToEvaluate) { CheckResult result; - vector values; + std::vector values; try { switch (m_solver.check()) @@ -123,7 +122,7 @@ pair> Z3Interface::check(vector const& _ } catch (z3::exception const& _err) { - set msgs{ + std::set msgs{ /// Resource limit (rlimit) exhausted. "max. resource limit exceeded", /// User given timeout exhausted. @@ -137,7 +136,7 @@ pair> Z3Interface::check(vector const& _ values.clear(); } - return make_pair(result, values); + return std::make_pair(result, values); } z3::expr Z3Interface::toZ3Expr(Expression const& _expr) @@ -150,7 +149,7 @@ z3::expr Z3Interface::toZ3Expr(Expression const& _expr) try { - string const& n = _expr.name; + std::string const& n = _expr.name; if (m_functions.count(n)) return m_functions.at(n)(arguments); else if (m_constants.count(n)) @@ -166,7 +165,7 @@ z3::expr Z3Interface::toZ3Expr(Expression const& _expr) return m_context.bool_val(false); else if (_expr.sort->kind == Kind::Sort) { - auto sortSort = dynamic_pointer_cast(_expr.sort); + auto sortSort = std::dynamic_pointer_cast(_expr.sort); smtAssert(sortSort, ""); return m_context.constant(n.c_str(), z3Sort(*sortSort->inner)); } @@ -233,7 +232,7 @@ z3::expr Z3Interface::toZ3Expr(Expression const& _expr) } else if (n == "bv2int") { - auto intSort = dynamic_pointer_cast(_expr.sort); + auto intSort = std::dynamic_pointer_cast(_expr.sort); smtAssert(intSort, ""); return z3::bv2int(arguments[0], intSort->isSigned); } @@ -243,9 +242,9 @@ z3::expr Z3Interface::toZ3Expr(Expression const& _expr) return z3::store(arguments[0], arguments[1], arguments[2]); else if (n == "const_array") { - shared_ptr sortSort = std::dynamic_pointer_cast(_expr.arguments[0].sort); + std::shared_ptr sortSort = std::dynamic_pointer_cast(_expr.arguments[0].sort); smtAssert(sortSort, ""); - auto arraySort = dynamic_pointer_cast(sortSort->inner); + auto arraySort = std::dynamic_pointer_cast(sortSort->inner); smtAssert(arraySort && arraySort->domain, ""); return z3::const_array(z3Sort(*arraySort->domain), arguments[1]); } @@ -285,7 +284,7 @@ Expression Z3Interface::fromZ3Expr(z3::expr const& _expr) if (_expr.is_quantifier()) { - string quantifierName; + std::string quantifierName; if (_expr.is_exists()) quantifierName = "exists"; else if (_expr.is_forall()) @@ -297,7 +296,7 @@ Expression Z3Interface::fromZ3Expr(z3::expr const& _expr) return Expression(quantifierName, {fromZ3Expr(_expr.body())}, sort); } smtAssert(_expr.is_app(), ""); - vector arguments; + std::vector arguments; for (unsigned i = 0; i < _expr.num_args(); ++i) arguments.push_back(fromZ3Expr(_expr.arg(i))); @@ -370,12 +369,12 @@ Expression Z3Interface::fromZ3Expr(z3::expr const& _expr) return Expression::store(arguments[0], arguments[1], arguments[2]); else if (kind == Z3_OP_CONST_ARRAY) { - auto sortSort = make_shared(fromZ3Sort(_expr.get_sort())); + auto sortSort = std::make_shared(fromZ3Sort(_expr.get_sort())); return Expression::const_array(Expression(sortSort), arguments[0]); } else if (kind == Z3_OP_DT_CONSTRUCTOR) { - auto sortSort = make_shared(fromZ3Sort(_expr.get_sort())); + auto sortSort = std::make_shared(fromZ3Sort(_expr.get_sort())); return Expression::tuple_constructor(Expression(sortSort), arguments); } else if (kind == Z3_OP_DT_ACCESSOR) @@ -412,12 +411,12 @@ z3::sort Z3Interface::z3Sort(Sort const& _sort) case Kind::Tuple: { auto const& tupleSort = dynamic_cast(_sort); - vector cMembers; + std::vector cMembers; for (auto const& member: tupleSort.members) cMembers.emplace_back(member.c_str()); /// Using this instead of the function below because with that one /// we can't use `&sorts[0]` here. - vector sorts; + std::vector sorts; for (auto const& sort: tupleSort.components) sorts.push_back(z3Sort(*sort)); z3::func_decl_vector projs(m_context); @@ -439,7 +438,7 @@ z3::sort Z3Interface::z3Sort(Sort const& _sort) return m_context.int_sort(); } -z3::sort_vector Z3Interface::z3Sort(vector const& _sorts) +z3::sort_vector Z3Interface::z3Sort(std::vector const& _sorts) { z3::sort_vector z3Sorts(m_context); for (auto const& _sort: _sorts) @@ -454,27 +453,27 @@ SortPointer Z3Interface::fromZ3Sort(z3::sort const& _sort) if (_sort.is_int()) return SortProvider::sintSort; if (_sort.is_bv()) - return make_shared(_sort.bv_size()); + return std::make_shared(_sort.bv_size()); if (_sort.is_array()) - return make_shared(fromZ3Sort(_sort.array_domain()), fromZ3Sort(_sort.array_range())); + return std::make_shared(fromZ3Sort(_sort.array_domain()), fromZ3Sort(_sort.array_range())); if (_sort.is_datatype()) { auto name = _sort.name().str(); auto constructor = z3::func_decl(m_context, Z3_get_tuple_sort_mk_decl(m_context, _sort)); - vector memberNames; - vector memberSorts; + std::vector memberNames; + std::vector memberSorts; for (unsigned i = 0; i < constructor.arity(); ++i) { auto accessor = z3::func_decl(m_context, Z3_get_tuple_sort_field_decl(m_context, _sort, i)); memberNames.push_back(accessor.name().str()); memberSorts.push_back(fromZ3Sort(accessor.range())); } - return make_shared(name, memberNames, memberSorts); + return std::make_shared(name, memberNames, memberSorts); } smtAssert(false, ""); } -vector Z3Interface::fromZ3Sort(z3::sort_vector const& _sorts) +std::vector Z3Interface::fromZ3Sort(z3::sort_vector const& _sorts) { return applyMap(_sorts, [this](auto const& sort) { return fromZ3Sort(sort); }); } diff --git a/libsmtutil/Z3Loader.cpp b/libsmtutil/Z3Loader.cpp index 86b17aa0300b..0211f600d9f1 100644 --- a/libsmtutil/Z3Loader.cpp +++ b/libsmtutil/Z3Loader.cpp @@ -27,7 +27,6 @@ #endif #include -using namespace std; using namespace solidity; using namespace solidity::smtutil; @@ -41,7 +40,7 @@ void* Z3Loader::loadSymbol(char const* _name) const { smtAssert(m_handle, "Attempted to use dynamically loaded Z3, even though it is not available."); void* sym = dlsym(m_handle, _name); - smtAssert(sym, string("Symbol \"") + _name + "\" not found in libz3.so"); + smtAssert(sym, std::string("Symbol \"") + _name + "\" not found in libz3.so"); return sym; } @@ -59,7 +58,7 @@ bool Z3Loader::available() const Z3Loader::Z3Loader() { - string libname{"libz3.so." + to_string(Z3_MAJOR_VERSION) + "." + to_string(Z3_MINOR_VERSION)}; + std::string libname{"libz3.so." + std::to_string(Z3_MAJOR_VERSION) + "." + std::to_string(Z3_MINOR_VERSION)}; m_handle = dlmopen(LM_ID_NEWLM, libname.c_str(), RTLD_NOW); } diff --git a/libsolc/libsolc.cpp b/libsolc/libsolc.cpp index 4ceeeac6fad7..105949253260 100644 --- a/libsolc/libsolc.cpp +++ b/libsolc/libsolc.cpp @@ -32,7 +32,6 @@ #include "license.h" -using namespace std; using namespace solidity; using namespace solidity::util; @@ -42,21 +41,21 @@ using solidity::frontend::StandardCompiler; namespace { -// The strings in this list must not be resized after they have been added here (via solidity_alloc()), because +// The std::strings in this list must not be resized after they have been added here (via solidity_alloc()), because // this may potentially change the pointer that was passed to the caller from solidity_alloc(). -static list solidityAllocations; +static std::list solidityAllocations; /// Find the equivalent to @p _data in the list of allocations of solidity_alloc(), /// removes it from the list and returns its value. /// /// If any invalid argument is being passed, it is considered a programming error /// on the caller-side and hence, will call abort() then. -string takeOverAllocation(char const* _data) +std::string takeOverAllocation(char const* _data) { for (auto iter = begin(solidityAllocations); iter != end(solidityAllocations); ++iter) if (iter->data() == _data) { - string chunk = std::move(*iter); + std::string chunk = std::move(*iter); solidityAllocations.erase(iter); return chunk; } @@ -64,11 +63,11 @@ string takeOverAllocation(char const* _data) abort(); } -/// Resizes a std::string to the proper length based on the occurrence of a zero terminator. -void truncateCString(string& _data) +/// Resizes a std::std::string to the proper length based on the occurrence of a zero terminator. +void truncateCString(std::string& _data) { size_t pos = _data.find('\0'); - if (pos != string::npos) + if (pos != std::string::npos) _data.resize(pos); } @@ -77,7 +76,7 @@ ReadCallback::Callback wrapReadCallback(CStyleReadFileCallback _readCallback, vo ReadCallback::Callback readCallback; if (_readCallback) { - readCallback = [=](string const& _kind, string const& _data) + readCallback = [=](std::string const& _kind, std::string const& _data) { char* contents_c = nullptr; char* error_c = nullptr; @@ -106,7 +105,7 @@ ReadCallback::Callback wrapReadCallback(CStyleReadFileCallback _readCallback, vo return readCallback; } -string compile(string _input, CStyleReadFileCallback _readCallback, void* _readContext) +std::string compile(std::string _input, CStyleReadFileCallback _readCallback, void* _readContext) { StandardCompiler compiler(wrapReadCallback(_readCallback, _readContext)); return compiler.compile(std::move(_input)); @@ -118,7 +117,7 @@ extern "C" { extern char const* solidity_license() noexcept { - static string fullLicenseText = otherLicenses + licenseText; + static std::string fullLicenseText = otherLicenses + licenseText; return fullLicenseText.c_str(); } diff --git a/libsolidity/analysis/ImmutableValidator.cpp b/libsolidity/analysis/ImmutableValidator.cpp index 8e89c49ab98a..0f5a2ee2e0e6 100644 --- a/libsolidity/analysis/ImmutableValidator.cpp +++ b/libsolidity/analysis/ImmutableValidator.cpp @@ -18,8 +18,6 @@ #include -#include - #include using namespace solidity::frontend; @@ -27,275 +25,44 @@ using namespace solidity::langutil; void ImmutableValidator::analyze() { - m_inCreationContext = true; - auto linearizedContracts = m_mostDerivedContract.annotation().linearizedBaseContracts | ranges::views::reverse; - for (ContractDefinition const* contract: linearizedContracts) - for (VariableDeclaration const* stateVar: contract->stateVariables()) - if (stateVar->value()) - stateVar->value()->accept(*this); - - for (ContractDefinition const* contract: linearizedContracts) - for (std::shared_ptr const& inheritSpec: contract->baseContracts()) - if (auto args = inheritSpec->arguments()) - ASTNode::listAccept(*args, *this); - - for (ContractDefinition const* contract: linearizedContracts) - { - for (VariableDeclaration const* stateVar: contract->stateVariables()) - if (stateVar->value()) - m_initializedStateVariables.emplace(stateVar); - - if (contract->constructor()) - visitCallableIfNew(*contract->constructor()); - } - - m_inCreationContext = false; - for (ContractDefinition const* contract: linearizedContracts) { - for (auto funcDef: contract->definedFunctions()) - visitCallableIfNew(*funcDef); + for (FunctionDefinition const* function: contract->definedFunctions()) + function->accept(*this); - for (auto modDef: contract->functionModifiers()) - visitCallableIfNew(*modDef); + for (ModifierDefinition const* modifier: contract->functionModifiers()) + modifier->accept(*this); } - - checkAllVariablesInitialized(m_mostDerivedContract.location()); } -bool ImmutableValidator::visit(Assignment const& _assignment) -{ - // Need to visit values first (rhs) as they might access other immutables. - _assignment.rightHandSide().accept(*this); - _assignment.leftHandSide().accept(*this); - return false; -} - - bool ImmutableValidator::visit(FunctionDefinition const& _functionDefinition) { - return analyseCallable(_functionDefinition); -} - -bool ImmutableValidator::visit(ModifierDefinition const& _modifierDefinition) -{ - return analyseCallable(_modifierDefinition); -} - -bool ImmutableValidator::visit(MemberAccess const& _memberAccess) -{ - _memberAccess.expression().accept(*this); - - if (auto contractType = dynamic_cast(_memberAccess.expression().annotation().type)) - if (!contractType->isSuper()) - // external access, no analysis needed. - return false; - - if (auto varDecl = dynamic_cast(_memberAccess.annotation().referencedDeclaration)) - analyseVariableReference(*varDecl, _memberAccess); - else if (auto funcType = dynamic_cast(_memberAccess.annotation().type)) - if (funcType->kind() == FunctionType::Kind::Internal && funcType->hasDeclaration()) - visitCallableIfNew(funcType->declaration()); - - return false; -} - -bool ImmutableValidator::visit(IfStatement const& _ifStatement) -{ - bool prevInBranch = m_inBranch; - - _ifStatement.condition().accept(*this); - - m_inBranch = true; - _ifStatement.trueStatement().accept(*this); - - if (auto falseStatement = _ifStatement.falseStatement()) - falseStatement->accept(*this); - - m_inBranch = prevInBranch; - - return false; -} - -bool ImmutableValidator::visit(WhileStatement const& _whileStatement) -{ - bool prevInLoop = m_inLoop; - m_inLoop = true; - - _whileStatement.condition().accept(*this); - _whileStatement.body().accept(*this); - - m_inLoop = prevInLoop; - - return false; -} - -bool ImmutableValidator::visit(TryStatement const& _tryStatement) -{ - ScopedSaveAndRestore constructorGuard{m_inTryStatement, true}; - - _tryStatement.externalCall().accept(*this); - - for (auto&& clause: _tryStatement.clauses()) - if (clause) - clause->accept(*this); - - return false; + return !_functionDefinition.isConstructor(); } -void ImmutableValidator::endVisit(IdentifierPath const& _identifierPath) +void ImmutableValidator::endVisit(MemberAccess const& _memberAccess) { - if (auto const callableDef = dynamic_cast(_identifierPath.annotation().referencedDeclaration)) - visitCallableIfNew( - *_identifierPath.annotation().requiredLookup == VirtualLookup::Virtual ? - callableDef->resolveVirtual(m_mostDerivedContract) : - *callableDef - ); - - solAssert(!dynamic_cast(_identifierPath.annotation().referencedDeclaration), ""); + analyseVariableReference(_memberAccess.annotation().referencedDeclaration, _memberAccess); } void ImmutableValidator::endVisit(Identifier const& _identifier) { - if (auto const callableDef = dynamic_cast(_identifier.annotation().referencedDeclaration)) - visitCallableIfNew(*_identifier.annotation().requiredLookup == VirtualLookup::Virtual ? callableDef->resolveVirtual(m_mostDerivedContract) : *callableDef); - if (auto const varDecl = dynamic_cast(_identifier.annotation().referencedDeclaration)) - analyseVariableReference(*varDecl, _identifier); -} - -void ImmutableValidator::endVisit(Return const& _return) -{ - if (m_currentConstructor != nullptr) - checkAllVariablesInitialized(_return.location()); -} - -bool ImmutableValidator::analyseCallable(CallableDeclaration const& _callableDeclaration) -{ - ScopedSaveAndRestore constructorGuard{m_currentConstructor, {}}; - ScopedSaveAndRestore constructorContractGuard{m_currentConstructorContract, {}}; - - if (FunctionDefinition const* funcDef = dynamic_cast(&_callableDeclaration)) - { - ASTNode::listAccept(funcDef->modifiers(), *this); - - if (funcDef->isConstructor()) - { - m_currentConstructorContract = funcDef->annotation().contract; - m_currentConstructor = funcDef; - } - - if (funcDef->isImplemented()) - funcDef->body().accept(*this); - } - else if (ModifierDefinition const* modDef = dynamic_cast(&_callableDeclaration)) - if (modDef->isImplemented()) - modDef->body().accept(*this); - - return false; + analyseVariableReference(_identifier.annotation().referencedDeclaration, _identifier); } -void ImmutableValidator::analyseVariableReference(VariableDeclaration const& _variableReference, Expression const& _expression) +void ImmutableValidator::analyseVariableReference(Declaration const* _reference, Expression const& _expression) { - if (!_variableReference.isStateVariable() || !_variableReference.immutable()) + auto const* variable = dynamic_cast(_reference); + if (!variable || !variable->isStateVariable() || !variable->immutable()) return; // If this is not an ordinary assignment, we write and read at the same time. - bool write = _expression.annotation().willBeWrittenTo; - bool read = !_expression.annotation().willBeWrittenTo || !_expression.annotation().lValueOfOrdinaryAssignment; - if (write) - { - if (!m_currentConstructor) - m_errorReporter.typeError( - 1581_error, - _expression.location(), - "Cannot write to immutable here: Immutable variables can only be initialized inline or assigned directly in the constructor." - ); - else if (m_currentConstructor->annotation().contract->id() != _variableReference.annotation().contract->id()) - m_errorReporter.typeError( - 7484_error, - _expression.location(), - "Cannot write to immutable here: Immutable variables must be initialized in the constructor of the contract they are defined in." - ); - else if (m_inLoop) - m_errorReporter.typeError( - 6672_error, - _expression.location(), - "Cannot write to immutable here: Immutable variables cannot be initialized inside a loop." - ); - else if (m_inBranch) - m_errorReporter.typeError( - 4599_error, - _expression.location(), - "Cannot write to immutable here: Immutable variables cannot be initialized inside an if statement." - ); - else if (m_inTryStatement) - m_errorReporter.typeError( - 4130_error, - _expression.location(), - "Cannot write to immutable here: Immutable variables cannot be initialized inside a try/catch statement." - ); - else if (m_initializedStateVariables.count(&_variableReference)) - { - if (!read) - m_errorReporter.typeError( - 1574_error, - _expression.location(), - "Immutable state variable already initialized." - ); - else - m_errorReporter.typeError( - 2718_error, - _expression.location(), - "Immutable variables cannot be modified after initialization." - ); - } - else if (read) - m_errorReporter.typeError( - 3969_error, - _expression.location(), - "Immutable variables must be initialized using an assignment." - ); - m_initializedStateVariables.emplace(&_variableReference); - } - if ( - read && - m_inCreationContext && - !m_initializedStateVariables.count(&_variableReference) - ) + if (_expression.annotation().willBeWrittenTo) m_errorReporter.typeError( - 7733_error, + 1581_error, _expression.location(), - "Immutable variables cannot be read before they are initialized." + "Cannot write to immutable here: Immutable variables can only be initialized inline or assigned directly in the constructor." ); } - -void ImmutableValidator::checkAllVariablesInitialized(solidity::langutil::SourceLocation const& _location) -{ - for (ContractDefinition const* contract: m_mostDerivedContract.annotation().linearizedBaseContracts | ranges::views::reverse) - { - for (VariableDeclaration const* varDecl: contract->stateVariables()) - if (varDecl->immutable()) - if (!util::contains(m_initializedStateVariables, varDecl)) - m_errorReporter.typeError( - 2658_error, - _location, - solidity::langutil::SecondarySourceLocation().append("Not initialized: ", varDecl->location()), - "Construction control flow ends without initializing all immutable state variables." - ); - - // Don't check further than the current c'tors contract - if (contract == m_currentConstructorContract) - break; - } -} - -void ImmutableValidator::visitCallableIfNew(Declaration const& _declaration) -{ - CallableDeclaration const* _callable = dynamic_cast(&_declaration); - solAssert(_callable != nullptr, ""); - - if (m_visitedCallables.emplace(_callable).second) - _declaration.accept(*this); -} diff --git a/libsolidity/analysis/ImmutableValidator.h b/libsolidity/analysis/ImmutableValidator.h index 43a4b5dbf404..78d85a61ce0f 100644 --- a/libsolidity/analysis/ImmutableValidator.h +++ b/libsolidity/analysis/ImmutableValidator.h @@ -21,25 +21,15 @@ #include #include -#include - namespace solidity::frontend { /** * Validates access and initialization of immutable variables: - * must be directly initialized in their respective c'tor or inline - * cannot be read before being initialized - * cannot be read when initializing state variables inline - * must be initialized outside loops (only one initialization) - * must be initialized outside ifs (must be initialized unconditionally) - * must be initialized exactly once (no multiple statements) - * must be initialized exactly once (no early return to skip initialization) + * must be directly initialized in a c'tor or inline */ class ImmutableValidator: private ASTConstVisitor { - using CallableDeclarationSet = std::set; - public: ImmutableValidator(langutil::ErrorReporter& _errorReporter, ContractDefinition const& _contractDefinition): m_mostDerivedContract(_contractDefinition), @@ -49,37 +39,15 @@ class ImmutableValidator: private ASTConstVisitor void analyze(); private: - bool visit(Assignment const& _assignment); bool visit(FunctionDefinition const& _functionDefinition); - bool visit(ModifierDefinition const& _modifierDefinition); - bool visit(MemberAccess const& _memberAccess); - bool visit(IfStatement const& _ifStatement); - bool visit(WhileStatement const& _whileStatement); - bool visit(TryStatement const& _tryStatement); - void endVisit(IdentifierPath const& _identifierPath); + void endVisit(MemberAccess const& _memberAccess); void endVisit(Identifier const& _identifier); - void endVisit(Return const& _return); - - bool analyseCallable(CallableDeclaration const& _callableDeclaration); - void analyseVariableReference(VariableDeclaration const& _variableReference, Expression const& _expression); - void checkAllVariablesInitialized(langutil::SourceLocation const& _location); - - void visitCallableIfNew(Declaration const& _declaration); + void analyseVariableReference(Declaration const* _variableReference, Expression const& _expression); ContractDefinition const& m_mostDerivedContract; - CallableDeclarationSet m_visitedCallables; - - std::set m_initializedStateVariables; langutil::ErrorReporter& m_errorReporter; - - FunctionDefinition const* m_currentConstructor = nullptr; - ContractDefinition const* m_currentConstructorContract = nullptr; - bool m_inLoop = false; - bool m_inBranch = false; - bool m_inCreationContext = true; - bool m_inTryStatement = false; }; } diff --git a/libsolidity/ast/AST.h b/libsolidity/ast/AST.h index 3f9c496a82b5..f807e6688067 100644 --- a/libsolidity/ast/AST.h +++ b/libsolidity/ast/AST.h @@ -167,9 +167,14 @@ class SourceUnit: public ASTNode, public ScopeOpener int64_t _id, SourceLocation const& _location, std::optional _licenseString, - std::vector> _nodes + std::vector> _nodes, + bool _experimentalSolidity ): - ASTNode(_id, _location), m_licenseString(std::move(_licenseString)), m_nodes(std::move(_nodes)) {} + ASTNode(_id, _location), + m_licenseString(std::move(_licenseString)), + m_nodes(std::move(_nodes)), + m_experimentalSolidity(_experimentalSolidity) + {} void accept(ASTVisitor& _visitor) override; void accept(ASTConstVisitor& _visitor) const override; @@ -180,10 +185,12 @@ class SourceUnit: public ASTNode, public ScopeOpener /// @returns a set of referenced SourceUnits. Recursively if @a _recurse is true. std::set referencedSourceUnits(bool _recurse = false, std::set _skipList = std::set()) const; + bool experimentalSolidity() const { return m_experimentalSolidity; } private: std::optional m_licenseString; std::vector> m_nodes; + bool m_experimentalSolidity = false; }; /** @@ -1254,7 +1261,7 @@ class EventDefinition: public CallableDeclaration, public StructurallyDocumented FunctionTypePointer functionType(bool /*_internal*/) const override; bool isVisibleInDerivedContracts() const override { return true; } - bool isVisibleViaContractTypeAccess() const override { return false; /* TODO */ } + bool isVisibleViaContractTypeAccess() const override { return true; } EventDefinitionAnnotation& annotation() const override; diff --git a/libsolidity/ast/ASTJsonExporter.cpp b/libsolidity/ast/ASTJsonExporter.cpp index e13cead11a18..da7f769362fe 100644 --- a/libsolidity/ast/ASTJsonExporter.cpp +++ b/libsolidity/ast/ASTJsonExporter.cpp @@ -214,9 +214,12 @@ bool ASTJsonExporter::visit(SourceUnit const& _node) { std::vector> attributes = { make_pair("license", _node.licenseString() ? Json::Value(*_node.licenseString()) : Json::nullValue), - make_pair("nodes", toJson(_node.nodes())) + make_pair("nodes", toJson(_node.nodes())), }; + if (_node.experimentalSolidity()) + attributes.emplace_back("experimentalSolidity", Json::Value(_node.experimentalSolidity())); + if (_node.annotation().exportedSymbols.set()) { Json::Value exportedSymbols = Json::objectValue; diff --git a/libsolidity/ast/ASTJsonImporter.cpp b/libsolidity/ast/ASTJsonImporter.cpp index 251219ea0a23..dd7098aabf9a 100644 --- a/libsolidity/ast/ASTJsonImporter.cpp +++ b/libsolidity/ast/ASTJsonImporter.cpp @@ -271,11 +271,15 @@ ASTPointer ASTJsonImporter::createSourceUnit(Json::Value const& _nod if (_node.isMember("license") && !_node["license"].isNull()) license = _node["license"].asString(); + bool experimentalSolidity = false; + if (_node.isMember("experimentalSolidity") && !_node["experimentalSolidity"].isNull()) + experimentalSolidity = _node["experimentalSolidity"].asBool(); + vector> nodes; for (auto& child: member(_node, "nodes")) nodes.emplace_back(convertJsonToASTNode(child)); - ASTPointer tmp = createASTNode(_node, license, nodes); + ASTPointer tmp = createASTNode(_node, license, nodes, experimentalSolidity); tmp->annotation().path = _srcName; return tmp; } diff --git a/libsolidity/ast/ExperimentalFeatures.h b/libsolidity/ast/ExperimentalFeatures.h index 772bc4e083a8..ae2cb14c54c4 100644 --- a/libsolidity/ast/ExperimentalFeatures.h +++ b/libsolidity/ast/ExperimentalFeatures.h @@ -32,7 +32,8 @@ enum class ExperimentalFeature ABIEncoderV2, // new ABI encoder that makes use of Yul SMTChecker, Test, - TestOnlyAnalysis + TestOnlyAnalysis, + Solidity }; static std::set const ExperimentalFeatureWithoutWarning = @@ -48,6 +49,7 @@ static std::map const ExperimentalFeatureNames { "SMTChecker", ExperimentalFeature::SMTChecker }, { "__test", ExperimentalFeature::Test }, { "__testOnlyAnalysis", ExperimentalFeature::TestOnlyAnalysis }, + { "solidity", ExperimentalFeature::Solidity } }; } diff --git a/libsolidity/ast/Types.cpp b/libsolidity/ast/Types.cpp index 4c127878d674..1c3931994194 100644 --- a/libsolidity/ast/Types.cpp +++ b/libsolidity/ast/Types.cpp @@ -3272,6 +3272,12 @@ BoolResult FunctionType::isImplicitlyConvertibleTo(Type const& _convertTo) const if (convertTo.kind() != kind()) return BoolResult::err("Special functions cannot be converted to function types."); + if ( + kind() == FunctionType::Kind::Declaration && + m_declaration != convertTo.m_declaration + ) + return BoolResult::err("Function declaration types referring to different functions cannot be converted to each other."); + if (!equalExcludingStateMutability(convertTo)) return false; @@ -3562,12 +3568,10 @@ MemberList::MemberMap FunctionType::nativeMembers(ASTNode const* _scope) const } case Kind::DelegateCall: { - auto const* functionDefinition = dynamic_cast(m_declaration); - solAssert(functionDefinition, ""); - solAssert(functionDefinition->visibility() != Visibility::Private, ""); - if (functionDefinition->visibility() != Visibility::Internal) + if (auto const* functionDefinition = dynamic_cast(m_declaration)) { - auto const* contract = dynamic_cast(m_declaration->scope()); + solAssert(functionDefinition->visibility() > Visibility::Internal, ""); + auto const *contract = dynamic_cast(m_declaration->scope()); solAssert(contract, ""); solAssert(contract->isLibrary(), ""); return {{"selector", TypeProvider::fixedBytes(4)}}; @@ -3611,7 +3615,11 @@ Type const* FunctionType::mobileType() const if (valueSet() || gasSet() || saltSet() || hasBoundFirstArgument()) return nullptr; - // return function without parameter names + // Special function types do not get a mobile type, such that they cannot be used in complex expressions. + if (m_kind != FunctionType::Kind::Internal && m_kind != FunctionType::Kind::External && m_kind != FunctionType::Kind::DelegateCall) + return nullptr; + + // return function without parameter names and without declaration return TypeProvider::function( m_parameterTypes, m_returnParameterTypes, @@ -3619,7 +3627,7 @@ Type const* FunctionType::mobileType() const strings(m_returnParameterNames.size()), m_kind, m_stateMutability, - m_declaration, + nullptr, Options::fromFunctionType(*this) ); } diff --git a/libsolidity/ast/Types.h b/libsolidity/ast/Types.h index c41fba070145..b0a3e42ccd83 100644 --- a/libsolidity/ast/Types.h +++ b/libsolidity/ast/Types.h @@ -1640,6 +1640,7 @@ class TypeType: public Type bool hasSimpleZeroValueInMemory() const override { solAssert(false, ""); } std::string toString(bool _withoutDataLocation) const override { return "type(" + m_actualType->toString(_withoutDataLocation) + ")"; } MemberList::MemberMap nativeMembers(ASTNode const* _currentScope) const override; + Type const* mobileType() const override { return nullptr; } BoolResult isExplicitlyConvertibleTo(Type const& _convertTo) const override; protected: @@ -1737,6 +1738,8 @@ class MagicType: public Type Type const* typeArgument() const; + Type const* mobileType() const override { return nullptr; } + protected: std::vector> makeStackItems() const override { return {}; } private: diff --git a/libsolidity/codegen/ExpressionCompiler.cpp b/libsolidity/codegen/ExpressionCompiler.cpp index 9d29c985841e..9a2a0cf04670 100644 --- a/libsolidity/codegen/ExpressionCompiler.cpp +++ b/libsolidity/codegen/ExpressionCompiler.cpp @@ -1927,6 +1927,10 @@ bool ExpressionCompiler::visit(MemberAccess const& _memberAccess) { if (functionType->hasDeclaration()) { + // Still visit the expression in case it has side effects. + _memberAccess.expression().accept(*this); + utils().popStackElement(*functionType); + if (functionType->kind() == FunctionType::Kind::Event) m_context << u256(h256::Arith(util::keccak256(functionType->externalSignature()))); else diff --git a/libsolidity/codegen/LValue.cpp b/libsolidity/codegen/LValue.cpp index 8f20cd992a92..b99ebceddd09 100644 --- a/libsolidity/codegen/LValue.cpp +++ b/libsolidity/codegen/LValue.cpp @@ -187,9 +187,16 @@ void ImmutableItem::storeValue(Type const& _sourceType, SourceLocation const&, b m_context << Instruction::POP; } -void ImmutableItem::setToZero(SourceLocation const&, bool) const +void ImmutableItem::setToZero(SourceLocation const&, bool _removeReference) const { - solAssert(false, "Attempted to set immutable variable to zero."); + CompilerUtils utils(m_context); + solUnimplementedAssert(m_dataType->isValueType()); + solAssert(_removeReference); + + m_context << m_context.immutableMemoryOffset(m_variable); + utils.pushZeroValue(*m_dataType); + utils.storeInMemoryDynamic(*m_dataType); + m_context << Instruction::POP; } StorageItem::StorageItem(CompilerContext& _compilerContext, VariableDeclaration const& _declaration): diff --git a/libsolidity/codegen/ir/IRGenerationContext.h b/libsolidity/codegen/ir/IRGenerationContext.h index 14a70a8a6c09..833b768a313e 100644 --- a/libsolidity/codegen/ir/IRGenerationContext.h +++ b/libsolidity/codegen/ir/IRGenerationContext.h @@ -23,7 +23,6 @@ #include #include -#include #include #include @@ -73,7 +72,6 @@ class IRGenerationContext langutil::EVMVersion _evmVersion, ExecutionContext _executionContext, RevertStrings _revertStrings, - OptimiserSettings _optimiserSettings, std::map _sourceIndices, langutil::DebugInfoSelection const& _debugInfoSelection, langutil::CharStreamProvider const* _soliditySourceProvider @@ -81,7 +79,6 @@ class IRGenerationContext m_evmVersion(_evmVersion), m_executionContext(_executionContext), m_revertStrings(_revertStrings), - m_optimiserSettings(std::move(_optimiserSettings)), m_sourceIndices(std::move(_sourceIndices)), m_debugInfoSelection(_debugInfoSelection), m_soliditySourceProvider(_soliditySourceProvider) @@ -176,7 +173,6 @@ class IRGenerationContext langutil::EVMVersion m_evmVersion; ExecutionContext m_executionContext; RevertStrings m_revertStrings; - OptimiserSettings m_optimiserSettings; std::map m_sourceIndices; std::set m_usedSourceNames; ContractDefinition const* m_mostDerivedContract = nullptr; diff --git a/libsolidity/codegen/ir/IRGenerator.cpp b/libsolidity/codegen/ir/IRGenerator.cpp index bc2f85b4aec0..223d712f0ded 100644 --- a/libsolidity/codegen/ir/IRGenerator.cpp +++ b/libsolidity/codegen/ir/IRGenerator.cpp @@ -40,6 +40,8 @@ #include +#include + #include #include @@ -87,34 +89,13 @@ set collectReachableCallables( } -pair IRGenerator::run( +string IRGenerator::run( ContractDefinition const& _contract, bytes const& _cborMetadata, map const& _otherYulSources ) { - string ir = yul::reindent(generate(_contract, _cborMetadata, _otherYulSources)); - - yul::YulStack asmStack( - m_evmVersion, - m_eofVersion, - yul::YulStack::Language::StrictAssembly, - m_optimiserSettings, - m_context.debugInfoSelection() - ); - if (!asmStack.parseAndAnalyze("", ir)) - { - string errorMessage; - for (auto const& error: asmStack.errors()) - errorMessage += langutil::SourceReferenceFormatter::formatErrorInformation( - *error, - asmStack.charStream("") - ); - solAssert(false, ir + "\n\nInvalid IR generated:\n" + errorMessage + "\n"); - } - asmStack.optimize(); - - return {std::move(ir), asmStack.print(m_context.soliditySourceProvider())}; + return yul::reindent(generate(_contract, _cborMetadata, _otherYulSources)); } string IRGenerator::generate( @@ -1112,7 +1093,6 @@ void IRGenerator::resetContext(ContractDefinition const& _contract, ExecutionCon m_evmVersion, _context, m_context.revertStrings(), - m_optimiserSettings, m_context.sourceIndices(), m_context.debugInfoSelection(), m_context.soliditySourceProvider() diff --git a/libsolidity/codegen/ir/IRGenerator.h b/libsolidity/codegen/ir/IRGenerator.h index 00387842ed01..fafe47128035 100644 --- a/libsolidity/codegen/ir/IRGenerator.h +++ b/libsolidity/codegen/ir/IRGenerator.h @@ -23,7 +23,6 @@ #pragma once -#include #include #include #include @@ -32,6 +31,8 @@ #include #include +#include + #include namespace solidity::frontend @@ -48,19 +49,16 @@ class IRGenerator langutil::EVMVersion _evmVersion, std::optional _eofVersion, RevertStrings _revertStrings, - OptimiserSettings _optimiserSettings, std::map _sourceIndices, langutil::DebugInfoSelection const& _debugInfoSelection, langutil::CharStreamProvider const* _soliditySourceProvider ): m_evmVersion(_evmVersion), m_eofVersion(_eofVersion), - m_optimiserSettings(_optimiserSettings), m_context( _evmVersion, ExecutionContext::Creation, _revertStrings, - std::move(_optimiserSettings), std::move(_sourceIndices), _debugInfoSelection, _soliditySourceProvider @@ -68,9 +66,8 @@ class IRGenerator m_utils(_evmVersion, m_context.revertStrings(), m_context.functionCollector()) {} - /// Generates and returns the IR code, in unoptimized and optimized form - /// (or just pretty-printed, depending on the optimizer settings). - std::pair run( + /// Generates and returns (unoptimized) IR code. + std::string run( ContractDefinition const& _contract, bytes const& _cborMetadata, std::map const& _otherYulSources @@ -141,7 +138,6 @@ class IRGenerator langutil::EVMVersion const m_evmVersion; std::optional const m_eofVersion; - OptimiserSettings const m_optimiserSettings; IRGenerationContext m_context; YulUtilFunctions m_utils; diff --git a/libsolidity/codegen/ir/IRGeneratorForStatements.cpp b/libsolidity/codegen/ir/IRGeneratorForStatements.cpp index c19f9f194ecd..2ed4c7fd8f3a 100644 --- a/libsolidity/codegen/ir/IRGeneratorForStatements.cpp +++ b/libsolidity/codegen/ir/IRGeneratorForStatements.cpp @@ -2301,13 +2301,13 @@ void IRGeneratorForStatements::endVisit(IndexAccess const& _indexAccess) } case DataLocation::Memory: { - string const memAddress = - m_utils.memoryArrayIndexAccessFunction(arrayType) + - "(" + - IRVariable(_indexAccess.baseExpression()).part("mpos").name() + - ", " + - expressionAsType(*_indexAccess.indexExpression(), *TypeProvider::uint256()) + - ")"; + string const indexAccessFunction = m_utils.memoryArrayIndexAccessFunction(arrayType); + string const baseRef = IRVariable(_indexAccess.baseExpression()).part("mpos").name(); + string const indexExpression = expressionAsType( + *_indexAccess.indexExpression(), + *TypeProvider::uint256() + ); + string const memAddress = indexAccessFunction + "(" + baseRef + ", " + indexExpression + ")"; setLValue(_indexAccess, IRLValue{ *arrayType.baseType(), @@ -2317,28 +2317,28 @@ void IRGeneratorForStatements::endVisit(IndexAccess const& _indexAccess) } case DataLocation::CallData: { - string indexAccessFunction = m_utils.calldataArrayIndexAccessFunction(arrayType); - string const indexAccessFunctionCall = - indexAccessFunction + - "(" + - IRVariable(_indexAccess.baseExpression()).commaSeparatedList() + - ", " + - expressionAsType(*_indexAccess.indexExpression(), *TypeProvider::uint256()) + - ")"; + string const indexAccessFunction = m_utils.calldataArrayIndexAccessFunction(arrayType); + string const baseRef = IRVariable(_indexAccess.baseExpression()).commaSeparatedList(); + string const indexExpression = expressionAsType( + *_indexAccess.indexExpression(), + *TypeProvider::uint256() + ); + string const calldataAddress = indexAccessFunction + "(" + baseRef + ", " + indexExpression + ")"; + if (arrayType.isByteArrayOrString()) define(_indexAccess) << m_utils.cleanupFunction(*arrayType.baseType()) << "(calldataload(" << - indexAccessFunctionCall << + calldataAddress << "))\n"; else if (arrayType.baseType()->isValueType()) define(_indexAccess) << m_utils.readFromCalldata(*arrayType.baseType()) << "(" << - indexAccessFunctionCall << + calldataAddress << ")\n"; else - define(_indexAccess) << indexAccessFunctionCall << "\n"; + define(_indexAccess) << calldataAddress << "\n"; break; } } diff --git a/libsolidity/formal/BMC.cpp b/libsolidity/formal/BMC.cpp index e0a5f312b4be..cead3a528f57 100644 --- a/libsolidity/formal/BMC.cpp +++ b/libsolidity/formal/BMC.cpp @@ -18,7 +18,6 @@ #include -#include #include #include @@ -26,6 +25,8 @@ #include #include +#include + #ifdef HAVE_Z3_DLOPEN #include #endif @@ -46,8 +47,11 @@ BMC::BMC( CharStreamProvider const& _charStreamProvider ): SMTEncoder(_context, _settings, _errorReporter, _unsupportedErrorReporter, _charStreamProvider), - m_interface(make_unique(_smtlib2Responses, _smtCallback, _settings.solvers, _settings.timeout)) + m_interface(make_unique( + _smtlib2Responses, _smtCallback, _settings.solvers, _settings.timeout, _settings.printQuery + )) { + solAssert(!_settings.printQuery || _settings.solvers == smtutil::SMTSolverChoice::SMTLIB2(), "Only SMTLib2 solver can be enabled to print queries"); #if defined (HAVE_Z3) || defined (HAVE_CVC4) if (m_settings.solvers.cvc4 || m_settings.solvers.z3) if (!_smtlib2Responses.empty()) @@ -77,13 +81,13 @@ void BMC::analyze(SourceUnit const& _source, map 0) + m_context.addAssertion(not(loopCondition) || broke); m_loopExecutionHappened = true; return false; } -// Here we consider the execution of two branches similar to WhileStatement. +// Unrolls for loop bool BMC::visit(ForStatement const& _node) { if (_node.initializationExpression()) _node.initializationExpression()->accept(*this); - auto indicesBeforeLoop = copyVariableIndices(); + smtutil::Expression broke(false); + smtutil::Expression forCondition(true); + smtutil::Expression forConditionOnPreviousIteration(true); + unsigned int bmcLoopIterations = m_settings.bmcLoopIterations.value_or(1); + for (unsigned int i = 0; i < bmcLoopIterations; ++i) + { + auto indicesBefore = copyVariableIndices(); + if (_node.condition()) + { + _node.condition()->accept(*this); + // values in loop condition might change during loop iteration + forCondition = expr(*_node.condition()); + } + m_loopCheckpoints.emplace(); + auto indicesAfterCondition = copyVariableIndices(); - // Do not reset the init expression part. - auto touchedVars = touchedVariables(_node.body()); - if (_node.condition()) - touchedVars += touchedVariables(*_node.condition()); - if (_node.loopExpression()) - touchedVars += touchedVariables(*_node.loopExpression()); + pushPathCondition(forCondition); + _node.body().accept(*this); - m_context.resetVariables(touchedVars); + auto [continues, brokeInCurrentIteration] = mergeVariablesFromLoopCheckpoints(); - if (_node.condition()) - { - _node.condition()->accept(*this); - if (isRootFunction()) - addVerificationTarget( - VerificationTargetType::ConstantCondition, - expr(*_node.condition()), - _node.condition() + // accept loop expression if there was no break + if (_node.loopExpression()) + { + auto indicesBreak = copyVariableIndices(); + _node.loopExpression()->accept(*this); + mergeVariables( + !brokeInCurrentIteration, + copyVariableIndices(), + indicesBreak ); - } - - m_context.pushSolver(); - if (_node.condition()) - m_context.addAssertion(expr(*_node.condition())); - _node.body().accept(*this); - if (_node.loopExpression()) - _node.loopExpression()->accept(*this); - m_context.popSolver(); - - auto indicesAfterLoop = copyVariableIndices(); - // We reset the execution to before the loop - // and visit the condition. - resetVariableIndices(indicesBeforeLoop); - if (_node.condition()) - _node.condition()->accept(*this); + } + popPathCondition(); - auto forCondition = _node.condition() ? expr(*_node.condition()) : smtutil::Expression(true); - mergeVariables(forCondition, indicesAfterLoop, copyVariableIndices()); + // merges indices modified when accepting loop condition that does no longer hold + mergeVariables( + !forCondition, + indicesAfterCondition, + copyVariableIndices() + ); + // handles breaks in previous iterations + // breaks in current iterations are handled when traversing loop checkpoints + // handles case when the loop condition no longer holds but bmc loop iterations still unrolls the loop + mergeVariables( + broke || !forConditionOnPreviousIteration, + indicesBefore, + copyVariableIndices() + ); + m_loopCheckpoints.pop(); + broke = broke || brokeInCurrentIteration; + forConditionOnPreviousIteration = forCondition; + } + if (bmcLoopIterations > 0) + m_context.addAssertion(not(forCondition) || broke); m_loopExecutionHappened = true; return false; } +std::tuple BMC::mergeVariablesFromLoopCheckpoints() +{ + smtutil::Expression continues(false); + smtutil::Expression brokeInCurrentIteration(false); + for (auto const& loopControl: m_loopCheckpoints.top()) + { + // use SSAs associated with this break statement only if + // loop didn't break or continue earlier in the iteration + // loop condition is included in break path conditions + mergeVariables( + !brokeInCurrentIteration && !continues && loopControl.pathConditions, + loopControl.variableIndices, + copyVariableIndices() + ); + if (loopControl.kind == LoopControlKind::Break) + brokeInCurrentIteration = + brokeInCurrentIteration || loopControl.pathConditions; + else if (loopControl.kind == LoopControlKind::Continue) + continues = continues || loopControl.pathConditions; + } + return std::pair(continues, brokeInCurrentIteration); +} + bool BMC::visit(TryStatement const& _tryStatement) { FunctionCall const* externalCall = dynamic_cast(&_tryStatement.externalCall()); @@ -424,6 +495,28 @@ bool BMC::visit(TryStatement const& _tryStatement) return false; } +bool BMC::visit(Break const&) +{ + LoopControl control = { + LoopControlKind::Break, + currentPathConditions(), + copyVariableIndices() + }; + m_loopCheckpoints.top().emplace_back(control); + return false; +} + +bool BMC::visit(Continue const&) +{ + LoopControl control = { + LoopControlKind::Continue, + currentPathConditions(), + copyVariableIndices() + }; + m_loopCheckpoints.top().emplace_back(control); + return false; +} + void BMC::endVisit(UnaryOperation const& _op) { SMTEncoder::endVisit(_op); @@ -531,7 +624,7 @@ void BMC::visitRequire(FunctionCall const& _funCall) auto const& args = _funCall.arguments(); solAssert(args.size() >= 1, ""); solAssert(args.front()->annotation().type->category() == Type::Category::Bool, ""); - if (isRootFunction()) + if (isRootFunction() && !isInsideLoop()) addVerificationTarget( VerificationTargetType::ConstantCondition, expr(*args.front()), @@ -956,7 +1049,7 @@ void BMC::checkCondition( vector expressionsToEvaluate; vector expressionNames; tie(expressionsToEvaluate, expressionNames) = _modelExpressions; - if (_callStack.size()) + if (!_callStack.empty()) if (_additionalValue) { expressionsToEvaluate.emplace_back(*_additionalValue); @@ -969,8 +1062,9 @@ void BMC::checkCondition( string extraComment = SMTEncoder::extraComment(); if (m_loopExecutionHappened) extraComment += - "\nNote that some information is erased after the execution of loops.\n" - "You can re-introduce information using require()."; + "False negatives are possible when unrolling loops.\n" + "This is due to the possibility that the BMC loop iteration setting is" + " smaller than the actual number of iterations needed to complete a loop."; if (m_externalFunctionCallHappened) extraComment += "\nNote that external function calls are not inlined," @@ -1101,6 +1195,15 @@ BMC::checkSatisfiableAndGenerateModel(vector const& _expres vector values; try { + if (m_settings.printQuery) + { + auto portfolio = dynamic_cast(m_interface.get()); + string smtlibCode = portfolio->dumpQuery(_expressionsToEvaluate); + m_errorReporter.info( + 6240_error, + "BMC: Requested query:\n" + smtlibCode + ); + } tie(result, values) = m_interface->check(_expressionsToEvaluate); } catch (smtutil::SolverError const& _e) @@ -1141,3 +1244,7 @@ void BMC::assignment(smt::SymbolicVariable& _symVar, smtutil::Expression const& )); } +bool BMC::isInsideLoop() const +{ + return !m_loopCheckpoints.empty(); +} diff --git a/libsolidity/formal/BMC.h b/libsolidity/formal/BMC.h index 9a8242047ebc..3abaac1bd2d3 100644 --- a/libsolidity/formal/BMC.h +++ b/libsolidity/formal/BMC.h @@ -100,6 +100,8 @@ class BMC: public SMTEncoder void endVisit(FunctionCall const& _node) override; void endVisit(Return const& _node) override; bool visit(TryStatement const& _node) override; + bool visit(Break const& _node) override; + bool visit(Continue const& _node) override; //@} /// Visitor helpers. @@ -188,6 +190,9 @@ class BMC: public SMTEncoder smtutil::CheckResult checkSatisfiable(); //@} + std::tuple mergeVariablesFromLoopCheckpoints(); + bool isInsideLoop() const; + std::unique_ptr m_interface; /// Flags used for better warning messages. @@ -204,6 +209,21 @@ class BMC: public SMTEncoder /// Number of verification conditions that could not be proved. size_t m_unprovedAmt = 0; -}; + enum class LoopControlKind + { + Continue, + Break + }; + + // Current path conditions and SSA indices for break or continue statement + struct LoopControl { + LoopControlKind kind; + smtutil::Expression pathConditions; + VariableIndices variableIndices; + }; + + // Loop control statements for every loop + std::stack> m_loopCheckpoints; +}; } diff --git a/libsolidity/formal/CHC.cpp b/libsolidity/formal/CHC.cpp index c6e737dbe62c..30c3bb0e9844 100644 --- a/libsolidity/formal/CHC.cpp +++ b/libsolidity/formal/CHC.cpp @@ -72,6 +72,7 @@ CHC::CHC( m_smtlib2Responses(_smtlib2Responses), m_smtCallback(_smtCallback) { + solAssert(!_settings.printQuery || _settings.solvers == smtutil::SMTSolverChoice::SMTLIB2(), "Only SMTLib2 solver can be enabled to print queries"); } void CHC::analyze(SourceUnit const& _source) @@ -1000,6 +1001,12 @@ void CHC::externalFunctionCallToTrustedCode(FunctionCall const& _funCall) if (!function) return; + // Remember the external call in the call graph to properly detect verification targets for the current function + if (m_currentFunction && !m_currentFunction->isConstructor()) + m_callGraph[m_currentFunction].insert(function); + else + m_callGraph[m_currentContract].insert(function); + // External call creates a new transaction. auto originalTx = state().tx(); Expression const* value = valueOption(callOptions); @@ -1801,6 +1808,16 @@ tuple CHC::query CheckResult result; smtutil::Expression invariant(true); CHCSolverInterface::CexGraph cex; + if (m_settings.printQuery) + { + auto smtLibInterface = dynamic_cast(m_interface.get()); + solAssert(smtLibInterface, "Requested to print queries but CHCSmtLib2Interface not available"); + string smtLibCode = smtLibInterface->dumpQuery(_query); + m_errorReporter.info( + 2339_error, + "CHC: Requested query:\n" + smtLibCode + ); + } tie(result, invariant, cex) = m_interface->query(_query); switch (result) { diff --git a/libsolidity/formal/ModelCheckerSettings.h b/libsolidity/formal/ModelCheckerSettings.h index fafb2cdaced7..b645f7c3b6e7 100644 --- a/libsolidity/formal/ModelCheckerSettings.h +++ b/libsolidity/formal/ModelCheckerSettings.h @@ -157,6 +157,7 @@ struct ModelCheckerExtCalls struct ModelCheckerSettings { + std::optional bmcLoopIterations; ModelCheckerContracts contracts = ModelCheckerContracts::Default(); /// Currently division and modulo are replaced by multiplication with slack vars, such that /// a / b <=> a = b * k + m @@ -168,6 +169,7 @@ struct ModelCheckerSettings ModelCheckerEngine engine = ModelCheckerEngine::None(); ModelCheckerExtCalls externalCalls = {}; ModelCheckerInvariants invariants = ModelCheckerInvariants::Default(); + bool printQuery = false; bool showProvedSafe = false; bool showUnproved = false; bool showUnsupported = false; @@ -179,11 +181,13 @@ struct ModelCheckerSettings bool operator==(ModelCheckerSettings const& _other) const noexcept { return + bmcLoopIterations == _other.bmcLoopIterations && contracts == _other.contracts && divModNoSlacks == _other.divModNoSlacks && engine == _other.engine && externalCalls.mode == _other.externalCalls.mode && invariants == _other.invariants && + printQuery == _other.printQuery && showProvedSafe == _other.showProvedSafe && showUnproved == _other.showUnproved && showUnsupported == _other.showUnsupported && diff --git a/libsolidity/formal/SMTEncoder.cpp b/libsolidity/formal/SMTEncoder.cpp index 49df9b919168..c0aaaf760ee0 100644 --- a/libsolidity/formal/SMTEncoder.cpp +++ b/libsolidity/formal/SMTEncoder.cpp @@ -33,6 +33,7 @@ #include #include +#include #include @@ -1364,7 +1365,10 @@ bool SMTEncoder::visit(MemberAccess const& _memberAccess) { auto const* functionType = dynamic_cast(_memberAccess.annotation().type); if (functionType && functionType->hasDeclaration()) - defineExpr(_memberAccess, functionType->externalIdentifier()); + defineExpr( + _memberAccess, + util::selectorFromSignatureU32(functionType->richIdentifier()) + ); return true; } @@ -2845,7 +2849,8 @@ smtutil::Expression SMTEncoder::contractAddressValue(FunctionCall const& _f) VariableDeclaration const* SMTEncoder::publicGetter(Expression const& _expr) const { if (auto memberAccess = dynamic_cast(&_expr)) - return dynamic_cast(memberAccess->annotation().referencedDeclaration); + if (auto variableDeclaration = dynamic_cast(memberAccess->annotation().referencedDeclaration)) + return variableDeclaration->isStateVariable() ? variableDeclaration : nullptr; return nullptr; } diff --git a/libsolidity/formal/SMTEncoder.h b/libsolidity/formal/SMTEncoder.h index c16569686ae6..726f16ef6bc9 100644 --- a/libsolidity/formal/SMTEncoder.h +++ b/libsolidity/formal/SMTEncoder.h @@ -168,7 +168,9 @@ class SMTEncoder: public ASTConstVisitor void endVisit(IndexAccess const& _node) override; void endVisit(IndexRangeAccess const& _node) override; bool visit(InlineAssembly const& _node) override; + bool visit(Break const&) override { return false; } void endVisit(Break const&) override {} + bool visit(Continue const&) override { return false; } void endVisit(Continue const&) override {} bool visit(TryCatchClause const&) override { return true; } void endVisit(TryCatchClause const&) override {} diff --git a/libsolidity/interface/CompilerStack.cpp b/libsolidity/interface/CompilerStack.cpp index 60a47347f92f..c86f50ca9188 100644 --- a/libsolidity/interface/CompilerStack.cpp +++ b/libsolidity/interface/CompilerStack.cpp @@ -59,6 +59,8 @@ #include #include +#include + #include #include #include @@ -68,6 +70,7 @@ #include #include +#include #include @@ -95,6 +98,7 @@ using namespace std; using namespace solidity; using namespace solidity::langutil; using namespace solidity::frontend; +using namespace solidity::stdlib; using solidity::util::errinfo_comment; @@ -315,7 +319,6 @@ void CompilerStack::reset(bool _keepSettings) m_evmVersion = langutil::EVMVersion(); m_modelCheckerSettings = ModelCheckerSettings{}; m_generateIR = false; - m_generateEwasm = false; m_revertStrings = RevertStrings::Default; m_optimiserSettings = OptimiserSettings::minimal(); m_metadataLiteralSources = false; @@ -370,6 +373,15 @@ bool CompilerStack::parse() for (auto const& import: ASTNode::filteredNodes(source.ast->nodes())) { solAssert(!import->path().empty(), "Import path cannot be empty."); + // Check whether the import directive is for the standard library, + // and if yes, add specified file to source units to be parsed. + auto it = stdlib::sources.find(import->path()); + if (it != stdlib::sources.end()) + { + auto [name, content] = *it; + m_sources[name].charStream = make_unique(content, name); + sourcesToParse.push_back(name); + } // The current value of `path` is the absolute path as seen from this source file. // We first have to apply remappings before we can store the actual absolute path @@ -430,7 +442,9 @@ bool CompilerStack::analyze() { if (m_stackState != ParsedAndImported || m_stackState >= AnalysisPerformed) solThrow(CompilerError, "Must call analyze only after parsing was performed."); - resolveImports(); + + if (!resolveImports()) + return false; for (Source const* source: m_sourceOrder) if (source->ast) @@ -681,7 +695,7 @@ bool CompilerStack::compile(State _stopAfter) { try { - if (m_viaIR || m_generateIR || m_generateEwasm) + if (m_viaIR || m_generateIR) generateIR(*contract); if (m_generateEvmBytecode) { @@ -690,8 +704,6 @@ bool CompilerStack::compile(State _stopAfter) else compileContract(*contract, otherCompilers); } - if (m_generateEwasm) - generateEwasm(*contract); } catch (Error const& _error) { @@ -884,28 +896,28 @@ string const& CompilerStack::yulIR(string const& _contractName) const return contract(_contractName).yulIR; } -string const& CompilerStack::yulIROptimized(string const& _contractName) const +Json::Value const& CompilerStack::yulIRAst(string const& _contractName) const { if (m_stackState != CompilationSuccessful) solThrow(CompilerError, "Compilation was not successful."); - return contract(_contractName).yulIROptimized; + return contract(_contractName).yulIRAst; } -string const& CompilerStack::ewasm(string const& _contractName) const +string const& CompilerStack::yulIROptimized(string const& _contractName) const { if (m_stackState != CompilationSuccessful) solThrow(CompilerError, "Compilation was not successful."); - return contract(_contractName).ewasm; + return contract(_contractName).yulIROptimized; } -evmasm::LinkerObject const& CompilerStack::ewasmObject(string const& _contractName) const +Json::Value const& CompilerStack::yulIROptimizedAst(string const& _contractName) const { if (m_stackState != CompilationSuccessful) solThrow(CompilerError, "Compilation was not successful."); - return contract(_contractName).ewasmObject; + return contract(_contractName).yulIROptimizedAst; } evmasm::LinkerObject const& CompilerStack::object(string const& _contractName) const @@ -1194,7 +1206,7 @@ string CompilerStack::applyRemapping(string const& _path, string const& _context return m_importRemapper.apply(_path, _context); } -void CompilerStack::resolveImports() +bool CompilerStack::resolveImports() { solAssert(m_stackState == ParsedAndImported, ""); @@ -1219,11 +1231,34 @@ void CompilerStack::resolveImports() sourceOrder.push_back(_source); }; + vector experimentalPragmaDirectives; for (auto const& sourcePair: m_sources) + { if (isRequestedSource(sourcePair.first)) toposort(&sourcePair.second); + if (sourcePair.second.ast && sourcePair.second.ast->experimentalSolidity()) + for (ASTPointer const& node: sourcePair.second.ast->nodes()) + if (PragmaDirective const* pragma = dynamic_cast(node.get())) + if (pragma->literals().size() >=2 && pragma->literals()[0] == "experimental" && pragma->literals()[1] == "solidity") + { + experimentalPragmaDirectives.push_back(pragma); + break; + } + } + + if (!experimentalPragmaDirectives.empty() && experimentalPragmaDirectives.size() != m_sources.size()) + { + for (auto &&pragma: experimentalPragmaDirectives) + m_errorReporter.parserError( + 2141_error, + pragma->location(), + "File declares \"pragma experimental solidity\". If you want to enable the experimental mode, all source units must include the pragma." + ); + return false; + } swap(m_sourceOrder, sourceOrder); + return true; } void CompilerStack::storeContractDefinitions() @@ -1434,33 +1469,16 @@ void CompilerStack::generateIR(ContractDefinition const& _contract) m_evmVersion, m_eofVersion, m_revertStrings, - m_optimiserSettings, sourceIndices(), m_debugInfoSelection, this ); - tie(compiledContract.yulIR, compiledContract.yulIROptimized) = generator.run( + compiledContract.yulIR = generator.run( _contract, createCBORMetadata(compiledContract, /* _forIR */ true), otherYulSources ); -} - -void CompilerStack::generateEVMFromIR(ContractDefinition const& _contract) -{ - solAssert(m_stackState >= AnalysisPerformed, ""); - if (m_hasError) - solThrow(CompilerError, "Called generateEVMFromIR with errors."); - - if (!_contract.canBeDeployed()) - return; - Contract& compiledContract = m_contracts.at(_contract.fullyQualifiedName()); - solAssert(!compiledContract.yulIROptimized.empty(), ""); - if (!compiledContract.object.bytecode.empty()) - return; - - // Re-parse the Yul IR in EVM dialect yul::YulStack stack( m_evmVersion, m_eofVersion, @@ -1468,29 +1486,35 @@ void CompilerStack::generateEVMFromIR(ContractDefinition const& _contract) m_optimiserSettings, m_debugInfoSelection ); - stack.parseAndAnalyze("", compiledContract.yulIROptimized); - stack.optimize(); - - //cout << yul::AsmPrinter{}(*stack.parserResult()->code) << endl; + if (!stack.parseAndAnalyze("", compiledContract.yulIR)) + { + string errorMessage; + for (auto const& error: stack.errors()) + errorMessage += langutil::SourceReferenceFormatter::formatErrorInformation( + *error, + stack.charStream("") + ); + solAssert(false, compiledContract.yulIR + "\n\nInvalid IR generated:\n" + errorMessage + "\n"); + } - string deployedName = IRNames::deployedObject(_contract); - solAssert(!deployedName.empty(), ""); - tie(compiledContract.evmAssembly, compiledContract.evmRuntimeAssembly) = stack.assembleEVMWithDeployed(deployedName); - assembleYul(_contract, compiledContract.evmAssembly, compiledContract.evmRuntimeAssembly); + compiledContract.yulIRAst = stack.astJson(); + stack.optimize(); + compiledContract.yulIROptimized = stack.print(this); + compiledContract.yulIROptimizedAst = stack.astJson(); } -void CompilerStack::generateEwasm(ContractDefinition const& _contract) +void CompilerStack::generateEVMFromIR(ContractDefinition const& _contract) { solAssert(m_stackState >= AnalysisPerformed, ""); if (m_hasError) - solThrow(CompilerError, "Called generateEwasm with errors."); + solThrow(CompilerError, "Called generateEVMFromIR with errors."); if (!_contract.canBeDeployed()) return; Contract& compiledContract = m_contracts.at(_contract.fullyQualifiedName()); solAssert(!compiledContract.yulIROptimized.empty(), ""); - if (!compiledContract.ewasm.empty()) + if (!compiledContract.object.bytecode.empty()) return; // Re-parse the Yul IR in EVM dialect @@ -1501,18 +1525,15 @@ void CompilerStack::generateEwasm(ContractDefinition const& _contract) m_optimiserSettings, m_debugInfoSelection ); - stack.parseAndAnalyze("", compiledContract.yulIROptimized); - - stack.optimize(); - stack.translate(yul::YulStack::Language::Ewasm); - stack.optimize(); + bool analysisSuccessful = stack.parseAndAnalyze("", compiledContract.yulIROptimized); + solAssert(analysisSuccessful); //cout << yul::AsmPrinter{}(*stack.parserResult()->code) << endl; - // Turn into Ewasm text representation. - auto result = stack.assemble(yul::YulStack::Machine::Ewasm); - compiledContract.ewasm = std::move(result.assembly); - compiledContract.ewasmObject = std::move(*result.bytecode); + string deployedName = IRNames::deployedObject(_contract); + solAssert(!deployedName.empty(), ""); + tie(compiledContract.evmAssembly, compiledContract.evmRuntimeAssembly) = stack.assembleEVMWithDeployed(deployedName); + assembleYul(_contract, compiledContract.evmAssembly, compiledContract.evmRuntimeAssembly); } CompilerStack::Contract const& CompilerStack::contract(string const& _contractName) const diff --git a/libsolidity/interface/CompilerStack.h b/libsolidity/interface/CompilerStack.h index 36e462330b0e..8880770b8225 100644 --- a/libsolidity/interface/CompilerStack.h +++ b/libsolidity/interface/CompilerStack.h @@ -203,9 +203,6 @@ class CompilerStack: public langutil::CharStreamProvider /// Enable generation of Yul IR code. void enableIRGeneration(bool _enable = true) { m_generateIR = _enable; } - /// Enable experimental generation of Ewasm code. If enabled, IR is also generated. - void enableEwasmGeneration(bool _enable = true) { m_generateEwasm = _enable; } - /// @arg _metadataLiteralSources When true, store sources as literals in the contract metadata. /// Must be set before parsing. void useMetadataLiteralSources(bool _metadataLiteralSources); @@ -279,14 +276,14 @@ class CompilerStack: public langutil::CharStreamProvider /// @returns the IR representation of a contract. std::string const& yulIR(std::string const& _contractName) const; + /// @returns the IR representation of a contract AST in format. + Json::Value const& yulIRAst(std::string const& _contractName) const; + /// @returns the optimized IR representation of a contract. std::string const& yulIROptimized(std::string const& _contractName) const; - /// @returns the Ewasm text representation of a contract. - std::string const& ewasm(std::string const& _contractName) const; - - /// @returns the Ewasm representation of a contract. - evmasm::LinkerObject const& ewasmObject(std::string const& _contractName) const; + /// @returns the optimized IR representation of a contract AST in JSON format. + Json::Value const& yulIROptimizedAst(std::string const& _contractName) const; /// @returns the assembled object for a contract. evmasm::LinkerObject const& object(std::string const& _contractName) const; @@ -389,8 +386,8 @@ class CompilerStack: public langutil::CharStreamProvider evmasm::LinkerObject runtimeObject; ///< Runtime object. std::string yulIR; ///< Yul IR code. std::string yulIROptimized; ///< Optimized Yul IR code. - std::string ewasm; ///< Experimental Ewasm text representation - evmasm::LinkerObject ewasmObject; ///< Experimental Ewasm code + Json::Value yulIRAst; ///< JSON AST of Yul IR code. + Json::Value yulIROptimizedAst; ///< JSON AST of optimized Yul IR code. util::LazyInit metadata; ///< The metadata json that will be hashed into the chain. util::LazyInit abi; util::LazyInit storageLayout; @@ -410,7 +407,7 @@ class CompilerStack: public langutil::CharStreamProvider /// @returns the newly loaded sources. StringMap loadMissingSources(SourceUnit const& _ast); std::string applyRemapping(std::string const& _path, std::string const& _context); - void resolveImports(); + bool resolveImports(); /// Store the contract definitions in m_contracts. void storeContractDefinitions(); @@ -448,10 +445,6 @@ class CompilerStack: public langutil::CharStreamProvider /// Depends on output generated by generateIR. void generateEVMFromIR(ContractDefinition const& _contract); - /// Generate Ewasm representation for a single contract. - /// Depends on output generated by generateIR. - void generateEwasm(ContractDefinition const& _contract); - /// Links all the known library addresses in the available objects. Any unknown /// library will still be kept as an unlinked placeholder in the objects. void link(); @@ -510,7 +503,6 @@ class CompilerStack: public langutil::CharStreamProvider std::map> m_requestedContractNames; bool m_generateEvmBytecode = true; bool m_generateIR = false; - bool m_generateEwasm = false; std::map m_libraries; ImportRemapper m_importRemapper; std::map m_sources; diff --git a/libsolidity/interface/OptimiserSettings.h b/libsolidity/interface/OptimiserSettings.h index bae343f2d13d..8b0299c47dac 100644 --- a/libsolidity/interface/OptimiserSettings.h +++ b/libsolidity/interface/OptimiserSettings.h @@ -103,8 +103,8 @@ struct OptimiserSettings case OptimisationPreset::Minimal: return minimal(); case OptimisationPreset::Standard: return standard(); case OptimisationPreset::Full: return full(); - default: solAssert(false, ""); } + util::unreachable(); } bool operator==(OptimiserSettings const& _other) const diff --git a/libsolidity/interface/StandardCompiler.cpp b/libsolidity/interface/StandardCompiler.cpp index dbcbe798aaed..fc1de4249858 100644 --- a/libsolidity/interface/StandardCompiler.cpp +++ b/libsolidity/interface/StandardCompiler.cpp @@ -179,7 +179,7 @@ bool hashMatchesContent(string const& _hash, string const& _content) bool isArtifactRequested(Json::Value const& _outputSelection, string const& _artifact, bool _wildcardMatchesExperimental) { - static set experimental{"ir", "irOptimized", "wast", "ewasm", "ewasm.wast"}; + static set experimental{"ir", "irAst", "irOptimized", "irOptimizedAst"}; for (auto const& selectedArtifactJson: _outputSelection) { string const& selectedArtifact = selectedArtifactJson.asString(); @@ -190,7 +190,7 @@ bool isArtifactRequested(Json::Value const& _outputSelection, string const& _art return true; else if (selectedArtifact == "*") { - // "ir", "irOptimized", "wast" and "ewasm.wast" can only be matched by "*" if activated. + // "ir", "irOptimized" can only be matched by "*" if activated. if (experimental.count(_artifact) == 0 || _wildcardMatchesExperimental) return true; } @@ -263,8 +263,7 @@ bool isBinaryRequested(Json::Value const& _outputSelection) // This does not include "evm.methodIdentifiers" on purpose! static vector const outputsThatRequireBinaries = vector{ "*", - "ir", "irOptimized", - "wast", "wasm", "ewasm.wast", "ewasm.wasm", + "ir", "irAst", "irOptimized", "irOptimizedAst", "evm.gasEstimates", "evm.legacyAssembly", "evm.assembly" } + evmObjectComponents("bytecode") + evmObjectComponents("deployedBytecode"); @@ -295,36 +294,22 @@ bool isEvmBytecodeRequested(Json::Value const& _outputSelection) return false; } -/// @returns true if any Ewasm code was requested. Note that as an exception, '*' does not -/// yet match "ewasm.wast" or "ewasm" -bool isEwasmRequested(Json::Value const& _outputSelection) -{ - if (!_outputSelection.isObject()) - return false; - - for (auto const& fileRequests: _outputSelection) - for (auto const& requests: fileRequests) - for (auto const& request: requests) - if (request == "ewasm" || request == "ewasm.wast") - return true; - - return false; -} - /// @returns true if any Yul IR was requested. Note that as an exception, '*' does not -/// yet match "ir" or "irOptimized" +/// yet match "ir", "irAst", "irOptimized" or "irOptimizedAst" bool isIRRequested(Json::Value const& _outputSelection) { - if (isEwasmRequested(_outputSelection)) - return true; - if (!_outputSelection.isObject()) return false; for (auto const& fileRequests: _outputSelection) for (auto const& requests: fileRequests) for (auto const& request: requests) - if (request == "ir" || request == "irOptimized") + if ( + request == "ir" || + request == "irAst" || + request == "irOptimized" || + request == "irOptimizedAst" + ) return true; return false; @@ -445,7 +430,7 @@ std::optional checkSettingsKeys(Json::Value const& _input) std::optional checkModelCheckerSettingsKeys(Json::Value const& _input) { - static set keys{"contracts", "divModNoSlacks", "engine", "extCalls", "invariants", "showProvedSafe", "showUnproved", "showUnsupported", "solvers", "targets", "timeout"}; + static set keys{"bmcLoopIterations", "contracts", "divModNoSlacks", "engine", "extCalls", "invariants", "printQuery", "showProvedSafe", "showUnproved", "showUnsupported", "solvers", "targets", "timeout"}; return checkKeys(_input, keys, "modelChecker"); } @@ -1028,6 +1013,16 @@ std::variant StandardCompiler: ret.modelCheckerSettings.engine = *engine; } + if (modelCheckerSettings.isMember("bmcLoopIterations")) + { + if (!ret.modelCheckerSettings.engine.bmc) + return formatFatalError(Error::Type::JSONError, "settings.modelChecker.bmcLoopIterations requires the BMC engine to be enabled."); + if (modelCheckerSettings["bmcLoopIterations"].isUInt()) + ret.modelCheckerSettings.bmcLoopIterations = modelCheckerSettings["bmcLoopIterations"].asUInt(); + else + return formatFatalError(Error::Type::JSONError, "settings.modelChecker.bmcLoopIterations must be an unsigned integer."); + } + if (modelCheckerSettings.isMember("extCalls")) { if (!modelCheckerSettings["extCalls"].isString()) @@ -1101,6 +1096,18 @@ std::variant StandardCompiler: ret.modelCheckerSettings.solvers = solvers; } + if (modelCheckerSettings.isMember("printQuery")) + { + auto const& printQuery = modelCheckerSettings["printQuery"]; + if (!printQuery.isBool()) + return formatFatalError(Error::Type::JSONError, "settings.modelChecker.printQuery must be a Boolean value."); + + if (!(ret.modelCheckerSettings.solvers == smtutil::SMTSolverChoice::SMTLIB2())) + return formatFatalError(Error::Type::JSONError, "Only SMTLib2 solver can be enabled to print queries"); + + ret.modelCheckerSettings.printQuery = printQuery.asBool(); + } + if (modelCheckerSettings.isMember("targets")) { auto const& targetsArray = modelCheckerSettings["targets"]; @@ -1175,7 +1182,6 @@ Json::Value StandardCompiler::compileSolidity(StandardCompiler::InputsAndSetting compilerStack.enableEvmBytecodeGeneration(isEvmBytecodeRequested(_inputsAndSettings.outputSelection)); compilerStack.enableIRGeneration(isIRRequested(_inputsAndSettings.outputSelection)); - compilerStack.enableEwasmGeneration(isEwasmRequested(_inputsAndSettings.outputSelection)); Json::Value errors = std::move(_inputsAndSettings.errors); @@ -1311,15 +1317,21 @@ Json::Value StandardCompiler::compileSolidity(StandardCompiler::InputsAndSetting )); } + bool parsingSuccess = compilerStack.state() >= CompilerStack::State::Parsed; bool analysisPerformed = compilerStack.state() >= CompilerStack::State::AnalysisPerformed; - bool const compilationSuccess = compilerStack.state() == CompilerStack::State::CompilationSuccessful; + bool compilationSuccess = compilerStack.state() == CompilerStack::State::CompilationSuccessful; if (compilerStack.hasError() && !_inputsAndSettings.parserErrorRecovery) analysisPerformed = false; + // If analysis fails, the artifacts inside CompilerStack are potentially incomplete and must not be returned. + // Note that not completing analysis due to stopAfter does not count as a failure. It's neither failure nor success. + bool analysisFailed = !analysisPerformed && _inputsAndSettings.stopAfter >= CompilerStack::State::AnalysisPerformed; + bool compilationFailed = !compilationSuccess && binariesRequested; + /// Inconsistent state - stop here to receive error reports from users if ( - ((binariesRequested && !compilationSuccess) || !analysisPerformed) && + (compilationFailed || !analysisPerformed) && (errors.empty() && _inputsAndSettings.stopAfter >= CompilerStack::State::AnalysisPerformed) ) return formatFatalError(Error::Type::InternalCompilerError, "No error reported, but compilation failed."); @@ -1337,7 +1349,7 @@ Json::Value StandardCompiler::compileSolidity(StandardCompiler::InputsAndSetting output["sources"] = Json::objectValue; unsigned sourceIndex = 0; - if (compilerStack.state() >= CompilerStack::State::Parsed && (!compilerStack.hasError() || _inputsAndSettings.parserErrorRecovery)) + if (parsingSuccess && !analysisFailed && (!compilerStack.hasError() || _inputsAndSettings.parserErrorRecovery)) for (string const& sourceName: compilerStack.sourceNames()) { Json::Value sourceResult = Json::objectValue; @@ -1371,14 +1383,12 @@ Json::Value StandardCompiler::compileSolidity(StandardCompiler::InputsAndSetting // IR if (compilationSuccess && isArtifactRequested(_inputsAndSettings.outputSelection, file, name, "ir", wildcardMatchesExperimental)) contractData["ir"] = compilerStack.yulIR(contractName); + if (compilationSuccess && isArtifactRequested(_inputsAndSettings.outputSelection, file, name, "irAst", wildcardMatchesExperimental)) + contractData["irAst"] = compilerStack.yulIRAst(contractName); if (compilationSuccess && isArtifactRequested(_inputsAndSettings.outputSelection, file, name, "irOptimized", wildcardMatchesExperimental)) contractData["irOptimized"] = compilerStack.yulIROptimized(contractName); - - // Ewasm - if (compilationSuccess && isArtifactRequested(_inputsAndSettings.outputSelection, file, name, "ewasm.wast", wildcardMatchesExperimental)) - contractData["ewasm"]["wast"] = compilerStack.ewasm(contractName); - if (compilationSuccess && isArtifactRequested(_inputsAndSettings.outputSelection, file, name, "ewasm.wasm", wildcardMatchesExperimental)) - contractData["ewasm"]["wasm"] = compilerStack.ewasmObject(contractName).toHex(); + if (compilationSuccess && isArtifactRequested(_inputsAndSettings.outputSelection, file, name, "irOptimizedAst", wildcardMatchesExperimental)) + contractData["irOptimizedAst"] = compilerStack.yulIROptimizedAst(contractName); // EVM Json::Value evmData(Json::objectValue); @@ -1540,6 +1550,13 @@ Json::Value StandardCompiler::compileYul(InputsAndSettings _inputsAndSettings) if (isArtifactRequested(_inputsAndSettings.outputSelection, sourceName, contractName, "ir", wildcardMatchesExperimental)) output["contracts"][sourceName][contractName]["ir"] = stack.print(); + if (isArtifactRequested(_inputsAndSettings.outputSelection, sourceName, contractName, "ast", wildcardMatchesExperimental)) + { + Json::Value sourceResult = Json::objectValue; + sourceResult["id"] = 1; + sourceResult["ast"] = stack.astJson(); + output["sources"][sourceName] = sourceResult; + } stack.optimize(); MachineAssemblyObject object; diff --git a/libsolidity/parsing/Parser.cpp b/libsolidity/parsing/Parser.cpp index fc58fe3d10c7..70446fd50ba0 100644 --- a/libsolidity/parsing/Parser.cpp +++ b/libsolidity/parsing/Parser.cpp @@ -94,14 +94,18 @@ ASTPointer Parser::parse(CharStream& _charStream) m_recursionDepth = 0; m_scanner = make_shared(_charStream); ASTNodeFactory nodeFactory(*this); + m_experimentalSolidityEnabledInCurrentSourceUnit = false; vector> nodes; + while (m_scanner->currentToken() == Token::Pragma) + nodes.push_back(parsePragmaDirective(false)); + while (m_scanner->currentToken() != Token::EOS) { switch (m_scanner->currentToken()) { case Token::Pragma: - nodes.push_back(parsePragmaDirective()); + nodes.push_back(parsePragmaDirective(true)); break; case Token::Import: nodes.push_back(parseImportDirective()); @@ -150,7 +154,7 @@ ASTPointer Parser::parse(CharStream& _charStream) } } solAssert(m_recursionDepth == 0, ""); - return nodeFactory.createNode(findLicenseString(nodes), nodes); + return nodeFactory.createNode(findLicenseString(nodes), nodes, m_experimentalSolidityEnabledInCurrentSourceUnit); } catch (FatalError const&) { @@ -203,7 +207,7 @@ ASTPointer Parser::parseStructuredDocumentation() return nullptr; } -ASTPointer Parser::parsePragmaDirective() +ASTPointer Parser::parsePragmaDirective(bool const _finishedParsingTopLevelPragmas) { RecursionGuard recursionGuard(*this); // pragma anything* ; @@ -213,6 +217,7 @@ ASTPointer Parser::parsePragmaDirective() expectToken(Token::Pragma); vector literals; vector tokens; + do { Token token = m_scanner->currentToken(); @@ -241,6 +246,15 @@ ASTPointer Parser::parsePragmaDirective() ); } + if (literals.size() >= 2 && literals[0] == "experimental" && literals[1] == "solidity") + { + if (m_evmVersion < EVMVersion::constantinople()) + fatalParserError(7637_error, "Experimental solidity requires Constantinople EVM version at the minimum."); + if (_finishedParsingTopLevelPragmas) + fatalParserError(8185_error, "Experimental pragma \"solidity\" can only be set at the beginning of the source unit."); + m_experimentalSolidityEnabledInCurrentSourceUnit = true; + } + return nodeFactory.createNode(tokens, literals); } @@ -257,9 +271,9 @@ ASTPointer Parser::parseImportDirective() SourceLocation unitAliasLocation{}; ImportDirective::SymbolAliasList symbolAliases; - if (m_scanner->currentToken() == Token::StringLiteral) + if (isQuotedPath() || isStdlibPath()) { - path = getLiteralAndAdvance(); + path = isQuotedPath() ? getLiteralAndAdvance() : getStdlibImportPathAndAdvance(); if (m_scanner->currentToken() == Token::As) { advance(); @@ -301,9 +315,9 @@ ASTPointer Parser::parseImportDirective() if (m_scanner->currentToken() != Token::Identifier || m_scanner->currentLiteral() != "from") fatalParserError(8208_error, "Expected \"from\"."); advance(); - if (m_scanner->currentToken() != Token::StringLiteral) + if (!isQuotedPath() && !isStdlibPath()) fatalParserError(6845_error, "Expected import path."); - path = getLiteralAndAdvance(); + path = isQuotedPath() ? getLiteralAndAdvance() : getStdlibImportPathAndAdvance(); } if (path->empty()) fatalParserError(6326_error, "Import path cannot be empty."); @@ -2476,4 +2490,25 @@ ASTPointer Parser::getLiteralAndAdvance() return identifier; } +bool Parser::isQuotedPath() const +{ + return m_scanner->currentToken() == Token::StringLiteral; +} + +bool Parser::isStdlibPath() const +{ + return m_experimentalSolidityEnabledInCurrentSourceUnit + && m_scanner->currentToken() == Token::Identifier + && m_scanner->currentLiteral() == "std"; +} + +ASTPointer Parser::getStdlibImportPathAndAdvance() +{ + ASTPointer std = expectIdentifierToken(); + if (m_scanner->currentToken() == Token::Period) + advance(); + ASTPointer library = expectIdentifierToken(); + return make_shared(*std + "." + *library); +} + } diff --git a/libsolidity/parsing/Parser.h b/libsolidity/parsing/Parser.h index c7d6146be3c8..65e8f61f311d 100644 --- a/libsolidity/parsing/Parser.h +++ b/libsolidity/parsing/Parser.h @@ -89,7 +89,7 @@ class Parser: public langutil::ParserBase ///@name Parsing functions for the AST nodes void parsePragmaVersion(langutil::SourceLocation const& _location, std::vector const& _tokens, std::vector const& _literals); ASTPointer parseStructuredDocumentation(); - ASTPointer parsePragmaDirective(); + ASTPointer parsePragmaDirective(bool _finishedParsingTopLevelPragmas); ASTPointer parseImportDirective(); /// @returns an std::pair, where /// result.second is set to true, if an abstract contract was parsed, false otherwise. @@ -219,6 +219,11 @@ class Parser: public langutil::ParserBase ASTPointer getLiteralAndAdvance(); ///@} + bool isQuotedPath() const; + bool isStdlibPath() const; + + ASTPointer getStdlibImportPathAndAdvance(); + /// Creates an empty ParameterList at the current location (used if parameters can be omitted). ASTPointer createEmptyParameterList(); @@ -227,6 +232,8 @@ class Parser: public langutil::ParserBase langutil::EVMVersion m_evmVersion; /// Counter for the next AST node ID int64_t m_currentNodeID = 0; + /// Flag that indicates whether experimental mode is enabled in the current source unit + bool m_experimentalSolidityEnabledInCurrentSourceUnit = false; }; } diff --git a/libsolutil/CMakeLists.txt b/libsolutil/CMakeLists.txt index b368e12f9dab..201429bb75e9 100644 --- a/libsolutil/CMakeLists.txt +++ b/libsolutil/CMakeLists.txt @@ -46,7 +46,7 @@ set(sources add_library(solutil ${sources}) target_link_libraries(solutil PUBLIC jsoncpp Boost::boost Boost::filesystem Boost::system range-v3 fmt::fmt-header-only) -target_include_directories(solutil PUBLIC "${CMAKE_SOURCE_DIR}") +target_include_directories(solutil PUBLIC "${PROJECT_SOURCE_DIR}") add_dependencies(solutil solidity_BuildInfo.h) if(SOLC_LINK_STATIC) diff --git a/libstdlib/CMakeLists.txt b/libstdlib/CMakeLists.txt new file mode 100644 index 000000000000..65a3a1cda16b --- /dev/null +++ b/libstdlib/CMakeLists.txt @@ -0,0 +1,18 @@ +# This will re-generate the headers if any file within src was modified. +set_directory_properties(PROPERTY CMAKE_CONFIGURE_DEPENDS ${PROJECT_SOURCE_DIR}/stdlib/src/) + +set(STDLIB stub) +set(GENERATED_STDLIB_HEADERS) +foreach(src IN LISTS STDLIB) + set(STDLIB_FILE ${PROJECT_SOURCE_DIR}/libstdlib/src/${src}.sol) + file(READ ${STDLIB_FILE} STDLIB_FILE_CONTENT HEX) + string(REGEX MATCHALL ".." STDLIB_FILE_CONTENT "${STDLIB_FILE_CONTENT}") + list(REMOVE_ITEM STDLIB_FILE_CONTENT "0d") + string(REGEX REPLACE ";" ",\n\t0x" STDLIB_FILE_CONTENT "${STDLIB_FILE_CONTENT}") + set(STDLIB_FILE_CONTENT "0x${STDLIB_FILE_CONTENT}") + set(STDLIB_FILE_NAME ${src}) + configure_file("${PROJECT_SOURCE_DIR}/libstdlib/stdlib.src.h.in" ${PROJECT_BINARY_DIR}/include/libstdlib/${src}.h NEWLINE_STYLE LF @ONLY) + list(APPEND GENERATED_STDLIB_HEADERS ${PROJECT_BINARY_DIR}/include/libstdlib/${src}.h) +endforeach() + +configure_file("${PROJECT_SOURCE_DIR}/libstdlib/stdlib.h.in" ${PROJECT_BINARY_DIR}/include/libstdlib/stdlib.h NEWLINE_STYLE LF @ONLY) diff --git a/libstdlib/src/stub.sol b/libstdlib/src/stub.sol new file mode 100644 index 000000000000..46ae21dcf5a2 --- /dev/null +++ b/libstdlib/src/stub.sol @@ -0,0 +1,9 @@ +// SPDX-License-Identifier: Apache-2.0 +pragma solidity >=0.0; + +pragma experimental solidity; + +function identity(uint256 x) pure returns (uint256) +{ + return x; +} diff --git a/libstdlib/stdlib.h.in b/libstdlib/stdlib.h.in new file mode 100644 index 000000000000..3b86029dc6e1 --- /dev/null +++ b/libstdlib/stdlib.h.in @@ -0,0 +1,15 @@ +#pragma once + +#include +#include + +#include "libstdlib/stub.h" + +namespace solidity::stdlib +{ + +static std::map sources = { + { "std.stub", stub } +}; + +} // namespace solidity::stdlib diff --git a/libstdlib/stdlib.src.h.in b/libstdlib/stdlib.src.h.in new file mode 100644 index 000000000000..0407663d6b4d --- /dev/null +++ b/libstdlib/stdlib.src.h.in @@ -0,0 +1,13 @@ +// The generation of this file is defined in stdlib/CMakeLists.txt. +// This file was generated by using the content of stdlib/src/@STDLIB_FILE_NAME@.sol. + +#pragma once + +namespace solidity::stdlib +{ + +static char const @STDLIB_FILE_NAME@[] = { + @STDLIB_FILE_CONTENT@, 0 +}; + +} // namespace solidity::stdlib diff --git a/libyul/AsmJsonConverter.cpp b/libyul/AsmJsonConverter.cpp index 1807396c50a6..0a800c2bad42 100644 --- a/libyul/AsmJsonConverter.cpp +++ b/libyul/AsmJsonConverter.cpp @@ -33,7 +33,7 @@ namespace solidity::yul Json::Value AsmJsonConverter::operator()(Block const& _node) const { - Json::Value ret = createAstNode(nativeLocationOf(_node), "YulBlock"); + Json::Value ret = createAstNode(originLocationOf(_node), nativeLocationOf(_node), "YulBlock"); ret["statements"] = vectorOfVariantsToJson(_node.statements); return ret; } @@ -41,7 +41,7 @@ Json::Value AsmJsonConverter::operator()(Block const& _node) const Json::Value AsmJsonConverter::operator()(TypedName const& _node) const { yulAssert(!_node.name.empty(), "Invalid variable name."); - Json::Value ret = createAstNode(nativeLocationOf(_node), "YulTypedName"); + Json::Value ret = createAstNode(originLocationOf(_node), nativeLocationOf(_node), "YulTypedName"); ret["name"] = _node.name.str(); ret["type"] = _node.type.str(); return ret; @@ -49,7 +49,7 @@ Json::Value AsmJsonConverter::operator()(TypedName const& _node) const Json::Value AsmJsonConverter::operator()(Literal const& _node) const { - Json::Value ret = createAstNode(nativeLocationOf(_node), "YulLiteral"); + Json::Value ret = createAstNode(originLocationOf(_node), nativeLocationOf(_node), "YulLiteral"); switch (_node.kind) { case LiteralKind::Number: @@ -76,7 +76,7 @@ Json::Value AsmJsonConverter::operator()(Literal const& _node) const Json::Value AsmJsonConverter::operator()(Identifier const& _node) const { yulAssert(!_node.name.empty(), "Invalid identifier"); - Json::Value ret = createAstNode(nativeLocationOf(_node), "YulIdentifier"); + Json::Value ret = createAstNode(originLocationOf(_node), nativeLocationOf(_node), "YulIdentifier"); ret["name"] = _node.name.str(); return ret; } @@ -84,7 +84,7 @@ Json::Value AsmJsonConverter::operator()(Identifier const& _node) const Json::Value AsmJsonConverter::operator()(Assignment const& _node) const { yulAssert(_node.variableNames.size() >= 1, "Invalid assignment syntax"); - Json::Value ret = createAstNode(nativeLocationOf(_node), "YulAssignment"); + Json::Value ret = createAstNode(originLocationOf(_node), nativeLocationOf(_node), "YulAssignment"); for (auto const& var: _node.variableNames) ret["variableNames"].append((*this)(var)); ret["value"] = _node.value ? std::visit(*this, *_node.value) : Json::nullValue; @@ -93,7 +93,7 @@ Json::Value AsmJsonConverter::operator()(Assignment const& _node) const Json::Value AsmJsonConverter::operator()(FunctionCall const& _node) const { - Json::Value ret = createAstNode(nativeLocationOf(_node), "YulFunctionCall"); + Json::Value ret = createAstNode(originLocationOf(_node), nativeLocationOf(_node), "YulFunctionCall"); ret["functionName"] = (*this)(_node.functionName); ret["arguments"] = vectorOfVariantsToJson(_node.arguments); return ret; @@ -101,14 +101,14 @@ Json::Value AsmJsonConverter::operator()(FunctionCall const& _node) const Json::Value AsmJsonConverter::operator()(ExpressionStatement const& _node) const { - Json::Value ret = createAstNode(nativeLocationOf(_node), "YulExpressionStatement"); + Json::Value ret = createAstNode(originLocationOf(_node), nativeLocationOf(_node), "YulExpressionStatement"); ret["expression"] = std::visit(*this, _node.expression); return ret; } Json::Value AsmJsonConverter::operator()(VariableDeclaration const& _node) const { - Json::Value ret = createAstNode(nativeLocationOf(_node), "YulVariableDeclaration"); + Json::Value ret = createAstNode(originLocationOf(_node), nativeLocationOf(_node), "YulVariableDeclaration"); for (auto const& var: _node.variables) ret["variables"].append((*this)(var)); @@ -120,7 +120,7 @@ Json::Value AsmJsonConverter::operator()(VariableDeclaration const& _node) const Json::Value AsmJsonConverter::operator()(FunctionDefinition const& _node) const { yulAssert(!_node.name.empty(), "Invalid function name."); - Json::Value ret = createAstNode(nativeLocationOf(_node), "YulFunctionDefinition"); + Json::Value ret = createAstNode(originLocationOf(_node), nativeLocationOf(_node), "YulFunctionDefinition"); ret["name"] = _node.name.str(); for (auto const& var: _node.parameters) ret["parameters"].append((*this)(var)); @@ -133,7 +133,7 @@ Json::Value AsmJsonConverter::operator()(FunctionDefinition const& _node) const Json::Value AsmJsonConverter::operator()(If const& _node) const { yulAssert(_node.condition, "Invalid if condition."); - Json::Value ret = createAstNode(nativeLocationOf(_node), "YulIf"); + Json::Value ret = createAstNode(originLocationOf(_node), nativeLocationOf(_node), "YulIf"); ret["condition"] = std::visit(*this, *_node.condition); ret["body"] = (*this)(_node.body); return ret; @@ -142,7 +142,7 @@ Json::Value AsmJsonConverter::operator()(If const& _node) const Json::Value AsmJsonConverter::operator()(Switch const& _node) const { yulAssert(_node.expression, "Invalid expression pointer."); - Json::Value ret = createAstNode(nativeLocationOf(_node), "YulSwitch"); + Json::Value ret = createAstNode(originLocationOf(_node), nativeLocationOf(_node), "YulSwitch"); ret["expression"] = std::visit(*this, *_node.expression); for (auto const& var: _node.cases) ret["cases"].append((*this)(var)); @@ -151,7 +151,7 @@ Json::Value AsmJsonConverter::operator()(Switch const& _node) const Json::Value AsmJsonConverter::operator()(Case const& _node) const { - Json::Value ret = createAstNode(nativeLocationOf(_node), "YulCase"); + Json::Value ret = createAstNode(originLocationOf(_node), nativeLocationOf(_node), "YulCase"); ret["value"] = _node.value ? (*this)(*_node.value) : "default"; ret["body"] = (*this)(_node.body); return ret; @@ -160,7 +160,7 @@ Json::Value AsmJsonConverter::operator()(Case const& _node) const Json::Value AsmJsonConverter::operator()(ForLoop const& _node) const { yulAssert(_node.condition, "Invalid for loop condition."); - Json::Value ret = createAstNode(nativeLocationOf(_node), "YulForLoop"); + Json::Value ret = createAstNode(originLocationOf(_node), nativeLocationOf(_node), "YulForLoop"); ret["pre"] = (*this)(_node.pre); ret["condition"] = std::visit(*this, *_node.condition); ret["post"] = (*this)(_node.post); @@ -170,27 +170,30 @@ Json::Value AsmJsonConverter::operator()(ForLoop const& _node) const Json::Value AsmJsonConverter::operator()(Break const& _node) const { - return createAstNode(nativeLocationOf(_node), "YulBreak"); + return createAstNode(originLocationOf(_node), nativeLocationOf(_node), "YulBreak"); } Json::Value AsmJsonConverter::operator()(Continue const& _node) const { - return createAstNode(nativeLocationOf(_node), "YulContinue"); + return createAstNode(originLocationOf(_node), nativeLocationOf(_node), "YulContinue"); } Json::Value AsmJsonConverter::operator()(Leave const& _node) const { - return createAstNode(nativeLocationOf(_node), "YulLeave"); + return createAstNode(originLocationOf(_node), nativeLocationOf(_node), "YulLeave"); } -Json::Value AsmJsonConverter::createAstNode(langutil::SourceLocation const& _location, string _nodeType) const +Json::Value AsmJsonConverter::createAstNode(langutil::SourceLocation const& _originLocation, langutil::SourceLocation const& _nativeLocation, string _nodeType) const { Json::Value ret{Json::objectValue}; ret["nodeType"] = std::move(_nodeType); - int length = -1; - if (_location.start >= 0 && _location.end >= 0) - length = _location.end - _location.start; - ret["src"] = to_string(_location.start) + ":" + to_string(length) + ":" + (m_sourceIndex.has_value() ? to_string(m_sourceIndex.value()) : "-1"); + auto srcLocation = [&](int start, int end) -> string + { + int length = (start >= 0 && end >= 0 && end >= start) ? end - start : -1; + return to_string(start) + ":" + to_string(length) + ":" + (m_sourceIndex.has_value() ? to_string(m_sourceIndex.value()) : "-1"); + }; + ret["src"] = srcLocation(_originLocation.start, _originLocation.end); + ret["nativeSrc"] = srcLocation(_nativeLocation.start, _nativeLocation.end); return ret; } diff --git a/libyul/AsmJsonConverter.h b/libyul/AsmJsonConverter.h index 52e36d5cddab..236ecbba579c 100644 --- a/libyul/AsmJsonConverter.h +++ b/libyul/AsmJsonConverter.h @@ -62,7 +62,7 @@ class AsmJsonConverter: public boost::static_visitor Json::Value operator()(Label const& _node) const; private: - Json::Value createAstNode(langutil::SourceLocation const& _location, std::string _nodeType) const; + Json::Value createAstNode(langutil::SourceLocation const& _originLocation, langutil::SourceLocation const& _nativeLocation, std::string _nodeType) const; template Json::Value vectorOfVariantsToJson(std::vector const& vec) const; diff --git a/libyul/CMakeLists.txt b/libyul/CMakeLists.txt index cc7033a0b833..0bb98e4677fa 100644 --- a/libyul/CMakeLists.txt +++ b/libyul/CMakeLists.txt @@ -1,19 +1,3 @@ -# This will re-generate the polyfill headers, if any file within libyul/backends/wasm/polyfill/ was modified. -set_directory_properties(PROPERTY CMAKE_CONFIGURE_DEPENDS ${CMAKE_SOURCE_DIR}/libyul/backends/wasm/polyfill/) - -set(POLYFILLS Arithmetic Bitwise Comparison Conversion Interface Keccak Logical Memory) -set(GENERATED_POLYFILL_HEADERS) -foreach(polyfill IN LISTS POLYFILLS) - set(POLYFILL_FILE ${CMAKE_SOURCE_DIR}/libyul/backends/wasm/polyfill/${polyfill}.yul) - file(READ ${POLYFILL_FILE} EWASM_POLYFILL_CONTENT HEX) - string(REGEX MATCHALL ".." EWASM_POLYFILL_CONTENT "${EWASM_POLYFILL_CONTENT}") - string(REGEX REPLACE ";" ",\n\t0x" EWASM_POLYFILL_CONTENT "${EWASM_POLYFILL_CONTENT}") - set(EWASM_POLYFILL_CONTENT "0x${EWASM_POLYFILL_CONTENT}") - set(EWASM_POLYFILL_NAME ${polyfill}) - configure_file("${CMAKE_SOURCE_DIR}/cmake/templates/ewasm_polyfill.in" ${CMAKE_BINARY_DIR}/include/ewasmPolyfills/${polyfill}.h @ONLY) - list(APPEND GENERATED_POLYFILL_HEADERS ${CMAKE_BINARY_DIR}/include/ewasmPolyfills/${polyfill}.h) -endforeach() - add_library(yul ${GENERATED_POLYFILL_HEADERS} @@ -80,20 +64,6 @@ add_library(yul backends/evm/StackLayoutGenerator.h backends/evm/VariableReferenceCounter.h backends/evm/VariableReferenceCounter.cpp - backends/wasm/EVMToEwasmTranslator.cpp - backends/wasm/EVMToEwasmTranslator.h - backends/wasm/BinaryTransform.cpp - backends/wasm/BinaryTransform.h - backends/wasm/TextTransform.cpp - backends/wasm/TextTransform.h - backends/wasm/WasmCodeTransform.cpp - backends/wasm/WasmCodeTransform.h - backends/wasm/WasmDialect.cpp - backends/wasm/WasmDialect.h - backends/wasm/WasmObjectCompiler.cpp - backends/wasm/WasmObjectCompiler.h - backends/wasm/WordSizeTransform.cpp - backends/wasm/WordSizeTransform.h optimiser/ASTCopier.cpp optimiser/ASTCopier.h optimiser/ASTWalker.cpp @@ -173,8 +143,6 @@ add_library(yul optimiser/OptimiserStep.h optimiser/OptimizerUtilities.cpp optimiser/OptimizerUtilities.h - optimiser/ReasoningBasedSimplifier.cpp - optimiser/ReasoningBasedSimplifier.h optimiser/UnusedAssignEliminator.cpp optimiser/UnusedAssignEliminator.h optimiser/UnusedStoreBase.cpp @@ -183,8 +151,6 @@ add_library(yul optimiser/UnusedStoreEliminator.h optimiser/Rematerialiser.cpp optimiser/Rematerialiser.h - optimiser/SMTSolver.cpp - optimiser/SMTSolver.h optimiser/SSAReverser.cpp optimiser/SSAReverser.h optimiser/SSATransform.cpp diff --git a/libyul/CompilabilityChecker.cpp b/libyul/CompilabilityChecker.cpp index acb48cfa5488..b9b51731b1ea 100644 --- a/libyul/CompilabilityChecker.cpp +++ b/libyul/CompilabilityChecker.cpp @@ -63,7 +63,9 @@ CompilabilityChecker::CompilabilityChecker( for (StackTooDeepError const& error: transform.stackErrors()) { - unreachableVariables[error.functionName].emplace(error.variable); + auto& unreachables = unreachableVariables[error.functionName]; + if (!util::contains(unreachables, error.variable)) + unreachables.emplace_back(error.variable); int& deficit = stackDeficit[error.functionName]; deficit = std::max(error.depth, deficit); } diff --git a/libyul/CompilabilityChecker.h b/libyul/CompilabilityChecker.h index 307d719e4b0e..c046df94ffb9 100644 --- a/libyul/CompilabilityChecker.h +++ b/libyul/CompilabilityChecker.h @@ -45,7 +45,7 @@ namespace solidity::yul struct CompilabilityChecker { CompilabilityChecker(Dialect const& _dialect, Object const& _object, bool _optimizeStackAllocation); - std::map> unreachableVariables; + std::map> unreachableVariables; std::map stackDeficit; }; diff --git a/libyul/Object.cpp b/libyul/Object.cpp index cf68ff765fd1..97857aa4baa0 100644 --- a/libyul/Object.cpp +++ b/libyul/Object.cpp @@ -22,6 +22,8 @@ #include #include +#include +#include #include #include @@ -88,6 +90,34 @@ string Object::toString( return useSrcComment + "object \"" + name.str() + "\" {\n" + indent(inner) + "\n}"; } +Json::Value Data::toJson() const +{ + Json::Value ret{Json::objectValue}; + ret["nodeType"] = "YulData"; + ret["value"] = util::toHex(data); + return ret; +} + +Json::Value Object::toJson() const +{ + yulAssert(code, "No code"); + + Json::Value codeJson{Json::objectValue}; + codeJson["nodeType"] = "YulCode"; + codeJson["block"] = AsmJsonConverter(0 /* sourceIndex */)(*code); + + Json::Value subObjectsJson{Json::arrayValue}; + for (shared_ptr const& subObject: subObjects) + subObjectsJson.append(subObject->toJson()); + + Json::Value ret{Json::objectValue}; + ret["nodeType"] = "YulObject"; + ret["name"] = name.str(); + ret["code"] = codeJson; + ret["subObjects"] = subObjectsJson; + return ret; +} + set Object::qualifiedDataNames() const { set qualifiedNames = diff --git a/libyul/Object.h b/libyul/Object.h index f3c4ee34a550..5f88d3bc7ff6 100644 --- a/libyul/Object.h +++ b/libyul/Object.h @@ -32,13 +32,13 @@ #include #include #include +#include namespace solidity::yul { struct Dialect; struct AsmAnalysisInfo; - using SourceNameMap = std::map>; struct Object; @@ -58,6 +58,7 @@ struct ObjectNode langutil::DebugInfoSelection const& _debugInfoSelection, langutil::CharStreamProvider const* _soliditySourceProvider ) const = 0; + virtual Json::Value toJson() const = 0; }; /** @@ -74,6 +75,7 @@ struct Data: public ObjectNode langutil::DebugInfoSelection const& _debugInfoSelection, langutil::CharStreamProvider const* _soliditySourceProvider ) const override; + Json::Value toJson() const override; }; @@ -95,7 +97,8 @@ struct Object: public ObjectNode langutil::DebugInfoSelection const& _debugInfoSelection = langutil::DebugInfoSelection::Default(), langutil::CharStreamProvider const* _soliditySourceProvider = nullptr ) const; - + /// @returns a compact JSON representation of the AST. + Json::Value toJson() const; /// @returns the set of names of data objects accessible from within the code of /// this object, including the name of object itself /// Handles all names containing dots as reserved identifiers, not accessible as data. diff --git a/libyul/YulStack.cpp b/libyul/YulStack.cpp index f258de6a84c7..66acc3f60eb6 100644 --- a/libyul/YulStack.cpp +++ b/libyul/YulStack.cpp @@ -16,8 +16,7 @@ */ // SPDX-License-Identifier: GPL-3.0 /** - * Full assembly stack that can support EVM-assembly and Yul as input and EVM, EVM1.5 and - * Ewasm as output. + * Full assembly stack that can support EVM-assembly and Yul as input and EVM, EVM1.5 */ @@ -30,15 +29,14 @@ #include #include #include -#include -#include -#include #include +#include #include - #include #include + #include + #include using namespace std; @@ -57,8 +55,6 @@ Dialect const& languageToDialect(YulStack::Language _language, EVMVersion _versi return EVMDialect::strictAssemblyForEVMObjects(_version); case YulStack::Language::Yul: return EVMDialectTyped::instance(_version); - case YulStack::Language::Ewasm: - return WasmDialect::instance(); } yulAssert(false, ""); return Dialect::yulDeprecated(); @@ -91,10 +87,14 @@ bool YulStack::parseAndAnalyze(std::string const& _sourceName, std::string const void YulStack::optimize() { - if (!m_optimiserSettings.runYulOptimiser) - return; - yulAssert(m_analysisSuccessful, "Analysis was not successful."); + yulAssert(m_parserResult); + + if ( + !m_optimiserSettings.runYulOptimiser && + yul::MSizeFinder::containsMSize(languageToDialect(m_language, m_evmVersion), *m_parserResult) + ) + return; m_analysisSuccessful = false; yulAssert(m_parserResult, ""); @@ -102,24 +102,6 @@ void YulStack::optimize() yulAssert(analyzeParsed(), "Invalid source code after optimization."); } -void YulStack::translate(YulStack::Language _targetLanguage) -{ - if (m_language == _targetLanguage) - return; - - yulAssert( - m_language == Language::StrictAssembly && _targetLanguage == Language::Ewasm, - "Invalid language combination" - ); - - *m_parserResult = EVMToEwasmTranslator( - languageToDialect(m_language, m_evmVersion), - *this - ).run(*parserResult()); - - m_language = _targetLanguage; -} - bool YulStack::analyzeParsed() { yulAssert(m_parserResult, ""); @@ -182,13 +164,15 @@ void YulStack::optimize(Object& _object, bool _isCreation) unique_ptr meter; if (EVMDialect const* evmDialect = dynamic_cast(&dialect)) meter = make_unique(*evmDialect, _isCreation, m_optimiserSettings.expectedExecutionsPerDeployment); + OptimiserSuite::run( dialect, meter.get(), _object, - m_optimiserSettings.optimizeStackAllocation, - m_optimiserSettings.yulOptimiserSteps, - m_optimiserSettings.yulOptimiserCleanupSteps, + // Defaults are the minimum necessary to avoid running into "Stack too deep" constantly. + m_optimiserSettings.runYulOptimiser ? m_optimiserSettings.optimizeStackAllocation : true, + m_optimiserSettings.runYulOptimiser ? m_optimiserSettings.yulOptimiserSteps : "u", + m_optimiserSettings.runYulOptimiser ? m_optimiserSettings.yulOptimiserCleanupSteps : "", _isCreation ? nullopt : make_optional(m_optimiserSettings.expectedExecutionsPerDeployment), {} ); @@ -205,18 +189,6 @@ MachineAssemblyObject YulStack::assemble(Machine _machine) const { case Machine::EVM: return assembleWithDeployed().first; - case Machine::Ewasm: - { - yulAssert(m_language == Language::Ewasm, ""); - Dialect const& dialect = languageToDialect(m_language, EVMVersion{}); - - MachineAssemblyObject object; - auto result = WasmObjectCompiler::compile(*m_parserResult, dialect); - object.assembly = std::move(result.first); - object.bytecode = make_shared(); - object.bytecode->bytecode = std::move(result.second); - return object; - } } // unreachable return MachineAssemblyObject(); @@ -266,7 +238,15 @@ YulStack::assembleEVMWithDeployed(optional _deployName) const evmasm::Assembly assembly(m_evmVersion, true, {}); EthAssemblyAdapter adapter(assembly); - compileEVM(adapter, m_optimiserSettings.optimizeStackAllocation); + + // NOTE: We always need stack optimization when Yul optimizer is disabled (unless code contains + // msize). It being disabled just means that we don't use the full step sequence. We still run + // it with the minimal steps required to avoid "stack too deep". + bool optimize = m_optimiserSettings.optimizeStackAllocation || ( + !m_optimiserSettings.runYulOptimiser && + !yul::MSizeFinder::containsMSize(languageToDialect(m_language, m_evmVersion), *m_parserResult) + ); + compileEVM(adapter, optimize); assembly.optimise(evmasm::Assembly::OptimiserSettings::translateSettings(m_optimiserSettings, m_evmVersion)); @@ -306,6 +286,13 @@ string YulStack::print( return m_parserResult->toString(&languageToDialect(m_language, m_evmVersion), m_debugInfoSelection, _soliditySourceProvider) + "\n"; } +Json::Value YulStack::astJson() const +{ + yulAssert(m_parserResult, ""); + yulAssert(m_parserResult->code, ""); + return m_parserResult->toJson(); +} + shared_ptr YulStack::parserResult() const { yulAssert(m_analysisSuccessful, "Analysis was not successful."); diff --git a/libyul/YulStack.h b/libyul/YulStack.h index 5c57b56fa58d..700fd2b3baa3 100644 --- a/libyul/YulStack.h +++ b/libyul/YulStack.h @@ -16,8 +16,7 @@ */ // SPDX-License-Identifier: GPL-3.0 /** - * Full assembly stack that can support EVM-assembly and Yul as input and EVM, EVM1.5 and - * Ewasm as output. + * Full assembly stack that can support EVM-assembly and Yul as input and EVM. */ #pragma once @@ -34,6 +33,8 @@ #include +#include + #include #include @@ -60,14 +61,13 @@ struct MachineAssemblyObject }; /* - * Full assembly stack that can support EVM-assembly and Yul as input and EVM, EVM1.5 and - * Ewasm as output. + * Full assembly stack that can support EVM-assembly and Yul as input and EVM as output. */ class YulStack: public langutil::CharStreamProvider { public: - enum class Language { Yul, Assembly, StrictAssembly, Ewasm }; - enum class Machine { EVM, Ewasm }; + enum class Language { Yul, Assembly, StrictAssembly }; + enum class Machine { EVM }; YulStack(): YulStack( @@ -105,9 +105,6 @@ class YulStack: public langutil::CharStreamProvider /// If the settings (see constructor) disabled the optimizer, nothing is done here. void optimize(); - /// Translate the source to a different language / dialect. - void translate(Language _targetLanguage); - /// Run the assembly step (should only be called after parseAndAnalyze). MachineAssemblyObject assemble(Machine _machine) const; @@ -135,7 +132,7 @@ class YulStack: public langutil::CharStreamProvider std::string print( langutil::CharStreamProvider const* _soliditySourceProvider = nullptr ) const; - + Json::Value astJson() const; /// Return the parsed and analyzed object. std::shared_ptr parserResult() const; diff --git a/libyul/backends/evm/StackLayoutGenerator.cpp b/libyul/backends/evm/StackLayoutGenerator.cpp index 2d5cdde87fd0..71bf19458b86 100644 --- a/libyul/backends/evm/StackLayoutGenerator.cpp +++ b/libyul/backends/evm/StackLayoutGenerator.cpp @@ -51,10 +51,10 @@ using namespace std; StackLayout StackLayoutGenerator::run(CFG const& _cfg) { StackLayout stackLayout; - StackLayoutGenerator{stackLayout}.processEntryPoint(*_cfg.entry); + StackLayoutGenerator{stackLayout, nullptr}.processEntryPoint(*_cfg.entry); for (auto& functionInfo: _cfg.functionInfo | ranges::views::values) - StackLayoutGenerator{stackLayout}.processEntryPoint(*functionInfo.entry, &functionInfo); + StackLayoutGenerator{stackLayout, &functionInfo}.processEntryPoint(*functionInfo.entry, &functionInfo); return stackLayout; } @@ -83,13 +83,15 @@ vector StackLayoutGenerator::reportStackTooD yulAssert(functionInfo, "Function not found."); } - StackLayoutGenerator generator{stackLayout}; + StackLayoutGenerator generator{stackLayout, functionInfo}; CFG::BasicBlock const* entry = functionInfo ? functionInfo->entry : _cfg.entry; generator.processEntryPoint(*entry); return generator.reportStackTooDeep(*entry); } -StackLayoutGenerator::StackLayoutGenerator(StackLayout& _layout): m_layout(_layout) +StackLayoutGenerator::StackLayoutGenerator(StackLayout& _layout, CFG::FunctionInfo const* _functionInfo): + m_layout(_layout), + m_currentFunctionInfo(_functionInfo) { } @@ -740,7 +742,7 @@ void StackLayoutGenerator::fillInJunk(CFG::BasicBlock const& _block, CFG::Functi }); }; /// @returns the number of operations required to transform @a _source to @a _target. - auto evaluateTransform = [](Stack _source, Stack const& _target) -> size_t { + auto evaluateTransform = [&](Stack _source, Stack const& _target) -> size_t { size_t opGas = 0; auto swap = [&](unsigned _swapDepth) { @@ -755,12 +757,23 @@ void StackLayoutGenerator::fillInJunk(CFG::BasicBlock const& _block, CFG::Functi opGas += evmasm::GasMeter::runGas(evmasm::pushInstruction(32), langutil::EVMVersion()); else { - auto depth = util::findOffset(_source | ranges::views::reverse, _slot); - yulAssert(depth); - if (*depth < 16) - opGas += evmasm::GasMeter::runGas(evmasm::dupInstruction(static_cast(*depth + 1)), langutil::EVMVersion()); + if (auto depth = util::findOffset(_source | ranges::views::reverse, _slot)) + { + if (*depth < 16) + opGas += evmasm::GasMeter::runGas(evmasm::dupInstruction(static_cast(*depth + 1)), langutil::EVMVersion()); + else + opGas += 1000; + } else - opGas += 1000; + { + // This has to be a previously unassigned return variable. + // We at least sanity-check that it is among the return variables at all. + yulAssert(m_currentFunctionInfo && holds_alternative(_slot)); + yulAssert(util::contains(m_currentFunctionInfo->returnVariables, get(_slot))); + // Strictly speaking the cost of the PUSH0 depends on the targeted EVM version, but the difference + // will not matter here. + opGas += evmasm::GasMeter::runGas(evmasm::pushInstruction(0), langutil::EVMVersion());; + } } }; auto pop = [&]() { opGas += evmasm::GasMeter::runGas(evmasm::Instruction::POP,langutil::EVMVersion()); }; diff --git a/libyul/backends/evm/StackLayoutGenerator.h b/libyul/backends/evm/StackLayoutGenerator.h index 40b554cd6038..d04b80bdc02a 100644 --- a/libyul/backends/evm/StackLayoutGenerator.h +++ b/libyul/backends/evm/StackLayoutGenerator.h @@ -66,7 +66,7 @@ class StackLayoutGenerator static std::vector reportStackTooDeep(CFG const& _cfg, YulString _functionName); private: - StackLayoutGenerator(StackLayout& _context); + StackLayoutGenerator(StackLayout& _context, CFG::FunctionInfo const* _functionInfo); /// @returns the optimal entry stack layout, s.t. @a _operation can be applied to it and /// the result can be transformed to @a _exitStack with minimal stack shuffling. @@ -115,6 +115,7 @@ class StackLayoutGenerator void fillInJunk(CFG::BasicBlock const& _block, CFG::FunctionInfo const* _functionInfo = nullptr); StackLayout& m_layout; + CFG::FunctionInfo const* m_currentFunctionInfo = nullptr; }; } diff --git a/libyul/backends/wasm/BinaryTransform.cpp b/libyul/backends/wasm/BinaryTransform.cpp deleted file mode 100644 index 03f385d805ca..000000000000 --- a/libyul/backends/wasm/BinaryTransform.cpp +++ /dev/null @@ -1,722 +0,0 @@ -/* - This file is part of solidity. - - solidity is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - solidity is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with solidity. If not, see . -*/ -// SPDX-License-Identifier: GPL-3.0 -/** - * Component that transforms internal Wasm representation to binary. - */ - -#include - -#include -#include -#include -#include - -#include -#include - -using namespace std; -using namespace solidity; -using namespace solidity::yul; -using namespace solidity::yul::wasm; -using namespace solidity::util; - -namespace -{ - -bytes toBytes(uint8_t _b) -{ - return bytes(1, _b); -} - -enum class LimitsKind: uint8_t -{ - Min = 0x00, - MinMax = 0x01, -}; - -enum class Mutability: uint8_t -{ - Const = 0x00, - Var = 0x01, -}; - -enum class Section: uint8_t -{ - CUSTOM = 0x00, - TYPE = 0x01, - IMPORT = 0x02, - FUNCTION = 0x03, - MEMORY = 0x05, - GLOBAL = 0x06, - EXPORT = 0x07, - CODE = 0x0a -}; - -bytes toBytes(Section _s) -{ - return toBytes(uint8_t(_s)); -} - -enum class ValueType: uint8_t -{ - Void = 0x40, - Function = 0x60, - I64 = 0x7e, - I32 = 0x7f -}; - -bytes toBytes(ValueType _vt) -{ - return toBytes(uint8_t(_vt)); -} - -ValueType toValueType(wasm::Type _type) -{ - if (_type == wasm::Type::i32) - return ValueType::I32; - else if (_type == wasm::Type::i64) - return ValueType::I64; - else - yulAssert(false, "Invalid wasm variable type"); -} - -enum class Export: uint8_t -{ - Function = 0x0, - Memory = 0x2 -}; - -bytes toBytes(Export _export) -{ - return toBytes(uint8_t(_export)); -} - -// NOTE: This is a subset of WebAssembly opcodes. -// Those available as a builtin are listed further down. -enum class Opcode: uint8_t -{ - Block = 0x02, - Loop = 0x03, - If = 0x04, - Else = 0x05, - End = 0x0b, - Br = 0x0c, - BrIf = 0x0d, - BrTable = 0x0e, // Not used yet. - Return = 0x0f, - Call = 0x10, - CallIndirect = 0x11, // Not used yet. - LocalGet = 0x20, - LocalSet = 0x21, - LocalTee = 0x22, // Not used yet. - GlobalGet = 0x23, - GlobalSet = 0x24, - I32Const = 0x41, - I64Const = 0x42, -}; - -bytes toBytes(Opcode _o) -{ - return toBytes(uint8_t(_o)); -} - -Opcode constOpcodeFor(ValueType _type) -{ - if (_type == ValueType::I32) - return Opcode::I32Const; - else if (_type == ValueType::I64) - return Opcode::I64Const; - else - yulAssert(false, "Values of this type cannot be used with const opcode"); -} - -static map const builtins = { - {"unreachable", 0x00}, - {"nop", 0x01}, - {"i32.drop", 0x1a}, - {"i64.drop", 0x1a}, - {"i32.select", 0x1b}, - {"i64.select", 0x1b}, - {"i32.load", 0x28}, - {"i64.load", 0x29}, - {"i32.load8_s", 0x2c}, - {"i32.load8_u", 0x2d}, - {"i32.load16_s", 0x2e}, - {"i32.load16_u", 0x2f}, - {"i64.load8_s", 0x30}, - {"i64.load8_u", 0x31}, - {"i64.load16_s", 0x32}, - {"i64.load16_u", 0x33}, - {"i64.load32_s", 0x34}, - {"i64.load32_u", 0x35}, - {"i32.store", 0x36}, - {"i64.store", 0x37}, - {"i32.store8", 0x3a}, - {"i32.store16", 0x3b}, - {"i64.store8", 0x3c}, - {"i64.store16", 0x3d}, - {"i64.store32", 0x3e}, - {"memory.size", 0x3f}, - {"memory.grow", 0x40}, - {"i32.eqz", 0x45}, - {"i32.eq", 0x46}, - {"i32.ne", 0x47}, - {"i32.lt_s", 0x48}, - {"i32.lt_u", 0x49}, - {"i32.gt_s", 0x4a}, - {"i32.gt_u", 0x4b}, - {"i32.le_s", 0x4c}, - {"i32.le_u", 0x4d}, - {"i32.ge_s", 0x4e}, - {"i32.ge_u", 0x4f}, - {"i64.eqz", 0x50}, - {"i64.eq", 0x51}, - {"i64.ne", 0x52}, - {"i64.lt_s", 0x53}, - {"i64.lt_u", 0x54}, - {"i64.gt_s", 0x55}, - {"i64.gt_u", 0x56}, - {"i64.le_s", 0x57}, - {"i64.le_u", 0x58}, - {"i64.ge_s", 0x59}, - {"i64.ge_u", 0x5a}, - {"i32.clz", 0x67}, - {"i32.ctz", 0x68}, - {"i32.popcnt", 0x69}, - {"i32.add", 0x6a}, - {"i32.sub", 0x6b}, - {"i32.mul", 0x6c}, - {"i32.div_s", 0x6d}, - {"i32.div_u", 0x6e}, - {"i32.rem_s", 0x6f}, - {"i32.rem_u", 0x70}, - {"i32.and", 0x71}, - {"i32.or", 0x72}, - {"i32.xor", 0x73}, - {"i32.shl", 0x74}, - {"i32.shr_s", 0x75}, - {"i32.shr_u", 0x76}, - {"i32.rotl", 0x77}, - {"i32.rotr", 0x78}, - {"i64.clz", 0x79}, - {"i64.ctz", 0x7a}, - {"i64.popcnt", 0x7b}, - {"i64.add", 0x7c}, - {"i64.sub", 0x7d}, - {"i64.mul", 0x7e}, - {"i64.div_s", 0x7f}, - {"i64.div_u", 0x80}, - {"i64.rem_s", 0x81}, - {"i64.rem_u", 0x82}, - {"i64.and", 0x83}, - {"i64.or", 0x84}, - {"i64.xor", 0x85}, - {"i64.shl", 0x86}, - {"i64.shr_s", 0x87}, - {"i64.shr_u", 0x88}, - {"i64.rotl", 0x89}, - {"i64.rotr", 0x8a}, - {"i32.wrap_i64", 0xa7}, - {"i64.extend_i32_s", 0xac}, - {"i64.extend_i32_u", 0xad}, -}; - -bytes prefixSize(bytes _data) -{ - size_t size = _data.size(); - return lebEncode(size) + std::move(_data); -} - -bytes makeSection(Section _section, bytes _data) -{ - return toBytes(_section) + prefixSize(std::move(_data)); -} - -/// This is a kind of run-length-encoding of local types. -vector> groupLocalVariables(vector _localVariables) -{ - vector> localEntries; - - size_t entrySize = 0; - ValueType entryType = ValueType::I32; // Any type would work here - for (VariableDeclaration const& localVariable: _localVariables) - { - ValueType variableType = toValueType(localVariable.type); - - if (variableType != entryType) - { - if (entrySize > 0) - localEntries.emplace_back(entrySize, entryType); - - entryType = variableType; - entrySize = 0; - } - - ++entrySize; - } - if (entrySize > 0) - localEntries.emplace_back(entrySize, entryType); - - return localEntries; -} - -} - -bytes BinaryTransform::run(Module const& _module) -{ - map> const types = typeToFunctionMap(_module.imports, _module.functions); - - map const globalIDs = enumerateGlobals(_module); - map const functionIDs = enumerateFunctions(_module); - map const functionTypes = enumerateFunctionTypes(types); - - yulAssert(globalIDs.size() == _module.globals.size(), ""); - yulAssert(functionIDs.size() == _module.imports.size() + _module.functions.size(), ""); - yulAssert(functionTypes.size() == functionIDs.size(), ""); - yulAssert(functionTypes.size() >= types.size(), ""); - - bytes ret{0, 'a', 's', 'm'}; - // version - ret += bytes{1, 0, 0, 0}; - ret += typeSection(types); - ret += importSection(_module.imports, functionTypes); - ret += functionSection(_module.functions, functionTypes); - ret += memorySection(); - ret += globalSection(_module.globals); - ret += exportSection(functionIDs); - - map> subModulePosAndSize; - for (auto const& [name, module]: _module.subModules) - { - // TODO should we prefix and / or shorten the name? - bytes data = BinaryTransform::run(module); - size_t const length = data.size(); - ret += customSection(name, std::move(data)); - // Skip all the previous sections and the size field of this current custom section. - size_t const offset = ret.size() - length; - subModulePosAndSize[name] = {offset, length}; - } - for (auto const& [name, data]: _module.customSections) - { - size_t const length = data.size(); - ret += customSection(name, data); - // Skip all the previous sections and the size field of this current custom section. - size_t const offset = ret.size() - length; - subModulePosAndSize[name] = {offset, length}; - } - - BinaryTransform bt( - std::move(globalIDs), - std::move(functionIDs), - std::move(functionTypes), - std::move(subModulePosAndSize) - ); - - ret += bt.codeSection(_module.functions); - return ret; -} - -bytes BinaryTransform::operator()(Literal const& _literal) -{ - return std::visit(GenericVisitor{ - [&](uint32_t _value) -> bytes { return toBytes(Opcode::I32Const) + lebEncodeSigned(static_cast(_value)); }, - [&](uint64_t _value) -> bytes { return toBytes(Opcode::I64Const) + lebEncodeSigned(static_cast(_value)); }, - }, _literal.value); -} - -bytes BinaryTransform::operator()(StringLiteral const&) -{ - // StringLiteral is a special AST element used for certain builtins. - // It is not mapped to actual WebAssembly, and should be processed in visit(BuiltinCall). - yulAssert(false, ""); -} - -bytes BinaryTransform::operator()(LocalVariable const& _variable) -{ - return toBytes(Opcode::LocalGet) + lebEncode(m_locals.at(_variable.name)); -} - -bytes BinaryTransform::operator()(GlobalVariable const& _variable) -{ - return toBytes(Opcode::GlobalGet) + lebEncode(m_globalIDs.at(_variable.name)); -} - -bytes BinaryTransform::operator()(BuiltinCall const& _call) -{ - // We need to avoid visiting the arguments of `dataoffset` and `datasize` because - // they are references to object names that should not end up in the code. - if (_call.functionName == "dataoffset") - { - string name = get(_call.arguments.at(0)).value; - // TODO: support the case where name refers to the current object - yulAssert(m_subModulePosAndSize.count(name), ""); - return toBytes(Opcode::I64Const) + lebEncodeSigned(static_cast(m_subModulePosAndSize.at(name).first)); - } - else if (_call.functionName == "datasize") - { - string name = get(_call.arguments.at(0)).value; - // TODO: support the case where name refers to the current object - yulAssert(m_subModulePosAndSize.count(name), ""); - return toBytes(Opcode::I64Const) + lebEncodeSigned(static_cast(m_subModulePosAndSize.at(name).second)); - } - - yulAssert(builtins.count(_call.functionName), "Builtin " + _call.functionName + " not found"); - // NOTE: the dialect ensures we have the right amount of arguments - bytes args = visit(_call.arguments); - bytes ret = std::move(args) + toBytes(builtins.at(_call.functionName)); - if ( - _call.functionName.find(".load") != string::npos || - _call.functionName.find(".store") != string::npos - ) - // Alignment hint and offset. Interpreters ignore the alignment. JITs/AOTs can take it - // into account to generate more efficient code but if the hint is invalid it could - // actually be more expensive. It's best to hint at 1-byte alignment if we don't plan - // to control the memory layout accordingly. - ret += bytes{{0, 0}}; // 2^0 == 1-byte alignment - - return ret; -} - -bytes BinaryTransform::operator()(FunctionCall const& _call) -{ - return visit(_call.arguments) + toBytes(Opcode::Call) + lebEncode(m_functionIDs.at(_call.functionName)); -} - -bytes BinaryTransform::operator()(LocalAssignment const& _assignment) -{ - return - std::visit(*this, *_assignment.value) + - toBytes(Opcode::LocalSet) + - lebEncode(m_locals.at(_assignment.variableName)); -} - -bytes BinaryTransform::operator()(GlobalAssignment const& _assignment) -{ - return - std::visit(*this, *_assignment.value) + - toBytes(Opcode::GlobalSet) + - lebEncode(m_globalIDs.at(_assignment.variableName)); -} - -bytes BinaryTransform::operator()(If const& _if) -{ - bytes result = - std::visit(*this, *_if.condition) + - toBytes(Opcode::If) + - toBytes(ValueType::Void); - - m_labels.emplace_back(); - - result += visit(_if.statements); - if (_if.elseStatements) - result += toBytes(Opcode::Else) + visit(*_if.elseStatements); - - m_labels.pop_back(); - - result += toBytes(Opcode::End); - return result; -} - -bytes BinaryTransform::operator()(Loop const& _loop) -{ - bytes result = toBytes(Opcode::Loop) + toBytes(ValueType::Void); - - m_labels.emplace_back(_loop.labelName); - result += visit(_loop.statements); - m_labels.pop_back(); - - result += toBytes(Opcode::End); - return result; -} - -bytes BinaryTransform::operator()(Branch const& _branch) -{ - return toBytes(Opcode::Br) + encodeLabelIdx(_branch.label.name); -} - -bytes BinaryTransform::operator()(BranchIf const& _branchIf) -{ - bytes result = std::visit(*this, *_branchIf.condition); - result += toBytes(Opcode::BrIf) + encodeLabelIdx(_branchIf.label.name); - return result; -} - -bytes BinaryTransform::operator()(Return const&) -{ - // Note that this does not work if the function returns a value. - return toBytes(Opcode::Return); -} - -bytes BinaryTransform::operator()(Block const& _block) -{ - m_labels.emplace_back(_block.labelName); - bytes result = - toBytes(Opcode::Block) + - toBytes(ValueType::Void) + - visit(_block.statements) + - toBytes(Opcode::End); - m_labels.pop_back(); - return result; -} - -bytes BinaryTransform::operator()(FunctionDefinition const& _function) -{ - bytes ret; - - vector> localEntries = groupLocalVariables(_function.locals); - ret += lebEncode(localEntries.size()); - for (pair const& entry: localEntries) - { - ret += lebEncode(entry.first); - ret += toBytes(entry.second); - } - - m_locals.clear(); - size_t varIdx = 0; - for (size_t i = 0; i < _function.parameters.size(); ++i) - m_locals[_function.parameters[i].name] = varIdx++; - for (size_t i = 0; i < _function.locals.size(); ++i) - m_locals[_function.locals[i].variableName] = varIdx++; - - yulAssert(m_labels.empty(), "Stray labels."); - - ret += visit(_function.body); - ret += toBytes(Opcode::End); - - yulAssert(m_labels.empty(), "Stray labels."); - - return prefixSize(std::move(ret)); -} - -BinaryTransform::Type BinaryTransform::typeOf(FunctionImport const& _import) -{ - return { - encodeTypes(_import.paramTypes), - encodeTypes(_import.returnType ? vector(1, *_import.returnType) : vector()) - }; -} - -BinaryTransform::Type BinaryTransform::typeOf(FunctionDefinition const& _funDef) -{ - return { - encodeTypes(_funDef.parameters), - encodeTypes(_funDef.returnType ? vector(1, *_funDef.returnType) : vector()) - }; -} - -uint8_t BinaryTransform::encodeType(wasm::Type _type) -{ - return uint8_t(toValueType(_type)); -} - -vector BinaryTransform::encodeTypes(vector const& _types) -{ - vector result; - for (wasm::Type t: _types) - result.emplace_back(encodeType(t)); - return result; -} - -vector BinaryTransform::encodeTypes(wasm::TypedNameList const& _typedNameList) -{ - vector result; - for (TypedName const& typedName: _typedNameList) - result.emplace_back(encodeType(typedName.type)); - return result; -} - -map> BinaryTransform::typeToFunctionMap( - vector const& _imports, - vector const& _functions -) -{ - map> types; - for (auto const& import: _imports) - types[typeOf(import)].emplace_back(import.internalName); - for (auto const& fun: _functions) - types[typeOf(fun)].emplace_back(fun.name); - - return types; -} - -map BinaryTransform::enumerateGlobals(Module const& _module) -{ - map globals; - for (size_t i = 0; i < _module.globals.size(); ++i) - globals[_module.globals[i].variableName] = i; - - return globals; -} - -map BinaryTransform::enumerateFunctions(Module const& _module) -{ - map functions; - size_t funID = 0; - for (FunctionImport const& fun: _module.imports) - functions[fun.internalName] = funID++; - for (FunctionDefinition const& fun: _module.functions) - functions[fun.name] = funID++; - - return functions; -} - -map BinaryTransform::enumerateFunctionTypes(map> const& _typeToFunctionMap) -{ - map functionTypes; - size_t typeID = 0; - for (vector const& funNames: _typeToFunctionMap | ranges::views::values) - { - for (string const& name: funNames) - functionTypes[name] = typeID; - ++typeID; - } - - return functionTypes; -} - -bytes BinaryTransform::typeSection(map> const& _typeToFunctionMap) -{ - bytes result; - size_t index = 0; - for (Type const& type: _typeToFunctionMap | ranges::views::keys) - { - result += toBytes(ValueType::Function); - result += lebEncode(type.first.size()) + type.first; - result += lebEncode(type.second.size()) + type.second; - - index++; - } - - return makeSection(Section::TYPE, lebEncode(index) + std::move(result)); -} - -bytes BinaryTransform::importSection( - vector const& _imports, - map const& _functionTypes -) -{ - bytes result = lebEncode(_imports.size()); - for (FunctionImport const& import: _imports) - { - uint8_t importKind = 0; // function - result += - encodeName(import.module) + - encodeName(import.externalName) + - toBytes(importKind) + - lebEncode(_functionTypes.at(import.internalName)); - } - return makeSection(Section::IMPORT, std::move(result)); -} - -bytes BinaryTransform::functionSection( - vector const& _functions, - map const& _functionTypes -) -{ - bytes result = lebEncode(_functions.size()); - for (auto const& fun: _functions) - result += lebEncode(_functionTypes.at(fun.name)); - return makeSection(Section::FUNCTION, std::move(result)); -} - -bytes BinaryTransform::memorySection() -{ - bytes result = lebEncode(1); - result.push_back(static_cast(LimitsKind::Min)); - result.push_back(1); // initial length - return makeSection(Section::MEMORY, std::move(result)); -} - -bytes BinaryTransform::globalSection(vector const& _globals) -{ - bytes result = lebEncode(_globals.size()); - for (wasm::GlobalVariableDeclaration const& global: _globals) - { - ValueType globalType = toValueType(global.type); - result += - toBytes(globalType) + - lebEncode(static_cast(Mutability::Var)) + - toBytes(constOpcodeFor(globalType)) + - lebEncodeSigned(0) + - toBytes(Opcode::End); - } - - return makeSection(Section::GLOBAL, std::move(result)); -} - -bytes BinaryTransform::exportSection(map const& _functionIDs) -{ - bool hasMain = _functionIDs.count("main"); - bytes result = lebEncode(hasMain ? 2 : 1); - result += encodeName("memory") + toBytes(Export::Memory) + lebEncode(0); - if (hasMain) - result += encodeName("main") + toBytes(Export::Function) + lebEncode(_functionIDs.at("main")); - return makeSection(Section::EXPORT, std::move(result)); -} - -bytes BinaryTransform::customSection(string const& _name, bytes _data) -{ - bytes result = encodeName(_name) + std::move(_data); - return makeSection(Section::CUSTOM, std::move(result)); -} - -bytes BinaryTransform::codeSection(vector const& _functions) -{ - bytes result = lebEncode(_functions.size()); - for (FunctionDefinition const& fun: _functions) - result += (*this)(fun); - return makeSection(Section::CODE, std::move(result)); -} - -bytes BinaryTransform::visit(vector const& _expressions) -{ - bytes result; - for (auto const& expr: _expressions) - result += std::visit(*this, expr); - return result; -} - -bytes BinaryTransform::visitReversed(vector const& _expressions) -{ - bytes result; - for (auto const& expr: _expressions | ranges::views::reverse) - result += std::visit(*this, expr); - return result; -} - -bytes BinaryTransform::encodeLabelIdx(string const& _label) const -{ - yulAssert(!_label.empty(), "Empty label."); - size_t depth = 0; - for (string const& label: m_labels | ranges::views::reverse) - if (label == _label) - return lebEncode(depth); - else - ++depth; - yulAssert(false, "Label not found."); -} - -bytes BinaryTransform::encodeName(string const& _name) -{ - // UTF-8 is allowed here by the Wasm spec, but since all names here should stem from - // Solidity or Yul identifiers or similar, non-ascii characters ending up here - // is a very bad sign. - for (char c: _name) - yulAssert(uint8_t(c) <= 0x7f, "Non-ascii character found."); - return lebEncode(_name.size()) + asBytes(_name); -} diff --git a/libyul/backends/wasm/BinaryTransform.h b/libyul/backends/wasm/BinaryTransform.h deleted file mode 100644 index d164c11bf694..000000000000 --- a/libyul/backends/wasm/BinaryTransform.h +++ /dev/null @@ -1,124 +0,0 @@ -/* - This file is part of solidity. - - solidity is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - solidity is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with solidity. If not, see . -*/ -// SPDX-License-Identifier: GPL-3.0 -/** - * Component that transforms internal Wasm representation to binary. - */ - -#pragma once - -#include - -#include - -#include -#include - -namespace solidity::yul::wasm -{ - -/** - * Web assembly to binary transform. - */ -class BinaryTransform -{ -public: - static bytes run(Module const& _module); - - bytes operator()(wasm::Literal const& _literal); - bytes operator()(wasm::StringLiteral const& _literal); - bytes operator()(wasm::LocalVariable const& _identifier); - bytes operator()(wasm::GlobalVariable const& _identifier); - bytes operator()(wasm::BuiltinCall const& _builinCall); - bytes operator()(wasm::FunctionCall const& _functionCall); - bytes operator()(wasm::LocalAssignment const& _assignment); - bytes operator()(wasm::GlobalAssignment const& _assignment); - bytes operator()(wasm::If const& _if); - bytes operator()(wasm::Loop const& _loop); - bytes operator()(wasm::Branch const& _branch); - bytes operator()(wasm::BranchIf const& _branchIf); - bytes operator()(wasm::Return const& _return); - bytes operator()(wasm::Block const& _block); - bytes operator()(wasm::FunctionDefinition const& _function); - -private: - BinaryTransform( - std::map _globalIDs, - std::map _functionIDs, - std::map _functionTypes, - std::map> _subModulePosAndSize - ): - m_globalIDs(std::move(_globalIDs)), - m_functionIDs(std::move(_functionIDs)), - m_functionTypes(std::move(_functionTypes)), - m_subModulePosAndSize(std::move(_subModulePosAndSize)) - {} - - using Type = std::pair, std::vector>; - static Type typeOf(wasm::FunctionImport const& _import); - static Type typeOf(wasm::FunctionDefinition const& _funDef); - - static uint8_t encodeType(wasm::Type _type); - static std::vector encodeTypes(std::vector const& _types); - static std::vector encodeTypes(wasm::TypedNameList const& _typedNameList); - - static std::map> typeToFunctionMap( - std::vector const& _imports, - std::vector const& _functions - ); - - static std::map enumerateGlobals(Module const& _module); - static std::map enumerateFunctions(Module const& _module); - static std::map enumerateFunctionTypes( - std::map> const& _typeToFunctionMap - ); - - static bytes typeSection(std::map> const& _typeToFunctionMap); - static bytes importSection( - std::vector const& _imports, - std::map const& _functionTypes - ); - static bytes functionSection( - std::vector const& _functions, - std::map const& _functionTypes - ); - static bytes memorySection(); - static bytes globalSection(std::vector const& _globals); - static bytes exportSection(std::map const& _functionIDs); - static bytes customSection(std::string const& _name, bytes _data); - bytes codeSection(std::vector const& _functions); - - bytes visit(std::vector const& _expressions); - bytes visitReversed(std::vector const& _expressions); - - bytes encodeLabelIdx(std::string const& _label) const; - - static bytes encodeName(std::string const& _name); - - std::map const m_globalIDs; - std::map const m_functionIDs; - std::map const m_functionTypes; - /// The map of submodules, where the pair refers to the [offset, length]. The offset is - /// an absolute offset within the resulting assembled bytecode. - std::map> const m_subModulePosAndSize; - - std::map m_locals; - std::vector m_labels; -}; - -} - diff --git a/libyul/backends/wasm/EVMToEwasmTranslator.cpp b/libyul/backends/wasm/EVMToEwasmTranslator.cpp deleted file mode 100644 index d36b1cda3995..000000000000 --- a/libyul/backends/wasm/EVMToEwasmTranslator.cpp +++ /dev/null @@ -1,159 +0,0 @@ -/* - This file is part of solidity. - - solidity is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - solidity is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with solidity. If not, see . -*/ -// SPDX-License-Identifier: GPL-3.0 -/** - * Translates Yul code from EVM dialect to Ewasm dialect. - */ - -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include - -#include -#include -#include -#include - -#include - -// The following headers are generated from the -// yul files placed in libyul/backends/wasm/polyfill. - -#include -#include -#include -#include -#include -#include -#include -#include - -using namespace std; -using namespace solidity; -using namespace solidity::yul; -using namespace solidity::util; -using namespace solidity::langutil; - -Object EVMToEwasmTranslator::run(Object const& _object) -{ - if (!m_polyfill) - parsePolyfill(); - - Block ast = std::get(Disambiguator(m_dialect, *_object.analysisInfo)(*_object.code)); - set reservedIdentifiers; - NameDispenser nameDispenser{m_dialect, ast, reservedIdentifiers}; - // expectedExecutionsPerDeployment is currently unused. - OptimiserStepContext context{ - m_dialect, - nameDispenser, - reservedIdentifiers, - frontend::OptimiserSettings::standard().expectedExecutionsPerDeployment - }; - - FunctionHoister::run(context, ast); - FunctionGrouper::run(context, ast); - MainFunction::run(context, ast); - ForLoopConditionIntoBody::run(context, ast); - ExpressionSplitter::run(context, ast); - WordSizeTransform::run(m_dialect, WasmDialect::instance(), ast, nameDispenser); - - NameDisplacer{nameDispenser, m_polyfillFunctions}(ast); - for (auto const& st: m_polyfill->statements) - ast.statements.emplace_back(ASTCopier{}.translate(st)); - - Object ret; - ret.name = _object.name; - ret.code = make_shared(std::move(ast)); - ret.debugData = _object.debugData; - ret.analysisInfo = make_shared(); - - ErrorList errors; - ErrorReporter errorReporter(errors); - AsmAnalyzer analyzer(*ret.analysisInfo, errorReporter, WasmDialect::instance(), {}, _object.qualifiedDataNames()); - if (!analyzer.analyze(*ret.code)) - { - string message = "Invalid code generated after EVM to wasm translation.\n"; - message += "Note that the source locations in the errors below will reference the original, not the translated code.\n"; - message += "Translated code:\n"; - message += "----------------------------------\n"; - message += ret.toString(&WasmDialect::instance()); - message += "----------------------------------\n"; - for (auto const& err: errors) - message += langutil::SourceReferenceFormatter::formatErrorInformation(*err, m_charStreamProvider); - yulAssert(false, message); - } - - for (auto const& subObjectNode: _object.subObjects) - if (Object const* subObject = dynamic_cast(subObjectNode.get())) - ret.subObjects.push_back(make_shared(run(*subObject))); - else - ret.subObjects.push_back(make_shared(dynamic_cast(*subObjectNode))); - ret.subIndexByName = _object.subIndexByName; - - return ret; -} - -void EVMToEwasmTranslator::parsePolyfill() -{ - ErrorList errors; - ErrorReporter errorReporter(errors); - CharStream charStream( - "{" + - string(solidity::yul::wasm::polyfill::Arithmetic) + - string(solidity::yul::wasm::polyfill::Bitwise) + - string(solidity::yul::wasm::polyfill::Comparison) + - string(solidity::yul::wasm::polyfill::Conversion) + - string(solidity::yul::wasm::polyfill::Interface) + - string(solidity::yul::wasm::polyfill::Keccak) + - string(solidity::yul::wasm::polyfill::Logical) + - string(solidity::yul::wasm::polyfill::Memory) + - "}", ""); - - // Passing an empty SourceLocation() here is a workaround to prevent a crash - // when compiling from yul->ewasm. We're stripping nativeLocation and - // originLocation from the AST (but we only really need to strip nativeLocation) - m_polyfill = Parser(errorReporter, WasmDialect::instance(), langutil::SourceLocation()).parse(charStream); - if (!errors.empty()) - { - string message; - for (auto const& err: errors) - message += langutil::SourceReferenceFormatter::formatErrorInformation( - *err, - SingletonCharStreamProvider(charStream) - ); - yulAssert(false, message); - } - - m_polyfillFunctions.clear(); - for (auto const& statement: m_polyfill->statements) - m_polyfillFunctions.insert(std::get(statement).name); -} diff --git a/libyul/backends/wasm/EVMToEwasmTranslator.h b/libyul/backends/wasm/EVMToEwasmTranslator.h deleted file mode 100644 index 7f95f8d138ea..000000000000 --- a/libyul/backends/wasm/EVMToEwasmTranslator.h +++ /dev/null @@ -1,55 +0,0 @@ -/* - This file is part of solidity. - - solidity is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - solidity is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with solidity. If not, see . -*/ -// SPDX-License-Identifier: GPL-3.0 -/** - * Translates Yul code from EVM dialect to Ewasm dialect. - */ - -#pragma once - -#include -#include -#include - -namespace solidity::langutil -{ -class CharStreamProvider; -} -namespace solidity::yul -{ -struct Object; - -class EVMToEwasmTranslator: public ASTModifier -{ -public: - EVMToEwasmTranslator(Dialect const& _evmDialect, langutil::CharStreamProvider const& _charStreamProvider): - m_dialect(_evmDialect), - m_charStreamProvider(_charStreamProvider) - {} - Object run(Object const& _object); - -private: - void parsePolyfill(); - - Dialect const& m_dialect; - langutil::CharStreamProvider const& m_charStreamProvider; - - std::shared_ptr m_polyfill; - std::set m_polyfillFunctions; -}; - -} diff --git a/libyul/backends/wasm/TextTransform.cpp b/libyul/backends/wasm/TextTransform.cpp deleted file mode 100644 index 62596ba6e81b..000000000000 --- a/libyul/backends/wasm/TextTransform.cpp +++ /dev/null @@ -1,246 +0,0 @@ -/* - This file is part of solidity. - - solidity is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - solidity is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with solidity. If not, see . -*/ -// SPDX-License-Identifier: GPL-3.0 -/** - * Component that transforms internal Wasm representation to text. - */ - -#include -#include - -#include - -#include -#include -#include -#include -#include - -#include -#include - -#include - -using namespace std; -using namespace solidity; -using namespace solidity::yul; -using namespace solidity::yul::wasm; -using namespace solidity::util; - -string TextTransform::run(wasm::Module const& _module) -{ - string ret = "(module\n"; - for (auto const& [name, module]: _module.subModules) - ret += - " ;; custom section for sub-module\n" - " ;; The Keccak-256 hash of the text representation of \"" + - name + - "\": " + - toHex(keccak256(run(module))) + - "\n" - " ;; (@custom \"" + - name + - "\" \"" + - util::toHex(BinaryTransform::run(module)) + - "\")\n"; - for (auto const& [name, data]: _module.customSections) - ret += - " ;; custom section for data\n" - " ;; (@custom \"" + - name + - "\" \"" + - util::toHex(data) + - "\")\n"; - for (wasm::FunctionImport const& imp: _module.imports) - { - ret += " (import \"" + imp.module + "\" \"" + imp.externalName + "\" (func $" + imp.internalName; - if (!imp.paramTypes.empty()) - ret += " (param" + joinHumanReadablePrefixed(imp.paramTypes | ranges::views::transform(encodeType), " ", " ") + ")"; - if (imp.returnType) - ret += " (result " + encodeType(*imp.returnType) + ")"; - ret += "))\n"; - } - - // allocate one 64k page of memory and make it available to the Ethereum client - ret += " (memory $memory (export \"memory\") 1)\n"; - for (auto const& f: _module.functions) - if (f.name == "main") - { - // export the main function - ret += " (export \"main\" (func $main))\n"; - break; - } - - for (auto const& g: _module.globals) - ret += " (global $" + g.variableName + " (mut " + encodeType(g.type) + ") (" + encodeType(g.type) + ".const 0))\n"; - ret += "\n"; - for (auto const& f: _module.functions) - ret += transform(f) + "\n"; - return std::move(ret) + ")\n"; -} - -string TextTransform::operator()(wasm::Literal const& _literal) -{ - return std::visit(GenericVisitor{ - [&](uint32_t _value) -> string { return "(i32.const " + to_string(_value) + ")"; }, - [&](uint64_t _value) -> string { return "(i64.const " + to_string(_value) + ")"; }, - }, _literal.value); -} - -string TextTransform::operator()(wasm::StringLiteral const& _literal) -{ - // StringLiteral is a special AST element used for certain builtins. - // The output of this will not be valid WebAssembly. - string quoted = boost::replace_all_copy(_literal.value, "\\", "\\\\"); - boost::replace_all(quoted, "\"", "\\\""); - return "\"" + quoted + "\""; -} - -string TextTransform::operator()(wasm::LocalVariable const& _identifier) -{ - return "(local.get $" + _identifier.name + ")"; -} - -string TextTransform::operator()(wasm::GlobalVariable const& _identifier) -{ - return "(global.get $" + _identifier.name + ")"; -} - -string TextTransform::operator()(wasm::BuiltinCall const& _builtinCall) -{ - string args = joinTransformed(_builtinCall.arguments); - string funcName = _builtinCall.functionName; - // These are prefixed in the dialect, but are actually overloaded instructions in WebAssembly. - if (funcName == "i32.drop" || funcName == "i64.drop") - funcName = "drop"; - else if (funcName == "i32.select" || funcName == "i64.select") - funcName = "select"; - return "(" + funcName + (args.empty() ? "" : " " + args) + ")"; -} - -string TextTransform::operator()(wasm::FunctionCall const& _functionCall) -{ - string args = joinTransformed(_functionCall.arguments); - return "(call $" + _functionCall.functionName + (args.empty() ? "" : " " + args) + ")"; -} - -string TextTransform::operator()(wasm::LocalAssignment const& _assignment) -{ - return "(local.set $" + _assignment.variableName + " " + visit(*_assignment.value) + ")\n"; -} - -string TextTransform::operator()(wasm::GlobalAssignment const& _assignment) -{ - return "(global.set $" + _assignment.variableName + " " + visit(*_assignment.value) + ")\n"; -} - -string TextTransform::operator()(wasm::If const& _if) -{ - string text = "(if " + visit(*_if.condition) + " (then\n" + indented(joinTransformed(_if.statements, '\n')) + ")"; - if (_if.elseStatements) - text += "(else\n" + indented(joinTransformed(*_if.elseStatements, '\n')) + ")"; - return std::move(text) + ")\n"; -} - -string TextTransform::operator()(wasm::Loop const& _loop) -{ - string label = _loop.labelName.empty() ? "" : " $" + _loop.labelName; - return "(loop" + std::move(label) + "\n" + indented(joinTransformed(_loop.statements, '\n')) + ")\n"; -} - -string TextTransform::operator()(wasm::Branch const& _branch) -{ - return "(br $" + _branch.label.name + ")\n"; -} - -string TextTransform::operator()(wasm::BranchIf const& _branchIf) -{ - return "(br_if $" + _branchIf.label.name + " " + visit(*_branchIf.condition) + ")\n"; -} - -string TextTransform::operator()(wasm::Return const&) -{ - return "(return)\n"; -} - -string TextTransform::operator()(wasm::Block const& _block) -{ - string label = _block.labelName.empty() ? "" : " $" + _block.labelName; - return "(block" + std::move(label) + "\n" + indented(joinTransformed(_block.statements, '\n')) + "\n)\n"; -} - -string TextTransform::indented(string const& _in) -{ - string replacement; - - if (!_in.empty()) - { - replacement.reserve(_in.size() + 4); - replacement += " "; - for (auto it = _in.begin(); it != _in.end(); ++it) - if (*it == '\n' && it + 1 != _in.end() && *(it + 1) != '\n') - replacement += "\n "; - else - replacement += *it; - } - return replacement; -} - -string TextTransform::transform(wasm::FunctionDefinition const& _function) -{ - string ret = "(func $" + _function.name + "\n"; - for (auto const& param: _function.parameters) - ret += " (param $" + param.name + " " + encodeType(param.type) + ")\n"; - if (_function.returnType.has_value()) - ret += " (result " + encodeType(_function.returnType.value()) + ")\n"; - for (auto const& local: _function.locals) - ret += " (local $" + local.variableName + " " + encodeType(local.type) + ")\n"; - ret += indented(joinTransformed(_function.body, '\n')); - if (ret.back() != '\n') - ret += '\n'; - ret += ")\n"; - return ret; -} - - -string TextTransform::visit(wasm::Expression const& _expression) -{ - return std::visit(*this, _expression); -} - -string TextTransform::joinTransformed(vector const& _expressions, char _separator) -{ - string ret; - for (auto const& e: _expressions) - { - string t = visit(e); - if (!t.empty() && !ret.empty() && ret.back() != '\n') - ret += _separator; - ret += std::move(t); - } - return ret; -} - -string TextTransform::encodeType(wasm::Type _type) -{ - if (_type == wasm::Type::i32) - return "i32"; - else if (_type == wasm::Type::i64) - return "i64"; - else - yulAssert(false, "Invalid wasm type"); -} diff --git a/libyul/backends/wasm/TextTransform.h b/libyul/backends/wasm/TextTransform.h deleted file mode 100644 index eb14da65d971..000000000000 --- a/libyul/backends/wasm/TextTransform.h +++ /dev/null @@ -1,71 +0,0 @@ -/* - This file is part of solidity. - - solidity is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - solidity is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with solidity. If not, see . -*/ -// SPDX-License-Identifier: GPL-3.0 -/** - * Component that transforms internal Wasm representation to text. - */ - -#pragma once - -#include - -#include - -namespace solidity::yul -{ -struct AsmAnalysisInfo; -} - -namespace solidity::yul::wasm -{ - -class TextTransform -{ -public: - std::string run(wasm::Module const& _module); - -public: - std::string operator()(wasm::Literal const& _literal); - std::string operator()(wasm::StringLiteral const& _literal); - std::string operator()(wasm::LocalVariable const& _identifier); - std::string operator()(wasm::GlobalVariable const& _identifier); - std::string operator()(wasm::BuiltinCall const& _builinCall); - std::string operator()(wasm::FunctionCall const& _functionCall); - std::string operator()(wasm::LocalAssignment const& _assignment); - std::string operator()(wasm::GlobalAssignment const& _assignment); - std::string operator()(wasm::If const& _if); - std::string operator()(wasm::Loop const& _loop); - std::string operator()(wasm::Branch const& _branch); - std::string operator()(wasm::BranchIf const& _branchIf); - std::string operator()(wasm::Return const& _return); - std::string operator()(wasm::Block const& _block); - -private: - std::string indented(std::string const& _in); - - std::string transform(wasm::FunctionDefinition const& _function); - - std::string visit(wasm::Expression const& _expression); - std::string joinTransformed( - std::vector const& _expressions, - char _separator = ' ' - ); - - static std::string encodeType(wasm::Type _type); -}; - -} diff --git a/libyul/backends/wasm/WasmAST.h b/libyul/backends/wasm/WasmAST.h deleted file mode 100644 index 67b642ec9b88..000000000000 --- a/libyul/backends/wasm/WasmAST.h +++ /dev/null @@ -1,117 +0,0 @@ -/* - This file is part of solidity. - - solidity is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - solidity is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with solidity. If not, see . -*/ -// SPDX-License-Identifier: GPL-3.0 -/** - * Simplified in-memory representation of a Wasm AST. - */ - -#pragma once - -#include - -#include -#include -#include -#include -#include -#include - -namespace solidity::yul::wasm -{ - -enum class Type -{ - i32, - i64, -}; - -struct TypedName { std::string name; Type type; }; -using TypedNameList = std::vector; - -struct Literal; -struct StringLiteral; -struct LocalVariable; -struct GlobalVariable; -struct FunctionCall; -struct BuiltinCall; -struct LocalAssignment; -struct GlobalAssignment; -struct Block; -struct If; -struct Loop; -struct Branch; -struct BranchIf; -struct Return; -using Expression = std::variant< - Literal, StringLiteral, LocalVariable, GlobalVariable, - FunctionCall, BuiltinCall, LocalAssignment, GlobalAssignment, - Block, If, Loop, Branch, BranchIf, Return ->; - -struct Literal { std::variant value; }; -// This is a special AST element used for certain builtins. It is not mapped to actual WebAssembly. -struct StringLiteral { std::string value; }; -struct LocalVariable { std::string name; }; -struct GlobalVariable { std::string name; }; -struct Label { std::string name; }; -struct FunctionCall { std::string functionName; std::vector arguments; }; -struct BuiltinCall { std::string functionName; std::vector arguments; }; -struct LocalAssignment { std::string variableName; std::unique_ptr value; }; -struct GlobalAssignment { std::string variableName; std::unique_ptr value; }; -struct Block { std::string labelName; std::vector statements; }; -struct If { - std::unique_ptr condition; - std::vector statements; - std::unique_ptr> elseStatements; -}; -struct Loop { std::string labelName; std::vector statements; }; -struct Branch { Label label; }; -struct Return {}; -struct BranchIf { Label label; std::unique_ptr condition; }; - -struct VariableDeclaration { std::string variableName; Type type; }; -struct GlobalVariableDeclaration { std::string variableName; Type type; }; -struct FunctionImport { - std::string module; - std::string externalName; - std::string internalName; - std::vector paramTypes; - std::optional returnType; -}; - -struct FunctionDefinition -{ - std::string name; - std::vector parameters; - std::optional returnType; - std::vector locals; - std::vector body; -}; - -/** - * Abstract representation of a wasm module. - */ -struct Module -{ - std::vector globals; - std::vector imports; - std::vector functions; - std::map subModules; - std::map customSections; -}; - -} diff --git a/libyul/backends/wasm/WasmCodeTransform.cpp b/libyul/backends/wasm/WasmCodeTransform.cpp deleted file mode 100644 index 2d895d3fe056..000000000000 --- a/libyul/backends/wasm/WasmCodeTransform.cpp +++ /dev/null @@ -1,449 +0,0 @@ -/* - This file is part of solidity. - - solidity is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - solidity is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with solidity. If not, see . -*/ -// SPDX-License-Identifier: GPL-3.0 -/** -* Common code generator for translating Yul / inline assembly to Wasm. -*/ - -#include - -#include - -#include -#include -#include -#include - -#include - -#include -#include - -using namespace std; -using namespace solidity; -using namespace solidity::yul; -using namespace solidity::util; - -wasm::Module WasmCodeTransform::run(Dialect const& _dialect, yul::Block const& _ast) -{ - wasm::Module module; - - TypeInfo typeInfo(_dialect, _ast); - WasmCodeTransform transform(_dialect, _ast, typeInfo); - - for (auto const& statement: _ast.statements) - { - yulAssert( - holds_alternative(statement), - "Expected only function definitions at the highest level." - ); - if (holds_alternative(statement)) - module.functions.emplace_back(transform.translateFunction(std::get(statement))); - } - - for (auto& imp: transform.m_functionsToImport) - module.imports.emplace_back(std::move(imp.second)); - module.globals = transform.m_globalVariables; - - return module; -} - -wasm::Expression WasmCodeTransform::generateMultiAssignment( - vector _variableNames, - unique_ptr _firstValue -) -{ - yulAssert(!_variableNames.empty(), ""); - wasm::LocalAssignment assignment{std::move(_variableNames.front()), std::move(_firstValue)}; - - if (_variableNames.size() == 1) - return { std::move(assignment) }; - - vector typesForGlobals; - for (size_t i = 1; i < _variableNames.size(); ++i) - typesForGlobals.push_back(translatedType(m_typeInfo.typeOfVariable(YulString(_variableNames[i])))); - vector allocatedIndices = allocateGlobals(typesForGlobals); - yulAssert(allocatedIndices.size() == _variableNames.size() - 1, ""); - - wasm::Block block; - block.statements.emplace_back(std::move(assignment)); - for (size_t i = 1; i < _variableNames.size(); ++i) - block.statements.emplace_back(wasm::LocalAssignment{ - std::move(_variableNames.at(i)), - make_unique(wasm::GlobalVariable{m_globalVariables.at(allocatedIndices[i - 1]).variableName}) - }); - return { std::move(block) }; -} - -wasm::Expression WasmCodeTransform::operator()(yul::VariableDeclaration const& _varDecl) -{ - vector variableNames; - for (auto const& var: _varDecl.variables) - { - variableNames.emplace_back(var.name.str()); - m_localVariables.emplace_back(wasm::VariableDeclaration{variableNames.back(), translatedType(var.type)}); - } - - if (_varDecl.value) - return generateMultiAssignment(std::move(variableNames), visit(*_varDecl.value)); - else - return wasm::BuiltinCall{"nop", {}}; -} - -wasm::Expression WasmCodeTransform::operator()(yul::Assignment const& _assignment) -{ - vector variableNames; - for (auto const& var: _assignment.variableNames) - variableNames.emplace_back(var.name.str()); - return generateMultiAssignment(std::move(variableNames), visit(*_assignment.value)); -} - -wasm::Expression WasmCodeTransform::operator()(yul::ExpressionStatement const& _statement) -{ - return visitReturnByValue(_statement.expression); -} - -void WasmCodeTransform::importBuiltinFunction(BuiltinFunction const* _builtin, string const& _module, string const& _externalName, string const& _internalName) -{ - yulAssert(_builtin, ""); - yulAssert(_builtin->returns.size() <= 1, ""); - // Imported function, use regular call, but mark for import. - YulString internalName(_internalName); - if (!m_functionsToImport.count(internalName)) - { - wasm::FunctionImport imp{ - _module, - _externalName, - _internalName, - {}, - _builtin->returns.empty() ? nullopt : make_optional(translatedType(_builtin->returns.front())) - }; - for (auto const& param: _builtin->parameters) - imp.paramTypes.emplace_back(translatedType(param)); - m_functionsToImport[internalName] = std::move(imp); - } -} - -wasm::Expression WasmCodeTransform::operator()(yul::FunctionCall const& _call) -{ - if (BuiltinFunction const* builtin = m_dialect.builtin(_call.functionName.name)) - { - if (_call.functionName.name.str().substr(0, 6) == "debug.") - importBuiltinFunction(builtin, "debug", builtin->name.str().substr(6), builtin->name.str()); - else if (_call.functionName.name.str().substr(0, 4) == "eth.") - importBuiltinFunction(builtin, "ethereum", builtin->name.str().substr(4), builtin->name.str()); - else - { - vector arguments; - for (size_t i = 0; i < _call.arguments.size(); i++) - if (builtin->literalArgument(i)) - { - yulAssert(builtin->literalArgument(i) == LiteralKind::String, ""); - arguments.emplace_back(wasm::StringLiteral{std::get(_call.arguments[i]).value.str()}); - } - else - arguments.emplace_back(visitReturnByValue(_call.arguments[i])); - - return wasm::BuiltinCall{_call.functionName.name.str(), std::move(arguments)}; - } - } - - // If this function returns multiple values, then the first one will - // be returned in the expression itself and the others in global variables. - // The values have to be used right away in an assignment or variable declaration, - // so it is handled there. - - return wasm::FunctionCall{_call.functionName.name.str(), visit(_call.arguments)}; -} - -wasm::Expression WasmCodeTransform::operator()(yul::Identifier const& _identifier) -{ - return wasm::LocalVariable{_identifier.name.str()}; -} - -wasm::Expression WasmCodeTransform::operator()(yul::Literal const& _literal) -{ - return makeLiteral(translatedType(_literal.type), valueOfLiteral(_literal)); -} - -wasm::Expression WasmCodeTransform::operator()(yul::If const& _if) -{ - yul::Type conditionType = m_typeInfo.typeOf(*_if.condition); - - wasm::Expression condition; - if (conditionType == "i32"_yulstring) - condition = visitReturnByValue(*_if.condition); - else if (conditionType == "i64"_yulstring) - { - vector args; - args.emplace_back(visitReturnByValue(*_if.condition)); - args.emplace_back(makeLiteral(translatedType("i64"_yulstring), 0)); - - // NOTE: `if` in wasm requires an i32 argument - condition = wasm::BuiltinCall{"i64.ne", std::move(args)}; - } - else - yulAssert(false, "Invalid condition type"); - - return wasm::If{make_unique(std::move(condition)), visit(_if.body.statements), {}}; -} - -wasm::Expression WasmCodeTransform::operator()(yul::Switch const& _switch) -{ - yul::Type expressionType = m_typeInfo.typeOf(*_switch.expression); - YulString eq_instruction = YulString(expressionType.str() + ".eq"); - yulAssert(WasmDialect::instance().builtin(eq_instruction), ""); - - wasm::Block block; - string condition = m_nameDispenser.newName("condition"_yulstring).str(); - m_localVariables.emplace_back(wasm::VariableDeclaration{condition, translatedType(expressionType)}); - block.statements.emplace_back(wasm::LocalAssignment{condition, visit(*_switch.expression)}); - - vector* currentBlock = &block.statements; - for (size_t i = 0; i < _switch.cases.size(); ++i) - { - Case const& c = _switch.cases.at(i); - if (c.value) - { - wasm::BuiltinCall comparison{eq_instruction.str(), make_vector( - wasm::LocalVariable{condition}, - visitReturnByValue(*c.value) - )}; - wasm::If ifStmnt{ - make_unique(std::move(comparison)), - visit(c.body.statements), - {} - }; - vector* nextBlock = nullptr; - if (i != _switch.cases.size() - 1) - { - ifStmnt.elseStatements = make_unique>(); - nextBlock = ifStmnt.elseStatements.get(); - } - currentBlock->emplace_back(std::move(ifStmnt)); - currentBlock = nextBlock; - } - else - { - yulAssert(i == _switch.cases.size() - 1, "Default case must be last."); - *currentBlock += visit(c.body.statements); - } - } - return { std::move(block) }; -} - -wasm::Expression WasmCodeTransform::operator()(yul::FunctionDefinition const&) -{ - yulAssert(false, "Should not have visited here."); - return {}; -} - -wasm::Expression WasmCodeTransform::operator()(yul::ForLoop const& _for) -{ - string breakLabel = newLabel(); - string continueLabel = newLabel(); - m_breakContinueLabelNames.push({breakLabel, continueLabel}); - - yul::Type conditionType = m_typeInfo.typeOf(*_for.condition); - YulString eqz_instruction = YulString(conditionType.str() + ".eqz"); - yulAssert(WasmDialect::instance().builtin(eqz_instruction), ""); - - std::vector statements = visit(_for.pre.statements); - - wasm::Loop loop; - loop.labelName = newLabel(); - loop.statements.emplace_back(wasm::BranchIf{wasm::Label{breakLabel}, make_unique( - wasm::BuiltinCall{eqz_instruction.str(), make_vector( - visitReturnByValue(*_for.condition) - )} - )}); - loop.statements.emplace_back(wasm::Block{continueLabel, visit(_for.body.statements)}); - loop.statements += visit(_for.post.statements); - loop.statements.emplace_back(wasm::Branch{wasm::Label{loop.labelName}}); - - statements += make_vector(std::move(loop)); - return wasm::Block{breakLabel, std::move(statements)}; -} - -wasm::Expression WasmCodeTransform::operator()(yul::Break const&) -{ - yulAssert(m_breakContinueLabelNames.size() > 0, ""); - return wasm::Branch{wasm::Label{m_breakContinueLabelNames.top().first}}; -} - -wasm::Expression WasmCodeTransform::operator()(yul::Continue const&) -{ - yulAssert(m_breakContinueLabelNames.size() > 0, ""); - return wasm::Branch{wasm::Label{m_breakContinueLabelNames.top().second}}; -} - -wasm::Expression WasmCodeTransform::operator()(yul::Leave const&) -{ - yulAssert(!m_functionBodyLabel.empty(), ""); - return wasm::Branch{wasm::Label{m_functionBodyLabel}}; -} - -wasm::Expression WasmCodeTransform::operator()(yul::Block const& _block) -{ - return wasm::Block{{}, visit(_block.statements)}; -} - -unique_ptr WasmCodeTransform::visit(yul::Expression const& _expression) -{ - return make_unique(std::visit(*this, _expression)); -} - -wasm::Expression WasmCodeTransform::visitReturnByValue(yul::Expression const& _expression) -{ - return std::visit(*this, _expression); -} - -vector WasmCodeTransform::visit(vector const& _expressions) -{ - vector ret; - for (auto const& e: _expressions) - ret.emplace_back(visitReturnByValue(e)); - return ret; -} - -wasm::Expression WasmCodeTransform::visit(yul::Statement const& _statement) -{ - return std::visit(*this, _statement); -} - -vector WasmCodeTransform::visit(vector const& _statements) -{ - vector ret; - for (auto const& s: _statements) - ret.emplace_back(visit(s)); - return ret; -} - -wasm::FunctionDefinition WasmCodeTransform::translateFunction(yul::FunctionDefinition const& _fun) -{ - wasm::FunctionDefinition fun; - fun.name = _fun.name.str(); - for (auto const& param: _fun.parameters) - fun.parameters.push_back({param.name.str(), translatedType(param.type)}); - for (auto const& retParam: _fun.returnVariables) - fun.locals.emplace_back(wasm::VariableDeclaration{retParam.name.str(), translatedType(retParam.type)}); - if (!_fun.returnVariables.empty()) - fun.returnType = translatedType(_fun.returnVariables[0].type); - - yulAssert(m_localVariables.empty(), ""); - yulAssert(m_functionBodyLabel.empty(), ""); - m_functionBodyLabel = newLabel(); - fun.body.emplace_back(wasm::Expression(wasm::Block{ - m_functionBodyLabel, - visit(_fun.body.statements) - })); - fun.locals += m_localVariables; - - m_localVariables.clear(); - m_functionBodyLabel = {}; - - if (!_fun.returnVariables.empty()) - { - // First return variable is returned directly, the others are stored - // in globals. - vector typesForGlobals; - for (size_t i = 1; i < _fun.returnVariables.size(); ++i) - typesForGlobals.push_back(translatedType(_fun.returnVariables[i].type)); - vector allocatedIndices = allocateGlobals(typesForGlobals); - yulAssert(allocatedIndices.size() == _fun.returnVariables.size() - 1, ""); - - for (size_t i = 1; i < _fun.returnVariables.size(); ++i) - fun.body.emplace_back(wasm::GlobalAssignment{ - m_globalVariables.at(allocatedIndices[i - 1]).variableName, - make_unique(wasm::LocalVariable{_fun.returnVariables.at(i).name.str()}) - }); - fun.body.emplace_back(wasm::LocalVariable{_fun.returnVariables.front().name.str()}); - } - return fun; -} - -string WasmCodeTransform::newLabel() -{ - return m_nameDispenser.newName("label_"_yulstring).str(); -} - -vector WasmCodeTransform::allocateGlobals(vector const& _typesForGlobals) -{ - map availableGlobals; - for (wasm::GlobalVariableDeclaration const& global: m_globalVariables) - ++availableGlobals[global.type]; - - map neededGlobals; - for (wasm::Type const& type: _typesForGlobals) - ++neededGlobals[type]; - - for (auto [type, neededGlobalCount]: neededGlobals) - while (availableGlobals[type] < neededGlobalCount) - { - m_globalVariables.emplace_back(wasm::GlobalVariableDeclaration{ - m_nameDispenser.newName("global_"_yulstring).str(), - type, - }); - - ++availableGlobals[type]; - } - - vector allocatedIndices; - map nextGlobal; - for (wasm::Type const& type: _typesForGlobals) - { - while (m_globalVariables[nextGlobal[type]].type != type) - ++nextGlobal[type]; - - allocatedIndices.push_back(nextGlobal[type]++); - } - - yulAssert(all_of( - allocatedIndices.begin(), - allocatedIndices.end(), - [this](size_t index){ return index < m_globalVariables.size(); } - ), ""); - yulAssert(allocatedIndices.size() == set(allocatedIndices.begin(), allocatedIndices.end()).size(), "Indices not unique"); - yulAssert(allocatedIndices.size() == _typesForGlobals.size(), ""); - return allocatedIndices; -} - -wasm::Type WasmCodeTransform::translatedType(yul::Type _yulType) -{ - if (_yulType == "i32"_yulstring) - return wasm::Type::i32; - else if (_yulType == "i64"_yulstring) - return wasm::Type::i64; - else - yulAssert(false, "This Yul type does not have a corresponding type in Wasm."); -} - -wasm::Literal WasmCodeTransform::makeLiteral(wasm::Type _type, u256 _value) -{ - if (_type == wasm::Type::i32) - { - yulAssert(_value <= numeric_limits::max(), "Literal too large: " + _value.str()); - return wasm::Literal{static_cast(_value)}; - } - else if (_type == wasm::Type::i64) - { - yulAssert(_value <= numeric_limits::max(), "Literal too large: " + _value.str()); - return wasm::Literal{static_cast(_value)}; - } - else - yulAssert(false, "Invalid Wasm literal type"); -} diff --git a/libyul/backends/wasm/WasmCodeTransform.h b/libyul/backends/wasm/WasmCodeTransform.h deleted file mode 100644 index 1026f17c60c5..000000000000 --- a/libyul/backends/wasm/WasmCodeTransform.h +++ /dev/null @@ -1,115 +0,0 @@ -/* - This file is part of solidity. - - solidity is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - solidity is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with solidity. If not, see . -*/ -// SPDX-License-Identifier: GPL-3.0 -/** - * Common code generator for translating Yul / inline assembly to Wasm. - */ - -#pragma once - -#include -#include -#include -#include -#include - -#include -#include - -#include -#include - -namespace solidity::yul -{ -struct AsmAnalysisInfo; - -class WasmCodeTransform -{ -public: - static wasm::Module run(Dialect const& _dialect, yul::Block const& _ast); - -public: - wasm::Expression operator()(yul::Literal const& _literal); - wasm::Expression operator()(yul::Identifier const& _identifier); - wasm::Expression operator()(yul::FunctionCall const&); - wasm::Expression operator()(yul::ExpressionStatement const& _statement); - wasm::Expression operator()(yul::Assignment const& _assignment); - wasm::Expression operator()(yul::VariableDeclaration const& _varDecl); - wasm::Expression operator()(yul::If const& _if); - wasm::Expression operator()(yul::Switch const& _switch); - wasm::Expression operator()(yul::FunctionDefinition const&); - wasm::Expression operator()(yul::ForLoop const&); - wasm::Expression operator()(yul::Break const&); - wasm::Expression operator()(yul::Continue const&); - wasm::Expression operator()(yul::Leave const&); - wasm::Expression operator()(yul::Block const& _block); - -private: - WasmCodeTransform( - Dialect const& _dialect, - Block const& _ast, - TypeInfo& _typeInfo - ): - m_dialect(_dialect), - m_nameDispenser(_dialect, _ast), - m_typeInfo(_typeInfo) - {} - - std::unique_ptr visit(yul::Expression const& _expression); - wasm::Expression visitReturnByValue(yul::Expression const& _expression); - std::vector visit(std::vector const& _expressions); - wasm::Expression visit(yul::Statement const& _statement); - std::vector visit(std::vector const& _statements); - - /// Returns an assignment or a block containing multiple assignments. - /// @param _variableNames the names of the variables to assign to - /// @param _firstValue the value to be assigned to the first variable. If there - /// is more than one variable, the values are taken from m_globalVariables. - wasm::Expression generateMultiAssignment( - std::vector _variableNames, - std::unique_ptr _firstValue - ); - - wasm::FunctionDefinition translateFunction(yul::FunctionDefinition const& _funDef); - - /// Imports an external function into the current module. - /// @param _builtin _builtin the builtin that will be imported into the current module. - /// @param _module _module the module name under which the external function can be found. - /// @param _externalName the name of the external function within the module _module. - /// @param _internalName the name of the internal function under that the external function is accessible. - void importBuiltinFunction(BuiltinFunction const* _builtin, std::string const& _module, std::string const& _externalName, std::string const& _internalName); - - std::string newLabel(); - /// Selects a subset of global variables matching specified sequence of variable types. - /// Defines more global variables of a given type if there's not enough. - std::vector allocateGlobals(std::vector const& _typesForGlobals); - - static wasm::Type translatedType(yul::Type _yulType); - static wasm::Literal makeLiteral(wasm::Type _type, u256 _value); - - Dialect const& m_dialect; - NameDispenser m_nameDispenser; - - std::vector m_localVariables; - std::vector m_globalVariables; - std::map m_functionsToImport; - std::string m_functionBodyLabel; - std::stack> m_breakContinueLabelNames; - TypeInfo& m_typeInfo; -}; - -} diff --git a/libyul/backends/wasm/WasmDialect.cpp b/libyul/backends/wasm/WasmDialect.cpp deleted file mode 100644 index b724ba69e63d..000000000000 --- a/libyul/backends/wasm/WasmDialect.cpp +++ /dev/null @@ -1,284 +0,0 @@ -/* - This file is part of solidity. - - solidity is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - solidity is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with solidity. If not, see . -*/ -// SPDX-License-Identifier: GPL-3.0 -/** - * Dialects for Wasm. - */ - -#include - -#include -#include - -using namespace std; -using namespace solidity::yul; - -WasmDialect::WasmDialect() -{ - YulString i64 = "i64"_yulstring; - YulString i32 = "i32"_yulstring; - defaultType = i64; - boolType = i32; - types = {i64, i32}; - - for (auto t: types) - for (auto const& name: { - "add", - "sub", - "mul", - // TODO: div_s - "div_u", - // TODO: rem_s - "rem_u", - "and", - "or", - "xor", - "shl", - // TODO: shr_s - "shr_u", - // TODO: rotl - // TODO: rotr - }) - addFunction(t.str() + "." + name, {t, t}, {t}); - - for (auto t: types) - for (auto const& name: { - "eq", - "ne", - // TODO: lt_s - "lt_u", - // TODO: gt_s - "gt_u", - // TODO: le_s - "le_u", - // TODO: ge_s - "ge_u" - }) - addFunction(t.str() + "." + name, {t, t}, {i32}); - - addFunction("i32.eqz", {i32}, {i32}); - addFunction("i64.eqz", {i64}, {i32}); - - for (auto t: types) - for (auto const& name: { - "clz", - "ctz", - "popcnt", - }) - addFunction(t.str() + "." + name, {t}, {t}); - - addFunction("i32.wrap_i64", {i64}, {i32}); - - addFunction("i64.extend_i32_u", {i32}, {i64}); - - addFunction("i32.store", {i32, i32}, {}, false); - m_functions["i32.store"_yulstring].sideEffects.storage = SideEffects::None; - m_functions["i32.store"_yulstring].sideEffects.otherState = SideEffects::None; - addFunction("i64.store", {i32, i64}, {}, false); - // TODO: add i32.store16, i64.store8, i64.store16, i64.store32 - m_functions["i64.store"_yulstring].sideEffects.storage = SideEffects::None; - m_functions["i64.store"_yulstring].sideEffects.otherState = SideEffects::None; - - addFunction("i32.store8", {i32, i32}, {}, false); - m_functions["i32.store8"_yulstring].sideEffects.storage = SideEffects::None; - m_functions["i32.store8"_yulstring].sideEffects.otherState = SideEffects::None; - - addFunction("i64.store8", {i32, i64}, {}, false); - m_functions["i64.store8"_yulstring].sideEffects.storage = SideEffects::None; - m_functions["i64.store8"_yulstring].sideEffects.otherState = SideEffects::None; - - addFunction("i32.load", {i32}, {i32}, false); - m_functions["i32.load"_yulstring].sideEffects.canBeRemoved = true; - m_functions["i32.load"_yulstring].sideEffects.canBeRemovedIfNoMSize = true; - m_functions["i32.load"_yulstring].sideEffects.storage = SideEffects::None; - m_functions["i32.load"_yulstring].sideEffects.memory = SideEffects::Read; - m_functions["i32.load"_yulstring].sideEffects.otherState = SideEffects::None; - addFunction("i64.load", {i32}, {i64}, false); - // TODO: add i32.load8, i32.load16, i64.load8, i64.load16, i64.load32 - m_functions["i64.load"_yulstring].sideEffects.canBeRemoved = true; - m_functions["i64.load"_yulstring].sideEffects.canBeRemovedIfNoMSize = true; - m_functions["i64.load"_yulstring].sideEffects.storage = SideEffects::None; - m_functions["i64.load"_yulstring].sideEffects.memory = SideEffects::Read; - m_functions["i64.load"_yulstring].sideEffects.otherState = SideEffects::None; - - // Drop is actually overloaded for all types, but Yul does not support that. - // Because of that, we introduce "i32.drop" and "i64.drop". - addFunction("i32.drop", {i32}, {}); - addFunction("i64.drop", {i64}, {}); - - // Select is also overloaded. - addFunction("i32.select", {i32, i32, i32}, {i32}); - addFunction("i64.select", {i64, i64, i32}, {i64}); - - addFunction("nop", {}, {}); - addFunction("unreachable", {}, {}, false); - m_functions["unreachable"_yulstring].sideEffects.storage = SideEffects::None; - m_functions["unreachable"_yulstring].sideEffects.memory = SideEffects::None; - m_functions["unreachable"_yulstring].sideEffects.otherState = SideEffects::None; - m_functions["unreachable"_yulstring].controlFlowSideEffects.canTerminate = false; - m_functions["unreachable"_yulstring].controlFlowSideEffects.canRevert = true; - m_functions["unreachable"_yulstring].controlFlowSideEffects.canContinue = false; - - addFunction("datasize", {i64}, {i64}, true, {LiteralKind::String}); - addFunction("dataoffset", {i64}, {i64}, true, {LiteralKind::String}); - - addExternals(); -} - -BuiltinFunction const* WasmDialect::builtin(YulString _name) const -{ - auto it = m_functions.find(_name); - if (it != m_functions.end()) - return &it->second; - else - return nullptr; -} - -BuiltinFunction const* WasmDialect::discardFunction(YulString _type) const -{ - if (_type == "i32"_yulstring) - return builtin("i32.drop"_yulstring); - yulAssert(_type == "i64"_yulstring, ""); - return builtin("i64.drop"_yulstring); -} - -BuiltinFunction const* WasmDialect::equalityFunction(YulString _type) const -{ - if (_type == "i32"_yulstring) - return builtin("i32.eq"_yulstring); - yulAssert(_type == "i64"_yulstring, ""); - return builtin("i64.eq"_yulstring); -} - -WasmDialect const& WasmDialect::instance() -{ - static std::unique_ptr dialect; - static YulStringRepository::ResetCallback callback{[&] { dialect.reset(); }}; - if (!dialect) - dialect = make_unique(); - return *dialect; -} - -void WasmDialect::addExternals() -{ - // These are not YulStrings because that would be too complicated with regards - // to the YulStringRepository reset. - static string const i64{"i64"}; - static string const i32{"i32"}; - static string const i32ptr{"i32"}; // Uses "i32" on purpose. - struct External - { - string module; - string name; - vector parameters; - vector returns; - ControlFlowSideEffects controlFlowSideEffects = ControlFlowSideEffects{}; - }; - static vector externals{ - {"eth", "getAddress", {i32ptr}, {}}, - {"eth", "getExternalBalance", {i32ptr, i32ptr}, {}}, - {"eth", "getBlockBaseFee", {i32ptr}, {}}, - {"eth", "getBlockHash", {i64, i32ptr}, {i32}}, - {"eth", "call", {i64, i32ptr, i32ptr, i32ptr, i32}, {i32}}, - {"eth", "callDataCopy", {i32ptr, i32, i32}, {}}, - {"eth", "getCallDataSize", {}, {i32}}, - {"eth", "callCode", {i64, i32ptr, i32ptr, i32ptr, i32}, {i32}}, - {"eth", "callDelegate", {i64, i32ptr, i32ptr, i32}, {i32}}, - {"eth", "callStatic", {i64, i32ptr, i32ptr, i32}, {i32}}, - {"eth", "storageStore", {i32ptr, i32ptr}, {}}, - {"eth", "storageLoad", {i32ptr, i32ptr}, {}}, - {"eth", "getCaller", {i32ptr}, {}}, - {"eth", "getCallValue", {i32ptr}, {}}, - {"eth", "codeCopy", {i32ptr, i32, i32}, {}}, - {"eth", "getCodeSize", {}, {i32}}, - {"eth", "getBlockCoinbase", {i32ptr}, {}}, - {"eth", "create", {i32ptr, i32ptr, i32, i32ptr}, {i32}}, - {"eth", "getBlockDifficulty", {i32ptr}, {}}, - {"eth", "externalCodeCopy", {i32ptr, i32ptr, i32, i32}, {}}, - {"eth", "getExternalCodeSize", {i32ptr}, {i32}}, - {"eth", "getGasLeft", {}, {i64}}, - {"eth", "getBlockGasLimit", {}, {i64}}, - {"eth", "getTxGasPrice", {i32ptr}, {}}, - {"eth", "log", {i32ptr, i32, i32, i32ptr, i32ptr, i32ptr, i32ptr}, {}}, - {"eth", "getBlockNumber", {}, {i64}}, - {"eth", "getTxOrigin", {i32ptr}, {}}, - {"eth", "finish", {i32ptr, i32}, {}, ControlFlowSideEffects{true, false, false}}, - {"eth", "revert", {i32ptr, i32}, {}, ControlFlowSideEffects{false, true, false}}, - {"eth", "getReturnDataSize", {}, {i32}}, - {"eth", "returnDataCopy", {i32ptr, i32, i32}, {}}, - {"eth", "selfDestruct", {i32ptr}, {}, ControlFlowSideEffects{false, true, false}}, - {"eth", "getBlockTimestamp", {}, {i64}}, - {"debug", "print32", {i32}, {}}, - {"debug", "print64", {i64}, {}}, - {"debug", "printMem", {i32, i32}, {}}, - {"debug", "printMemHex", {i32, i32}, {}}, - {"debug", "printStorage", {i32}, {}}, - {"debug", "printStorageHex", {i32}, {}}, - }; - for (External const& ext: externals) - { - YulString name{ext.module + "." + ext.name}; - BuiltinFunction& f = m_functions[name]; - f.name = name; - for (string const& p: ext.parameters) - f.parameters.emplace_back(YulString(p)); - for (string const& p: ext.returns) - f.returns.emplace_back(YulString(p)); - // TODO some of them are side effect free. - f.sideEffects = SideEffects::worst(); - f.sideEffects.cannotLoop = true; - f.sideEffects.movableApartFromEffects = !ext.controlFlowSideEffects.terminatesOrReverts(); - f.controlFlowSideEffects = ext.controlFlowSideEffects; - f.isMSize = false; - f.literalArguments.clear(); - - static set const writesToStorage{ - "storageStore", - "call", - "callcode", - "callDelegate", - "create" - }; - static set const readsStorage{"storageLoad", "callStatic"}; - if (readsStorage.count(ext.name)) - f.sideEffects.storage = SideEffects::Read; - else if (!writesToStorage.count(ext.name)) - f.sideEffects.storage = SideEffects::None; - } -} - -void WasmDialect::addFunction( - string _name, - vector _params, - vector _returns, - bool _movable, - vector> _literalArguments -) -{ - YulString name{std::move(_name)}; - BuiltinFunction& f = m_functions[name]; - f.name = name; - f.parameters = std::move(_params); - yulAssert(_returns.size() <= 1, "The Wasm 1.0 specification only allows up to 1 return value."); - f.returns = std::move(_returns); - f.sideEffects = _movable ? SideEffects{} : SideEffects::worst(); - f.sideEffects.cannotLoop = true; - // TODO This should be improved when LoopInvariantCodeMotion gets specialized for WASM - f.sideEffects.movableApartFromEffects = _movable; - f.isMSize = false; - f.literalArguments = std::move(_literalArguments); -} diff --git a/libyul/backends/wasm/WasmDialect.h b/libyul/backends/wasm/WasmDialect.h deleted file mode 100644 index 2776c14e79f4..000000000000 --- a/libyul/backends/wasm/WasmDialect.h +++ /dev/null @@ -1,71 +0,0 @@ -/* - This file is part of solidity. - - solidity is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - solidity is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with solidity. If not, see . -*/ -// SPDX-License-Identifier: GPL-3.0 -/** - * Dialects for Wasm. - */ - -#pragma once - -#include - -#include - -namespace solidity::yul -{ - -class YulString; -using Type = YulString; -struct FunctionCall; -struct Object; - -/** - * Yul dialect for Wasm as a backend. - * - * Builtin functions are a subset of the wasm instructions. - * - * There is a builtin function `i32.drop` that takes an i32, while `i64.drop` takes i64. - * - */ -struct WasmDialect: public Dialect -{ - WasmDialect(); - - BuiltinFunction const* builtin(YulString _name) const override; - BuiltinFunction const* discardFunction(YulString _type) const override; - BuiltinFunction const* equalityFunction(YulString _type) const override; - BuiltinFunction const* booleanNegationFunction() const override { return builtin("i32.eqz"_yulstring); } - - std::set fixedFunctionNames() const override { return {"main"_yulstring}; } - - static WasmDialect const& instance(); - -private: - void addExternals(); - - void addFunction( - std::string _name, - std::vector _params, - std::vector _returns, - bool _movable = true, - std::vector> _literalArguments = std::vector>{} - ); - - std::map m_functions; -}; - -} diff --git a/libyul/backends/wasm/WasmObjectCompiler.cpp b/libyul/backends/wasm/WasmObjectCompiler.cpp deleted file mode 100644 index bdd109d31ccf..000000000000 --- a/libyul/backends/wasm/WasmObjectCompiler.cpp +++ /dev/null @@ -1,60 +0,0 @@ -/* - This file is part of solidity. - - solidity is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - solidity is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with solidity. If not, see . -*/ -// SPDX-License-Identifier: GPL-3.0 -/** - * Compiler that transforms Yul Objects to Wasm text and binary representation (Ewasm flavoured). - */ - -#include - -#include -#include -#include - -#include -#include - -#include - -using namespace solidity; -using namespace solidity::yul; -using namespace std; - -pair WasmObjectCompiler::compile(Object& _object, Dialect const& _dialect) -{ - WasmObjectCompiler compiler(_dialect); - wasm::Module module = compiler.run(_object); - return {wasm::TextTransform().run(module), wasm::BinaryTransform::run(module)}; -} - -wasm::Module WasmObjectCompiler::run(Object& _object) -{ - yulAssert(_object.analysisInfo, "No analysis info."); - yulAssert(_object.code, "No code."); - - wasm::Module module = WasmCodeTransform::run(m_dialect, *_object.code); - - for (auto& subNode: _object.subObjects) - if (Object* subObject = dynamic_cast(subNode.get())) - module.subModules[subObject->name.str()] = run(*subObject); - else if (Data* subObject = dynamic_cast(subNode.get())) - module.customSections[subObject->name.str()] = subObject->data; - else - yulAssert(false, ""); - - return module; -} diff --git a/libyul/backends/wasm/WasmObjectCompiler.h b/libyul/backends/wasm/WasmObjectCompiler.h deleted file mode 100644 index 52e48a9d5ecf..000000000000 --- a/libyul/backends/wasm/WasmObjectCompiler.h +++ /dev/null @@ -1,53 +0,0 @@ -/* - This file is part of solidity. - - solidity is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - solidity is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with solidity. If not, see . -*/ -// SPDX-License-Identifier: GPL-3.0 -/** - * Compiler that transforms Yul Objects to Wasm text and binary representation (Ewasm flavoured). - */ - -#pragma once - -#include -#include -#include -#include // solidity::bytes - -namespace solidity::yul -{ -struct Object; -struct Dialect; -namespace wasm -{ -struct Module; -} - -class WasmObjectCompiler -{ -public: - /// Compiles the given object and returns the Wasm text and binary representation. - static std::pair compile(Object& _object, Dialect const& _dialect); -private: - WasmObjectCompiler(Dialect const& _dialect): - m_dialect(_dialect) - {} - - wasm::Module run(Object& _object); - - Dialect const& m_dialect; -}; - -} diff --git a/libyul/backends/wasm/WordSizeTransform.cpp b/libyul/backends/wasm/WordSizeTransform.cpp deleted file mode 100644 index ad723717b65a..000000000000 --- a/libyul/backends/wasm/WordSizeTransform.cpp +++ /dev/null @@ -1,433 +0,0 @@ -/* - This file is part of solidity. - - solidity is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - solidity is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with solidity. If not, see . -*/ -// SPDX-License-Identifier: GPL-3.0 - -#include -#include -#include -#include -#include - -#include - -#include -#include -#include -#include - -using namespace std; -using namespace solidity; -using namespace solidity::yul; -using namespace solidity::util; - -void WordSizeTransform::operator()(FunctionDefinition& _fd) -{ - rewriteVarDeclList(_fd.parameters); - rewriteVarDeclList(_fd.returnVariables); - (*this)(_fd.body); -} - -void WordSizeTransform::operator()(FunctionCall& _fc) -{ - vector> const* literalArguments = nullptr; - - if (BuiltinFunction const* fun = m_inputDialect.builtin(_fc.functionName.name)) - if (!fun->literalArguments.empty()) - literalArguments = &fun->literalArguments; - - vector newArgs; - - for (size_t i = 0; i < _fc.arguments.size(); i++) - if (!literalArguments || !(*literalArguments)[i].has_value()) - newArgs += expandValueToVector(_fc.arguments[i]); - else - { - get(_fc.arguments[i]).type = m_targetDialect.defaultType; - newArgs.emplace_back(std::move(_fc.arguments[i])); - } - - _fc.arguments = std::move(newArgs); -} - -void WordSizeTransform::operator()(If& _if) -{ - _if.condition = make_unique(FunctionCall{ - debugDataOf(*_if.condition), - Identifier{debugDataOf(*_if.condition), "or_bool"_yulstring}, - expandValueToVector(*_if.condition) - }); - (*this)(_if.body); -} - -void WordSizeTransform::operator()(Switch&) -{ - yulAssert(false, "Switch statement has to be handled inside the containing block."); -} - -void WordSizeTransform::operator()(ForLoop& _for) -{ - (*this)(_for.pre); - _for.condition = make_unique(FunctionCall{ - debugDataOf(*_for.condition), - Identifier{debugDataOf(*_for.condition), "or_bool"_yulstring}, - expandValueToVector(*_for.condition) - }); - (*this)(_for.post); - (*this)(_for.body); -} - -void WordSizeTransform::operator()(Block& _block) -{ - iterateReplacing( - _block.statements, - [&](Statement& _s) -> std::optional> - { - if (holds_alternative(_s)) - { - VariableDeclaration& varDecl = std::get(_s); - - if (!varDecl.value) - rewriteVarDeclList(varDecl.variables); - else if (holds_alternative(*varDecl.value)) - { - visit(*varDecl.value); - - // Special handling for datasize and dataoffset - they will only need one variable. - if (BuiltinFunction const* f = m_inputDialect.builtin(std::get(*varDecl.value).functionName.name)) - if (f->name == "datasize"_yulstring || f->name == "dataoffset"_yulstring) - { - yulAssert(f->literalArguments.size() == 1, ""); - yulAssert(f->literalArguments.at(0) == LiteralKind::String, ""); - yulAssert(varDecl.variables.size() == 1, ""); - auto newLhs = generateU64IdentifierNames(varDecl.variables[0].name); - vector ret; - for (size_t i = 0; i < 3; i++) - ret.emplace_back(VariableDeclaration{ - varDecl.debugData, - {TypedName{varDecl.debugData, newLhs[i], m_targetDialect.defaultType}}, - make_unique(Literal{ - debugDataOf(*varDecl.value), - LiteralKind::Number, - "0"_yulstring, - m_targetDialect.defaultType - }) - }); - ret.emplace_back(VariableDeclaration{ - varDecl.debugData, - {TypedName{varDecl.debugData, newLhs[3], m_targetDialect.defaultType}}, - std::move(varDecl.value) - }); - return {std::move(ret)}; - } - - rewriteVarDeclList(varDecl.variables); - return std::nullopt; - } - else if ( - holds_alternative(*varDecl.value) || - holds_alternative(*varDecl.value) - ) - { - yulAssert(varDecl.variables.size() == 1, ""); - auto newRhs = expandValue(*varDecl.value); - auto newLhs = generateU64IdentifierNames(varDecl.variables[0].name); - vector ret; - for (size_t i = 0; i < 4; i++) - ret.emplace_back(VariableDeclaration{ - varDecl.debugData, - {TypedName{varDecl.debugData, newLhs[i], m_targetDialect.defaultType}}, - std::move(newRhs[i]) - } - ); - return {std::move(ret)}; - } - else - yulAssert(false, ""); - } - else if (holds_alternative(_s)) - { - Assignment& assignment = std::get(_s); - yulAssert(assignment.value, ""); - - if (holds_alternative(*assignment.value)) - { - visit(*assignment.value); - - // Special handling for datasize and dataoffset - they will only need one variable. - if (BuiltinFunction const* f = m_inputDialect.builtin(std::get(*assignment.value).functionName.name)) - if (f->name == "datasize"_yulstring || f->name == "dataoffset"_yulstring) - { - yulAssert(f->literalArguments.size() == 1, ""); - yulAssert(f->literalArguments[0] == LiteralKind::String, ""); - yulAssert(assignment.variableNames.size() == 1, ""); - auto newLhs = generateU64IdentifierNames(assignment.variableNames[0].name); - vector ret; - for (size_t i = 0; i < 3; i++) - ret.emplace_back(Assignment{ - assignment.debugData, - {Identifier{assignment.debugData, newLhs[i]}}, - make_unique(Literal{ - debugDataOf(*assignment.value), - LiteralKind::Number, - "0"_yulstring, - m_targetDialect.defaultType - }) - }); - ret.emplace_back(Assignment{ - assignment.debugData, - {Identifier{assignment.debugData, newLhs[3]}}, - std::move(assignment.value) - }); - return {std::move(ret)}; - } - - rewriteIdentifierList(assignment.variableNames); - return std::nullopt; - } - else if ( - holds_alternative(*assignment.value) || - holds_alternative(*assignment.value) - ) - { - yulAssert(assignment.variableNames.size() == 1, ""); - auto newRhs = expandValue(*assignment.value); - YulString lhsName = assignment.variableNames[0].name; - vector ret; - for (size_t i = 0; i < 4; i++) - ret.emplace_back(Assignment{ - assignment.debugData, - {Identifier{assignment.debugData, m_variableMapping.at(lhsName)[i]}}, - std::move(newRhs[i]) - } - ); - return {std::move(ret)}; - } - else - yulAssert(false, ""); - } - else if (holds_alternative(_s)) - return handleSwitch(std::get(_s)); - else - visit(_s); - return std::nullopt; - } - ); -} - -void WordSizeTransform::run( - Dialect const& _inputDialect, - Dialect const& _targetDialect, - Block& _ast, - NameDispenser& _nameDispenser -) -{ - // Free the name `or_bool`. - NameDisplacer{_nameDispenser, {"or_bool"_yulstring}}(_ast); - WordSizeTransform{_inputDialect, _targetDialect, _nameDispenser}(_ast); -} - -WordSizeTransform::WordSizeTransform( - Dialect const& _inputDialect, - Dialect const& _targetDialect, - NameDispenser& _nameDispenser -): - m_inputDialect(_inputDialect), - m_targetDialect(_targetDialect), - m_nameDispenser(_nameDispenser) -{ -} - -void WordSizeTransform::rewriteVarDeclList(TypedNameList& _nameList) -{ - iterateReplacing( - _nameList, - [&](TypedName const& _n) -> std::optional - { - TypedNameList ret; - for (auto newName: generateU64IdentifierNames(_n.name)) - ret.emplace_back(TypedName{_n.debugData, newName, m_targetDialect.defaultType}); - return ret; - } - ); -} - -void WordSizeTransform::rewriteIdentifierList(vector& _ids) -{ - iterateReplacing( - _ids, - [&](Identifier const& _id) -> std::optional> - { - vector ret; - for (auto newId: m_variableMapping.at(_id.name)) - ret.push_back(Identifier{_id.debugData, newId}); - return ret; - } - ); -} - -vector WordSizeTransform::handleSwitchInternal( - shared_ptr const& _debugData, - vector const& _splitExpressions, - vector _cases, - YulString _runDefaultFlag, - size_t _depth -) -{ - if (_depth == 4) - { - yulAssert(_cases.size() == 1, ""); - return std::move(_cases.front().body.statements); - } - - // Extract current 64 bit segment and group by it. - map> cases; - for (Case& c: _cases) - { - yulAssert(c.value, "Default case still present."); - cases[ - (valueOfLiteral(*c.value) >> (256 - 64 * (_depth + 1))) & - std::numeric_limits::max() - ].emplace_back(std::move(c)); - } - - Switch ret{ - _debugData, - make_unique(Identifier{_debugData, _splitExpressions.at(_depth)}), - {} - }; - - for (auto& c: cases) - { - Literal label{_debugData, LiteralKind::Number, YulString(c.first.str()), m_targetDialect.defaultType}; - ret.cases.emplace_back(Case{ - c.second.front().debugData, - make_unique(std::move(label)), - Block{_debugData, handleSwitchInternal( - _debugData, - _splitExpressions, - std::move(c.second), - _runDefaultFlag, - _depth + 1 - )} - }); - } - if (!_runDefaultFlag.empty()) - ret.cases.emplace_back(Case{ - _debugData, - nullptr, - Block{_debugData, make_vector( - Assignment{ - _debugData, - {{_debugData, _runDefaultFlag}}, - make_unique(Literal{_debugData, LiteralKind::Boolean, "true"_yulstring, m_targetDialect.boolType}) - } - )} - }); - return make_vector(std::move(ret)); -} - -std::vector WordSizeTransform::handleSwitch(Switch& _switch) -{ - for (auto& c: _switch.cases) - (*this)(c.body); - - // Turns the switch into a quadruply-nested switch plus - // a flag that tells to execute the default case after all the switches. - vector ret; - - YulString runDefaultFlag; - Case defaultCase; - if (!_switch.cases.back().value) - { - runDefaultFlag = m_nameDispenser.newName("run_default"_yulstring); - defaultCase = std::move(_switch.cases.back()); - _switch.cases.pop_back(); - ret.emplace_back(VariableDeclaration{ - _switch.debugData, - {TypedName{_switch.debugData, runDefaultFlag, m_targetDialect.boolType}}, - {} - }); - } - vector splitExpressions; - for (auto const& expr: expandValue(*_switch.expression)) - splitExpressions.emplace_back(std::get(*expr).name); - - ret += handleSwitchInternal( - _switch.debugData, - splitExpressions, - std::move(_switch.cases), - runDefaultFlag, - 0 - ); - if (!runDefaultFlag.empty()) - ret.emplace_back(If{ - _switch.debugData, - make_unique(Identifier{_switch.debugData, runDefaultFlag}), - std::move(defaultCase.body) - }); - return ret; -} - - -array WordSizeTransform::generateU64IdentifierNames(YulString const& _s) -{ - yulAssert(m_variableMapping.find(_s) == m_variableMapping.end(), ""); - for (size_t i = 0; i < 4; i++) - m_variableMapping[_s][i] = m_nameDispenser.newName(YulString{_s.str() + "_" + to_string(i)}); - return m_variableMapping[_s]; -} - -array, 4> WordSizeTransform::expandValue(Expression const& _e) -{ - array, 4> ret; - if (holds_alternative(_e)) - { - auto const& id = std::get(_e); - for (size_t i = 0; i < 4; i++) - ret[i] = make_unique(Identifier{id.debugData, m_variableMapping.at(id.name)[i]}); - } - else if (holds_alternative(_e)) - { - auto const& lit = std::get(_e); - u256 val = valueOfLiteral(lit); - for (size_t exprIndex = 0; exprIndex < 4; ++exprIndex) - { - size_t exprIndexReverse = 3 - exprIndex; - u256 currentVal = val & std::numeric_limits::max(); - val >>= 64; - ret[exprIndexReverse] = make_unique( - Literal{ - lit.debugData, - LiteralKind::Number, - YulString(currentVal.str()), - m_targetDialect.defaultType - } - ); - } - } - else - yulAssert(false, "Invalid expression to split."); - return ret; -} - -vector WordSizeTransform::expandValueToVector(Expression const& _e) -{ - vector ret; - for (unique_ptr& val: expandValue(_e)) - ret.emplace_back(std::move(*val)); - return ret; -} diff --git a/libyul/backends/wasm/WordSizeTransform.h b/libyul/backends/wasm/WordSizeTransform.h deleted file mode 100644 index faa7806a562d..000000000000 --- a/libyul/backends/wasm/WordSizeTransform.h +++ /dev/null @@ -1,108 +0,0 @@ -/* - This file is part of solidity. - - solidity is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - solidity is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with solidity. If not, see . -*/ -// SPDX-License-Identifier: GPL-3.0 -/** - * Replace every u256 variable with four u64 variables. - */ - -#pragma once - -#include -#include - -#include - -#include -#include - -namespace solidity::yul -{ - -/** - * A stage that replace every u256 variable with four u64 variables. - * This transformation stage is required because values in EVM are 256 bits, - * but wasm only supports values up to 64 bits, so we use four u64 values to simulate - * one u256 value. - * - * For FunctionCall that accepts or returns u256 values, they accepts or returns - * four times the number of values after this transformation, with the order of significance, - * from the most significant to the least significant. - * - * For example, the FunctionCall MUL supplied by code generator - * should take 8 arguments and return 4 values (instead of 2 and 1) after this transformation. - * - * mul(a1, a2, a3, a4, b1, b2, b3, b4) -> c1, c2, c3, c4 - * - * the value of c4 should be - * ((a1*(2^192) + a2*(2^128) + a3(2^64) + a4) * (b1*(2^192) + b2*(2^128) + b3(2^64) + b4)) & ((1<<64)-1) - * - * The resulting code still uses the EVM builtin functions but assumes that they - * take four times the parameters and each of type u64. - * In addition, it uses a single other builtin function called `or_bool` that - * takes four u64 parameters and is supposed to return the logical disjunction - * of them as a i32 value. If this name is already used somewhere, it is renamed. - * - * Prerequisite: Disambiguator, ForLoopConditionIntoBody, ExpressionSplitter - */ -class WordSizeTransform: public ASTModifier -{ -public: - void operator()(FunctionDefinition&) override; - void operator()(FunctionCall&) override; - void operator()(If&) override; - void operator()(Switch&) override; - void operator()(ForLoop&) override; - void operator()(Block& _block) override; - - static void run( - Dialect const& _inputDialect, - Dialect const& _targetDialect, - Block& _ast, - NameDispenser& _nameDispenser - ); - -private: - explicit WordSizeTransform( - Dialect const& _inputDialect, - Dialect const& _targetDialect, - NameDispenser& _nameDispenser - ); - - void rewriteVarDeclList(std::vector&); - void rewriteIdentifierList(std::vector&); - - std::vector handleSwitch(Switch& _switch); - std::vector handleSwitchInternal( - std::shared_ptr const& _debugData, - std::vector const& _splitExpressions, - std::vector _cases, - YulString _runDefaultFlag, - size_t _depth - ); - - std::array generateU64IdentifierNames(YulString const& _s); - std::array, 4> expandValue(Expression const& _e); - std::vector expandValueToVector(Expression const& _e); - - Dialect const& m_inputDialect; - Dialect const& m_targetDialect; - NameDispenser& m_nameDispenser; - /// maps original u256 variable's name to corresponding u64 variables' names - std::map> m_variableMapping; -}; - -} diff --git a/libyul/backends/wasm/polyfill/Arithmetic.yul b/libyul/backends/wasm/polyfill/Arithmetic.yul deleted file mode 100644 index 7a4a80f5f1d5..000000000000 --- a/libyul/backends/wasm/polyfill/Arithmetic.yul +++ /dev/null @@ -1,396 +0,0 @@ -/* - This file is part of solidity. - - solidity is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - solidity is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with solidity. If not, see . -*/ -// SPDX-License-Identifier: GPL-3.0 - -// NOTE: This file is used to generate `ewasmPolyfills/Arithmetic.h`. - -// returns a + y + c plus carry value on 64 bit values. -// c should be at most 1 -function add_carry(x, y, c) -> r, r_c { - let t := i64.add(x, y) - r := i64.add(t, c) - r_c := i64.extend_i32_u(i32.or( - i64.lt_u(t, x), - i64.lt_u(r, t) - )) -} - -function add(x1, x2, x3, x4, y1, y2, y3, y4) -> r1, r2, r3, r4 { - let carry - r4, carry := add_carry(x4, y4, 0) - r3, carry := add_carry(x3, y3, carry) - r2, carry := add_carry(x2, y2, carry) - r1, carry := add_carry(x1, y1, carry) -} - -function sub(x1, x2, x3, x4, y1, y2, y3, y4) -> r1, r2, r3, r4 { - // x - y = x + (~y + 1) - let carry - r4, carry := add_carry(x4, bit_negate(y4), 1) - r3, carry := add_carry(x3, bit_negate(y3), carry) - r2, carry := add_carry(x2, bit_negate(y2), carry) - r1, carry := add_carry(x1, bit_negate(y1), carry) -} - -function sub320(x1, x2, x3, x4, x5, y1, y2, y3, y4, y5) -> r1, r2, r3, r4, r5 { - // x - y = x + (~y + 1) - let carry - r5, carry := add_carry(x5, bit_negate(y5), 1) - r4, carry := add_carry(x4, bit_negate(y4), carry) - r3, carry := add_carry(x3, bit_negate(y3), carry) - r2, carry := add_carry(x2, bit_negate(y2), carry) - r1, carry := add_carry(x1, bit_negate(y1), carry) -} - -function sub512(x1, x2, x3, x4, x5, x6, x7, x8, y1, y2, y3, y4, y5, y6, y7, y8) -> r1, r2, r3, r4, r5, r6, r7, r8 { - // x - y = x + (~y + 1) - let carry - r8, carry := add_carry(x8, bit_negate(y8), 1) - r7, carry := add_carry(x7, bit_negate(y7), carry) - r6, carry := add_carry(x6, bit_negate(y6), carry) - r5, carry := add_carry(x5, bit_negate(y5), carry) - r4, carry := add_carry(x4, bit_negate(y4), carry) - r3, carry := add_carry(x3, bit_negate(y3), carry) - r2, carry := add_carry(x2, bit_negate(y2), carry) - r1, carry := add_carry(x1, bit_negate(y1), carry) -} - -// Multiplies two 64 bit values resulting in a 128 bit -// value split into two 64 bit values. -function mul_64x64_128(x, y) -> hi, lo { - let xh, xl := split(x) - let yh, yl := split(y) - let t0 := i64.mul(xl, yl) - let t1 := i64.mul(xh, yl) - let t2 := i64.mul(xl, yh) - let t3 := i64.mul(xh, yh) - let t0h, t0l := split(t0) - let u1 := i64.add(t1, t0h) - let u1h, u1l := split(u1) - let u2 := i64.add(t2, u1l) - lo := i64.or(i64.shl(u2, 32), t0l) - hi := i64.add(t3, i64.add(i64.shr_u(u2, 32), u1h)) -} - -// Multiplies two 128 bit values resulting in a 256 bit -// value split into four 64 bit values. -function mul_128x128_256(x1, x2, y1, y2) -> r1, r2, r3, r4 { - let ah, al := mul_64x64_128(x1, y1) - let bh, bl := mul_64x64_128(x1, y2) - let ch, cl := mul_64x64_128(x2, y1) - let dh, dl := mul_64x64_128(x2, y2) - r4 := dl - let carry1, carry2 - let t1, t2 - r3, carry1 := add_carry(bl, cl, 0) - r3, carry2 := add_carry(r3, dh, 0) - t1, carry1 := add_carry(bh, ch, carry1) - r2, carry2 := add_carry(t1, al, carry2) - r1 := i64.add(i64.add(ah, carry1), carry2) -} - -// Multiplies two 256 bit values resulting in a 512 bit -// value split into eight 64 bit values. -function mul_256x256_512(x1, x2, x3, x4, y1, y2, y3, y4) -> r1, r2, r3, r4, r5, r6, r7, r8 { - let a1, a2, a3, a4 := mul_128x128_256(x1, x2, y1, y2) - let b1, b2, b3, b4 := mul_128x128_256(x1, x2, y3, y4) - let c1, c2, c3, c4 := mul_128x128_256(x3, x4, y1, y2) - let d1, d2, d3, d4 := mul_128x128_256(x3, x4, y3, y4) - r8 := d4 - r7 := d3 - let carry1, carry2 - let t1, t2 - r6, carry1 := add_carry(b4, c4, 0) - r6, carry2 := add_carry(r6, d2, 0) - r5, carry1 := add_carry(b3, c3, carry1) - r5, carry2 := add_carry(r5, d1, carry2) - r4, carry1 := add_carry(a4, b2, carry1) - r4, carry2 := add_carry(r4, c2, carry2) - r3, carry1 := add_carry(a3, b1, carry1) - r3, carry2 := add_carry(r3, c1, carry2) - r2, carry1 := add_carry(a2, carry1, carry2) - r1 := i64.add(a1, carry1) -} - -function mul(x1, x2, x3, x4, y1, y2, y3, y4) -> r1, r2, r3, r4 { - // TODO it would actually suffice to have mul_128x128_128 for the first two. - let b1, b2, b3, b4 := mul_128x128_256(x3, x4, y1, y2) - let c1, c2, c3, c4 := mul_128x128_256(x1, x2, y3, y4) - let d1, d2, d3, d4 := mul_128x128_256(x3, x4, y3, y4) - r4 := d4 - r3 := d3 - let t1, t2 - t1, t2, r1, r2 := add(0, 0, b3, b4, 0, 0, c3, c4) - t1, t2, r1, r2 := add(0, 0, r1, r2, 0, 0, d1, d2) -} - -function div(x1, x2, x3, x4, y1, y2, y3, y4) -> r1, r2, r3, r4 { - // Based on https://github.com/ewasm/evm2wasm/blob/master/wasm/DIV.wast - if iszero256(y1, y2, y3, y4) { - leave - } - - let m1 := 0 - let m2 := 0 - let m3 := 0 - let m4 := 1 - - for {} true {} { - if i32.or(i64.eqz(i64.clz(y1)), gte_256x256_64(y1, y2, y3, y4, x1, x2, x3, x4)) { - break - } - y1, y2, y3, y4 := shl_internal(1, y1, y2, y3, y4) - m1, m2, m3, m4 := shl_internal(1, m1, m2, m3, m4) - } - - for {} or_bool(m1, m2, m3, m4) {} { - if gte_256x256_64(x1, x2, x3, x4, y1, y2, y3, y4) { - x1, x2, x3, x4 := sub(x1, x2, x3, x4, y1, y2, y3, y4) - r1, r2, r3, r4 := add(r1, r2, r3, r4, m1, m2, m3, m4) - } - y1, y2, y3, y4 := shr_internal(1, y1, y2, y3, y4) - m1, m2, m3, m4 := shr_internal(1, m1, m2, m3, m4) - } -} - -function sdiv(x1, x2, x3, x4, y1, y2, y3, y4) -> r1, r2, r3, r4 { - // Based on https://github.com/ewasm/evm2wasm/blob/master/wasm/SDIV.wast - - let sign:i32 := i32.wrap_i64(i64.shr_u(i64.xor(x1, y1), 63)) - - if i64.eqz(i64.clz(x1)) { - x1, x2, x3, x4 := xor( - x1, x2, x3, x4, - 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff - ) - x1, x2, x3, x4 := add(x1, x2, x3, x4, 0, 0, 0, 1) - } - - if i64.eqz(i64.clz(y1)) { - y1, y2, y3, y4 := xor( - y1, y2, y3, y4, - 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff - ) - y1, y2, y3, y4 := add(y1, y2, y3, y4, 0, 0, 0, 1) - } - - r1, r2, r3, r4 := div(x1, x2, x3, x4, y1, y2, y3, y4) - - if sign { - r1, r2, r3, r4 := xor( - r1, r2, r3, r4, - 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff - ) - r1, r2, r3, r4 := add(r1, r2, r3, r4, 0, 0, 0, 1) - } -} - -function mod(x1, x2, x3, x4, y1, y2, y3, y4) -> r1, r2, r3, r4 { - // Based on https://github.com/ewasm/evm2wasm/blob/master/wasm/MOD.wast - if iszero256(y1, y2, y3, y4) { - leave - } - - r1 := x1 - r2 := x2 - r3 := x3 - r4 := x4 - - let m1 := 0 - let m2 := 0 - let m3 := 0 - let m4 := 1 - - for {} true {} { - if i32.or(i64.eqz(i64.clz(y1)), gte_256x256_64(y1, y2, y3, y4, r1, r2, r3, r4)) { - break - } - - y1, y2, y3, y4 := shl_internal(1, y1, y2, y3, y4) - m1, m2, m3, m4 := shl_internal(1, m1, m2, m3, m4) - } - - for {} or_bool(m1, m2, m3, m4) {} { - if gte_256x256_64(r1, r2, r3, r4, y1, y2, y3, y4) { - r1, r2, r3, r4 := sub(r1, r2, r3, r4, y1, y2, y3, y4) - } - - y1, y2, y3, y4 := shr_internal(1, y1, y2, y3, y4) - m1, m2, m3, m4 := shr_internal(1, m1, m2, m3, m4) - } -} - -function mod320(x1, x2, x3, x4, x5, y1, y2, y3, y4, y5) -> r1, r2, r3, r4, r5 { - // Based on https://github.com/ewasm/evm2wasm/blob/master/wasm/mod_320.wast - if iszero320(y1, y2, y3, y4, y5) { - leave - } - - let m1 := 0 - let m2 := 0 - let m3 := 0 - let m4 := 0 - let m5 := 1 - - r1 := x1 - r2 := x2 - r3 := x3 - r4 := x4 - r5 := x5 - - for {} true {} { - if i32.or(i64.eqz(i64.clz(y1)), gte_320x320_64(y1, y2, y3, y4, y5, r1, r2, r3, r4, r5)) { - break - } - y1, y2, y3, y4, y5 := shl320_internal(1, y1, y2, y3, y4, y5) - m1, m2, m3, m4, m5 := shl320_internal(1, m1, m2, m3, m4, m5) - } - - for {} or_bool_320(m1, m2, m3, m4, m5) {} { - if gte_320x320_64(r1, r2, r3, r4, r5, y1, y2, y3, y4, y5) { - r1, r2, r3, r4, r5 := sub320(r1, r2, r3, r4, r5, y1, y2, y3, y4, y5) - } - - y1, y2, y3, y4, y5 := shr320_internal(1, y1, y2, y3, y4, y5) - m1, m2, m3, m4, m5 := shr320_internal(1, m1, m2, m3, m4, m5) - } -} - -function mod512(x1, x2, x3, x4, x5, x6, x7, x8, y1, y2, y3, y4, y5, y6, y7, y8) -> r1, r2, r3, r4, r5, r6, r7, r8 { - // Based on https://github.com/ewasm/evm2wasm/blob/master/wasm/mod_512.wast - if iszero512(y1, y2, y3, y4, y5, y6, y7, y8) { - leave - } - - let m1 := 0 - let m2 := 0 - let m3 := 0 - let m4 := 0 - let m5 := 0 - let m6 := 0 - let m7 := 0 - let m8 := 1 - - r1 := x1 - r2 := x2 - r3 := x3 - r4 := x4 - r5 := x5 - r6 := x6 - r7 := x7 - r8 := x8 - - for {} true {} { - if i32.or( - i64.eqz(i64.clz(y1)), - gte_512x512_64(y1, y2, y3, y4, y5, y6, y7, y8, r1, r2, r3, r4, r5, r6, r7, r8) - ) - { - break - } - y1, y2, y3, y4, y5, y6, y7, y8 := shl512_internal(1, y1, y2, y3, y4, y5, y6, y7, y8) - m1, m2, m3, m4, m5, m6, m7, m8 := shl512_internal(1, m1, m2, m3, m4, m5, m6, m7, m8) - } - - for {} or_bool_512(m1, m2, m3, m4, m5, m6, m7, m8) {} { - if gte_512x512_64(r1, r2, r3, r4, r5, r6, r7, r8, y1, y2, y3, y4, y5, y6, y7, y8) { - r1, r2, r3, r4, r5, r6, r7, r8 := sub512(r1, r2, r3, r4, r5, r6, r7, r8, y1, y2, y3, y4, y5, y6, y7, y8) - } - - y1, y2, y3, y4, y5, y6, y7, y8 := shr512_internal(1, y1, y2, y3, y4, y5, y6, y7, y8) - m1, m2, m3, m4, m5, m6, m7, m8 := shr512_internal(1, m1, m2, m3, m4, m5, m6, m7, m8) - } -} - -function smod(x1, x2, x3, x4, y1, y2, y3, y4) -> r1, r2, r3, r4 { - // Based on https://github.com/ewasm/evm2wasm/blob/master/wasm/SMOD.wast - let m1 := 0 - let m2 := 0 - let m3 := 0 - let m4 := 1 - - let sign:i32 := i32.wrap_i64(i64.shr_u(x1, 63)) - - if i64.eqz(i64.clz(x1)) { - x1, x2, x3, x4 := xor( - x1, x2, x3, x4, - 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff - ) - x1, x2, x3, x4 := add(x1, x2, x3, x4, 0, 0, 0, 1) - } - - if i64.eqz(i64.clz(y1)) { - y1, y2, y3, y4 := xor( - y1, y2, y3, y4, - 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff - ) - y1, y2, y3, y4 := add(y1, y2, y3, y4, 0, 0, 0, 1) - } - - r1, r2, r3, r4 := mod(x1, x2, x3, x4, y1, y2, y3, y4) - - if sign { - r1, r2, r3, r4 := xor( - r1, r2, r3, r4, - 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff - ) - r1, r2, r3, r4 := add(r1, r2, r3, r4, 0, 0, 0, 1) - } -} - -function exp(x1, x2, x3, x4, y1, y2, y3, y4) -> r1, r2, r3, r4 { - r4 := 1 - for {} or_bool(y1, y2, y3, y4) {} { - if i32.wrap_i64(i64.and(y4, 1)) { - r1, r2, r3, r4 := mul(r1, r2, r3, r4, x1, x2, x3, x4) - } - x1, x2, x3, x4 := mul(x1, x2, x3, x4, x1, x2, x3, x4) - y1, y2, y3, y4 := shr_internal(1, y1, y2, y3, y4) - } -} - -function addmod(x1, x2, x3, x4, y1, y2, y3, y4, m1, m2, m3, m4) -> z1, z2, z3, z4 { - let carry - z4, carry := add_carry(x4, y4, 0) - z3, carry := add_carry(x3, y3, carry) - z2, carry := add_carry(x2, y2, carry) - z1, carry := add_carry(x1, y1, carry) - - let z0 - z0, z1, z2, z3, z4 := mod320(carry, z1, z2, z3, z4, 0, m1, m2, m3, m4) -} - -function mulmod(x1, x2, x3, x4, y1, y2, y3, y4, m1, m2, m3, m4) -> z1, z2, z3, z4 { - let r1, r2, r3, r4, r5, r6, r7, r8 := mul_256x256_512(x1, x2, x3, x4, y1, y2, y3, y4) - let t1 - let t2 - let t3 - let t4 - t1, t2, t3, t4, z1, z2, z3, z4 := mod512(r1, r2, r3, r4, r5, r6, r7, r8, 0, 0, 0, 0, m1, m2, m3, m4) -} - -function signextend(x1, x2, x3, x4, y1, y2, y3, y4) -> z1, z2, z3, z4 { - z1 := y1 - z2 := y2 - z3 := y3 - z4 := y4 - if lt_256x256_64(x1, x2, x3, x4, 0, 0, 0, 32) { - let d := i64.mul(i64.sub(31, x4), 8) - z1, z2, z3, z4 := shl(0, 0, 0, d, z1, z2, z3, z4) - z1, z2, z3, z4 := sar(0, 0, 0, d, z1, z2, z3, z4) - } -} diff --git a/libyul/backends/wasm/polyfill/Bitwise.yul b/libyul/backends/wasm/polyfill/Bitwise.yul deleted file mode 100644 index 3efa07bf50e5..000000000000 --- a/libyul/backends/wasm/polyfill/Bitwise.yul +++ /dev/null @@ -1,222 +0,0 @@ -/* - This file is part of solidity. - - solidity is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - solidity is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with solidity. If not, see . -*/ -// SPDX-License-Identifier: GPL-3.0 - -// NOTE: This file is used to generate `ewasmPolyfills/Bitwise.h`. - -function bit_negate(x) -> y { - y := i64.xor(x, 0xffffffffffffffff) -} - -function split(x) -> hi, lo { - hi := i64.shr_u(x, 32) - lo := i64.and(x, 0xffffffff) -} - -function shl_internal(amount, x1, x2, x3, x4) -> r1, r2, r3, r4 { - // amount < 64 - r1 := i64.add(i64.shl(x1, amount), i64.shr_u(x2, i64.sub(64, amount))) - r2 := i64.add(i64.shl(x2, amount), i64.shr_u(x3, i64.sub(64, amount))) - r3 := i64.add(i64.shl(x3, amount), i64.shr_u(x4, i64.sub(64, amount))) - r4 := i64.shl(x4, amount) -} - -function shr_internal(amount, x1, x2, x3, x4) -> r1, r2, r3, r4 { - // amount < 64 - r4 := i64.add(i64.shr_u(x4, amount), i64.shl(x3, i64.sub(64, amount))) - r3 := i64.add(i64.shr_u(x3, amount), i64.shl(x2, i64.sub(64, amount))) - r2 := i64.add(i64.shr_u(x2, amount), i64.shl(x1, i64.sub(64, amount))) - r1 := i64.shr_u(x1, amount) -} - -function shl320_internal(amount, x1, x2, x3, x4, x5) -> r1, r2, r3, r4, r5 { - // amount < 64 - r1 := i64.add(i64.shl(x1, amount), i64.shr_u(x2, i64.sub(64, amount))) - r2 := i64.add(i64.shl(x2, amount), i64.shr_u(x3, i64.sub(64, amount))) - r3 := i64.add(i64.shl(x3, amount), i64.shr_u(x4, i64.sub(64, amount))) - r4 := i64.add(i64.shl(x4, amount), i64.shr_u(x5, i64.sub(64, amount))) - r5 := i64.shl(x5, 1) -} - -function shr320_internal(amount, x1, x2, x3, x4, x5) -> r1, r2, r3, r4, r5 { - // amount < 64 - r5 := i64.add(i64.shr_u(x5, amount), i64.shl(x4, i64.sub(64, amount))) - r4 := i64.add(i64.shr_u(x4, amount), i64.shl(x3, i64.sub(64, amount))) - r3 := i64.add(i64.shr_u(x3, amount), i64.shl(x2, i64.sub(64, amount))) - r2 := i64.add(i64.shr_u(x2, amount), i64.shl(x1, i64.sub(64, amount))) - r1 := i64.shr_u(x1, 1) -} - -function shl512_internal(amount, x1, x2, x3, x4, x5, x6, x7, x8) -> r1, r2, r3, r4, r5, r6, r7, r8 { - // amount < 64 - r1 := i64.add(i64.shl(x1, amount), i64.shr_u(x2, i64.sub(64, amount))) - r2 := i64.add(i64.shl(x2, amount), i64.shr_u(x3, i64.sub(64, amount))) - r3 := i64.add(i64.shl(x3, amount), i64.shr_u(x4, i64.sub(64, amount))) - r4 := i64.add(i64.shl(x4, amount), i64.shr_u(x5, i64.sub(64, amount))) - r5 := i64.add(i64.shl(x5, amount), i64.shr_u(x6, i64.sub(64, amount))) - r6 := i64.add(i64.shl(x6, amount), i64.shr_u(x7, i64.sub(64, amount))) - r7 := i64.add(i64.shl(x7, amount), i64.shr_u(x8, i64.sub(64, amount))) - r8 := i64.shl(x8, amount) -} - -function shr512_internal(amount, x1, x2, x3, x4, x5, x6, x7, x8) -> r1, r2, r3, r4, r5, r6, r7, r8 { - // amount < 64 - r8 := i64.add(i64.shr_u(x8, amount), i64.shl(x7, i64.sub(64, amount))) - r7 := i64.add(i64.shr_u(x7, amount), i64.shl(x6, i64.sub(64, amount))) - r6 := i64.add(i64.shr_u(x6, amount), i64.shl(x5, i64.sub(64, amount))) - r5 := i64.add(i64.shr_u(x5, amount), i64.shl(x4, i64.sub(64, amount))) - r4 := i64.add(i64.shr_u(x4, amount), i64.shl(x3, i64.sub(64, amount))) - r3 := i64.add(i64.shr_u(x3, amount), i64.shl(x2, i64.sub(64, amount))) - r2 := i64.add(i64.shr_u(x2, amount), i64.shl(x1, i64.sub(64, amount))) - r1 := i64.shr_u(x1, amount) -} - -function byte(x1, x2, x3, x4, y1, y2, y3, y4) -> r1, r2, r3, r4 { - if i64.eqz(i64.or(i64.or(x1, x2), x3)) { - let component - switch i64.div_u(x4, 8) - case 0 { component := y1 } - case 1 { component := y2 } - case 2 { component := y3 } - case 3 { component := y4 } - x4 := i64.mul(i64.rem_u(x4, 8), 8) - r4 := i64.shr_u(component, i64.sub(56, x4)) - r4 := i64.and(0xff, r4) - } -} - -function xor(x1, x2, x3, x4, y1, y2, y3, y4) -> r1, r2, r3, r4 { - r1 := i64.xor(x1, y1) - r2 := i64.xor(x2, y2) - r3 := i64.xor(x3, y3) - r4 := i64.xor(x4, y4) -} - -function or(x1, x2, x3, x4, y1, y2, y3, y4) -> r1, r2, r3, r4 { - r1 := i64.or(x1, y1) - r2 := i64.or(x2, y2) - r3 := i64.or(x3, y3) - r4 := i64.or(x4, y4) -} - -function and(x1, x2, x3, x4, y1, y2, y3, y4) -> r1, r2, r3, r4 { - r1 := i64.and(x1, y1) - r2 := i64.and(x2, y2) - r3 := i64.and(x3, y3) - r4 := i64.and(x4, y4) -} - -function not(x1, x2, x3, x4) -> r1, r2, r3, r4 { - let mask := 0xffffffffffffffff - r1, r2, r3, r4 := xor(x1, x2, x3, x4, mask, mask, mask, mask) -} - -function shl_single(a, amount) -> x, y { - // amount < 64 - x := i64.shr_u(a, i64.sub(64, amount)) - y := i64.shl(a, amount) -} - -function shl(x1, x2, x3, x4, y1, y2, y3, y4) -> z1, z2, z3, z4 { - if i32.and(i64.eqz(x1), i64.eqz(x2)) { - if i64.eqz(x3) { - if i64.lt_u(x4, 256) { - if i64.ge_u(x4, 128) { - y1 := y3 - y2 := y4 - y3 := 0 - y4 := 0 - x4 := i64.sub(x4, 128) - } - if i64.ge_u(x4, 64) { - y1 := y2 - y2 := y3 - y3 := y4 - y4 := 0 - x4 := i64.sub(x4, 64) - } - let t, r - t, z4 := shl_single(y4, x4) - r, z3 := shl_single(y3, x4) - z3 := i64.or(z3, t) - t, z2 := shl_single(y2, x4) - z2 := i64.or(z2, r) - r, z1 := shl_single(y1, x4) - z1 := i64.or(z1, t) - } - } - } -} - -function shr_single(a, amount) -> x, y { - // amount < 64 - y := i64.shl(a, i64.sub(64, amount)) - x := i64.shr_u(a, amount) -} - -function shr(x1, x2, x3, x4, y1, y2, y3, y4) -> z1, z2, z3, z4 { - if i32.and(i64.eqz(x1), i64.eqz(x2)) { - if i64.eqz(x3) { - if i64.lt_u(x4, 256) { - if i64.ge_u(x4, 128) { - y4 := y2 - y3 := y1 - y2 := 0 - y1 := 0 - x4 := i64.sub(x4, 128) - } - if i64.ge_u(x4, 64) { - y4 := y3 - y3 := y2 - y2 := y1 - y1 := 0 - x4 := i64.sub(x4, 64) - } - let t - z4, t := shr_single(y4, x4) - z3, t := shr_single(y3, x4) - z4 := i64.or(z4, t) - z2, t := shr_single(y2, x4) - z3 := i64.or(z3, t) - z1, t := shr_single(y1, x4) - z2 := i64.or(z2, t) - } - } - } -} - -function sar(x1, x2, x3, x4, y1, y2, y3, y4) -> z1, z2, z3, z4 { - if i64.gt_u(i64.clz(y1), 0) { - z1, z2, z3, z4 := shr(x1, x2, x3, x4, y1, y2, y3, y4) - leave - } - - if gte_256x256_64(x1, x2, x3, x4, 0, 0, 0, 256) { - z1 := 0xffffffffffffffff - z2 := 0xffffffffffffffff - z3 := 0xffffffffffffffff - z4 := 0xffffffffffffffff - } - if lt_256x256_64(x1, x2, x3, x4, 0, 0, 0, 256) { - y1, y2, y3, y4 := shr(0, 0, 0, x4, y1, y2, y3, y4) - z1, z2, z3, z4 := shl( - 0, 0, 0, i64.sub(256, x4), - 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff - ) - z1, z2, z3, z4 := or(y1, y2, y3, y4, z1, z2, z3, z4) - } -} diff --git a/libyul/backends/wasm/polyfill/Comparison.yul b/libyul/backends/wasm/polyfill/Comparison.yul deleted file mode 100644 index dc052a14595d..000000000000 --- a/libyul/backends/wasm/polyfill/Comparison.yul +++ /dev/null @@ -1,168 +0,0 @@ -/* - This file is part of solidity. - - solidity is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - solidity is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with solidity. If not, see . -*/ -// SPDX-License-Identifier: GPL-3.0 - -// NOTE: This file is used to generate `ewasmPolyfills/Comparison.h`. - -function iszero(x1, x2, x3, x4) -> r1, r2, r3, r4 { - r4 := i64.extend_i32_u(iszero256(x1, x2, x3, x4)) -} - -function iszero256(x1, x2, x3, x4) -> r:i32 { - r := i64.eqz(i64.or(i64.or(x1, x2), i64.or(x3, x4))) -} - -function iszero320(x1, x2, x3, x4, x5) -> r:i32 { - r := i64.eqz(i64.or(i64.or(i64.or(x1, x2), i64.or(x3, x4)), x5)) -} - -function iszero512(x1, x2, x3, x4, x5, x6, x7, x8) -> r:i32 { - r := i32.and(iszero256(x1, x2, x3, x4), iszero256(x5, x6, x7, x8)) -} - -function eq(x1, x2, x3, x4, y1, y2, y3, y4) -> r1, r2, r3, r4 { - r4 := i64.extend_i32_u( - i32.and( - i64.eq(x1, y1), - i32.and( - i64.eq(x2, y2), - i32.and( - i64.eq(x3, y3), - i64.eq(x4, y4) - ) - ) - ) - ) -} - -// returns 0 if a == b, -1 if a < b and 1 if a > b -function cmp(a, b) -> r:i32 { - r := i32.select(0xffffffff:i32, i64.ne(a, b), i64.lt_u(a, b)) -} - -function lt_320x320_64(x1, x2, x3, x4, x5, y1, y2, y3, y4, y5) -> z:i32 { - switch cmp(x1, y1) - case 0:i32 { - switch cmp(x2, y2) - case 0:i32 { - switch cmp(x3, y3) - case 0:i32 { - switch cmp(x4, y4) - case 0:i32 { - z := i64.lt_u(x5, y5) - } - case 1:i32 { z := 0:i32 } - default { z := 1:i32 } - } - case 1:i32 { z := 0:i32 } - default { z := 1:i32 } - } - case 1:i32 { z := 0:i32 } - default { z := 1:i32 } - } - case 1:i32 { z := 0:i32 } - default { z := 1:i32 } -} - -function lt_512x512_64(x1, x2, x3, x4, x5, x6, x7, x8, y1, y2, y3, y4, y5, y6, y7, y8) -> z:i32 { - switch cmp(x1, y1) - case 0:i32 { - switch cmp(x2, y2) - case 0:i32 { - switch cmp(x3, y3) - case 0:i32 { - switch cmp(x4, y4) - case 0:i32 { - switch cmp(x5, y5) - case 0:i32 { - switch cmp(x6, y6) - case 0:i32 { - switch cmp(x7, y7) - case 0:i32 { - z := i64.lt_u(x8, y8) - } - case 1:i32 { z := 0:i32 } - default { z := 1:i32 } - } - case 1:i32 { z := 0:i32 } - default { z := 1:i32 } - } - case 1:i32 { z := 0:i32 } - default { z := 1:i32 } - } - case 1:i32 { z := 0:i32 } - default { z := 1:i32 } - } - case 1:i32 { z := 0:i32 } - default { z := 1:i32 } - } - case 1:i32 { z := 0:i32 } - default { z := 1:i32 } - } - case 1:i32 { z := 0:i32 } - default { z := 1:i32 } -} - -function lt_256x256_64(x1, x2, x3, x4, y1, y2, y3, y4) -> z:i32 { - switch cmp(x1, y1) - case 0:i32 { - switch cmp(x2, y2) - case 0:i32 { - switch cmp(x3, y3) - case 0:i32 { - z := i64.lt_u(x4, y4) - } - case 1:i32 { z := 0:i32 } - default { z := 1:i32 } - } - case 1:i32 { z := 0:i32 } - default { z := 1:i32 } - } - case 1:i32 { z := 0:i32 } - default { z := 1:i32 } -} - -function lt(x1, x2, x3, x4, y1, y2, y3, y4) -> z1, z2, z3, z4 { - z4 := i64.extend_i32_u(lt_256x256_64(x1, x2, x3, x4, y1, y2, y3, y4)) -} - -function gte_256x256_64(x1, x2, x3, x4, y1, y2, y3, y4) -> z:i32 { - z := i32.eqz(lt_256x256_64(x1, x2, x3, x4, y1, y2, y3, y4)) -} - -function gte_320x320_64(x1, x2, x3, x4, x5, y1, y2, y3, y4, y5) -> z:i32 { - z := i32.eqz(lt_320x320_64(x1, x2, x3, x4, x5, y1, y2, y3, y4, y5)) -} - -function gte_512x512_64(x1, x2, x3, x4, x5, x6, x7, x8, y1, y2, y3, y4, y5, y6, y7, y8) -> z:i32 { - z := i32.eqz(lt_512x512_64(x1, x2, x3, x4, x5, x6, x7, x8, y1, y2, y3, y4, y5, y6, y7, y8)) -} - -function gt(x1, x2, x3, x4, y1, y2, y3, y4) -> z1, z2, z3, z4 { - z1, z2, z3, z4 := lt(y1, y2, y3, y4, x1, x2, x3, x4) -} - -function slt(x1, x2, x3, x4, y1, y2, y3, y4) -> z1, z2, z3, z4 { - // TODO correct? - x1 := i64.add(x1, 0x8000000000000000) - y1 := i64.add(y1, 0x8000000000000000) - z1, z2, z3, z4 := lt(x1, x2, x3, x4, y1, y2, y3, y4) -} - -function sgt(x1, x2, x3, x4, y1, y2, y3, y4) -> z1, z2, z3, z4 { - z1, z2, z3, z4 := slt(y1, y2, y3, y4, x1, x2, x3, x4) -} diff --git a/libyul/backends/wasm/polyfill/Conversion.yul b/libyul/backends/wasm/polyfill/Conversion.yul deleted file mode 100644 index 17d205ddd564..000000000000 --- a/libyul/backends/wasm/polyfill/Conversion.yul +++ /dev/null @@ -1,79 +0,0 @@ -/* - This file is part of solidity. - - solidity is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - solidity is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with solidity. If not, see . -*/ -// SPDX-License-Identifier: GPL-3.0 - -// NOTE: This file is used to generate `ewasmPolyfills/Conversion.h`. - -function u256_to_u128(x1, x2, x3, x4) -> v1, v2 { - if i64.ne(0, i64.or(x1, x2)) { invalid() } - v2 := x4 - v1 := x3 -} - -function u256_to_i64(x1, x2, x3, x4) -> v { - if i64.ne(0, i64.or(i64.or(x1, x2), x3)) { invalid() } - v := x4 -} - -function u256_to_i32(x1, x2, x3, x4) -> v:i32 { - if i64.ne(0, i64.or(i64.or(x1, x2), x3)) { invalid() } - if i64.ne(0, i64.shr_u(x4, 32)) { invalid() } - v := i32.wrap_i64(x4) -} - -function u256_to_byte(x1, x2, x3, x4) -> v { - if i64.ne(0, i64.or(i64.or(x1, x2), x3)) { invalid() } - if i64.gt_u(x4, 255) { invalid() } - v := x4 -} - -function u256_to_i32ptr(x1, x2, x3, x4) -> v:i32 { - v := u256_to_i32(x1, x2, x3, x4) -} - -function to_internal_i32ptr(x1, x2, x3, x4) -> r:i32 { - let p:i32 := u256_to_i32ptr(x1, x2, x3, x4) - r := i32.add(p, 64:i32) - if i32.lt_u(r, p) { invalid() } -} - -function u256_to_address(x1, x2, x3, x4) -> r1, r2, r3 { - if i64.ne(0, x1) { invalid() } - if i64.ne(0, i64.shr_u(x2, 32)) { invalid() } - r1 := x2 - r2 := x3 - r3 := x4 -} - -function bswap16(x:i32) -> y:i32 { - let hi:i32 := i32.and(i32.shl(x, 8:i32), 0xff00:i32) - let lo:i32 := i32.and(i32.shr_u(x, 8:i32), 0xff:i32) - y := i32.or(hi, lo) -} - -function bswap32(x:i32) -> y:i32 { - let hi:i32 := i32.shl(bswap16(x), 16:i32) - let lo:i32 := bswap16(i32.shr_u(x, 16:i32)) - y := i32.or(hi, lo) -} - - -function bswap64(x) -> y { - let hi := i64.shl(i64.extend_i32_u(bswap32(i32.wrap_i64(x))), 32) - let lo := i64.extend_i32_u(bswap32(i32.wrap_i64(i64.shr_u(x, 32)))) - y := i64.or(hi, lo) -} diff --git a/libyul/backends/wasm/polyfill/Interface.yul b/libyul/backends/wasm/polyfill/Interface.yul deleted file mode 100644 index a840e3bb016d..000000000000 --- a/libyul/backends/wasm/polyfill/Interface.yul +++ /dev/null @@ -1,413 +0,0 @@ -/* - This file is part of solidity. - - solidity is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - solidity is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with solidity. If not, see . -*/ -// SPDX-License-Identifier: GPL-3.0 - -// NOTE: This file is used to generate `ewasmPolyfills/Interface.h`. - -function address() -> z1, z2, z3, z4 { - eth.getAddress(12:i32) - z1, z2, z3, z4 := mload_address(0:i32) -} - -function balance(x1, x2, x3, x4) -> z1, z2, z3, z4 { - mstore_address(0:i32, x1, x2, x3, x4) - eth.getExternalBalance(12:i32, 32:i32) - z3 := i64.load(40:i32) - z4 := i64.load(32:i32) -} - -function selfbalance() -> z1, z2, z3, z4 { - // TODO: not part of current Ewasm spec - unreachable() -} - -function chainid() -> z1, z2, z3, z4 { - // TODO: not part of current Ewasm spec - unreachable() -} - -function origin() -> z1, z2, z3, z4 { - eth.getTxOrigin(12:i32) - z1, z2, z3, z4 := mload_address(0:i32) -} - -function caller() -> z1, z2, z3, z4 { - eth.getCaller(12:i32) - z1, z2, z3, z4 := mload_address(0:i32) -} - -function callvalue() -> z1, z2, z3, z4 { - eth.getCallValue(0:i32) - z3 := i64.load(8:i32) - z4 := i64.load(0:i32) -} - -function calldataload(x1, x2, x3, x4) -> z1, z2, z3, z4 { - calldatacopy(0, 0, 0, 0, x1, x2, x3, x4, 0, 0, 0, 32) - z1, z2, z3, z4 := mload_internal(0:i32) -} - -function calldatasize() -> z1, z2, z3, z4 { - z4 := i64.extend_i32_u(eth.getCallDataSize()) -} - -function calldatacopy(x1, x2, x3, x4, y1, y2, y3, y4, z1, z2, z3, z4) { - let cds:i32 := eth.getCallDataSize() - let destination:i32 := u256_to_i32(x1, x2, x3, x4) - let offset:i32 := u256_to_i32(y1, y2, y3, y4) - let requested_size:i32 := u256_to_i32(z1, z2, z3, z4) - // overflow? - if i32.gt_u(offset, i32.sub(0xffffffff:i32, requested_size)) { - eth.revert(0:i32, 0:i32) - } - - let available_size:i32 := i32.sub(cds, offset) - if i32.gt_u(offset, cds) { - available_size := 0:i32 - } - - if i32.gt_u(available_size, 0:i32) { - eth.callDataCopy( - destination, - offset, - available_size - ) - } - - if i32.gt_u(requested_size, available_size) { - memset(i32.add(destination, available_size), 0:i32, i32.sub(requested_size, available_size)) - } -} - -// Needed? -function codesize() -> z1, z2, z3, z4 { - z4 := i64.extend_i32_u(eth.getCodeSize()) -} - -function codecopy(x1, x2, x3, x4, y1, y2, y3, y4, z1, z2, z3, z4) { - eth.codeCopy( - to_internal_i32ptr(x1, x2, x3, x4), - u256_to_i32(y1, y2, y3, y4), - u256_to_i32(z1, z2, z3, z4) - ) -} - -function datacopy(x1, x2, x3, x4, y1, y2, y3, y4, z1, z2, z3, z4) { - // TODO correct? - codecopy(x1, x2, x3, x4, y1, y2, y3, y4, z1, z2, z3, z4) -} - -function gasprice() -> z1, z2, z3, z4 { - eth.getTxGasPrice(0:i32) - z3 := i64.load(8:i32) - z4 := i64.load(0:i32) -} - -function extcodesize_internal(x1, x2, x3, x4) -> r:i32 { - mstore_address(0:i32, x1, x2, x3, x4) - r := eth.getExternalCodeSize(12:i32) -} - -function extcodesize(x1, x2, x3, x4) -> z1, z2, z3, z4 { - z4 := i64.extend_i32_u(extcodesize_internal(x1, x2, x3, x4)) -} - -function extcodehash(x1, x2, x3, x4) -> z1, z2, z3, z4 { - // TODO: not part of current Ewasm spec - unreachable() -} - -function extcodecopy(a1, a2, a3, a4, p1, p2, p3, p4, o1, o2, o3, o4, l1, l2, l3, l4) { - mstore_address(0:i32, a1, a2, a3, a4) - let codeOffset:i32 := u256_to_i32(o1, o2, o3, o4) - let codeLength:i32 := u256_to_i32(l1, l2, l3, l4) - eth.externalCodeCopy(12:i32, to_internal_i32ptr(p1, p2, p3, p4), codeOffset, codeLength) -} - -function returndatasize() -> z1, z2, z3, z4 { - z4 := i64.extend_i32_u(eth.getReturnDataSize()) -} - -function returndatacopy(x1, x2, x3, x4, y1, y2, y3, y4, z1, z2, z3, z4) { - eth.returnDataCopy( - to_internal_i32ptr(x1, x2, x3, x4), - u256_to_i32(y1, y2, y3, y4), - u256_to_i32(z1, z2, z3, z4) - ) -} - -function blockhash(x1, x2, x3, x4) -> z1, z2, z3, z4 { - let r:i32 := eth.getBlockHash(u256_to_i64(x1, x2, x3, x4), 0:i32) - if i32.eqz(r) { - z1, z2, z3, z4 := mload_internal(0:i32) - } -} - -function coinbase() -> z1, z2, z3, z4 { - eth.getBlockCoinbase(12:i32) - z1, z2, z3, z4 := mload_address(0:i32) -} - -function timestamp() -> z1, z2, z3, z4 { - z4 := eth.getBlockTimestamp() -} - -function number() -> z1, z2, z3, z4 { - z4 := eth.getBlockNumber() -} - -function difficulty() -> z1, z2, z3, z4 { - eth.getBlockDifficulty(0:i32) - z1 := i64.load(24:i32) - z2 := i64.load(16:i32) - z3 := i64.load(8:i32) - z4 := i64.load(0:i32) -} - -function gaslimit() -> z1, z2, z3, z4 { - z4 := eth.getBlockGasLimit() -} - -function mload(x1, x2, x3, x4) -> z1, z2, z3, z4 { - z1, z2, z3, z4 := mload_internal(to_internal_i32ptr(x1, x2, x3, x4)) -} - -function mstore(x1, x2, x3, x4, y1, y2, y3, y4) { - mstore_internal(to_internal_i32ptr(x1, x2, x3, x4), y1, y2, y3, y4) -} - -// Needed? -function msize() -> z1, z2, z3, z4 { - // TODO implement - unreachable() -} - -function sload(x1, x2, x3, x4) -> z1, z2, z3, z4 { - mstore_internal(0:i32, x1, x2, x3, x4) - eth.storageLoad(0:i32, 32:i32) - z1, z2, z3, z4 := mload_internal(32:i32) -} - -function sstore(x1, x2, x3, x4, y1, y2, y3, y4) { - mstore_internal(0:i32, x1, x2, x3, x4) - mstore_internal(32:i32, y1, y2, y3, y4) - eth.storageStore(0:i32, 32:i32) -} - -function gas() -> z1, z2, z3, z4 { - z4 := eth.getGasLeft() -} - -function log0(p1, p2, p3, p4, s1, s2, s3, s4) { - eth.log( - to_internal_i32ptr(p1, p2, p3, p4), - u256_to_i32(s1, s2, s3, s4), - 0:i32, 0:i32, 0:i32, 0:i32, 0:i32 - ) -} - -function log1( - p1, p2, p3, p4, s1, s2, s3, s4, - t1_1, t1_2, t1_3, t1_4 -) { - eth.log( - to_internal_i32ptr(p1, p2, p3, p4), - u256_to_i32(s1, s2, s3, s4), - 1:i32, - to_internal_i32ptr(t1_1, t1_2, t1_3, t1_4), - 0:i32, 0:i32, 0:i32 - ) -} - -function log2( - p1, p2, p3, p4, s1, s2, s3, s4, - t1_1, t1_2, t1_3, t1_4, - t2_1, t2_2, t2_3, t2_4 -) { - eth.log( - to_internal_i32ptr(p1, p2, p3, p4), - u256_to_i32(s1, s2, s3, s4), - 2:i32, - to_internal_i32ptr(t1_1, t1_2, t1_3, t1_4), - to_internal_i32ptr(t2_1, t2_2, t2_3, t2_4), - 0:i32, 0:i32 - ) -} - -function log3( - p1, p2, p3, p4, s1, s2, s3, s4, - t1_1, t1_2, t1_3, t1_4, - t2_1, t2_2, t2_3, t2_4, - t3_1, t3_2, t3_3, t3_4 -) { - eth.log( - to_internal_i32ptr(p1, p2, p3, p4), - u256_to_i32(s1, s2, s3, s4), - 3:i32, - to_internal_i32ptr(t1_1, t1_2, t1_3, t1_4), - to_internal_i32ptr(t2_1, t2_2, t2_3, t2_4), - to_internal_i32ptr(t3_1, t3_2, t3_3, t3_4), - 0:i32 - ) -} - -function log4( - p1, p2, p3, p4, s1, s2, s3, s4, - t1_1, t1_2, t1_3, t1_4, - t2_1, t2_2, t2_3, t2_4, - t3_1, t3_2, t3_3, t3_4, - t4_1, t4_2, t4_3, t4_4, -) { - eth.log( - to_internal_i32ptr(p1, p2, p3, p4), - u256_to_i32(s1, s2, s3, s4), - 4:i32, - to_internal_i32ptr(t1_1, t1_2, t1_3, t1_4), - to_internal_i32ptr(t2_1, t2_2, t2_3, t2_4), - to_internal_i32ptr(t3_1, t3_2, t3_3, t3_4), - to_internal_i32ptr(t4_1, t4_2, t4_3, t4_4) - ) -} - -function create( - x1, x2, x3, x4, - y1, y2, y3, y4, - z1, z2, z3, z4 -) -> a1, a2, a3, a4 { - let v1, v2 := u256_to_u128(x1, x2, x3, x4) - mstore_internal(0:i32, 0, 0, v1, v2) - - let r:i32 := eth.create(0:i32, to_internal_i32ptr(y1, y2, y3, y4), u256_to_i32(z1, z2, z3, z4), 32:i32) - if i32.eqz(r) { - a1, a2, a3, a4 := mload_internal(32:i32) - } -} - -function call( - a1, a2, a3, a4, - b1, b2, b3, b4, - c1, c2, c3, c4, - d1, d2, d3, d4, - e1, e2, e3, e4, - f1, f2, f3, f4, - g1, g2, g3, g4 -) -> x1, x2, x3, x4 { - let g := u256_to_i64(a1, a2, a3, a4) - mstore_address(0:i32, b1, b2, b3, b4) - - let v1, v2 := u256_to_u128(c1, c2, c3, c4) - mstore_internal(32:i32, 0, 0, v1, v2) - - x4 := i64.extend_i32_u(eth.call(g, 12:i32, 32:i32, to_internal_i32ptr(d1, d2, d3, d4), u256_to_i32(e1, e2, e3, e4))) -} - -function callcode( - a1, a2, a3, a4, - b1, b2, b3, b4, - c1, c2, c3, c4, - d1, d2, d3, d4, - e1, e2, e3, e4, - f1, f2, f3, f4, - g1, g2, g3, g4 -) -> x1, x2, x3, x4 { - mstore_address(0:i32, b1, b2, b3, b4) - - let v1, v2 := u256_to_u128(c1, c2, c3, c4) - mstore_internal(32:i32, 0, 0, v1, v2) - - x4 := i64.extend_i32_u(eth.callCode( - u256_to_i64(a1, a2, a3, a4), - 12:i32, - 32:i32, - to_internal_i32ptr(d1, d2, d3, d4), - u256_to_i32(e1, e2, e3, e4) - )) -} - -function delegatecall( - a1, a2, a3, a4, - b1, b2, b3, b4, - c1, c2, c3, c4, - d1, d2, d3, d4, - e1, e2, e3, e4, - f1, f2, f3, f4 -) -> x1, x2, x3, x4 { - mstore_address(0:i32, b1, b2, b3, b4) - - x4 := i64.extend_i32_u(eth.callDelegate( - u256_to_i64(a1, a2, a3, a4), - 12:i32, - to_internal_i32ptr(c1, c2, c3, c4), - u256_to_i32(d1, d2, d3, d4) - )) -} - -function staticcall( - a1, a2, a3, a4, - b1, b2, b3, b4, - c1, c2, c3, c4, - d1, d2, d3, d4, - e1, e2, e3, e4, - f1, f2, f3, f4 -) -> x1, x2, x3, x4 { - mstore_address(0:i32, b1, b2, b3, b4) - - x4 := i64.extend_i32_u(eth.callStatic( - u256_to_i64(a1, a2, a3, a4), - 12:i32, - to_internal_i32ptr(c1, c2, c3, c4), - u256_to_i32(d1, d2, d3, d4) - )) -} - -function create2( - a1, a2, a3, a4, - b1, b2, b3, b4, - c1, c2, c3, c4, - d1, d2, d3, d4 -) -> x1, x2, x3, x4 { - // TODO: not part of current Ewasm spec - unreachable() -} - -function selfdestruct(a1, a2, a3, a4) { - mstore_address(0:i32, a1, a2, a3, a4) - // In EVM, addresses are padded to 32 bytes, so discard the first 12. - eth.selfDestruct(12:i32) -} - -function return(x1, x2, x3, x4, y1, y2, y3, y4) { - eth.finish( - to_internal_i32ptr(x1, x2, x3, x4), - u256_to_i32(y1, y2, y3, y4) - ) -} - -function revert(x1, x2, x3, x4, y1, y2, y3, y4) { - eth.revert( - to_internal_i32ptr(x1, x2, x3, x4), - u256_to_i32(y1, y2, y3, y4) - ) -} - -function invalid() { - unreachable() -} - -function stop() { - eth.finish(0:i32, 0:i32) -} diff --git a/libyul/backends/wasm/polyfill/Keccak.yul b/libyul/backends/wasm/polyfill/Keccak.yul deleted file mode 100644 index 2dae23394101..000000000000 --- a/libyul/backends/wasm/polyfill/Keccak.yul +++ /dev/null @@ -1,24 +0,0 @@ -/* - This file is part of solidity. - - solidity is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - solidity is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with solidity. If not, see . -*/ -// SPDX-License-Identifier: GPL-3.0 - -// NOTE: This file is used to generate `ewasmPolyfills/Keccak.h`. - -function keccak256(x1, x2, x3, x4, y1, y2, y3, y4) -> z1, z2, z3, z4 { - // TODO implement - unreachable() -} diff --git a/libyul/backends/wasm/polyfill/Logical.yul b/libyul/backends/wasm/polyfill/Logical.yul deleted file mode 100644 index 8d297d3545e6..000000000000 --- a/libyul/backends/wasm/polyfill/Logical.yul +++ /dev/null @@ -1,31 +0,0 @@ -/* - This file is part of solidity. - - solidity is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - solidity is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with solidity. If not, see . -*/ -// SPDX-License-Identifier: GPL-3.0 - -// NOTE: This file is used to generate `ewasmPolyfills/Logical.h`. - -function or_bool(a, b, c, d) -> r:i32 { - r := i32.eqz(i64.eqz(i64.or(i64.or(a, b), i64.or(c, d)))) -} - -function or_bool_320(a, b, c, d, e) -> r:i32 { - r := i32.or(or_bool(a, b, c, 0), or_bool(d, e, 0, 0)) -} - -function or_bool_512(a, b, c, d, e, f, g, h) -> r:i32 { - r := i32.or(or_bool(a, b, c, d), or_bool(e, f, g, h)) -} diff --git a/libyul/backends/wasm/polyfill/Memory.yul b/libyul/backends/wasm/polyfill/Memory.yul deleted file mode 100644 index 410c42d8fa2b..000000000000 --- a/libyul/backends/wasm/polyfill/Memory.yul +++ /dev/null @@ -1,109 +0,0 @@ -/* - This file is part of solidity. - - solidity is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - solidity is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with solidity. If not, see . -*/ -// SPDX-License-Identifier: GPL-3.0 - -// NOTE: This file is used to generate `ewasmPolyfills/Memory.h`. - -function save_temp_mem_32() -> t1, t2, t3, t4 { - t1 := i64.load(0:i32) - t2 := i64.load(8:i32) - t3 := i64.load(16:i32) - t4 := i64.load(24:i32) -} - -function restore_temp_mem_32(t1, t2, t3, t4) { - i64.store(0:i32, t1) - i64.store(8:i32, t2) - i64.store(16:i32, t3) - i64.store(24:i32, t4) -} - -function save_temp_mem_64() -> t1, t2, t3, t4, t5, t6, t7, t8 { - t1 := i64.load(0:i32) - t2 := i64.load(8:i32) - t3 := i64.load(16:i32) - t4 := i64.load(24:i32) - t5 := i64.load(32:i32) - t6 := i64.load(40:i32) - t7 := i64.load(48:i32) - t8 := i64.load(54:i32) -} - -function restore_temp_mem_64(t1, t2, t3, t4, t5, t6, t7, t8) { - i64.store(0:i32, t1) - i64.store(8:i32, t2) - i64.store(16:i32, t3) - i64.store(24:i32, t4) - i64.store(32:i32, t5) - i64.store(40:i32, t6) - i64.store(48:i32, t7) - i64.store(54:i32, t8) -} - -function pop(x1, x2, x3, x4) { -} - -function memoryguard(x:i64) -> y1, y2, y3, y4 { - y4 := x -} - -// Fill `length` bytes starting from `ptr` with `value`. -function memset(ptr:i32, value:i32, length:i32) { - for { let i:i32 := 0:i32 } i32.lt_u(i, length) { i := i32.add(i, 1:i32) } - { - i32.store8(i32.add(ptr, i), value) - } -} - -// Writes 256-bits from `pos`, but only set the bottom 160-bits. -function mstore_address(pos:i32, a1, a2, a3, a4) { - a1, a2, a3 := u256_to_address(a1, a2, a3, a4) - i64.store(pos, 0:i64) - i32.store(i32.add(pos, 8:i32), 0:i32) - i32.store(i32.add(pos, 12:i32), bswap32(i32.wrap_i64(a1))) - i64.store(i32.add(pos, 16:i32), bswap64(a2)) - i64.store(i32.add(pos, 24:i32), bswap64(a3)) -} - -// Reads 256-bits from `pos`, but only returns the bottom 160-bits. -function mload_address(pos:i32) -> z1, z2, z3, z4 { - z2 := i64.extend_i32_u(bswap32(i32.load(i32.add(pos, 12:i32)))) - z3 := bswap64(i64.load(i32.add(pos, 16:i32))) - z4 := bswap64(i64.load(i32.add(pos, 24:i32))) -} - -// Writes 256-bits from `pos`. -function mstore_internal(pos:i32, y1, y2, y3, y4) { - i64.store(pos, bswap64(y1)) - i64.store(i32.add(pos, 8:i32), bswap64(y2)) - i64.store(i32.add(pos, 16:i32), bswap64(y3)) - i64.store(i32.add(pos, 24:i32), bswap64(y4)) -} - -// Reads 256-bits from `pos`. -function mload_internal(pos:i32) -> z1, z2, z3, z4 { - z1 := bswap64(i64.load(pos)) - z2 := bswap64(i64.load(i32.add(pos, 8:i32))) - z3 := bswap64(i64.load(i32.add(pos, 16:i32))) - z4 := bswap64(i64.load(i32.add(pos, 24:i32))) -} - -// Stores one byte at position `x` of value `y`. -function mstore8(x1, x2, x3, x4, y1, y2, y3, y4) { - let v := u256_to_byte(y1, y2, y3, y4) - i64.store8(to_internal_i32ptr(x1, x2, x3, x4), v) -} diff --git a/libyul/optimiser/CallGraphGenerator.cpp b/libyul/optimiser/CallGraphGenerator.cpp index 5aeff50be5e7..66f740391dc1 100644 --- a/libyul/optimiser/CallGraphGenerator.cpp +++ b/libyul/optimiser/CallGraphGenerator.cpp @@ -22,6 +22,7 @@ #include #include +#include #include using namespace std; @@ -79,7 +80,9 @@ CallGraph CallGraphGenerator::callGraph(Block const& _ast) void CallGraphGenerator::operator()(FunctionCall const& _functionCall) { - m_callGraph.functionCalls[m_currentFunction].insert(_functionCall.functionName.name); + auto& functionCalls = m_callGraph.functionCalls[m_currentFunction]; + if (!util::contains(functionCalls, _functionCall.functionName.name)) + functionCalls.emplace_back(_functionCall.functionName.name); ASTWalker::operator()(_functionCall); } diff --git a/libyul/optimiser/CallGraphGenerator.h b/libyul/optimiser/CallGraphGenerator.h index a581df018202..ad19878b6892 100644 --- a/libyul/optimiser/CallGraphGenerator.h +++ b/libyul/optimiser/CallGraphGenerator.h @@ -32,7 +32,7 @@ namespace solidity::yul struct CallGraph { - std::map> functionCalls; + std::map> functionCalls; std::set functionsWithLoops; /// @returns the set of functions contained in cycles in the call graph, i.e. /// functions that are part of a (mutual) recursion. diff --git a/libyul/optimiser/FullInliner.cpp b/libyul/optimiser/FullInliner.cpp index 9ffe871faf08..ebf82e763dc2 100644 --- a/libyul/optimiser/FullInliner.cpp +++ b/libyul/optimiser/FullInliner.cpp @@ -37,6 +37,10 @@ #include #include +#include +#include +#include + using namespace std; using namespace solidity; using namespace solidity::yul; @@ -156,7 +160,8 @@ map FullInliner::callDepths() const } for (auto& call: cg.functionCalls) - call.second -= removed; + for (YulString toBeRemoved: removed) + ranges::actions::remove(call.second, toBeRemoved); currentDepth++; @@ -184,6 +189,12 @@ bool FullInliner::shallInline(FunctionCall const& _funCall, YulString _callSite) if (m_noInlineFunctions.count(_funCall.functionName.name) || recursive(*calledFunction)) return false; + // No inlining of calls where argument expressions may have side-effects. + // To avoid running into this, make sure that ExpressionSplitter runs before FullInliner. + for (auto const& argument: _funCall.arguments) + if (!holds_alternative(argument) && !holds_alternative(argument)) + return false; + // Inline really, really tiny functions size_t size = m_functionSizes.at(calledFunction->name); if (size <= 1) @@ -302,8 +313,8 @@ vector InlineModifier::performInline(Statement& _statement, FunctionC newStatements.emplace_back(std::move(varDecl)); }; - for (size_t i = 0; i < _funCall.arguments.size(); ++i) - newVariable(function->parameters[i], &_funCall.arguments[i]); + for (auto&& [parameter, argument]: ranges::views::zip(function->parameters, _funCall.arguments) | ranges::views::reverse) + newVariable(parameter, &argument); for (auto const& var: function->returnVariables) newVariable(var, nullptr); diff --git a/libyul/optimiser/FullInliner.h b/libyul/optimiser/FullInliner.h index 5029abf3920b..931315305c57 100644 --- a/libyul/optimiser/FullInliner.h +++ b/libyul/optimiser/FullInliner.h @@ -44,10 +44,10 @@ class NameCollector; * Optimiser component that modifies an AST in place, inlining functions. * Expressions are expected to be split, i.e. the component will only inline * function calls that are at the root of the expression and that only contains - * variables as arguments. More specifically, it will inline + * variables or literals as arguments. More specifically, it will inline * - let x1, ..., xn := f(a1, ..., am) * - x1, ..., xn := f(a1, ..., am) - * f(a1, ..., am) + * - f(a1, ..., am) * * The transform changes code of the form * @@ -58,8 +58,8 @@ class NameCollector; * * function f(a, b) -> c { ... } * - * let f_a := x * let f_b := y + * let f_a := x * let f_c * code of f, with replacements: a -> f_a, b -> f_b, c -> f_c * let z := f_c diff --git a/libyul/optimiser/ReasoningBasedSimplifier.cpp b/libyul/optimiser/ReasoningBasedSimplifier.cpp deleted file mode 100644 index 24882d84e8e1..000000000000 --- a/libyul/optimiser/ReasoningBasedSimplifier.cpp +++ /dev/null @@ -1,228 +0,0 @@ -/* - This file is part of solidity. - - solidity is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - solidity is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with solidity. If not, see . -*/ - -#include -#include - -#include -#include -#include -#include - -#include -#include - -#include - -#include - -#include -#include - -using namespace std; -using namespace solidity; -using namespace solidity::util; -using namespace solidity::yul; -using namespace solidity::smtutil; - -void ReasoningBasedSimplifier::run(OptimiserStepContext& _context, Block& _ast) -{ - set ssaVars = SSAValueTracker::ssaVariables(_ast); - ReasoningBasedSimplifier{_context.dialect, ssaVars}(_ast); -} - -std::optional ReasoningBasedSimplifier::invalidInCurrentEnvironment() -{ - // SMTLib2 interface is always available, but we would like to have synchronous answers. - if (smtutil::SMTPortfolio{}.solvers() <= 1) - return string{"No SMT solvers available."}; - else - return nullopt; -} - -void ReasoningBasedSimplifier::operator()(VariableDeclaration& _varDecl) -{ - SMTSolver::encodeVariableDeclaration(_varDecl); -} - -void ReasoningBasedSimplifier::operator()(If& _if) -{ - if (!SideEffectsCollector{m_dialect, *_if.condition}.movable()) - return; - - smtutil::Expression condition = encodeExpression(*_if.condition); - m_solver->push(); - m_solver->addAssertion(condition == constantValue(0)); - CheckResult result = m_solver->check({}).first; - m_solver->pop(); - if (result == CheckResult::UNSATISFIABLE) - { - Literal trueCondition = m_dialect.trueLiteral(); - trueCondition.debugData = debugDataOf(*_if.condition); - _if.condition = make_unique(std::move(trueCondition)); - } - else - { - m_solver->push(); - m_solver->addAssertion(condition != constantValue(0)); - CheckResult result2 = m_solver->check({}).first; - m_solver->pop(); - if (result2 == CheckResult::UNSATISFIABLE) - { - Literal falseCondition = m_dialect.zeroLiteralForType(m_dialect.boolType); - falseCondition.debugData = debugDataOf(*_if.condition); - _if.condition = make_unique(std::move(falseCondition)); - _if.body = yul::Block{}; - // Nothing left to be done. - return; - } - } - - m_solver->push(); - m_solver->addAssertion(condition != constantValue(0)); - - ASTModifier::operator()(_if.body); - - m_solver->pop(); -} - -ReasoningBasedSimplifier::ReasoningBasedSimplifier( - Dialect const& _dialect, - set const& _ssaVariables -): - SMTSolver(_ssaVariables, _dialect), - m_dialect(_dialect) -{ -} - - -smtutil::Expression ReasoningBasedSimplifier::encodeEVMBuiltin( - evmasm::Instruction _instruction, - vector const& _arguments -) -{ - vector arguments = applyMap( - _arguments, - [this](yul::Expression const& _expr) { return encodeExpression(_expr); } - ); - switch (_instruction) - { - case evmasm::Instruction::ADD: - return wrap(arguments.at(0) + arguments.at(1)); - case evmasm::Instruction::MUL: - return wrap(arguments.at(0) * arguments.at(1)); - case evmasm::Instruction::SUB: - return wrap(arguments.at(0) - arguments.at(1)); - case evmasm::Instruction::DIV: - return smtutil::Expression::ite( - arguments.at(1) == constantValue(0), - constantValue(0), - arguments.at(0) / arguments.at(1) - ); - case evmasm::Instruction::SDIV: - return smtutil::Expression::ite( - arguments.at(1) == constantValue(0), - constantValue(0), - // No `wrap()` needed here, because -2**255 / -1 results - // in 2**255 which is "converted" to its two's complement - // representation 2**255 in `signedToTwosComplement` - signedToTwosComplement(smtutil::signedDivisionEVM( - twosComplementToSigned(arguments.at(0)), - twosComplementToSigned(arguments.at(1)) - )) - ); - case evmasm::Instruction::MOD: - return smtutil::Expression::ite( - arguments.at(1) == constantValue(0), - constantValue(0), - arguments.at(0) % arguments.at(1) - ); - case evmasm::Instruction::SMOD: - return smtutil::Expression::ite( - arguments.at(1) == constantValue(0), - constantValue(0), - signedToTwosComplement(signedModuloEVM( - twosComplementToSigned(arguments.at(0)), - twosComplementToSigned(arguments.at(1)) - )) - ); - case evmasm::Instruction::LT: - return booleanValue(arguments.at(0) < arguments.at(1)); - case evmasm::Instruction::SLT: - return booleanValue(twosComplementToSigned(arguments.at(0)) < twosComplementToSigned(arguments.at(1))); - case evmasm::Instruction::GT: - return booleanValue(arguments.at(0) > arguments.at(1)); - case evmasm::Instruction::SGT: - return booleanValue(twosComplementToSigned(arguments.at(0)) > twosComplementToSigned(arguments.at(1))); - case evmasm::Instruction::EQ: - return booleanValue(arguments.at(0) == arguments.at(1)); - case evmasm::Instruction::ISZERO: - return booleanValue(arguments.at(0) == constantValue(0)); - case evmasm::Instruction::AND: - return smtutil::Expression::ite( - (arguments.at(0) == 0 || arguments.at(0) == 1) && - (arguments.at(1) == 0 || arguments.at(1) == 1), - booleanValue(arguments.at(0) == 1 && arguments.at(1) == 1), - bv2int(int2bv(arguments.at(0)) & int2bv(arguments.at(1))) - ); - case evmasm::Instruction::OR: - return smtutil::Expression::ite( - (arguments.at(0) == 0 || arguments.at(0) == 1) && - (arguments.at(1) == 0 || arguments.at(1) == 1), - booleanValue(arguments.at(0) == 1 || arguments.at(1) == 1), - bv2int(int2bv(arguments.at(0)) | int2bv(arguments.at(1))) - ); - case evmasm::Instruction::XOR: - return bv2int(int2bv(arguments.at(0)) ^ int2bv(arguments.at(1))); - case evmasm::Instruction::NOT: - return smtutil::Expression(u256(-1)) - arguments.at(0); - case evmasm::Instruction::SHL: - return smtutil::Expression::ite( - arguments.at(0) > 255, - constantValue(0), - bv2int(int2bv(arguments.at(1)) << int2bv(arguments.at(0))) - ); - case evmasm::Instruction::SHR: - return smtutil::Expression::ite( - arguments.at(0) > 255, - constantValue(0), - bv2int(int2bv(arguments.at(1)) >> int2bv(arguments.at(0))) - ); - case evmasm::Instruction::SAR: - return smtutil::Expression::ite( - arguments.at(0) > 255, - constantValue(0), - bv2int(smtutil::Expression::ashr(int2bv(arguments.at(1)), int2bv(arguments.at(0)))) - ); - case evmasm::Instruction::ADDMOD: - return smtutil::Expression::ite( - arguments.at(2) == constantValue(0), - constantValue(0), - (arguments.at(0) + arguments.at(1)) % arguments.at(2) - ); - case evmasm::Instruction::MULMOD: - return smtutil::Expression::ite( - arguments.at(2) == constantValue(0), - constantValue(0), - (arguments.at(0) * arguments.at(1)) % arguments.at(2) - ); - // TODO SIGNEXTEND - default: - break; - } - return newRestrictedVariable(); -} diff --git a/libyul/optimiser/ReasoningBasedSimplifier.h b/libyul/optimiser/ReasoningBasedSimplifier.h deleted file mode 100644 index c458a36d096c..000000000000 --- a/libyul/optimiser/ReasoningBasedSimplifier.h +++ /dev/null @@ -1,75 +0,0 @@ -/* - This file is part of solidity. - - solidity is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - solidity is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with solidity. If not, see . -*/ -#pragma once - -#include -#include -#include -#include - -// because of instruction -#include - -#include - -namespace solidity::smtutil -{ -class SolverInterface; -class Expression; -struct Sort; -} - -namespace solidity::yul -{ - -/** - * Reasoning-based simplifier. - * This optimizer uses SMT solvers to check whether `if` conditions are constant. - * - If `constraints AND condition` is UNSAT, the condition is never true and the whole body can be removed. - * - If `constraints AND NOT condition` is UNSAT, the condition is always true and can be replaced by `1`. - * The simplifications above can only be applied if the condition is movable. - * - * It is only effective on the EVM dialect, but safe to use on other dialects. - * - * Prerequisite: Disambiguator, SSATransform. - */ -class ReasoningBasedSimplifier: public ASTModifier, SMTSolver -{ -public: - static constexpr char const* name{"ReasoningBasedSimplifier"}; - static void run(OptimiserStepContext& _context, Block& _ast); - static std::optional invalidInCurrentEnvironment(); - - using ASTModifier::operator(); - void operator()(VariableDeclaration& _varDecl) override; - void operator()(If& _if) override; - -private: - explicit ReasoningBasedSimplifier( - Dialect const& _dialect, - std::set const& _ssaVariables - ); - - smtutil::Expression encodeEVMBuiltin( - evmasm::Instruction _instruction, - std::vector const& _arguments - ) override; - - Dialect const& m_dialect; -}; - -} diff --git a/libyul/optimiser/SMTSolver.cpp b/libyul/optimiser/SMTSolver.cpp deleted file mode 100644 index c0c6bcb5ecb7..000000000000 --- a/libyul/optimiser/SMTSolver.cpp +++ /dev/null @@ -1,160 +0,0 @@ -/* - This file is part of solidity. - - solidity is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - solidity is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with solidity. If not, see . -*/ - -#include -#include - -#include -#include - -#include -#include - -#include -#include - -using namespace solidity::yul; -using namespace solidity::util; -using namespace solidity::smtutil; -using namespace solidity; -using namespace std; - -SMTSolver::SMTSolver(set const& _ssaVariables, Dialect const& _dialect): - m_ssaVariables(_ssaVariables), - m_solver(make_unique()), - m_dialect(_dialect) -{ } - -smtutil::Expression SMTSolver::encodeExpression(Expression const& _expression) -{ - return std::visit(GenericVisitor{ - [&](FunctionCall const& _functionCall) - { - if (auto instruction = toEVMInstruction(m_dialect, _functionCall.functionName.name)) - return encodeEVMBuiltin(*instruction, _functionCall.arguments); - - return newRestrictedVariable(); - }, - [&](Identifier const& _identifier) - { - if ( - m_ssaVariables.count(_identifier.name) && - m_variables.count(_identifier.name) - ) - return m_variables.at(_identifier.name); - else - return newRestrictedVariable(); - }, - [&](Literal const& _literal) - { - return literalValue(_literal); - } - }, _expression); -} - -smtutil::Expression SMTSolver::int2bv(smtutil::Expression _arg) -{ - return smtutil::Expression::int2bv(std::move(_arg), 256); -} - -smtutil::Expression SMTSolver::bv2int(smtutil::Expression _arg) -{ - return smtutil::Expression::bv2int(std::move(_arg)); -} - -smtutil::Expression SMTSolver::newVariable() -{ - return m_solver->newVariable(uniqueName(), defaultSort()); -} - -smtutil::Expression SMTSolver::newRestrictedVariable(bigint _maxValue) -{ - smtutil::Expression var = newVariable(); - m_solver->addAssertion(0 <= var && var <= smtutil::Expression(_maxValue)); - return var; -} - -string SMTSolver::uniqueName() -{ - return "expr_" + to_string(m_varCounter++); -} - -shared_ptr SMTSolver::defaultSort() const -{ - return SortProvider::intSort(); -} - -smtutil::Expression SMTSolver::booleanValue(smtutil::Expression _value) -{ - return smtutil::Expression::ite(_value, constantValue(1), constantValue(0)); -} - -smtutil::Expression SMTSolver::constantValue(bigint _value) -{ - return _value; -} - -smtutil::Expression SMTSolver::literalValue(Literal const& _literal) -{ - return smtutil::Expression(valueOfLiteral(_literal)); -} - -smtutil::Expression SMTSolver::twosComplementToSigned(smtutil::Expression _value) -{ - return smtutil::Expression::ite( - _value < smtutil::Expression(bigint(1) << 255), - _value, - _value - smtutil::Expression(bigint(1) << 256) - ); -} - -smtutil::Expression SMTSolver::signedToTwosComplement(smtutil::Expression _value) -{ - return smtutil::Expression::ite( - _value >= 0, - _value, - _value + smtutil::Expression(bigint(1) << 256) - ); -} - -smtutil::Expression SMTSolver::wrap(smtutil::Expression _value) -{ - smtutil::Expression rest = newRestrictedVariable(); - smtutil::Expression multiplier = newVariable(); - m_solver->addAssertion(_value == multiplier * smtutil::Expression(bigint(1) << 256) + rest); - return rest; -} - -void SMTSolver::encodeVariableDeclaration(VariableDeclaration const& _varDecl) -{ - if ( - _varDecl.variables.size() == 1 && - _varDecl.value && - m_ssaVariables.count(_varDecl.variables.front().name) - ) - { - YulString const& variableName = _varDecl.variables.front().name; - bool const inserted = m_variables.insert({ - variableName, - m_solver->newVariable("yul_" + variableName.str(), defaultSort()) - }).second; - yulAssert(inserted, ""); - m_solver->addAssertion( - m_variables.at(variableName) == encodeExpression(*_varDecl.value) - ); - } -} diff --git a/libyul/optimiser/SMTSolver.h b/libyul/optimiser/SMTSolver.h deleted file mode 100644 index d92a84c1d5ea..000000000000 --- a/libyul/optimiser/SMTSolver.h +++ /dev/null @@ -1,92 +0,0 @@ -/* - This file is part of solidity. - - solidity is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - solidity is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with solidity. If not, see . -*/ -#pragma once - -#include -#include -#include - -// because of instruction -#include - -#include - -#include - -namespace solidity::smtutil -{ - -class SolverInterface; -class Expression; -struct Sort; - -} - -namespace solidity::yul -{ - -/** - * Base class for SMT based optimization steps. - * - * Works best when used with AST in SSA form. - */ -class SMTSolver -{ -protected: - SMTSolver( - std::set const& _ssaVariables, - Dialect const& _dialect - ); - - /// Helper function that encodes VariableDeclaration - void encodeVariableDeclaration(VariableDeclaration const& _varDecl); - - /// The encoding for a builtin. The type of encoding determines what we are - /// solving for. - virtual smtutil::Expression encodeEVMBuiltin( - evmasm::Instruction _instruction, - std::vector const& _arguments - ) = 0; - - smtutil::Expression encodeExpression(Expression const& _expression); - - static smtutil::Expression int2bv(smtutil::Expression _arg); - static smtutil::Expression bv2int(smtutil::Expression _arg); - - smtutil::Expression newVariable(); - virtual smtutil::Expression newRestrictedVariable(bigint _maxValue = (bigint(1) << 256) - 1); - std::string uniqueName(); - - virtual std::shared_ptr defaultSort() const; - static smtutil::Expression booleanValue(smtutil::Expression _value); - static smtutil::Expression constantValue(bigint _value); - static smtutil::Expression literalValue(Literal const& _literal); - static smtutil::Expression twosComplementToSigned(smtutil::Expression _value); - static smtutil::Expression signedToTwosComplement(smtutil::Expression _value); - smtutil::Expression wrap(smtutil::Expression _value); - - std::set const& m_ssaVariables; - std::unique_ptr m_solver; - std::map m_variables; - - Dialect const& m_dialect; - -private: - size_t m_varCounter = 0; -}; - -} diff --git a/libyul/optimiser/Semantics.cpp b/libyul/optimiser/Semantics.cpp index 12349394a047..d87c20574382 100644 --- a/libyul/optimiser/Semantics.cpp +++ b/libyul/optimiser/Semantics.cpp @@ -94,6 +94,19 @@ bool MSizeFinder::containsMSize(Dialect const& _dialect, Block const& _ast) return finder.m_msizeFound; } +bool MSizeFinder::containsMSize(Dialect const& _dialect, Object const& _object) +{ + if (containsMSize(_dialect, *_object.code)) + return true; + + for (shared_ptr const& node: _object.subObjects) + if (auto const* object = dynamic_cast(node.get())) + if (containsMSize(_dialect, *object)) + return true; + + return false; +} + void MSizeFinder::operator()(FunctionCall const& _functionCall) { ASTWalker::operator()(_functionCall); diff --git a/libyul/optimiser/Semantics.h b/libyul/optimiser/Semantics.h index 32b9c9b582bc..762c80110618 100644 --- a/libyul/optimiser/Semantics.h +++ b/libyul/optimiser/Semantics.h @@ -21,10 +21,11 @@ #pragma once -#include +#include +#include #include +#include #include -#include #include @@ -143,6 +144,7 @@ class MSizeFinder: public ASTWalker { public: static bool containsMSize(Dialect const& _dialect, Block const& _ast); + static bool containsMSize(Dialect const& _dialect, Object const& _object); using ASTWalker::operator(); void operator()(FunctionCall const& _funCall) override; diff --git a/libyul/optimiser/StackLimitEvader.cpp b/libyul/optimiser/StackLimitEvader.cpp index b4b9d5469a48..4c84f5155d41 100644 --- a/libyul/optimiser/StackLimitEvader.cpp +++ b/libyul/optimiser/StackLimitEvader.cpp @@ -97,9 +97,9 @@ struct MemoryOffsetAllocator /// Maps function names to the set of unreachable variables in that function. /// An empty variable name means that the function has too many arguments or return variables. - map> const& unreachableVariables; + map> const& unreachableVariables; /// The graph of immediate function calls of all functions. - map> const& callGraph; + map> const& callGraph; /// Maps the name of each user-defined function to its definition. map const& functionDefinitions; @@ -149,18 +149,23 @@ void StackLimitEvader::run( map> const& _stackTooDeepErrors ) { - map> unreachableVariables; + map> unreachableVariables; for (auto&& [function, stackTooDeepErrors]: _stackTooDeepErrors) + { + auto& unreachables = unreachableVariables[function]; // TODO: choose wisely. for (auto const& stackTooDeepError: stackTooDeepErrors) - unreachableVariables[function] += stackTooDeepError.variableChoices | ranges::views::take(stackTooDeepError.deficit) | ranges::to>; + for (auto variable: stackTooDeepError.variableChoices | ranges::views::take(stackTooDeepError.deficit)) + if (!util::contains(unreachables, variable)) + unreachables.emplace_back(variable); + } run(_context, _object, unreachableVariables); } void StackLimitEvader::run( OptimiserStepContext& _context, Object& _object, - map> const& _unreachableVariables + map> const& _unreachableVariables ) { yulAssert(_object.code, ""); diff --git a/libyul/optimiser/StackLimitEvader.h b/libyul/optimiser/StackLimitEvader.h index ae2d31c37591..025553200f05 100644 --- a/libyul/optimiser/StackLimitEvader.h +++ b/libyul/optimiser/StackLimitEvader.h @@ -60,7 +60,7 @@ class StackLimitEvader static void run( OptimiserStepContext& _context, Object& _object, - std::map> const& _unreachableVariables + std::map> const& _unreachableVariables ); /// @a _stackTooDeepErrors can be determined by the StackLayoutGenerator. /// Can only be run on the EVM dialect with objects. diff --git a/libyul/optimiser/Suite.cpp b/libyul/optimiser/Suite.cpp index 0641328f141e..bd966e5d3069 100644 --- a/libyul/optimiser/Suite.cpp +++ b/libyul/optimiser/Suite.cpp @@ -43,7 +43,6 @@ #include #include #include -#include #include #include #include @@ -70,7 +69,6 @@ #include #include -#include #include #include @@ -212,13 +210,6 @@ void OptimiserSuite::run( else if (evmDialect->providesObjectAccess() && _optimizeStackAllocation) StackLimitEvader::run(suite.m_context, _object); } - else if (dynamic_cast(&_dialect)) - { - // If the first statement is an empty block, remove it. - // We should only have function definitions after that. - if (ast.statements.size() > 1 && std::get(ast.statements.front()).statements.empty()) - ast.statements.erase(ast.statements.begin()); - } dispenser.reset(ast); NameSimplifier::run(suite.m_context, ast); @@ -280,7 +271,6 @@ map> const& OptimiserSuite::allSteps() LoopInvariantCodeMotion, UnusedAssignEliminator, UnusedStoreEliminator, - ReasoningBasedSimplifier, Rematerialiser, SSAReverser, SSATransform, @@ -320,7 +310,6 @@ map const& OptimiserSuite::stepNameToAbbreviationMap() {LiteralRematerialiser::name, 'T'}, {LoadResolver::name, 'L'}, {LoopInvariantCodeMotion::name, 'M'}, - {ReasoningBasedSimplifier::name, 'R'}, {UnusedAssignEliminator::name, 'r'}, {UnusedStoreEliminator::name, 'S'}, {Rematerialiser::name, 'm'}, diff --git a/scripts/ASTImportTest.sh b/scripts/ASTImportTest.sh index faf98c19267b..c245261951de 100755 --- a/scripts/ASTImportTest.sh +++ b/scripts/ASTImportTest.sh @@ -209,7 +209,7 @@ esac # boost_filesystem_bug specifically tests a local fix for a boost::filesystem # bug. Since the test involves a malformed path, there is no point in running # tests on it. See https://github.com/boostorg/filesystem/issues/176 -IMPORT_TEST_FILES=$(find "${TEST_DIRS[@]}" -name "*.sol" -and -not -name "boost_filesystem_bug.sol") +IMPORT_TEST_FILES=$(find "${TEST_DIRS[@]}" -name "*.sol" -and -not -name "boost_filesystem_bug.sol" -not -path "*/experimental/*") NSOURCES="$(echo "${IMPORT_TEST_FILES}" | wc -l)" echo "Looking at ${NSOURCES} .sol files..." diff --git a/scripts/build_emscripten.sh b/scripts/build_emscripten.sh index 4e605715768c..1b780a4276b6 100755 --- a/scripts/build_emscripten.sh +++ b/scripts/build_emscripten.sh @@ -33,9 +33,9 @@ if (( $# != 0 )); then params="$(printf "%q " "${@}")" fi -# solbuildpackpusher/solidity-buildpack-deps:emscripten-15 +# solbuildpackpusher/solidity-buildpack-deps:emscripten-16 # NOTE: Without `safe.directory` git would assume it's not safe to operate on /root/project since it's owned by a different user. # See https://github.blog/2022-04-12-git-security-vulnerability-announced/ docker run -v "$(pwd):/root/project" -w /root/project \ - solbuildpackpusher/solidity-buildpack-deps@sha256:f86cb1fb4631b1fbb927149f60caea7b095be5b85d379456eee09cb105e7f225 \ + solbuildpackpusher/solidity-buildpack-deps@sha256:19fcb5ac029bbc27ec36e10f7d14ea224d8010145f9690562ef084fd16146b0c \ /bin/bash -c "git config --global --add safe.directory /root/project && ./scripts/ci/build_emscripten.sh ${params}" diff --git a/scripts/bytecodecompare/deploy_key.enc b/scripts/bytecodecompare/deploy_key.enc deleted file mode 100644 index acab2a279151..000000000000 Binary files a/scripts/bytecodecompare/deploy_key.enc and /dev/null differ diff --git a/scripts/bytecodecompare/prepare_report.js b/scripts/bytecodecompare/prepare_report.js index 36acfbb35853..cba7a0800116 100755 --- a/scripts/bytecodecompare/prepare_report.js +++ b/scripts/bytecodecompare/prepare_report.js @@ -4,6 +4,12 @@ const fs = require('fs') const compiler = require('solc') +SETTINGS_PRESETS = { + 'legacy-optimize': {optimize: true, viaIR: false}, + 'legacy-no-optimize': {optimize: false, viaIR: false}, + 'via-ir-optimize': {optimize: true, viaIR: true}, + 'via-ir-no-optimize': {optimize: false, viaIR: true}, +} function loadSource(sourceFileName, stripSMTPragmas) { @@ -23,96 +29,114 @@ function cleanString(string) return (string !== '' ? string : undefined) } - +let inputFiles = [] let stripSMTPragmas = false -let firstFileArgumentIndex = 2 +let presets = [] -if (process.argv.length >= 3 && process.argv[2] === '--strip-smt-pragmas') +for (let i = 2; i < process.argv.length; ++i) { - stripSMTPragmas = true - firstFileArgumentIndex = 3 -} - -for (const optimize of [false, true]) -{ - for (const filename of process.argv.slice(firstFileArgumentIndex)) + if (process.argv[i] === '--strip-smt-pragmas') + stripSMTPragmas = true + else if (process.argv[i] === '--preset') { - if (filename !== undefined) - { - let input = { - language: 'Solidity', - sources: { - [filename]: {content: loadSource(filename, stripSMTPragmas)} - }, - settings: { - optimizer: {enabled: optimize}, - outputSelection: {'*': {'*': ['evm.bytecode.object', 'metadata']}} - } - } - if (!stripSMTPragmas) - input['settings']['modelChecker'] = {engine: 'none'} + if (i + 1 === process.argv.length) + throw Error("Option --preset was used, but no preset name given.") - let serializedOutput - let result - const serializedInput = JSON.stringify(input) + presets.push(process.argv[i + 1]) + ++i; + } + else + inputFiles.push(process.argv[i]) +} - let internalCompilerError = false - try - { - serializedOutput = compiler.compile(serializedInput) - } - catch (exception) - { - internalCompilerError = true - } +if (presets.length === 0) + presets = ['legacy-no-optimize', 'legacy-optimize'] - if (!internalCompilerError) - { - result = JSON.parse(serializedOutput) - - if ('errors' in result) - for (const error of result['errors']) - // JSON interface still returns contract metadata in case of an internal compiler error while - // CLI interface does not. To make reports comparable we must force this case to be detected as - // an error in both cases. - if (['UnimplementedFeatureError', 'CompilerError', 'CodeGenerationError'].includes(error['type'])) - { - internalCompilerError = true - break - } - } +for (const preset of presets) + if (!(preset in SETTINGS_PRESETS)) + throw Error(`Invalid preset name: ${preset}.`) - if ( - internalCompilerError || - !('contracts' in result) || - Object.keys(result['contracts']).length === 0 || - Object.keys(result['contracts']).every(file => Object.keys(result['contracts'][file]).length === 0) - ) - // NOTE: do not exit here because this may be run on source which cannot be compiled - console.log(filename + ': ') - else - for (const contractFile in result['contracts']) - for (const contractName in result['contracts'][contractFile]) - { - const contractResults = result['contracts'][contractFile][contractName] +for (const preset of presets) +{ + settings = SETTINGS_PRESETS[preset] - let bytecode = '' - let metadata = '' + for (const filename of inputFiles) + { + let input = { + language: 'Solidity', + sources: { + [filename]: {content: loadSource(filename, stripSMTPragmas)} + }, + settings: { + optimizer: {enabled: settings.optimize}, + // NOTE: We omit viaIR rather than set it to false to handle older versions that don't have it. + viaIR: settings.viaIR ? true : undefined, + outputSelection: {'*': {'*': ['evm.bytecode.object', 'metadata']}} + } + } + if (!stripSMTPragmas) + input['settings']['modelChecker'] = {engine: 'none'} - if ( - 'evm' in contractResults && - 'bytecode' in contractResults['evm'] && - 'object' in contractResults['evm']['bytecode'] && - cleanString(contractResults.evm.bytecode.object) !== undefined - ) - bytecode = cleanString(contractResults.evm.bytecode.object) + let serializedOutput + let result + const serializedInput = JSON.stringify(input) - if ('metadata' in contractResults && cleanString(contractResults.metadata) !== undefined) - metadata = contractResults.metadata + let internalCompilerError = false + try + { + serializedOutput = compiler.compile(serializedInput) + } + catch (exception) + { + internalCompilerError = true + } - console.log(filename + ':' + contractName + ' ' + bytecode) - console.log(filename + ':' + contractName + ' ' + metadata) + if (!internalCompilerError) + { + result = JSON.parse(serializedOutput) + + if ('errors' in result) + for (const error of result['errors']) + // JSON interface still returns contract metadata in case of an internal compiler error while + // CLI interface does not. To make reports comparable we must force this case to be detected as + // an error in both cases. + if (['UnimplementedFeatureError', 'CompilerError', 'CodeGenerationError', 'YulException'].includes(error['type'])) + { + internalCompilerError = true + break } } + + if ( + internalCompilerError || + !('contracts' in result) || + Object.keys(result['contracts']).length === 0 || + Object.keys(result['contracts']).every(file => Object.keys(result['contracts'][file]).length === 0) + ) + // NOTE: do not exit here because this may be run on source which cannot be compiled + console.log(filename + ': ') + else + for (const contractFile in result['contracts']) + for (const contractName in result['contracts'][contractFile]) + { + const contractResults = result['contracts'][contractFile][contractName] + + let bytecode = '' + let metadata = '' + + if ( + 'evm' in contractResults && + 'bytecode' in contractResults['evm'] && + 'object' in contractResults['evm']['bytecode'] && + cleanString(contractResults.evm.bytecode.object) !== undefined + ) + bytecode = cleanString(contractResults.evm.bytecode.object) + + if ('metadata' in contractResults && cleanString(contractResults.metadata) !== undefined) + metadata = contractResults.metadata + + console.log(filename + ':' + contractName + ' ' + bytecode) + console.log(filename + ':' + contractName + ' ' + metadata) + } } } diff --git a/scripts/bytecodecompare/prepare_report.py b/scripts/bytecodecompare/prepare_report.py index 90901e8b79ed..82bccbb65a75 100755 --- a/scripts/bytecodecompare/prepare_report.py +++ b/scripts/bytecodecompare/prepare_report.py @@ -26,12 +26,39 @@ class CompilerInterface(Enum): STANDARD_JSON = 'standard-json' +class ExecutionArchitecture(Enum): + NATIVE = 'native' + OSX_INTEL = 'osx_intel' + + +class SettingsPreset(Enum): + LEGACY_OPTIMIZE = 'legacy-optimize' + LEGACY_NO_OPTIMIZE = 'legacy-no-optimize' + VIA_IR_OPTIMIZE = 'via-ir-optimize' + VIA_IR_NO_OPTIMIZE = 'via-ir-no-optimize' + + class SMTUse(Enum): PRESERVE = 'preserve' DISABLE = 'disable' STRIP_PRAGMAS = 'strip-pragmas' +@dataclass(frozen=True) +class CompilerSettings: + optimize: bool + via_ir: bool + + @staticmethod + def from_preset(preset: SettingsPreset): + return { + SettingsPreset.LEGACY_OPTIMIZE: CompilerSettings(optimize=True, via_ir=False), + SettingsPreset.LEGACY_NO_OPTIMIZE: CompilerSettings(optimize=False, via_ir=False), + SettingsPreset.VIA_IR_OPTIMIZE: CompilerSettings(optimize=True, via_ir=True), + SettingsPreset.VIA_IR_NO_OPTIMIZE: CompilerSettings(optimize=False, via_ir=True), + }[preset] + + @dataclass(frozen=True) class ContractReport: contract_name: str @@ -135,7 +162,7 @@ def parse_standard_json_output(source_file_name: Path, standard_json_output: str # CLI interface does not. To make reports comparable we must force this case to be detected as # an error in both cases. internal_compiler_error = any( - error['type'] in ['UnimplementedFeatureError', 'CompilerError', 'CodeGenerationError'] + error['type'] in ['UnimplementedFeatureError', 'CompilerError', 'CodeGenerationError', 'YulException'] for error in decoded_json_output.get('errors', {}) ) @@ -189,14 +216,23 @@ def parse_cli_output(source_file_name: Path, cli_output: str) -> FileReport: def prepare_compiler_input( compiler_path: Path, + execution_arch: ExecutionArchitecture, source_file_name: Path, - optimize: bool, force_no_optimize_yul: bool, interface: CompilerInterface, + preset: SettingsPreset, smt_use: SMTUse, metadata_option_supported: bool, ) -> Tuple[List[str], str]: + settings = CompilerSettings.from_preset(preset) + + command_line = [] + if execution_arch == ExecutionArchitecture.OSX_INTEL: + command_line = ["/usr/bin/arch", "-64", "-x86_64"] + else: + assert execution_arch == ExecutionArchitecture.NATIVE + if interface == CompilerInterface.STANDARD_JSON: json_input: dict = { 'language': 'Solidity', @@ -204,7 +240,9 @@ def prepare_compiler_input( str(source_file_name): {'content': load_source(source_file_name, smt_use)} }, 'settings': { - 'optimizer': {'enabled': optimize}, + 'optimizer': {'enabled': settings.optimize}, + # NOTE: We omit viaIR rather than set it to false to handle older versions that don't have it. + **({'viaIR': True} if settings.via_ir else {}), 'outputSelection': {'*': {'*': ['evm.bytecode.object', 'metadata']}}, } } @@ -212,7 +250,7 @@ def prepare_compiler_input( if smt_use == SMTUse.DISABLE: json_input['settings']['modelChecker'] = {'engine': 'none'} - command_line = [str(compiler_path), '--standard-json'] + command_line += [str(compiler_path), '--standard-json'] compiler_input = json.dumps(json_input) else: assert interface == CompilerInterface.CLI @@ -220,14 +258,16 @@ def prepare_compiler_input( compiler_options = [str(source_file_name), '--bin'] if metadata_option_supported: compiler_options.append('--metadata') - if optimize: + if settings.optimize: compiler_options.append('--optimize') elif force_no_optimize_yul: compiler_options.append('--no-optimize-yul') + if settings.via_ir: + compiler_options.append('--via-ir') if smt_use == SMTUse.DISABLE: compiler_options += ['--model-checker-engine', 'none'] - command_line = [str(compiler_path)] + compiler_options + command_line += [str(compiler_path)] + compiler_options compiler_input = load_source(source_file_name, smt_use) return (command_line, compiler_input) @@ -258,23 +298,24 @@ def detect_metadata_cli_option_support(compiler_path: Path): def run_compiler( compiler_path: Path, + execution_arch: ExecutionArchitecture, source_file_name: Path, - optimize: bool, force_no_optimize_yul: bool, interface: CompilerInterface, + preset: SettingsPreset, smt_use: SMTUse, metadata_option_supported: bool, tmp_dir: Path, exit_on_error: bool, ) -> FileReport: - if interface == CompilerInterface.STANDARD_JSON: (command_line, compiler_input) = prepare_compiler_input( compiler_path, + execution_arch, Path(source_file_name.name), - optimize, force_no_optimize_yul, interface, + preset, smt_use, metadata_option_supported, ) @@ -294,10 +335,11 @@ def run_compiler( (command_line, compiler_input) = prepare_compiler_input( compiler_path.absolute(), + execution_arch, Path(source_file_name.name), - optimize, force_no_optimize_yul, interface, + preset, smt_use, metadata_option_supported, ) @@ -323,7 +365,9 @@ def run_compiler( def generate_report( source_file_names: List[str], compiler_path: Path, + execution_arch: ExecutionArchitecture, interface: CompilerInterface, + presets: List[SettingsPreset], smt_use: SMTUse, force_no_optimize_yul: bool, report_file_path: Path, @@ -335,16 +379,17 @@ def generate_report( try: with open(report_file_path, mode='w', encoding='utf8', newline='\n') as report_file: - for optimize in [False, True]: + for preset in presets: with TemporaryDirectory(prefix='prepare_report-') as tmp_dir: for source_file_name in sorted(source_file_names): try: report = run_compiler( compiler_path, + execution_arch, Path(source_file_name), - optimize, force_no_optimize_yul, interface, + preset, smt_use, metadata_option_supported, Path(tmp_dir), @@ -358,7 +403,7 @@ def generate_report( except subprocess.CalledProcessError as exception: print( f"\n\nInterrupted by an exception while processing file " - f"'{source_file_name}' with optimize={optimize}\n\n" + f"'{source_file_name}' with preset={preset}\n\n" f"COMPILER STDOUT:\n{exception.stdout}\n" f"COMPILER STDERR:\n{exception.stderr}\n", file=sys.stderr @@ -367,7 +412,7 @@ def generate_report( except: print( f"\n\nInterrupted by an exception while processing file " - f"'{source_file_name}' with optimize={optimize}\n", + f"'{source_file_name}' with preset={preset}\n\n", file=sys.stderr ) raise @@ -390,6 +435,22 @@ def commandline_parser() -> ArgumentParser: choices=[c.value for c in CompilerInterface], help="Compiler interface to use.", ) + parser.add_argument( + '--execution-arch', + dest='execution_arch', + default=ExecutionArchitecture.NATIVE.value, + choices=[c.value for c in ExecutionArchitecture], + help="Select the architecture of the universal binary that should be executed. (Only relevant for macOS)", + ) + parser.add_argument( + '--preset', + dest='presets', + default=None, + nargs='+', + action='append', + choices=[p.value for p in SettingsPreset], + help="Predefined set of settings to pass to the compiler. More than one can be selected.", + ) parser.add_argument( '--smt-use', dest='smt_use', @@ -418,10 +479,20 @@ def commandline_parser() -> ArgumentParser: if __name__ == "__main__": options = commandline_parser().parse_args() + + if options.presets is None: + # NOTE: Can't put it in add_argument()'s default because then it would be always present. + # See https://github.com/python/cpython/issues/60603 + presets = [[SettingsPreset.LEGACY_NO_OPTIMIZE.value, SettingsPreset.LEGACY_OPTIMIZE.value]] + else: + presets = options.presets + generate_report( glob("*.sol"), Path(options.compiler_path), + ExecutionArchitecture(options.execution_arch), CompilerInterface(options.interface), + [SettingsPreset(p) for preset_group in presets for p in preset_group], SMTUse(options.smt_use), options.force_no_optimize_yul, Path(options.report_file), diff --git a/scripts/bytecodecompare/storebytecode.sh b/scripts/bytecodecompare/storebytecode.sh deleted file mode 100755 index beeb79d0932b..000000000000 --- a/scripts/bytecodecompare/storebytecode.sh +++ /dev/null @@ -1,73 +0,0 @@ -#!/usr/bin/env bash - -#------------------------------------------------------------------------------ -# Script used for cross-platform comparison of the bytecode generated by the compiler. -# Splits all test source code into multiple files, generates bytecode and metadata -# for each file and combines it into a single report.txt file. -# -# The script is meant to be executed in CI on all supported platforms. All generated -# reports must be identical for a given compiler version. -# -# ------------------------------------------------------------------------------ -# This file is part of solidity. -# -# solidity is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# solidity is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with solidity. If not, see -# -# (c) 2017 solidity contributors. -#------------------------------------------------------------------------------ - -set -e - -REPO_ROOT="$(dirname "$0")"/../.. -cd "$REPO_ROOT" -REPO_ROOT=$(pwd) # make it absolute - -BUILD_DIR="${1:-${REPO_ROOT}/build}" - -# Set locale to C to prevent it from affecting glob sort order. -export LC_ALL=C - -echo "Compiling all test contracts into bytecode..." -TMPDIR=$(mktemp -d) -( - cd "$TMPDIR" - - "$REPO_ROOT"/scripts/isolate_tests.py "$REPO_ROOT"/test/ - - if [[ "$SOLC_EMSCRIPTEN" = "On" ]] - then - echo "Installing solc-js..." - # npm install solc - git clone --depth 1 https://github.com/ethereum/solc-js.git solc-js - cp "$REPO_ROOT/emscripten_build/libsolc/soljson.js" solc-js/ - pushd solc-js/ - npm install - npm run build - popd - - cp "$REPO_ROOT/scripts/bytecodecompare/prepare_report.js" . - npm install ./solc-js/dist - - echo "Running the compiler..." - # shellcheck disable=SC2035 - ./prepare_report.js *.sol > report.txt - echo "Finished running the compiler." - else - "$REPO_ROOT/scripts/bytecodecompare/prepare_report.py" "$BUILD_DIR/solc/solc" - fi - - cp report.txt "$REPO_ROOT" -) -rm -rf "$TMPDIR" -echo "Storebytecode finished." diff --git a/scripts/check_style.sh b/scripts/check_style.sh index 0953106d3bf1..34fbf0381bf7 100755 --- a/scripts/check_style.sh +++ b/scripts/check_style.sh @@ -20,6 +20,13 @@ EXCLUDE_FILES=( EXCLUDE_FILES_JOINED=$(printf "%s\|" "${EXCLUDE_FILES[@]}") EXCLUDE_FILES_JOINED=${EXCLUDE_FILES_JOINED%??} +NAMESPACE_STD_FREE_FILES=( + libevmasm/* + liblangutil/* + libsmtutil/* + libsolc/* +) + ( REPO_ROOT="$(dirname "$0")"/.. cd "$REPO_ROOT" || exit 1 @@ -58,6 +65,9 @@ FORMATERROR=$( # unqualified move()/forward() checks, i.e. make sure that std::move() and std::forward() are used instead of move() and forward() preparedGrep "move\(.+\)" | grep -v "std::move" | grep -E "[^a-z]move" preparedGrep "forward\(.+\)" | grep -v "std::forward" | grep -E "[^a-z]forward" + # make sure `using namespace std` is not used in INCLUDE_DIRECTORIES + # shellcheck disable=SC2068,SC2068 + grep -nIE -d skip "using namespace std;" ${NAMESPACE_STD_FREE_FILES[@]} ) | grep -E -v -e "^[a-zA-Z\./]*:[0-9]*:\s*\/(\/|\*)" -e "^test/" || true ) diff --git a/scripts/ci/notification/matrix_notification.sh b/scripts/ci/notification/matrix_notification.sh index cbe290af46c3..f7bd1949b471 100755 --- a/scripts/ci/notification/matrix_notification.sh +++ b/scripts/ci/notification/matrix_notification.sh @@ -1,7 +1,6 @@ #!/bin/bash set -euo pipefail -shopt -s inherit_errexit SCRIPT_DIR="$(dirname "$0")" @@ -28,6 +27,7 @@ function notify() { curl "https://${MATRIX_SERVER}/_matrix/client/v3/rooms/${MATRIX_NOTIFY_ROOM_ID}/send/m.room.message" \ --request POST \ --include \ + --fail \ --header "Content-Type: application/json" \ --header "Accept: application/json" \ --header "Authorization: Bearer ${MATRIX_ACCESS_TOKEN}" \ @@ -63,10 +63,14 @@ function format_predefined_message() { [[ -z "$template" ]] && fail "Message template for event [$event] not defined." - # Export variables that must be substituted - export WORKFLOW_NAME JOB BRANCH TAG BUILD_URL BUILD_NUM - envsubst < "$template" - unset WORKFLOW_NAME JOB BRANCH TAG BUILD_URL BUILD_NUM + # shellcheck disable=SC2016 + sed -e 's|${WORKFLOW_NAME}|'"${WORKFLOW_NAME}"'|' \ + -e 's|${JOB}|'"${JOB}"'|' \ + -e 's|${BRANCH}|'"${BRANCH}"'|' \ + -e 's|${TAG}|'"${TAG}"'|' \ + -e 's|${BUILD_URL}|'"${BUILD_URL}"'|' \ + -e 's|${BUILD_NUM}|'"${BUILD_NUM}"'|' \ + "$template" } # Set message environment variables based on CI backend diff --git a/scripts/common.sh b/scripts/common.sh index b5c6ada91465..da8726f3fa0d 100644 --- a/scripts/common.sh +++ b/scripts/common.sh @@ -121,7 +121,7 @@ function assertFail function msg_on_error { - local error_message + local error_message="" local no_stdout=false local no_stderr=false diff --git a/scripts/common_cmdline.sh b/scripts/common_cmdline.sh index d364f644488f..5e32a76dc9ed 100644 --- a/scripts/common_cmdline.sh +++ b/scripts/common_cmdline.sh @@ -103,3 +103,69 @@ function compileFull false fi } + +function singleContractOutputViaStandardJSON +{ + (( $# == 4 )) || assertFail + local language="$1" + local selected_output="$2" + local extra_settings="$3" + local input_file="$4" + [[ $selected_output != "*" ]] || assertFail + + json_output=$( + "$SOLC" --standard-json --allow-paths "$(basename "$input_file")" - <filesystemFriendlyName(_contractName) + "_yul_ast.json", + util::jsonPrint( + m_compiler->yulIRAst(_contractName), + m_options.formatting.json + ) + ); + else + { + sout() << "IR AST:" << endl; + sout() << util::jsonPrint( + m_compiler->yulIRAst(_contractName), + m_options.formatting.json + ) << endl; + } +} + void CommandLineInterface::handleIROptimized(string const& _contractName) { solAssert(CompilerInputModes.count(m_options.input.mode) == 1); @@ -231,7 +256,10 @@ void CommandLineInterface::handleIROptimized(string const& _contractName) return; if (!m_options.output.dir.empty()) - createFile(m_compiler->filesystemFriendlyName(_contractName) + "_opt.yul", m_compiler->yulIROptimized(_contractName)); + createFile( + m_compiler->filesystemFriendlyName(_contractName) + "_opt.yul", + m_compiler->yulIROptimized(_contractName) + ); else { sout() << "Optimized IR:" << endl; @@ -239,26 +267,28 @@ void CommandLineInterface::handleIROptimized(string const& _contractName) } } -void CommandLineInterface::handleEwasm(string const& _contractName) +void CommandLineInterface::handleIROptimizedAst(string const& _contractName) { solAssert(CompilerInputModes.count(m_options.input.mode) == 1); - if (!m_options.compiler.outputs.ewasm) + if (!m_options.compiler.outputs.irOptimizedAstJson) return; if (!m_options.output.dir.empty()) - { - createFile(m_compiler->filesystemFriendlyName(_contractName) + ".wast", m_compiler->ewasm(_contractName)); createFile( - m_compiler->filesystemFriendlyName(_contractName) + ".wasm", - asString(m_compiler->ewasmObject(_contractName).bytecode) + m_compiler->filesystemFriendlyName(_contractName) + "_opt_yul_ast.json", + util::jsonPrint( + m_compiler->yulIROptimizedAst(_contractName), + m_options.formatting.json + ) ); - } else { - sout() << "Ewasm text:" << endl; - sout() << m_compiler->ewasm(_contractName) << endl; - sout() << "Ewasm binary (hex): " << m_compiler->ewasmObject(_contractName).toHex() << endl; + sout() << "Optimized IR AST:" << endl; + sout() << util::jsonPrint( + m_compiler->yulIROptimizedAst(_contractName), + m_options.formatting.json + ) << endl; } } @@ -713,9 +743,12 @@ void CommandLineInterface::compile() if (m_options.output.debugInfoSelection.has_value()) m_compiler->selectDebugInfo(m_options.output.debugInfoSelection.value()); // TODO: Perhaps we should not compile unless requested - - m_compiler->enableIRGeneration(m_options.compiler.outputs.ir || m_options.compiler.outputs.irOptimized); - m_compiler->enableEwasmGeneration(m_options.compiler.outputs.ewasm); + m_compiler->enableIRGeneration( + m_options.compiler.outputs.ir || + m_options.compiler.outputs.irOptimized || + m_options.compiler.outputs.irAstJson || + m_options.compiler.outputs.irOptimizedAstJson + ); m_compiler->enableEvmBytecodeGeneration( m_options.compiler.estimateGas || m_options.compiler.outputs.asm_ || @@ -881,9 +914,9 @@ void CommandLineInterface::handleCombinedJSON() { output[g_strSources][sourceCode.first] = Json::Value(Json::objectValue); output[g_strSources][sourceCode.first]["AST"] = ASTJsonExporter( - m_compiler->state(), - m_compiler->sourceIndices() - ).toJson(m_compiler->ast(sourceCode.first)); + m_compiler->state(), + m_compiler->sourceIndices() + ).toJson(m_compiler->ast(sourceCode.first)); output[g_strSources][sourceCode.first]["id"] = m_compiler->sourceIndices().at(sourceCode.first); } } @@ -1041,9 +1074,6 @@ void CommandLineInterface::assembleYul(yul::YulStack::Language _language, yul::Y map yulStacks; for (auto const& src: m_fileReader.sourceUnits()) { - // --no-optimize-yul option is not accepted in assembly mode. - solAssert(!m_options.optimizer.noOptimizeYul); - auto& stack = yulStacks[src.first] = yul::YulStack( m_options.output.evmVersion, m_options.output.eofVersion, @@ -1082,9 +1112,8 @@ void CommandLineInterface::assembleYul(yul::YulStack::Language _language, yul::Y for (auto const& src: m_fileReader.sourceUnits()) { - string machine = - _targetMachine == yul::YulStack::Machine::EVM ? "EVM" : - "Ewasm"; + solAssert(_targetMachine == yul::YulStack::Machine::EVM); + string machine = "EVM"; sout() << endl << "======= " << src.first << " (" << machine << ") =======" << endl; yul::YulStack& stack = yulStacks[src.first]; @@ -1097,19 +1126,6 @@ void CommandLineInterface::assembleYul(yul::YulStack::Language _language, yul::Y sout() << stack.print() << endl; } - if (_language != yul::YulStack::Language::Ewasm && _targetMachine == yul::YulStack::Machine::Ewasm) - { - stack.translate(yul::YulStack::Language::Ewasm); - stack.optimize(); - - if (m_options.compiler.outputs.ewasmIR) - { - sout() << endl << "==========================" << endl; - sout() << endl << "Translated source:" << endl; - sout() << stack.print() << endl; - } - } - yul::MachineAssemblyObject object; object = stack.assemble(_targetMachine); object.bytecode->link(m_options.linker.libraries); @@ -1122,12 +1138,13 @@ void CommandLineInterface::assembleYul(yul::YulStack::Language _language, yul::Y else serr() << "No binary representation found." << endl; } - - solAssert(_targetMachine == yul::YulStack::Machine::Ewasm || _targetMachine == yul::YulStack::Machine::EVM, ""); - if ( - (_targetMachine == yul::YulStack::Machine::EVM && m_options.compiler.outputs.asm_) || - (_targetMachine == yul::YulStack::Machine::Ewasm && m_options.compiler.outputs.ewasm) - ) + if (m_options.compiler.outputs.astCompactJson) + { + sout() << "AST:" << endl << endl; + sout() << util::jsonPrint(stack.astJson(), m_options.formatting.json) << endl; + } + solAssert(_targetMachine == yul::YulStack::Machine::EVM, ""); + if (m_options.compiler.outputs.asm_) { sout() << endl << "Text representation:" << endl; if (!object.assembly.empty()) @@ -1182,8 +1199,9 @@ void CommandLineInterface::outputCompilationResults() handleBytecode(contract); handleIR(contract); + handleIRAst(contract); handleIROptimized(contract); - handleEwasm(contract); + handleIROptimizedAst(contract); handleSignatureHashes(contract); handleMetadata(contract); handleABI(contract); diff --git a/solc/CommandLineInterface.h b/solc/CommandLineInterface.h index 80b4bee6fb2c..5de69270b7e4 100644 --- a/solc/CommandLineInterface.h +++ b/solc/CommandLineInterface.h @@ -101,8 +101,9 @@ class CommandLineInterface void handleBinary(std::string const& _contract); void handleOpcode(std::string const& _contract); void handleIR(std::string const& _contract); + void handleIRAst(std::string const& _contract); void handleIROptimized(std::string const& _contract); - void handleEwasm(std::string const& _contract); + void handleIROptimizedAst(std::string const& _contract); void handleBytecode(std::string const& _contract); void handleSignatureHashes(std::string const& _contract); void handleMetadata(std::string const& _contract); diff --git a/solc/CommandLineParser.cpp b/solc/CommandLineParser.cpp index a3e7829660f1..060c1ad8fe0e 100644 --- a/solc/CommandLineParser.cpp +++ b/solc/CommandLineParser.cpp @@ -46,7 +46,6 @@ static string const g_strCombinedJson = "combined-json"; static string const g_strErrorRecovery = "error-recovery"; static string const g_strEVM = "evm"; static string const g_strEVMVersion = "evm-version"; -static string const g_strEwasm = "ewasm"; static string const g_strEOFVersion = "experimental-eof-version"; static string const g_strViaIR = "via-ir"; static string const g_strExperimentalViaIR = "experimental-via-ir"; @@ -71,12 +70,14 @@ static string const g_strModelCheckerDivModNoSlacks = "model-checker-div-mod-no- static string const g_strModelCheckerEngine = "model-checker-engine"; static string const g_strModelCheckerExtCalls = "model-checker-ext-calls"; static string const g_strModelCheckerInvariants = "model-checker-invariants"; +static string const g_strModelCheckerPrintQuery = "model-checker-print-query"; static string const g_strModelCheckerShowProvedSafe = "model-checker-show-proved-safe"; static string const g_strModelCheckerShowUnproved = "model-checker-show-unproved"; static string const g_strModelCheckerShowUnsupported = "model-checker-show-unsupported"; static string const g_strModelCheckerSolvers = "model-checker-solvers"; static string const g_strModelCheckerTargets = "model-checker-targets"; static string const g_strModelCheckerTimeout = "model-checker-timeout"; +static string const g_strModelCheckerBMCLoopIterations = "model-checker-bmc-loop-iterations"; static string const g_strNone = "none"; static string const g_strNoOptimizeYul = "no-optimize-yul"; static string const g_strOptimize = "optimize"; @@ -114,15 +115,13 @@ static string const g_strErrorIds = "error-codes"; /// Possible arguments to for --machine static set const g_machineArgs { - g_strEVM, - g_strEwasm + g_strEVM }; /// Possible arguments to for --yul-dialect static set const g_yulDialectArgs { - g_strEVM, - g_strEwasm + g_strEVM }; /// Possible arguments to for --metadata-hash @@ -249,9 +248,9 @@ bool CommandLineOptions::operator==(CommandLineOptions const& _other) const noex metadata.format == _other.metadata.format && metadata.hash == _other.metadata.hash && metadata.literalSources == _other.metadata.literalSources && - optimizer.enabled == _other.optimizer.enabled && + optimizer.optimizeEvmasm == _other.optimizer.optimizeEvmasm && + optimizer.optimizeYul == _other.optimizer.optimizeYul && optimizer.expectedExecutionsPerDeployment == _other.optimizer.expectedExecutionsPerDeployment && - optimizer.noOptimizeYul == _other.optimizer.noOptimizeYul && optimizer.yulSteps == _other.optimizer.yulSteps && modelChecker.initialize == _other.modelChecker.initialize && modelChecker.settings == _other.modelChecker.settings; @@ -261,13 +260,16 @@ OptimiserSettings CommandLineOptions::optimiserSettings() const { OptimiserSettings settings; - if (optimizer.enabled) + if (optimizer.optimizeEvmasm) settings = OptimiserSettings::standard(); else settings = OptimiserSettings::minimal(); - if (optimizer.noOptimizeYul) - settings.runYulOptimiser = false; + settings.runYulOptimiser = optimizer.optimizeYul; + if (optimizer.optimizeYul) + // NOTE: Standard JSON disables optimizeStackAllocation by default when yul optimizer is disabled. + // --optimize --no-optimize-yul on the CLI does not have that effect. + settings.optimizeStackAllocation = true; if (optimizer.expectedExecutionsPerDeployment.has_value()) settings.expectedExecutionsPerDeployment = optimizer.expectedExecutionsPerDeployment.value(); @@ -460,13 +462,12 @@ void CommandLineParser::parseOutputSelection() CompilerOutputs::componentMap() | ranges::views::keys | ranges::to() - ) - set{CompilerOutputs::componentName(&CompilerOutputs::ewasmIR)}; + ); static set const assemblerModeOutputs = { CompilerOutputs::componentName(&CompilerOutputs::asm_), CompilerOutputs::componentName(&CompilerOutputs::binary), CompilerOutputs::componentName(&CompilerOutputs::irOptimized), - CompilerOutputs::componentName(&CompilerOutputs::ewasm), - CompilerOutputs::componentName(&CompilerOutputs::ewasmIR), + CompilerOutputs::componentName(&CompilerOutputs::astCompactJson), }; switch (_mode) @@ -499,8 +500,6 @@ void CommandLineParser::parseOutputSelection() m_options.compiler.outputs.asm_ = true; m_options.compiler.outputs.binary = true; m_options.compiler.outputs.irOptimized = true; - m_options.compiler.outputs.ewasm = true; - m_options.compiler.outputs.ewasmIR = true; } vector unsupportedOutputs; @@ -528,8 +527,8 @@ are welcome to redistribute it under certain conditions. See 'solc --)" + g_strL for details. Usage: solc [options] [input_file...] -Compiles the given Solidity input files (or the standard input if none given or -"-" is used as a file name) and outputs the components specified in the options +Compiles the given Solidity input files (or the standard input if "-" is +used as a file name) and outputs the components specified in the options at standard output or in files in the output directory, if specified. Imports are automatically read from the filesystem, but it is also possible to remap paths using the context:prefix=path syntax. @@ -649,21 +648,15 @@ General Information)").c_str(), ) ( g_strAssemble.c_str(), - ("Switch to assembly mode, ignoring all options except " - "--" + g_strMachine + ", --" + g_strYulDialect + ", --" + g_strOptimize + " and --" + g_strYulOptimizations + " " - "and assumes input is assembly.").c_str() + "Switch to assembly mode and assume input is assembly." ) ( g_strYul.c_str(), - ("Switch to Yul mode, ignoring all options except " - "--" + g_strMachine + ", --" + g_strYulDialect + ", --" + g_strOptimize + " and --" + g_strYulOptimizations + " " - "and assumes input is Yul.").c_str() + "Switch to Yul mode and assume input is Yul." ) ( g_strStrictAssembly.c_str(), - ("Switch to strict assembly mode, ignoring all options except " - "--" + g_strMachine + ", --" + g_strYulDialect + ", --" + g_strOptimize + " and --" + g_strYulOptimizations + " " - "and assumes input is strict assembly.").c_str() + "Switch to strict assembly mode and assume input is strict assembly." ) ( g_strImportAst.c_str(), @@ -742,9 +735,9 @@ General Information)").c_str(), (CompilerOutputs::componentName(&CompilerOutputs::binaryRuntime).c_str(), "Binary of the runtime part of the contracts in hex.") (CompilerOutputs::componentName(&CompilerOutputs::abi).c_str(), "ABI specification of the contracts.") (CompilerOutputs::componentName(&CompilerOutputs::ir).c_str(), "Intermediate Representation (IR) of all contracts.") - (CompilerOutputs::componentName(&CompilerOutputs::irOptimized).c_str(), "Optimized intermediate Representation (IR) of all contracts.") - (CompilerOutputs::componentName(&CompilerOutputs::ewasm).c_str(), "Ewasm text representation of all contracts (EXPERIMENTAL).") - (CompilerOutputs::componentName(&CompilerOutputs::ewasmIR).c_str(), "Intermediate representation (IR) converted to a form that can be translated directly into Ewasm text representation (EXPERIMENTAL).") + (CompilerOutputs::componentName(&CompilerOutputs::irAstJson).c_str(), "AST of Intermediate Representation (IR) of all contracts in a compact JSON format.") + (CompilerOutputs::componentName(&CompilerOutputs::irOptimized).c_str(), "Optimized Intermediate Representation (IR) of all contracts.") + (CompilerOutputs::componentName(&CompilerOutputs::irOptimizedAstJson).c_str(), "AST of optimized Intermediate Representation (IR) of all contracts in a compact JSON format.") (CompilerOutputs::componentName(&CompilerOutputs::signatureHashes).c_str(), "Function signature hashes of the contracts.") (CompilerOutputs::componentName(&CompilerOutputs::natspecUser).c_str(), "Natspec user documentation of all contracts.") (CompilerOutputs::componentName(&CompilerOutputs::natspecDev).c_str(), "Natspec developer documentation of all contracts.") @@ -789,7 +782,7 @@ General Information)").c_str(), optimizerOptions.add_options() ( g_strOptimize.c_str(), - "Enable bytecode optimizer." + "Enable optimizer." ) ( g_strOptimizeRuns.c_str(), @@ -801,16 +794,18 @@ General Information)").c_str(), ) ( g_strOptimizeYul.c_str(), - ("Legacy option, ignored. Use the general --" + g_strOptimize + " to enable Yul optimizer.").c_str() + ("Enable Yul optimizer (independently of the EVM assembly optimizer). " + "The general --" + g_strOptimize + " option automatically enables this unless --" + + g_strNoOptimizeYul + " is specified.").c_str() ) ( g_strNoOptimizeYul.c_str(), - "Disable Yul optimizer in Solidity." + "Disable Yul optimizer (independently of the EVM assembly optimizer)." ) ( g_strYulOptimizations.c_str(), po::value()->value_name("steps"), - "Forces yul optimizer to use the specified sequence of optimization steps instead of the built-in one." + "Forces Yul optimizer to use the specified sequence of optimization steps instead of the built-in one." ) ; desc.add(optimizerOptions); @@ -847,6 +842,10 @@ General Information)").c_str(), " Multiple types of invariants can be selected at the same time, separated by a comma and no spaces." " By default no invariants are reported." ) + ( + g_strModelCheckerPrintQuery.c_str(), + "Print the queries created by the SMTChecker in the SMTLIB2 format." + ) ( g_strModelCheckerShowProvedSafe.c_str(), "Show all targets that were proved safe separately." @@ -867,17 +866,23 @@ General Information)").c_str(), ( g_strModelCheckerTargets.c_str(), po::value()->value_name("default,all,constantCondition,underflow,overflow,divByZero,balance,assert,popEmptyArray,outOfBounds")->default_value("default"), - "Select model checker verification targets. " + "Select model checker verification targets." "Multiple targets can be selected at the same time, separated by a comma and no spaces." " By default all targets except underflow and overflow are selected." ) ( g_strModelCheckerTimeout.c_str(), po::value()->value_name("ms"), - "Set model checker timeout per query in milliseconds. " - "The default is a deterministic resource limit. " + "Set model checker timeout per query in milliseconds." + "The default is a deterministic resource limit." "A timeout of 0 means no resource/time restrictions for any query." ) + ( + g_strModelCheckerBMCLoopIterations.c_str(), + po::value(), + "Set loop unrolling depth for BMC engine." + "Default is 1." + ) ; desc.add(smtCheckerOptions); @@ -963,14 +968,17 @@ void CommandLineParser::processArgs() {g_strMetadataLiteral, {InputMode::Compiler, InputMode::CompilerWithASTImport}}, {g_strNoCBORMetadata, {InputMode::Compiler, InputMode::CompilerWithASTImport}}, {g_strMetadataHash, {InputMode::Compiler, InputMode::CompilerWithASTImport}}, - {g_strModelCheckerShowProvedSafe, {InputMode::Compiler, InputMode::CompilerWithASTImport}}, - {g_strModelCheckerShowUnproved, {InputMode::Compiler, InputMode::CompilerWithASTImport}}, - {g_strModelCheckerShowUnsupported, {InputMode::Compiler, InputMode::CompilerWithASTImport}}, + {g_strModelCheckerContracts, {InputMode::Compiler, InputMode::CompilerWithASTImport}}, {g_strModelCheckerDivModNoSlacks, {InputMode::Compiler, InputMode::CompilerWithASTImport}}, {g_strModelCheckerEngine, {InputMode::Compiler, InputMode::CompilerWithASTImport}}, {g_strModelCheckerInvariants, {InputMode::Compiler, InputMode::CompilerWithASTImport}}, + {g_strModelCheckerPrintQuery, {InputMode::Compiler, InputMode::CompilerWithASTImport}}, + {g_strModelCheckerShowProvedSafe, {InputMode::Compiler, InputMode::CompilerWithASTImport}}, + {g_strModelCheckerShowUnproved, {InputMode::Compiler, InputMode::CompilerWithASTImport}}, + {g_strModelCheckerShowUnsupported, {InputMode::Compiler, InputMode::CompilerWithASTImport}}, {g_strModelCheckerSolvers, {InputMode::Compiler, InputMode::CompilerWithASTImport}}, {g_strModelCheckerTimeout, {InputMode::Compiler, InputMode::CompilerWithASTImport}}, + {g_strModelCheckerBMCLoopIterations, {InputMode::Compiler, InputMode::CompilerWithASTImport}}, {g_strModelCheckerContracts, {InputMode::Compiler, InputMode::CompilerWithASTImport}}, {g_strModelCheckerTargets, {InputMode::Compiler, InputMode::CompilerWithASTImport}} }; @@ -996,21 +1004,11 @@ void CommandLineParser::processArgs() return; checkMutuallyExclusive({g_strColor, g_strNoColor}); + checkMutuallyExclusive({g_strStopAfter, g_strGas}); - array const conflictingWithStopAfter{ - CompilerOutputs::componentName(&CompilerOutputs::binary), - CompilerOutputs::componentName(&CompilerOutputs::ir), - CompilerOutputs::componentName(&CompilerOutputs::irOptimized), - CompilerOutputs::componentName(&CompilerOutputs::ewasm), - CompilerOutputs::componentName(&CompilerOutputs::ewasmIR), - g_strGas, - CompilerOutputs::componentName(&CompilerOutputs::asm_), - CompilerOutputs::componentName(&CompilerOutputs::asmJson), - CompilerOutputs::componentName(&CompilerOutputs::opcodes), - }; - - for (auto& option: conflictingWithStopAfter) - checkMutuallyExclusive({g_strStopAfter, option}); + for (string const& option: CompilerOutputs::componentMap() | ranges::views::keys) + if (option != CompilerOutputs::componentName(&CompilerOutputs::astCompactJson)) + checkMutuallyExclusive({g_strStopAfter, option}); if ( m_options.input.mode != InputMode::Compiler && @@ -1157,8 +1155,17 @@ void CommandLineParser::processArgs() m_options.output.eofVersion = 1; } - m_options.optimizer.enabled = (m_args.count(g_strOptimize) > 0); - m_options.optimizer.noOptimizeYul = (m_args.count(g_strNoOptimizeYul) > 0); + if (m_args.count(g_strNoOptimizeYul) > 0 && m_args.count(g_strOptimizeYul) > 0) + solThrow( + CommandLineValidationError, + "Options --" + g_strOptimizeYul + " and --" + g_strNoOptimizeYul + " cannot be used together." + ); + + m_options.optimizer.optimizeEvmasm = (m_args.count(g_strOptimize) > 0); + m_options.optimizer.optimizeYul = ( + (m_args.count(g_strOptimize) > 0 && m_args.count(g_strNoOptimizeYul) == 0) || + m_args.count(g_strOptimizeYul) > 0 + ); if (!m_args[g_strOptimizeRuns].defaulted()) m_options.optimizer.expectedExecutionsPerDeployment = m_args.at(g_strOptimizeRuns).as(); @@ -1190,8 +1197,6 @@ void CommandLineParser::processArgs() g_strOutputDir, g_strGas, g_strCombinedJson, - g_strOptimizeYul, - g_strNoOptimizeYul, }; if (countEnabledOptions(nonAssemblyModeOptions) >= 1) { @@ -1199,9 +1204,6 @@ void CommandLineParser::processArgs() auto enabledOptions = nonAssemblyModeOptions | ranges::views::filter(optionEnabled) | ranges::to_vector; string message = "The following options are invalid in assembly mode: " + joinOptionNames(enabledOptions) + "."; - if (m_args.count(g_strOptimizeYul) || m_args.count(g_strNoOptimizeYul)) - message += " Optimization is disabled by default and can be enabled with --" + g_strOptimize + "."; - solThrow(CommandLineValidationError, message); } @@ -1215,42 +1217,25 @@ void CommandLineParser::processArgs() string machine = m_args[g_strMachine].as(); if (machine == g_strEVM) m_options.assembly.targetMachine = Machine::EVM; - else if (machine == g_strEwasm) - m_options.assembly.targetMachine = Machine::Ewasm; else solThrow(CommandLineValidationError, "Invalid option for --" + g_strMachine + ": " + machine); } - if (m_options.assembly.targetMachine == Machine::Ewasm && m_options.assembly.inputLanguage == Input::StrictAssembly) - m_options.assembly.inputLanguage = Input::Ewasm; if (m_args.count(g_strYulDialect)) { string dialect = m_args[g_strYulDialect].as(); if (dialect == g_strEVM) m_options.assembly.inputLanguage = Input::StrictAssembly; - else if (dialect == g_strEwasm) - { - m_options.assembly.inputLanguage = Input::Ewasm; - if (m_options.assembly.targetMachine != Machine::Ewasm) - solThrow( - CommandLineValidationError, - "If you select Ewasm as --" + g_strYulDialect + ", " - "--" + g_strMachine + " has to be Ewasm as well." - ); - } else solThrow(CommandLineValidationError, "Invalid option for --" + g_strYulDialect + ": " + dialect); } - if (m_options.optimizer.enabled && (m_options.assembly.inputLanguage != Input::StrictAssembly && m_options.assembly.inputLanguage != Input::Ewasm)) + if ( + (m_options.optimizer.optimizeEvmasm || m_options.optimizer.optimizeYul) && + m_options.assembly.inputLanguage != Input::StrictAssembly + ) solThrow( CommandLineValidationError, "Optimizer can only be used for strict assembly. Use --" + g_strStrictAssembly + "." ); - if (m_options.assembly.targetMachine == Machine::Ewasm && m_options.assembly.inputLanguage != Input::StrictAssembly && m_options.assembly.inputLanguage != Input::Ewasm) - solThrow( - CommandLineValidationError, - "The selected input language is not directly supported when targeting the Ewasm machine " - "and automatic translation is not available." - ); return; } else if (countEnabledOptions({g_strYulDialect, g_strMachine}) >= 1) @@ -1344,6 +1329,13 @@ void CommandLineParser::processArgs() m_options.modelChecker.settings.solvers = *solvers; } + if (m_args.count(g_strModelCheckerPrintQuery)) + { + if (!(m_options.modelChecker.settings.solvers == smtutil::SMTSolverChoice::SMTLIB2())) + solThrow(CommandLineValidationError, "Only SMTLib2 solver can be enabled to print queries"); + m_options.modelChecker.settings.printQuery = true; + } + if (m_args.count(g_strModelCheckerTargets)) { string targetsStr = m_args[g_strModelCheckerTargets].as(); @@ -1356,6 +1348,13 @@ void CommandLineParser::processArgs() if (m_args.count(g_strModelCheckerTimeout)) m_options.modelChecker.settings.timeout = m_args[g_strModelCheckerTimeout].as(); + if (m_args.count(g_strModelCheckerBMCLoopIterations)) + { + if (!m_options.modelChecker.settings.engine.bmc) + solThrow(CommandLineValidationError, "BMC loop unrolling requires the BMC engine to be enabled"); + m_options.modelChecker.settings.bmcLoopIterations = m_args[g_strModelCheckerBMCLoopIterations].as(); + } + m_options.metadata.literalSources = (m_args.count(g_strMetadataLiteral) > 0); m_options.modelChecker.initialize = m_args.count(g_strModelCheckerContracts) || diff --git a/solc/CommandLineParser.h b/solc/CommandLineParser.h index 51efc9e40828..6b391e724096 100644 --- a/solc/CommandLineParser.h +++ b/solc/CommandLineParser.h @@ -77,9 +77,9 @@ struct CompilerOutputs {"bin-runtime", &CompilerOutputs::binaryRuntime}, {"abi", &CompilerOutputs::abi}, {"ir", &CompilerOutputs::ir}, + {"ir-ast-json", &CompilerOutputs::irAstJson}, {"ir-optimized", &CompilerOutputs::irOptimized}, - {"ewasm", &CompilerOutputs::ewasm}, - {"ewasm-ir", &CompilerOutputs::ewasmIR}, + {"ir-optimized-ast-json", &CompilerOutputs::irOptimizedAstJson}, {"hashes", &CompilerOutputs::signatureHashes}, {"userdoc", &CompilerOutputs::natspecUser}, {"devdoc", &CompilerOutputs::natspecDev}, @@ -97,9 +97,9 @@ struct CompilerOutputs bool binaryRuntime = false; bool abi = false; bool ir = false; + bool irAstJson = false; bool irOptimized = false; - bool ewasm = false; - bool ewasmIR = false; + bool irOptimizedAstJson = false; bool signatureHashes = false; bool natspecUser = false; bool natspecDev = false; @@ -223,9 +223,9 @@ struct CommandLineOptions struct { - bool enabled = false; + bool optimizeEvmasm = false; + bool optimizeYul = false; std::optional expectedExecutionsPerDeployment; - bool noOptimizeYul = false; std::optional yulSteps; } optimizer; diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 9a2c78fd8c1b..9a3fa84b490f 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -135,8 +135,6 @@ set(libyul_sources libyul/ControlFlowSideEffectsTest.h libyul/EVMCodeTransformTest.cpp libyul/EVMCodeTransformTest.h - libyul/EwasmTranslationTest.cpp - libyul/EwasmTranslationTest.h libyul/FunctionSideEffects.cpp libyul/FunctionSideEffects.h libyul/Inliner.cpp diff --git a/test/Common.cpp b/test/Common.cpp index 3af23c782783..72e4d13e8f6f 100644 --- a/test/Common.cpp +++ b/test/Common.cpp @@ -108,13 +108,11 @@ void CommonOptions::addOptions() ("eof-version", po::value()->implicit_value(1u), "which EOF version to use") ("testpath", po::value(&this->testPath)->default_value(solidity::test::testPath()), "path to test files") ("vm", po::value>(&vmPaths), "path to evmc library, can be supplied multiple times.") - ("ewasm", po::bool_switch(&ewasm)->default_value(ewasm), "tries to automatically find an ewasm vm and enable ewasm test-execution.") ("batches", po::value(&this->batches)->default_value(1), "set number of batches to split the tests into") ("selected-batch", po::value(&this->selectedBatch)->default_value(0), "zero-based number of batch to execute") ("no-semantic-tests", po::bool_switch(&disableSemanticTests)->default_value(disableSemanticTests), "disable semantic tests") ("no-smt", po::bool_switch(&disableSMT)->default_value(disableSMT), "disable SMT checker") ("optimize", po::bool_switch(&optimize)->default_value(optimize), "enables optimization") - ("enforce-compile-to-ewasm", po::bool_switch(&enforceCompileToEwasm)->default_value(enforceCompileToEwasm), "Enforce compiling all tests to Ewasm to see if additional tests can be activated.") ("enforce-gas-cost", po::value(&enforceGasTest)->default_value(enforceGasTest)->implicit_value(true), "Enforce checking gas cost in semantic tests.") ("enforce-gas-cost-min-value", po::value(&enforceGasTestMinValue)->default_value(enforceGasTestMinValue), "Threshold value to enforce adding gas checks to a test.") ("abiencoderv1", po::bool_switch(&useABIEncoderV1)->default_value(useABIEncoderV1), "enables abi encoder v1") @@ -209,14 +207,6 @@ bool CommonOptions::parse(int argc, char const* const* argv) vmPaths.emplace_back(*repoPath); else vmPaths.emplace_back(evmoneFilename); - if (ewasm) { - if (auto envPath = getenv("ETH_HERA")) - vmPaths.emplace_back(envPath); - else if (auto repoPath = findInDefaultPath(heraFilename)) - vmPaths.emplace_back(*repoPath); - else - vmPaths.emplace_back(heraFilename); - } } return true; @@ -234,8 +224,6 @@ string CommonOptions::toString(vector const& _selectedOptions) const {"optimize", boolToString(optimize)}, {"useABIEncoderV1", boolToString(useABIEncoderV1)}, {"batch", to_string(selectedBatch + 1) + "/" + to_string(batches)}, - {"ewasm", boolToString(ewasm)}, - {"enforceCompileToEwasm", boolToString(enforceCompileToEwasm)}, {"enforceGasTest", boolToString(enforceGasTest)}, {"enforceGasTestMinValue", enforceGasTestMinValue.str()}, {"disableSemanticTests", boolToString(disableSemanticTests)}, @@ -303,10 +291,10 @@ bool isValidSemanticTestPath(boost::filesystem::path const& _testPath) bool loadVMs(CommonOptions const& _options) { - if (_options.disableSemanticTests && !_options.ewasm) + if (_options.disableSemanticTests) return true; - auto [evmSupported, ewasmSupported] = solidity::test::EVMHost::checkVmPaths(_options.vmPaths); + bool evmSupported = solidity::test::EVMHost::checkVmPaths(_options.vmPaths); if (!_options.disableSemanticTests && !evmSupported) { std::cerr << "Unable to find " << solidity::test::evmoneFilename; @@ -315,14 +303,6 @@ bool loadVMs(CommonOptions const& _options) std::cerr << solidity::test::evmoneDownloadLink << std::endl; return false; } - if (_options.ewasm && !ewasmSupported) - { - std::cerr << "Unable to find " << solidity::test::heraFilename; - std::cerr << ". To be able to enable ewasm tests, please provide the path using --vm ." << std::endl; - std::cerr << "You can download it at" << std::endl; - std::cerr << solidity::test::heraDownloadLink << std::endl; - return false; - } return true; } diff --git a/test/Common.h b/test/Common.h index 468e5af645d3..d82ff9c6b71f 100644 --- a/test/Common.h +++ b/test/Common.h @@ -34,18 +34,12 @@ namespace solidity::test #ifdef _WIN32 static constexpr auto evmoneFilename = "evmone.dll"; static constexpr auto evmoneDownloadLink = "https://github.com/ethereum/evmone/releases/download/v0.10.0/evmone-0.10.0-windows-amd64.zip"; -static constexpr auto heraFilename = "hera.dll"; -static constexpr auto heraDownloadLink = "https://github.com/ewasm/hera/archive/v0.6.0.tar.gz"; #elif defined(__APPLE__) static constexpr auto evmoneFilename = "libevmone.dylib"; static constexpr auto evmoneDownloadLink = "https://github.com/ethereum/evmone/releases/download/v0.10.0/evmone-0.10.0-darwin-x86_64.tar.gz"; -static constexpr auto heraFilename = "libhera.dylib"; -static constexpr auto heraDownloadLink = "https://github.com/ewasm/hera/releases/download/v0.6.0/hera-0.6.0-darwin-x86_64.tar.gz"; #else static constexpr auto evmoneFilename = "libevmone.so"; static constexpr auto evmoneDownloadLink = "https://github.com/ethereum/evmone/releases/download/v0.10.0/evmone-0.10.0-linux-x86_64.tar.gz"; -static constexpr auto heraFilename = "libhera.so"; -static constexpr auto heraDownloadLink = "https://github.com/ewasm/hera/releases/download/v0.6.0/hera-0.6.0-linux-x86_64.tar.gz"; #endif struct ConfigException: public util::Exception {}; @@ -58,9 +52,7 @@ struct CommonOptions std::vector vmPaths; boost::filesystem::path testPath; - bool ewasm = false; bool optimize = false; - bool enforceCompileToEwasm = false; bool enforceGasTest = false; u256 enforceGasTestMinValue = 100000; bool disableSemanticTests = false; diff --git a/test/EVMHost.cpp b/test/EVMHost.cpp index 132ce2bebadb..81005547d2de 100644 --- a/test/EVMHost.cpp +++ b/test/EVMHost.cpp @@ -47,10 +47,10 @@ evmc::VM& EVMHost::getVM(string const& _path) auto vm = evmc::VM{evmc_load_and_configure(_path.c_str(), &errorCode)}; if (vm && errorCode == EVMC_LOADER_SUCCESS) { - if (vm.get_capabilities() & (EVMC_CAPABILITY_EVM1 | EVMC_CAPABILITY_EWASM)) + if (vm.get_capabilities() & (EVMC_CAPABILITY_EVM1)) vms[_path] = make_unique(evmc::VM(std::move(vm))); else - cerr << "VM loaded neither supports EVM1 nor EWASM" << endl; + cerr << "VM loaded does not support EVM1" << endl; } else { @@ -67,10 +67,9 @@ evmc::VM& EVMHost::getVM(string const& _path) return NullVM; } -std::tuple EVMHost::checkVmPaths(vector const& _vmPaths) +bool EVMHost::checkVmPaths(vector const& _vmPaths) { bool evmVmFound = false; - bool ewasmVmFound = false; for (auto const& path: _vmPaths) { evmc::VM& vm = EVMHost::getVM(path.string()); @@ -83,15 +82,8 @@ std::tuple EVMHost::checkVmPaths(vector con BOOST_THROW_EXCEPTION(runtime_error("Multiple evm1 evmc vms defined. Please only define one evm1 evmc vm.")); evmVmFound = true; } - - if (vm.has_capability(EVMC_CAPABILITY_EWASM)) - { - if (ewasmVmFound) - BOOST_THROW_EXCEPTION(runtime_error("Multiple ewasm evmc vms where defined. Please only define one ewasm evmc vm.")); - ewasmVmFound = true; - } } - return {evmVmFound, ewasmVmFound}; + return evmVmFound; } EVMHost::EVMHost(langutil::EVMVersion _evmVersion, evmc::VM& _vm): diff --git a/test/EVMHost.h b/test/EVMHost.h index 61b4c3c71c8f..967adc2486aa 100644 --- a/test/EVMHost.h +++ b/test/EVMHost.h @@ -65,16 +65,15 @@ class EVMHost: public evmc::MockedHost // Solidity testing specific features. - /// Tries to dynamically load an evmc vm supporting evm1 or ewasm and caches the loaded VM. + /// Tries to dynamically load an evmc vm supporting evm1 and caches the loaded VM. /// @returns vmc::VM(nullptr) on failure. static evmc::VM& getVM(std::string const& _path = {}); /// Tries to load all defined evmc vm shared libraries. /// @param _vmPaths paths to multiple evmc shared libraries. - /// @throw Exception if multiple evm1 or multiple ewasm evmc vms where loaded. - /// @returns A pair of booleans, the first element being true, if an evmc vm supporting evm1 was loaded properly, - /// the second being true, if an evmc vm supporting ewasm was loaded properly. - static std::tuple checkVmPaths(std::vector const& _vmPaths); + /// @throw Exception if multiple evm1 vms where loaded. + /// @returns true, if an evmc vm supporting evm1 was loaded properly, + static bool checkVmPaths(std::vector const& _vmPaths); explicit EVMHost(langutil::EVMVersion _evmVersion, evmc::VM& _vm); diff --git a/test/ExecutionFramework.cpp b/test/ExecutionFramework.cpp index 0b7c6ea80caf..a18a73de06b8 100644 --- a/test/ExecutionFramework.cpp +++ b/test/ExecutionFramework.cpp @@ -60,11 +60,6 @@ ExecutionFramework::ExecutionFramework(langutil::EVMVersion _evmVersion, vector< { if (solidity::test::CommonOptions::get().optimize) m_optimiserSettings = solidity::frontend::OptimiserSettings::standard(); - - for (auto const& path: m_vmPaths) - if (EVMHost::getVM(path.string()).has_capability(EVMC_CAPABILITY_EWASM)) - m_supportsEwasm = true; - selectVM(evmc_capabilities::EVMC_CAPABILITY_EVM1); } diff --git a/test/ExecutionFramework.h b/test/ExecutionFramework.h index a4154d1cd9d6..de0fb9477bcb 100644 --- a/test/ExecutionFramework.h +++ b/test/ExecutionFramework.h @@ -296,7 +296,6 @@ class ExecutionFramework solidity::frontend::RevertStrings m_revertStrings = solidity::frontend::RevertStrings::Default; solidity::frontend::OptimiserSettings m_optimiserSettings = solidity::frontend::OptimiserSettings::minimal(); bool m_showMessages = false; - bool m_supportsEwasm = false; std::unique_ptr m_evmcHost; std::vector m_vmPaths; diff --git a/test/InteractiveTests.h b/test/InteractiveTests.h index e58beabbf8e4..9e054c109c5d 100644 --- a/test/InteractiveTests.h +++ b/test/InteractiveTests.h @@ -28,7 +28,6 @@ #include #include #include -#include #include #include #include @@ -78,7 +77,6 @@ Testsuite const g_interactiveTestsuites[] = { {"SMT Checker", "libsolidity", "smtCheckerTests", true, false, &SMTCheckerTest::create}, {"Gas Estimates", "libsolidity", "gasTests", false, false, &GasTest::create}, {"Memory Guard Tests", "libsolidity", "memoryGuardTests", false, false, &MemoryGuardTest::create}, - {"Ewasm Translation", "libyul", "ewasmTranslationTests", false, false, &yul::test::EwasmTranslationTest::create} }; } diff --git a/test/TestCase.h b/test/TestCase.h index 7a5c75c50209..f631bea8dce3 100644 --- a/test/TestCase.h +++ b/test/TestCase.h @@ -41,7 +41,6 @@ class TestCase langutil::EVMVersion evmVersion; std::optional eofVersion; std::vector vmPaths; - bool enforceCompileToEwasm = false; bool enforceGasCost = false; u256 enforceGasCostMinValue; }; diff --git a/test/cmdlineTests.sh b/test/cmdlineTests.sh index ce9af142fc76..b02880557c71 100755 --- a/test/cmdlineTests.sh +++ b/test/cmdlineTests.sh @@ -32,6 +32,8 @@ set -eo pipefail REPO_ROOT=$(cd "$(dirname "$0")/.." && pwd) SOLIDITY_BUILD_DIR=${SOLIDITY_BUILD_DIR:-${REPO_ROOT}/build} +export REPO_ROOT SOLIDITY_BUILD_DIR + # shellcheck source=scripts/common.sh source "${REPO_ROOT}/scripts/common.sh" # shellcheck source=scripts/common_cmdline.sh @@ -40,8 +42,8 @@ source "${REPO_ROOT}/scripts/common_cmdline.sh" pushd "${REPO_ROOT}/test/cmdlineTests" > /dev/null autoupdate=false no_smt=false -declare -a selected_tests -declare -a patterns_with_no_matches +declare -a included_test_patterns +declare -a excluded_test_patterns while [[ $# -gt 0 ]] do case "$1" in @@ -53,27 +55,47 @@ do no_smt=true shift ;; + --exclude) + [[ $2 != '' ]] || fail "No pattern given to --exclude option or the pattern is empty." + excluded_test_patterns+=("$2") + shift + shift + ;; *) - matching_tests=$(find . -mindepth 1 -maxdepth 1 -type d -name "$1" | cut -c 3- | sort) - - if [[ $matching_tests == "" ]] - then - patterns_with_no_matches+=("$1") - printWarning "No tests matching pattern '$1' found." - else - # shellcheck disable=SC2206 # We do not support test names containing spaces. - selected_tests+=($matching_tests) - fi - + included_test_patterns+=("$1") shift ;; esac done -if (( ${#selected_tests[@]} == 0 && ${#patterns_with_no_matches[@]} == 0 )) +(( ${#included_test_patterns[@]} > 0 )) || included_test_patterns+=('*') + +test_name_filter=('(' -name "${included_test_patterns[0]}") +for pattern in "${included_test_patterns[@]:1}" +do + test_name_filter+=(-or -name "$pattern") +done +test_name_filter+=(')') + +for pattern in "${excluded_test_patterns[@]}" +do + test_name_filter+=(-and -not -name "$pattern") +done + +# NOTE: We want leading symbols in names to affect the sort order but without +# LC_COLLATE=C sort seems to ignore them. +# shellcheck disable=SC2207 # We do not support test names containing spaces. +selected_tests=($(find . -mindepth 1 -maxdepth 1 -type d "${test_name_filter[@]}" | cut -c 3- | LC_COLLATE=C sort)) + +if (( ${#selected_tests[@]} == 0 )) then - selected_tests=(*) + printWarning "The pattern '${test_name_filter[*]}' did not match any tests." + exit 0; +else + test_count=$(find . -mindepth 1 -maxdepth 1 -type d | wc -l) + printLog "Selected ${#selected_tests[@]} out of ${test_count} tests." fi + popd > /dev/null case "$OSTYPE" in @@ -88,6 +110,7 @@ case "$OSTYPE" in ;; esac echo "Using solc binary at ${SOLC}" +export SOLC INTERACTIVE=true if ! tty -s || [ "$CI" ] @@ -108,7 +131,7 @@ function update_expectation { local newExpectation="${1}" local expectationFile="${2}" - if [[ $newExpectation == "" || $newExpectation -eq 0 && $expectationFile == */exit ]] + if [[ $newExpectation == '' || $newExpectation == '0' && $expectationFile == */exit ]] then if [[ -f $expectationFile ]] then @@ -167,8 +190,8 @@ function test_solc_behaviour local stderr_expected="${7}" local stdout_expectation_file="${8}" # the file to write to when user chooses to update stdout expectation local stderr_expectation_file="${9}" # the file to write to when user chooses to update stderr expectation - local stdout_path; stdout_path=$(mktemp) - local stderr_path; stderr_path=$(mktemp) + local stdout_path; stdout_path=$(mktemp -t "cmdline-test-stdout-XXXXXX") + local stderr_path; stderr_path=$(mktemp -t "cmdline-test-stderr-XXXXXX") # shellcheck disable=SC2064 trap "rm -f $stdout_path $stderr_path" EXIT @@ -209,13 +232,12 @@ EOF sed -i.bak -E -e 's/([0-9a-f]{34}\$__)[0-9a-f]+(__\$[0-9a-f]{17})/\1\2/g' "$stdout_path" # Remove metadata in assembly output (see below about the magic numbers) sed -i.bak -E -e 's/"[0-9a-f]+64697066735822[0-9a-f]+64736f6c63[0-9a-f]+/"/g' "$stdout_path" - # Remove hash of text representation in ewasm - sed -i.bak -E -e 's/The Keccak-256 hash of the text representation of .*: [0-9a-f]+/The Keccak-256 hash of the text representation of /g' "$stdout_path" # Replace escaped newlines by actual newlines for readability # shellcheck disable=SC1003 sed -i.bak -E -e 's/\\n/\'$'\n/g' "$stdout_path" sed -i.bak -e 's/\(^[ ]*auxdata:[[:space:]]\)0x[0-9a-f]*$/\1/' "$stdout_path" + sed -i.bak -e 's/\(\\"version\\":[ ]*\\"\)[^"\\]*\(\\"\)/\1\2/' "$stdout_path" rm "$stdout_path.bak" else sed -i.bak -e '/^Warning: This is a pre-release compiler version, please do not use it in production./d' "$stderr_path" @@ -293,117 +315,8 @@ EOF } -function test_solc_assembly_output -{ - local input="${1}" - local expected="${2}" - IFS=" " read -r -a solc_args <<< "${3}" - - local expected_object="object \"object\" { code ${expected} }" - - output=$(echo "${input}" | msg_on_error --no-stderr "$SOLC" - "${solc_args[@]}") - empty=$(echo "$output" | tr '\n' ' ' | tr -s ' ' | sed -ne "/${expected_object}/p") - if [ -z "$empty" ] - then - printError "Incorrect assembly output. Expected: " - >&2 echo -e "${expected}" - printError "with arguments ${solc_args[*]}, but got:" - >&2 echo "${output}" - fail - fi -} - -function test_via_ir_equivalence() -{ - SOLTMPDIR=$(mktemp -d) - pushd "$SOLTMPDIR" > /dev/null - - (( $# <= 2 )) || fail "This function accepts at most two arguments." - - if [[ $2 != --optimize ]] && [[ $2 != "" ]] - then - fail "The second argument must be --optimize if present." - fi - - local solidity_file="$1" - local optimize_flag="$2" - - output_file_prefix=$(basename "$1" .sol) - - local optimizer_flags=() - [[ $optimize_flag == "" ]] || optimizer_flags+=("$optimize_flag") - [[ $optimize_flag == "" ]] || output_file_prefix+="_optimize" - - msg_on_error --no-stderr "$SOLC" --ir-optimized --debug-info location "${optimizer_flags[@]}" "$solidity_file" | - sed '/^Optimized IR:$/d' | - split_on_empty_lines_into_numbered_files $output_file_prefix ".yul" - - for yul_file in $(find . -name "${output_file_prefix}*.yul" | sort -V); do - msg_on_error --no-stderr "$SOLC" --strict-assembly --asm "${optimizer_flags[@]}" "$yul_file" | - sed '/^Text representation:$/d' > "${yul_file/.yul/.asm}" - done - - local asm_output_two_stage asm_output_via_ir - for asm_file in $(find . -name "${output_file_prefix}*.asm" | sort -V); do - asm_output_two_stage+=$(sed '/^asm_output_two_stage:$/d' "$asm_file" | sed '/^=======/d') - done - - asm_output_via_ir=$( - msg_on_error --no-stderr "$SOLC" --via-ir --asm --debug-info location "${optimizer_flags[@]}" "$solidity_file" | - sed '/^EVM assembly:$/d' | - sed '/^=======/d' - ) - - diff_values "$asm_output_two_stage" "$asm_output_via_ir" --ignore-space-change --ignore-blank-lines - - local bin_output_two_stage bin_output_via_ir - - for yul_file in $(find . -name "${output_file_prefix}*.yul" | sort -V); do - bin_output_two_stage+=$( - msg_on_error --no-stderr "$SOLC" --strict-assembly --bin "${optimizer_flags[@]}" "$yul_file" | - sed '/^Binary representation:$/d' | - sed '/^=======/d' - ) - done - - bin_output_via_ir=$( - msg_on_error --no-stderr "$SOLC" --via-ir --bin "${optimizer_flags[@]}" "$solidity_file" | - sed '/^Binary:$/d' | - sed '/^=======/d' - ) - - diff_values "$bin_output_two_stage" "$bin_output_via_ir" --ignore-space-change --ignore-blank-lines - - popd > /dev/null - rm -r "$SOLTMPDIR" -} - ## RUN -SOLTMPDIR=$(mktemp -d) -printTask "Checking that the bug list is up to date..." -cp "${REPO_ROOT}/docs/bugs_by_version.json" "${SOLTMPDIR}/original_bugs_by_version.json" -"${REPO_ROOT}/scripts/update_bugs_by_version.py" -diff --unified "${SOLTMPDIR}/original_bugs_by_version.json" "${REPO_ROOT}/docs/bugs_by_version.json" || \ - fail "The bug list in bugs_by_version.json was out of date and has been updated. Please investigate and submit a bugfix if necessary." -rm -r "$SOLTMPDIR" - -printTask "Testing unknown options..." -( - set +e - output=$("$SOLC" --allow=test 2>&1) - failed=$? - set -e - - if [ "$output" == "unrecognised option '--allow=test'" ] && [ $failed -ne 0 ] - then - echo "Passed" - else - fail "Incorrect response to unknown options: $output" - fi -) - - printTask "Testing passing files that are not found..." test_solc_behaviour "file_not_found.sol" "" "" "" 1 "" "\"file_not_found.sol\" is not found." "" "" @@ -443,13 +356,23 @@ printTask "Running general commandline tests..." fi fi + scriptFiles="$(ls -1 "${tdir}/test."* 2> /dev/null || true)" + scriptCount="$(echo "${scriptFiles}" | wc -w)" + inputFiles="$(ls -1 "${tdir}/input."* 2> /dev/null || true)" inputCount="$(echo "${inputFiles}" | wc -w)" - if (( inputCount > 1 )) + (( inputCount <= 1 )) || fail "Ambiguous input. Found input files in multiple formats:"$'\n'"${inputFiles}" + (( scriptCount <= 1 )) || fail "Ambiguous input. Found script files in multiple formats:"$'\n'"${scriptFiles}" + (( inputCount == 0 || scriptCount == 0 )) || fail "Ambiguous input. Found both input and script files:"$'\n'"${inputFiles}"$'\n'"${scriptFiles}" + + if (( scriptCount == 1 )) then - printError "Ambiguous input. Found input files in multiple formats:" - echo -e "${inputFiles}" - fail + if ! "$scriptFiles" + then + fail "Test script ${scriptFiles} failed." + fi + + continue fi # Use printf to get rid of the trailing newline @@ -499,206 +422,4 @@ printTask "Running general commandline tests..." done ) -printTask "Compiling various other contracts and libraries..." -( - cd "$REPO_ROOT"/test/compilationTests/ - for dir in */ - do - echo " - $dir" - cd "$dir" - # shellcheck disable=SC2046 # These file names are not supposed to contain spaces. - compileFull --expect-warnings $(find . -name '*.sol') - cd .. - done -) - -printTask "Compiling all examples from the documentation..." -SOLTMPDIR=$(mktemp -d) -( - set -e - cd "$SOLTMPDIR" - "$REPO_ROOT"/scripts/isolate_tests.py "$REPO_ROOT"/docs/ - developmentVersion=$("$REPO_ROOT/scripts/get_version.sh") - - for f in *.yul *.sol - do - # The contributors guide uses syntax tests, but we cannot - # really handle them here. - if grep -E 'DeclarationError:|// ----' "$f" >/dev/null - then - continue - fi - echo "$f" - - opts=() - # We expect errors if explicitly stated, or if imports - # are used (in the style guide) - if grep -E "// This will not compile" "$f" >/dev/null || - sed -e 's|//.*||g' "$f" | grep -E "import \"" >/dev/null - then - opts=(--expect-errors) - fi - if grep "// This will report a warning" "$f" >/dev/null - then - opts+=(--expect-warnings) - fi - if grep "// This may report a warning" "$f" >/dev/null - then - opts+=(--ignore-warnings) - fi - - # Disable the version pragma in code snippets that only work with the current development version. - # It's necessary because x.y.z won't match `^x.y.z` or `>=x.y.z` pragmas until it's officially released. - sed -i.bak -E -e 's/pragma[[:space:]]+solidity[[:space:]]*(\^|>=)[[:space:]]*'"$developmentVersion"'/pragma solidity >0.0.1/' "$f" - compileFull "${opts[@]}" "$SOLTMPDIR/$f" - done -) -rm -r "$SOLTMPDIR" -echo "Done." - -printTask "Testing library checksum..." -echo '' | msg_on_error --no-stdout "$SOLC" - --link --libraries a=0x90f20564390eAe531E810af625A22f51385Cd222 -echo '' | "$SOLC" - --link --libraries a=0x80f20564390eAe531E810af625A22f51385Cd222 &>/dev/null && \ - fail "solc --link did not reject a library address with an invalid checksum." - -printTask "Testing long library names..." -echo '' | msg_on_error --no-stdout "$SOLC" - --link --libraries aveeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeerylonglibraryname=0x90f20564390eAe531E810af625A22f51385Cd222 - -printTask "Testing linking itself..." -SOLTMPDIR=$(mktemp -d) -( - cd "$SOLTMPDIR" - echo 'library L { function f() public pure {} } contract C { function f() public pure { L.f(); } }' > x.sol - msg_on_error --no-stderr "$SOLC" --bin -o . x.sol - # Explanation and placeholder should be there - grep -q '//' C.bin && grep -q '__' C.bin - # But not in library file. - grep -q -v '[/_]' L.bin - # Now link - msg_on_error "$SOLC" --link --libraries x.sol:L=0x90f20564390eAe531E810af625A22f51385Cd222 C.bin - # Now the placeholder and explanation should be gone. - grep -q -v '[/_]' C.bin -) -rm -r "$SOLTMPDIR" - -printTask "Testing overwriting files..." -SOLTMPDIR=$(mktemp -d) -( - # First time it works - echo 'contract C {}' | msg_on_error --no-stderr "$SOLC" - --bin -o "$SOLTMPDIR/non-existing-stuff-to-create" - # Second time it fails - echo 'contract C {}' | "$SOLC" - --bin -o "$SOLTMPDIR/non-existing-stuff-to-create" 2>/dev/null && \ - fail "solc did not refuse to overwrite $SOLTMPDIR/non-existing-stuff-to-create." - # Unless we force - echo 'contract C {}' | msg_on_error --no-stderr "$SOLC" - --overwrite --bin -o "$SOLTMPDIR/non-existing-stuff-to-create" -) -rm -r "$SOLTMPDIR" - -printTask "Testing assemble, yul, strict-assembly and optimize..." -( - echo '{}' | msg_on_error --silent "$SOLC" - --assemble - echo '{}' | msg_on_error --silent "$SOLC" - --yul - echo '{}' | msg_on_error --silent "$SOLC" - --strict-assembly - - # Test options above in conjunction with --optimize. - # Using both, --assemble and --optimize should fail. - echo '{}' | "$SOLC" - --assemble --optimize &>/dev/null && fail "solc --assemble --optimize did not fail as expected." - echo '{}' | "$SOLC" - --yul --optimize &>/dev/null && fail "solc --yul --optimize did not fail as expected." - - # Test yul and strict assembly output - # Non-empty code results in non-empty binary representation with optimizations turned off, - # while it results in empty binary representation with optimizations turned on. - test_solc_assembly_output "{ let x:u256 := 0:u256 }" "{ let x := 0 }" "--yul" - test_solc_assembly_output "{ let x:u256 := bitnot(7:u256) }" "{ let x := bitnot(7) }" "--yul" - test_solc_assembly_output "{ let t:bool := not(true) }" "{ let t:bool := not(true) }" "--yul" - test_solc_assembly_output "{ let x := 0 }" "{ let x := 0 }" "--strict-assembly" - test_solc_assembly_output "{ let x := 0 }" "{ { } }" "--strict-assembly --optimize" -) - -printTask "Testing the eqivalence of --via-ir and a two-stage compilation..." -( - externalContracts=( - externalTests/solc-js/DAO/TokenCreation.sol - libsolidity/semanticTests/externalContracts/_prbmath/PRBMathSD59x18.sol - libsolidity/semanticTests/externalContracts/_prbmath/PRBMathUD60x18.sol - libsolidity/semanticTests/externalContracts/_stringutils/stringutils.sol - libsolidity/semanticTests/externalContracts/deposit_contract.sol - libsolidity/semanticTests/externalContracts/FixedFeeRegistrar.sol - libsolidity/semanticTests/externalContracts/snark.sol - ) - - requiresOptimizer=( - externalTests/solc-js/DAO/TokenCreation.sol - libsolidity/semanticTests/externalContracts/deposit_contract.sol - libsolidity/semanticTests/externalContracts/FixedFeeRegistrar.sol - libsolidity/semanticTests/externalContracts/snark.sol - ) - - for contractFile in "${externalContracts[@]}" - do - if ! [[ "${requiresOptimizer[*]}" =~ $contractFile ]] - then - printTask " - ${contractFile}" - test_via_ir_equivalence "${REPO_ROOT}/test/${contractFile}" - fi - - printTask " - ${contractFile} (optimized)" - test_via_ir_equivalence "${REPO_ROOT}/test/${contractFile}" --optimize - done -) - -printTask "Testing standard input..." -SOLTMPDIR=$(mktemp -d) -( - set +e - output=$("$SOLC" --bin 2>&1) - result=$? - set -e - - # This should fail - if [[ ! ("$output" =~ "No input files given") || ($result == 0) ]] - then - fail "Incorrect response to empty input arg list: $output" - fi - - # The contract should be compiled - if ! echo 'contract C {}' | msg_on_error --no-stderr "$SOLC" - --bin | grep -q ":C" - then - fail "Failed to compile a simple contract from standard input" - fi - - # This should not fail - echo '' | msg_on_error --silent --msg "Incorrect response to --ast-compact-json option with empty stdin" \ - "$SOLC" --ast-compact-json - -) -rm -r "$SOLTMPDIR" - -printTask "Testing AST import/export..." -SOLTMPDIR=$(mktemp -d) -( - cd "$SOLTMPDIR" - if ! "$REPO_ROOT/scripts/ASTImportTest.sh" ast - then - rm -r "$SOLTMPDIR" - fail - fi -) -rm -r "$SOLTMPDIR" - -printTask "Testing AST export with stop-after=parsing..." -"$REPO_ROOT/test/stopAfterParseTests.sh" - -printTask "Testing soljson via the fuzzer..." -SOLTMPDIR=$(mktemp -d) -( - set -e - cd "$SOLTMPDIR" - "$REPO_ROOT"/scripts/isolate_tests.py "$REPO_ROOT"/test/ - "$REPO_ROOT"/scripts/isolate_tests.py "$REPO_ROOT"/docs/ - - echo ./*.sol | xargs -P 4 -n 50 "${SOLIDITY_BUILD_DIR}/test/tools/solfuzzer" --quiet --input-files - echo ./*.sol | xargs -P 4 -n 50 "${SOLIDITY_BUILD_DIR}/test/tools/solfuzzer" --without-optimizer --quiet --input-files -) -rm -r "$SOLTMPDIR" - echo "Commandline tests successful." diff --git a/test/cmdlineTests/ast_ir/args b/test/cmdlineTests/ast_ir/args new file mode 100644 index 000000000000..d254bff83d54 --- /dev/null +++ b/test/cmdlineTests/ast_ir/args @@ -0,0 +1 @@ +--ir-ast-json --ir-optimized-ast-json --optimize --pretty-json --json-indent 4 diff --git a/test/cmdlineTests/ast_ir/input.sol b/test/cmdlineTests/ast_ir/input.sol new file mode 100644 index 000000000000..f123f6c8bee3 --- /dev/null +++ b/test/cmdlineTests/ast_ir/input.sol @@ -0,0 +1,4 @@ +// SPDX-License-Identifier: GPL-3.0 +pragma solidity >=0.0; + +contract C {} diff --git a/test/cmdlineTests/ast_ir/output b/test/cmdlineTests/ast_ir/output new file mode 100644 index 000000000000..cca31349e868 --- /dev/null +++ b/test/cmdlineTests/ast_ir/output @@ -0,0 +1,1078 @@ +IR AST: +{ + "code": + { + "block": + { + "nativeSrc": "59:790:0", + "nodeType": "YulBlock", + "src": "-1:-1:0", + "statements": + [ + { + "expression": + { + "arguments": + [ + { + "kind": "number", + "nativeSrc": "118:2:0", + "nodeType": "YulLiteral", + "src": "60:13:0", + "type": "", + "value": "64" + }, + { + "arguments": + [ + { + "kind": "number", + "nativeSrc": "134:3:0", + "nodeType": "YulLiteral", + "src": "60:13:0", + "type": "", + "value": "128" + } + ], + "functionName": + { + "name": "memoryguard", + "nativeSrc": "122:11:0", + "nodeType": "YulIdentifier", + "src": "60:13:0" + }, + "nativeSrc": "122:16:0", + "nodeType": "YulFunctionCall", + "src": "60:13:0" + } + ], + "functionName": + { + "name": "mstore", + "nativeSrc": "111:6:0", + "nodeType": "YulIdentifier", + "src": "60:13:0" + }, + "nativeSrc": "111:28:0", + "nodeType": "YulFunctionCall", + "src": "60:13:0" + }, + "nativeSrc": "111:28:0", + "nodeType": "YulExpressionStatement", + "src": "60:13:0" + }, + { + "body": + { + "nativeSrc": "163:83:0", + "nodeType": "YulBlock", + "src": "60:13:0", + "statements": + [ + { + "expression": + { + "arguments": [], + "functionName": + { + "name": "revert_error_ca66f745a3ce8ff40e2ccaf1ad45db7774001b90d25810abd9040049be7bf4bb", + "nativeSrc": "165:77:0", + "nodeType": "YulIdentifier", + "src": "60:13:0" + }, + "nativeSrc": "165:79:0", + "nodeType": "YulFunctionCall", + "src": "60:13:0" + }, + "nativeSrc": "165:79:0", + "nodeType": "YulExpressionStatement", + "src": "60:13:0" + } + ] + }, + "condition": + { + "arguments": [], + "functionName": + { + "name": "callvalue", + "nativeSrc": "151:9:0", + "nodeType": "YulIdentifier", + "src": "60:13:0" + }, + "nativeSrc": "151:11:0", + "nodeType": "YulFunctionCall", + "src": "60:13:0" + }, + "nativeSrc": "148:98:0", + "nodeType": "YulIf", + "src": "60:13:0" + }, + { + "expression": + { + "arguments": [], + "functionName": + { + "name": "constructor_C_2", + "nativeSrc": "256:15:0", + "nodeType": "YulIdentifier", + "src": "60:13:0" + }, + "nativeSrc": "256:17:0", + "nodeType": "YulFunctionCall", + "src": "60:13:0" + }, + "nativeSrc": "256:17:0", + "nodeType": "YulExpressionStatement", + "src": "60:13:0" + }, + { + "nativeSrc": "283:30:0", + "nodeType": "YulVariableDeclaration", + "src": "60:13:0", + "value": + { + "arguments": [], + "functionName": + { + "name": "allocate_unbounded", + "nativeSrc": "293:18:0", + "nodeType": "YulIdentifier", + "src": "60:13:0" + }, + "nativeSrc": "293:20:0", + "nodeType": "YulFunctionCall", + "src": "60:13:0" + }, + "variables": + [ + { + "name": "_1", + "nativeSrc": "287:2:0", + "nodeType": "YulTypedName", + "src": "60:13:0", + "type": "" + } + ] + }, + { + "expression": + { + "arguments": + [ + { + "name": "_1", + "nativeSrc": "331:2:0", + "nodeType": "YulIdentifier", + "src": "60:13:0" + }, + { + "arguments": + [ + { + "hexValue": "435f325f6465706c6f796564", + "kind": "string", + "nativeSrc": "346:14:0", + "nodeType": "YulLiteral", + "src": "60:13:0", + "type": "", + "value": "C_2_deployed" + } + ], + "functionName": + { + "name": "dataoffset", + "nativeSrc": "335:10:0", + "nodeType": "YulIdentifier", + "src": "60:13:0" + }, + "nativeSrc": "335:26:0", + "nodeType": "YulFunctionCall", + "src": "60:13:0" + }, + { + "arguments": + [ + { + "hexValue": "435f325f6465706c6f796564", + "kind": "string", + "nativeSrc": "372:14:0", + "nodeType": "YulLiteral", + "src": "60:13:0", + "type": "", + "value": "C_2_deployed" + } + ], + "functionName": + { + "name": "datasize", + "nativeSrc": "363:8:0", + "nodeType": "YulIdentifier", + "src": "60:13:0" + }, + "nativeSrc": "363:24:0", + "nodeType": "YulFunctionCall", + "src": "60:13:0" + } + ], + "functionName": + { + "name": "codecopy", + "nativeSrc": "322:8:0", + "nodeType": "YulIdentifier", + "src": "60:13:0" + }, + "nativeSrc": "322:66:0", + "nodeType": "YulFunctionCall", + "src": "60:13:0" + }, + "nativeSrc": "322:66:0", + "nodeType": "YulExpressionStatement", + "src": "60:13:0" + }, + { + "expression": + { + "arguments": + [ + { + "name": "_1", + "nativeSrc": "405:2:0", + "nodeType": "YulIdentifier", + "src": "60:13:0" + }, + { + "arguments": + [ + { + "hexValue": "435f325f6465706c6f796564", + "kind": "string", + "nativeSrc": "418:14:0", + "nodeType": "YulLiteral", + "src": "60:13:0", + "type": "", + "value": "C_2_deployed" + } + ], + "functionName": + { + "name": "datasize", + "nativeSrc": "409:8:0", + "nodeType": "YulIdentifier", + "src": "60:13:0" + }, + "nativeSrc": "409:24:0", + "nodeType": "YulFunctionCall", + "src": "60:13:0" + } + ], + "functionName": + { + "name": "return", + "nativeSrc": "398:6:0", + "nodeType": "YulIdentifier", + "src": "60:13:0" + }, + "nativeSrc": "398:36:0", + "nodeType": "YulFunctionCall", + "src": "60:13:0" + }, + "nativeSrc": "398:36:0", + "nodeType": "YulExpressionStatement", + "src": "60:13:0" + }, + { + "body": + { + "nativeSrc": "484:43:0", + "nodeType": "YulBlock", + "src": "60:13:0", + "statements": + [ + { + "nativeSrc": "498:19:0", + "nodeType": "YulAssignment", + "src": "60:13:0", + "value": + { + "arguments": + [ + { + "kind": "number", + "nativeSrc": "514:2:0", + "nodeType": "YulLiteral", + "src": "60:13:0", + "type": "", + "value": "64" + } + ], + "functionName": + { + "name": "mload", + "nativeSrc": "508:5:0", + "nodeType": "YulIdentifier", + "src": "60:13:0" + }, + "nativeSrc": "508:9:0", + "nodeType": "YulFunctionCall", + "src": "60:13:0" + }, + "variableNames": + [ + { + "name": "memPtr", + "nativeSrc": "498:6:0", + "nodeType": "YulIdentifier", + "src": "60:13:0" + } + ] + } + ] + }, + "name": "allocate_unbounded", + "nativeSrc": "444:83:0", + "nodeType": "YulFunctionDefinition", + "returnVariables": + [ + { + "name": "memPtr", + "nativeSrc": "477:6:0", + "nodeType": "YulTypedName", + "src": "60:13:0", + "type": "" + } + ], + "src": "60:13:0" + }, + { + "body": + { + "nativeSrc": "626:36:0", + "nodeType": "YulBlock", + "src": "60:13:0", + "statements": + [ + { + "expression": + { + "arguments": + [ + { + "kind": "number", + "nativeSrc": "647:1:0", + "nodeType": "YulLiteral", + "src": "60:13:0", + "type": "", + "value": "0" + }, + { + "kind": "number", + "nativeSrc": "650:1:0", + "nodeType": "YulLiteral", + "src": "60:13:0", + "type": "", + "value": "0" + } + ], + "functionName": + { + "name": "revert", + "nativeSrc": "640:6:0", + "nodeType": "YulIdentifier", + "src": "60:13:0" + }, + "nativeSrc": "640:12:0", + "nodeType": "YulFunctionCall", + "src": "60:13:0" + }, + "nativeSrc": "640:12:0", + "nodeType": "YulExpressionStatement", + "src": "60:13:0" + } + ] + }, + "name": "revert_error_ca66f745a3ce8ff40e2ccaf1ad45db7774001b90d25810abd9040049be7bf4bb", + "nativeSrc": "537:125:0", + "nodeType": "YulFunctionDefinition", + "src": "60:13:0" + }, + { + "body": + { + "nativeSrc": "741:59:0", + "nodeType": "YulBlock", + "src": "60:13:0", + "statements": [] + }, + "name": "constructor_C_2", + "nativeSrc": "714:86:0", + "nodeType": "YulFunctionDefinition", + "src": "60:13:0" + } + ] + }, + "nodeType": "YulCode" + }, + "name": "C_2", + "nodeType": "YulObject", + "subObjects": + [ + { + "code": + { + "block": + { + "nativeSrc": "929:588:0", + "nodeType": "YulBlock", + "src": "-1:-1:0", + "statements": + [ + { + "expression": + { + "arguments": + [ + { + "kind": "number", + "nativeSrc": "996:2:0", + "nodeType": "YulLiteral", + "src": "60:13:0", + "type": "", + "value": "64" + }, + { + "arguments": + [ + { + "kind": "number", + "nativeSrc": "1012:3:0", + "nodeType": "YulLiteral", + "src": "60:13:0", + "type": "", + "value": "128" + } + ], + "functionName": + { + "name": "memoryguard", + "nativeSrc": "1000:11:0", + "nodeType": "YulIdentifier", + "src": "60:13:0" + }, + "nativeSrc": "1000:16:0", + "nodeType": "YulFunctionCall", + "src": "60:13:0" + } + ], + "functionName": + { + "name": "mstore", + "nativeSrc": "989:6:0", + "nodeType": "YulIdentifier", + "src": "60:13:0" + }, + "nativeSrc": "989:28:0", + "nodeType": "YulFunctionCall", + "src": "60:13:0" + }, + "nativeSrc": "989:28:0", + "nodeType": "YulExpressionStatement", + "src": "60:13:0" + }, + { + "expression": + { + "arguments": [], + "functionName": + { + "name": "revert_error_42b3090547df1d2001c96683413b8cf91c1b902ef5e3cb8d9f6f304cf7446f74", + "nativeSrc": "1031:77:0", + "nodeType": "YulIdentifier", + "src": "60:13:0" + }, + "nativeSrc": "1031:79:0", + "nodeType": "YulFunctionCall", + "src": "60:13:0" + }, + "nativeSrc": "1031:79:0", + "nodeType": "YulExpressionStatement", + "src": "60:13:0" + }, + { + "body": + { + "nativeSrc": "1177:77:0", + "nodeType": "YulBlock", + "src": "60:13:0", + "statements": + [ + { + "nativeSrc": "1195:44:0", + "nodeType": "YulAssignment", + "src": "60:13:0", + "value": + { + "arguments": + [ + { + "kind": "number", + "nativeSrc": "1228:3:0", + "nodeType": "YulLiteral", + "src": "60:13:0", + "type": "", + "value": "224" + }, + { + "name": "value", + "nativeSrc": "1233:5:0", + "nodeType": "YulIdentifier", + "src": "60:13:0" + } + ], + "functionName": + { + "name": "shr", + "nativeSrc": "1224:3:0", + "nodeType": "YulIdentifier", + "src": "60:13:0" + }, + "nativeSrc": "1224:15:0", + "nodeType": "YulFunctionCall", + "src": "60:13:0" + }, + "variableNames": + [ + { + "name": "newValue", + "nativeSrc": "1195:8:0", + "nodeType": "YulIdentifier", + "src": "60:13:0" + } + ] + } + ] + }, + "name": "shift_right_224_unsigned", + "nativeSrc": "1124:130:0", + "nodeType": "YulFunctionDefinition", + "parameters": + [ + { + "name": "value", + "nativeSrc": "1158:5:0", + "nodeType": "YulTypedName", + "src": "60:13:0", + "type": "" + } + ], + "returnVariables": + [ + { + "name": "newValue", + "nativeSrc": "1168:8:0", + "nodeType": "YulTypedName", + "src": "60:13:0", + "type": "" + } + ], + "src": "60:13:0" + }, + { + "body": + { + "nativeSrc": "1308:51:0", + "nodeType": "YulBlock", + "src": "60:13:0", + "statements": + [ + { + "nativeSrc": "1326:19:0", + "nodeType": "YulAssignment", + "src": "60:13:0", + "value": + { + "arguments": + [ + { + "kind": "number", + "nativeSrc": "1342:2:0", + "nodeType": "YulLiteral", + "src": "60:13:0", + "type": "", + "value": "64" + } + ], + "functionName": + { + "name": "mload", + "nativeSrc": "1336:5:0", + "nodeType": "YulIdentifier", + "src": "60:13:0" + }, + "nativeSrc": "1336:9:0", + "nodeType": "YulFunctionCall", + "src": "60:13:0" + }, + "variableNames": + [ + { + "name": "memPtr", + "nativeSrc": "1326:6:0", + "nodeType": "YulIdentifier", + "src": "60:13:0" + } + ] + } + ] + }, + "name": "allocate_unbounded", + "nativeSrc": "1268:91:0", + "nodeType": "YulFunctionDefinition", + "returnVariables": + [ + { + "name": "memPtr", + "nativeSrc": "1301:6:0", + "nodeType": "YulTypedName", + "src": "60:13:0", + "type": "" + } + ], + "src": "60:13:0" + }, + { + "body": + { + "nativeSrc": "1462:44:0", + "nodeType": "YulBlock", + "src": "60:13:0", + "statements": + [ + { + "expression": + { + "arguments": + [ + { + "kind": "number", + "nativeSrc": "1487:1:0", + "nodeType": "YulLiteral", + "src": "60:13:0", + "type": "", + "value": "0" + }, + { + "kind": "number", + "nativeSrc": "1490:1:0", + "nodeType": "YulLiteral", + "src": "60:13:0", + "type": "", + "value": "0" + } + ], + "functionName": + { + "name": "revert", + "nativeSrc": "1480:6:0", + "nodeType": "YulIdentifier", + "src": "60:13:0" + }, + "nativeSrc": "1480:12:0", + "nodeType": "YulFunctionCall", + "src": "60:13:0" + }, + "nativeSrc": "1480:12:0", + "nodeType": "YulExpressionStatement", + "src": "60:13:0" + } + ] + }, + "name": "revert_error_42b3090547df1d2001c96683413b8cf91c1b902ef5e3cb8d9f6f304cf7446f74", + "nativeSrc": "1373:133:0", + "nodeType": "YulFunctionDefinition", + "src": "60:13:0" + } + ] + }, + "nodeType": "YulCode" + }, + "name": "C_2_deployed", + "nodeType": "YulObject", + "subObjects": + [ + { + "nodeType": "YulData", + "value": "" + } + ] + } + ] +} +Optimized IR AST: +{ + "code": + { + "block": + { + "nativeSrc": "59:790:0", + "nodeType": "YulBlock", + "src": "-1:-1:0", + "statements": + [ + { + "nativeSrc": "59:790:0", + "nodeType": "YulBlock", + "src": "-1:-1:0", + "statements": + [ + { + "nativeSrc": "122:16:0", + "nodeType": "YulVariableDeclaration", + "src": "60:13:0", + "value": + { + "arguments": + [ + { + "kind": "number", + "nativeSrc": "134:3:0", + "nodeType": "YulLiteral", + "src": "60:13:0", + "type": "", + "value": "0x80" + } + ], + "functionName": + { + "name": "memoryguard", + "nativeSrc": "122:11:0", + "nodeType": "YulIdentifier", + "src": "60:13:0" + }, + "nativeSrc": "122:16:0", + "nodeType": "YulFunctionCall", + "src": "60:13:0" + }, + "variables": + [ + { + "name": "_1", + "nativeSrc": "122:16:0", + "nodeType": "YulTypedName", + "src": "60:13:0", + "type": "" + } + ] + }, + { + "expression": + { + "arguments": + [ + { + "kind": "number", + "nativeSrc": "118:2:0", + "nodeType": "YulLiteral", + "src": "60:13:0", + "type": "", + "value": "64" + }, + { + "name": "_1", + "nativeSrc": "122:16:0", + "nodeType": "YulIdentifier", + "src": "60:13:0" + } + ], + "functionName": + { + "name": "mstore", + "nativeSrc": "111:6:0", + "nodeType": "YulIdentifier", + "src": "60:13:0" + }, + "nativeSrc": "111:28:0", + "nodeType": "YulFunctionCall", + "src": "60:13:0" + }, + "nativeSrc": "111:28:0", + "nodeType": "YulExpressionStatement", + "src": "60:13:0" + }, + { + "body": + { + "nativeSrc": "163:83:0", + "nodeType": "YulBlock", + "src": "60:13:0", + "statements": + [ + { + "expression": + { + "arguments": + [ + { + "kind": "number", + "nativeSrc": "650:1:0", + "nodeType": "YulLiteral", + "src": "60:13:0", + "type": "", + "value": "0" + }, + { + "kind": "number", + "nativeSrc": "650:1:0", + "nodeType": "YulLiteral", + "src": "60:13:0", + "type": "", + "value": "0" + } + ], + "functionName": + { + "name": "revert", + "nativeSrc": "640:6:0", + "nodeType": "YulIdentifier", + "src": "60:13:0" + }, + "nativeSrc": "640:12:0", + "nodeType": "YulFunctionCall", + "src": "60:13:0" + }, + "nativeSrc": "640:12:0", + "nodeType": "YulExpressionStatement", + "src": "60:13:0" + } + ] + }, + "condition": + { + "arguments": [], + "functionName": + { + "name": "callvalue", + "nativeSrc": "151:9:0", + "nodeType": "YulIdentifier", + "src": "60:13:0" + }, + "nativeSrc": "151:11:0", + "nodeType": "YulFunctionCall", + "src": "60:13:0" + }, + "nativeSrc": "148:98:0", + "nodeType": "YulIf", + "src": "60:13:0" + }, + { + "nativeSrc": "363:24:0", + "nodeType": "YulVariableDeclaration", + "src": "60:13:0", + "value": + { + "arguments": + [ + { + "hexValue": "435f325f6465706c6f796564", + "kind": "string", + "nativeSrc": "372:14:0", + "nodeType": "YulLiteral", + "src": "60:13:0", + "type": "", + "value": "C_2_deployed" + } + ], + "functionName": + { + "name": "datasize", + "nativeSrc": "363:8:0", + "nodeType": "YulIdentifier", + "src": "60:13:0" + }, + "nativeSrc": "363:24:0", + "nodeType": "YulFunctionCall", + "src": "60:13:0" + }, + "variables": + [ + { + "name": "_2", + "nativeSrc": "363:24:0", + "nodeType": "YulTypedName", + "src": "60:13:0", + "type": "" + } + ] + }, + { + "expression": + { + "arguments": + [ + { + "name": "_1", + "nativeSrc": "331:2:0", + "nodeType": "YulIdentifier", + "src": "60:13:0" + }, + { + "arguments": + [ + { + "hexValue": "435f325f6465706c6f796564", + "kind": "string", + "nativeSrc": "346:14:0", + "nodeType": "YulLiteral", + "src": "60:13:0", + "type": "", + "value": "C_2_deployed" + } + ], + "functionName": + { + "name": "dataoffset", + "nativeSrc": "335:10:0", + "nodeType": "YulIdentifier", + "src": "60:13:0" + }, + "nativeSrc": "335:26:0", + "nodeType": "YulFunctionCall", + "src": "60:13:0" + }, + { + "name": "_2", + "nativeSrc": "363:24:0", + "nodeType": "YulIdentifier", + "src": "60:13:0" + } + ], + "functionName": + { + "name": "codecopy", + "nativeSrc": "322:8:0", + "nodeType": "YulIdentifier", + "src": "60:13:0" + }, + "nativeSrc": "322:66:0", + "nodeType": "YulFunctionCall", + "src": "60:13:0" + }, + "nativeSrc": "322:66:0", + "nodeType": "YulExpressionStatement", + "src": "60:13:0" + }, + { + "expression": + { + "arguments": + [ + { + "name": "_1", + "nativeSrc": "405:2:0", + "nodeType": "YulIdentifier", + "src": "60:13:0" + }, + { + "name": "_2", + "nativeSrc": "409:24:0", + "nodeType": "YulIdentifier", + "src": "60:13:0" + } + ], + "functionName": + { + "name": "return", + "nativeSrc": "398:6:0", + "nodeType": "YulIdentifier", + "src": "60:13:0" + }, + "nativeSrc": "398:36:0", + "nodeType": "YulFunctionCall", + "src": "60:13:0" + }, + "nativeSrc": "398:36:0", + "nodeType": "YulExpressionStatement", + "src": "60:13:0" + } + ] + } + ] + }, + "nodeType": "YulCode" + }, + "name": "C_2", + "nodeType": "YulObject", + "subObjects": + [ + { + "code": + { + "block": + { + "nativeSrc": "929:588:0", + "nodeType": "YulBlock", + "src": "-1:-1:0", + "statements": + [ + { + "nativeSrc": "929:588:0", + "nodeType": "YulBlock", + "src": "-1:-1:0", + "statements": + [ + { + "expression": + { + "arguments": + [ + { + "kind": "number", + "nativeSrc": "1490:1:0", + "nodeType": "YulLiteral", + "src": "60:13:0", + "type": "", + "value": "0" + }, + { + "kind": "number", + "nativeSrc": "1490:1:0", + "nodeType": "YulLiteral", + "src": "60:13:0", + "type": "", + "value": "0" + } + ], + "functionName": + { + "name": "revert", + "nativeSrc": "1480:6:0", + "nodeType": "YulIdentifier", + "src": "60:13:0" + }, + "nativeSrc": "1480:12:0", + "nodeType": "YulFunctionCall", + "src": "60:13:0" + }, + "nativeSrc": "1480:12:0", + "nodeType": "YulExpressionStatement", + "src": "60:13:0" + } + ] + } + ] + }, + "nodeType": "YulCode" + }, + "name": "C_2_deployed", + "nodeType": "YulObject", + "subObjects": + [ + { + "nodeType": "YulData", + "value": "" + } + ] + } + ] +} diff --git a/test/cmdlineTests/combined_json_generated_sources/output b/test/cmdlineTests/combined_json_generated_sources/output index 0bd9395fea83..5ef9078d6e80 100644 --- a/test/cmdlineTests/combined_json_generated_sources/output +++ b/test/cmdlineTests/combined_json_generated_sources/output @@ -9,6 +9,7 @@ { "ast": { + "nativeSrc": "0:1856:1", "nodeType": "YulBlock", "src": "0:1856:1", "statements": @@ -16,11 +17,13 @@ { "body": { + "nativeSrc": "47:35:1", "nodeType": "YulBlock", "src": "47:35:1", "statements": [ { + "nativeSrc": "57:19:1", "nodeType": "YulAssignment", "src": "57:19:1", "value": @@ -29,6 +32,7 @@ [ { "kind": "number", + "nativeSrc": "73:2:1", "nodeType": "YulLiteral", "src": "73:2:1", "type": "", @@ -38,9 +42,11 @@ "functionName": { "name": "mload", + "nativeSrc": "67:5:1", "nodeType": "YulIdentifier", "src": "67:5:1" }, + "nativeSrc": "67:9:1", "nodeType": "YulFunctionCall", "src": "67:9:1" }, @@ -48,6 +54,7 @@ [ { "name": "memPtr", + "nativeSrc": "57:6:1", "nodeType": "YulIdentifier", "src": "57:6:1" } @@ -56,11 +63,13 @@ ] }, "name": "allocate_unbounded", + "nativeSrc": "7:75:1", "nodeType": "YulFunctionDefinition", "returnVariables": [ { "name": "memPtr", + "nativeSrc": "40:6:1", "nodeType": "YulTypedName", "src": "40:6:1", "type": "" @@ -71,6 +80,7 @@ { "body": { + "nativeSrc": "177:28:1", "nodeType": "YulBlock", "src": "177:28:1", "statements": @@ -82,6 +92,7 @@ [ { "kind": "number", + "nativeSrc": "194:1:1", "nodeType": "YulLiteral", "src": "194:1:1", "type": "", @@ -89,6 +100,7 @@ }, { "kind": "number", + "nativeSrc": "197:1:1", "nodeType": "YulLiteral", "src": "197:1:1", "type": "", @@ -98,24 +110,29 @@ "functionName": { "name": "revert", + "nativeSrc": "187:6:1", "nodeType": "YulIdentifier", "src": "187:6:1" }, + "nativeSrc": "187:12:1", "nodeType": "YulFunctionCall", "src": "187:12:1" }, + "nativeSrc": "187:12:1", "nodeType": "YulExpressionStatement", "src": "187:12:1" } ] }, "name": "revert_error_dbdddcbe895c83990c08b3492a0e83918d802a52331272ac6fdb6a7c4aea3b1b", + "nativeSrc": "88:117:1", "nodeType": "YulFunctionDefinition", "src": "88:117:1" }, { "body": { + "nativeSrc": "300:28:1", "nodeType": "YulBlock", "src": "300:28:1", "statements": @@ -127,6 +144,7 @@ [ { "kind": "number", + "nativeSrc": "317:1:1", "nodeType": "YulLiteral", "src": "317:1:1", "type": "", @@ -134,6 +152,7 @@ }, { "kind": "number", + "nativeSrc": "320:1:1", "nodeType": "YulLiteral", "src": "320:1:1", "type": "", @@ -143,24 +162,29 @@ "functionName": { "name": "revert", + "nativeSrc": "310:6:1", "nodeType": "YulIdentifier", "src": "310:6:1" }, + "nativeSrc": "310:12:1", "nodeType": "YulFunctionCall", "src": "310:12:1" }, + "nativeSrc": "310:12:1", "nodeType": "YulExpressionStatement", "src": "310:12:1" } ] }, "name": "revert_error_c1322bf8034eace5e0b5c7295db60986aa89aae5e0ea0873e4689e076861a5db", + "nativeSrc": "211:117:1", "nodeType": "YulFunctionDefinition", "src": "211:117:1" }, { "body": { + "nativeSrc": "423:28:1", "nodeType": "YulBlock", "src": "423:28:1", "statements": @@ -172,6 +196,7 @@ [ { "kind": "number", + "nativeSrc": "440:1:1", "nodeType": "YulLiteral", "src": "440:1:1", "type": "", @@ -179,6 +204,7 @@ }, { "kind": "number", + "nativeSrc": "443:1:1", "nodeType": "YulLiteral", "src": "443:1:1", "type": "", @@ -188,24 +214,29 @@ "functionName": { "name": "revert", + "nativeSrc": "433:6:1", "nodeType": "YulIdentifier", "src": "433:6:1" }, + "nativeSrc": "433:12:1", "nodeType": "YulFunctionCall", "src": "433:12:1" }, + "nativeSrc": "433:12:1", "nodeType": "YulExpressionStatement", "src": "433:12:1" } ] }, "name": "revert_error_1b9f4a0a5773e33b91aa01db23bf8c55fce1411167c872835e7fa00a4f17d46d", + "nativeSrc": "334:117:1", "nodeType": "YulFunctionDefinition", "src": "334:117:1" }, { "body": { + "nativeSrc": "546:28:1", "nodeType": "YulBlock", "src": "546:28:1", "statements": @@ -217,6 +248,7 @@ [ { "kind": "number", + "nativeSrc": "563:1:1", "nodeType": "YulLiteral", "src": "563:1:1", "type": "", @@ -224,6 +256,7 @@ }, { "kind": "number", + "nativeSrc": "566:1:1", "nodeType": "YulLiteral", "src": "566:1:1", "type": "", @@ -233,24 +266,29 @@ "functionName": { "name": "revert", + "nativeSrc": "556:6:1", "nodeType": "YulIdentifier", "src": "556:6:1" }, + "nativeSrc": "556:12:1", "nodeType": "YulFunctionCall", "src": "556:12:1" }, + "nativeSrc": "556:12:1", "nodeType": "YulExpressionStatement", "src": "556:12:1" } ] }, "name": "revert_error_15abf5612cd996bc235ba1e55a4a30ac60e6bb601ff7ba4ad3f179b6be8d0490", + "nativeSrc": "457:117:1", "nodeType": "YulFunctionDefinition", "src": "457:117:1" }, { "body": { + "nativeSrc": "669:28:1", "nodeType": "YulBlock", "src": "669:28:1", "statements": @@ -262,6 +300,7 @@ [ { "kind": "number", + "nativeSrc": "686:1:1", "nodeType": "YulLiteral", "src": "686:1:1", "type": "", @@ -269,6 +308,7 @@ }, { "kind": "number", + "nativeSrc": "689:1:1", "nodeType": "YulLiteral", "src": "689:1:1", "type": "", @@ -278,24 +318,29 @@ "functionName": { "name": "revert", + "nativeSrc": "679:6:1", "nodeType": "YulIdentifier", "src": "679:6:1" }, + "nativeSrc": "679:12:1", "nodeType": "YulFunctionCall", "src": "679:12:1" }, + "nativeSrc": "679:12:1", "nodeType": "YulExpressionStatement", "src": "679:12:1" } ] }, "name": "revert_error_81385d8c0b31fffe14be1da910c8bd3a80be4cfa248e04f42ec0faea3132a8ef", + "nativeSrc": "580:117:1", "nodeType": "YulFunctionDefinition", "src": "580:117:1" }, { "body": { + "nativeSrc": "810:478:1", "nodeType": "YulBlock", "src": "810:478:1", "statements": @@ -303,6 +348,7 @@ { "body": { + "nativeSrc": "859:83:1", "nodeType": "YulBlock", "src": "859:83:1", "statements": @@ -314,12 +360,15 @@ "functionName": { "name": "revert_error_1b9f4a0a5773e33b91aa01db23bf8c55fce1411167c872835e7fa00a4f17d46d", + "nativeSrc": "861:77:1", "nodeType": "YulIdentifier", "src": "861:77:1" }, + "nativeSrc": "861:79:1", "nodeType": "YulFunctionCall", "src": "861:79:1" }, + "nativeSrc": "861:79:1", "nodeType": "YulExpressionStatement", "src": "861:79:1" } @@ -337,11 +386,13 @@ [ { "name": "offset", + "nativeSrc": "838:6:1", "nodeType": "YulIdentifier", "src": "838:6:1" }, { "kind": "number", + "nativeSrc": "846:4:1", "nodeType": "YulLiteral", "src": "846:4:1", "type": "", @@ -351,14 +402,17 @@ "functionName": { "name": "add", + "nativeSrc": "834:3:1", "nodeType": "YulIdentifier", "src": "834:3:1" }, + "nativeSrc": "834:17:1", "nodeType": "YulFunctionCall", "src": "834:17:1" }, { "name": "end", + "nativeSrc": "853:3:1", "nodeType": "YulIdentifier", "src": "853:3:1" } @@ -366,9 +420,11 @@ "functionName": { "name": "slt", + "nativeSrc": "830:3:1", "nodeType": "YulIdentifier", "src": "830:3:1" }, + "nativeSrc": "830:27:1", "nodeType": "YulFunctionCall", "src": "830:27:1" } @@ -376,16 +432,20 @@ "functionName": { "name": "iszero", + "nativeSrc": "823:6:1", "nodeType": "YulIdentifier", "src": "823:6:1" }, + "nativeSrc": "823:35:1", "nodeType": "YulFunctionCall", "src": "823:35:1" }, + "nativeSrc": "820:122:1", "nodeType": "YulIf", "src": "820:122:1" }, { + "nativeSrc": "951:30:1", "nodeType": "YulAssignment", "src": "951:30:1", "value": @@ -394,6 +454,7 @@ [ { "name": "offset", + "nativeSrc": "974:6:1", "nodeType": "YulIdentifier", "src": "974:6:1" } @@ -401,9 +462,11 @@ "functionName": { "name": "calldataload", + "nativeSrc": "961:12:1", "nodeType": "YulIdentifier", "src": "961:12:1" }, + "nativeSrc": "961:20:1", "nodeType": "YulFunctionCall", "src": "961:20:1" }, @@ -411,6 +474,7 @@ [ { "name": "length", + "nativeSrc": "951:6:1", "nodeType": "YulIdentifier", "src": "951:6:1" } @@ -419,6 +483,7 @@ { "body": { + "nativeSrc": "1024:83:1", "nodeType": "YulBlock", "src": "1024:83:1", "statements": @@ -430,12 +495,15 @@ "functionName": { "name": "revert_error_15abf5612cd996bc235ba1e55a4a30ac60e6bb601ff7ba4ad3f179b6be8d0490", + "nativeSrc": "1026:77:1", "nodeType": "YulIdentifier", "src": "1026:77:1" }, + "nativeSrc": "1026:79:1", "nodeType": "YulFunctionCall", "src": "1026:79:1" }, + "nativeSrc": "1026:79:1", "nodeType": "YulExpressionStatement", "src": "1026:79:1" } @@ -447,11 +515,13 @@ [ { "name": "length", + "nativeSrc": "996:6:1", "nodeType": "YulIdentifier", "src": "996:6:1" }, { "kind": "number", + "nativeSrc": "1004:18:1", "nodeType": "YulLiteral", "src": "1004:18:1", "type": "", @@ -461,16 +531,20 @@ "functionName": { "name": "gt", + "nativeSrc": "993:2:1", "nodeType": "YulIdentifier", "src": "993:2:1" }, + "nativeSrc": "993:30:1", "nodeType": "YulFunctionCall", "src": "993:30:1" }, + "nativeSrc": "990:117:1", "nodeType": "YulIf", "src": "990:117:1" }, { + "nativeSrc": "1116:29:1", "nodeType": "YulAssignment", "src": "1116:29:1", "value": @@ -479,11 +553,13 @@ [ { "name": "offset", + "nativeSrc": "1132:6:1", "nodeType": "YulIdentifier", "src": "1132:6:1" }, { "kind": "number", + "nativeSrc": "1140:4:1", "nodeType": "YulLiteral", "src": "1140:4:1", "type": "", @@ -493,9 +569,11 @@ "functionName": { "name": "add", + "nativeSrc": "1128:3:1", "nodeType": "YulIdentifier", "src": "1128:3:1" }, + "nativeSrc": "1128:17:1", "nodeType": "YulFunctionCall", "src": "1128:17:1" }, @@ -503,6 +581,7 @@ [ { "name": "arrayPos", + "nativeSrc": "1116:8:1", "nodeType": "YulIdentifier", "src": "1116:8:1" } @@ -511,6 +590,7 @@ { "body": { + "nativeSrc": "1199:83:1", "nodeType": "YulBlock", "src": "1199:83:1", "statements": @@ -522,12 +602,15 @@ "functionName": { "name": "revert_error_81385d8c0b31fffe14be1da910c8bd3a80be4cfa248e04f42ec0faea3132a8ef", + "nativeSrc": "1201:77:1", "nodeType": "YulIdentifier", "src": "1201:77:1" }, + "nativeSrc": "1201:79:1", "nodeType": "YulFunctionCall", "src": "1201:79:1" }, + "nativeSrc": "1201:79:1", "nodeType": "YulExpressionStatement", "src": "1201:79:1" } @@ -542,6 +625,7 @@ [ { "name": "arrayPos", + "nativeSrc": "1164:8:1", "nodeType": "YulIdentifier", "src": "1164:8:1" }, @@ -550,11 +634,13 @@ [ { "name": "length", + "nativeSrc": "1178:6:1", "nodeType": "YulIdentifier", "src": "1178:6:1" }, { "kind": "number", + "nativeSrc": "1186:4:1", "nodeType": "YulLiteral", "src": "1186:4:1", "type": "", @@ -564,9 +650,11 @@ "functionName": { "name": "mul", + "nativeSrc": "1174:3:1", "nodeType": "YulIdentifier", "src": "1174:3:1" }, + "nativeSrc": "1174:17:1", "nodeType": "YulFunctionCall", "src": "1174:17:1" } @@ -574,14 +662,17 @@ "functionName": { "name": "add", + "nativeSrc": "1160:3:1", "nodeType": "YulIdentifier", "src": "1160:3:1" }, + "nativeSrc": "1160:32:1", "nodeType": "YulFunctionCall", "src": "1160:32:1" }, { "name": "end", + "nativeSrc": "1194:3:1", "nodeType": "YulIdentifier", "src": "1194:3:1" } @@ -589,29 +680,35 @@ "functionName": { "name": "gt", + "nativeSrc": "1157:2:1", "nodeType": "YulIdentifier", "src": "1157:2:1" }, + "nativeSrc": "1157:41:1", "nodeType": "YulFunctionCall", "src": "1157:41:1" }, + "nativeSrc": "1154:128:1", "nodeType": "YulIf", "src": "1154:128:1" } ] }, "name": "abi_decode_t_array$_t_uint256_$dyn_calldata_ptr", + "nativeSrc": "720:568:1", "nodeType": "YulFunctionDefinition", "parameters": [ { "name": "offset", + "nativeSrc": "777:6:1", "nodeType": "YulTypedName", "src": "777:6:1", "type": "" }, { "name": "end", + "nativeSrc": "785:3:1", "nodeType": "YulTypedName", "src": "785:3:1", "type": "" @@ -621,12 +718,14 @@ [ { "name": "arrayPos", + "nativeSrc": "793:8:1", "nodeType": "YulTypedName", "src": "793:8:1", "type": "" }, { "name": "length", + "nativeSrc": "803:6:1", "nodeType": "YulTypedName", "src": "803:6:1", "type": "" @@ -637,6 +736,7 @@ { "body": { + "nativeSrc": "1395:458:1", "nodeType": "YulBlock", "src": "1395:458:1", "statements": @@ -644,6 +744,7 @@ { "body": { + "nativeSrc": "1441:83:1", "nodeType": "YulBlock", "src": "1441:83:1", "statements": @@ -655,12 +756,15 @@ "functionName": { "name": "revert_error_dbdddcbe895c83990c08b3492a0e83918d802a52331272ac6fdb6a7c4aea3b1b", + "nativeSrc": "1443:77:1", "nodeType": "YulIdentifier", "src": "1443:77:1" }, + "nativeSrc": "1443:79:1", "nodeType": "YulFunctionCall", "src": "1443:79:1" }, + "nativeSrc": "1443:79:1", "nodeType": "YulExpressionStatement", "src": "1443:79:1" } @@ -675,11 +779,13 @@ [ { "name": "dataEnd", + "nativeSrc": "1416:7:1", "nodeType": "YulIdentifier", "src": "1416:7:1" }, { "name": "headStart", + "nativeSrc": "1425:9:1", "nodeType": "YulIdentifier", "src": "1425:9:1" } @@ -687,14 +793,17 @@ "functionName": { "name": "sub", + "nativeSrc": "1412:3:1", "nodeType": "YulIdentifier", "src": "1412:3:1" }, + "nativeSrc": "1412:23:1", "nodeType": "YulFunctionCall", "src": "1412:23:1" }, { "kind": "number", + "nativeSrc": "1437:2:1", "nodeType": "YulLiteral", "src": "1437:2:1", "type": "", @@ -704,21 +813,26 @@ "functionName": { "name": "slt", + "nativeSrc": "1408:3:1", "nodeType": "YulIdentifier", "src": "1408:3:1" }, + "nativeSrc": "1408:32:1", "nodeType": "YulFunctionCall", "src": "1408:32:1" }, + "nativeSrc": "1405:119:1", "nodeType": "YulIf", "src": "1405:119:1" }, { + "nativeSrc": "1534:312:1", "nodeType": "YulBlock", "src": "1534:312:1", "statements": [ { + "nativeSrc": "1549:45:1", "nodeType": "YulVariableDeclaration", "src": "1549:45:1", "value": @@ -730,11 +844,13 @@ [ { "name": "headStart", + "nativeSrc": "1580:9:1", "nodeType": "YulIdentifier", "src": "1580:9:1" }, { "kind": "number", + "nativeSrc": "1591:1:1", "nodeType": "YulLiteral", "src": "1591:1:1", "type": "", @@ -744,9 +860,11 @@ "functionName": { "name": "add", + "nativeSrc": "1576:3:1", "nodeType": "YulIdentifier", "src": "1576:3:1" }, + "nativeSrc": "1576:17:1", "nodeType": "YulFunctionCall", "src": "1576:17:1" } @@ -754,9 +872,11 @@ "functionName": { "name": "calldataload", + "nativeSrc": "1563:12:1", "nodeType": "YulIdentifier", "src": "1563:12:1" }, + "nativeSrc": "1563:31:1", "nodeType": "YulFunctionCall", "src": "1563:31:1" }, @@ -764,6 +884,7 @@ [ { "name": "offset", + "nativeSrc": "1553:6:1", "nodeType": "YulTypedName", "src": "1553:6:1", "type": "" @@ -773,6 +894,7 @@ { "body": { + "nativeSrc": "1641:83:1", "nodeType": "YulBlock", "src": "1641:83:1", "statements": @@ -784,12 +906,15 @@ "functionName": { "name": "revert_error_c1322bf8034eace5e0b5c7295db60986aa89aae5e0ea0873e4689e076861a5db", + "nativeSrc": "1643:77:1", "nodeType": "YulIdentifier", "src": "1643:77:1" }, + "nativeSrc": "1643:79:1", "nodeType": "YulFunctionCall", "src": "1643:79:1" }, + "nativeSrc": "1643:79:1", "nodeType": "YulExpressionStatement", "src": "1643:79:1" } @@ -801,11 +926,13 @@ [ { "name": "offset", + "nativeSrc": "1613:6:1", "nodeType": "YulIdentifier", "src": "1613:6:1" }, { "kind": "number", + "nativeSrc": "1621:18:1", "nodeType": "YulLiteral", "src": "1621:18:1", "type": "", @@ -815,16 +942,20 @@ "functionName": { "name": "gt", + "nativeSrc": "1610:2:1", "nodeType": "YulIdentifier", "src": "1610:2:1" }, + "nativeSrc": "1610:30:1", "nodeType": "YulFunctionCall", "src": "1610:30:1" }, + "nativeSrc": "1607:117:1", "nodeType": "YulIf", "src": "1607:117:1" }, { + "nativeSrc": "1738:98:1", "nodeType": "YulAssignment", "src": "1738:98:1", "value": @@ -836,11 +967,13 @@ [ { "name": "headStart", + "nativeSrc": "1808:9:1", "nodeType": "YulIdentifier", "src": "1808:9:1" }, { "name": "offset", + "nativeSrc": "1819:6:1", "nodeType": "YulIdentifier", "src": "1819:6:1" } @@ -848,14 +981,17 @@ "functionName": { "name": "add", + "nativeSrc": "1804:3:1", "nodeType": "YulIdentifier", "src": "1804:3:1" }, + "nativeSrc": "1804:22:1", "nodeType": "YulFunctionCall", "src": "1804:22:1" }, { "name": "dataEnd", + "nativeSrc": "1828:7:1", "nodeType": "YulIdentifier", "src": "1828:7:1" } @@ -863,9 +999,11 @@ "functionName": { "name": "abi_decode_t_array$_t_uint256_$dyn_calldata_ptr", + "nativeSrc": "1756:47:1", "nodeType": "YulIdentifier", "src": "1756:47:1" }, + "nativeSrc": "1756:80:1", "nodeType": "YulFunctionCall", "src": "1756:80:1" }, @@ -873,11 +1011,13 @@ [ { "name": "value0", + "nativeSrc": "1738:6:1", "nodeType": "YulIdentifier", "src": "1738:6:1" }, { "name": "value1", + "nativeSrc": "1746:6:1", "nodeType": "YulIdentifier", "src": "1746:6:1" } @@ -888,17 +1028,20 @@ ] }, "name": "abi_decode_tuple_t_array$_t_uint256_$dyn_calldata_ptr", + "nativeSrc": "1294:559:1", "nodeType": "YulFunctionDefinition", "parameters": [ { "name": "headStart", + "nativeSrc": "1357:9:1", "nodeType": "YulTypedName", "src": "1357:9:1", "type": "" }, { "name": "dataEnd", + "nativeSrc": "1368:7:1", "nodeType": "YulTypedName", "src": "1368:7:1", "type": "" @@ -908,12 +1051,14 @@ [ { "name": "value0", + "nativeSrc": "1380:6:1", "nodeType": "YulTypedName", "src": "1380:6:1", "type": "" }, { "name": "value1", + "nativeSrc": "1388:6:1", "nodeType": "YulTypedName", "src": "1388:6:1", "type": "" diff --git a/test/cmdlineTests/evm_to_wasm/args b/test/cmdlineTests/evm_to_wasm/args deleted file mode 100644 index 099ebdc3a380..000000000000 --- a/test/cmdlineTests/evm_to_wasm/args +++ /dev/null @@ -1 +0,0 @@ ---assemble --optimize --yul-dialect evm --machine ewasm diff --git a/test/cmdlineTests/evm_to_wasm/input.yul b/test/cmdlineTests/evm_to_wasm/input.yul deleted file mode 100644 index f21cd2b7e038..000000000000 --- a/test/cmdlineTests/evm_to_wasm/input.yul +++ /dev/null @@ -1,3 +0,0 @@ -{ - sstore(0, 1) -} diff --git a/test/cmdlineTests/evm_to_wasm/output b/test/cmdlineTests/evm_to_wasm/output deleted file mode 100644 index fa454f80f7e9..000000000000 --- a/test/cmdlineTests/evm_to_wasm/output +++ /dev/null @@ -1,96 +0,0 @@ - -======= evm_to_wasm/input.yul (Ewasm) ======= - -Pretty printed source: -object "object" { - code { { sstore(0, 1) } } -} - - -========================== - -Translated source: -object "object" { - code { - function main() - { - let hi := i64.shl(i64.extend_i32_u(bswap32(i32.wrap_i64(0))), 32) - let y := i64.or(hi, i64.extend_i32_u(bswap32(i32.wrap_i64(i64.shr_u(0, 32))))) - i64.store(0:i32, y) - i64.store(i32.add(0:i32, 8:i32), y) - i64.store(i32.add(0:i32, 16:i32), y) - i64.store(i32.add(0:i32, 24:i32), y) - i64.store(32:i32, y) - i64.store(i32.add(32:i32, 8:i32), y) - i64.store(i32.add(32:i32, 16:i32), y) - let hi_1 := i64.shl(i64.extend_i32_u(bswap32(i32.wrap_i64(1))), 32) - i64.store(i32.add(32:i32, 24:i32), i64.or(hi_1, i64.extend_i32_u(bswap32(i32.wrap_i64(i64.shr_u(1, 32)))))) - eth.storageStore(0:i32, 32:i32) - } - function bswap16(x:i32) -> y:i32 - { - y := i32.or(i32.and(i32.shl(x, 8:i32), 0xff00:i32), i32.and(i32.shr_u(x, 8:i32), 0xff:i32)) - } - function bswap32(x:i32) -> y:i32 - { - let hi:i32 := i32.shl(bswap16(x), 16:i32) - y := i32.or(hi, bswap16(i32.shr_u(x, 16:i32))) - } - } -} - - -Binary representation: -0061736d01000000010e0360000060017f017f60027f7f0002190108657468657265756d0c73746f7261676553746f726500020304030001010503010001060100071102066d656d6f72790200046d61696e00010ac70103850101037e02404200a71003ad422086210020004200422088a71003ad84210141002001370000410041086a2001370000410041106a2001370000410041186a200137000041202001370000412041086a2001370000412041106a20013700004201a71003ad4220862102412041186a20024201422088a71003ad843700004100412010000b0b1f01017f024020004108744180fe0371200041087641ff01717221010b20010b1e01027f02402000100241107421022002200041107610027221010b20010b - -Text representation: -(module - (import "ethereum" "storageStore" (func $eth.storageStore (param i32 i32))) - (memory $memory (export "memory") 1) - (export "main" (func $main)) - -(func $main - (local $hi i64) - (local $y i64) - (local $hi_1 i64) - (block $label_ - (local.set $hi (i64.shl (i64.extend_i32_u (call $bswap32 (i32.wrap_i64 (i64.const 0)))) (i64.const 32))) - (local.set $y (i64.or (local.get $hi) (i64.extend_i32_u (call $bswap32 (i32.wrap_i64 (i64.shr_u (i64.const 0) (i64.const 32))))))) - (i64.store (i32.const 0) (local.get $y)) - (i64.store (i32.add (i32.const 0) (i32.const 8)) (local.get $y)) - (i64.store (i32.add (i32.const 0) (i32.const 16)) (local.get $y)) - (i64.store (i32.add (i32.const 0) (i32.const 24)) (local.get $y)) - (i64.store (i32.const 32) (local.get $y)) - (i64.store (i32.add (i32.const 32) (i32.const 8)) (local.get $y)) - (i64.store (i32.add (i32.const 32) (i32.const 16)) (local.get $y)) - (local.set $hi_1 (i64.shl (i64.extend_i32_u (call $bswap32 (i32.wrap_i64 (i64.const 1)))) (i64.const 32))) - (i64.store (i32.add (i32.const 32) (i32.const 24)) (i64.or (local.get $hi_1) (i64.extend_i32_u (call $bswap32 (i32.wrap_i64 (i64.shr_u (i64.const 1) (i64.const 32))))))) - (call $eth.storageStore (i32.const 0) (i32.const 32)) - ) -) - -(func $bswap16 - (param $x i32) - (result i32) - (local $y i32) - (block $label__1 - (local.set $y (i32.or (i32.and (i32.shl (local.get $x) (i32.const 8)) (i32.const 65280)) (i32.and (i32.shr_u (local.get $x) (i32.const 8)) (i32.const 255)))) - - ) - (local.get $y) -) - -(func $bswap32 - (param $x i32) - (result i32) - (local $y i32) - (local $hi i32) - (block $label__2 - (local.set $hi (i32.shl (call $bswap16 (local.get $x)) (i32.const 16))) - (local.set $y (i32.or (local.get $hi) (call $bswap16 (i32.shr_u (local.get $x) (i32.const 16))))) - - ) - (local.get $y) -) - -) diff --git a/test/cmdlineTests/evm_to_wasm_break/args b/test/cmdlineTests/evm_to_wasm_break/args deleted file mode 100644 index 099ebdc3a380..000000000000 --- a/test/cmdlineTests/evm_to_wasm_break/args +++ /dev/null @@ -1 +0,0 @@ ---assemble --optimize --yul-dialect evm --machine ewasm diff --git a/test/cmdlineTests/evm_to_wasm_break/input.yul b/test/cmdlineTests/evm_to_wasm_break/input.yul deleted file mode 100644 index a625eea088e1..000000000000 --- a/test/cmdlineTests/evm_to_wasm_break/input.yul +++ /dev/null @@ -1,8 +0,0 @@ -{ - let x := calldataload(0) - for { } lt(x, 10) { x := add(x, 1) } { - if eq(x, 2) { break } - if eq(x, 4) { continue } - } - sstore(0, x) -} diff --git a/test/cmdlineTests/evm_to_wasm_break/output b/test/cmdlineTests/evm_to_wasm_break/output deleted file mode 100644 index 01a4cbb411aa..000000000000 --- a/test/cmdlineTests/evm_to_wasm_break/output +++ /dev/null @@ -1,583 +0,0 @@ - -======= evm_to_wasm_break/input.yul (Ewasm) ======= - -Pretty printed source: -object "object" { - code { - { - let x := calldataload(0) - for { } lt(x, 10) { x := add(x, 1) } - { - if eq(x, 2) { break } - if eq(x, 4) { continue } - } - sstore(0, x) - } - } -} - - -========================== - -Translated source: -object "object" { - code { - function main() - { - let x, x_1, x_2, x_3 := calldataload() - let x_4 := x - let x_5 := x_1 - let x_6 := x_2 - let x_7 := x_3 - let _1:i32 := i32.eqz(i32.eqz(i64.eqz(i64.or(i64.or(0, 0), i64.or(0, 1))))) - for { } - i32.eqz(_1) - { - let x_8, x_9, x_10, x_11 := add(x_4, x_5, x_6, x_7) - x_4 := x_8 - x_5 := x_9 - x_6 := x_10 - x_7 := x_11 - } - { - let _2, _3, _4, _5 := iszero_1324_2108(lt(x_4, x_5, x_6, x_7)) - if i32.eqz(i64.eqz(i64.or(i64.or(_2, _3), i64.or(_4, _5)))) { break } - let _6, _7, _8, _9 := eq_771_2109(x_4, x_5, x_6, x_7) - if i32.eqz(i64.eqz(i64.or(i64.or(_6, _7), i64.or(_8, _9)))) { break } - let _10, _11, _12, _13 := eq_772_2110(x_4, x_5, x_6, x_7) - if i32.eqz(i64.eqz(i64.or(i64.or(_10, _11), i64.or(_12, _13)))) { continue } - } - sstore(x_4, x_5, x_6, x_7) - } - function add(x1, x2, x3, x4) -> r1, r2, r3, r4 - { - let t := i64.add(x4, 1) - r4 := i64.add(t, 0) - let t_1 := i64.add(x3, 0) - r3 := i64.add(t_1, i64.extend_i32_u(i32.or(i64.lt_u(t, x4), i64.lt_u(r4, t)))) - let t_2 := i64.add(x2, 0) - r2 := i64.add(t_2, i64.extend_i32_u(i32.or(i64.lt_u(t_1, x3), i64.lt_u(r3, t_1)))) - r1 := i64.add(i64.add(x1, 0), i64.extend_i32_u(i32.or(i64.lt_u(t_2, x2), i64.lt_u(r2, t_2)))) - } - function iszero_1324_2108(x4) -> r1, r2, r3, r4 - { - r4 := i64.extend_i32_u(i64.eqz(i64.or(i64.or(0, 0), i64.or(0, x4)))) - } - function eq_771_2109(x1, x2, x3, x4) -> r1, r2, r3, r4 - { - r4 := i64.extend_i32_u(i32.and(i64.eq(x1, 0), i32.and(i64.eq(x2, 0), i32.and(i64.eq(x3, 0), i64.eq(x4, 2))))) - } - function eq_772_2110(x1, x2, x3, x4) -> r1, r2, r3, r4 - { - r4 := i64.extend_i32_u(i32.and(i64.eq(x1, 0), i32.and(i64.eq(x2, 0), i32.and(i64.eq(x3, 0), i64.eq(x4, 4))))) - } - function lt(x1, x2, x3, x4) -> z4 - { - let z:i32 := false - let _1 := 0 - let _2:i32 := 0xffffffff:i32 - switch i32.select(_2, i64.ne(x1, _1), i64.lt_u(x1, _1)) - case 0:i32 { - switch i32.select(_2, i64.ne(x2, _1), i64.lt_u(x2, _1)) - case 0:i32 { - switch i32.select(_2, i64.ne(x3, _1), i64.lt_u(x3, _1)) - case 0:i32 { z := i64.lt_u(x4, 10) } - case 1:i32 { z := 0:i32 } - default { z := 1:i32 } - } - case 1:i32 { z := 0:i32 } - default { z := 1:i32 } - } - case 1:i32 { z := 0:i32 } - default { z := 1:i32 } - z4 := i64.extend_i32_u(z) - } - function u256_to_i32_774() -> v:i32 - { - let _1 := 0 - if i64.ne(_1, i64.or(i64.or(_1, _1), _1)) { unreachable() } - if i64.ne(_1, i64.shr_u(_1, 32)) { unreachable() } - v := i32.wrap_i64(_1) - } - function u256_to_i32() -> v:i32 - { - if i64.ne(0, i64.or(i64.or(0, 0), 0)) { unreachable() } - if i64.ne(0, i64.shr_u(32, 32)) { unreachable() } - v := i32.wrap_i64(32) - } - function bswap16(x:i32) -> y:i32 - { - y := i32.or(i32.and(i32.shl(x, 8:i32), 0xff00:i32), i32.and(i32.shr_u(x, 8:i32), 0xff:i32)) - } - function bswap32(x:i32) -> y:i32 - { - let hi:i32 := i32.shl(bswap16(x), 16:i32) - y := i32.or(hi, bswap16(i32.shr_u(x, 16:i32))) - } - function bswap64(x) -> y - { - let hi := i64.shl(i64.extend_i32_u(bswap32(i32.wrap_i64(x))), 32) - y := i64.or(hi, i64.extend_i32_u(bswap32(i32.wrap_i64(i64.shr_u(x, 32))))) - } - function calldataload() -> z1, z2, z3, z4 - { - let cds:i32 := eth.getCallDataSize() - let destination:i32 := u256_to_i32_774() - let offset:i32 := u256_to_i32_774() - let requested_size:i32 := u256_to_i32() - if i32.gt_u(offset, i32.sub(0xffffffff:i32, requested_size)) { eth.revert(0:i32, 0:i32) } - let available_size:i32 := i32.sub(cds, offset) - if i32.gt_u(offset, cds) { available_size := 0:i32 } - let _1:i32 := 0:i32 - if i32.gt_u(available_size, _1) - { - eth.callDataCopy(destination, offset, available_size) - } - if i32.gt_u(requested_size, available_size) - { - let _2:i32 := i32.sub(requested_size, available_size) - let _3:i32 := i32.add(destination, available_size) - let i:i32 := _1 - for { } i32.lt_u(i, _2) { i := i32.add(i, 1:i32) } - { - i32.store8(i32.add(_3, i), _1) - } - } - let z1_1 := bswap64(i64.load(_1)) - let z2_1 := bswap64(i64.load(i32.add(_1, 8:i32))) - let z3_1 := bswap64(i64.load(i32.add(_1, 16:i32))) - let z4_1 := bswap64(i64.load(i32.add(_1, 24:i32))) - z1 := z1_1 - z2 := z2_1 - z3 := z3_1 - z4 := z4_1 - } - function sstore(y1, y2, y3, y4) - { - let hi := i64.shl(i64.extend_i32_u(bswap32(i32.wrap_i64(0))), 32) - let y := i64.or(hi, i64.extend_i32_u(bswap32(i32.wrap_i64(i64.shr_u(0, 32))))) - i64.store(0:i32, y) - i64.store(i32.add(0:i32, 8:i32), y) - i64.store(i32.add(0:i32, 16:i32), y) - i64.store(i32.add(0:i32, 24:i32), y) - i64.store(32:i32, bswap64(y1)) - i64.store(i32.add(32:i32, 8:i32), bswap64(y2)) - i64.store(i32.add(32:i32, 16:i32), bswap64(y3)) - i64.store(i32.add(32:i32, 24:i32), bswap64(y4)) - eth.storageStore(0:i32, 32:i32) - } - } -} - - -Binary representation: -0061736d010000000130096000006000017e6000017f60017e017e60047e7e7e7e0060047e7e7e7e017e60017f017f60027f7f0060037f7f7f00025e0408657468657265756d0c73746f7261676553746f7265000708657468657265756d06726576657274000708657468657265756d0f67657443616c6c4461746153697a65000208657468657265756d0c63616c6c44617461436f70790008030e0d0005030505050202060603010405030100010615047e0142000b7e0142000b7e0142000b7f0141000b071102066d656d6f72790200046d61696e00040abd090d8d0203087e017f107e02400240100f21002300210123012102230221030b200021042001210520022106200321074200420084420042018484504545210802400340200845450d010240024020042005200620071009100621092303210a2300210b2301210c0b2009200a84200b200c8484504504400c030b024020042005200620071007210d2300210e2301210f230221100b200d200e84200f20108484504504400c030b02402004200520062007100821112300211223012113230221140b2011201284201320148484504504400c010b0b02402004200520062007100521152300211623012117230221180b201521042016210520172106201821070c000b0b200420052006200710100b0b6701077e0240200342017c2108200842007c2107200242007c210920092008200354200720085472ad7c2106200142007c210a200a2009200254200620095472ad7c2105200042007c200a2001542005200a5472ad7c21040b20052400200624012007240220040b2401047e0240420042008442002000848450ad21040b20022400200324012004240220010b2f01047e02402000420051200142005120024200512003420251717171ad21070b20052400200624012007240220040b2f01047e02402000420051200142005120024200512003420451717171ad21070b20052400200624012007240220040bab0104017e017f017e047f02404100210542002106417f210702402007200020065220002006541b21082008410046044002402007200120065220012006541b21092009410046044002402007200220065220022006541b210a200a41004604402003420a54210505200a41014604404100210505410121050b0b0b05200941014604404100210505410121050b0b0b05200841014604404100210505410121050b0b0b2005ad21040b20040b2f02017f017e02404200210120012001200184200184520440000b20012001422088520440000b2001a721000b20000b2901017f024042004200420084420084520440000b42004220422088520440000b4220a721000b20000b1f01017f024020004108744180fe0371200041087641ff01717221010b20010b1e01027f02402000100c411074210220022000411076100c7221010b20010b2201027e02402000a7100dad422086210220022000422088a7100dad8421010b20010bdc0103047e097f047e024010022104100a2105100a2106100b21072006417f20076b4b04404100410010010b200420066b2108200620044b0440410021080b41002109200820094b044020052006200810030b200720084b0440200720086b210a200520086a210b2009210c02400340200c200a49450d010240200b200c6a20093a00000b200c41016a210c0c000b0b0b2009290000100e210d200941086a290000100e210e200941106a290000100e210f200941186a290000100e2110200d2100200e2101200f2102201021030b20012400200224012003240220000b7801027e02404200a7100dad422086210420044200422088a7100dad84210541002005370000410041086a2005370000410041106a2005370000410041186a200537000041202000100e370000412041086a2001100e370000412041106a2002100e370000412041186a2003100e3700004100412010000b0b - -Text representation: -(module - (import "ethereum" "storageStore" (func $eth.storageStore (param i32 i32))) - (import "ethereum" "revert" (func $eth.revert (param i32 i32))) - (import "ethereum" "getCallDataSize" (func $eth.getCallDataSize (result i32))) - (import "ethereum" "callDataCopy" (func $eth.callDataCopy (param i32 i32 i32))) - (memory $memory (export "memory") 1) - (export "main" (func $main)) - (global $global_ (mut i64) (i64.const 0)) - (global $global__1 (mut i64) (i64.const 0)) - (global $global__2 (mut i64) (i64.const 0)) - (global $global__6 (mut i32) (i32.const 0)) - -(func $main - (local $x i64) - (local $x_1 i64) - (local $x_2 i64) - (local $x_3 i64) - (local $x_4 i64) - (local $x_5 i64) - (local $x_6 i64) - (local $x_7 i64) - (local $_1 i32) - (local $_2 i64) - (local $_3 i64) - (local $_4 i64) - (local $_5 i64) - (local $_6 i64) - (local $_7 i64) - (local $_8 i64) - (local $_9 i64) - (local $_10 i64) - (local $_11 i64) - (local $_12 i64) - (local $_13 i64) - (local $x_8 i64) - (local $x_9 i64) - (local $x_10 i64) - (local $x_11 i64) - (block $label_ - (block - (local.set $x (call $calldataload)) - (local.set $x_1 (global.get $global_)) - (local.set $x_2 (global.get $global__1)) - (local.set $x_3 (global.get $global__2)) - - ) - (local.set $x_4 (local.get $x)) - (local.set $x_5 (local.get $x_1)) - (local.set $x_6 (local.get $x_2)) - (local.set $x_7 (local.get $x_3)) - (local.set $_1 (i32.eqz (i32.eqz (i64.eqz (i64.or (i64.or (i64.const 0) (i64.const 0)) (i64.or (i64.const 0) (i64.const 1))))))) - (block $label__3 - (loop $label__5 - (br_if $label__3 (i32.eqz (i32.eqz (local.get $_1)))) - (block $label__4 - (block - (local.set $_2 (call $iszero_1324_2108 (call $lt (local.get $x_4) (local.get $x_5) (local.get $x_6) (local.get $x_7)))) - (local.set $_3 (global.get $global__6)) - (local.set $_4 (global.get $global_)) - (local.set $_5 (global.get $global__1)) - - ) - (if (i32.eqz (i64.eqz (i64.or (i64.or (local.get $_2) (local.get $_3)) (i64.or (local.get $_4) (local.get $_5))))) (then - (br $label__3) - )) - (block - (local.set $_6 (call $eq_771_2109 (local.get $x_4) (local.get $x_5) (local.get $x_6) (local.get $x_7))) - (local.set $_7 (global.get $global_)) - (local.set $_8 (global.get $global__1)) - (local.set $_9 (global.get $global__2)) - - ) - (if (i32.eqz (i64.eqz (i64.or (i64.or (local.get $_6) (local.get $_7)) (i64.or (local.get $_8) (local.get $_9))))) (then - (br $label__3) - )) - (block - (local.set $_10 (call $eq_772_2110 (local.get $x_4) (local.get $x_5) (local.get $x_6) (local.get $x_7))) - (local.set $_11 (global.get $global_)) - (local.set $_12 (global.get $global__1)) - (local.set $_13 (global.get $global__2)) - - ) - (if (i32.eqz (i64.eqz (i64.or (i64.or (local.get $_10) (local.get $_11)) (i64.or (local.get $_12) (local.get $_13))))) (then - (br $label__4) - )) - - ) - (block - (local.set $x_8 (call $add (local.get $x_4) (local.get $x_5) (local.get $x_6) (local.get $x_7))) - (local.set $x_9 (global.get $global_)) - (local.set $x_10 (global.get $global__1)) - (local.set $x_11 (global.get $global__2)) - - ) - (local.set $x_4 (local.get $x_8)) - (local.set $x_5 (local.get $x_9)) - (local.set $x_6 (local.get $x_10)) - (local.set $x_7 (local.get $x_11)) - (br $label__5) - ) - - ) - (call $sstore (local.get $x_4) (local.get $x_5) (local.get $x_6) (local.get $x_7)) - ) -) - -(func $add - (param $x1 i64) - (param $x2 i64) - (param $x3 i64) - (param $x4 i64) - (result i64) - (local $r1 i64) - (local $r2 i64) - (local $r3 i64) - (local $r4 i64) - (local $t i64) - (local $t_1 i64) - (local $t_2 i64) - (block $label__7 - (local.set $t (i64.add (local.get $x4) (i64.const 1))) - (local.set $r4 (i64.add (local.get $t) (i64.const 0))) - (local.set $t_1 (i64.add (local.get $x3) (i64.const 0))) - (local.set $r3 (i64.add (local.get $t_1) (i64.extend_i32_u (i32.or (i64.lt_u (local.get $t) (local.get $x4)) (i64.lt_u (local.get $r4) (local.get $t)))))) - (local.set $t_2 (i64.add (local.get $x2) (i64.const 0))) - (local.set $r2 (i64.add (local.get $t_2) (i64.extend_i32_u (i32.or (i64.lt_u (local.get $t_1) (local.get $x3)) (i64.lt_u (local.get $r3) (local.get $t_1)))))) - (local.set $r1 (i64.add (i64.add (local.get $x1) (i64.const 0)) (i64.extend_i32_u (i32.or (i64.lt_u (local.get $t_2) (local.get $x2)) (i64.lt_u (local.get $r2) (local.get $t_2)))))) - - ) - (global.set $global_ (local.get $r2)) - (global.set $global__1 (local.get $r3)) - (global.set $global__2 (local.get $r4)) - (local.get $r1) -) - -(func $iszero_1324_2108 - (param $x4 i64) - (result i64) - (local $r1 i64) - (local $r2 i64) - (local $r3 i64) - (local $r4 i64) - (block $label__8 - (local.set $r4 (i64.extend_i32_u (i64.eqz (i64.or (i64.or (i64.const 0) (i64.const 0)) (i64.or (i64.const 0) (local.get $x4)))))) - - ) - (global.set $global_ (local.get $r2)) - (global.set $global__1 (local.get $r3)) - (global.set $global__2 (local.get $r4)) - (local.get $r1) -) - -(func $eq_771_2109 - (param $x1 i64) - (param $x2 i64) - (param $x3 i64) - (param $x4 i64) - (result i64) - (local $r1 i64) - (local $r2 i64) - (local $r3 i64) - (local $r4 i64) - (block $label__9 - (local.set $r4 (i64.extend_i32_u (i32.and (i64.eq (local.get $x1) (i64.const 0)) (i32.and (i64.eq (local.get $x2) (i64.const 0)) (i32.and (i64.eq (local.get $x3) (i64.const 0)) (i64.eq (local.get $x4) (i64.const 2))))))) - - ) - (global.set $global_ (local.get $r2)) - (global.set $global__1 (local.get $r3)) - (global.set $global__2 (local.get $r4)) - (local.get $r1) -) - -(func $eq_772_2110 - (param $x1 i64) - (param $x2 i64) - (param $x3 i64) - (param $x4 i64) - (result i64) - (local $r1 i64) - (local $r2 i64) - (local $r3 i64) - (local $r4 i64) - (block $label__10 - (local.set $r4 (i64.extend_i32_u (i32.and (i64.eq (local.get $x1) (i64.const 0)) (i32.and (i64.eq (local.get $x2) (i64.const 0)) (i32.and (i64.eq (local.get $x3) (i64.const 0)) (i64.eq (local.get $x4) (i64.const 4))))))) - - ) - (global.set $global_ (local.get $r2)) - (global.set $global__1 (local.get $r3)) - (global.set $global__2 (local.get $r4)) - (local.get $r1) -) - -(func $lt - (param $x1 i64) - (param $x2 i64) - (param $x3 i64) - (param $x4 i64) - (result i64) - (local $z4 i64) - (local $z i32) - (local $_1 i64) - (local $_2 i32) - (local $condition i32) - (local $condition_12 i32) - (local $condition_13 i32) - (block $label__11 - (local.set $z (i32.const 0)) - (local.set $_1 (i64.const 0)) - (local.set $_2 (i32.const 4294967295)) - (block - (local.set $condition (select (local.get $_2) (i64.ne (local.get $x1) (local.get $_1)) (i64.lt_u (local.get $x1) (local.get $_1)))) - (if (i32.eq (local.get $condition) (i32.const 0)) (then - (block - (local.set $condition_12 (select (local.get $_2) (i64.ne (local.get $x2) (local.get $_1)) (i64.lt_u (local.get $x2) (local.get $_1)))) - (if (i32.eq (local.get $condition_12) (i32.const 0)) (then - (block - (local.set $condition_13 (select (local.get $_2) (i64.ne (local.get $x3) (local.get $_1)) (i64.lt_u (local.get $x3) (local.get $_1)))) - (if (i32.eq (local.get $condition_13) (i32.const 0)) (then - (local.set $z (i64.lt_u (local.get $x4) (i64.const 10))) - )(else - (if (i32.eq (local.get $condition_13) (i32.const 1)) (then - (local.set $z (i32.const 0)) - )(else - (local.set $z (i32.const 1)) - )) - )) - - ) - )(else - (if (i32.eq (local.get $condition_12) (i32.const 1)) (then - (local.set $z (i32.const 0)) - )(else - (local.set $z (i32.const 1)) - )) - )) - - ) - )(else - (if (i32.eq (local.get $condition) (i32.const 1)) (then - (local.set $z (i32.const 0)) - )(else - (local.set $z (i32.const 1)) - )) - )) - - ) - (local.set $z4 (i64.extend_i32_u (local.get $z))) - - ) - (local.get $z4) -) - -(func $u256_to_i32_774 - (result i32) - (local $v i32) - (local $_1 i64) - (block $label__14 - (local.set $_1 (i64.const 0)) - (if (i64.ne (local.get $_1) (i64.or (i64.or (local.get $_1) (local.get $_1)) (local.get $_1))) (then - (unreachable))) - (if (i64.ne (local.get $_1) (i64.shr_u (local.get $_1) (i64.const 32))) (then - (unreachable))) - (local.set $v (i32.wrap_i64 (local.get $_1))) - - ) - (local.get $v) -) - -(func $u256_to_i32 - (result i32) - (local $v i32) - (block $label__15 - (if (i64.ne (i64.const 0) (i64.or (i64.or (i64.const 0) (i64.const 0)) (i64.const 0))) (then - (unreachable))) - (if (i64.ne (i64.const 0) (i64.shr_u (i64.const 32) (i64.const 32))) (then - (unreachable))) - (local.set $v (i32.wrap_i64 (i64.const 32))) - - ) - (local.get $v) -) - -(func $bswap16 - (param $x i32) - (result i32) - (local $y i32) - (block $label__16 - (local.set $y (i32.or (i32.and (i32.shl (local.get $x) (i32.const 8)) (i32.const 65280)) (i32.and (i32.shr_u (local.get $x) (i32.const 8)) (i32.const 255)))) - - ) - (local.get $y) -) - -(func $bswap32 - (param $x i32) - (result i32) - (local $y i32) - (local $hi i32) - (block $label__17 - (local.set $hi (i32.shl (call $bswap16 (local.get $x)) (i32.const 16))) - (local.set $y (i32.or (local.get $hi) (call $bswap16 (i32.shr_u (local.get $x) (i32.const 16))))) - - ) - (local.get $y) -) - -(func $bswap64 - (param $x i64) - (result i64) - (local $y i64) - (local $hi i64) - (block $label__18 - (local.set $hi (i64.shl (i64.extend_i32_u (call $bswap32 (i32.wrap_i64 (local.get $x)))) (i64.const 32))) - (local.set $y (i64.or (local.get $hi) (i64.extend_i32_u (call $bswap32 (i32.wrap_i64 (i64.shr_u (local.get $x) (i64.const 32))))))) - - ) - (local.get $y) -) - -(func $calldataload - (result i64) - (local $z1 i64) - (local $z2 i64) - (local $z3 i64) - (local $z4 i64) - (local $cds i32) - (local $destination i32) - (local $offset i32) - (local $requested_size i32) - (local $available_size i32) - (local $_1 i32) - (local $_2 i32) - (local $_3 i32) - (local $i i32) - (local $z1_1 i64) - (local $z2_1 i64) - (local $z3_1 i64) - (local $z4_1 i64) - (block $label__19 - (local.set $cds (call $eth.getCallDataSize)) - (local.set $destination (call $u256_to_i32_774)) - (local.set $offset (call $u256_to_i32_774)) - (local.set $requested_size (call $u256_to_i32)) - (if (i32.gt_u (local.get $offset) (i32.sub (i32.const 4294967295) (local.get $requested_size))) (then - (call $eth.revert (i32.const 0) (i32.const 0)))) - (local.set $available_size (i32.sub (local.get $cds) (local.get $offset))) - (if (i32.gt_u (local.get $offset) (local.get $cds)) (then - (local.set $available_size (i32.const 0)) - )) - (local.set $_1 (i32.const 0)) - (if (i32.gt_u (local.get $available_size) (local.get $_1)) (then - (call $eth.callDataCopy (local.get $destination) (local.get $offset) (local.get $available_size)))) - (if (i32.gt_u (local.get $requested_size) (local.get $available_size)) (then - (local.set $_2 (i32.sub (local.get $requested_size) (local.get $available_size))) - (local.set $_3 (i32.add (local.get $destination) (local.get $available_size))) - (local.set $i (local.get $_1)) - (block $label__20 - (loop $label__22 - (br_if $label__20 (i32.eqz (i32.lt_u (local.get $i) (local.get $_2)))) - (block $label__21 - (i32.store8 (i32.add (local.get $_3) (local.get $i)) (local.get $_1)) - ) - (local.set $i (i32.add (local.get $i) (i32.const 1))) - (br $label__22) - ) - - ) - )) - (local.set $z1_1 (call $bswap64 (i64.load (local.get $_1)))) - (local.set $z2_1 (call $bswap64 (i64.load (i32.add (local.get $_1) (i32.const 8))))) - (local.set $z3_1 (call $bswap64 (i64.load (i32.add (local.get $_1) (i32.const 16))))) - (local.set $z4_1 (call $bswap64 (i64.load (i32.add (local.get $_1) (i32.const 24))))) - (local.set $z1 (local.get $z1_1)) - (local.set $z2 (local.get $z2_1)) - (local.set $z3 (local.get $z3_1)) - (local.set $z4 (local.get $z4_1)) - - ) - (global.set $global_ (local.get $z2)) - (global.set $global__1 (local.get $z3)) - (global.set $global__2 (local.get $z4)) - (local.get $z1) -) - -(func $sstore - (param $y1 i64) - (param $y2 i64) - (param $y3 i64) - (param $y4 i64) - (local $hi i64) - (local $y i64) - (block $label__23 - (local.set $hi (i64.shl (i64.extend_i32_u (call $bswap32 (i32.wrap_i64 (i64.const 0)))) (i64.const 32))) - (local.set $y (i64.or (local.get $hi) (i64.extend_i32_u (call $bswap32 (i32.wrap_i64 (i64.shr_u (i64.const 0) (i64.const 32))))))) - (i64.store (i32.const 0) (local.get $y)) - (i64.store (i32.add (i32.const 0) (i32.const 8)) (local.get $y)) - (i64.store (i32.add (i32.const 0) (i32.const 16)) (local.get $y)) - (i64.store (i32.add (i32.const 0) (i32.const 24)) (local.get $y)) - (i64.store (i32.const 32) (call $bswap64 (local.get $y1))) - (i64.store (i32.add (i32.const 32) (i32.const 8)) (call $bswap64 (local.get $y2))) - (i64.store (i32.add (i32.const 32) (i32.const 16)) (call $bswap64 (local.get $y3))) - (i64.store (i32.add (i32.const 32) (i32.const 24)) (call $bswap64 (local.get $y4))) - (call $eth.storageStore (i32.const 0) (i32.const 32)) - ) -) - -) diff --git a/test/cmdlineTests/evm_to_wasm_output_selection_asm_only/args b/test/cmdlineTests/evm_to_wasm_output_selection_asm_only/args deleted file mode 100644 index f39038498198..000000000000 --- a/test/cmdlineTests/evm_to_wasm_output_selection_asm_only/args +++ /dev/null @@ -1 +0,0 @@ ---assemble --optimize --yul-dialect evm --machine ewasm --asm diff --git a/test/cmdlineTests/evm_to_wasm_output_selection_asm_only/input.yul b/test/cmdlineTests/evm_to_wasm_output_selection_asm_only/input.yul deleted file mode 100644 index 4fa5ef66f8da..000000000000 --- a/test/cmdlineTests/evm_to_wasm_output_selection_asm_only/input.yul +++ /dev/null @@ -1,4 +0,0 @@ -{ - let x := 42 - sstore(0, x) -} diff --git a/test/cmdlineTests/evm_to_wasm_output_selection_asm_only/output b/test/cmdlineTests/evm_to_wasm_output_selection_asm_only/output deleted file mode 100644 index d0cb60f39bee..000000000000 --- a/test/cmdlineTests/evm_to_wasm_output_selection_asm_only/output +++ /dev/null @@ -1,2 +0,0 @@ - -======= evm_to_wasm_output_selection_asm_only/input.yul (Ewasm) ======= diff --git a/test/cmdlineTests/evm_to_wasm_output_selection_ewasm_ir_only/args b/test/cmdlineTests/evm_to_wasm_output_selection_ewasm_ir_only/args deleted file mode 100644 index 7c6526b562d3..000000000000 --- a/test/cmdlineTests/evm_to_wasm_output_selection_ewasm_ir_only/args +++ /dev/null @@ -1 +0,0 @@ ---assemble --optimize --yul-dialect evm --machine ewasm --ewasm-ir diff --git a/test/cmdlineTests/evm_to_wasm_output_selection_ewasm_ir_only/input.yul b/test/cmdlineTests/evm_to_wasm_output_selection_ewasm_ir_only/input.yul deleted file mode 100644 index 4fa5ef66f8da..000000000000 --- a/test/cmdlineTests/evm_to_wasm_output_selection_ewasm_ir_only/input.yul +++ /dev/null @@ -1,4 +0,0 @@ -{ - let x := 42 - sstore(0, x) -} diff --git a/test/cmdlineTests/evm_to_wasm_output_selection_ewasm_ir_only/output b/test/cmdlineTests/evm_to_wasm_output_selection_ewasm_ir_only/output deleted file mode 100644 index 3124db17da95..000000000000 --- a/test/cmdlineTests/evm_to_wasm_output_selection_ewasm_ir_only/output +++ /dev/null @@ -1,34 +0,0 @@ - -======= evm_to_wasm_output_selection_ewasm_ir_only/input.yul (Ewasm) ======= - -========================== - -Translated source: -object "object" { - code { - function main() - { - let hi := i64.shl(i64.extend_i32_u(bswap32(i32.wrap_i64(0))), 32) - let y := i64.or(hi, i64.extend_i32_u(bswap32(i32.wrap_i64(i64.shr_u(0, 32))))) - i64.store(0:i32, y) - i64.store(i32.add(0:i32, 8:i32), y) - i64.store(i32.add(0:i32, 16:i32), y) - i64.store(i32.add(0:i32, 24:i32), y) - i64.store(32:i32, y) - i64.store(i32.add(32:i32, 8:i32), y) - i64.store(i32.add(32:i32, 16:i32), y) - let hi_1 := i64.shl(i64.extend_i32_u(bswap32(i32.wrap_i64(42))), 32) - i64.store(i32.add(32:i32, 24:i32), i64.or(hi_1, i64.extend_i32_u(bswap32(i32.wrap_i64(i64.shr_u(42, 32)))))) - eth.storageStore(0:i32, 32:i32) - } - function bswap16(x:i32) -> y:i32 - { - y := i32.or(i32.and(i32.shl(x, 8:i32), 0xff00:i32), i32.and(i32.shr_u(x, 8:i32), 0xff:i32)) - } - function bswap32(x:i32) -> y:i32 - { - let hi:i32 := i32.shl(bswap16(x), 16:i32) - y := i32.or(hi, bswap16(i32.shr_u(x, 16:i32))) - } - } -} diff --git a/test/cmdlineTests/evm_to_wasm_output_selection_ewasm_only/args b/test/cmdlineTests/evm_to_wasm_output_selection_ewasm_only/args deleted file mode 100644 index 48a844213a96..000000000000 --- a/test/cmdlineTests/evm_to_wasm_output_selection_ewasm_only/args +++ /dev/null @@ -1 +0,0 @@ ---assemble --optimize --yul-dialect evm --machine ewasm --ewasm diff --git a/test/cmdlineTests/evm_to_wasm_output_selection_ewasm_only/input.yul b/test/cmdlineTests/evm_to_wasm_output_selection_ewasm_only/input.yul deleted file mode 100644 index 4fa5ef66f8da..000000000000 --- a/test/cmdlineTests/evm_to_wasm_output_selection_ewasm_only/input.yul +++ /dev/null @@ -1,4 +0,0 @@ -{ - let x := 42 - sstore(0, x) -} diff --git a/test/cmdlineTests/evm_to_wasm_output_selection_ewasm_only/output b/test/cmdlineTests/evm_to_wasm_output_selection_ewasm_only/output deleted file mode 100644 index e8b306260504..000000000000 --- a/test/cmdlineTests/evm_to_wasm_output_selection_ewasm_only/output +++ /dev/null @@ -1,54 +0,0 @@ - -======= evm_to_wasm_output_selection_ewasm_only/input.yul (Ewasm) ======= - -Text representation: -(module - (import "ethereum" "storageStore" (func $eth.storageStore (param i32 i32))) - (memory $memory (export "memory") 1) - (export "main" (func $main)) - -(func $main - (local $hi i64) - (local $y i64) - (local $hi_1 i64) - (block $label_ - (local.set $hi (i64.shl (i64.extend_i32_u (call $bswap32 (i32.wrap_i64 (i64.const 0)))) (i64.const 32))) - (local.set $y (i64.or (local.get $hi) (i64.extend_i32_u (call $bswap32 (i32.wrap_i64 (i64.shr_u (i64.const 0) (i64.const 32))))))) - (i64.store (i32.const 0) (local.get $y)) - (i64.store (i32.add (i32.const 0) (i32.const 8)) (local.get $y)) - (i64.store (i32.add (i32.const 0) (i32.const 16)) (local.get $y)) - (i64.store (i32.add (i32.const 0) (i32.const 24)) (local.get $y)) - (i64.store (i32.const 32) (local.get $y)) - (i64.store (i32.add (i32.const 32) (i32.const 8)) (local.get $y)) - (i64.store (i32.add (i32.const 32) (i32.const 16)) (local.get $y)) - (local.set $hi_1 (i64.shl (i64.extend_i32_u (call $bswap32 (i32.wrap_i64 (i64.const 42)))) (i64.const 32))) - (i64.store (i32.add (i32.const 32) (i32.const 24)) (i64.or (local.get $hi_1) (i64.extend_i32_u (call $bswap32 (i32.wrap_i64 (i64.shr_u (i64.const 42) (i64.const 32))))))) - (call $eth.storageStore (i32.const 0) (i32.const 32)) - ) -) - -(func $bswap16 - (param $x i32) - (result i32) - (local $y i32) - (block $label__1 - (local.set $y (i32.or (i32.and (i32.shl (local.get $x) (i32.const 8)) (i32.const 65280)) (i32.and (i32.shr_u (local.get $x) (i32.const 8)) (i32.const 255)))) - - ) - (local.get $y) -) - -(func $bswap32 - (param $x i32) - (result i32) - (local $y i32) - (local $hi i32) - (block $label__2 - (local.set $hi (i32.shl (call $bswap16 (local.get $x)) (i32.const 16))) - (local.set $y (i32.or (local.get $hi) (call $bswap16 (i32.shr_u (local.get $x) (i32.const 16))))) - - ) - (local.get $y) -) - -) diff --git a/test/cmdlineTests/evm_to_wasm_unsupported_translation/args b/test/cmdlineTests/evm_to_wasm_unsupported_translation/args deleted file mode 100644 index cc6c07083182..000000000000 --- a/test/cmdlineTests/evm_to_wasm_unsupported_translation/args +++ /dev/null @@ -1 +0,0 @@ ---assemble --machine ewasm diff --git a/test/cmdlineTests/evm_to_wasm_unsupported_translation/err b/test/cmdlineTests/evm_to_wasm_unsupported_translation/err deleted file mode 100644 index 5ef050f64424..000000000000 --- a/test/cmdlineTests/evm_to_wasm_unsupported_translation/err +++ /dev/null @@ -1 +0,0 @@ -The selected input language is not directly supported when targeting the Ewasm machine and automatic translation is not available. diff --git a/test/cmdlineTests/evm_to_wasm_unsupported_translation/input.yul b/test/cmdlineTests/evm_to_wasm_unsupported_translation/input.yul deleted file mode 100644 index f21cd2b7e038..000000000000 --- a/test/cmdlineTests/evm_to_wasm_unsupported_translation/input.yul +++ /dev/null @@ -1,3 +0,0 @@ -{ - sstore(0, 1) -} diff --git a/test/cmdlineTests/evm_to_wasm_unsupported_translation/output b/test/cmdlineTests/evm_to_wasm_unsupported_translation/output deleted file mode 100644 index 8b137891791f..000000000000 --- a/test/cmdlineTests/evm_to_wasm_unsupported_translation/output +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/cmdlineTests/inline_assembly_function_name_clash/output b/test/cmdlineTests/inline_assembly_function_name_clash/output index 889514d96a32..8becb87ae06f 100644 --- a/test/cmdlineTests/inline_assembly_function_name_clash/output +++ b/test/cmdlineTests/inline_assembly_function_name_clash/output @@ -5,171 +5,201 @@ { "function-debug-runtime": { - "abi_decode_tuple_": + "abi_decode": { - "entryPoint": 117, + "entryPoint": 80, "parameterSlots": 2, "returnSlots": 0 }, - "abi_encode_t_uint256_to_t_uint256_fromStack": + "abi_encode_uint256": { - "entryPoint": 149, + "entryPoint": 111, "parameterSlots": 2, - "returnSlots": 0 + "returnSlots": 1 }, - "abi_encode_tuple_t_uint256__to_t_uint256__fromStack": + "abi_encode_uint256_to_uint256": { - "entryPoint": 164, + "entryPoint": 98, "parameterSlots": 2, - "returnSlots": 1 + "returnSlots": 0 }, "allocate_unbounded": { - "entryPoint": 100, + "entryPoint": 66, "parameterSlots": 0, "returnSlots": 1 }, - "cleanup_t_uint256": + "cleanup_uint256": { - "entryPoint": 140, + "entryPoint": 95, "parameterSlots": 1, "returnSlots": 1 }, - "convert_t_uint256_to_t_uint256": + "convert_uint256_to_uint256": { - "entryPoint": 398, + "entryPoint": 276, "parameterSlots": 1, "returnSlots": 1 }, - "external_fun_f_25": + "external_fun_f": { - "entryPoint": 189, + "entryPoint": 132, "parameterSlots": 0, "returnSlots": 0 }, - "external_fun_g_36": + "external_fun_g": { - "entryPoint": 247, + "entryPoint": 185, "parameterSlots": 0, "returnSlots": 0 }, - "fun_f_25": + "fun_f": { - "entryPoint": 653, + "entryPoint": 442, "id": 25, "parameterSlots": 0, "returnSlots": 1 }, - "fun_f_25_inner": + "fun_f_inner": { - "entryPoint": 621, + "entryPoint": 430, "parameterSlots": 1, "returnSlots": 1 }, - "fun_g_36": + "fun_g": { - "entryPoint": 858, + "entryPoint": 564, "id": 36, "parameterSlots": 0, "returnSlots": 1 }, - "fun_g_36_inner": + "fun_g_inner": { - "entryPoint": 826, + "entryPoint": 552, "parameterSlots": 1, "returnSlots": 1 }, "identity": { - "entryPoint": 389, + "entryPoint": 273, "parameterSlots": 1, "returnSlots": 1 }, - "modifier_m_17": + "modifier_m": { - "entryPoint": 475, + "entryPoint": 509, "id": 14, "parameterSlots": 1, "returnSlots": 1 }, - "modifier_m_19": + "modifier_m_17": { - "entryPoint": 548, + "entryPoint": 344, "id": 14, "parameterSlots": 1, "returnSlots": 1 }, - "modifier_m_28": + "modifier_m_19": { - "entryPoint": 680, + "entryPoint": 387, "id": 14, "parameterSlots": 1, "returnSlots": 1 }, - "modifier_m_30": + "modifier_m_28": { - "entryPoint": 753, + "entryPoint": 466, "id": 14, "parameterSlots": 1, "returnSlots": 1 }, - "prepare_store_t_uint256": + "prepare_store_uint256": { - "entryPoint": 431, + "entryPoint": 304, "parameterSlots": 1, "returnSlots": 1 }, "revert_error_42b3090547df1d2001c96683413b8cf91c1b902ef5e3cb8d9f6f304cf7446f74": { - "entryPoint": 305, + "entryPoint": 238, "parameterSlots": 0, "returnSlots": 0 }, "revert_error_ca66f745a3ce8ff40e2ccaf1ad45db7774001b90d25810abd9040049be7bf4bb": { - "entryPoint": 109, + "entryPoint": 72, "parameterSlots": 0, "returnSlots": 0 }, "revert_error_dbdddcbe895c83990c08b3492a0e83918d802a52331272ac6fdb6a7c4aea3b1b": { - "entryPoint": 113, + "entryPoint": 76, "parameterSlots": 0, "returnSlots": 0 }, - "shift_left_0": + "shift_left": { - "entryPoint": 313, + "entryPoint": 246, "parameterSlots": 1, "returnSlots": 1 }, - "shift_right_224_unsigned": + "shift_right_unsigned": { - "entryPoint": 88, + "entryPoint": 60, "parameterSlots": 1, "returnSlots": 1 }, - "update_byte_slice_32_shift_0": + "update_byte_slice_shift": { - "entryPoint": 324, + "entryPoint": 251, "parameterSlots": 2, "returnSlots": 1 }, - "update_storage_value_offset_0t_uint256_to_t_uint256": + "update_storage_value_offsett_uint256_to_uint256": { - "entryPoint": 440, + "entryPoint": 307, "parameterSlots": 2, "returnSlots": 0 }, "usr$f": { - "entryPoint": 496, + "entryPoint": 339, + "parameterSlots": 0, + "returnSlots": 1 + }, + "usr$f_17": + { + "entryPoint": 382, + "parameterSlots": 0, + "returnSlots": 1 + }, + "usr$f_22": + { + "entryPoint": 425, + "parameterSlots": 0, + "returnSlots": 1 + }, + "usr$f_26": + { + "entryPoint": 461, + "parameterSlots": 0, + "returnSlots": 1 + }, + "usr$f_32": + { + "entryPoint": 504, + "parameterSlots": 0, + "returnSlots": 1 + }, + "usr$f_37": + { + "entryPoint": 547, "parameterSlots": 0, "returnSlots": 1 }, - "zero_value_for_split_t_uint256": + "zero_value_for_split_uint256": { - "entryPoint": 309, + "entryPoint": 242, "parameterSlots": 0, "returnSlots": 1 } diff --git a/test/cmdlineTests/linker_mode_output_selection_invalid/args b/test/cmdlineTests/linker_mode_output_selection_invalid/args index ded0d6efc551..6c5b1680bc18 100644 --- a/test/cmdlineTests/linker_mode_output_selection_invalid/args +++ b/test/cmdlineTests/linker_mode_output_selection_invalid/args @@ -1 +1 @@ ---link --asm --asm-json --opcodes --bin --bin-runtime --abi --ir --ir-optimized --ewasm --hashes --userdoc --devdoc --metadata --storage-layout +--link --asm --asm-json --opcodes --bin --bin-runtime --abi --ir --ir-optimized --hashes --userdoc --devdoc --metadata --storage-layout diff --git a/test/cmdlineTests/linker_mode_output_selection_invalid/err b/test/cmdlineTests/linker_mode_output_selection_invalid/err index c84a12d97ede..614ade61f23c 100644 --- a/test/cmdlineTests/linker_mode_output_selection_invalid/err +++ b/test/cmdlineTests/linker_mode_output_selection_invalid/err @@ -1 +1 @@ -The following outputs are not supported in linker mode: --abi, --asm, --asm-json, --bin, --bin-runtime, --devdoc, --ewasm, --hashes, --ir, --ir-optimized, --metadata, --opcodes, --storage-layout, --userdoc. +The following outputs are not supported in linker mode: --abi, --asm, --asm-json, --bin, --bin-runtime, --devdoc, --hashes, --ir, --ir-optimized, --metadata, --opcodes, --storage-layout, --userdoc. diff --git a/test/cmdlineTests/linking_strict_assembly/output b/test/cmdlineTests/linking_strict_assembly/output index 520b3cf7bb39..29a8abdfaea8 100644 --- a/test/cmdlineTests/linking_strict_assembly/output +++ b/test/cmdlineTests/linking_strict_assembly/output @@ -4,23 +4,23 @@ Pretty printed source: object "a" { code { - let addr := linkersymbol("contract/test.sol:L") - sstore(0, addr) + { + let addr := linkersymbol("contract/test.sol:L") + sstore(0, addr) + } } } Binary representation: -731234567890123456789012345678901234567890805f5550 +7312345678901234567890123456789012345678905f5500 Text representation: /* "linking_strict_assembly/input.yul":44:79 */ linkerSymbol("f919ba91ac99f96129544b80b9516b27a80e376b9dc693819d0b18b7e0395612") - /* "linking_strict_assembly/input.yul":98:102 */ - dup1 /* "linking_strict_assembly/input.yul":95:96 */ 0x00 /* "linking_strict_assembly/input.yul":88:103 */ sstore /* "linking_strict_assembly/input.yul":22:109 */ - pop + stop diff --git a/test/cmdlineTests/linking_strict_assembly_qualified_library_qualified_reference/output b/test/cmdlineTests/linking_strict_assembly_qualified_library_qualified_reference/output index a919ba72ec52..e4fa4fcbd9ab 100644 --- a/test/cmdlineTests/linking_strict_assembly_qualified_library_qualified_reference/output +++ b/test/cmdlineTests/linking_strict_assembly_qualified_library_qualified_reference/output @@ -4,18 +4,19 @@ Pretty printed source: object "a" { code { - let addr := linkersymbol(":L") - sstore(0, addr) + { + let addr := linkersymbol(":L") + sstore(0, addr) + } } } Binary representation: -731234567890123456789012345678901234567890805f5550 +7312345678901234567890123456789012345678905f5500 Text representation: linkerSymbol("20a18a9bf97d889dcf77111b674da319a4e9e3e05d3f4df9e0bf5c588dd4f0f8") - dup1 0x00 sstore - pop + stop diff --git a/test/cmdlineTests/linking_strict_assembly_qualified_library_unqualified_reference/output b/test/cmdlineTests/linking_strict_assembly_qualified_library_unqualified_reference/output index 660876888abe..ebf7f6542c52 100644 --- a/test/cmdlineTests/linking_strict_assembly_qualified_library_unqualified_reference/output +++ b/test/cmdlineTests/linking_strict_assembly_qualified_library_unqualified_reference/output @@ -4,18 +4,19 @@ Pretty printed source: object "a" { code { - let addr := linkersymbol("L") - sstore(0, addr) + { + let addr := linkersymbol("L") + sstore(0, addr) + } } } Binary representation: -73__$8aa64f937099b65a4febc243a5ae0f2d64$__805f5550 +73__$8aa64f937099b65a4febc243a5ae0f2d64$__5f5500 Text representation: linkerSymbol("8aa64f937099b65a4febc243a5ae0f2d6416bb9e473c30dd29c1ee498fb7c5a8") - dup1 0x00 sstore - pop + stop diff --git a/test/cmdlineTests/linking_strict_assembly_same_library_name_different_files/output b/test/cmdlineTests/linking_strict_assembly_same_library_name_different_files/output index 5babd2279d86..4aecfc6b26b1 100644 --- a/test/cmdlineTests/linking_strict_assembly_same_library_name_different_files/output +++ b/test/cmdlineTests/linking_strict_assembly_same_library_name_different_files/output @@ -4,34 +4,33 @@ Pretty printed source: object "a" { code { - let addr1 := linkersymbol("library1.sol:L") - let addr2 := linkersymbol("library2.sol:L") - sstore(0, addr1) - sstore(1, addr2) + { + let addr1 := linkersymbol("library1.sol:L") + let addr2 := linkersymbol("library2.sol:L") + sstore(0, addr1) + sstore(1, addr2) + } } } Binary representation: -731111111111111111111111111111111111111111732222222222222222222222222222222222222222815f55806001555050 +731111111111111111111111111111111111111111732222222222222222222222222222222222222222905f5560015500 Text representation: /* "linking_strict_assembly_same_library_name_different_files/input.yul":45:75 */ linkerSymbol("f3ffc10c396a7cc41ae954b050792839d20947bf73497d30c49a9fda1ea477ec") /* "linking_strict_assembly_same_library_name_different_files/input.yul":97:127 */ linkerSymbol("c3523432985587641d17c68161d2f700c57aaf4ed21cda4f25d76193c831f97f") - /* "linking_strict_assembly_same_library_name_different_files/input.yul":146:151 */ - dup2 + /* "linking_strict_assembly_same_library_name_different_files/input.yul":136:152 */ + swap1 /* "linking_strict_assembly_same_library_name_different_files/input.yul":143:144 */ 0x00 /* "linking_strict_assembly_same_library_name_different_files/input.yul":136:152 */ sstore - /* "linking_strict_assembly_same_library_name_different_files/input.yul":171:176 */ - dup1 /* "linking_strict_assembly_same_library_name_different_files/input.yul":168:169 */ 0x01 /* "linking_strict_assembly_same_library_name_different_files/input.yul":161:177 */ sstore /* "linking_strict_assembly_same_library_name_different_files/input.yul":22:183 */ - pop - pop + stop diff --git a/test/cmdlineTests/linking_strict_assembly_same_library_name_different_files_in_link_references/output b/test/cmdlineTests/linking_strict_assembly_same_library_name_different_files_in_link_references/output index 0eba8cf84852..10a7fe7fe067 100644 --- a/test/cmdlineTests/linking_strict_assembly_same_library_name_different_files_in_link_references/output +++ b/test/cmdlineTests/linking_strict_assembly_same_library_name_different_files_in_link_references/output @@ -4,34 +4,33 @@ Pretty printed source: object "a" { code { - let addr1 := linkersymbol("library1.sol:L") - let addr2 := linkersymbol("library2.sol:L") - sstore(0, addr1) - sstore(1, addr2) + { + let addr1 := linkersymbol("library1.sol:L") + let addr2 := linkersymbol("library2.sol:L") + sstore(0, addr1) + sstore(1, addr2) + } } } Binary representation: -73123456789012345678901234567890123456789073__$c3523432985587641d17c68161d2f700c5$__815f55806001555050 +73123456789012345678901234567890123456789073__$c3523432985587641d17c68161d2f700c5$__905f5560015500 Text representation: /* "linking_strict_assembly_same_library_name_different_files_in_link_references/input.yul":45:75 */ linkerSymbol("f3ffc10c396a7cc41ae954b050792839d20947bf73497d30c49a9fda1ea477ec") /* "linking_strict_assembly_same_library_name_different_files_in_link_references/input.yul":97:127 */ linkerSymbol("c3523432985587641d17c68161d2f700c57aaf4ed21cda4f25d76193c831f97f") - /* "linking_strict_assembly_same_library_name_different_files_in_link_references/input.yul":146:151 */ - dup2 + /* "linking_strict_assembly_same_library_name_different_files_in_link_references/input.yul":136:152 */ + swap1 /* "linking_strict_assembly_same_library_name_different_files_in_link_references/input.yul":143:144 */ 0x00 /* "linking_strict_assembly_same_library_name_different_files_in_link_references/input.yul":136:152 */ sstore - /* "linking_strict_assembly_same_library_name_different_files_in_link_references/input.yul":171:176 */ - dup1 /* "linking_strict_assembly_same_library_name_different_files_in_link_references/input.yul":168:169 */ 0x01 /* "linking_strict_assembly_same_library_name_different_files_in_link_references/input.yul":161:177 */ sstore /* "linking_strict_assembly_same_library_name_different_files_in_link_references/input.yul":22:183 */ - pop - pop + stop diff --git a/test/cmdlineTests/linking_strict_assembly_unqualified_library_qualified_reference/output b/test/cmdlineTests/linking_strict_assembly_unqualified_library_qualified_reference/output index 71d19f7aeb83..aaf03d0733b4 100644 --- a/test/cmdlineTests/linking_strict_assembly_unqualified_library_qualified_reference/output +++ b/test/cmdlineTests/linking_strict_assembly_unqualified_library_qualified_reference/output @@ -4,18 +4,19 @@ Pretty printed source: object "a" { code { - let addr := linkersymbol(":L") - sstore(0, addr) + { + let addr := linkersymbol(":L") + sstore(0, addr) + } } } Binary representation: -73__$20a18a9bf97d889dcf77111b674da319a4$__805f5550 +73__$20a18a9bf97d889dcf77111b674da319a4$__5f5500 Text representation: linkerSymbol("20a18a9bf97d889dcf77111b674da319a4e9e3e05d3f4df9e0bf5c588dd4f0f8") - dup1 0x00 sstore - pop + stop diff --git a/test/cmdlineTests/linking_strict_assembly_unqualified_library_unqualified_reference/output b/test/cmdlineTests/linking_strict_assembly_unqualified_library_unqualified_reference/output index 6f3ee5eb75e0..d91d89f5ca69 100644 --- a/test/cmdlineTests/linking_strict_assembly_unqualified_library_unqualified_reference/output +++ b/test/cmdlineTests/linking_strict_assembly_unqualified_library_unqualified_reference/output @@ -4,18 +4,19 @@ Pretty printed source: object "a" { code { - let addr := linkersymbol("L") - sstore(0, addr) + { + let addr := linkersymbol("L") + sstore(0, addr) + } } } Binary representation: -731234567890123456789012345678901234567890805f5550 +7312345678901234567890123456789012345678905f5500 Text representation: linkerSymbol("8aa64f937099b65a4febc243a5ae0f2d6416bb9e473c30dd29c1ee498fb7c5a8") - dup1 0x00 sstore - pop + stop diff --git a/test/cmdlineTests/linking_strict_assembly_unresolved_references/output b/test/cmdlineTests/linking_strict_assembly_unresolved_references/output index bc2e167b3351..a110db5a3e4e 100644 --- a/test/cmdlineTests/linking_strict_assembly_unresolved_references/output +++ b/test/cmdlineTests/linking_strict_assembly_unresolved_references/output @@ -4,34 +4,33 @@ Pretty printed source: object "a" { code { - let addr1 := linkersymbol("contract/test.sol:L1") - let addr2 := linkersymbol("contract/test.sol:L2") - sstore(0, addr1) - sstore(1, addr2) + { + let addr1 := linkersymbol("contract/test.sol:L1") + let addr2 := linkersymbol("contract/test.sol:L2") + sstore(0, addr1) + sstore(1, addr2) + } } } Binary representation: -73123456789012345678901234567890123456789073__$fb58009a6b1ecea3b9d99bedd645df4ec3$__815f55806001555050 +73123456789012345678901234567890123456789073__$fb58009a6b1ecea3b9d99bedd645df4ec3$__905f5560015500 Text representation: /* "linking_strict_assembly_unresolved_references/input.yul":45:81 */ linkerSymbol("05b0326038374a21e0895480a58bda0768cdcc04c8d18f154362d1ca5223d245") /* "linking_strict_assembly_unresolved_references/input.yul":103:139 */ linkerSymbol("fb58009a6b1ecea3b9d99bedd645df4ec308f17bc0087e5f39d078f77f809177") - /* "linking_strict_assembly_unresolved_references/input.yul":158:163 */ - dup2 + /* "linking_strict_assembly_unresolved_references/input.yul":148:164 */ + swap1 /* "linking_strict_assembly_unresolved_references/input.yul":155:156 */ 0x00 /* "linking_strict_assembly_unresolved_references/input.yul":148:164 */ sstore - /* "linking_strict_assembly_unresolved_references/input.yul":183:188 */ - dup1 /* "linking_strict_assembly_unresolved_references/input.yul":180:181 */ 0x01 /* "linking_strict_assembly_unresolved_references/input.yul":173:189 */ sstore /* "linking_strict_assembly_unresolved_references/input.yul":22:195 */ - pop - pop + stop diff --git a/test/cmdlineTests/metadata/args b/test/cmdlineTests/metadata/args new file mode 100644 index 000000000000..5cbfceb4723f --- /dev/null +++ b/test/cmdlineTests/metadata/args @@ -0,0 +1 @@ +--metadata diff --git a/test/cmdlineTests/metadata/input.sol b/test/cmdlineTests/metadata/input.sol new file mode 100644 index 000000000000..a3a86cc8d317 --- /dev/null +++ b/test/cmdlineTests/metadata/input.sol @@ -0,0 +1,4 @@ +// SPDX-License-Identifier: GPL-3.0 +pragma solidity *; + +contract C {} diff --git a/test/cmdlineTests/metadata/output b/test/cmdlineTests/metadata/output new file mode 100644 index 000000000000..bf1e750c95f0 --- /dev/null +++ b/test/cmdlineTests/metadata/output @@ -0,0 +1,4 @@ + +======= metadata/input.sol:C ======= +Metadata: +{"compiler":{"version": ""},"language":"Solidity","output":{"abi":[],"devdoc":{"kind":"dev","methods":{},"version":1},"userdoc":{"kind":"user","methods":{},"version":1}},"settings":{"compilationTarget":{"metadata/input.sol":"C"},"evmVersion":"shanghai","libraries":{},"metadata":{"bytecodeHash":"ipfs"},"optimizer":{"enabled":false,"runs":200},"remappings":[]},"sources":{"metadata/input.sol":{"keccak256":"0x5cf617b1707a484e3c4bd59643013dec76ab7d75900b46855214729ae3e0ceb0","license":"GPL-3.0","urls":["bzz-raw://ac418a02dfadf87234150d3568f33269e3f49460345cb39300e017a6d755eff2","dweb:/ipfs/QmQq3owBu25x2WV46HB1WyKzJpxiAPecU7eMKqtXCF7eeS"]}},"version":1} diff --git a/test/cmdlineTests/model_checker_bmc_loop_iterations/args b/test/cmdlineTests/model_checker_bmc_loop_iterations/args new file mode 100644 index 000000000000..3761421e91b8 --- /dev/null +++ b/test/cmdlineTests/model_checker_bmc_loop_iterations/args @@ -0,0 +1 @@ +--model-checker-engine bmc --model-checker-bmc-loop-iterations 3 \ No newline at end of file diff --git a/test/cmdlineTests/model_checker_bmc_loop_iterations/err b/test/cmdlineTests/model_checker_bmc_loop_iterations/err new file mode 100644 index 000000000000..cbb2b0f9daca --- /dev/null +++ b/test/cmdlineTests/model_checker_bmc_loop_iterations/err @@ -0,0 +1,11 @@ +Warning: BMC: Assertion violation happens here. + --> model_checker_bmc_loop_iterations/input.sol:10:3: + | +10 | assert(x == 3); + | ^^^^^^^^^^^^^^ +Note: Counterexample: + x = 2 + +Note: Callstack: +Note: False negatives are possible when unrolling loops. +This is due to the possibility that the BMC loop iteration setting is smaller than the actual number of iterations needed to complete a loop. diff --git a/test/cmdlineTests/model_checker_bmc_loop_iterations/input.sol b/test/cmdlineTests/model_checker_bmc_loop_iterations/input.sol new file mode 100644 index 000000000000..3722e46cfcef --- /dev/null +++ b/test/cmdlineTests/model_checker_bmc_loop_iterations/input.sol @@ -0,0 +1,12 @@ +// SPDX-License-Identifier: GPL-3.0 +pragma solidity >=0.0; +contract C +{ + function f(uint x) public pure { + require(x == 0); + do { + ++x; + } while (x < 2); + assert(x == 3); + } +} \ No newline at end of file diff --git a/test/cmdlineTests/model_checker_bmc_loop_iterations_invalid_arg/args b/test/cmdlineTests/model_checker_bmc_loop_iterations_invalid_arg/args new file mode 100644 index 000000000000..32b6eb05b088 --- /dev/null +++ b/test/cmdlineTests/model_checker_bmc_loop_iterations_invalid_arg/args @@ -0,0 +1 @@ +--model-checker-engine bmc --model-checker-bmc-loop-iterations bmc \ No newline at end of file diff --git a/test/cmdlineTests/model_checker_bmc_loop_iterations_invalid_arg/err b/test/cmdlineTests/model_checker_bmc_loop_iterations_invalid_arg/err new file mode 100644 index 000000000000..0f0fbaf8b284 --- /dev/null +++ b/test/cmdlineTests/model_checker_bmc_loop_iterations_invalid_arg/err @@ -0,0 +1 @@ +the argument ('bmc') for option '--model-checker-bmc-loop-iterations' is invalid \ No newline at end of file diff --git a/test/cmdlineTests/model_checker_bmc_loop_iterations_invalid_arg/exit b/test/cmdlineTests/model_checker_bmc_loop_iterations_invalid_arg/exit new file mode 100644 index 000000000000..56a6051ca2b0 --- /dev/null +++ b/test/cmdlineTests/model_checker_bmc_loop_iterations_invalid_arg/exit @@ -0,0 +1 @@ +1 \ No newline at end of file diff --git a/test/cmdlineTests/model_checker_bmc_loop_iterations_invalid_arg/input.sol b/test/cmdlineTests/model_checker_bmc_loop_iterations_invalid_arg/input.sol new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/test/cmdlineTests/model_checker_bmc_loop_iterations_no_argument/args b/test/cmdlineTests/model_checker_bmc_loop_iterations_no_argument/args new file mode 100644 index 000000000000..aad7e026c645 --- /dev/null +++ b/test/cmdlineTests/model_checker_bmc_loop_iterations_no_argument/args @@ -0,0 +1 @@ +--model-checker-engine bmc --model-checker-bmc-loop-iterations \ No newline at end of file diff --git a/test/cmdlineTests/model_checker_bmc_loop_iterations_no_argument/err b/test/cmdlineTests/model_checker_bmc_loop_iterations_no_argument/err new file mode 100644 index 000000000000..9b59a4eb870e --- /dev/null +++ b/test/cmdlineTests/model_checker_bmc_loop_iterations_no_argument/err @@ -0,0 +1 @@ +the argument ('model_checker_bmc_loop_iterations_no_argument/input.sol') for option '--model-checker-bmc-loop-iterations' is invalid diff --git a/test/cmdlineTests/model_checker_bmc_loop_iterations_no_argument/exit b/test/cmdlineTests/model_checker_bmc_loop_iterations_no_argument/exit new file mode 100644 index 000000000000..56a6051ca2b0 --- /dev/null +++ b/test/cmdlineTests/model_checker_bmc_loop_iterations_no_argument/exit @@ -0,0 +1 @@ +1 \ No newline at end of file diff --git a/test/cmdlineTests/model_checker_bmc_loop_iterations_no_argument/input.sol b/test/cmdlineTests/model_checker_bmc_loop_iterations_no_argument/input.sol new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/test/cmdlineTests/model_checker_print_query_all/args b/test/cmdlineTests/model_checker_print_query_all/args new file mode 100644 index 000000000000..d0b07d5aff9b --- /dev/null +++ b/test/cmdlineTests/model_checker_print_query_all/args @@ -0,0 +1 @@ +--model-checker-engine all --model-checker-print-query --model-checker-solvers smtlib2 --model-checker-timeout 1000 diff --git a/test/cmdlineTests/model_checker_print_query_all/err b/test/cmdlineTests/model_checker_print_query_all/err new file mode 100644 index 000000000000..1a04042cd778 --- /dev/null +++ b/test/cmdlineTests/model_checker_print_query_all/err @@ -0,0 +1,165 @@ +Info: CHC: Requested query: +(set-option :timeout 1000) +(set-logic HORN) +(declare-datatypes ((|bytes_tuple| 0)) (((|bytes_tuple| (|bytes_tuple_accessor_array| (Array Int Int)) (|bytes_tuple_accessor_length| Int))))) +(declare-datatypes ((|tx_type| 0)) (((|tx_type| (|block.basefee| Int) (|block.chainid| Int) (|block.coinbase| Int) (|block.gaslimit| Int) (|block.number| Int) (|block.prevrandao| Int) (|block.timestamp| Int) (|blockhash| (Array Int Int)) (|msg.data| |bytes_tuple|) (|msg.sender| Int) (|msg.sig| Int) (|msg.value| Int) (|tx.gasprice| Int) (|tx.origin| Int))))) +(declare-datatypes ((|ecrecover_input_type| 0)) (((|ecrecover_input_type| (|hash| Int) (|v| Int) (|r| Int) (|s| Int))))) +(declare-datatypes ((|crypto_type| 0)) (((|crypto_type| (|ecrecover| (Array |ecrecover_input_type| Int)) (|keccak256| (Array |bytes_tuple| Int)) (|ripemd160| (Array |bytes_tuple| Int)) (|sha256| (Array |bytes_tuple| Int)))))) +(declare-datatypes ((|abi_type| 0)) (((|abi_type|)))) +(declare-datatypes ((|state_type| 0)) (((|state_type| (|balances| (Array Int Int)))))) +(declare-fun |interface_0_C_16_0| (Int |abi_type| |crypto_type| |state_type| ) Bool) +(declare-fun |nondet_interface_1_C_16_0| (Int Int |abi_type| |crypto_type| |state_type| |state_type| ) Bool) +(declare-fun |summary_constructor_2_C_16_0| (Int Int |abi_type| |crypto_type| |tx_type| |state_type| |state_type| ) Bool) +(assert +(forall ( (abi_0 |abi_type|) (crypto_0 |crypto_type|) (error_0 Int) (state_0 |state_type|) (this_0 Int) (tx_0 |tx_type|)) +(=> (= error_0 0) (nondet_interface_1_C_16_0 error_0 this_0 abi_0 crypto_0 state_0 state_0)))) + + +(declare-fun |summary_3_function_f__15_16_0| (Int Int |abi_type| |crypto_type| |tx_type| |state_type| |state_type| ) Bool) +(declare-fun |summary_4_function_f__15_16_0| (Int Int |abi_type| |crypto_type| |tx_type| |state_type| |state_type| ) Bool) +(assert +(forall ( (abi_0 |abi_type|) (crypto_0 |crypto_type|) (error_0 Int) (error_1 Int) (state_0 |state_type|) (state_1 |state_type|) (state_2 |state_type|) (this_0 Int) (tx_0 |tx_type|)) +(=> (and (and (nondet_interface_1_C_16_0 error_0 this_0 abi_0 crypto_0 state_0 state_1) true) (and (= error_0 0) (summary_4_function_f__15_16_0 error_1 this_0 abi_0 crypto_0 tx_0 state_1 state_2))) (nondet_interface_1_C_16_0 error_1 this_0 abi_0 crypto_0 state_0 state_2)))) + + +(declare-fun |block_5_function_f__15_16_0| (Int Int |abi_type| |crypto_type| |tx_type| |state_type| |state_type| Int ) Bool) +(declare-fun |block_6_f_14_16_0| (Int Int |abi_type| |crypto_type| |tx_type| |state_type| |state_type| Int ) Bool) +(assert +(forall ( (abi_0 |abi_type|) (crypto_0 |crypto_type|) (error_0 Int) (error_1 Int) (state_0 |state_type|) (state_1 |state_type|) (state_2 |state_type|) (this_0 Int) (tx_0 |tx_type|) (x_5_0 Int) (x_5_1 Int)) +(block_5_function_f__15_16_0 error_0 this_0 abi_0 crypto_0 tx_0 state_0 state_1 x_5_1))) + + +(assert +(forall ( (abi_0 |abi_type|) (crypto_0 |crypto_type|) (error_0 Int) (error_1 Int) (state_0 |state_type|) (state_1 |state_type|) (state_2 |state_type|) (this_0 Int) (tx_0 |tx_type|) (x_5_0 Int) (x_5_1 Int)) +(=> (and (and (block_5_function_f__15_16_0 error_0 this_0 abi_0 crypto_0 tx_0 state_0 state_1 x_5_1) (and (and (and (and (= state_1 state_0) (= error_0 0)) true) true) true)) true) (block_6_f_14_16_0 error_0 this_0 abi_0 crypto_0 tx_0 state_0 state_1 x_5_1)))) + + +(declare-fun |block_7_return_function_f__15_16_0| (Int Int |abi_type| |crypto_type| |tx_type| |state_type| |state_type| Int ) Bool) +(declare-fun |block_8_function_f__15_16_0| (Int Int |abi_type| |crypto_type| |tx_type| |state_type| |state_type| Int ) Bool) +(assert +(forall ( (abi_0 |abi_type|) (crypto_0 |crypto_type|) (error_0 Int) (error_1 Int) (expr_10_0 Int) (expr_11_1 Bool) (expr_6_0 Int) (expr_9_0 Int) (state_0 |state_type|) (state_1 |state_type|) (state_2 |state_type|) (this_0 Int) (tx_0 |tx_type|) (x_5_0 Int) (x_5_1 Int) (x_5_2 Int)) +(=> (and (and (block_6_f_14_16_0 error_0 this_0 abi_0 crypto_0 tx_0 state_0 state_1 x_5_1) (and (= expr_11_1 (= expr_9_0 expr_10_0)) (and (=> true true) (and (= expr_10_0 0) (and (=> true (and (>= expr_9_0 0) (<= expr_9_0 115792089237316195423570985008687907853269984665640564039457584007913129639935))) (and (= expr_9_0 x_5_2) (and (= x_5_2 expr_6_0) (and (=> true true) (and (= expr_6_0 0) (and (= x_5_1 0) true)))))))))) (and (and true (not expr_11_1)) (= error_1 1))) (block_8_function_f__15_16_0 error_1 this_0 abi_0 crypto_0 tx_0 state_0 state_1 x_5_2)))) + + +(assert +(forall ( (abi_0 |abi_type|) (crypto_0 |crypto_type|) (error_0 Int) (error_1 Int) (expr_10_0 Int) (expr_11_1 Bool) (expr_6_0 Int) (expr_9_0 Int) (state_0 |state_type|) (state_1 |state_type|) (state_2 |state_type|) (this_0 Int) (tx_0 |tx_type|) (x_5_0 Int) (x_5_1 Int) (x_5_2 Int)) +(=> (block_8_function_f__15_16_0 error_1 this_0 abi_0 crypto_0 tx_0 state_0 state_1 x_5_2) (summary_3_function_f__15_16_0 error_1 this_0 abi_0 crypto_0 tx_0 state_0 state_1)))) + + +(assert +(forall ( (abi_0 |abi_type|) (crypto_0 |crypto_type|) (error_0 Int) (error_1 Int) (expr_10_0 Int) (expr_11_1 Bool) (expr_6_0 Int) (expr_9_0 Int) (state_0 |state_type|) (state_1 |state_type|) (state_2 |state_type|) (this_0 Int) (tx_0 |tx_type|) (x_5_0 Int) (x_5_1 Int) (x_5_2 Int)) +(=> (and (and (block_6_f_14_16_0 error_0 this_0 abi_0 crypto_0 tx_0 state_0 state_1 x_5_1) (and (= error_1 error_0) (and (= expr_11_1 (= expr_9_0 expr_10_0)) (and (=> true true) (and (= expr_10_0 0) (and (=> true (and (>= expr_9_0 0) (<= expr_9_0 115792089237316195423570985008687907853269984665640564039457584007913129639935))) (and (= expr_9_0 x_5_2) (and (= x_5_2 expr_6_0) (and (=> true true) (and (= expr_6_0 0) (and (= x_5_1 0) true))))))))))) true) (block_7_return_function_f__15_16_0 error_1 this_0 abi_0 crypto_0 tx_0 state_0 state_1 x_5_2)))) + + +(assert +(forall ( (abi_0 |abi_type|) (crypto_0 |crypto_type|) (error_0 Int) (error_1 Int) (expr_10_0 Int) (expr_11_1 Bool) (expr_6_0 Int) (expr_9_0 Int) (state_0 |state_type|) (state_1 |state_type|) (state_2 |state_type|) (this_0 Int) (tx_0 |tx_type|) (x_5_0 Int) (x_5_1 Int) (x_5_2 Int)) +(=> (and (and (block_7_return_function_f__15_16_0 error_0 this_0 abi_0 crypto_0 tx_0 state_0 state_1 x_5_1) true) true) (summary_3_function_f__15_16_0 error_0 this_0 abi_0 crypto_0 tx_0 state_0 state_1)))) + + +(declare-fun |block_9_function_f__15_16_0| (Int Int |abi_type| |crypto_type| |tx_type| |state_type| |state_type| Int ) Bool) +(assert +(forall ( (abi_0 |abi_type|) (crypto_0 |crypto_type|) (error_0 Int) (error_1 Int) (expr_10_0 Int) (expr_11_1 Bool) (expr_6_0 Int) (expr_9_0 Int) (state_0 |state_type|) (state_1 |state_type|) (state_2 |state_type|) (this_0 Int) (tx_0 |tx_type|) (x_5_0 Int) (x_5_1 Int) (x_5_2 Int)) +(block_9_function_f__15_16_0 error_0 this_0 abi_0 crypto_0 tx_0 state_0 state_1 x_5_1))) + + +(assert +(forall ( (abi_0 |abi_type|) (crypto_0 |crypto_type|) (error_0 Int) (error_1 Int) (expr_10_0 Int) (expr_11_1 Bool) (expr_6_0 Int) (expr_9_0 Int) (funds_2_0 Int) (state_0 |state_type|) (state_1 |state_type|) (state_2 |state_type|) (state_3 |state_type|) (this_0 Int) (tx_0 |tx_type|) (x_5_0 Int) (x_5_1 Int) (x_5_2 Int)) +(=> (and (and (block_9_function_f__15_16_0 error_0 this_0 abi_0 crypto_0 tx_0 state_0 state_1 x_5_1) (and (summary_3_function_f__15_16_0 error_1 this_0 abi_0 crypto_0 tx_0 state_2 state_3) (and (= state_2 (|state_type| (store (|balances| state_1) this_0 (+ (select (|balances| state_1) this_0) funds_2_0)))) (and (and (>= (+ (select (|balances| state_1) this_0) funds_2_0) 0) (<= (+ (select (|balances| state_1) this_0) funds_2_0) 115792089237316195423570985008687907853269984665640564039457584007913129639935)) (and (>= funds_2_0 (|msg.value| tx_0)) (and (and (and (and (and (and (and (and (and (and (and (and (and (> (|block.prevrandao| tx_0) 18446744073709551616) (and (>= (|block.basefee| tx_0) 0) (<= (|block.basefee| tx_0) 115792089237316195423570985008687907853269984665640564039457584007913129639935))) (and (>= (|block.chainid| tx_0) 0) (<= (|block.chainid| tx_0) 115792089237316195423570985008687907853269984665640564039457584007913129639935))) (and (>= (|block.coinbase| tx_0) 0) (<= (|block.coinbase| tx_0) 1461501637330902918203684832716283019655932542975))) (and (>= (|block.prevrandao| tx_0) 0) (<= (|block.prevrandao| tx_0) 115792089237316195423570985008687907853269984665640564039457584007913129639935))) (and (>= (|block.gaslimit| tx_0) 0) (<= (|block.gaslimit| tx_0) 115792089237316195423570985008687907853269984665640564039457584007913129639935))) (and (>= (|block.number| tx_0) 0) (<= (|block.number| tx_0) 115792089237316195423570985008687907853269984665640564039457584007913129639935))) (and (>= (|block.timestamp| tx_0) 0) (<= (|block.timestamp| tx_0) 115792089237316195423570985008687907853269984665640564039457584007913129639935))) (and (>= (|msg.sender| tx_0) 0) (<= (|msg.sender| tx_0) 1461501637330902918203684832716283019655932542975))) (and (>= (|msg.value| tx_0) 0) (<= (|msg.value| tx_0) 115792089237316195423570985008687907853269984665640564039457584007913129639935))) (and (>= (|tx.origin| tx_0) 0) (<= (|tx.origin| tx_0) 1461501637330902918203684832716283019655932542975))) (and (>= (|tx.gasprice| tx_0) 0) (<= (|tx.gasprice| tx_0) 115792089237316195423570985008687907853269984665640564039457584007913129639935))) (and (and (and (and (and (and (= (|msg.value| tx_0) 0) (= (|msg.sig| tx_0) 638722032)) (= (select (|bytes_tuple_accessor_array| (|msg.data| tx_0)) 0) 38)) (= (select (|bytes_tuple_accessor_array| (|msg.data| tx_0)) 1) 18)) (= (select (|bytes_tuple_accessor_array| (|msg.data| tx_0)) 2) 31)) (= (select (|bytes_tuple_accessor_array| (|msg.data| tx_0)) 3) 240)) (>= (|bytes_tuple_accessor_length| (|msg.data| tx_0)) 4))) (and (and (and (and (= state_1 state_0) (= error_0 0)) true) true) true))))))) true) (summary_4_function_f__15_16_0 error_1 this_0 abi_0 crypto_0 tx_0 state_0 state_3)))) + + +(assert +(forall ( (abi_0 |abi_type|) (crypto_0 |crypto_type|) (error_0 Int) (error_1 Int) (expr_10_0 Int) (expr_11_1 Bool) (expr_6_0 Int) (expr_9_0 Int) (funds_2_0 Int) (state_0 |state_type|) (state_1 |state_type|) (state_2 |state_type|) (state_3 |state_type|) (this_0 Int) (tx_0 |tx_type|) (x_5_0 Int) (x_5_1 Int) (x_5_2 Int)) +(=> (and (and (interface_0_C_16_0 this_0 abi_0 crypto_0 state_0) true) (and (summary_4_function_f__15_16_0 error_0 this_0 abi_0 crypto_0 tx_0 state_0 state_1) (= error_0 0))) (interface_0_C_16_0 this_0 abi_0 crypto_0 state_1)))) + + +(declare-fun |contract_initializer_10_C_16_0| (Int Int |abi_type| |crypto_type| |tx_type| |state_type| |state_type| ) Bool) +(declare-fun |contract_initializer_entry_11_C_16_0| (Int Int |abi_type| |crypto_type| |tx_type| |state_type| |state_type| ) Bool) +(assert +(forall ( (abi_0 |abi_type|) (crypto_0 |crypto_type|) (error_0 Int) (error_1 Int) (expr_10_0 Int) (expr_11_1 Bool) (expr_6_0 Int) (expr_9_0 Int) (funds_2_0 Int) (state_0 |state_type|) (state_1 |state_type|) (state_2 |state_type|) (state_3 |state_type|) (this_0 Int) (tx_0 |tx_type|) (x_5_0 Int) (x_5_1 Int) (x_5_2 Int)) +(=> (and (and (= state_1 state_0) (= error_0 0)) true) (contract_initializer_entry_11_C_16_0 error_0 this_0 abi_0 crypto_0 tx_0 state_0 state_1)))) + + +(declare-fun |contract_initializer_after_init_12_C_16_0| (Int Int |abi_type| |crypto_type| |tx_type| |state_type| |state_type| ) Bool) +(assert +(forall ( (abi_0 |abi_type|) (crypto_0 |crypto_type|) (error_0 Int) (error_1 Int) (expr_10_0 Int) (expr_11_1 Bool) (expr_6_0 Int) (expr_9_0 Int) (funds_2_0 Int) (state_0 |state_type|) (state_1 |state_type|) (state_2 |state_type|) (state_3 |state_type|) (this_0 Int) (tx_0 |tx_type|) (x_5_0 Int) (x_5_1 Int) (x_5_2 Int)) +(=> (and (and (contract_initializer_entry_11_C_16_0 error_0 this_0 abi_0 crypto_0 tx_0 state_0 state_1) true) true) (contract_initializer_after_init_12_C_16_0 error_0 this_0 abi_0 crypto_0 tx_0 state_0 state_1)))) + + +(assert +(forall ( (abi_0 |abi_type|) (crypto_0 |crypto_type|) (error_0 Int) (error_1 Int) (expr_10_0 Int) (expr_11_1 Bool) (expr_6_0 Int) (expr_9_0 Int) (funds_2_0 Int) (state_0 |state_type|) (state_1 |state_type|) (state_2 |state_type|) (state_3 |state_type|) (this_0 Int) (tx_0 |tx_type|) (x_5_0 Int) (x_5_1 Int) (x_5_2 Int)) +(=> (and (and (contract_initializer_after_init_12_C_16_0 error_0 this_0 abi_0 crypto_0 tx_0 state_0 state_1) true) true) (contract_initializer_10_C_16_0 error_0 this_0 abi_0 crypto_0 tx_0 state_0 state_1)))) + + +(declare-fun |implicit_constructor_entry_13_C_16_0| (Int Int |abi_type| |crypto_type| |tx_type| |state_type| |state_type| ) Bool) +(assert +(forall ( (abi_0 |abi_type|) (crypto_0 |crypto_type|) (error_0 Int) (error_1 Int) (expr_10_0 Int) (expr_11_1 Bool) (expr_6_0 Int) (expr_9_0 Int) (funds_2_0 Int) (state_0 |state_type|) (state_1 |state_type|) (state_2 |state_type|) (state_3 |state_type|) (this_0 Int) (tx_0 |tx_type|) (x_5_0 Int) (x_5_1 Int) (x_5_2 Int)) +(=> (and (and (and (and (and (= state_1 state_0) (= error_0 0)) true) true) true) (>= (select (|balances| state_1) this_0) (|msg.value| tx_0))) (implicit_constructor_entry_13_C_16_0 error_0 this_0 abi_0 crypto_0 tx_0 state_0 state_1)))) + + +(assert +(forall ( (abi_0 |abi_type|) (crypto_0 |crypto_type|) (error_0 Int) (error_1 Int) (expr_10_0 Int) (expr_11_1 Bool) (expr_6_0 Int) (expr_9_0 Int) (funds_2_0 Int) (state_0 |state_type|) (state_1 |state_type|) (state_2 |state_type|) (state_3 |state_type|) (this_0 Int) (tx_0 |tx_type|) (x_5_0 Int) (x_5_1 Int) (x_5_2 Int)) +(=> (and (and (implicit_constructor_entry_13_C_16_0 error_0 this_0 abi_0 crypto_0 tx_0 state_0 state_1) (and (contract_initializer_10_C_16_0 error_1 this_0 abi_0 crypto_0 tx_0 state_1 state_2) true)) (> error_1 0)) (summary_constructor_2_C_16_0 error_1 this_0 abi_0 crypto_0 tx_0 state_0 state_2)))) + + +(assert +(forall ( (abi_0 |abi_type|) (crypto_0 |crypto_type|) (error_0 Int) (error_1 Int) (expr_10_0 Int) (expr_11_1 Bool) (expr_6_0 Int) (expr_9_0 Int) (funds_2_0 Int) (state_0 |state_type|) (state_1 |state_type|) (state_2 |state_type|) (state_3 |state_type|) (this_0 Int) (tx_0 |tx_type|) (x_5_0 Int) (x_5_1 Int) (x_5_2 Int)) +(=> (and (and (implicit_constructor_entry_13_C_16_0 error_0 this_0 abi_0 crypto_0 tx_0 state_0 state_1) (and (= error_1 0) (and (contract_initializer_10_C_16_0 error_1 this_0 abi_0 crypto_0 tx_0 state_1 state_2) true))) true) (summary_constructor_2_C_16_0 error_1 this_0 abi_0 crypto_0 tx_0 state_0 state_2)))) + + +(assert +(forall ( (abi_0 |abi_type|) (crypto_0 |crypto_type|) (error_0 Int) (error_1 Int) (expr_10_0 Int) (expr_11_1 Bool) (expr_6_0 Int) (expr_9_0 Int) (funds_2_0 Int) (state_0 |state_type|) (state_1 |state_type|) (state_2 |state_type|) (state_3 |state_type|) (this_0 Int) (tx_0 |tx_type|) (x_5_0 Int) (x_5_1 Int) (x_5_2 Int)) +(=> (and (and (summary_constructor_2_C_16_0 error_0 this_0 abi_0 crypto_0 tx_0 state_0 state_1) true) (and (and (and (and (and (and (and (and (and (and (and (and (and (> (|block.prevrandao| tx_0) 18446744073709551616) (and (>= (|block.basefee| tx_0) 0) (<= (|block.basefee| tx_0) 115792089237316195423570985008687907853269984665640564039457584007913129639935))) (and (>= (|block.chainid| tx_0) 0) (<= (|block.chainid| tx_0) 115792089237316195423570985008687907853269984665640564039457584007913129639935))) (and (>= (|block.coinbase| tx_0) 0) (<= (|block.coinbase| tx_0) 1461501637330902918203684832716283019655932542975))) (and (>= (|block.prevrandao| tx_0) 0) (<= (|block.prevrandao| tx_0) 115792089237316195423570985008687907853269984665640564039457584007913129639935))) (and (>= (|block.gaslimit| tx_0) 0) (<= (|block.gaslimit| tx_0) 115792089237316195423570985008687907853269984665640564039457584007913129639935))) (and (>= (|block.number| tx_0) 0) (<= (|block.number| tx_0) 115792089237316195423570985008687907853269984665640564039457584007913129639935))) (and (>= (|block.timestamp| tx_0) 0) (<= (|block.timestamp| tx_0) 115792089237316195423570985008687907853269984665640564039457584007913129639935))) (and (>= (|msg.sender| tx_0) 0) (<= (|msg.sender| tx_0) 1461501637330902918203684832716283019655932542975))) (and (>= (|msg.value| tx_0) 0) (<= (|msg.value| tx_0) 115792089237316195423570985008687907853269984665640564039457584007913129639935))) (and (>= (|tx.origin| tx_0) 0) (<= (|tx.origin| tx_0) 1461501637330902918203684832716283019655932542975))) (and (>= (|tx.gasprice| tx_0) 0) (<= (|tx.gasprice| tx_0) 115792089237316195423570985008687907853269984665640564039457584007913129639935))) (= (|msg.value| tx_0) 0)) (= error_0 0))) (interface_0_C_16_0 this_0 abi_0 crypto_0 state_1)))) + + +(declare-fun |error_target_3_0| () Bool) +(assert +(forall ( (abi_0 |abi_type|) (crypto_0 |crypto_type|) (error_0 Int) (error_1 Int) (expr_10_0 Int) (expr_11_1 Bool) (expr_6_0 Int) (expr_9_0 Int) (funds_2_0 Int) (state_0 |state_type|) (state_1 |state_type|) (state_2 |state_type|) (state_3 |state_type|) (this_0 Int) (tx_0 |tx_type|) (x_5_0 Int) (x_5_1 Int) (x_5_2 Int)) +(=> (and (and (interface_0_C_16_0 this_0 abi_0 crypto_0 state_0) true) (and (summary_4_function_f__15_16_0 error_0 this_0 abi_0 crypto_0 tx_0 state_0 state_1) (= error_0 1))) error_target_3_0))) + + + +(assert +(forall ( (abi_0 |abi_type|) (crypto_0 |crypto_type|) (error_0 Int) (error_1 Int) (expr_10_0 Int) (expr_11_1 Bool) (expr_6_0 Int) (expr_9_0 Int) (funds_2_0 Int) (state_0 |state_type|) (state_1 |state_type|) (state_2 |state_type|) (state_3 |state_type|) (this_0 Int) (tx_0 |tx_type|) (x_5_0 Int) (x_5_1 Int) (x_5_2 Int)) +(=> error_target_3_0 false))) +(check-sat) + + +Warning: CHC: 1 verification condition(s) could not be proved. Enable the model checker option "show unproved" to see all of them. Consider choosing a specific contract to be verified in order to reduce the solving problems. Consider increasing the timeout per query. + +Warning: CHC analysis was not possible. No Horn solver was available. None of the installed solvers was enabled. + +Info: BMC: Requested query: +(set-option :produce-models true) +(set-option :timeout 1000) +(set-logic ALL) +(declare-fun |x_5_3| () Int) +(declare-fun |error_0| () Int) +(declare-fun |this_0| () Int) +(declare-datatypes ((|bytes_tuple| 0)) (((|bytes_tuple| (|bytes_tuple_accessor_array| (Array Int Int)) (|bytes_tuple_accessor_length| Int))))) +(declare-datatypes ((|tx_type| 0)) (((|tx_type| (|block.basefee| Int) (|block.chainid| Int) (|block.coinbase| Int) (|block.gaslimit| Int) (|block.number| Int) (|block.prevrandao| Int) (|block.timestamp| Int) (|blockhash| (Array Int Int)) (|msg.data| |bytes_tuple|) (|msg.sender| Int) (|msg.sig| Int) (|msg.value| Int) (|tx.gasprice| Int) (|tx.origin| Int))))) +(declare-fun |tx_0| () |tx_type|) +(declare-datatypes ((|ecrecover_input_type| 0)) (((|ecrecover_input_type| (|hash| Int) (|v| Int) (|r| Int) (|s| Int))))) +(declare-datatypes ((|crypto_type| 0)) (((|crypto_type| (|ecrecover| (Array |ecrecover_input_type| Int)) (|keccak256| (Array |bytes_tuple| Int)) (|ripemd160| (Array |bytes_tuple| Int)) (|sha256| (Array |bytes_tuple| Int)))))) +(declare-fun |crypto_0| () |crypto_type|) +(declare-datatypes ((|abi_type| 0)) (((|abi_type|)))) +(declare-fun |abi_0| () |abi_type|) +(declare-datatypes ((|state_type| 0)) (((|state_type| (|balances| (Array Int Int)))))) +(declare-fun |state_0| () |state_type|) +(declare-fun |x_5_4| () Int) +(declare-fun |x_5_0| () Int) +(declare-fun |expr_6_0| () Int) +(declare-fun |x_5_1| () Int) +(declare-fun |expr_9_0| () Int) +(declare-fun |expr_10_0| () Int) +(declare-fun |expr_11_1| () Bool) + +(assert (and (and (and true true) (and (= expr_11_1 (= expr_9_0 expr_10_0)) (and (=> (and true true) true) (and (= expr_10_0 0) (and (=> (and true true) (and (>= expr_9_0 0) (<= expr_9_0 115792089237316195423570985008687907853269984665640564039457584007913129639935))) (and (= expr_9_0 x_5_1) (and (ite (and true true) (= x_5_1 expr_6_0) (= x_5_1 x_5_0)) (and (=> (and true true) true) (and (= expr_6_0 0) (and (= x_5_0 0) (and (and (and (and (and (and (and (and (and (and (and (and (and (> (|block.prevrandao| tx_0) 18446744073709551616) (and (>= (|block.basefee| tx_0) 0) (<= (|block.basefee| tx_0) 115792089237316195423570985008687907853269984665640564039457584007913129639935))) (and (>= (|block.chainid| tx_0) 0) (<= (|block.chainid| tx_0) 115792089237316195423570985008687907853269984665640564039457584007913129639935))) (and (>= (|block.coinbase| tx_0) 0) (<= (|block.coinbase| tx_0) 1461501637330902918203684832716283019655932542975))) (and (>= (|block.prevrandao| tx_0) 0) (<= (|block.prevrandao| tx_0) 115792089237316195423570985008687907853269984665640564039457584007913129639935))) (and (>= (|block.gaslimit| tx_0) 0) (<= (|block.gaslimit| tx_0) 115792089237316195423570985008687907853269984665640564039457584007913129639935))) (and (>= (|block.number| tx_0) 0) (<= (|block.number| tx_0) 115792089237316195423570985008687907853269984665640564039457584007913129639935))) (and (>= (|block.timestamp| tx_0) 0) (<= (|block.timestamp| tx_0) 115792089237316195423570985008687907853269984665640564039457584007913129639935))) (and (>= (|msg.sender| tx_0) 0) (<= (|msg.sender| tx_0) 1461501637330902918203684832716283019655932542975))) (and (>= (|msg.value| tx_0) 0) (<= (|msg.value| tx_0) 115792089237316195423570985008687907853269984665640564039457584007913129639935))) (and (>= (|tx.origin| tx_0) 0) (<= (|tx.origin| tx_0) 1461501637330902918203684832716283019655932542975))) (and (>= (|tx.gasprice| tx_0) 0) (<= (|tx.gasprice| tx_0) 115792089237316195423570985008687907853269984665640564039457584007913129639935))) (and (and (and (and (and (and (= (|msg.value| tx_0) 0) (= (|msg.sig| tx_0) 638722032)) (= (select (|bytes_tuple_accessor_array| (|msg.data| tx_0)) 0) 38)) (= (select (|bytes_tuple_accessor_array| (|msg.data| tx_0)) 1) 18)) (= (select (|bytes_tuple_accessor_array| (|msg.data| tx_0)) 2) 31)) (= (select (|bytes_tuple_accessor_array| (|msg.data| tx_0)) 3) 240)) (>= (|bytes_tuple_accessor_length| (|msg.data| tx_0)) 4))) true))))))))))) (not expr_11_1))) +(declare-const |EVALEXPR_0| Int) +(assert (= |EVALEXPR_0| x_5_1)) +(check-sat) +(get-value (|EVALEXPR_0| )) + + +Warning: BMC: 1 verification condition(s) could not be proved. Enable the model checker option "show unproved" to see all of them. Consider choosing a specific contract to be verified in order to reduce the solving problems. Consider increasing the timeout per query. + +Warning: BMC analysis was not possible. No SMT solver (Z3 or CVC4) was available. None of the installed solvers was enabled. diff --git a/test/cmdlineTests/model_checker_print_query_all/input.sol b/test/cmdlineTests/model_checker_print_query_all/input.sol new file mode 100644 index 000000000000..eb4cd572ae22 --- /dev/null +++ b/test/cmdlineTests/model_checker_print_query_all/input.sol @@ -0,0 +1,9 @@ +// SPDX-License-Identifier: GPL-3.0 +pragma solidity >=0.0; +contract C +{ + function f() public pure { + uint x = 0; + assert(x == 0); + } +} diff --git a/test/cmdlineTests/model_checker_print_query_bmc/args b/test/cmdlineTests/model_checker_print_query_bmc/args new file mode 100644 index 000000000000..d13bdc43b3b3 --- /dev/null +++ b/test/cmdlineTests/model_checker_print_query_bmc/args @@ -0,0 +1 @@ +--model-checker-engine bmc --model-checker-print-query --model-checker-solvers smtlib2 diff --git a/test/cmdlineTests/model_checker_print_query_bmc/err b/test/cmdlineTests/model_checker_print_query_bmc/err new file mode 100644 index 000000000000..1a59f87b0d95 --- /dev/null +++ b/test/cmdlineTests/model_checker_print_query_bmc/err @@ -0,0 +1,32 @@ +Info: BMC: Requested query: +(set-option :produce-models true) +(set-logic ALL) +(declare-fun |error_0| () Int) +(declare-fun |this_0| () Int) +(declare-datatypes ((|bytes_tuple| 0)) (((|bytes_tuple| (|bytes_tuple_accessor_array| (Array Int Int)) (|bytes_tuple_accessor_length| Int))))) +(declare-datatypes ((|tx_type| 0)) (((|tx_type| (|block.basefee| Int) (|block.chainid| Int) (|block.coinbase| Int) (|block.gaslimit| Int) (|block.number| Int) (|block.prevrandao| Int) (|block.timestamp| Int) (|blockhash| (Array Int Int)) (|msg.data| |bytes_tuple|) (|msg.sender| Int) (|msg.sig| Int) (|msg.value| Int) (|tx.gasprice| Int) (|tx.origin| Int))))) +(declare-fun |tx_0| () |tx_type|) +(declare-datatypes ((|ecrecover_input_type| 0)) (((|ecrecover_input_type| (|hash| Int) (|v| Int) (|r| Int) (|s| Int))))) +(declare-datatypes ((|crypto_type| 0)) (((|crypto_type| (|ecrecover| (Array |ecrecover_input_type| Int)) (|keccak256| (Array |bytes_tuple| Int)) (|ripemd160| (Array |bytes_tuple| Int)) (|sha256| (Array |bytes_tuple| Int)))))) +(declare-fun |crypto_0| () |crypto_type|) +(declare-datatypes ((|abi_type| 0)) (((|abi_type|)))) +(declare-fun |abi_0| () |abi_type|) +(declare-datatypes ((|state_type| 0)) (((|state_type| (|balances| (Array Int Int)))))) +(declare-fun |state_0| () |state_type|) +(declare-fun |x_5_0| () Int) +(declare-fun |expr_6_0| () Int) +(declare-fun |x_5_1| () Int) +(declare-fun |expr_9_0| () Int) +(declare-fun |expr_10_0| () Int) +(declare-fun |expr_11_1| () Bool) + +(assert (and (and (and true true) (and (= expr_11_1 (= expr_9_0 expr_10_0)) (and (=> (and true true) true) (and (= expr_10_0 0) (and (=> (and true true) (and (>= expr_9_0 0) (<= expr_9_0 115792089237316195423570985008687907853269984665640564039457584007913129639935))) (and (= expr_9_0 x_5_1) (and (ite (and true true) (= x_5_1 expr_6_0) (= x_5_1 x_5_0)) (and (=> (and true true) true) (and (= expr_6_0 0) (and (= x_5_0 0) (and (and (and (and (and (and (and (and (and (and (and (and (and (> (|block.prevrandao| tx_0) 18446744073709551616) (and (>= (|block.basefee| tx_0) 0) (<= (|block.basefee| tx_0) 115792089237316195423570985008687907853269984665640564039457584007913129639935))) (and (>= (|block.chainid| tx_0) 0) (<= (|block.chainid| tx_0) 115792089237316195423570985008687907853269984665640564039457584007913129639935))) (and (>= (|block.coinbase| tx_0) 0) (<= (|block.coinbase| tx_0) 1461501637330902918203684832716283019655932542975))) (and (>= (|block.prevrandao| tx_0) 0) (<= (|block.prevrandao| tx_0) 115792089237316195423570985008687907853269984665640564039457584007913129639935))) (and (>= (|block.gaslimit| tx_0) 0) (<= (|block.gaslimit| tx_0) 115792089237316195423570985008687907853269984665640564039457584007913129639935))) (and (>= (|block.number| tx_0) 0) (<= (|block.number| tx_0) 115792089237316195423570985008687907853269984665640564039457584007913129639935))) (and (>= (|block.timestamp| tx_0) 0) (<= (|block.timestamp| tx_0) 115792089237316195423570985008687907853269984665640564039457584007913129639935))) (and (>= (|msg.sender| tx_0) 0) (<= (|msg.sender| tx_0) 1461501637330902918203684832716283019655932542975))) (and (>= (|msg.value| tx_0) 0) (<= (|msg.value| tx_0) 115792089237316195423570985008687907853269984665640564039457584007913129639935))) (and (>= (|tx.origin| tx_0) 0) (<= (|tx.origin| tx_0) 1461501637330902918203684832716283019655932542975))) (and (>= (|tx.gasprice| tx_0) 0) (<= (|tx.gasprice| tx_0) 115792089237316195423570985008687907853269984665640564039457584007913129639935))) (and (and (and (and (and (and (= (|msg.value| tx_0) 0) (= (|msg.sig| tx_0) 638722032)) (= (select (|bytes_tuple_accessor_array| (|msg.data| tx_0)) 0) 38)) (= (select (|bytes_tuple_accessor_array| (|msg.data| tx_0)) 1) 18)) (= (select (|bytes_tuple_accessor_array| (|msg.data| tx_0)) 2) 31)) (= (select (|bytes_tuple_accessor_array| (|msg.data| tx_0)) 3) 240)) (>= (|bytes_tuple_accessor_length| (|msg.data| tx_0)) 4))) true))))))))))) (not expr_11_1))) +(declare-const |EVALEXPR_0| Int) +(assert (= |EVALEXPR_0| x_5_1)) +(check-sat) +(get-value (|EVALEXPR_0| )) + + +Warning: BMC: 1 verification condition(s) could not be proved. Enable the model checker option "show unproved" to see all of them. Consider choosing a specific contract to be verified in order to reduce the solving problems. Consider increasing the timeout per query. + +Warning: BMC analysis was not possible. No SMT solver (Z3 or CVC4) was available. None of the installed solvers was enabled. diff --git a/test/cmdlineTests/model_checker_print_query_bmc/input.sol b/test/cmdlineTests/model_checker_print_query_bmc/input.sol new file mode 100644 index 000000000000..eb4cd572ae22 --- /dev/null +++ b/test/cmdlineTests/model_checker_print_query_bmc/input.sol @@ -0,0 +1,9 @@ +// SPDX-License-Identifier: GPL-3.0 +pragma solidity >=0.0; +contract C +{ + function f() public pure { + uint x = 0; + assert(x == 0); + } +} diff --git a/test/cmdlineTests/model_checker_print_query_chc/args b/test/cmdlineTests/model_checker_print_query_chc/args new file mode 100644 index 000000000000..752709efbb5c --- /dev/null +++ b/test/cmdlineTests/model_checker_print_query_chc/args @@ -0,0 +1 @@ +--model-checker-engine chc --model-checker-print-query --model-checker-solvers smtlib2 --model-checker-timeout 1000 diff --git a/test/cmdlineTests/model_checker_print_query_chc/err b/test/cmdlineTests/model_checker_print_query_chc/err new file mode 100644 index 000000000000..1dd7f0c98828 --- /dev/null +++ b/test/cmdlineTests/model_checker_print_query_chc/err @@ -0,0 +1,129 @@ +Info: CHC: Requested query: +(set-option :timeout 1000) +(set-logic HORN) +(declare-datatypes ((|bytes_tuple| 0)) (((|bytes_tuple| (|bytes_tuple_accessor_array| (Array Int Int)) (|bytes_tuple_accessor_length| Int))))) +(declare-datatypes ((|tx_type| 0)) (((|tx_type| (|block.basefee| Int) (|block.chainid| Int) (|block.coinbase| Int) (|block.gaslimit| Int) (|block.number| Int) (|block.prevrandao| Int) (|block.timestamp| Int) (|blockhash| (Array Int Int)) (|msg.data| |bytes_tuple|) (|msg.sender| Int) (|msg.sig| Int) (|msg.value| Int) (|tx.gasprice| Int) (|tx.origin| Int))))) +(declare-datatypes ((|ecrecover_input_type| 0)) (((|ecrecover_input_type| (|hash| Int) (|v| Int) (|r| Int) (|s| Int))))) +(declare-datatypes ((|crypto_type| 0)) (((|crypto_type| (|ecrecover| (Array |ecrecover_input_type| Int)) (|keccak256| (Array |bytes_tuple| Int)) (|ripemd160| (Array |bytes_tuple| Int)) (|sha256| (Array |bytes_tuple| Int)))))) +(declare-datatypes ((|abi_type| 0)) (((|abi_type|)))) +(declare-datatypes ((|state_type| 0)) (((|state_type| (|balances| (Array Int Int)))))) +(declare-fun |interface_0_C_16_0| (Int |abi_type| |crypto_type| |state_type| ) Bool) +(declare-fun |nondet_interface_1_C_16_0| (Int Int |abi_type| |crypto_type| |state_type| |state_type| ) Bool) +(declare-fun |summary_constructor_2_C_16_0| (Int Int |abi_type| |crypto_type| |tx_type| |state_type| |state_type| ) Bool) +(assert +(forall ( (abi_0 |abi_type|) (crypto_0 |crypto_type|) (error_0 Int) (state_0 |state_type|) (this_0 Int) (tx_0 |tx_type|)) +(=> (= error_0 0) (nondet_interface_1_C_16_0 error_0 this_0 abi_0 crypto_0 state_0 state_0)))) + + +(declare-fun |summary_3_function_f__15_16_0| (Int Int |abi_type| |crypto_type| |tx_type| |state_type| |state_type| ) Bool) +(declare-fun |summary_4_function_f__15_16_0| (Int Int |abi_type| |crypto_type| |tx_type| |state_type| |state_type| ) Bool) +(assert +(forall ( (abi_0 |abi_type|) (crypto_0 |crypto_type|) (error_0 Int) (error_1 Int) (state_0 |state_type|) (state_1 |state_type|) (state_2 |state_type|) (this_0 Int) (tx_0 |tx_type|)) +(=> (and (and (nondet_interface_1_C_16_0 error_0 this_0 abi_0 crypto_0 state_0 state_1) true) (and (= error_0 0) (summary_4_function_f__15_16_0 error_1 this_0 abi_0 crypto_0 tx_0 state_1 state_2))) (nondet_interface_1_C_16_0 error_1 this_0 abi_0 crypto_0 state_0 state_2)))) + + +(declare-fun |block_5_function_f__15_16_0| (Int Int |abi_type| |crypto_type| |tx_type| |state_type| |state_type| Int ) Bool) +(declare-fun |block_6_f_14_16_0| (Int Int |abi_type| |crypto_type| |tx_type| |state_type| |state_type| Int ) Bool) +(assert +(forall ( (abi_0 |abi_type|) (crypto_0 |crypto_type|) (error_0 Int) (error_1 Int) (state_0 |state_type|) (state_1 |state_type|) (state_2 |state_type|) (this_0 Int) (tx_0 |tx_type|) (x_5_0 Int) (x_5_1 Int)) +(block_5_function_f__15_16_0 error_0 this_0 abi_0 crypto_0 tx_0 state_0 state_1 x_5_1))) + + +(assert +(forall ( (abi_0 |abi_type|) (crypto_0 |crypto_type|) (error_0 Int) (error_1 Int) (state_0 |state_type|) (state_1 |state_type|) (state_2 |state_type|) (this_0 Int) (tx_0 |tx_type|) (x_5_0 Int) (x_5_1 Int)) +(=> (and (and (block_5_function_f__15_16_0 error_0 this_0 abi_0 crypto_0 tx_0 state_0 state_1 x_5_1) (and (and (and (and (= state_1 state_0) (= error_0 0)) true) true) true)) true) (block_6_f_14_16_0 error_0 this_0 abi_0 crypto_0 tx_0 state_0 state_1 x_5_1)))) + + +(declare-fun |block_7_return_function_f__15_16_0| (Int Int |abi_type| |crypto_type| |tx_type| |state_type| |state_type| Int ) Bool) +(declare-fun |block_8_function_f__15_16_0| (Int Int |abi_type| |crypto_type| |tx_type| |state_type| |state_type| Int ) Bool) +(assert +(forall ( (abi_0 |abi_type|) (crypto_0 |crypto_type|) (error_0 Int) (error_1 Int) (expr_10_0 Int) (expr_11_1 Bool) (expr_6_0 Int) (expr_9_0 Int) (state_0 |state_type|) (state_1 |state_type|) (state_2 |state_type|) (this_0 Int) (tx_0 |tx_type|) (x_5_0 Int) (x_5_1 Int) (x_5_2 Int)) +(=> (and (and (block_6_f_14_16_0 error_0 this_0 abi_0 crypto_0 tx_0 state_0 state_1 x_5_1) (and (= expr_11_1 (= expr_9_0 expr_10_0)) (and (=> true true) (and (= expr_10_0 0) (and (=> true (and (>= expr_9_0 0) (<= expr_9_0 115792089237316195423570985008687907853269984665640564039457584007913129639935))) (and (= expr_9_0 x_5_2) (and (= x_5_2 expr_6_0) (and (=> true true) (and (= expr_6_0 0) (and (= x_5_1 0) true)))))))))) (and (and true (not expr_11_1)) (= error_1 1))) (block_8_function_f__15_16_0 error_1 this_0 abi_0 crypto_0 tx_0 state_0 state_1 x_5_2)))) + + +(assert +(forall ( (abi_0 |abi_type|) (crypto_0 |crypto_type|) (error_0 Int) (error_1 Int) (expr_10_0 Int) (expr_11_1 Bool) (expr_6_0 Int) (expr_9_0 Int) (state_0 |state_type|) (state_1 |state_type|) (state_2 |state_type|) (this_0 Int) (tx_0 |tx_type|) (x_5_0 Int) (x_5_1 Int) (x_5_2 Int)) +(=> (block_8_function_f__15_16_0 error_1 this_0 abi_0 crypto_0 tx_0 state_0 state_1 x_5_2) (summary_3_function_f__15_16_0 error_1 this_0 abi_0 crypto_0 tx_0 state_0 state_1)))) + + +(assert +(forall ( (abi_0 |abi_type|) (crypto_0 |crypto_type|) (error_0 Int) (error_1 Int) (expr_10_0 Int) (expr_11_1 Bool) (expr_6_0 Int) (expr_9_0 Int) (state_0 |state_type|) (state_1 |state_type|) (state_2 |state_type|) (this_0 Int) (tx_0 |tx_type|) (x_5_0 Int) (x_5_1 Int) (x_5_2 Int)) +(=> (and (and (block_6_f_14_16_0 error_0 this_0 abi_0 crypto_0 tx_0 state_0 state_1 x_5_1) (and (= error_1 error_0) (and (= expr_11_1 (= expr_9_0 expr_10_0)) (and (=> true true) (and (= expr_10_0 0) (and (=> true (and (>= expr_9_0 0) (<= expr_9_0 115792089237316195423570985008687907853269984665640564039457584007913129639935))) (and (= expr_9_0 x_5_2) (and (= x_5_2 expr_6_0) (and (=> true true) (and (= expr_6_0 0) (and (= x_5_1 0) true))))))))))) true) (block_7_return_function_f__15_16_0 error_1 this_0 abi_0 crypto_0 tx_0 state_0 state_1 x_5_2)))) + + +(assert +(forall ( (abi_0 |abi_type|) (crypto_0 |crypto_type|) (error_0 Int) (error_1 Int) (expr_10_0 Int) (expr_11_1 Bool) (expr_6_0 Int) (expr_9_0 Int) (state_0 |state_type|) (state_1 |state_type|) (state_2 |state_type|) (this_0 Int) (tx_0 |tx_type|) (x_5_0 Int) (x_5_1 Int) (x_5_2 Int)) +(=> (and (and (block_7_return_function_f__15_16_0 error_0 this_0 abi_0 crypto_0 tx_0 state_0 state_1 x_5_1) true) true) (summary_3_function_f__15_16_0 error_0 this_0 abi_0 crypto_0 tx_0 state_0 state_1)))) + + +(declare-fun |block_9_function_f__15_16_0| (Int Int |abi_type| |crypto_type| |tx_type| |state_type| |state_type| Int ) Bool) +(assert +(forall ( (abi_0 |abi_type|) (crypto_0 |crypto_type|) (error_0 Int) (error_1 Int) (expr_10_0 Int) (expr_11_1 Bool) (expr_6_0 Int) (expr_9_0 Int) (state_0 |state_type|) (state_1 |state_type|) (state_2 |state_type|) (this_0 Int) (tx_0 |tx_type|) (x_5_0 Int) (x_5_1 Int) (x_5_2 Int)) +(block_9_function_f__15_16_0 error_0 this_0 abi_0 crypto_0 tx_0 state_0 state_1 x_5_1))) + + +(assert +(forall ( (abi_0 |abi_type|) (crypto_0 |crypto_type|) (error_0 Int) (error_1 Int) (expr_10_0 Int) (expr_11_1 Bool) (expr_6_0 Int) (expr_9_0 Int) (funds_2_0 Int) (state_0 |state_type|) (state_1 |state_type|) (state_2 |state_type|) (state_3 |state_type|) (this_0 Int) (tx_0 |tx_type|) (x_5_0 Int) (x_5_1 Int) (x_5_2 Int)) +(=> (and (and (block_9_function_f__15_16_0 error_0 this_0 abi_0 crypto_0 tx_0 state_0 state_1 x_5_1) (and (summary_3_function_f__15_16_0 error_1 this_0 abi_0 crypto_0 tx_0 state_2 state_3) (and (= state_2 (|state_type| (store (|balances| state_1) this_0 (+ (select (|balances| state_1) this_0) funds_2_0)))) (and (and (>= (+ (select (|balances| state_1) this_0) funds_2_0) 0) (<= (+ (select (|balances| state_1) this_0) funds_2_0) 115792089237316195423570985008687907853269984665640564039457584007913129639935)) (and (>= funds_2_0 (|msg.value| tx_0)) (and (and (and (and (and (and (and (and (and (and (and (and (and (> (|block.prevrandao| tx_0) 18446744073709551616) (and (>= (|block.basefee| tx_0) 0) (<= (|block.basefee| tx_0) 115792089237316195423570985008687907853269984665640564039457584007913129639935))) (and (>= (|block.chainid| tx_0) 0) (<= (|block.chainid| tx_0) 115792089237316195423570985008687907853269984665640564039457584007913129639935))) (and (>= (|block.coinbase| tx_0) 0) (<= (|block.coinbase| tx_0) 1461501637330902918203684832716283019655932542975))) (and (>= (|block.prevrandao| tx_0) 0) (<= (|block.prevrandao| tx_0) 115792089237316195423570985008687907853269984665640564039457584007913129639935))) (and (>= (|block.gaslimit| tx_0) 0) (<= (|block.gaslimit| tx_0) 115792089237316195423570985008687907853269984665640564039457584007913129639935))) (and (>= (|block.number| tx_0) 0) (<= (|block.number| tx_0) 115792089237316195423570985008687907853269984665640564039457584007913129639935))) (and (>= (|block.timestamp| tx_0) 0) (<= (|block.timestamp| tx_0) 115792089237316195423570985008687907853269984665640564039457584007913129639935))) (and (>= (|msg.sender| tx_0) 0) (<= (|msg.sender| tx_0) 1461501637330902918203684832716283019655932542975))) (and (>= (|msg.value| tx_0) 0) (<= (|msg.value| tx_0) 115792089237316195423570985008687907853269984665640564039457584007913129639935))) (and (>= (|tx.origin| tx_0) 0) (<= (|tx.origin| tx_0) 1461501637330902918203684832716283019655932542975))) (and (>= (|tx.gasprice| tx_0) 0) (<= (|tx.gasprice| tx_0) 115792089237316195423570985008687907853269984665640564039457584007913129639935))) (and (and (and (and (and (and (= (|msg.value| tx_0) 0) (= (|msg.sig| tx_0) 638722032)) (= (select (|bytes_tuple_accessor_array| (|msg.data| tx_0)) 0) 38)) (= (select (|bytes_tuple_accessor_array| (|msg.data| tx_0)) 1) 18)) (= (select (|bytes_tuple_accessor_array| (|msg.data| tx_0)) 2) 31)) (= (select (|bytes_tuple_accessor_array| (|msg.data| tx_0)) 3) 240)) (>= (|bytes_tuple_accessor_length| (|msg.data| tx_0)) 4))) (and (and (and (and (= state_1 state_0) (= error_0 0)) true) true) true))))))) true) (summary_4_function_f__15_16_0 error_1 this_0 abi_0 crypto_0 tx_0 state_0 state_3)))) + + +(assert +(forall ( (abi_0 |abi_type|) (crypto_0 |crypto_type|) (error_0 Int) (error_1 Int) (expr_10_0 Int) (expr_11_1 Bool) (expr_6_0 Int) (expr_9_0 Int) (funds_2_0 Int) (state_0 |state_type|) (state_1 |state_type|) (state_2 |state_type|) (state_3 |state_type|) (this_0 Int) (tx_0 |tx_type|) (x_5_0 Int) (x_5_1 Int) (x_5_2 Int)) +(=> (and (and (interface_0_C_16_0 this_0 abi_0 crypto_0 state_0) true) (and (summary_4_function_f__15_16_0 error_0 this_0 abi_0 crypto_0 tx_0 state_0 state_1) (= error_0 0))) (interface_0_C_16_0 this_0 abi_0 crypto_0 state_1)))) + + +(declare-fun |contract_initializer_10_C_16_0| (Int Int |abi_type| |crypto_type| |tx_type| |state_type| |state_type| ) Bool) +(declare-fun |contract_initializer_entry_11_C_16_0| (Int Int |abi_type| |crypto_type| |tx_type| |state_type| |state_type| ) Bool) +(assert +(forall ( (abi_0 |abi_type|) (crypto_0 |crypto_type|) (error_0 Int) (error_1 Int) (expr_10_0 Int) (expr_11_1 Bool) (expr_6_0 Int) (expr_9_0 Int) (funds_2_0 Int) (state_0 |state_type|) (state_1 |state_type|) (state_2 |state_type|) (state_3 |state_type|) (this_0 Int) (tx_0 |tx_type|) (x_5_0 Int) (x_5_1 Int) (x_5_2 Int)) +(=> (and (and (= state_1 state_0) (= error_0 0)) true) (contract_initializer_entry_11_C_16_0 error_0 this_0 abi_0 crypto_0 tx_0 state_0 state_1)))) + + +(declare-fun |contract_initializer_after_init_12_C_16_0| (Int Int |abi_type| |crypto_type| |tx_type| |state_type| |state_type| ) Bool) +(assert +(forall ( (abi_0 |abi_type|) (crypto_0 |crypto_type|) (error_0 Int) (error_1 Int) (expr_10_0 Int) (expr_11_1 Bool) (expr_6_0 Int) (expr_9_0 Int) (funds_2_0 Int) (state_0 |state_type|) (state_1 |state_type|) (state_2 |state_type|) (state_3 |state_type|) (this_0 Int) (tx_0 |tx_type|) (x_5_0 Int) (x_5_1 Int) (x_5_2 Int)) +(=> (and (and (contract_initializer_entry_11_C_16_0 error_0 this_0 abi_0 crypto_0 tx_0 state_0 state_1) true) true) (contract_initializer_after_init_12_C_16_0 error_0 this_0 abi_0 crypto_0 tx_0 state_0 state_1)))) + + +(assert +(forall ( (abi_0 |abi_type|) (crypto_0 |crypto_type|) (error_0 Int) (error_1 Int) (expr_10_0 Int) (expr_11_1 Bool) (expr_6_0 Int) (expr_9_0 Int) (funds_2_0 Int) (state_0 |state_type|) (state_1 |state_type|) (state_2 |state_type|) (state_3 |state_type|) (this_0 Int) (tx_0 |tx_type|) (x_5_0 Int) (x_5_1 Int) (x_5_2 Int)) +(=> (and (and (contract_initializer_after_init_12_C_16_0 error_0 this_0 abi_0 crypto_0 tx_0 state_0 state_1) true) true) (contract_initializer_10_C_16_0 error_0 this_0 abi_0 crypto_0 tx_0 state_0 state_1)))) + + +(declare-fun |implicit_constructor_entry_13_C_16_0| (Int Int |abi_type| |crypto_type| |tx_type| |state_type| |state_type| ) Bool) +(assert +(forall ( (abi_0 |abi_type|) (crypto_0 |crypto_type|) (error_0 Int) (error_1 Int) (expr_10_0 Int) (expr_11_1 Bool) (expr_6_0 Int) (expr_9_0 Int) (funds_2_0 Int) (state_0 |state_type|) (state_1 |state_type|) (state_2 |state_type|) (state_3 |state_type|) (this_0 Int) (tx_0 |tx_type|) (x_5_0 Int) (x_5_1 Int) (x_5_2 Int)) +(=> (and (and (and (and (and (= state_1 state_0) (= error_0 0)) true) true) true) (>= (select (|balances| state_1) this_0) (|msg.value| tx_0))) (implicit_constructor_entry_13_C_16_0 error_0 this_0 abi_0 crypto_0 tx_0 state_0 state_1)))) + + +(assert +(forall ( (abi_0 |abi_type|) (crypto_0 |crypto_type|) (error_0 Int) (error_1 Int) (expr_10_0 Int) (expr_11_1 Bool) (expr_6_0 Int) (expr_9_0 Int) (funds_2_0 Int) (state_0 |state_type|) (state_1 |state_type|) (state_2 |state_type|) (state_3 |state_type|) (this_0 Int) (tx_0 |tx_type|) (x_5_0 Int) (x_5_1 Int) (x_5_2 Int)) +(=> (and (and (implicit_constructor_entry_13_C_16_0 error_0 this_0 abi_0 crypto_0 tx_0 state_0 state_1) (and (contract_initializer_10_C_16_0 error_1 this_0 abi_0 crypto_0 tx_0 state_1 state_2) true)) (> error_1 0)) (summary_constructor_2_C_16_0 error_1 this_0 abi_0 crypto_0 tx_0 state_0 state_2)))) + + +(assert +(forall ( (abi_0 |abi_type|) (crypto_0 |crypto_type|) (error_0 Int) (error_1 Int) (expr_10_0 Int) (expr_11_1 Bool) (expr_6_0 Int) (expr_9_0 Int) (funds_2_0 Int) (state_0 |state_type|) (state_1 |state_type|) (state_2 |state_type|) (state_3 |state_type|) (this_0 Int) (tx_0 |tx_type|) (x_5_0 Int) (x_5_1 Int) (x_5_2 Int)) +(=> (and (and (implicit_constructor_entry_13_C_16_0 error_0 this_0 abi_0 crypto_0 tx_0 state_0 state_1) (and (= error_1 0) (and (contract_initializer_10_C_16_0 error_1 this_0 abi_0 crypto_0 tx_0 state_1 state_2) true))) true) (summary_constructor_2_C_16_0 error_1 this_0 abi_0 crypto_0 tx_0 state_0 state_2)))) + + +(assert +(forall ( (abi_0 |abi_type|) (crypto_0 |crypto_type|) (error_0 Int) (error_1 Int) (expr_10_0 Int) (expr_11_1 Bool) (expr_6_0 Int) (expr_9_0 Int) (funds_2_0 Int) (state_0 |state_type|) (state_1 |state_type|) (state_2 |state_type|) (state_3 |state_type|) (this_0 Int) (tx_0 |tx_type|) (x_5_0 Int) (x_5_1 Int) (x_5_2 Int)) +(=> (and (and (summary_constructor_2_C_16_0 error_0 this_0 abi_0 crypto_0 tx_0 state_0 state_1) true) (and (and (and (and (and (and (and (and (and (and (and (and (and (> (|block.prevrandao| tx_0) 18446744073709551616) (and (>= (|block.basefee| tx_0) 0) (<= (|block.basefee| tx_0) 115792089237316195423570985008687907853269984665640564039457584007913129639935))) (and (>= (|block.chainid| tx_0) 0) (<= (|block.chainid| tx_0) 115792089237316195423570985008687907853269984665640564039457584007913129639935))) (and (>= (|block.coinbase| tx_0) 0) (<= (|block.coinbase| tx_0) 1461501637330902918203684832716283019655932542975))) (and (>= (|block.prevrandao| tx_0) 0) (<= (|block.prevrandao| tx_0) 115792089237316195423570985008687907853269984665640564039457584007913129639935))) (and (>= (|block.gaslimit| tx_0) 0) (<= (|block.gaslimit| tx_0) 115792089237316195423570985008687907853269984665640564039457584007913129639935))) (and (>= (|block.number| tx_0) 0) (<= (|block.number| tx_0) 115792089237316195423570985008687907853269984665640564039457584007913129639935))) (and (>= (|block.timestamp| tx_0) 0) (<= (|block.timestamp| tx_0) 115792089237316195423570985008687907853269984665640564039457584007913129639935))) (and (>= (|msg.sender| tx_0) 0) (<= (|msg.sender| tx_0) 1461501637330902918203684832716283019655932542975))) (and (>= (|msg.value| tx_0) 0) (<= (|msg.value| tx_0) 115792089237316195423570985008687907853269984665640564039457584007913129639935))) (and (>= (|tx.origin| tx_0) 0) (<= (|tx.origin| tx_0) 1461501637330902918203684832716283019655932542975))) (and (>= (|tx.gasprice| tx_0) 0) (<= (|tx.gasprice| tx_0) 115792089237316195423570985008687907853269984665640564039457584007913129639935))) (= (|msg.value| tx_0) 0)) (= error_0 0))) (interface_0_C_16_0 this_0 abi_0 crypto_0 state_1)))) + + +(declare-fun |error_target_3_0| () Bool) +(assert +(forall ( (abi_0 |abi_type|) (crypto_0 |crypto_type|) (error_0 Int) (error_1 Int) (expr_10_0 Int) (expr_11_1 Bool) (expr_6_0 Int) (expr_9_0 Int) (funds_2_0 Int) (state_0 |state_type|) (state_1 |state_type|) (state_2 |state_type|) (state_3 |state_type|) (this_0 Int) (tx_0 |tx_type|) (x_5_0 Int) (x_5_1 Int) (x_5_2 Int)) +(=> (and (and (interface_0_C_16_0 this_0 abi_0 crypto_0 state_0) true) (and (summary_4_function_f__15_16_0 error_0 this_0 abi_0 crypto_0 tx_0 state_0 state_1) (= error_0 1))) error_target_3_0))) + + + +(assert +(forall ( (abi_0 |abi_type|) (crypto_0 |crypto_type|) (error_0 Int) (error_1 Int) (expr_10_0 Int) (expr_11_1 Bool) (expr_6_0 Int) (expr_9_0 Int) (funds_2_0 Int) (state_0 |state_type|) (state_1 |state_type|) (state_2 |state_type|) (state_3 |state_type|) (this_0 Int) (tx_0 |tx_type|) (x_5_0 Int) (x_5_1 Int) (x_5_2 Int)) +(=> error_target_3_0 false))) +(check-sat) + + +Warning: CHC: 1 verification condition(s) could not be proved. Enable the model checker option "show unproved" to see all of them. Consider choosing a specific contract to be verified in order to reduce the solving problems. Consider increasing the timeout per query. + +Warning: CHC analysis was not possible. No Horn solver was available. None of the installed solvers was enabled. diff --git a/test/cmdlineTests/model_checker_print_query_chc/input.sol b/test/cmdlineTests/model_checker_print_query_chc/input.sol new file mode 100644 index 000000000000..eb4cd572ae22 --- /dev/null +++ b/test/cmdlineTests/model_checker_print_query_chc/input.sol @@ -0,0 +1,9 @@ +// SPDX-License-Identifier: GPL-3.0 +pragma solidity >=0.0; +contract C +{ + function f() public pure { + uint x = 0; + assert(x == 0); + } +} diff --git a/test/cmdlineTests/model_checker_print_query_no_smtlib2_solver_bmc/args b/test/cmdlineTests/model_checker_print_query_no_smtlib2_solver_bmc/args new file mode 100644 index 000000000000..12b7c324584b --- /dev/null +++ b/test/cmdlineTests/model_checker_print_query_no_smtlib2_solver_bmc/args @@ -0,0 +1 @@ +--model-checker-engine bmc --model-checker-print-query --model-checker-solvers z3 diff --git a/test/cmdlineTests/model_checker_print_query_no_smtlib2_solver_bmc/err b/test/cmdlineTests/model_checker_print_query_no_smtlib2_solver_bmc/err new file mode 100644 index 000000000000..db94bc9ba505 --- /dev/null +++ b/test/cmdlineTests/model_checker_print_query_no_smtlib2_solver_bmc/err @@ -0,0 +1 @@ +Only SMTLib2 solver can be enabled to print queries diff --git a/test/cmdlineTests/evm_to_wasm_unsupported_translation/exit b/test/cmdlineTests/model_checker_print_query_no_smtlib2_solver_bmc/exit similarity index 100% rename from test/cmdlineTests/evm_to_wasm_unsupported_translation/exit rename to test/cmdlineTests/model_checker_print_query_no_smtlib2_solver_bmc/exit diff --git a/test/cmdlineTests/model_checker_print_query_no_smtlib2_solver_bmc/input.sol b/test/cmdlineTests/model_checker_print_query_no_smtlib2_solver_bmc/input.sol new file mode 100644 index 000000000000..eb4cd572ae22 --- /dev/null +++ b/test/cmdlineTests/model_checker_print_query_no_smtlib2_solver_bmc/input.sol @@ -0,0 +1,9 @@ +// SPDX-License-Identifier: GPL-3.0 +pragma solidity >=0.0; +contract C +{ + function f() public pure { + uint x = 0; + assert(x == 0); + } +} diff --git a/test/cmdlineTests/model_checker_print_query_no_smtlib2_solver_chc/args b/test/cmdlineTests/model_checker_print_query_no_smtlib2_solver_chc/args new file mode 100644 index 000000000000..e3a8c32d4716 --- /dev/null +++ b/test/cmdlineTests/model_checker_print_query_no_smtlib2_solver_chc/args @@ -0,0 +1 @@ +--model-checker-engine chc --model-checker-print-query --model-checker-solvers z3 diff --git a/test/cmdlineTests/model_checker_print_query_no_smtlib2_solver_chc/err b/test/cmdlineTests/model_checker_print_query_no_smtlib2_solver_chc/err new file mode 100644 index 000000000000..db94bc9ba505 --- /dev/null +++ b/test/cmdlineTests/model_checker_print_query_no_smtlib2_solver_chc/err @@ -0,0 +1 @@ +Only SMTLib2 solver can be enabled to print queries diff --git a/test/cmdlineTests/output_selection_ewasm_ir_only/exit b/test/cmdlineTests/model_checker_print_query_no_smtlib2_solver_chc/exit similarity index 100% rename from test/cmdlineTests/output_selection_ewasm_ir_only/exit rename to test/cmdlineTests/model_checker_print_query_no_smtlib2_solver_chc/exit diff --git a/test/cmdlineTests/model_checker_print_query_no_smtlib2_solver_chc/input.sol b/test/cmdlineTests/model_checker_print_query_no_smtlib2_solver_chc/input.sol new file mode 100644 index 000000000000..eb4cd572ae22 --- /dev/null +++ b/test/cmdlineTests/model_checker_print_query_no_smtlib2_solver_chc/input.sol @@ -0,0 +1,9 @@ +// SPDX-License-Identifier: GPL-3.0 +pragma solidity >=0.0; +contract C +{ + function f() public pure { + uint x = 0; + assert(x == 0); + } +} diff --git a/test/cmdlineTests/model_checker_print_query_superflous_solver/args b/test/cmdlineTests/model_checker_print_query_superflous_solver/args new file mode 100644 index 000000000000..64e5d88728ea --- /dev/null +++ b/test/cmdlineTests/model_checker_print_query_superflous_solver/args @@ -0,0 +1 @@ +--model-checker-engine bmc --model-checker-print-query --model-checker-solvers z3,smtlib2 diff --git a/test/cmdlineTests/model_checker_print_query_superflous_solver/err b/test/cmdlineTests/model_checker_print_query_superflous_solver/err new file mode 100644 index 000000000000..db94bc9ba505 --- /dev/null +++ b/test/cmdlineTests/model_checker_print_query_superflous_solver/err @@ -0,0 +1 @@ +Only SMTLib2 solver can be enabled to print queries diff --git a/test/cmdlineTests/strict_asm_invalid_option_optimize_yul/exit b/test/cmdlineTests/model_checker_print_query_superflous_solver/exit similarity index 100% rename from test/cmdlineTests/strict_asm_invalid_option_optimize_yul/exit rename to test/cmdlineTests/model_checker_print_query_superflous_solver/exit diff --git a/test/cmdlineTests/model_checker_print_query_superflous_solver/input.sol b/test/cmdlineTests/model_checker_print_query_superflous_solver/input.sol new file mode 100644 index 000000000000..eb4cd572ae22 --- /dev/null +++ b/test/cmdlineTests/model_checker_print_query_superflous_solver/input.sol @@ -0,0 +1,9 @@ +// SPDX-License-Identifier: GPL-3.0 +pragma solidity >=0.0; +contract C +{ + function f() public pure { + uint x = 0; + assert(x == 0); + } +} diff --git a/test/cmdlineTests/optimizer_enabled_invalid_yul_optimizer_enabled_and_disabled/args b/test/cmdlineTests/optimizer_enabled_invalid_yul_optimizer_enabled_and_disabled/args new file mode 100644 index 000000000000..ce566d3e0d9e --- /dev/null +++ b/test/cmdlineTests/optimizer_enabled_invalid_yul_optimizer_enabled_and_disabled/args @@ -0,0 +1 @@ +--optimize-yul --no-optimize-yul diff --git a/test/cmdlineTests/optimizer_enabled_invalid_yul_optimizer_enabled_and_disabled/err b/test/cmdlineTests/optimizer_enabled_invalid_yul_optimizer_enabled_and_disabled/err new file mode 100644 index 000000000000..43c54c2f3934 --- /dev/null +++ b/test/cmdlineTests/optimizer_enabled_invalid_yul_optimizer_enabled_and_disabled/err @@ -0,0 +1 @@ +Options --optimize-yul and --no-optimize-yul cannot be used together. diff --git a/test/cmdlineTests/optimizer_enabled_invalid_yul_optimizer_enabled_and_disabled/exit b/test/cmdlineTests/optimizer_enabled_invalid_yul_optimizer_enabled_and_disabled/exit new file mode 100644 index 000000000000..d00491fd7e5b --- /dev/null +++ b/test/cmdlineTests/optimizer_enabled_invalid_yul_optimizer_enabled_and_disabled/exit @@ -0,0 +1 @@ +1 diff --git a/test/cmdlineTests/optimizer_enabled_invalid_yul_optimizer_enabled_and_disabled/input.sol b/test/cmdlineTests/optimizer_enabled_invalid_yul_optimizer_enabled_and_disabled/input.sol new file mode 100644 index 000000000000..a32f63f78ff2 --- /dev/null +++ b/test/cmdlineTests/optimizer_enabled_invalid_yul_optimizer_enabled_and_disabled/input.sol @@ -0,0 +1,2 @@ +// SPDX-License-Identifier: GPL-3.0 +pragma solidity *; diff --git a/test/cmdlineTests/output_selection_ewasm_ir_only/args b/test/cmdlineTests/output_selection_ewasm_ir_only/args deleted file mode 100644 index bccff6085e10..000000000000 --- a/test/cmdlineTests/output_selection_ewasm_ir_only/args +++ /dev/null @@ -1 +0,0 @@ ---optimize --ewasm-ir diff --git a/test/cmdlineTests/output_selection_ewasm_ir_only/err b/test/cmdlineTests/output_selection_ewasm_ir_only/err deleted file mode 100644 index 52dd265b5dbd..000000000000 --- a/test/cmdlineTests/output_selection_ewasm_ir_only/err +++ /dev/null @@ -1 +0,0 @@ -The following outputs are not supported in compiler mode: --ewasm-ir. diff --git a/test/cmdlineTests/output_selection_ewasm_ir_only/input.sol b/test/cmdlineTests/output_selection_ewasm_ir_only/input.sol deleted file mode 100644 index 9755e16e71db..000000000000 --- a/test/cmdlineTests/output_selection_ewasm_ir_only/input.sol +++ /dev/null @@ -1,4 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0 -pragma solidity *; - -contract C {} diff --git a/test/cmdlineTests/standard_cli_output_selection_invalid/args b/test/cmdlineTests/standard_cli_output_selection_invalid/args index 538c8709722d..691b7fa54acd 100644 --- a/test/cmdlineTests/standard_cli_output_selection_invalid/args +++ b/test/cmdlineTests/standard_cli_output_selection_invalid/args @@ -1 +1 @@ ---ast-compact-json --asm --asm-json --opcodes --bin --bin-runtime --abi --ir --ir-optimized --ewasm --ewasm-ir --hashes --userdoc --devdoc --metadata --storage-layout +--ast-compact-json --asm --asm-json --opcodes --bin --bin-runtime --abi --ir --ir-optimized --hashes --userdoc --devdoc --metadata --storage-layout diff --git a/test/cmdlineTests/standard_cli_output_selection_invalid/err b/test/cmdlineTests/standard_cli_output_selection_invalid/err index e9d24e61d486..ead982255667 100644 --- a/test/cmdlineTests/standard_cli_output_selection_invalid/err +++ b/test/cmdlineTests/standard_cli_output_selection_invalid/err @@ -1 +1 @@ -The following outputs are not supported in standard JSON mode: --abi, --asm, --asm-json, --ast-compact-json, --bin, --bin-runtime, --devdoc, --ewasm, --ewasm-ir, --hashes, --ir, --ir-optimized, --metadata, --opcodes, --storage-layout, --userdoc. +The following outputs are not supported in standard JSON mode: --abi, --asm, --asm-json, --ast-compact-json, --bin, --bin-runtime, --devdoc, --hashes, --ir, --ir-optimized, --metadata, --opcodes, --storage-layout, --userdoc. diff --git a/test/cmdlineTests/standard_empty_file_name/output.json b/test/cmdlineTests/standard_empty_file_name/output.json index e419d0a5eec0..4e4d84c41c75 100644 --- a/test/cmdlineTests/standard_empty_file_name/output.json +++ b/test/cmdlineTests/standard_empty_file_name/output.json @@ -18,11 +18,5 @@ "type": "DeclarationError" } ], - "sources": - { - "": - { - "id": 0 - } - } + "sources": {} } diff --git a/test/cmdlineTests/standard_ewasm_requested/input.json b/test/cmdlineTests/standard_ewasm_requested/input.json deleted file mode 100644 index 53dcc68eefe7..000000000000 --- a/test/cmdlineTests/standard_ewasm_requested/input.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "language": "Solidity", - "sources": - { - "A": - { - "content": "// SPDX-License-Identifier: GPL-3.0\npragma solidity >=0.0; pragma abicoder v2; contract C { }" - } - }, - "settings": - { - "optimizer": - { - "enabled": true, - "details": {"yul": true} - }, - "outputSelection": - { - "*": { "*": ["ewasm.wast", "ewasm.wasm"] } - } - } -} diff --git a/test/cmdlineTests/standard_ewasm_requested/output.json b/test/cmdlineTests/standard_ewasm_requested/output.json deleted file mode 100644 index 1db94af7d10d..000000000000 --- a/test/cmdlineTests/standard_ewasm_requested/output.json +++ /dev/null @@ -1,176 +0,0 @@ -{ - "contracts": - { - "A": - { - "C": - { - "ewasm": - { - "wasm": "", - "wast": "(module - ;; custom section for sub-module - ;; The Keccak-256 hash of the text representation of - ;; (@custom \"C_3_deployed\" \"\") - (import \"ethereum\" \"codeCopy\" (func $eth.codeCopy (param i32 i32 i32))) - (import \"ethereum\" \"revert\" (func $eth.revert (param i32 i32))) - (import \"ethereum\" \"getCallValue\" (func $eth.getCallValue (param i32))) - (import \"ethereum\" \"finish\" (func $eth.finish (param i32 i32))) - (memory $memory (export \"memory\") 1) - (export \"main\" (func $main)) - -(func $main - (local $p i32) - (local $r i32) - (local $hi i64) - (local $y i64) - (local $z3 i64) - (local $_1 i64) - (block $label_ - (local.set $p (call $u256_to_i32_716)) - (local.set $r (i32.add (local.get $p) (i32.const 64))) - (if (i32.lt_u (local.get $r) (local.get $p)) (then - (unreachable))) - (local.set $hi (i64.shl (i64.extend_i32_u (call $bswap32 (i32.wrap_i64 (i64.const 0)))) (i64.const 32))) - (local.set $y (i64.or (local.get $hi) (i64.extend_i32_u (call $bswap32 (i32.wrap_i64 (i64.shr_u (i64.const 0) (i64.const 32))))))) - (i64.store (local.get $r) (local.get $y)) - (i64.store (i32.add (local.get $r) (i32.const 8)) (local.get $y)) - (i64.store (i32.add (local.get $r) (i32.const 16)) (local.get $y)) - (i64.store (i32.add (local.get $r) (i32.const 24)) (call $bswap64)) - (call $eth.getCallValue (i32.const 0)) - (local.set $z3 (i64.load (i32.const 8))) - (if (i32.eqz (i64.eqz (i64.or (i64.or (i64.const 0) (i64.const 0)) (i64.or (local.get $z3) (i64.load (i32.const 0)))))) (then - (call $eth.revert (call $to_internal_i32ptr_334) (call $u256_to_i32_333)))) - (local.set $_1 (datasize \"C_3_deployed\")) - (call $eth.codeCopy (call $to_internal_i32ptr) (call $u256_to_i32 (dataoffset \"C_3_deployed\")) (call $u256_to_i32 (local.get $_1))) - (call $eth.finish (call $to_internal_i32ptr) (call $u256_to_i32 (local.get $_1))) - ) -) - -(func $u256_to_i32_333 - (result i32) - (local $v i32) - (local $_1 i64) - (block $label__1 - (local.set $_1 (i64.const 0)) - (if (i64.ne (local.get $_1) (i64.or (i64.or (local.get $_1) (local.get $_1)) (local.get $_1))) (then - (unreachable))) - (if (i64.ne (local.get $_1) (i64.shr_u (local.get $_1) (i64.const 32))) (then - (unreachable))) - (local.set $v (i32.wrap_i64 (local.get $_1))) - - ) - (local.get $v) -) - -(func $u256_to_i32 - (param $x4 i64) - (result i32) - (local $v i32) - (block $label__2 - (if (i64.ne (i64.const 0) (i64.or (i64.or (i64.const 0) (i64.const 0)) (i64.const 0))) (then - (unreachable))) - (if (i64.ne (i64.const 0) (i64.shr_u (local.get $x4) (i64.const 32))) (then - (unreachable))) - (local.set $v (i32.wrap_i64 (local.get $x4))) - - ) - (local.get $v) -) - -(func $u256_to_i32_716 - (result i32) - (local $v i32) - (block $label__3 - (if (i64.ne (i64.const 0) (i64.or (i64.or (i64.const 0) (i64.const 0)) (i64.const 0))) (then - (unreachable))) - (if (i64.ne (i64.const 0) (i64.shr_u (i64.const 64) (i64.const 32))) (then - (unreachable))) - (local.set $v (i32.wrap_i64 (i64.const 64))) - - ) - (local.get $v) -) - -(func $to_internal_i32ptr_334 - (result i32) - (local $r i32) - (local $p i32) - (block $label__4 - (local.set $p (call $u256_to_i32_333)) - (local.set $r (i32.add (local.get $p) (i32.const 64))) - (if (i32.lt_u (local.get $r) (local.get $p)) (then - (unreachable))) - - ) - (local.get $r) -) - -(func $to_internal_i32ptr - (result i32) - (local $r i32) - (local $v i32) - (block $label__5 - (if (i64.ne (i64.const 0) (i64.or (i64.or (i64.const 0) (i64.const 0)) (i64.const 0))) (then - (unreachable))) - (if (i64.ne (i64.const 0) (i64.shr_u (i64.const 128) (i64.const 32))) (then - (unreachable))) - (local.set $v (i32.wrap_i64 (i64.const 128))) - (local.set $r (i32.add (local.get $v) (i32.const 64))) - (if (i32.lt_u (local.get $r) (local.get $v)) (then - (unreachable))) - - ) - (local.get $r) -) - -(func $bswap16 - (param $x i32) - (result i32) - (local $y i32) - (block $label__6 - (local.set $y (i32.or (i32.and (i32.shl (local.get $x) (i32.const 8)) (i32.const 65280)) (i32.and (i32.shr_u (local.get $x) (i32.const 8)) (i32.const 255)))) - - ) - (local.get $y) -) - -(func $bswap32 - (param $x i32) - (result i32) - (local $y i32) - (local $hi i32) - (block $label__7 - (local.set $hi (i32.shl (call $bswap16 (local.get $x)) (i32.const 16))) - (local.set $y (i32.or (local.get $hi) (call $bswap16 (i32.shr_u (local.get $x) (i32.const 16))))) - - ) - (local.get $y) -) - -(func $bswap64 - (result i64) - (local $y i64) - (local $hi i64) - (block $label__8 - (local.set $hi (i64.shl (i64.extend_i32_u (call $bswap32 (i32.wrap_i64 (i64.const 128)))) (i64.const 32))) - (local.set $y (i64.or (local.get $hi) (i64.extend_i32_u (call $bswap32 (i32.wrap_i64 (i64.shr_u (i64.const 128) (i64.const 32))))))) - - ) - (local.get $y) -) - -) -" - } - } - } - }, - "sources": - { - "A": - { - "id": 0 - } - } -} diff --git a/test/cmdlineTests/standard_ewasm_requested_abstract/input.json b/test/cmdlineTests/standard_ewasm_requested_abstract/input.json deleted file mode 100644 index 2ee666fe2d58..000000000000 --- a/test/cmdlineTests/standard_ewasm_requested_abstract/input.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "language": "Solidity", - "sources": - { - "A": - { - "content": "// SPDX-License-Identifier: GPL-3.0\npragma solidity >=0.0; pragma abicoder v2; abstract contract C { }" - } - }, - "settings": - { - "optimizer": - { - "enabled": true, - "details": {"yul": true} - }, - "outputSelection": - { - "*": { "*": ["ewasm.wast", "ewasm.wasm"] } - } - } -} diff --git a/test/cmdlineTests/standard_ewasm_requested_abstract/output.json b/test/cmdlineTests/standard_ewasm_requested_abstract/output.json deleted file mode 100644 index 14a4ef2df946..000000000000 --- a/test/cmdlineTests/standard_ewasm_requested_abstract/output.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "contracts": - { - "A": - { - "C": - { - "ewasm": - { - "wasm": "", - "wast": "" - } - } - } - }, - "sources": - { - "A": - { - "id": 0 - } - } -} diff --git a/test/cmdlineTests/standard_generatedSources/output.json b/test/cmdlineTests/standard_generatedSources/output.json index e56ddaa80a96..350d108991bd 100644 --- a/test/cmdlineTests/standard_generatedSources/output.json +++ b/test/cmdlineTests/standard_generatedSources/output.json @@ -19,6 +19,7 @@ { "ast": { + "nativeSrc": "0:3989:1", "nodeType": "YulBlock", "src": "0:3989:1", "statements": @@ -26,11 +27,13 @@ { "body": { + "nativeSrc": "47:35:1", "nodeType": "YulBlock", "src": "47:35:1", "statements": [ { + "nativeSrc": "57:19:1", "nodeType": "YulAssignment", "src": "57:19:1", "value": @@ -39,6 +42,7 @@ [ { "kind": "number", + "nativeSrc": "73:2:1", "nodeType": "YulLiteral", "src": "73:2:1", "type": "", @@ -48,9 +52,11 @@ "functionName": { "name": "mload", + "nativeSrc": "67:5:1", "nodeType": "YulIdentifier", "src": "67:5:1" }, + "nativeSrc": "67:9:1", "nodeType": "YulFunctionCall", "src": "67:9:1" }, @@ -58,6 +64,7 @@ [ { "name": "memPtr", + "nativeSrc": "57:6:1", "nodeType": "YulIdentifier", "src": "57:6:1" } @@ -66,11 +73,13 @@ ] }, "name": "allocate_unbounded", + "nativeSrc": "7:75:1", "nodeType": "YulFunctionDefinition", "returnVariables": [ { "name": "memPtr", + "nativeSrc": "40:6:1", "nodeType": "YulTypedName", "src": "40:6:1", "type": "" @@ -81,6 +90,7 @@ { "body": { + "nativeSrc": "177:28:1", "nodeType": "YulBlock", "src": "177:28:1", "statements": @@ -92,6 +102,7 @@ [ { "kind": "number", + "nativeSrc": "194:1:1", "nodeType": "YulLiteral", "src": "194:1:1", "type": "", @@ -99,6 +110,7 @@ }, { "kind": "number", + "nativeSrc": "197:1:1", "nodeType": "YulLiteral", "src": "197:1:1", "type": "", @@ -108,24 +120,29 @@ "functionName": { "name": "revert", + "nativeSrc": "187:6:1", "nodeType": "YulIdentifier", "src": "187:6:1" }, + "nativeSrc": "187:12:1", "nodeType": "YulFunctionCall", "src": "187:12:1" }, + "nativeSrc": "187:12:1", "nodeType": "YulExpressionStatement", "src": "187:12:1" } ] }, "name": "revert_error_dbdddcbe895c83990c08b3492a0e83918d802a52331272ac6fdb6a7c4aea3b1b", + "nativeSrc": "88:117:1", "nodeType": "YulFunctionDefinition", "src": "88:117:1" }, { "body": { + "nativeSrc": "300:28:1", "nodeType": "YulBlock", "src": "300:28:1", "statements": @@ -137,6 +154,7 @@ [ { "kind": "number", + "nativeSrc": "317:1:1", "nodeType": "YulLiteral", "src": "317:1:1", "type": "", @@ -144,6 +162,7 @@ }, { "kind": "number", + "nativeSrc": "320:1:1", "nodeType": "YulLiteral", "src": "320:1:1", "type": "", @@ -153,24 +172,29 @@ "functionName": { "name": "revert", + "nativeSrc": "310:6:1", "nodeType": "YulIdentifier", "src": "310:6:1" }, + "nativeSrc": "310:12:1", "nodeType": "YulFunctionCall", "src": "310:12:1" }, + "nativeSrc": "310:12:1", "nodeType": "YulExpressionStatement", "src": "310:12:1" } ] }, "name": "revert_error_c1322bf8034eace5e0b5c7295db60986aa89aae5e0ea0873e4689e076861a5db", + "nativeSrc": "211:117:1", "nodeType": "YulFunctionDefinition", "src": "211:117:1" }, { "body": { + "nativeSrc": "423:28:1", "nodeType": "YulBlock", "src": "423:28:1", "statements": @@ -182,6 +206,7 @@ [ { "kind": "number", + "nativeSrc": "440:1:1", "nodeType": "YulLiteral", "src": "440:1:1", "type": "", @@ -189,6 +214,7 @@ }, { "kind": "number", + "nativeSrc": "443:1:1", "nodeType": "YulLiteral", "src": "443:1:1", "type": "", @@ -198,29 +224,35 @@ "functionName": { "name": "revert", + "nativeSrc": "433:6:1", "nodeType": "YulIdentifier", "src": "433:6:1" }, + "nativeSrc": "433:12:1", "nodeType": "YulFunctionCall", "src": "433:12:1" }, + "nativeSrc": "433:12:1", "nodeType": "YulExpressionStatement", "src": "433:12:1" } ] }, "name": "revert_error_1b9f4a0a5773e33b91aa01db23bf8c55fce1411167c872835e7fa00a4f17d46d", + "nativeSrc": "334:117:1", "nodeType": "YulFunctionDefinition", "src": "334:117:1" }, { "body": { + "nativeSrc": "505:54:1", "nodeType": "YulBlock", "src": "505:54:1", "statements": [ { + "nativeSrc": "515:38:1", "nodeType": "YulAssignment", "src": "515:38:1", "value": @@ -232,11 +264,13 @@ [ { "name": "value", + "nativeSrc": "533:5:1", "nodeType": "YulIdentifier", "src": "533:5:1" }, { "kind": "number", + "nativeSrc": "540:2:1", "nodeType": "YulLiteral", "src": "540:2:1", "type": "", @@ -246,9 +280,11 @@ "functionName": { "name": "add", + "nativeSrc": "529:3:1", "nodeType": "YulIdentifier", "src": "529:3:1" }, + "nativeSrc": "529:14:1", "nodeType": "YulFunctionCall", "src": "529:14:1" }, @@ -257,6 +293,7 @@ [ { "kind": "number", + "nativeSrc": "549:2:1", "nodeType": "YulLiteral", "src": "549:2:1", "type": "", @@ -266,9 +303,11 @@ "functionName": { "name": "not", + "nativeSrc": "545:3:1", "nodeType": "YulIdentifier", "src": "545:3:1" }, + "nativeSrc": "545:7:1", "nodeType": "YulFunctionCall", "src": "545:7:1" } @@ -276,9 +315,11 @@ "functionName": { "name": "and", + "nativeSrc": "525:3:1", "nodeType": "YulIdentifier", "src": "525:3:1" }, + "nativeSrc": "525:28:1", "nodeType": "YulFunctionCall", "src": "525:28:1" }, @@ -286,6 +327,7 @@ [ { "name": "result", + "nativeSrc": "515:6:1", "nodeType": "YulIdentifier", "src": "515:6:1" } @@ -294,11 +336,13 @@ ] }, "name": "round_up_to_mul_of_32", + "nativeSrc": "457:102:1", "nodeType": "YulFunctionDefinition", "parameters": [ { "name": "value", + "nativeSrc": "488:5:1", "nodeType": "YulTypedName", "src": "488:5:1", "type": "" @@ -308,6 +352,7 @@ [ { "name": "result", + "nativeSrc": "498:6:1", "nodeType": "YulTypedName", "src": "498:6:1", "type": "" @@ -318,6 +363,7 @@ { "body": { + "nativeSrc": "593:152:1", "nodeType": "YulBlock", "src": "593:152:1", "statements": @@ -329,6 +375,7 @@ [ { "kind": "number", + "nativeSrc": "610:1:1", "nodeType": "YulLiteral", "src": "610:1:1", "type": "", @@ -336,6 +383,7 @@ }, { "kind": "number", + "nativeSrc": "613:77:1", "nodeType": "YulLiteral", "src": "613:77:1", "type": "", @@ -345,12 +393,15 @@ "functionName": { "name": "mstore", + "nativeSrc": "603:6:1", "nodeType": "YulIdentifier", "src": "603:6:1" }, + "nativeSrc": "603:88:1", "nodeType": "YulFunctionCall", "src": "603:88:1" }, + "nativeSrc": "603:88:1", "nodeType": "YulExpressionStatement", "src": "603:88:1" }, @@ -361,6 +412,7 @@ [ { "kind": "number", + "nativeSrc": "707:1:1", "nodeType": "YulLiteral", "src": "707:1:1", "type": "", @@ -368,6 +420,7 @@ }, { "kind": "number", + "nativeSrc": "710:4:1", "nodeType": "YulLiteral", "src": "710:4:1", "type": "", @@ -377,12 +430,15 @@ "functionName": { "name": "mstore", + "nativeSrc": "700:6:1", "nodeType": "YulIdentifier", "src": "700:6:1" }, + "nativeSrc": "700:15:1", "nodeType": "YulFunctionCall", "src": "700:15:1" }, + "nativeSrc": "700:15:1", "nodeType": "YulExpressionStatement", "src": "700:15:1" }, @@ -393,6 +449,7 @@ [ { "kind": "number", + "nativeSrc": "731:1:1", "nodeType": "YulLiteral", "src": "731:1:1", "type": "", @@ -400,6 +457,7 @@ }, { "kind": "number", + "nativeSrc": "734:4:1", "nodeType": "YulLiteral", "src": "734:4:1", "type": "", @@ -409,29 +467,35 @@ "functionName": { "name": "revert", + "nativeSrc": "724:6:1", "nodeType": "YulIdentifier", "src": "724:6:1" }, + "nativeSrc": "724:15:1", "nodeType": "YulFunctionCall", "src": "724:15:1" }, + "nativeSrc": "724:15:1", "nodeType": "YulExpressionStatement", "src": "724:15:1" } ] }, "name": "panic_error_0x41", + "nativeSrc": "565:180:1", "nodeType": "YulFunctionDefinition", "src": "565:180:1" }, { "body": { + "nativeSrc": "794:238:1", "nodeType": "YulBlock", "src": "794:238:1", "statements": [ { + "nativeSrc": "804:58:1", "nodeType": "YulVariableDeclaration", "src": "804:58:1", "value": @@ -440,6 +504,7 @@ [ { "name": "memPtr", + "nativeSrc": "826:6:1", "nodeType": "YulIdentifier", "src": "826:6:1" }, @@ -448,6 +513,7 @@ [ { "name": "size", + "nativeSrc": "856:4:1", "nodeType": "YulIdentifier", "src": "856:4:1" } @@ -455,9 +521,11 @@ "functionName": { "name": "round_up_to_mul_of_32", + "nativeSrc": "834:21:1", "nodeType": "YulIdentifier", "src": "834:21:1" }, + "nativeSrc": "834:27:1", "nodeType": "YulFunctionCall", "src": "834:27:1" } @@ -465,9 +533,11 @@ "functionName": { "name": "add", + "nativeSrc": "822:3:1", "nodeType": "YulIdentifier", "src": "822:3:1" }, + "nativeSrc": "822:40:1", "nodeType": "YulFunctionCall", "src": "822:40:1" }, @@ -475,6 +545,7 @@ [ { "name": "newFreePtr", + "nativeSrc": "808:10:1", "nodeType": "YulTypedName", "src": "808:10:1", "type": "" @@ -484,6 +555,7 @@ { "body": { + "nativeSrc": "973:22:1", "nodeType": "YulBlock", "src": "973:22:1", "statements": @@ -495,12 +567,15 @@ "functionName": { "name": "panic_error_0x41", + "nativeSrc": "975:16:1", "nodeType": "YulIdentifier", "src": "975:16:1" }, + "nativeSrc": "975:18:1", "nodeType": "YulFunctionCall", "src": "975:18:1" }, + "nativeSrc": "975:18:1", "nodeType": "YulExpressionStatement", "src": "975:18:1" } @@ -515,11 +590,13 @@ [ { "name": "newFreePtr", + "nativeSrc": "916:10:1", "nodeType": "YulIdentifier", "src": "916:10:1" }, { "kind": "number", + "nativeSrc": "928:18:1", "nodeType": "YulLiteral", "src": "928:18:1", "type": "", @@ -529,9 +606,11 @@ "functionName": { "name": "gt", + "nativeSrc": "913:2:1", "nodeType": "YulIdentifier", "src": "913:2:1" }, + "nativeSrc": "913:34:1", "nodeType": "YulFunctionCall", "src": "913:34:1" }, @@ -540,11 +619,13 @@ [ { "name": "newFreePtr", + "nativeSrc": "952:10:1", "nodeType": "YulIdentifier", "src": "952:10:1" }, { "name": "memPtr", + "nativeSrc": "964:6:1", "nodeType": "YulIdentifier", "src": "964:6:1" } @@ -552,9 +633,11 @@ "functionName": { "name": "lt", + "nativeSrc": "949:2:1", "nodeType": "YulIdentifier", "src": "949:2:1" }, + "nativeSrc": "949:22:1", "nodeType": "YulFunctionCall", "src": "949:22:1" } @@ -562,12 +645,15 @@ "functionName": { "name": "or", + "nativeSrc": "910:2:1", "nodeType": "YulIdentifier", "src": "910:2:1" }, + "nativeSrc": "910:62:1", "nodeType": "YulFunctionCall", "src": "910:62:1" }, + "nativeSrc": "907:88:1", "nodeType": "YulIf", "src": "907:88:1" }, @@ -578,6 +664,7 @@ [ { "kind": "number", + "nativeSrc": "1011:2:1", "nodeType": "YulLiteral", "src": "1011:2:1", "type": "", @@ -585,6 +672,7 @@ }, { "name": "newFreePtr", + "nativeSrc": "1015:10:1", "nodeType": "YulIdentifier", "src": "1015:10:1" } @@ -592,29 +680,35 @@ "functionName": { "name": "mstore", + "nativeSrc": "1004:6:1", "nodeType": "YulIdentifier", "src": "1004:6:1" }, + "nativeSrc": "1004:22:1", "nodeType": "YulFunctionCall", "src": "1004:22:1" }, + "nativeSrc": "1004:22:1", "nodeType": "YulExpressionStatement", "src": "1004:22:1" } ] }, "name": "finalize_allocation", + "nativeSrc": "751:281:1", "nodeType": "YulFunctionDefinition", "parameters": [ { "name": "memPtr", + "nativeSrc": "780:6:1", "nodeType": "YulTypedName", "src": "780:6:1", "type": "" }, { "name": "size", + "nativeSrc": "788:4:1", "nodeType": "YulTypedName", "src": "788:4:1", "type": "" @@ -625,11 +719,13 @@ { "body": { + "nativeSrc": "1079:88:1", "nodeType": "YulBlock", "src": "1079:88:1", "statements": [ { + "nativeSrc": "1089:30:1", "nodeType": "YulAssignment", "src": "1089:30:1", "value": @@ -638,9 +734,11 @@ "functionName": { "name": "allocate_unbounded", + "nativeSrc": "1099:18:1", "nodeType": "YulIdentifier", "src": "1099:18:1" }, + "nativeSrc": "1099:20:1", "nodeType": "YulFunctionCall", "src": "1099:20:1" }, @@ -648,6 +746,7 @@ [ { "name": "memPtr", + "nativeSrc": "1089:6:1", "nodeType": "YulIdentifier", "src": "1089:6:1" } @@ -660,11 +759,13 @@ [ { "name": "memPtr", + "nativeSrc": "1148:6:1", "nodeType": "YulIdentifier", "src": "1148:6:1" }, { "name": "size", + "nativeSrc": "1156:4:1", "nodeType": "YulIdentifier", "src": "1156:4:1" } @@ -672,23 +773,28 @@ "functionName": { "name": "finalize_allocation", + "nativeSrc": "1128:19:1", "nodeType": "YulIdentifier", "src": "1128:19:1" }, + "nativeSrc": "1128:33:1", "nodeType": "YulFunctionCall", "src": "1128:33:1" }, + "nativeSrc": "1128:33:1", "nodeType": "YulExpressionStatement", "src": "1128:33:1" } ] }, "name": "allocate_memory", + "nativeSrc": "1038:129:1", "nodeType": "YulFunctionDefinition", "parameters": [ { "name": "size", + "nativeSrc": "1063:4:1", "nodeType": "YulTypedName", "src": "1063:4:1", "type": "" @@ -698,6 +804,7 @@ [ { "name": "memPtr", + "nativeSrc": "1072:6:1", "nodeType": "YulTypedName", "src": "1072:6:1", "type": "" @@ -708,6 +815,7 @@ { "body": { + "nativeSrc": "1255:229:1", "nodeType": "YulBlock", "src": "1255:229:1", "statements": @@ -715,6 +823,7 @@ { "body": { + "nativeSrc": "1360:22:1", "nodeType": "YulBlock", "src": "1360:22:1", "statements": @@ -726,12 +835,15 @@ "functionName": { "name": "panic_error_0x41", + "nativeSrc": "1362:16:1", "nodeType": "YulIdentifier", "src": "1362:16:1" }, + "nativeSrc": "1362:18:1", "nodeType": "YulFunctionCall", "src": "1362:18:1" }, + "nativeSrc": "1362:18:1", "nodeType": "YulExpressionStatement", "src": "1362:18:1" } @@ -743,11 +855,13 @@ [ { "name": "length", + "nativeSrc": "1332:6:1", "nodeType": "YulIdentifier", "src": "1332:6:1" }, { "kind": "number", + "nativeSrc": "1340:18:1", "nodeType": "YulLiteral", "src": "1340:18:1", "type": "", @@ -757,16 +871,20 @@ "functionName": { "name": "gt", + "nativeSrc": "1329:2:1", "nodeType": "YulIdentifier", "src": "1329:2:1" }, + "nativeSrc": "1329:30:1", "nodeType": "YulFunctionCall", "src": "1329:30:1" }, + "nativeSrc": "1326:56:1", "nodeType": "YulIf", "src": "1326:56:1" }, { + "nativeSrc": "1392:25:1", "nodeType": "YulAssignment", "src": "1392:25:1", "value": @@ -775,11 +893,13 @@ [ { "name": "length", + "nativeSrc": "1404:6:1", "nodeType": "YulIdentifier", "src": "1404:6:1" }, { "kind": "number", + "nativeSrc": "1412:4:1", "nodeType": "YulLiteral", "src": "1412:4:1", "type": "", @@ -789,9 +909,11 @@ "functionName": { "name": "mul", + "nativeSrc": "1400:3:1", "nodeType": "YulIdentifier", "src": "1400:3:1" }, + "nativeSrc": "1400:17:1", "nodeType": "YulFunctionCall", "src": "1400:17:1" }, @@ -799,12 +921,14 @@ [ { "name": "size", + "nativeSrc": "1392:4:1", "nodeType": "YulIdentifier", "src": "1392:4:1" } ] }, { + "nativeSrc": "1454:23:1", "nodeType": "YulAssignment", "src": "1454:23:1", "value": @@ -813,11 +937,13 @@ [ { "name": "size", + "nativeSrc": "1466:4:1", "nodeType": "YulIdentifier", "src": "1466:4:1" }, { "kind": "number", + "nativeSrc": "1472:4:1", "nodeType": "YulLiteral", "src": "1472:4:1", "type": "", @@ -827,9 +953,11 @@ "functionName": { "name": "add", + "nativeSrc": "1462:3:1", "nodeType": "YulIdentifier", "src": "1462:3:1" }, + "nativeSrc": "1462:15:1", "nodeType": "YulFunctionCall", "src": "1462:15:1" }, @@ -837,6 +965,7 @@ [ { "name": "size", + "nativeSrc": "1454:4:1", "nodeType": "YulIdentifier", "src": "1454:4:1" } @@ -845,11 +974,13 @@ ] }, "name": "array_allocation_size_t_array$_t_uint256_$dyn_memory_ptr", + "nativeSrc": "1173:311:1", "nodeType": "YulFunctionDefinition", "parameters": [ { "name": "length", + "nativeSrc": "1239:6:1", "nodeType": "YulTypedName", "src": "1239:6:1", "type": "" @@ -859,6 +990,7 @@ [ { "name": "size", + "nativeSrc": "1250:4:1", "nodeType": "YulTypedName", "src": "1250:4:1", "type": "" @@ -869,6 +1001,7 @@ { "body": { + "nativeSrc": "1579:28:1", "nodeType": "YulBlock", "src": "1579:28:1", "statements": @@ -880,6 +1013,7 @@ [ { "kind": "number", + "nativeSrc": "1596:1:1", "nodeType": "YulLiteral", "src": "1596:1:1", "type": "", @@ -887,6 +1021,7 @@ }, { "kind": "number", + "nativeSrc": "1599:1:1", "nodeType": "YulLiteral", "src": "1599:1:1", "type": "", @@ -896,34 +1031,41 @@ "functionName": { "name": "revert", + "nativeSrc": "1589:6:1", "nodeType": "YulIdentifier", "src": "1589:6:1" }, + "nativeSrc": "1589:12:1", "nodeType": "YulFunctionCall", "src": "1589:12:1" }, + "nativeSrc": "1589:12:1", "nodeType": "YulExpressionStatement", "src": "1589:12:1" } ] }, "name": "revert_error_81385d8c0b31fffe14be1da910c8bd3a80be4cfa248e04f42ec0faea3132a8ef", + "nativeSrc": "1490:117:1", "nodeType": "YulFunctionDefinition", "src": "1490:117:1" }, { "body": { + "nativeSrc": "1658:32:1", "nodeType": "YulBlock", "src": "1658:32:1", "statements": [ { + "nativeSrc": "1668:16:1", "nodeType": "YulAssignment", "src": "1668:16:1", "value": { "name": "value", + "nativeSrc": "1679:5:1", "nodeType": "YulIdentifier", "src": "1679:5:1" }, @@ -931,6 +1073,7 @@ [ { "name": "cleaned", + "nativeSrc": "1668:7:1", "nodeType": "YulIdentifier", "src": "1668:7:1" } @@ -939,11 +1082,13 @@ ] }, "name": "cleanup_t_uint256", + "nativeSrc": "1613:77:1", "nodeType": "YulFunctionDefinition", "parameters": [ { "name": "value", + "nativeSrc": "1640:5:1", "nodeType": "YulTypedName", "src": "1640:5:1", "type": "" @@ -953,6 +1098,7 @@ [ { "name": "cleaned", + "nativeSrc": "1650:7:1", "nodeType": "YulTypedName", "src": "1650:7:1", "type": "" @@ -963,6 +1109,7 @@ { "body": { + "nativeSrc": "1739:79:1", "nodeType": "YulBlock", "src": "1739:79:1", "statements": @@ -970,6 +1117,7 @@ { "body": { + "nativeSrc": "1796:16:1", "nodeType": "YulBlock", "src": "1796:16:1", "statements": @@ -981,6 +1129,7 @@ [ { "kind": "number", + "nativeSrc": "1805:1:1", "nodeType": "YulLiteral", "src": "1805:1:1", "type": "", @@ -988,6 +1137,7 @@ }, { "kind": "number", + "nativeSrc": "1808:1:1", "nodeType": "YulLiteral", "src": "1808:1:1", "type": "", @@ -997,12 +1147,15 @@ "functionName": { "name": "revert", + "nativeSrc": "1798:6:1", "nodeType": "YulIdentifier", "src": "1798:6:1" }, + "nativeSrc": "1798:12:1", "nodeType": "YulFunctionCall", "src": "1798:12:1" }, + "nativeSrc": "1798:12:1", "nodeType": "YulExpressionStatement", "src": "1798:12:1" } @@ -1017,6 +1170,7 @@ [ { "name": "value", + "nativeSrc": "1762:5:1", "nodeType": "YulIdentifier", "src": "1762:5:1" }, @@ -1025,6 +1179,7 @@ [ { "name": "value", + "nativeSrc": "1787:5:1", "nodeType": "YulIdentifier", "src": "1787:5:1" } @@ -1032,9 +1187,11 @@ "functionName": { "name": "cleanup_t_uint256", + "nativeSrc": "1769:17:1", "nodeType": "YulIdentifier", "src": "1769:17:1" }, + "nativeSrc": "1769:24:1", "nodeType": "YulFunctionCall", "src": "1769:24:1" } @@ -1042,9 +1199,11 @@ "functionName": { "name": "eq", + "nativeSrc": "1759:2:1", "nodeType": "YulIdentifier", "src": "1759:2:1" }, + "nativeSrc": "1759:35:1", "nodeType": "YulFunctionCall", "src": "1759:35:1" } @@ -1052,23 +1211,28 @@ "functionName": { "name": "iszero", + "nativeSrc": "1752:6:1", "nodeType": "YulIdentifier", "src": "1752:6:1" }, + "nativeSrc": "1752:43:1", "nodeType": "YulFunctionCall", "src": "1752:43:1" }, + "nativeSrc": "1749:63:1", "nodeType": "YulIf", "src": "1749:63:1" } ] }, "name": "validator_revert_t_uint256", + "nativeSrc": "1696:122:1", "nodeType": "YulFunctionDefinition", "parameters": [ { "name": "value", + "nativeSrc": "1732:5:1", "nodeType": "YulTypedName", "src": "1732:5:1", "type": "" @@ -1079,11 +1243,13 @@ { "body": { + "nativeSrc": "1876:87:1", "nodeType": "YulBlock", "src": "1876:87:1", "statements": [ { + "nativeSrc": "1886:29:1", "nodeType": "YulAssignment", "src": "1886:29:1", "value": @@ -1092,6 +1258,7 @@ [ { "name": "offset", + "nativeSrc": "1908:6:1", "nodeType": "YulIdentifier", "src": "1908:6:1" } @@ -1099,9 +1266,11 @@ "functionName": { "name": "calldataload", + "nativeSrc": "1895:12:1", "nodeType": "YulIdentifier", "src": "1895:12:1" }, + "nativeSrc": "1895:20:1", "nodeType": "YulFunctionCall", "src": "1895:20:1" }, @@ -1109,6 +1278,7 @@ [ { "name": "value", + "nativeSrc": "1886:5:1", "nodeType": "YulIdentifier", "src": "1886:5:1" } @@ -1121,6 +1291,7 @@ [ { "name": "value", + "nativeSrc": "1951:5:1", "nodeType": "YulIdentifier", "src": "1951:5:1" } @@ -1128,29 +1299,35 @@ "functionName": { "name": "validator_revert_t_uint256", + "nativeSrc": "1924:26:1", "nodeType": "YulIdentifier", "src": "1924:26:1" }, + "nativeSrc": "1924:33:1", "nodeType": "YulFunctionCall", "src": "1924:33:1" }, + "nativeSrc": "1924:33:1", "nodeType": "YulExpressionStatement", "src": "1924:33:1" } ] }, "name": "abi_decode_t_uint256", + "nativeSrc": "1824:139:1", "nodeType": "YulFunctionDefinition", "parameters": [ { "name": "offset", + "nativeSrc": "1854:6:1", "nodeType": "YulTypedName", "src": "1854:6:1", "type": "" }, { "name": "end", + "nativeSrc": "1862:3:1", "nodeType": "YulTypedName", "src": "1862:3:1", "type": "" @@ -1160,6 +1337,7 @@ [ { "name": "value", + "nativeSrc": "1870:5:1", "nodeType": "YulTypedName", "src": "1870:5:1", "type": "" @@ -1170,11 +1348,13 @@ { "body": { + "nativeSrc": "2088:608:1", "nodeType": "YulBlock", "src": "2088:608:1", "statements": [ { + "nativeSrc": "2098:90:1", "nodeType": "YulAssignment", "src": "2098:90:1", "value": @@ -1186,6 +1366,7 @@ [ { "name": "length", + "nativeSrc": "2180:6:1", "nodeType": "YulIdentifier", "src": "2180:6:1" } @@ -1193,9 +1374,11 @@ "functionName": { "name": "array_allocation_size_t_array$_t_uint256_$dyn_memory_ptr", + "nativeSrc": "2123:56:1", "nodeType": "YulIdentifier", "src": "2123:56:1" }, + "nativeSrc": "2123:64:1", "nodeType": "YulFunctionCall", "src": "2123:64:1" } @@ -1203,9 +1386,11 @@ "functionName": { "name": "allocate_memory", + "nativeSrc": "2107:15:1", "nodeType": "YulIdentifier", "src": "2107:15:1" }, + "nativeSrc": "2107:81:1", "nodeType": "YulFunctionCall", "src": "2107:81:1" }, @@ -1213,17 +1398,20 @@ [ { "name": "array", + "nativeSrc": "2098:5:1", "nodeType": "YulIdentifier", "src": "2098:5:1" } ] }, { + "nativeSrc": "2197:16:1", "nodeType": "YulVariableDeclaration", "src": "2197:16:1", "value": { "name": "array", + "nativeSrc": "2208:5:1", "nodeType": "YulIdentifier", "src": "2208:5:1" }, @@ -1231,6 +1419,7 @@ [ { "name": "dst", + "nativeSrc": "2201:3:1", "nodeType": "YulTypedName", "src": "2201:3:1", "type": "" @@ -1244,11 +1433,13 @@ [ { "name": "array", + "nativeSrc": "2230:5:1", "nodeType": "YulIdentifier", "src": "2230:5:1" }, { "name": "length", + "nativeSrc": "2237:6:1", "nodeType": "YulIdentifier", "src": "2237:6:1" } @@ -1256,16 +1447,20 @@ "functionName": { "name": "mstore", + "nativeSrc": "2223:6:1", "nodeType": "YulIdentifier", "src": "2223:6:1" }, + "nativeSrc": "2223:21:1", "nodeType": "YulFunctionCall", "src": "2223:21:1" }, + "nativeSrc": "2223:21:1", "nodeType": "YulExpressionStatement", "src": "2223:21:1" }, { + "nativeSrc": "2253:23:1", "nodeType": "YulAssignment", "src": "2253:23:1", "value": @@ -1274,11 +1469,13 @@ [ { "name": "array", + "nativeSrc": "2264:5:1", "nodeType": "YulIdentifier", "src": "2264:5:1" }, { "kind": "number", + "nativeSrc": "2271:4:1", "nodeType": "YulLiteral", "src": "2271:4:1", "type": "", @@ -1288,9 +1485,11 @@ "functionName": { "name": "add", + "nativeSrc": "2260:3:1", "nodeType": "YulIdentifier", "src": "2260:3:1" }, + "nativeSrc": "2260:16:1", "nodeType": "YulFunctionCall", "src": "2260:16:1" }, @@ -1298,12 +1497,14 @@ [ { "name": "dst", + "nativeSrc": "2253:3:1", "nodeType": "YulIdentifier", "src": "2253:3:1" } ] }, { + "nativeSrc": "2286:44:1", "nodeType": "YulVariableDeclaration", "src": "2286:44:1", "value": @@ -1312,6 +1513,7 @@ [ { "name": "offset", + "nativeSrc": "2304:6:1", "nodeType": "YulIdentifier", "src": "2304:6:1" }, @@ -1320,11 +1522,13 @@ [ { "name": "length", + "nativeSrc": "2316:6:1", "nodeType": "YulIdentifier", "src": "2316:6:1" }, { "kind": "number", + "nativeSrc": "2324:4:1", "nodeType": "YulLiteral", "src": "2324:4:1", "type": "", @@ -1334,9 +1538,11 @@ "functionName": { "name": "mul", + "nativeSrc": "2312:3:1", "nodeType": "YulIdentifier", "src": "2312:3:1" }, + "nativeSrc": "2312:17:1", "nodeType": "YulFunctionCall", "src": "2312:17:1" } @@ -1344,9 +1550,11 @@ "functionName": { "name": "add", + "nativeSrc": "2300:3:1", "nodeType": "YulIdentifier", "src": "2300:3:1" }, + "nativeSrc": "2300:30:1", "nodeType": "YulFunctionCall", "src": "2300:30:1" }, @@ -1354,6 +1562,7 @@ [ { "name": "srcEnd", + "nativeSrc": "2290:6:1", "nodeType": "YulTypedName", "src": "2290:6:1", "type": "" @@ -1363,6 +1572,7 @@ { "body": { + "nativeSrc": "2358:103:1", "nodeType": "YulBlock", "src": "2358:103:1", "statements": @@ -1374,12 +1584,15 @@ "functionName": { "name": "revert_error_81385d8c0b31fffe14be1da910c8bd3a80be4cfa248e04f42ec0faea3132a8ef", + "nativeSrc": "2372:77:1", "nodeType": "YulIdentifier", "src": "2372:77:1" }, + "nativeSrc": "2372:79:1", "nodeType": "YulFunctionCall", "src": "2372:79:1" }, + "nativeSrc": "2372:79:1", "nodeType": "YulExpressionStatement", "src": "2372:79:1" } @@ -1391,11 +1604,13 @@ [ { "name": "srcEnd", + "nativeSrc": "2345:6:1", "nodeType": "YulIdentifier", "src": "2345:6:1" }, { "name": "end", + "nativeSrc": "2353:3:1", "nodeType": "YulIdentifier", "src": "2353:3:1" } @@ -1403,28 +1618,34 @@ "functionName": { "name": "gt", + "nativeSrc": "2342:2:1", "nodeType": "YulIdentifier", "src": "2342:2:1" }, + "nativeSrc": "2342:15:1", "nodeType": "YulFunctionCall", "src": "2342:15:1" }, + "nativeSrc": "2339:122:1", "nodeType": "YulIf", "src": "2339:122:1" }, { "body": { + "nativeSrc": "2546:144:1", "nodeType": "YulBlock", "src": "2546:144:1", "statements": [ { + "nativeSrc": "2561:21:1", "nodeType": "YulVariableDeclaration", "src": "2561:21:1", "value": { "name": "src", + "nativeSrc": "2579:3:1", "nodeType": "YulIdentifier", "src": "2579:3:1" }, @@ -1432,6 +1653,7 @@ [ { "name": "elementPos", + "nativeSrc": "2565:10:1", "nodeType": "YulTypedName", "src": "2565:10:1", "type": "" @@ -1445,6 +1667,7 @@ [ { "name": "dst", + "nativeSrc": "2603:3:1", "nodeType": "YulIdentifier", "src": "2603:3:1" }, @@ -1453,11 +1676,13 @@ [ { "name": "elementPos", + "nativeSrc": "2629:10:1", "nodeType": "YulIdentifier", "src": "2629:10:1" }, { "name": "end", + "nativeSrc": "2641:3:1", "nodeType": "YulIdentifier", "src": "2641:3:1" } @@ -1465,9 +1690,11 @@ "functionName": { "name": "abi_decode_t_uint256", + "nativeSrc": "2608:20:1", "nodeType": "YulIdentifier", "src": "2608:20:1" }, + "nativeSrc": "2608:37:1", "nodeType": "YulFunctionCall", "src": "2608:37:1" } @@ -1475,16 +1702,20 @@ "functionName": { "name": "mstore", + "nativeSrc": "2596:6:1", "nodeType": "YulIdentifier", "src": "2596:6:1" }, + "nativeSrc": "2596:50:1", "nodeType": "YulFunctionCall", "src": "2596:50:1" }, + "nativeSrc": "2596:50:1", "nodeType": "YulExpressionStatement", "src": "2596:50:1" }, { + "nativeSrc": "2659:21:1", "nodeType": "YulAssignment", "src": "2659:21:1", "value": @@ -1493,11 +1724,13 @@ [ { "name": "dst", + "nativeSrc": "2670:3:1", "nodeType": "YulIdentifier", "src": "2670:3:1" }, { "kind": "number", + "nativeSrc": "2675:4:1", "nodeType": "YulLiteral", "src": "2675:4:1", "type": "", @@ -1507,9 +1740,11 @@ "functionName": { "name": "add", + "nativeSrc": "2666:3:1", "nodeType": "YulIdentifier", "src": "2666:3:1" }, + "nativeSrc": "2666:14:1", "nodeType": "YulFunctionCall", "src": "2666:14:1" }, @@ -1517,6 +1752,7 @@ [ { "name": "dst", + "nativeSrc": "2659:3:1", "nodeType": "YulIdentifier", "src": "2659:3:1" } @@ -1530,11 +1766,13 @@ [ { "name": "src", + "nativeSrc": "2499:3:1", "nodeType": "YulIdentifier", "src": "2499:3:1" }, { "name": "srcEnd", + "nativeSrc": "2504:6:1", "nodeType": "YulIdentifier", "src": "2504:6:1" } @@ -1542,20 +1780,25 @@ "functionName": { "name": "lt", + "nativeSrc": "2496:2:1", "nodeType": "YulIdentifier", "src": "2496:2:1" }, + "nativeSrc": "2496:15:1", "nodeType": "YulFunctionCall", "src": "2496:15:1" }, + "nativeSrc": "2470:220:1", "nodeType": "YulForLoop", "post": { + "nativeSrc": "2512:25:1", "nodeType": "YulBlock", "src": "2512:25:1", "statements": [ { + "nativeSrc": "2514:21:1", "nodeType": "YulAssignment", "src": "2514:21:1", "value": @@ -1564,11 +1807,13 @@ [ { "name": "src", + "nativeSrc": "2525:3:1", "nodeType": "YulIdentifier", "src": "2525:3:1" }, { "kind": "number", + "nativeSrc": "2530:4:1", "nodeType": "YulLiteral", "src": "2530:4:1", "type": "", @@ -1578,9 +1823,11 @@ "functionName": { "name": "add", + "nativeSrc": "2521:3:1", "nodeType": "YulIdentifier", "src": "2521:3:1" }, + "nativeSrc": "2521:14:1", "nodeType": "YulFunctionCall", "src": "2521:14:1" }, @@ -1588,6 +1835,7 @@ [ { "name": "src", + "nativeSrc": "2514:3:1", "nodeType": "YulIdentifier", "src": "2514:3:1" } @@ -1597,16 +1845,19 @@ }, "pre": { + "nativeSrc": "2474:21:1", "nodeType": "YulBlock", "src": "2474:21:1", "statements": [ { + "nativeSrc": "2476:17:1", "nodeType": "YulVariableDeclaration", "src": "2476:17:1", "value": { "name": "offset", + "nativeSrc": "2487:6:1", "nodeType": "YulIdentifier", "src": "2487:6:1" }, @@ -1614,6 +1865,7 @@ [ { "name": "src", + "nativeSrc": "2480:3:1", "nodeType": "YulTypedName", "src": "2480:3:1", "type": "" @@ -1627,23 +1879,27 @@ ] }, "name": "abi_decode_available_length_t_array$_t_uint256_$dyn_memory_ptr", + "nativeSrc": "1986:710:1", "nodeType": "YulFunctionDefinition", "parameters": [ { "name": "offset", + "nativeSrc": "2058:6:1", "nodeType": "YulTypedName", "src": "2058:6:1", "type": "" }, { "name": "length", + "nativeSrc": "2066:6:1", "nodeType": "YulTypedName", "src": "2066:6:1", "type": "" }, { "name": "end", + "nativeSrc": "2074:3:1", "nodeType": "YulTypedName", "src": "2074:3:1", "type": "" @@ -1653,6 +1909,7 @@ [ { "name": "array", + "nativeSrc": "2082:5:1", "nodeType": "YulTypedName", "src": "2082:5:1", "type": "" @@ -1663,6 +1920,7 @@ { "body": { + "nativeSrc": "2796:293:1", "nodeType": "YulBlock", "src": "2796:293:1", "statements": @@ -1670,6 +1928,7 @@ { "body": { + "nativeSrc": "2845:83:1", "nodeType": "YulBlock", "src": "2845:83:1", "statements": @@ -1681,12 +1940,15 @@ "functionName": { "name": "revert_error_1b9f4a0a5773e33b91aa01db23bf8c55fce1411167c872835e7fa00a4f17d46d", + "nativeSrc": "2847:77:1", "nodeType": "YulIdentifier", "src": "2847:77:1" }, + "nativeSrc": "2847:79:1", "nodeType": "YulFunctionCall", "src": "2847:79:1" }, + "nativeSrc": "2847:79:1", "nodeType": "YulExpressionStatement", "src": "2847:79:1" } @@ -1704,11 +1966,13 @@ [ { "name": "offset", + "nativeSrc": "2824:6:1", "nodeType": "YulIdentifier", "src": "2824:6:1" }, { "kind": "number", + "nativeSrc": "2832:4:1", "nodeType": "YulLiteral", "src": "2832:4:1", "type": "", @@ -1718,14 +1982,17 @@ "functionName": { "name": "add", + "nativeSrc": "2820:3:1", "nodeType": "YulIdentifier", "src": "2820:3:1" }, + "nativeSrc": "2820:17:1", "nodeType": "YulFunctionCall", "src": "2820:17:1" }, { "name": "end", + "nativeSrc": "2839:3:1", "nodeType": "YulIdentifier", "src": "2839:3:1" } @@ -1733,9 +2000,11 @@ "functionName": { "name": "slt", + "nativeSrc": "2816:3:1", "nodeType": "YulIdentifier", "src": "2816:3:1" }, + "nativeSrc": "2816:27:1", "nodeType": "YulFunctionCall", "src": "2816:27:1" } @@ -1743,16 +2012,20 @@ "functionName": { "name": "iszero", + "nativeSrc": "2809:6:1", "nodeType": "YulIdentifier", "src": "2809:6:1" }, + "nativeSrc": "2809:35:1", "nodeType": "YulFunctionCall", "src": "2809:35:1" }, + "nativeSrc": "2806:122:1", "nodeType": "YulIf", "src": "2806:122:1" }, { + "nativeSrc": "2937:34:1", "nodeType": "YulVariableDeclaration", "src": "2937:34:1", "value": @@ -1761,6 +2034,7 @@ [ { "name": "offset", + "nativeSrc": "2964:6:1", "nodeType": "YulIdentifier", "src": "2964:6:1" } @@ -1768,9 +2042,11 @@ "functionName": { "name": "calldataload", + "nativeSrc": "2951:12:1", "nodeType": "YulIdentifier", "src": "2951:12:1" }, + "nativeSrc": "2951:20:1", "nodeType": "YulFunctionCall", "src": "2951:20:1" }, @@ -1778,6 +2054,7 @@ [ { "name": "length", + "nativeSrc": "2941:6:1", "nodeType": "YulTypedName", "src": "2941:6:1", "type": "" @@ -1785,6 +2062,7 @@ ] }, { + "nativeSrc": "2980:103:1", "nodeType": "YulAssignment", "src": "2980:103:1", "value": @@ -1796,11 +2074,13 @@ [ { "name": "offset", + "nativeSrc": "3056:6:1", "nodeType": "YulIdentifier", "src": "3056:6:1" }, { "kind": "number", + "nativeSrc": "3064:4:1", "nodeType": "YulLiteral", "src": "3064:4:1", "type": "", @@ -1810,19 +2090,23 @@ "functionName": { "name": "add", + "nativeSrc": "3052:3:1", "nodeType": "YulIdentifier", "src": "3052:3:1" }, + "nativeSrc": "3052:17:1", "nodeType": "YulFunctionCall", "src": "3052:17:1" }, { "name": "length", + "nativeSrc": "3071:6:1", "nodeType": "YulIdentifier", "src": "3071:6:1" }, { "name": "end", + "nativeSrc": "3079:3:1", "nodeType": "YulIdentifier", "src": "3079:3:1" } @@ -1830,9 +2114,11 @@ "functionName": { "name": "abi_decode_available_length_t_array$_t_uint256_$dyn_memory_ptr", + "nativeSrc": "2989:62:1", "nodeType": "YulIdentifier", "src": "2989:62:1" }, + "nativeSrc": "2989:94:1", "nodeType": "YulFunctionCall", "src": "2989:94:1" }, @@ -1840,6 +2126,7 @@ [ { "name": "array", + "nativeSrc": "2980:5:1", "nodeType": "YulIdentifier", "src": "2980:5:1" } @@ -1848,17 +2135,20 @@ ] }, "name": "abi_decode_t_array$_t_uint256_$dyn_memory_ptr", + "nativeSrc": "2719:370:1", "nodeType": "YulFunctionDefinition", "parameters": [ { "name": "offset", + "nativeSrc": "2774:6:1", "nodeType": "YulTypedName", "src": "2774:6:1", "type": "" }, { "name": "end", + "nativeSrc": "2782:3:1", "nodeType": "YulTypedName", "src": "2782:3:1", "type": "" @@ -1868,6 +2158,7 @@ [ { "name": "array", + "nativeSrc": "2790:5:1", "nodeType": "YulTypedName", "src": "2790:5:1", "type": "" @@ -1878,6 +2169,7 @@ { "body": { + "nativeSrc": "3186:448:1", "nodeType": "YulBlock", "src": "3186:448:1", "statements": @@ -1885,6 +2177,7 @@ { "body": { + "nativeSrc": "3232:83:1", "nodeType": "YulBlock", "src": "3232:83:1", "statements": @@ -1896,12 +2189,15 @@ "functionName": { "name": "revert_error_dbdddcbe895c83990c08b3492a0e83918d802a52331272ac6fdb6a7c4aea3b1b", + "nativeSrc": "3234:77:1", "nodeType": "YulIdentifier", "src": "3234:77:1" }, + "nativeSrc": "3234:79:1", "nodeType": "YulFunctionCall", "src": "3234:79:1" }, + "nativeSrc": "3234:79:1", "nodeType": "YulExpressionStatement", "src": "3234:79:1" } @@ -1916,11 +2212,13 @@ [ { "name": "dataEnd", + "nativeSrc": "3207:7:1", "nodeType": "YulIdentifier", "src": "3207:7:1" }, { "name": "headStart", + "nativeSrc": "3216:9:1", "nodeType": "YulIdentifier", "src": "3216:9:1" } @@ -1928,14 +2226,17 @@ "functionName": { "name": "sub", + "nativeSrc": "3203:3:1", "nodeType": "YulIdentifier", "src": "3203:3:1" }, + "nativeSrc": "3203:23:1", "nodeType": "YulFunctionCall", "src": "3203:23:1" }, { "kind": "number", + "nativeSrc": "3228:2:1", "nodeType": "YulLiteral", "src": "3228:2:1", "type": "", @@ -1945,21 +2246,26 @@ "functionName": { "name": "slt", + "nativeSrc": "3199:3:1", "nodeType": "YulIdentifier", "src": "3199:3:1" }, + "nativeSrc": "3199:32:1", "nodeType": "YulFunctionCall", "src": "3199:32:1" }, + "nativeSrc": "3196:119:1", "nodeType": "YulIf", "src": "3196:119:1" }, { + "nativeSrc": "3325:302:1", "nodeType": "YulBlock", "src": "3325:302:1", "statements": [ { + "nativeSrc": "3340:45:1", "nodeType": "YulVariableDeclaration", "src": "3340:45:1", "value": @@ -1971,11 +2277,13 @@ [ { "name": "headStart", + "nativeSrc": "3371:9:1", "nodeType": "YulIdentifier", "src": "3371:9:1" }, { "kind": "number", + "nativeSrc": "3382:1:1", "nodeType": "YulLiteral", "src": "3382:1:1", "type": "", @@ -1985,9 +2293,11 @@ "functionName": { "name": "add", + "nativeSrc": "3367:3:1", "nodeType": "YulIdentifier", "src": "3367:3:1" }, + "nativeSrc": "3367:17:1", "nodeType": "YulFunctionCall", "src": "3367:17:1" } @@ -1995,9 +2305,11 @@ "functionName": { "name": "calldataload", + "nativeSrc": "3354:12:1", "nodeType": "YulIdentifier", "src": "3354:12:1" }, + "nativeSrc": "3354:31:1", "nodeType": "YulFunctionCall", "src": "3354:31:1" }, @@ -2005,6 +2317,7 @@ [ { "name": "offset", + "nativeSrc": "3344:6:1", "nodeType": "YulTypedName", "src": "3344:6:1", "type": "" @@ -2014,6 +2327,7 @@ { "body": { + "nativeSrc": "3432:83:1", "nodeType": "YulBlock", "src": "3432:83:1", "statements": @@ -2025,12 +2339,15 @@ "functionName": { "name": "revert_error_c1322bf8034eace5e0b5c7295db60986aa89aae5e0ea0873e4689e076861a5db", + "nativeSrc": "3434:77:1", "nodeType": "YulIdentifier", "src": "3434:77:1" }, + "nativeSrc": "3434:79:1", "nodeType": "YulFunctionCall", "src": "3434:79:1" }, + "nativeSrc": "3434:79:1", "nodeType": "YulExpressionStatement", "src": "3434:79:1" } @@ -2042,11 +2359,13 @@ [ { "name": "offset", + "nativeSrc": "3404:6:1", "nodeType": "YulIdentifier", "src": "3404:6:1" }, { "kind": "number", + "nativeSrc": "3412:18:1", "nodeType": "YulLiteral", "src": "3412:18:1", "type": "", @@ -2056,16 +2375,20 @@ "functionName": { "name": "gt", + "nativeSrc": "3401:2:1", "nodeType": "YulIdentifier", "src": "3401:2:1" }, + "nativeSrc": "3401:30:1", "nodeType": "YulFunctionCall", "src": "3401:30:1" }, + "nativeSrc": "3398:117:1", "nodeType": "YulIf", "src": "3398:117:1" }, { + "nativeSrc": "3529:88:1", "nodeType": "YulAssignment", "src": "3529:88:1", "value": @@ -2077,11 +2400,13 @@ [ { "name": "headStart", + "nativeSrc": "3589:9:1", "nodeType": "YulIdentifier", "src": "3589:9:1" }, { "name": "offset", + "nativeSrc": "3600:6:1", "nodeType": "YulIdentifier", "src": "3600:6:1" } @@ -2089,14 +2414,17 @@ "functionName": { "name": "add", + "nativeSrc": "3585:3:1", "nodeType": "YulIdentifier", "src": "3585:3:1" }, + "nativeSrc": "3585:22:1", "nodeType": "YulFunctionCall", "src": "3585:22:1" }, { "name": "dataEnd", + "nativeSrc": "3609:7:1", "nodeType": "YulIdentifier", "src": "3609:7:1" } @@ -2104,9 +2432,11 @@ "functionName": { "name": "abi_decode_t_array$_t_uint256_$dyn_memory_ptr", + "nativeSrc": "3539:45:1", "nodeType": "YulIdentifier", "src": "3539:45:1" }, + "nativeSrc": "3539:78:1", "nodeType": "YulFunctionCall", "src": "3539:78:1" }, @@ -2114,6 +2444,7 @@ [ { "name": "value0", + "nativeSrc": "3529:6:1", "nodeType": "YulIdentifier", "src": "3529:6:1" } @@ -2124,17 +2455,20 @@ ] }, "name": "abi_decode_tuple_t_array$_t_uint256_$dyn_memory_ptr", + "nativeSrc": "3095:539:1", "nodeType": "YulFunctionDefinition", "parameters": [ { "name": "headStart", + "nativeSrc": "3156:9:1", "nodeType": "YulTypedName", "src": "3156:9:1", "type": "" }, { "name": "dataEnd", + "nativeSrc": "3167:7:1", "nodeType": "YulTypedName", "src": "3167:7:1", "type": "" @@ -2144,6 +2478,7 @@ [ { "name": "value0", + "nativeSrc": "3179:6:1", "nodeType": "YulTypedName", "src": "3179:6:1", "type": "" @@ -2154,6 +2489,7 @@ { "body": { + "nativeSrc": "3705:53:1", "nodeType": "YulBlock", "src": "3705:53:1", "statements": @@ -2165,6 +2501,7 @@ [ { "name": "pos", + "nativeSrc": "3722:3:1", "nodeType": "YulIdentifier", "src": "3722:3:1" }, @@ -2173,6 +2510,7 @@ [ { "name": "value", + "nativeSrc": "3745:5:1", "nodeType": "YulIdentifier", "src": "3745:5:1" } @@ -2180,9 +2518,11 @@ "functionName": { "name": "cleanup_t_uint256", + "nativeSrc": "3727:17:1", "nodeType": "YulIdentifier", "src": "3727:17:1" }, + "nativeSrc": "3727:24:1", "nodeType": "YulFunctionCall", "src": "3727:24:1" } @@ -2190,29 +2530,35 @@ "functionName": { "name": "mstore", + "nativeSrc": "3715:6:1", "nodeType": "YulIdentifier", "src": "3715:6:1" }, + "nativeSrc": "3715:37:1", "nodeType": "YulFunctionCall", "src": "3715:37:1" }, + "nativeSrc": "3715:37:1", "nodeType": "YulExpressionStatement", "src": "3715:37:1" } ] }, "name": "abi_encode_t_uint256_to_t_uint256_fromStack", + "nativeSrc": "3640:118:1", "nodeType": "YulFunctionDefinition", "parameters": [ { "name": "value", + "nativeSrc": "3693:5:1", "nodeType": "YulTypedName", "src": "3693:5:1", "type": "" }, { "name": "pos", + "nativeSrc": "3700:3:1", "nodeType": "YulTypedName", "src": "3700:3:1", "type": "" @@ -2223,11 +2569,13 @@ { "body": { + "nativeSrc": "3862:124:1", "nodeType": "YulBlock", "src": "3862:124:1", "statements": [ { + "nativeSrc": "3872:26:1", "nodeType": "YulAssignment", "src": "3872:26:1", "value": @@ -2236,11 +2584,13 @@ [ { "name": "headStart", + "nativeSrc": "3884:9:1", "nodeType": "YulIdentifier", "src": "3884:9:1" }, { "kind": "number", + "nativeSrc": "3895:2:1", "nodeType": "YulLiteral", "src": "3895:2:1", "type": "", @@ -2250,9 +2600,11 @@ "functionName": { "name": "add", + "nativeSrc": "3880:3:1", "nodeType": "YulIdentifier", "src": "3880:3:1" }, + "nativeSrc": "3880:18:1", "nodeType": "YulFunctionCall", "src": "3880:18:1" }, @@ -2260,6 +2612,7 @@ [ { "name": "tail", + "nativeSrc": "3872:4:1", "nodeType": "YulIdentifier", "src": "3872:4:1" } @@ -2272,6 +2625,7 @@ [ { "name": "value0", + "nativeSrc": "3952:6:1", "nodeType": "YulIdentifier", "src": "3952:6:1" }, @@ -2280,11 +2634,13 @@ [ { "name": "headStart", + "nativeSrc": "3965:9:1", "nodeType": "YulIdentifier", "src": "3965:9:1" }, { "kind": "number", + "nativeSrc": "3976:1:1", "nodeType": "YulLiteral", "src": "3976:1:1", "type": "", @@ -2294,9 +2650,11 @@ "functionName": { "name": "add", + "nativeSrc": "3961:3:1", "nodeType": "YulIdentifier", "src": "3961:3:1" }, + "nativeSrc": "3961:17:1", "nodeType": "YulFunctionCall", "src": "3961:17:1" } @@ -2304,29 +2662,35 @@ "functionName": { "name": "abi_encode_t_uint256_to_t_uint256_fromStack", + "nativeSrc": "3908:43:1", "nodeType": "YulIdentifier", "src": "3908:43:1" }, + "nativeSrc": "3908:71:1", "nodeType": "YulFunctionCall", "src": "3908:71:1" }, + "nativeSrc": "3908:71:1", "nodeType": "YulExpressionStatement", "src": "3908:71:1" } ] }, "name": "abi_encode_tuple_t_uint256__to_t_uint256__fromStack_reversed", + "nativeSrc": "3764:222:1", "nodeType": "YulFunctionDefinition", "parameters": [ { "name": "headStart", + "nativeSrc": "3834:9:1", "nodeType": "YulTypedName", "src": "3834:9:1", "type": "" }, { "name": "value0", + "nativeSrc": "3846:6:1", "nodeType": "YulTypedName", "src": "3846:6:1", "type": "" @@ -2336,6 +2700,7 @@ [ { "name": "tail", + "nativeSrc": "3857:4:1", "nodeType": "YulTypedName", "src": "3857:4:1", "type": "" diff --git a/test/cmdlineTests/standard_irOptimized_ast_requested/in.sol b/test/cmdlineTests/standard_irOptimized_ast_requested/in.sol new file mode 100644 index 000000000000..a3a86cc8d317 --- /dev/null +++ b/test/cmdlineTests/standard_irOptimized_ast_requested/in.sol @@ -0,0 +1,4 @@ +// SPDX-License-Identifier: GPL-3.0 +pragma solidity *; + +contract C {} diff --git a/test/cmdlineTests/standard_irOptimized_ast_requested/input.json b/test/cmdlineTests/standard_irOptimized_ast_requested/input.json new file mode 100644 index 000000000000..fd16983068aa --- /dev/null +++ b/test/cmdlineTests/standard_irOptimized_ast_requested/input.json @@ -0,0 +1,9 @@ +{ + "language": "Solidity", + "sources": { + "C": {"urls": ["standard_irOptimized_ast_requested/in.sol"]} + }, + "settings": { + "outputSelection": {"*": {"*": ["irOptimizedAst"]}} + } +} diff --git a/test/cmdlineTests/standard_irOptimized_ast_requested/output.json b/test/cmdlineTests/standard_irOptimized_ast_requested/output.json new file mode 100644 index 000000000000..200b653ff443 --- /dev/null +++ b/test/cmdlineTests/standard_irOptimized_ast_requested/output.json @@ -0,0 +1,571 @@ +{ + "contracts": + { + "C": + { + "C": + { + "irOptimizedAst": + { + "code": + { + "block": + { + "nativeSrc": "44:790:0", + "nodeType": "YulBlock", + "src": "-1:-1:0", + "statements": + [ + { + "nativeSrc": "44:790:0", + "nodeType": "YulBlock", + "src": "-1:-1:0", + "statements": + [ + { + "expression": + { + "arguments": + [ + { + "kind": "number", + "nativeSrc": "103:2:0", + "nodeType": "YulLiteral", + "src": "56:13:0", + "type": "", + "value": "64" + }, + { + "arguments": + [ + { + "kind": "number", + "nativeSrc": "119:3:0", + "nodeType": "YulLiteral", + "src": "56:13:0", + "type": "", + "value": "0x80" + } + ], + "functionName": + { + "name": "memoryguard", + "nativeSrc": "107:11:0", + "nodeType": "YulIdentifier", + "src": "56:13:0" + }, + "nativeSrc": "107:16:0", + "nodeType": "YulFunctionCall", + "src": "56:13:0" + } + ], + "functionName": + { + "name": "mstore", + "nativeSrc": "96:6:0", + "nodeType": "YulIdentifier", + "src": "56:13:0" + }, + "nativeSrc": "96:28:0", + "nodeType": "YulFunctionCall", + "src": "56:13:0" + }, + "nativeSrc": "96:28:0", + "nodeType": "YulExpressionStatement", + "src": "56:13:0" + }, + { + "body": + { + "nativeSrc": "148:83:0", + "nodeType": "YulBlock", + "src": "56:13:0", + "statements": + [ + { + "expression": + { + "arguments": [], + "functionName": + { + "name": "revert_error_ca66f745a3ce8ff40e2ccaf1ad45db7774001b90d25810abd9040049be7bf4bb", + "nativeSrc": "150:77:0", + "nodeType": "YulIdentifier", + "src": "56:13:0" + }, + "nativeSrc": "150:79:0", + "nodeType": "YulFunctionCall", + "src": "56:13:0" + }, + "nativeSrc": "150:79:0", + "nodeType": "YulExpressionStatement", + "src": "56:13:0" + } + ] + }, + "condition": + { + "arguments": [], + "functionName": + { + "name": "callvalue", + "nativeSrc": "136:9:0", + "nodeType": "YulIdentifier", + "src": "56:13:0" + }, + "nativeSrc": "136:11:0", + "nodeType": "YulFunctionCall", + "src": "56:13:0" + }, + "nativeSrc": "133:98:0", + "nodeType": "YulIf", + "src": "56:13:0" + }, + { + "nativeSrc": "268:30:0", + "nodeType": "YulVariableDeclaration", + "src": "56:13:0", + "value": + { + "arguments": [], + "functionName": + { + "name": "allocate_unbounded", + "nativeSrc": "278:18:0", + "nodeType": "YulIdentifier", + "src": "56:13:0" + }, + "nativeSrc": "278:20:0", + "nodeType": "YulFunctionCall", + "src": "56:13:0" + }, + "variables": + [ + { + "name": "_1", + "nativeSrc": "272:2:0", + "nodeType": "YulTypedName", + "src": "56:13:0", + "type": "" + } + ] + }, + { + "expression": + { + "arguments": + [ + { + "name": "_1", + "nativeSrc": "316:2:0", + "nodeType": "YulIdentifier", + "src": "56:13:0" + }, + { + "arguments": + [ + { + "hexValue": "435f325f6465706c6f796564", + "kind": "string", + "nativeSrc": "331:14:0", + "nodeType": "YulLiteral", + "src": "56:13:0", + "type": "", + "value": "C_2_deployed" + } + ], + "functionName": + { + "name": "dataoffset", + "nativeSrc": "320:10:0", + "nodeType": "YulIdentifier", + "src": "56:13:0" + }, + "nativeSrc": "320:26:0", + "nodeType": "YulFunctionCall", + "src": "56:13:0" + }, + { + "arguments": + [ + { + "hexValue": "435f325f6465706c6f796564", + "kind": "string", + "nativeSrc": "357:14:0", + "nodeType": "YulLiteral", + "src": "56:13:0", + "type": "", + "value": "C_2_deployed" + } + ], + "functionName": + { + "name": "datasize", + "nativeSrc": "348:8:0", + "nodeType": "YulIdentifier", + "src": "56:13:0" + }, + "nativeSrc": "348:24:0", + "nodeType": "YulFunctionCall", + "src": "56:13:0" + } + ], + "functionName": + { + "name": "codecopy", + "nativeSrc": "307:8:0", + "nodeType": "YulIdentifier", + "src": "56:13:0" + }, + "nativeSrc": "307:66:0", + "nodeType": "YulFunctionCall", + "src": "56:13:0" + }, + "nativeSrc": "307:66:0", + "nodeType": "YulExpressionStatement", + "src": "56:13:0" + }, + { + "expression": + { + "arguments": + [ + { + "name": "_1", + "nativeSrc": "390:2:0", + "nodeType": "YulIdentifier", + "src": "56:13:0" + }, + { + "arguments": + [ + { + "hexValue": "435f325f6465706c6f796564", + "kind": "string", + "nativeSrc": "403:14:0", + "nodeType": "YulLiteral", + "src": "56:13:0", + "type": "", + "value": "C_2_deployed" + } + ], + "functionName": + { + "name": "datasize", + "nativeSrc": "394:8:0", + "nodeType": "YulIdentifier", + "src": "56:13:0" + }, + "nativeSrc": "394:24:0", + "nodeType": "YulFunctionCall", + "src": "56:13:0" + } + ], + "functionName": + { + "name": "return", + "nativeSrc": "383:6:0", + "nodeType": "YulIdentifier", + "src": "56:13:0" + }, + "nativeSrc": "383:36:0", + "nodeType": "YulFunctionCall", + "src": "56:13:0" + }, + "nativeSrc": "383:36:0", + "nodeType": "YulExpressionStatement", + "src": "56:13:0" + } + ] + }, + { + "body": + { + "nativeSrc": "469:43:0", + "nodeType": "YulBlock", + "src": "56:13:0", + "statements": + [ + { + "nativeSrc": "483:19:0", + "nodeType": "YulAssignment", + "src": "56:13:0", + "value": + { + "arguments": + [ + { + "kind": "number", + "nativeSrc": "499:2:0", + "nodeType": "YulLiteral", + "src": "56:13:0", + "type": "", + "value": "64" + } + ], + "functionName": + { + "name": "mload", + "nativeSrc": "493:5:0", + "nodeType": "YulIdentifier", + "src": "56:13:0" + }, + "nativeSrc": "493:9:0", + "nodeType": "YulFunctionCall", + "src": "56:13:0" + }, + "variableNames": + [ + { + "name": "memPtr", + "nativeSrc": "483:6:0", + "nodeType": "YulIdentifier", + "src": "56:13:0" + } + ] + } + ] + }, + "name": "allocate_unbounded", + "nativeSrc": "429:83:0", + "nodeType": "YulFunctionDefinition", + "returnVariables": + [ + { + "name": "memPtr", + "nativeSrc": "462:6:0", + "nodeType": "YulTypedName", + "src": "56:13:0", + "type": "" + } + ], + "src": "56:13:0" + }, + { + "body": + { + "nativeSrc": "611:36:0", + "nodeType": "YulBlock", + "src": "56:13:0", + "statements": + [ + { + "expression": + { + "arguments": + [ + { + "kind": "number", + "nativeSrc": "632:1:0", + "nodeType": "YulLiteral", + "src": "56:13:0", + "type": "", + "value": "0" + }, + { + "kind": "number", + "nativeSrc": "635:1:0", + "nodeType": "YulLiteral", + "src": "56:13:0", + "type": "", + "value": "0" + } + ], + "functionName": + { + "name": "revert", + "nativeSrc": "625:6:0", + "nodeType": "YulIdentifier", + "src": "56:13:0" + }, + "nativeSrc": "625:12:0", + "nodeType": "YulFunctionCall", + "src": "56:13:0" + }, + "nativeSrc": "625:12:0", + "nodeType": "YulExpressionStatement", + "src": "56:13:0" + } + ] + }, + "name": "revert_error_ca66f745a3ce8ff40e2ccaf1ad45db7774001b90d25810abd9040049be7bf4bb", + "nativeSrc": "522:125:0", + "nodeType": "YulFunctionDefinition", + "src": "56:13:0" + } + ] + }, + "nodeType": "YulCode" + }, + "name": "C_2", + "nodeType": "YulObject", + "subObjects": + [ + { + "code": + { + "block": + { + "nativeSrc": "899:588:0", + "nodeType": "YulBlock", + "src": "-1:-1:0", + "statements": + [ + { + "nativeSrc": "899:588:0", + "nodeType": "YulBlock", + "src": "-1:-1:0", + "statements": + [ + { + "expression": + { + "arguments": + [ + { + "kind": "number", + "nativeSrc": "966:2:0", + "nodeType": "YulLiteral", + "src": "56:13:0", + "type": "", + "value": "64" + }, + { + "arguments": + [ + { + "kind": "number", + "nativeSrc": "982:3:0", + "nodeType": "YulLiteral", + "src": "56:13:0", + "type": "", + "value": "0x80" + } + ], + "functionName": + { + "name": "memoryguard", + "nativeSrc": "970:11:0", + "nodeType": "YulIdentifier", + "src": "56:13:0" + }, + "nativeSrc": "970:16:0", + "nodeType": "YulFunctionCall", + "src": "56:13:0" + } + ], + "functionName": + { + "name": "mstore", + "nativeSrc": "959:6:0", + "nodeType": "YulIdentifier", + "src": "56:13:0" + }, + "nativeSrc": "959:28:0", + "nodeType": "YulFunctionCall", + "src": "56:13:0" + }, + "nativeSrc": "959:28:0", + "nodeType": "YulExpressionStatement", + "src": "56:13:0" + }, + { + "expression": + { + "arguments": [], + "functionName": + { + "name": "revert_error_42b3090547df1d2001c96683413b8cf91c1b902ef5e3cb8d9f6f304cf7446f74", + "nativeSrc": "1001:77:0", + "nodeType": "YulIdentifier", + "src": "56:13:0" + }, + "nativeSrc": "1001:79:0", + "nodeType": "YulFunctionCall", + "src": "56:13:0" + }, + "nativeSrc": "1001:79:0", + "nodeType": "YulExpressionStatement", + "src": "56:13:0" + } + ] + }, + { + "body": + { + "nativeSrc": "1432:44:0", + "nodeType": "YulBlock", + "src": "56:13:0", + "statements": + [ + { + "expression": + { + "arguments": + [ + { + "kind": "number", + "nativeSrc": "1457:1:0", + "nodeType": "YulLiteral", + "src": "56:13:0", + "type": "", + "value": "0" + }, + { + "kind": "number", + "nativeSrc": "1460:1:0", + "nodeType": "YulLiteral", + "src": "56:13:0", + "type": "", + "value": "0" + } + ], + "functionName": + { + "name": "revert", + "nativeSrc": "1450:6:0", + "nodeType": "YulIdentifier", + "src": "56:13:0" + }, + "nativeSrc": "1450:12:0", + "nodeType": "YulFunctionCall", + "src": "56:13:0" + }, + "nativeSrc": "1450:12:0", + "nodeType": "YulExpressionStatement", + "src": "56:13:0" + } + ] + }, + "name": "revert_error_42b3090547df1d2001c96683413b8cf91c1b902ef5e3cb8d9f6f304cf7446f74", + "nativeSrc": "1343:133:0", + "nodeType": "YulFunctionDefinition", + "src": "56:13:0" + } + ] + }, + "nodeType": "YulCode" + }, + "name": "C_2_deployed", + "nodeType": "YulObject", + "subObjects": + [ + { + "nodeType": "YulData", + "value": "" + } + ] + } + ] + } + } + } + }, + "sources": + { + "C": + { + "id": 0 + } + } +} diff --git a/test/cmdlineTests/standard_irOptimized_requested/output.json b/test/cmdlineTests/standard_irOptimized_requested/output.json index b3a27c5ca57c..88ce6489578e 100644 --- a/test/cmdlineTests/standard_irOptimized_requested/output.json +++ b/test/cmdlineTests/standard_irOptimized_requested/output.json @@ -8,37 +8,38 @@ "irOptimized": "/// @use-src 0:\"A\" object \"C_7\" { code { - /// @src 0:79:121 \"contract C { function f() public pure {} }\" - mstore(64, memoryguard(128)) - if callvalue() { - revert_error_ca66f745a3ce8ff40e2ccaf1ad45db7774001b90d25810abd9040049be7bf4bb() + /// @src 0:79:121 \"contract C { function f() public pure {} }\" + mstore(64, memoryguard(0x80)) + if callvalue() + { + revert_error_ca66f745a3ce8ff40e2ccaf1ad45db7774001b90d25810abd9040049be7bf4bb() + } + let _1 := allocate_unbounded() + codecopy(_1, dataoffset(\"C_7_deployed\"), datasize(\"C_7_deployed\")) + return(_1, datasize(\"C_7_deployed\")) } - constructor_C_7() - let _1 := allocate_unbounded() - codecopy(_1, dataoffset(\"C_7_deployed\"), datasize(\"C_7_deployed\")) - return(_1, datasize(\"C_7_deployed\")) function allocate_unbounded() -> memPtr { memPtr := mload(64) } function revert_error_ca66f745a3ce8ff40e2ccaf1ad45db7774001b90d25810abd9040049be7bf4bb() { revert(0, 0) } - function constructor_C_7() - { } } /// @use-src 0:\"A\" object \"C_7_deployed\" { code { - /// @src 0:79:121 \"contract C { function f() public pure {} }\" - mstore(64, memoryguard(128)) - if iszero(lt(calldatasize(), 4)) { - let selector := shift_right_224_unsigned(calldataload(0)) - switch selector - case 0x26121ff0 { external_fun_f_6() } - default { } + /// @src 0:79:121 \"contract C { function f() public pure {} }\" + mstore(64, memoryguard(0x80)) + if iszero(lt(calldatasize(), 4)) + { + let selector := shift_right_unsigned(calldataload(0)) + switch selector + case 0x26121ff0 { external_fun_f() } + default { } + } + revert_error_42b3090547df1d2001c96683413b8cf91c1b902ef5e3cb8d9f6f304cf7446f74() } - revert_error_42b3090547df1d2001c96683413b8cf91c1b902ef5e3cb8d9f6f304cf7446f74() - function shift_right_224_unsigned(value) -> newValue + function shift_right_unsigned(value) -> newValue { newValue := shr(224, value) } function allocate_unbounded() -> memPtr { memPtr := mload(64) } @@ -46,32 +47,28 @@ object \"C_7\" { { revert(0, 0) } function revert_error_dbdddcbe895c83990c08b3492a0e83918d802a52331272ac6fdb6a7c4aea3b1b() { revert(0, 0) } - function abi_decode_tuple_(headStart, dataEnd) + function abi_decode(headStart, dataEnd) { if slt(sub(dataEnd, headStart), 0) { revert_error_dbdddcbe895c83990c08b3492a0e83918d802a52331272ac6fdb6a7c4aea3b1b() } } - function abi_encode_tuple__to__fromStack(headStart) -> tail + function abi_encode_tuple(headStart) -> tail { tail := add(headStart, 0) } - function external_fun_f_6() + function external_fun_f() { if callvalue() { revert_error_ca66f745a3ce8ff40e2ccaf1ad45db7774001b90d25810abd9040049be7bf4bb() } - abi_decode_tuple_(4, calldatasize()) - fun_f_6() + abi_decode(4, calldatasize()) let memPos := allocate_unbounded() - let memEnd := abi_encode_tuple__to__fromStack(memPos) + let memEnd := abi_encode_tuple(memPos) return(memPos, sub(memEnd, memPos)) } function revert_error_42b3090547df1d2001c96683413b8cf91c1b902ef5e3cb8d9f6f304cf7446f74() { revert(0, 0) } - /// @ast-id 6 @src 0:92:119 \"function f() public pure {}\" - function fun_f_6() - { } } data \".metadata\" hex\"\" } diff --git a/test/cmdlineTests/standard_ir_ast_requested/in.sol b/test/cmdlineTests/standard_ir_ast_requested/in.sol new file mode 100644 index 000000000000..a3a86cc8d317 --- /dev/null +++ b/test/cmdlineTests/standard_ir_ast_requested/in.sol @@ -0,0 +1,4 @@ +// SPDX-License-Identifier: GPL-3.0 +pragma solidity *; + +contract C {} diff --git a/test/cmdlineTests/standard_ir_ast_requested/input.json b/test/cmdlineTests/standard_ir_ast_requested/input.json new file mode 100644 index 000000000000..1cb1083a2ef6 --- /dev/null +++ b/test/cmdlineTests/standard_ir_ast_requested/input.json @@ -0,0 +1,9 @@ +{ + "language": "Solidity", + "sources": { + "C": {"urls": ["standard_ir_ast_requested/in.sol"]} + }, + "settings": { + "outputSelection": {"*": {"*": ["irAst"]}} + } +} diff --git a/test/cmdlineTests/standard_ir_ast_requested/output.json b/test/cmdlineTests/standard_ir_ast_requested/output.json new file mode 100644 index 000000000000..f949d7b30cb2 --- /dev/null +++ b/test/cmdlineTests/standard_ir_ast_requested/output.json @@ -0,0 +1,729 @@ +{ + "contracts": + { + "C": + { + "C": + { + "irAst": + { + "code": + { + "block": + { + "nativeSrc": "44:790:0", + "nodeType": "YulBlock", + "src": "-1:-1:0", + "statements": + [ + { + "expression": + { + "arguments": + [ + { + "kind": "number", + "nativeSrc": "103:2:0", + "nodeType": "YulLiteral", + "src": "56:13:0", + "type": "", + "value": "64" + }, + { + "arguments": + [ + { + "kind": "number", + "nativeSrc": "119:3:0", + "nodeType": "YulLiteral", + "src": "56:13:0", + "type": "", + "value": "128" + } + ], + "functionName": + { + "name": "memoryguard", + "nativeSrc": "107:11:0", + "nodeType": "YulIdentifier", + "src": "56:13:0" + }, + "nativeSrc": "107:16:0", + "nodeType": "YulFunctionCall", + "src": "56:13:0" + } + ], + "functionName": + { + "name": "mstore", + "nativeSrc": "96:6:0", + "nodeType": "YulIdentifier", + "src": "56:13:0" + }, + "nativeSrc": "96:28:0", + "nodeType": "YulFunctionCall", + "src": "56:13:0" + }, + "nativeSrc": "96:28:0", + "nodeType": "YulExpressionStatement", + "src": "56:13:0" + }, + { + "body": + { + "nativeSrc": "148:83:0", + "nodeType": "YulBlock", + "src": "56:13:0", + "statements": + [ + { + "expression": + { + "arguments": [], + "functionName": + { + "name": "revert_error_ca66f745a3ce8ff40e2ccaf1ad45db7774001b90d25810abd9040049be7bf4bb", + "nativeSrc": "150:77:0", + "nodeType": "YulIdentifier", + "src": "56:13:0" + }, + "nativeSrc": "150:79:0", + "nodeType": "YulFunctionCall", + "src": "56:13:0" + }, + "nativeSrc": "150:79:0", + "nodeType": "YulExpressionStatement", + "src": "56:13:0" + } + ] + }, + "condition": + { + "arguments": [], + "functionName": + { + "name": "callvalue", + "nativeSrc": "136:9:0", + "nodeType": "YulIdentifier", + "src": "56:13:0" + }, + "nativeSrc": "136:11:0", + "nodeType": "YulFunctionCall", + "src": "56:13:0" + }, + "nativeSrc": "133:98:0", + "nodeType": "YulIf", + "src": "56:13:0" + }, + { + "expression": + { + "arguments": [], + "functionName": + { + "name": "constructor_C_2", + "nativeSrc": "241:15:0", + "nodeType": "YulIdentifier", + "src": "56:13:0" + }, + "nativeSrc": "241:17:0", + "nodeType": "YulFunctionCall", + "src": "56:13:0" + }, + "nativeSrc": "241:17:0", + "nodeType": "YulExpressionStatement", + "src": "56:13:0" + }, + { + "nativeSrc": "268:30:0", + "nodeType": "YulVariableDeclaration", + "src": "56:13:0", + "value": + { + "arguments": [], + "functionName": + { + "name": "allocate_unbounded", + "nativeSrc": "278:18:0", + "nodeType": "YulIdentifier", + "src": "56:13:0" + }, + "nativeSrc": "278:20:0", + "nodeType": "YulFunctionCall", + "src": "56:13:0" + }, + "variables": + [ + { + "name": "_1", + "nativeSrc": "272:2:0", + "nodeType": "YulTypedName", + "src": "56:13:0", + "type": "" + } + ] + }, + { + "expression": + { + "arguments": + [ + { + "name": "_1", + "nativeSrc": "316:2:0", + "nodeType": "YulIdentifier", + "src": "56:13:0" + }, + { + "arguments": + [ + { + "hexValue": "435f325f6465706c6f796564", + "kind": "string", + "nativeSrc": "331:14:0", + "nodeType": "YulLiteral", + "src": "56:13:0", + "type": "", + "value": "C_2_deployed" + } + ], + "functionName": + { + "name": "dataoffset", + "nativeSrc": "320:10:0", + "nodeType": "YulIdentifier", + "src": "56:13:0" + }, + "nativeSrc": "320:26:0", + "nodeType": "YulFunctionCall", + "src": "56:13:0" + }, + { + "arguments": + [ + { + "hexValue": "435f325f6465706c6f796564", + "kind": "string", + "nativeSrc": "357:14:0", + "nodeType": "YulLiteral", + "src": "56:13:0", + "type": "", + "value": "C_2_deployed" + } + ], + "functionName": + { + "name": "datasize", + "nativeSrc": "348:8:0", + "nodeType": "YulIdentifier", + "src": "56:13:0" + }, + "nativeSrc": "348:24:0", + "nodeType": "YulFunctionCall", + "src": "56:13:0" + } + ], + "functionName": + { + "name": "codecopy", + "nativeSrc": "307:8:0", + "nodeType": "YulIdentifier", + "src": "56:13:0" + }, + "nativeSrc": "307:66:0", + "nodeType": "YulFunctionCall", + "src": "56:13:0" + }, + "nativeSrc": "307:66:0", + "nodeType": "YulExpressionStatement", + "src": "56:13:0" + }, + { + "expression": + { + "arguments": + [ + { + "name": "_1", + "nativeSrc": "390:2:0", + "nodeType": "YulIdentifier", + "src": "56:13:0" + }, + { + "arguments": + [ + { + "hexValue": "435f325f6465706c6f796564", + "kind": "string", + "nativeSrc": "403:14:0", + "nodeType": "YulLiteral", + "src": "56:13:0", + "type": "", + "value": "C_2_deployed" + } + ], + "functionName": + { + "name": "datasize", + "nativeSrc": "394:8:0", + "nodeType": "YulIdentifier", + "src": "56:13:0" + }, + "nativeSrc": "394:24:0", + "nodeType": "YulFunctionCall", + "src": "56:13:0" + } + ], + "functionName": + { + "name": "return", + "nativeSrc": "383:6:0", + "nodeType": "YulIdentifier", + "src": "56:13:0" + }, + "nativeSrc": "383:36:0", + "nodeType": "YulFunctionCall", + "src": "56:13:0" + }, + "nativeSrc": "383:36:0", + "nodeType": "YulExpressionStatement", + "src": "56:13:0" + }, + { + "body": + { + "nativeSrc": "469:43:0", + "nodeType": "YulBlock", + "src": "56:13:0", + "statements": + [ + { + "nativeSrc": "483:19:0", + "nodeType": "YulAssignment", + "src": "56:13:0", + "value": + { + "arguments": + [ + { + "kind": "number", + "nativeSrc": "499:2:0", + "nodeType": "YulLiteral", + "src": "56:13:0", + "type": "", + "value": "64" + } + ], + "functionName": + { + "name": "mload", + "nativeSrc": "493:5:0", + "nodeType": "YulIdentifier", + "src": "56:13:0" + }, + "nativeSrc": "493:9:0", + "nodeType": "YulFunctionCall", + "src": "56:13:0" + }, + "variableNames": + [ + { + "name": "memPtr", + "nativeSrc": "483:6:0", + "nodeType": "YulIdentifier", + "src": "56:13:0" + } + ] + } + ] + }, + "name": "allocate_unbounded", + "nativeSrc": "429:83:0", + "nodeType": "YulFunctionDefinition", + "returnVariables": + [ + { + "name": "memPtr", + "nativeSrc": "462:6:0", + "nodeType": "YulTypedName", + "src": "56:13:0", + "type": "" + } + ], + "src": "56:13:0" + }, + { + "body": + { + "nativeSrc": "611:36:0", + "nodeType": "YulBlock", + "src": "56:13:0", + "statements": + [ + { + "expression": + { + "arguments": + [ + { + "kind": "number", + "nativeSrc": "632:1:0", + "nodeType": "YulLiteral", + "src": "56:13:0", + "type": "", + "value": "0" + }, + { + "kind": "number", + "nativeSrc": "635:1:0", + "nodeType": "YulLiteral", + "src": "56:13:0", + "type": "", + "value": "0" + } + ], + "functionName": + { + "name": "revert", + "nativeSrc": "625:6:0", + "nodeType": "YulIdentifier", + "src": "56:13:0" + }, + "nativeSrc": "625:12:0", + "nodeType": "YulFunctionCall", + "src": "56:13:0" + }, + "nativeSrc": "625:12:0", + "nodeType": "YulExpressionStatement", + "src": "56:13:0" + } + ] + }, + "name": "revert_error_ca66f745a3ce8ff40e2ccaf1ad45db7774001b90d25810abd9040049be7bf4bb", + "nativeSrc": "522:125:0", + "nodeType": "YulFunctionDefinition", + "src": "56:13:0" + }, + { + "body": + { + "nativeSrc": "726:59:0", + "nodeType": "YulBlock", + "src": "56:13:0", + "statements": [] + }, + "name": "constructor_C_2", + "nativeSrc": "699:86:0", + "nodeType": "YulFunctionDefinition", + "src": "56:13:0" + } + ] + }, + "nodeType": "YulCode" + }, + "name": "C_2", + "nodeType": "YulObject", + "subObjects": + [ + { + "code": + { + "block": + { + "nativeSrc": "899:588:0", + "nodeType": "YulBlock", + "src": "-1:-1:0", + "statements": + [ + { + "expression": + { + "arguments": + [ + { + "kind": "number", + "nativeSrc": "966:2:0", + "nodeType": "YulLiteral", + "src": "56:13:0", + "type": "", + "value": "64" + }, + { + "arguments": + [ + { + "kind": "number", + "nativeSrc": "982:3:0", + "nodeType": "YulLiteral", + "src": "56:13:0", + "type": "", + "value": "128" + } + ], + "functionName": + { + "name": "memoryguard", + "nativeSrc": "970:11:0", + "nodeType": "YulIdentifier", + "src": "56:13:0" + }, + "nativeSrc": "970:16:0", + "nodeType": "YulFunctionCall", + "src": "56:13:0" + } + ], + "functionName": + { + "name": "mstore", + "nativeSrc": "959:6:0", + "nodeType": "YulIdentifier", + "src": "56:13:0" + }, + "nativeSrc": "959:28:0", + "nodeType": "YulFunctionCall", + "src": "56:13:0" + }, + "nativeSrc": "959:28:0", + "nodeType": "YulExpressionStatement", + "src": "56:13:0" + }, + { + "expression": + { + "arguments": [], + "functionName": + { + "name": "revert_error_42b3090547df1d2001c96683413b8cf91c1b902ef5e3cb8d9f6f304cf7446f74", + "nativeSrc": "1001:77:0", + "nodeType": "YulIdentifier", + "src": "56:13:0" + }, + "nativeSrc": "1001:79:0", + "nodeType": "YulFunctionCall", + "src": "56:13:0" + }, + "nativeSrc": "1001:79:0", + "nodeType": "YulExpressionStatement", + "src": "56:13:0" + }, + { + "body": + { + "nativeSrc": "1147:77:0", + "nodeType": "YulBlock", + "src": "56:13:0", + "statements": + [ + { + "nativeSrc": "1165:44:0", + "nodeType": "YulAssignment", + "src": "56:13:0", + "value": + { + "arguments": + [ + { + "kind": "number", + "nativeSrc": "1198:3:0", + "nodeType": "YulLiteral", + "src": "56:13:0", + "type": "", + "value": "224" + }, + { + "name": "value", + "nativeSrc": "1203:5:0", + "nodeType": "YulIdentifier", + "src": "56:13:0" + } + ], + "functionName": + { + "name": "shr", + "nativeSrc": "1194:3:0", + "nodeType": "YulIdentifier", + "src": "56:13:0" + }, + "nativeSrc": "1194:15:0", + "nodeType": "YulFunctionCall", + "src": "56:13:0" + }, + "variableNames": + [ + { + "name": "newValue", + "nativeSrc": "1165:8:0", + "nodeType": "YulIdentifier", + "src": "56:13:0" + } + ] + } + ] + }, + "name": "shift_right_224_unsigned", + "nativeSrc": "1094:130:0", + "nodeType": "YulFunctionDefinition", + "parameters": + [ + { + "name": "value", + "nativeSrc": "1128:5:0", + "nodeType": "YulTypedName", + "src": "56:13:0", + "type": "" + } + ], + "returnVariables": + [ + { + "name": "newValue", + "nativeSrc": "1138:8:0", + "nodeType": "YulTypedName", + "src": "56:13:0", + "type": "" + } + ], + "src": "56:13:0" + }, + { + "body": + { + "nativeSrc": "1278:51:0", + "nodeType": "YulBlock", + "src": "56:13:0", + "statements": + [ + { + "nativeSrc": "1296:19:0", + "nodeType": "YulAssignment", + "src": "56:13:0", + "value": + { + "arguments": + [ + { + "kind": "number", + "nativeSrc": "1312:2:0", + "nodeType": "YulLiteral", + "src": "56:13:0", + "type": "", + "value": "64" + } + ], + "functionName": + { + "name": "mload", + "nativeSrc": "1306:5:0", + "nodeType": "YulIdentifier", + "src": "56:13:0" + }, + "nativeSrc": "1306:9:0", + "nodeType": "YulFunctionCall", + "src": "56:13:0" + }, + "variableNames": + [ + { + "name": "memPtr", + "nativeSrc": "1296:6:0", + "nodeType": "YulIdentifier", + "src": "56:13:0" + } + ] + } + ] + }, + "name": "allocate_unbounded", + "nativeSrc": "1238:91:0", + "nodeType": "YulFunctionDefinition", + "returnVariables": + [ + { + "name": "memPtr", + "nativeSrc": "1271:6:0", + "nodeType": "YulTypedName", + "src": "56:13:0", + "type": "" + } + ], + "src": "56:13:0" + }, + { + "body": + { + "nativeSrc": "1432:44:0", + "nodeType": "YulBlock", + "src": "56:13:0", + "statements": + [ + { + "expression": + { + "arguments": + [ + { + "kind": "number", + "nativeSrc": "1457:1:0", + "nodeType": "YulLiteral", + "src": "56:13:0", + "type": "", + "value": "0" + }, + { + "kind": "number", + "nativeSrc": "1460:1:0", + "nodeType": "YulLiteral", + "src": "56:13:0", + "type": "", + "value": "0" + } + ], + "functionName": + { + "name": "revert", + "nativeSrc": "1450:6:0", + "nodeType": "YulIdentifier", + "src": "56:13:0" + }, + "nativeSrc": "1450:12:0", + "nodeType": "YulFunctionCall", + "src": "56:13:0" + }, + "nativeSrc": "1450:12:0", + "nodeType": "YulExpressionStatement", + "src": "56:13:0" + } + ] + }, + "name": "revert_error_42b3090547df1d2001c96683413b8cf91c1b902ef5e3cb8d9f6f304cf7446f74", + "nativeSrc": "1343:133:0", + "nodeType": "YulFunctionDefinition", + "src": "56:13:0" + } + ] + }, + "nodeType": "YulCode" + }, + "name": "C_2_deployed", + "nodeType": "YulObject", + "subObjects": + [ + { + "nodeType": "YulData", + "value": "" + } + ] + } + ] + } + } + } + }, + "sources": + { + "C": + { + "id": 0 + } + } +} diff --git a/test/cmdlineTests/standard_metadata/args b/test/cmdlineTests/standard_metadata/args new file mode 100644 index 000000000000..18532c5a6d3f --- /dev/null +++ b/test/cmdlineTests/standard_metadata/args @@ -0,0 +1 @@ +--allow-paths . diff --git a/test/cmdlineTests/standard_metadata/in.sol b/test/cmdlineTests/standard_metadata/in.sol new file mode 100644 index 000000000000..a3a86cc8d317 --- /dev/null +++ b/test/cmdlineTests/standard_metadata/in.sol @@ -0,0 +1,4 @@ +// SPDX-License-Identifier: GPL-3.0 +pragma solidity *; + +contract C {} diff --git a/test/cmdlineTests/standard_metadata/input.json b/test/cmdlineTests/standard_metadata/input.json new file mode 100644 index 000000000000..ae4bfe8f5965 --- /dev/null +++ b/test/cmdlineTests/standard_metadata/input.json @@ -0,0 +1,11 @@ +{ + "language": "Solidity", + "sources": { + "C": {"urls": ["standard_metadata/in.sol"]} + }, + "settings": { + "outputSelection": { + "*": {"*": ["metadata"]} + } + } +} diff --git a/test/cmdlineTests/standard_metadata/output.json b/test/cmdlineTests/standard_metadata/output.json new file mode 100644 index 000000000000..4429466676d1 --- /dev/null +++ b/test/cmdlineTests/standard_metadata/output.json @@ -0,0 +1,19 @@ +{ + "contracts": + { + "C": + { + "C": + { + "metadata": "{\"compiler\":{\"version\":\"\"},\"language\":\"Solidity\",\"output\":{\"abi\":[],\"devdoc\":{\"kind\":\"dev\",\"methods\":{},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"C\":\"C\"},\"evmVersion\":\"shanghai\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":false,\"runs\":200},\"remappings\":[]},\"sources\":{\"C\":{\"keccak256\":\"0x5cf617b1707a484e3c4bd59643013dec76ab7d75900b46855214729ae3e0ceb0\",\"license\":\"GPL-3.0\",\"urls\":[\"bzz-raw://ac418a02dfadf87234150d3568f33269e3f49460345cb39300e017a6d755eff2\",\"dweb:/ipfs/QmQq3owBu25x2WV46HB1WyKzJpxiAPecU7eMKqtXCF7eeS\"]}},\"version\":1}" + } + } + }, + "sources": + { + "C": + { + "id": 0 + } + } +} diff --git a/test/cmdlineTests/standard_model_checker_bmc_loop_iterations/input.json b/test/cmdlineTests/standard_model_checker_bmc_loop_iterations/input.json new file mode 100644 index 000000000000..e7d2d09bb5ae --- /dev/null +++ b/test/cmdlineTests/standard_model_checker_bmc_loop_iterations/input.json @@ -0,0 +1,29 @@ +{ + "language": "Solidity", + "sources": + { + "Source": + { + "content": "// SPDX-License-Identifier: GPL-3.0 + pragma solidity >=0.0; + contract C + { + function f(uint x) public pure { + require(x == 0); + do { + ++x; + } while (x < 2); + assert(x == 2); + } + }" + } + }, + "settings": + { + "modelChecker": + { + "engine": "bmc", + "bmcLoopIterations": 3 + } + } +} \ No newline at end of file diff --git a/test/cmdlineTests/standard_model_checker_bmc_loop_iterations/output.json b/test/cmdlineTests/standard_model_checker_bmc_loop_iterations/output.json new file mode 100644 index 000000000000..139b0825bc47 --- /dev/null +++ b/test/cmdlineTests/standard_model_checker_bmc_loop_iterations/output.json @@ -0,0 +1,22 @@ +{ + "errors": + [ + { + "component": "general", + "errorCode": "6002", + "formattedMessage": "Info: BMC: 1 verification condition(s) proved safe! Enable the model checker option \"show proved safe\" to see all of them. + +", + "message": "BMC: 1 verification condition(s) proved safe! Enable the model checker option \"show proved safe\" to see all of them.", + "severity": "info", + "type": "Info" + } + ], + "sources": + { + "Source": + { + "id": 0 + } + } +} diff --git a/test/cmdlineTests/standard_model_checker_bmc_loop_iterations_invalid_arg/input.json b/test/cmdlineTests/standard_model_checker_bmc_loop_iterations_invalid_arg/input.json new file mode 100644 index 000000000000..8c5fa65cd906 --- /dev/null +++ b/test/cmdlineTests/standard_model_checker_bmc_loop_iterations_invalid_arg/input.json @@ -0,0 +1,29 @@ +{ + "language": "Solidity", + "sources": + { + "Source": + { + "content": "// SPDX-License-Identifier: GPL-3.0 + pragma solidity >=0.0; + contract C + { + function f(uint x) public pure { + require(x == 0); + do { + ++x; + } while (x < 2); + assert(x == 2); + } + }" + } + }, + "settings": + { + "modelChecker": + { + "engine": "bmc", + "bmcLoopIterations": "bmc" + } + } +} diff --git a/test/cmdlineTests/standard_model_checker_bmc_loop_iterations_invalid_arg/output.json b/test/cmdlineTests/standard_model_checker_bmc_loop_iterations_invalid_arg/output.json new file mode 100644 index 000000000000..971973d85c0c --- /dev/null +++ b/test/cmdlineTests/standard_model_checker_bmc_loop_iterations_invalid_arg/output.json @@ -0,0 +1,12 @@ +{ + "errors": + [ + { + "component": "general", + "formattedMessage": "settings.modelChecker.bmcLoopIterations must be an unsigned integer.", + "message": "settings.modelChecker.bmcLoopIterations must be an unsigned integer.", + "severity": "error", + "type": "JSONError" + } + ] +} diff --git a/test/cmdlineTests/standard_model_checker_print_query_all/input.json b/test/cmdlineTests/standard_model_checker_print_query_all/input.json new file mode 100644 index 000000000000..67fc5d8c792c --- /dev/null +++ b/test/cmdlineTests/standard_model_checker_print_query_all/input.json @@ -0,0 +1,27 @@ +{ + "language": "Solidity", + "sources": + { + "A": + { + "content": "// SPDX-License-Identifier: GPL-3.0\npragma solidity >=0.0;\n + contract C + { + function f() public pure { + uint x = 0; + assert(x == 0); + } + }" + } + }, + "settings": + { + "modelChecker": + { + "engine": "all", + "printQuery": true, + "solvers": ["smtlib2"], + "timeout": 1000 + } + } +} diff --git a/test/cmdlineTests/standard_model_checker_print_query_all/output.json b/test/cmdlineTests/standard_model_checker_print_query_all/output.json new file mode 100644 index 000000000000..b8e11ced7301 --- /dev/null +++ b/test/cmdlineTests/standard_model_checker_print_query_all/output.json @@ -0,0 +1,540 @@ +{ + "auxiliaryInputRequested": + { + "smtlib2queries": + { + "0x1880095c52d8681601c6821e4a5c29740649509af99947bce54102546dd3376a": "(set-option :timeout 1000) +(set-logic HORN) +(declare-datatypes ((|bytes_tuple| 0)) (((|bytes_tuple| (|bytes_tuple_accessor_array| (Array Int Int)) (|bytes_tuple_accessor_length| Int))))) +(declare-datatypes ((|tx_type| 0)) (((|tx_type| (|block.basefee| Int) (|block.chainid| Int) (|block.coinbase| Int) (|block.gaslimit| Int) (|block.number| Int) (|block.prevrandao| Int) (|block.timestamp| Int) (|blockhash| (Array Int Int)) (|msg.data| |bytes_tuple|) (|msg.sender| Int) (|msg.sig| Int) (|msg.value| Int) (|tx.gasprice| Int) (|tx.origin| Int))))) +(declare-datatypes ((|ecrecover_input_type| 0)) (((|ecrecover_input_type| (|hash| Int) (|v| Int) (|r| Int) (|s| Int))))) +(declare-datatypes ((|crypto_type| 0)) (((|crypto_type| (|ecrecover| (Array |ecrecover_input_type| Int)) (|keccak256| (Array |bytes_tuple| Int)) (|ripemd160| (Array |bytes_tuple| Int)) (|sha256| (Array |bytes_tuple| Int)))))) +(declare-datatypes ((|abi_type| 0)) (((|abi_type|)))) +(declare-datatypes ((|state_type| 0)) (((|state_type| (|balances| (Array Int Int)))))) +(declare-fun |interface_0_C_16_0| (Int |abi_type| |crypto_type| |state_type| ) Bool) +(declare-fun |nondet_interface_1_C_16_0| (Int Int |abi_type| |crypto_type| |state_type| |state_type| ) Bool) +(declare-fun |summary_constructor_2_C_16_0| (Int Int |abi_type| |crypto_type| |tx_type| |state_type| |state_type| ) Bool) +(assert +(forall ( (abi_0 |abi_type|) (crypto_0 |crypto_type|) (error_0 Int) (state_0 |state_type|) (this_0 Int) (tx_0 |tx_type|)) +(=> (= error_0 0) (nondet_interface_1_C_16_0 error_0 this_0 abi_0 crypto_0 state_0 state_0)))) + + +(declare-fun |summary_3_function_f__15_16_0| (Int Int |abi_type| |crypto_type| |tx_type| |state_type| |state_type| ) Bool) +(declare-fun |summary_4_function_f__15_16_0| (Int Int |abi_type| |crypto_type| |tx_type| |state_type| |state_type| ) Bool) +(assert +(forall ( (abi_0 |abi_type|) (crypto_0 |crypto_type|) (error_0 Int) (error_1 Int) (state_0 |state_type|) (state_1 |state_type|) (state_2 |state_type|) (this_0 Int) (tx_0 |tx_type|)) +(=> (and (and (nondet_interface_1_C_16_0 error_0 this_0 abi_0 crypto_0 state_0 state_1) true) (and (= error_0 0) (summary_4_function_f__15_16_0 error_1 this_0 abi_0 crypto_0 tx_0 state_1 state_2))) (nondet_interface_1_C_16_0 error_1 this_0 abi_0 crypto_0 state_0 state_2)))) + + +(declare-fun |block_5_function_f__15_16_0| (Int Int |abi_type| |crypto_type| |tx_type| |state_type| |state_type| Int ) Bool) +(declare-fun |block_6_f_14_16_0| (Int Int |abi_type| |crypto_type| |tx_type| |state_type| |state_type| Int ) Bool) +(assert +(forall ( (abi_0 |abi_type|) (crypto_0 |crypto_type|) (error_0 Int) (error_1 Int) (state_0 |state_type|) (state_1 |state_type|) (state_2 |state_type|) (this_0 Int) (tx_0 |tx_type|) (x_5_0 Int) (x_5_1 Int)) +(block_5_function_f__15_16_0 error_0 this_0 abi_0 crypto_0 tx_0 state_0 state_1 x_5_1))) + + +(assert +(forall ( (abi_0 |abi_type|) (crypto_0 |crypto_type|) (error_0 Int) (error_1 Int) (state_0 |state_type|) (state_1 |state_type|) (state_2 |state_type|) (this_0 Int) (tx_0 |tx_type|) (x_5_0 Int) (x_5_1 Int)) +(=> (and (and (block_5_function_f__15_16_0 error_0 this_0 abi_0 crypto_0 tx_0 state_0 state_1 x_5_1) (and (and (and (and (= state_1 state_0) (= error_0 0)) true) true) true)) true) (block_6_f_14_16_0 error_0 this_0 abi_0 crypto_0 tx_0 state_0 state_1 x_5_1)))) + + +(declare-fun |block_7_return_function_f__15_16_0| (Int Int |abi_type| |crypto_type| |tx_type| |state_type| |state_type| Int ) Bool) +(declare-fun |block_8_function_f__15_16_0| (Int Int |abi_type| |crypto_type| |tx_type| |state_type| |state_type| Int ) Bool) +(assert +(forall ( (abi_0 |abi_type|) (crypto_0 |crypto_type|) (error_0 Int) (error_1 Int) (expr_10_0 Int) (expr_11_1 Bool) (expr_6_0 Int) (expr_9_0 Int) (state_0 |state_type|) (state_1 |state_type|) (state_2 |state_type|) (this_0 Int) (tx_0 |tx_type|) (x_5_0 Int) (x_5_1 Int) (x_5_2 Int)) +(=> (and (and (block_6_f_14_16_0 error_0 this_0 abi_0 crypto_0 tx_0 state_0 state_1 x_5_1) (and (= expr_11_1 (= expr_9_0 expr_10_0)) (and (=> true true) (and (= expr_10_0 0) (and (=> true (and (>= expr_9_0 0) (<= expr_9_0 115792089237316195423570985008687907853269984665640564039457584007913129639935))) (and (= expr_9_0 x_5_2) (and (= x_5_2 expr_6_0) (and (=> true true) (and (= expr_6_0 0) (and (= x_5_1 0) true)))))))))) (and (and true (not expr_11_1)) (= error_1 1))) (block_8_function_f__15_16_0 error_1 this_0 abi_0 crypto_0 tx_0 state_0 state_1 x_5_2)))) + + +(assert +(forall ( (abi_0 |abi_type|) (crypto_0 |crypto_type|) (error_0 Int) (error_1 Int) (expr_10_0 Int) (expr_11_1 Bool) (expr_6_0 Int) (expr_9_0 Int) (state_0 |state_type|) (state_1 |state_type|) (state_2 |state_type|) (this_0 Int) (tx_0 |tx_type|) (x_5_0 Int) (x_5_1 Int) (x_5_2 Int)) +(=> (block_8_function_f__15_16_0 error_1 this_0 abi_0 crypto_0 tx_0 state_0 state_1 x_5_2) (summary_3_function_f__15_16_0 error_1 this_0 abi_0 crypto_0 tx_0 state_0 state_1)))) + + +(assert +(forall ( (abi_0 |abi_type|) (crypto_0 |crypto_type|) (error_0 Int) (error_1 Int) (expr_10_0 Int) (expr_11_1 Bool) (expr_6_0 Int) (expr_9_0 Int) (state_0 |state_type|) (state_1 |state_type|) (state_2 |state_type|) (this_0 Int) (tx_0 |tx_type|) (x_5_0 Int) (x_5_1 Int) (x_5_2 Int)) +(=> (and (and (block_6_f_14_16_0 error_0 this_0 abi_0 crypto_0 tx_0 state_0 state_1 x_5_1) (and (= error_1 error_0) (and (= expr_11_1 (= expr_9_0 expr_10_0)) (and (=> true true) (and (= expr_10_0 0) (and (=> true (and (>= expr_9_0 0) (<= expr_9_0 115792089237316195423570985008687907853269984665640564039457584007913129639935))) (and (= expr_9_0 x_5_2) (and (= x_5_2 expr_6_0) (and (=> true true) (and (= expr_6_0 0) (and (= x_5_1 0) true))))))))))) true) (block_7_return_function_f__15_16_0 error_1 this_0 abi_0 crypto_0 tx_0 state_0 state_1 x_5_2)))) + + +(assert +(forall ( (abi_0 |abi_type|) (crypto_0 |crypto_type|) (error_0 Int) (error_1 Int) (expr_10_0 Int) (expr_11_1 Bool) (expr_6_0 Int) (expr_9_0 Int) (state_0 |state_type|) (state_1 |state_type|) (state_2 |state_type|) (this_0 Int) (tx_0 |tx_type|) (x_5_0 Int) (x_5_1 Int) (x_5_2 Int)) +(=> (and (and (block_7_return_function_f__15_16_0 error_0 this_0 abi_0 crypto_0 tx_0 state_0 state_1 x_5_1) true) true) (summary_3_function_f__15_16_0 error_0 this_0 abi_0 crypto_0 tx_0 state_0 state_1)))) + + +(declare-fun |block_9_function_f__15_16_0| (Int Int |abi_type| |crypto_type| |tx_type| |state_type| |state_type| Int ) Bool) +(assert +(forall ( (abi_0 |abi_type|) (crypto_0 |crypto_type|) (error_0 Int) (error_1 Int) (expr_10_0 Int) (expr_11_1 Bool) (expr_6_0 Int) (expr_9_0 Int) (state_0 |state_type|) (state_1 |state_type|) (state_2 |state_type|) (this_0 Int) (tx_0 |tx_type|) (x_5_0 Int) (x_5_1 Int) (x_5_2 Int)) +(block_9_function_f__15_16_0 error_0 this_0 abi_0 crypto_0 tx_0 state_0 state_1 x_5_1))) + + +(assert +(forall ( (abi_0 |abi_type|) (crypto_0 |crypto_type|) (error_0 Int) (error_1 Int) (expr_10_0 Int) (expr_11_1 Bool) (expr_6_0 Int) (expr_9_0 Int) (funds_2_0 Int) (state_0 |state_type|) (state_1 |state_type|) (state_2 |state_type|) (state_3 |state_type|) (this_0 Int) (tx_0 |tx_type|) (x_5_0 Int) (x_5_1 Int) (x_5_2 Int)) +(=> (and (and (block_9_function_f__15_16_0 error_0 this_0 abi_0 crypto_0 tx_0 state_0 state_1 x_5_1) (and (summary_3_function_f__15_16_0 error_1 this_0 abi_0 crypto_0 tx_0 state_2 state_3) (and (= state_2 (|state_type| (store (|balances| state_1) this_0 (+ (select (|balances| state_1) this_0) funds_2_0)))) (and (and (>= (+ (select (|balances| state_1) this_0) funds_2_0) 0) (<= (+ (select (|balances| state_1) this_0) funds_2_0) 115792089237316195423570985008687907853269984665640564039457584007913129639935)) (and (>= funds_2_0 (|msg.value| tx_0)) (and (and (and (and (and (and (and (and (and (and (and (and (and (> (|block.prevrandao| tx_0) 18446744073709551616) (and (>= (|block.basefee| tx_0) 0) (<= (|block.basefee| tx_0) 115792089237316195423570985008687907853269984665640564039457584007913129639935))) (and (>= (|block.chainid| tx_0) 0) (<= (|block.chainid| tx_0) 115792089237316195423570985008687907853269984665640564039457584007913129639935))) (and (>= (|block.coinbase| tx_0) 0) (<= (|block.coinbase| tx_0) 1461501637330902918203684832716283019655932542975))) (and (>= (|block.prevrandao| tx_0) 0) (<= (|block.prevrandao| tx_0) 115792089237316195423570985008687907853269984665640564039457584007913129639935))) (and (>= (|block.gaslimit| tx_0) 0) (<= (|block.gaslimit| tx_0) 115792089237316195423570985008687907853269984665640564039457584007913129639935))) (and (>= (|block.number| tx_0) 0) (<= (|block.number| tx_0) 115792089237316195423570985008687907853269984665640564039457584007913129639935))) (and (>= (|block.timestamp| tx_0) 0) (<= (|block.timestamp| tx_0) 115792089237316195423570985008687907853269984665640564039457584007913129639935))) (and (>= (|msg.sender| tx_0) 0) (<= (|msg.sender| tx_0) 1461501637330902918203684832716283019655932542975))) (and (>= (|msg.value| tx_0) 0) (<= (|msg.value| tx_0) 115792089237316195423570985008687907853269984665640564039457584007913129639935))) (and (>= (|tx.origin| tx_0) 0) (<= (|tx.origin| tx_0) 1461501637330902918203684832716283019655932542975))) (and (>= (|tx.gasprice| tx_0) 0) (<= (|tx.gasprice| tx_0) 115792089237316195423570985008687907853269984665640564039457584007913129639935))) (and (and (and (and (and (and (= (|msg.value| tx_0) 0) (= (|msg.sig| tx_0) 638722032)) (= (select (|bytes_tuple_accessor_array| (|msg.data| tx_0)) 0) 38)) (= (select (|bytes_tuple_accessor_array| (|msg.data| tx_0)) 1) 18)) (= (select (|bytes_tuple_accessor_array| (|msg.data| tx_0)) 2) 31)) (= (select (|bytes_tuple_accessor_array| (|msg.data| tx_0)) 3) 240)) (>= (|bytes_tuple_accessor_length| (|msg.data| tx_0)) 4))) (and (and (and (and (= state_1 state_0) (= error_0 0)) true) true) true))))))) true) (summary_4_function_f__15_16_0 error_1 this_0 abi_0 crypto_0 tx_0 state_0 state_3)))) + + +(assert +(forall ( (abi_0 |abi_type|) (crypto_0 |crypto_type|) (error_0 Int) (error_1 Int) (expr_10_0 Int) (expr_11_1 Bool) (expr_6_0 Int) (expr_9_0 Int) (funds_2_0 Int) (state_0 |state_type|) (state_1 |state_type|) (state_2 |state_type|) (state_3 |state_type|) (this_0 Int) (tx_0 |tx_type|) (x_5_0 Int) (x_5_1 Int) (x_5_2 Int)) +(=> (and (and (interface_0_C_16_0 this_0 abi_0 crypto_0 state_0) true) (and (summary_4_function_f__15_16_0 error_0 this_0 abi_0 crypto_0 tx_0 state_0 state_1) (= error_0 0))) (interface_0_C_16_0 this_0 abi_0 crypto_0 state_1)))) + + +(declare-fun |contract_initializer_10_C_16_0| (Int Int |abi_type| |crypto_type| |tx_type| |state_type| |state_type| ) Bool) +(declare-fun |contract_initializer_entry_11_C_16_0| (Int Int |abi_type| |crypto_type| |tx_type| |state_type| |state_type| ) Bool) +(assert +(forall ( (abi_0 |abi_type|) (crypto_0 |crypto_type|) (error_0 Int) (error_1 Int) (expr_10_0 Int) (expr_11_1 Bool) (expr_6_0 Int) (expr_9_0 Int) (funds_2_0 Int) (state_0 |state_type|) (state_1 |state_type|) (state_2 |state_type|) (state_3 |state_type|) (this_0 Int) (tx_0 |tx_type|) (x_5_0 Int) (x_5_1 Int) (x_5_2 Int)) +(=> (and (and (= state_1 state_0) (= error_0 0)) true) (contract_initializer_entry_11_C_16_0 error_0 this_0 abi_0 crypto_0 tx_0 state_0 state_1)))) + + +(declare-fun |contract_initializer_after_init_12_C_16_0| (Int Int |abi_type| |crypto_type| |tx_type| |state_type| |state_type| ) Bool) +(assert +(forall ( (abi_0 |abi_type|) (crypto_0 |crypto_type|) (error_0 Int) (error_1 Int) (expr_10_0 Int) (expr_11_1 Bool) (expr_6_0 Int) (expr_9_0 Int) (funds_2_0 Int) (state_0 |state_type|) (state_1 |state_type|) (state_2 |state_type|) (state_3 |state_type|) (this_0 Int) (tx_0 |tx_type|) (x_5_0 Int) (x_5_1 Int) (x_5_2 Int)) +(=> (and (and (contract_initializer_entry_11_C_16_0 error_0 this_0 abi_0 crypto_0 tx_0 state_0 state_1) true) true) (contract_initializer_after_init_12_C_16_0 error_0 this_0 abi_0 crypto_0 tx_0 state_0 state_1)))) + + +(assert +(forall ( (abi_0 |abi_type|) (crypto_0 |crypto_type|) (error_0 Int) (error_1 Int) (expr_10_0 Int) (expr_11_1 Bool) (expr_6_0 Int) (expr_9_0 Int) (funds_2_0 Int) (state_0 |state_type|) (state_1 |state_type|) (state_2 |state_type|) (state_3 |state_type|) (this_0 Int) (tx_0 |tx_type|) (x_5_0 Int) (x_5_1 Int) (x_5_2 Int)) +(=> (and (and (contract_initializer_after_init_12_C_16_0 error_0 this_0 abi_0 crypto_0 tx_0 state_0 state_1) true) true) (contract_initializer_10_C_16_0 error_0 this_0 abi_0 crypto_0 tx_0 state_0 state_1)))) + + +(declare-fun |implicit_constructor_entry_13_C_16_0| (Int Int |abi_type| |crypto_type| |tx_type| |state_type| |state_type| ) Bool) +(assert +(forall ( (abi_0 |abi_type|) (crypto_0 |crypto_type|) (error_0 Int) (error_1 Int) (expr_10_0 Int) (expr_11_1 Bool) (expr_6_0 Int) (expr_9_0 Int) (funds_2_0 Int) (state_0 |state_type|) (state_1 |state_type|) (state_2 |state_type|) (state_3 |state_type|) (this_0 Int) (tx_0 |tx_type|) (x_5_0 Int) (x_5_1 Int) (x_5_2 Int)) +(=> (and (and (and (and (and (= state_1 state_0) (= error_0 0)) true) true) true) (>= (select (|balances| state_1) this_0) (|msg.value| tx_0))) (implicit_constructor_entry_13_C_16_0 error_0 this_0 abi_0 crypto_0 tx_0 state_0 state_1)))) + + +(assert +(forall ( (abi_0 |abi_type|) (crypto_0 |crypto_type|) (error_0 Int) (error_1 Int) (expr_10_0 Int) (expr_11_1 Bool) (expr_6_0 Int) (expr_9_0 Int) (funds_2_0 Int) (state_0 |state_type|) (state_1 |state_type|) (state_2 |state_type|) (state_3 |state_type|) (this_0 Int) (tx_0 |tx_type|) (x_5_0 Int) (x_5_1 Int) (x_5_2 Int)) +(=> (and (and (implicit_constructor_entry_13_C_16_0 error_0 this_0 abi_0 crypto_0 tx_0 state_0 state_1) (and (contract_initializer_10_C_16_0 error_1 this_0 abi_0 crypto_0 tx_0 state_1 state_2) true)) (> error_1 0)) (summary_constructor_2_C_16_0 error_1 this_0 abi_0 crypto_0 tx_0 state_0 state_2)))) + + +(assert +(forall ( (abi_0 |abi_type|) (crypto_0 |crypto_type|) (error_0 Int) (error_1 Int) (expr_10_0 Int) (expr_11_1 Bool) (expr_6_0 Int) (expr_9_0 Int) (funds_2_0 Int) (state_0 |state_type|) (state_1 |state_type|) (state_2 |state_type|) (state_3 |state_type|) (this_0 Int) (tx_0 |tx_type|) (x_5_0 Int) (x_5_1 Int) (x_5_2 Int)) +(=> (and (and (implicit_constructor_entry_13_C_16_0 error_0 this_0 abi_0 crypto_0 tx_0 state_0 state_1) (and (= error_1 0) (and (contract_initializer_10_C_16_0 error_1 this_0 abi_0 crypto_0 tx_0 state_1 state_2) true))) true) (summary_constructor_2_C_16_0 error_1 this_0 abi_0 crypto_0 tx_0 state_0 state_2)))) + + +(assert +(forall ( (abi_0 |abi_type|) (crypto_0 |crypto_type|) (error_0 Int) (error_1 Int) (expr_10_0 Int) (expr_11_1 Bool) (expr_6_0 Int) (expr_9_0 Int) (funds_2_0 Int) (state_0 |state_type|) (state_1 |state_type|) (state_2 |state_type|) (state_3 |state_type|) (this_0 Int) (tx_0 |tx_type|) (x_5_0 Int) (x_5_1 Int) (x_5_2 Int)) +(=> (and (and (summary_constructor_2_C_16_0 error_0 this_0 abi_0 crypto_0 tx_0 state_0 state_1) true) (and (and (and (and (and (and (and (and (and (and (and (and (and (> (|block.prevrandao| tx_0) 18446744073709551616) (and (>= (|block.basefee| tx_0) 0) (<= (|block.basefee| tx_0) 115792089237316195423570985008687907853269984665640564039457584007913129639935))) (and (>= (|block.chainid| tx_0) 0) (<= (|block.chainid| tx_0) 115792089237316195423570985008687907853269984665640564039457584007913129639935))) (and (>= (|block.coinbase| tx_0) 0) (<= (|block.coinbase| tx_0) 1461501637330902918203684832716283019655932542975))) (and (>= (|block.prevrandao| tx_0) 0) (<= (|block.prevrandao| tx_0) 115792089237316195423570985008687907853269984665640564039457584007913129639935))) (and (>= (|block.gaslimit| tx_0) 0) (<= (|block.gaslimit| tx_0) 115792089237316195423570985008687907853269984665640564039457584007913129639935))) (and (>= (|block.number| tx_0) 0) (<= (|block.number| tx_0) 115792089237316195423570985008687907853269984665640564039457584007913129639935))) (and (>= (|block.timestamp| tx_0) 0) (<= (|block.timestamp| tx_0) 115792089237316195423570985008687907853269984665640564039457584007913129639935))) (and (>= (|msg.sender| tx_0) 0) (<= (|msg.sender| tx_0) 1461501637330902918203684832716283019655932542975))) (and (>= (|msg.value| tx_0) 0) (<= (|msg.value| tx_0) 115792089237316195423570985008687907853269984665640564039457584007913129639935))) (and (>= (|tx.origin| tx_0) 0) (<= (|tx.origin| tx_0) 1461501637330902918203684832716283019655932542975))) (and (>= (|tx.gasprice| tx_0) 0) (<= (|tx.gasprice| tx_0) 115792089237316195423570985008687907853269984665640564039457584007913129639935))) (= (|msg.value| tx_0) 0)) (= error_0 0))) (interface_0_C_16_0 this_0 abi_0 crypto_0 state_1)))) + + +(declare-fun |error_target_3_0| () Bool) +(assert +(forall ( (abi_0 |abi_type|) (crypto_0 |crypto_type|) (error_0 Int) (error_1 Int) (expr_10_0 Int) (expr_11_1 Bool) (expr_6_0 Int) (expr_9_0 Int) (funds_2_0 Int) (state_0 |state_type|) (state_1 |state_type|) (state_2 |state_type|) (state_3 |state_type|) (this_0 Int) (tx_0 |tx_type|) (x_5_0 Int) (x_5_1 Int) (x_5_2 Int)) +(=> (and (and (interface_0_C_16_0 this_0 abi_0 crypto_0 state_0) true) (and (summary_4_function_f__15_16_0 error_0 this_0 abi_0 crypto_0 tx_0 state_0 state_1) (= error_0 1))) error_target_3_0))) + + + +(assert +(forall ( (abi_0 |abi_type|) (crypto_0 |crypto_type|) (error_0 Int) (error_1 Int) (expr_10_0 Int) (expr_11_1 Bool) (expr_6_0 Int) (expr_9_0 Int) (funds_2_0 Int) (state_0 |state_type|) (state_1 |state_type|) (state_2 |state_type|) (state_3 |state_type|) (this_0 Int) (tx_0 |tx_type|) (x_5_0 Int) (x_5_1 Int) (x_5_2 Int)) +(=> error_target_3_0 false))) +(check-sat) +", + "0xcbfcc2413b217c6564ee01f322c9ca1f34fd79d19961dc3e62aa9c2e5dcb6efc": "(set-option :produce-models true) +(set-option :timeout 1000) +(set-logic ALL) +(declare-fun |x_5_3| () Int) +(declare-fun |error_0| () Int) +(declare-fun |this_0| () Int) +(declare-datatypes ((|bytes_tuple| 0)) (((|bytes_tuple| (|bytes_tuple_accessor_array| (Array Int Int)) (|bytes_tuple_accessor_length| Int))))) +(declare-datatypes ((|tx_type| 0)) (((|tx_type| (|block.basefee| Int) (|block.chainid| Int) (|block.coinbase| Int) (|block.gaslimit| Int) (|block.number| Int) (|block.prevrandao| Int) (|block.timestamp| Int) (|blockhash| (Array Int Int)) (|msg.data| |bytes_tuple|) (|msg.sender| Int) (|msg.sig| Int) (|msg.value| Int) (|tx.gasprice| Int) (|tx.origin| Int))))) +(declare-fun |tx_0| () |tx_type|) +(declare-datatypes ((|ecrecover_input_type| 0)) (((|ecrecover_input_type| (|hash| Int) (|v| Int) (|r| Int) (|s| Int))))) +(declare-datatypes ((|crypto_type| 0)) (((|crypto_type| (|ecrecover| (Array |ecrecover_input_type| Int)) (|keccak256| (Array |bytes_tuple| Int)) (|ripemd160| (Array |bytes_tuple| Int)) (|sha256| (Array |bytes_tuple| Int)))))) +(declare-fun |crypto_0| () |crypto_type|) +(declare-datatypes ((|abi_type| 0)) (((|abi_type|)))) +(declare-fun |abi_0| () |abi_type|) +(declare-datatypes ((|state_type| 0)) (((|state_type| (|balances| (Array Int Int)))))) +(declare-fun |state_0| () |state_type|) +(declare-fun |x_5_4| () Int) +(declare-fun |x_5_0| () Int) +(declare-fun |expr_6_0| () Int) +(declare-fun |x_5_1| () Int) +(declare-fun |expr_9_0| () Int) +(declare-fun |expr_10_0| () Int) +(declare-fun |expr_11_1| () Bool) + +(assert (and (and (and true true) (and (= expr_11_1 (= expr_9_0 expr_10_0)) (and (=> (and true true) true) (and (= expr_10_0 0) (and (=> (and true true) (and (>= expr_9_0 0) (<= expr_9_0 115792089237316195423570985008687907853269984665640564039457584007913129639935))) (and (= expr_9_0 x_5_1) (and (ite (and true true) (= x_5_1 expr_6_0) (= x_5_1 x_5_0)) (and (=> (and true true) true) (and (= expr_6_0 0) (and (= x_5_0 0) (and (and (and (and (and (and (and (and (and (and (and (and (and (> (|block.prevrandao| tx_0) 18446744073709551616) (and (>= (|block.basefee| tx_0) 0) (<= (|block.basefee| tx_0) 115792089237316195423570985008687907853269984665640564039457584007913129639935))) (and (>= (|block.chainid| tx_0) 0) (<= (|block.chainid| tx_0) 115792089237316195423570985008687907853269984665640564039457584007913129639935))) (and (>= (|block.coinbase| tx_0) 0) (<= (|block.coinbase| tx_0) 1461501637330902918203684832716283019655932542975))) (and (>= (|block.prevrandao| tx_0) 0) (<= (|block.prevrandao| tx_0) 115792089237316195423570985008687907853269984665640564039457584007913129639935))) (and (>= (|block.gaslimit| tx_0) 0) (<= (|block.gaslimit| tx_0) 115792089237316195423570985008687907853269984665640564039457584007913129639935))) (and (>= (|block.number| tx_0) 0) (<= (|block.number| tx_0) 115792089237316195423570985008687907853269984665640564039457584007913129639935))) (and (>= (|block.timestamp| tx_0) 0) (<= (|block.timestamp| tx_0) 115792089237316195423570985008687907853269984665640564039457584007913129639935))) (and (>= (|msg.sender| tx_0) 0) (<= (|msg.sender| tx_0) 1461501637330902918203684832716283019655932542975))) (and (>= (|msg.value| tx_0) 0) (<= (|msg.value| tx_0) 115792089237316195423570985008687907853269984665640564039457584007913129639935))) (and (>= (|tx.origin| tx_0) 0) (<= (|tx.origin| tx_0) 1461501637330902918203684832716283019655932542975))) (and (>= (|tx.gasprice| tx_0) 0) (<= (|tx.gasprice| tx_0) 115792089237316195423570985008687907853269984665640564039457584007913129639935))) (and (and (and (and (and (and (= (|msg.value| tx_0) 0) (= (|msg.sig| tx_0) 638722032)) (= (select (|bytes_tuple_accessor_array| (|msg.data| tx_0)) 0) 38)) (= (select (|bytes_tuple_accessor_array| (|msg.data| tx_0)) 1) 18)) (= (select (|bytes_tuple_accessor_array| (|msg.data| tx_0)) 2) 31)) (= (select (|bytes_tuple_accessor_array| (|msg.data| tx_0)) 3) 240)) (>= (|bytes_tuple_accessor_length| (|msg.data| tx_0)) 4))) true))))))))))) (not expr_11_1))) +(declare-const |EVALEXPR_0| Int) +(assert (= |EVALEXPR_0| x_5_1)) +(check-sat) +(get-value (|EVALEXPR_0| )) +" + } + }, + "errors": + [ + { + "component": "general", + "errorCode": "2339", + "formattedMessage": "Info: CHC: Requested query: +(set-option :timeout 1000) +(set-logic HORN) +(declare-datatypes ((|bytes_tuple| 0)) (((|bytes_tuple| (|bytes_tuple_accessor_array| (Array Int Int)) (|bytes_tuple_accessor_length| Int))))) +(declare-datatypes ((|tx_type| 0)) (((|tx_type| (|block.basefee| Int) (|block.chainid| Int) (|block.coinbase| Int) (|block.gaslimit| Int) (|block.number| Int) (|block.prevrandao| Int) (|block.timestamp| Int) (|blockhash| (Array Int Int)) (|msg.data| |bytes_tuple|) (|msg.sender| Int) (|msg.sig| Int) (|msg.value| Int) (|tx.gasprice| Int) (|tx.origin| Int))))) +(declare-datatypes ((|ecrecover_input_type| 0)) (((|ecrecover_input_type| (|hash| Int) (|v| Int) (|r| Int) (|s| Int))))) +(declare-datatypes ((|crypto_type| 0)) (((|crypto_type| (|ecrecover| (Array |ecrecover_input_type| Int)) (|keccak256| (Array |bytes_tuple| Int)) (|ripemd160| (Array |bytes_tuple| Int)) (|sha256| (Array |bytes_tuple| Int)))))) +(declare-datatypes ((|abi_type| 0)) (((|abi_type|)))) +(declare-datatypes ((|state_type| 0)) (((|state_type| (|balances| (Array Int Int)))))) +(declare-fun |interface_0_C_16_0| (Int |abi_type| |crypto_type| |state_type| ) Bool) +(declare-fun |nondet_interface_1_C_16_0| (Int Int |abi_type| |crypto_type| |state_type| |state_type| ) Bool) +(declare-fun |summary_constructor_2_C_16_0| (Int Int |abi_type| |crypto_type| |tx_type| |state_type| |state_type| ) Bool) +(assert +(forall ( (abi_0 |abi_type|) (crypto_0 |crypto_type|) (error_0 Int) (state_0 |state_type|) (this_0 Int) (tx_0 |tx_type|)) +(=> (= error_0 0) (nondet_interface_1_C_16_0 error_0 this_0 abi_0 crypto_0 state_0 state_0)))) + + +(declare-fun |summary_3_function_f__15_16_0| (Int Int |abi_type| |crypto_type| |tx_type| |state_type| |state_type| ) Bool) +(declare-fun |summary_4_function_f__15_16_0| (Int Int |abi_type| |crypto_type| |tx_type| |state_type| |state_type| ) Bool) +(assert +(forall ( (abi_0 |abi_type|) (crypto_0 |crypto_type|) (error_0 Int) (error_1 Int) (state_0 |state_type|) (state_1 |state_type|) (state_2 |state_type|) (this_0 Int) (tx_0 |tx_type|)) +(=> (and (and (nondet_interface_1_C_16_0 error_0 this_0 abi_0 crypto_0 state_0 state_1) true) (and (= error_0 0) (summary_4_function_f__15_16_0 error_1 this_0 abi_0 crypto_0 tx_0 state_1 state_2))) (nondet_interface_1_C_16_0 error_1 this_0 abi_0 crypto_0 state_0 state_2)))) + + +(declare-fun |block_5_function_f__15_16_0| (Int Int |abi_type| |crypto_type| |tx_type| |state_type| |state_type| Int ) Bool) +(declare-fun |block_6_f_14_16_0| (Int Int |abi_type| |crypto_type| |tx_type| |state_type| |state_type| Int ) Bool) +(assert +(forall ( (abi_0 |abi_type|) (crypto_0 |crypto_type|) (error_0 Int) (error_1 Int) (state_0 |state_type|) (state_1 |state_type|) (state_2 |state_type|) (this_0 Int) (tx_0 |tx_type|) (x_5_0 Int) (x_5_1 Int)) +(block_5_function_f__15_16_0 error_0 this_0 abi_0 crypto_0 tx_0 state_0 state_1 x_5_1))) + + +(assert +(forall ( (abi_0 |abi_type|) (crypto_0 |crypto_type|) (error_0 Int) (error_1 Int) (state_0 |state_type|) (state_1 |state_type|) (state_2 |state_type|) (this_0 Int) (tx_0 |tx_type|) (x_5_0 Int) (x_5_1 Int)) +(=> (and (and (block_5_function_f__15_16_0 error_0 this_0 abi_0 crypto_0 tx_0 state_0 state_1 x_5_1) (and (and (and (and (= state_1 state_0) (= error_0 0)) true) true) true)) true) (block_6_f_14_16_0 error_0 this_0 abi_0 crypto_0 tx_0 state_0 state_1 x_5_1)))) + + +(declare-fun |block_7_return_function_f__15_16_0| (Int Int |abi_type| |crypto_type| |tx_type| |state_type| |state_type| Int ) Bool) +(declare-fun |block_8_function_f__15_16_0| (Int Int |abi_type| |crypto_type| |tx_type| |state_type| |state_type| Int ) Bool) +(assert +(forall ( (abi_0 |abi_type|) (crypto_0 |crypto_type|) (error_0 Int) (error_1 Int) (expr_10_0 Int) (expr_11_1 Bool) (expr_6_0 Int) (expr_9_0 Int) (state_0 |state_type|) (state_1 |state_type|) (state_2 |state_type|) (this_0 Int) (tx_0 |tx_type|) (x_5_0 Int) (x_5_1 Int) (x_5_2 Int)) +(=> (and (and (block_6_f_14_16_0 error_0 this_0 abi_0 crypto_0 tx_0 state_0 state_1 x_5_1) (and (= expr_11_1 (= expr_9_0 expr_10_0)) (and (=> true true) (and (= expr_10_0 0) (and (=> true (and (>= expr_9_0 0) (<= expr_9_0 115792089237316195423570985008687907853269984665640564039457584007913129639935))) (and (= expr_9_0 x_5_2) (and (= x_5_2 expr_6_0) (and (=> true true) (and (= expr_6_0 0) (and (= x_5_1 0) true)))))))))) (and (and true (not expr_11_1)) (= error_1 1))) (block_8_function_f__15_16_0 error_1 this_0 abi_0 crypto_0 tx_0 state_0 state_1 x_5_2)))) + + +(assert +(forall ( (abi_0 |abi_type|) (crypto_0 |crypto_type|) (error_0 Int) (error_1 Int) (expr_10_0 Int) (expr_11_1 Bool) (expr_6_0 Int) (expr_9_0 Int) (state_0 |state_type|) (state_1 |state_type|) (state_2 |state_type|) (this_0 Int) (tx_0 |tx_type|) (x_5_0 Int) (x_5_1 Int) (x_5_2 Int)) +(=> (block_8_function_f__15_16_0 error_1 this_0 abi_0 crypto_0 tx_0 state_0 state_1 x_5_2) (summary_3_function_f__15_16_0 error_1 this_0 abi_0 crypto_0 tx_0 state_0 state_1)))) + + +(assert +(forall ( (abi_0 |abi_type|) (crypto_0 |crypto_type|) (error_0 Int) (error_1 Int) (expr_10_0 Int) (expr_11_1 Bool) (expr_6_0 Int) (expr_9_0 Int) (state_0 |state_type|) (state_1 |state_type|) (state_2 |state_type|) (this_0 Int) (tx_0 |tx_type|) (x_5_0 Int) (x_5_1 Int) (x_5_2 Int)) +(=> (and (and (block_6_f_14_16_0 error_0 this_0 abi_0 crypto_0 tx_0 state_0 state_1 x_5_1) (and (= error_1 error_0) (and (= expr_11_1 (= expr_9_0 expr_10_0)) (and (=> true true) (and (= expr_10_0 0) (and (=> true (and (>= expr_9_0 0) (<= expr_9_0 115792089237316195423570985008687907853269984665640564039457584007913129639935))) (and (= expr_9_0 x_5_2) (and (= x_5_2 expr_6_0) (and (=> true true) (and (= expr_6_0 0) (and (= x_5_1 0) true))))))))))) true) (block_7_return_function_f__15_16_0 error_1 this_0 abi_0 crypto_0 tx_0 state_0 state_1 x_5_2)))) + + +(assert +(forall ( (abi_0 |abi_type|) (crypto_0 |crypto_type|) (error_0 Int) (error_1 Int) (expr_10_0 Int) (expr_11_1 Bool) (expr_6_0 Int) (expr_9_0 Int) (state_0 |state_type|) (state_1 |state_type|) (state_2 |state_type|) (this_0 Int) (tx_0 |tx_type|) (x_5_0 Int) (x_5_1 Int) (x_5_2 Int)) +(=> (and (and (block_7_return_function_f__15_16_0 error_0 this_0 abi_0 crypto_0 tx_0 state_0 state_1 x_5_1) true) true) (summary_3_function_f__15_16_0 error_0 this_0 abi_0 crypto_0 tx_0 state_0 state_1)))) + + +(declare-fun |block_9_function_f__15_16_0| (Int Int |abi_type| |crypto_type| |tx_type| |state_type| |state_type| Int ) Bool) +(assert +(forall ( (abi_0 |abi_type|) (crypto_0 |crypto_type|) (error_0 Int) (error_1 Int) (expr_10_0 Int) (expr_11_1 Bool) (expr_6_0 Int) (expr_9_0 Int) (state_0 |state_type|) (state_1 |state_type|) (state_2 |state_type|) (this_0 Int) (tx_0 |tx_type|) (x_5_0 Int) (x_5_1 Int) (x_5_2 Int)) +(block_9_function_f__15_16_0 error_0 this_0 abi_0 crypto_0 tx_0 state_0 state_1 x_5_1))) + + +(assert +(forall ( (abi_0 |abi_type|) (crypto_0 |crypto_type|) (error_0 Int) (error_1 Int) (expr_10_0 Int) (expr_11_1 Bool) (expr_6_0 Int) (expr_9_0 Int) (funds_2_0 Int) (state_0 |state_type|) (state_1 |state_type|) (state_2 |state_type|) (state_3 |state_type|) (this_0 Int) (tx_0 |tx_type|) (x_5_0 Int) (x_5_1 Int) (x_5_2 Int)) +(=> (and (and (block_9_function_f__15_16_0 error_0 this_0 abi_0 crypto_0 tx_0 state_0 state_1 x_5_1) (and (summary_3_function_f__15_16_0 error_1 this_0 abi_0 crypto_0 tx_0 state_2 state_3) (and (= state_2 (|state_type| (store (|balances| state_1) this_0 (+ (select (|balances| state_1) this_0) funds_2_0)))) (and (and (>= (+ (select (|balances| state_1) this_0) funds_2_0) 0) (<= (+ (select (|balances| state_1) this_0) funds_2_0) 115792089237316195423570985008687907853269984665640564039457584007913129639935)) (and (>= funds_2_0 (|msg.value| tx_0)) (and (and (and (and (and (and (and (and (and (and (and (and (and (> (|block.prevrandao| tx_0) 18446744073709551616) (and (>= (|block.basefee| tx_0) 0) (<= (|block.basefee| tx_0) 115792089237316195423570985008687907853269984665640564039457584007913129639935))) (and (>= (|block.chainid| tx_0) 0) (<= (|block.chainid| tx_0) 115792089237316195423570985008687907853269984665640564039457584007913129639935))) (and (>= (|block.coinbase| tx_0) 0) (<= (|block.coinbase| tx_0) 1461501637330902918203684832716283019655932542975))) (and (>= (|block.prevrandao| tx_0) 0) (<= (|block.prevrandao| tx_0) 115792089237316195423570985008687907853269984665640564039457584007913129639935))) (and (>= (|block.gaslimit| tx_0) 0) (<= (|block.gaslimit| tx_0) 115792089237316195423570985008687907853269984665640564039457584007913129639935))) (and (>= (|block.number| tx_0) 0) (<= (|block.number| tx_0) 115792089237316195423570985008687907853269984665640564039457584007913129639935))) (and (>= (|block.timestamp| tx_0) 0) (<= (|block.timestamp| tx_0) 115792089237316195423570985008687907853269984665640564039457584007913129639935))) (and (>= (|msg.sender| tx_0) 0) (<= (|msg.sender| tx_0) 1461501637330902918203684832716283019655932542975))) (and (>= (|msg.value| tx_0) 0) (<= (|msg.value| tx_0) 115792089237316195423570985008687907853269984665640564039457584007913129639935))) (and (>= (|tx.origin| tx_0) 0) (<= (|tx.origin| tx_0) 1461501637330902918203684832716283019655932542975))) (and (>= (|tx.gasprice| tx_0) 0) (<= (|tx.gasprice| tx_0) 115792089237316195423570985008687907853269984665640564039457584007913129639935))) (and (and (and (and (and (and (= (|msg.value| tx_0) 0) (= (|msg.sig| tx_0) 638722032)) (= (select (|bytes_tuple_accessor_array| (|msg.data| tx_0)) 0) 38)) (= (select (|bytes_tuple_accessor_array| (|msg.data| tx_0)) 1) 18)) (= (select (|bytes_tuple_accessor_array| (|msg.data| tx_0)) 2) 31)) (= (select (|bytes_tuple_accessor_array| (|msg.data| tx_0)) 3) 240)) (>= (|bytes_tuple_accessor_length| (|msg.data| tx_0)) 4))) (and (and (and (and (= state_1 state_0) (= error_0 0)) true) true) true))))))) true) (summary_4_function_f__15_16_0 error_1 this_0 abi_0 crypto_0 tx_0 state_0 state_3)))) + + +(assert +(forall ( (abi_0 |abi_type|) (crypto_0 |crypto_type|) (error_0 Int) (error_1 Int) (expr_10_0 Int) (expr_11_1 Bool) (expr_6_0 Int) (expr_9_0 Int) (funds_2_0 Int) (state_0 |state_type|) (state_1 |state_type|) (state_2 |state_type|) (state_3 |state_type|) (this_0 Int) (tx_0 |tx_type|) (x_5_0 Int) (x_5_1 Int) (x_5_2 Int)) +(=> (and (and (interface_0_C_16_0 this_0 abi_0 crypto_0 state_0) true) (and (summary_4_function_f__15_16_0 error_0 this_0 abi_0 crypto_0 tx_0 state_0 state_1) (= error_0 0))) (interface_0_C_16_0 this_0 abi_0 crypto_0 state_1)))) + + +(declare-fun |contract_initializer_10_C_16_0| (Int Int |abi_type| |crypto_type| |tx_type| |state_type| |state_type| ) Bool) +(declare-fun |contract_initializer_entry_11_C_16_0| (Int Int |abi_type| |crypto_type| |tx_type| |state_type| |state_type| ) Bool) +(assert +(forall ( (abi_0 |abi_type|) (crypto_0 |crypto_type|) (error_0 Int) (error_1 Int) (expr_10_0 Int) (expr_11_1 Bool) (expr_6_0 Int) (expr_9_0 Int) (funds_2_0 Int) (state_0 |state_type|) (state_1 |state_type|) (state_2 |state_type|) (state_3 |state_type|) (this_0 Int) (tx_0 |tx_type|) (x_5_0 Int) (x_5_1 Int) (x_5_2 Int)) +(=> (and (and (= state_1 state_0) (= error_0 0)) true) (contract_initializer_entry_11_C_16_0 error_0 this_0 abi_0 crypto_0 tx_0 state_0 state_1)))) + + +(declare-fun |contract_initializer_after_init_12_C_16_0| (Int Int |abi_type| |crypto_type| |tx_type| |state_type| |state_type| ) Bool) +(assert +(forall ( (abi_0 |abi_type|) (crypto_0 |crypto_type|) (error_0 Int) (error_1 Int) (expr_10_0 Int) (expr_11_1 Bool) (expr_6_0 Int) (expr_9_0 Int) (funds_2_0 Int) (state_0 |state_type|) (state_1 |state_type|) (state_2 |state_type|) (state_3 |state_type|) (this_0 Int) (tx_0 |tx_type|) (x_5_0 Int) (x_5_1 Int) (x_5_2 Int)) +(=> (and (and (contract_initializer_entry_11_C_16_0 error_0 this_0 abi_0 crypto_0 tx_0 state_0 state_1) true) true) (contract_initializer_after_init_12_C_16_0 error_0 this_0 abi_0 crypto_0 tx_0 state_0 state_1)))) + + +(assert +(forall ( (abi_0 |abi_type|) (crypto_0 |crypto_type|) (error_0 Int) (error_1 Int) (expr_10_0 Int) (expr_11_1 Bool) (expr_6_0 Int) (expr_9_0 Int) (funds_2_0 Int) (state_0 |state_type|) (state_1 |state_type|) (state_2 |state_type|) (state_3 |state_type|) (this_0 Int) (tx_0 |tx_type|) (x_5_0 Int) (x_5_1 Int) (x_5_2 Int)) +(=> (and (and (contract_initializer_after_init_12_C_16_0 error_0 this_0 abi_0 crypto_0 tx_0 state_0 state_1) true) true) (contract_initializer_10_C_16_0 error_0 this_0 abi_0 crypto_0 tx_0 state_0 state_1)))) + + +(declare-fun |implicit_constructor_entry_13_C_16_0| (Int Int |abi_type| |crypto_type| |tx_type| |state_type| |state_type| ) Bool) +(assert +(forall ( (abi_0 |abi_type|) (crypto_0 |crypto_type|) (error_0 Int) (error_1 Int) (expr_10_0 Int) (expr_11_1 Bool) (expr_6_0 Int) (expr_9_0 Int) (funds_2_0 Int) (state_0 |state_type|) (state_1 |state_type|) (state_2 |state_type|) (state_3 |state_type|) (this_0 Int) (tx_0 |tx_type|) (x_5_0 Int) (x_5_1 Int) (x_5_2 Int)) +(=> (and (and (and (and (and (= state_1 state_0) (= error_0 0)) true) true) true) (>= (select (|balances| state_1) this_0) (|msg.value| tx_0))) (implicit_constructor_entry_13_C_16_0 error_0 this_0 abi_0 crypto_0 tx_0 state_0 state_1)))) + + +(assert +(forall ( (abi_0 |abi_type|) (crypto_0 |crypto_type|) (error_0 Int) (error_1 Int) (expr_10_0 Int) (expr_11_1 Bool) (expr_6_0 Int) (expr_9_0 Int) (funds_2_0 Int) (state_0 |state_type|) (state_1 |state_type|) (state_2 |state_type|) (state_3 |state_type|) (this_0 Int) (tx_0 |tx_type|) (x_5_0 Int) (x_5_1 Int) (x_5_2 Int)) +(=> (and (and (implicit_constructor_entry_13_C_16_0 error_0 this_0 abi_0 crypto_0 tx_0 state_0 state_1) (and (contract_initializer_10_C_16_0 error_1 this_0 abi_0 crypto_0 tx_0 state_1 state_2) true)) (> error_1 0)) (summary_constructor_2_C_16_0 error_1 this_0 abi_0 crypto_0 tx_0 state_0 state_2)))) + + +(assert +(forall ( (abi_0 |abi_type|) (crypto_0 |crypto_type|) (error_0 Int) (error_1 Int) (expr_10_0 Int) (expr_11_1 Bool) (expr_6_0 Int) (expr_9_0 Int) (funds_2_0 Int) (state_0 |state_type|) (state_1 |state_type|) (state_2 |state_type|) (state_3 |state_type|) (this_0 Int) (tx_0 |tx_type|) (x_5_0 Int) (x_5_1 Int) (x_5_2 Int)) +(=> (and (and (implicit_constructor_entry_13_C_16_0 error_0 this_0 abi_0 crypto_0 tx_0 state_0 state_1) (and (= error_1 0) (and (contract_initializer_10_C_16_0 error_1 this_0 abi_0 crypto_0 tx_0 state_1 state_2) true))) true) (summary_constructor_2_C_16_0 error_1 this_0 abi_0 crypto_0 tx_0 state_0 state_2)))) + + +(assert +(forall ( (abi_0 |abi_type|) (crypto_0 |crypto_type|) (error_0 Int) (error_1 Int) (expr_10_0 Int) (expr_11_1 Bool) (expr_6_0 Int) (expr_9_0 Int) (funds_2_0 Int) (state_0 |state_type|) (state_1 |state_type|) (state_2 |state_type|) (state_3 |state_type|) (this_0 Int) (tx_0 |tx_type|) (x_5_0 Int) (x_5_1 Int) (x_5_2 Int)) +(=> (and (and (summary_constructor_2_C_16_0 error_0 this_0 abi_0 crypto_0 tx_0 state_0 state_1) true) (and (and (and (and (and (and (and (and (and (and (and (and (and (> (|block.prevrandao| tx_0) 18446744073709551616) (and (>= (|block.basefee| tx_0) 0) (<= (|block.basefee| tx_0) 115792089237316195423570985008687907853269984665640564039457584007913129639935))) (and (>= (|block.chainid| tx_0) 0) (<= (|block.chainid| tx_0) 115792089237316195423570985008687907853269984665640564039457584007913129639935))) (and (>= (|block.coinbase| tx_0) 0) (<= (|block.coinbase| tx_0) 1461501637330902918203684832716283019655932542975))) (and (>= (|block.prevrandao| tx_0) 0) (<= (|block.prevrandao| tx_0) 115792089237316195423570985008687907853269984665640564039457584007913129639935))) (and (>= (|block.gaslimit| tx_0) 0) (<= (|block.gaslimit| tx_0) 115792089237316195423570985008687907853269984665640564039457584007913129639935))) (and (>= (|block.number| tx_0) 0) (<= (|block.number| tx_0) 115792089237316195423570985008687907853269984665640564039457584007913129639935))) (and (>= (|block.timestamp| tx_0) 0) (<= (|block.timestamp| tx_0) 115792089237316195423570985008687907853269984665640564039457584007913129639935))) (and (>= (|msg.sender| tx_0) 0) (<= (|msg.sender| tx_0) 1461501637330902918203684832716283019655932542975))) (and (>= (|msg.value| tx_0) 0) (<= (|msg.value| tx_0) 115792089237316195423570985008687907853269984665640564039457584007913129639935))) (and (>= (|tx.origin| tx_0) 0) (<= (|tx.origin| tx_0) 1461501637330902918203684832716283019655932542975))) (and (>= (|tx.gasprice| tx_0) 0) (<= (|tx.gasprice| tx_0) 115792089237316195423570985008687907853269984665640564039457584007913129639935))) (= (|msg.value| tx_0) 0)) (= error_0 0))) (interface_0_C_16_0 this_0 abi_0 crypto_0 state_1)))) + + +(declare-fun |error_target_3_0| () Bool) +(assert +(forall ( (abi_0 |abi_type|) (crypto_0 |crypto_type|) (error_0 Int) (error_1 Int) (expr_10_0 Int) (expr_11_1 Bool) (expr_6_0 Int) (expr_9_0 Int) (funds_2_0 Int) (state_0 |state_type|) (state_1 |state_type|) (state_2 |state_type|) (state_3 |state_type|) (this_0 Int) (tx_0 |tx_type|) (x_5_0 Int) (x_5_1 Int) (x_5_2 Int)) +(=> (and (and (interface_0_C_16_0 this_0 abi_0 crypto_0 state_0) true) (and (summary_4_function_f__15_16_0 error_0 this_0 abi_0 crypto_0 tx_0 state_0 state_1) (= error_0 1))) error_target_3_0))) + + + +(assert +(forall ( (abi_0 |abi_type|) (crypto_0 |crypto_type|) (error_0 Int) (error_1 Int) (expr_10_0 Int) (expr_11_1 Bool) (expr_6_0 Int) (expr_9_0 Int) (funds_2_0 Int) (state_0 |state_type|) (state_1 |state_type|) (state_2 |state_type|) (state_3 |state_type|) (this_0 Int) (tx_0 |tx_type|) (x_5_0 Int) (x_5_1 Int) (x_5_2 Int)) +(=> error_target_3_0 false))) +(check-sat) + + +", + "message": "CHC: Requested query: +(set-option :timeout 1000) +(set-logic HORN) +(declare-datatypes ((|bytes_tuple| 0)) (((|bytes_tuple| (|bytes_tuple_accessor_array| (Array Int Int)) (|bytes_tuple_accessor_length| Int))))) +(declare-datatypes ((|tx_type| 0)) (((|tx_type| (|block.basefee| Int) (|block.chainid| Int) (|block.coinbase| Int) (|block.gaslimit| Int) (|block.number| Int) (|block.prevrandao| Int) (|block.timestamp| Int) (|blockhash| (Array Int Int)) (|msg.data| |bytes_tuple|) (|msg.sender| Int) (|msg.sig| Int) (|msg.value| Int) (|tx.gasprice| Int) (|tx.origin| Int))))) +(declare-datatypes ((|ecrecover_input_type| 0)) (((|ecrecover_input_type| (|hash| Int) (|v| Int) (|r| Int) (|s| Int))))) +(declare-datatypes ((|crypto_type| 0)) (((|crypto_type| (|ecrecover| (Array |ecrecover_input_type| Int)) (|keccak256| (Array |bytes_tuple| Int)) (|ripemd160| (Array |bytes_tuple| Int)) (|sha256| (Array |bytes_tuple| Int)))))) +(declare-datatypes ((|abi_type| 0)) (((|abi_type|)))) +(declare-datatypes ((|state_type| 0)) (((|state_type| (|balances| (Array Int Int)))))) +(declare-fun |interface_0_C_16_0| (Int |abi_type| |crypto_type| |state_type| ) Bool) +(declare-fun |nondet_interface_1_C_16_0| (Int Int |abi_type| |crypto_type| |state_type| |state_type| ) Bool) +(declare-fun |summary_constructor_2_C_16_0| (Int Int |abi_type| |crypto_type| |tx_type| |state_type| |state_type| ) Bool) +(assert +(forall ( (abi_0 |abi_type|) (crypto_0 |crypto_type|) (error_0 Int) (state_0 |state_type|) (this_0 Int) (tx_0 |tx_type|)) +(=> (= error_0 0) (nondet_interface_1_C_16_0 error_0 this_0 abi_0 crypto_0 state_0 state_0)))) + + +(declare-fun |summary_3_function_f__15_16_0| (Int Int |abi_type| |crypto_type| |tx_type| |state_type| |state_type| ) Bool) +(declare-fun |summary_4_function_f__15_16_0| (Int Int |abi_type| |crypto_type| |tx_type| |state_type| |state_type| ) Bool) +(assert +(forall ( (abi_0 |abi_type|) (crypto_0 |crypto_type|) (error_0 Int) (error_1 Int) (state_0 |state_type|) (state_1 |state_type|) (state_2 |state_type|) (this_0 Int) (tx_0 |tx_type|)) +(=> (and (and (nondet_interface_1_C_16_0 error_0 this_0 abi_0 crypto_0 state_0 state_1) true) (and (= error_0 0) (summary_4_function_f__15_16_0 error_1 this_0 abi_0 crypto_0 tx_0 state_1 state_2))) (nondet_interface_1_C_16_0 error_1 this_0 abi_0 crypto_0 state_0 state_2)))) + + +(declare-fun |block_5_function_f__15_16_0| (Int Int |abi_type| |crypto_type| |tx_type| |state_type| |state_type| Int ) Bool) +(declare-fun |block_6_f_14_16_0| (Int Int |abi_type| |crypto_type| |tx_type| |state_type| |state_type| Int ) Bool) +(assert +(forall ( (abi_0 |abi_type|) (crypto_0 |crypto_type|) (error_0 Int) (error_1 Int) (state_0 |state_type|) (state_1 |state_type|) (state_2 |state_type|) (this_0 Int) (tx_0 |tx_type|) (x_5_0 Int) (x_5_1 Int)) +(block_5_function_f__15_16_0 error_0 this_0 abi_0 crypto_0 tx_0 state_0 state_1 x_5_1))) + + +(assert +(forall ( (abi_0 |abi_type|) (crypto_0 |crypto_type|) (error_0 Int) (error_1 Int) (state_0 |state_type|) (state_1 |state_type|) (state_2 |state_type|) (this_0 Int) (tx_0 |tx_type|) (x_5_0 Int) (x_5_1 Int)) +(=> (and (and (block_5_function_f__15_16_0 error_0 this_0 abi_0 crypto_0 tx_0 state_0 state_1 x_5_1) (and (and (and (and (= state_1 state_0) (= error_0 0)) true) true) true)) true) (block_6_f_14_16_0 error_0 this_0 abi_0 crypto_0 tx_0 state_0 state_1 x_5_1)))) + + +(declare-fun |block_7_return_function_f__15_16_0| (Int Int |abi_type| |crypto_type| |tx_type| |state_type| |state_type| Int ) Bool) +(declare-fun |block_8_function_f__15_16_0| (Int Int |abi_type| |crypto_type| |tx_type| |state_type| |state_type| Int ) Bool) +(assert +(forall ( (abi_0 |abi_type|) (crypto_0 |crypto_type|) (error_0 Int) (error_1 Int) (expr_10_0 Int) (expr_11_1 Bool) (expr_6_0 Int) (expr_9_0 Int) (state_0 |state_type|) (state_1 |state_type|) (state_2 |state_type|) (this_0 Int) (tx_0 |tx_type|) (x_5_0 Int) (x_5_1 Int) (x_5_2 Int)) +(=> (and (and (block_6_f_14_16_0 error_0 this_0 abi_0 crypto_0 tx_0 state_0 state_1 x_5_1) (and (= expr_11_1 (= expr_9_0 expr_10_0)) (and (=> true true) (and (= expr_10_0 0) (and (=> true (and (>= expr_9_0 0) (<= expr_9_0 115792089237316195423570985008687907853269984665640564039457584007913129639935))) (and (= expr_9_0 x_5_2) (and (= x_5_2 expr_6_0) (and (=> true true) (and (= expr_6_0 0) (and (= x_5_1 0) true)))))))))) (and (and true (not expr_11_1)) (= error_1 1))) (block_8_function_f__15_16_0 error_1 this_0 abi_0 crypto_0 tx_0 state_0 state_1 x_5_2)))) + + +(assert +(forall ( (abi_0 |abi_type|) (crypto_0 |crypto_type|) (error_0 Int) (error_1 Int) (expr_10_0 Int) (expr_11_1 Bool) (expr_6_0 Int) (expr_9_0 Int) (state_0 |state_type|) (state_1 |state_type|) (state_2 |state_type|) (this_0 Int) (tx_0 |tx_type|) (x_5_0 Int) (x_5_1 Int) (x_5_2 Int)) +(=> (block_8_function_f__15_16_0 error_1 this_0 abi_0 crypto_0 tx_0 state_0 state_1 x_5_2) (summary_3_function_f__15_16_0 error_1 this_0 abi_0 crypto_0 tx_0 state_0 state_1)))) + + +(assert +(forall ( (abi_0 |abi_type|) (crypto_0 |crypto_type|) (error_0 Int) (error_1 Int) (expr_10_0 Int) (expr_11_1 Bool) (expr_6_0 Int) (expr_9_0 Int) (state_0 |state_type|) (state_1 |state_type|) (state_2 |state_type|) (this_0 Int) (tx_0 |tx_type|) (x_5_0 Int) (x_5_1 Int) (x_5_2 Int)) +(=> (and (and (block_6_f_14_16_0 error_0 this_0 abi_0 crypto_0 tx_0 state_0 state_1 x_5_1) (and (= error_1 error_0) (and (= expr_11_1 (= expr_9_0 expr_10_0)) (and (=> true true) (and (= expr_10_0 0) (and (=> true (and (>= expr_9_0 0) (<= expr_9_0 115792089237316195423570985008687907853269984665640564039457584007913129639935))) (and (= expr_9_0 x_5_2) (and (= x_5_2 expr_6_0) (and (=> true true) (and (= expr_6_0 0) (and (= x_5_1 0) true))))))))))) true) (block_7_return_function_f__15_16_0 error_1 this_0 abi_0 crypto_0 tx_0 state_0 state_1 x_5_2)))) + + +(assert +(forall ( (abi_0 |abi_type|) (crypto_0 |crypto_type|) (error_0 Int) (error_1 Int) (expr_10_0 Int) (expr_11_1 Bool) (expr_6_0 Int) (expr_9_0 Int) (state_0 |state_type|) (state_1 |state_type|) (state_2 |state_type|) (this_0 Int) (tx_0 |tx_type|) (x_5_0 Int) (x_5_1 Int) (x_5_2 Int)) +(=> (and (and (block_7_return_function_f__15_16_0 error_0 this_0 abi_0 crypto_0 tx_0 state_0 state_1 x_5_1) true) true) (summary_3_function_f__15_16_0 error_0 this_0 abi_0 crypto_0 tx_0 state_0 state_1)))) + + +(declare-fun |block_9_function_f__15_16_0| (Int Int |abi_type| |crypto_type| |tx_type| |state_type| |state_type| Int ) Bool) +(assert +(forall ( (abi_0 |abi_type|) (crypto_0 |crypto_type|) (error_0 Int) (error_1 Int) (expr_10_0 Int) (expr_11_1 Bool) (expr_6_0 Int) (expr_9_0 Int) (state_0 |state_type|) (state_1 |state_type|) (state_2 |state_type|) (this_0 Int) (tx_0 |tx_type|) (x_5_0 Int) (x_5_1 Int) (x_5_2 Int)) +(block_9_function_f__15_16_0 error_0 this_0 abi_0 crypto_0 tx_0 state_0 state_1 x_5_1))) + + +(assert +(forall ( (abi_0 |abi_type|) (crypto_0 |crypto_type|) (error_0 Int) (error_1 Int) (expr_10_0 Int) (expr_11_1 Bool) (expr_6_0 Int) (expr_9_0 Int) (funds_2_0 Int) (state_0 |state_type|) (state_1 |state_type|) (state_2 |state_type|) (state_3 |state_type|) (this_0 Int) (tx_0 |tx_type|) (x_5_0 Int) (x_5_1 Int) (x_5_2 Int)) +(=> (and (and (block_9_function_f__15_16_0 error_0 this_0 abi_0 crypto_0 tx_0 state_0 state_1 x_5_1) (and (summary_3_function_f__15_16_0 error_1 this_0 abi_0 crypto_0 tx_0 state_2 state_3) (and (= state_2 (|state_type| (store (|balances| state_1) this_0 (+ (select (|balances| state_1) this_0) funds_2_0)))) (and (and (>= (+ (select (|balances| state_1) this_0) funds_2_0) 0) (<= (+ (select (|balances| state_1) this_0) funds_2_0) 115792089237316195423570985008687907853269984665640564039457584007913129639935)) (and (>= funds_2_0 (|msg.value| tx_0)) (and (and (and (and (and (and (and (and (and (and (and (and (and (> (|block.prevrandao| tx_0) 18446744073709551616) (and (>= (|block.basefee| tx_0) 0) (<= (|block.basefee| tx_0) 115792089237316195423570985008687907853269984665640564039457584007913129639935))) (and (>= (|block.chainid| tx_0) 0) (<= (|block.chainid| tx_0) 115792089237316195423570985008687907853269984665640564039457584007913129639935))) (and (>= (|block.coinbase| tx_0) 0) (<= (|block.coinbase| tx_0) 1461501637330902918203684832716283019655932542975))) (and (>= (|block.prevrandao| tx_0) 0) (<= (|block.prevrandao| tx_0) 115792089237316195423570985008687907853269984665640564039457584007913129639935))) (and (>= (|block.gaslimit| tx_0) 0) (<= (|block.gaslimit| tx_0) 115792089237316195423570985008687907853269984665640564039457584007913129639935))) (and (>= (|block.number| tx_0) 0) (<= (|block.number| tx_0) 115792089237316195423570985008687907853269984665640564039457584007913129639935))) (and (>= (|block.timestamp| tx_0) 0) (<= (|block.timestamp| tx_0) 115792089237316195423570985008687907853269984665640564039457584007913129639935))) (and (>= (|msg.sender| tx_0) 0) (<= (|msg.sender| tx_0) 1461501637330902918203684832716283019655932542975))) (and (>= (|msg.value| tx_0) 0) (<= (|msg.value| tx_0) 115792089237316195423570985008687907853269984665640564039457584007913129639935))) (and (>= (|tx.origin| tx_0) 0) (<= (|tx.origin| tx_0) 1461501637330902918203684832716283019655932542975))) (and (>= (|tx.gasprice| tx_0) 0) (<= (|tx.gasprice| tx_0) 115792089237316195423570985008687907853269984665640564039457584007913129639935))) (and (and (and (and (and (and (= (|msg.value| tx_0) 0) (= (|msg.sig| tx_0) 638722032)) (= (select (|bytes_tuple_accessor_array| (|msg.data| tx_0)) 0) 38)) (= (select (|bytes_tuple_accessor_array| (|msg.data| tx_0)) 1) 18)) (= (select (|bytes_tuple_accessor_array| (|msg.data| tx_0)) 2) 31)) (= (select (|bytes_tuple_accessor_array| (|msg.data| tx_0)) 3) 240)) (>= (|bytes_tuple_accessor_length| (|msg.data| tx_0)) 4))) (and (and (and (and (= state_1 state_0) (= error_0 0)) true) true) true))))))) true) (summary_4_function_f__15_16_0 error_1 this_0 abi_0 crypto_0 tx_0 state_0 state_3)))) + + +(assert +(forall ( (abi_0 |abi_type|) (crypto_0 |crypto_type|) (error_0 Int) (error_1 Int) (expr_10_0 Int) (expr_11_1 Bool) (expr_6_0 Int) (expr_9_0 Int) (funds_2_0 Int) (state_0 |state_type|) (state_1 |state_type|) (state_2 |state_type|) (state_3 |state_type|) (this_0 Int) (tx_0 |tx_type|) (x_5_0 Int) (x_5_1 Int) (x_5_2 Int)) +(=> (and (and (interface_0_C_16_0 this_0 abi_0 crypto_0 state_0) true) (and (summary_4_function_f__15_16_0 error_0 this_0 abi_0 crypto_0 tx_0 state_0 state_1) (= error_0 0))) (interface_0_C_16_0 this_0 abi_0 crypto_0 state_1)))) + + +(declare-fun |contract_initializer_10_C_16_0| (Int Int |abi_type| |crypto_type| |tx_type| |state_type| |state_type| ) Bool) +(declare-fun |contract_initializer_entry_11_C_16_0| (Int Int |abi_type| |crypto_type| |tx_type| |state_type| |state_type| ) Bool) +(assert +(forall ( (abi_0 |abi_type|) (crypto_0 |crypto_type|) (error_0 Int) (error_1 Int) (expr_10_0 Int) (expr_11_1 Bool) (expr_6_0 Int) (expr_9_0 Int) (funds_2_0 Int) (state_0 |state_type|) (state_1 |state_type|) (state_2 |state_type|) (state_3 |state_type|) (this_0 Int) (tx_0 |tx_type|) (x_5_0 Int) (x_5_1 Int) (x_5_2 Int)) +(=> (and (and (= state_1 state_0) (= error_0 0)) true) (contract_initializer_entry_11_C_16_0 error_0 this_0 abi_0 crypto_0 tx_0 state_0 state_1)))) + + +(declare-fun |contract_initializer_after_init_12_C_16_0| (Int Int |abi_type| |crypto_type| |tx_type| |state_type| |state_type| ) Bool) +(assert +(forall ( (abi_0 |abi_type|) (crypto_0 |crypto_type|) (error_0 Int) (error_1 Int) (expr_10_0 Int) (expr_11_1 Bool) (expr_6_0 Int) (expr_9_0 Int) (funds_2_0 Int) (state_0 |state_type|) (state_1 |state_type|) (state_2 |state_type|) (state_3 |state_type|) (this_0 Int) (tx_0 |tx_type|) (x_5_0 Int) (x_5_1 Int) (x_5_2 Int)) +(=> (and (and (contract_initializer_entry_11_C_16_0 error_0 this_0 abi_0 crypto_0 tx_0 state_0 state_1) true) true) (contract_initializer_after_init_12_C_16_0 error_0 this_0 abi_0 crypto_0 tx_0 state_0 state_1)))) + + +(assert +(forall ( (abi_0 |abi_type|) (crypto_0 |crypto_type|) (error_0 Int) (error_1 Int) (expr_10_0 Int) (expr_11_1 Bool) (expr_6_0 Int) (expr_9_0 Int) (funds_2_0 Int) (state_0 |state_type|) (state_1 |state_type|) (state_2 |state_type|) (state_3 |state_type|) (this_0 Int) (tx_0 |tx_type|) (x_5_0 Int) (x_5_1 Int) (x_5_2 Int)) +(=> (and (and (contract_initializer_after_init_12_C_16_0 error_0 this_0 abi_0 crypto_0 tx_0 state_0 state_1) true) true) (contract_initializer_10_C_16_0 error_0 this_0 abi_0 crypto_0 tx_0 state_0 state_1)))) + + +(declare-fun |implicit_constructor_entry_13_C_16_0| (Int Int |abi_type| |crypto_type| |tx_type| |state_type| |state_type| ) Bool) +(assert +(forall ( (abi_0 |abi_type|) (crypto_0 |crypto_type|) (error_0 Int) (error_1 Int) (expr_10_0 Int) (expr_11_1 Bool) (expr_6_0 Int) (expr_9_0 Int) (funds_2_0 Int) (state_0 |state_type|) (state_1 |state_type|) (state_2 |state_type|) (state_3 |state_type|) (this_0 Int) (tx_0 |tx_type|) (x_5_0 Int) (x_5_1 Int) (x_5_2 Int)) +(=> (and (and (and (and (and (= state_1 state_0) (= error_0 0)) true) true) true) (>= (select (|balances| state_1) this_0) (|msg.value| tx_0))) (implicit_constructor_entry_13_C_16_0 error_0 this_0 abi_0 crypto_0 tx_0 state_0 state_1)))) + + +(assert +(forall ( (abi_0 |abi_type|) (crypto_0 |crypto_type|) (error_0 Int) (error_1 Int) (expr_10_0 Int) (expr_11_1 Bool) (expr_6_0 Int) (expr_9_0 Int) (funds_2_0 Int) (state_0 |state_type|) (state_1 |state_type|) (state_2 |state_type|) (state_3 |state_type|) (this_0 Int) (tx_0 |tx_type|) (x_5_0 Int) (x_5_1 Int) (x_5_2 Int)) +(=> (and (and (implicit_constructor_entry_13_C_16_0 error_0 this_0 abi_0 crypto_0 tx_0 state_0 state_1) (and (contract_initializer_10_C_16_0 error_1 this_0 abi_0 crypto_0 tx_0 state_1 state_2) true)) (> error_1 0)) (summary_constructor_2_C_16_0 error_1 this_0 abi_0 crypto_0 tx_0 state_0 state_2)))) + + +(assert +(forall ( (abi_0 |abi_type|) (crypto_0 |crypto_type|) (error_0 Int) (error_1 Int) (expr_10_0 Int) (expr_11_1 Bool) (expr_6_0 Int) (expr_9_0 Int) (funds_2_0 Int) (state_0 |state_type|) (state_1 |state_type|) (state_2 |state_type|) (state_3 |state_type|) (this_0 Int) (tx_0 |tx_type|) (x_5_0 Int) (x_5_1 Int) (x_5_2 Int)) +(=> (and (and (implicit_constructor_entry_13_C_16_0 error_0 this_0 abi_0 crypto_0 tx_0 state_0 state_1) (and (= error_1 0) (and (contract_initializer_10_C_16_0 error_1 this_0 abi_0 crypto_0 tx_0 state_1 state_2) true))) true) (summary_constructor_2_C_16_0 error_1 this_0 abi_0 crypto_0 tx_0 state_0 state_2)))) + + +(assert +(forall ( (abi_0 |abi_type|) (crypto_0 |crypto_type|) (error_0 Int) (error_1 Int) (expr_10_0 Int) (expr_11_1 Bool) (expr_6_0 Int) (expr_9_0 Int) (funds_2_0 Int) (state_0 |state_type|) (state_1 |state_type|) (state_2 |state_type|) (state_3 |state_type|) (this_0 Int) (tx_0 |tx_type|) (x_5_0 Int) (x_5_1 Int) (x_5_2 Int)) +(=> (and (and (summary_constructor_2_C_16_0 error_0 this_0 abi_0 crypto_0 tx_0 state_0 state_1) true) (and (and (and (and (and (and (and (and (and (and (and (and (and (> (|block.prevrandao| tx_0) 18446744073709551616) (and (>= (|block.basefee| tx_0) 0) (<= (|block.basefee| tx_0) 115792089237316195423570985008687907853269984665640564039457584007913129639935))) (and (>= (|block.chainid| tx_0) 0) (<= (|block.chainid| tx_0) 115792089237316195423570985008687907853269984665640564039457584007913129639935))) (and (>= (|block.coinbase| tx_0) 0) (<= (|block.coinbase| tx_0) 1461501637330902918203684832716283019655932542975))) (and (>= (|block.prevrandao| tx_0) 0) (<= (|block.prevrandao| tx_0) 115792089237316195423570985008687907853269984665640564039457584007913129639935))) (and (>= (|block.gaslimit| tx_0) 0) (<= (|block.gaslimit| tx_0) 115792089237316195423570985008687907853269984665640564039457584007913129639935))) (and (>= (|block.number| tx_0) 0) (<= (|block.number| tx_0) 115792089237316195423570985008687907853269984665640564039457584007913129639935))) (and (>= (|block.timestamp| tx_0) 0) (<= (|block.timestamp| tx_0) 115792089237316195423570985008687907853269984665640564039457584007913129639935))) (and (>= (|msg.sender| tx_0) 0) (<= (|msg.sender| tx_0) 1461501637330902918203684832716283019655932542975))) (and (>= (|msg.value| tx_0) 0) (<= (|msg.value| tx_0) 115792089237316195423570985008687907853269984665640564039457584007913129639935))) (and (>= (|tx.origin| tx_0) 0) (<= (|tx.origin| tx_0) 1461501637330902918203684832716283019655932542975))) (and (>= (|tx.gasprice| tx_0) 0) (<= (|tx.gasprice| tx_0) 115792089237316195423570985008687907853269984665640564039457584007913129639935))) (= (|msg.value| tx_0) 0)) (= error_0 0))) (interface_0_C_16_0 this_0 abi_0 crypto_0 state_1)))) + + +(declare-fun |error_target_3_0| () Bool) +(assert +(forall ( (abi_0 |abi_type|) (crypto_0 |crypto_type|) (error_0 Int) (error_1 Int) (expr_10_0 Int) (expr_11_1 Bool) (expr_6_0 Int) (expr_9_0 Int) (funds_2_0 Int) (state_0 |state_type|) (state_1 |state_type|) (state_2 |state_type|) (state_3 |state_type|) (this_0 Int) (tx_0 |tx_type|) (x_5_0 Int) (x_5_1 Int) (x_5_2 Int)) +(=> (and (and (interface_0_C_16_0 this_0 abi_0 crypto_0 state_0) true) (and (summary_4_function_f__15_16_0 error_0 this_0 abi_0 crypto_0 tx_0 state_0 state_1) (= error_0 1))) error_target_3_0))) + + + +(assert +(forall ( (abi_0 |abi_type|) (crypto_0 |crypto_type|) (error_0 Int) (error_1 Int) (expr_10_0 Int) (expr_11_1 Bool) (expr_6_0 Int) (expr_9_0 Int) (funds_2_0 Int) (state_0 |state_type|) (state_1 |state_type|) (state_2 |state_type|) (state_3 |state_type|) (this_0 Int) (tx_0 |tx_type|) (x_5_0 Int) (x_5_1 Int) (x_5_2 Int)) +(=> error_target_3_0 false))) +(check-sat) +", + "severity": "info", + "type": "Info" + }, + { + "component": "general", + "errorCode": "5840", + "formattedMessage": "Warning: CHC: 1 verification condition(s) could not be proved. Enable the model checker option \"show unproved\" to see all of them. Consider choosing a specific contract to be verified in order to reduce the solving problems. Consider increasing the timeout per query. + +", + "message": "CHC: 1 verification condition(s) could not be proved. Enable the model checker option \"show unproved\" to see all of them. Consider choosing a specific contract to be verified in order to reduce the solving problems. Consider increasing the timeout per query.", + "severity": "warning", + "type": "Warning" + }, + { + "component": "general", + "errorCode": "3996", + "formattedMessage": "Warning: CHC analysis was not possible. No Horn solver was available. None of the installed solvers was enabled. + +", + "message": "CHC analysis was not possible. No Horn solver was available. None of the installed solvers was enabled.", + "severity": "warning", + "type": "Warning" + }, + { + "component": "general", + "errorCode": "6240", + "formattedMessage": "Info: BMC: Requested query: +(set-option :produce-models true) +(set-option :timeout 1000) +(set-logic ALL) +(declare-fun |x_5_3| () Int) +(declare-fun |error_0| () Int) +(declare-fun |this_0| () Int) +(declare-datatypes ((|bytes_tuple| 0)) (((|bytes_tuple| (|bytes_tuple_accessor_array| (Array Int Int)) (|bytes_tuple_accessor_length| Int))))) +(declare-datatypes ((|tx_type| 0)) (((|tx_type| (|block.basefee| Int) (|block.chainid| Int) (|block.coinbase| Int) (|block.gaslimit| Int) (|block.number| Int) (|block.prevrandao| Int) (|block.timestamp| Int) (|blockhash| (Array Int Int)) (|msg.data| |bytes_tuple|) (|msg.sender| Int) (|msg.sig| Int) (|msg.value| Int) (|tx.gasprice| Int) (|tx.origin| Int))))) +(declare-fun |tx_0| () |tx_type|) +(declare-datatypes ((|ecrecover_input_type| 0)) (((|ecrecover_input_type| (|hash| Int) (|v| Int) (|r| Int) (|s| Int))))) +(declare-datatypes ((|crypto_type| 0)) (((|crypto_type| (|ecrecover| (Array |ecrecover_input_type| Int)) (|keccak256| (Array |bytes_tuple| Int)) (|ripemd160| (Array |bytes_tuple| Int)) (|sha256| (Array |bytes_tuple| Int)))))) +(declare-fun |crypto_0| () |crypto_type|) +(declare-datatypes ((|abi_type| 0)) (((|abi_type|)))) +(declare-fun |abi_0| () |abi_type|) +(declare-datatypes ((|state_type| 0)) (((|state_type| (|balances| (Array Int Int)))))) +(declare-fun |state_0| () |state_type|) +(declare-fun |x_5_4| () Int) +(declare-fun |x_5_0| () Int) +(declare-fun |expr_6_0| () Int) +(declare-fun |x_5_1| () Int) +(declare-fun |expr_9_0| () Int) +(declare-fun |expr_10_0| () Int) +(declare-fun |expr_11_1| () Bool) + +(assert (and (and (and true true) (and (= expr_11_1 (= expr_9_0 expr_10_0)) (and (=> (and true true) true) (and (= expr_10_0 0) (and (=> (and true true) (and (>= expr_9_0 0) (<= expr_9_0 115792089237316195423570985008687907853269984665640564039457584007913129639935))) (and (= expr_9_0 x_5_1) (and (ite (and true true) (= x_5_1 expr_6_0) (= x_5_1 x_5_0)) (and (=> (and true true) true) (and (= expr_6_0 0) (and (= x_5_0 0) (and (and (and (and (and (and (and (and (and (and (and (and (and (> (|block.prevrandao| tx_0) 18446744073709551616) (and (>= (|block.basefee| tx_0) 0) (<= (|block.basefee| tx_0) 115792089237316195423570985008687907853269984665640564039457584007913129639935))) (and (>= (|block.chainid| tx_0) 0) (<= (|block.chainid| tx_0) 115792089237316195423570985008687907853269984665640564039457584007913129639935))) (and (>= (|block.coinbase| tx_0) 0) (<= (|block.coinbase| tx_0) 1461501637330902918203684832716283019655932542975))) (and (>= (|block.prevrandao| tx_0) 0) (<= (|block.prevrandao| tx_0) 115792089237316195423570985008687907853269984665640564039457584007913129639935))) (and (>= (|block.gaslimit| tx_0) 0) (<= (|block.gaslimit| tx_0) 115792089237316195423570985008687907853269984665640564039457584007913129639935))) (and (>= (|block.number| tx_0) 0) (<= (|block.number| tx_0) 115792089237316195423570985008687907853269984665640564039457584007913129639935))) (and (>= (|block.timestamp| tx_0) 0) (<= (|block.timestamp| tx_0) 115792089237316195423570985008687907853269984665640564039457584007913129639935))) (and (>= (|msg.sender| tx_0) 0) (<= (|msg.sender| tx_0) 1461501637330902918203684832716283019655932542975))) (and (>= (|msg.value| tx_0) 0) (<= (|msg.value| tx_0) 115792089237316195423570985008687907853269984665640564039457584007913129639935))) (and (>= (|tx.origin| tx_0) 0) (<= (|tx.origin| tx_0) 1461501637330902918203684832716283019655932542975))) (and (>= (|tx.gasprice| tx_0) 0) (<= (|tx.gasprice| tx_0) 115792089237316195423570985008687907853269984665640564039457584007913129639935))) (and (and (and (and (and (and (= (|msg.value| tx_0) 0) (= (|msg.sig| tx_0) 638722032)) (= (select (|bytes_tuple_accessor_array| (|msg.data| tx_0)) 0) 38)) (= (select (|bytes_tuple_accessor_array| (|msg.data| tx_0)) 1) 18)) (= (select (|bytes_tuple_accessor_array| (|msg.data| tx_0)) 2) 31)) (= (select (|bytes_tuple_accessor_array| (|msg.data| tx_0)) 3) 240)) (>= (|bytes_tuple_accessor_length| (|msg.data| tx_0)) 4))) true))))))))))) (not expr_11_1))) +(declare-const |EVALEXPR_0| Int) +(assert (= |EVALEXPR_0| x_5_1)) +(check-sat) +(get-value (|EVALEXPR_0| )) + + +", + "message": "BMC: Requested query: +(set-option :produce-models true) +(set-option :timeout 1000) +(set-logic ALL) +(declare-fun |x_5_3| () Int) +(declare-fun |error_0| () Int) +(declare-fun |this_0| () Int) +(declare-datatypes ((|bytes_tuple| 0)) (((|bytes_tuple| (|bytes_tuple_accessor_array| (Array Int Int)) (|bytes_tuple_accessor_length| Int))))) +(declare-datatypes ((|tx_type| 0)) (((|tx_type| (|block.basefee| Int) (|block.chainid| Int) (|block.coinbase| Int) (|block.gaslimit| Int) (|block.number| Int) (|block.prevrandao| Int) (|block.timestamp| Int) (|blockhash| (Array Int Int)) (|msg.data| |bytes_tuple|) (|msg.sender| Int) (|msg.sig| Int) (|msg.value| Int) (|tx.gasprice| Int) (|tx.origin| Int))))) +(declare-fun |tx_0| () |tx_type|) +(declare-datatypes ((|ecrecover_input_type| 0)) (((|ecrecover_input_type| (|hash| Int) (|v| Int) (|r| Int) (|s| Int))))) +(declare-datatypes ((|crypto_type| 0)) (((|crypto_type| (|ecrecover| (Array |ecrecover_input_type| Int)) (|keccak256| (Array |bytes_tuple| Int)) (|ripemd160| (Array |bytes_tuple| Int)) (|sha256| (Array |bytes_tuple| Int)))))) +(declare-fun |crypto_0| () |crypto_type|) +(declare-datatypes ((|abi_type| 0)) (((|abi_type|)))) +(declare-fun |abi_0| () |abi_type|) +(declare-datatypes ((|state_type| 0)) (((|state_type| (|balances| (Array Int Int)))))) +(declare-fun |state_0| () |state_type|) +(declare-fun |x_5_4| () Int) +(declare-fun |x_5_0| () Int) +(declare-fun |expr_6_0| () Int) +(declare-fun |x_5_1| () Int) +(declare-fun |expr_9_0| () Int) +(declare-fun |expr_10_0| () Int) +(declare-fun |expr_11_1| () Bool) + +(assert (and (and (and true true) (and (= expr_11_1 (= expr_9_0 expr_10_0)) (and (=> (and true true) true) (and (= expr_10_0 0) (and (=> (and true true) (and (>= expr_9_0 0) (<= expr_9_0 115792089237316195423570985008687907853269984665640564039457584007913129639935))) (and (= expr_9_0 x_5_1) (and (ite (and true true) (= x_5_1 expr_6_0) (= x_5_1 x_5_0)) (and (=> (and true true) true) (and (= expr_6_0 0) (and (= x_5_0 0) (and (and (and (and (and (and (and (and (and (and (and (and (and (> (|block.prevrandao| tx_0) 18446744073709551616) (and (>= (|block.basefee| tx_0) 0) (<= (|block.basefee| tx_0) 115792089237316195423570985008687907853269984665640564039457584007913129639935))) (and (>= (|block.chainid| tx_0) 0) (<= (|block.chainid| tx_0) 115792089237316195423570985008687907853269984665640564039457584007913129639935))) (and (>= (|block.coinbase| tx_0) 0) (<= (|block.coinbase| tx_0) 1461501637330902918203684832716283019655932542975))) (and (>= (|block.prevrandao| tx_0) 0) (<= (|block.prevrandao| tx_0) 115792089237316195423570985008687907853269984665640564039457584007913129639935))) (and (>= (|block.gaslimit| tx_0) 0) (<= (|block.gaslimit| tx_0) 115792089237316195423570985008687907853269984665640564039457584007913129639935))) (and (>= (|block.number| tx_0) 0) (<= (|block.number| tx_0) 115792089237316195423570985008687907853269984665640564039457584007913129639935))) (and (>= (|block.timestamp| tx_0) 0) (<= (|block.timestamp| tx_0) 115792089237316195423570985008687907853269984665640564039457584007913129639935))) (and (>= (|msg.sender| tx_0) 0) (<= (|msg.sender| tx_0) 1461501637330902918203684832716283019655932542975))) (and (>= (|msg.value| tx_0) 0) (<= (|msg.value| tx_0) 115792089237316195423570985008687907853269984665640564039457584007913129639935))) (and (>= (|tx.origin| tx_0) 0) (<= (|tx.origin| tx_0) 1461501637330902918203684832716283019655932542975))) (and (>= (|tx.gasprice| tx_0) 0) (<= (|tx.gasprice| tx_0) 115792089237316195423570985008687907853269984665640564039457584007913129639935))) (and (and (and (and (and (and (= (|msg.value| tx_0) 0) (= (|msg.sig| tx_0) 638722032)) (= (select (|bytes_tuple_accessor_array| (|msg.data| tx_0)) 0) 38)) (= (select (|bytes_tuple_accessor_array| (|msg.data| tx_0)) 1) 18)) (= (select (|bytes_tuple_accessor_array| (|msg.data| tx_0)) 2) 31)) (= (select (|bytes_tuple_accessor_array| (|msg.data| tx_0)) 3) 240)) (>= (|bytes_tuple_accessor_length| (|msg.data| tx_0)) 4))) true))))))))))) (not expr_11_1))) +(declare-const |EVALEXPR_0| Int) +(assert (= |EVALEXPR_0| x_5_1)) +(check-sat) +(get-value (|EVALEXPR_0| )) +", + "severity": "info", + "type": "Info" + }, + { + "component": "general", + "errorCode": "2788", + "formattedMessage": "Warning: BMC: 1 verification condition(s) could not be proved. Enable the model checker option \"show unproved\" to see all of them. Consider choosing a specific contract to be verified in order to reduce the solving problems. Consider increasing the timeout per query. + +", + "message": "BMC: 1 verification condition(s) could not be proved. Enable the model checker option \"show unproved\" to see all of them. Consider choosing a specific contract to be verified in order to reduce the solving problems. Consider increasing the timeout per query.", + "severity": "warning", + "type": "Warning" + }, + { + "component": "general", + "errorCode": "8084", + "formattedMessage": "Warning: BMC analysis was not possible. No SMT solver (Z3 or CVC4) was available. None of the installed solvers was enabled. + +", + "message": "BMC analysis was not possible. No SMT solver (Z3 or CVC4) was available. None of the installed solvers was enabled.", + "severity": "warning", + "type": "Warning" + } + ], + "sources": + { + "A": + { + "id": 0 + } + } +} diff --git a/test/cmdlineTests/standard_model_checker_print_query_bmc/input.json b/test/cmdlineTests/standard_model_checker_print_query_bmc/input.json new file mode 100644 index 000000000000..7957a58e3e4f --- /dev/null +++ b/test/cmdlineTests/standard_model_checker_print_query_bmc/input.json @@ -0,0 +1,26 @@ +{ + "language": "Solidity", + "sources": + { + "A": + { + "content": "// SPDX-License-Identifier: GPL-3.0\npragma solidity >=0.0;\n + contract C + { + function f() public pure { + uint x = 0; + assert(x == 0); + } + }" + } + }, + "settings": + { + "modelChecker": + { + "engine": "bmc", + "printQuery": true, + "solvers": ["smtlib2"] + } + } +} diff --git a/test/cmdlineTests/standard_model_checker_print_query_bmc/output.json b/test/cmdlineTests/standard_model_checker_print_query_bmc/output.json new file mode 100644 index 000000000000..f7b4dc7e2871 --- /dev/null +++ b/test/cmdlineTests/standard_model_checker_print_query_bmc/output.json @@ -0,0 +1,129 @@ +{ + "auxiliaryInputRequested": + { + "smtlib2queries": + { + "0x8704a7b848b706ef33cbfc06e4f185636f568a29621126b7244355dd0de956bb": "(set-option :produce-models true) +(set-logic ALL) +(declare-fun |error_0| () Int) +(declare-fun |this_0| () Int) +(declare-datatypes ((|bytes_tuple| 0)) (((|bytes_tuple| (|bytes_tuple_accessor_array| (Array Int Int)) (|bytes_tuple_accessor_length| Int))))) +(declare-datatypes ((|tx_type| 0)) (((|tx_type| (|block.basefee| Int) (|block.chainid| Int) (|block.coinbase| Int) (|block.gaslimit| Int) (|block.number| Int) (|block.prevrandao| Int) (|block.timestamp| Int) (|blockhash| (Array Int Int)) (|msg.data| |bytes_tuple|) (|msg.sender| Int) (|msg.sig| Int) (|msg.value| Int) (|tx.gasprice| Int) (|tx.origin| Int))))) +(declare-fun |tx_0| () |tx_type|) +(declare-datatypes ((|ecrecover_input_type| 0)) (((|ecrecover_input_type| (|hash| Int) (|v| Int) (|r| Int) (|s| Int))))) +(declare-datatypes ((|crypto_type| 0)) (((|crypto_type| (|ecrecover| (Array |ecrecover_input_type| Int)) (|keccak256| (Array |bytes_tuple| Int)) (|ripemd160| (Array |bytes_tuple| Int)) (|sha256| (Array |bytes_tuple| Int)))))) +(declare-fun |crypto_0| () |crypto_type|) +(declare-datatypes ((|abi_type| 0)) (((|abi_type|)))) +(declare-fun |abi_0| () |abi_type|) +(declare-datatypes ((|state_type| 0)) (((|state_type| (|balances| (Array Int Int)))))) +(declare-fun |state_0| () |state_type|) +(declare-fun |x_5_0| () Int) +(declare-fun |expr_6_0| () Int) +(declare-fun |x_5_1| () Int) +(declare-fun |expr_9_0| () Int) +(declare-fun |expr_10_0| () Int) +(declare-fun |expr_11_1| () Bool) + +(assert (and (and (and true true) (and (= expr_11_1 (= expr_9_0 expr_10_0)) (and (=> (and true true) true) (and (= expr_10_0 0) (and (=> (and true true) (and (>= expr_9_0 0) (<= expr_9_0 115792089237316195423570985008687907853269984665640564039457584007913129639935))) (and (= expr_9_0 x_5_1) (and (ite (and true true) (= x_5_1 expr_6_0) (= x_5_1 x_5_0)) (and (=> (and true true) true) (and (= expr_6_0 0) (and (= x_5_0 0) (and (and (and (and (and (and (and (and (and (and (and (and (and (> (|block.prevrandao| tx_0) 18446744073709551616) (and (>= (|block.basefee| tx_0) 0) (<= (|block.basefee| tx_0) 115792089237316195423570985008687907853269984665640564039457584007913129639935))) (and (>= (|block.chainid| tx_0) 0) (<= (|block.chainid| tx_0) 115792089237316195423570985008687907853269984665640564039457584007913129639935))) (and (>= (|block.coinbase| tx_0) 0) (<= (|block.coinbase| tx_0) 1461501637330902918203684832716283019655932542975))) (and (>= (|block.prevrandao| tx_0) 0) (<= (|block.prevrandao| tx_0) 115792089237316195423570985008687907853269984665640564039457584007913129639935))) (and (>= (|block.gaslimit| tx_0) 0) (<= (|block.gaslimit| tx_0) 115792089237316195423570985008687907853269984665640564039457584007913129639935))) (and (>= (|block.number| tx_0) 0) (<= (|block.number| tx_0) 115792089237316195423570985008687907853269984665640564039457584007913129639935))) (and (>= (|block.timestamp| tx_0) 0) (<= (|block.timestamp| tx_0) 115792089237316195423570985008687907853269984665640564039457584007913129639935))) (and (>= (|msg.sender| tx_0) 0) (<= (|msg.sender| tx_0) 1461501637330902918203684832716283019655932542975))) (and (>= (|msg.value| tx_0) 0) (<= (|msg.value| tx_0) 115792089237316195423570985008687907853269984665640564039457584007913129639935))) (and (>= (|tx.origin| tx_0) 0) (<= (|tx.origin| tx_0) 1461501637330902918203684832716283019655932542975))) (and (>= (|tx.gasprice| tx_0) 0) (<= (|tx.gasprice| tx_0) 115792089237316195423570985008687907853269984665640564039457584007913129639935))) (and (and (and (and (and (and (= (|msg.value| tx_0) 0) (= (|msg.sig| tx_0) 638722032)) (= (select (|bytes_tuple_accessor_array| (|msg.data| tx_0)) 0) 38)) (= (select (|bytes_tuple_accessor_array| (|msg.data| tx_0)) 1) 18)) (= (select (|bytes_tuple_accessor_array| (|msg.data| tx_0)) 2) 31)) (= (select (|bytes_tuple_accessor_array| (|msg.data| tx_0)) 3) 240)) (>= (|bytes_tuple_accessor_length| (|msg.data| tx_0)) 4))) true))))))))))) (not expr_11_1))) +(declare-const |EVALEXPR_0| Int) +(assert (= |EVALEXPR_0| x_5_1)) +(check-sat) +(get-value (|EVALEXPR_0| )) +" + } + }, + "errors": + [ + { + "component": "general", + "errorCode": "6240", + "formattedMessage": "Info: BMC: Requested query: +(set-option :produce-models true) +(set-logic ALL) +(declare-fun |error_0| () Int) +(declare-fun |this_0| () Int) +(declare-datatypes ((|bytes_tuple| 0)) (((|bytes_tuple| (|bytes_tuple_accessor_array| (Array Int Int)) (|bytes_tuple_accessor_length| Int))))) +(declare-datatypes ((|tx_type| 0)) (((|tx_type| (|block.basefee| Int) (|block.chainid| Int) (|block.coinbase| Int) (|block.gaslimit| Int) (|block.number| Int) (|block.prevrandao| Int) (|block.timestamp| Int) (|blockhash| (Array Int Int)) (|msg.data| |bytes_tuple|) (|msg.sender| Int) (|msg.sig| Int) (|msg.value| Int) (|tx.gasprice| Int) (|tx.origin| Int))))) +(declare-fun |tx_0| () |tx_type|) +(declare-datatypes ((|ecrecover_input_type| 0)) (((|ecrecover_input_type| (|hash| Int) (|v| Int) (|r| Int) (|s| Int))))) +(declare-datatypes ((|crypto_type| 0)) (((|crypto_type| (|ecrecover| (Array |ecrecover_input_type| Int)) (|keccak256| (Array |bytes_tuple| Int)) (|ripemd160| (Array |bytes_tuple| Int)) (|sha256| (Array |bytes_tuple| Int)))))) +(declare-fun |crypto_0| () |crypto_type|) +(declare-datatypes ((|abi_type| 0)) (((|abi_type|)))) +(declare-fun |abi_0| () |abi_type|) +(declare-datatypes ((|state_type| 0)) (((|state_type| (|balances| (Array Int Int)))))) +(declare-fun |state_0| () |state_type|) +(declare-fun |x_5_0| () Int) +(declare-fun |expr_6_0| () Int) +(declare-fun |x_5_1| () Int) +(declare-fun |expr_9_0| () Int) +(declare-fun |expr_10_0| () Int) +(declare-fun |expr_11_1| () Bool) + +(assert (and (and (and true true) (and (= expr_11_1 (= expr_9_0 expr_10_0)) (and (=> (and true true) true) (and (= expr_10_0 0) (and (=> (and true true) (and (>= expr_9_0 0) (<= expr_9_0 115792089237316195423570985008687907853269984665640564039457584007913129639935))) (and (= expr_9_0 x_5_1) (and (ite (and true true) (= x_5_1 expr_6_0) (= x_5_1 x_5_0)) (and (=> (and true true) true) (and (= expr_6_0 0) (and (= x_5_0 0) (and (and (and (and (and (and (and (and (and (and (and (and (and (> (|block.prevrandao| tx_0) 18446744073709551616) (and (>= (|block.basefee| tx_0) 0) (<= (|block.basefee| tx_0) 115792089237316195423570985008687907853269984665640564039457584007913129639935))) (and (>= (|block.chainid| tx_0) 0) (<= (|block.chainid| tx_0) 115792089237316195423570985008687907853269984665640564039457584007913129639935))) (and (>= (|block.coinbase| tx_0) 0) (<= (|block.coinbase| tx_0) 1461501637330902918203684832716283019655932542975))) (and (>= (|block.prevrandao| tx_0) 0) (<= (|block.prevrandao| tx_0) 115792089237316195423570985008687907853269984665640564039457584007913129639935))) (and (>= (|block.gaslimit| tx_0) 0) (<= (|block.gaslimit| tx_0) 115792089237316195423570985008687907853269984665640564039457584007913129639935))) (and (>= (|block.number| tx_0) 0) (<= (|block.number| tx_0) 115792089237316195423570985008687907853269984665640564039457584007913129639935))) (and (>= (|block.timestamp| tx_0) 0) (<= (|block.timestamp| tx_0) 115792089237316195423570985008687907853269984665640564039457584007913129639935))) (and (>= (|msg.sender| tx_0) 0) (<= (|msg.sender| tx_0) 1461501637330902918203684832716283019655932542975))) (and (>= (|msg.value| tx_0) 0) (<= (|msg.value| tx_0) 115792089237316195423570985008687907853269984665640564039457584007913129639935))) (and (>= (|tx.origin| tx_0) 0) (<= (|tx.origin| tx_0) 1461501637330902918203684832716283019655932542975))) (and (>= (|tx.gasprice| tx_0) 0) (<= (|tx.gasprice| tx_0) 115792089237316195423570985008687907853269984665640564039457584007913129639935))) (and (and (and (and (and (and (= (|msg.value| tx_0) 0) (= (|msg.sig| tx_0) 638722032)) (= (select (|bytes_tuple_accessor_array| (|msg.data| tx_0)) 0) 38)) (= (select (|bytes_tuple_accessor_array| (|msg.data| tx_0)) 1) 18)) (= (select (|bytes_tuple_accessor_array| (|msg.data| tx_0)) 2) 31)) (= (select (|bytes_tuple_accessor_array| (|msg.data| tx_0)) 3) 240)) (>= (|bytes_tuple_accessor_length| (|msg.data| tx_0)) 4))) true))))))))))) (not expr_11_1))) +(declare-const |EVALEXPR_0| Int) +(assert (= |EVALEXPR_0| x_5_1)) +(check-sat) +(get-value (|EVALEXPR_0| )) + + +", + "message": "BMC: Requested query: +(set-option :produce-models true) +(set-logic ALL) +(declare-fun |error_0| () Int) +(declare-fun |this_0| () Int) +(declare-datatypes ((|bytes_tuple| 0)) (((|bytes_tuple| (|bytes_tuple_accessor_array| (Array Int Int)) (|bytes_tuple_accessor_length| Int))))) +(declare-datatypes ((|tx_type| 0)) (((|tx_type| (|block.basefee| Int) (|block.chainid| Int) (|block.coinbase| Int) (|block.gaslimit| Int) (|block.number| Int) (|block.prevrandao| Int) (|block.timestamp| Int) (|blockhash| (Array Int Int)) (|msg.data| |bytes_tuple|) (|msg.sender| Int) (|msg.sig| Int) (|msg.value| Int) (|tx.gasprice| Int) (|tx.origin| Int))))) +(declare-fun |tx_0| () |tx_type|) +(declare-datatypes ((|ecrecover_input_type| 0)) (((|ecrecover_input_type| (|hash| Int) (|v| Int) (|r| Int) (|s| Int))))) +(declare-datatypes ((|crypto_type| 0)) (((|crypto_type| (|ecrecover| (Array |ecrecover_input_type| Int)) (|keccak256| (Array |bytes_tuple| Int)) (|ripemd160| (Array |bytes_tuple| Int)) (|sha256| (Array |bytes_tuple| Int)))))) +(declare-fun |crypto_0| () |crypto_type|) +(declare-datatypes ((|abi_type| 0)) (((|abi_type|)))) +(declare-fun |abi_0| () |abi_type|) +(declare-datatypes ((|state_type| 0)) (((|state_type| (|balances| (Array Int Int)))))) +(declare-fun |state_0| () |state_type|) +(declare-fun |x_5_0| () Int) +(declare-fun |expr_6_0| () Int) +(declare-fun |x_5_1| () Int) +(declare-fun |expr_9_0| () Int) +(declare-fun |expr_10_0| () Int) +(declare-fun |expr_11_1| () Bool) + +(assert (and (and (and true true) (and (= expr_11_1 (= expr_9_0 expr_10_0)) (and (=> (and true true) true) (and (= expr_10_0 0) (and (=> (and true true) (and (>= expr_9_0 0) (<= expr_9_0 115792089237316195423570985008687907853269984665640564039457584007913129639935))) (and (= expr_9_0 x_5_1) (and (ite (and true true) (= x_5_1 expr_6_0) (= x_5_1 x_5_0)) (and (=> (and true true) true) (and (= expr_6_0 0) (and (= x_5_0 0) (and (and (and (and (and (and (and (and (and (and (and (and (and (> (|block.prevrandao| tx_0) 18446744073709551616) (and (>= (|block.basefee| tx_0) 0) (<= (|block.basefee| tx_0) 115792089237316195423570985008687907853269984665640564039457584007913129639935))) (and (>= (|block.chainid| tx_0) 0) (<= (|block.chainid| tx_0) 115792089237316195423570985008687907853269984665640564039457584007913129639935))) (and (>= (|block.coinbase| tx_0) 0) (<= (|block.coinbase| tx_0) 1461501637330902918203684832716283019655932542975))) (and (>= (|block.prevrandao| tx_0) 0) (<= (|block.prevrandao| tx_0) 115792089237316195423570985008687907853269984665640564039457584007913129639935))) (and (>= (|block.gaslimit| tx_0) 0) (<= (|block.gaslimit| tx_0) 115792089237316195423570985008687907853269984665640564039457584007913129639935))) (and (>= (|block.number| tx_0) 0) (<= (|block.number| tx_0) 115792089237316195423570985008687907853269984665640564039457584007913129639935))) (and (>= (|block.timestamp| tx_0) 0) (<= (|block.timestamp| tx_0) 115792089237316195423570985008687907853269984665640564039457584007913129639935))) (and (>= (|msg.sender| tx_0) 0) (<= (|msg.sender| tx_0) 1461501637330902918203684832716283019655932542975))) (and (>= (|msg.value| tx_0) 0) (<= (|msg.value| tx_0) 115792089237316195423570985008687907853269984665640564039457584007913129639935))) (and (>= (|tx.origin| tx_0) 0) (<= (|tx.origin| tx_0) 1461501637330902918203684832716283019655932542975))) (and (>= (|tx.gasprice| tx_0) 0) (<= (|tx.gasprice| tx_0) 115792089237316195423570985008687907853269984665640564039457584007913129639935))) (and (and (and (and (and (and (= (|msg.value| tx_0) 0) (= (|msg.sig| tx_0) 638722032)) (= (select (|bytes_tuple_accessor_array| (|msg.data| tx_0)) 0) 38)) (= (select (|bytes_tuple_accessor_array| (|msg.data| tx_0)) 1) 18)) (= (select (|bytes_tuple_accessor_array| (|msg.data| tx_0)) 2) 31)) (= (select (|bytes_tuple_accessor_array| (|msg.data| tx_0)) 3) 240)) (>= (|bytes_tuple_accessor_length| (|msg.data| tx_0)) 4))) true))))))))))) (not expr_11_1))) +(declare-const |EVALEXPR_0| Int) +(assert (= |EVALEXPR_0| x_5_1)) +(check-sat) +(get-value (|EVALEXPR_0| )) +", + "severity": "info", + "type": "Info" + }, + { + "component": "general", + "errorCode": "2788", + "formattedMessage": "Warning: BMC: 1 verification condition(s) could not be proved. Enable the model checker option \"show unproved\" to see all of them. Consider choosing a specific contract to be verified in order to reduce the solving problems. Consider increasing the timeout per query. + +", + "message": "BMC: 1 verification condition(s) could not be proved. Enable the model checker option \"show unproved\" to see all of them. Consider choosing a specific contract to be verified in order to reduce the solving problems. Consider increasing the timeout per query.", + "severity": "warning", + "type": "Warning" + }, + { + "component": "general", + "errorCode": "8084", + "formattedMessage": "Warning: BMC analysis was not possible. No SMT solver (Z3 or CVC4) was available. None of the installed solvers was enabled. + +", + "message": "BMC analysis was not possible. No SMT solver (Z3 or CVC4) was available. None of the installed solvers was enabled.", + "severity": "warning", + "type": "Warning" + } + ], + "sources": + { + "A": + { + "id": 0 + } + } +} diff --git a/test/cmdlineTests/standard_model_checker_print_query_chc/input.json b/test/cmdlineTests/standard_model_checker_print_query_chc/input.json new file mode 100644 index 000000000000..d5801ef260fd --- /dev/null +++ b/test/cmdlineTests/standard_model_checker_print_query_chc/input.json @@ -0,0 +1,27 @@ +{ + "language": "Solidity", + "sources": + { + "A": + { + "content": "// SPDX-License-Identifier: GPL-3.0\npragma solidity >=0.0;\n + contract C + { + function f() public pure { + uint x = 0; + assert(x == 0); + } + }" + } + }, + "settings": + { + "modelChecker": + { + "engine": "chc", + "printQuery": true, + "solvers": ["smtlib2"], + "timeout": 1000 + } + } +} diff --git a/test/cmdlineTests/standard_model_checker_print_query_chc/output.json b/test/cmdlineTests/standard_model_checker_print_query_chc/output.json new file mode 100644 index 000000000000..9ef925b205a2 --- /dev/null +++ b/test/cmdlineTests/standard_model_checker_print_query_chc/output.json @@ -0,0 +1,420 @@ +{ + "auxiliaryInputRequested": + { + "smtlib2queries": + { + "0x1880095c52d8681601c6821e4a5c29740649509af99947bce54102546dd3376a": "(set-option :timeout 1000) +(set-logic HORN) +(declare-datatypes ((|bytes_tuple| 0)) (((|bytes_tuple| (|bytes_tuple_accessor_array| (Array Int Int)) (|bytes_tuple_accessor_length| Int))))) +(declare-datatypes ((|tx_type| 0)) (((|tx_type| (|block.basefee| Int) (|block.chainid| Int) (|block.coinbase| Int) (|block.gaslimit| Int) (|block.number| Int) (|block.prevrandao| Int) (|block.timestamp| Int) (|blockhash| (Array Int Int)) (|msg.data| |bytes_tuple|) (|msg.sender| Int) (|msg.sig| Int) (|msg.value| Int) (|tx.gasprice| Int) (|tx.origin| Int))))) +(declare-datatypes ((|ecrecover_input_type| 0)) (((|ecrecover_input_type| (|hash| Int) (|v| Int) (|r| Int) (|s| Int))))) +(declare-datatypes ((|crypto_type| 0)) (((|crypto_type| (|ecrecover| (Array |ecrecover_input_type| Int)) (|keccak256| (Array |bytes_tuple| Int)) (|ripemd160| (Array |bytes_tuple| Int)) (|sha256| (Array |bytes_tuple| Int)))))) +(declare-datatypes ((|abi_type| 0)) (((|abi_type|)))) +(declare-datatypes ((|state_type| 0)) (((|state_type| (|balances| (Array Int Int)))))) +(declare-fun |interface_0_C_16_0| (Int |abi_type| |crypto_type| |state_type| ) Bool) +(declare-fun |nondet_interface_1_C_16_0| (Int Int |abi_type| |crypto_type| |state_type| |state_type| ) Bool) +(declare-fun |summary_constructor_2_C_16_0| (Int Int |abi_type| |crypto_type| |tx_type| |state_type| |state_type| ) Bool) +(assert +(forall ( (abi_0 |abi_type|) (crypto_0 |crypto_type|) (error_0 Int) (state_0 |state_type|) (this_0 Int) (tx_0 |tx_type|)) +(=> (= error_0 0) (nondet_interface_1_C_16_0 error_0 this_0 abi_0 crypto_0 state_0 state_0)))) + + +(declare-fun |summary_3_function_f__15_16_0| (Int Int |abi_type| |crypto_type| |tx_type| |state_type| |state_type| ) Bool) +(declare-fun |summary_4_function_f__15_16_0| (Int Int |abi_type| |crypto_type| |tx_type| |state_type| |state_type| ) Bool) +(assert +(forall ( (abi_0 |abi_type|) (crypto_0 |crypto_type|) (error_0 Int) (error_1 Int) (state_0 |state_type|) (state_1 |state_type|) (state_2 |state_type|) (this_0 Int) (tx_0 |tx_type|)) +(=> (and (and (nondet_interface_1_C_16_0 error_0 this_0 abi_0 crypto_0 state_0 state_1) true) (and (= error_0 0) (summary_4_function_f__15_16_0 error_1 this_0 abi_0 crypto_0 tx_0 state_1 state_2))) (nondet_interface_1_C_16_0 error_1 this_0 abi_0 crypto_0 state_0 state_2)))) + + +(declare-fun |block_5_function_f__15_16_0| (Int Int |abi_type| |crypto_type| |tx_type| |state_type| |state_type| Int ) Bool) +(declare-fun |block_6_f_14_16_0| (Int Int |abi_type| |crypto_type| |tx_type| |state_type| |state_type| Int ) Bool) +(assert +(forall ( (abi_0 |abi_type|) (crypto_0 |crypto_type|) (error_0 Int) (error_1 Int) (state_0 |state_type|) (state_1 |state_type|) (state_2 |state_type|) (this_0 Int) (tx_0 |tx_type|) (x_5_0 Int) (x_5_1 Int)) +(block_5_function_f__15_16_0 error_0 this_0 abi_0 crypto_0 tx_0 state_0 state_1 x_5_1))) + + +(assert +(forall ( (abi_0 |abi_type|) (crypto_0 |crypto_type|) (error_0 Int) (error_1 Int) (state_0 |state_type|) (state_1 |state_type|) (state_2 |state_type|) (this_0 Int) (tx_0 |tx_type|) (x_5_0 Int) (x_5_1 Int)) +(=> (and (and (block_5_function_f__15_16_0 error_0 this_0 abi_0 crypto_0 tx_0 state_0 state_1 x_5_1) (and (and (and (and (= state_1 state_0) (= error_0 0)) true) true) true)) true) (block_6_f_14_16_0 error_0 this_0 abi_0 crypto_0 tx_0 state_0 state_1 x_5_1)))) + + +(declare-fun |block_7_return_function_f__15_16_0| (Int Int |abi_type| |crypto_type| |tx_type| |state_type| |state_type| Int ) Bool) +(declare-fun |block_8_function_f__15_16_0| (Int Int |abi_type| |crypto_type| |tx_type| |state_type| |state_type| Int ) Bool) +(assert +(forall ( (abi_0 |abi_type|) (crypto_0 |crypto_type|) (error_0 Int) (error_1 Int) (expr_10_0 Int) (expr_11_1 Bool) (expr_6_0 Int) (expr_9_0 Int) (state_0 |state_type|) (state_1 |state_type|) (state_2 |state_type|) (this_0 Int) (tx_0 |tx_type|) (x_5_0 Int) (x_5_1 Int) (x_5_2 Int)) +(=> (and (and (block_6_f_14_16_0 error_0 this_0 abi_0 crypto_0 tx_0 state_0 state_1 x_5_1) (and (= expr_11_1 (= expr_9_0 expr_10_0)) (and (=> true true) (and (= expr_10_0 0) (and (=> true (and (>= expr_9_0 0) (<= expr_9_0 115792089237316195423570985008687907853269984665640564039457584007913129639935))) (and (= expr_9_0 x_5_2) (and (= x_5_2 expr_6_0) (and (=> true true) (and (= expr_6_0 0) (and (= x_5_1 0) true)))))))))) (and (and true (not expr_11_1)) (= error_1 1))) (block_8_function_f__15_16_0 error_1 this_0 abi_0 crypto_0 tx_0 state_0 state_1 x_5_2)))) + + +(assert +(forall ( (abi_0 |abi_type|) (crypto_0 |crypto_type|) (error_0 Int) (error_1 Int) (expr_10_0 Int) (expr_11_1 Bool) (expr_6_0 Int) (expr_9_0 Int) (state_0 |state_type|) (state_1 |state_type|) (state_2 |state_type|) (this_0 Int) (tx_0 |tx_type|) (x_5_0 Int) (x_5_1 Int) (x_5_2 Int)) +(=> (block_8_function_f__15_16_0 error_1 this_0 abi_0 crypto_0 tx_0 state_0 state_1 x_5_2) (summary_3_function_f__15_16_0 error_1 this_0 abi_0 crypto_0 tx_0 state_0 state_1)))) + + +(assert +(forall ( (abi_0 |abi_type|) (crypto_0 |crypto_type|) (error_0 Int) (error_1 Int) (expr_10_0 Int) (expr_11_1 Bool) (expr_6_0 Int) (expr_9_0 Int) (state_0 |state_type|) (state_1 |state_type|) (state_2 |state_type|) (this_0 Int) (tx_0 |tx_type|) (x_5_0 Int) (x_5_1 Int) (x_5_2 Int)) +(=> (and (and (block_6_f_14_16_0 error_0 this_0 abi_0 crypto_0 tx_0 state_0 state_1 x_5_1) (and (= error_1 error_0) (and (= expr_11_1 (= expr_9_0 expr_10_0)) (and (=> true true) (and (= expr_10_0 0) (and (=> true (and (>= expr_9_0 0) (<= expr_9_0 115792089237316195423570985008687907853269984665640564039457584007913129639935))) (and (= expr_9_0 x_5_2) (and (= x_5_2 expr_6_0) (and (=> true true) (and (= expr_6_0 0) (and (= x_5_1 0) true))))))))))) true) (block_7_return_function_f__15_16_0 error_1 this_0 abi_0 crypto_0 tx_0 state_0 state_1 x_5_2)))) + + +(assert +(forall ( (abi_0 |abi_type|) (crypto_0 |crypto_type|) (error_0 Int) (error_1 Int) (expr_10_0 Int) (expr_11_1 Bool) (expr_6_0 Int) (expr_9_0 Int) (state_0 |state_type|) (state_1 |state_type|) (state_2 |state_type|) (this_0 Int) (tx_0 |tx_type|) (x_5_0 Int) (x_5_1 Int) (x_5_2 Int)) +(=> (and (and (block_7_return_function_f__15_16_0 error_0 this_0 abi_0 crypto_0 tx_0 state_0 state_1 x_5_1) true) true) (summary_3_function_f__15_16_0 error_0 this_0 abi_0 crypto_0 tx_0 state_0 state_1)))) + + +(declare-fun |block_9_function_f__15_16_0| (Int Int |abi_type| |crypto_type| |tx_type| |state_type| |state_type| Int ) Bool) +(assert +(forall ( (abi_0 |abi_type|) (crypto_0 |crypto_type|) (error_0 Int) (error_1 Int) (expr_10_0 Int) (expr_11_1 Bool) (expr_6_0 Int) (expr_9_0 Int) (state_0 |state_type|) (state_1 |state_type|) (state_2 |state_type|) (this_0 Int) (tx_0 |tx_type|) (x_5_0 Int) (x_5_1 Int) (x_5_2 Int)) +(block_9_function_f__15_16_0 error_0 this_0 abi_0 crypto_0 tx_0 state_0 state_1 x_5_1))) + + +(assert +(forall ( (abi_0 |abi_type|) (crypto_0 |crypto_type|) (error_0 Int) (error_1 Int) (expr_10_0 Int) (expr_11_1 Bool) (expr_6_0 Int) (expr_9_0 Int) (funds_2_0 Int) (state_0 |state_type|) (state_1 |state_type|) (state_2 |state_type|) (state_3 |state_type|) (this_0 Int) (tx_0 |tx_type|) (x_5_0 Int) (x_5_1 Int) (x_5_2 Int)) +(=> (and (and (block_9_function_f__15_16_0 error_0 this_0 abi_0 crypto_0 tx_0 state_0 state_1 x_5_1) (and (summary_3_function_f__15_16_0 error_1 this_0 abi_0 crypto_0 tx_0 state_2 state_3) (and (= state_2 (|state_type| (store (|balances| state_1) this_0 (+ (select (|balances| state_1) this_0) funds_2_0)))) (and (and (>= (+ (select (|balances| state_1) this_0) funds_2_0) 0) (<= (+ (select (|balances| state_1) this_0) funds_2_0) 115792089237316195423570985008687907853269984665640564039457584007913129639935)) (and (>= funds_2_0 (|msg.value| tx_0)) (and (and (and (and (and (and (and (and (and (and (and (and (and (> (|block.prevrandao| tx_0) 18446744073709551616) (and (>= (|block.basefee| tx_0) 0) (<= (|block.basefee| tx_0) 115792089237316195423570985008687907853269984665640564039457584007913129639935))) (and (>= (|block.chainid| tx_0) 0) (<= (|block.chainid| tx_0) 115792089237316195423570985008687907853269984665640564039457584007913129639935))) (and (>= (|block.coinbase| tx_0) 0) (<= (|block.coinbase| tx_0) 1461501637330902918203684832716283019655932542975))) (and (>= (|block.prevrandao| tx_0) 0) (<= (|block.prevrandao| tx_0) 115792089237316195423570985008687907853269984665640564039457584007913129639935))) (and (>= (|block.gaslimit| tx_0) 0) (<= (|block.gaslimit| tx_0) 115792089237316195423570985008687907853269984665640564039457584007913129639935))) (and (>= (|block.number| tx_0) 0) (<= (|block.number| tx_0) 115792089237316195423570985008687907853269984665640564039457584007913129639935))) (and (>= (|block.timestamp| tx_0) 0) (<= (|block.timestamp| tx_0) 115792089237316195423570985008687907853269984665640564039457584007913129639935))) (and (>= (|msg.sender| tx_0) 0) (<= (|msg.sender| tx_0) 1461501637330902918203684832716283019655932542975))) (and (>= (|msg.value| tx_0) 0) (<= (|msg.value| tx_0) 115792089237316195423570985008687907853269984665640564039457584007913129639935))) (and (>= (|tx.origin| tx_0) 0) (<= (|tx.origin| tx_0) 1461501637330902918203684832716283019655932542975))) (and (>= (|tx.gasprice| tx_0) 0) (<= (|tx.gasprice| tx_0) 115792089237316195423570985008687907853269984665640564039457584007913129639935))) (and (and (and (and (and (and (= (|msg.value| tx_0) 0) (= (|msg.sig| tx_0) 638722032)) (= (select (|bytes_tuple_accessor_array| (|msg.data| tx_0)) 0) 38)) (= (select (|bytes_tuple_accessor_array| (|msg.data| tx_0)) 1) 18)) (= (select (|bytes_tuple_accessor_array| (|msg.data| tx_0)) 2) 31)) (= (select (|bytes_tuple_accessor_array| (|msg.data| tx_0)) 3) 240)) (>= (|bytes_tuple_accessor_length| (|msg.data| tx_0)) 4))) (and (and (and (and (= state_1 state_0) (= error_0 0)) true) true) true))))))) true) (summary_4_function_f__15_16_0 error_1 this_0 abi_0 crypto_0 tx_0 state_0 state_3)))) + + +(assert +(forall ( (abi_0 |abi_type|) (crypto_0 |crypto_type|) (error_0 Int) (error_1 Int) (expr_10_0 Int) (expr_11_1 Bool) (expr_6_0 Int) (expr_9_0 Int) (funds_2_0 Int) (state_0 |state_type|) (state_1 |state_type|) (state_2 |state_type|) (state_3 |state_type|) (this_0 Int) (tx_0 |tx_type|) (x_5_0 Int) (x_5_1 Int) (x_5_2 Int)) +(=> (and (and (interface_0_C_16_0 this_0 abi_0 crypto_0 state_0) true) (and (summary_4_function_f__15_16_0 error_0 this_0 abi_0 crypto_0 tx_0 state_0 state_1) (= error_0 0))) (interface_0_C_16_0 this_0 abi_0 crypto_0 state_1)))) + + +(declare-fun |contract_initializer_10_C_16_0| (Int Int |abi_type| |crypto_type| |tx_type| |state_type| |state_type| ) Bool) +(declare-fun |contract_initializer_entry_11_C_16_0| (Int Int |abi_type| |crypto_type| |tx_type| |state_type| |state_type| ) Bool) +(assert +(forall ( (abi_0 |abi_type|) (crypto_0 |crypto_type|) (error_0 Int) (error_1 Int) (expr_10_0 Int) (expr_11_1 Bool) (expr_6_0 Int) (expr_9_0 Int) (funds_2_0 Int) (state_0 |state_type|) (state_1 |state_type|) (state_2 |state_type|) (state_3 |state_type|) (this_0 Int) (tx_0 |tx_type|) (x_5_0 Int) (x_5_1 Int) (x_5_2 Int)) +(=> (and (and (= state_1 state_0) (= error_0 0)) true) (contract_initializer_entry_11_C_16_0 error_0 this_0 abi_0 crypto_0 tx_0 state_0 state_1)))) + + +(declare-fun |contract_initializer_after_init_12_C_16_0| (Int Int |abi_type| |crypto_type| |tx_type| |state_type| |state_type| ) Bool) +(assert +(forall ( (abi_0 |abi_type|) (crypto_0 |crypto_type|) (error_0 Int) (error_1 Int) (expr_10_0 Int) (expr_11_1 Bool) (expr_6_0 Int) (expr_9_0 Int) (funds_2_0 Int) (state_0 |state_type|) (state_1 |state_type|) (state_2 |state_type|) (state_3 |state_type|) (this_0 Int) (tx_0 |tx_type|) (x_5_0 Int) (x_5_1 Int) (x_5_2 Int)) +(=> (and (and (contract_initializer_entry_11_C_16_0 error_0 this_0 abi_0 crypto_0 tx_0 state_0 state_1) true) true) (contract_initializer_after_init_12_C_16_0 error_0 this_0 abi_0 crypto_0 tx_0 state_0 state_1)))) + + +(assert +(forall ( (abi_0 |abi_type|) (crypto_0 |crypto_type|) (error_0 Int) (error_1 Int) (expr_10_0 Int) (expr_11_1 Bool) (expr_6_0 Int) (expr_9_0 Int) (funds_2_0 Int) (state_0 |state_type|) (state_1 |state_type|) (state_2 |state_type|) (state_3 |state_type|) (this_0 Int) (tx_0 |tx_type|) (x_5_0 Int) (x_5_1 Int) (x_5_2 Int)) +(=> (and (and (contract_initializer_after_init_12_C_16_0 error_0 this_0 abi_0 crypto_0 tx_0 state_0 state_1) true) true) (contract_initializer_10_C_16_0 error_0 this_0 abi_0 crypto_0 tx_0 state_0 state_1)))) + + +(declare-fun |implicit_constructor_entry_13_C_16_0| (Int Int |abi_type| |crypto_type| |tx_type| |state_type| |state_type| ) Bool) +(assert +(forall ( (abi_0 |abi_type|) (crypto_0 |crypto_type|) (error_0 Int) (error_1 Int) (expr_10_0 Int) (expr_11_1 Bool) (expr_6_0 Int) (expr_9_0 Int) (funds_2_0 Int) (state_0 |state_type|) (state_1 |state_type|) (state_2 |state_type|) (state_3 |state_type|) (this_0 Int) (tx_0 |tx_type|) (x_5_0 Int) (x_5_1 Int) (x_5_2 Int)) +(=> (and (and (and (and (and (= state_1 state_0) (= error_0 0)) true) true) true) (>= (select (|balances| state_1) this_0) (|msg.value| tx_0))) (implicit_constructor_entry_13_C_16_0 error_0 this_0 abi_0 crypto_0 tx_0 state_0 state_1)))) + + +(assert +(forall ( (abi_0 |abi_type|) (crypto_0 |crypto_type|) (error_0 Int) (error_1 Int) (expr_10_0 Int) (expr_11_1 Bool) (expr_6_0 Int) (expr_9_0 Int) (funds_2_0 Int) (state_0 |state_type|) (state_1 |state_type|) (state_2 |state_type|) (state_3 |state_type|) (this_0 Int) (tx_0 |tx_type|) (x_5_0 Int) (x_5_1 Int) (x_5_2 Int)) +(=> (and (and (implicit_constructor_entry_13_C_16_0 error_0 this_0 abi_0 crypto_0 tx_0 state_0 state_1) (and (contract_initializer_10_C_16_0 error_1 this_0 abi_0 crypto_0 tx_0 state_1 state_2) true)) (> error_1 0)) (summary_constructor_2_C_16_0 error_1 this_0 abi_0 crypto_0 tx_0 state_0 state_2)))) + + +(assert +(forall ( (abi_0 |abi_type|) (crypto_0 |crypto_type|) (error_0 Int) (error_1 Int) (expr_10_0 Int) (expr_11_1 Bool) (expr_6_0 Int) (expr_9_0 Int) (funds_2_0 Int) (state_0 |state_type|) (state_1 |state_type|) (state_2 |state_type|) (state_3 |state_type|) (this_0 Int) (tx_0 |tx_type|) (x_5_0 Int) (x_5_1 Int) (x_5_2 Int)) +(=> (and (and (implicit_constructor_entry_13_C_16_0 error_0 this_0 abi_0 crypto_0 tx_0 state_0 state_1) (and (= error_1 0) (and (contract_initializer_10_C_16_0 error_1 this_0 abi_0 crypto_0 tx_0 state_1 state_2) true))) true) (summary_constructor_2_C_16_0 error_1 this_0 abi_0 crypto_0 tx_0 state_0 state_2)))) + + +(assert +(forall ( (abi_0 |abi_type|) (crypto_0 |crypto_type|) (error_0 Int) (error_1 Int) (expr_10_0 Int) (expr_11_1 Bool) (expr_6_0 Int) (expr_9_0 Int) (funds_2_0 Int) (state_0 |state_type|) (state_1 |state_type|) (state_2 |state_type|) (state_3 |state_type|) (this_0 Int) (tx_0 |tx_type|) (x_5_0 Int) (x_5_1 Int) (x_5_2 Int)) +(=> (and (and (summary_constructor_2_C_16_0 error_0 this_0 abi_0 crypto_0 tx_0 state_0 state_1) true) (and (and (and (and (and (and (and (and (and (and (and (and (and (> (|block.prevrandao| tx_0) 18446744073709551616) (and (>= (|block.basefee| tx_0) 0) (<= (|block.basefee| tx_0) 115792089237316195423570985008687907853269984665640564039457584007913129639935))) (and (>= (|block.chainid| tx_0) 0) (<= (|block.chainid| tx_0) 115792089237316195423570985008687907853269984665640564039457584007913129639935))) (and (>= (|block.coinbase| tx_0) 0) (<= (|block.coinbase| tx_0) 1461501637330902918203684832716283019655932542975))) (and (>= (|block.prevrandao| tx_0) 0) (<= (|block.prevrandao| tx_0) 115792089237316195423570985008687907853269984665640564039457584007913129639935))) (and (>= (|block.gaslimit| tx_0) 0) (<= (|block.gaslimit| tx_0) 115792089237316195423570985008687907853269984665640564039457584007913129639935))) (and (>= (|block.number| tx_0) 0) (<= (|block.number| tx_0) 115792089237316195423570985008687907853269984665640564039457584007913129639935))) (and (>= (|block.timestamp| tx_0) 0) (<= (|block.timestamp| tx_0) 115792089237316195423570985008687907853269984665640564039457584007913129639935))) (and (>= (|msg.sender| tx_0) 0) (<= (|msg.sender| tx_0) 1461501637330902918203684832716283019655932542975))) (and (>= (|msg.value| tx_0) 0) (<= (|msg.value| tx_0) 115792089237316195423570985008687907853269984665640564039457584007913129639935))) (and (>= (|tx.origin| tx_0) 0) (<= (|tx.origin| tx_0) 1461501637330902918203684832716283019655932542975))) (and (>= (|tx.gasprice| tx_0) 0) (<= (|tx.gasprice| tx_0) 115792089237316195423570985008687907853269984665640564039457584007913129639935))) (= (|msg.value| tx_0) 0)) (= error_0 0))) (interface_0_C_16_0 this_0 abi_0 crypto_0 state_1)))) + + +(declare-fun |error_target_3_0| () Bool) +(assert +(forall ( (abi_0 |abi_type|) (crypto_0 |crypto_type|) (error_0 Int) (error_1 Int) (expr_10_0 Int) (expr_11_1 Bool) (expr_6_0 Int) (expr_9_0 Int) (funds_2_0 Int) (state_0 |state_type|) (state_1 |state_type|) (state_2 |state_type|) (state_3 |state_type|) (this_0 Int) (tx_0 |tx_type|) (x_5_0 Int) (x_5_1 Int) (x_5_2 Int)) +(=> (and (and (interface_0_C_16_0 this_0 abi_0 crypto_0 state_0) true) (and (summary_4_function_f__15_16_0 error_0 this_0 abi_0 crypto_0 tx_0 state_0 state_1) (= error_0 1))) error_target_3_0))) + + + +(assert +(forall ( (abi_0 |abi_type|) (crypto_0 |crypto_type|) (error_0 Int) (error_1 Int) (expr_10_0 Int) (expr_11_1 Bool) (expr_6_0 Int) (expr_9_0 Int) (funds_2_0 Int) (state_0 |state_type|) (state_1 |state_type|) (state_2 |state_type|) (state_3 |state_type|) (this_0 Int) (tx_0 |tx_type|) (x_5_0 Int) (x_5_1 Int) (x_5_2 Int)) +(=> error_target_3_0 false))) +(check-sat) +" + } + }, + "errors": + [ + { + "component": "general", + "errorCode": "2339", + "formattedMessage": "Info: CHC: Requested query: +(set-option :timeout 1000) +(set-logic HORN) +(declare-datatypes ((|bytes_tuple| 0)) (((|bytes_tuple| (|bytes_tuple_accessor_array| (Array Int Int)) (|bytes_tuple_accessor_length| Int))))) +(declare-datatypes ((|tx_type| 0)) (((|tx_type| (|block.basefee| Int) (|block.chainid| Int) (|block.coinbase| Int) (|block.gaslimit| Int) (|block.number| Int) (|block.prevrandao| Int) (|block.timestamp| Int) (|blockhash| (Array Int Int)) (|msg.data| |bytes_tuple|) (|msg.sender| Int) (|msg.sig| Int) (|msg.value| Int) (|tx.gasprice| Int) (|tx.origin| Int))))) +(declare-datatypes ((|ecrecover_input_type| 0)) (((|ecrecover_input_type| (|hash| Int) (|v| Int) (|r| Int) (|s| Int))))) +(declare-datatypes ((|crypto_type| 0)) (((|crypto_type| (|ecrecover| (Array |ecrecover_input_type| Int)) (|keccak256| (Array |bytes_tuple| Int)) (|ripemd160| (Array |bytes_tuple| Int)) (|sha256| (Array |bytes_tuple| Int)))))) +(declare-datatypes ((|abi_type| 0)) (((|abi_type|)))) +(declare-datatypes ((|state_type| 0)) (((|state_type| (|balances| (Array Int Int)))))) +(declare-fun |interface_0_C_16_0| (Int |abi_type| |crypto_type| |state_type| ) Bool) +(declare-fun |nondet_interface_1_C_16_0| (Int Int |abi_type| |crypto_type| |state_type| |state_type| ) Bool) +(declare-fun |summary_constructor_2_C_16_0| (Int Int |abi_type| |crypto_type| |tx_type| |state_type| |state_type| ) Bool) +(assert +(forall ( (abi_0 |abi_type|) (crypto_0 |crypto_type|) (error_0 Int) (state_0 |state_type|) (this_0 Int) (tx_0 |tx_type|)) +(=> (= error_0 0) (nondet_interface_1_C_16_0 error_0 this_0 abi_0 crypto_0 state_0 state_0)))) + + +(declare-fun |summary_3_function_f__15_16_0| (Int Int |abi_type| |crypto_type| |tx_type| |state_type| |state_type| ) Bool) +(declare-fun |summary_4_function_f__15_16_0| (Int Int |abi_type| |crypto_type| |tx_type| |state_type| |state_type| ) Bool) +(assert +(forall ( (abi_0 |abi_type|) (crypto_0 |crypto_type|) (error_0 Int) (error_1 Int) (state_0 |state_type|) (state_1 |state_type|) (state_2 |state_type|) (this_0 Int) (tx_0 |tx_type|)) +(=> (and (and (nondet_interface_1_C_16_0 error_0 this_0 abi_0 crypto_0 state_0 state_1) true) (and (= error_0 0) (summary_4_function_f__15_16_0 error_1 this_0 abi_0 crypto_0 tx_0 state_1 state_2))) (nondet_interface_1_C_16_0 error_1 this_0 abi_0 crypto_0 state_0 state_2)))) + + +(declare-fun |block_5_function_f__15_16_0| (Int Int |abi_type| |crypto_type| |tx_type| |state_type| |state_type| Int ) Bool) +(declare-fun |block_6_f_14_16_0| (Int Int |abi_type| |crypto_type| |tx_type| |state_type| |state_type| Int ) Bool) +(assert +(forall ( (abi_0 |abi_type|) (crypto_0 |crypto_type|) (error_0 Int) (error_1 Int) (state_0 |state_type|) (state_1 |state_type|) (state_2 |state_type|) (this_0 Int) (tx_0 |tx_type|) (x_5_0 Int) (x_5_1 Int)) +(block_5_function_f__15_16_0 error_0 this_0 abi_0 crypto_0 tx_0 state_0 state_1 x_5_1))) + + +(assert +(forall ( (abi_0 |abi_type|) (crypto_0 |crypto_type|) (error_0 Int) (error_1 Int) (state_0 |state_type|) (state_1 |state_type|) (state_2 |state_type|) (this_0 Int) (tx_0 |tx_type|) (x_5_0 Int) (x_5_1 Int)) +(=> (and (and (block_5_function_f__15_16_0 error_0 this_0 abi_0 crypto_0 tx_0 state_0 state_1 x_5_1) (and (and (and (and (= state_1 state_0) (= error_0 0)) true) true) true)) true) (block_6_f_14_16_0 error_0 this_0 abi_0 crypto_0 tx_0 state_0 state_1 x_5_1)))) + + +(declare-fun |block_7_return_function_f__15_16_0| (Int Int |abi_type| |crypto_type| |tx_type| |state_type| |state_type| Int ) Bool) +(declare-fun |block_8_function_f__15_16_0| (Int Int |abi_type| |crypto_type| |tx_type| |state_type| |state_type| Int ) Bool) +(assert +(forall ( (abi_0 |abi_type|) (crypto_0 |crypto_type|) (error_0 Int) (error_1 Int) (expr_10_0 Int) (expr_11_1 Bool) (expr_6_0 Int) (expr_9_0 Int) (state_0 |state_type|) (state_1 |state_type|) (state_2 |state_type|) (this_0 Int) (tx_0 |tx_type|) (x_5_0 Int) (x_5_1 Int) (x_5_2 Int)) +(=> (and (and (block_6_f_14_16_0 error_0 this_0 abi_0 crypto_0 tx_0 state_0 state_1 x_5_1) (and (= expr_11_1 (= expr_9_0 expr_10_0)) (and (=> true true) (and (= expr_10_0 0) (and (=> true (and (>= expr_9_0 0) (<= expr_9_0 115792089237316195423570985008687907853269984665640564039457584007913129639935))) (and (= expr_9_0 x_5_2) (and (= x_5_2 expr_6_0) (and (=> true true) (and (= expr_6_0 0) (and (= x_5_1 0) true)))))))))) (and (and true (not expr_11_1)) (= error_1 1))) (block_8_function_f__15_16_0 error_1 this_0 abi_0 crypto_0 tx_0 state_0 state_1 x_5_2)))) + + +(assert +(forall ( (abi_0 |abi_type|) (crypto_0 |crypto_type|) (error_0 Int) (error_1 Int) (expr_10_0 Int) (expr_11_1 Bool) (expr_6_0 Int) (expr_9_0 Int) (state_0 |state_type|) (state_1 |state_type|) (state_2 |state_type|) (this_0 Int) (tx_0 |tx_type|) (x_5_0 Int) (x_5_1 Int) (x_5_2 Int)) +(=> (block_8_function_f__15_16_0 error_1 this_0 abi_0 crypto_0 tx_0 state_0 state_1 x_5_2) (summary_3_function_f__15_16_0 error_1 this_0 abi_0 crypto_0 tx_0 state_0 state_1)))) + + +(assert +(forall ( (abi_0 |abi_type|) (crypto_0 |crypto_type|) (error_0 Int) (error_1 Int) (expr_10_0 Int) (expr_11_1 Bool) (expr_6_0 Int) (expr_9_0 Int) (state_0 |state_type|) (state_1 |state_type|) (state_2 |state_type|) (this_0 Int) (tx_0 |tx_type|) (x_5_0 Int) (x_5_1 Int) (x_5_2 Int)) +(=> (and (and (block_6_f_14_16_0 error_0 this_0 abi_0 crypto_0 tx_0 state_0 state_1 x_5_1) (and (= error_1 error_0) (and (= expr_11_1 (= expr_9_0 expr_10_0)) (and (=> true true) (and (= expr_10_0 0) (and (=> true (and (>= expr_9_0 0) (<= expr_9_0 115792089237316195423570985008687907853269984665640564039457584007913129639935))) (and (= expr_9_0 x_5_2) (and (= x_5_2 expr_6_0) (and (=> true true) (and (= expr_6_0 0) (and (= x_5_1 0) true))))))))))) true) (block_7_return_function_f__15_16_0 error_1 this_0 abi_0 crypto_0 tx_0 state_0 state_1 x_5_2)))) + + +(assert +(forall ( (abi_0 |abi_type|) (crypto_0 |crypto_type|) (error_0 Int) (error_1 Int) (expr_10_0 Int) (expr_11_1 Bool) (expr_6_0 Int) (expr_9_0 Int) (state_0 |state_type|) (state_1 |state_type|) (state_2 |state_type|) (this_0 Int) (tx_0 |tx_type|) (x_5_0 Int) (x_5_1 Int) (x_5_2 Int)) +(=> (and (and (block_7_return_function_f__15_16_0 error_0 this_0 abi_0 crypto_0 tx_0 state_0 state_1 x_5_1) true) true) (summary_3_function_f__15_16_0 error_0 this_0 abi_0 crypto_0 tx_0 state_0 state_1)))) + + +(declare-fun |block_9_function_f__15_16_0| (Int Int |abi_type| |crypto_type| |tx_type| |state_type| |state_type| Int ) Bool) +(assert +(forall ( (abi_0 |abi_type|) (crypto_0 |crypto_type|) (error_0 Int) (error_1 Int) (expr_10_0 Int) (expr_11_1 Bool) (expr_6_0 Int) (expr_9_0 Int) (state_0 |state_type|) (state_1 |state_type|) (state_2 |state_type|) (this_0 Int) (tx_0 |tx_type|) (x_5_0 Int) (x_5_1 Int) (x_5_2 Int)) +(block_9_function_f__15_16_0 error_0 this_0 abi_0 crypto_0 tx_0 state_0 state_1 x_5_1))) + + +(assert +(forall ( (abi_0 |abi_type|) (crypto_0 |crypto_type|) (error_0 Int) (error_1 Int) (expr_10_0 Int) (expr_11_1 Bool) (expr_6_0 Int) (expr_9_0 Int) (funds_2_0 Int) (state_0 |state_type|) (state_1 |state_type|) (state_2 |state_type|) (state_3 |state_type|) (this_0 Int) (tx_0 |tx_type|) (x_5_0 Int) (x_5_1 Int) (x_5_2 Int)) +(=> (and (and (block_9_function_f__15_16_0 error_0 this_0 abi_0 crypto_0 tx_0 state_0 state_1 x_5_1) (and (summary_3_function_f__15_16_0 error_1 this_0 abi_0 crypto_0 tx_0 state_2 state_3) (and (= state_2 (|state_type| (store (|balances| state_1) this_0 (+ (select (|balances| state_1) this_0) funds_2_0)))) (and (and (>= (+ (select (|balances| state_1) this_0) funds_2_0) 0) (<= (+ (select (|balances| state_1) this_0) funds_2_0) 115792089237316195423570985008687907853269984665640564039457584007913129639935)) (and (>= funds_2_0 (|msg.value| tx_0)) (and (and (and (and (and (and (and (and (and (and (and (and (and (> (|block.prevrandao| tx_0) 18446744073709551616) (and (>= (|block.basefee| tx_0) 0) (<= (|block.basefee| tx_0) 115792089237316195423570985008687907853269984665640564039457584007913129639935))) (and (>= (|block.chainid| tx_0) 0) (<= (|block.chainid| tx_0) 115792089237316195423570985008687907853269984665640564039457584007913129639935))) (and (>= (|block.coinbase| tx_0) 0) (<= (|block.coinbase| tx_0) 1461501637330902918203684832716283019655932542975))) (and (>= (|block.prevrandao| tx_0) 0) (<= (|block.prevrandao| tx_0) 115792089237316195423570985008687907853269984665640564039457584007913129639935))) (and (>= (|block.gaslimit| tx_0) 0) (<= (|block.gaslimit| tx_0) 115792089237316195423570985008687907853269984665640564039457584007913129639935))) (and (>= (|block.number| tx_0) 0) (<= (|block.number| tx_0) 115792089237316195423570985008687907853269984665640564039457584007913129639935))) (and (>= (|block.timestamp| tx_0) 0) (<= (|block.timestamp| tx_0) 115792089237316195423570985008687907853269984665640564039457584007913129639935))) (and (>= (|msg.sender| tx_0) 0) (<= (|msg.sender| tx_0) 1461501637330902918203684832716283019655932542975))) (and (>= (|msg.value| tx_0) 0) (<= (|msg.value| tx_0) 115792089237316195423570985008687907853269984665640564039457584007913129639935))) (and (>= (|tx.origin| tx_0) 0) (<= (|tx.origin| tx_0) 1461501637330902918203684832716283019655932542975))) (and (>= (|tx.gasprice| tx_0) 0) (<= (|tx.gasprice| tx_0) 115792089237316195423570985008687907853269984665640564039457584007913129639935))) (and (and (and (and (and (and (= (|msg.value| tx_0) 0) (= (|msg.sig| tx_0) 638722032)) (= (select (|bytes_tuple_accessor_array| (|msg.data| tx_0)) 0) 38)) (= (select (|bytes_tuple_accessor_array| (|msg.data| tx_0)) 1) 18)) (= (select (|bytes_tuple_accessor_array| (|msg.data| tx_0)) 2) 31)) (= (select (|bytes_tuple_accessor_array| (|msg.data| tx_0)) 3) 240)) (>= (|bytes_tuple_accessor_length| (|msg.data| tx_0)) 4))) (and (and (and (and (= state_1 state_0) (= error_0 0)) true) true) true))))))) true) (summary_4_function_f__15_16_0 error_1 this_0 abi_0 crypto_0 tx_0 state_0 state_3)))) + + +(assert +(forall ( (abi_0 |abi_type|) (crypto_0 |crypto_type|) (error_0 Int) (error_1 Int) (expr_10_0 Int) (expr_11_1 Bool) (expr_6_0 Int) (expr_9_0 Int) (funds_2_0 Int) (state_0 |state_type|) (state_1 |state_type|) (state_2 |state_type|) (state_3 |state_type|) (this_0 Int) (tx_0 |tx_type|) (x_5_0 Int) (x_5_1 Int) (x_5_2 Int)) +(=> (and (and (interface_0_C_16_0 this_0 abi_0 crypto_0 state_0) true) (and (summary_4_function_f__15_16_0 error_0 this_0 abi_0 crypto_0 tx_0 state_0 state_1) (= error_0 0))) (interface_0_C_16_0 this_0 abi_0 crypto_0 state_1)))) + + +(declare-fun |contract_initializer_10_C_16_0| (Int Int |abi_type| |crypto_type| |tx_type| |state_type| |state_type| ) Bool) +(declare-fun |contract_initializer_entry_11_C_16_0| (Int Int |abi_type| |crypto_type| |tx_type| |state_type| |state_type| ) Bool) +(assert +(forall ( (abi_0 |abi_type|) (crypto_0 |crypto_type|) (error_0 Int) (error_1 Int) (expr_10_0 Int) (expr_11_1 Bool) (expr_6_0 Int) (expr_9_0 Int) (funds_2_0 Int) (state_0 |state_type|) (state_1 |state_type|) (state_2 |state_type|) (state_3 |state_type|) (this_0 Int) (tx_0 |tx_type|) (x_5_0 Int) (x_5_1 Int) (x_5_2 Int)) +(=> (and (and (= state_1 state_0) (= error_0 0)) true) (contract_initializer_entry_11_C_16_0 error_0 this_0 abi_0 crypto_0 tx_0 state_0 state_1)))) + + +(declare-fun |contract_initializer_after_init_12_C_16_0| (Int Int |abi_type| |crypto_type| |tx_type| |state_type| |state_type| ) Bool) +(assert +(forall ( (abi_0 |abi_type|) (crypto_0 |crypto_type|) (error_0 Int) (error_1 Int) (expr_10_0 Int) (expr_11_1 Bool) (expr_6_0 Int) (expr_9_0 Int) (funds_2_0 Int) (state_0 |state_type|) (state_1 |state_type|) (state_2 |state_type|) (state_3 |state_type|) (this_0 Int) (tx_0 |tx_type|) (x_5_0 Int) (x_5_1 Int) (x_5_2 Int)) +(=> (and (and (contract_initializer_entry_11_C_16_0 error_0 this_0 abi_0 crypto_0 tx_0 state_0 state_1) true) true) (contract_initializer_after_init_12_C_16_0 error_0 this_0 abi_0 crypto_0 tx_0 state_0 state_1)))) + + +(assert +(forall ( (abi_0 |abi_type|) (crypto_0 |crypto_type|) (error_0 Int) (error_1 Int) (expr_10_0 Int) (expr_11_1 Bool) (expr_6_0 Int) (expr_9_0 Int) (funds_2_0 Int) (state_0 |state_type|) (state_1 |state_type|) (state_2 |state_type|) (state_3 |state_type|) (this_0 Int) (tx_0 |tx_type|) (x_5_0 Int) (x_5_1 Int) (x_5_2 Int)) +(=> (and (and (contract_initializer_after_init_12_C_16_0 error_0 this_0 abi_0 crypto_0 tx_0 state_0 state_1) true) true) (contract_initializer_10_C_16_0 error_0 this_0 abi_0 crypto_0 tx_0 state_0 state_1)))) + + +(declare-fun |implicit_constructor_entry_13_C_16_0| (Int Int |abi_type| |crypto_type| |tx_type| |state_type| |state_type| ) Bool) +(assert +(forall ( (abi_0 |abi_type|) (crypto_0 |crypto_type|) (error_0 Int) (error_1 Int) (expr_10_0 Int) (expr_11_1 Bool) (expr_6_0 Int) (expr_9_0 Int) (funds_2_0 Int) (state_0 |state_type|) (state_1 |state_type|) (state_2 |state_type|) (state_3 |state_type|) (this_0 Int) (tx_0 |tx_type|) (x_5_0 Int) (x_5_1 Int) (x_5_2 Int)) +(=> (and (and (and (and (and (= state_1 state_0) (= error_0 0)) true) true) true) (>= (select (|balances| state_1) this_0) (|msg.value| tx_0))) (implicit_constructor_entry_13_C_16_0 error_0 this_0 abi_0 crypto_0 tx_0 state_0 state_1)))) + + +(assert +(forall ( (abi_0 |abi_type|) (crypto_0 |crypto_type|) (error_0 Int) (error_1 Int) (expr_10_0 Int) (expr_11_1 Bool) (expr_6_0 Int) (expr_9_0 Int) (funds_2_0 Int) (state_0 |state_type|) (state_1 |state_type|) (state_2 |state_type|) (state_3 |state_type|) (this_0 Int) (tx_0 |tx_type|) (x_5_0 Int) (x_5_1 Int) (x_5_2 Int)) +(=> (and (and (implicit_constructor_entry_13_C_16_0 error_0 this_0 abi_0 crypto_0 tx_0 state_0 state_1) (and (contract_initializer_10_C_16_0 error_1 this_0 abi_0 crypto_0 tx_0 state_1 state_2) true)) (> error_1 0)) (summary_constructor_2_C_16_0 error_1 this_0 abi_0 crypto_0 tx_0 state_0 state_2)))) + + +(assert +(forall ( (abi_0 |abi_type|) (crypto_0 |crypto_type|) (error_0 Int) (error_1 Int) (expr_10_0 Int) (expr_11_1 Bool) (expr_6_0 Int) (expr_9_0 Int) (funds_2_0 Int) (state_0 |state_type|) (state_1 |state_type|) (state_2 |state_type|) (state_3 |state_type|) (this_0 Int) (tx_0 |tx_type|) (x_5_0 Int) (x_5_1 Int) (x_5_2 Int)) +(=> (and (and (implicit_constructor_entry_13_C_16_0 error_0 this_0 abi_0 crypto_0 tx_0 state_0 state_1) (and (= error_1 0) (and (contract_initializer_10_C_16_0 error_1 this_0 abi_0 crypto_0 tx_0 state_1 state_2) true))) true) (summary_constructor_2_C_16_0 error_1 this_0 abi_0 crypto_0 tx_0 state_0 state_2)))) + + +(assert +(forall ( (abi_0 |abi_type|) (crypto_0 |crypto_type|) (error_0 Int) (error_1 Int) (expr_10_0 Int) (expr_11_1 Bool) (expr_6_0 Int) (expr_9_0 Int) (funds_2_0 Int) (state_0 |state_type|) (state_1 |state_type|) (state_2 |state_type|) (state_3 |state_type|) (this_0 Int) (tx_0 |tx_type|) (x_5_0 Int) (x_5_1 Int) (x_5_2 Int)) +(=> (and (and (summary_constructor_2_C_16_0 error_0 this_0 abi_0 crypto_0 tx_0 state_0 state_1) true) (and (and (and (and (and (and (and (and (and (and (and (and (and (> (|block.prevrandao| tx_0) 18446744073709551616) (and (>= (|block.basefee| tx_0) 0) (<= (|block.basefee| tx_0) 115792089237316195423570985008687907853269984665640564039457584007913129639935))) (and (>= (|block.chainid| tx_0) 0) (<= (|block.chainid| tx_0) 115792089237316195423570985008687907853269984665640564039457584007913129639935))) (and (>= (|block.coinbase| tx_0) 0) (<= (|block.coinbase| tx_0) 1461501637330902918203684832716283019655932542975))) (and (>= (|block.prevrandao| tx_0) 0) (<= (|block.prevrandao| tx_0) 115792089237316195423570985008687907853269984665640564039457584007913129639935))) (and (>= (|block.gaslimit| tx_0) 0) (<= (|block.gaslimit| tx_0) 115792089237316195423570985008687907853269984665640564039457584007913129639935))) (and (>= (|block.number| tx_0) 0) (<= (|block.number| tx_0) 115792089237316195423570985008687907853269984665640564039457584007913129639935))) (and (>= (|block.timestamp| tx_0) 0) (<= (|block.timestamp| tx_0) 115792089237316195423570985008687907853269984665640564039457584007913129639935))) (and (>= (|msg.sender| tx_0) 0) (<= (|msg.sender| tx_0) 1461501637330902918203684832716283019655932542975))) (and (>= (|msg.value| tx_0) 0) (<= (|msg.value| tx_0) 115792089237316195423570985008687907853269984665640564039457584007913129639935))) (and (>= (|tx.origin| tx_0) 0) (<= (|tx.origin| tx_0) 1461501637330902918203684832716283019655932542975))) (and (>= (|tx.gasprice| tx_0) 0) (<= (|tx.gasprice| tx_0) 115792089237316195423570985008687907853269984665640564039457584007913129639935))) (= (|msg.value| tx_0) 0)) (= error_0 0))) (interface_0_C_16_0 this_0 abi_0 crypto_0 state_1)))) + + +(declare-fun |error_target_3_0| () Bool) +(assert +(forall ( (abi_0 |abi_type|) (crypto_0 |crypto_type|) (error_0 Int) (error_1 Int) (expr_10_0 Int) (expr_11_1 Bool) (expr_6_0 Int) (expr_9_0 Int) (funds_2_0 Int) (state_0 |state_type|) (state_1 |state_type|) (state_2 |state_type|) (state_3 |state_type|) (this_0 Int) (tx_0 |tx_type|) (x_5_0 Int) (x_5_1 Int) (x_5_2 Int)) +(=> (and (and (interface_0_C_16_0 this_0 abi_0 crypto_0 state_0) true) (and (summary_4_function_f__15_16_0 error_0 this_0 abi_0 crypto_0 tx_0 state_0 state_1) (= error_0 1))) error_target_3_0))) + + + +(assert +(forall ( (abi_0 |abi_type|) (crypto_0 |crypto_type|) (error_0 Int) (error_1 Int) (expr_10_0 Int) (expr_11_1 Bool) (expr_6_0 Int) (expr_9_0 Int) (funds_2_0 Int) (state_0 |state_type|) (state_1 |state_type|) (state_2 |state_type|) (state_3 |state_type|) (this_0 Int) (tx_0 |tx_type|) (x_5_0 Int) (x_5_1 Int) (x_5_2 Int)) +(=> error_target_3_0 false))) +(check-sat) + + +", + "message": "CHC: Requested query: +(set-option :timeout 1000) +(set-logic HORN) +(declare-datatypes ((|bytes_tuple| 0)) (((|bytes_tuple| (|bytes_tuple_accessor_array| (Array Int Int)) (|bytes_tuple_accessor_length| Int))))) +(declare-datatypes ((|tx_type| 0)) (((|tx_type| (|block.basefee| Int) (|block.chainid| Int) (|block.coinbase| Int) (|block.gaslimit| Int) (|block.number| Int) (|block.prevrandao| Int) (|block.timestamp| Int) (|blockhash| (Array Int Int)) (|msg.data| |bytes_tuple|) (|msg.sender| Int) (|msg.sig| Int) (|msg.value| Int) (|tx.gasprice| Int) (|tx.origin| Int))))) +(declare-datatypes ((|ecrecover_input_type| 0)) (((|ecrecover_input_type| (|hash| Int) (|v| Int) (|r| Int) (|s| Int))))) +(declare-datatypes ((|crypto_type| 0)) (((|crypto_type| (|ecrecover| (Array |ecrecover_input_type| Int)) (|keccak256| (Array |bytes_tuple| Int)) (|ripemd160| (Array |bytes_tuple| Int)) (|sha256| (Array |bytes_tuple| Int)))))) +(declare-datatypes ((|abi_type| 0)) (((|abi_type|)))) +(declare-datatypes ((|state_type| 0)) (((|state_type| (|balances| (Array Int Int)))))) +(declare-fun |interface_0_C_16_0| (Int |abi_type| |crypto_type| |state_type| ) Bool) +(declare-fun |nondet_interface_1_C_16_0| (Int Int |abi_type| |crypto_type| |state_type| |state_type| ) Bool) +(declare-fun |summary_constructor_2_C_16_0| (Int Int |abi_type| |crypto_type| |tx_type| |state_type| |state_type| ) Bool) +(assert +(forall ( (abi_0 |abi_type|) (crypto_0 |crypto_type|) (error_0 Int) (state_0 |state_type|) (this_0 Int) (tx_0 |tx_type|)) +(=> (= error_0 0) (nondet_interface_1_C_16_0 error_0 this_0 abi_0 crypto_0 state_0 state_0)))) + + +(declare-fun |summary_3_function_f__15_16_0| (Int Int |abi_type| |crypto_type| |tx_type| |state_type| |state_type| ) Bool) +(declare-fun |summary_4_function_f__15_16_0| (Int Int |abi_type| |crypto_type| |tx_type| |state_type| |state_type| ) Bool) +(assert +(forall ( (abi_0 |abi_type|) (crypto_0 |crypto_type|) (error_0 Int) (error_1 Int) (state_0 |state_type|) (state_1 |state_type|) (state_2 |state_type|) (this_0 Int) (tx_0 |tx_type|)) +(=> (and (and (nondet_interface_1_C_16_0 error_0 this_0 abi_0 crypto_0 state_0 state_1) true) (and (= error_0 0) (summary_4_function_f__15_16_0 error_1 this_0 abi_0 crypto_0 tx_0 state_1 state_2))) (nondet_interface_1_C_16_0 error_1 this_0 abi_0 crypto_0 state_0 state_2)))) + + +(declare-fun |block_5_function_f__15_16_0| (Int Int |abi_type| |crypto_type| |tx_type| |state_type| |state_type| Int ) Bool) +(declare-fun |block_6_f_14_16_0| (Int Int |abi_type| |crypto_type| |tx_type| |state_type| |state_type| Int ) Bool) +(assert +(forall ( (abi_0 |abi_type|) (crypto_0 |crypto_type|) (error_0 Int) (error_1 Int) (state_0 |state_type|) (state_1 |state_type|) (state_2 |state_type|) (this_0 Int) (tx_0 |tx_type|) (x_5_0 Int) (x_5_1 Int)) +(block_5_function_f__15_16_0 error_0 this_0 abi_0 crypto_0 tx_0 state_0 state_1 x_5_1))) + + +(assert +(forall ( (abi_0 |abi_type|) (crypto_0 |crypto_type|) (error_0 Int) (error_1 Int) (state_0 |state_type|) (state_1 |state_type|) (state_2 |state_type|) (this_0 Int) (tx_0 |tx_type|) (x_5_0 Int) (x_5_1 Int)) +(=> (and (and (block_5_function_f__15_16_0 error_0 this_0 abi_0 crypto_0 tx_0 state_0 state_1 x_5_1) (and (and (and (and (= state_1 state_0) (= error_0 0)) true) true) true)) true) (block_6_f_14_16_0 error_0 this_0 abi_0 crypto_0 tx_0 state_0 state_1 x_5_1)))) + + +(declare-fun |block_7_return_function_f__15_16_0| (Int Int |abi_type| |crypto_type| |tx_type| |state_type| |state_type| Int ) Bool) +(declare-fun |block_8_function_f__15_16_0| (Int Int |abi_type| |crypto_type| |tx_type| |state_type| |state_type| Int ) Bool) +(assert +(forall ( (abi_0 |abi_type|) (crypto_0 |crypto_type|) (error_0 Int) (error_1 Int) (expr_10_0 Int) (expr_11_1 Bool) (expr_6_0 Int) (expr_9_0 Int) (state_0 |state_type|) (state_1 |state_type|) (state_2 |state_type|) (this_0 Int) (tx_0 |tx_type|) (x_5_0 Int) (x_5_1 Int) (x_5_2 Int)) +(=> (and (and (block_6_f_14_16_0 error_0 this_0 abi_0 crypto_0 tx_0 state_0 state_1 x_5_1) (and (= expr_11_1 (= expr_9_0 expr_10_0)) (and (=> true true) (and (= expr_10_0 0) (and (=> true (and (>= expr_9_0 0) (<= expr_9_0 115792089237316195423570985008687907853269984665640564039457584007913129639935))) (and (= expr_9_0 x_5_2) (and (= x_5_2 expr_6_0) (and (=> true true) (and (= expr_6_0 0) (and (= x_5_1 0) true)))))))))) (and (and true (not expr_11_1)) (= error_1 1))) (block_8_function_f__15_16_0 error_1 this_0 abi_0 crypto_0 tx_0 state_0 state_1 x_5_2)))) + + +(assert +(forall ( (abi_0 |abi_type|) (crypto_0 |crypto_type|) (error_0 Int) (error_1 Int) (expr_10_0 Int) (expr_11_1 Bool) (expr_6_0 Int) (expr_9_0 Int) (state_0 |state_type|) (state_1 |state_type|) (state_2 |state_type|) (this_0 Int) (tx_0 |tx_type|) (x_5_0 Int) (x_5_1 Int) (x_5_2 Int)) +(=> (block_8_function_f__15_16_0 error_1 this_0 abi_0 crypto_0 tx_0 state_0 state_1 x_5_2) (summary_3_function_f__15_16_0 error_1 this_0 abi_0 crypto_0 tx_0 state_0 state_1)))) + + +(assert +(forall ( (abi_0 |abi_type|) (crypto_0 |crypto_type|) (error_0 Int) (error_1 Int) (expr_10_0 Int) (expr_11_1 Bool) (expr_6_0 Int) (expr_9_0 Int) (state_0 |state_type|) (state_1 |state_type|) (state_2 |state_type|) (this_0 Int) (tx_0 |tx_type|) (x_5_0 Int) (x_5_1 Int) (x_5_2 Int)) +(=> (and (and (block_6_f_14_16_0 error_0 this_0 abi_0 crypto_0 tx_0 state_0 state_1 x_5_1) (and (= error_1 error_0) (and (= expr_11_1 (= expr_9_0 expr_10_0)) (and (=> true true) (and (= expr_10_0 0) (and (=> true (and (>= expr_9_0 0) (<= expr_9_0 115792089237316195423570985008687907853269984665640564039457584007913129639935))) (and (= expr_9_0 x_5_2) (and (= x_5_2 expr_6_0) (and (=> true true) (and (= expr_6_0 0) (and (= x_5_1 0) true))))))))))) true) (block_7_return_function_f__15_16_0 error_1 this_0 abi_0 crypto_0 tx_0 state_0 state_1 x_5_2)))) + + +(assert +(forall ( (abi_0 |abi_type|) (crypto_0 |crypto_type|) (error_0 Int) (error_1 Int) (expr_10_0 Int) (expr_11_1 Bool) (expr_6_0 Int) (expr_9_0 Int) (state_0 |state_type|) (state_1 |state_type|) (state_2 |state_type|) (this_0 Int) (tx_0 |tx_type|) (x_5_0 Int) (x_5_1 Int) (x_5_2 Int)) +(=> (and (and (block_7_return_function_f__15_16_0 error_0 this_0 abi_0 crypto_0 tx_0 state_0 state_1 x_5_1) true) true) (summary_3_function_f__15_16_0 error_0 this_0 abi_0 crypto_0 tx_0 state_0 state_1)))) + + +(declare-fun |block_9_function_f__15_16_0| (Int Int |abi_type| |crypto_type| |tx_type| |state_type| |state_type| Int ) Bool) +(assert +(forall ( (abi_0 |abi_type|) (crypto_0 |crypto_type|) (error_0 Int) (error_1 Int) (expr_10_0 Int) (expr_11_1 Bool) (expr_6_0 Int) (expr_9_0 Int) (state_0 |state_type|) (state_1 |state_type|) (state_2 |state_type|) (this_0 Int) (tx_0 |tx_type|) (x_5_0 Int) (x_5_1 Int) (x_5_2 Int)) +(block_9_function_f__15_16_0 error_0 this_0 abi_0 crypto_0 tx_0 state_0 state_1 x_5_1))) + + +(assert +(forall ( (abi_0 |abi_type|) (crypto_0 |crypto_type|) (error_0 Int) (error_1 Int) (expr_10_0 Int) (expr_11_1 Bool) (expr_6_0 Int) (expr_9_0 Int) (funds_2_0 Int) (state_0 |state_type|) (state_1 |state_type|) (state_2 |state_type|) (state_3 |state_type|) (this_0 Int) (tx_0 |tx_type|) (x_5_0 Int) (x_5_1 Int) (x_5_2 Int)) +(=> (and (and (block_9_function_f__15_16_0 error_0 this_0 abi_0 crypto_0 tx_0 state_0 state_1 x_5_1) (and (summary_3_function_f__15_16_0 error_1 this_0 abi_0 crypto_0 tx_0 state_2 state_3) (and (= state_2 (|state_type| (store (|balances| state_1) this_0 (+ (select (|balances| state_1) this_0) funds_2_0)))) (and (and (>= (+ (select (|balances| state_1) this_0) funds_2_0) 0) (<= (+ (select (|balances| state_1) this_0) funds_2_0) 115792089237316195423570985008687907853269984665640564039457584007913129639935)) (and (>= funds_2_0 (|msg.value| tx_0)) (and (and (and (and (and (and (and (and (and (and (and (and (and (> (|block.prevrandao| tx_0) 18446744073709551616) (and (>= (|block.basefee| tx_0) 0) (<= (|block.basefee| tx_0) 115792089237316195423570985008687907853269984665640564039457584007913129639935))) (and (>= (|block.chainid| tx_0) 0) (<= (|block.chainid| tx_0) 115792089237316195423570985008687907853269984665640564039457584007913129639935))) (and (>= (|block.coinbase| tx_0) 0) (<= (|block.coinbase| tx_0) 1461501637330902918203684832716283019655932542975))) (and (>= (|block.prevrandao| tx_0) 0) (<= (|block.prevrandao| tx_0) 115792089237316195423570985008687907853269984665640564039457584007913129639935))) (and (>= (|block.gaslimit| tx_0) 0) (<= (|block.gaslimit| tx_0) 115792089237316195423570985008687907853269984665640564039457584007913129639935))) (and (>= (|block.number| tx_0) 0) (<= (|block.number| tx_0) 115792089237316195423570985008687907853269984665640564039457584007913129639935))) (and (>= (|block.timestamp| tx_0) 0) (<= (|block.timestamp| tx_0) 115792089237316195423570985008687907853269984665640564039457584007913129639935))) (and (>= (|msg.sender| tx_0) 0) (<= (|msg.sender| tx_0) 1461501637330902918203684832716283019655932542975))) (and (>= (|msg.value| tx_0) 0) (<= (|msg.value| tx_0) 115792089237316195423570985008687907853269984665640564039457584007913129639935))) (and (>= (|tx.origin| tx_0) 0) (<= (|tx.origin| tx_0) 1461501637330902918203684832716283019655932542975))) (and (>= (|tx.gasprice| tx_0) 0) (<= (|tx.gasprice| tx_0) 115792089237316195423570985008687907853269984665640564039457584007913129639935))) (and (and (and (and (and (and (= (|msg.value| tx_0) 0) (= (|msg.sig| tx_0) 638722032)) (= (select (|bytes_tuple_accessor_array| (|msg.data| tx_0)) 0) 38)) (= (select (|bytes_tuple_accessor_array| (|msg.data| tx_0)) 1) 18)) (= (select (|bytes_tuple_accessor_array| (|msg.data| tx_0)) 2) 31)) (= (select (|bytes_tuple_accessor_array| (|msg.data| tx_0)) 3) 240)) (>= (|bytes_tuple_accessor_length| (|msg.data| tx_0)) 4))) (and (and (and (and (= state_1 state_0) (= error_0 0)) true) true) true))))))) true) (summary_4_function_f__15_16_0 error_1 this_0 abi_0 crypto_0 tx_0 state_0 state_3)))) + + +(assert +(forall ( (abi_0 |abi_type|) (crypto_0 |crypto_type|) (error_0 Int) (error_1 Int) (expr_10_0 Int) (expr_11_1 Bool) (expr_6_0 Int) (expr_9_0 Int) (funds_2_0 Int) (state_0 |state_type|) (state_1 |state_type|) (state_2 |state_type|) (state_3 |state_type|) (this_0 Int) (tx_0 |tx_type|) (x_5_0 Int) (x_5_1 Int) (x_5_2 Int)) +(=> (and (and (interface_0_C_16_0 this_0 abi_0 crypto_0 state_0) true) (and (summary_4_function_f__15_16_0 error_0 this_0 abi_0 crypto_0 tx_0 state_0 state_1) (= error_0 0))) (interface_0_C_16_0 this_0 abi_0 crypto_0 state_1)))) + + +(declare-fun |contract_initializer_10_C_16_0| (Int Int |abi_type| |crypto_type| |tx_type| |state_type| |state_type| ) Bool) +(declare-fun |contract_initializer_entry_11_C_16_0| (Int Int |abi_type| |crypto_type| |tx_type| |state_type| |state_type| ) Bool) +(assert +(forall ( (abi_0 |abi_type|) (crypto_0 |crypto_type|) (error_0 Int) (error_1 Int) (expr_10_0 Int) (expr_11_1 Bool) (expr_6_0 Int) (expr_9_0 Int) (funds_2_0 Int) (state_0 |state_type|) (state_1 |state_type|) (state_2 |state_type|) (state_3 |state_type|) (this_0 Int) (tx_0 |tx_type|) (x_5_0 Int) (x_5_1 Int) (x_5_2 Int)) +(=> (and (and (= state_1 state_0) (= error_0 0)) true) (contract_initializer_entry_11_C_16_0 error_0 this_0 abi_0 crypto_0 tx_0 state_0 state_1)))) + + +(declare-fun |contract_initializer_after_init_12_C_16_0| (Int Int |abi_type| |crypto_type| |tx_type| |state_type| |state_type| ) Bool) +(assert +(forall ( (abi_0 |abi_type|) (crypto_0 |crypto_type|) (error_0 Int) (error_1 Int) (expr_10_0 Int) (expr_11_1 Bool) (expr_6_0 Int) (expr_9_0 Int) (funds_2_0 Int) (state_0 |state_type|) (state_1 |state_type|) (state_2 |state_type|) (state_3 |state_type|) (this_0 Int) (tx_0 |tx_type|) (x_5_0 Int) (x_5_1 Int) (x_5_2 Int)) +(=> (and (and (contract_initializer_entry_11_C_16_0 error_0 this_0 abi_0 crypto_0 tx_0 state_0 state_1) true) true) (contract_initializer_after_init_12_C_16_0 error_0 this_0 abi_0 crypto_0 tx_0 state_0 state_1)))) + + +(assert +(forall ( (abi_0 |abi_type|) (crypto_0 |crypto_type|) (error_0 Int) (error_1 Int) (expr_10_0 Int) (expr_11_1 Bool) (expr_6_0 Int) (expr_9_0 Int) (funds_2_0 Int) (state_0 |state_type|) (state_1 |state_type|) (state_2 |state_type|) (state_3 |state_type|) (this_0 Int) (tx_0 |tx_type|) (x_5_0 Int) (x_5_1 Int) (x_5_2 Int)) +(=> (and (and (contract_initializer_after_init_12_C_16_0 error_0 this_0 abi_0 crypto_0 tx_0 state_0 state_1) true) true) (contract_initializer_10_C_16_0 error_0 this_0 abi_0 crypto_0 tx_0 state_0 state_1)))) + + +(declare-fun |implicit_constructor_entry_13_C_16_0| (Int Int |abi_type| |crypto_type| |tx_type| |state_type| |state_type| ) Bool) +(assert +(forall ( (abi_0 |abi_type|) (crypto_0 |crypto_type|) (error_0 Int) (error_1 Int) (expr_10_0 Int) (expr_11_1 Bool) (expr_6_0 Int) (expr_9_0 Int) (funds_2_0 Int) (state_0 |state_type|) (state_1 |state_type|) (state_2 |state_type|) (state_3 |state_type|) (this_0 Int) (tx_0 |tx_type|) (x_5_0 Int) (x_5_1 Int) (x_5_2 Int)) +(=> (and (and (and (and (and (= state_1 state_0) (= error_0 0)) true) true) true) (>= (select (|balances| state_1) this_0) (|msg.value| tx_0))) (implicit_constructor_entry_13_C_16_0 error_0 this_0 abi_0 crypto_0 tx_0 state_0 state_1)))) + + +(assert +(forall ( (abi_0 |abi_type|) (crypto_0 |crypto_type|) (error_0 Int) (error_1 Int) (expr_10_0 Int) (expr_11_1 Bool) (expr_6_0 Int) (expr_9_0 Int) (funds_2_0 Int) (state_0 |state_type|) (state_1 |state_type|) (state_2 |state_type|) (state_3 |state_type|) (this_0 Int) (tx_0 |tx_type|) (x_5_0 Int) (x_5_1 Int) (x_5_2 Int)) +(=> (and (and (implicit_constructor_entry_13_C_16_0 error_0 this_0 abi_0 crypto_0 tx_0 state_0 state_1) (and (contract_initializer_10_C_16_0 error_1 this_0 abi_0 crypto_0 tx_0 state_1 state_2) true)) (> error_1 0)) (summary_constructor_2_C_16_0 error_1 this_0 abi_0 crypto_0 tx_0 state_0 state_2)))) + + +(assert +(forall ( (abi_0 |abi_type|) (crypto_0 |crypto_type|) (error_0 Int) (error_1 Int) (expr_10_0 Int) (expr_11_1 Bool) (expr_6_0 Int) (expr_9_0 Int) (funds_2_0 Int) (state_0 |state_type|) (state_1 |state_type|) (state_2 |state_type|) (state_3 |state_type|) (this_0 Int) (tx_0 |tx_type|) (x_5_0 Int) (x_5_1 Int) (x_5_2 Int)) +(=> (and (and (implicit_constructor_entry_13_C_16_0 error_0 this_0 abi_0 crypto_0 tx_0 state_0 state_1) (and (= error_1 0) (and (contract_initializer_10_C_16_0 error_1 this_0 abi_0 crypto_0 tx_0 state_1 state_2) true))) true) (summary_constructor_2_C_16_0 error_1 this_0 abi_0 crypto_0 tx_0 state_0 state_2)))) + + +(assert +(forall ( (abi_0 |abi_type|) (crypto_0 |crypto_type|) (error_0 Int) (error_1 Int) (expr_10_0 Int) (expr_11_1 Bool) (expr_6_0 Int) (expr_9_0 Int) (funds_2_0 Int) (state_0 |state_type|) (state_1 |state_type|) (state_2 |state_type|) (state_3 |state_type|) (this_0 Int) (tx_0 |tx_type|) (x_5_0 Int) (x_5_1 Int) (x_5_2 Int)) +(=> (and (and (summary_constructor_2_C_16_0 error_0 this_0 abi_0 crypto_0 tx_0 state_0 state_1) true) (and (and (and (and (and (and (and (and (and (and (and (and (and (> (|block.prevrandao| tx_0) 18446744073709551616) (and (>= (|block.basefee| tx_0) 0) (<= (|block.basefee| tx_0) 115792089237316195423570985008687907853269984665640564039457584007913129639935))) (and (>= (|block.chainid| tx_0) 0) (<= (|block.chainid| tx_0) 115792089237316195423570985008687907853269984665640564039457584007913129639935))) (and (>= (|block.coinbase| tx_0) 0) (<= (|block.coinbase| tx_0) 1461501637330902918203684832716283019655932542975))) (and (>= (|block.prevrandao| tx_0) 0) (<= (|block.prevrandao| tx_0) 115792089237316195423570985008687907853269984665640564039457584007913129639935))) (and (>= (|block.gaslimit| tx_0) 0) (<= (|block.gaslimit| tx_0) 115792089237316195423570985008687907853269984665640564039457584007913129639935))) (and (>= (|block.number| tx_0) 0) (<= (|block.number| tx_0) 115792089237316195423570985008687907853269984665640564039457584007913129639935))) (and (>= (|block.timestamp| tx_0) 0) (<= (|block.timestamp| tx_0) 115792089237316195423570985008687907853269984665640564039457584007913129639935))) (and (>= (|msg.sender| tx_0) 0) (<= (|msg.sender| tx_0) 1461501637330902918203684832716283019655932542975))) (and (>= (|msg.value| tx_0) 0) (<= (|msg.value| tx_0) 115792089237316195423570985008687907853269984665640564039457584007913129639935))) (and (>= (|tx.origin| tx_0) 0) (<= (|tx.origin| tx_0) 1461501637330902918203684832716283019655932542975))) (and (>= (|tx.gasprice| tx_0) 0) (<= (|tx.gasprice| tx_0) 115792089237316195423570985008687907853269984665640564039457584007913129639935))) (= (|msg.value| tx_0) 0)) (= error_0 0))) (interface_0_C_16_0 this_0 abi_0 crypto_0 state_1)))) + + +(declare-fun |error_target_3_0| () Bool) +(assert +(forall ( (abi_0 |abi_type|) (crypto_0 |crypto_type|) (error_0 Int) (error_1 Int) (expr_10_0 Int) (expr_11_1 Bool) (expr_6_0 Int) (expr_9_0 Int) (funds_2_0 Int) (state_0 |state_type|) (state_1 |state_type|) (state_2 |state_type|) (state_3 |state_type|) (this_0 Int) (tx_0 |tx_type|) (x_5_0 Int) (x_5_1 Int) (x_5_2 Int)) +(=> (and (and (interface_0_C_16_0 this_0 abi_0 crypto_0 state_0) true) (and (summary_4_function_f__15_16_0 error_0 this_0 abi_0 crypto_0 tx_0 state_0 state_1) (= error_0 1))) error_target_3_0))) + + + +(assert +(forall ( (abi_0 |abi_type|) (crypto_0 |crypto_type|) (error_0 Int) (error_1 Int) (expr_10_0 Int) (expr_11_1 Bool) (expr_6_0 Int) (expr_9_0 Int) (funds_2_0 Int) (state_0 |state_type|) (state_1 |state_type|) (state_2 |state_type|) (state_3 |state_type|) (this_0 Int) (tx_0 |tx_type|) (x_5_0 Int) (x_5_1 Int) (x_5_2 Int)) +(=> error_target_3_0 false))) +(check-sat) +", + "severity": "info", + "type": "Info" + }, + { + "component": "general", + "errorCode": "5840", + "formattedMessage": "Warning: CHC: 1 verification condition(s) could not be proved. Enable the model checker option \"show unproved\" to see all of them. Consider choosing a specific contract to be verified in order to reduce the solving problems. Consider increasing the timeout per query. + +", + "message": "CHC: 1 verification condition(s) could not be proved. Enable the model checker option \"show unproved\" to see all of them. Consider choosing a specific contract to be verified in order to reduce the solving problems. Consider increasing the timeout per query.", + "severity": "warning", + "type": "Warning" + }, + { + "component": "general", + "errorCode": "3996", + "formattedMessage": "Warning: CHC analysis was not possible. No Horn solver was available. None of the installed solvers was enabled. + +", + "message": "CHC analysis was not possible. No Horn solver was available. None of the installed solvers was enabled.", + "severity": "warning", + "type": "Warning" + } + ], + "sources": + { + "A": + { + "id": 0 + } + } +} diff --git a/test/cmdlineTests/standard_model_checker_print_query_invalid_arg/input.json b/test/cmdlineTests/standard_model_checker_print_query_invalid_arg/input.json new file mode 100644 index 000000000000..97822c2bde6f --- /dev/null +++ b/test/cmdlineTests/standard_model_checker_print_query_invalid_arg/input.json @@ -0,0 +1,25 @@ +{ + "language": "Solidity", + "sources": + { + "A": + { + "content": "// SPDX-License-Identifier: GPL-3.0\npragma solidity >=0.0;\n + contract C + { + function f() public pure { + uint x = 0; + assert(x == 0); + } + }" + } + }, + "settings": + { + "modelChecker": + { + "engine": "all", + "printQuery": 17 + } + } +} diff --git a/test/cmdlineTests/standard_model_checker_print_query_invalid_arg/output.json b/test/cmdlineTests/standard_model_checker_print_query_invalid_arg/output.json new file mode 100644 index 000000000000..00c389f7a433 --- /dev/null +++ b/test/cmdlineTests/standard_model_checker_print_query_invalid_arg/output.json @@ -0,0 +1,12 @@ +{ + "errors": + [ + { + "component": "general", + "formattedMessage": "settings.modelChecker.printQuery must be a Boolean value.", + "message": "settings.modelChecker.printQuery must be a Boolean value.", + "severity": "error", + "type": "JSONError" + } + ] +} diff --git a/test/cmdlineTests/standard_model_checker_print_query_no_smtlib2_solver/input.json b/test/cmdlineTests/standard_model_checker_print_query_no_smtlib2_solver/input.json new file mode 100644 index 000000000000..0159c256e6ed --- /dev/null +++ b/test/cmdlineTests/standard_model_checker_print_query_no_smtlib2_solver/input.json @@ -0,0 +1,25 @@ +{ + "language": "Solidity", + "sources": + { + "A": + { + "content": "// SPDX-License-Identifier: GPL-3.0\npragma solidity >=0.0;\n + contract C + { + function f() public pure { + uint x = 0; + assert(x == 0); + } + }" + } + }, + "settings": + { + "modelChecker": + { + "engine": "all", + "printQuery": true + } + } +} diff --git a/test/cmdlineTests/standard_model_checker_print_query_no_smtlib2_solver/output.json b/test/cmdlineTests/standard_model_checker_print_query_no_smtlib2_solver/output.json new file mode 100644 index 000000000000..42d4b5b2db8a --- /dev/null +++ b/test/cmdlineTests/standard_model_checker_print_query_no_smtlib2_solver/output.json @@ -0,0 +1,12 @@ +{ + "errors": + [ + { + "component": "general", + "formattedMessage": "Only SMTLib2 solver can be enabled to print queries", + "message": "Only SMTLib2 solver can be enabled to print queries", + "severity": "error", + "type": "JSONError" + } + ] +} diff --git a/test/cmdlineTests/standard_model_checker_print_query_superflous_solver/input.json b/test/cmdlineTests/standard_model_checker_print_query_superflous_solver/input.json new file mode 100644 index 000000000000..9ebda00174b4 --- /dev/null +++ b/test/cmdlineTests/standard_model_checker_print_query_superflous_solver/input.json @@ -0,0 +1,26 @@ +{ + "language": "Solidity", + "sources": + { + "A": + { + "content": "// SPDX-License-Identifier: GPL-3.0\npragma solidity >=0.0;\n + contract C + { + function f() public pure { + uint x = 0; + assert(x == 0); + } + }" + } + }, + "settings": + { + "modelChecker": + { + "engine": "all", + "printQuery": true, + "solvers": ["smtlib2", "z3"] + } + } +} diff --git a/test/cmdlineTests/standard_model_checker_print_query_superflous_solver/output.json b/test/cmdlineTests/standard_model_checker_print_query_superflous_solver/output.json new file mode 100644 index 000000000000..42d4b5b2db8a --- /dev/null +++ b/test/cmdlineTests/standard_model_checker_print_query_superflous_solver/output.json @@ -0,0 +1,12 @@ +{ + "errors": + [ + { + "component": "general", + "formattedMessage": "Only SMTLib2 solver can be enabled to print queries", + "message": "Only SMTLib2 solver can be enabled to print queries", + "severity": "error", + "type": "JSONError" + } + ] +} diff --git a/test/cmdlineTests/standard_model_checker_solvers_smtlib2/output.json b/test/cmdlineTests/standard_model_checker_solvers_smtlib2/output.json index bf59a0d9daa1..ebeca53f5ba3 100644 --- a/test/cmdlineTests/standard_model_checker_solvers_smtlib2/output.json +++ b/test/cmdlineTests/standard_model_checker_solvers_smtlib2/output.json @@ -30,8 +30,7 @@ (check-sat) (get-value (|EVALEXPR_0| )) ", - "0xa991e3c158410479bc0a0540fb60ce7010aec315a5b0010d254f12f3d1f0a4e5": "(set-logic HORN) - + "0xe3dc20257e2b1bd9c6eb77b75913ec3a5752be174e0fd56af16d9fc95afa1b15": "(set-logic HORN) (declare-datatypes ((|bytes_tuple| 0)) (((|bytes_tuple| (|bytes_tuple_accessor_array| (Array Int Int)) (|bytes_tuple_accessor_length| Int))))) (declare-datatypes ((|tx_type| 0)) (((|tx_type| (|block.basefee| Int) (|block.chainid| Int) (|block.coinbase| Int) (|block.gaslimit| Int) (|block.number| Int) (|block.prevrandao| Int) (|block.timestamp| Int) (|blockhash| (Array Int Int)) (|msg.data| |bytes_tuple|) (|msg.sender| Int) (|msg.sig| Int) (|msg.value| Int) (|tx.gasprice| Int) (|tx.origin| Int))))) (declare-datatypes ((|ecrecover_input_type| 0)) (((|ecrecover_input_type| (|hash| Int) (|v| Int) (|r| Int) (|s| Int))))) @@ -148,10 +147,12 @@ (=> (and (and (interface_0_C_14_0 this_0 abi_0 crypto_0 state_0) true) (and (summary_4_function_f__13_14_0 error_0 this_0 abi_0 crypto_0 tx_0 state_0 x_3_0 state_1 x_3_1) (= error_0 1))) error_target_3_0))) + (assert (forall ( (abi_0 |abi_type|) (crypto_0 |crypto_type|) (error_0 Int) (error_1 Int) (expr_7_0 Int) (expr_8_0 Int) (expr_9_1 Bool) (funds_2_0 Int) (state_0 |state_type|) (state_1 |state_type|) (state_2 |state_type|) (state_3 |state_type|) (this_0 Int) (tx_0 |tx_type|) (x_3_0 Int) (x_3_1 Int) (x_3_2 Int)) (=> error_target_3_0 false))) -(check-sat)" +(check-sat) +" } }, "errors": diff --git a/test/cmdlineTests/standard_optimizer_generatedSources/output.json b/test/cmdlineTests/standard_optimizer_generatedSources/output.json index 264241d03685..da2c31cbee25 100644 --- a/test/cmdlineTests/standard_optimizer_generatedSources/output.json +++ b/test/cmdlineTests/standard_optimizer_generatedSources/output.json @@ -19,11 +19,13 @@ { "ast": { + "nativeSrc": "0:1445:1", "nodeType": "YulBlock", "src": "0:1445:1", "statements": [ { + "nativeSrc": "6:3:1", "nodeType": "YulBlock", "src": "6:3:1", "statements": [] @@ -31,6 +33,7 @@ { "body": { + "nativeSrc": "46:95:1", "nodeType": "YulBlock", "src": "46:95:1", "statements": @@ -42,6 +45,7 @@ [ { "kind": "number", + "nativeSrc": "63:1:1", "nodeType": "YulLiteral", "src": "63:1:1", "type": "", @@ -52,6 +56,7 @@ [ { "kind": "number", + "nativeSrc": "70:3:1", "nodeType": "YulLiteral", "src": "70:3:1", "type": "", @@ -59,6 +64,7 @@ }, { "kind": "number", + "nativeSrc": "75:10:1", "nodeType": "YulLiteral", "src": "75:10:1", "type": "", @@ -68,9 +74,11 @@ "functionName": { "name": "shl", + "nativeSrc": "66:3:1", "nodeType": "YulIdentifier", "src": "66:3:1" }, + "nativeSrc": "66:20:1", "nodeType": "YulFunctionCall", "src": "66:20:1" } @@ -78,12 +86,15 @@ "functionName": { "name": "mstore", + "nativeSrc": "56:6:1", "nodeType": "YulIdentifier", "src": "56:6:1" }, + "nativeSrc": "56:31:1", "nodeType": "YulFunctionCall", "src": "56:31:1" }, + "nativeSrc": "56:31:1", "nodeType": "YulExpressionStatement", "src": "56:31:1" }, @@ -94,6 +105,7 @@ [ { "kind": "number", + "nativeSrc": "103:1:1", "nodeType": "YulLiteral", "src": "103:1:1", "type": "", @@ -101,6 +113,7 @@ }, { "kind": "number", + "nativeSrc": "106:4:1", "nodeType": "YulLiteral", "src": "106:4:1", "type": "", @@ -110,12 +123,15 @@ "functionName": { "name": "mstore", + "nativeSrc": "96:6:1", "nodeType": "YulIdentifier", "src": "96:6:1" }, + "nativeSrc": "96:15:1", "nodeType": "YulFunctionCall", "src": "96:15:1" }, + "nativeSrc": "96:15:1", "nodeType": "YulExpressionStatement", "src": "96:15:1" }, @@ -126,6 +142,7 @@ [ { "kind": "number", + "nativeSrc": "127:1:1", "nodeType": "YulLiteral", "src": "127:1:1", "type": "", @@ -133,6 +150,7 @@ }, { "kind": "number", + "nativeSrc": "130:4:1", "nodeType": "YulLiteral", "src": "130:4:1", "type": "", @@ -142,34 +160,41 @@ "functionName": { "name": "revert", + "nativeSrc": "120:6:1", "nodeType": "YulIdentifier", "src": "120:6:1" }, + "nativeSrc": "120:15:1", "nodeType": "YulFunctionCall", "src": "120:15:1" }, + "nativeSrc": "120:15:1", "nodeType": "YulExpressionStatement", "src": "120:15:1" } ] }, "name": "panic_error_0x41", + "nativeSrc": "14:127:1", "nodeType": "YulFunctionDefinition", "src": "14:127:1" }, { "body": { + "nativeSrc": "241:1020:1", "nodeType": "YulBlock", "src": "241:1020:1", "statements": [ { + "nativeSrc": "251:12:1", "nodeType": "YulVariableDeclaration", "src": "251:12:1", "value": { "kind": "number", + "nativeSrc": "261:2:1", "nodeType": "YulLiteral", "src": "261:2:1", "type": "", @@ -179,6 +204,7 @@ [ { "name": "_1", + "nativeSrc": "255:2:1", "nodeType": "YulTypedName", "src": "255:2:1", "type": "" @@ -188,6 +214,7 @@ { "body": { + "nativeSrc": "308:16:1", "nodeType": "YulBlock", "src": "308:16:1", "statements": @@ -199,6 +226,7 @@ [ { "kind": "number", + "nativeSrc": "317:1:1", "nodeType": "YulLiteral", "src": "317:1:1", "type": "", @@ -206,6 +234,7 @@ }, { "kind": "number", + "nativeSrc": "320:1:1", "nodeType": "YulLiteral", "src": "320:1:1", "type": "", @@ -215,12 +244,15 @@ "functionName": { "name": "revert", + "nativeSrc": "310:6:1", "nodeType": "YulIdentifier", "src": "310:6:1" }, + "nativeSrc": "310:12:1", "nodeType": "YulFunctionCall", "src": "310:12:1" }, + "nativeSrc": "310:12:1", "nodeType": "YulExpressionStatement", "src": "310:12:1" } @@ -235,11 +267,13 @@ [ { "name": "dataEnd", + "nativeSrc": "283:7:1", "nodeType": "YulIdentifier", "src": "283:7:1" }, { "name": "headStart", + "nativeSrc": "292:9:1", "nodeType": "YulIdentifier", "src": "292:9:1" } @@ -247,14 +281,17 @@ "functionName": { "name": "sub", + "nativeSrc": "279:3:1", "nodeType": "YulIdentifier", "src": "279:3:1" }, + "nativeSrc": "279:23:1", "nodeType": "YulFunctionCall", "src": "279:23:1" }, { "name": "_1", + "nativeSrc": "304:2:1", "nodeType": "YulIdentifier", "src": "304:2:1" } @@ -262,16 +299,20 @@ "functionName": { "name": "slt", + "nativeSrc": "275:3:1", "nodeType": "YulIdentifier", "src": "275:3:1" }, + "nativeSrc": "275:32:1", "nodeType": "YulFunctionCall", "src": "275:32:1" }, + "nativeSrc": "272:52:1", "nodeType": "YulIf", "src": "272:52:1" }, { + "nativeSrc": "333:37:1", "nodeType": "YulVariableDeclaration", "src": "333:37:1", "value": @@ -280,6 +321,7 @@ [ { "name": "headStart", + "nativeSrc": "360:9:1", "nodeType": "YulIdentifier", "src": "360:9:1" } @@ -287,9 +329,11 @@ "functionName": { "name": "calldataload", + "nativeSrc": "347:12:1", "nodeType": "YulIdentifier", "src": "347:12:1" }, + "nativeSrc": "347:23:1", "nodeType": "YulFunctionCall", "src": "347:23:1" }, @@ -297,6 +341,7 @@ [ { "name": "offset", + "nativeSrc": "337:6:1", "nodeType": "YulTypedName", "src": "337:6:1", "type": "" @@ -304,11 +349,13 @@ ] }, { + "nativeSrc": "379:28:1", "nodeType": "YulVariableDeclaration", "src": "379:28:1", "value": { "kind": "number", + "nativeSrc": "389:18:1", "nodeType": "YulLiteral", "src": "389:18:1", "type": "", @@ -318,6 +365,7 @@ [ { "name": "_2", + "nativeSrc": "383:2:1", "nodeType": "YulTypedName", "src": "383:2:1", "type": "" @@ -327,6 +375,7 @@ { "body": { + "nativeSrc": "434:16:1", "nodeType": "YulBlock", "src": "434:16:1", "statements": @@ -338,6 +387,7 @@ [ { "kind": "number", + "nativeSrc": "443:1:1", "nodeType": "YulLiteral", "src": "443:1:1", "type": "", @@ -345,6 +395,7 @@ }, { "kind": "number", + "nativeSrc": "446:1:1", "nodeType": "YulLiteral", "src": "446:1:1", "type": "", @@ -354,12 +405,15 @@ "functionName": { "name": "revert", + "nativeSrc": "436:6:1", "nodeType": "YulIdentifier", "src": "436:6:1" }, + "nativeSrc": "436:12:1", "nodeType": "YulFunctionCall", "src": "436:12:1" }, + "nativeSrc": "436:12:1", "nodeType": "YulExpressionStatement", "src": "436:12:1" } @@ -371,11 +425,13 @@ [ { "name": "offset", + "nativeSrc": "422:6:1", "nodeType": "YulIdentifier", "src": "422:6:1" }, { "name": "_2", + "nativeSrc": "430:2:1", "nodeType": "YulIdentifier", "src": "430:2:1" } @@ -383,16 +439,20 @@ "functionName": { "name": "gt", + "nativeSrc": "419:2:1", "nodeType": "YulIdentifier", "src": "419:2:1" }, + "nativeSrc": "419:14:1", "nodeType": "YulFunctionCall", "src": "419:14:1" }, + "nativeSrc": "416:34:1", "nodeType": "YulIf", "src": "416:34:1" }, { + "nativeSrc": "459:32:1", "nodeType": "YulVariableDeclaration", "src": "459:32:1", "value": @@ -401,11 +461,13 @@ [ { "name": "headStart", + "nativeSrc": "473:9:1", "nodeType": "YulIdentifier", "src": "473:9:1" }, { "name": "offset", + "nativeSrc": "484:6:1", "nodeType": "YulIdentifier", "src": "484:6:1" } @@ -413,9 +475,11 @@ "functionName": { "name": "add", + "nativeSrc": "469:3:1", "nodeType": "YulIdentifier", "src": "469:3:1" }, + "nativeSrc": "469:22:1", "nodeType": "YulFunctionCall", "src": "469:22:1" }, @@ -423,6 +487,7 @@ [ { "name": "_3", + "nativeSrc": "463:2:1", "nodeType": "YulTypedName", "src": "463:2:1", "type": "" @@ -432,6 +497,7 @@ { "body": { + "nativeSrc": "539:16:1", "nodeType": "YulBlock", "src": "539:16:1", "statements": @@ -443,6 +509,7 @@ [ { "kind": "number", + "nativeSrc": "548:1:1", "nodeType": "YulLiteral", "src": "548:1:1", "type": "", @@ -450,6 +517,7 @@ }, { "kind": "number", + "nativeSrc": "551:1:1", "nodeType": "YulLiteral", "src": "551:1:1", "type": "", @@ -459,12 +527,15 @@ "functionName": { "name": "revert", + "nativeSrc": "541:6:1", "nodeType": "YulIdentifier", "src": "541:6:1" }, + "nativeSrc": "541:12:1", "nodeType": "YulFunctionCall", "src": "541:12:1" }, + "nativeSrc": "541:12:1", "nodeType": "YulExpressionStatement", "src": "541:12:1" } @@ -482,11 +553,13 @@ [ { "name": "_3", + "nativeSrc": "518:2:1", "nodeType": "YulIdentifier", "src": "518:2:1" }, { "kind": "number", + "nativeSrc": "522:4:1", "nodeType": "YulLiteral", "src": "522:4:1", "type": "", @@ -496,14 +569,17 @@ "functionName": { "name": "add", + "nativeSrc": "514:3:1", "nodeType": "YulIdentifier", "src": "514:3:1" }, + "nativeSrc": "514:13:1", "nodeType": "YulFunctionCall", "src": "514:13:1" }, { "name": "dataEnd", + "nativeSrc": "529:7:1", "nodeType": "YulIdentifier", "src": "529:7:1" } @@ -511,9 +587,11 @@ "functionName": { "name": "slt", + "nativeSrc": "510:3:1", "nodeType": "YulIdentifier", "src": "510:3:1" }, + "nativeSrc": "510:27:1", "nodeType": "YulFunctionCall", "src": "510:27:1" } @@ -521,16 +599,20 @@ "functionName": { "name": "iszero", + "nativeSrc": "503:6:1", "nodeType": "YulIdentifier", "src": "503:6:1" }, + "nativeSrc": "503:35:1", "nodeType": "YulFunctionCall", "src": "503:35:1" }, + "nativeSrc": "500:55:1", "nodeType": "YulIf", "src": "500:55:1" }, { + "nativeSrc": "564:26:1", "nodeType": "YulVariableDeclaration", "src": "564:26:1", "value": @@ -539,6 +621,7 @@ [ { "name": "_3", + "nativeSrc": "587:2:1", "nodeType": "YulIdentifier", "src": "587:2:1" } @@ -546,9 +629,11 @@ "functionName": { "name": "calldataload", + "nativeSrc": "574:12:1", "nodeType": "YulIdentifier", "src": "574:12:1" }, + "nativeSrc": "574:16:1", "nodeType": "YulFunctionCall", "src": "574:16:1" }, @@ -556,6 +641,7 @@ [ { "name": "_4", + "nativeSrc": "568:2:1", "nodeType": "YulTypedName", "src": "568:2:1", "type": "" @@ -565,6 +651,7 @@ { "body": { + "nativeSrc": "613:22:1", "nodeType": "YulBlock", "src": "613:22:1", "statements": @@ -576,12 +663,15 @@ "functionName": { "name": "panic_error_0x41", + "nativeSrc": "615:16:1", "nodeType": "YulIdentifier", "src": "615:16:1" }, + "nativeSrc": "615:18:1", "nodeType": "YulFunctionCall", "src": "615:18:1" }, + "nativeSrc": "615:18:1", "nodeType": "YulExpressionStatement", "src": "615:18:1" } @@ -593,11 +683,13 @@ [ { "name": "_4", + "nativeSrc": "605:2:1", "nodeType": "YulIdentifier", "src": "605:2:1" }, { "name": "_2", + "nativeSrc": "609:2:1", "nodeType": "YulIdentifier", "src": "609:2:1" } @@ -605,16 +697,20 @@ "functionName": { "name": "gt", + "nativeSrc": "602:2:1", "nodeType": "YulIdentifier", "src": "602:2:1" }, + "nativeSrc": "602:10:1", "nodeType": "YulFunctionCall", "src": "602:10:1" }, + "nativeSrc": "599:36:1", "nodeType": "YulIf", "src": "599:36:1" }, { + "nativeSrc": "644:20:1", "nodeType": "YulVariableDeclaration", "src": "644:20:1", "value": @@ -623,6 +719,7 @@ [ { "kind": "number", + "nativeSrc": "658:1:1", "nodeType": "YulLiteral", "src": "658:1:1", "type": "", @@ -630,6 +727,7 @@ }, { "name": "_4", + "nativeSrc": "661:2:1", "nodeType": "YulIdentifier", "src": "661:2:1" } @@ -637,9 +735,11 @@ "functionName": { "name": "shl", + "nativeSrc": "654:3:1", "nodeType": "YulIdentifier", "src": "654:3:1" }, + "nativeSrc": "654:10:1", "nodeType": "YulFunctionCall", "src": "654:10:1" }, @@ -647,6 +747,7 @@ [ { "name": "_5", + "nativeSrc": "648:2:1", "nodeType": "YulTypedName", "src": "648:2:1", "type": "" @@ -654,6 +755,7 @@ ] }, { + "nativeSrc": "673:23:1", "nodeType": "YulVariableDeclaration", "src": "673:23:1", "value": @@ -662,6 +764,7 @@ [ { "kind": "number", + "nativeSrc": "693:2:1", "nodeType": "YulLiteral", "src": "693:2:1", "type": "", @@ -671,9 +774,11 @@ "functionName": { "name": "mload", + "nativeSrc": "687:5:1", "nodeType": "YulIdentifier", "src": "687:5:1" }, + "nativeSrc": "687:9:1", "nodeType": "YulFunctionCall", "src": "687:9:1" }, @@ -681,6 +786,7 @@ [ { "name": "memPtr", + "nativeSrc": "677:6:1", "nodeType": "YulTypedName", "src": "677:6:1", "type": "" @@ -688,6 +794,7 @@ ] }, { + "nativeSrc": "705:56:1", "nodeType": "YulVariableDeclaration", "src": "705:56:1", "value": @@ -696,6 +803,7 @@ [ { "name": "memPtr", + "nativeSrc": "727:6:1", "nodeType": "YulIdentifier", "src": "727:6:1" }, @@ -707,11 +815,13 @@ [ { "name": "_5", + "nativeSrc": "743:2:1", "nodeType": "YulIdentifier", "src": "743:2:1" }, { "kind": "number", + "nativeSrc": "747:2:1", "nodeType": "YulLiteral", "src": "747:2:1", "type": "", @@ -721,9 +831,11 @@ "functionName": { "name": "add", + "nativeSrc": "739:3:1", "nodeType": "YulIdentifier", "src": "739:3:1" }, + "nativeSrc": "739:11:1", "nodeType": "YulFunctionCall", "src": "739:11:1" }, @@ -732,6 +844,7 @@ [ { "kind": "number", + "nativeSrc": "756:2:1", "nodeType": "YulLiteral", "src": "756:2:1", "type": "", @@ -741,9 +854,11 @@ "functionName": { "name": "not", + "nativeSrc": "752:3:1", "nodeType": "YulIdentifier", "src": "752:3:1" }, + "nativeSrc": "752:7:1", "nodeType": "YulFunctionCall", "src": "752:7:1" } @@ -751,9 +866,11 @@ "functionName": { "name": "and", + "nativeSrc": "735:3:1", "nodeType": "YulIdentifier", "src": "735:3:1" }, + "nativeSrc": "735:25:1", "nodeType": "YulFunctionCall", "src": "735:25:1" } @@ -761,9 +878,11 @@ "functionName": { "name": "add", + "nativeSrc": "723:3:1", "nodeType": "YulIdentifier", "src": "723:3:1" }, + "nativeSrc": "723:38:1", "nodeType": "YulFunctionCall", "src": "723:38:1" }, @@ -771,6 +890,7 @@ [ { "name": "newFreePtr", + "nativeSrc": "709:10:1", "nodeType": "YulTypedName", "src": "709:10:1", "type": "" @@ -780,6 +900,7 @@ { "body": { + "nativeSrc": "820:22:1", "nodeType": "YulBlock", "src": "820:22:1", "statements": @@ -791,12 +912,15 @@ "functionName": { "name": "panic_error_0x41", + "nativeSrc": "822:16:1", "nodeType": "YulIdentifier", "src": "822:16:1" }, + "nativeSrc": "822:18:1", "nodeType": "YulFunctionCall", "src": "822:18:1" }, + "nativeSrc": "822:18:1", "nodeType": "YulExpressionStatement", "src": "822:18:1" } @@ -811,11 +935,13 @@ [ { "name": "newFreePtr", + "nativeSrc": "779:10:1", "nodeType": "YulIdentifier", "src": "779:10:1" }, { "name": "_2", + "nativeSrc": "791:2:1", "nodeType": "YulIdentifier", "src": "791:2:1" } @@ -823,9 +949,11 @@ "functionName": { "name": "gt", + "nativeSrc": "776:2:1", "nodeType": "YulIdentifier", "src": "776:2:1" }, + "nativeSrc": "776:18:1", "nodeType": "YulFunctionCall", "src": "776:18:1" }, @@ -834,11 +962,13 @@ [ { "name": "newFreePtr", + "nativeSrc": "799:10:1", "nodeType": "YulIdentifier", "src": "799:10:1" }, { "name": "memPtr", + "nativeSrc": "811:6:1", "nodeType": "YulIdentifier", "src": "811:6:1" } @@ -846,9 +976,11 @@ "functionName": { "name": "lt", + "nativeSrc": "796:2:1", "nodeType": "YulIdentifier", "src": "796:2:1" }, + "nativeSrc": "796:22:1", "nodeType": "YulFunctionCall", "src": "796:22:1" } @@ -856,12 +988,15 @@ "functionName": { "name": "or", + "nativeSrc": "773:2:1", "nodeType": "YulIdentifier", "src": "773:2:1" }, + "nativeSrc": "773:46:1", "nodeType": "YulFunctionCall", "src": "773:46:1" }, + "nativeSrc": "770:72:1", "nodeType": "YulIf", "src": "770:72:1" }, @@ -872,6 +1007,7 @@ [ { "kind": "number", + "nativeSrc": "858:2:1", "nodeType": "YulLiteral", "src": "858:2:1", "type": "", @@ -879,6 +1015,7 @@ }, { "name": "newFreePtr", + "nativeSrc": "862:10:1", "nodeType": "YulIdentifier", "src": "862:10:1" } @@ -886,21 +1023,26 @@ "functionName": { "name": "mstore", + "nativeSrc": "851:6:1", "nodeType": "YulIdentifier", "src": "851:6:1" }, + "nativeSrc": "851:22:1", "nodeType": "YulFunctionCall", "src": "851:22:1" }, + "nativeSrc": "851:22:1", "nodeType": "YulExpressionStatement", "src": "851:22:1" }, { + "nativeSrc": "882:17:1", "nodeType": "YulVariableDeclaration", "src": "882:17:1", "value": { "name": "memPtr", + "nativeSrc": "893:6:1", "nodeType": "YulIdentifier", "src": "893:6:1" }, @@ -908,6 +1050,7 @@ [ { "name": "dst", + "nativeSrc": "886:3:1", "nodeType": "YulTypedName", "src": "886:3:1", "type": "" @@ -921,11 +1064,13 @@ [ { "name": "memPtr", + "nativeSrc": "915:6:1", "nodeType": "YulIdentifier", "src": "915:6:1" }, { "name": "_4", + "nativeSrc": "923:2:1", "nodeType": "YulIdentifier", "src": "923:2:1" } @@ -933,16 +1078,20 @@ "functionName": { "name": "mstore", + "nativeSrc": "908:6:1", "nodeType": "YulIdentifier", "src": "908:6:1" }, + "nativeSrc": "908:18:1", "nodeType": "YulFunctionCall", "src": "908:18:1" }, + "nativeSrc": "908:18:1", "nodeType": "YulExpressionStatement", "src": "908:18:1" }, { + "nativeSrc": "935:22:1", "nodeType": "YulAssignment", "src": "935:22:1", "value": @@ -951,11 +1100,13 @@ [ { "name": "memPtr", + "nativeSrc": "946:6:1", "nodeType": "YulIdentifier", "src": "946:6:1" }, { "name": "_1", + "nativeSrc": "954:2:1", "nodeType": "YulIdentifier", "src": "954:2:1" } @@ -963,9 +1114,11 @@ "functionName": { "name": "add", + "nativeSrc": "942:3:1", "nodeType": "YulIdentifier", "src": "942:3:1" }, + "nativeSrc": "942:15:1", "nodeType": "YulFunctionCall", "src": "942:15:1" }, @@ -973,12 +1126,14 @@ [ { "name": "dst", + "nativeSrc": "935:3:1", "nodeType": "YulIdentifier", "src": "935:3:1" } ] }, { + "nativeSrc": "966:34:1", "nodeType": "YulVariableDeclaration", "src": "966:34:1", "value": @@ -990,11 +1145,13 @@ [ { "name": "_3", + "nativeSrc": "988:2:1", "nodeType": "YulIdentifier", "src": "988:2:1" }, { "name": "_5", + "nativeSrc": "992:2:1", "nodeType": "YulIdentifier", "src": "992:2:1" } @@ -1002,14 +1159,17 @@ "functionName": { "name": "add", + "nativeSrc": "984:3:1", "nodeType": "YulIdentifier", "src": "984:3:1" }, + "nativeSrc": "984:11:1", "nodeType": "YulFunctionCall", "src": "984:11:1" }, { "name": "_1", + "nativeSrc": "997:2:1", "nodeType": "YulIdentifier", "src": "997:2:1" } @@ -1017,9 +1177,11 @@ "functionName": { "name": "add", + "nativeSrc": "980:3:1", "nodeType": "YulIdentifier", "src": "980:3:1" }, + "nativeSrc": "980:20:1", "nodeType": "YulFunctionCall", "src": "980:20:1" }, @@ -1027,6 +1189,7 @@ [ { "name": "srcEnd", + "nativeSrc": "970:6:1", "nodeType": "YulTypedName", "src": "970:6:1", "type": "" @@ -1036,6 +1199,7 @@ { "body": { + "nativeSrc": "1032:16:1", "nodeType": "YulBlock", "src": "1032:16:1", "statements": @@ -1047,6 +1211,7 @@ [ { "kind": "number", + "nativeSrc": "1041:1:1", "nodeType": "YulLiteral", "src": "1041:1:1", "type": "", @@ -1054,6 +1219,7 @@ }, { "kind": "number", + "nativeSrc": "1044:1:1", "nodeType": "YulLiteral", "src": "1044:1:1", "type": "", @@ -1063,12 +1229,15 @@ "functionName": { "name": "revert", + "nativeSrc": "1034:6:1", "nodeType": "YulIdentifier", "src": "1034:6:1" }, + "nativeSrc": "1034:12:1", "nodeType": "YulFunctionCall", "src": "1034:12:1" }, + "nativeSrc": "1034:12:1", "nodeType": "YulExpressionStatement", "src": "1034:12:1" } @@ -1080,11 +1249,13 @@ [ { "name": "srcEnd", + "nativeSrc": "1015:6:1", "nodeType": "YulIdentifier", "src": "1015:6:1" }, { "name": "dataEnd", + "nativeSrc": "1023:7:1", "nodeType": "YulIdentifier", "src": "1023:7:1" } @@ -1092,16 +1263,20 @@ "functionName": { "name": "gt", + "nativeSrc": "1012:2:1", "nodeType": "YulIdentifier", "src": "1012:2:1" }, + "nativeSrc": "1012:19:1", "nodeType": "YulFunctionCall", "src": "1012:19:1" }, + "nativeSrc": "1009:39:1", "nodeType": "YulIf", "src": "1009:39:1" }, { + "nativeSrc": "1057:22:1", "nodeType": "YulVariableDeclaration", "src": "1057:22:1", "value": @@ -1110,11 +1285,13 @@ [ { "name": "_3", + "nativeSrc": "1072:2:1", "nodeType": "YulIdentifier", "src": "1072:2:1" }, { "name": "_1", + "nativeSrc": "1076:2:1", "nodeType": "YulIdentifier", "src": "1076:2:1" } @@ -1122,9 +1299,11 @@ "functionName": { "name": "add", + "nativeSrc": "1068:3:1", "nodeType": "YulIdentifier", "src": "1068:3:1" }, + "nativeSrc": "1068:11:1", "nodeType": "YulFunctionCall", "src": "1068:11:1" }, @@ -1132,6 +1311,7 @@ [ { "name": "src", + "nativeSrc": "1061:3:1", "nodeType": "YulTypedName", "src": "1061:3:1", "type": "" @@ -1141,6 +1321,7 @@ { "body": { + "nativeSrc": "1144:86:1", "nodeType": "YulBlock", "src": "1144:86:1", "statements": @@ -1152,6 +1333,7 @@ [ { "name": "dst", + "nativeSrc": "1165:3:1", "nodeType": "YulIdentifier", "src": "1165:3:1" }, @@ -1160,6 +1342,7 @@ [ { "name": "src", + "nativeSrc": "1183:3:1", "nodeType": "YulIdentifier", "src": "1183:3:1" } @@ -1167,9 +1350,11 @@ "functionName": { "name": "calldataload", + "nativeSrc": "1170:12:1", "nodeType": "YulIdentifier", "src": "1170:12:1" }, + "nativeSrc": "1170:17:1", "nodeType": "YulFunctionCall", "src": "1170:17:1" } @@ -1177,16 +1362,20 @@ "functionName": { "name": "mstore", + "nativeSrc": "1158:6:1", "nodeType": "YulIdentifier", "src": "1158:6:1" }, + "nativeSrc": "1158:30:1", "nodeType": "YulFunctionCall", "src": "1158:30:1" }, + "nativeSrc": "1158:30:1", "nodeType": "YulExpressionStatement", "src": "1158:30:1" }, { + "nativeSrc": "1201:19:1", "nodeType": "YulAssignment", "src": "1201:19:1", "value": @@ -1195,11 +1384,13 @@ [ { "name": "dst", + "nativeSrc": "1212:3:1", "nodeType": "YulIdentifier", "src": "1212:3:1" }, { "name": "_1", + "nativeSrc": "1217:2:1", "nodeType": "YulIdentifier", "src": "1217:2:1" } @@ -1207,9 +1398,11 @@ "functionName": { "name": "add", + "nativeSrc": "1208:3:1", "nodeType": "YulIdentifier", "src": "1208:3:1" }, + "nativeSrc": "1208:12:1", "nodeType": "YulFunctionCall", "src": "1208:12:1" }, @@ -1217,6 +1410,7 @@ [ { "name": "dst", + "nativeSrc": "1201:3:1", "nodeType": "YulIdentifier", "src": "1201:3:1" } @@ -1230,11 +1424,13 @@ [ { "name": "src", + "nativeSrc": "1099:3:1", "nodeType": "YulIdentifier", "src": "1099:3:1" }, { "name": "srcEnd", + "nativeSrc": "1104:6:1", "nodeType": "YulIdentifier", "src": "1104:6:1" } @@ -1242,20 +1438,25 @@ "functionName": { "name": "lt", + "nativeSrc": "1096:2:1", "nodeType": "YulIdentifier", "src": "1096:2:1" }, + "nativeSrc": "1096:15:1", "nodeType": "YulFunctionCall", "src": "1096:15:1" }, + "nativeSrc": "1088:142:1", "nodeType": "YulForLoop", "post": { + "nativeSrc": "1112:23:1", "nodeType": "YulBlock", "src": "1112:23:1", "statements": [ { + "nativeSrc": "1114:19:1", "nodeType": "YulAssignment", "src": "1114:19:1", "value": @@ -1264,11 +1465,13 @@ [ { "name": "src", + "nativeSrc": "1125:3:1", "nodeType": "YulIdentifier", "src": "1125:3:1" }, { "name": "_1", + "nativeSrc": "1130:2:1", "nodeType": "YulIdentifier", "src": "1130:2:1" } @@ -1276,9 +1479,11 @@ "functionName": { "name": "add", + "nativeSrc": "1121:3:1", "nodeType": "YulIdentifier", "src": "1121:3:1" }, + "nativeSrc": "1121:12:1", "nodeType": "YulFunctionCall", "src": "1121:12:1" }, @@ -1286,6 +1491,7 @@ [ { "name": "src", + "nativeSrc": "1114:3:1", "nodeType": "YulIdentifier", "src": "1114:3:1" } @@ -1295,6 +1501,7 @@ }, "pre": { + "nativeSrc": "1092:3:1", "nodeType": "YulBlock", "src": "1092:3:1", "statements": [] @@ -1302,11 +1509,13 @@ "src": "1088:142:1" }, { + "nativeSrc": "1239:16:1", "nodeType": "YulAssignment", "src": "1239:16:1", "value": { "name": "memPtr", + "nativeSrc": "1249:6:1", "nodeType": "YulIdentifier", "src": "1249:6:1" }, @@ -1314,6 +1523,7 @@ [ { "name": "value0", + "nativeSrc": "1239:6:1", "nodeType": "YulIdentifier", "src": "1239:6:1" } @@ -1322,17 +1532,20 @@ ] }, "name": "abi_decode_tuple_t_array$_t_uint256_$dyn_memory_ptr", + "nativeSrc": "146:1115:1", "nodeType": "YulFunctionDefinition", "parameters": [ { "name": "headStart", + "nativeSrc": "207:9:1", "nodeType": "YulTypedName", "src": "207:9:1", "type": "" }, { "name": "dataEnd", + "nativeSrc": "218:7:1", "nodeType": "YulTypedName", "src": "218:7:1", "type": "" @@ -1342,6 +1555,7 @@ [ { "name": "value0", + "nativeSrc": "230:6:1", "nodeType": "YulTypedName", "src": "230:6:1", "type": "" @@ -1352,11 +1566,13 @@ { "body": { + "nativeSrc": "1367:76:1", "nodeType": "YulBlock", "src": "1367:76:1", "statements": [ { + "nativeSrc": "1377:26:1", "nodeType": "YulAssignment", "src": "1377:26:1", "value": @@ -1365,11 +1581,13 @@ [ { "name": "headStart", + "nativeSrc": "1389:9:1", "nodeType": "YulIdentifier", "src": "1389:9:1" }, { "kind": "number", + "nativeSrc": "1400:2:1", "nodeType": "YulLiteral", "src": "1400:2:1", "type": "", @@ -1379,9 +1597,11 @@ "functionName": { "name": "add", + "nativeSrc": "1385:3:1", "nodeType": "YulIdentifier", "src": "1385:3:1" }, + "nativeSrc": "1385:18:1", "nodeType": "YulFunctionCall", "src": "1385:18:1" }, @@ -1389,6 +1609,7 @@ [ { "name": "tail", + "nativeSrc": "1377:4:1", "nodeType": "YulIdentifier", "src": "1377:4:1" } @@ -1401,11 +1622,13 @@ [ { "name": "headStart", + "nativeSrc": "1419:9:1", "nodeType": "YulIdentifier", "src": "1419:9:1" }, { "name": "value0", + "nativeSrc": "1430:6:1", "nodeType": "YulIdentifier", "src": "1430:6:1" } @@ -1413,29 +1636,35 @@ "functionName": { "name": "mstore", + "nativeSrc": "1412:6:1", "nodeType": "YulIdentifier", "src": "1412:6:1" }, + "nativeSrc": "1412:25:1", "nodeType": "YulFunctionCall", "src": "1412:25:1" }, + "nativeSrc": "1412:25:1", "nodeType": "YulExpressionStatement", "src": "1412:25:1" } ] }, "name": "abi_encode_tuple_t_uint256__to_t_uint256__fromStack_reversed", + "nativeSrc": "1266:177:1", "nodeType": "YulFunctionDefinition", "parameters": [ { "name": "headStart", + "nativeSrc": "1336:9:1", "nodeType": "YulTypedName", "src": "1336:9:1", "type": "" }, { "name": "value0", + "nativeSrc": "1347:6:1", "nodeType": "YulTypedName", "src": "1347:6:1", "type": "" @@ -1445,6 +1674,7 @@ [ { "name": "tail", + "nativeSrc": "1358:4:1", "nodeType": "YulTypedName", "src": "1358:4:1", "type": "" diff --git a/test/cmdlineTests/standard_outputs_on_analysis_error_fatal/args b/test/cmdlineTests/standard_outputs_on_analysis_error_fatal/args new file mode 100644 index 000000000000..18532c5a6d3f --- /dev/null +++ b/test/cmdlineTests/standard_outputs_on_analysis_error_fatal/args @@ -0,0 +1 @@ +--allow-paths . diff --git a/test/cmdlineTests/standard_outputs_on_analysis_error_fatal/in.sol b/test/cmdlineTests/standard_outputs_on_analysis_error_fatal/in.sol new file mode 100644 index 000000000000..b31d640322ad --- /dev/null +++ b/test/cmdlineTests/standard_outputs_on_analysis_error_fatal/in.sol @@ -0,0 +1,8 @@ +// SPDX-License-Identifier: GPL-3.0 +pragma solidity *; + +contract C { + // This will trigger a fatal error at the analysis stage, of the kind that terminates analysis + // immediately without letting the current step finish. + constructor(uint[] storage) {} +} diff --git a/test/cmdlineTests/standard_outputs_on_analysis_error_fatal/input.json b/test/cmdlineTests/standard_outputs_on_analysis_error_fatal/input.json new file mode 100644 index 000000000000..b640f033dc46 --- /dev/null +++ b/test/cmdlineTests/standard_outputs_on_analysis_error_fatal/input.json @@ -0,0 +1,14 @@ +{ + "language": "Solidity", + "sources": { + "C": {"urls": ["standard_outputs_on_analysis_error_fatal/in.sol"]} + }, + "settings": { + "outputSelection": { + "*": { + "*": ["*"], + "": ["*"] + } + } + } +} diff --git a/test/cmdlineTests/standard_outputs_on_analysis_error_fatal/output.json b/test/cmdlineTests/standard_outputs_on_analysis_error_fatal/output.json new file mode 100644 index 000000000000..51d12668fb13 --- /dev/null +++ b/test/cmdlineTests/standard_outputs_on_analysis_error_fatal/output.json @@ -0,0 +1,26 @@ +{ + "errors": + [ + { + "component": "general", + "errorCode": "3644", + "formattedMessage": "TypeError: This parameter has a type that can only be used internally. You can make the contract abstract to avoid this problem. + --> C:7:17: + | +7 | constructor(uint[] storage) {} + | ^^^^^^^^^^^^^^ + +", + "message": "This parameter has a type that can only be used internally. You can make the contract abstract to avoid this problem.", + "severity": "error", + "sourceLocation": + { + "end": 258, + "file": "C", + "start": 244 + }, + "type": "TypeError" + } + ], + "sources": {} +} diff --git a/test/cmdlineTests/standard_outputs_on_analysis_error_fatal_after_current_step/args b/test/cmdlineTests/standard_outputs_on_analysis_error_fatal_after_current_step/args new file mode 100644 index 000000000000..18532c5a6d3f --- /dev/null +++ b/test/cmdlineTests/standard_outputs_on_analysis_error_fatal_after_current_step/args @@ -0,0 +1 @@ +--allow-paths . diff --git a/test/cmdlineTests/standard_outputs_on_analysis_error_fatal_after_current_step/in.sol b/test/cmdlineTests/standard_outputs_on_analysis_error_fatal_after_current_step/in.sol new file mode 100644 index 000000000000..6c8bb3938b76 --- /dev/null +++ b/test/cmdlineTests/standard_outputs_on_analysis_error_fatal_after_current_step/in.sol @@ -0,0 +1,6 @@ +// SPDX-License-Identifier: GPL-3.0 +pragma solidity *; + +// This will trigger a fatal error at the analysis stage, of the kind that lets the current +// analysis steps finish but terminates analysis after immediately after that step. +function f(uint immutable x) {} diff --git a/test/cmdlineTests/standard_outputs_on_analysis_error_fatal_after_current_step/input.json b/test/cmdlineTests/standard_outputs_on_analysis_error_fatal_after_current_step/input.json new file mode 100644 index 000000000000..0214e00e8406 --- /dev/null +++ b/test/cmdlineTests/standard_outputs_on_analysis_error_fatal_after_current_step/input.json @@ -0,0 +1,14 @@ +{ + "language": "Solidity", + "sources": { + "C": {"urls": ["standard_outputs_on_analysis_error_fatal_after_current_step/in.sol"]} + }, + "settings": { + "outputSelection": { + "*": { + "*": ["*"], + "": ["*"] + } + } + } +} diff --git a/test/cmdlineTests/standard_outputs_on_analysis_error_fatal_after_current_step/output.json b/test/cmdlineTests/standard_outputs_on_analysis_error_fatal_after_current_step/output.json new file mode 100644 index 000000000000..d47ded5d4018 --- /dev/null +++ b/test/cmdlineTests/standard_outputs_on_analysis_error_fatal_after_current_step/output.json @@ -0,0 +1,26 @@ +{ + "errors": + [ + { + "component": "general", + "errorCode": "8297", + "formattedMessage": "DeclarationError: The \"immutable\" keyword can only be used for state variables. + --> C:6:12: + | +6 | function f(uint immutable x) {} + | ^^^^^^^^^^^^^^^^ + +", + "message": "The \"immutable\" keyword can only be used for state variables.", + "severity": "error", + "sourceLocation": + { + "end": 259, + "file": "C", + "start": 243 + }, + "type": "DeclarationError" + } + ], + "sources": {} +} diff --git a/test/cmdlineTests/standard_outputs_on_analysis_error_non_fatal/args b/test/cmdlineTests/standard_outputs_on_analysis_error_non_fatal/args new file mode 100644 index 000000000000..18532c5a6d3f --- /dev/null +++ b/test/cmdlineTests/standard_outputs_on_analysis_error_non_fatal/args @@ -0,0 +1 @@ +--allow-paths . diff --git a/test/cmdlineTests/standard_outputs_on_analysis_error_non_fatal/in.sol b/test/cmdlineTests/standard_outputs_on_analysis_error_non_fatal/in.sol new file mode 100644 index 000000000000..050f5ad43673 --- /dev/null +++ b/test/cmdlineTests/standard_outputs_on_analysis_error_non_fatal/in.sol @@ -0,0 +1,9 @@ +// SPDX-License-Identifier: GPL-3.0 +pragma solidity *; + +contract C { + // This will trigger a non-fatal error at the analysis stage. + // With this kind of error we still run subsequent analysis stages. + uint x; + string y = x; +} diff --git a/test/cmdlineTests/standard_outputs_on_analysis_error_non_fatal/input.json b/test/cmdlineTests/standard_outputs_on_analysis_error_non_fatal/input.json new file mode 100644 index 000000000000..904ebc5bf287 --- /dev/null +++ b/test/cmdlineTests/standard_outputs_on_analysis_error_non_fatal/input.json @@ -0,0 +1,14 @@ +{ + "language": "Solidity", + "sources": { + "C": {"urls": ["standard_outputs_on_analysis_error_non_fatal/in.sol"]} + }, + "settings": { + "outputSelection": { + "*": { + "*": ["*"], + "": ["*"] + } + } + } +} diff --git a/test/cmdlineTests/standard_outputs_on_analysis_error_non_fatal/output.json b/test/cmdlineTests/standard_outputs_on_analysis_error_non_fatal/output.json new file mode 100644 index 000000000000..2f3aaae4420c --- /dev/null +++ b/test/cmdlineTests/standard_outputs_on_analysis_error_non_fatal/output.json @@ -0,0 +1,26 @@ +{ + "errors": + [ + { + "component": "general", + "errorCode": "7407", + "formattedMessage": "TypeError: Type uint256 is not implicitly convertible to expected type string storage ref. + --> C:8:16: + | +8 | string y = x; + | ^ + +", + "message": "Type uint256 is not implicitly convertible to expected type string storage ref.", + "severity": "error", + "sourceLocation": + { + "end": 235, + "file": "C", + "start": 234 + }, + "type": "TypeError" + } + ], + "sources": {} +} diff --git a/test/cmdlineTests/standard_outputs_on_compilation_error/args b/test/cmdlineTests/standard_outputs_on_compilation_error/args new file mode 100644 index 000000000000..18532c5a6d3f --- /dev/null +++ b/test/cmdlineTests/standard_outputs_on_compilation_error/args @@ -0,0 +1 @@ +--allow-paths . diff --git a/test/cmdlineTests/standard_outputs_on_compilation_error/in.sol b/test/cmdlineTests/standard_outputs_on_compilation_error/in.sol new file mode 100644 index 000000000000..1d5118b87287 --- /dev/null +++ b/test/cmdlineTests/standard_outputs_on_compilation_error/in.sol @@ -0,0 +1,13 @@ +// SPDX-License-Identifier: GPL-3.0 +pragma solidity *; + +contract C { + // This will trigger an error at the compilation stage. + // CodeGenerationError due to immutable initialization in constructor being optimized out. + uint immutable public x; + + constructor() { + x = 0; + while (true) {} + } +} diff --git a/test/cmdlineTests/standard_outputs_on_compilation_error/input.json b/test/cmdlineTests/standard_outputs_on_compilation_error/input.json new file mode 100644 index 000000000000..855f007689b8 --- /dev/null +++ b/test/cmdlineTests/standard_outputs_on_compilation_error/input.json @@ -0,0 +1,15 @@ +{ + "language": "Solidity", + "sources": { + "C": {"urls": ["standard_outputs_on_compilation_error/in.sol"]} + }, + "settings": { + "optimizer": {"enabled": true}, + "outputSelection": { + "*": { + "*": ["*"], + "": ["*"] + } + } + } +} diff --git a/test/cmdlineTests/standard_outputs_on_compilation_error/output.json b/test/cmdlineTests/standard_outputs_on_compilation_error/output.json new file mode 100644 index 000000000000..ac01fb1eba9c --- /dev/null +++ b/test/cmdlineTests/standard_outputs_on_compilation_error/output.json @@ -0,0 +1,280 @@ +{ + "contracts": + { + "C": + { + "C": + { + "abi": + [ + { + "inputs": [], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [], + "name": "x", + "outputs": + [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + } + ], + "devdoc": + { + "kind": "dev", + "methods": {}, + "version": 1 + }, + "evm": + { + "methodIdentifiers": + { + "x()": "0c55699c" + } + }, + "metadata": "{\"compiler\":{\"version\":\"\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"x\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"C\":\"C\"},\"evmVersion\":\"shanghai\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"C\":{\"keccak256\":\"0x67a13ebd685e4c6f792e71eb747dac57edb99e94d04d841ee6c979ae517934ce\",\"license\":\"GPL-3.0\",\"urls\":[\"bzz-raw://665b000da768823654f680d02686c1e59d682a0b3882e43a77fed9f80ce64ae8\",\"dweb:/ipfs/QmVnKvuidH6KiCdNQpoAQUtDbB8hXkafVLXWMNitUcxnqC\"]}},\"version\":1}", + "storageLayout": + { + "storage": [], + "types": null + }, + "userdoc": + { + "kind": "user", + "methods": {}, + "version": 1 + } + } + } + }, + "errors": + [ + { + "component": "general", + "errorCode": "1284", + "formattedMessage": "CodeGenerationError: Some immutables were read from but never assigned, possibly because of optimization. + +", + "message": "Some immutables were read from but never assigned, possibly because of optimization.", + "severity": "error", + "type": "CodeGenerationError" + } + ], + "sources": + { + "C": + { + "ast": + { + "absolutePath": "C", + "exportedSymbols": + { + "C": + [ + 15 + ] + }, + "id": 16, + "license": "GPL-3.0", + "nodeType": "SourceUnit", + "nodes": + [ + { + "id": 1, + "literals": + [ + "solidity", + "*" + ], + "nodeType": "PragmaDirective", + "src": "36:18:0" + }, + { + "abstract": false, + "baseContracts": [], + "canonicalName": "C", + "contractDependencies": [], + "contractKind": "contract", + "fullyImplemented": true, + "id": 15, + "linearizedBaseContracts": + [ + 15 + ], + "name": "C", + "nameLocation": "65:1:0", + "nodeType": "ContractDefinition", + "nodes": + [ + { + "constant": false, + "functionSelector": "0c55699c", + "id": 3, + "mutability": "immutable", + "name": "x", + "nameLocation": "250:1:0", + "nodeType": "VariableDeclaration", + "scope": 15, + "src": "228:23:0", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": + { + "id": 2, + "name": "uint", + "nodeType": "ElementaryTypeName", + "src": "228:4:0", + "typeDescriptions": + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "public" + }, + { + "body": + { + "id": 13, + "nodeType": "Block", + "src": "272:46:0", + "statements": + [ + { + "expression": + { + "id": 8, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": + { + "id": 6, + "name": "x", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3, + "src": "282:1:0", + "typeDescriptions": + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": + { + "hexValue": "30", + "id": 7, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "286:1:0", + "typeDescriptions": + { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "src": "282:5:0", + "typeDescriptions": + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 9, + "nodeType": "ExpressionStatement", + "src": "282:5:0" + }, + { + "body": + { + "id": 11, + "nodeType": "Block", + "src": "310:2:0", + "statements": [] + }, + "condition": + { + "hexValue": "74727565", + "id": 10, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "bool", + "lValueRequested": false, + "nodeType": "Literal", + "src": "304:4:0", + "typeDescriptions": + { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "value": "true" + }, + "id": 12, + "nodeType": "WhileStatement", + "src": "297:15:0" + } + ] + }, + "id": 14, + "implemented": true, + "kind": "constructor", + "modifiers": [], + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "FunctionDefinition", + "parameters": + { + "id": 4, + "nodeType": "ParameterList", + "parameters": [], + "src": "269:2:0" + }, + "returnParameters": + { + "id": 5, + "nodeType": "ParameterList", + "parameters": [], + "src": "272:0:0" + }, + "scope": 15, + "src": "258:60:0", + "stateMutability": "nonpayable", + "virtual": false, + "visibility": "public" + } + ], + "scope": 16, + "src": "56:264:0", + "usedErrors": [], + "usedEvents": [] + } + ], + "src": "36:285:0" + }, + "id": 0 + } + } +} diff --git a/test/cmdlineTests/standard_outputs_on_parsing_error/args b/test/cmdlineTests/standard_outputs_on_parsing_error/args new file mode 100644 index 000000000000..18532c5a6d3f --- /dev/null +++ b/test/cmdlineTests/standard_outputs_on_parsing_error/args @@ -0,0 +1 @@ +--allow-paths . diff --git a/test/cmdlineTests/standard_outputs_on_parsing_error/in.sol b/test/cmdlineTests/standard_outputs_on_parsing_error/in.sol new file mode 100644 index 000000000000..a4d891c1b25a --- /dev/null +++ b/test/cmdlineTests/standard_outputs_on_parsing_error/in.sol @@ -0,0 +1,5 @@ +// SPDX-License-Identifier: GPL-3.0 +pragma solidity *; + +// This will trigger an error at the parsing stage +contract C {}} diff --git a/test/cmdlineTests/standard_outputs_on_parsing_error/input.json b/test/cmdlineTests/standard_outputs_on_parsing_error/input.json new file mode 100644 index 000000000000..a0d00c4e9e39 --- /dev/null +++ b/test/cmdlineTests/standard_outputs_on_parsing_error/input.json @@ -0,0 +1,14 @@ +{ + "language": "Solidity", + "sources": { + "C": {"urls": ["standard_outputs_on_parsing_error/in.sol"]} + }, + "settings": { + "outputSelection": { + "*": { + "*": ["*"], + "": ["*"] + } + } + } +} diff --git a/test/cmdlineTests/standard_outputs_on_parsing_error/output.json b/test/cmdlineTests/standard_outputs_on_parsing_error/output.json new file mode 100644 index 000000000000..8c1f6c0dbe28 --- /dev/null +++ b/test/cmdlineTests/standard_outputs_on_parsing_error/output.json @@ -0,0 +1,26 @@ +{ + "errors": + [ + { + "component": "general", + "errorCode": "7858", + "formattedMessage": "ParserError: Expected pragma, import directive or contract/interface/library/struct/enum/constant/function/error definition. + --> C:5:14: + | +5 | contract C {}} + | ^ + +", + "message": "Expected pragma, import directive or contract/interface/library/struct/enum/constant/function/error definition.", + "severity": "error", + "sourceLocation": + { + "end": 121, + "file": "C", + "start": 120 + }, + "type": "ParserError" + } + ], + "sources": {} +} diff --git a/test/cmdlineTests/standard_stop_after_parsing_ast_requested/args b/test/cmdlineTests/standard_stop_after_parsing_ast_requested/args new file mode 100644 index 000000000000..18532c5a6d3f --- /dev/null +++ b/test/cmdlineTests/standard_stop_after_parsing_ast_requested/args @@ -0,0 +1 @@ +--allow-paths . diff --git a/test/cmdlineTests/standard_stop_after_parsing_ast_requested/in.sol b/test/cmdlineTests/standard_stop_after_parsing_ast_requested/in.sol new file mode 100644 index 000000000000..e78a24ff786e --- /dev/null +++ b/test/cmdlineTests/standard_stop_after_parsing_ast_requested/in.sol @@ -0,0 +1,6 @@ +// SPDX-License-Identifier: GPL-3.0 +pragma solidity *; + +import "A"; + +contract C {} diff --git a/test/cmdlineTests/standard_stop_after_parsing_ast_requested/input.json b/test/cmdlineTests/standard_stop_after_parsing_ast_requested/input.json new file mode 100644 index 000000000000..34f157495034 --- /dev/null +++ b/test/cmdlineTests/standard_stop_after_parsing_ast_requested/input.json @@ -0,0 +1,12 @@ +{ + "language": "Solidity", + "sources": { + "C": {"urls": ["standard_stop_after_parsing_ast_requested/in.sol"]} + }, + "settings": { + "stopAfter": "parsing", + "outputSelection": { + "*": {"": ["ast"]} + } + } +} diff --git a/test/cmdlineTests/standard_stop_after_parsing_ast_requested/output.json b/test/cmdlineTests/standard_stop_after_parsing_ast_requested/output.json new file mode 100644 index 000000000000..6907d4780f58 --- /dev/null +++ b/test/cmdlineTests/standard_stop_after_parsing_ast_requested/output.json @@ -0,0 +1,54 @@ +{ + "sources": + { + "C": + { + "ast": + { + "absolutePath": "C", + "id": 4, + "license": "GPL-3.0", + "nodeType": "SourceUnit", + "nodes": + [ + { + "id": 1, + "literals": + [ + "solidity", + "*" + ], + "nodeType": "PragmaDirective", + "src": "36:18:0" + }, + { + "absolutePath": "A", + "file": "A", + "id": 2, + "nameLocation": "-1:-1:-1", + "nodeType": "ImportDirective", + "src": "56:11:0", + "symbolAliases": [], + "unitAlias": "" + }, + { + "abstract": false, + "baseContracts": [], + "contractDependencies": [], + "contractKind": "contract", + "id": 3, + "name": "C", + "nameLocation": "78:1:0", + "nodeType": "ContractDefinition", + "nodes": [], + "src": "69:13:0", + "usedErrors": [], + "usedEvents": [] + } + ], + "src": "36:47:0" + }, + "id": 0 + } + } +} diff --git a/test/cmdlineTests/standard_stop_after_parsing_bytecode_requested/args b/test/cmdlineTests/standard_stop_after_parsing_bytecode_requested/args new file mode 100644 index 000000000000..18532c5a6d3f --- /dev/null +++ b/test/cmdlineTests/standard_stop_after_parsing_bytecode_requested/args @@ -0,0 +1 @@ +--allow-paths . diff --git a/test/cmdlineTests/standard_stop_after_parsing_bytecode_requested/in.sol b/test/cmdlineTests/standard_stop_after_parsing_bytecode_requested/in.sol new file mode 100644 index 000000000000..e78a24ff786e --- /dev/null +++ b/test/cmdlineTests/standard_stop_after_parsing_bytecode_requested/in.sol @@ -0,0 +1,6 @@ +// SPDX-License-Identifier: GPL-3.0 +pragma solidity *; + +import "A"; + +contract C {} diff --git a/test/cmdlineTests/standard_stop_after_parsing_bytecode_requested/input.json b/test/cmdlineTests/standard_stop_after_parsing_bytecode_requested/input.json new file mode 100644 index 000000000000..7ef3d37fd305 --- /dev/null +++ b/test/cmdlineTests/standard_stop_after_parsing_bytecode_requested/input.json @@ -0,0 +1,12 @@ +{ + "language": "Solidity", + "sources": { + "C": {"urls": ["standard_stop_after_parsing_bytecode_requested/in.sol"]} + }, + "settings": { + "stopAfter": "parsing", + "outputSelection": { + "*": {"*": ["evm.bytecode.object"]} + } + } +} diff --git a/test/cmdlineTests/standard_stop_after_parsing_bytecode_requested/output.json b/test/cmdlineTests/standard_stop_after_parsing_bytecode_requested/output.json new file mode 100644 index 000000000000..37195309631d --- /dev/null +++ b/test/cmdlineTests/standard_stop_after_parsing_bytecode_requested/output.json @@ -0,0 +1,12 @@ +{ + "errors": + [ + { + "component": "general", + "formattedMessage": "Requested output selection conflicts with \"settings.stopAfter\".", + "message": "Requested output selection conflicts with \"settings.stopAfter\".", + "severity": "error", + "type": "JSONError" + } + ] +} diff --git a/test/cmdlineTests/standard_stop_after_parsing_non_binary_output_requested/args b/test/cmdlineTests/standard_stop_after_parsing_non_binary_output_requested/args new file mode 100644 index 000000000000..18532c5a6d3f --- /dev/null +++ b/test/cmdlineTests/standard_stop_after_parsing_non_binary_output_requested/args @@ -0,0 +1 @@ +--allow-paths . diff --git a/test/cmdlineTests/standard_stop_after_parsing_non_binary_output_requested/in.sol b/test/cmdlineTests/standard_stop_after_parsing_non_binary_output_requested/in.sol new file mode 100644 index 000000000000..978517b3c23f --- /dev/null +++ b/test/cmdlineTests/standard_stop_after_parsing_non_binary_output_requested/in.sol @@ -0,0 +1,8 @@ +// SPDX-License-Identifier: GPL-3.0 +pragma solidity *; + +import "A"; + +contract C { + function f() public {} +} diff --git a/test/cmdlineTests/standard_stop_after_parsing_non_binary_output_requested/input.json b/test/cmdlineTests/standard_stop_after_parsing_non_binary_output_requested/input.json new file mode 100644 index 000000000000..ac4d623c7103 --- /dev/null +++ b/test/cmdlineTests/standard_stop_after_parsing_non_binary_output_requested/input.json @@ -0,0 +1,19 @@ +{ + "language": "Solidity", + "sources": { + "C": {"urls": ["standard_stop_after_parsing_non_binary_output_requested/in.sol"]} + }, + "settings": { + "stopAfter": "parsing", + "outputSelection": { + "*": {"*": [ + "abi", + "devdoc", + "userdoc", + "metadata", + "storageLayout", + "evm.methodIdentifiers" + ]} + } + } +} diff --git a/test/cmdlineTests/standard_stop_after_parsing_non_binary_output_requested/output.json b/test/cmdlineTests/standard_stop_after_parsing_non_binary_output_requested/output.json new file mode 100644 index 000000000000..5b64763be82f --- /dev/null +++ b/test/cmdlineTests/standard_stop_after_parsing_non_binary_output_requested/output.json @@ -0,0 +1,9 @@ +{ + "sources": + { + "C": + { + "id": 0 + } + } +} diff --git a/test/cmdlineTests/standard_yul/output.json b/test/cmdlineTests/standard_yul/output.json index 33d5fc0bd37b..9dcf201139f4 100644 --- a/test/cmdlineTests/standard_yul/output.json +++ b/test/cmdlineTests/standard_yul/output.json @@ -7,22 +7,18 @@ { "evm": { - "assembly": " /* \"A\":17:18 */ + "assembly": " /* \"A\":38:39 */ 0x00 /* \"A\":11:19 */ - mload - /* \"A\":38:39 */ - 0x00 - /* \"A\":34:35 */ dup1 - /* \"A\":31:32 */ - dup3 + dup1 + mload /* \"A\":27:36 */ add /* \"A\":20:40 */ sstore /* \"A\":0:42 */ - pop + stop ", "bytecode": { @@ -43,12 +39,137 @@ ", "irOptimized": "object \"object\" { code { - let x := mload(0) - sstore(add(x, 0), 0) + { + let x := mload(0) + sstore(add(x, 0), 0) + } } } " } } + }, + "sources": + { + "A": + { + "ast": + { + "code": + { + "block": + { + "nativeSrc": "0:42:0", + "nodeType": "YulBlock", + "src": "0:42:0", + "statements": + [ + { + "nativeSrc": "2:17:0", + "nodeType": "YulVariableDeclaration", + "src": "2:17:0", + "value": + { + "arguments": + [ + { + "kind": "number", + "nativeSrc": "17:1:0", + "nodeType": "YulLiteral", + "src": "17:1:0", + "type": "", + "value": "0" + } + ], + "functionName": + { + "name": "mload", + "nativeSrc": "11:5:0", + "nodeType": "YulIdentifier", + "src": "11:5:0" + }, + "nativeSrc": "11:8:0", + "nodeType": "YulFunctionCall", + "src": "11:8:0" + }, + "variables": + [ + { + "name": "x", + "nativeSrc": "6:1:0", + "nodeType": "YulTypedName", + "src": "6:1:0", + "type": "" + } + ] + }, + { + "expression": + { + "arguments": + [ + { + "arguments": + [ + { + "name": "x", + "nativeSrc": "31:1:0", + "nodeType": "YulIdentifier", + "src": "31:1:0" + }, + { + "kind": "number", + "nativeSrc": "34:1:0", + "nodeType": "YulLiteral", + "src": "34:1:0", + "type": "", + "value": "0" + } + ], + "functionName": + { + "name": "add", + "nativeSrc": "27:3:0", + "nodeType": "YulIdentifier", + "src": "27:3:0" + }, + "nativeSrc": "27:9:0", + "nodeType": "YulFunctionCall", + "src": "27:9:0" + }, + { + "kind": "number", + "nativeSrc": "38:1:0", + "nodeType": "YulLiteral", + "src": "38:1:0", + "type": "", + "value": "0" + } + ], + "functionName": + { + "name": "sstore", + "nativeSrc": "20:6:0", + "nodeType": "YulIdentifier", + "src": "20:6:0" + }, + "nativeSrc": "20:20:0", + "nodeType": "YulFunctionCall", + "src": "20:20:0" + }, + "nativeSrc": "20:20:0", + "nodeType": "YulExpressionStatement", + "src": "20:20:0" + } + ] + }, + "nodeType": "YulCode" + }, + "name": "object", + "nodeType": "YulObject", + "subObjects": [] + }, + "id": 1 + } } } diff --git a/test/cmdlineTests/standard_yul_debug_info_print_all/in.yul b/test/cmdlineTests/standard_yul_debug_info_print_all/in.yul index 6d1ebe21b989..aa564d00ce86 100644 --- a/test/cmdlineTests/standard_yul_debug_info_print_all/in.yul +++ b/test/cmdlineTests/standard_yul_debug_info_print_all/in.yul @@ -9,6 +9,7 @@ object "C_6_deployed" { /// @src 0:77:99 "function f() public {}" function fun_f_5() { + sstore(0, 42) } /// @src 0:60:101 "contract C {..." } diff --git a/test/cmdlineTests/standard_yul_debug_info_print_all/output.json b/test/cmdlineTests/standard_yul_debug_info_print_all/output.json index 78f14c08da2f..9d675a06918d 100644 --- a/test/cmdlineTests/standard_yul_debug_info_print_all/output.json +++ b/test/cmdlineTests/standard_yul_debug_info_print_all/output.json @@ -13,11 +13,11 @@ tag_1 jump\t// in tag_2: + stop /* \"input.sol\":77:99 */ - jump(tag_3) tag_1: + sstore(0x00, 0x2a) jump\t// out -tag_3: " } } diff --git a/test/cmdlineTests/standard_yul_debug_info_print_location_only/in.yul b/test/cmdlineTests/standard_yul_debug_info_print_location_only/in.yul index 6d1ebe21b989..aa564d00ce86 100644 --- a/test/cmdlineTests/standard_yul_debug_info_print_location_only/in.yul +++ b/test/cmdlineTests/standard_yul_debug_info_print_location_only/in.yul @@ -9,6 +9,7 @@ object "C_6_deployed" { /// @src 0:77:99 "function f() public {}" function fun_f_5() { + sstore(0, 42) } /// @src 0:60:101 "contract C {..." } diff --git a/test/cmdlineTests/standard_yul_debug_info_print_location_only/output.json b/test/cmdlineTests/standard_yul_debug_info_print_location_only/output.json index 526a6a5c637a..8cbbd326c71e 100644 --- a/test/cmdlineTests/standard_yul_debug_info_print_location_only/output.json +++ b/test/cmdlineTests/standard_yul_debug_info_print_location_only/output.json @@ -13,11 +13,11 @@ tag_1 jump\t// in tag_2: + stop /* \"input.sol\":77:99 */ - jump(tag_3) tag_1: + sstore(0x00, 0x2a) jump\t// out -tag_3: " } } diff --git a/test/cmdlineTests/standard_yul_debug_info_print_none/in.yul b/test/cmdlineTests/standard_yul_debug_info_print_none/in.yul index 6d1ebe21b989..aa564d00ce86 100644 --- a/test/cmdlineTests/standard_yul_debug_info_print_none/in.yul +++ b/test/cmdlineTests/standard_yul_debug_info_print_none/in.yul @@ -9,6 +9,7 @@ object "C_6_deployed" { /// @src 0:77:99 "function f() public {}" function fun_f_5() { + sstore(0, 42) } /// @src 0:60:101 "contract C {..." } diff --git a/test/cmdlineTests/standard_yul_debug_info_print_none/output.json b/test/cmdlineTests/standard_yul_debug_info_print_none/output.json index f5b5c636448b..d1e4cff4cb3d 100644 --- a/test/cmdlineTests/standard_yul_debug_info_print_none/output.json +++ b/test/cmdlineTests/standard_yul_debug_info_print_none/output.json @@ -12,10 +12,10 @@ tag_1 jump\t// in tag_2: - jump(tag_3) + stop tag_1: + sstore(0x00, 0x2a) jump\t// out -tag_3: " } } diff --git a/test/cmdlineTests/standard_yul_debug_info_print_snippet_only/in.yul b/test/cmdlineTests/standard_yul_debug_info_print_snippet_only/in.yul index 6d1ebe21b989..aa564d00ce86 100644 --- a/test/cmdlineTests/standard_yul_debug_info_print_snippet_only/in.yul +++ b/test/cmdlineTests/standard_yul_debug_info_print_snippet_only/in.yul @@ -9,6 +9,7 @@ object "C_6_deployed" { /// @src 0:77:99 "function f() public {}" function fun_f_5() { + sstore(0, 42) } /// @src 0:60:101 "contract C {..." } diff --git a/test/cmdlineTests/standard_yul_object/output.json b/test/cmdlineTests/standard_yul_object/output.json index e5a5dadac509..edf139dc0de2 100644 --- a/test/cmdlineTests/standard_yul_object/output.json +++ b/test/cmdlineTests/standard_yul_object/output.json @@ -7,20 +7,17 @@ { "evm": { - "assembly": " /* \"A\":39:61 */ - data_4e03657aea45a94fc7d47ba826c8d667c0d1e6e33a64a036ec44f58fa12d6c45 - /* \"A\":80:81 */ + "assembly": " /* \"A\":80:81 */ 0x00 - /* \"A\":76:77 */ + /* \"A\":39:61 */ dup1 - /* \"A\":73:74 */ - dup3 + data_4e03657aea45a94fc7d47ba826c8d667c0d1e6e33a64a036ec44f58fa12d6c45 /* \"A\":69:78 */ add /* \"A\":62:82 */ sstore /* \"A\":28:84 */ - pop + stop stop data_4e03657aea45a94fc7d47ba826c8d667c0d1e6e33a64a036ec44f58fa12d6c45 616263 ", @@ -44,13 +41,145 @@ data_4e03657aea45a94fc7d47ba826c8d667c0d1e6e33a64a036ec44f58fa12d6c45 616263 ", "irOptimized": "object \"NamedObject\" { code { - let x := dataoffset(\"DataName\") - sstore(add(x, 0), 0) + { + let x := dataoffset(\"DataName\") + sstore(add(x, 0), 0) + } } data \"DataName\" hex\"616263\" } " } } + }, + "sources": + { + "A": + { + "ast": + { + "code": + { + "block": + { + "nativeSrc": "28:56:0", + "nodeType": "YulBlock", + "src": "28:56:0", + "statements": + [ + { + "nativeSrc": "30:31:0", + "nodeType": "YulVariableDeclaration", + "src": "30:31:0", + "value": + { + "arguments": + [ + { + "hexValue": "446174614e616d65", + "kind": "string", + "nativeSrc": "50:10:0", + "nodeType": "YulLiteral", + "src": "50:10:0", + "type": "", + "value": "DataName" + } + ], + "functionName": + { + "name": "dataoffset", + "nativeSrc": "39:10:0", + "nodeType": "YulIdentifier", + "src": "39:10:0" + }, + "nativeSrc": "39:22:0", + "nodeType": "YulFunctionCall", + "src": "39:22:0" + }, + "variables": + [ + { + "name": "x", + "nativeSrc": "34:1:0", + "nodeType": "YulTypedName", + "src": "34:1:0", + "type": "" + } + ] + }, + { + "expression": + { + "arguments": + [ + { + "arguments": + [ + { + "name": "x", + "nativeSrc": "73:1:0", + "nodeType": "YulIdentifier", + "src": "73:1:0" + }, + { + "kind": "number", + "nativeSrc": "76:1:0", + "nodeType": "YulLiteral", + "src": "76:1:0", + "type": "", + "value": "0" + } + ], + "functionName": + { + "name": "add", + "nativeSrc": "69:3:0", + "nodeType": "YulIdentifier", + "src": "69:3:0" + }, + "nativeSrc": "69:9:0", + "nodeType": "YulFunctionCall", + "src": "69:9:0" + }, + { + "kind": "number", + "nativeSrc": "80:1:0", + "nodeType": "YulLiteral", + "src": "80:1:0", + "type": "", + "value": "0" + } + ], + "functionName": + { + "name": "sstore", + "nativeSrc": "62:6:0", + "nodeType": "YulIdentifier", + "src": "62:6:0" + }, + "nativeSrc": "62:20:0", + "nodeType": "YulFunctionCall", + "src": "62:20:0" + }, + "nativeSrc": "62:20:0", + "nodeType": "YulExpressionStatement", + "src": "62:20:0" + } + ] + }, + "nodeType": "YulCode" + }, + "name": "NamedObject", + "nodeType": "YulObject", + "subObjects": + [ + { + "nodeType": "YulData", + "value": "616263" + } + ] + }, + "id": 1 + } } } diff --git a/test/cmdlineTests/standard_yul_object_name/output.json b/test/cmdlineTests/standard_yul_object_name/output.json index 57c7ce709d5b..7faeed3c3223 100644 --- a/test/cmdlineTests/standard_yul_object_name/output.json +++ b/test/cmdlineTests/standard_yul_object_name/output.json @@ -7,29 +7,25 @@ { "evm": { - "assembly": " /* \"A\":39:61 */ - data_4e03657aea45a94fc7d47ba826c8d667c0d1e6e33a64a036ec44f58fa12d6c45 - /* \"A\":80:81 */ + "assembly": " /* \"A\":80:81 */ 0x00 - /* \"A\":76:77 */ + /* \"A\":39:61 */ dup1 - /* \"A\":73:74 */ - dup3 + data_4e03657aea45a94fc7d47ba826c8d667c0d1e6e33a64a036ec44f58fa12d6c45 /* \"A\":69:78 */ add /* \"A\":62:82 */ sstore /* \"A\":28:84 */ - pop + stop stop data_4e03657aea45a94fc7d47ba826c8d667c0d1e6e33a64a036ec44f58fa12d6c45 616263 sub_0: assembly { /* \"A\":147:148 */ 0x00 - /* \"A\":144:145 */ - dup1 /* \"A\":137:149 */ + dup1 revert } ", @@ -66,16 +62,203 @@ sub_0: assembly { ", "irOptimized": "object \"NamedObject\" { code { - let x := dataoffset(\"DataName\") - sstore(add(x, 0), 0) + { + let x := dataoffset(\"DataName\") + sstore(add(x, 0), 0) + } } data \"DataName\" hex\"616263\" object \"OtherObject\" { - code { revert(0, 0) } + code { { revert(0, 0) } } } } " } } + }, + "sources": + { + "A": + { + "ast": + { + "code": + { + "block": + { + "nativeSrc": "28:56:0", + "nodeType": "YulBlock", + "src": "28:56:0", + "statements": + [ + { + "nativeSrc": "30:31:0", + "nodeType": "YulVariableDeclaration", + "src": "30:31:0", + "value": + { + "arguments": + [ + { + "hexValue": "446174614e616d65", + "kind": "string", + "nativeSrc": "50:10:0", + "nodeType": "YulLiteral", + "src": "50:10:0", + "type": "", + "value": "DataName" + } + ], + "functionName": + { + "name": "dataoffset", + "nativeSrc": "39:10:0", + "nodeType": "YulIdentifier", + "src": "39:10:0" + }, + "nativeSrc": "39:22:0", + "nodeType": "YulFunctionCall", + "src": "39:22:0" + }, + "variables": + [ + { + "name": "x", + "nativeSrc": "34:1:0", + "nodeType": "YulTypedName", + "src": "34:1:0", + "type": "" + } + ] + }, + { + "expression": + { + "arguments": + [ + { + "arguments": + [ + { + "name": "x", + "nativeSrc": "73:1:0", + "nodeType": "YulIdentifier", + "src": "73:1:0" + }, + { + "kind": "number", + "nativeSrc": "76:1:0", + "nodeType": "YulLiteral", + "src": "76:1:0", + "type": "", + "value": "0" + } + ], + "functionName": + { + "name": "add", + "nativeSrc": "69:3:0", + "nodeType": "YulIdentifier", + "src": "69:3:0" + }, + "nativeSrc": "69:9:0", + "nodeType": "YulFunctionCall", + "src": "69:9:0" + }, + { + "kind": "number", + "nativeSrc": "80:1:0", + "nodeType": "YulLiteral", + "src": "80:1:0", + "type": "", + "value": "0" + } + ], + "functionName": + { + "name": "sstore", + "nativeSrc": "62:6:0", + "nodeType": "YulIdentifier", + "src": "62:6:0" + }, + "nativeSrc": "62:20:0", + "nodeType": "YulFunctionCall", + "src": "62:20:0" + }, + "nativeSrc": "62:20:0", + "nodeType": "YulExpressionStatement", + "src": "62:20:0" + } + ] + }, + "nodeType": "YulCode" + }, + "name": "NamedObject", + "nodeType": "YulObject", + "subObjects": + [ + { + "nodeType": "YulData", + "value": "616263" + }, + { + "code": + { + "block": + { + "nativeSrc": "135:16:0", + "nodeType": "YulBlock", + "src": "135:16:0", + "statements": + [ + { + "expression": + { + "arguments": + [ + { + "kind": "number", + "nativeSrc": "144:1:0", + "nodeType": "YulLiteral", + "src": "144:1:0", + "type": "", + "value": "0" + }, + { + "kind": "number", + "nativeSrc": "147:1:0", + "nodeType": "YulLiteral", + "src": "147:1:0", + "type": "", + "value": "0" + } + ], + "functionName": + { + "name": "revert", + "nativeSrc": "137:6:0", + "nodeType": "YulIdentifier", + "src": "137:6:0" + }, + "nativeSrc": "137:12:0", + "nodeType": "YulFunctionCall", + "src": "137:12:0" + }, + "nativeSrc": "137:12:0", + "nodeType": "YulExpressionStatement", + "src": "137:12:0" + } + ] + }, + "nodeType": "YulCode" + }, + "name": "OtherObject", + "nodeType": "YulObject", + "subObjects": [] + } + ] + }, + "id": 1 + } } } diff --git a/test/cmdlineTests/standard_yul_optimiserSteps/output.json b/test/cmdlineTests/standard_yul_optimiserSteps/output.json index 7df2f7695237..54dd24ac6814 100644 --- a/test/cmdlineTests/standard_yul_optimiserSteps/output.json +++ b/test/cmdlineTests/standard_yul_optimiserSteps/output.json @@ -45,5 +45,128 @@ " } } + }, + "sources": + { + "A": + { + "ast": + { + "code": + { + "block": + { + "nativeSrc": "0:42:0", + "nodeType": "YulBlock", + "src": "0:42:0", + "statements": + [ + { + "nativeSrc": "2:17:0", + "nodeType": "YulVariableDeclaration", + "src": "2:17:0", + "value": + { + "arguments": + [ + { + "kind": "number", + "nativeSrc": "17:1:0", + "nodeType": "YulLiteral", + "src": "17:1:0", + "type": "", + "value": "0" + } + ], + "functionName": + { + "name": "mload", + "nativeSrc": "11:5:0", + "nodeType": "YulIdentifier", + "src": "11:5:0" + }, + "nativeSrc": "11:8:0", + "nodeType": "YulFunctionCall", + "src": "11:8:0" + }, + "variables": + [ + { + "name": "x", + "nativeSrc": "6:1:0", + "nodeType": "YulTypedName", + "src": "6:1:0", + "type": "" + } + ] + }, + { + "expression": + { + "arguments": + [ + { + "arguments": + [ + { + "name": "x", + "nativeSrc": "31:1:0", + "nodeType": "YulIdentifier", + "src": "31:1:0" + }, + { + "kind": "number", + "nativeSrc": "34:1:0", + "nodeType": "YulLiteral", + "src": "34:1:0", + "type": "", + "value": "0" + } + ], + "functionName": + { + "name": "add", + "nativeSrc": "27:3:0", + "nodeType": "YulIdentifier", + "src": "27:3:0" + }, + "nativeSrc": "27:9:0", + "nodeType": "YulFunctionCall", + "src": "27:9:0" + }, + { + "kind": "number", + "nativeSrc": "38:1:0", + "nodeType": "YulLiteral", + "src": "38:1:0", + "type": "", + "value": "0" + } + ], + "functionName": + { + "name": "sstore", + "nativeSrc": "20:6:0", + "nodeType": "YulIdentifier", + "src": "20:6:0" + }, + "nativeSrc": "20:20:0", + "nodeType": "YulFunctionCall", + "src": "20:20:0" + }, + "nativeSrc": "20:20:0", + "nodeType": "YulExpressionStatement", + "src": "20:20:0" + } + ] + }, + "nodeType": "YulCode" + }, + "name": "object", + "nodeType": "YulObject", + "subObjects": [] + }, + "id": 1 + } } } diff --git a/test/cmdlineTests/standard_yul_optimized/output.json b/test/cmdlineTests/standard_yul_optimized/output.json index f5524c6df750..b260f72edc66 100644 --- a/test/cmdlineTests/standard_yul_optimized/output.json +++ b/test/cmdlineTests/standard_yul_optimized/output.json @@ -40,5 +40,128 @@ " } } + }, + "sources": + { + "A": + { + "ast": + { + "code": + { + "block": + { + "nativeSrc": "0:42:0", + "nodeType": "YulBlock", + "src": "0:42:0", + "statements": + [ + { + "nativeSrc": "2:17:0", + "nodeType": "YulVariableDeclaration", + "src": "2:17:0", + "value": + { + "arguments": + [ + { + "kind": "number", + "nativeSrc": "17:1:0", + "nodeType": "YulLiteral", + "src": "17:1:0", + "type": "", + "value": "0" + } + ], + "functionName": + { + "name": "mload", + "nativeSrc": "11:5:0", + "nodeType": "YulIdentifier", + "src": "11:5:0" + }, + "nativeSrc": "11:8:0", + "nodeType": "YulFunctionCall", + "src": "11:8:0" + }, + "variables": + [ + { + "name": "x", + "nativeSrc": "6:1:0", + "nodeType": "YulTypedName", + "src": "6:1:0", + "type": "" + } + ] + }, + { + "expression": + { + "arguments": + [ + { + "arguments": + [ + { + "name": "x", + "nativeSrc": "31:1:0", + "nodeType": "YulIdentifier", + "src": "31:1:0" + }, + { + "kind": "number", + "nativeSrc": "34:1:0", + "nodeType": "YulLiteral", + "src": "34:1:0", + "type": "", + "value": "0" + } + ], + "functionName": + { + "name": "add", + "nativeSrc": "27:3:0", + "nodeType": "YulIdentifier", + "src": "27:3:0" + }, + "nativeSrc": "27:9:0", + "nodeType": "YulFunctionCall", + "src": "27:9:0" + }, + { + "kind": "number", + "nativeSrc": "38:1:0", + "nodeType": "YulLiteral", + "src": "38:1:0", + "type": "", + "value": "0" + } + ], + "functionName": + { + "name": "sstore", + "nativeSrc": "20:6:0", + "nodeType": "YulIdentifier", + "src": "20:6:0" + }, + "nativeSrc": "20:20:0", + "nodeType": "YulFunctionCall", + "src": "20:20:0" + }, + "nativeSrc": "20:20:0", + "nodeType": "YulExpressionStatement", + "src": "20:20:0" + } + ] + }, + "nodeType": "YulCode" + }, + "name": "object", + "nodeType": "YulObject", + "subObjects": [] + }, + "id": 1 + } } } diff --git a/test/cmdlineTests/stop_after_parsing_abi/args b/test/cmdlineTests/stop_after_parsing_abi/args new file mode 100644 index 000000000000..9ec9f63e43f1 --- /dev/null +++ b/test/cmdlineTests/stop_after_parsing_abi/args @@ -0,0 +1 @@ +--pretty-json --json-indent 4 --stop-after parsing --abi diff --git a/test/cmdlineTests/stop_after_parsing_abi/err b/test/cmdlineTests/stop_after_parsing_abi/err new file mode 100644 index 000000000000..9beceafe7b32 --- /dev/null +++ b/test/cmdlineTests/stop_after_parsing_abi/err @@ -0,0 +1 @@ +The following options are mutually exclusive: --stop-after, --abi. Select at most one. diff --git a/test/cmdlineTests/stop_after_parsing_abi/exit b/test/cmdlineTests/stop_after_parsing_abi/exit new file mode 100644 index 000000000000..d00491fd7e5b --- /dev/null +++ b/test/cmdlineTests/stop_after_parsing_abi/exit @@ -0,0 +1 @@ +1 diff --git a/test/cmdlineTests/stop_after_parsing_abi/input.sol b/test/cmdlineTests/stop_after_parsing_abi/input.sol new file mode 100644 index 000000000000..978517b3c23f --- /dev/null +++ b/test/cmdlineTests/stop_after_parsing_abi/input.sol @@ -0,0 +1,8 @@ +// SPDX-License-Identifier: GPL-3.0 +pragma solidity *; + +import "A"; + +contract C { + function f() public {} +} diff --git a/test/cmdlineTests/stop_after_parsing_ast/args b/test/cmdlineTests/stop_after_parsing_ast/args new file mode 100644 index 000000000000..72df9974ab43 --- /dev/null +++ b/test/cmdlineTests/stop_after_parsing_ast/args @@ -0,0 +1 @@ +--pretty-json --json-indent 4 --stop-after parsing --ast-compact-json diff --git a/test/cmdlineTests/stop_after_parsing_ast/input.sol b/test/cmdlineTests/stop_after_parsing_ast/input.sol new file mode 100644 index 000000000000..e78a24ff786e --- /dev/null +++ b/test/cmdlineTests/stop_after_parsing_ast/input.sol @@ -0,0 +1,6 @@ +// SPDX-License-Identifier: GPL-3.0 +pragma solidity *; + +import "A"; + +contract C {} diff --git a/test/cmdlineTests/stop_after_parsing_ast/output b/test/cmdlineTests/stop_after_parsing_ast/output new file mode 100644 index 000000000000..163941860401 --- /dev/null +++ b/test/cmdlineTests/stop_after_parsing_ast/output @@ -0,0 +1,48 @@ +JSON AST (compact format): + + +======= stop_after_parsing_ast/input.sol ======= +{ + "absolutePath": "stop_after_parsing_ast/input.sol", + "id": 4, + "license": "GPL-3.0", + "nodeType": "SourceUnit", + "nodes": + [ + { + "id": 1, + "literals": + [ + "solidity", + "*" + ], + "nodeType": "PragmaDirective", + "src": "36:18:0" + }, + { + "absolutePath": "A", + "file": "A", + "id": 2, + "nameLocation": "-1:-1:-1", + "nodeType": "ImportDirective", + "src": "56:11:0", + "symbolAliases": [], + "unitAlias": "" + }, + { + "abstract": false, + "baseContracts": [], + "contractDependencies": [], + "contractKind": "contract", + "id": 3, + "name": "C", + "nameLocation": "78:1:0", + "nodeType": "ContractDefinition", + "nodes": [], + "src": "69:13:0", + "usedErrors": [], + "usedEvents": [] + } + ], + "src": "36:47:0" +} diff --git a/test/cmdlineTests/strict_asm_ast_compact_json/args b/test/cmdlineTests/strict_asm_ast_compact_json/args new file mode 100644 index 000000000000..091ceb769aa2 --- /dev/null +++ b/test/cmdlineTests/strict_asm_ast_compact_json/args @@ -0,0 +1 @@ +--strict-assembly --ast-compact-json --pretty-json --json-indent 4 diff --git a/test/cmdlineTests/strict_asm_ast_compact_json/input.yul b/test/cmdlineTests/strict_asm_ast_compact_json/input.yul new file mode 100644 index 000000000000..6d1ebe21b989 --- /dev/null +++ b/test/cmdlineTests/strict_asm_ast_compact_json/input.yul @@ -0,0 +1,15 @@ +/// @use-src 0:"input.sol" +object "C_6_deployed" { + code { + /// @src 0:60:101 "contract C {..." + mstore(64, 128) + + // f() + fun_f_5() + + /// @src 0:77:99 "function f() public {}" + function fun_f_5() { + } + /// @src 0:60:101 "contract C {..." + } +} diff --git a/test/cmdlineTests/strict_asm_ast_compact_json/output b/test/cmdlineTests/strict_asm_ast_compact_json/output new file mode 100644 index 000000000000..98afddcfa9d7 --- /dev/null +++ b/test/cmdlineTests/strict_asm_ast_compact_json/output @@ -0,0 +1,67 @@ + +======= strict_asm_ast_compact_json/input.yul (EVM) ======= +AST: + +{ + "code": + { + "block": + { + "nativeSrc": "60:246:0", + "nodeType": "YulBlock", + "src": "-1:-1:0", + "statements": + [ + { + "nativeSrc": "60:246:0", + "nodeType": "YulBlock", + "src": "-1:-1:0", + "statements": + [ + { + "expression": + { + "arguments": + [ + { + "kind": "number", + "nativeSrc": "122:2:0", + "nodeType": "YulLiteral", + "src": "60:41:0", + "type": "", + "value": "64" + }, + { + "kind": "number", + "nativeSrc": "126:3:0", + "nodeType": "YulLiteral", + "src": "60:41:0", + "type": "", + "value": "128" + } + ], + "functionName": + { + "name": "mstore", + "nativeSrc": "115:6:0", + "nodeType": "YulIdentifier", + "src": "60:41:0" + }, + "nativeSrc": "115:15:0", + "nodeType": "YulFunctionCall", + "src": "60:41:0" + }, + "nativeSrc": "115:15:0", + "nodeType": "YulExpressionStatement", + "src": "60:41:0" + } + ] + } + ] + }, + "nodeType": "YulCode" + }, + "name": "C_6_deployed", + "nodeType": "YulObject", + "subObjects": [] +} diff --git a/test/cmdlineTests/strict_asm_debug_info_print_all/input.yul b/test/cmdlineTests/strict_asm_debug_info_print_all/input.yul index 6d1ebe21b989..aa564d00ce86 100644 --- a/test/cmdlineTests/strict_asm_debug_info_print_all/input.yul +++ b/test/cmdlineTests/strict_asm_debug_info_print_all/input.yul @@ -9,6 +9,7 @@ object "C_6_deployed" { /// @src 0:77:99 "function f() public {}" function fun_f_5() { + sstore(0, 42) } /// @src 0:60:101 "contract C {..." } diff --git a/test/cmdlineTests/strict_asm_debug_info_print_all/output b/test/cmdlineTests/strict_asm_debug_info_print_all/output index e83614b62ac0..0e58baf578e6 100644 --- a/test/cmdlineTests/strict_asm_debug_info_print_all/output +++ b/test/cmdlineTests/strict_asm_debug_info_print_all/output @@ -5,18 +5,20 @@ Pretty printed source: /// @use-src 0:"input.sol" object "C_6_deployed" { code { - /// @src 0:60:101 - mstore(64, 128) - fun_f_5() + { + /// @src 0:60:101 + mstore(64, 128) + fun_f() + } /// @src 0:77:99 - function fun_f_5() - { } + function fun_f() + { sstore(0, 42) } } } Binary representation: -6080604052600a600e565b6010565b565b +6080604052600a600c565b005b602a5f5556 Text representation: /* "input.sol":60:101 */ @@ -25,8 +27,8 @@ Text representation: tag_1 jump // in tag_2: + stop /* "input.sol":77:99 */ - jump(tag_3) tag_1: + sstore(0x00, 0x2a) jump // out -tag_3: diff --git a/test/cmdlineTests/strict_asm_debug_info_print_location_only/input.yul b/test/cmdlineTests/strict_asm_debug_info_print_location_only/input.yul index 6d1ebe21b989..aa564d00ce86 100644 --- a/test/cmdlineTests/strict_asm_debug_info_print_location_only/input.yul +++ b/test/cmdlineTests/strict_asm_debug_info_print_location_only/input.yul @@ -9,6 +9,7 @@ object "C_6_deployed" { /// @src 0:77:99 "function f() public {}" function fun_f_5() { + sstore(0, 42) } /// @src 0:60:101 "contract C {..." } diff --git a/test/cmdlineTests/strict_asm_debug_info_print_location_only/output b/test/cmdlineTests/strict_asm_debug_info_print_location_only/output index a4fd0e4940ed..17d2f50e2e15 100644 --- a/test/cmdlineTests/strict_asm_debug_info_print_location_only/output +++ b/test/cmdlineTests/strict_asm_debug_info_print_location_only/output @@ -5,18 +5,20 @@ Pretty printed source: /// @use-src 0:"input.sol" object "C_6_deployed" { code { - /// @src 0:60:101 - mstore(64, 128) - fun_f_5() + { + /// @src 0:60:101 + mstore(64, 128) + fun_f() + } /// @src 0:77:99 - function fun_f_5() - { } + function fun_f() + { sstore(0, 42) } } } Binary representation: -6080604052600a600e565b6010565b565b +6080604052600a600c565b005b602a5f5556 Text representation: /* "input.sol":60:101 */ @@ -25,8 +27,8 @@ Text representation: tag_1 jump // in tag_2: + stop /* "input.sol":77:99 */ - jump(tag_3) tag_1: + sstore(0x00, 0x2a) jump // out -tag_3: diff --git a/test/cmdlineTests/strict_asm_debug_info_print_none/input.yul b/test/cmdlineTests/strict_asm_debug_info_print_none/input.yul index 6d1ebe21b989..aa564d00ce86 100644 --- a/test/cmdlineTests/strict_asm_debug_info_print_none/input.yul +++ b/test/cmdlineTests/strict_asm_debug_info_print_none/input.yul @@ -9,6 +9,7 @@ object "C_6_deployed" { /// @src 0:77:99 "function f() public {}" function fun_f_5() { + sstore(0, 42) } /// @src 0:60:101 "contract C {..." } diff --git a/test/cmdlineTests/strict_asm_debug_info_print_none/output b/test/cmdlineTests/strict_asm_debug_info_print_none/output index fc8841c9a843..51f779490ab7 100644 --- a/test/cmdlineTests/strict_asm_debug_info_print_none/output +++ b/test/cmdlineTests/strict_asm_debug_info_print_none/output @@ -5,16 +5,18 @@ Pretty printed source: /// @use-src 0:"input.sol" object "C_6_deployed" { code { - mstore(64, 128) - fun_f_5() - function fun_f_5() - { } + { + mstore(64, 128) + fun_f() + } + function fun_f() + { sstore(0, 42) } } } Binary representation: -6080604052600a600e565b6010565b565b +6080604052600a600c565b005b602a5f5556 Text representation: mstore(0x40, 0x80) @@ -22,7 +24,7 @@ Text representation: tag_1 jump // in tag_2: - jump(tag_3) + stop tag_1: + sstore(0x00, 0x2a) jump // out -tag_3: diff --git a/test/cmdlineTests/strict_asm_debug_info_print_snippet_only/input.yul b/test/cmdlineTests/strict_asm_debug_info_print_snippet_only/input.yul index 6d1ebe21b989..aa564d00ce86 100644 --- a/test/cmdlineTests/strict_asm_debug_info_print_snippet_only/input.yul +++ b/test/cmdlineTests/strict_asm_debug_info_print_snippet_only/input.yul @@ -9,6 +9,7 @@ object "C_6_deployed" { /// @src 0:77:99 "function f() public {}" function fun_f_5() { + sstore(0, 42) } /// @src 0:60:101 "contract C {..." } diff --git a/test/cmdlineTests/strict_asm_invalid_option_optimize_yul/args b/test/cmdlineTests/strict_asm_invalid_option_optimize_yul/args deleted file mode 100644 index 827d998294b2..000000000000 --- a/test/cmdlineTests/strict_asm_invalid_option_optimize_yul/args +++ /dev/null @@ -1 +0,0 @@ ---strict-assembly --optimize-yul diff --git a/test/cmdlineTests/strict_asm_invalid_option_optimize_yul/err b/test/cmdlineTests/strict_asm_invalid_option_optimize_yul/err deleted file mode 100644 index a6378a665ec1..000000000000 --- a/test/cmdlineTests/strict_asm_invalid_option_optimize_yul/err +++ /dev/null @@ -1 +0,0 @@ -The following options are invalid in assembly mode: --optimize-yul. Optimization is disabled by default and can be enabled with --optimize. diff --git a/test/cmdlineTests/strict_asm_invalid_option_optimize_yul/input.yul b/test/cmdlineTests/strict_asm_invalid_option_optimize_yul/input.yul deleted file mode 100644 index f21cd2b7e038..000000000000 --- a/test/cmdlineTests/strict_asm_invalid_option_optimize_yul/input.yul +++ /dev/null @@ -1,3 +0,0 @@ -{ - sstore(0, 1) -} diff --git a/test/cmdlineTests/strict_asm_msize_with_optimizer/args b/test/cmdlineTests/strict_asm_msize_with_optimizer/args new file mode 100644 index 000000000000..f1cb61514f3b --- /dev/null +++ b/test/cmdlineTests/strict_asm_msize_with_optimizer/args @@ -0,0 +1 @@ +--strict-assembly --debug-info none --optimize diff --git a/test/cmdlineTests/strict_asm_msize_with_optimizer/input.yul b/test/cmdlineTests/strict_asm_msize_with_optimizer/input.yul new file mode 100644 index 000000000000..ccff7a32f45b --- /dev/null +++ b/test/cmdlineTests/strict_asm_msize_with_optimizer/input.yul @@ -0,0 +1,13 @@ +{ + function f() -> x { + x := mload(0) + } + + // In pure Yul optimization in presence of msize is allowed. + // Everything in this file should get optimized out. + pop(msize()) + + let x := 0 + let y := x + mstore(0, f()) +} diff --git a/test/cmdlineTests/strict_asm_msize_with_optimizer/output b/test/cmdlineTests/strict_asm_msize_with_optimizer/output new file mode 100644 index 000000000000..fbc1e69fac24 --- /dev/null +++ b/test/cmdlineTests/strict_asm_msize_with_optimizer/output @@ -0,0 +1,14 @@ + +======= strict_asm_msize_with_optimizer/input.yul (EVM) ======= + +Pretty printed source: +object "object" { + code { { } } +} + + +Binary representation: +00 + +Text representation: + stop diff --git a/test/cmdlineTests/strict_asm_msize_without_optimizer/args b/test/cmdlineTests/strict_asm_msize_without_optimizer/args new file mode 100644 index 000000000000..7e891dd86b95 --- /dev/null +++ b/test/cmdlineTests/strict_asm_msize_without_optimizer/args @@ -0,0 +1 @@ +--strict-assembly --debug-info none diff --git a/test/cmdlineTests/strict_asm_msize_without_optimizer/input.yul b/test/cmdlineTests/strict_asm_msize_without_optimizer/input.yul new file mode 100644 index 000000000000..e787c40097c2 --- /dev/null +++ b/test/cmdlineTests/strict_asm_msize_without_optimizer/input.yul @@ -0,0 +1,13 @@ +{ + function f() -> x { + x := mload(0) + } + + // In pure Yul without optimizer presence of msize disables stack optimization. + // This file should remain untouched when passed through the optimizer. + pop(msize()) + + let x := 0 + let y := x + mstore(0, f()) +} diff --git a/test/cmdlineTests/strict_asm_msize_without_optimizer/output b/test/cmdlineTests/strict_asm_msize_without_optimizer/output new file mode 100644 index 000000000000..fabd2e874a5b --- /dev/null +++ b/test/cmdlineTests/strict_asm_msize_without_optimizer/output @@ -0,0 +1,40 @@ + +======= strict_asm_msize_without_optimizer/input.yul (EVM) ======= + +Pretty printed source: +object "object" { + code { + function f() -> x + { x := mload(0) } + pop(msize()) + let x := 0 + let y := x + mstore(0, f()) + } +} + + +Binary representation: +600b565b5f8051905090565b5f8060136003565b5f525050 + +Text representation: + jump(tag_2) +tag_1: + 0x00 + dup1 + mload + swap1 + pop + swap1 + jump // out +tag_2: + 0x00 + dup1 + tag_4 + tag_1 + jump // in +tag_4: + 0x00 + mstore + pop + pop diff --git a/test/cmdlineTests/strict_asm_optimizer_invalid_yul_optimizer_enabled_and_disabled/args b/test/cmdlineTests/strict_asm_optimizer_invalid_yul_optimizer_enabled_and_disabled/args new file mode 100644 index 000000000000..cbefff3e9bf3 --- /dev/null +++ b/test/cmdlineTests/strict_asm_optimizer_invalid_yul_optimizer_enabled_and_disabled/args @@ -0,0 +1 @@ +--strict-assembly --optimize-yul --no-optimize-yul diff --git a/test/cmdlineTests/strict_asm_optimizer_invalid_yul_optimizer_enabled_and_disabled/err b/test/cmdlineTests/strict_asm_optimizer_invalid_yul_optimizer_enabled_and_disabled/err new file mode 100644 index 000000000000..43c54c2f3934 --- /dev/null +++ b/test/cmdlineTests/strict_asm_optimizer_invalid_yul_optimizer_enabled_and_disabled/err @@ -0,0 +1 @@ +Options --optimize-yul and --no-optimize-yul cannot be used together. diff --git a/test/cmdlineTests/strict_asm_optimizer_invalid_yul_optimizer_enabled_and_disabled/exit b/test/cmdlineTests/strict_asm_optimizer_invalid_yul_optimizer_enabled_and_disabled/exit new file mode 100644 index 000000000000..d00491fd7e5b --- /dev/null +++ b/test/cmdlineTests/strict_asm_optimizer_invalid_yul_optimizer_enabled_and_disabled/exit @@ -0,0 +1 @@ +1 diff --git a/test/cmdlineTests/strict_asm_optimizer_invalid_yul_optimizer_enabled_and_disabled/input.yul b/test/cmdlineTests/strict_asm_optimizer_invalid_yul_optimizer_enabled_and_disabled/input.yul new file mode 100644 index 000000000000..0967ef424bce --- /dev/null +++ b/test/cmdlineTests/strict_asm_optimizer_invalid_yul_optimizer_enabled_and_disabled/input.yul @@ -0,0 +1 @@ +{} diff --git a/test/cmdlineTests/strict_asm_options_in_non_asm_mode/args b/test/cmdlineTests/strict_asm_options_in_non_asm_mode/args index 6f9a273ab6a0..9efe91f61f29 100644 --- a/test/cmdlineTests/strict_asm_options_in_non_asm_mode/args +++ b/test/cmdlineTests/strict_asm_options_in_non_asm_mode/args @@ -1 +1 @@ ---yul-dialect evm --machine ewasm +--yul-dialect evm --machine evm diff --git a/test/cmdlineTests/strict_asm_output_selection_ewasm_ir_only/args b/test/cmdlineTests/strict_asm_output_selection_ewasm_ir_only/args deleted file mode 100644 index 647c63654cfa..000000000000 --- a/test/cmdlineTests/strict_asm_output_selection_ewasm_ir_only/args +++ /dev/null @@ -1 +0,0 @@ ---strict-assembly --optimize --ewasm-ir diff --git a/test/cmdlineTests/strict_asm_output_selection_ewasm_ir_only/input.yul b/test/cmdlineTests/strict_asm_output_selection_ewasm_ir_only/input.yul deleted file mode 100644 index 4fa5ef66f8da..000000000000 --- a/test/cmdlineTests/strict_asm_output_selection_ewasm_ir_only/input.yul +++ /dev/null @@ -1,4 +0,0 @@ -{ - let x := 42 - sstore(0, x) -} diff --git a/test/cmdlineTests/strict_asm_output_selection_ewasm_ir_only/output b/test/cmdlineTests/strict_asm_output_selection_ewasm_ir_only/output deleted file mode 100644 index 8026a6e83e85..000000000000 --- a/test/cmdlineTests/strict_asm_output_selection_ewasm_ir_only/output +++ /dev/null @@ -1,2 +0,0 @@ - -======= strict_asm_output_selection_ewasm_ir_only/input.yul (EVM) ======= diff --git a/test/cmdlineTests/strict_asm_output_selection_ewasm_only/args b/test/cmdlineTests/strict_asm_output_selection_ewasm_only/args deleted file mode 100644 index bb147ae337d9..000000000000 --- a/test/cmdlineTests/strict_asm_output_selection_ewasm_only/args +++ /dev/null @@ -1 +0,0 @@ ---strict-assembly --optimize --ewasm diff --git a/test/cmdlineTests/strict_asm_output_selection_ewasm_only/input.yul b/test/cmdlineTests/strict_asm_output_selection_ewasm_only/input.yul deleted file mode 100644 index 4fa5ef66f8da..000000000000 --- a/test/cmdlineTests/strict_asm_output_selection_ewasm_only/input.yul +++ /dev/null @@ -1,4 +0,0 @@ -{ - let x := 42 - sstore(0, x) -} diff --git a/test/cmdlineTests/strict_asm_output_selection_ewasm_only/output b/test/cmdlineTests/strict_asm_output_selection_ewasm_only/output deleted file mode 100644 index f90f049aaa49..000000000000 --- a/test/cmdlineTests/strict_asm_output_selection_ewasm_only/output +++ /dev/null @@ -1,2 +0,0 @@ - -======= strict_asm_output_selection_ewasm_only/input.yul (EVM) ======= diff --git a/test/cmdlineTests/strict_asm_output_selection_invalid/args b/test/cmdlineTests/strict_asm_output_selection_invalid/args index 85814eb29b53..daeb64aae98b 100644 --- a/test/cmdlineTests/strict_asm_output_selection_invalid/args +++ b/test/cmdlineTests/strict_asm_output_selection_invalid/args @@ -1 +1 @@ ---strict-assembly --asm --asm-json --opcodes --bin --bin-runtime --abi --ir --ir-optimized --ewasm --hashes --userdoc --devdoc --metadata --storage-layout +--strict-assembly --asm --asm-json --opcodes --bin --bin-runtime --abi --ir --ir-optimized --hashes --userdoc --devdoc --metadata --storage-layout diff --git a/test/cmdlineTests/viair_msize_without_optimizer/args b/test/cmdlineTests/viair_msize_without_optimizer/args new file mode 100644 index 000000000000..3b9da15f9798 --- /dev/null +++ b/test/cmdlineTests/viair_msize_without_optimizer/args @@ -0,0 +1 @@ +--via-ir --ir-optimized --asm --debug-info none diff --git a/test/cmdlineTests/viair_msize_without_optimizer/input.sol b/test/cmdlineTests/viair_msize_without_optimizer/input.sol new file mode 100644 index 000000000000..e70ba17fb224 --- /dev/null +++ b/test/cmdlineTests/viair_msize_without_optimizer/input.sol @@ -0,0 +1,21 @@ +// SPDX-License-Identifier: GPL-3.0 +pragma solidity *; + +contract C { + function f() pure public { + assembly ("memory-safe") { + function f() -> x { + x := mload(0) + } + + // Presence of msize disables all Yul optimizations, including the minimal steps or + // stack optimization that would normally be performed even with the optimizer nominally disabled. + // This block should remain untouched when passed through the optimizer. + pop(msize()) + + let x := 0 + let y := x + mstore(0, f()) + } + } +} diff --git a/test/cmdlineTests/viair_msize_without_optimizer/output b/test/cmdlineTests/viair_msize_without_optimizer/output new file mode 100644 index 000000000000..b54f8a3f5647 --- /dev/null +++ b/test/cmdlineTests/viair_msize_without_optimizer/output @@ -0,0 +1,261 @@ + +======= viair_msize_without_optimizer/input.sol:C ======= +EVM assembly: + mstore(0x40, 0x80) + jumpi(tag_4, iszero(callvalue)) + tag_5 + tag_2 + jump // in +tag_5: +tag_4: + tag_6 + tag_3 + jump // in +tag_6: + tag_7 + tag_1 + jump // in +tag_7: + dataSize(sub_0) + dataOffset(sub_0) + dup3 + codecopy + dataSize(sub_0) + dup2 + return +tag_1: + 0x00 + mload(0x40) + swap1 + pop + swap1 + jump // out +tag_2: + 0x00 + dup1 + revert +tag_3: + jump // out +stop + +sub_0: assembly { + mstore(0x40, 0x80) + jumpi(tag_10, lt(calldatasize, 0x04)) + tag_11 + calldataload(0x00) + tag_1 + jump // in + tag_11: + dup1 + 0x26121ff0 + dup2 + sub + tag_12 + jumpi + tag_14 + tag_7 + jump // in + tag_14: + tag_12: + pop + pop + tag_10: + tag_15 + tag_8 + jump // in + tag_15: + jump(tag_16) + tag_1: + 0x00 + dup2 + 0xe0 + shr + swap1 + pop + swap2 + swap1 + pop + jump // out + tag_2: + 0x00 + mload(0x40) + swap1 + pop + swap1 + jump // out + tag_3: + 0x00 + dup1 + revert + tag_4: + 0x00 + dup1 + revert + tag_5: + 0x00 + dup2 + dup4 + sub + slt + iszero + tag_22 + jumpi + tag_23 + tag_4 + jump // in + tag_23: + tag_22: + pop + pop + jump // out + tag_6: + 0x00 + dup1 + dup3 + add + swap1 + pop + swap2 + swap1 + pop + jump // out + tag_7: + jumpi(tag_26, iszero(callvalue)) + tag_27 + tag_3 + jump // in + tag_27: + tag_26: + tag_28 + calldatasize + 0x04 + tag_5 + jump // in + tag_28: + tag_29 + tag_9 + jump // in + tag_29: + tag_30 + tag_2 + jump // in + tag_30: + tag_31 + dup2 + tag_6 + jump // in + tag_31: + dup2 + dup2 + sub + dup3 + return + tag_8: + 0x00 + dup1 + revert + tag_9: + jump(tag_35) + tag_34: + 0x00 + dup1 + mload + swap1 + pop + swap1 + jump // out + tag_35: + 0x00 + dup1 + tag_37 + tag_34 + jump // in + tag_37: + 0x00 + mstore + pop + pop + jump // out + tag_16: + + auxdata: +} + +Optimized IR: +/// @use-src 0:"viair_msize_without_optimizer/input.sol" +object "C_7" { + code { + mstore(64, memoryguard(128)) + if callvalue() + { + revert_error_ca66f745a3ce8ff40e2ccaf1ad45db7774001b90d25810abd9040049be7bf4bb() + } + constructor_C_7() + let _1 := allocate_unbounded() + codecopy(_1, dataoffset("C_7_deployed"), datasize("C_7_deployed")) + return(_1, datasize("C_7_deployed")) + function allocate_unbounded() -> memPtr + { memPtr := mload(64) } + function revert_error_ca66f745a3ce8ff40e2ccaf1ad45db7774001b90d25810abd9040049be7bf4bb() + { revert(0, 0) } + function constructor_C_7() + { } + } + /// @use-src 0:"viair_msize_without_optimizer/input.sol" + object "C_7_deployed" { + code { + mstore(64, memoryguard(128)) + if iszero(lt(calldatasize(), 4)) + { + let selector := shift_right_224_unsigned(calldataload(0)) + switch selector + case 0x26121ff0 { external_fun_f_6() } + default { } + } + revert_error_42b3090547df1d2001c96683413b8cf91c1b902ef5e3cb8d9f6f304cf7446f74() + function shift_right_224_unsigned(value) -> newValue + { newValue := shr(224, value) } + function allocate_unbounded() -> memPtr + { memPtr := mload(64) } + function revert_error_ca66f745a3ce8ff40e2ccaf1ad45db7774001b90d25810abd9040049be7bf4bb() + { revert(0, 0) } + function revert_error_dbdddcbe895c83990c08b3492a0e83918d802a52331272ac6fdb6a7c4aea3b1b() + { revert(0, 0) } + function abi_decode_tuple_(headStart, dataEnd) + { + if slt(sub(dataEnd, headStart), 0) + { + revert_error_dbdddcbe895c83990c08b3492a0e83918d802a52331272ac6fdb6a7c4aea3b1b() + } + } + function abi_encode_tuple__to__fromStack(headStart) -> tail + { tail := add(headStart, 0) } + function external_fun_f_6() + { + if callvalue() + { + revert_error_ca66f745a3ce8ff40e2ccaf1ad45db7774001b90d25810abd9040049be7bf4bb() + } + abi_decode_tuple_(4, calldatasize()) + fun_f_6() + let memPos := allocate_unbounded() + let memEnd := abi_encode_tuple__to__fromStack(memPos) + return(memPos, sub(memEnd, memPos)) + } + function revert_error_42b3090547df1d2001c96683413b8cf91c1b902ef5e3cb8d9f6f304cf7446f74() + { revert(0, 0) } + function fun_f_6() + { + { + function usr$f() -> usr$x + { usr$x := mload(0) } + pop(msize()) + let usr$x := 0 + let usr$y := usr$x + mstore(0, usr$f()) + } + } + } + data ".metadata" hex"" + } +} diff --git a/test/cmdlineTests/wasm_to_wasm_function_returning_multiple_values/args b/test/cmdlineTests/wasm_to_wasm_function_returning_multiple_values/args deleted file mode 100644 index 04cd5f05ba49..000000000000 --- a/test/cmdlineTests/wasm_to_wasm_function_returning_multiple_values/args +++ /dev/null @@ -1 +0,0 @@ ---yul --yul-dialect ewasm --machine ewasm diff --git a/test/cmdlineTests/wasm_to_wasm_function_returning_multiple_values/input.yul b/test/cmdlineTests/wasm_to_wasm_function_returning_multiple_values/input.yul deleted file mode 100644 index 2b1a6d9606c0..000000000000 --- a/test/cmdlineTests/wasm_to_wasm_function_returning_multiple_values/input.yul +++ /dev/null @@ -1,17 +0,0 @@ -object "object" { - code { - function main() - { - let m:i64, n:i32, p:i32, q:i64 := multireturn(1:i32, 2:i64, 3:i64, 4:i32) - } - - function multireturn(a:i32, b:i64, c:i64, d:i32) -> x:i64, y:i32, z:i32, w:i64 - { - x := b - w := c - - y := a - z := d - } - } -} diff --git a/test/cmdlineTests/wasm_to_wasm_function_returning_multiple_values/output b/test/cmdlineTests/wasm_to_wasm_function_returning_multiple_values/output deleted file mode 100644 index 4a3ef4eba760..000000000000 --- a/test/cmdlineTests/wasm_to_wasm_function_returning_multiple_values/output +++ /dev/null @@ -1,73 +0,0 @@ - -======= wasm_to_wasm_function_returning_multiple_values/input.yul (Ewasm) ======= - -Pretty printed source: -object "object" { - code { - function main() - { - let m, n:i32, p:i32, q := multireturn(1:i32, 2, 3, 4:i32) - } - function multireturn(a:i32, b, c, d:i32) -> x, y:i32, z:i32, w - { - x := b - w := c - y := a - z := d - } - } -} - - -Binary representation: -0061736d01000000010c0260000060047f7e7e7f017e020100030302000105030100010610037f0141000b7f0141000b7e0142000b071102066d656d6f72790200046d61696e00000a52022603017e027f017e024002404101420242034104100121002300210123012102230221030b0b0b2903017e027f017e0240200121042002210720002105200321060b20052400200624012007240220040b - -Text representation: -(module - (memory $memory (export "memory") 1) - (export "main" (func $main)) - (global $global_ (mut i32) (i32.const 0)) - (global $global__1 (mut i32) (i32.const 0)) - (global $global__2 (mut i64) (i64.const 0)) - -(func $main - (local $m i64) - (local $n i32) - (local $p i32) - (local $q i64) - (block $label_ - (block - (local.set $m (call $multireturn (i32.const 1) (i64.const 2) (i64.const 3) (i32.const 4))) - (local.set $n (global.get $global_)) - (local.set $p (global.get $global__1)) - (local.set $q (global.get $global__2)) - - ) - - ) -) - -(func $multireturn - (param $a i32) - (param $b i64) - (param $c i64) - (param $d i32) - (result i64) - (local $x i64) - (local $y i32) - (local $z i32) - (local $w i64) - (block $label__3 - (local.set $x (local.get $b)) - (local.set $w (local.get $c)) - (local.set $y (local.get $a)) - (local.set $z (local.get $d)) - - ) - (global.set $global_ (local.get $y)) - (global.set $global__1 (local.get $z)) - (global.set $global__2 (local.get $w)) - (local.get $x) -) - -) diff --git a/test/cmdlineTests/wasm_to_wasm_memory_instructions_alignment/args b/test/cmdlineTests/wasm_to_wasm_memory_instructions_alignment/args deleted file mode 100644 index 04cd5f05ba49..000000000000 --- a/test/cmdlineTests/wasm_to_wasm_memory_instructions_alignment/args +++ /dev/null @@ -1 +0,0 @@ ---yul --yul-dialect ewasm --machine ewasm diff --git a/test/cmdlineTests/wasm_to_wasm_memory_instructions_alignment/input.yul b/test/cmdlineTests/wasm_to_wasm_memory_instructions_alignment/input.yul deleted file mode 100644 index 731e6c9bb21a..000000000000 --- a/test/cmdlineTests/wasm_to_wasm_memory_instructions_alignment/input.yul +++ /dev/null @@ -1,8 +0,0 @@ -object "object" { - code { - function main() - { - i64.store8(0x01:i32, 42:i64) - } - } -} diff --git a/test/cmdlineTests/wasm_to_wasm_memory_instructions_alignment/output b/test/cmdlineTests/wasm_to_wasm_memory_instructions_alignment/output deleted file mode 100644 index e0cc44e57771..000000000000 --- a/test/cmdlineTests/wasm_to_wasm_memory_instructions_alignment/output +++ /dev/null @@ -1,27 +0,0 @@ - -======= wasm_to_wasm_memory_instructions_alignment/input.yul (Ewasm) ======= - -Pretty printed source: -object "object" { - code { - function main() - { i64.store8(0x01:i32, 42) } - } -} - - -Binary representation: -0061736d01000000010401600000020100030201000503010001060100071102066d656d6f72790200046d61696e00000a0e010c0002404101422a3c00000b0b - -Text representation: -(module - (memory $memory (export "memory") 1) - (export "main" (func $main)) - -(func $main - (block $label_ - (i64.store8 (i32.const 1) (i64.const 42)) - ) -) - -) diff --git a/test/cmdlineTests/yul_function_name_clashes/output b/test/cmdlineTests/yul_function_name_clashes/output index cfbb96bfa842..2c54b6f50893 100644 --- a/test/cmdlineTests/yul_function_name_clashes/output +++ b/test/cmdlineTests/yul_function_name_clashes/output @@ -4,63 +4,43 @@ Pretty printed source: object "object" { code { - let a - let b { - function z() -> y - { y := calldataload(0) } + let a + let b a := z() + b := z_1() + sstore(a, b) } - { - function z() -> y - { y := calldataload(0x20) } - b := z() - } - sstore(a, b) + function z() -> y + { y := calldataload(0) } + function z_1() -> y + { y := calldataload(0x20) } } } Binary representation: -5f80600d565b5f8035905090565b60136005565b91506022565b5f602035905090565b60286019565b90508082555050 +6005600f565b600b6014565b9055005b5f3590565b6020359056 Text representation: - 0x00 - dup1 - jump(tag_2) + tag_3 + tag_1 + jump // in +tag_3: + tag_4 + tag_2 + jump // in +tag_4: + swap1 + sstore + stop tag_1: 0x00 - dup1 calldataload swap1 - pop - swap1 jump // out tag_2: - tag_4 - tag_1 - jump // in -tag_4: - swap2 - pop - jump(tag_6) -tag_5: - 0x00 0x20 calldataload swap1 - pop - swap1 jump // out -tag_6: - tag_8 - tag_5 - jump // in -tag_8: - swap1 - pop - dup1 - dup3 - sstore - pop - pop diff --git a/test/cmdlineTests/yul_function_name_clashes_different_params/output b/test/cmdlineTests/yul_function_name_clashes_different_params/output index cd0dce30c479..22cee64c1f48 100644 --- a/test/cmdlineTests/yul_function_name_clashes_different_params/output +++ b/test/cmdlineTests/yul_function_name_clashes_different_params/output @@ -4,90 +4,56 @@ Pretty printed source: object "object" { code { - let a - let b { - function z() -> y - { y := calldataload(0) } + let a + let b a := z() + b := z_1(0x70) + sstore(a, b) } - { - function z(r) -> y - { y := calldataload(r) } - b := z(0x70) - } - sstore(a, b) + function z() -> y + { y := calldataload(0) } + function z_1(r) -> y + { y := calldataload(r) } } } Binary representation: -5f80600d565b5f8035905090565b60136005565b91506023565b5f81359050919050565b602b60706019565b90508082555050 +60056011565b600d60706016565b9055005b5f3590565b359056 Text representation: - /* "yul_function_name_clashes_different_params/input.yul":37:42 */ - 0x00 - /* "yul_function_name_clashes_different_params/input.yul":51:56 */ - dup1 + /* "yul_function_name_clashes_different_params/input.yul":151:154 */ + tag_3 + tag_1 + jump // in +tag_3: + /* "yul_function_name_clashes_different_params/input.yul":260:267 */ + tag_4 + /* "yul_function_name_clashes_different_params/input.yul":262:266 */ + 0x70 + /* "yul_function_name_clashes_different_params/input.yul":260:267 */ + tag_2 + jump // in +tag_4: + /* "yul_function_name_clashes_different_params/input.yul":286:298 */ + swap1 + sstore + /* "yul_function_name_clashes_different_params/input.yul":27:304 */ + stop /* "yul_function_name_clashes_different_params/input.yul":79:133 */ - jump(tag_2) tag_1: - /* "yul_function_name_clashes_different_params/input.yul":95:96 */ - 0x00 /* "yul_function_name_clashes_different_params/input.yul":129:130 */ - dup1 + 0x00 /* "yul_function_name_clashes_different_params/input.yul":116:131 */ calldataload - /* "yul_function_name_clashes_different_params/input.yul":111:131 */ - swap1 - pop /* "yul_function_name_clashes_different_params/input.yul":79:133 */ swap1 jump // out -tag_2: - /* "yul_function_name_clashes_different_params/input.yul":151:154 */ - tag_4 - tag_1 - jump // in -tag_4: - /* "yul_function_name_clashes_different_params/input.yul":146:154 */ - swap2 - pop /* "yul_function_name_clashes_different_params/input.yul":187:242 */ - jump(tag_6) -tag_5: - /* "yul_function_name_clashes_different_params/input.yul":204:205 */ - 0x00 - /* "yul_function_name_clashes_different_params/input.yul":238:239 */ - dup2 +tag_2: /* "yul_function_name_clashes_different_params/input.yul":225:240 */ calldataload - /* "yul_function_name_clashes_different_params/input.yul":220:240 */ - swap1 - pop /* "yul_function_name_clashes_different_params/input.yul":187:242 */ - swap2 swap1 - pop jump // out -tag_6: - /* "yul_function_name_clashes_different_params/input.yul":260:267 */ - tag_8 - /* "yul_function_name_clashes_different_params/input.yul":262:266 */ - 0x70 - /* "yul_function_name_clashes_different_params/input.yul":260:267 */ - tag_5 - jump // in -tag_8: - /* "yul_function_name_clashes_different_params/input.yul":255:267 */ - swap1 - pop - /* "yul_function_name_clashes_different_params/input.yul":296:297 */ - dup1 - /* "yul_function_name_clashes_different_params/input.yul":293:294 */ - dup3 - /* "yul_function_name_clashes_different_params/input.yul":286:298 */ - sstore - /* "yul_function_name_clashes_different_params/input.yul":27:304 */ - pop - pop diff --git a/test/cmdlineTests/yul_to_wasm_source_location_crash/args b/test/cmdlineTests/yul_to_wasm_source_location_crash/args deleted file mode 100644 index 254a1883c133..000000000000 --- a/test/cmdlineTests/yul_to_wasm_source_location_crash/args +++ /dev/null @@ -1 +0,0 @@ ---strict-assembly --yul-dialect evm --machine ewasm --optimize --ewasm-ir diff --git a/test/cmdlineTests/yul_to_wasm_source_location_crash/input.yul b/test/cmdlineTests/yul_to_wasm_source_location_crash/input.yul deleted file mode 100644 index 89e060931b95..000000000000 --- a/test/cmdlineTests/yul_to_wasm_source_location_crash/input.yul +++ /dev/null @@ -1,4 +0,0 @@ -/// @use-src 0:"test.sol" -object "C" { - code { sstore(0,0) } -} diff --git a/test/cmdlineTests/yul_to_wasm_source_location_crash/output b/test/cmdlineTests/yul_to_wasm_source_location_crash/output deleted file mode 100644 index 29ff631aa52a..000000000000 --- a/test/cmdlineTests/yul_to_wasm_source_location_crash/output +++ /dev/null @@ -1,34 +0,0 @@ - -======= yul_to_wasm_source_location_crash/input.yul (Ewasm) ======= - -========================== - -Translated source: -/// @use-src 0:"test.sol" -object "C" { - code { - function main() - { - let hi := i64.shl(i64.extend_i32_u(bswap32(i32.wrap_i64(0))), 32) - let y := i64.or(hi, i64.extend_i32_u(bswap32(i32.wrap_i64(i64.shr_u(0, 32))))) - i64.store(0:i32, y) - i64.store(i32.add(0:i32, 8:i32), y) - i64.store(i32.add(0:i32, 16:i32), y) - i64.store(i32.add(0:i32, 24:i32), y) - i64.store(32:i32, y) - i64.store(i32.add(32:i32, 8:i32), y) - i64.store(i32.add(32:i32, 16:i32), y) - i64.store(i32.add(32:i32, 24:i32), y) - eth.storageStore(0:i32, 32:i32) - } - function bswap16(x:i32) -> y:i32 - { - y := i32.or(i32.and(i32.shl(x, 8:i32), 0xff00:i32), i32.and(i32.shr_u(x, 8:i32), 0xff:i32)) - } - function bswap32(x:i32) -> y:i32 - { - let hi:i32 := i32.shl(bswap16(x), 16:i32) - y := i32.or(hi, bswap16(i32.shr_u(x, 16:i32))) - } - } -} diff --git a/test/cmdlineTests/~assembler_modes/test.sh b/test/cmdlineTests/~assembler_modes/test.sh new file mode 100755 index 000000000000..5ca1bb40f82b --- /dev/null +++ b/test/cmdlineTests/~assembler_modes/test.sh @@ -0,0 +1,43 @@ +#!/usr/bin/env bash +set -euo pipefail + +# shellcheck source=scripts/common.sh +source "${REPO_ROOT}/scripts/common.sh" + +function test_solc_assembly_output +{ + local input="${1}" + local expected="${2}" + IFS=" " read -r -a solc_args <<< "${3}" + + local expected_object="object \"object\" { code ${expected} }" + + output=$(echo "${input}" | msg_on_error --no-stderr "$SOLC" - "${solc_args[@]}") + empty=$(echo "$output" | tr '\n' ' ' | tr -s ' ' | sed -ne "/${expected_object}/p") + if [ -z "$empty" ] + then + printError "Incorrect assembly output. Expected: " + >&2 echo -e "${expected}" + printError "with arguments ${solc_args[*]}, but got:" + >&2 echo "${output}" + fail + fi +} + +echo '{}' | msg_on_error --silent "$SOLC" - --assemble +echo '{}' | msg_on_error --silent "$SOLC" - --yul +echo '{}' | msg_on_error --silent "$SOLC" - --strict-assembly + +# Test options above in conjunction with --optimize. +# Using both, --assemble and --optimize should fail. +echo '{}' | "$SOLC" - --assemble --optimize &>/dev/null && fail "solc --assemble --optimize did not fail as expected." +echo '{}' | "$SOLC" - --yul --optimize &>/dev/null && fail "solc --yul --optimize did not fail as expected." + +# Test yul and strict assembly output +# Non-empty code results in non-empty binary representation with optimizations turned off, +# while it results in empty binary representation with optimizations turned on. +test_solc_assembly_output "{ let x:u256 := 0:u256 mstore(0, x) }" "{ { let x := 0 mstore(0, x) } }" "--yul" +test_solc_assembly_output "{ let x:u256 := bitnot(7:u256) mstore(0, x) }" "{ { let x := bitnot(7) mstore(0, x) } }" "--yul" +test_solc_assembly_output "{ let t:bool := not(true) if t { mstore(0, 1) } }" "{ { let t:bool := not(true) if t { mstore(0, 1) } } }" "--yul" +test_solc_assembly_output "{ let x := 0 mstore(0, x) }" "{ { let x := 0 mstore(0, x) } }" "--strict-assembly" +test_solc_assembly_output "{ let x := 0 mstore(0, x) }" "{ { } }" "--strict-assembly --optimize" diff --git a/test/cmdlineTests/~ast_export_with_stop_after_parsing/test.sh b/test/cmdlineTests/~ast_export_with_stop_after_parsing/test.sh new file mode 100755 index 000000000000..e6a69d28b249 --- /dev/null +++ b/test/cmdlineTests/~ast_export_with_stop_after_parsing/test.sh @@ -0,0 +1,7 @@ +#!/usr/bin/env bash +set -euo pipefail + +# shellcheck source=scripts/common.sh +source "${REPO_ROOT}/scripts/common.sh" + +"$REPO_ROOT/test/stopAfterParseTests.sh" diff --git a/test/cmdlineTests/~ast_import_export/test.sh b/test/cmdlineTests/~ast_import_export/test.sh new file mode 100755 index 000000000000..ff3ab8811387 --- /dev/null +++ b/test/cmdlineTests/~ast_import_export/test.sh @@ -0,0 +1,14 @@ +#!/usr/bin/env bash +set -euo pipefail + +# shellcheck source=scripts/common.sh +source "${REPO_ROOT}/scripts/common.sh" + +SOLTMPDIR=$(mktemp -d -t "cmdline-test-ast-import-export-XXXXXX") +cd "$SOLTMPDIR" +if ! "$REPO_ROOT/scripts/ASTImportTest.sh" ast +then + rm -r "$SOLTMPDIR" + fail +fi +rm -r "$SOLTMPDIR" diff --git a/test/cmdlineTests/~cli_and_standard_json_equivalence/test.sh b/test/cmdlineTests/~cli_and_standard_json_equivalence/test.sh new file mode 100755 index 000000000000..4a7fe05b8b8e --- /dev/null +++ b/test/cmdlineTests/~cli_and_standard_json_equivalence/test.sh @@ -0,0 +1,61 @@ +#!/usr/bin/env bash +set -euo pipefail + +# shellcheck source=scripts/common.sh +source "${REPO_ROOT}/scripts/common.sh" +# shellcheck source=scripts/common_cmdline.sh +source "${REPO_ROOT}/scripts/common_cmdline.sh" + +function test_cli_and_standard_json_equivalence +{ + (( $# == 5 )) || assertFail + local cli_options="$1" + local selected_cli_output="$2" + local standard_json_settings="$3" + local selected_standard_json_output="$4" + local input_file_relative_path="$5" + + # CLI normalizes paths, Standard JSON uses them as is. Using paths that would change under this + # normalization will make the comparison fail. To avoid this use already normalized paths. + # The sanity check below should reject most of these by disallowing absolute paths, relative + # paths with ./ or ../ segments and paths with redundant slashes, but keep in mind it's not foolproof. + [[ $input_file_relative_path =~ ^/|^\.$|\./|^\.\.$|\.\./|// ]] && assertfail + + local cli_output standard_json_output + cli_output=$( + # shellcheck disable=SC2086 # Intentionally unquoted. May contain multiple options. + msg_on_error --no-stderr \ + "$SOLC" $cli_options "$selected_cli_output" "$input_file_relative_path" + ) + standard_json_output=$( + singleContractOutputViaStandardJSON \ + Solidity \ + "$selected_standard_json_output" \ + "$standard_json_settings" \ + "$input_file_relative_path" + ) + + diff_values \ + "$(echo "$cli_output" | stripCLIDecorations | stripEmptyLines)" \ + "$(echo "$standard_json_output" | stripEmptyLines)" \ + --ignore-space-change \ + --ignore-blank-lines +} + +cd "$REPO_ROOT" + +printTask " - --optimize vs optimizer.enabled: true (--asm output)" +test_cli_and_standard_json_equivalence \ + '--optimize' \ + '--asm' \ + '"optimizer": {"enabled": true}' \ + 'evm.assembly' \ + "test/libsolidity/semanticTests/various/erc20.sol" + +printTask " - --optimize-yul vs optimizer.details.yul: true (--asm output)" +test_cli_and_standard_json_equivalence \ + '--optimize-yul' \ + '--asm' \ + '"optimizer": {"enabled": false, "details": {"yul": true}}' \ + 'evm.assembly' \ + "test/libsolidity/semanticTests/various/erc20.sol" diff --git a/test/cmdlineTests/~compilation_tests/test.sh b/test/cmdlineTests/~compilation_tests/test.sh new file mode 100755 index 000000000000..d411c5ce85e5 --- /dev/null +++ b/test/cmdlineTests/~compilation_tests/test.sh @@ -0,0 +1,17 @@ +#!/usr/bin/env bash +set -euo pipefail + +# shellcheck source=scripts/common.sh +source "${REPO_ROOT}/scripts/common.sh" +# shellcheck source=scripts/common_cmdline.sh +source "${REPO_ROOT}/scripts/common_cmdline.sh" + +cd "$REPO_ROOT"/test/compilationTests/ +for dir in */ +do + echo " - $dir" + cd "$dir" + # shellcheck disable=SC2046 # These file names are not supposed to contain spaces. + compileFull --expect-warnings $(find . -name '*.sol') + cd .. +done diff --git a/test/cmdlineTests/~documentation_examples/test.sh b/test/cmdlineTests/~documentation_examples/test.sh new file mode 100755 index 000000000000..1acf5e8a7a4f --- /dev/null +++ b/test/cmdlineTests/~documentation_examples/test.sh @@ -0,0 +1,48 @@ +#!/usr/bin/env bash +set -eo pipefail + +# shellcheck source=scripts/common.sh +source "${REPO_ROOT}/scripts/common.sh" +# shellcheck source=scripts/common_cmdline.sh +source "${REPO_ROOT}/scripts/common_cmdline.sh" + +SOLTMPDIR=$(mktemp -d -t "cmdline-test-docs-examples-XXXXXX") +cd "$SOLTMPDIR" + +"$REPO_ROOT"/scripts/isolate_tests.py "$REPO_ROOT"/docs/ + +developmentVersion=$("$REPO_ROOT/scripts/get_version.sh") + +for f in *.yul *.sol +do + # The contributors guide uses syntax tests, but we cannot + # really handle them here. + if grep -E 'DeclarationError:|// ----' "$f" >/dev/null + then + continue + fi + echo " - Compiling example $f" + + opts=() + # We expect errors if explicitly stated, or if imports + # are used (in the style guide) + if grep -E "// This will not compile" "$f" >/dev/null || + sed -e 's|//.*||g' "$f" | grep -E "import \"" >/dev/null + then + opts=(--expect-errors) + fi + if grep "// This will report a warning" "$f" >/dev/null + then + opts+=(--expect-warnings) + fi + if grep "// This may report a warning" "$f" >/dev/null + then + opts+=(--ignore-warnings) + fi + + # Disable the version pragma in code snippets that only work with the current development version. + # It's necessary because x.y.z won't match `^x.y.z` or `>=x.y.z` pragmas until it's officially released. + sed -i.bak -E -e 's/pragma[[:space:]]+solidity[[:space:]]*(\^|>=)[[:space:]]*'"$developmentVersion"'/pragma solidity >0.0.1/' "$f" + compileFull "${opts[@]}" "$SOLTMPDIR/$f" +done +rm -r "$SOLTMPDIR" diff --git a/test/cmdlineTests/~library_checksum/test.sh b/test/cmdlineTests/~library_checksum/test.sh new file mode 100755 index 000000000000..bb5fbf51de2f --- /dev/null +++ b/test/cmdlineTests/~library_checksum/test.sh @@ -0,0 +1,11 @@ +#!/usr/bin/env bash +set -euo pipefail + +# shellcheck source=scripts/common.sh +source "${REPO_ROOT}/scripts/common.sh" + +echo '' | msg_on_error --no-stdout "$SOLC" - --link --libraries a=0x90f20564390eAe531E810af625A22f51385Cd222 +echo '' | "$SOLC" - --link --libraries a=0x80f20564390eAe531E810af625A22f51385Cd222 &>/dev/null && \ + fail "solc --link did not reject a library address with an invalid checksum." + +exit 0 diff --git a/test/cmdlineTests/~library_long_names/test.sh b/test/cmdlineTests/~library_long_names/test.sh new file mode 100755 index 000000000000..ad3008cdd5ea --- /dev/null +++ b/test/cmdlineTests/~library_long_names/test.sh @@ -0,0 +1,7 @@ +#!/usr/bin/env bash +set -euo pipefail + +# shellcheck source=scripts/common.sh +source "${REPO_ROOT}/scripts/common.sh" + +echo '' | msg_on_error --no-stdout "$SOLC" - --link --libraries aveeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeerylonglibraryname=0x90f20564390eAe531E810af625A22f51385Cd222 diff --git a/test/cmdlineTests/~linking/test.sh b/test/cmdlineTests/~linking/test.sh new file mode 100755 index 000000000000..ad7d9e173614 --- /dev/null +++ b/test/cmdlineTests/~linking/test.sh @@ -0,0 +1,26 @@ +#!/usr/bin/env bash +set -euo pipefail + +# shellcheck source=scripts/common.sh +source "${REPO_ROOT}/scripts/common.sh" + +SOLTMPDIR=$(mktemp -d -t "cmdline-test-linking-XXXXXX") +cd "$SOLTMPDIR" + +echo 'library L { function f() public pure {} } contract C { function f() public pure { L.f(); } }' > x.sol +msg_on_error --no-stderr "$SOLC" --bin -o . x.sol + +# Explanation and placeholder should be there +grep -q '//' C.bin && grep -q '__' C.bin + +# But not in library file. +grep -q -v '[/_]' L.bin + +# Now link +printf " " +msg_on_error "$SOLC" --link --libraries x.sol:L=0x90f20564390eAe531E810af625A22f51385Cd222 C.bin + +# Now the placeholder and explanation should be gone. +grep -q -v '[/_]' C.bin + +rm -r "$SOLTMPDIR" diff --git a/test/cmdlineTests/~overwriting_files/test.sh b/test/cmdlineTests/~overwriting_files/test.sh new file mode 100755 index 000000000000..acb8a7aca29e --- /dev/null +++ b/test/cmdlineTests/~overwriting_files/test.sh @@ -0,0 +1,19 @@ +#!/usr/bin/env bash +set -euo pipefail + +# shellcheck source=scripts/common.sh +source "${REPO_ROOT}/scripts/common.sh" + +SOLTMPDIR=$(mktemp -d -t "cmdline-test-overwriting-files-XXXXXX") + +# First time it works +echo 'contract C {}' | msg_on_error --no-stderr "$SOLC" - --bin -o "$SOLTMPDIR/non-existing-stuff-to-create" + +# Second time it fails +echo 'contract C {}' | "$SOLC" - --bin -o "$SOLTMPDIR/non-existing-stuff-to-create" 2>/dev/null && \ + fail "solc did not refuse to overwrite $SOLTMPDIR/non-existing-stuff-to-create." + +# Unless we force +echo 'contract C {}' | msg_on_error --no-stderr "$SOLC" - --overwrite --bin -o "$SOLTMPDIR/non-existing-stuff-to-create" + +rm -r "$SOLTMPDIR" diff --git a/test/cmdlineTests/~soljson_via_fuzzer/test.sh b/test/cmdlineTests/~soljson_via_fuzzer/test.sh new file mode 100755 index 000000000000..2d2312fd1586 --- /dev/null +++ b/test/cmdlineTests/~soljson_via_fuzzer/test.sh @@ -0,0 +1,16 @@ +#!/usr/bin/env bash +set -euo pipefail + +# shellcheck source=scripts/common.sh +source "${REPO_ROOT}/scripts/common.sh" + +SOLTMPDIR=$(mktemp -d -t "cmdline-test-soljson-via-fuzzer-XXXXXX") +cd "$SOLTMPDIR" + +"$REPO_ROOT"/scripts/isolate_tests.py "$REPO_ROOT"/test/ +"$REPO_ROOT"/scripts/isolate_tests.py "$REPO_ROOT"/docs/ + +echo ./*.sol | xargs -P 4 -n 50 "${SOLIDITY_BUILD_DIR}/test/tools/solfuzzer" --quiet --input-files +echo ./*.sol | xargs -P 4 -n 50 "${SOLIDITY_BUILD_DIR}/test/tools/solfuzzer" --without-optimizer --quiet --input-files + +rm -r "$SOLTMPDIR" diff --git a/test/cmdlineTests/~standard_input/test.sh b/test/cmdlineTests/~standard_input/test.sh new file mode 100755 index 000000000000..4aab34be1fee --- /dev/null +++ b/test/cmdlineTests/~standard_input/test.sh @@ -0,0 +1,26 @@ +#!/usr/bin/env bash +set -euo pipefail + +# shellcheck source=scripts/common.sh +source "${REPO_ROOT}/scripts/common.sh" + +set +e +output=$("$SOLC" --bin 2>&1) +result=$? +set -e + +# This should fail +if [[ ! ("$output" =~ "No input files given") || ($result == 0) ]] +then + fail "Incorrect response to empty input arg list: $output" +fi + +# The contract should be compiled +if ! echo 'contract C {}' | msg_on_error --no-stderr "$SOLC" - --bin | grep -q ":C" +then + fail "Failed to compile a simple contract from standard input" +fi + +# This should not fail +echo '' | msg_on_error --silent --msg "Incorrect response to --ast-compact-json option with empty stdin" \ + "$SOLC" --ast-compact-json - diff --git a/test/cmdlineTests/~unknown_options/test.sh b/test/cmdlineTests/~unknown_options/test.sh new file mode 100755 index 000000000000..923a36be6007 --- /dev/null +++ b/test/cmdlineTests/~unknown_options/test.sh @@ -0,0 +1,15 @@ +#!/usr/bin/env bash +set -euo pipefail + +# shellcheck source=scripts/common.sh +source "${REPO_ROOT}/scripts/common.sh" + +set +e +output=$("$SOLC" --allow=test 2>&1) +failed=$? +set -e + +if [[ $output != "unrecognised option '--allow=test'" ]] || (( failed == 0 )) +then + fail "Incorrect response to unknown options: $output" +fi diff --git a/test/cmdlineTests/~update_bugs_by_version/test.sh b/test/cmdlineTests/~update_bugs_by_version/test.sh new file mode 100755 index 000000000000..6ec1d069bcba --- /dev/null +++ b/test/cmdlineTests/~update_bugs_by_version/test.sh @@ -0,0 +1,15 @@ +#!/usr/bin/env bash +set -euo pipefail + +# shellcheck source=scripts/common.sh +source "${REPO_ROOT}/scripts/common.sh" + +SOLTMPDIR=$(mktemp -d -t "cmdline-test-update-bugs-by-version-XXXXXX") + +cp "${REPO_ROOT}/docs/bugs_by_version.json" "${SOLTMPDIR}/original_bugs_by_version.json" +"${REPO_ROOT}/scripts/update_bugs_by_version.py" + +diff --unified "${SOLTMPDIR}/original_bugs_by_version.json" "${REPO_ROOT}/docs/bugs_by_version.json" || \ + fail "The bug list in bugs_by_version.json was out of date and has been updated. Please investigate and submit a bugfix if necessary." + +rm -r "$SOLTMPDIR" diff --git a/test/cmdlineTests/~via_ir_equivalence/test.sh b/test/cmdlineTests/~via_ir_equivalence/test.sh new file mode 100755 index 000000000000..d663bef858c5 --- /dev/null +++ b/test/cmdlineTests/~via_ir_equivalence/test.sh @@ -0,0 +1,97 @@ +#!/usr/bin/env bash +set -eo pipefail + +# shellcheck source=scripts/common.sh +source "${REPO_ROOT}/scripts/common.sh" +# shellcheck source=scripts/common_cmdline.sh +source "${REPO_ROOT}/scripts/common_cmdline.sh" + +function test_via_ir_equivalence() +{ + (( $# <= 2 )) || fail "This function accepts at most two arguments." + local solidity_file="$1" + local optimize_flag="$2" + [[ $optimize_flag == --optimize || $optimize_flag == "" ]] || assertFail "The second argument must be --optimize if present." + + local output_file_prefix + output_file_prefix=$(basename "$solidity_file" .sol) + + SOLTMPDIR=$(mktemp -d -t "cmdline-test-via-ir-equivalence-${output_file_prefix}-XXXXXX") + pushd "$SOLTMPDIR" > /dev/null + + local optimizer_flags=() + [[ $optimize_flag == "" ]] || optimizer_flags+=("$optimize_flag") + [[ $optimize_flag == "" ]] || output_file_prefix+="_optimize" + + msg_on_error --no-stderr \ + "$SOLC" --ir-optimized --debug-info location "${optimizer_flags[@]}" "$solidity_file" | + stripCLIDecorations | + split_on_empty_lines_into_numbered_files "$output_file_prefix" ".yul" + + local asm_output_two_stage asm_output_via_ir + + for yul_file in $(find . -name "${output_file_prefix}*.yul" | sort -V); do + asm_output_two_stage+=$( + msg_on_error --no-stderr \ + "$SOLC" --strict-assembly --asm "${optimizer_flags[@]}" --no-optimize-yul "$yul_file" | + stripCLIDecorations + ) + done + + asm_output_via_ir=$( + msg_on_error --no-stderr \ + "$SOLC" --via-ir --asm --debug-info location "${optimizer_flags[@]}" "$solidity_file" | + stripCLIDecorations + ) + + diff_values "$asm_output_two_stage" "$asm_output_via_ir" --ignore-space-change --ignore-blank-lines + + local bin_output_two_stage bin_output_via_ir + + for yul_file in $(find . -name "${output_file_prefix}*.yul" | sort -V); do + bin_output_two_stage+=$( + msg_on_error --no-stderr \ + "$SOLC" --strict-assembly --bin "${optimizer_flags[@]}" "$yul_file" --no-optimize-yul | + stripCLIDecorations + ) + done + + bin_output_via_ir=$( + msg_on_error --no-stderr \ + "$SOLC" --via-ir --bin "${optimizer_flags[@]}" "$solidity_file" | stripCLIDecorations + ) + + diff_values "$bin_output_two_stage" "$bin_output_via_ir" --ignore-space-change --ignore-blank-lines + + popd > /dev/null + rm -r "$SOLTMPDIR" +} + +externalContracts=( + externalTests/solc-js/DAO/TokenCreation.sol + libsolidity/semanticTests/externalContracts/_prbmath/PRBMathSD59x18.sol + libsolidity/semanticTests/externalContracts/_prbmath/PRBMathUD60x18.sol + libsolidity/semanticTests/externalContracts/_stringutils/stringutils.sol + libsolidity/semanticTests/externalContracts/deposit_contract.sol + libsolidity/semanticTests/externalContracts/FixedFeeRegistrar.sol + libsolidity/semanticTests/externalContracts/snark.sol +) + +requiresOptimizer=( + externalTests/solc-js/DAO/TokenCreation.sol + libsolidity/semanticTests/externalContracts/deposit_contract.sol + libsolidity/semanticTests/externalContracts/FixedFeeRegistrar.sol + libsolidity/semanticTests/externalContracts/snark.sol +) + +for contractFile in "${externalContracts[@]}" +do + if ! [[ "${requiresOptimizer[*]}" =~ $contractFile ]] + then + printTask " - ${contractFile}" + test_via_ir_equivalence "${REPO_ROOT}/test/${contractFile}" + fi + + printTask " - ${contractFile} (optimized)" + test_via_ir_equivalence "${REPO_ROOT}/test/${contractFile}" --optimize +done diff --git a/test/externalTests/bleeps.sh b/test/externalTests/bleeps.sh index 939552100495..30f0ec9240b9 100755 --- a/test/externalTests/bleeps.sh +++ b/test/externalTests/bleeps.sh @@ -46,8 +46,8 @@ function bleeps_test local compile_only_presets=() local settings_presets=( "${compile_only_presets[@]}" - #ir-no-optimize # Compilation fails with: "YulException: Variable param_0 is 2 slot(s) too deep inside the stack." - #ir-optimize-evm-only # Compilation fails with: "YulException: Variable param_0 is 2 slot(s) too deep inside the stack." + #ir-no-optimize # Compilation fails with: "YulException: Variable expr_15509_mpos is 4 too deep in the stack". No memoryguard was present. + #ir-optimize-evm-only # Compilation fails with: "YulException: Variable expr_15260_mpos is 4 too deep in the stack". No memoryguard was present. ir-optimize-evm+yul #legacy-no-optimize # Compilation fails with: "CompilerError: Stack too deep, try removing local variables." #legacy-optimize-evm-only # Compilation fails with: "CompilerError: Stack too deep, try removing local variables." diff --git a/test/externalTests/brink.sh b/test/externalTests/brink.sh index 77dd62f940f8..06e2207bd09f 100755 --- a/test/externalTests/brink.sh +++ b/test/externalTests/brink.sh @@ -45,8 +45,8 @@ function brink_test local extra_optimizer_settings="runs: 800" local compile_only_presets=( - #ir-no-optimize # Compilation fails with "YulException: Variable var_signature_127_offset is 2 slot(s) too deep inside the stack." - #ir-optimize-evm-only # Compilation fails with "YulException: Variable var_signature_127_offset is 2 slot(s) too deep inside the stack." + ir-no-optimize # Lots of test failures. Tests depend on constants.js, which seems to be calculated specifically for 0.8.10. + ir-optimize-evm-only # Lots of test failures. Tests depend on constants.js, which seems to be calculated specifically for 0.8.10. ir-optimize-evm+yul # Lots of test failures. Tests depend on constants.js, which seems to be calculated specifically for 0.8.10. legacy-optimize-evm+yul # Lots of test failures. Tests depend on constants.js, which seems to be calculated specifically for 0.8.10. legacy-no-optimize # Lots of test failures. Tests depend on constants.js, which seems to be calculated specifically for 0.8.10. diff --git a/test/externalTests/chainlink.sh b/test/externalTests/chainlink.sh index a11266c3b84b..4d5080730f80 100755 --- a/test/externalTests/chainlink.sh +++ b/test/externalTests/chainlink.sh @@ -47,8 +47,8 @@ function chainlink_test ) local settings_presets=( "${compile_only_presets[@]}" - #ir-no-optimize # Compilation fails with "YulException: Variable var__value_775 is 1 slot(s) too deep inside the stack." - #ir-optimize-evm-only # Compilation fails with "YulException: Variable var__value_10 is 1 slot(s) too deep inside the stack" + #ir-no-optimize # Compilation fails with "YulException: Variable expr_10724_mpos is 2 too deep in the stack". No memoryguard was present. + #ir-optimize-evm-only # Compilation fails with "YulException: Variable expr_1891_mpos is 2 too deep in the stack". No memoryguard was present. ir-optimize-evm+yul legacy-optimize-evm-only # NOTE: This requires >= 4 GB RAM in CI not to crash legacy-optimize-evm+yul # NOTE: This requires >= 4 GB RAM in CI not to crash diff --git a/test/externalTests/elementfi.sh b/test/externalTests/elementfi.sh index b3348e339c9a..94e622d10c5a 100755 --- a/test/externalTests/elementfi.sh +++ b/test/externalTests/elementfi.sh @@ -45,8 +45,8 @@ function elementfi_test local compile_only_presets=( # ElementFi's test suite is hard-coded for Mainnet forked via alchemy.io. # Locally we can only compile. - #ir-no-optimize # Compilation fails with "YulException: Variable var_amount_9311 is 10 slot(s) too deep inside the stack." - #ir-optimize-evm-only # Compilation fails with "YulException: Variable var_amount_9311 is 10 slot(s) too deep inside the stack." + ir-no-optimize + ir-optimize-evm-only ir-optimize-evm+yul legacy-no-optimize legacy-optimize-evm-only diff --git a/test/externalTests/ens.sh b/test/externalTests/ens.sh index 7f713f4abd81..aee291a1a468 100755 --- a/test/externalTests/ens.sh +++ b/test/externalTests/ens.sh @@ -42,13 +42,13 @@ function ens_test local config_file="hardhat.config.js" local compile_only_presets=( + ir-no-optimize # FIXME: Tests fail with "Error: cannot estimate gas; transaction may fail or may require manual gas limit" legacy-no-optimize # Compiles but tests fail to deploy GovernorCompatibilityBravo (code too large). ) local settings_presets=( "${compile_only_presets[@]}" - #ir-no-optimize # Compilation fails with "YulException: Variable var__945 is 1 slot(s) too deep inside the stack." - #ir-optimize-evm-only # Compilation fails with "YulException: Variable var__945 is 1 slot(s) too deep inside the stack." - ir-optimize-evm+yul # Needs memory-safe inline assembly patch + ir-optimize-evm-only + ir-optimize-evm+yul # Needs memory-safe inline assembly patch legacy-optimize-evm-only legacy-optimize-evm+yul ) diff --git a/test/externalTests/euler.sh b/test/externalTests/euler.sh index 586526124f31..80f18e702d92 100755 --- a/test/externalTests/euler.sh +++ b/test/externalTests/euler.sh @@ -47,8 +47,8 @@ function euler_test local compile_only_presets=() local settings_presets=( "${compile_only_presets[@]}" - #ir-no-optimize # Compilation fails with "YulException: Variable var_utilisation_307 is 6 slot(s) too deep inside the stack." - #ir-optimize-evm-only # Compilation fails with "YulException: Variable var_utilisation_307 is 6 slot(s) too deep inside the stack." + #ir-no-optimize # Compilation fails with "YulException: Variable var_v_mpos is 4 too deep in the stack". No memoryguard was present. + #ir-optimize-evm-only # Compilation fails with "YulException: Variable var_v_mpos is 4 too deep in the stack". No memoryguard was present. ir-optimize-evm+yul legacy-optimize-evm-only legacy-optimize-evm+yul diff --git a/test/externalTests/gnosis.sh b/test/externalTests/gnosis.sh index de0624c06c57..5f7ea4876527 100755 --- a/test/externalTests/gnosis.sh +++ b/test/externalTests/gnosis.sh @@ -45,8 +45,8 @@ function gnosis_safe_test local compile_only_presets=() local settings_presets=( "${compile_only_presets[@]}" - #ir-no-optimize # Compilation fails with "YulException: Variable var_call_430_mpos is 1 slot(s) too deep inside the stack." - #ir-optimize-evm-only # Compilation fails with "YulException: Variable var_call_430_mpos is 1 slot(s) too deep inside the stack." + #ir-no-optimize # Compilation fails with "YulException: Variable var_txHash is 1 too deep in the stack". No memoryguard was present. + #ir-optimize-evm-only # Compilation fails with "YulException: Variable var_txHash is 1 too deep in the stack". No memoryguard was present. # TODO: Uncomment the preset below when the issue: https://github.com/safe-global/safe-contracts/issues/544 is solved. #ir-optimize-evm+yul # Compilation fails with "YulException: Cannot swap Variable var_operation with Variable _1: too deep in the stack by 4 slots." legacy-no-optimize diff --git a/test/externalTests/gp2.sh b/test/externalTests/gp2.sh index 4dae6f0c3bcc..bbb442226f62 100755 --- a/test/externalTests/gp2.sh +++ b/test/externalTests/gp2.sh @@ -43,12 +43,12 @@ function gp2_test local config_var="config" local compile_only_presets=( - legacy-no-optimize # Tests doing `new GPv2VaultRelayer` fail with "Error: Transaction reverted: trying to deploy a contract whose code is too large" + ir-no-optimize # Tests fail with "Error: Transaction reverted: trying to deploy a contract whose code is too large" + legacy-no-optimize # Tests fail with "Error: Transaction reverted: trying to deploy a contract whose code is too large" ) local settings_presets=( "${compile_only_presets[@]}" - #ir-no-optimize # Compilation fails with "YulException: Variable var_amount_1468 is 10 slot(s) too deep inside the stack." - #ir-no-optimize # Compilation fails with "YulException: Variable var_offset_3451 is 1 slot(s) too deep inside the stack." + ir-optimize-evm-only ir-optimize-evm+yul legacy-optimize-evm-only legacy-optimize-evm+yul @@ -69,6 +69,14 @@ function gp2_test force_hardhat_unlimited_contract_size "$config_file" "$config_var" yarn + # Workaround for error caused by the last release of hardhat-waffle@2.0.6 that bumps ethereum-waffle + # to version 4.0.10 and breaks gp2 build with the following error: + # + # Cannot find module 'ethereum-waffle/dist/cjs/src/deployContract' + # + # See: https://github.com/NomicFoundation/hardhat-waffle/commit/83ee9cb36ee59d0bedacbbd00043f030af104ad0 + yarn add '@nomiclabs/hardhat-waffle@2.0.5' + # Some dependencies come with pre-built artifacts. We want to build from scratch. rm -r node_modules/@gnosis.pm/safe-contracts/build/ diff --git a/test/externalTests/perpetual-pools.sh b/test/externalTests/perpetual-pools.sh index 70a14c499338..8d8dc34e212d 100755 --- a/test/externalTests/perpetual-pools.sh +++ b/test/externalTests/perpetual-pools.sh @@ -45,8 +45,8 @@ function perpetual_pools_test local compile_only_presets=() local settings_presets=( "${compile_only_presets[@]}" - #ir-no-optimize # Compilation fails with "YulException: Variable var_amount_527 is 9 slot(s) too deep inside the stack." - #ir-optimize-evm-only # Compilation fails with "YulException: Variable var_amount_527 is 9 slot(s) too deep inside the stack." + ir-no-optimize + ir-optimize-evm-only ir-optimize-evm+yul legacy-no-optimize legacy-optimize-evm-only diff --git a/test/externalTests/pool-together.sh b/test/externalTests/pool-together.sh index 77b3ad1499b2..3f7141d9bade 100755 --- a/test/externalTests/pool-together.sh +++ b/test/externalTests/pool-together.sh @@ -45,8 +45,8 @@ function pool_together_test local compile_only_presets=() local settings_presets=( "${compile_only_presets[@]}" - #ir-no-optimize # Compilation fails with "YulException: Variable var_amount_205 is 9 slot(s) too deep inside the stack." - #ir-optimize-evm-only # Compilation fails with "YulException: Variable var_amount_205 is 9 slot(s) too deep inside the stack." + ir-no-optimize + ir-optimize-evm-only ir-optimize-evm+yul legacy-no-optimize legacy-optimize-evm-only diff --git a/test/externalTests/prb-math.sh b/test/externalTests/prb-math.sh index 99c7c2716cde..fcf1aa208ee9 100755 --- a/test/externalTests/prb-math.sh +++ b/test/externalTests/prb-math.sh @@ -45,11 +45,12 @@ function prb_math_test local config_file="hardhat.config.ts" local config_var="config" - local compile_only_presets=() + local compile_only_presets=( + ir-no-optimize # Tests fail with "Error: Transaction reverted: trying to deploy a contract whose code is too large" + ) local settings_presets=( "${compile_only_presets[@]}" - #ir-no-optimize # Compilation fails with "YulException: Variable var_y_1960 is 8 slot(s) too deep inside the stack." - #ir-optimize-evm-only # Compilation fails with "YulException: Variable var_y_1960 is 8 slot(s) too deep inside the stack." + ir-optimize-evm-only ir-optimize-evm+yul legacy-optimize-evm-only legacy-optimize-evm+yul @@ -96,6 +97,14 @@ function prb_math_test yarn install --no-lock-file yarn add hardhat-gas-reporter + # Workaround for error caused by the last release of hardhat-waffle@2.0.6 that bumps ethereum-waffle + # to version 4.0.10 and breaks prb-math build with the following error: + # + # Cannot find module 'ethereum-waffle/dist/cjs/src/deployContract' + # + # See: https://github.com/NomicFoundation/hardhat-waffle/commit/83ee9cb36ee59d0bedacbbd00043f030af104ad0 + yarn add '@nomiclabs/hardhat-waffle@2.0.5' + replace_version_pragmas for preset in $SELECTED_PRESETS; do diff --git a/test/externalTests/trident.sh b/test/externalTests/trident.sh index f02123217a2b..d8d94eb3c101 100755 --- a/test/externalTests/trident.sh +++ b/test/externalTests/trident.sh @@ -54,9 +54,9 @@ function trident_test local compile_only_presets=() local settings_presets=( "${compile_only_presets[@]}" - #ir-no-optimize # Compilation fails with: "YulException: Variable var_amount_165 is 9 slot(s) too deep inside the stack." - #ir-optimize-evm-only # Compilation fails with: "YulException: Variable var_amount_165 is 9 slot(s) too deep inside the stack." - ir-optimize-evm+yul # Needs memory-safe inline assembly patch + ir-no-optimize + ir-optimize-evm-only + ir-optimize-evm+yul # Needs memory-safe inline assembly patch legacy-no-optimize legacy-optimize-evm-only legacy-optimize-evm+yul diff --git a/test/externalTests/uniswap.sh b/test/externalTests/uniswap.sh index 37fed8644310..8d2551b61920 100755 --- a/test/externalTests/uniswap.sh +++ b/test/externalTests/uniswap.sh @@ -45,8 +45,8 @@ function uniswap_test local compile_only_presets=() local settings_presets=( "${compile_only_presets[@]}" - #ir-no-optimize # Compilation fails with: "YulException: Variable ret_0 is 1 slot(s) too deep inside the stack." - #ir-optimize-evm-only # Compilation fails with: "YulException: Variable ret_0 is 1 slot(s) too deep inside the stack." + ir-no-optimize + ir-optimize-evm-only ir-optimize-evm+yul legacy-no-optimize legacy-optimize-evm-only diff --git a/test/externalTests/yield-liquidator.sh b/test/externalTests/yield-liquidator.sh index 3c7137f7377b..7a4353af578e 100755 --- a/test/externalTests/yield-liquidator.sh +++ b/test/externalTests/yield-liquidator.sh @@ -45,8 +45,8 @@ function yield_liquidator_test local compile_only_presets=() local settings_presets=( "${compile_only_presets[@]}" - #ir-no-optimize # Compilation fails with "YulException: Variable var_roles_168_mpos is 2 slot(s) too deep inside the stack." - #ir-optimize-evm-only # Compilation fails with "YulException: Variable var__33 is 6 slot(s) too deep inside the stack." + ir-no-optimize + ir-optimize-evm-only ir-optimize-evm+yul legacy-optimize-evm-only legacy-optimize-evm+yul diff --git a/test/externalTests/zeppelin.sh b/test/externalTests/zeppelin.sh index 46b3f2d89886..f0570bf46897 100755 --- a/test/externalTests/zeppelin.sh +++ b/test/externalTests/zeppelin.sh @@ -46,11 +46,12 @@ function zeppelin_test local ref="master" local config_file="hardhat.config.js" - local compile_only_presets=() + local compile_only_presets=( + #ir-no-optimize # Compilation fails with "Contract initcode size is 49410 bytes and exceeds 49152 bytes (a limit introduced in Shanghai)." + ir-optimize-evm-only # FIXME: A few tests fail with "Transaction: ... exited with an error (status 0) after consuming all gas." +) local settings_presets=( "${compile_only_presets[@]}" - #ir-no-optimize # Compilation fails with "YulException: Variable var_account_852 is 4 slot(s) too deep inside the stack." - #ir-optimize-evm-only # Compilation fails with "YulException: Variable var_account_852 is 4 slot(s) too deep inside the stack." ir-optimize-evm+yul legacy-no-optimize legacy-optimize-evm-only @@ -70,35 +71,31 @@ function zeppelin_test sed -i "s|describe(\('when the given implementation is the zero address'\)|describe.skip(\1|g" test/proxy/transparent/TransparentUpgradeableProxy.behaviour.js sed -i "s|describe(\('when the new proposed admin is the zero address'\)|describe.skip(\1|g" test/proxy/transparent/TransparentUpgradeableProxy.behaviour.js # In some cases Hardhat does not detect revert reasons properly via IR. - sed -i "s|it(\('reverts if the current value is 0'\)|it.skip(\1|g" test/utils/Counters.test.js sed -i "s|it(\('prevent unauthorized maintenance'\)|it.skip(\1|g" test/governance/TimelockController.test.js sed -i "s|it(\('cannot cancel invalid operation'\)|it.skip(\1|g" test/governance/TimelockController.test.js sed -i "s|it(\('cannot call onlyInitializable function outside the scope of an initializable function'\)|it.skip(\1|g" test/proxy/utils/Initializable.test.js - sed -i "s|it(\('other accounts cannot unpause'\)|it.skip(\1|g" test/token/ERC20/presets/ERC20PresetMinterPauser.test.js - sed -i "s|it(\('other accounts cannot unpause'\)|it.skip(\1|g" test/token/ERC1155/presets/ERC1155PresetMinterPauser.test.js - sed -i "s|it(\('other accounts cannot pause'\)|it.skip(\1|g" test/token/ERC20/presets/ERC20PresetMinterPauser.test.js - sed -i "s|it(\('other accounts cannot pause'\)|it.skip(\1|g" test/token/ERC1155/presets/ERC1155PresetMinterPauser.test.js - sed -i "s|it(\('cannot be released before time limit'\)|it.skip(\1|g" test/token/ERC20/utils/TokenTimelock.test.js - sed -i "s|it(\('cannot be released just before time limit'\)|it.skip(\1|g" test/token/ERC20/utils/TokenTimelock.test.js sed -i "s|it(\('reverts when sending non-zero amounts'\)|it.skip(\1|g" test/utils/Address.test.js sed -i "s|it(\('reverts when sending more than the balance'\)|it.skip(\1|g" test/utils/Address.test.js sed -i "s|it(\('fails deploying a contract if the bytecode length is zero'\)|it.skip(\1|g" test/utils/Create2.test.js sed -i "s|it(\('fails deploying a contract if factory contract does not have sufficient balance'\)|it.skip(\1|g" test/utils/Create2.test.js - sed -i "s|it(\('reverts on withdrawals'\)|it.skip(\1|g" test/utils/escrow/ConditionalEscrow.test.js - sed -i "s|it(\('does not allow beneficiary withdrawal'\)|it.skip(\1|g" test/utils/escrow/RefundEscrow.test.js - sed -i "s|it(\('rejects deposits'\)|it.skip(\1|g" test/utils/escrow/RefundEscrow.test.js - sed -i "s|it(\('does not allow 0xffffffff'\)|it.skip(\1|g" test/utils/introspection/ERC165Storage.test.js sed -i "s|it(\('reverts when casting -1'\)|it.skip(\1|g" test/utils/math/SafeCast.test.js sed -i 's|it(\(`reverts when casting [^`]\+`\)|it.skip(\1|g' test/utils/math/SafeCast.test.js sed -i "s|it(\('reverts if index is greater than supply'\)|it.skip(\1|g" test/token/ERC721/ERC721.behavior.js sed -i "s|it(\('burns all tokens'\)|it.skip(\1|g" test/token/ERC721/ERC721.behavior.js - sed -i "s|it(\('other accounts cannot pause'\)|it.skip(\1|g" test/token/ERC721/presets/ERC721PresetMinterPauserAutoId.test.js - sed -i "s|it(\('other accounts cannot unpause'\)|it.skip(\1|g" test/token/ERC721/presets/ERC721PresetMinterPauserAutoId.test.js sed -i "s|it(\('guards transfer against invalid user'\)|it.skip(\1|g" test/access/Ownable2Step.test.js - sed -i "s|it(\('reverting initialization'\)|it.skip(\1|g" test/proxy/beacon/BeaconProxy.test.js + sed -i "s|it(\('reverting initialization function'\)|it.skip(\1|g" test/proxy/beacon/BeaconProxy.test.js sed -i "s|describe(\('reverting initialization'\)|describe.skip(\1|g" test/proxy/Proxy.behaviour.js sed -i "s|it(\('does not allow remote callback'\)|it.skip(\1|g" test/security/ReentrancyGuard.test.js - sed -i "s|shouldBehaveLikeAccessControlDefaultAdminRules|\/\/&|" test/access/AccessControlDefaultAdminRules.test.js + + # TODO: Remove when hardhat properly handle reverts of custom errors with via-ir enabled + # and/or open-zeppelin fix https://github.com/OpenZeppelin/openzeppelin-contracts/issues/4349 + sed -i "s|it(\('cannot nest reinitializers'\)|it.skip(\1|g" test/proxy/utils/Initializable.test.js + sed -i "s|it(\('prevents re-initialization'\)|it.skip(\1|g" test/proxy/utils/Initializable.test.js + sed -i "s|it(\('can lock contract after initialization'\)|it.skip(\1|g" test/proxy/utils/Initializable.test.js + sed -i "s|it(\('calling upgradeTo on the implementation reverts'\)|it.skip(\1|g" test/proxy/utils/UUPSUpgradeable.test.js + sed -i "s|it(\('calling upgradeToAndCall on the implementation reverts'\)|it.skip(\1|g" test/proxy/utils/UUPSUpgradeable.test.js + sed -i "s|it(\('calling upgradeTo from a contract that is not an ERC1967 proxy\)|it.skip(\1|g" test/proxy/utils/UUPSUpgradeable.test.js + sed -i "s|it(\('calling upgradeToAndCall from a contract that is not an ERC1967 proxy\)|it.skip(\1|g" test/proxy/utils/UUPSUpgradeable.test.js # Here only the testToInt(248) and testToInt(256) cases fail so change the loop range to skip them sed -i "s|range(8, 256, 8)\(.forEach(bits => testToInt(bits));\)|range(8, 240, 8)\1|" test/utils/math/SafeCast.test.js diff --git a/test/libsolidity/ASTJSON/abstract_contract.sol b/test/libsolidity/ASTJSON/abstract_contract.sol index bddbc177931a..3ef96612f5fb 100644 --- a/test/libsolidity/ASTJSON/abstract_contract.sol +++ b/test/libsolidity/ASTJSON/abstract_contract.sol @@ -2,5 +2,4 @@ abstract contract C { constructor() { } } - // ---- diff --git a/test/libsolidity/ASTJSON/address_payable.sol b/test/libsolidity/ASTJSON/address_payable.sol index 28c9c8a20da4..f9ebb124ebaf 100644 --- a/test/libsolidity/ASTJSON/address_payable.sol +++ b/test/libsolidity/ASTJSON/address_payable.sol @@ -7,5 +7,4 @@ contract C { m[c] = payable(0); } } - // ---- diff --git a/test/libsolidity/ASTJSON/assembly/call.json b/test/libsolidity/ASTJSON/assembly/call.json index 7081d2f983fc..d92cf05fe8e4 100644 --- a/test/libsolidity/ASTJSON/assembly/call.json +++ b/test/libsolidity/ASTJSON/assembly/call.json @@ -39,6 +39,7 @@ { "AST": { + "nativeSrc": "56:34:1", "nodeType": "YulBlock", "src": "56:34:1", "statements": @@ -53,6 +54,7 @@ [ { "kind": "number", + "nativeSrc": "67:1:1", "nodeType": "YulLiteral", "src": "67:1:1", "type": "", @@ -60,6 +62,7 @@ }, { "kind": "number", + "nativeSrc": "70:1:1", "nodeType": "YulLiteral", "src": "70:1:1", "type": "", @@ -67,6 +70,7 @@ }, { "kind": "number", + "nativeSrc": "73:1:1", "nodeType": "YulLiteral", "src": "73:1:1", "type": "", @@ -74,6 +78,7 @@ }, { "kind": "number", + "nativeSrc": "76:1:1", "nodeType": "YulLiteral", "src": "76:1:1", "type": "", @@ -81,6 +86,7 @@ }, { "kind": "number", + "nativeSrc": "79:1:1", "nodeType": "YulLiteral", "src": "79:1:1", "type": "", @@ -88,6 +94,7 @@ }, { "kind": "number", + "nativeSrc": "82:1:1", "nodeType": "YulLiteral", "src": "82:1:1", "type": "", @@ -95,6 +102,7 @@ }, { "kind": "number", + "nativeSrc": "85:1:1", "nodeType": "YulLiteral", "src": "85:1:1", "type": "", @@ -104,9 +112,11 @@ "functionName": { "name": "call", + "nativeSrc": "62:4:1", "nodeType": "YulIdentifier", "src": "62:4:1" }, + "nativeSrc": "62:25:1", "nodeType": "YulFunctionCall", "src": "62:25:1" } @@ -114,12 +124,15 @@ "functionName": { "name": "pop", + "nativeSrc": "58:3:1", "nodeType": "YulIdentifier", "src": "58:3:1" }, + "nativeSrc": "58:30:1", "nodeType": "YulFunctionCall", "src": "58:30:1" }, + "nativeSrc": "58:30:1", "nodeType": "YulExpressionStatement", "src": "58:30:1" } diff --git a/test/libsolidity/ASTJSON/assembly/call.sol b/test/libsolidity/ASTJSON/assembly/call.sol index 09d1ce184378..1735fd7f7e22 100644 --- a/test/libsolidity/ASTJSON/assembly/call.sol +++ b/test/libsolidity/ASTJSON/assembly/call.sol @@ -3,5 +3,4 @@ contract C { assembly { pop(call(0, 1, 2, 3, 4, 5, 6)) } } } - // ---- diff --git a/test/libsolidity/ASTJSON/assembly/call_parseOnly.json b/test/libsolidity/ASTJSON/assembly/call_parseOnly.json index 1a9dc74a2839..803a1e4f5f1e 100644 --- a/test/libsolidity/ASTJSON/assembly/call_parseOnly.json +++ b/test/libsolidity/ASTJSON/assembly/call_parseOnly.json @@ -26,6 +26,7 @@ { "AST": { + "nativeSrc": "56:34:1", "nodeType": "YulBlock", "src": "56:34:1", "statements": @@ -40,6 +41,7 @@ [ { "kind": "number", + "nativeSrc": "67:1:1", "nodeType": "YulLiteral", "src": "67:1:1", "type": "", @@ -47,6 +49,7 @@ }, { "kind": "number", + "nativeSrc": "70:1:1", "nodeType": "YulLiteral", "src": "70:1:1", "type": "", @@ -54,6 +57,7 @@ }, { "kind": "number", + "nativeSrc": "73:1:1", "nodeType": "YulLiteral", "src": "73:1:1", "type": "", @@ -61,6 +65,7 @@ }, { "kind": "number", + "nativeSrc": "76:1:1", "nodeType": "YulLiteral", "src": "76:1:1", "type": "", @@ -68,6 +73,7 @@ }, { "kind": "number", + "nativeSrc": "79:1:1", "nodeType": "YulLiteral", "src": "79:1:1", "type": "", @@ -75,6 +81,7 @@ }, { "kind": "number", + "nativeSrc": "82:1:1", "nodeType": "YulLiteral", "src": "82:1:1", "type": "", @@ -82,6 +89,7 @@ }, { "kind": "number", + "nativeSrc": "85:1:1", "nodeType": "YulLiteral", "src": "85:1:1", "type": "", @@ -91,9 +99,11 @@ "functionName": { "name": "call", + "nativeSrc": "62:4:1", "nodeType": "YulIdentifier", "src": "62:4:1" }, + "nativeSrc": "62:25:1", "nodeType": "YulFunctionCall", "src": "62:25:1" } @@ -101,12 +111,15 @@ "functionName": { "name": "pop", + "nativeSrc": "58:3:1", "nodeType": "YulIdentifier", "src": "58:3:1" }, + "nativeSrc": "58:30:1", "nodeType": "YulFunctionCall", "src": "58:30:1" }, + "nativeSrc": "58:30:1", "nodeType": "YulExpressionStatement", "src": "58:30:1" } diff --git a/test/libsolidity/ASTJSON/assembly/empty_block.json b/test/libsolidity/ASTJSON/assembly/empty_block.json index 05dc8c0c059a..3ec3c2eec018 100644 --- a/test/libsolidity/ASTJSON/assembly/empty_block.json +++ b/test/libsolidity/ASTJSON/assembly/empty_block.json @@ -39,11 +39,13 @@ { "AST": { + "nativeSrc": "61:6:1", "nodeType": "YulBlock", "src": "61:6:1", "statements": [ { + "nativeSrc": "63:2:1", "nodeType": "YulBlock", "src": "63:2:1", "statements": [] diff --git a/test/libsolidity/ASTJSON/assembly/empty_block.sol b/test/libsolidity/ASTJSON/assembly/empty_block.sol index 23c2babbe36d..33bb796ea615 100644 --- a/test/libsolidity/ASTJSON/assembly/empty_block.sol +++ b/test/libsolidity/ASTJSON/assembly/empty_block.sol @@ -3,5 +3,4 @@ contract C { assembly { {} } } } - // ---- diff --git a/test/libsolidity/ASTJSON/assembly/empty_block_parseOnly.json b/test/libsolidity/ASTJSON/assembly/empty_block_parseOnly.json index 4a1d1f61474a..ee8e7b7330fb 100644 --- a/test/libsolidity/ASTJSON/assembly/empty_block_parseOnly.json +++ b/test/libsolidity/ASTJSON/assembly/empty_block_parseOnly.json @@ -26,11 +26,13 @@ { "AST": { + "nativeSrc": "61:6:1", "nodeType": "YulBlock", "src": "61:6:1", "statements": [ { + "nativeSrc": "63:2:1", "nodeType": "YulBlock", "src": "63:2:1", "statements": [] diff --git a/test/libsolidity/ASTJSON/assembly/function.json b/test/libsolidity/ASTJSON/assembly/function.json index d8822183c28c..a3b908ac18b9 100644 --- a/test/libsolidity/ASTJSON/assembly/function.json +++ b/test/libsolidity/ASTJSON/assembly/function.json @@ -39,6 +39,7 @@ { "AST": { + "nativeSrc": "61:43:1", "nodeType": "YulBlock", "src": "61:43:1", "statements": @@ -46,6 +47,7 @@ { "body": { + "nativeSrc": "76:22:1", "nodeType": "YulBlock", "src": "76:22:1", "statements": @@ -60,6 +62,7 @@ [ { "kind": "number", + "nativeSrc": "92:2:1", "nodeType": "YulLiteral", "src": "92:2:1", "type": "", @@ -69,9 +72,11 @@ "functionName": { "name": "blockhash", + "nativeSrc": "82:9:1", "nodeType": "YulIdentifier", "src": "82:9:1" }, + "nativeSrc": "82:13:1", "nodeType": "YulFunctionCall", "src": "82:13:1" } @@ -79,18 +84,22 @@ "functionName": { "name": "pop", + "nativeSrc": "78:3:1", "nodeType": "YulIdentifier", "src": "78:3:1" }, + "nativeSrc": "78:18:1", "nodeType": "YulFunctionCall", "src": "78:18:1" }, + "nativeSrc": "78:18:1", "nodeType": "YulExpressionStatement", "src": "78:18:1" } ] }, "name": "g", + "nativeSrc": "63:35:1", "nodeType": "YulFunctionDefinition", "src": "63:35:1" }, @@ -101,12 +110,15 @@ "functionName": { "name": "g", + "nativeSrc": "99:1:1", "nodeType": "YulIdentifier", "src": "99:1:1" }, + "nativeSrc": "99:3:1", "nodeType": "YulFunctionCall", "src": "99:3:1" }, + "nativeSrc": "99:3:1", "nodeType": "YulExpressionStatement", "src": "99:3:1" } diff --git a/test/libsolidity/ASTJSON/assembly/function.sol b/test/libsolidity/ASTJSON/assembly/function.sol index 6020f1f51318..1edf2f2de24d 100644 --- a/test/libsolidity/ASTJSON/assembly/function.sol +++ b/test/libsolidity/ASTJSON/assembly/function.sol @@ -3,5 +3,4 @@ contract C { assembly { function g() { pop(blockhash(20)) } g() } } } - // ---- diff --git a/test/libsolidity/ASTJSON/assembly/function_parseOnly.json b/test/libsolidity/ASTJSON/assembly/function_parseOnly.json index 8115fc0aecbf..04f5c2721b70 100644 --- a/test/libsolidity/ASTJSON/assembly/function_parseOnly.json +++ b/test/libsolidity/ASTJSON/assembly/function_parseOnly.json @@ -26,6 +26,7 @@ { "AST": { + "nativeSrc": "61:43:1", "nodeType": "YulBlock", "src": "61:43:1", "statements": @@ -33,6 +34,7 @@ { "body": { + "nativeSrc": "76:22:1", "nodeType": "YulBlock", "src": "76:22:1", "statements": @@ -47,6 +49,7 @@ [ { "kind": "number", + "nativeSrc": "92:2:1", "nodeType": "YulLiteral", "src": "92:2:1", "type": "", @@ -56,9 +59,11 @@ "functionName": { "name": "blockhash", + "nativeSrc": "82:9:1", "nodeType": "YulIdentifier", "src": "82:9:1" }, + "nativeSrc": "82:13:1", "nodeType": "YulFunctionCall", "src": "82:13:1" } @@ -66,18 +71,22 @@ "functionName": { "name": "pop", + "nativeSrc": "78:3:1", "nodeType": "YulIdentifier", "src": "78:3:1" }, + "nativeSrc": "78:18:1", "nodeType": "YulFunctionCall", "src": "78:18:1" }, + "nativeSrc": "78:18:1", "nodeType": "YulExpressionStatement", "src": "78:18:1" } ] }, "name": "g", + "nativeSrc": "63:35:1", "nodeType": "YulFunctionDefinition", "src": "63:35:1" }, @@ -88,12 +97,15 @@ "functionName": { "name": "g", + "nativeSrc": "99:1:1", "nodeType": "YulIdentifier", "src": "99:1:1" }, + "nativeSrc": "99:3:1", "nodeType": "YulFunctionCall", "src": "99:3:1" }, + "nativeSrc": "99:3:1", "nodeType": "YulExpressionStatement", "src": "99:3:1" } diff --git a/test/libsolidity/ASTJSON/assembly/leave.json b/test/libsolidity/ASTJSON/assembly/leave.json index 23ac98ccb34a..51c94f542c76 100644 --- a/test/libsolidity/ASTJSON/assembly/leave.json +++ b/test/libsolidity/ASTJSON/assembly/leave.json @@ -39,6 +39,7 @@ { "AST": { + "nativeSrc": "56:26:1", "nodeType": "YulBlock", "src": "56:26:1", "statements": @@ -46,17 +47,20 @@ { "body": { + "nativeSrc": "71:9:1", "nodeType": "YulBlock", "src": "71:9:1", "statements": [ { + "nativeSrc": "73:5:1", "nodeType": "YulLeave", "src": "73:5:1" } ] }, "name": "f", + "nativeSrc": "58:22:1", "nodeType": "YulFunctionDefinition", "src": "58:22:1" } diff --git a/test/libsolidity/ASTJSON/assembly/leave.sol b/test/libsolidity/ASTJSON/assembly/leave.sol index 5ae4a9e0dd09..39f1cafedb22 100644 --- a/test/libsolidity/ASTJSON/assembly/leave.sol +++ b/test/libsolidity/ASTJSON/assembly/leave.sol @@ -3,5 +3,4 @@ contract C { assembly { function f() { leave } } } } - // ---- diff --git a/test/libsolidity/ASTJSON/assembly/leave_parseOnly.json b/test/libsolidity/ASTJSON/assembly/leave_parseOnly.json index 215266456d17..ee34743eac32 100644 --- a/test/libsolidity/ASTJSON/assembly/leave_parseOnly.json +++ b/test/libsolidity/ASTJSON/assembly/leave_parseOnly.json @@ -26,6 +26,7 @@ { "AST": { + "nativeSrc": "56:26:1", "nodeType": "YulBlock", "src": "56:26:1", "statements": @@ -33,17 +34,20 @@ { "body": { + "nativeSrc": "71:9:1", "nodeType": "YulBlock", "src": "71:9:1", "statements": [ { + "nativeSrc": "73:5:1", "nodeType": "YulLeave", "src": "73:5:1" } ] }, "name": "f", + "nativeSrc": "58:22:1", "nodeType": "YulFunctionDefinition", "src": "58:22:1" } diff --git a/test/libsolidity/ASTJSON/assembly/loop.json b/test/libsolidity/ASTJSON/assembly/loop.json index 7e684b4a34a6..d3d20992d772 100644 --- a/test/libsolidity/ASTJSON/assembly/loop.json +++ b/test/libsolidity/ASTJSON/assembly/loop.json @@ -39,6 +39,7 @@ { "AST": { + "nativeSrc": "61:49:1", "nodeType": "YulBlock", "src": "61:49:1", "statements": @@ -46,15 +47,18 @@ { "body": { + "nativeSrc": "90:18:1", "nodeType": "YulBlock", "src": "90:18:1", "statements": [ { + "nativeSrc": "92:5:1", "nodeType": "YulBreak", "src": "92:5:1" }, { + "nativeSrc": "98:8:1", "nodeType": "YulContinue", "src": "98:8:1" } @@ -63,14 +67,17 @@ "condition": { "kind": "number", + "nativeSrc": "70:1:1", "nodeType": "YulLiteral", "src": "70:1:1", "type": "", "value": "1" }, + "nativeSrc": "63:45:1", "nodeType": "YulForLoop", "post": { + "nativeSrc": "72:17:1", "nodeType": "YulBlock", "src": "72:17:1", "statements": @@ -85,6 +92,7 @@ [ { "kind": "number", + "nativeSrc": "84:1:1", "nodeType": "YulLiteral", "src": "84:1:1", "type": "", @@ -94,9 +102,11 @@ "functionName": { "name": "sload", + "nativeSrc": "78:5:1", "nodeType": "YulIdentifier", "src": "78:5:1" }, + "nativeSrc": "78:8:1", "nodeType": "YulFunctionCall", "src": "78:8:1" } @@ -104,12 +114,15 @@ "functionName": { "name": "pop", + "nativeSrc": "74:3:1", "nodeType": "YulIdentifier", "src": "74:3:1" }, + "nativeSrc": "74:13:1", "nodeType": "YulFunctionCall", "src": "74:13:1" }, + "nativeSrc": "74:13:1", "nodeType": "YulExpressionStatement", "src": "74:13:1" } @@ -117,6 +130,7 @@ }, "pre": { + "nativeSrc": "67:2:1", "nodeType": "YulBlock", "src": "67:2:1", "statements": [] diff --git a/test/libsolidity/ASTJSON/assembly/loop.sol b/test/libsolidity/ASTJSON/assembly/loop.sol index bba8d282f63d..baa45e62c489 100644 --- a/test/libsolidity/ASTJSON/assembly/loop.sol +++ b/test/libsolidity/ASTJSON/assembly/loop.sol @@ -3,5 +3,4 @@ contract C { assembly { for {} 1 { pop(sload(0)) } { break continue } } } } - // ---- diff --git a/test/libsolidity/ASTJSON/assembly/loop_parseOnly.json b/test/libsolidity/ASTJSON/assembly/loop_parseOnly.json index 934afdf42e65..24dbbdc4eaf8 100644 --- a/test/libsolidity/ASTJSON/assembly/loop_parseOnly.json +++ b/test/libsolidity/ASTJSON/assembly/loop_parseOnly.json @@ -26,6 +26,7 @@ { "AST": { + "nativeSrc": "61:49:1", "nodeType": "YulBlock", "src": "61:49:1", "statements": @@ -33,15 +34,18 @@ { "body": { + "nativeSrc": "90:18:1", "nodeType": "YulBlock", "src": "90:18:1", "statements": [ { + "nativeSrc": "92:5:1", "nodeType": "YulBreak", "src": "92:5:1" }, { + "nativeSrc": "98:8:1", "nodeType": "YulContinue", "src": "98:8:1" } @@ -50,14 +54,17 @@ "condition": { "kind": "number", + "nativeSrc": "70:1:1", "nodeType": "YulLiteral", "src": "70:1:1", "type": "", "value": "1" }, + "nativeSrc": "63:45:1", "nodeType": "YulForLoop", "post": { + "nativeSrc": "72:17:1", "nodeType": "YulBlock", "src": "72:17:1", "statements": @@ -72,6 +79,7 @@ [ { "kind": "number", + "nativeSrc": "84:1:1", "nodeType": "YulLiteral", "src": "84:1:1", "type": "", @@ -81,9 +89,11 @@ "functionName": { "name": "sload", + "nativeSrc": "78:5:1", "nodeType": "YulIdentifier", "src": "78:5:1" }, + "nativeSrc": "78:8:1", "nodeType": "YulFunctionCall", "src": "78:8:1" } @@ -91,12 +101,15 @@ "functionName": { "name": "pop", + "nativeSrc": "74:3:1", "nodeType": "YulIdentifier", "src": "74:3:1" }, + "nativeSrc": "74:13:1", "nodeType": "YulFunctionCall", "src": "74:13:1" }, + "nativeSrc": "74:13:1", "nodeType": "YulExpressionStatement", "src": "74:13:1" } @@ -104,6 +117,7 @@ }, "pre": { + "nativeSrc": "67:2:1", "nodeType": "YulBlock", "src": "67:2:1", "statements": [] diff --git a/test/libsolidity/ASTJSON/assembly/nested_functions.json b/test/libsolidity/ASTJSON/assembly/nested_functions.json index 881e7456f1cb..3c9fd53ec03c 100644 --- a/test/libsolidity/ASTJSON/assembly/nested_functions.json +++ b/test/libsolidity/ASTJSON/assembly/nested_functions.json @@ -39,6 +39,7 @@ { "AST": { + "nativeSrc": "72:76:1", "nodeType": "YulBlock", "src": "72:76:1", "statements": @@ -46,6 +47,7 @@ { "body": { + "nativeSrc": "94:35:1", "nodeType": "YulBlock", "src": "94:35:1", "statements": @@ -53,26 +55,31 @@ { "body": { + "nativeSrc": "118:3:1", "nodeType": "YulBlock", "src": "118:3:1", "statements": [] }, "name": "f2", + "nativeSrc": "104:17:1", "nodeType": "YulFunctionDefinition", "src": "104:17:1" } ] }, "name": "f1", + "nativeSrc": "80:49:1", "nodeType": "YulFunctionDefinition", "src": "80:49:1" }, { + "nativeSrc": "136:6:1", "nodeType": "YulAssignment", "src": "136:6:1", "value": { "kind": "number", + "nativeSrc": "141:1:1", "nodeType": "YulLiteral", "src": "141:1:1", "type": "", @@ -82,6 +89,7 @@ [ { "name": "x", + "nativeSrc": "136:1:1", "nodeType": "YulIdentifier", "src": "136:1:1" } diff --git a/test/libsolidity/ASTJSON/assembly/nested_functions.sol b/test/libsolidity/ASTJSON/assembly/nested_functions.sol index 396efa0bf8a2..42479fa94ad3 100644 --- a/test/libsolidity/ASTJSON/assembly/nested_functions.sol +++ b/test/libsolidity/ASTJSON/assembly/nested_functions.sol @@ -8,5 +8,4 @@ contract C { } } } - // ---- diff --git a/test/libsolidity/ASTJSON/assembly/nested_functions_parseOnly.json b/test/libsolidity/ASTJSON/assembly/nested_functions_parseOnly.json index a9ac0965aa88..b924b42cfd0e 100644 --- a/test/libsolidity/ASTJSON/assembly/nested_functions_parseOnly.json +++ b/test/libsolidity/ASTJSON/assembly/nested_functions_parseOnly.json @@ -26,6 +26,7 @@ { "AST": { + "nativeSrc": "72:76:1", "nodeType": "YulBlock", "src": "72:76:1", "statements": @@ -33,6 +34,7 @@ { "body": { + "nativeSrc": "94:35:1", "nodeType": "YulBlock", "src": "94:35:1", "statements": @@ -40,26 +42,31 @@ { "body": { + "nativeSrc": "118:3:1", "nodeType": "YulBlock", "src": "118:3:1", "statements": [] }, "name": "f2", + "nativeSrc": "104:17:1", "nodeType": "YulFunctionDefinition", "src": "104:17:1" } ] }, "name": "f1", + "nativeSrc": "80:49:1", "nodeType": "YulFunctionDefinition", "src": "80:49:1" }, { + "nativeSrc": "136:6:1", "nodeType": "YulAssignment", "src": "136:6:1", "value": { "kind": "number", + "nativeSrc": "141:1:1", "nodeType": "YulLiteral", "src": "141:1:1", "type": "", @@ -69,6 +76,7 @@ [ { "name": "x", + "nativeSrc": "136:1:1", "nodeType": "YulIdentifier", "src": "136:1:1" } diff --git a/test/libsolidity/ASTJSON/assembly/slot_offset.json b/test/libsolidity/ASTJSON/assembly/slot_offset.json index e61125cbdb31..799239b3afc6 100644 --- a/test/libsolidity/ASTJSON/assembly/slot_offset.json +++ b/test/libsolidity/ASTJSON/assembly/slot_offset.json @@ -124,16 +124,19 @@ { "AST": { + "nativeSrc": "95:45:1", "nodeType": "YulBlock", "src": "95:45:1", "statements": [ { + "nativeSrc": "97:17:1", "nodeType": "YulVariableDeclaration", "src": "97:17:1", "value": { "name": "s.offset", + "nativeSrc": "106:8:1", "nodeType": "YulIdentifier", "src": "106:8:1" }, @@ -141,6 +144,7 @@ [ { "name": "x", + "nativeSrc": "101:1:1", "nodeType": "YulTypedName", "src": "101:1:1", "type": "" @@ -148,6 +152,7 @@ ] }, { + "nativeSrc": "115:23:1", "nodeType": "YulVariableDeclaration", "src": "115:23:1", "value": @@ -156,11 +161,13 @@ [ { "name": "s.slot", + "nativeSrc": "128:6:1", "nodeType": "YulIdentifier", "src": "128:6:1" }, { "kind": "number", + "nativeSrc": "136:1:1", "nodeType": "YulLiteral", "src": "136:1:1", "type": "", @@ -170,9 +177,11 @@ "functionName": { "name": "mul", + "nativeSrc": "124:3:1", "nodeType": "YulIdentifier", "src": "124:3:1" }, + "nativeSrc": "124:14:1", "nodeType": "YulFunctionCall", "src": "124:14:1" }, @@ -180,6 +189,7 @@ [ { "name": "y", + "nativeSrc": "119:1:1", "nodeType": "YulTypedName", "src": "119:1:1", "type": "" diff --git a/test/libsolidity/ASTJSON/assembly/slot_offset.sol b/test/libsolidity/ASTJSON/assembly/slot_offset.sol index d3c8f75542e2..0cc2b07c116b 100644 --- a/test/libsolidity/ASTJSON/assembly/slot_offset.sol +++ b/test/libsolidity/ASTJSON/assembly/slot_offset.sol @@ -5,5 +5,4 @@ contract C { assembly { let x := s.offset let y := mul(s.slot, 2) } } } - // ---- diff --git a/test/libsolidity/ASTJSON/assembly/slot_offset_parseOnly.json b/test/libsolidity/ASTJSON/assembly/slot_offset_parseOnly.json index ccf9c53fe133..ef8dc8b0adb8 100644 --- a/test/libsolidity/ASTJSON/assembly/slot_offset_parseOnly.json +++ b/test/libsolidity/ASTJSON/assembly/slot_offset_parseOnly.json @@ -89,16 +89,19 @@ { "AST": { + "nativeSrc": "95:45:1", "nodeType": "YulBlock", "src": "95:45:1", "statements": [ { + "nativeSrc": "97:17:1", "nodeType": "YulVariableDeclaration", "src": "97:17:1", "value": { "name": "s.offset", + "nativeSrc": "106:8:1", "nodeType": "YulIdentifier", "src": "106:8:1" }, @@ -106,6 +109,7 @@ [ { "name": "x", + "nativeSrc": "101:1:1", "nodeType": "YulTypedName", "src": "101:1:1", "type": "" @@ -113,6 +117,7 @@ ] }, { + "nativeSrc": "115:23:1", "nodeType": "YulVariableDeclaration", "src": "115:23:1", "value": @@ -121,11 +126,13 @@ [ { "name": "s.slot", + "nativeSrc": "128:6:1", "nodeType": "YulIdentifier", "src": "128:6:1" }, { "kind": "number", + "nativeSrc": "136:1:1", "nodeType": "YulLiteral", "src": "136:1:1", "type": "", @@ -135,9 +142,11 @@ "functionName": { "name": "mul", + "nativeSrc": "124:3:1", "nodeType": "YulIdentifier", "src": "124:3:1" }, + "nativeSrc": "124:14:1", "nodeType": "YulFunctionCall", "src": "124:14:1" }, @@ -145,6 +154,7 @@ [ { "name": "y", + "nativeSrc": "119:1:1", "nodeType": "YulTypedName", "src": "119:1:1", "type": "" diff --git a/test/libsolidity/ASTJSON/assembly/stringlit.json b/test/libsolidity/ASTJSON/assembly/stringlit.json index 33211190e5ae..ab27a3d16ff6 100644 --- a/test/libsolidity/ASTJSON/assembly/stringlit.json +++ b/test/libsolidity/ASTJSON/assembly/stringlit.json @@ -39,17 +39,20 @@ { "AST": { + "nativeSrc": "56:18:1", "nodeType": "YulBlock", "src": "56:18:1", "statements": [ { + "nativeSrc": "58:14:1", "nodeType": "YulVariableDeclaration", "src": "58:14:1", "value": { "hexValue": "616263", "kind": "string", + "nativeSrc": "67:5:1", "nodeType": "YulLiteral", "src": "67:5:1", "type": "", @@ -59,6 +62,7 @@ [ { "name": "x", + "nativeSrc": "62:1:1", "nodeType": "YulTypedName", "src": "62:1:1", "type": "" diff --git a/test/libsolidity/ASTJSON/assembly/stringlit.sol b/test/libsolidity/ASTJSON/assembly/stringlit.sol index e382095ad0be..6f5278ac17f1 100644 --- a/test/libsolidity/ASTJSON/assembly/stringlit.sol +++ b/test/libsolidity/ASTJSON/assembly/stringlit.sol @@ -3,5 +3,4 @@ contract C { assembly { let x := "abc" } } } - // ---- diff --git a/test/libsolidity/ASTJSON/assembly/stringlit_parseOnly.json b/test/libsolidity/ASTJSON/assembly/stringlit_parseOnly.json index dd4e1d0610ff..3cb2a907287d 100644 --- a/test/libsolidity/ASTJSON/assembly/stringlit_parseOnly.json +++ b/test/libsolidity/ASTJSON/assembly/stringlit_parseOnly.json @@ -26,17 +26,20 @@ { "AST": { + "nativeSrc": "56:18:1", "nodeType": "YulBlock", "src": "56:18:1", "statements": [ { + "nativeSrc": "58:14:1", "nodeType": "YulVariableDeclaration", "src": "58:14:1", "value": { "hexValue": "616263", "kind": "string", + "nativeSrc": "67:5:1", "nodeType": "YulLiteral", "src": "67:5:1", "type": "", @@ -46,6 +49,7 @@ [ { "name": "x", + "nativeSrc": "62:1:1", "nodeType": "YulTypedName", "src": "62:1:1", "type": "" diff --git a/test/libsolidity/ASTJSON/assembly/switch.json b/test/libsolidity/ASTJSON/assembly/switch.json index 26874da0e978..99c69e048bfb 100644 --- a/test/libsolidity/ASTJSON/assembly/switch.json +++ b/test/libsolidity/ASTJSON/assembly/switch.json @@ -39,16 +39,19 @@ { "AST": { + "nativeSrc": "61:129:1", "nodeType": "YulBlock", "src": "61:129:1", "statements": [ { + "nativeSrc": "75:10:1", "nodeType": "YulVariableDeclaration", "src": "75:10:1", "value": { "kind": "number", + "nativeSrc": "84:1:1", "nodeType": "YulLiteral", "src": "84:1:1", "type": "", @@ -58,6 +61,7 @@ [ { "name": "v", + "nativeSrc": "79:1:1", "nodeType": "YulTypedName", "src": "79:1:1", "type": "" @@ -70,16 +74,19 @@ { "body": { + "nativeSrc": "139:10:1", "nodeType": "YulBlock", "src": "139:10:1", "statements": [ { + "nativeSrc": "141:6:1", "nodeType": "YulAssignment", "src": "141:6:1", "value": { "kind": "number", + "nativeSrc": "146:1:1", "nodeType": "YulLiteral", "src": "146:1:1", "type": "", @@ -89,6 +96,7 @@ [ { "name": "v", + "nativeSrc": "141:1:1", "nodeType": "YulIdentifier", "src": "141:1:1" } @@ -96,11 +104,13 @@ } ] }, + "nativeSrc": "132:17:1", "nodeType": "YulCase", "src": "132:17:1", "value": { "kind": "number", + "nativeSrc": "137:1:1", "nodeType": "YulLiteral", "src": "137:1:1", "type": "", @@ -110,16 +120,19 @@ { "body": { + "nativeSrc": "170:10:1", "nodeType": "YulBlock", "src": "170:10:1", "statements": [ { + "nativeSrc": "172:6:1", "nodeType": "YulAssignment", "src": "172:6:1", "value": { "kind": "number", + "nativeSrc": "177:1:1", "nodeType": "YulLiteral", "src": "177:1:1", "type": "", @@ -129,6 +142,7 @@ [ { "name": "v", + "nativeSrc": "172:1:1", "nodeType": "YulIdentifier", "src": "172:1:1" } @@ -136,6 +150,7 @@ } ] }, + "nativeSrc": "162:18:1", "nodeType": "YulCase", "src": "162:18:1", "value": "default" @@ -147,12 +162,15 @@ "functionName": { "name": "calldatasize", + "nativeSrc": "105:12:1", "nodeType": "YulIdentifier", "src": "105:12:1" }, + "nativeSrc": "105:14:1", "nodeType": "YulFunctionCall", "src": "105:14:1" }, + "nativeSrc": "98:82:1", "nodeType": "YulSwitch", "src": "98:82:1" } diff --git a/test/libsolidity/ASTJSON/assembly/switch.sol b/test/libsolidity/ASTJSON/assembly/switch.sol index c04d311b09e4..a7a23d26aac3 100644 --- a/test/libsolidity/ASTJSON/assembly/switch.sol +++ b/test/libsolidity/ASTJSON/assembly/switch.sol @@ -8,5 +8,4 @@ contract C { } } } - // ---- diff --git a/test/libsolidity/ASTJSON/assembly/switch_default.json b/test/libsolidity/ASTJSON/assembly/switch_default.json index d472ea0183a1..07f804f3cb74 100644 --- a/test/libsolidity/ASTJSON/assembly/switch_default.json +++ b/test/libsolidity/ASTJSON/assembly/switch_default.json @@ -39,6 +39,7 @@ { "AST": { + "nativeSrc": "61:33:1", "nodeType": "YulBlock", "src": "61:33:1", "statements": @@ -49,15 +50,18 @@ { "body": { + "nativeSrc": "79:2:1", "nodeType": "YulBlock", "src": "79:2:1", "statements": [] }, + "nativeSrc": "72:9:1", "nodeType": "YulCase", "src": "72:9:1", "value": { "kind": "number", + "nativeSrc": "77:1:1", "nodeType": "YulLiteral", "src": "77:1:1", "type": "", @@ -67,10 +71,12 @@ { "body": { + "nativeSrc": "90:2:1", "nodeType": "YulBlock", "src": "90:2:1", "statements": [] }, + "nativeSrc": "82:10:1", "nodeType": "YulCase", "src": "82:10:1", "value": "default" @@ -79,11 +85,13 @@ "expression": { "kind": "number", + "nativeSrc": "70:1:1", "nodeType": "YulLiteral", "src": "70:1:1", "type": "", "value": "0" }, + "nativeSrc": "63:29:1", "nodeType": "YulSwitch", "src": "63:29:1" } diff --git a/test/libsolidity/ASTJSON/assembly/switch_default.sol b/test/libsolidity/ASTJSON/assembly/switch_default.sol index 1f61896fe275..0760bb7dfdb7 100644 --- a/test/libsolidity/ASTJSON/assembly/switch_default.sol +++ b/test/libsolidity/ASTJSON/assembly/switch_default.sol @@ -3,5 +3,4 @@ contract C { assembly { switch 0 case 0 {} default {} } } } - // ---- diff --git a/test/libsolidity/ASTJSON/assembly/switch_default_parseOnly.json b/test/libsolidity/ASTJSON/assembly/switch_default_parseOnly.json index e4a3e1b40c77..2ec302770814 100644 --- a/test/libsolidity/ASTJSON/assembly/switch_default_parseOnly.json +++ b/test/libsolidity/ASTJSON/assembly/switch_default_parseOnly.json @@ -26,6 +26,7 @@ { "AST": { + "nativeSrc": "61:33:1", "nodeType": "YulBlock", "src": "61:33:1", "statements": @@ -36,15 +37,18 @@ { "body": { + "nativeSrc": "79:2:1", "nodeType": "YulBlock", "src": "79:2:1", "statements": [] }, + "nativeSrc": "72:9:1", "nodeType": "YulCase", "src": "72:9:1", "value": { "kind": "number", + "nativeSrc": "77:1:1", "nodeType": "YulLiteral", "src": "77:1:1", "type": "", @@ -54,10 +58,12 @@ { "body": { + "nativeSrc": "90:2:1", "nodeType": "YulBlock", "src": "90:2:1", "statements": [] }, + "nativeSrc": "82:10:1", "nodeType": "YulCase", "src": "82:10:1", "value": "default" @@ -66,11 +72,13 @@ "expression": { "kind": "number", + "nativeSrc": "70:1:1", "nodeType": "YulLiteral", "src": "70:1:1", "type": "", "value": "0" }, + "nativeSrc": "63:29:1", "nodeType": "YulSwitch", "src": "63:29:1" } diff --git a/test/libsolidity/ASTJSON/assembly/switch_parseOnly.json b/test/libsolidity/ASTJSON/assembly/switch_parseOnly.json index d7392a8c8c63..2412ea48dd0c 100644 --- a/test/libsolidity/ASTJSON/assembly/switch_parseOnly.json +++ b/test/libsolidity/ASTJSON/assembly/switch_parseOnly.json @@ -26,16 +26,19 @@ { "AST": { + "nativeSrc": "61:129:1", "nodeType": "YulBlock", "src": "61:129:1", "statements": [ { + "nativeSrc": "75:10:1", "nodeType": "YulVariableDeclaration", "src": "75:10:1", "value": { "kind": "number", + "nativeSrc": "84:1:1", "nodeType": "YulLiteral", "src": "84:1:1", "type": "", @@ -45,6 +48,7 @@ [ { "name": "v", + "nativeSrc": "79:1:1", "nodeType": "YulTypedName", "src": "79:1:1", "type": "" @@ -57,16 +61,19 @@ { "body": { + "nativeSrc": "139:10:1", "nodeType": "YulBlock", "src": "139:10:1", "statements": [ { + "nativeSrc": "141:6:1", "nodeType": "YulAssignment", "src": "141:6:1", "value": { "kind": "number", + "nativeSrc": "146:1:1", "nodeType": "YulLiteral", "src": "146:1:1", "type": "", @@ -76,6 +83,7 @@ [ { "name": "v", + "nativeSrc": "141:1:1", "nodeType": "YulIdentifier", "src": "141:1:1" } @@ -83,11 +91,13 @@ } ] }, + "nativeSrc": "132:17:1", "nodeType": "YulCase", "src": "132:17:1", "value": { "kind": "number", + "nativeSrc": "137:1:1", "nodeType": "YulLiteral", "src": "137:1:1", "type": "", @@ -97,16 +107,19 @@ { "body": { + "nativeSrc": "170:10:1", "nodeType": "YulBlock", "src": "170:10:1", "statements": [ { + "nativeSrc": "172:6:1", "nodeType": "YulAssignment", "src": "172:6:1", "value": { "kind": "number", + "nativeSrc": "177:1:1", "nodeType": "YulLiteral", "src": "177:1:1", "type": "", @@ -116,6 +129,7 @@ [ { "name": "v", + "nativeSrc": "172:1:1", "nodeType": "YulIdentifier", "src": "172:1:1" } @@ -123,6 +137,7 @@ } ] }, + "nativeSrc": "162:18:1", "nodeType": "YulCase", "src": "162:18:1", "value": "default" @@ -134,12 +149,15 @@ "functionName": { "name": "calldatasize", + "nativeSrc": "105:12:1", "nodeType": "YulIdentifier", "src": "105:12:1" }, + "nativeSrc": "105:14:1", "nodeType": "YulFunctionCall", "src": "105:14:1" }, + "nativeSrc": "98:82:1", "nodeType": "YulSwitch", "src": "98:82:1" } diff --git a/test/libsolidity/ASTJSON/assembly/var_access.json b/test/libsolidity/ASTJSON/assembly/var_access.json index c93667df2aa3..ae7845815fa2 100644 --- a/test/libsolidity/ASTJSON/assembly/var_access.json +++ b/test/libsolidity/ASTJSON/assembly/var_access.json @@ -81,16 +81,19 @@ { "AST": { + "nativeSrc": "77:10:1", "nodeType": "YulBlock", "src": "77:10:1", "statements": [ { + "nativeSrc": "79:6:1", "nodeType": "YulAssignment", "src": "79:6:1", "value": { "kind": "number", + "nativeSrc": "84:1:1", "nodeType": "YulLiteral", "src": "84:1:1", "type": "", @@ -100,6 +103,7 @@ [ { "name": "x", + "nativeSrc": "79:1:1", "nodeType": "YulIdentifier", "src": "79:1:1" } diff --git a/test/libsolidity/ASTJSON/assembly/var_access.sol b/test/libsolidity/ASTJSON/assembly/var_access.sol index 768f38c3342c..e4b7423fde04 100644 --- a/test/libsolidity/ASTJSON/assembly/var_access.sol +++ b/test/libsolidity/ASTJSON/assembly/var_access.sol @@ -4,5 +4,4 @@ contract C { assembly { x := 7 } } } - // ---- diff --git a/test/libsolidity/ASTJSON/assembly/var_access_parseOnly.json b/test/libsolidity/ASTJSON/assembly/var_access_parseOnly.json index b56324944f26..ca3fcf92c91e 100644 --- a/test/libsolidity/ASTJSON/assembly/var_access_parseOnly.json +++ b/test/libsolidity/ASTJSON/assembly/var_access_parseOnly.json @@ -59,16 +59,19 @@ { "AST": { + "nativeSrc": "77:10:1", "nodeType": "YulBlock", "src": "77:10:1", "statements": [ { + "nativeSrc": "79:6:1", "nodeType": "YulAssignment", "src": "79:6:1", "value": { "kind": "number", + "nativeSrc": "84:1:1", "nodeType": "YulLiteral", "src": "84:1:1", "type": "", @@ -78,6 +81,7 @@ [ { "name": "x", + "nativeSrc": "79:1:1", "nodeType": "YulIdentifier", "src": "79:1:1" } diff --git a/test/libsolidity/ASTJSON/constructor.sol b/test/libsolidity/ASTJSON/constructor.sol index b2b1c646048b..b48aa1be342a 100644 --- a/test/libsolidity/ASTJSON/constructor.sol +++ b/test/libsolidity/ASTJSON/constructor.sol @@ -2,5 +2,4 @@ contract C { constructor() { } } - // ---- diff --git a/test/libsolidity/ASTJSON/documentation.sol b/test/libsolidity/ASTJSON/documentation.sol index 4d354dd26a1d..6bbf4042af60 100644 --- a/test/libsolidity/ASTJSON/documentation.sol +++ b/test/libsolidity/ASTJSON/documentation.sol @@ -16,5 +16,4 @@ contract C { /** Some comment on mod.*/ modifier mod() { _; } /** Some comment on fn.*/ function fn() public {} } - // ---- diff --git a/test/libsolidity/ASTJSON/documentation_local_variable.sol b/test/libsolidity/ASTJSON/documentation_local_variable.sol index b21602d9280b..a593e0194a9a 100644 --- a/test/libsolidity/ASTJSON/documentation_local_variable.sol +++ b/test/libsolidity/ASTJSON/documentation_local_variable.sol @@ -21,5 +21,4 @@ contract C { uint param3 ) public {} } - // ---- diff --git a/test/libsolidity/ASTJSON/documentation_on_statements.sol b/test/libsolidity/ASTJSON/documentation_on_statements.sol index 235fa3d20bb4..9506bb05c165 100644 --- a/test/libsolidity/ASTJSON/documentation_on_statements.sol +++ b/test/libsolidity/ASTJSON/documentation_on_statements.sol @@ -12,5 +12,4 @@ contract C { return x; } } - // ---- diff --git a/test/libsolidity/ASTJSON/documentation_triple.sol b/test/libsolidity/ASTJSON/documentation_triple.sol index 578933d9c74e..5b14e58f6f05 100644 --- a/test/libsolidity/ASTJSON/documentation_triple.sol +++ b/test/libsolidity/ASTJSON/documentation_triple.sol @@ -12,5 +12,4 @@ contract C { return x; } } - // ---- diff --git a/test/libsolidity/ASTJSON/event_with_variables_of_internal_types.sol b/test/libsolidity/ASTJSON/event_with_variables_of_internal_types.sol index a2291057003d..6fe58c39c168 100644 --- a/test/libsolidity/ASTJSON/event_with_variables_of_internal_types.sol +++ b/test/libsolidity/ASTJSON/event_with_variables_of_internal_types.sol @@ -1,5 +1,4 @@ contract C { event E(function() internal); } - // ---- diff --git a/test/libsolidity/ASTJSON/fail_after_parsing.sol b/test/libsolidity/ASTJSON/fail_after_parsing.sol index b3b53a7c1611..882b4c950267 100644 --- a/test/libsolidity/ASTJSON/fail_after_parsing.sol +++ b/test/libsolidity/ASTJSON/fail_after_parsing.sol @@ -11,6 +11,5 @@ interface I { uint calldata c = 123.4; } } - // ---- // failAfter: Parsed diff --git a/test/libsolidity/ASTJSON/fallback.sol b/test/libsolidity/ASTJSON/fallback.sol index 219d85db593a..170e77958c97 100644 --- a/test/libsolidity/ASTJSON/fallback.sol +++ b/test/libsolidity/ASTJSON/fallback.sol @@ -2,5 +2,4 @@ contract C { fallback() external payable { } } - // ---- diff --git a/test/libsolidity/ASTJSON/fallback_and_receive_ether.sol b/test/libsolidity/ASTJSON/fallback_and_receive_ether.sol index 89acccf5a603..7eb712582db6 100644 --- a/test/libsolidity/ASTJSON/fallback_and_receive_ether.sol +++ b/test/libsolidity/ASTJSON/fallback_and_receive_ether.sol @@ -4,5 +4,4 @@ contract C { fallback() external payable { } } - // ---- diff --git a/test/libsolidity/ASTJSON/fallback_payable.sol b/test/libsolidity/ASTJSON/fallback_payable.sol index d66d378aff8d..7eff747af373 100644 --- a/test/libsolidity/ASTJSON/fallback_payable.sol +++ b/test/libsolidity/ASTJSON/fallback_payable.sol @@ -1,5 +1,4 @@ contract C { fallback() external {} } - // ---- diff --git a/test/libsolidity/ASTJSON/mappings.sol b/test/libsolidity/ASTJSON/mappings.sol index 05912d21f703..5412ca601eb9 100644 --- a/test/libsolidity/ASTJSON/mappings.sol +++ b/test/libsolidity/ASTJSON/mappings.sol @@ -5,5 +5,4 @@ contract C { mapping(E => bool) c; mapping(address keyAddress => uint256 value) d; } - // ---- diff --git a/test/libsolidity/ASTJSON/mutability.sol b/test/libsolidity/ASTJSON/mutability.sol index 7688186e773f..3f67c29e0981 100644 --- a/test/libsolidity/ASTJSON/mutability.sol +++ b/test/libsolidity/ASTJSON/mutability.sol @@ -4,5 +4,4 @@ contract C uint public constant b = 2; uint public c = 3; } - // ---- diff --git a/test/libsolidity/ASTJSON/not_existing_import.sol b/test/libsolidity/ASTJSON/not_existing_import.sol index 7251a02b84a5..ad3c100c499b 100644 --- a/test/libsolidity/ASTJSON/not_existing_import.sol +++ b/test/libsolidity/ASTJSON/not_existing_import.sol @@ -4,6 +4,5 @@ contract C is NotExisting.X NotExisting.SomeStruct public myStruct; constructor() {} } - // ---- // failAfter: Parsed diff --git a/test/libsolidity/ASTJSON/override.sol b/test/libsolidity/ASTJSON/override.sol index 1aaa58c600ab..a03244985744 100644 --- a/test/libsolidity/ASTJSON/override.sol +++ b/test/libsolidity/ASTJSON/override.sol @@ -9,5 +9,4 @@ contract C is B { function foo() public override { } function faa() public override { } } - // ---- diff --git a/test/libsolidity/ASTJSON/pragma_experimental_solidity.json b/test/libsolidity/ASTJSON/pragma_experimental_solidity.json new file mode 100644 index 000000000000..66ece94e08c8 --- /dev/null +++ b/test/libsolidity/ASTJSON/pragma_experimental_solidity.json @@ -0,0 +1,21 @@ +{ + "absolutePath": "a", + "experimentalSolidity": true, + "exportedSymbols": {}, + "id": 2, + "nodeType": "SourceUnit", + "nodes": + [ + { + "id": 1, + "literals": + [ + "experimental", + "solidity" + ], + "nodeType": "PragmaDirective", + "src": "0:29:1" + } + ], + "src": "0:70:1" +} diff --git a/test/libsolidity/ASTJSON/pragma_experimental_solidity.sol b/test/libsolidity/ASTJSON/pragma_experimental_solidity.sol new file mode 100644 index 000000000000..b902bb061dbe --- /dev/null +++ b/test/libsolidity/ASTJSON/pragma_experimental_solidity.sol @@ -0,0 +1,4 @@ +pragma experimental solidity; +// ==== +// EVMVersion: >=constantinople +// ---- diff --git a/test/libsolidity/ASTJSON/pragma_experimental_solidity_parseOnly.json b/test/libsolidity/ASTJSON/pragma_experimental_solidity_parseOnly.json new file mode 100644 index 000000000000..b1ac937a2427 --- /dev/null +++ b/test/libsolidity/ASTJSON/pragma_experimental_solidity_parseOnly.json @@ -0,0 +1,20 @@ +{ + "absolutePath": "a", + "experimentalSolidity": true, + "id": 2, + "nodeType": "SourceUnit", + "nodes": + [ + { + "id": 1, + "literals": + [ + "experimental", + "solidity" + ], + "nodeType": "PragmaDirective", + "src": "0:29:1" + } + ], + "src": "0:70:1" +} diff --git a/test/libsolidity/ASTJSON/receive_ether.sol b/test/libsolidity/ASTJSON/receive_ether.sol index f75a43b2dfd1..1e59dc1317bc 100644 --- a/test/libsolidity/ASTJSON/receive_ether.sol +++ b/test/libsolidity/ASTJSON/receive_ether.sol @@ -2,5 +2,4 @@ contract C { receive() external payable { } } - // ---- diff --git a/test/libsolidity/ASTJSON/two_base_functions.sol b/test/libsolidity/ASTJSON/two_base_functions.sol index 89c8e207a531..0a00bcc14505 100644 --- a/test/libsolidity/ASTJSON/two_base_functions.sol +++ b/test/libsolidity/ASTJSON/two_base_functions.sol @@ -7,5 +7,4 @@ contract B { contract C is A, B { function f() public override(A, B) {} } - // ---- diff --git a/test/libsolidity/ASTJSON/used_errors.sol b/test/libsolidity/ASTJSON/used_errors.sol index 24c03982fed6..97f7a27f48e2 100644 --- a/test/libsolidity/ASTJSON/used_errors.sol +++ b/test/libsolidity/ASTJSON/used_errors.sol @@ -4,5 +4,4 @@ contract C { error T(); function h() public { f(); } } - // ---- diff --git a/test/libsolidity/ASTJSON/userDefinedValueType.sol b/test/libsolidity/ASTJSON/userDefinedValueType.sol index f1124f8cd6fd..d5ef2e00b9f8 100644 --- a/test/libsolidity/ASTJSON/userDefinedValueType.sol +++ b/test/libsolidity/ASTJSON/userDefinedValueType.sol @@ -9,5 +9,4 @@ contract C { type MyUInt is uint; mapping(MyAddress => MyUInt) public m; } - // ---- diff --git a/test/libsolidity/ASTJSON/user_defined_operator.sol b/test/libsolidity/ASTJSON/user_defined_operator.sol index df5d0ed32609..bfbdf7b9bf83 100644 --- a/test/libsolidity/ASTJSON/user_defined_operator.sol +++ b/test/libsolidity/ASTJSON/user_defined_operator.sol @@ -7,5 +7,4 @@ contract C { return -a - b; } } - // ---- diff --git a/test/libsolidity/ASTJSON/yul_hex_literal.json b/test/libsolidity/ASTJSON/yul_hex_literal.json index 0b3fa41741b3..0498289c6729 100644 --- a/test/libsolidity/ASTJSON/yul_hex_literal.json +++ b/test/libsolidity/ASTJSON/yul_hex_literal.json @@ -39,17 +39,20 @@ { "AST": { + "nativeSrc": "66:142:1", "nodeType": "YulBlock", "src": "66:142:1", "statements": [ { + "nativeSrc": "80:15:1", "nodeType": "YulVariableDeclaration", "src": "80:15:1", "value": { "hexValue": "74657374", "kind": "string", + "nativeSrc": "89:6:1", "nodeType": "YulLiteral", "src": "89:6:1", "type": "", @@ -59,6 +62,7 @@ [ { "name": "a", + "nativeSrc": "84:1:1", "nodeType": "YulTypedName", "src": "84:1:1", "type": "" @@ -66,12 +70,14 @@ ] }, { + "nativeSrc": "108:54:1", "nodeType": "YulVariableDeclaration", "src": "108:54:1", "value": { "hexValue": "112233445566778899aabbccddeeff6677889900", "kind": "string", + "nativeSrc": "117:45:1", "nodeType": "YulLiteral", "src": "117:45:1", "type": "" @@ -80,6 +86,7 @@ [ { "name": "b", + "nativeSrc": "112:1:1", "nodeType": "YulTypedName", "src": "112:1:1", "type": "" @@ -87,12 +94,14 @@ ] }, { + "nativeSrc": "175:23:1", "nodeType": "YulVariableDeclaration", "src": "175:23:1", "value": { "hexValue": "1234abcd", "kind": "string", + "nativeSrc": "184:14:1", "nodeType": "YulLiteral", "src": "184:14:1", "type": "" @@ -101,6 +110,7 @@ [ { "name": "c", + "nativeSrc": "179:1:1", "nodeType": "YulTypedName", "src": "179:1:1", "type": "" diff --git a/test/libsolidity/ASTJSON/yul_hex_literal.sol b/test/libsolidity/ASTJSON/yul_hex_literal.sol index f441866c1d1b..c3b57a8fe8d2 100644 --- a/test/libsolidity/ASTJSON/yul_hex_literal.sol +++ b/test/libsolidity/ASTJSON/yul_hex_literal.sol @@ -7,5 +7,4 @@ contract Sample { } } } - // ---- diff --git a/test/libsolidity/ASTJSON/yul_hex_literal_parseOnly.json b/test/libsolidity/ASTJSON/yul_hex_literal_parseOnly.json index 3551ac2d99a4..023c13cc7423 100644 --- a/test/libsolidity/ASTJSON/yul_hex_literal_parseOnly.json +++ b/test/libsolidity/ASTJSON/yul_hex_literal_parseOnly.json @@ -26,17 +26,20 @@ { "AST": { + "nativeSrc": "66:142:1", "nodeType": "YulBlock", "src": "66:142:1", "statements": [ { + "nativeSrc": "80:15:1", "nodeType": "YulVariableDeclaration", "src": "80:15:1", "value": { "hexValue": "74657374", "kind": "string", + "nativeSrc": "89:6:1", "nodeType": "YulLiteral", "src": "89:6:1", "type": "", @@ -46,6 +49,7 @@ [ { "name": "a", + "nativeSrc": "84:1:1", "nodeType": "YulTypedName", "src": "84:1:1", "type": "" @@ -53,12 +57,14 @@ ] }, { + "nativeSrc": "108:54:1", "nodeType": "YulVariableDeclaration", "src": "108:54:1", "value": { "hexValue": "112233445566778899aabbccddeeff6677889900", "kind": "string", + "nativeSrc": "117:45:1", "nodeType": "YulLiteral", "src": "117:45:1", "type": "" @@ -67,6 +73,7 @@ [ { "name": "b", + "nativeSrc": "112:1:1", "nodeType": "YulTypedName", "src": "112:1:1", "type": "" @@ -74,12 +81,14 @@ ] }, { + "nativeSrc": "175:23:1", "nodeType": "YulVariableDeclaration", "src": "175:23:1", "value": { "hexValue": "1234abcd", "kind": "string", + "nativeSrc": "184:14:1", "nodeType": "YulLiteral", "src": "184:14:1", "type": "" @@ -88,6 +97,7 @@ [ { "name": "c", + "nativeSrc": "179:1:1", "nodeType": "YulTypedName", "src": "179:1:1", "type": "" diff --git a/test/libsolidity/ASTJSONTest.cpp b/test/libsolidity/ASTJSONTest.cpp index 3602e1485913..6f264fc131ef 100644 --- a/test/libsolidity/ASTJSONTest.cpp +++ b/test/libsolidity/ASTJSONTest.cpp @@ -181,7 +181,8 @@ void ASTJSONTest::validateTestConfiguration() const } } -ASTJSONTest::ASTJSONTest(string const& _filename) +ASTJSONTest::ASTJSONTest(string const& _filename): + EVMVersionRestrictedTestCase(_filename) { if (!boost::algorithm::ends_with(_filename, ".sol")) BOOST_THROW_EXCEPTION(runtime_error("Invalid test contract file name: \"" + _filename + "\".")); diff --git a/test/libsolidity/ASTJSONTest.h b/test/libsolidity/ASTJSONTest.h index 648f3bbc3234..1e74b62fec8e 100644 --- a/test/libsolidity/ASTJSONTest.h +++ b/test/libsolidity/ASTJSONTest.h @@ -35,7 +35,7 @@ class CompilerStack; namespace solidity::frontend::test { -class ASTJSONTest: public TestCase +class ASTJSONTest: public EVMVersionRestrictedTestCase { public: struct TestVariant diff --git a/test/libsolidity/SMTCheckerTest.cpp b/test/libsolidity/SMTCheckerTest.cpp index 9495895278ab..288527e04899 100644 --- a/test/libsolidity/SMTCheckerTest.cpp +++ b/test/libsolidity/SMTCheckerTest.cpp @@ -122,6 +122,9 @@ SMTCheckerTest::SMTCheckerTest(string const& _filename): SyntaxTest(_filename, E m_shouldRun = false; #endif } + + auto const& bmcLoopIterations = m_reader.sizetSetting("BMCLoopIterations", 1); + m_modelCheckerSettings.bmcLoopIterations = std::optional{bmcLoopIterations}; } TestCase::TestResult SMTCheckerTest::run(ostream& _stream, string const& _linePrefix, bool _formatted) diff --git a/test/libsolidity/SMTCheckerTest.h b/test/libsolidity/SMTCheckerTest.h index 54d23c74fbcc..965705f30c77 100644 --- a/test/libsolidity/SMTCheckerTest.h +++ b/test/libsolidity/SMTCheckerTest.h @@ -55,6 +55,8 @@ class SMTCheckerTest: public SyntaxTest Set in m_modelCheckerSettings. SMTSolvers: `all`, `cvc4`, `z3`, `none`, where the default is `all`. Set in m_modelCheckerSettings. + BMCLoopIterations: number of loop iterations for BMC engine, the default is 1. + Set in m_modelCheckerSettings. */ ModelCheckerSettings m_modelCheckerSettings; diff --git a/test/libsolidity/SemanticTest.cpp b/test/libsolidity/SemanticTest.cpp index 4746999a3ec8..50f2a3cf1028 100644 --- a/test/libsolidity/SemanticTest.cpp +++ b/test/libsolidity/SemanticTest.cpp @@ -50,7 +50,6 @@ SemanticTest::SemanticTest( langutil::EVMVersion _evmVersion, optional _eofVersion, vector const& _vmPaths, - bool _enforceCompileToEwasm, bool _enforceGasCost, u256 _enforceGasCostMinValue ): @@ -60,7 +59,6 @@ SemanticTest::SemanticTest( m_lineOffset(m_reader.lineNumber()), m_builtins(makeBuiltins()), m_sideEffectHooks(makeSideEffectHooks()), - m_enforceCompileToEwasm(_enforceCompileToEwasm), m_enforceGasCost(_enforceGasCost), m_enforceGasCostMinValue(std::move(_enforceGasCostMinValue)) { @@ -83,25 +81,6 @@ SemanticTest::SemanticTest( m_testCaseWantsYulRun = util::contains(yulRunTriggers, compileViaYul); m_testCaseWantsLegacyRun = util::contains(legacyRunTriggers, compileViaYul); - // Do not enforce ewasm, if via yul was explicitly denied. - if (compileViaYul == "false") - m_enforceCompileToEwasm = false; - - string compileToEwasm = m_reader.stringSetting("compileToEwasm", "false"); - if (compileToEwasm == "also") - m_testCaseWantsEwasmRun = true; - else if (compileToEwasm == "false") - m_testCaseWantsEwasmRun = false; - else - BOOST_THROW_EXCEPTION(runtime_error("Invalid compileToEwasm value: " + compileToEwasm + ".")); - - if (m_testCaseWantsEwasmRun && !m_testCaseWantsYulRun) - BOOST_THROW_EXCEPTION(runtime_error("Invalid compileToEwasm value: " + compileToEwasm + ", compileViaYul need to be enabled.")); - - // run ewasm tests only if an ewasm evmc vm was defined - if (m_testCaseWantsEwasmRun && !m_supportsEwasm) - m_testCaseWantsEwasmRun = false; - auto revertStrings = revertStringsFromString(m_reader.stringSetting("revertStrings", "default")); soltestAssert(revertStrings, "Invalid revertStrings setting."); m_revertStrings = revertStrings.value(); @@ -298,24 +277,10 @@ TestCase::TestResult SemanticTest::run(ostream& _stream, string const& _linePref TestResult result = TestResult::Success; if (m_testCaseWantsLegacyRun && !m_eofVersion.has_value()) - result = runTest(_stream, _linePrefix, _formatted, false, false); + result = runTest(_stream, _linePrefix, _formatted, false); if (m_testCaseWantsYulRun && result == TestResult::Success) - result = runTest(_stream, _linePrefix, _formatted, true, false); - - if (!m_eofVersion.has_value() && (m_testCaseWantsEwasmRun || m_enforceCompileToEwasm) && result == TestResult::Success) - { - // TODO: Once we have full Ewasm support, we could remove try/catch here. - try - { - result = runTest(_stream, _linePrefix, _formatted, true, true); - } - catch (...) - { - if (!m_enforceCompileToEwasm) - throw; - } - } + result = runTest(_stream, _linePrefix, _formatted, true); if (result != TestResult::Success) solidity::test::CommonOptions::get().printSelectedOptions( @@ -331,33 +296,19 @@ TestCase::TestResult SemanticTest::runTest( ostream& _stream, string const& _linePrefix, bool _formatted, - bool _isYulRun, - bool _isEwasmRun) + bool _isYulRun) { bool success = true; m_gasCostFailure = false; - if (_isEwasmRun) - { - soltestAssert(_isYulRun, ""); - selectVM(evmc_capabilities::EVMC_CAPABILITY_EWASM); - } - else - selectVM(evmc_capabilities::EVMC_CAPABILITY_EVM1); + selectVM(evmc_capabilities::EVMC_CAPABILITY_EVM1); reset(); m_compileViaYul = _isYulRun; - if (_isEwasmRun) - { - soltestAssert(m_compileViaYul, ""); - m_compileToEwasm = _isEwasmRun; - } - - m_canEnableEwasmRun = false; if (_isYulRun) - AnsiColorized(_stream, _formatted, {BOLD, CYAN}) << _linePrefix << "Running via Yul" << (_isEwasmRun ? " (ewasm):" : ":") << endl; + AnsiColorized(_stream, _formatted, {BOLD, CYAN}) << _linePrefix << "Running via Yul: " << endl; for (TestFunctionCall& test: m_tests) test.reset(); @@ -459,7 +410,8 @@ TestCase::TestResult SemanticTest::runTest( test.setFailure(!m_transactionSuccessful); test.setRawBytes(std::move(output)); - test.setContractABI(m_compiler.contractABI(m_compiler.lastContractName(m_sources.mainSourceFile))); + if (test.call().kind != FunctionCall::Kind::LowLevel) + test.setContractABI(m_compiler.contractABI(m_compiler.lastContractName(m_sources.mainSourceFile))); } vector effects; @@ -470,31 +422,8 @@ TestCase::TestResult SemanticTest::runTest( success &= test.call().expectedSideEffects == test.call().actualSideEffects; } - // Right now we have sometimes different test results in Yul vs. Ewasm. - // The main reason is that Ewasm just returns a failure in some cases. - // TODO: If Ewasm support got fully implemented, we could implement this in the same way as above. - if (success && !m_testCaseWantsEwasmRun && _isEwasmRun) - { - // TODO: There is something missing in Ewasm to support other types of revert strings: - // for now, we just ignore test-cases that do not use RevertStrings::Default. - if (m_revertStrings != RevertStrings::Default) - return TestResult::Success; - - m_canEnableEwasmRun = true; - AnsiColorized(_stream, _formatted, {BOLD, YELLOW}) << - _linePrefix << endl << - _linePrefix << "Test can pass via Yul (Ewasm), but marked with \"compileToEwasm: false.\"" << endl; - return TestResult::Failure; - } - if (!success) { - // Ignore failing tests that can't yet get compiled to Ewasm: - // if the test run was not successful and enforce compiling to ewasm was set, - // but the test case did not want to get run with Ewasm, we just ignore this failure. - if (m_enforceCompileToEwasm && !m_testCaseWantsEwasmRun) - return TestResult::Success; - AnsiColorized(_stream, _formatted, {BOLD, CYAN}) << _linePrefix << "Expected result:" << endl; for (TestFunctionCall const& test: m_tests) { @@ -647,21 +576,12 @@ void SemanticTest::printUpdatedExpectations(ostream& _stream, string const&) con void SemanticTest::printUpdatedSettings(ostream& _stream, string const& _linePrefix) { auto& settings = m_reader.settings(); - if (settings.empty() && !m_canEnableEwasmRun) + if (settings.empty()) return; _stream << _linePrefix << "// ====" << endl; - if (m_canEnableEwasmRun) - { - soltestAssert(m_testCaseWantsYulRun, ""); - _stream << _linePrefix << "// compileToEwasm: also\n"; - } - for (auto const& [settingName, settingValue]: settings) - if ( - !(settingName == "compileToEwasm" && m_canEnableEwasmRun) - ) - _stream << _linePrefix << "// " << settingName << ": " << settingValue<< endl; + _stream << _linePrefix << "// " << settingName << ": " << settingValue<< endl; } void SemanticTest::parseExpectations(istream& _stream) diff --git a/test/libsolidity/SemanticTest.h b/test/libsolidity/SemanticTest.h index c5abb93e270d..b5b7be83afa9 100644 --- a/test/libsolidity/SemanticTest.h +++ b/test/libsolidity/SemanticTest.h @@ -53,7 +53,6 @@ class SemanticTest: public SolidityExecutionFramework, public EVMVersionRestrict _options.evmVersion, _options.eofVersion, _options.vmPaths, - _options.enforceCompileToEwasm, _options.enforceGasCost, _options.enforceGasCostMinValue ); @@ -64,7 +63,6 @@ class SemanticTest: public SolidityExecutionFramework, public EVMVersionRestrict langutil::EVMVersion _evmVersion, std::optional _eofVersion, std::vector const& _vmPaths, - bool _enforceCompileToEwasm = false, bool _enforceGasCost = false, u256 _enforceGasCostMinValue = 100000 ); @@ -85,7 +83,7 @@ class SemanticTest: public SolidityExecutionFramework, public EVMVersionRestrict bool deploy(std::string const& _contractName, u256 const& _value, bytes const& _arguments, std::map const& _libraries = {}); private: - TestResult runTest(std::ostream& _stream, std::string const& _linePrefix, bool _formatted, bool _isYulRun, bool _isEwasmRun); + TestResult runTest(std::ostream& _stream, std::string const& _linePrefix, bool _formatted, bool _isYulRun); bool checkGasCostExpectation(TestFunctionCall& io_test, bool _compileViaYul) const; std::map makeBuiltins(); std::vector makeSideEffectHooks() const; @@ -98,12 +96,9 @@ class SemanticTest: public SolidityExecutionFramework, public EVMVersionRestrict std::map const m_builtins; std::vector const m_sideEffectHooks; bool m_testCaseWantsYulRun = true; - bool m_testCaseWantsEwasmRun = false; bool m_testCaseWantsLegacyRun = true; - bool m_enforceCompileToEwasm = false; bool m_runWithABIEncoderV1Only = false; bool m_allowNonExistingFunctions = false; - bool m_canEnableEwasmRun = false; bool m_gasCostFailure = false; bool m_enforceGasCost = false; u256 m_enforceGasCostMinValue; diff --git a/test/libsolidity/SolidityEndToEndTest.cpp b/test/libsolidity/SolidityEndToEndTest.cpp index 268861fd2abc..b174419d21d2 100644 --- a/test/libsolidity/SolidityEndToEndTest.cpp +++ b/test/libsolidity/SolidityEndToEndTest.cpp @@ -53,33 +53,19 @@ using namespace solidity::langutil; #define ALSO_VIA_YUL(CODE) \ { \ - m_doEwasmTestrun = true; \ - \ m_compileViaYul = false; \ - m_compileToEwasm = false; \ { CODE } \ \ m_compileViaYul = true; \ reset(); \ { CODE } \ - \ - if (m_doEwasmTestrun) \ - { \ - m_compileToEwasm = true; \ - reset(); \ - { CODE } \ - } \ } -#define DISABLE_EWASM_TESTRUN() \ - { m_doEwasmTestrun = false; } - namespace solidity::frontend::test { struct SolidityEndToEndTestExecutionFramework: public SolidityExecutionFramework { - bool m_doEwasmTestrun = false; }; BOOST_FIXTURE_TEST_SUITE(SolidityEndToEndTest, SolidityEndToEndTestExecutionFramework) @@ -108,7 +94,6 @@ BOOST_AUTO_TEST_CASE(creation_code_optimizer) reset(); compileAndRun(codeC + codeD); ABI_CHECK(callContractFunction("f()"), encodeArgs(0x20, bytecodeC.size()) + encode(bytecodeC, false)); - m_doEwasmTestrun = false; }) } @@ -166,8 +151,6 @@ BOOST_AUTO_TEST_CASE(recursive_calls) } )"; ALSO_VIA_YUL( - DISABLE_EWASM_TESTRUN() - compileAndRun(sourceCode); function recursive_calls_cpp = [&recursive_calls_cpp](u256 const& n) -> u256 { @@ -193,8 +176,6 @@ BOOST_AUTO_TEST_CASE(while_loop) } )"; ALSO_VIA_YUL( - DISABLE_EWASM_TESTRUN() - compileAndRun(sourceCode); auto while_loop_cpp = [](u256 const& n) -> u256 @@ -223,8 +204,6 @@ BOOST_AUTO_TEST_CASE(do_while_loop) } )"; ALSO_VIA_YUL( - DISABLE_EWASM_TESTRUN() - compileAndRun(sourceCode); auto do_while_loop_cpp = [](u256 const& n) -> u256 @@ -270,8 +249,6 @@ BOOST_AUTO_TEST_CASE(do_while_loop_multiple_local_vars) } )"; ALSO_VIA_YUL( - DISABLE_EWASM_TESTRUN() - compileAndRun(sourceCode); auto do_while = [](u256 n) -> u256 @@ -322,8 +299,6 @@ BOOST_AUTO_TEST_CASE(nested_loops) } )"; ALSO_VIA_YUL( - DISABLE_EWASM_TESTRUN() - compileAndRun(sourceCode); auto nested_loops_cpp = [](u256 n) -> u256 @@ -390,8 +365,6 @@ BOOST_AUTO_TEST_CASE(nested_loops_multiple_local_vars) } )"; ALSO_VIA_YUL( - DISABLE_EWASM_TESTRUN() - compileAndRun(sourceCode); auto nested_loops_cpp = [](u256 n) -> u256 @@ -446,8 +419,6 @@ BOOST_AUTO_TEST_CASE(for_loop_multiple_local_vars) } )"; ALSO_VIA_YUL( - DISABLE_EWASM_TESTRUN() - compileAndRun(sourceCode); auto for_loop = [](u256 n) -> u256 @@ -509,8 +480,6 @@ BOOST_AUTO_TEST_CASE(nested_for_loop_multiple_local_vars) } )"; ALSO_VIA_YUL( - DISABLE_EWASM_TESTRUN() - compileAndRun(sourceCode); auto for_loop = [](u256 n) -> u256 @@ -551,8 +520,6 @@ BOOST_AUTO_TEST_CASE(for_loop) } )"; ALSO_VIA_YUL( - DISABLE_EWASM_TESTRUN() - compileAndRun(sourceCode); auto for_loop_cpp = [](u256 const& n) -> u256 @@ -580,8 +547,6 @@ BOOST_AUTO_TEST_CASE(for_loop_simple_init_expr) } )"; ALSO_VIA_YUL( - DISABLE_EWASM_TESTRUN() - compileAndRun(sourceCode); auto for_loop_simple_init_expr_cpp = [](u256 const& n) -> u256 @@ -621,7 +586,6 @@ BOOST_AUTO_TEST_CASE(for_loop_break_continue) } )"; ALSO_VIA_YUL( - DISABLE_EWASM_TESTRUN() compileAndRun(sourceCode); auto breakContinue = [](u256 const& n) -> u256 @@ -657,8 +621,6 @@ BOOST_AUTO_TEST_CASE(short_circuiting) } )"; ALSO_VIA_YUL( - DISABLE_EWASM_TESTRUN() - compileAndRun(sourceCode); auto short_circuiting_cpp = [](u256 n) -> u256 @@ -776,8 +738,6 @@ BOOST_AUTO_TEST_CASE(mapping_state_inc_dec) return --table[value++]; }; ALSO_VIA_YUL( - DISABLE_EWASM_TESTRUN() - compileAndRun(sourceCode); value = 0; table.clear(); @@ -804,8 +764,6 @@ BOOST_AUTO_TEST_CASE(multi_level_mapping) else return table[_x][_y] = _z; }; ALSO_VIA_YUL( - DISABLE_EWASM_TESTRUN() - compileAndRun(sourceCode); table.clear(); @@ -842,8 +800,6 @@ BOOST_AUTO_TEST_CASE(constructor) }; ALSO_VIA_YUL( - DISABLE_EWASM_TESTRUN() - compileAndRun(sourceCode); testContractAgainstCpp("get(uint256)", get, u256(6)); testContractAgainstCpp("get(uint256)", get, u256(7)); @@ -862,8 +818,6 @@ BOOST_AUTO_TEST_CASE(send_ether) } )"; ALSO_VIA_YUL( - DISABLE_EWASM_TESTRUN() - u256 amount(250); compileAndRun(sourceCode, amount + 1); h160 address(23); @@ -896,8 +850,6 @@ BOOST_AUTO_TEST_CASE(transfer_ether) } )"; ALSO_VIA_YUL( - DISABLE_EWASM_TESTRUN() - compileAndRun(sourceCode, 0, "B"); h160 const nonPayableRecipient = m_contractAddress; compileAndRun(sourceCode, 0, "C"); @@ -1237,8 +1189,6 @@ BOOST_AUTO_TEST_CASE(empty_name_input_parameter_with_named_one) } )"; ALSO_VIA_YUL( - DISABLE_EWASM_TESTRUN() - compileAndRun(sourceCode); BOOST_CHECK(callContractFunction("f(uint256,uint256)", 5, 9) != encodeArgs(5, 8)); ABI_CHECK(callContractFunction("f(uint256,uint256)", 5, 9), encodeArgs(9, 8)); @@ -1382,7 +1332,6 @@ BOOST_AUTO_TEST_CASE(library_call_protection) } )"; ALSO_VIA_YUL( - DISABLE_EWASM_TESTRUN() compileAndRun(sourceCode, 0, "Lib"); ABI_CHECK(callContractFunction("np(Lib.S storage)", 0), encodeArgs()); ABI_CHECK(callContractFunction("v(Lib.S storage)", 0), encodeArgs(m_sender)); @@ -1406,7 +1355,6 @@ BOOST_AUTO_TEST_CASE(bytes_from_calldata_to_memory) } )"; ALSO_VIA_YUL( - DISABLE_EWASM_TESTRUN(); compileAndRun(sourceCode); bytes calldata1 = util::selectorFromSignatureH32("f()").asBytes() + bytes(61, 0x22) + bytes(12, 0x12); sendMessage(calldata1, false); @@ -1446,7 +1394,6 @@ BOOST_AUTO_TEST_CASE(call_forward_bytes_length) } )"; ALSO_VIA_YUL( - DISABLE_EWASM_TESTRUN(); compileAndRun(sourceCode, 0, "sender"); // No additional data, just function selector @@ -1485,7 +1432,6 @@ BOOST_AUTO_TEST_CASE(copying_bytes_multiassign) } )"; ALSO_VIA_YUL( - DISABLE_EWASM_TESTRUN() compileAndRun(sourceCode, 0, "sender"); ABI_CHECK(callContractFunction("recv(uint256)", 7), bytes()); ABI_CHECK(callContractFunction("val()"), encodeArgs(0)); @@ -1508,7 +1454,6 @@ BOOST_AUTO_TEST_CASE(copy_from_calldata_removes_bytes_data) } )"; ALSO_VIA_YUL( - DISABLE_EWASM_TESTRUN() compileAndRun(sourceCode); ABI_CHECK(callContractFunction("set()", 1, 2, 3, 4, 5), encodeArgs(true)); BOOST_CHECK(!storageEmpty(m_contractAddress)); @@ -1569,7 +1514,6 @@ BOOST_AUTO_TEST_CASE(struct_referencing) } )"; ALSO_VIA_YUL( - DISABLE_EWASM_TESTRUN() compileAndRun(sourceCode, 0, "L"); ABI_CHECK(callContractFunction("f()"), encodeArgs(0, 3)); ABI_CHECK(callContractFunction("g()"), encodeArgs(4)); @@ -1618,7 +1562,6 @@ BOOST_AUTO_TEST_CASE(enum_referencing) } )"; ALSO_VIA_YUL( - DISABLE_EWASM_TESTRUN() compileAndRun(sourceCode, 0, "L"); ABI_CHECK(callContractFunction("f()"), encodeArgs(1)); ABI_CHECK(callContractFunction("g()"), encodeArgs(3)); @@ -1649,8 +1592,6 @@ BOOST_AUTO_TEST_CASE(bytes_in_arguments) } )"; ALSO_VIA_YUL( - DISABLE_EWASM_TESTRUN() - compileAndRun(sourceCode); string innercalldata1 = asString(util::selectorFromSignatureH32("f(uint256,uint256)").asBytes() + encodeArgs(8, 9)); @@ -1702,8 +1643,6 @@ BOOST_AUTO_TEST_CASE(array_copy_storage_abi) } )"; ALSO_VIA_YUL( - DISABLE_EWASM_TESTRUN() - compileAndRun(sourceCode); bytes valueSequence; for (size_t i = 0; i < 101; ++i) @@ -2138,8 +2077,6 @@ BOOST_AUTO_TEST_CASE(string_as_mapping_key) }; ALSO_VIA_YUL( - DISABLE_EWASM_TESTRUN() - compileAndRun(sourceCode, 0, "Test"); for (unsigned i = 0; i < strings.size(); i++) ABI_CHECK(callContractFunction( @@ -2308,7 +2245,6 @@ BOOST_AUTO_TEST_CASE(library_call) } )"; ALSO_VIA_YUL( - DISABLE_EWASM_TESTRUN() compileAndRun(sourceCode, 0, "Lib"); compileAndRun(sourceCode, 0, "Test", bytes(), map{{":Lib", m_contractAddress}}); ABI_CHECK(callContractFunction("f(uint256)", u256(33)), encodeArgs(u256(33) * 9)); @@ -2326,7 +2262,6 @@ BOOST_AUTO_TEST_CASE(library_function_external) } )"; ALSO_VIA_YUL( - DISABLE_EWASM_TESTRUN() compileAndRun(sourceCode, 0, "Lib"); compileAndRun(sourceCode, 0, "Test", bytes(), map{{":Lib", m_contractAddress}}); ABI_CHECK(callContractFunction("f(bytes)", u256(0x20), u256(5), "abcde"), encodeArgs("c")); @@ -2478,7 +2413,6 @@ BOOST_AUTO_TEST_CASE(short_strings) } )"; ALSO_VIA_YUL( - DISABLE_EWASM_TESTRUN() compileAndRun(sourceCode, 0, "A"); ABI_CHECK(callContractFunction("data1()"), encodeDyn(string("123"))); ABI_CHECK(callContractFunction("lengthChange()"), encodeArgs(u256(0))); @@ -2522,7 +2456,6 @@ BOOST_AUTO_TEST_CASE(reject_ether_sent_to_library) } )"; ALSO_VIA_YUL( - DISABLE_EWASM_TESTRUN() compileAndRun(sourceCode, 0, "lib"); Address libraryAddress = m_contractAddress; compileAndRun(sourceCode, 10, "c"); @@ -2737,7 +2670,6 @@ BOOST_AUTO_TEST_CASE(non_payable_throw) } )"; ALSO_VIA_YUL( - DISABLE_EWASM_TESTRUN() compileAndRun(sourceCode, 0, "C"); ABI_CHECK(callContractFunctionWithValue("f()", 27), encodeArgs()); BOOST_CHECK_EQUAL(balanceAt(m_contractAddress), 0); @@ -2784,7 +2716,6 @@ BOOST_AUTO_TEST_CASE(receive_external_function_type) )"; ALSO_VIA_YUL( - DISABLE_EWASM_TESTRUN() compileAndRun(sourceCode, 0, "C"); ABI_CHECK(callContractFunction( "f(function)", @@ -2839,8 +2770,6 @@ BOOST_AUTO_TEST_CASE(contracts_separated_with_comment) contract C2 {} )"; ALSO_VIA_YUL( - DISABLE_EWASM_TESTRUN() - compileAndRun(sourceCode, 0, "C1"); compileAndRun(sourceCode, 0, "C2"); ) @@ -3308,7 +3237,6 @@ BOOST_AUTO_TEST_CASE(bare_call_return_data) } )DELIMITER"; ALSO_VIA_YUL( - DISABLE_EWASM_TESTRUN() compileAndRun(sourceCode, 0, "C"); ABI_CHECK(callContractFunction("f(string)", encodeDyn(string("return_bool()"))), encodeArgs(true, 0x40, 0x20, true)); ABI_CHECK(callContractFunction("f(string)", encodeDyn(string("return_int32()"))), encodeArgs(true, 0x40, 0x20, u256(-32))); @@ -3369,7 +3297,6 @@ BOOST_AUTO_TEST_CASE(abi_encodePacked) for (auto v2: {false, true}) { ALSO_VIA_YUL( - DISABLE_EWASM_TESTRUN() string prefix = "pragma abicoder " + string(v2 ? "v2" : "v1") + ";\n"; compileAndRun(prefix + sourceCode, 0, "C"); ABI_CHECK(callContractFunction("f0()"), encodeArgs(0x20, 0)); @@ -3447,7 +3374,6 @@ BOOST_AUTO_TEST_CASE(abi_encodePacked_from_storage) for (auto v2: {false, true}) { ALSO_VIA_YUL( - DISABLE_EWASM_TESTRUN() string prefix = "pragma abicoder " + string(v2 ? "v2" : "v1") + ";\n"; compileAndRun(prefix + sourceCode, 0, "C"); bytes payload = encodeArgs(0xfffff1, 0, 0xfffff2, 0, 0, 0xfffff3, 0, 0, 0xfffff4); @@ -3521,7 +3447,6 @@ BOOST_AUTO_TEST_CASE(abi_encodePacked_from_memory) for (auto v2: {false, true}) { ALSO_VIA_YUL( - DISABLE_EWASM_TESTRUN() string prefix = "pragma abicoder " + string(v2 ? "v2" : "v1") + ";\n"; compileAndRun(prefix + sourceCode, 0, "C"); bytes payload = encodeArgs(0xfffff1, 0, 0xfffff2, 0, 0, 0xfffff3, 0, 0, 0xfffff4); @@ -3568,7 +3493,6 @@ BOOST_AUTO_TEST_CASE(abi_encodePacked_functionPtr) for (auto v2: {false, true}) { ALSO_VIA_YUL( - DISABLE_EWASM_TESTRUN() string prefix = "pragma abicoder " + string(v2 ? "v2" : "v1") + ";\n"; compileAndRun(prefix + sourceCode, 0, "C"); string directEncoding = asString(fromHex("08" "1112131400000000000011121314000000000087" "26121ff0" "02")); @@ -3611,7 +3535,6 @@ BOOST_AUTO_TEST_CASE(abi_encodePackedV2_structs) } )"; ALSO_VIA_YUL( - DISABLE_EWASM_TESTRUN() compileAndRun(sourceCode, 0, "C"); bytes structEnc = encodeArgs(int(0x12), u256(-7), int(2), int(3), u256(-7), u256(-8)); ABI_CHECK(callContractFunction("testStorage()"), encodeArgs()); @@ -3647,7 +3570,6 @@ BOOST_AUTO_TEST_CASE(abi_encodePackedV2_nestedArray) } )"; ALSO_VIA_YUL( - DISABLE_EWASM_TESTRUN() compileAndRun(sourceCode, 0, "C"); bytes structEnc = encodeArgs(1, 2, 3, 0, 0, 0, 0, 4); ABI_CHECK(callContractFunction("testNestedArrays()"), encodeArgs()); @@ -3678,7 +3600,6 @@ BOOST_AUTO_TEST_CASE(abi_encodePackedV2_arrayOfStrings) } )"; ALSO_VIA_YUL( - DISABLE_EWASM_TESTRUN() compileAndRun(sourceCode, 0, "C"); bytes arrayEncoding = encodeArgs("abc", "0123456789012345678901234567890123456789"); ABI_CHECK(callContractFunction("testStorage()"), encodeArgs()); @@ -3798,7 +3719,6 @@ BOOST_AUTO_TEST_CASE(event_wrong_abi_name) } )"; ALSO_VIA_YUL( - DISABLE_EWASM_TESTRUN() compileAndRun(sourceCode, 0, "ClientReceipt", bytes()); compileAndRun(sourceCode, 0, "Test", bytes(), map{{":ClientReceipt", m_contractAddress}}); @@ -3874,7 +3794,6 @@ BOOST_AUTO_TEST_CASE(strip_reason_strings) } )"; ALSO_VIA_YUL( - DISABLE_EWASM_TESTRUN() m_revertStrings = RevertStrings::Default; compileAndRun(sourceCode, 0, "C"); diff --git a/test/libsolidity/SolidityExecutionFramework.cpp b/test/libsolidity/SolidityExecutionFramework.cpp index 3e8372ef78a7..7d18e1bb4aa5 100644 --- a/test/libsolidity/SolidityExecutionFramework.cpp +++ b/test/libsolidity/SolidityExecutionFramework.cpp @@ -53,7 +53,6 @@ bytes SolidityExecutionFramework::multiSourceCompileContract( entry.second = addPreamble(entry.second); m_compiler.reset(); - m_compiler.enableEwasmGeneration(m_compileToEwasm); m_compiler.setSources(sourcesWithPreamble); m_compiler.setLibraries(_libraryAddresses); m_compiler.setRevertStringBehaviour(m_revertStrings); @@ -83,46 +82,41 @@ bytes SolidityExecutionFramework::multiSourceCompileContract( evmasm::LinkerObject obj; if (m_compileViaYul) { - if (m_compileToEwasm) - obj = m_compiler.ewasmObject(contractName); - else + // Try compiling twice: If the first run fails due to stack errors, forcefully enable + // the optimizer. + for (bool forceEnableOptimizer: {false, true}) { - // Try compiling twice: If the first run fails due to stack errors, forcefully enable - // the optimizer. - for (bool forceEnableOptimizer: {false, true}) + OptimiserSettings optimiserSettings = m_optimiserSettings; + if (!forceEnableOptimizer && !optimiserSettings.runYulOptimiser) { - OptimiserSettings optimiserSettings = m_optimiserSettings; - if (!forceEnableOptimizer && !optimiserSettings.runYulOptimiser) - { - // Enable some optimizations on the first run - optimiserSettings.runYulOptimiser = true; - optimiserSettings.yulOptimiserSteps = "uljmul jmul"; - } - else if (forceEnableOptimizer) - optimiserSettings = OptimiserSettings::full(); + // Enable some optimizations on the first run + optimiserSettings.runYulOptimiser = true; + optimiserSettings.yulOptimiserSteps = "uljmul jmul"; + } + else if (forceEnableOptimizer) + optimiserSettings = OptimiserSettings::full(); - yul::YulStack asmStack( - m_evmVersion, - m_eofVersion, - yul::YulStack::Language::StrictAssembly, - optimiserSettings, - DebugInfoSelection::All() - ); - bool analysisSuccessful = asmStack.parseAndAnalyze("", m_compiler.yulIROptimized(contractName)); - solAssert(analysisSuccessful, "Code that passed analysis in CompilerStack can't have errors"); + yul::YulStack asmStack( + m_evmVersion, + m_eofVersion, + yul::YulStack::Language::StrictAssembly, + optimiserSettings, + DebugInfoSelection::All() + ); + bool analysisSuccessful = asmStack.parseAndAnalyze("", m_compiler.yulIROptimized(contractName)); + solAssert(analysisSuccessful, "Code that passed analysis in CompilerStack can't have errors"); - try - { - asmStack.optimize(); - obj = std::move(*asmStack.assemble(yul::YulStack::Machine::EVM).bytecode); - obj.link(_libraryAddresses); - break; - } - catch (...) - { - if (forceEnableOptimizer || optimiserSettings == OptimiserSettings::full()) - throw; - } + try + { + asmStack.optimize(); + obj = std::move(*asmStack.assemble(yul::YulStack::Machine::EVM).bytecode); + obj.link(_libraryAddresses); + break; + } + catch (...) + { + if (forceEnableOptimizer || optimiserSettings == OptimiserSettings::full()) + throw; } } } diff --git a/test/libsolidity/SolidityExecutionFramework.h b/test/libsolidity/SolidityExecutionFramework.h index 4865c68a2253..c2cea6600ae6 100644 --- a/test/libsolidity/SolidityExecutionFramework.h +++ b/test/libsolidity/SolidityExecutionFramework.h @@ -87,7 +87,6 @@ class SolidityExecutionFramework: public solidity::test::ExecutionFramework std::optional m_eofVersion; CompilerStack m_compiler; bool m_compileViaYul = false; - bool m_compileToEwasm = false; bool m_showMetadata = false; bool m_appendCBORMetadata = true; CompilerStack::MetadataHash m_metadataHash = CompilerStack::MetadataHash::IPFS; diff --git a/test/libsolidity/SolidityTypes.cpp b/test/libsolidity/SolidityTypes.cpp index 48a0441b44de..db43f49c038b 100644 --- a/test/libsolidity/SolidityTypes.cpp +++ b/test/libsolidity/SolidityTypes.cpp @@ -213,7 +213,7 @@ BOOST_AUTO_TEST_CASE(type_identifiers) ModifierDefinition mod(++id, SourceLocation{}, make_shared("modif"), SourceLocation{}, {}, emptyParams, {}, {}, {}); BOOST_CHECK_EQUAL(ModifierType(mod).identifier(), "t_modifier$__$"); - SourceUnit su(++id, {}, {}, {}); + SourceUnit su(++id, {}, {}, {}, {}); BOOST_CHECK_EQUAL(ModuleType(su).identifier(), "t_module_7"); BOOST_CHECK_EQUAL(MagicType(MagicType::Kind::Block).identifier(), "t_magic_block"); BOOST_CHECK_EQUAL(MagicType(MagicType::Kind::Message).identifier(), "t_magic_message"); diff --git a/test/libsolidity/SyntaxTest.cpp b/test/libsolidity/SyntaxTest.cpp index ee3c4b4b06b3..159f9dcb12a0 100644 --- a/test/libsolidity/SyntaxTest.cpp +++ b/test/libsolidity/SyntaxTest.cpp @@ -123,25 +123,28 @@ void SyntaxTest::filterObtainedErrors() string sourceName; if (SourceLocation const* location = currentError->sourceLocation()) { + locationStart = location->start; + locationEnd = location->end; solAssert(location->sourceName, ""); sourceName = *location->sourceName; - solAssert(m_sources.sources.count(sourceName) == 1, ""); - - int preambleSize = - static_cast(compiler().charStream(sourceName).size()) - - static_cast(m_sources.sources[sourceName].size()); - solAssert(preambleSize >= 0, ""); - - // ignore the version & license pragma inserted by the testing tool when calculating locations. - if (location->start != -1) - { - solAssert(location->start >= preambleSize, ""); - locationStart = location->start - preambleSize; - } - if (location->end != -1) + if(m_sources.sources.count(sourceName) == 1) { - solAssert(location->end >= preambleSize, ""); - locationEnd = location->end - preambleSize; + int preambleSize = + static_cast(compiler().charStream(sourceName).size()) - + static_cast(m_sources.sources[sourceName].size()); + solAssert(preambleSize >= 0, ""); + + // ignore the version & license pragma inserted by the testing tool when calculating locations. + if (location->start != -1) + { + solAssert(location->start >= preambleSize, ""); + locationStart = location->start - preambleSize; + } + if (location->end != -1) + { + solAssert(location->end >= preambleSize, ""); + locationEnd = location->end - preambleSize; + } } } m_errorList.emplace_back(SyntaxTestError{ diff --git a/test/libsolidity/errorRecoveryTests/contract_recovery.sol b/test/libsolidity/errorRecoveryTests/contract_recovery.sol index 980c2beaba5c..082d91be6c76 100644 --- a/test/libsolidity/errorRecoveryTests/contract_recovery.sol +++ b/test/libsolidity/errorRecoveryTests/contract_recovery.sol @@ -1,7 +1,6 @@ contract Errort6 { using foo for ; // missing type name } - // ---- // ParserError 3546: (36-37): Expected type name // Warning 3796: (59-60): Recovered in ContractDefinition at '}'. diff --git a/test/libsolidity/errorRecoveryTests/error_to_eos.sol b/test/libsolidity/errorRecoveryTests/error_to_eos.sol index 6ecc6d9d63fe..5d09898601cc 100644 --- a/test/libsolidity/errorRecoveryTests/error_to_eos.sol +++ b/test/libsolidity/errorRecoveryTests/error_to_eos.sol @@ -15,7 +15,6 @@ contract SendCoin { return true; } } - // ---- // ParserError 6635: (235-236): Expected identifier but got '}' // ParserError 6635: (276-284): Expected ';' but got 'contract' diff --git a/test/libsolidity/lsp/rename/function.sol b/test/libsolidity/lsp/rename/function.sol index ffd8f6b58967..852086c2c785 100644 --- a/test/libsolidity/lsp/rename/function.sol +++ b/test/libsolidity/lsp/rename/function.sol @@ -40,7 +40,6 @@ function free() pure // ^^^^^^^^ @FunctionInFreeFunction // ^ @CursorInFreeFunction } - // ---- // -> textDocument/rename { // "newName": "Renamed", diff --git a/test/libsolidity/lsp/rename/import_directive.sol b/test/libsolidity/lsp/rename/import_directive.sol index a6b596866a7b..70d86f5d0619 100644 --- a/test/libsolidity/lsp/rename/import_directive.sol +++ b/test/libsolidity/lsp/rename/import_directive.sol @@ -26,7 +26,6 @@ contract C // ^^^^ @UserInPublicVariable // ^ @CursorOnUserInPublicVariable } - // ---- // contract: // -> textDocument/rename { diff --git a/test/libsolidity/lsp/rename/variable.sol b/test/libsolidity/lsp/rename/variable.sol index 39c23bcd72a8..a3c08f320229 100644 --- a/test/libsolidity/lsp/rename/variable.sol +++ b/test/libsolidity/lsp/rename/variable.sol @@ -24,7 +24,6 @@ function freeFunction(C _contract) view returns(int) // ^^^^^^^^ @VariableInFreeFunction // ^ @CursorOnVariableInFreeFunction } - // ---- // -> textDocument/rename { // "newName": "Renamed", diff --git a/test/libsolidity/lsp/semanticTokens/enums.sol b/test/libsolidity/lsp/semanticTokens/enums.sol index ea1655e1ef6f..848c08e7fe55 100644 --- a/test/libsolidity/lsp/semanticTokens/enums.sol +++ b/test/libsolidity/lsp/semanticTokens/enums.sol @@ -17,7 +17,6 @@ function getColorEnum() pure returns (Color result) { result = Color.Red; } - // ---- // -> textDocument/semanticTokens/full { // } diff --git a/test/libsolidity/lsp/semanticTokens/functions.sol b/test/libsolidity/lsp/semanticTokens/functions.sol index fee9af788783..a7a53495fddc 100644 --- a/test/libsolidity/lsp/semanticTokens/functions.sol +++ b/test/libsolidity/lsp/semanticTokens/functions.sol @@ -22,7 +22,6 @@ contract Contract return true; } } - // ---- // functions: @unusedVariable 2072 // -> textDocument/semanticTokens/full { diff --git a/test/libsolidity/semanticTests/abiEncoderV1/abi_decode_dynamic_array.sol b/test/libsolidity/semanticTests/abiEncoderV1/abi_decode_dynamic_array.sol index 180d89ec185b..4d6b92073212 100644 --- a/test/libsolidity/semanticTests/abiEncoderV1/abi_decode_dynamic_array.sol +++ b/test/libsolidity/semanticTests/abiEncoderV1/abi_decode_dynamic_array.sol @@ -3,6 +3,5 @@ contract C { return abi.decode(data, (uint256[])); } } - // ---- // f(bytes): 0x20, 0xc0, 0x20, 0x4, 0x3, 0x4, 0x5, 0x6 -> 0x20, 0x4, 0x3, 0x4, 0x5, 0x6 diff --git a/test/libsolidity/semanticTests/abiEncoderV1/abi_decode_static_array.sol b/test/libsolidity/semanticTests/abiEncoderV1/abi_decode_static_array.sol index 270a5abc0695..fd0a59abb8f6 100644 --- a/test/libsolidity/semanticTests/abiEncoderV1/abi_decode_static_array.sol +++ b/test/libsolidity/semanticTests/abiEncoderV1/abi_decode_static_array.sol @@ -7,6 +7,5 @@ contract C { return abi.decode(data, (uint256[2][3])); } } - // ---- // f(bytes): 0x20, 0xc0, 0x1, 0x2, 0x3, 0x4, 0x5, 0x6 -> 1, 2, 3, 4, 5, 6 diff --git a/test/libsolidity/semanticTests/abiEncoderV1/abi_decode_static_array_v2.sol b/test/libsolidity/semanticTests/abiEncoderV1/abi_decode_static_array_v2.sol index 5e4d03a7e044..e228099c4eb3 100644 --- a/test/libsolidity/semanticTests/abiEncoderV1/abi_decode_static_array_v2.sol +++ b/test/libsolidity/semanticTests/abiEncoderV1/abi_decode_static_array_v2.sol @@ -10,6 +10,5 @@ contract C { return abi.decode(data, (uint256[2][3])); } } - // ---- // f(bytes): 0x20, 0xc0, 0x1, 0x2, 0x3, 0x4, 0x5, 0x6 -> 1, 2, 3, 4, 5, 6 diff --git a/test/libsolidity/semanticTests/abiEncoderV1/abi_decode_trivial.sol b/test/libsolidity/semanticTests/abiEncoderV1/abi_decode_trivial.sol index 7b873951f676..c1b91815accf 100644 --- a/test/libsolidity/semanticTests/abiEncoderV1/abi_decode_trivial.sol +++ b/test/libsolidity/semanticTests/abiEncoderV1/abi_decode_trivial.sol @@ -3,6 +3,5 @@ contract C { return abi.decode(data, (uint256)); } } - // ---- // f(bytes): 0x20, 0x20, 0x21 -> 33 diff --git a/test/libsolidity/semanticTests/abiEncoderV1/abi_decode_v2.sol b/test/libsolidity/semanticTests/abiEncoderV1/abi_decode_v2.sol index eb4bd70fbca3..782971c59c5d 100644 --- a/test/libsolidity/semanticTests/abiEncoderV1/abi_decode_v2.sol +++ b/test/libsolidity/semanticTests/abiEncoderV1/abi_decode_v2.sol @@ -17,6 +17,5 @@ contract C { return abi.decode(abi.encode(s), (S)); } } - // ---- // f() -> 0x20, 0x8, 0x40, 0x3, 0x9, 0xa, 0xb diff --git a/test/libsolidity/semanticTests/abiEncoderV1/abi_decode_v2_calldata.sol b/test/libsolidity/semanticTests/abiEncoderV1/abi_decode_v2_calldata.sol index ddfe343294a6..8bbb77b9aad0 100644 --- a/test/libsolidity/semanticTests/abiEncoderV1/abi_decode_v2_calldata.sol +++ b/test/libsolidity/semanticTests/abiEncoderV1/abi_decode_v2_calldata.sol @@ -11,6 +11,5 @@ contract C { return abi.decode(data, (S)); } } - // ---- // f(bytes): 0x20, 0xe0, 0x20, 0x21, 0x40, 0x3, 0xa, 0xb, 0xc -> 0x20, 0x21, 0x40, 0x3, 0xa, 0xb, 0xc diff --git a/test/libsolidity/semanticTests/abiEncoderV1/abi_decode_v2_storage.sol b/test/libsolidity/semanticTests/abiEncoderV1/abi_decode_v2_storage.sol index 61360868be69..c13f004fba41 100644 --- a/test/libsolidity/semanticTests/abiEncoderV1/abi_decode_v2_storage.sol +++ b/test/libsolidity/semanticTests/abiEncoderV1/abi_decode_v2_storage.sol @@ -19,7 +19,6 @@ contract C { return abi.decode(data, (S)); } } - // ---- // f() -> 0x20, 0x8, 0x40, 0x3, 0x9, 0xa, 0xb // gas irOptimized: 203166 diff --git a/test/libsolidity/semanticTests/abiEncoderV1/abi_encode.sol b/test/libsolidity/semanticTests/abiEncoderV1/abi_encode.sol index 773b7d2c6600..1e654d281ce0 100644 --- a/test/libsolidity/semanticTests/abiEncoderV1/abi_encode.sol +++ b/test/libsolidity/semanticTests/abiEncoderV1/abi_encode.sol @@ -27,9 +27,6 @@ contract C { return abi.encode(bytes2(x)); } } - -// ==== -// compileToEwasm: also // ---- // f0() -> 0x20, 0x0 // f1() -> 0x20, 0x40, 0x1, 0x2 diff --git a/test/libsolidity/semanticTests/abiEncoderV1/abi_encode_call.sol b/test/libsolidity/semanticTests/abiEncoderV1/abi_encode_call.sol index d73db5da6228..e34d46b74a42 100644 --- a/test/libsolidity/semanticTests/abiEncoderV1/abi_encode_call.sol +++ b/test/libsolidity/semanticTests/abiEncoderV1/abi_encode_call.sol @@ -21,6 +21,5 @@ contract C { return x; } } - // ---- // f() -> true diff --git a/test/libsolidity/semanticTests/abiEncoderV1/abi_encode_decode_simple.sol b/test/libsolidity/semanticTests/abiEncoderV1/abi_encode_decode_simple.sol index fb093b41a7da..627f0b0c6b7f 100644 --- a/test/libsolidity/semanticTests/abiEncoderV1/abi_encode_decode_simple.sol +++ b/test/libsolidity/semanticTests/abiEncoderV1/abi_encode_decode_simple.sol @@ -4,8 +4,5 @@ contract C { return abi.decode(abi.encode(uint256(33), arg), (uint256, bytes)); } } - -// ==== -// compileToEwasm: also // ---- // f() -> 0x21, 0x40, 0x7, "abcdefg" diff --git a/test/libsolidity/semanticTests/abiEncoderV1/abi_encode_empty_string.sol b/test/libsolidity/semanticTests/abiEncoderV1/abi_encode_empty_string.sol index 7497d3c35a91..601fb3cbeea5 100644 --- a/test/libsolidity/semanticTests/abiEncoderV1/abi_encode_empty_string.sol +++ b/test/libsolidity/semanticTests/abiEncoderV1/abi_encode_empty_string.sol @@ -19,7 +19,6 @@ contract C { return abi.encodeWithSelector(0x00000001, msg); } } - // ==== // ABIEncoderV1Only: true // compileViaYul: false diff --git a/test/libsolidity/semanticTests/abiEncoderV1/abi_encode_rational.sol b/test/libsolidity/semanticTests/abiEncoderV1/abi_encode_rational.sol index c5ba49368f50..44cf1ab5b9fd 100644 --- a/test/libsolidity/semanticTests/abiEncoderV1/abi_encode_rational.sol +++ b/test/libsolidity/semanticTests/abiEncoderV1/abi_encode_rational.sol @@ -4,8 +4,5 @@ contract C { return abi.encode(1, -2); } } - -// ==== -// compileToEwasm: also // ---- // f() -> 0x20, 0x40, 0x1, -2 diff --git a/test/libsolidity/semanticTests/abiEncoderV1/calldata_arrays_too_large.sol b/test/libsolidity/semanticTests/abiEncoderV1/calldata_arrays_too_large.sol index b372a4c47a43..49bee94ea344 100644 --- a/test/libsolidity/semanticTests/abiEncoderV1/calldata_arrays_too_large.sol +++ b/test/libsolidity/semanticTests/abiEncoderV1/calldata_arrays_too_large.sol @@ -3,7 +3,5 @@ contract C { return 7; } } -// ==== -// compileToEwasm: also // ---- // f(uint256,uint256[],uint256): 6, 0x60, 9, 0x8000000000000000000000000000000000000000000000000000000000000002, 1, 2 -> FAILURE diff --git a/test/libsolidity/semanticTests/abiEncoderV1/decode_slice.sol b/test/libsolidity/semanticTests/abiEncoderV1/decode_slice.sol index 11e79dec03ff..35cb15077abc 100644 --- a/test/libsolidity/semanticTests/abiEncoderV1/decode_slice.sol +++ b/test/libsolidity/semanticTests/abiEncoderV1/decode_slice.sol @@ -5,8 +5,5 @@ contract C { f = abi.decode(msg.data[4 + 32 : 4 + 32 + 32], (uint256)); } } - -// ==== -// compileToEwasm: also // ---- // f(uint256,uint256): 42, 23 -> 42, 23, 42, 23 diff --git a/test/libsolidity/semanticTests/abiEncoderV1/dynamic_memory_copy.sol b/test/libsolidity/semanticTests/abiEncoderV1/dynamic_memory_copy.sol index 126c6c950bde..ef2b07cb5213 100644 --- a/test/libsolidity/semanticTests/abiEncoderV1/dynamic_memory_copy.sol +++ b/test/libsolidity/semanticTests/abiEncoderV1/dynamic_memory_copy.sol @@ -18,7 +18,6 @@ contract C { } } } - // ---- // test(bytes): 0x20, 0x80, 0x40, 0x60, 0, 0 -> false, false // test(bytes): 0x20, 0xC0, 0x40, 0x80, 1, 0x42, 1, 0x42 -> false, false diff --git a/test/libsolidity/semanticTests/abiEncoderV1/memory_dynamic_array_and_calldata_bytes.sol b/test/libsolidity/semanticTests/abiEncoderV1/memory_dynamic_array_and_calldata_bytes.sol index 3b2b90c6c3a1..f828ab41e88c 100644 --- a/test/libsolidity/semanticTests/abiEncoderV1/memory_dynamic_array_and_calldata_bytes.sol +++ b/test/libsolidity/semanticTests/abiEncoderV1/memory_dynamic_array_and_calldata_bytes.sol @@ -9,7 +9,6 @@ contract C { return f(a, b); } } - // ==== // EVMVersion: >homestead // ---- diff --git a/test/libsolidity/semanticTests/abiEncoderV2/abi_encode_empty_string_v2.sol b/test/libsolidity/semanticTests/abiEncoderV2/abi_encode_empty_string_v2.sol index 8db4674c22f8..849c24a91f3c 100644 --- a/test/libsolidity/semanticTests/abiEncoderV2/abi_encode_empty_string_v2.sol +++ b/test/libsolidity/semanticTests/abiEncoderV2/abi_encode_empty_string_v2.sol @@ -8,8 +8,5 @@ contract C { return (abi.encode(""), abi.encodePacked("")); } } - -// ==== -// compileToEwasm: also // ---- // f() -> 0x40, 0xa0, 0x40, 0x20, 0x0, 0x0 diff --git a/test/libsolidity/semanticTests/abiEncoderV2/abi_encode_rational_v2.sol b/test/libsolidity/semanticTests/abiEncoderV2/abi_encode_rational_v2.sol index 106c26ea9723..edd319d45a39 100644 --- a/test/libsolidity/semanticTests/abiEncoderV2/abi_encode_rational_v2.sol +++ b/test/libsolidity/semanticTests/abiEncoderV2/abi_encode_rational_v2.sol @@ -7,8 +7,5 @@ contract C { return abi.encode(1, -2); } } - -// ==== -// compileToEwasm: also // ---- // f() -> 0x20, 0x40, 0x1, -2 diff --git a/test/libsolidity/semanticTests/abiEncoderV2/abi_encode_v2.sol b/test/libsolidity/semanticTests/abiEncoderV2/abi_encode_v2.sol index a0b732caed24..cdf2d3087d35 100644 --- a/test/libsolidity/semanticTests/abiEncoderV2/abi_encode_v2.sol +++ b/test/libsolidity/semanticTests/abiEncoderV2/abi_encode_v2.sol @@ -44,7 +44,6 @@ contract C { require(y[0] == "e"); } } - // ---- // f0() -> 0x20, 0x0 // f1() -> 0x20, 0x40, 0x1, 0x2 diff --git a/test/libsolidity/semanticTests/abiEncoderV2/bool_out_of_bounds.sol b/test/libsolidity/semanticTests/abiEncoderV2/bool_out_of_bounds.sol index 1a6856ff4d47..e47125707515 100644 --- a/test/libsolidity/semanticTests/abiEncoderV2/bool_out_of_bounds.sol +++ b/test/libsolidity/semanticTests/abiEncoderV2/bool_out_of_bounds.sol @@ -3,8 +3,6 @@ pragma abicoder v2; contract C { function f(bool b) public pure returns (bool) { return b; } } -// ==== -// compileToEwasm: also // ---- // f(bool): true -> true // f(bool): false -> false diff --git a/test/libsolidity/semanticTests/abiEncoderV2/calldata_array_dynamic_static_short_decode.sol b/test/libsolidity/semanticTests/abiEncoderV2/calldata_array_dynamic_static_short_decode.sol index 9fab29f9f791..2d8095704751 100644 --- a/test/libsolidity/semanticTests/abiEncoderV2/calldata_array_dynamic_static_short_decode.sol +++ b/test/libsolidity/semanticTests/abiEncoderV2/calldata_array_dynamic_static_short_decode.sol @@ -5,8 +5,6 @@ contract C { return 23; } } -// ==== -// compileToEwasm: also // ---- // f(uint256[][2][]): 0x20, 0x01, 0x20, 0x40, 0x60, 0x00, 0x00 -> 23 # this is the common encoding for x.length == 1 && x[0][0].length == 0 && x[0][1].length == 0 # // f(uint256[][2][]): 0x20, 0x01, 0x20, 0x00, 0x00 -> 23 # exotic, but still valid encoding # diff --git a/test/libsolidity/semanticTests/abiEncoderV2/calldata_dynamic_array_to_memory.sol b/test/libsolidity/semanticTests/abiEncoderV2/calldata_dynamic_array_to_memory.sol index f044d6f05a42..1fca188a6857 100644 --- a/test/libsolidity/semanticTests/abiEncoderV2/calldata_dynamic_array_to_memory.sol +++ b/test/libsolidity/semanticTests/abiEncoderV2/calldata_dynamic_array_to_memory.sol @@ -13,7 +13,6 @@ contract C { return a; } } - // ---- // f(uint256[][]): 0x20, 2, 0x40, 0xa0, 2, 5, 6, 2, 7, 8 -> 0x20, 2, 0x40, 0xa0, 2, 5, 6, 2, 7, 8 // f(uint256[][]): 0x20, 2, 0x40, 0xa0, 2, 5, 6, 2, 7, 8, 9 -> 0x20, 2, 0x40, 0xa0, 2, 5, 6, 2, 7, 8 diff --git a/test/libsolidity/semanticTests/abiEncoderV2/calldata_overlapped_dynamic_arrays.sol b/test/libsolidity/semanticTests/abiEncoderV2/calldata_overlapped_dynamic_arrays.sol index 1b1f360f48d0..796488a9fe4a 100644 --- a/test/libsolidity/semanticTests/abiEncoderV2/calldata_overlapped_dynamic_arrays.sol +++ b/test/libsolidity/semanticTests/abiEncoderV2/calldata_overlapped_dynamic_arrays.sol @@ -22,7 +22,6 @@ contract C { return abi.encode(s); } } - // ---- // f_memory(uint256[],uint256[2]): 0x20, 1, 2 -> 0x60, 0x01, 0x02, 1, 2 // f_memory(uint256[],uint256[2]): 0x40, 1, 2, 5, 6 -> 0x60, 1, 2, 2, 5, 6 diff --git a/test/libsolidity/semanticTests/abiEncoderV2/calldata_overlapped_nested_dynamic_arrays.sol b/test/libsolidity/semanticTests/abiEncoderV2/calldata_overlapped_nested_dynamic_arrays.sol index f7ed9daf4563..d5a3266f0520 100644 --- a/test/libsolidity/semanticTests/abiEncoderV2/calldata_overlapped_nested_dynamic_arrays.sol +++ b/test/libsolidity/semanticTests/abiEncoderV2/calldata_overlapped_nested_dynamic_arrays.sol @@ -16,7 +16,6 @@ contract C { return a[which]; } } - // ---- // f_memory(uint256[][]): 0x20, 2, 0x40, 0x40, 2, 1, 2 -> 0x20, 2, 0x40, 0xa0, 2, 1, 2, 2, 1, 2 // f_memory(uint256[][]): 0x20, 2, 0x40, 0x60, 2, 1, 2 -> 0x20, 2, 0x40, 0xa0, 2, 1, 2, 1, 2 diff --git a/test/libsolidity/semanticTests/abiEncoderV2/calldata_struct_array_reencode.sol b/test/libsolidity/semanticTests/abiEncoderV2/calldata_struct_array_reencode.sol index d456cdfcc255..347710a30dd2 100644 --- a/test/libsolidity/semanticTests/abiEncoderV2/calldata_struct_array_reencode.sol +++ b/test/libsolidity/semanticTests/abiEncoderV2/calldata_struct_array_reencode.sol @@ -33,7 +33,6 @@ contract C { } } - // ---- // f((uint256[])): 0x20, 0x20, 0 -> 0x20, 0x60, 0x20, 0x20, 0 // f((uint256[])): 0x20, 0x20, 1 -> FAILURE diff --git a/test/libsolidity/semanticTests/abiEncoderV2/calldata_three_dimensional_dynamic_array_index_access.sol b/test/libsolidity/semanticTests/abiEncoderV2/calldata_three_dimensional_dynamic_array_index_access.sol index a97c4f6d8a37..745bebe72891 100644 --- a/test/libsolidity/semanticTests/abiEncoderV2/calldata_three_dimensional_dynamic_array_index_access.sol +++ b/test/libsolidity/semanticTests/abiEncoderV2/calldata_three_dimensional_dynamic_array_index_access.sol @@ -23,7 +23,6 @@ contract C { return abi.encode(s[i][j].a); } } - // ==== // revertStrings: debug // ---- diff --git a/test/libsolidity/semanticTests/abiEncoderV2/calldata_with_garbage.sol b/test/libsolidity/semanticTests/abiEncoderV2/calldata_with_garbage.sol index b126928546fd..58f68b8cc268 100644 --- a/test/libsolidity/semanticTests/abiEncoderV2/calldata_with_garbage.sol +++ b/test/libsolidity/semanticTests/abiEncoderV2/calldata_with_garbage.sol @@ -39,7 +39,6 @@ contract C { return (a[which], b[0]); } } - // ---- // f_memory(uint256[]): 0x80, 9, 9, 9, 0 -> 0x20, 0 // f_memory(uint256[]): 0x80, 9, 9, 9, 1, 7 -> 0x20, 1, 7 diff --git a/test/libsolidity/semanticTests/abiEncoderV2/cleanup/cleanup.sol b/test/libsolidity/semanticTests/abiEncoderV2/cleanup/cleanup.sol index b680e9cd23c1..4286f8f07d34 100644 --- a/test/libsolidity/semanticTests/abiEncoderV2/cleanup/cleanup.sol +++ b/test/libsolidity/semanticTests/abiEncoderV2/cleanup/cleanup.sol @@ -6,8 +6,6 @@ contract C { assembly { v := a w := b x := c y := d z := e} } } -// ==== -// compileToEwasm: also // ---- // f(uint16,int16,address,bytes3,bool): 1, 2, 3, "a", true -> 1, 2, 3, "a", true // f(uint16,int16,address,bytes3,bool): 0xffffff, 0x1ffff, 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff, "abcd", 1 -> FAILURE diff --git a/test/libsolidity/semanticTests/abiEncoderV2/enums.sol b/test/libsolidity/semanticTests/abiEncoderV2/enums.sol index 285bf334f951..1e323472897f 100644 --- a/test/libsolidity/semanticTests/abiEncoderV2/enums.sol +++ b/test/libsolidity/semanticTests/abiEncoderV2/enums.sol @@ -6,8 +6,6 @@ contract C { assembly { x := e } } } -// ==== -// compileToEwasm: also // ---- // f(uint8): 0 -> 0 // f(uint8): 1 -> 1 diff --git a/test/libsolidity/semanticTests/abiEncoderV2/memory_dynamic_array_and_calldata_bytes.sol b/test/libsolidity/semanticTests/abiEncoderV2/memory_dynamic_array_and_calldata_bytes.sol index 07d035080090..3fe54eff57e5 100644 --- a/test/libsolidity/semanticTests/abiEncoderV2/memory_dynamic_array_and_calldata_bytes.sol +++ b/test/libsolidity/semanticTests/abiEncoderV2/memory_dynamic_array_and_calldata_bytes.sol @@ -7,7 +7,6 @@ contract C { return f(a, b); } } - // ---- // f(uint256[],bytes): 0x40, 0x80, 1, 0xFF, 6, "123456" -> 0x20, 0xc0, 0x40, 0x80, 1, 0xff, 6, "123456" // g(uint256[],bytes): 0x40, 0x80, 1, 0xffff, 8, "12345678" -> 0x20, 0xc0, 0x40, 0x80, 1, 0xffff, 8, "12345678" diff --git a/test/libsolidity/semanticTests/abiEncoderV2/memory_dynamic_array_and_calldata_static_array.sol b/test/libsolidity/semanticTests/abiEncoderV2/memory_dynamic_array_and_calldata_static_array.sol index a8f4f55541a4..a734103f10d2 100644 --- a/test/libsolidity/semanticTests/abiEncoderV2/memory_dynamic_array_and_calldata_static_array.sol +++ b/test/libsolidity/semanticTests/abiEncoderV2/memory_dynamic_array_and_calldata_static_array.sol @@ -11,7 +11,6 @@ contract C { return (a, b); } } - // ---- // f(uint256[],uint256[1]): 0x40, 0xff, 1, 0xffff -> 0x20, 0x80, 0x40, 0xff, 1, 0xffff // g(uint256[],uint256[1]): 0x40, 0xff, 1, 0xffff -> 0x20, 0x80, 0x40, 0xff, 1, 0xffff diff --git a/test/libsolidity/semanticTests/abiEncoderV2/struct/struct_short.sol b/test/libsolidity/semanticTests/abiEncoderV2/struct/struct_short.sol index 73fa9b415f30..ce6550d31a34 100644 --- a/test/libsolidity/semanticTests/abiEncoderV2/struct/struct_short.sol +++ b/test/libsolidity/semanticTests/abiEncoderV2/struct/struct_short.sol @@ -6,8 +6,6 @@ contract C { q = s; } } -// ==== -// compileToEwasm: also // ---- // f((int256,uint256,bytes16)): 0xff010, 0xff0002, "abcd" -> 0xff010, 0xff0002, "abcd" // f((int256,uint256,bytes16)): 0xff010, 0xff0002, 0x1111222233334444555566667777888800000000000000000000000000000000 -> 0xff010, 0xff0002, left(0x11112222333344445555666677778888) diff --git a/test/libsolidity/semanticTests/abiEncoderV2/struct/struct_simple.sol b/test/libsolidity/semanticTests/abiEncoderV2/struct/struct_simple.sol index 80fe3149b742..cf631b8aec79 100644 --- a/test/libsolidity/semanticTests/abiEncoderV2/struct/struct_simple.sol +++ b/test/libsolidity/semanticTests/abiEncoderV2/struct/struct_simple.sol @@ -9,7 +9,5 @@ contract C { d = uint16(s.d); } } -// ==== -// compileToEwasm: also // ---- // f((uint256,uint8,uint8,bytes2)): 1, 2, 3, "ab" -> 1, 2, 3, 0x6162 diff --git a/test/libsolidity/semanticTests/abiEncoderV2/struct/struct_validation.sol b/test/libsolidity/semanticTests/abiEncoderV2/struct/struct_validation.sol index 3e266410244c..57e218f7d561 100644 --- a/test/libsolidity/semanticTests/abiEncoderV2/struct/struct_validation.sol +++ b/test/libsolidity/semanticTests/abiEncoderV2/struct/struct_validation.sol @@ -10,8 +10,6 @@ contract C { } } } -// ==== -// compileToEwasm: also // ---- // f((int16,uint8,bytes2)): 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff01, 0xff, "ab" -> 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff01, 0xff, "ab" // f((int16,uint8,bytes2)): 0xff010, 0xff, "ab" -> FAILURE diff --git a/test/libsolidity/semanticTests/abiEncoderV2/struct/validation_function_type_inside_struct.sol b/test/libsolidity/semanticTests/abiEncoderV2/struct/validation_function_type_inside_struct.sol index b1151c2fac5b..8a22b037f6de 100644 --- a/test/libsolidity/semanticTests/abiEncoderV2/struct/validation_function_type_inside_struct.sol +++ b/test/libsolidity/semanticTests/abiEncoderV2/struct/validation_function_type_inside_struct.sol @@ -6,8 +6,6 @@ contract C { function g(S calldata) external pure returns (uint r) { r = 2; } function h(S calldata s) external pure returns (uint r) { s.x; r = 3; } } -// ==== -// compileToEwasm: also // ---- // f((function)): "01234567890123456789abcd" -> 1 // f((function)): "01234567890123456789abcdX" -> FAILURE diff --git a/test/libsolidity/semanticTests/abiencodedecode/abi_decode_calldata.sol b/test/libsolidity/semanticTests/abiencodedecode/abi_decode_calldata.sol index 3bab26b831a2..6b6e55e02241 100644 --- a/test/libsolidity/semanticTests/abiencodedecode/abi_decode_calldata.sol +++ b/test/libsolidity/semanticTests/abiencodedecode/abi_decode_calldata.sol @@ -7,6 +7,5 @@ contract C { return abi.decode(data, (uint256, bytes)); } } - // ---- // f(bytes): 0x20, 0x80, 0x21, 0x40, 0x7, "abcdefg" -> 0x21, 0x40, 0x7, "abcdefg" diff --git a/test/libsolidity/semanticTests/abiencodedecode/abi_decode_simple.sol b/test/libsolidity/semanticTests/abiencodedecode/abi_decode_simple.sol index 2703f25e93e9..9ae6602f310f 100644 --- a/test/libsolidity/semanticTests/abiencodedecode/abi_decode_simple.sol +++ b/test/libsolidity/semanticTests/abiencodedecode/abi_decode_simple.sol @@ -3,6 +3,5 @@ contract C { return abi.decode(data, (uint256, bytes)); } } - // ---- // f(bytes): 0x20, 0x80, 0x21, 0x40, 0x7, "abcdefg" -> 0x21, 0x40, 0x7, "abcdefg" diff --git a/test/libsolidity/semanticTests/abiencodedecode/abi_decode_simple_storage.sol b/test/libsolidity/semanticTests/abiencodedecode/abi_decode_simple_storage.sol index 93fe74c99168..03084f0a35b6 100644 --- a/test/libsolidity/semanticTests/abiencodedecode/abi_decode_simple_storage.sol +++ b/test/libsolidity/semanticTests/abiencodedecode/abi_decode_simple_storage.sol @@ -6,7 +6,6 @@ contract C { return abi.decode(data, (uint256, bytes)); } } - // ---- // f(bytes): 0x20, 0x80, 0x21, 0x40, 0x7, "abcdefg" -> 0x21, 0x40, 0x7, "abcdefg" // gas irOptimized: 135693 diff --git a/test/libsolidity/semanticTests/abiencodedecode/abi_encode_call.sol b/test/libsolidity/semanticTests/abiencodedecode/abi_encode_call.sol index ab7a94372eb2..1edede787853 100644 --- a/test/libsolidity/semanticTests/abiencodedecode/abi_encode_call.sol +++ b/test/libsolidity/semanticTests/abiencodedecode/abi_encode_call.sol @@ -44,6 +44,5 @@ contract C { return success; } } - // ---- // callExternal() -> true diff --git a/test/libsolidity/semanticTests/abiencodedecode/abi_encode_call_declaration.sol b/test/libsolidity/semanticTests/abiencodedecode/abi_encode_call_declaration.sol index 86399614105d..752298fbb059 100644 --- a/test/libsolidity/semanticTests/abiencodedecode/abi_encode_call_declaration.sol +++ b/test/libsolidity/semanticTests/abiencodedecode/abi_encode_call_declaration.sol @@ -46,7 +46,6 @@ contract C is Base { } } - // ==== // EVMVersion: >=byzantium // ---- diff --git a/test/libsolidity/semanticTests/abiencodedecode/abi_encode_call_memory.sol b/test/libsolidity/semanticTests/abiencodedecode/abi_encode_call_memory.sol index 2e2420af3519..5f67174cfcb4 100644 --- a/test/libsolidity/semanticTests/abiencodedecode/abi_encode_call_memory.sol +++ b/test/libsolidity/semanticTests/abiencodedecode/abi_encode_call_memory.sol @@ -21,6 +21,5 @@ contract C { return bytes4(a); } } - // ---- // test() -> 0xa7a0d53700000000000000000000000000000000000000000000000000000000 diff --git a/test/libsolidity/semanticTests/abiencodedecode/abi_encode_with_selector.sol b/test/libsolidity/semanticTests/abiencodedecode/abi_encode_with_selector.sol index 45c71e4d81d3..f72de4379bad 100644 --- a/test/libsolidity/semanticTests/abiencodedecode/abi_encode_with_selector.sol +++ b/test/libsolidity/semanticTests/abiencodedecode/abi_encode_with_selector.sol @@ -15,8 +15,6 @@ contract C { return abi.encodeWithSelector(x, type(uint).max); } } -// ==== -// compileToEwasm: also // ---- // f0() -> 0x20, 4, 8234104107246695022420661102507966550300666591269321702959126607540084801536 // f1() -> 0x20, 0x64, 8234104107246695022420661102507966550300666591269321702959126607540084801536, 862718293348820473429344482784628181556388621521298319395315527974912, 91135606241822717681769169345594720818313984248279388438121731325952, 0 diff --git a/test/libsolidity/semanticTests/abiencodedecode/abi_encode_with_selectorv2.sol b/test/libsolidity/semanticTests/abiencodedecode/abi_encode_with_selectorv2.sol index a4f24a963e2f..b23e2dd27e85 100644 --- a/test/libsolidity/semanticTests/abiencodedecode/abi_encode_with_selectorv2.sol +++ b/test/libsolidity/semanticTests/abiencodedecode/abi_encode_with_selectorv2.sol @@ -24,8 +24,6 @@ contract C { return abi.encodeWithSelector(x, type(uint).max, s, uint(3)); } } -// ==== -// compileToEwasm: also // ---- // f0() -> 0x20, 4, 8234104107246695022420661102507966550300666591269321702959126607540084801536 // f1() -> 0x20, 0x64, 8234104107246695022420661102507966550300666591269321702959126607540084801536, 862718293348820473429344482784628181556388621521298319395315527974912, 91135606241822717681769169345594720818313984248279388438121731325952, 0 diff --git a/test/libsolidity/semanticTests/abiencodedecode/offset_overflow_in_array_decoding.sol b/test/libsolidity/semanticTests/abiencodedecode/offset_overflow_in_array_decoding.sol index 736794dc4f82..02937aced8da 100644 --- a/test/libsolidity/semanticTests/abiencodedecode/offset_overflow_in_array_decoding.sol +++ b/test/libsolidity/semanticTests/abiencodedecode/offset_overflow_in_array_decoding.sol @@ -23,7 +23,5 @@ contract Test { return decoded[1][0]; } } -// ==== -// compileToEwasm: also // ---- // test() -> FAILURE diff --git a/test/libsolidity/semanticTests/abiencodedecode/offset_overflow_in_array_decoding_2.sol b/test/libsolidity/semanticTests/abiencodedecode/offset_overflow_in_array_decoding_2.sol index fe956322f18a..0a874914a93d 100644 --- a/test/libsolidity/semanticTests/abiencodedecode/offset_overflow_in_array_decoding_2.sol +++ b/test/libsolidity/semanticTests/abiencodedecode/offset_overflow_in_array_decoding_2.sol @@ -24,7 +24,5 @@ contract Test { return decoded[0][0] + decoded[1][0]; } } -// ==== -// compileToEwasm: also // ---- // withinArray() -> FAILURE diff --git a/test/libsolidity/semanticTests/abiencodedecode/offset_overflow_in_array_decoding_3.sol b/test/libsolidity/semanticTests/abiencodedecode/offset_overflow_in_array_decoding_3.sol index 8a7e572cc8ee..a20e9ae49fe1 100644 --- a/test/libsolidity/semanticTests/abiencodedecode/offset_overflow_in_array_decoding_3.sol +++ b/test/libsolidity/semanticTests/abiencodedecode/offset_overflow_in_array_decoding_3.sol @@ -17,7 +17,5 @@ contract Test { return decoded[1][0]; } } -// ==== -// compileToEwasm: also // ---- // test() -> FAILURE diff --git a/test/libsolidity/semanticTests/accessor/accessor_for_const_state_variable.sol b/test/libsolidity/semanticTests/accessor/accessor_for_const_state_variable.sol index 1d6346259ce8..b8def58898a7 100644 --- a/test/libsolidity/semanticTests/accessor/accessor_for_const_state_variable.sol +++ b/test/libsolidity/semanticTests/accessor/accessor_for_const_state_variable.sol @@ -1,7 +1,5 @@ contract Lotto { uint256 public constant ticketPrice = 555; } -// ==== -// compileToEwasm: also // ---- // ticketPrice() -> 555 diff --git a/test/libsolidity/semanticTests/accessor/accessor_for_state_variable.sol b/test/libsolidity/semanticTests/accessor/accessor_for_state_variable.sol index 16b534585a37..51cb8e5e2369 100644 --- a/test/libsolidity/semanticTests/accessor/accessor_for_state_variable.sol +++ b/test/libsolidity/semanticTests/accessor/accessor_for_state_variable.sol @@ -1,8 +1,5 @@ contract Lotto { uint256 public ticketPrice = 500; } - -// ==== -// compileToEwasm: also // ---- // ticketPrice() -> 500 diff --git a/test/libsolidity/semanticTests/arithmetics/addmod_mulmod.sol b/test/libsolidity/semanticTests/arithmetics/addmod_mulmod.sol index 034abce943ed..e6f703bd7681 100644 --- a/test/libsolidity/semanticTests/arithmetics/addmod_mulmod.sol +++ b/test/libsolidity/semanticTests/arithmetics/addmod_mulmod.sol @@ -7,8 +7,5 @@ contract C { return 0; } } - -// ==== -// compileToEwasm: also // ---- // test() -> 0 diff --git a/test/libsolidity/semanticTests/arithmetics/addmod_mulmod_zero.sol b/test/libsolidity/semanticTests/arithmetics/addmod_mulmod_zero.sol index cfcd9463faa6..cd32ceffa039 100644 --- a/test/libsolidity/semanticTests/arithmetics/addmod_mulmod_zero.sol +++ b/test/libsolidity/semanticTests/arithmetics/addmod_mulmod_zero.sol @@ -17,9 +17,6 @@ contract C { return 2; } } - -// ==== -// compileToEwasm: also // ---- // f(uint256): 0 -> FAILURE, hex"4e487b71", 0x12 // g(uint256): 0 -> FAILURE, hex"4e487b71", 0x12 diff --git a/test/libsolidity/semanticTests/arithmetics/block_inside_unchecked.sol b/test/libsolidity/semanticTests/arithmetics/block_inside_unchecked.sol index b626289104cb..7a8504d53178 100644 --- a/test/libsolidity/semanticTests/arithmetics/block_inside_unchecked.sol +++ b/test/libsolidity/semanticTests/arithmetics/block_inside_unchecked.sol @@ -7,7 +7,5 @@ contract C { }} } } -// ==== -// compileToEwasm: also // ---- // f() -> 0x00 diff --git a/test/libsolidity/semanticTests/arithmetics/checked_called_by_unchecked.sol b/test/libsolidity/semanticTests/arithmetics/checked_called_by_unchecked.sol index 4fc0ff189fd2..420a52cde48e 100644 --- a/test/libsolidity/semanticTests/arithmetics/checked_called_by_unchecked.sol +++ b/test/libsolidity/semanticTests/arithmetics/checked_called_by_unchecked.sol @@ -7,8 +7,6 @@ contract C { unchecked { return add(a, b) + c; } } } -// ==== -// compileToEwasm: also // ---- // f(uint16,uint16,uint16): 0xe000, 0xe500, 2 -> FAILURE, hex"4e487b71", 0x11 // f(uint16,uint16,uint16): 0xe000, 0x1000, 0x1000 -> 0x00 diff --git a/test/libsolidity/semanticTests/arithmetics/checked_modifier_called_by_unchecked.sol b/test/libsolidity/semanticTests/arithmetics/checked_modifier_called_by_unchecked.sol index 267489b419a2..42658f83a4f2 100644 --- a/test/libsolidity/semanticTests/arithmetics/checked_modifier_called_by_unchecked.sol +++ b/test/libsolidity/semanticTests/arithmetics/checked_modifier_called_by_unchecked.sol @@ -8,8 +8,6 @@ contract C { return b + c; } } -// ==== -// compileToEwasm: also // ---- // f(uint16,uint16,uint16): 0xe000, 0xe500, 2 -> 58626 // f(uint16,uint16,uint16): 0x1000, 0xe500, 0xe000 -> FAILURE, hex"4e487b71", 0x11 diff --git a/test/libsolidity/semanticTests/arithmetics/divisiod_by_zero.sol b/test/libsolidity/semanticTests/arithmetics/divisiod_by_zero.sol index d996409ca8c0..517c4966e984 100644 --- a/test/libsolidity/semanticTests/arithmetics/divisiod_by_zero.sol +++ b/test/libsolidity/semanticTests/arithmetics/divisiod_by_zero.sol @@ -7,8 +7,6 @@ contract C { return a % b; } } -// ==== -// compileToEwasm: also // ---- // div(uint256,uint256): 7, 2 -> 3 // div(uint256,uint256): 7, 0 -> FAILURE, hex"4e487b71", 0x12 # throws # diff --git a/test/libsolidity/semanticTests/arithmetics/exp_associativity.sol b/test/libsolidity/semanticTests/arithmetics/exp_associativity.sol index 730209fb58a4..0ec9f2c79077 100644 --- a/test/libsolidity/semanticTests/arithmetics/exp_associativity.sol +++ b/test/libsolidity/semanticTests/arithmetics/exp_associativity.sol @@ -29,7 +29,6 @@ contract C { (b**a**a/b**a**b == (b**(a**a))/(b**(a**b))); } } - // ---- // test_hardcode1(uint256,uint256,uint256): 2, 3, 4 -> 2417851639229258349412352 // test_hardcode2(uint256,uint256,uint256,uint256): 3, 2, 2, 2 -> 43046721 diff --git a/test/libsolidity/semanticTests/arithmetics/signed_mod.sol b/test/libsolidity/semanticTests/arithmetics/signed_mod.sol index 0239810ab9a6..3062562069ce 100644 --- a/test/libsolidity/semanticTests/arithmetics/signed_mod.sol +++ b/test/libsolidity/semanticTests/arithmetics/signed_mod.sol @@ -11,9 +11,6 @@ contract C { } } } - -// ==== -// compileToEwasm: also // ---- // f(int256,int256): 7, 5 -> 2 // f(int256,int256): 7, -5 -> 2 diff --git a/test/libsolidity/semanticTests/arithmetics/unchecked_called_by_checked.sol b/test/libsolidity/semanticTests/arithmetics/unchecked_called_by_checked.sol index f7859e6c131c..140506279d0a 100644 --- a/test/libsolidity/semanticTests/arithmetics/unchecked_called_by_checked.sol +++ b/test/libsolidity/semanticTests/arithmetics/unchecked_called_by_checked.sol @@ -9,8 +9,6 @@ contract C { return add(a, 0x100) + 0x100; } } -// ==== -// compileToEwasm: also // ---- // f(uint16): 7 -> 0x0207 // f(uint16): 0xffff -> 511 diff --git a/test/libsolidity/semanticTests/arithmetics/unchecked_div_by_zero.sol b/test/libsolidity/semanticTests/arithmetics/unchecked_div_by_zero.sol index 6e9cc90aeecd..ae91ea278f05 100644 --- a/test/libsolidity/semanticTests/arithmetics/unchecked_div_by_zero.sol +++ b/test/libsolidity/semanticTests/arithmetics/unchecked_div_by_zero.sol @@ -13,8 +13,6 @@ contract C { } } } -// ==== -// compileToEwasm: also // ---- // div(uint256,uint256): 7, 2 -> 3 // div(uint256,uint256): 7, 0 -> FAILURE, hex"4e487b71", 0x12 # throws # diff --git a/test/libsolidity/semanticTests/array/calldata_array.sol b/test/libsolidity/semanticTests/array/calldata_array.sol index cdb1c9b6d5d0..c524d06e003b 100644 --- a/test/libsolidity/semanticTests/array/calldata_array.sol +++ b/test/libsolidity/semanticTests/array/calldata_array.sol @@ -11,7 +11,5 @@ contract C { b = s[1]; } } -// ==== -// compileToEwasm: also // ---- // f(uint256[2]): 42, 23 -> 42, 23 diff --git a/test/libsolidity/semanticTests/array/calldata_array_as_argument_internal_function.sol b/test/libsolidity/semanticTests/array/calldata_array_as_argument_internal_function.sol index 99bd31c57f4c..d21c40caeef6 100644 --- a/test/libsolidity/semanticTests/array/calldata_array_as_argument_internal_function.sol +++ b/test/libsolidity/semanticTests/array/calldata_array_as_argument_internal_function.sol @@ -12,8 +12,6 @@ contract Test { return f(c[start: end]); } } -// ==== -// compileToEwasm: also // ---- // g(uint256[]): 0x20, 4, 1, 2, 3, 4 -> 4, 1 // h(uint256[],uint256,uint256): 0x60, 1, 3, 4, 1, 2, 3, 4 -> 2, 2 diff --git a/test/libsolidity/semanticTests/array/calldata_array_dynamic_invalid.sol b/test/libsolidity/semanticTests/array/calldata_array_dynamic_invalid.sol index 190d73d79a1c..dc1d1c31a18b 100644 --- a/test/libsolidity/semanticTests/array/calldata_array_dynamic_invalid.sol +++ b/test/libsolidity/semanticTests/array/calldata_array_dynamic_invalid.sol @@ -11,8 +11,6 @@ contract C { return 42; } } -// ==== -// compileToEwasm: also // ---- // f(uint256[][]): 0x20, 0x0 -> 42 # valid access stub # // f(uint256[][]): 0x20, 0x1 -> FAILURE # invalid on argument decoding # diff --git a/test/libsolidity/semanticTests/array/calldata_array_of_struct.sol b/test/libsolidity/semanticTests/array/calldata_array_of_struct.sol index c31ffcb53623..006bf2521e32 100644 --- a/test/libsolidity/semanticTests/array/calldata_array_of_struct.sol +++ b/test/libsolidity/semanticTests/array/calldata_array_of_struct.sol @@ -19,8 +19,5 @@ contract C { d = s[1].b; } } - -// ==== -// compileToEwasm: also // ---- // f((uint256,uint256)[]): 0x20, 0x2, 0x1, 0x2, 0x3, 0x4 -> 2, 1, 2, 3, 4 diff --git a/test/libsolidity/semanticTests/array/calldata_slice_access.sol b/test/libsolidity/semanticTests/array/calldata_slice_access.sol index b8eb63829e0e..76af2214f429 100644 --- a/test/libsolidity/semanticTests/array/calldata_slice_access.sol +++ b/test/libsolidity/semanticTests/array/calldata_slice_access.sol @@ -6,8 +6,6 @@ contract C { return (x[start:end][index], x[start:][0:end-start][index], x[:end][start:][index]); } } -// ==== -// compileToEwasm: also // ---- // f(uint256[],uint256,uint256): 0x80, 0, 0, 0, 1, 42 -> // f(uint256[],uint256,uint256): 0x80, 0, 1, 0, 1, 42 -> diff --git a/test/libsolidity/semanticTests/array/concat/bytes_concat_empty_argument_list.sol b/test/libsolidity/semanticTests/array/concat/bytes_concat_empty_argument_list.sol index 0485012e38e9..7041ff8513b5 100644 --- a/test/libsolidity/semanticTests/array/concat/bytes_concat_empty_argument_list.sol +++ b/test/libsolidity/semanticTests/array/concat/bytes_concat_empty_argument_list.sol @@ -3,7 +3,5 @@ contract C { return bytes.concat(); } } -// ==== -// compileToEwasm: also // ---- // f() -> 0x20, 0 diff --git a/test/libsolidity/semanticTests/array/concat/bytes_concat_empty_strings.sol b/test/libsolidity/semanticTests/array/concat/bytes_concat_empty_strings.sol index a83e5462b350..10d31162cb42 100644 --- a/test/libsolidity/semanticTests/array/concat/bytes_concat_empty_strings.sol +++ b/test/libsolidity/semanticTests/array/concat/bytes_concat_empty_strings.sol @@ -18,8 +18,6 @@ contract C { return bytes.concat(b, "abc", b, "abc", b); } } -// ==== -// compileToEwasm: also // ---- // f() -> 0x20, 0 // g() -> 0x20, 6, "abcabc" diff --git a/test/libsolidity/semanticTests/array/constant_var_as_array_length.sol b/test/libsolidity/semanticTests/array/constant_var_as_array_length.sol index ffd4b54033e7..fe6f07a40e5d 100644 --- a/test/libsolidity/semanticTests/array/constant_var_as_array_length.sol +++ b/test/libsolidity/semanticTests/array/constant_var_as_array_length.sol @@ -6,7 +6,6 @@ contract C { a = _a; } } - // ---- // constructor(): 1, 2, 3 -> // gas irOptimized: 140952 diff --git a/test/libsolidity/semanticTests/array/copying/array_copy_different_packing.sol b/test/libsolidity/semanticTests/array/copying/array_copy_different_packing.sol index 55e20f91729f..6f616f4b5328 100644 --- a/test/libsolidity/semanticTests/array/copying/array_copy_different_packing.sol +++ b/test/libsolidity/semanticTests/array/copying/array_copy_different_packing.sol @@ -16,7 +16,6 @@ contract c { e = data2[5]; } } - // ---- // test() -> 0x01000000000000000000000000000000000000000000000000, 0x02000000000000000000000000000000000000000000000000, 0x03000000000000000000000000000000000000000000000000, 0x04000000000000000000000000000000000000000000000000, 0x05000000000000000000000000000000000000000000000000 // gas irOptimized: 208122 diff --git a/test/libsolidity/semanticTests/array/copying/array_copy_nested_array.sol b/test/libsolidity/semanticTests/array/copying/array_copy_nested_array.sol index 03f58e11900f..7b5b30b79fd1 100644 --- a/test/libsolidity/semanticTests/array/copying/array_copy_nested_array.sol +++ b/test/libsolidity/semanticTests/array/copying/array_copy_nested_array.sol @@ -10,7 +10,6 @@ contract c { return c[1][1] | c[1][2] | c[1][3] | c[1][4]; } } - // ---- // test(uint256[2][]): 32, 3, 7, 8, 9, 10, 11, 12 -> 10 // gas irOptimized: 689714 diff --git a/test/libsolidity/semanticTests/array/copying/array_copy_storage_abi_signed.sol b/test/libsolidity/semanticTests/array/copying/array_copy_storage_abi_signed.sol index 0e225f1e598c..335afd0ac45e 100644 --- a/test/libsolidity/semanticTests/array/copying/array_copy_storage_abi_signed.sol +++ b/test/libsolidity/semanticTests/array/copying/array_copy_storage_abi_signed.sol @@ -15,6 +15,5 @@ contract c { return x; } } - // ---- // test() -> 0x20, 0x8, -1, -1, 8, -16, -2, 6, 8, -1 diff --git a/test/libsolidity/semanticTests/array/copying/array_copy_storage_storage_different_base_nested.sol b/test/libsolidity/semanticTests/array/copying/array_copy_storage_storage_different_base_nested.sol index 113269ea2ba3..4ab3d0bd870c 100644 --- a/test/libsolidity/semanticTests/array/copying/array_copy_storage_storage_different_base_nested.sol +++ b/test/libsolidity/semanticTests/array/copying/array_copy_storage_storage_different_base_nested.sol @@ -19,8 +19,6 @@ contract c { y = data2[0][4]; } } -// ==== -// compileToEwasm: also // ---- // test() -> 3, 4 // gas irOptimized: 169602 diff --git a/test/libsolidity/semanticTests/array/copying/array_copy_storage_storage_dynamic_dynamic.sol b/test/libsolidity/semanticTests/array/copying/array_copy_storage_storage_dynamic_dynamic.sol index 1582b711837c..fcdcf9c2d2c4 100644 --- a/test/libsolidity/semanticTests/array/copying/array_copy_storage_storage_dynamic_dynamic.sol +++ b/test/libsolidity/semanticTests/array/copying/array_copy_storage_storage_dynamic_dynamic.sol @@ -15,7 +15,6 @@ contract c { y = data2[4]; } } - // ---- // test() -> 5, 4 // gas irOptimized: 252986 diff --git a/test/libsolidity/semanticTests/array/copying/array_copy_storage_storage_static_dynamic.sol b/test/libsolidity/semanticTests/array/copying/array_copy_storage_storage_static_dynamic.sol index 8b750efa7ad3..943a5206eef4 100644 --- a/test/libsolidity/semanticTests/array/copying/array_copy_storage_storage_static_dynamic.sol +++ b/test/libsolidity/semanticTests/array/copying/array_copy_storage_storage_static_dynamic.sol @@ -9,7 +9,6 @@ contract c { y = data2[8]; } } - // ---- // test() -> 9, 4 // gas irOptimized: 123142 diff --git a/test/libsolidity/semanticTests/array/copying/array_copy_storage_storage_static_simple.sol b/test/libsolidity/semanticTests/array/copying/array_copy_storage_storage_static_simple.sol index 00c69b7deeef..2fccff774e94 100644 --- a/test/libsolidity/semanticTests/array/copying/array_copy_storage_storage_static_simple.sol +++ b/test/libsolidity/semanticTests/array/copying/array_copy_storage_storage_static_simple.sol @@ -9,8 +9,6 @@ contract C { return (data2[0], data2[1]); } } -// ==== -// compileToEwasm: also // ---- // test() -> left(0x01), left(0x02) // gas legacy: 90001 diff --git a/test/libsolidity/semanticTests/array/copying/array_copy_storage_storage_static_static.sol b/test/libsolidity/semanticTests/array/copying/array_copy_storage_storage_static_static.sol index f7f0560653b4..3b0a229c96f1 100644 --- a/test/libsolidity/semanticTests/array/copying/array_copy_storage_storage_static_static.sol +++ b/test/libsolidity/semanticTests/array/copying/array_copy_storage_storage_static_static.sol @@ -12,9 +12,6 @@ contract c { y = data1[30]; // should be cleared } } - -// ==== -// compileToEwasm: also // ---- // test() -> 8, 0 // gas irOptimized: 196278 diff --git a/test/libsolidity/semanticTests/array/copying/array_copy_target_leftover.sol b/test/libsolidity/semanticTests/array/copying/array_copy_target_leftover.sol index a3f800b0834f..31addad5ecab 100644 --- a/test/libsolidity/semanticTests/array/copying/array_copy_target_leftover.sol +++ b/test/libsolidity/semanticTests/array/copying/array_copy_target_leftover.sol @@ -15,8 +15,6 @@ contract c { res2 |= uint(uint16(data2[16 + i])) * 0x10000**i; } } -// ==== -// compileToEwasm: also // ---- // test() -> 0xffffffff, 0x0000000000000000000000000a00090008000700060005000400030002000100, 0x0000000000000000000000000000000000000000000000000000000000000000 // gas irOptimized: 104665 diff --git a/test/libsolidity/semanticTests/array/copying/array_copy_target_leftover2.sol b/test/libsolidity/semanticTests/array/copying/array_copy_target_leftover2.sol index 0e0a26fc9dff..0a2bcffce201 100644 --- a/test/libsolidity/semanticTests/array/copying/array_copy_target_leftover2.sol +++ b/test/libsolidity/semanticTests/array/copying/array_copy_target_leftover2.sol @@ -17,8 +17,6 @@ contract c { r3 = data2[5]; } } -// ==== -// compileToEwasm: also // ---- // test() -> 0x04000000000000000000000000000000000000000000000000, 0x0, 0x0 // gas irOptimized: 93858 diff --git a/test/libsolidity/semanticTests/array/copying/array_copy_target_simple.sol b/test/libsolidity/semanticTests/array/copying/array_copy_target_simple.sol index 160697c6b157..0a306cade434 100644 --- a/test/libsolidity/semanticTests/array/copying/array_copy_target_simple.sol +++ b/test/libsolidity/semanticTests/array/copying/array_copy_target_simple.sol @@ -16,9 +16,6 @@ contract c { e = data2[9]; } } - -// ==== -// compileToEwasm: also // ---- // test() -> 0x01000000000000000000000000000000000000000000000000, 0x02000000000000000000000000000000000000000000000000, 0x03000000000000000000000000000000000000000000000000, 0x04000000000000000000000000000000000000000000000000, 0x0 // gas irOptimized: 273576 diff --git a/test/libsolidity/semanticTests/array/copying/array_copy_target_simple_2.sol b/test/libsolidity/semanticTests/array/copying/array_copy_target_simple_2.sol index c2ab09c6432e..de100d0964d6 100644 --- a/test/libsolidity/semanticTests/array/copying/array_copy_target_simple_2.sol +++ b/test/libsolidity/semanticTests/array/copying/array_copy_target_simple_2.sol @@ -16,9 +16,6 @@ contract c { e = data2[9]; } } - -// ==== -// compileToEwasm: also // ---- // test() -> 0x01000000000000000000000000000000000000000000000000, 0x02000000000000000000000000000000000000000000000000, 0x03000000000000000000000000000000000000000000000000, 0x04000000000000000000000000000000000000000000000000, 0x00 // gas irOptimized: 233285 diff --git a/test/libsolidity/semanticTests/array/copying/array_elements_to_mapping.sol b/test/libsolidity/semanticTests/array/copying/array_elements_to_mapping.sol index e139e200ffe3..53ca44cdc5b3 100644 --- a/test/libsolidity/semanticTests/array/copying/array_elements_to_mapping.sol +++ b/test/libsolidity/semanticTests/array/copying/array_elements_to_mapping.sol @@ -50,7 +50,6 @@ contract C { return m[0]; } } - // ---- // from_storage() -> 0x20, 2, 0x40, 0xa0, 2, 10, 11, 3, 12, 13, 14 // gas irOptimized: 150061 diff --git a/test/libsolidity/semanticTests/array/copying/array_nested_storage_to_memory.sol b/test/libsolidity/semanticTests/array/copying/array_nested_storage_to_memory.sol index 40990ba81285..ebaada764708 100644 --- a/test/libsolidity/semanticTests/array/copying/array_nested_storage_to_memory.sol +++ b/test/libsolidity/semanticTests/array/copying/array_nested_storage_to_memory.sol @@ -37,7 +37,6 @@ contract C { return a4; } } - // ---- // test1() -> 0x20, 2, 0x40, 0xa0, 2, 1, 2, 3, 3, 4, 5 // test2() -> 0x20, 0x40, 0xc0, 3, 6, 7, 8, 1, 9 diff --git a/test/libsolidity/semanticTests/array/copying/array_storage_multi_items_per_slot.sol b/test/libsolidity/semanticTests/array/copying/array_storage_multi_items_per_slot.sol index cbb87a2788ca..e335d8684978 100644 --- a/test/libsolidity/semanticTests/array/copying/array_storage_multi_items_per_slot.sol +++ b/test/libsolidity/semanticTests/array/copying/array_storage_multi_items_per_slot.sol @@ -10,8 +10,6 @@ contract C { return (a[32], b[1], c[2]); } } -// ==== -// compileToEwasm: also // ---- // f() -> 1, 2, 3 // gas irOptimized: 131932 diff --git a/test/libsolidity/semanticTests/array/copying/array_to_mapping.sol b/test/libsolidity/semanticTests/array/copying/array_to_mapping.sol index 5c36ed3f3a0e..9fcbbffcea46 100644 --- a/test/libsolidity/semanticTests/array/copying/array_to_mapping.sol +++ b/test/libsolidity/semanticTests/array/copying/array_to_mapping.sol @@ -35,7 +35,6 @@ contract C { return m[0]; } } - // ---- // from_storage() -> 0x20, 2, 0x40, 0xa0, 2, 10, 11, 3, 12, 13, 14 // gas irOptimized: 147892 diff --git a/test/libsolidity/semanticTests/array/copying/bytes_memory_to_storage.sol b/test/libsolidity/semanticTests/array/copying/bytes_memory_to_storage.sol index 6cdd48bf1c47..d1202e27eb07 100644 --- a/test/libsolidity/semanticTests/array/copying/bytes_memory_to_storage.sol +++ b/test/libsolidity/semanticTests/array/copying/bytes_memory_to_storage.sol @@ -6,7 +6,5 @@ contract C { return s[0]; } } -// ==== -// compileToEwasm: also // ---- // f() -> "a" diff --git a/test/libsolidity/semanticTests/array/copying/bytes_storage_to_memory.sol b/test/libsolidity/semanticTests/array/copying/bytes_storage_to_memory.sol index e996714ce278..84e11c1384b5 100644 --- a/test/libsolidity/semanticTests/array/copying/bytes_storage_to_memory.sol +++ b/test/libsolidity/semanticTests/array/copying/bytes_storage_to_memory.sol @@ -5,7 +5,5 @@ contract C { return data[0]; } } -// ==== -// compileToEwasm: also // ---- // f() -> "a" diff --git a/test/libsolidity/semanticTests/array/copying/calldata_array_of_struct_to_memory.sol b/test/libsolidity/semanticTests/array/copying/calldata_array_of_struct_to_memory.sol index 25a2c05f1668..fcf4aca21eaa 100644 --- a/test/libsolidity/semanticTests/array/copying/calldata_array_of_struct_to_memory.sol +++ b/test/libsolidity/semanticTests/array/copying/calldata_array_of_struct_to_memory.sol @@ -20,6 +20,5 @@ contract C { d = m[1].b; } } - // ---- // f((uint256,uint256)[]): 0x20, 0x2, 0x1, 0x2, 0x3, 0x4 -> 2, 1, 2, 3, 4 diff --git a/test/libsolidity/semanticTests/array/copying/calldata_array_static_to_memory.sol b/test/libsolidity/semanticTests/array/copying/calldata_array_static_to_memory.sol index fbc1d03d94aa..ace6550bb87f 100644 --- a/test/libsolidity/semanticTests/array/copying/calldata_array_static_to_memory.sol +++ b/test/libsolidity/semanticTests/array/copying/calldata_array_static_to_memory.sol @@ -4,7 +4,5 @@ contract C { return (m1[0], m1[1]); } } -// ==== -// compileToEwasm: also // ---- // f(uint256[2]): 43, 57 -> 43, 57 diff --git a/test/libsolidity/semanticTests/array/copying/calldata_array_to_mapping.sol b/test/libsolidity/semanticTests/array/copying/calldata_array_to_mapping.sol index 90b5b85d6afe..26f3d587f0c0 100644 --- a/test/libsolidity/semanticTests/array/copying/calldata_array_to_mapping.sol +++ b/test/libsolidity/semanticTests/array/copying/calldata_array_to_mapping.sol @@ -10,7 +10,6 @@ contract C { return m[0]; } } - // ==== // compileViaYul: true // ---- diff --git a/test/libsolidity/semanticTests/array/copying/calldata_bytes_to_storage.sol b/test/libsolidity/semanticTests/array/copying/calldata_bytes_to_storage.sol index 57f6b3a3e756..2409893e36a4 100644 --- a/test/libsolidity/semanticTests/array/copying/calldata_bytes_to_storage.sol +++ b/test/libsolidity/semanticTests/array/copying/calldata_bytes_to_storage.sol @@ -5,7 +5,5 @@ contract C { return s[0]; } } -// ==== -// compileToEwasm: also // ---- // f(bytes): 0x20, 0x08, "abcdefgh" -> "a" diff --git a/test/libsolidity/semanticTests/array/copying/calldata_dynamic_array_to_memory.sol b/test/libsolidity/semanticTests/array/copying/calldata_dynamic_array_to_memory.sol index 28eecc4f2e40..db6625c8e7bf 100644 --- a/test/libsolidity/semanticTests/array/copying/calldata_dynamic_array_to_memory.sol +++ b/test/libsolidity/semanticTests/array/copying/calldata_dynamic_array_to_memory.sol @@ -10,6 +10,5 @@ contract C { return (a.length, m); } } - // ---- // f(uint256[][]): 0x20, 0x1, 0x20, 0x2, 0x17, 0x2a -> 0x1, 0x40, 0x2, 0x17, 0x2a diff --git a/test/libsolidity/semanticTests/array/copying/copy_function_internal_storage_array.sol b/test/libsolidity/semanticTests/array/copying/copy_function_internal_storage_array.sol index d4d535950181..18795ff798c2 100644 --- a/test/libsolidity/semanticTests/array/copying/copy_function_internal_storage_array.sol +++ b/test/libsolidity/semanticTests/array/copying/copy_function_internal_storage_array.sol @@ -13,7 +13,6 @@ contract C { return 7; } } - // ---- // test() -> 7 // gas irOptimized: 122477 diff --git a/test/libsolidity/semanticTests/array/copying/copy_internal_function_array_to_storage.sol b/test/libsolidity/semanticTests/array/copying/copy_internal_function_array_to_storage.sol index 20b894082ca1..95ba9d8ed8e8 100644 --- a/test/libsolidity/semanticTests/array/copying/copy_internal_function_array_to_storage.sol +++ b/test/libsolidity/semanticTests/array/copying/copy_internal_function_array_to_storage.sol @@ -16,9 +16,6 @@ contract C { return 2; } } - -// ==== -// compileToEwasm: also // ---- // one() -> 3 // gas legacy: 140253 diff --git a/test/libsolidity/semanticTests/array/copying/copying_bytes_multiassign.sol b/test/libsolidity/semanticTests/array/copying/copying_bytes_multiassign.sol index ca6362b5c01d..8277df30a1e1 100644 --- a/test/libsolidity/semanticTests/array/copying/copying_bytes_multiassign.sol +++ b/test/libsolidity/semanticTests/array/copying/copying_bytes_multiassign.sol @@ -16,8 +16,6 @@ contract sender { bytes savedData1; bytes savedData2; } -// ==== -// compileToEwasm: false // ---- // (): 7 -> // gas irOptimized: 110820 diff --git a/test/libsolidity/semanticTests/array/copying/dirty_memory_bytes_to_storage_copy_ir.sol b/test/libsolidity/semanticTests/array/copying/dirty_memory_bytes_to_storage_copy_ir.sol index 2af9270624f6..3704e36821af 100644 --- a/test/libsolidity/semanticTests/array/copying/dirty_memory_bytes_to_storage_copy_ir.sol +++ b/test/libsolidity/semanticTests/array/copying/dirty_memory_bytes_to_storage_copy_ir.sol @@ -14,6 +14,5 @@ contract C { } // ==== // compileViaYul: true -// compileToEwasm: also // ---- // f() -> 0x6465616462656566000000000000000000000000000000000000000000000010 diff --git a/test/libsolidity/semanticTests/array/copying/elements_of_nested_array_of_structs_calldata_to_storage.sol b/test/libsolidity/semanticTests/array/copying/elements_of_nested_array_of_structs_calldata_to_storage.sol index f435d9136367..eb0eb108fbf9 100644 --- a/test/libsolidity/semanticTests/array/copying/elements_of_nested_array_of_structs_calldata_to_storage.sol +++ b/test/libsolidity/semanticTests/array/copying/elements_of_nested_array_of_structs_calldata_to_storage.sol @@ -27,8 +27,6 @@ contract C { return s3[0]; } } - - // ==== // compileViaYul: true // ---- diff --git a/test/libsolidity/semanticTests/array/copying/elements_of_nested_array_of_structs_memory_to_storage.sol b/test/libsolidity/semanticTests/array/copying/elements_of_nested_array_of_structs_memory_to_storage.sol index 3a52e0a58488..9dbc64f734a9 100644 --- a/test/libsolidity/semanticTests/array/copying/elements_of_nested_array_of_structs_memory_to_storage.sol +++ b/test/libsolidity/semanticTests/array/copying/elements_of_nested_array_of_structs_memory_to_storage.sol @@ -27,8 +27,6 @@ contract C { return s3[0]; } } - - // ==== // compileViaYul: true // ---- diff --git a/test/libsolidity/semanticTests/array/copying/nested_array_element_calldata_to_memory.sol b/test/libsolidity/semanticTests/array/copying/nested_array_element_calldata_to_memory.sol index ee715b5b6c11..e3843537fbed 100644 --- a/test/libsolidity/semanticTests/array/copying/nested_array_element_calldata_to_memory.sol +++ b/test/libsolidity/semanticTests/array/copying/nested_array_element_calldata_to_memory.sol @@ -31,7 +31,6 @@ contract C { return tmp[0]; } } - // ---- // test1(uint8[][][]): 0x20, 2, 0x40, 0x60, 0, 2, 0x40, 0x80, 1, 7, 2, 8, 9 -> 0x20, 2, 0x40, 0x80, 1, 7, 2, 8, 9 // test2(uint8[][1][]): 0x20, 2, 0x40, 0xe0, 0x20, 3, 12, 13, 14, 0x20, 3, 15, 16, 17 -> 0x20, 0x20, 3, 12, 13, 14 diff --git a/test/libsolidity/semanticTests/array/copying/nested_array_element_calldata_to_storage.sol b/test/libsolidity/semanticTests/array/copying/nested_array_element_calldata_to_storage.sol index 93c458341b04..5040a72cadb5 100644 --- a/test/libsolidity/semanticTests/array/copying/nested_array_element_calldata_to_storage.sol +++ b/test/libsolidity/semanticTests/array/copying/nested_array_element_calldata_to_storage.sol @@ -22,7 +22,6 @@ contract C { require(a2[1][1][1] == 0); } } - // ---- // test(uint8[2][2][2]): 1, 2, 3, 4, 5, 6, 7, 8 // test2(uint8[2][2]): 1, 2, 3, 4 diff --git a/test/libsolidity/semanticTests/array/copying/nested_array_element_memory_to_memory.sol b/test/libsolidity/semanticTests/array/copying/nested_array_element_memory_to_memory.sol index ab3d472d6f29..3058df842a27 100644 --- a/test/libsolidity/semanticTests/array/copying/nested_array_element_memory_to_memory.sol +++ b/test/libsolidity/semanticTests/array/copying/nested_array_element_memory_to_memory.sol @@ -31,7 +31,6 @@ contract C { return tmp[0]; } } - // ---- // test1(uint8[][][]): 0x20, 2, 0x40, 0x60, 0, 2, 0x40, 0x80, 1, 7, 2, 8, 9 -> 0x20, 2, 0x40, 0x80, 1, 7, 2, 8, 9 // test2(uint8[][1][]): 0x20, 2, 0x40, 0xe0, 0x20, 3, 12, 13, 14, 0x20, 3, 15, 16, 17 -> 0x20, 0x20, 3, 12, 13, 14 diff --git a/test/libsolidity/semanticTests/array/copying/nested_array_element_memory_to_storage.sol b/test/libsolidity/semanticTests/array/copying/nested_array_element_memory_to_storage.sol index 2dd2e7aa37b5..2f4b4ca7c9a1 100644 --- a/test/libsolidity/semanticTests/array/copying/nested_array_element_memory_to_storage.sol +++ b/test/libsolidity/semanticTests/array/copying/nested_array_element_memory_to_storage.sol @@ -22,7 +22,6 @@ contract C { require(a2[1][1][1] == 0); } } - // ---- // test(uint8[2][2][2]): 1, 2, 3, 4, 5, 6, 7, 8 // test2(uint8[2][2]): 1, 2, 3, 4 diff --git a/test/libsolidity/semanticTests/array/copying/nested_array_element_storage_to_memory.sol b/test/libsolidity/semanticTests/array/copying/nested_array_element_storage_to_memory.sol index 2f78042a488c..e30ca769bd42 100644 --- a/test/libsolidity/semanticTests/array/copying/nested_array_element_storage_to_memory.sol +++ b/test/libsolidity/semanticTests/array/copying/nested_array_element_storage_to_memory.sol @@ -60,7 +60,6 @@ contract C { return tmp; } } - // ---- // test1() -> 0x20, 2, 0x40, 0xa0, 2, 3, 4, 2, 5, 6 // test2() -> 0x20, 2, 0x40, 0xa0, 2, 6, 7, 2, 8, 9 diff --git a/test/libsolidity/semanticTests/array/copying/nested_array_element_storage_to_storage.sol b/test/libsolidity/semanticTests/array/copying/nested_array_element_storage_to_storage.sol index c402c14b2099..c962d815f434 100644 --- a/test/libsolidity/semanticTests/array/copying/nested_array_element_storage_to_storage.sol +++ b/test/libsolidity/semanticTests/array/copying/nested_array_element_storage_to_storage.sol @@ -68,7 +68,6 @@ contract C { require(dst4[1][1] == src4[0][1][1]); } } - // ---- // test1() -> // gas irOptimized: 150508 diff --git a/test/libsolidity/semanticTests/array/copying/nested_array_of_structs_calldata_to_memory.sol b/test/libsolidity/semanticTests/array/copying/nested_array_of_structs_calldata_to_memory.sol index 159486eda666..3d424a7c5976 100644 --- a/test/libsolidity/semanticTests/array/copying/nested_array_of_structs_calldata_to_memory.sol +++ b/test/libsolidity/semanticTests/array/copying/nested_array_of_structs_calldata_to_memory.sol @@ -18,7 +18,6 @@ contract C { return a; } } - // ---- // test1((uint8,uint8)[1][2]): 1, 2, 3, 4 -> 1, 2, 3, 4 // test2((uint8,uint8)[1][]): 0x20, 3, 7, 11, 13, 17, 19, 23 -> 0x20, 3, 7, 11, 13, 17, 19, 23 diff --git a/test/libsolidity/semanticTests/array/copying/nested_array_of_structs_calldata_to_storage.sol b/test/libsolidity/semanticTests/array/copying/nested_array_of_structs_calldata_to_storage.sol index 60d65cb59bd6..fe60365e4aa7 100644 --- a/test/libsolidity/semanticTests/array/copying/nested_array_of_structs_calldata_to_storage.sol +++ b/test/libsolidity/semanticTests/array/copying/nested_array_of_structs_calldata_to_storage.sol @@ -25,8 +25,6 @@ contract C { return s3; } } - - // ==== // compileViaYul: true // ---- diff --git a/test/libsolidity/semanticTests/array/copying/nested_array_of_structs_memory_to_memory.sol b/test/libsolidity/semanticTests/array/copying/nested_array_of_structs_memory_to_memory.sol index 55a4d6aedb2c..6c8da98dd66c 100644 --- a/test/libsolidity/semanticTests/array/copying/nested_array_of_structs_memory_to_memory.sol +++ b/test/libsolidity/semanticTests/array/copying/nested_array_of_structs_memory_to_memory.sol @@ -18,7 +18,6 @@ contract C { r = a; } } - // ---- // test1((uint8,uint8)[1][2]): 1, 2, 3, 4 -> 1, 2, 3, 4 // test2((uint8,uint8)[1][]): 0x20, 3, 7, 11, 13, 17, 19, 23 -> 0x20, 3, 7, 11, 13, 17, 19, 23 diff --git a/test/libsolidity/semanticTests/array/copying/nested_array_of_structs_memory_to_storage.sol b/test/libsolidity/semanticTests/array/copying/nested_array_of_structs_memory_to_storage.sol index 13b350262162..ccf2f2a2082d 100644 --- a/test/libsolidity/semanticTests/array/copying/nested_array_of_structs_memory_to_storage.sol +++ b/test/libsolidity/semanticTests/array/copying/nested_array_of_structs_memory_to_storage.sol @@ -25,8 +25,6 @@ contract C { return s3; } } - - // ==== // compileViaYul: true // ---- diff --git a/test/libsolidity/semanticTests/array/copying/nested_array_of_structs_storage_to_storage.sol b/test/libsolidity/semanticTests/array/copying/nested_array_of_structs_storage_to_storage.sol index 64c7f06a57c1..fb06b318874a 100644 --- a/test/libsolidity/semanticTests/array/copying/nested_array_of_structs_storage_to_storage.sol +++ b/test/libsolidity/semanticTests/array/copying/nested_array_of_structs_storage_to_storage.sol @@ -59,7 +59,6 @@ contract C { require(dst3[1][0].y == src3[1][0].y); } } - // ==== // compileViaYul: true // ---- diff --git a/test/libsolidity/semanticTests/array/copying/nested_array_of_structs_with_nested_array_from_storage_to_memory.sol b/test/libsolidity/semanticTests/array/copying/nested_array_of_structs_with_nested_array_from_storage_to_memory.sol index 58240492ca75..3a5e44a5df01 100644 --- a/test/libsolidity/semanticTests/array/copying/nested_array_of_structs_with_nested_array_from_storage_to_memory.sol +++ b/test/libsolidity/semanticTests/array/copying/nested_array_of_structs_with_nested_array_from_storage_to_memory.sol @@ -37,7 +37,6 @@ contract C { return s2[0]; } } - // ==== // compileViaYul: true // ---- diff --git a/test/libsolidity/semanticTests/array/copying/nested_dynamic_array_element_calldata_to_storage.sol b/test/libsolidity/semanticTests/array/copying/nested_dynamic_array_element_calldata_to_storage.sol index 5b7205553026..6e44ed2686ab 100644 --- a/test/libsolidity/semanticTests/array/copying/nested_dynamic_array_element_calldata_to_storage.sol +++ b/test/libsolidity/semanticTests/array/copying/nested_dynamic_array_element_calldata_to_storage.sol @@ -26,7 +26,6 @@ contract C { require(a2[1].length == 0); } } - // ==== // compileViaYul: true // ---- diff --git a/test/libsolidity/semanticTests/array/copying/storage_memory_packed.sol b/test/libsolidity/semanticTests/array/copying/storage_memory_packed.sol index b1410f7e2775..f49b4923b81f 100644 --- a/test/libsolidity/semanticTests/array/copying/storage_memory_packed.sol +++ b/test/libsolidity/semanticTests/array/copying/storage_memory_packed.sol @@ -9,7 +9,5 @@ contract C { return (m[0], m[16], m[32]); } } -// ==== -// compileToEwasm: also // ---- // f() -> 2, 3, 4 diff --git a/test/libsolidity/semanticTests/array/create_dynamic_array_with_zero_length.sol b/test/libsolidity/semanticTests/array/create_dynamic_array_with_zero_length.sol index 3856e23dc27c..9d2dbd8c28bb 100644 --- a/test/libsolidity/semanticTests/array/create_dynamic_array_with_zero_length.sol +++ b/test/libsolidity/semanticTests/array/create_dynamic_array_with_zero_length.sol @@ -4,7 +4,5 @@ contract C { return 7; } } -// ==== -// compileToEwasm: also // ---- // f() -> 7 diff --git a/test/libsolidity/semanticTests/array/create_memory_array_too_large.sol b/test/libsolidity/semanticTests/array/create_memory_array_too_large.sol index ed6a3740370a..1d886a8c0e7d 100644 --- a/test/libsolidity/semanticTests/array/create_memory_array_too_large.sol +++ b/test/libsolidity/semanticTests/array/create_memory_array_too_large.sol @@ -19,8 +19,6 @@ contract C { y[0] = 23; return x[2]; }} -// ==== -// compileToEwasm: also // ---- // f() -> FAILURE, hex"4e487b71", 0x41 // g() -> FAILURE, hex"4e487b71", 0x41 diff --git a/test/libsolidity/semanticTests/array/create_multiple_dynamic_arrays.sol b/test/libsolidity/semanticTests/array/create_multiple_dynamic_arrays.sol index ad5c3927927f..2396e3179b63 100644 --- a/test/libsolidity/semanticTests/array/create_multiple_dynamic_arrays.sol +++ b/test/libsolidity/semanticTests/array/create_multiple_dynamic_arrays.sol @@ -29,7 +29,5 @@ contract C { return 0; } } -// ==== -// compileToEwasm: also // ---- // f() -> 7 diff --git a/test/libsolidity/semanticTests/array/delete/delete_bytes_array.sol b/test/libsolidity/semanticTests/array/delete/delete_bytes_array.sol index 77096a645c32..b735d182d555 100644 --- a/test/libsolidity/semanticTests/array/delete/delete_bytes_array.sol +++ b/test/libsolidity/semanticTests/array/delete/delete_bytes_array.sol @@ -29,7 +29,6 @@ contract C { assert(size == 0); } } - // ---- // f() -> 0 // g() -> 0 diff --git a/test/libsolidity/semanticTests/array/delete/delete_memory_array.sol b/test/libsolidity/semanticTests/array/delete/delete_memory_array.sol index 54abc495c9b2..53a66af34337 100644 --- a/test/libsolidity/semanticTests/array/delete/delete_memory_array.sol +++ b/test/libsolidity/semanticTests/array/delete/delete_memory_array.sol @@ -10,6 +10,5 @@ contract C { } } } - // ---- // len() -> 0 diff --git a/test/libsolidity/semanticTests/array/delete/delete_on_array_of_structs.sol b/test/libsolidity/semanticTests/array/delete/delete_on_array_of_structs.sol index 316b8d9efd1e..2c1421eee952 100644 --- a/test/libsolidity/semanticTests/array/delete/delete_on_array_of_structs.sol +++ b/test/libsolidity/semanticTests/array/delete/delete_on_array_of_structs.sol @@ -15,6 +15,5 @@ contract C { return true; } } - // ---- // f() -> true # This code interprets x as an array length and thus will go out of gas. neither of the two should throw due to out-of-bounds access # diff --git a/test/libsolidity/semanticTests/array/delete/delete_storage_array.sol b/test/libsolidity/semanticTests/array/delete/delete_storage_array.sol index 0bb429674741..4136456684e2 100644 --- a/test/libsolidity/semanticTests/array/delete/delete_storage_array.sol +++ b/test/libsolidity/semanticTests/array/delete/delete_storage_array.sol @@ -32,7 +32,6 @@ contract C { } } } - // ---- // len() -> 0 // val() -> 0 diff --git a/test/libsolidity/semanticTests/array/dynamic_arrays_in_storage.sol b/test/libsolidity/semanticTests/array/dynamic_arrays_in_storage.sol index d6e7160be9fc..bce78baa4133 100644 --- a/test/libsolidity/semanticTests/array/dynamic_arrays_in_storage.sol +++ b/test/libsolidity/semanticTests/array/dynamic_arrays_in_storage.sol @@ -38,7 +38,6 @@ contract c { while (ids.length < l2) ids.push(); } } - // ---- // getLengths() -> 0, 0 // setLengths(uint256,uint256): 48, 49 -> diff --git a/test/libsolidity/semanticTests/array/dynamic_out_of_bounds_array_access.sol b/test/libsolidity/semanticTests/array/dynamic_out_of_bounds_array_access.sol index 844324f3253e..5cf35ef3edfe 100644 --- a/test/libsolidity/semanticTests/array/dynamic_out_of_bounds_array_access.sol +++ b/test/libsolidity/semanticTests/array/dynamic_out_of_bounds_array_access.sol @@ -19,7 +19,6 @@ contract c { return data.length; } } - // ---- // length() -> 0 // get(uint256): 3 -> FAILURE, hex"4e487b71", 0x32 diff --git a/test/libsolidity/semanticTests/array/external_array_args.sol b/test/libsolidity/semanticTests/array/external_array_args.sol index 53cc757725f0..da6664f9e91e 100644 --- a/test/libsolidity/semanticTests/array/external_array_args.sol +++ b/test/libsolidity/semanticTests/array/external_array_args.sol @@ -6,7 +6,5 @@ contract c { cv = c[c_index]; } } -// ==== -// compileToEwasm: also // ---- // test(uint256[8],uint256[],uint256[5],uint256,uint256,uint256): 1, 2, 3, 4, 5, 6, 7, 8, 0x220, 21, 22, 23, 24, 25, 0, 1, 2, 3, 11, 12, 13 -> 1, 12, 23 diff --git a/test/libsolidity/semanticTests/array/fixed_array_cleanup.sol b/test/libsolidity/semanticTests/array/fixed_array_cleanup.sol index 51f93db7a29b..337946a20c90 100644 --- a/test/libsolidity/semanticTests/array/fixed_array_cleanup.sol +++ b/test/libsolidity/semanticTests/array/fixed_array_cleanup.sol @@ -7,8 +7,6 @@ contract c { } function clear() public { delete data; } } -// ==== -// compileToEwasm: also // ---- // storageEmpty -> 1 // fill() -> diff --git a/test/libsolidity/semanticTests/array/fixed_arrays_as_return_type.sol b/test/libsolidity/semanticTests/array/fixed_arrays_as_return_type.sol index 519a11131c85..9d8dc0bc7b52 100644 --- a/test/libsolidity/semanticTests/array/fixed_arrays_as_return_type.sol +++ b/test/libsolidity/semanticTests/array/fixed_arrays_as_return_type.sol @@ -16,7 +16,6 @@ contract B { res2 = a.f(1000); } } - // ---- // f() -> 2, 3, 4, 5, 6, 1000, 1001, 1002, 1003, 1004 // gas irOptimized: 115828 diff --git a/test/libsolidity/semanticTests/array/fixed_arrays_in_storage.sol b/test/libsolidity/semanticTests/array/fixed_arrays_in_storage.sol index eb167ee0c8f1..b65a3d254d54 100644 --- a/test/libsolidity/semanticTests/array/fixed_arrays_in_storage.sol +++ b/test/libsolidity/semanticTests/array/fixed_arrays_in_storage.sol @@ -33,8 +33,6 @@ contract c { l2 = ids.length; } } -// ==== -// compileToEwasm: also // ---- // setIDStatic(uint256): 0xb -> // getID(uint256): 0x2 -> 0xb diff --git a/test/libsolidity/semanticTests/array/fixed_bytes_length_access.sol b/test/libsolidity/semanticTests/array/fixed_bytes_length_access.sol index e22b56cfc1a6..d641cd83f1ac 100644 --- a/test/libsolidity/semanticTests/array/fixed_bytes_length_access.sol +++ b/test/libsolidity/semanticTests/array/fixed_bytes_length_access.sol @@ -5,7 +5,5 @@ contract C { return (x.length, bytes16(uint128(2)).length, a.length + 7); } } -// ==== -// compileToEwasm: also // ---- // f(bytes32): "789" -> 32, 16, 8 diff --git a/test/libsolidity/semanticTests/array/fixed_out_of_bounds_array_access.sol b/test/libsolidity/semanticTests/array/fixed_out_of_bounds_array_access.sol index d82ef152c971..1b3b640808b3 100644 --- a/test/libsolidity/semanticTests/array/fixed_out_of_bounds_array_access.sol +++ b/test/libsolidity/semanticTests/array/fixed_out_of_bounds_array_access.sol @@ -14,9 +14,6 @@ contract c { return data.length; } } - -// ==== -// compileToEwasm: also // ---- // length() -> 4 // set(uint256,uint256): 3, 4 -> true diff --git a/test/libsolidity/semanticTests/array/function_array_cross_calls.sol b/test/libsolidity/semanticTests/array/function_array_cross_calls.sol index 8bb4545b2b94..7e29d82a8166 100644 --- a/test/libsolidity/semanticTests/array/function_array_cross_calls.sol +++ b/test/libsolidity/semanticTests/array/function_array_cross_calls.sol @@ -40,7 +40,6 @@ contract C { return this.e; } } - // ---- // test() -> 5, 6, 7 // gas irOptimized: 260895 diff --git a/test/libsolidity/semanticTests/array/function_memory_array.sol b/test/libsolidity/semanticTests/array/function_memory_array.sol index 322eed73ead3..bdd23c67538e 100644 --- a/test/libsolidity/semanticTests/array/function_memory_array.sol +++ b/test/libsolidity/semanticTests/array/function_memory_array.sol @@ -30,8 +30,6 @@ contract C { return arr[i](x); } } -// ==== -// compileToEwasm: also // ---- // test(uint256,uint256): 10, 0 -> 11 // test(uint256,uint256): 10, 1 -> 12 diff --git a/test/libsolidity/semanticTests/array/indexAccess/index_access.sol b/test/libsolidity/semanticTests/array/indexAccess/index_access.sol index b90bbb12e38f..c618ae8e45d4 100644 --- a/test/libsolidity/semanticTests/array/indexAccess/index_access.sol +++ b/test/libsolidity/semanticTests/array/indexAccess/index_access.sol @@ -13,8 +13,6 @@ contract C { ret[7] = bytesValue[0]; } } -// ==== -// compileToEwasm: also // ---- // to_little_endian_64(uint64): 0 -> 0x20, 8, 0x00 // to_little_endian_64(uint64): 0x0102030405060708 -> 0x20, 8, 0x0807060504030201000000000000000000000000000000000000000000000000 diff --git a/test/libsolidity/semanticTests/array/indexAccess/inline_array_index_access_ints.sol b/test/libsolidity/semanticTests/array/indexAccess/inline_array_index_access_ints.sol index c1481fc9973e..0525f6f283ef 100644 --- a/test/libsolidity/semanticTests/array/indexAccess/inline_array_index_access_ints.sol +++ b/test/libsolidity/semanticTests/array/indexAccess/inline_array_index_access_ints.sol @@ -3,8 +3,5 @@ contract C { return ([1, 2, 3, 4][2]); } } - -// ==== -// compileToEwasm: also // ---- // f() -> 3 diff --git a/test/libsolidity/semanticTests/array/indexAccess/inline_array_index_access_strings.sol b/test/libsolidity/semanticTests/array/indexAccess/inline_array_index_access_strings.sol index b826dc13d061..bf6c0b0ee8d4 100644 --- a/test/libsolidity/semanticTests/array/indexAccess/inline_array_index_access_strings.sol +++ b/test/libsolidity/semanticTests/array/indexAccess/inline_array_index_access_strings.sol @@ -9,9 +9,6 @@ contract C { tester = f(); } } - -// ==== -// compileToEwasm: also // ---- // test() -> // tester() -> 0x20, 0x3, "abc" diff --git a/test/libsolidity/semanticTests/array/indexAccess/memory_arrays_index_access_write.sol b/test/libsolidity/semanticTests/array/indexAccess/memory_arrays_index_access_write.sol index ff83a43101bc..7a8a18670ea5 100644 --- a/test/libsolidity/semanticTests/array/indexAccess/memory_arrays_index_access_write.sol +++ b/test/libsolidity/semanticTests/array/indexAccess/memory_arrays_index_access_write.sol @@ -10,7 +10,5 @@ contract Test { return data; } } -// ==== -// compileToEwasm: also // ---- // f() -> 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x07 diff --git a/test/libsolidity/semanticTests/array/inline_array_return.sol b/test/libsolidity/semanticTests/array/inline_array_return.sol index d6673882f606..25302dcbfdd2 100644 --- a/test/libsolidity/semanticTests/array/inline_array_return.sol +++ b/test/libsolidity/semanticTests/array/inline_array_return.sol @@ -10,8 +10,5 @@ contract C { return (tester[0], tester[1], tester[2], tester[3], tester[4]); } } - -// ==== -// compileToEwasm: also // ---- // f() -> 1, 2, 3, 4, 5 diff --git a/test/libsolidity/semanticTests/array/inline_array_singleton.sol b/test/libsolidity/semanticTests/array/inline_array_singleton.sol index 870c853e14fd..b14ade6e48c1 100644 --- a/test/libsolidity/semanticTests/array/inline_array_singleton.sol +++ b/test/libsolidity/semanticTests/array/inline_array_singleton.sol @@ -4,7 +4,5 @@ contract C { return [4][0]; } } -// ==== -// compileToEwasm: also // ---- // f() -> 4 diff --git a/test/libsolidity/semanticTests/array/inline_array_storage_to_memory_conversion_ints.sol b/test/libsolidity/semanticTests/array/inline_array_storage_to_memory_conversion_ints.sol index 18626b055d7c..e145d281c906 100644 --- a/test/libsolidity/semanticTests/array/inline_array_storage_to_memory_conversion_ints.sol +++ b/test/libsolidity/semanticTests/array/inline_array_storage_to_memory_conversion_ints.sol @@ -6,8 +6,5 @@ contract C { return (z[0], z[1]); } } - -// ==== -// compileToEwasm: also // ---- // f() -> 3, 6 diff --git a/test/libsolidity/semanticTests/array/inline_array_storage_to_memory_conversion_strings.sol b/test/libsolidity/semanticTests/array/inline_array_storage_to_memory_conversion_strings.sol index 2b456ca9aadc..7dfe6e642594 100644 --- a/test/libsolidity/semanticTests/array/inline_array_storage_to_memory_conversion_strings.sol +++ b/test/libsolidity/semanticTests/array/inline_array_storage_to_memory_conversion_strings.sol @@ -7,8 +7,5 @@ contract C { return (x[1], x[2]); } } - -// ==== -// compileToEwasm: also // ---- // f() -> 0x40, 0x80, 0x3, "ray", 0x2, "mi" diff --git a/test/libsolidity/semanticTests/array/inline_array_strings_from_document.sol b/test/libsolidity/semanticTests/array/inline_array_strings_from_document.sol index 23f2d89c704f..9cb16349a1ef 100644 --- a/test/libsolidity/semanticTests/array/inline_array_strings_from_document.sol +++ b/test/libsolidity/semanticTests/array/inline_array_strings_from_document.sol @@ -4,9 +4,6 @@ contract C { return (x[i]); } } - -// ==== -// compileToEwasm: also // ---- // f(uint256): 0 -> 0x20, 0x4, "This" // f(uint256): 1 -> 0x20, 0x2, "is" diff --git a/test/libsolidity/semanticTests/array/memory.sol b/test/libsolidity/semanticTests/array/memory.sol index 6bde7c26cde3..88c18d4949b3 100644 --- a/test/libsolidity/semanticTests/array/memory.sol +++ b/test/libsolidity/semanticTests/array/memory.sol @@ -9,7 +9,6 @@ contract C { return this.h(n) * 2; } } - // ---- // h(uint256[4]): 1, 2, 3, 4 -> 10 // i(uint256[4]): 1, 2, 3, 4 -> 20 diff --git a/test/libsolidity/semanticTests/array/pop/array_pop_empty_exception.sol b/test/libsolidity/semanticTests/array/pop/array_pop_empty_exception.sol index 1750711e1349..6130130da2de 100644 --- a/test/libsolidity/semanticTests/array/pop/array_pop_empty_exception.sol +++ b/test/libsolidity/semanticTests/array/pop/array_pop_empty_exception.sol @@ -6,7 +6,5 @@ contract c { return true; } } -// ==== -// compileToEwasm: also // ---- // test() -> FAILURE, hex"4e487b71", 0x31 diff --git a/test/libsolidity/semanticTests/array/pop/array_pop_isolated.sol b/test/libsolidity/semanticTests/array/pop/array_pop_isolated.sol index ce41673e068d..43d7c3a9836d 100644 --- a/test/libsolidity/semanticTests/array/pop/array_pop_isolated.sol +++ b/test/libsolidity/semanticTests/array/pop/array_pop_isolated.sol @@ -8,7 +8,5 @@ contract c { x = 3; } } -// ==== -// compileToEwasm: also // ---- // test() -> 3 diff --git a/test/libsolidity/semanticTests/array/pop/byte_array_pop.sol b/test/libsolidity/semanticTests/array/pop/byte_array_pop.sol index 81e1eb020d53..8f0152180e35 100644 --- a/test/libsolidity/semanticTests/array/pop/byte_array_pop.sol +++ b/test/libsolidity/semanticTests/array/pop/byte_array_pop.sol @@ -12,7 +12,5 @@ contract c { l = data.length; } } -// ==== -// compileToEwasm: also // ---- // test() -> 2, 1, 1 diff --git a/test/libsolidity/semanticTests/array/pop/byte_array_pop_copy_long.sol b/test/libsolidity/semanticTests/array/pop/byte_array_pop_copy_long.sol index 3528e4c8180a..c64d93c1208a 100644 --- a/test/libsolidity/semanticTests/array/pop/byte_array_pop_copy_long.sol +++ b/test/libsolidity/semanticTests/array/pop/byte_array_pop_copy_long.sol @@ -7,7 +7,6 @@ contract c { return data; } } - // ---- // test() -> 0x20, 29, 0x0303030303030303030303030303030303030303030303030303030303000000 // gas irOptimized: 109310 diff --git a/test/libsolidity/semanticTests/array/pop/byte_array_pop_empty_exception.sol b/test/libsolidity/semanticTests/array/pop/byte_array_pop_empty_exception.sol index 5d573a096225..d860275e404f 100644 --- a/test/libsolidity/semanticTests/array/pop/byte_array_pop_empty_exception.sol +++ b/test/libsolidity/semanticTests/array/pop/byte_array_pop_empty_exception.sol @@ -9,7 +9,5 @@ contract c { return true; } } -// ==== -// compileToEwasm: also // ---- // test() -> FAILURE, hex"4e487b71", 0x31 diff --git a/test/libsolidity/semanticTests/array/pop/byte_array_pop_isolated.sol b/test/libsolidity/semanticTests/array/pop/byte_array_pop_isolated.sol index 519b0c5abed4..f74221712534 100644 --- a/test/libsolidity/semanticTests/array/pop/byte_array_pop_isolated.sol +++ b/test/libsolidity/semanticTests/array/pop/byte_array_pop_isolated.sol @@ -8,7 +8,5 @@ contract c { x = 3; } } -// ==== -// compileToEwasm: also // ---- // test() -> 3 diff --git a/test/libsolidity/semanticTests/array/pop/byte_array_pop_masking_long.sol b/test/libsolidity/semanticTests/array/pop/byte_array_pop_masking_long.sol index 6416afb2da74..623b58739a11 100644 --- a/test/libsolidity/semanticTests/array/pop/byte_array_pop_masking_long.sol +++ b/test/libsolidity/semanticTests/array/pop/byte_array_pop_masking_long.sol @@ -7,7 +7,6 @@ contract c { return data; } } - // ---- // test() -> 0x20, 33, 0x303030303030303030303030303030303030303030303030303030303030303, 0x0300000000000000000000000000000000000000000000000000000000000000 // gas irOptimized: 108053 diff --git a/test/libsolidity/semanticTests/array/pop/byte_array_pop_storage_empty.sol b/test/libsolidity/semanticTests/array/pop/byte_array_pop_storage_empty.sol index 4b2e88ffa827..a89f8a2acebf 100644 --- a/test/libsolidity/semanticTests/array/pop/byte_array_pop_storage_empty.sol +++ b/test/libsolidity/semanticTests/array/pop/byte_array_pop_storage_empty.sol @@ -9,8 +9,6 @@ contract c { data.pop(); } } -// ==== -// compileToEwasm: also // ---- // test() -> // storageEmpty -> 1 diff --git a/test/libsolidity/semanticTests/array/push/array_push_packed_array.sol b/test/libsolidity/semanticTests/array/push/array_push_packed_array.sol index 434168119284..e7a3bdbd1f18 100644 --- a/test/libsolidity/semanticTests/array/push/array_push_packed_array.sol +++ b/test/libsolidity/semanticTests/array/push/array_push_packed_array.sol @@ -11,7 +11,6 @@ contract c { return (x[0], x[1], x[2], x[3]); } } - // ---- // test() -> 1, 2, 3, 4 // gas irOptimized: 93017 diff --git a/test/libsolidity/semanticTests/array/push/byte_array_push.sol b/test/libsolidity/semanticTests/array/push/byte_array_push.sol index 28afd9f89c2c..2e0288d24327 100644 --- a/test/libsolidity/semanticTests/array/push/byte_array_push.sol +++ b/test/libsolidity/semanticTests/array/push/byte_array_push.sol @@ -13,7 +13,5 @@ contract c { if (l != 0x03) return true; } } -// ==== -// compileToEwasm: also // ---- // test() -> false diff --git a/test/libsolidity/semanticTests/array/short_fixed_array_cleanup.sol b/test/libsolidity/semanticTests/array/short_fixed_array_cleanup.sol index 6fada19c57a3..8288e1e86165 100644 --- a/test/libsolidity/semanticTests/array/short_fixed_array_cleanup.sol +++ b/test/libsolidity/semanticTests/array/short_fixed_array_cleanup.sol @@ -7,8 +7,6 @@ contract c { } function clear() public { delete data; } } -// ==== -// compileToEwasm: also // ---- // storageEmpty -> 1 // fill() -> diff --git a/test/libsolidity/semanticTests/array/slices/array_calldata_assignment.sol b/test/libsolidity/semanticTests/array/slices/array_calldata_assignment.sol index 282ccba09b2b..c9c489a8fccd 100644 --- a/test/libsolidity/semanticTests/array/slices/array_calldata_assignment.sol +++ b/test/libsolidity/semanticTests/array/slices/array_calldata_assignment.sol @@ -4,7 +4,5 @@ contract C { return x[i]; } } -// ==== -// compileToEwasm: also // ---- // f(uint256[],uint256[],uint256): 0x60, 0xA0, 1, 1, 0, 2, 1, 2 -> 2 diff --git a/test/libsolidity/semanticTests/array/storage_array_ref.sol b/test/libsolidity/semanticTests/array/storage_array_ref.sol index 0a896fed4b5b..37292ae874d1 100644 --- a/test/libsolidity/semanticTests/array/storage_array_ref.sol +++ b/test/libsolidity/semanticTests/array/storage_array_ref.sol @@ -38,7 +38,6 @@ contract Store is BinarySearch { return find(data, v); } } - // ---- // find(uint256): 7 -> -1 // add(uint256): 7 -> diff --git a/test/libsolidity/semanticTests/array/string_allocation_bug.sol b/test/libsolidity/semanticTests/array/string_allocation_bug.sol index bc974a438305..d6dadb78a964 100644 --- a/test/libsolidity/semanticTests/array/string_allocation_bug.sol +++ b/test/libsolidity/semanticTests/array/string_allocation_bug.sol @@ -16,7 +16,5 @@ contract Sample { p[0] = m; } } -// ==== -// compileToEwasm: also // ---- // p(uint256): 0x0 -> 0xbbbb, 0xcccc, 0x80, 0xc0, 0x05, "hello", 0x05, "world" diff --git a/test/libsolidity/semanticTests/array/strings_in_struct.sol b/test/libsolidity/semanticTests/array/strings_in_struct.sol index 1cc6b5a9325d..bacf8dec7a00 100644 --- a/test/libsolidity/semanticTests/array/strings_in_struct.sol +++ b/test/libsolidity/semanticTests/array/strings_in_struct.sol @@ -28,8 +28,6 @@ contract buggystruct { return bug.last; } } -// ==== -// compileToEwasm: also // ---- // getFirst() -> 0x0a // getSecond() -> 0x14 diff --git a/test/libsolidity/semanticTests/asmForLoop/for_loop_break.sol b/test/libsolidity/semanticTests/asmForLoop/for_loop_break.sol index c0c58007210e..d74db942c6a6 100644 --- a/test/libsolidity/semanticTests/asmForLoop/for_loop_break.sol +++ b/test/libsolidity/semanticTests/asmForLoop/for_loop_break.sol @@ -9,7 +9,5 @@ contract C { } } } -// ==== -// compileToEwasm: also // ---- // f() -> 6 diff --git a/test/libsolidity/semanticTests/asmForLoop/for_loop_continue.sol b/test/libsolidity/semanticTests/asmForLoop/for_loop_continue.sol index 4be20d6ba58a..f25a3c06a0bc 100644 --- a/test/libsolidity/semanticTests/asmForLoop/for_loop_continue.sol +++ b/test/libsolidity/semanticTests/asmForLoop/for_loop_continue.sol @@ -9,7 +9,5 @@ contract C { } } } -// ==== -// compileToEwasm: also // ---- // f() -> 5 diff --git a/test/libsolidity/semanticTests/asmForLoop/for_loop_nested.sol b/test/libsolidity/semanticTests/asmForLoop/for_loop_nested.sol index 620f2c3baaba..3a13e9f0e674 100644 --- a/test/libsolidity/semanticTests/asmForLoop/for_loop_nested.sol +++ b/test/libsolidity/semanticTests/asmForLoop/for_loop_nested.sol @@ -13,8 +13,6 @@ contract C { } } } -// ==== -// compileToEwasm: also // ---- // f(uint256): 0 -> 2 // f(uint256): 1 -> 18 diff --git a/test/libsolidity/semanticTests/builtinFunctions/assignment_to_const_var_involving_keccak.sol b/test/libsolidity/semanticTests/builtinFunctions/assignment_to_const_var_involving_keccak.sol index 2e8a66363e51..2fc479d0e10a 100644 --- a/test/libsolidity/semanticTests/builtinFunctions/assignment_to_const_var_involving_keccak.sol +++ b/test/libsolidity/semanticTests/builtinFunctions/assignment_to_const_var_involving_keccak.sol @@ -5,7 +5,5 @@ contract C { return x; } } -// ==== -// compileToEwasm: also // ---- // f() -> 0x4e03657aea45a94fc7d47ba826c8d667c0d1e6e33a64a036ec44f58fa12d6c45 diff --git a/test/libsolidity/semanticTests/builtinFunctions/blockhash.sol b/test/libsolidity/semanticTests/builtinFunctions/blockhash.sol index dc6e26f141a7..008a0467d42f 100644 --- a/test/libsolidity/semanticTests/builtinFunctions/blockhash.sol +++ b/test/libsolidity/semanticTests/builtinFunctions/blockhash.sol @@ -9,8 +9,6 @@ contract C { return blockhash(3); } } -// ==== -// compileToEwasm: also // ---- // f() -> 0x3737373737373737373737373737373737373737373737373737373737373738 // g() -> 0x3737373737373737373737373737373737373737373737373737373737373739 diff --git a/test/libsolidity/semanticTests/builtinFunctions/blockhash_shadow_resolution.sol b/test/libsolidity/semanticTests/builtinFunctions/blockhash_shadow_resolution.sol index fa1d01d4035f..0b532da0ec8d 100644 --- a/test/libsolidity/semanticTests/builtinFunctions/blockhash_shadow_resolution.sol +++ b/test/libsolidity/semanticTests/builtinFunctions/blockhash_shadow_resolution.sol @@ -2,7 +2,5 @@ contract C { function blockhash(uint256 blockNumber) public returns(bytes32) { bytes32 x; return x; } function f() public returns(bytes32) { return blockhash(3); } } -// ==== -// compileToEwasm: also // ---- // f() -> 0 diff --git a/test/libsolidity/semanticTests/builtinFunctions/function_types_sig.sol b/test/libsolidity/semanticTests/builtinFunctions/function_types_sig.sol index 9a8132950c15..2e771032bc7e 100644 --- a/test/libsolidity/semanticTests/builtinFunctions/function_types_sig.sol +++ b/test/libsolidity/semanticTests/builtinFunctions/function_types_sig.sol @@ -19,8 +19,6 @@ contract C { return this.x.selector; } } -// ==== -// compileToEwasm: also // ---- // f() -> 0x26121ff000000000000000000000000000000000000000000000000000000000 // g() -> 0x26121ff000000000000000000000000000000000000000000000000000000000 diff --git a/test/libsolidity/semanticTests/builtinFunctions/keccak256_empty.sol b/test/libsolidity/semanticTests/builtinFunctions/keccak256_empty.sol index 1898f0311374..f75c569e7777 100644 --- a/test/libsolidity/semanticTests/builtinFunctions/keccak256_empty.sol +++ b/test/libsolidity/semanticTests/builtinFunctions/keccak256_empty.sol @@ -3,8 +3,5 @@ contract C { return keccak256(""); } } - -// ==== -// compileToEwasm: also // ---- // f() -> 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470 diff --git a/test/libsolidity/semanticTests/builtinFunctions/keccak256_with_bytes.sol b/test/libsolidity/semanticTests/builtinFunctions/keccak256_with_bytes.sol index 725d984d86f8..1904e814021b 100644 --- a/test/libsolidity/semanticTests/builtinFunctions/keccak256_with_bytes.sol +++ b/test/libsolidity/semanticTests/builtinFunctions/keccak256_with_bytes.sol @@ -8,6 +8,5 @@ contract c { return keccak256(data) == keccak256("foo"); } } - // ---- // foo() -> true diff --git a/test/libsolidity/semanticTests/builtinFunctions/msg_sig.sol b/test/libsolidity/semanticTests/builtinFunctions/msg_sig.sol index 21c5ed76dba8..f28658fe7dc1 100644 --- a/test/libsolidity/semanticTests/builtinFunctions/msg_sig.sol +++ b/test/libsolidity/semanticTests/builtinFunctions/msg_sig.sol @@ -3,7 +3,5 @@ contract test { return msg.sig; } } -// ==== -// compileToEwasm: also // ---- // foo(uint256): 0x0 -> 0x2fbebd3800000000000000000000000000000000000000000000000000000000 diff --git a/test/libsolidity/semanticTests/builtinFunctions/msg_sig_after_internal_call_is_same.sol b/test/libsolidity/semanticTests/builtinFunctions/msg_sig_after_internal_call_is_same.sol index a50521610f9c..7ff53efaa478 100644 --- a/test/libsolidity/semanticTests/builtinFunctions/msg_sig_after_internal_call_is_same.sol +++ b/test/libsolidity/semanticTests/builtinFunctions/msg_sig_after_internal_call_is_same.sol @@ -7,7 +7,5 @@ contract test { return boo(); } } -// ==== -// compileToEwasm: also // ---- // foo(uint256): 0x0 -> 0x2fbebd3800000000000000000000000000000000000000000000000000000000 diff --git a/test/libsolidity/semanticTests/builtinFunctions/ripemd160_empty.sol b/test/libsolidity/semanticTests/builtinFunctions/ripemd160_empty.sol index c79625d3cc5b..330fafc4d8df 100644 --- a/test/libsolidity/semanticTests/builtinFunctions/ripemd160_empty.sol +++ b/test/libsolidity/semanticTests/builtinFunctions/ripemd160_empty.sol @@ -3,6 +3,5 @@ contract C { return ripemd160(""); } } - // ---- // f() -> 0x9c1185a5c5e9fc54612808977ee8f548b2258d31000000000000000000000000 diff --git a/test/libsolidity/semanticTests/c99_scoping_activation.sol b/test/libsolidity/semanticTests/c99_scoping_activation.sol index 394b211d625e..6edf9db476fa 100644 --- a/test/libsolidity/semanticTests/c99_scoping_activation.sol +++ b/test/libsolidity/semanticTests/c99_scoping_activation.sol @@ -34,8 +34,6 @@ contract test { } } } -// ==== -// compileToEwasm: also // ---- // f() -> 3 // g() -> 0 diff --git a/test/libsolidity/semanticTests/calldata/calldata_array_index_range_access.sol b/test/libsolidity/semanticTests/calldata/calldata_array_index_range_access.sol index 61013596807b..634e35693ca2 100644 --- a/test/libsolidity/semanticTests/calldata/calldata_array_index_range_access.sol +++ b/test/libsolidity/semanticTests/calldata/calldata_array_index_range_access.sol @@ -25,8 +25,6 @@ contract C { return x[:e][idx]; } } -// ==== -// compileToEwasm: also // ---- // f(uint256[],uint256,uint256): 0x60, 2, 4, 5, 1, 2, 3, 4, 5 -> 2 // f(uint256[],uint256,uint256): 0x60, 2, 6, 5, 1, 2, 3, 4, 5 -> FAILURE diff --git a/test/libsolidity/semanticTests/calldata/calldata_array_three_dimensional.sol b/test/libsolidity/semanticTests/calldata/calldata_array_three_dimensional.sol index 826c5f723b9c..42c360be0b7f 100644 --- a/test/libsolidity/semanticTests/calldata/calldata_array_three_dimensional.sol +++ b/test/libsolidity/semanticTests/calldata/calldata_array_three_dimensional.sol @@ -8,8 +8,6 @@ contract C { d = x[i][j][k]; } } -// ==== -// compileToEwasm: also // ---- // f(uint256[][2][],uint256,uint256,uint256): 0x80, 0, 0, 0, 1, 0x20, 0x40, 0x80, 1, 42, 1, 23 -> 1, 2, 1, 42 // f(uint256[][2][],uint256,uint256,uint256): 0x80, 0, 1, 0, 1, 0x20, 0x40, 0x80, 1, 42, 1, 23 -> 1, 2, 1, 23 diff --git a/test/libsolidity/semanticTests/calldata/calldata_attached_to_bytes.sol b/test/libsolidity/semanticTests/calldata/calldata_attached_to_bytes.sol index e41b75c2dff0..1b6e7379b457 100644 --- a/test/libsolidity/semanticTests/calldata/calldata_attached_to_bytes.sol +++ b/test/libsolidity/semanticTests/calldata/calldata_attached_to_bytes.sol @@ -13,6 +13,5 @@ contract C { return _b.reverse(); } } - // ---- // test(uint256,bytes,uint256): 7, 0x60, 4, 2, "ab" -> "b", "a" diff --git a/test/libsolidity/semanticTests/calldata/calldata_attached_to_dynamic_array_or_slice.sol b/test/libsolidity/semanticTests/calldata/calldata_attached_to_dynamic_array_or_slice.sol index 3ebb4787acc7..5803ef6e845d 100644 --- a/test/libsolidity/semanticTests/calldata/calldata_attached_to_dynamic_array_or_slice.sol +++ b/test/libsolidity/semanticTests/calldata/calldata_attached_to_dynamic_array_or_slice.sol @@ -17,7 +17,6 @@ contract C { return _a[:].reverse(); } } - // ---- // testArray(uint256,uint256[],uint256): 7, 0x60, 4, 2, 66, 77 -> 77, 66 // testSlice(uint256,uint256[],uint256): 7, 0x60, 4, 2, 66, 77 -> 77, 66 diff --git a/test/libsolidity/semanticTests/calldata/calldata_attached_to_static_array.sol b/test/libsolidity/semanticTests/calldata/calldata_attached_to_static_array.sol index e43b17561cb2..a5158dad66a4 100644 --- a/test/libsolidity/semanticTests/calldata/calldata_attached_to_static_array.sol +++ b/test/libsolidity/semanticTests/calldata/calldata_attached_to_static_array.sol @@ -13,6 +13,5 @@ contract C { return _a.reverse(); } } - // ---- // test(uint256,uint256[2],uint256): 7, 66, 77, 4 -> 77, 66 diff --git a/test/libsolidity/semanticTests/calldata/calldata_struct_cleaning.sol b/test/libsolidity/semanticTests/calldata/calldata_struct_cleaning.sol index 493b1ef0b22e..45b323b3d182 100644 --- a/test/libsolidity/semanticTests/calldata/calldata_struct_cleaning.sol +++ b/test/libsolidity/semanticTests/calldata/calldata_struct_cleaning.sol @@ -16,8 +16,6 @@ contract C { } } } -// ==== -// compileToEwasm: also // ---- // f((uint8,bytes1)): 0x12, hex"3400000000000000000000000000000000000000000000000000000000000000" -> 0x12, hex"3400000000000000000000000000000000000000000000000000000000000000" # double check that the valid case goes through # // f((uint8,bytes1)): 0x1234, hex"5678000000000000000000000000000000000000000000000000000000000000" -> FAILURE diff --git a/test/libsolidity/semanticTests/calldata/copy_from_calldata_removes_bytes_data.sol b/test/libsolidity/semanticTests/calldata/copy_from_calldata_removes_bytes_data.sol index 8df274158469..3dd93c12e42c 100644 --- a/test/libsolidity/semanticTests/calldata/copy_from_calldata_removes_bytes_data.sol +++ b/test/libsolidity/semanticTests/calldata/copy_from_calldata_removes_bytes_data.sol @@ -7,7 +7,6 @@ contract c { } // ==== // EVMVersion: >=byzantium -// compileToEwasm: false // ---- // (): 1, 2, 3, 4, 5 -> // gas irOptimized: 155155 diff --git a/test/libsolidity/semanticTests/cleanup/bool_conversion_v2.sol b/test/libsolidity/semanticTests/cleanup/bool_conversion_v2.sol index 821da2dac605..003cdb0ec781 100644 --- a/test/libsolidity/semanticTests/cleanup/bool_conversion_v2.sol +++ b/test/libsolidity/semanticTests/cleanup/bool_conversion_v2.sol @@ -11,8 +11,6 @@ contract C { _out = _in; } } -// ==== -// compileToEwasm: also // ---- // f(bool): 0x0 -> 0x0 // f(bool): 0x1 -> 0x1 diff --git a/test/libsolidity/semanticTests/cleanup/cleanup_address_types_shortening.sol b/test/libsolidity/semanticTests/cleanup/cleanup_address_types_shortening.sol index 916f2e5aad74..8718cb2e6a67 100644 --- a/test/libsolidity/semanticTests/cleanup/cleanup_address_types_shortening.sol +++ b/test/libsolidity/semanticTests/cleanup/cleanup_address_types_shortening.sol @@ -25,9 +25,6 @@ contract C { require(z == 0x1122334455667788990011223344556677889900); } } - -// ==== -// compileToEwasm: also // ---- // f() -> 0x1122334455667788990011223344556677889900 // g() -> 0x1122334455667788990011223344556677889900 diff --git a/test/libsolidity/semanticTests/cleanup/cleanup_address_types_v2.sol b/test/libsolidity/semanticTests/cleanup/cleanup_address_types_v2.sol index d6157ab23eb3..73db35c32cb5 100644 --- a/test/libsolidity/semanticTests/cleanup/cleanup_address_types_v2.sol +++ b/test/libsolidity/semanticTests/cleanup/cleanup_address_types_v2.sol @@ -13,8 +13,6 @@ contract C { return 0; } } -// ==== -// compileToEwasm: also // ---- // f(address): 0xffff1234567890123456789012345678901234567890 -> FAILURE # We input longer data on purpose.# // g(address): 0xffff1234567890123456789012345678901234567890 -> FAILURE diff --git a/test/libsolidity/semanticTests/cleanup/cleanup_bytes_types_shortening_newCodeGen.sol b/test/libsolidity/semanticTests/cleanup/cleanup_bytes_types_shortening_newCodeGen.sol index a99b82a08551..b26ba5640c9a 100644 --- a/test/libsolidity/semanticTests/cleanup/cleanup_bytes_types_shortening_newCodeGen.sol +++ b/test/libsolidity/semanticTests/cleanup/cleanup_bytes_types_shortening_newCodeGen.sol @@ -8,7 +8,6 @@ contract C { } } // ==== -// compileToEwasm: also // compileViaYul: true // ---- // f() -> 0xffff000000000000000000000000000000000000000000000000000000000000 diff --git a/test/libsolidity/semanticTests/cleanup/cleanup_bytes_types_v2.sol b/test/libsolidity/semanticTests/cleanup/cleanup_bytes_types_v2.sol index f481ffed6b54..8a95f10c0911 100644 --- a/test/libsolidity/semanticTests/cleanup/cleanup_bytes_types_v2.sol +++ b/test/libsolidity/semanticTests/cleanup/cleanup_bytes_types_v2.sol @@ -10,7 +10,5 @@ contract C { return 0; } } -// ==== -// compileToEwasm: also // ---- // f(bytes2,uint16): "abc", 0x40102 -> FAILURE # We input longer data on purpose. # diff --git a/test/libsolidity/semanticTests/cleanup/cleanup_in_compound_assign.sol b/test/libsolidity/semanticTests/cleanup/cleanup_in_compound_assign.sol index 51815f5e9681..e0e62971cf89 100644 --- a/test/libsolidity/semanticTests/cleanup/cleanup_in_compound_assign.sol +++ b/test/libsolidity/semanticTests/cleanup/cleanup_in_compound_assign.sol @@ -8,7 +8,5 @@ contract C { return (x, y); } } -// ==== -// compileToEwasm: also // ---- // test() -> 0xff, 0xff diff --git a/test/libsolidity/semanticTests/cleanup/exp_cleanup.sol b/test/libsolidity/semanticTests/cleanup/exp_cleanup.sol index a5145bcebdaa..746f21ef5136 100644 --- a/test/libsolidity/semanticTests/cleanup/exp_cleanup.sol +++ b/test/libsolidity/semanticTests/cleanup/exp_cleanup.sol @@ -6,8 +6,5 @@ contract C { } } } - -// ==== -// compileToEwasm: also // ---- // f() -> 0x1 diff --git a/test/libsolidity/semanticTests/cleanup/exp_cleanup_direct.sol b/test/libsolidity/semanticTests/cleanup/exp_cleanup_direct.sol index 663716a126c2..62f927b5bb6b 100644 --- a/test/libsolidity/semanticTests/cleanup/exp_cleanup_direct.sol +++ b/test/libsolidity/semanticTests/cleanup/exp_cleanup_direct.sol @@ -5,8 +5,5 @@ contract C { } } } - -// ==== -// compileToEwasm: also // ---- // f() -> 0x1 diff --git a/test/libsolidity/semanticTests/cleanup/exp_cleanup_nonzero_base.sol b/test/libsolidity/semanticTests/cleanup/exp_cleanup_nonzero_base.sol index 12c3afba4754..de55afa9c657 100644 --- a/test/libsolidity/semanticTests/cleanup/exp_cleanup_nonzero_base.sol +++ b/test/libsolidity/semanticTests/cleanup/exp_cleanup_nonzero_base.sol @@ -6,8 +6,5 @@ contract C { } } } - -// ==== -// compileToEwasm: also // ---- // f() -> 0x1 diff --git a/test/libsolidity/semanticTests/cleanup/exp_cleanup_smaller_base.sol b/test/libsolidity/semanticTests/cleanup/exp_cleanup_smaller_base.sol index b282948cb0ce..7b81d0a1c57e 100644 --- a/test/libsolidity/semanticTests/cleanup/exp_cleanup_smaller_base.sol +++ b/test/libsolidity/semanticTests/cleanup/exp_cleanup_smaller_base.sol @@ -9,7 +9,5 @@ contract C { } } } -// ==== -// compileToEwasm: also // ---- // f() -> 0x00 diff --git a/test/libsolidity/semanticTests/constantEvaluator/negative_fractional_mod.sol b/test/libsolidity/semanticTests/constantEvaluator/negative_fractional_mod.sol index 0385a4c3089e..4426f0c0c5bf 100644 --- a/test/libsolidity/semanticTests/constantEvaluator/negative_fractional_mod.sol +++ b/test/libsolidity/semanticTests/constantEvaluator/negative_fractional_mod.sol @@ -5,7 +5,5 @@ contract C { return (x, (-(-t % 3)) * 5); } } -// ==== -// compileToEwasm: also // ---- // f() -> 11, 10 diff --git a/test/libsolidity/semanticTests/constantEvaluator/rounding.sol b/test/libsolidity/semanticTests/constantEvaluator/rounding.sol index a7c1b4b45221..837e87dc8726 100644 --- a/test/libsolidity/semanticTests/constantEvaluator/rounding.sol +++ b/test/libsolidity/semanticTests/constantEvaluator/rounding.sol @@ -9,7 +9,5 @@ contract C { return (x.length, c, y.length, -d); } } -// ==== -// compileToEwasm: also // ---- // f() -> 2, 2, 2, 2 diff --git a/test/libsolidity/semanticTests/constants/asm_address_constant_regression.sol b/test/libsolidity/semanticTests/constants/asm_address_constant_regression.sol index 3da3ff646c1d..ae405d8f366f 100644 --- a/test/libsolidity/semanticTests/constants/asm_address_constant_regression.sol +++ b/test/libsolidity/semanticTests/constants/asm_address_constant_regression.sol @@ -7,8 +7,5 @@ contract C { assembly { z := e } } } - -// ==== -// compileToEwasm: also // ---- // f() -> 0x00 diff --git a/test/libsolidity/semanticTests/constants/asm_constant_file_level.sol b/test/libsolidity/semanticTests/constants/asm_constant_file_level.sol index 89d2e250d4d1..4f907646357c 100644 --- a/test/libsolidity/semanticTests/constants/asm_constant_file_level.sol +++ b/test/libsolidity/semanticTests/constants/asm_constant_file_level.sol @@ -5,7 +5,5 @@ contract C { assembly { z := e } } } -// ==== -// compileToEwasm: also // ---- // f() -> 0x1212121212121212121212121000002134593163 diff --git a/test/libsolidity/semanticTests/constants/constant_string.sol b/test/libsolidity/semanticTests/constants/constant_string.sol index 638b24382281..3b53102baaad 100644 --- a/test/libsolidity/semanticTests/constants/constant_string.sol +++ b/test/libsolidity/semanticTests/constants/constant_string.sol @@ -15,9 +15,6 @@ contract C { return bytes(c); } } - -// ==== -// compileToEwasm: also // ---- // f() -> 0x20, 3, "\x03\x01\x02" // g() -> 0x20, 3, "\x03\x01\x02" diff --git a/test/libsolidity/semanticTests/constants/constant_string_at_file_level.sol b/test/libsolidity/semanticTests/constants/constant_string_at_file_level.sol index a8822176da4c..0ff332c4f51d 100644 --- a/test/libsolidity/semanticTests/constants/constant_string_at_file_level.sol +++ b/test/libsolidity/semanticTests/constants/constant_string_at_file_level.sol @@ -23,9 +23,6 @@ contract C { return (x, choices, st); } } - -// ==== -// compileToEwasm: also // ---- // f() -> 0x20, 3, "\x03\x01\x02" // g() -> 0x20, 3, "\x03\x01\x02" diff --git a/test/libsolidity/semanticTests/constants/constant_variables.sol b/test/libsolidity/semanticTests/constants/constant_variables.sol index 4ae4edb976b3..2ecd6e76a6f6 100644 --- a/test/libsolidity/semanticTests/constants/constant_variables.sol +++ b/test/libsolidity/semanticTests/constants/constant_variables.sol @@ -4,8 +4,5 @@ contract Foo { ActionChoices constant choices = ActionChoices.GoLeft; bytes32 constant st = "abc\x00\xff__"; } - -// ==== -// compileToEwasm: also // ---- // constructor() -> diff --git a/test/libsolidity/semanticTests/constants/constants_at_file_level_referencing.sol b/test/libsolidity/semanticTests/constants/constants_at_file_level_referencing.sol index a1ae3911fc82..764ffc245034 100644 --- a/test/libsolidity/semanticTests/constants/constants_at_file_level_referencing.sol +++ b/test/libsolidity/semanticTests/constants/constants_at_file_level_referencing.sol @@ -31,9 +31,6 @@ contract C { return fre(); } } - -// ==== -// compileToEwasm: also // ---- // f() -> 0x20, 3, "\x03\x01\x02" // g() -> 0x20, 3, "\x03\x01\x02" diff --git a/test/libsolidity/semanticTests/constants/consteval_array_length.sol b/test/libsolidity/semanticTests/constants/consteval_array_length.sol index bdf95a9b9efa..91e929834df4 100644 --- a/test/libsolidity/semanticTests/constants/consteval_array_length.sol +++ b/test/libsolidity/semanticTests/constants/consteval_array_length.sol @@ -8,7 +8,6 @@ contract C { } } // ==== -// compileToEwasm: also // compileViaYul: true // ---- // constructor() -> diff --git a/test/libsolidity/semanticTests/constants/function_unreferenced.sol b/test/libsolidity/semanticTests/constants/function_unreferenced.sol index 2b80c440fcac..d7578fecea4d 100644 --- a/test/libsolidity/semanticTests/constants/function_unreferenced.sol +++ b/test/libsolidity/semanticTests/constants/function_unreferenced.sol @@ -5,7 +5,5 @@ contract C is B { bytes4 constant s2 = B.g.selector; function f() external pure returns (bytes4) { return s2; } } -// ==== -// compileToEwasm: also // ---- // f() -> 0xe2179b8e00000000000000000000000000000000000000000000000000000000 diff --git a/test/libsolidity/semanticTests/constants/same_constants_different_files.sol b/test/libsolidity/semanticTests/constants/same_constants_different_files.sol index 5a85c5fd7740..3a819befb824 100644 --- a/test/libsolidity/semanticTests/constants/same_constants_different_files.sol +++ b/test/libsolidity/semanticTests/constants/same_constants_different_files.sol @@ -19,8 +19,5 @@ contract C { return (a, fre(), M.a, b); } } - -// ==== -// compileToEwasm: also // ---- // f() -> 0x0d, 0x59, 0x59, 0x59 diff --git a/test/libsolidity/semanticTests/constants/simple_constant_variables_test.sol b/test/libsolidity/semanticTests/constants/simple_constant_variables_test.sol index ea35262ef414..ed0e919fcd57 100644 --- a/test/libsolidity/semanticTests/constants/simple_constant_variables_test.sol +++ b/test/libsolidity/semanticTests/constants/simple_constant_variables_test.sol @@ -5,8 +5,5 @@ contract Foo { uint256 constant x = 56; } - -// ==== -// compileToEwasm: also // ---- // getX() -> 56 diff --git a/test/libsolidity/semanticTests/constructor/base_constructor_arguments.sol b/test/libsolidity/semanticTests/constructor/base_constructor_arguments.sol index d6d76adc5b18..55daf6d3d547 100644 --- a/test/libsolidity/semanticTests/constructor/base_constructor_arguments.sol +++ b/test/libsolidity/semanticTests/constructor/base_constructor_arguments.sol @@ -19,6 +19,5 @@ contract Derived is Base { return m_a; } } - // ---- // getA() -> 49 diff --git a/test/libsolidity/semanticTests/constructor/constructor_arguments_internal.sol b/test/libsolidity/semanticTests/constructor/constructor_arguments_internal.sol index bb7e7e596aa1..bf3f0c0c9b74 100644 --- a/test/libsolidity/semanticTests/constructor/constructor_arguments_internal.sol +++ b/test/libsolidity/semanticTests/constructor/constructor_arguments_internal.sol @@ -32,7 +32,6 @@ contract Main { return h.getName(); } } - // ---- // getFlag() -> true // getName() -> "abc" diff --git a/test/libsolidity/semanticTests/constructor/constructor_static_array_argument.sol b/test/libsolidity/semanticTests/constructor/constructor_static_array_argument.sol index b6242379e75b..dd91c86a2031 100644 --- a/test/libsolidity/semanticTests/constructor/constructor_static_array_argument.sol +++ b/test/libsolidity/semanticTests/constructor/constructor_static_array_argument.sol @@ -7,7 +7,6 @@ contract C { b = _b; } } - // ---- // constructor(): 1, 2, 3, 4 -> // gas irOptimized: 172314 diff --git a/test/libsolidity/semanticTests/constructor/evm_exceptions_in_constructor_call_fail.sol b/test/libsolidity/semanticTests/constructor/evm_exceptions_in_constructor_call_fail.sol index 92633cdda968..43d1fdab848f 100644 --- a/test/libsolidity/semanticTests/constructor/evm_exceptions_in_constructor_call_fail.sol +++ b/test/libsolidity/semanticTests/constructor/evm_exceptions_in_constructor_call_fail.sol @@ -13,7 +13,6 @@ contract B { ++test; } } - // ---- // testIt() -> // test() -> 2 diff --git a/test/libsolidity/semanticTests/constructor/function_usage_in_constructor_arguments.sol b/test/libsolidity/semanticTests/constructor/function_usage_in_constructor_arguments.sol index 0c0b6e3144c6..c04f039188c4 100644 --- a/test/libsolidity/semanticTests/constructor/function_usage_in_constructor_arguments.sol +++ b/test/libsolidity/semanticTests/constructor/function_usage_in_constructor_arguments.sol @@ -19,6 +19,5 @@ contract Derived is Base { return m_a; } } - // ---- // getA() -> 2 diff --git a/test/libsolidity/semanticTests/constructor/functions_called_by_constructor.sol b/test/libsolidity/semanticTests/constructor/functions_called_by_constructor.sol index 397c314a9ff6..b968a07a161d 100644 --- a/test/libsolidity/semanticTests/constructor/functions_called_by_constructor.sol +++ b/test/libsolidity/semanticTests/constructor/functions_called_by_constructor.sol @@ -14,8 +14,5 @@ contract Test { name = _name; } } - -// ==== -// compileToEwasm: also // ---- // getName() -> "abc" diff --git a/test/libsolidity/semanticTests/constructor/functions_called_by_constructor_through_dispatch.sol b/test/libsolidity/semanticTests/constructor/functions_called_by_constructor_through_dispatch.sol index 763393a998ba..0a1250a8ba62 100644 --- a/test/libsolidity/semanticTests/constructor/functions_called_by_constructor_through_dispatch.sol +++ b/test/libsolidity/semanticTests/constructor/functions_called_by_constructor_through_dispatch.sol @@ -24,8 +24,5 @@ contract Test { name = _shiftOperator(name, _bytes); } } - -// ==== -// compileToEwasm: also // ---- // getName() -> "def\x00\x00\x00" diff --git a/test/libsolidity/semanticTests/constructor/inline_member_init_inheritence_without_constructor.sol b/test/libsolidity/semanticTests/constructor/inline_member_init_inheritence_without_constructor.sol index 6e1f46f86445..320349cda9ed 100644 --- a/test/libsolidity/semanticTests/constructor/inline_member_init_inheritence_without_constructor.sol +++ b/test/libsolidity/semanticTests/constructor/inline_member_init_inheritence_without_constructor.sol @@ -14,8 +14,6 @@ contract Derived is Base { return m_derived; } } -// ==== -// compileToEwasm: also // ---- // getBMember() -> 5 // getDMember() -> 6 diff --git a/test/libsolidity/semanticTests/constructor/payable_constructor.sol b/test/libsolidity/semanticTests/constructor/payable_constructor.sol index 0f19eb7e2664..09fe0a1cc32d 100644 --- a/test/libsolidity/semanticTests/constructor/payable_constructor.sol +++ b/test/libsolidity/semanticTests/constructor/payable_constructor.sol @@ -1,8 +1,5 @@ contract C { constructor() payable {} } - -// ==== -// compileToEwasm: also // ---- // constructor(), 27 wei -> diff --git a/test/libsolidity/semanticTests/constructor/store_function_in_constructor.sol b/test/libsolidity/semanticTests/constructor/store_function_in_constructor.sol index 7f0514041e6b..dee3af35415f 100644 --- a/test/libsolidity/semanticTests/constructor/store_function_in_constructor.sol +++ b/test/libsolidity/semanticTests/constructor/store_function_in_constructor.sol @@ -15,9 +15,6 @@ contract C { return x(_arg); } } - -// ==== -// compileToEwasm: also // ---- // use(uint256): 3 -> 6 // result_in_constructor() -> 4 diff --git a/test/libsolidity/semanticTests/constructor/store_function_in_constructor_packed.sol b/test/libsolidity/semanticTests/constructor/store_function_in_constructor_packed.sol index 7fef18a1568b..07b12ad96cb7 100644 --- a/test/libsolidity/semanticTests/constructor/store_function_in_constructor_packed.sol +++ b/test/libsolidity/semanticTests/constructor/store_function_in_constructor_packed.sol @@ -16,9 +16,6 @@ contract C { return x(_arg); } } - -// ==== -// compileToEwasm: also // ---- // use(uint16): 3 -> 0xfff9 // result_in_constructor() -> 0xfffb diff --git a/test/libsolidity/semanticTests/constructor/store_internal_unused_function_in_constructor.sol b/test/libsolidity/semanticTests/constructor/store_internal_unused_function_in_constructor.sol index 6721329a12a1..cc9d8ca6a134 100644 --- a/test/libsolidity/semanticTests/constructor/store_internal_unused_function_in_constructor.sol +++ b/test/libsolidity/semanticTests/constructor/store_internal_unused_function_in_constructor.sol @@ -13,8 +13,5 @@ contract C { return x(); } } - -// ==== -// compileToEwasm: also // ---- // t() -> 7 diff --git a/test/libsolidity/semanticTests/constructor/store_internal_unused_library_function_in_constructor.sol b/test/libsolidity/semanticTests/constructor/store_internal_unused_library_function_in_constructor.sol index 7b166489fb8c..5845e9b56e15 100644 --- a/test/libsolidity/semanticTests/constructor/store_internal_unused_library_function_in_constructor.sol +++ b/test/libsolidity/semanticTests/constructor/store_internal_unused_library_function_in_constructor.sol @@ -16,6 +16,5 @@ contract C { return x(); } } - // ---- // t() -> 7 diff --git a/test/libsolidity/semanticTests/constructor_inheritance_init_order.sol b/test/libsolidity/semanticTests/constructor_inheritance_init_order.sol index 6b1b6704afa3..00dfef4abc99 100644 --- a/test/libsolidity/semanticTests/constructor_inheritance_init_order.sol +++ b/test/libsolidity/semanticTests/constructor_inheritance_init_order.sol @@ -11,7 +11,6 @@ contract B is A { uint public y = f(); } // ==== -// compileToEwasm: also // compileViaYul: true // ---- // constructor() -> diff --git a/test/libsolidity/semanticTests/constructor_inheritance_init_order_2.sol b/test/libsolidity/semanticTests/constructor_inheritance_init_order_2.sol index b60564665ded..9b982d6e9930 100644 --- a/test/libsolidity/semanticTests/constructor_inheritance_init_order_2.sol +++ b/test/libsolidity/semanticTests/constructor_inheritance_init_order_2.sol @@ -7,8 +7,6 @@ contract A { contract B is A { uint public y = f(); } -// ==== -// compileToEwasm: also // ---- // constructor() -> // gas irOptimized: 120936 diff --git a/test/libsolidity/semanticTests/deployedCodeExclusion/subassembly_deduplication.sol b/test/libsolidity/semanticTests/deployedCodeExclusion/subassembly_deduplication.sol index 2b2d694bd17a..b6ae85b838d8 100644 --- a/test/libsolidity/semanticTests/deployedCodeExclusion/subassembly_deduplication.sol +++ b/test/libsolidity/semanticTests/deployedCodeExclusion/subassembly_deduplication.sol @@ -37,6 +37,5 @@ contract C { x < 2 * type(A).creationCode.length; } } - // ---- // test() -> true diff --git a/test/libsolidity/semanticTests/dirty_calldata_bytes.sol b/test/libsolidity/semanticTests/dirty_calldata_bytes.sol index 48dc5ee2f1ad..5876b1f7c65c 100644 --- a/test/libsolidity/semanticTests/dirty_calldata_bytes.sol +++ b/test/libsolidity/semanticTests/dirty_calldata_bytes.sol @@ -8,7 +8,5 @@ contract C { correct = r == (0x64 << 248); } } -// ==== -// compileToEwasm: also // ---- // f(bytes): 0x20, 0x04, "dead" -> true diff --git a/test/libsolidity/semanticTests/empty_contract.sol b/test/libsolidity/semanticTests/empty_contract.sol index 511b72469240..7c1ae2846ea8 100644 --- a/test/libsolidity/semanticTests/empty_contract.sol +++ b/test/libsolidity/semanticTests/empty_contract.sol @@ -2,6 +2,5 @@ contract test { } // ==== // allowNonExistingFunctions: true -// compileToEwasm: also // ---- // i_am_not_there() -> FAILURE diff --git a/test/libsolidity/semanticTests/empty_for_loop.sol b/test/libsolidity/semanticTests/empty_for_loop.sol index d4ba09f1395e..450134b63901 100644 --- a/test/libsolidity/semanticTests/empty_for_loop.sol +++ b/test/libsolidity/semanticTests/empty_for_loop.sol @@ -7,7 +7,5 @@ contract test { } } } -// ==== -// compileToEwasm: also // ---- // f() -> 10 diff --git a/test/libsolidity/semanticTests/enums/constructing_enums_from_ints.sol b/test/libsolidity/semanticTests/enums/constructing_enums_from_ints.sol index ddf1a66fa1e4..beabc514315b 100644 --- a/test/libsolidity/semanticTests/enums/constructing_enums_from_ints.sol +++ b/test/libsolidity/semanticTests/enums/constructing_enums_from_ints.sol @@ -5,8 +5,5 @@ contract c { return uint256(Truth(uint8(0x1))); } } - -// ==== -// compileToEwasm: also // ---- // test() -> 1 diff --git a/test/libsolidity/semanticTests/enums/enum_explicit_overflow.sol b/test/libsolidity/semanticTests/enums/enum_explicit_overflow.sol index a538946ad582..b952524b2a22 100644 --- a/test/libsolidity/semanticTests/enums/enum_explicit_overflow.sol +++ b/test/libsolidity/semanticTests/enums/enum_explicit_overflow.sol @@ -20,9 +20,7 @@ contract test { ActionChoices choice; } - // ==== -// compileToEwasm: also // EVMVersion: >=byzantium // ---- // getChoiceExp(uint256): 2 -> 2 diff --git a/test/libsolidity/semanticTests/enums/enum_explicit_overflow_homestead.sol b/test/libsolidity/semanticTests/enums/enum_explicit_overflow_homestead.sol index 9b783b404196..60a1d64d3e34 100644 --- a/test/libsolidity/semanticTests/enums/enum_explicit_overflow_homestead.sol +++ b/test/libsolidity/semanticTests/enums/enum_explicit_overflow_homestead.sol @@ -20,7 +20,6 @@ contract test { ActionChoices choice; } - // ==== // EVMVersion: 3 diff --git a/test/libsolidity/semanticTests/enums/minmax.sol b/test/libsolidity/semanticTests/enums/minmax.sol index 4b929c36cf58..a447f64338e4 100644 --- a/test/libsolidity/semanticTests/enums/minmax.sol +++ b/test/libsolidity/semanticTests/enums/minmax.sol @@ -4,7 +4,6 @@ contract test { function min() public returns(uint) { return uint(type(MinMax).min); } function max() public returns(uint) { return uint(type(MinMax).max); } } - // ---- // min() -> 0 // max() -> 3 diff --git a/test/libsolidity/semanticTests/enums/using_contract_enums_with_explicit_contract_name.sol b/test/libsolidity/semanticTests/enums/using_contract_enums_with_explicit_contract_name.sol index cda5d06ac371..a3bce93accae 100644 --- a/test/libsolidity/semanticTests/enums/using_contract_enums_with_explicit_contract_name.sol +++ b/test/libsolidity/semanticTests/enums/using_contract_enums_with_explicit_contract_name.sol @@ -5,8 +5,5 @@ contract test { _ret = test.Choice.B; } } - -// ==== -// compileToEwasm: also // ---- // answer() -> 1 diff --git a/test/libsolidity/semanticTests/enums/using_enums.sol b/test/libsolidity/semanticTests/enums/using_enums.sol index ec014160aae6..b4d0ce8e367f 100644 --- a/test/libsolidity/semanticTests/enums/using_enums.sol +++ b/test/libsolidity/semanticTests/enums/using_enums.sol @@ -11,8 +11,5 @@ contract test { ActionChoices choices; } - -// ==== -// compileToEwasm: also // ---- // getChoice() -> 2 diff --git a/test/libsolidity/semanticTests/enums/using_inherited_enum.sol b/test/libsolidity/semanticTests/enums/using_inherited_enum.sol index 8d65aeac8e8c..9741568baaf3 100644 --- a/test/libsolidity/semanticTests/enums/using_inherited_enum.sol +++ b/test/libsolidity/semanticTests/enums/using_inherited_enum.sol @@ -8,7 +8,5 @@ contract test is base { _ret = Choice.B; } } -// ==== -// compileToEwasm: also // ---- // answer() -> 1 diff --git a/test/libsolidity/semanticTests/enums/using_inherited_enum_excplicitly.sol b/test/libsolidity/semanticTests/enums/using_inherited_enum_excplicitly.sol index cac059774c1d..eb1d63a2fd6f 100644 --- a/test/libsolidity/semanticTests/enums/using_inherited_enum_excplicitly.sol +++ b/test/libsolidity/semanticTests/enums/using_inherited_enum_excplicitly.sol @@ -8,7 +8,5 @@ contract test is base { _ret = base.Choice.B; } } -// ==== -// compileToEwasm: also // ---- // answer() -> 1 diff --git a/test/libsolidity/semanticTests/errors/named_error_args.sol b/test/libsolidity/semanticTests/errors/named_error_args.sol index 28df2c4ccb9b..04697f52192b 100644 --- a/test/libsolidity/semanticTests/errors/named_error_args.sol +++ b/test/libsolidity/semanticTests/errors/named_error_args.sol @@ -4,7 +4,5 @@ contract C { revert E({b: 7, a: 2}); } } -// ==== -// compileToEwasm: also // ---- // f() -> FAILURE, hex"85208890", hex"0000000000000000000000000000000000000000000000000000000000000002", hex"0000000000000000000000000000000000000000000000000000000000000007" diff --git a/test/libsolidity/semanticTests/errors/named_parameters_shadowing_types.sol b/test/libsolidity/semanticTests/errors/named_parameters_shadowing_types.sol index a0d43c274fd8..2f2b7c676b9b 100644 --- a/test/libsolidity/semanticTests/errors/named_parameters_shadowing_types.sol +++ b/test/libsolidity/semanticTests/errors/named_parameters_shadowing_types.sol @@ -18,8 +18,6 @@ contract C { revert E2({EnumType: StructType(42), StructType: EnumType.B}); } } -// ==== -// compileToEwasm: also // ---- // f() -> FAILURE, hex"33a54193", hex"000000000000000000000000000000000000000000000000000000000000002a" // g() -> FAILURE, hex"374b9387", hex"0000000000000000000000000000000000000000000000000000000000000001", hex"000000000000000000000000000000000000000000000000000000000000002a" diff --git a/test/libsolidity/semanticTests/errors/panic_via_import.sol b/test/libsolidity/semanticTests/errors/panic_via_import.sol index b763164c9a48..94a6a7aaaf68 100644 --- a/test/libsolidity/semanticTests/errors/panic_via_import.sol +++ b/test/libsolidity/semanticTests/errors/panic_via_import.sol @@ -11,8 +11,6 @@ contract C { revert E(1); } } -// ==== -// compileToEwasm: also // ---- // a() -> FAILURE, hex"002ff067", hex"0000000000000000000000000000000000000000000000000000000000000001" // b() -> FAILURE, hex"002ff067", hex"0000000000000000000000000000000000000000000000000000000000000001" diff --git a/test/libsolidity/semanticTests/errors/simple.sol b/test/libsolidity/semanticTests/errors/simple.sol index b8a8e0d609dd..809b10c57d0a 100644 --- a/test/libsolidity/semanticTests/errors/simple.sol +++ b/test/libsolidity/semanticTests/errors/simple.sol @@ -4,7 +4,5 @@ contract C { revert E(2, 7); } } -// ==== -// compileToEwasm: also // ---- // f() -> FAILURE, hex"85208890", 2, 7 diff --git a/test/libsolidity/semanticTests/errors/using_structs.sol b/test/libsolidity/semanticTests/errors/using_structs.sol index 47979a9552d7..e04e4b1c7a49 100644 --- a/test/libsolidity/semanticTests/errors/using_structs.sol +++ b/test/libsolidity/semanticTests/errors/using_structs.sol @@ -13,8 +13,6 @@ contract C { } } } -// ==== -// compileToEwasm: also // ---- // f(bool): true -> FAILURE, hex"e96e07f0", hex"0000000000000000000000000000000000000000000000000000000000000002", hex"0000000000000000000000000000000000000000000000000000000000000060", hex"0000000000000000000000000000000000000000000000000000000000000007", hex"0000000000000000000000000000000000000000000000000000000000000009", hex"0000000000000000000000000000000000000000000000000000000000000040", hex"0000000000000000000000000000000000000000000000000000000000000003", hex"6162630000000000000000000000000000000000000000000000000000000000" // f(bool): false -> FAILURE, hex"e96e07f0", hex"0000000000000000000000000000000000000000000000000000000000000002", hex"0000000000000000000000000000000000000000000000000000000000000060", hex"0000000000000000000000000000000000000000000000000000000000000007", hex"0000000000000000000000000000000000000000000000000000000000000009", hex"0000000000000000000000000000000000000000000000000000000000000040", hex"0000000000000000000000000000000000000000000000000000000000000003", hex"6162630000000000000000000000000000000000000000000000000000000000" diff --git a/test/libsolidity/semanticTests/errors/via_contract_type.sol b/test/libsolidity/semanticTests/errors/via_contract_type.sol index f0ea6ca3c8f8..09f60e6530d2 100644 --- a/test/libsolidity/semanticTests/errors/via_contract_type.sol +++ b/test/libsolidity/semanticTests/errors/via_contract_type.sol @@ -10,8 +10,6 @@ contract B is A { function h() public pure { revert X.E("abc"); } } -// ==== -// compileToEwasm: also // ---- // f() -> FAILURE, hex"002ff067", hex"0000000000000000000000000000000000000000000000000000000000000001" // g() -> FAILURE, hex"002ff067", hex"0000000000000000000000000000000000000000000000000000000000000001" diff --git a/test/libsolidity/semanticTests/errors/via_import.sol b/test/libsolidity/semanticTests/errors/via_import.sol index 6a6d3399edc8..eb54e5b4d71b 100644 --- a/test/libsolidity/semanticTests/errors/via_import.sol +++ b/test/libsolidity/semanticTests/errors/via_import.sol @@ -17,8 +17,6 @@ contract C { revert T.S.E(3); } } -// ==== -// compileToEwasm: also // ---- // x() -> FAILURE, hex"002ff067", hex"0000000000000000000000000000000000000000000000000000000000000001" // y() -> FAILURE, hex"002ff067", hex"0000000000000000000000000000000000000000000000000000000000000002" diff --git a/test/libsolidity/semanticTests/errors/weird_name.sol b/test/libsolidity/semanticTests/errors/weird_name.sol index d3d7545496f6..2466d6e20346 100644 --- a/test/libsolidity/semanticTests/errors/weird_name.sol +++ b/test/libsolidity/semanticTests/errors/weird_name.sol @@ -4,7 +4,5 @@ contract C { revert error(2); } } -// ==== -// compileToEwasm: also // ---- // f() -> FAILURE, hex"b48fb6cf", hex"0000000000000000000000000000000000000000000000000000000000000002" diff --git a/test/libsolidity/semanticTests/events/event_selector.sol b/test/libsolidity/semanticTests/events/event_selector.sol index 116e2329e649..b42ba490838b 100644 --- a/test/libsolidity/semanticTests/events/event_selector.sol +++ b/test/libsolidity/semanticTests/events/event_selector.sol @@ -1,32 +1,49 @@ library L { event E(); } + library S { event E(uint); } + library T { event E(); } +interface I { + event E(); +} + +contract B { + event E(); +} + contract D { event F(); } contract C is D { - function test1() external pure returns (bytes32, bytes32) { + function test1() external pure returns (bytes32, bytes32, bytes32, bytes32) { assert(L.E.selector == T.E.selector); + assert(I.E.selector == L.E.selector); + assert(T.E.selector == I.E.selector); + assert(B.E.selector == T.E.selector); assert(L.E.selector != S.E.selector); assert(T.E.selector != S.E.selector); + assert(I.E.selector != S.E.selector); + assert(B.E.selector != S.E.selector); - return (L.E.selector, S.E.selector); + return (L.E.selector, S.E.selector, I.E.selector, B.E.selector); } bytes32 s1 = L.E.selector; bytes32 s2 = S.E.selector; bytes32 s3 = T.E.selector; - function test2() external returns (bytes32, bytes32, bytes32) { - return (s1, s2, s3); + bytes32 s4 = I.E.selector; + bytes32 s5 = B.E.selector; + function test2() external returns (bytes32, bytes32, bytes32, bytes32, bytes32) { + return (s1, s2, s3, s4, s5); } function test3() external returns (bytes32) { @@ -36,6 +53,6 @@ contract C is D { // ==== // compileViaYul: also // ---- -// test1() -> 0x92bbf6e823a631f3c8e09b1c8df90f378fb56f7fbc9701827e1ff8aad7f6a028, 0x2ff0672f372fbe844b353429d4510ea5e43683af134c54f75f789ff57bc0c0 -// test2() -> 0x92bbf6e823a631f3c8e09b1c8df90f378fb56f7fbc9701827e1ff8aad7f6a028, 0x2ff0672f372fbe844b353429d4510ea5e43683af134c54f75f789ff57bc0c0, 0x92bbf6e823a631f3c8e09b1c8df90f378fb56f7fbc9701827e1ff8aad7f6a028 +// test1() -> 0x92bbf6e823a631f3c8e09b1c8df90f378fb56f7fbc9701827e1ff8aad7f6a028, 0x2ff0672f372fbe844b353429d4510ea5e43683af134c54f75f789ff57bc0c0, 0x92bbf6e823a631f3c8e09b1c8df90f378fb56f7fbc9701827e1ff8aad7f6a028, 0x92bbf6e823a631f3c8e09b1c8df90f378fb56f7fbc9701827e1ff8aad7f6a028 +// test2() -> 0x92bbf6e823a631f3c8e09b1c8df90f378fb56f7fbc9701827e1ff8aad7f6a028, 0x2ff0672f372fbe844b353429d4510ea5e43683af134c54f75f789ff57bc0c0, 0x92bbf6e823a631f3c8e09b1c8df90f378fb56f7fbc9701827e1ff8aad7f6a028, 0x92bbf6e823a631f3c8e09b1c8df90f378fb56f7fbc9701827e1ff8aad7f6a028, 0x92bbf6e823a631f3c8e09b1c8df90f378fb56f7fbc9701827e1ff8aad7f6a028 // test3() -> 0x28811f5935c16a099486acb976b3a6b4942950a1425a74e9eb3e9b7f7135e12a diff --git a/test/libsolidity/semanticTests/exponentiation/literal_base.sol b/test/libsolidity/semanticTests/exponentiation/literal_base.sol index f00999c97177..3dcba494abc0 100644 --- a/test/libsolidity/semanticTests/exponentiation/literal_base.sol +++ b/test/libsolidity/semanticTests/exponentiation/literal_base.sol @@ -7,8 +7,6 @@ contract test { } } } -// ==== -// compileToEwasm: also // ---- // f(uint256): 0 -> 1, 1 // f(uint256): 1 -> 2, -2 diff --git a/test/libsolidity/semanticTests/exponentiation/signed_base.sol b/test/libsolidity/semanticTests/exponentiation/signed_base.sol index 105a8ef5f723..f58c081293e6 100644 --- a/test/libsolidity/semanticTests/exponentiation/signed_base.sol +++ b/test/libsolidity/semanticTests/exponentiation/signed_base.sol @@ -10,7 +10,5 @@ contract test { return (x**y1, x**y2); } } -// ==== -// compileToEwasm: also // ---- // f() -> 9, -27 diff --git a/test/libsolidity/semanticTests/exponentiation/small_exp.sol b/test/libsolidity/semanticTests/exponentiation/small_exp.sol index 945b65c9df1c..a26675fb7f31 100644 --- a/test/libsolidity/semanticTests/exponentiation/small_exp.sol +++ b/test/libsolidity/semanticTests/exponentiation/small_exp.sol @@ -10,7 +10,5 @@ contract test { return r; } } -// ==== -// compileToEwasm: also // ---- // f() -> 4 diff --git a/test/libsolidity/semanticTests/expressions/bit_operators.sol b/test/libsolidity/semanticTests/expressions/bit_operators.sol index 733951e2c088..35887059c99e 100644 --- a/test/libsolidity/semanticTests/expressions/bit_operators.sol +++ b/test/libsolidity/semanticTests/expressions/bit_operators.sol @@ -13,7 +13,5 @@ contract test { z = a ^ b; } } -// ==== -// compileToEwasm: also // ---- // f() -> 3855, 268374015, 268370160 diff --git a/test/libsolidity/semanticTests/expressions/bytes_comparison.sol b/test/libsolidity/semanticTests/expressions/bytes_comparison.sol index 634486d915ef..b1220c510ce7 100644 --- a/test/libsolidity/semanticTests/expressions/bytes_comparison.sol +++ b/test/libsolidity/semanticTests/expressions/bytes_comparison.sol @@ -6,7 +6,5 @@ contract test { return a < x && x < b; } } -// ==== -// compileToEwasm: also // ---- // f() -> true diff --git a/test/libsolidity/semanticTests/expressions/conditional_expression_different_types.sol b/test/libsolidity/semanticTests/expressions/conditional_expression_different_types.sol index 66eb86d50523..df07364b368d 100644 --- a/test/libsolidity/semanticTests/expressions/conditional_expression_different_types.sol +++ b/test/libsolidity/semanticTests/expressions/conditional_expression_different_types.sol @@ -5,8 +5,6 @@ contract test { return cond ? x : y; } } -// ==== -// compileToEwasm: also // ---- // f(bool): true -> 0xcd // f(bool): false -> 0xabab diff --git a/test/libsolidity/semanticTests/expressions/conditional_expression_false_literal.sol b/test/libsolidity/semanticTests/expressions/conditional_expression_false_literal.sol index f8c3abf2dd9c..3915c7b8dc61 100644 --- a/test/libsolidity/semanticTests/expressions/conditional_expression_false_literal.sol +++ b/test/libsolidity/semanticTests/expressions/conditional_expression_false_literal.sol @@ -3,7 +3,5 @@ contract test { return false ? 5 : 10; } } -// ==== -// compileToEwasm: also // ---- // f() -> 10 diff --git a/test/libsolidity/semanticTests/expressions/conditional_expression_functions.sol b/test/libsolidity/semanticTests/expressions/conditional_expression_functions.sol index 5abc4e1e3371..bff9122b1ea1 100644 --- a/test/libsolidity/semanticTests/expressions/conditional_expression_functions.sol +++ b/test/libsolidity/semanticTests/expressions/conditional_expression_functions.sol @@ -7,8 +7,6 @@ contract test { return z(); } } -// ==== -// compileToEwasm: also // ---- // f(bool): true -> 1 // f(bool): false -> 2 diff --git a/test/libsolidity/semanticTests/expressions/conditional_expression_multiple.sol b/test/libsolidity/semanticTests/expressions/conditional_expression_multiple.sol index c51172b0d86b..2a9d6de8086a 100644 --- a/test/libsolidity/semanticTests/expressions/conditional_expression_multiple.sol +++ b/test/libsolidity/semanticTests/expressions/conditional_expression_multiple.sol @@ -6,8 +6,6 @@ contract test { x > 50 ? 50 : 10; } } -// ==== -// compileToEwasm: also // ---- // f(uint256): 1001 -> 1000 // f(uint256): 500 -> 100 diff --git a/test/libsolidity/semanticTests/expressions/conditional_expression_storage_memory_1.sol b/test/libsolidity/semanticTests/expressions/conditional_expression_storage_memory_1.sol index 40cfc7a9ddb7..3434cca016e8 100644 --- a/test/libsolidity/semanticTests/expressions/conditional_expression_storage_memory_1.sol +++ b/test/libsolidity/semanticTests/expressions/conditional_expression_storage_memory_1.sol @@ -22,8 +22,6 @@ contract test { return ret; } } -// ==== -// compileToEwasm: also // ---- // f(bool): true -> 1 // f(bool): false -> 2 diff --git a/test/libsolidity/semanticTests/expressions/conditional_expression_true_literal.sol b/test/libsolidity/semanticTests/expressions/conditional_expression_true_literal.sol index 968a4a02a80b..06247f0dc535 100644 --- a/test/libsolidity/semanticTests/expressions/conditional_expression_true_literal.sol +++ b/test/libsolidity/semanticTests/expressions/conditional_expression_true_literal.sol @@ -3,7 +3,5 @@ contract test { return true ? 5 : 10; } } -// ==== -// compileToEwasm: also // ---- // f() -> 5 diff --git a/test/libsolidity/semanticTests/expressions/conditional_expression_tuples.sol b/test/libsolidity/semanticTests/expressions/conditional_expression_tuples.sol index a28dd1f06d2a..d27d06bacb79 100644 --- a/test/libsolidity/semanticTests/expressions/conditional_expression_tuples.sol +++ b/test/libsolidity/semanticTests/expressions/conditional_expression_tuples.sol @@ -3,8 +3,6 @@ contract test { return cond ? (1, 2) : (3, 4); } } -// ==== -// compileToEwasm: also // ---- // f(bool): true -> 1, 2 // f(bool): false -> 3, 4 diff --git a/test/libsolidity/semanticTests/expressions/conditional_expression_with_return_values.sol b/test/libsolidity/semanticTests/expressions/conditional_expression_with_return_values.sol index fdf691ae4388..bbaf051bde11 100644 --- a/test/libsolidity/semanticTests/expressions/conditional_expression_with_return_values.sol +++ b/test/libsolidity/semanticTests/expressions/conditional_expression_with_return_values.sol @@ -3,8 +3,6 @@ contract test { cond ? a = v : b = v; } } -// ==== -// compileToEwasm: also // ---- // f(bool,uint256): true, 20 -> 20, 0 // f(bool,uint256): false, 20 -> 0, 20 diff --git a/test/libsolidity/semanticTests/expressions/exp_operator_const.sol b/test/libsolidity/semanticTests/expressions/exp_operator_const.sol index ef71a3d2b0af..e2a7ccc7355e 100644 --- a/test/libsolidity/semanticTests/expressions/exp_operator_const.sol +++ b/test/libsolidity/semanticTests/expressions/exp_operator_const.sol @@ -1,7 +1,5 @@ contract test { function f() public returns(uint d) { return 2 ** 3; } } -// ==== -// compileToEwasm: also // ---- // f() -> 8 diff --git a/test/libsolidity/semanticTests/expressions/exp_operator_const_signed.sol b/test/libsolidity/semanticTests/expressions/exp_operator_const_signed.sol index 4901f5c78f7f..b2dd001b3528 100644 --- a/test/libsolidity/semanticTests/expressions/exp_operator_const_signed.sol +++ b/test/libsolidity/semanticTests/expressions/exp_operator_const_signed.sol @@ -1,7 +1,5 @@ contract test { function f() public returns(int d) { return (-2) ** 3; } } -// ==== -// compileToEwasm: also // ---- // f() -> -8 diff --git a/test/libsolidity/semanticTests/expressions/exp_zero_literal.sol b/test/libsolidity/semanticTests/expressions/exp_zero_literal.sol index 716f72aeebb8..f7e5c6ab8107 100644 --- a/test/libsolidity/semanticTests/expressions/exp_zero_literal.sol +++ b/test/libsolidity/semanticTests/expressions/exp_zero_literal.sol @@ -1,7 +1,5 @@ contract test { function f() public returns(uint d) { return 0 ** 0; } } -// ==== -// compileToEwasm: also // ---- // f() -> 1 diff --git a/test/libsolidity/semanticTests/expressions/inc_dec_operators.sol b/test/libsolidity/semanticTests/expressions/inc_dec_operators.sol index b9eaa648033e..c6957ee9f62a 100644 --- a/test/libsolidity/semanticTests/expressions/inc_dec_operators.sol +++ b/test/libsolidity/semanticTests/expressions/inc_dec_operators.sol @@ -11,7 +11,5 @@ contract test { r += (++v) * 0x10000; } } -// ==== -// compileToEwasm: also // ---- // f() -> 0x053866 diff --git a/test/libsolidity/semanticTests/expressions/module_from_ternary_expression.sol b/test/libsolidity/semanticTests/expressions/module_from_ternary_expression.sol new file mode 100644 index 000000000000..7aa8a5caa886 --- /dev/null +++ b/test/libsolidity/semanticTests/expressions/module_from_ternary_expression.sol @@ -0,0 +1,15 @@ +==== Source: A ==== +contract C { +} +==== Source: B ==== +import "A" as M; + +contract C { + function f() public pure returns (bool) { + bool flag; + ((flag = true) ? M : M).C; + return flag; + } +} +// ---- +// f() -> true diff --git a/test/libsolidity/semanticTests/expressions/tuple_from_ternary_expression.sol b/test/libsolidity/semanticTests/expressions/tuple_from_ternary_expression.sol new file mode 100644 index 000000000000..c8a2ced2cc12 --- /dev/null +++ b/test/libsolidity/semanticTests/expressions/tuple_from_ternary_expression.sol @@ -0,0 +1,9 @@ +contract C { + function f() public pure returns (bool){ + bool flag; + ((flag = true) ? (1, 2, 3) : (3, 2, 1)); + return flag; + } +} +// ---- +// f() -> true diff --git a/test/libsolidity/semanticTests/expressions/uncalled_address_transfer_send.sol b/test/libsolidity/semanticTests/expressions/uncalled_address_transfer_send.sol index 837f9f74108e..af408b3f5110 100644 --- a/test/libsolidity/semanticTests/expressions/uncalled_address_transfer_send.sol +++ b/test/libsolidity/semanticTests/expressions/uncalled_address_transfer_send.sol @@ -6,7 +6,5 @@ contract TransferTest { function f() pure public {} } -// ==== -// compileToEwasm: also // ---- // f() -> diff --git a/test/libsolidity/semanticTests/fallback/call_forward_bytes.sol b/test/libsolidity/semanticTests/fallback/call_forward_bytes.sol index 4a35fad1dbca..7bf3aee3acfe 100644 --- a/test/libsolidity/semanticTests/fallback/call_forward_bytes.sol +++ b/test/libsolidity/semanticTests/fallback/call_forward_bytes.sol @@ -14,7 +14,6 @@ contract sender { } // ==== // allowNonExistingFunctions: true -// compileToEwasm: false // ---- // recv(uint256): 7 -> // val() -> 0 diff --git a/test/libsolidity/semanticTests/fallback/falback_return.sol b/test/libsolidity/semanticTests/fallback/falback_return.sol index 55e65348b184..d59bb9d45247 100644 --- a/test/libsolidity/semanticTests/fallback/falback_return.sol +++ b/test/libsolidity/semanticTests/fallback/falback_return.sol @@ -5,8 +5,6 @@ contract A { x++; } } -// ==== -// compileToEwasm: also // ---- // () // x() -> 1 diff --git a/test/libsolidity/semanticTests/fallback/fallback_or_receive.sol b/test/libsolidity/semanticTests/fallback/fallback_or_receive.sol index 14366886cbe3..9b5319ae0013 100644 --- a/test/libsolidity/semanticTests/fallback/fallback_or_receive.sol +++ b/test/libsolidity/semanticTests/fallback/fallback_or_receive.sol @@ -5,8 +5,6 @@ contract C { receive () payable external { ++y; } function f() external returns (uint, uint) { return (x, y); } } -// ==== -// compileToEwasm: also // ---- // f() -> 0, 0 // () -> diff --git a/test/libsolidity/semanticTests/fallback/inherited.sol b/test/libsolidity/semanticTests/fallback/inherited.sol index 75ab307bfc43..55c63944508c 100644 --- a/test/libsolidity/semanticTests/fallback/inherited.sol +++ b/test/libsolidity/semanticTests/fallback/inherited.sol @@ -4,8 +4,6 @@ contract A { function getData() public returns (uint r) { return data; } } contract B is A {} -// ==== -// compileToEwasm: also // ---- // getData() -> 0 // (): 42 -> diff --git a/test/libsolidity/semanticTests/fallback/short_data_calls_fallback.sol b/test/libsolidity/semanticTests/fallback/short_data_calls_fallback.sol index cb62135edfa9..dd97f4c03488 100644 --- a/test/libsolidity/semanticTests/fallback/short_data_calls_fallback.sol +++ b/test/libsolidity/semanticTests/fallback/short_data_calls_fallback.sol @@ -4,8 +4,6 @@ contract A { function fow() public { x = 3; } fallback () external { x = 2; } } -// ==== -// compileToEwasm: also // ---- // (): hex"d88e0b" // x() -> 2 diff --git a/test/libsolidity/semanticTests/freeFunctions/easy.sol b/test/libsolidity/semanticTests/freeFunctions/easy.sol index dae3b40377ed..f73f101256c5 100644 --- a/test/libsolidity/semanticTests/freeFunctions/easy.sol +++ b/test/libsolidity/semanticTests/freeFunctions/easy.sol @@ -7,7 +7,5 @@ contract C { return add(x, 2); } } -// ==== -// compileToEwasm: also // ---- // f(uint256): 7 -> 9 diff --git a/test/libsolidity/semanticTests/freeFunctions/free_namesake_contract_function.sol b/test/libsolidity/semanticTests/freeFunctions/free_namesake_contract_function.sol index 465b80f7a921..cf4140286d7c 100644 --- a/test/libsolidity/semanticTests/freeFunctions/free_namesake_contract_function.sol +++ b/test/libsolidity/semanticTests/freeFunctions/free_namesake_contract_function.sol @@ -4,7 +4,5 @@ contract C { return f(); } } -// ==== -// compileToEwasm: also // ---- // f() -> FAILURE diff --git a/test/libsolidity/semanticTests/freeFunctions/import.sol b/test/libsolidity/semanticTests/freeFunctions/import.sol index f4ecd6bacab2..edd44de4939a 100644 --- a/test/libsolidity/semanticTests/freeFunctions/import.sol +++ b/test/libsolidity/semanticTests/freeFunctions/import.sol @@ -14,7 +14,5 @@ contract C { two = data.x; } } -// ==== -// compileToEwasm: also // ---- // f(uint256): 7 -> 7, 8 diff --git a/test/libsolidity/semanticTests/freeFunctions/overloads.sol b/test/libsolidity/semanticTests/freeFunctions/overloads.sol index 468f75be994f..6a2da653610e 100644 --- a/test/libsolidity/semanticTests/freeFunctions/overloads.sol +++ b/test/libsolidity/semanticTests/freeFunctions/overloads.sol @@ -10,7 +10,5 @@ contract C { return (f(2), f("abc")); } } -// ==== -// compileToEwasm: also // ---- // g() -> 2, 3 diff --git a/test/libsolidity/semanticTests/freeFunctions/recursion.sol b/test/libsolidity/semanticTests/freeFunctions/recursion.sol index b6a131b63bf0..894a60f3f611 100644 --- a/test/libsolidity/semanticTests/freeFunctions/recursion.sol +++ b/test/libsolidity/semanticTests/freeFunctions/recursion.sol @@ -12,8 +12,6 @@ contract C { return exp(base, exponent); } } -// ==== -// compileToEwasm: also // ---- // g(uint256,uint256): 0, 0 -> 1 // g(uint256,uint256): 0, 1 -> 0x00 diff --git a/test/libsolidity/semanticTests/functionCall/array_multiple_local_vars.sol b/test/libsolidity/semanticTests/functionCall/array_multiple_local_vars.sol index 0605888d082b..4dbfe91f107f 100644 --- a/test/libsolidity/semanticTests/functionCall/array_multiple_local_vars.sol +++ b/test/libsolidity/semanticTests/functionCall/array_multiple_local_vars.sol @@ -22,8 +22,6 @@ contract test { return sum; } } -// ==== -// compileToEwasm: also // ---- // f(uint256[]): 32, 3, 1000, 1, 2 -> 3 // f(uint256[]): 32, 3, 100, 500, 300 -> 600 diff --git a/test/libsolidity/semanticTests/functionCall/call_attached_library_function_on_function.sol b/test/libsolidity/semanticTests/functionCall/call_attached_library_function_on_function.sol index 97bc083af99e..023133a49f32 100644 --- a/test/libsolidity/semanticTests/functionCall/call_attached_library_function_on_function.sol +++ b/test/libsolidity/semanticTests/functionCall/call_attached_library_function_on_function.sol @@ -8,8 +8,6 @@ contract C { } function t() public pure returns (uint) { return 7; } } -// ==== -// compileToEwasm: false // ---- // library: L // f() -> 7 diff --git a/test/libsolidity/semanticTests/functionCall/call_attached_library_function_on_storage_variable.sol b/test/libsolidity/semanticTests/functionCall/call_attached_library_function_on_storage_variable.sol index d8d55dc9bbec..5a599c8a5707 100644 --- a/test/libsolidity/semanticTests/functionCall/call_attached_library_function_on_storage_variable.sol +++ b/test/libsolidity/semanticTests/functionCall/call_attached_library_function_on_storage_variable.sol @@ -7,8 +7,6 @@ contract C { return (x.mul)({x: a}); } } -// ==== -// compileToEwasm: false // ---- // library: D // f(uint256): 7 -> 0x2a diff --git a/test/libsolidity/semanticTests/functionCall/call_attached_library_function_on_string.sol b/test/libsolidity/semanticTests/functionCall/call_attached_library_function_on_string.sol index d374573dc977..d2d23fb626d5 100644 --- a/test/libsolidity/semanticTests/functionCall/call_attached_library_function_on_string.sol +++ b/test/libsolidity/semanticTests/functionCall/call_attached_library_function_on_string.sol @@ -11,8 +11,6 @@ contract C { return s.length(); } } -// ==== -// compileToEwasm: false // ---- // library: D // f() -> 3 diff --git a/test/libsolidity/semanticTests/functionCall/call_function_returning_function.sol b/test/libsolidity/semanticTests/functionCall/call_function_returning_function.sol index 82c38cca5a02..a00628eaf108 100644 --- a/test/libsolidity/semanticTests/functionCall/call_function_returning_function.sol +++ b/test/libsolidity/semanticTests/functionCall/call_function_returning_function.sol @@ -21,8 +21,5 @@ contract test { return x()()()(); } } - -// ==== -// compileToEwasm: also // ---- // f() -> 2 diff --git a/test/libsolidity/semanticTests/functionCall/call_function_returning_nothing_via_pointer.sol b/test/libsolidity/semanticTests/functionCall/call_function_returning_nothing_via_pointer.sol index ea5edaaef609..b43c453d2378 100644 --- a/test/libsolidity/semanticTests/functionCall/call_function_returning_nothing_via_pointer.sol +++ b/test/libsolidity/semanticTests/functionCall/call_function_returning_nothing_via_pointer.sol @@ -11,9 +11,6 @@ contract test { return flag; } } - -// ==== -// compileToEwasm: also // ---- // f() -> true // flag() -> true diff --git a/test/libsolidity/semanticTests/functionCall/call_internal_function_via_expression.sol b/test/libsolidity/semanticTests/functionCall/call_internal_function_via_expression.sol index 043ee05a82aa..0b880bfd1b8a 100644 --- a/test/libsolidity/semanticTests/functionCall/call_internal_function_via_expression.sol +++ b/test/libsolidity/semanticTests/functionCall/call_internal_function_via_expression.sol @@ -17,8 +17,6 @@ contract C { return (get_ptr(foo))(); } } -// ==== -// compileToEwasm: also // ---- // associated() -> 42 // unassociated() -> 42 diff --git a/test/libsolidity/semanticTests/functionCall/calling_nonexisting_contract_throws.sol b/test/libsolidity/semanticTests/functionCall/calling_nonexisting_contract_throws.sol index 9753015a453d..229618384d1e 100644 --- a/test/libsolidity/semanticTests/functionCall/calling_nonexisting_contract_throws.sol +++ b/test/libsolidity/semanticTests/functionCall/calling_nonexisting_contract_throws.sol @@ -21,9 +21,6 @@ contract C { return 7; } } - -// ==== -// compileToEwasm: also // ---- // f() -> FAILURE // g() -> FAILURE diff --git a/test/libsolidity/semanticTests/functionCall/calling_other_functions.sol b/test/libsolidity/semanticTests/functionCall/calling_other_functions.sol index 12139fc68453..9b008f12f2d9 100644 --- a/test/libsolidity/semanticTests/functionCall/calling_other_functions.sol +++ b/test/libsolidity/semanticTests/functionCall/calling_other_functions.sol @@ -12,8 +12,6 @@ contract collatz { return 3 * x + 1; } } -// ==== -// compileToEwasm: also // ---- // run(uint256): 0 -> 0 // run(uint256): 1 -> 1 diff --git a/test/libsolidity/semanticTests/functionCall/calling_uninitialized_function.sol b/test/libsolidity/semanticTests/functionCall/calling_uninitialized_function.sol index 2f660c24c8ac..701b1f51a3d4 100644 --- a/test/libsolidity/semanticTests/functionCall/calling_uninitialized_function.sol +++ b/test/libsolidity/semanticTests/functionCall/calling_uninitialized_function.sol @@ -11,8 +11,6 @@ contract C { return 7; } } -// ==== -// compileToEwasm: also // ---- // intern() -> FAILURE, hex"4e487b71", 0x51 # This should throw exceptions # // extern() -> FAILURE diff --git a/test/libsolidity/semanticTests/functionCall/calling_uninitialized_function_in_detail.sol b/test/libsolidity/semanticTests/functionCall/calling_uninitialized_function_in_detail.sol index a7295928aa8f..aa455afcf885 100644 --- a/test/libsolidity/semanticTests/functionCall/calling_uninitialized_function_in_detail.sol +++ b/test/libsolidity/semanticTests/functionCall/calling_uninitialized_function_in_detail.sol @@ -15,8 +15,5 @@ contract C { return 2; } } - -// ==== -// compileToEwasm: also // ---- // t() -> FAILURE, hex"4e487b71", 0x51 diff --git a/test/libsolidity/semanticTests/functionCall/calling_uninitialized_function_through_array.sol b/test/libsolidity/semanticTests/functionCall/calling_uninitialized_function_through_array.sol index f7d90c8f2dec..d83fab85222c 100644 --- a/test/libsolidity/semanticTests/functionCall/calling_uninitialized_function_through_array.sol +++ b/test/libsolidity/semanticTests/functionCall/calling_uninitialized_function_through_array.sol @@ -15,7 +15,5 @@ contract C { return 2; } } -// ==== -// compileToEwasm: also // ---- // t() -> FAILURE, hex"4e487b71", 0x51 diff --git a/test/libsolidity/semanticTests/functionCall/conditional_with_arguments.sol b/test/libsolidity/semanticTests/functionCall/conditional_with_arguments.sol index 65dbeaaeecf5..f5996d32ca9d 100644 --- a/test/libsolidity/semanticTests/functionCall/conditional_with_arguments.sol +++ b/test/libsolidity/semanticTests/functionCall/conditional_with_arguments.sol @@ -6,7 +6,5 @@ contract C { return (false ? g : h)(2, 1); } } -// ==== -// compileToEwasm: also // ---- // f() -> 1 diff --git a/test/libsolidity/semanticTests/functionCall/disordered_named_args.sol b/test/libsolidity/semanticTests/functionCall/disordered_named_args.sol index 5529b90a013a..f15d2201da31 100644 --- a/test/libsolidity/semanticTests/functionCall/disordered_named_args.sol +++ b/test/libsolidity/semanticTests/functionCall/disordered_named_args.sol @@ -2,7 +2,5 @@ contract test { function a(uint a, uint b, uint c) public returns (uint r) { r = a * 100 + b * 10 + c * 1; } function b() public returns (uint r) { r = a({c: 3, a: 1, b: 2}); } } -// ==== -// compileToEwasm: also // ---- // b() -> 123 diff --git a/test/libsolidity/semanticTests/functionCall/external_call.sol b/test/libsolidity/semanticTests/functionCall/external_call.sol index 48dddecec886..9189d5cc7872 100644 --- a/test/libsolidity/semanticTests/functionCall/external_call.sol +++ b/test/libsolidity/semanticTests/functionCall/external_call.sol @@ -9,7 +9,6 @@ contract C { return this.g(2 * n); } } - // ---- // g(uint256): 4 -> 5 // f(uint256): 2 -> 5 diff --git a/test/libsolidity/semanticTests/functionCall/external_call_at_construction_time.sol b/test/libsolidity/semanticTests/functionCall/external_call_at_construction_time.sol index 69a2193a3018..6f7f020fe678 100644 --- a/test/libsolidity/semanticTests/functionCall/external_call_at_construction_time.sol +++ b/test/libsolidity/semanticTests/functionCall/external_call_at_construction_time.sol @@ -16,7 +16,6 @@ contract C { return 1 + c; } } - // ==== // EVMVersion: >=byzantium // ---- diff --git a/test/libsolidity/semanticTests/functionCall/external_call_dynamic_returndata.sol b/test/libsolidity/semanticTests/functionCall/external_call_dynamic_returndata.sol index 56a2876ed4ef..80ca6cc41e61 100644 --- a/test/libsolidity/semanticTests/functionCall/external_call_dynamic_returndata.sol +++ b/test/libsolidity/semanticTests/functionCall/external_call_dynamic_returndata.sol @@ -16,7 +16,6 @@ contract C { return sum; } } - // ==== // EVMVersion: >=byzantium // ---- diff --git a/test/libsolidity/semanticTests/functionCall/external_call_to_nonexisting.sol b/test/libsolidity/semanticTests/functionCall/external_call_to_nonexisting.sol index e8efe09fad0d..86d3dcc8f252 100644 --- a/test/libsolidity/semanticTests/functionCall/external_call_to_nonexisting.sol +++ b/test/libsolidity/semanticTests/functionCall/external_call_to_nonexisting.sol @@ -20,7 +20,6 @@ contract C { return 1 + c; } } - // ---- // constructor(), 1 ether -> // gas irOptimized: 265110 diff --git a/test/libsolidity/semanticTests/functionCall/external_call_to_nonexisting_debugstrings.sol b/test/libsolidity/semanticTests/functionCall/external_call_to_nonexisting_debugstrings.sol index 8fe807e638fe..96f097ce7f4a 100644 --- a/test/libsolidity/semanticTests/functionCall/external_call_to_nonexisting_debugstrings.sol +++ b/test/libsolidity/semanticTests/functionCall/external_call_to_nonexisting_debugstrings.sol @@ -20,7 +20,6 @@ contract C { return 1 + c; } } - // ==== // EVMVersion: >=byzantium // revertStrings: debug diff --git a/test/libsolidity/semanticTests/functionCall/external_call_value.sol b/test/libsolidity/semanticTests/functionCall/external_call_value.sol index 5a946533d51d..9639c1119a4d 100644 --- a/test/libsolidity/semanticTests/functionCall/external_call_value.sol +++ b/test/libsolidity/semanticTests/functionCall/external_call_value.sol @@ -9,7 +9,6 @@ contract C { return this.g{value: 10}(n); } } - // ---- // g(uint256), 1 ether: 4 -> 1000000000000000000000, 4 // f(uint256), 11 ether: 2 -> 10000, 2 diff --git a/test/libsolidity/semanticTests/functionCall/external_function.sol b/test/libsolidity/semanticTests/functionCall/external_function.sol index d6c13a4ef22a..284bad09885d 100644 --- a/test/libsolidity/semanticTests/functionCall/external_function.sol +++ b/test/libsolidity/semanticTests/functionCall/external_function.sol @@ -11,8 +11,5 @@ contract c { r_b = b; } } - -// ==== -// compileToEwasm: also // ---- // test(uint256,uint256): 2, 3 -> 9, 3 diff --git a/test/libsolidity/semanticTests/functionCall/external_public_override.sol b/test/libsolidity/semanticTests/functionCall/external_public_override.sol index 31f47420562f..8e34a5b22362 100644 --- a/test/libsolidity/semanticTests/functionCall/external_public_override.sol +++ b/test/libsolidity/semanticTests/functionCall/external_public_override.sol @@ -14,9 +14,6 @@ contract B is A { return f(); } } - -// ==== -// compileToEwasm: also // ---- // f() -> 2 // g() -> 2 diff --git a/test/libsolidity/semanticTests/functionCall/file_level_call_via_module.sol b/test/libsolidity/semanticTests/functionCall/file_level_call_via_module.sol index 7db64dafcac9..7013a63527e9 100644 --- a/test/libsolidity/semanticTests/functionCall/file_level_call_via_module.sol +++ b/test/libsolidity/semanticTests/functionCall/file_level_call_via_module.sol @@ -9,7 +9,5 @@ contract C { } } -// ==== -// compileToEwasm: also // ---- // f() -> 7, 3 diff --git a/test/libsolidity/semanticTests/functionCall/gas_and_value_basic.sol b/test/libsolidity/semanticTests/functionCall/gas_and_value_basic.sol index abff2c9e7ec6..9c73e208e73e 100644 --- a/test/libsolidity/semanticTests/functionCall/gas_and_value_basic.sol +++ b/test/libsolidity/semanticTests/functionCall/gas_and_value_basic.sol @@ -36,7 +36,6 @@ contract test { myBal = address(this).balance; } } - // ---- // constructor(), 20 wei -> // gas irOptimized: 260052 diff --git a/test/libsolidity/semanticTests/functionCall/gas_and_value_brace_syntax.sol b/test/libsolidity/semanticTests/functionCall/gas_and_value_brace_syntax.sol index dd7487cdfdef..801b22d1772a 100644 --- a/test/libsolidity/semanticTests/functionCall/gas_and_value_brace_syntax.sol +++ b/test/libsolidity/semanticTests/functionCall/gas_and_value_brace_syntax.sol @@ -35,7 +35,6 @@ contract test { myBal = address(this).balance; } } - // ---- // constructor(), 20 wei -> // gas irOptimized: 260052 diff --git a/test/libsolidity/semanticTests/functionCall/inheritance/base_base_overload.sol b/test/libsolidity/semanticTests/functionCall/inheritance/base_base_overload.sol index 749e7c01bd03..adf1200eedec 100644 --- a/test/libsolidity/semanticTests/functionCall/inheritance/base_base_overload.sol +++ b/test/libsolidity/semanticTests/functionCall/inheritance/base_base_overload.sol @@ -34,8 +34,6 @@ contract Child is Base { BaseBase.init(c, d); } } -// ==== -// compileToEwasm: also // ---- // x() -> 0 // y() -> 0 diff --git a/test/libsolidity/semanticTests/functionCall/inheritance/base_overload.sol b/test/libsolidity/semanticTests/functionCall/inheritance/base_overload.sol index fa65755b850c..924431ec53f5 100644 --- a/test/libsolidity/semanticTests/functionCall/inheritance/base_overload.sol +++ b/test/libsolidity/semanticTests/functionCall/inheritance/base_overload.sol @@ -18,8 +18,6 @@ contract Child is Base { Base.init(c, d); } } -// ==== -// compileToEwasm: also // ---- // x() -> 0 // y() -> 0 diff --git a/test/libsolidity/semanticTests/functionCall/inheritance/call_base.sol b/test/libsolidity/semanticTests/functionCall/inheritance/call_base.sol index 85302de766f2..8f0e93ddbeb5 100644 --- a/test/libsolidity/semanticTests/functionCall/inheritance/call_base.sol +++ b/test/libsolidity/semanticTests/functionCall/inheritance/call_base.sol @@ -9,7 +9,5 @@ contract Child is Base { return f(n); } } -// ==== -// compileToEwasm: also // ---- // g(uint256): 4 -> 8 diff --git a/test/libsolidity/semanticTests/functionCall/inheritance/call_base_base.sol b/test/libsolidity/semanticTests/functionCall/inheritance/call_base_base.sol index 70ec4fd72901..8578a6707acc 100644 --- a/test/libsolidity/semanticTests/functionCall/inheritance/call_base_base.sol +++ b/test/libsolidity/semanticTests/functionCall/inheritance/call_base_base.sol @@ -22,8 +22,6 @@ contract Child is Base { return s(n); } } -// ==== -// compileToEwasm: also // ---- // g(uint256): 4 -> 12 // h(uint256): 4 -> 16 diff --git a/test/libsolidity/semanticTests/functionCall/inheritance/call_base_base_explicit.sol b/test/libsolidity/semanticTests/functionCall/inheritance/call_base_base_explicit.sol index 169e1a6ba7bc..f327b3f28e3a 100644 --- a/test/libsolidity/semanticTests/functionCall/inheritance/call_base_base_explicit.sol +++ b/test/libsolidity/semanticTests/functionCall/inheritance/call_base_base_explicit.sol @@ -25,8 +25,6 @@ contract Child is Base { return BaseBase.s(n); } } -// ==== -// compileToEwasm: also // ---- // g(uint256): 4 -> 8 // k(uint256): 4 -> 16 diff --git a/test/libsolidity/semanticTests/functionCall/inheritance/call_base_explicit.sol b/test/libsolidity/semanticTests/functionCall/inheritance/call_base_explicit.sol index 7ff1eae99adb..0a0cf465f03d 100644 --- a/test/libsolidity/semanticTests/functionCall/inheritance/call_base_explicit.sol +++ b/test/libsolidity/semanticTests/functionCall/inheritance/call_base_explicit.sol @@ -9,7 +9,5 @@ contract Child is Base { return Base.f(n); } } -// ==== -// compileToEwasm: also // ---- // g(uint256): 4 -> 8 diff --git a/test/libsolidity/semanticTests/functionCall/inheritance/call_unimplemented_base.sol b/test/libsolidity/semanticTests/functionCall/inheritance/call_unimplemented_base.sol index 61b428303bd7..21ab22e0bc63 100644 --- a/test/libsolidity/semanticTests/functionCall/inheritance/call_unimplemented_base.sol +++ b/test/libsolidity/semanticTests/functionCall/inheritance/call_unimplemented_base.sol @@ -14,7 +14,5 @@ contract C is V { function a() internal view override returns (uint256) { return 42; } } -// ==== -// compileToEwasm: also // ---- // b() -> 42 diff --git a/test/libsolidity/semanticTests/functionCall/inheritance/super_skip_unimplemented_in_abstract_contract.sol b/test/libsolidity/semanticTests/functionCall/inheritance/super_skip_unimplemented_in_abstract_contract.sol index 7dc726be2a62..20774d692668 100644 --- a/test/libsolidity/semanticTests/functionCall/inheritance/super_skip_unimplemented_in_abstract_contract.sol +++ b/test/libsolidity/semanticTests/functionCall/inheritance/super_skip_unimplemented_in_abstract_contract.sol @@ -15,7 +15,5 @@ contract B is A, I { return super.f(); } } -// ==== -// compileToEwasm: also // ---- // f() -> 42 diff --git a/test/libsolidity/semanticTests/functionCall/inheritance/super_skip_unimplemented_in_interface.sol b/test/libsolidity/semanticTests/functionCall/inheritance/super_skip_unimplemented_in_interface.sol index 218d1bca8edb..f5f0561334fe 100644 --- a/test/libsolidity/semanticTests/functionCall/inheritance/super_skip_unimplemented_in_interface.sol +++ b/test/libsolidity/semanticTests/functionCall/inheritance/super_skip_unimplemented_in_interface.sol @@ -15,7 +15,5 @@ contract B is A, I { return super.f(); } } -// ==== -// compileToEwasm: also // ---- // f() -> 42 diff --git a/test/libsolidity/semanticTests/functionCall/member_accessors.sol b/test/libsolidity/semanticTests/functionCall/member_accessors.sol index ad0b8a3e2e48..ae5eab6d11b3 100644 --- a/test/libsolidity/semanticTests/functionCall/member_accessors.sol +++ b/test/libsolidity/semanticTests/functionCall/member_accessors.sol @@ -14,7 +14,6 @@ contract test { } // ==== // allowNonExistingFunctions: true -// compileToEwasm: also // ---- // data() -> 8 // name() -> "Celina" diff --git a/test/libsolidity/semanticTests/functionCall/multiple_functions.sol b/test/libsolidity/semanticTests/functionCall/multiple_functions.sol index 63fac55e0924..3c60a13f11cf 100644 --- a/test/libsolidity/semanticTests/functionCall/multiple_functions.sol +++ b/test/libsolidity/semanticTests/functionCall/multiple_functions.sol @@ -6,7 +6,6 @@ contract test { } // ==== // allowNonExistingFunctions: true -// compileToEwasm: also // ---- // a() -> 0 // b() -> 1 diff --git a/test/libsolidity/semanticTests/functionCall/multiple_return_values.sol b/test/libsolidity/semanticTests/functionCall/multiple_return_values.sol index ef746eb032bf..cb2a8a0c0395 100644 --- a/test/libsolidity/semanticTests/functionCall/multiple_return_values.sol +++ b/test/libsolidity/semanticTests/functionCall/multiple_return_values.sol @@ -3,7 +3,5 @@ contract test { y1 = x2; y2 = x1; } } -// ==== -// compileToEwasm: also // ---- // run(bool,uint256): true, 0xcd -> 0xcd, true, 0 diff --git a/test/libsolidity/semanticTests/functionCall/named_args.sol b/test/libsolidity/semanticTests/functionCall/named_args.sol index 4966f51860fe..706f6d94dc6a 100644 --- a/test/libsolidity/semanticTests/functionCall/named_args.sol +++ b/test/libsolidity/semanticTests/functionCall/named_args.sol @@ -3,8 +3,6 @@ contract test { function b() public returns (uint r) { r = a({a: 1, b: 2, c: 3}); } function c() public returns (uint r) { r = a({b: 2, c: 3, a: 1}); } } -// ==== -// compileToEwasm: also // ---- // b() -> 123 // c() -> 123 diff --git a/test/libsolidity/semanticTests/functionCall/named_args_overload.sol b/test/libsolidity/semanticTests/functionCall/named_args_overload.sol index 0c31e47c5030..65f34d8ff6d7 100644 --- a/test/libsolidity/semanticTests/functionCall/named_args_overload.sol +++ b/test/libsolidity/semanticTests/functionCall/named_args_overload.sol @@ -26,8 +26,6 @@ contract C { return 500; } } -// ==== -// compileToEwasm: also // ---- // call(uint256): 0 -> 0 // call(uint256): 1 -> 1 diff --git a/test/libsolidity/semanticTests/functionCall/send_zero_ether.sol b/test/libsolidity/semanticTests/functionCall/send_zero_ether.sol index b78951c41abe..18a19979295b 100644 --- a/test/libsolidity/semanticTests/functionCall/send_zero_ether.sol +++ b/test/libsolidity/semanticTests/functionCall/send_zero_ether.sol @@ -13,9 +13,6 @@ contract Main { return payable(r).send(0); } } - -// ==== -// compileToEwasm: also // ---- // constructor(), 20 wei -> // gas irOptimized: 100264 diff --git a/test/libsolidity/semanticTests/functionCall/transaction_status.sol b/test/libsolidity/semanticTests/functionCall/transaction_status.sol index 309cb8ef1845..caa538deec4b 100644 --- a/test/libsolidity/semanticTests/functionCall/transaction_status.sol +++ b/test/libsolidity/semanticTests/functionCall/transaction_status.sol @@ -3,8 +3,6 @@ contract test { function g() public { revert(); } function h() public { assert(false); } } -// ==== -// compileToEwasm: also // ---- // f() -> // g() -> FAILURE diff --git a/test/libsolidity/semanticTests/functionCall/value_test.sol b/test/libsolidity/semanticTests/functionCall/value_test.sol index c15e6332f1ec..a6fea6a50b50 100644 --- a/test/libsolidity/semanticTests/functionCall/value_test.sol +++ b/test/libsolidity/semanticTests/functionCall/value_test.sol @@ -3,8 +3,6 @@ contract C { return msg.value; } } -// ==== -// compileToEwasm: also // ---- // f(), 1 ether -> 1000000000000000000 // f(), 1 wei -> 1 diff --git a/test/libsolidity/semanticTests/functionSelector/function_selector_via_contract_name.sol b/test/libsolidity/semanticTests/functionSelector/function_selector_via_contract_name.sol index 5052ad2b400a..0a9e6d3ffd14 100644 --- a/test/libsolidity/semanticTests/functionSelector/function_selector_via_contract_name.sol +++ b/test/libsolidity/semanticTests/functionSelector/function_selector_via_contract_name.sol @@ -15,8 +15,6 @@ contract C { return (a.f.selector, a.g.selector, b.f.selector, b.g.selector); } } -// ==== -// compileToEwasm: also // ---- // test1() -> left(0x26121ff0), left(0xe420264a), left(0x26121ff0), left(0xe420264a) // test2() -> left(0x26121ff0), left(0xe420264a), left(0x26121ff0), left(0xe420264a) diff --git a/test/libsolidity/semanticTests/functionTypes/address_member.sol b/test/libsolidity/semanticTests/functionTypes/address_member.sol index c407a3ab6337..a5f56f3dc688 100644 --- a/test/libsolidity/semanticTests/functionTypes/address_member.sol +++ b/test/libsolidity/semanticTests/functionTypes/address_member.sol @@ -6,7 +6,5 @@ contract C { a2 = [this.f.address][0]; } } -// ==== -// compileToEwasm: also // ---- // f() -> 0xc06afe3a8444fc0004668591e8306bfb9968e79e, 0xc06afe3a8444fc0004668591e8306bfb9968e79e diff --git a/test/libsolidity/semanticTests/functionTypes/function_delete_stack.sol b/test/libsolidity/semanticTests/functionTypes/function_delete_stack.sol index 409bb809eb47..67a4434dfe00 100644 --- a/test/libsolidity/semanticTests/functionTypes/function_delete_stack.sol +++ b/test/libsolidity/semanticTests/functionTypes/function_delete_stack.sol @@ -9,8 +9,5 @@ contract C { y(); } } - -// ==== -// compileToEwasm: also // ---- // test() -> FAILURE, hex"4e487b71", 0x51 diff --git a/test/libsolidity/semanticTests/functionTypes/function_delete_storage.sol b/test/libsolidity/semanticTests/functionTypes/function_delete_storage.sol index 4cf8be204029..a147b4e02587 100644 --- a/test/libsolidity/semanticTests/functionTypes/function_delete_storage.sol +++ b/test/libsolidity/semanticTests/functionTypes/function_delete_storage.sol @@ -19,9 +19,6 @@ contract C { return y(); } } - -// ==== -// compileToEwasm: also // ---- // set() -> 7 // ca() -> 7 diff --git a/test/libsolidity/semanticTests/functionTypes/function_type_library_internal.sol b/test/libsolidity/semanticTests/functionTypes/function_type_library_internal.sol index f096a4979444..587daac97894 100644 --- a/test/libsolidity/semanticTests/functionTypes/function_type_library_internal.sol +++ b/test/libsolidity/semanticTests/functionTypes/function_type_library_internal.sol @@ -21,6 +21,5 @@ contract C { return Utils.reduce(x, Utils.sum, 0); } } - // ---- // f(uint256[]): 0x20, 0x3, 0x1, 0x7, 0x3 -> 11 diff --git a/test/libsolidity/semanticTests/functionTypes/mapping_of_functions.sol b/test/libsolidity/semanticTests/functionTypes/mapping_of_functions.sol index 353844723c23..f9cd863baa7b 100644 --- a/test/libsolidity/semanticTests/functionTypes/mapping_of_functions.sol +++ b/test/libsolidity/semanticTests/functionTypes/mapping_of_functions.sol @@ -24,7 +24,6 @@ contract Flow { return 7; } } - // ---- // success() -> false // f() -> 7 diff --git a/test/libsolidity/semanticTests/functionTypes/pass_function_types_externally.sol b/test/libsolidity/semanticTests/functionTypes/pass_function_types_externally.sol index ebef9a2549a8..3f14eb594af5 100644 --- a/test/libsolidity/semanticTests/functionTypes/pass_function_types_externally.sol +++ b/test/libsolidity/semanticTests/functionTypes/pass_function_types_externally.sol @@ -15,7 +15,6 @@ contract C { return x + 1; } } - // ---- // f(uint256): 7 -> 8 // f2(uint256): 7 -> 8 diff --git a/test/libsolidity/semanticTests/functionTypes/pass_function_types_internally.sol b/test/libsolidity/semanticTests/functionTypes/pass_function_types_internally.sol index a2bab4051488..0acbcc5858d9 100644 --- a/test/libsolidity/semanticTests/functionTypes/pass_function_types_internally.sol +++ b/test/libsolidity/semanticTests/functionTypes/pass_function_types_internally.sol @@ -11,7 +11,5 @@ contract C { return x + 1; } } -// ==== -// compileToEwasm: also // ---- // f(uint256): 7 -> 8 diff --git a/test/libsolidity/semanticTests/functionTypes/same_function_in_construction_and_runtime.sol b/test/libsolidity/semanticTests/functionTypes/same_function_in_construction_and_runtime.sol index 675c2d08b078..84f6fad1c098 100644 --- a/test/libsolidity/semanticTests/functionTypes/same_function_in_construction_and_runtime.sol +++ b/test/libsolidity/semanticTests/functionTypes/same_function_in_construction_and_runtime.sol @@ -13,8 +13,6 @@ contract C { return double(_arg); } } -// ==== -// compileToEwasm: also // ---- // runtime(uint256): 3 -> 6 // initial() -> 4 diff --git a/test/libsolidity/semanticTests/functionTypes/same_function_in_construction_and_runtime_equality_check.sol b/test/libsolidity/semanticTests/functionTypes/same_function_in_construction_and_runtime_equality_check.sol index d32db4d90882..b5b24954c9f6 100644 --- a/test/libsolidity/semanticTests/functionTypes/same_function_in_construction_and_runtime_equality_check.sol +++ b/test/libsolidity/semanticTests/functionTypes/same_function_in_construction_and_runtime_equality_check.sol @@ -13,8 +13,5 @@ contract C { _ret = _arg * 2; } } - -// ==== -// compileToEwasm: also // ---- // test() -> true diff --git a/test/libsolidity/semanticTests/functionTypes/selector_1.sol b/test/libsolidity/semanticTests/functionTypes/selector_1.sol index 3d49e5b42768..397655dae54c 100644 --- a/test/libsolidity/semanticTests/functionTypes/selector_1.sol +++ b/test/libsolidity/semanticTests/functionTypes/selector_1.sol @@ -10,6 +10,5 @@ contract C is B { } // ==== // compileViaYul: true -// compileToEwasm: also // ---- // test() -> 0xcf9f23b500000000000000000000000000000000000000000000000000000000, 0x7defb41000000000000000000000000000000000000000000000000000000000, 0xcf9f23b500000000000000000000000000000000000000000000000000000000, 0x7defb41000000000000000000000000000000000000000000000000000000000 diff --git a/test/libsolidity/semanticTests/functionTypes/selector_2.sol b/test/libsolidity/semanticTests/functionTypes/selector_2.sol index 46de760551c9..248e446736bc 100644 --- a/test/libsolidity/semanticTests/functionTypes/selector_2.sol +++ b/test/libsolidity/semanticTests/functionTypes/selector_2.sol @@ -10,6 +10,5 @@ contract D { } // ==== // compileViaYul: true -// compileToEwasm: also // ---- // test() -> 0xcf9f23b500000000000000000000000000000000000000000000000000000000, 0x7defb41000000000000000000000000000000000000000000000000000000000 diff --git a/test/libsolidity/semanticTests/functionTypes/selector_assignment_expression.sol b/test/libsolidity/semanticTests/functionTypes/selector_assignment_expression.sol new file mode 100644 index 000000000000..896dbeb9927b --- /dev/null +++ b/test/libsolidity/semanticTests/functionTypes/selector_assignment_expression.sol @@ -0,0 +1,10 @@ +contract C { + bool public z; + function f() public { + ((z = true) ? this.f : this.f).selector; + } +} + +// ---- +// f() +// z() -> true diff --git a/test/libsolidity/semanticTests/functionTypes/selector_expression_side_effect.sol b/test/libsolidity/semanticTests/functionTypes/selector_expression_side_effect.sol new file mode 100644 index 000000000000..cdb7b98dfe70 --- /dev/null +++ b/test/libsolidity/semanticTests/functionTypes/selector_expression_side_effect.sol @@ -0,0 +1,13 @@ +contract C { + uint x; + function f() public returns (uint256) { + h().f.selector; + return x; + } + function h() public returns (C) { + x = 42; + return this; + } +} +// ---- +// f() -> 42 diff --git a/test/libsolidity/semanticTests/functionTypes/selector_ternary.sol b/test/libsolidity/semanticTests/functionTypes/selector_ternary.sol new file mode 100644 index 000000000000..567b7c14b945 --- /dev/null +++ b/test/libsolidity/semanticTests/functionTypes/selector_ternary.sol @@ -0,0 +1,10 @@ +contract C { + function f() public {} + function g() public {} + function h(bool c) public returns (bytes4) { + return (c ? this.f : this.g).selector; + } +} +// ---- +// h(bool): true -> 0x26121ff000000000000000000000000000000000000000000000000000000000 +// h(bool): false -> 0xe2179b8e00000000000000000000000000000000000000000000000000000000 diff --git a/test/libsolidity/semanticTests/functionTypes/selector_ternary_function_pointer_from_function_call.sol b/test/libsolidity/semanticTests/functionTypes/selector_ternary_function_pointer_from_function_call.sol new file mode 100644 index 000000000000..83415f728ceb --- /dev/null +++ b/test/libsolidity/semanticTests/functionTypes/selector_ternary_function_pointer_from_function_call.sol @@ -0,0 +1,19 @@ +contract A { + function f() public {} + function g() public {} +} + +contract C { + A a = new A(); + + function getContract() public view returns (A) { + return a; + } + + function test(bool b) public view returns (bytes4) { + return (b ? getContract().f : getContract().g).selector; + } +} +// ---- +// test(bool): true -> 0x26121ff000000000000000000000000000000000000000000000000000000000 +// test(bool): false -> 0xe2179b8e00000000000000000000000000000000000000000000000000000000 diff --git a/test/libsolidity/semanticTests/functionTypes/store_function.sol b/test/libsolidity/semanticTests/functionTypes/store_function.sol index b1d0fc0c3bca..132a6c95659a 100644 --- a/test/libsolidity/semanticTests/functionTypes/store_function.sol +++ b/test/libsolidity/semanticTests/functionTypes/store_function.sol @@ -23,7 +23,6 @@ contract C { return ev(x); } } - // ---- // t() -> 9 // gas irOptimized: 99064 diff --git a/test/libsolidity/semanticTests/functionTypes/struct_with_external_function.sol b/test/libsolidity/semanticTests/functionTypes/struct_with_external_function.sol index 9c7684245ed4..3de9cfa8763b 100644 --- a/test/libsolidity/semanticTests/functionTypes/struct_with_external_function.sol +++ b/test/libsolidity/semanticTests/functionTypes/struct_with_external_function.sol @@ -27,6 +27,5 @@ contract Flow { return (t[0].x(), t[1].x()); } } - // ---- // f() -> 1, 2 diff --git a/test/libsolidity/semanticTests/functionTypes/struct_with_functions.sol b/test/libsolidity/semanticTests/functionTypes/struct_with_functions.sol index 1ecd9eaf514b..fae91862957a 100644 --- a/test/libsolidity/semanticTests/functionTypes/struct_with_functions.sol +++ b/test/libsolidity/semanticTests/functionTypes/struct_with_functions.sol @@ -27,8 +27,5 @@ contract Flow { return (t[0].x(), t[1].x()); } } - -// ==== -// compileToEwasm: also // ---- // f() -> 1, 2 diff --git a/test/libsolidity/semanticTests/functionTypes/ternary_contract_internal_function.sol b/test/libsolidity/semanticTests/functionTypes/ternary_contract_internal_function.sol new file mode 100644 index 000000000000..f7dc890489d0 --- /dev/null +++ b/test/libsolidity/semanticTests/functionTypes/ternary_contract_internal_function.sol @@ -0,0 +1,10 @@ +contract C { + function f() internal pure returns(uint256) { return 1;} + function g() internal pure returns(uint256) { return 2; } + function test(bool b) public returns(uint256) { + return (b ? C.f : C.g)(); + } +} +// ---- +// test(bool): true -> 1 +// test(bool): false -> 2 diff --git a/test/libsolidity/semanticTests/functionTypes/ternary_contract_library_internal_function.sol b/test/libsolidity/semanticTests/functionTypes/ternary_contract_library_internal_function.sol new file mode 100644 index 000000000000..a29a678d502b --- /dev/null +++ b/test/libsolidity/semanticTests/functionTypes/ternary_contract_library_internal_function.sol @@ -0,0 +1,13 @@ +library L { + function f() internal pure returns(uint256){ return 1; } +} + +contract C { + function g() internal pure returns(uint256) { return 2; } + function test(bool b) public returns(uint256) { + return (b ? L.f : C.g)(); + } +} +// ---- +// test(bool): true -> 1 +// test(bool): false -> 2 diff --git a/test/libsolidity/semanticTests/functionTypes/ternary_contract_public_function.sol b/test/libsolidity/semanticTests/functionTypes/ternary_contract_public_function.sol new file mode 100644 index 000000000000..6d52017a5efb --- /dev/null +++ b/test/libsolidity/semanticTests/functionTypes/ternary_contract_public_function.sol @@ -0,0 +1,10 @@ +contract C { + function f() public pure returns(uint256) { return 1; } + function g() public pure returns(uint256) { return 2; } + function test(bool b) public returns(uint256) { + return (b ? C.f : C.g)(); + } +} +// ---- +// test(bool): true -> 1 +// test(bool): false -> 2 diff --git a/test/libsolidity/semanticTests/functionTypes/uninitialized_internal_storage_function_call.sol b/test/libsolidity/semanticTests/functionTypes/uninitialized_internal_storage_function_call.sol index fb34698bb8f5..b55de08758b8 100644 --- a/test/libsolidity/semanticTests/functionTypes/uninitialized_internal_storage_function_call.sol +++ b/test/libsolidity/semanticTests/functionTypes/uninitialized_internal_storage_function_call.sol @@ -6,8 +6,5 @@ contract Test { return 2; } } - -// ==== -// compileToEwasm: also // ---- // f() -> FAILURE, hex"4e487b71", 0x51 diff --git a/test/libsolidity/semanticTests/getters/bytes.sol b/test/libsolidity/semanticTests/getters/bytes.sol index 24f384fa5cc6..c22403c7792a 100644 --- a/test/libsolidity/semanticTests/getters/bytes.sol +++ b/test/libsolidity/semanticTests/getters/bytes.sol @@ -4,7 +4,5 @@ contract C { b = "abc"; } } -// ==== -// compileToEwasm: also // ---- // b() -> 0x20, 0x03, 0x6162630000000000000000000000000000000000000000000000000000000000 diff --git a/test/libsolidity/semanticTests/getters/string_and_bytes.sol b/test/libsolidity/semanticTests/getters/string_and_bytes.sol index 9452ff97cd39..f9cf7316f866 100644 --- a/test/libsolidity/semanticTests/getters/string_and_bytes.sol +++ b/test/libsolidity/semanticTests/getters/string_and_bytes.sol @@ -9,8 +9,6 @@ contract C { c = hex"ff077fff"; } } -// ==== -// compileToEwasm: also // ---- // a() -> 0x20, 11, "hello world" // b() -> 0x20, 4, "ABCD" diff --git a/test/libsolidity/semanticTests/getters/value_types.sol b/test/libsolidity/semanticTests/getters/value_types.sol index 3d590ded1619..a8a8759e3e33 100644 --- a/test/libsolidity/semanticTests/getters/value_types.sol +++ b/test/libsolidity/semanticTests/getters/value_types.sol @@ -20,8 +20,6 @@ contract C { i = address(type(uint160).max / 3); } } -// ==== -// compileToEwasm: also // ---- // a() -> 3 // b() -> 4 diff --git a/test/libsolidity/semanticTests/immutable/delete.sol b/test/libsolidity/semanticTests/immutable/delete.sol new file mode 100644 index 000000000000..76e219a77d44 --- /dev/null +++ b/test/libsolidity/semanticTests/immutable/delete.sol @@ -0,0 +1,15 @@ +contract C { + uint8 immutable public a; + uint8 immutable public b = 0x42; + uint public c; + + constructor() { + delete a; + delete b; + c = b * 2 + a; + } +} +// ---- +// a() -> 0 +// b() -> 0 +// c() -> 0 diff --git a/test/libsolidity/semanticTests/immutable/increment_decrement.sol b/test/libsolidity/semanticTests/immutable/increment_decrement.sol new file mode 100644 index 000000000000..14304513a3da --- /dev/null +++ b/test/libsolidity/semanticTests/immutable/increment_decrement.sol @@ -0,0 +1,18 @@ +contract C { + int immutable x = 1; + int immutable y = 3; + + constructor() { + x--; + --x; + y++; + ++y; + --y; + } + + function f() public view returns (int, int) { + return (x, y); + } +} +// ---- +// f() -> -1, 4 diff --git a/test/libsolidity/semanticTests/immutable/multiple_initializations.sol b/test/libsolidity/semanticTests/immutable/multiple_initializations.sol new file mode 100644 index 000000000000..b72f05b11015 --- /dev/null +++ b/test/libsolidity/semanticTests/immutable/multiple_initializations.sol @@ -0,0 +1,27 @@ +contract A { + uint immutable x = x + 1; + uint immutable y = x += 2; + + constructor(uint) m(x += 16) m(x += 32) { + x += 64; + x += 128; + } + + modifier m(uint) { + _; + } + + function get() public returns (uint) { + return x; + } +} + +contract B is A(A.x += 8) { + constructor(uint) {} +} + +contract C is B { + constructor() B(x += 4) {} +} +// ---- +// get() -> 0xff diff --git a/test/libsolidity/semanticTests/immutable/uninitialized.sol b/test/libsolidity/semanticTests/immutable/uninitialized.sol new file mode 100644 index 000000000000..f6d59ce768e7 --- /dev/null +++ b/test/libsolidity/semanticTests/immutable/uninitialized.sol @@ -0,0 +1,11 @@ +contract C { + uint immutable u; + bool immutable b; + address immutable a; + + function get() public returns (uint, bool, address) { + return (u, b, a); + } +} +// ---- +// get() -> 0, false, 0x0 diff --git a/test/libsolidity/semanticTests/inheritance/access_base_storage.sol b/test/libsolidity/semanticTests/inheritance/access_base_storage.sol index 4b11c3598ac6..034e7c1d34c5 100644 --- a/test/libsolidity/semanticTests/inheritance/access_base_storage.sol +++ b/test/libsolidity/semanticTests/inheritance/access_base_storage.sol @@ -21,9 +21,6 @@ contract Derived is Base { derived = dataDerived; } } - -// ==== -// compileToEwasm: also // ---- // setData(uint256,uint256): 1, 2 -> true // getViaBase() -> 1 diff --git a/test/libsolidity/semanticTests/inheritance/address_overload_resolution.sol b/test/libsolidity/semanticTests/inheritance/address_overload_resolution.sol index aa9dc4b9924e..c65d1abec558 100644 --- a/test/libsolidity/semanticTests/inheritance/address_overload_resolution.sol +++ b/test/libsolidity/semanticTests/inheritance/address_overload_resolution.sol @@ -18,7 +18,6 @@ contract D { return (new C()).transfer(5); } } - // ---- // f() -> 1 // gas irOptimized: 77051 diff --git a/test/libsolidity/semanticTests/inheritance/base_access_to_function_type_variables.sol b/test/libsolidity/semanticTests/inheritance/base_access_to_function_type_variables.sol index 7b5e856d34d8..9cff3c728d5c 100644 --- a/test/libsolidity/semanticTests/inheritance/base_access_to_function_type_variables.sol +++ b/test/libsolidity/semanticTests/inheritance/base_access_to_function_type_variables.sol @@ -13,9 +13,6 @@ contract C { return C.x(); } } - -// ==== -// compileToEwasm: also // ---- // g() -> 2 // h() -> FAILURE, hex"4e487b71", 0x51 diff --git a/test/libsolidity/semanticTests/inheritance/derived_overload_base_function_direct.sol b/test/libsolidity/semanticTests/inheritance/derived_overload_base_function_direct.sol index 87571f2d022e..02e20c49d6af 100644 --- a/test/libsolidity/semanticTests/inheritance/derived_overload_base_function_direct.sol +++ b/test/libsolidity/semanticTests/inheritance/derived_overload_base_function_direct.sol @@ -14,8 +14,5 @@ contract C is B { return f(1); } } - -// ==== -// compileToEwasm: also // ---- // g() -> 2 diff --git a/test/libsolidity/semanticTests/inheritance/derived_overload_base_function_indirect.sol b/test/libsolidity/semanticTests/inheritance/derived_overload_base_function_indirect.sol index 23f01e419552..5976fee6fefc 100644 --- a/test/libsolidity/semanticTests/inheritance/derived_overload_base_function_indirect.sol +++ b/test/libsolidity/semanticTests/inheritance/derived_overload_base_function_indirect.sol @@ -21,9 +21,6 @@ contract C is A, B { return f(1); } } - -// ==== -// compileToEwasm: also // ---- // g() -> 10 // h() -> 2 diff --git a/test/libsolidity/semanticTests/inheritance/explicit_base_class.sol b/test/libsolidity/semanticTests/inheritance/explicit_base_class.sol index 4c5468f03837..78f1f186356c 100644 --- a/test/libsolidity/semanticTests/inheritance/explicit_base_class.sol +++ b/test/libsolidity/semanticTests/inheritance/explicit_base_class.sol @@ -21,8 +21,6 @@ contract Derived is Base { return 3; } } -// ==== -// compileToEwasm: also // ---- // g() -> 3 // f() -> 1 diff --git a/test/libsolidity/semanticTests/inheritance/inherited_constant_state_var.sol b/test/libsolidity/semanticTests/inheritance/inherited_constant_state_var.sol index 256367df453b..70674a6c78bf 100644 --- a/test/libsolidity/semanticTests/inheritance/inherited_constant_state_var.sol +++ b/test/libsolidity/semanticTests/inheritance/inherited_constant_state_var.sol @@ -8,8 +8,5 @@ contract B is A { return A.x; } } - -// ==== -// compileToEwasm: also // ---- // f() -> 7 diff --git a/test/libsolidity/semanticTests/inheritance/inherited_function.sol b/test/libsolidity/semanticTests/inheritance/inherited_function.sol index 471fe7943ef1..fb3f8ee8f032 100644 --- a/test/libsolidity/semanticTests/inheritance/inherited_function.sol +++ b/test/libsolidity/semanticTests/inheritance/inherited_function.sol @@ -14,7 +14,5 @@ contract B is A { return A.f(); } } -// ==== -// compileToEwasm: also // ---- // g() -> 1 diff --git a/test/libsolidity/semanticTests/inheritance/inherited_function_calldata_calldata_interface.sol b/test/libsolidity/semanticTests/inheritance/inherited_function_calldata_calldata_interface.sol index 0663ddf4cc24..3114c80f1912 100644 --- a/test/libsolidity/semanticTests/inheritance/inherited_function_calldata_calldata_interface.sol +++ b/test/libsolidity/semanticTests/inheritance/inherited_function_calldata_calldata_interface.sol @@ -20,7 +20,6 @@ contract B { return i.f(new uint256[](2)); } } - // ---- // g() -> 42 // gas irOptimized: 80813 diff --git a/test/libsolidity/semanticTests/inheritance/inherited_function_calldata_memory_interface.sol b/test/libsolidity/semanticTests/inheritance/inherited_function_calldata_memory_interface.sol index e9339e66414c..74bf42ec7e61 100644 --- a/test/libsolidity/semanticTests/inheritance/inherited_function_calldata_memory_interface.sol +++ b/test/libsolidity/semanticTests/inheritance/inherited_function_calldata_memory_interface.sol @@ -20,7 +20,6 @@ contract B { return i.f(new uint256[](2)); } } - // ---- // g() -> 42 // gas irOptimized: 100282 diff --git a/test/libsolidity/semanticTests/inheritance/inherited_function_from_a_library.sol b/test/libsolidity/semanticTests/inheritance/inherited_function_from_a_library.sol index 42d4f711c9b9..1b1092cba953 100644 --- a/test/libsolidity/semanticTests/inheritance/inherited_function_from_a_library.sol +++ b/test/libsolidity/semanticTests/inheritance/inherited_function_from_a_library.sol @@ -14,6 +14,5 @@ contract B { return A.f(); } } - // ---- // g() -> 1 diff --git a/test/libsolidity/semanticTests/inheritance/inherited_function_through_dispatch.sol b/test/libsolidity/semanticTests/inheritance/inherited_function_through_dispatch.sol index e304fc2817b5..39683079a4b5 100644 --- a/test/libsolidity/semanticTests/inheritance/inherited_function_through_dispatch.sol +++ b/test/libsolidity/semanticTests/inheritance/inherited_function_through_dispatch.sol @@ -15,7 +15,5 @@ contract B is A { return ptr(); } } -// ==== -// compileToEwasm: also // ---- // g() -> 1 diff --git a/test/libsolidity/semanticTests/inheritance/member_notation_ctor.sol b/test/libsolidity/semanticTests/inheritance/member_notation_ctor.sol index c0eef13c4b9b..33392e8d48c6 100644 --- a/test/libsolidity/semanticTests/inheritance/member_notation_ctor.sol +++ b/test/libsolidity/semanticTests/inheritance/member_notation_ctor.sol @@ -17,7 +17,6 @@ contract A { return d.getX(); } } - // ---- // g(int256): -1 -> -1 // gas legacy: 102086 diff --git a/test/libsolidity/semanticTests/inheritance/overloaded_function_call_resolve_to_first.sol b/test/libsolidity/semanticTests/inheritance/overloaded_function_call_resolve_to_first.sol index b54f9bc27e3a..d31dba485ac1 100644 --- a/test/libsolidity/semanticTests/inheritance/overloaded_function_call_resolve_to_first.sol +++ b/test/libsolidity/semanticTests/inheritance/overloaded_function_call_resolve_to_first.sol @@ -11,8 +11,5 @@ contract test { return f(3); } } - -// ==== -// compileToEwasm: also // ---- // g() -> 3 diff --git a/test/libsolidity/semanticTests/inheritance/overloaded_function_call_resolve_to_second.sol b/test/libsolidity/semanticTests/inheritance/overloaded_function_call_resolve_to_second.sol index 5479960ac079..c1f816c1f91d 100644 --- a/test/libsolidity/semanticTests/inheritance/overloaded_function_call_resolve_to_second.sol +++ b/test/libsolidity/semanticTests/inheritance/overloaded_function_call_resolve_to_second.sol @@ -11,8 +11,5 @@ contract test { return f(3, 7); } } - -// ==== -// compileToEwasm: also // ---- // g() -> 10 diff --git a/test/libsolidity/semanticTests/inheritance/overloaded_function_call_with_if_else.sol b/test/libsolidity/semanticTests/inheritance/overloaded_function_call_with_if_else.sol index 70be159e8829..c0ff8fd58062 100644 --- a/test/libsolidity/semanticTests/inheritance/overloaded_function_call_with_if_else.sol +++ b/test/libsolidity/semanticTests/inheritance/overloaded_function_call_with_if_else.sol @@ -12,9 +12,6 @@ contract test { else return f(3, 7); } } - -// ==== -// compileToEwasm: also // ---- // g(bool): true -> 3 // g(bool): false -> 10 diff --git a/test/libsolidity/semanticTests/inheritance/super_in_constructor.sol b/test/libsolidity/semanticTests/inheritance/super_in_constructor.sol index c4b6774538c5..7e0aa51d201c 100644 --- a/test/libsolidity/semanticTests/inheritance/super_in_constructor.sol +++ b/test/libsolidity/semanticTests/inheritance/super_in_constructor.sol @@ -30,7 +30,5 @@ contract D is B, C { return data; } } -// ==== -// compileToEwasm: also // ---- // f() -> 15 diff --git a/test/libsolidity/semanticTests/inheritance/super_in_constructor_assignment.sol b/test/libsolidity/semanticTests/inheritance/super_in_constructor_assignment.sol index 47978ddbc761..6b06a784bcef 100644 --- a/test/libsolidity/semanticTests/inheritance/super_in_constructor_assignment.sol +++ b/test/libsolidity/semanticTests/inheritance/super_in_constructor_assignment.sol @@ -33,7 +33,5 @@ contract D is B, C { return data; } } -// ==== -// compileToEwasm: also // ---- // f() -> 15 diff --git a/test/libsolidity/semanticTests/inheritance/super_overload.sol b/test/libsolidity/semanticTests/inheritance/super_overload.sol index 1bb36ca2abf5..7b0b1448f0db 100644 --- a/test/libsolidity/semanticTests/inheritance/super_overload.sol +++ b/test/libsolidity/semanticTests/inheritance/super_overload.sol @@ -21,9 +21,6 @@ contract C is A, B { return super.f(1); } } - -// ==== -// compileToEwasm: also // ---- // g() -> 10 // h() -> 2 diff --git a/test/libsolidity/semanticTests/inheritance/value_for_constructor.sol b/test/libsolidity/semanticTests/inheritance/value_for_constructor.sol index dce48fa28cd3..5390f64db082 100644 --- a/test/libsolidity/semanticTests/inheritance/value_for_constructor.sol +++ b/test/libsolidity/semanticTests/inheritance/value_for_constructor.sol @@ -37,7 +37,6 @@ contract Main { them = address(h).balance; } } - // ---- // constructor(), 22 wei -> // gas irOptimized: 266886 diff --git a/test/libsolidity/semanticTests/inlineAssembly/calldata_array_read.sol b/test/libsolidity/semanticTests/inlineAssembly/calldata_array_read.sol index 21b52f84eadd..572e9def0ce2 100644 --- a/test/libsolidity/semanticTests/inlineAssembly/calldata_array_read.sol +++ b/test/libsolidity/semanticTests/inlineAssembly/calldata_array_read.sol @@ -6,7 +6,5 @@ contract C { assembly { s := t } } } -// ==== -// compileToEwasm: also // ---- // f(uint256[2][]): 0x20, 2, 1, 2, 3, 4 -> 0x44, 2, 0x84 diff --git a/test/libsolidity/semanticTests/inlineAssembly/calldata_length_read.sol b/test/libsolidity/semanticTests/inlineAssembly/calldata_length_read.sol index 04ec0b614f44..d3574806a239 100644 --- a/test/libsolidity/semanticTests/inlineAssembly/calldata_length_read.sol +++ b/test/libsolidity/semanticTests/inlineAssembly/calldata_length_read.sol @@ -7,8 +7,6 @@ contract C { assembly { l := x.length } } } -// ==== -// compileToEwasm: also // ---- // lenBytesRead(bytes): 0x20, 4, "abcd" -> 4 // lenBytesRead(bytes): 0x20, 0, "abcd" -> 0x00 diff --git a/test/libsolidity/semanticTests/inlineAssembly/calldata_offset_read.sol b/test/libsolidity/semanticTests/inlineAssembly/calldata_offset_read.sol index a9b82d11e05d..0b10748c50cf 100644 --- a/test/libsolidity/semanticTests/inlineAssembly/calldata_offset_read.sol +++ b/test/libsolidity/semanticTests/inlineAssembly/calldata_offset_read.sol @@ -10,8 +10,6 @@ contract C { } } } -// ==== -// compileToEwasm: also // ---- // f(bytes): 0x20, 0, 0 -> 0x44 // f(bytes): 0x22, 0, 0, 0 -> 0x46 diff --git a/test/libsolidity/semanticTests/inlineAssembly/calldata_offset_read_write.sol b/test/libsolidity/semanticTests/inlineAssembly/calldata_offset_read_write.sol index 6375055fe2d6..bcba7169b0f0 100644 --- a/test/libsolidity/semanticTests/inlineAssembly/calldata_offset_read_write.sol +++ b/test/libsolidity/semanticTests/inlineAssembly/calldata_offset_read_write.sol @@ -10,9 +10,6 @@ contract C { } } } - -// ==== -// compileToEwasm: also // ---- // f(uint256,bytes,uint256): 7, 0x60, 8, 2, 0 -> 8, 0x14 // f(uint256,bytes,uint256): 0, 0, 0 -> 8, 0x14 diff --git a/test/libsolidity/semanticTests/inlineAssembly/constant_access.sol b/test/libsolidity/semanticTests/inlineAssembly/constant_access.sol index 130ebcd33d66..82badaca780b 100644 --- a/test/libsolidity/semanticTests/inlineAssembly/constant_access.sol +++ b/test/libsolidity/semanticTests/inlineAssembly/constant_access.sol @@ -14,7 +14,5 @@ contract C { } } } -// ==== -// compileToEwasm: also // ---- // f() -> 2, left(0xabcd), left(0x616263), true, 0x1212121212121212121212121212121212121212 diff --git a/test/libsolidity/semanticTests/inlineAssembly/constant_access_referencing.sol b/test/libsolidity/semanticTests/inlineAssembly/constant_access_referencing.sol index 91644d1ace09..d12a979c9983 100644 --- a/test/libsolidity/semanticTests/inlineAssembly/constant_access_referencing.sol +++ b/test/libsolidity/semanticTests/inlineAssembly/constant_access_referencing.sol @@ -22,7 +22,5 @@ contract C { } } } -// ==== -// compileToEwasm: also // ---- // f() -> 2, left(0xabcd), left(0x616263), true, 0x1212121212121212121212121212121212121212 diff --git a/test/libsolidity/semanticTests/inlineAssembly/difficulty.sol b/test/libsolidity/semanticTests/inlineAssembly/difficulty.sol index 7ae286110c50..ef531f78af6d 100644 --- a/test/libsolidity/semanticTests/inlineAssembly/difficulty.sol +++ b/test/libsolidity/semanticTests/inlineAssembly/difficulty.sol @@ -6,7 +6,6 @@ contract C { } } // ==== -// compileToEwasm: also // EVMVersion: 200000000 diff --git a/test/libsolidity/semanticTests/inlineAssembly/inline_assembly_embedded_function_call.sol b/test/libsolidity/semanticTests/inlineAssembly/inline_assembly_embedded_function_call.sol index 5d917437e85c..c925823d0d71 100644 --- a/test/libsolidity/semanticTests/inlineAssembly/inline_assembly_embedded_function_call.sol +++ b/test/libsolidity/semanticTests/inlineAssembly/inline_assembly_embedded_function_call.sol @@ -20,8 +20,5 @@ contract C { } } } - -// ==== -// compileToEwasm: also // ---- // f() -> 0x1, 0x4, 0x7, 0x10 diff --git a/test/libsolidity/semanticTests/inlineAssembly/inline_assembly_for.sol b/test/libsolidity/semanticTests/inlineAssembly/inline_assembly_for.sol index d074e677ff2a..848e9016c8e2 100644 --- a/test/libsolidity/semanticTests/inlineAssembly/inline_assembly_for.sol +++ b/test/libsolidity/semanticTests/inlineAssembly/inline_assembly_for.sol @@ -15,9 +15,6 @@ contract C { } } } - -// ==== -// compileToEwasm: also // ---- // f(uint256): 0 -> 1 // f(uint256): 1 -> 1 diff --git a/test/libsolidity/semanticTests/inlineAssembly/inline_assembly_for2.sol b/test/libsolidity/semanticTests/inlineAssembly/inline_assembly_for2.sol index c4af2ea5fec3..2d8179513677 100644 --- a/test/libsolidity/semanticTests/inlineAssembly/inline_assembly_for2.sol +++ b/test/libsolidity/semanticTests/inlineAssembly/inline_assembly_for2.sol @@ -20,9 +20,6 @@ contract C { c = st; } } - -// ==== -// compileToEwasm: also // ---- // f(uint256): 0 -> 0, 2, 0 // f(uint256): 1 -> 1, 4, 3 diff --git a/test/libsolidity/semanticTests/inlineAssembly/inline_assembly_function_call.sol b/test/libsolidity/semanticTests/inlineAssembly/inline_assembly_function_call.sol index 48cceeb996c0..de198dff2e45 100644 --- a/test/libsolidity/semanticTests/inlineAssembly/inline_assembly_function_call.sol +++ b/test/libsolidity/semanticTests/inlineAssembly/inline_assembly_function_call.sol @@ -14,8 +14,5 @@ contract C { } } } - -// ==== -// compileToEwasm: also // ---- // f() -> 1, 2, 7 diff --git a/test/libsolidity/semanticTests/inlineAssembly/inline_assembly_function_call2.sol b/test/libsolidity/semanticTests/inlineAssembly/inline_assembly_function_call2.sol index caf441dd4608..d21084aa7128 100644 --- a/test/libsolidity/semanticTests/inlineAssembly/inline_assembly_function_call2.sol +++ b/test/libsolidity/semanticTests/inlineAssembly/inline_assembly_function_call2.sol @@ -17,8 +17,5 @@ contract C { } } } - -// ==== -// compileToEwasm: also // ---- // f() -> 0x1, 0x2, 0x7, 0x10 diff --git a/test/libsolidity/semanticTests/inlineAssembly/inline_assembly_function_call_assignment.sol b/test/libsolidity/semanticTests/inlineAssembly/inline_assembly_function_call_assignment.sol index 675ec3b1d537..e2e07823c83e 100644 --- a/test/libsolidity/semanticTests/inlineAssembly/inline_assembly_function_call_assignment.sol +++ b/test/libsolidity/semanticTests/inlineAssembly/inline_assembly_function_call_assignment.sol @@ -16,8 +16,5 @@ contract C { } } } - -// ==== -// compileToEwasm: also // ---- // f() -> 1, 2, 7 diff --git a/test/libsolidity/semanticTests/inlineAssembly/inline_assembly_if.sol b/test/libsolidity/semanticTests/inlineAssembly/inline_assembly_if.sol index 852f10ac83bc..ebe50f516bb0 100644 --- a/test/libsolidity/semanticTests/inlineAssembly/inline_assembly_if.sol +++ b/test/libsolidity/semanticTests/inlineAssembly/inline_assembly_if.sol @@ -7,9 +7,6 @@ contract C { } } } - -// ==== -// compileToEwasm: also // ---- // f(uint256): 0 -> 0 // f(uint256): 1 -> 0 diff --git a/test/libsolidity/semanticTests/inlineAssembly/inline_assembly_in_modifiers.sol b/test/libsolidity/semanticTests/inlineAssembly/inline_assembly_in_modifiers.sol index f74fbbc6380e..e050d2b52220 100644 --- a/test/libsolidity/semanticTests/inlineAssembly/inline_assembly_in_modifiers.sol +++ b/test/libsolidity/semanticTests/inlineAssembly/inline_assembly_in_modifiers.sol @@ -27,9 +27,6 @@ contract C { return true; } } - -// ==== -// compileToEwasm: also // ---- // f() -> true // g() -> FAILURE diff --git a/test/libsolidity/semanticTests/inlineAssembly/inline_assembly_memory_access.sol b/test/libsolidity/semanticTests/inlineAssembly/inline_assembly_memory_access.sol index 448cc3991483..1f6a50d65578 100644 --- a/test/libsolidity/semanticTests/inlineAssembly/inline_assembly_memory_access.sol +++ b/test/libsolidity/semanticTests/inlineAssembly/inline_assembly_memory_access.sol @@ -8,8 +8,5 @@ contract C { return x; } } - -// ==== -// compileToEwasm: also // ---- // test() -> 0x20, 0x5, "12345" diff --git a/test/libsolidity/semanticTests/inlineAssembly/inline_assembly_read_and_write_stack.sol b/test/libsolidity/semanticTests/inlineAssembly/inline_assembly_read_and_write_stack.sol index 58c77a81d59b..ae4b94ed5989 100644 --- a/test/libsolidity/semanticTests/inlineAssembly/inline_assembly_read_and_write_stack.sol +++ b/test/libsolidity/semanticTests/inlineAssembly/inline_assembly_read_and_write_stack.sol @@ -6,8 +6,5 @@ contract C { } } } - -// ==== -// compileToEwasm: also // ---- // f() -> 45 diff --git a/test/libsolidity/semanticTests/inlineAssembly/inline_assembly_recursion.sol b/test/libsolidity/semanticTests/inlineAssembly/inline_assembly_recursion.sol index c3c9297bc05f..a509513199ff 100644 --- a/test/libsolidity/semanticTests/inlineAssembly/inline_assembly_recursion.sol +++ b/test/libsolidity/semanticTests/inlineAssembly/inline_assembly_recursion.sol @@ -17,9 +17,6 @@ contract C { } } } - -// ==== -// compileToEwasm: also // ---- // f(uint256): 0 -> 1 // f(uint256): 1 -> 1 diff --git a/test/libsolidity/semanticTests/inlineAssembly/inline_assembly_storage_access.sol b/test/libsolidity/semanticTests/inlineAssembly/inline_assembly_storage_access.sol index d81bff29e1e3..254bc7473d51 100644 --- a/test/libsolidity/semanticTests/inlineAssembly/inline_assembly_storage_access.sol +++ b/test/libsolidity/semanticTests/inlineAssembly/inline_assembly_storage_access.sol @@ -16,8 +16,6 @@ contract C { return true; } } -// ==== -// compileToEwasm: also // ---- // f() -> true // z() -> 7 diff --git a/test/libsolidity/semanticTests/inlineAssembly/inline_assembly_storage_access_inside_function.sol b/test/libsolidity/semanticTests/inlineAssembly/inline_assembly_storage_access_inside_function.sol index 039f133ecdca..80cd7e11ecfe 100644 --- a/test/libsolidity/semanticTests/inlineAssembly/inline_assembly_storage_access_inside_function.sol +++ b/test/libsolidity/semanticTests/inlineAssembly/inline_assembly_storage_access_inside_function.sol @@ -17,8 +17,6 @@ contract C { return true; } } -// ==== -// compileToEwasm: also // ---- // f() -> true // z() -> 7 diff --git a/test/libsolidity/semanticTests/inlineAssembly/inline_assembly_storage_access_local_var.sol b/test/libsolidity/semanticTests/inlineAssembly/inline_assembly_storage_access_local_var.sol index 5544d90efbc9..c7728068e46a 100644 --- a/test/libsolidity/semanticTests/inlineAssembly/inline_assembly_storage_access_local_var.sol +++ b/test/libsolidity/semanticTests/inlineAssembly/inline_assembly_storage_access_local_var.sol @@ -12,7 +12,5 @@ contract C { return a.length; } } -// ==== -// compileToEwasm: also // ---- // f() -> 7 diff --git a/test/libsolidity/semanticTests/inlineAssembly/inline_assembly_storage_access_via_pointer.sol b/test/libsolidity/semanticTests/inlineAssembly/inline_assembly_storage_access_via_pointer.sol index 687b1d914a86..6c382ef9e60b 100644 --- a/test/libsolidity/semanticTests/inlineAssembly/inline_assembly_storage_access_via_pointer.sol +++ b/test/libsolidity/semanticTests/inlineAssembly/inline_assembly_storage_access_via_pointer.sol @@ -17,9 +17,6 @@ contract C { return true; } } - -// ==== -// compileToEwasm: also // ---- // f() -> true // a() -> 7 diff --git a/test/libsolidity/semanticTests/inlineAssembly/inline_assembly_switch.sol b/test/libsolidity/semanticTests/inlineAssembly/inline_assembly_switch.sol index e4d8419b48d3..615d69594b70 100644 --- a/test/libsolidity/semanticTests/inlineAssembly/inline_assembly_switch.sol +++ b/test/libsolidity/semanticTests/inlineAssembly/inline_assembly_switch.sol @@ -14,9 +14,6 @@ contract C { } } } - -// ==== -// compileToEwasm: also // ---- // f(uint256): 0 -> 2 // f(uint256): 1 -> 8 diff --git a/test/libsolidity/semanticTests/inlineAssembly/inline_assembly_write_to_stack.sol b/test/libsolidity/semanticTests/inlineAssembly/inline_assembly_write_to_stack.sol index b181f825993e..ed20bfe2de0f 100644 --- a/test/libsolidity/semanticTests/inlineAssembly/inline_assembly_write_to_stack.sol +++ b/test/libsolidity/semanticTests/inlineAssembly/inline_assembly_write_to_stack.sol @@ -6,8 +6,5 @@ contract C { } } } - -// ==== -// compileToEwasm: also // ---- // f() -> 7, "abcdef" diff --git a/test/libsolidity/semanticTests/inlineAssembly/inlineasm_empty_let.sol b/test/libsolidity/semanticTests/inlineAssembly/inlineasm_empty_let.sol index b9aa70aeda53..17e14e8ac08e 100644 --- a/test/libsolidity/semanticTests/inlineAssembly/inlineasm_empty_let.sol +++ b/test/libsolidity/semanticTests/inlineAssembly/inlineasm_empty_let.sol @@ -8,8 +8,5 @@ contract C { } } } - -// ==== -// compileToEwasm: also // ---- // f() -> 0, 0 diff --git a/test/libsolidity/semanticTests/inlineAssembly/keccak256_assembly.sol b/test/libsolidity/semanticTests/inlineAssembly/keccak256_assembly.sol index 741d03a8b1ce..253af98902c3 100644 --- a/test/libsolidity/semanticTests/inlineAssembly/keccak256_assembly.sol +++ b/test/libsolidity/semanticTests/inlineAssembly/keccak256_assembly.sol @@ -5,6 +5,5 @@ contract C { } } } - // ---- // f() -> 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470 diff --git a/test/libsolidity/semanticTests/inlineAssembly/leave.sol b/test/libsolidity/semanticTests/inlineAssembly/leave.sol index 8dff599284c3..40add273e000 100644 --- a/test/libsolidity/semanticTests/inlineAssembly/leave.sol +++ b/test/libsolidity/semanticTests/inlineAssembly/leave.sol @@ -10,7 +10,5 @@ contract C { } } } -// ==== -// compileToEwasm: also // ---- // f() -> 2 diff --git a/test/libsolidity/semanticTests/inlineAssembly/prevrandao.sol b/test/libsolidity/semanticTests/inlineAssembly/prevrandao.sol index 5a3b791feb3d..8a71c8f4e68d 100644 --- a/test/libsolidity/semanticTests/inlineAssembly/prevrandao.sol +++ b/test/libsolidity/semanticTests/inlineAssembly/prevrandao.sol @@ -6,7 +6,6 @@ contract C { } } // ==== -// compileToEwasm: also // EVMVersion: >=paris // ---- // f() -> 0xa86c2e601b6c44eb4848f7d23d9df3113fbcac42041c49cbed5000cb4f118777 diff --git a/test/libsolidity/semanticTests/inlineAssembly/shadowing_local_function_opcode.sol b/test/libsolidity/semanticTests/inlineAssembly/shadowing_local_function_opcode.sol index ea24ec6c41e4..d7e585e33e75 100644 --- a/test/libsolidity/semanticTests/inlineAssembly/shadowing_local_function_opcode.sol +++ b/test/libsolidity/semanticTests/inlineAssembly/shadowing_local_function_opcode.sol @@ -7,7 +7,5 @@ contract C { } } } -// ==== -// compileToEwasm: also // ---- // g() -> 7, 3 diff --git a/test/libsolidity/semanticTests/inlineAssembly/slot_access_via_mapping_pointer.sol b/test/libsolidity/semanticTests/inlineAssembly/slot_access_via_mapping_pointer.sol index 66f592bb67ed..e080985e36fe 100644 --- a/test/libsolidity/semanticTests/inlineAssembly/slot_access_via_mapping_pointer.sol +++ b/test/libsolidity/semanticTests/inlineAssembly/slot_access_via_mapping_pointer.sol @@ -25,7 +25,6 @@ contract C { } } } - // ---- // f(uint256): 0 -> 0, 0 // f(uint256): 1 -> 1, 0 diff --git a/test/libsolidity/semanticTests/inlineAssembly/truefalse.sol b/test/libsolidity/semanticTests/inlineAssembly/truefalse.sol index eb57b80926b1..4183642bb082 100644 --- a/test/libsolidity/semanticTests/inlineAssembly/truefalse.sol +++ b/test/libsolidity/semanticTests/inlineAssembly/truefalse.sol @@ -6,7 +6,5 @@ contract C { } } } -// ==== -// compileToEwasm: also // ---- // f() -> 1, 0 diff --git a/test/libsolidity/semanticTests/integer/basic.sol b/test/libsolidity/semanticTests/integer/basic.sol index b03cb20f2436..cea56cd7cbc0 100644 --- a/test/libsolidity/semanticTests/integer/basic.sol +++ b/test/libsolidity/semanticTests/integer/basic.sol @@ -18,7 +18,5 @@ contract C { return true; } } -// ==== -// compileToEwasm: also // ---- // basic() -> true diff --git a/test/libsolidity/semanticTests/integer/int.sol b/test/libsolidity/semanticTests/integer/int.sol index 770fa0be71df..d3681a0ee267 100644 --- a/test/libsolidity/semanticTests/integer/int.sol +++ b/test/libsolidity/semanticTests/integer/int.sol @@ -232,8 +232,6 @@ contract test { return true; } } -// ==== -// compileToEwasm: also // ---- // intMinA() -> true // intMinB() -> true diff --git a/test/libsolidity/semanticTests/integer/many_local_variables.sol b/test/libsolidity/semanticTests/integer/many_local_variables.sol index 0f3f0f642ee2..c43f92696898 100644 --- a/test/libsolidity/semanticTests/integer/many_local_variables.sol +++ b/test/libsolidity/semanticTests/integer/many_local_variables.sol @@ -5,7 +5,5 @@ contract test { y += b + x2; } } -// ==== -// compileToEwasm: also // ---- // run(uint256,uint256,uint256): 0x1000, 0x10000, 0x100000 -> 0x121121 diff --git a/test/libsolidity/semanticTests/integer/small_signed_types.sol b/test/libsolidity/semanticTests/integer/small_signed_types.sol index e1173b95557a..4c0311e50f92 100644 --- a/test/libsolidity/semanticTests/integer/small_signed_types.sol +++ b/test/libsolidity/semanticTests/integer/small_signed_types.sol @@ -3,7 +3,5 @@ contract test { return -int32(10) * -int64(20); } } -// ==== -// compileToEwasm: also // ---- // run() -> 200 diff --git a/test/libsolidity/semanticTests/integer/uint.sol b/test/libsolidity/semanticTests/integer/uint.sol index 2fa6028063fa..ccd32fab4119 100644 --- a/test/libsolidity/semanticTests/integer/uint.sol +++ b/test/libsolidity/semanticTests/integer/uint.sol @@ -231,8 +231,6 @@ contract test { return true; } } -// ==== -// compileToEwasm: also // ---- // uintMinA() -> true // uintMinB() -> true diff --git a/test/libsolidity/semanticTests/interfaceID/homer.sol b/test/libsolidity/semanticTests/interfaceID/homer.sol index 49b60b12f127..fbe6293ddb63 100644 --- a/test/libsolidity/semanticTests/interfaceID/homer.sol +++ b/test/libsolidity/semanticTests/interfaceID/homer.sol @@ -28,9 +28,6 @@ contract Homer is ERC165, Simpson { return "yellow"; } } - -// ==== -// compileToEwasm: also // ---- // supportsInterface(bytes4): left(0x01ffc9a0) -> false // supportsInterface(bytes4): left(0x01ffc9a7) -> true diff --git a/test/libsolidity/semanticTests/interfaceID/homer_interfaceId.sol b/test/libsolidity/semanticTests/interfaceID/homer_interfaceId.sol index 9bf0e3c59810..c66169cd3e2b 100644 --- a/test/libsolidity/semanticTests/interfaceID/homer_interfaceId.sol +++ b/test/libsolidity/semanticTests/interfaceID/homer_interfaceId.sol @@ -28,9 +28,6 @@ contract Homer is ERC165, Simpson { return "yellow"; } } - -// ==== -// compileToEwasm: also // ---- // supportsInterface(bytes4): left(0x01ffc9a0) -> false // supportsInterface(bytes4): left(0x01ffc9a7) -> true diff --git a/test/libsolidity/semanticTests/interfaceID/interfaceId_events.sol b/test/libsolidity/semanticTests/interfaceID/interfaceId_events.sol index 51d48f497ceb..9bbf11bedbe2 100644 --- a/test/libsolidity/semanticTests/interfaceID/interfaceId_events.sol +++ b/test/libsolidity/semanticTests/interfaceID/interfaceId_events.sol @@ -13,9 +13,6 @@ contract Test { bytes4 public hello_world = type(HelloWorld).interfaceId; bytes4 public hello_world_with_event = type(HelloWorldWithEvent).interfaceId; } - -// ==== -// compileToEwasm: also // ---- // hello_world() -> left(0xc6be8b58) // hello_world_with_event() -> left(0xc6be8b58) diff --git a/test/libsolidity/semanticTests/interfaceID/interfaces.sol b/test/libsolidity/semanticTests/interfaceID/interfaces.sol index 77cf83707242..f66d859ea347 100644 --- a/test/libsolidity/semanticTests/interfaceID/interfaces.sol +++ b/test/libsolidity/semanticTests/interfaceID/interfaces.sol @@ -50,9 +50,6 @@ contract Test { return type(HelloWorldDerived).interfaceId; } } - -// ==== -// compileToEwasm: also // ---- // hello() -> left(0x19ff1d21) // world() -> left(0xdf419679) diff --git a/test/libsolidity/semanticTests/interfaceID/lisa.sol b/test/libsolidity/semanticTests/interfaceID/lisa.sol index 885cf9b2463c..722502d86fa0 100644 --- a/test/libsolidity/semanticTests/interfaceID/lisa.sol +++ b/test/libsolidity/semanticTests/interfaceID/lisa.sol @@ -39,7 +39,6 @@ contract Lisa is ERC165MappingImplementation, Simpson { return "yellow"; } } - // ---- // supportsInterface(bytes4): left(0x01ffc9a0) -> false // supportsInterface(bytes4): left(0x01ffc9a7) -> true diff --git a/test/libsolidity/semanticTests/interfaceID/lisa_interfaceId.sol b/test/libsolidity/semanticTests/interfaceID/lisa_interfaceId.sol index c9a7c49050b2..457ac8856eb7 100644 --- a/test/libsolidity/semanticTests/interfaceID/lisa_interfaceId.sol +++ b/test/libsolidity/semanticTests/interfaceID/lisa_interfaceId.sol @@ -39,7 +39,6 @@ contract Lisa is ERC165MappingImplementation, Simpson { return "yellow"; } } - // ---- // supportsInterface(bytes4): left(0x01ffc9a0) -> false // supportsInterface(bytes4): left(0x01ffc9a7) -> true diff --git a/test/libsolidity/semanticTests/interface_inheritance_conversions.sol b/test/libsolidity/semanticTests/interface_inheritance_conversions.sol index 70c7fac4022c..62e1e4fba6dc 100644 --- a/test/libsolidity/semanticTests/interface_inheritance_conversions.sol +++ b/test/libsolidity/semanticTests/interface_inheritance_conversions.sol @@ -32,7 +32,6 @@ contract C { return (sb.parentFun(), sb.subBFun()); } } - // ---- // convertParent() -> 1 // gas irOptimized: 85524 diff --git a/test/libsolidity/semanticTests/isoltestFormatting.sol b/test/libsolidity/semanticTests/isoltestFormatting.sol index 88ec15f57250..9380dc01588e 100644 --- a/test/libsolidity/semanticTests/isoltestFormatting.sol +++ b/test/libsolidity/semanticTests/isoltestFormatting.sol @@ -8,8 +8,6 @@ contract C { return a; } } -// ==== -// compileToEwasm: also // ---- // f() -> 4, 11, 0x0111, 0x333333, 2222222222222222222 // g() -> 0x10, 0x0100, 0x0101, 0x333333, 2222222222222222222 diff --git a/test/libsolidity/semanticTests/libraries/internal_call_attached_with_parentheses.sol b/test/libsolidity/semanticTests/libraries/internal_call_attached_with_parentheses.sol index 43ce7ea66405..1fa930acc29b 100644 --- a/test/libsolidity/semanticTests/libraries/internal_call_attached_with_parentheses.sol +++ b/test/libsolidity/semanticTests/libraries/internal_call_attached_with_parentheses.sol @@ -20,6 +20,5 @@ contract C { return x.data[3]; } } - // ---- // f() -> 0x0a diff --git a/test/libsolidity/semanticTests/libraries/internal_call_unattached_with_parentheses.sol b/test/libsolidity/semanticTests/libraries/internal_call_unattached_with_parentheses.sol index 4de0f4dc969c..5a76dabdfa42 100644 --- a/test/libsolidity/semanticTests/libraries/internal_call_unattached_with_parentheses.sol +++ b/test/libsolidity/semanticTests/libraries/internal_call_unattached_with_parentheses.sol @@ -9,6 +9,5 @@ contract C { return (L.f)(); } } - // ---- // foo() -> 3 diff --git a/test/libsolidity/semanticTests/libraries/internal_library_function.sol b/test/libsolidity/semanticTests/libraries/internal_library_function.sol index a3c8a870018e..24299b6d14cd 100644 --- a/test/libsolidity/semanticTests/libraries/internal_library_function.sol +++ b/test/libsolidity/semanticTests/libraries/internal_library_function.sol @@ -16,6 +16,5 @@ contract C { return x[3]; } } - // ---- // f() -> 2 diff --git a/test/libsolidity/semanticTests/libraries/internal_library_function_attached_to_contract.sol b/test/libsolidity/semanticTests/libraries/internal_library_function_attached_to_contract.sol index afe9b0deb912..a4a25f51ebde 100644 --- a/test/libsolidity/semanticTests/libraries/internal_library_function_attached_to_contract.sol +++ b/test/libsolidity/semanticTests/libraries/internal_library_function_attached_to_contract.sol @@ -14,6 +14,5 @@ contract C { return e.foo(); } } - // ---- // test() -> 42 diff --git a/test/libsolidity/semanticTests/libraries/internal_library_function_attached_to_external_function_type.sol b/test/libsolidity/semanticTests/libraries/internal_library_function_attached_to_external_function_type.sol index 63ca1e0b7a96..a2473e7e79d7 100644 --- a/test/libsolidity/semanticTests/libraries/internal_library_function_attached_to_external_function_type.sol +++ b/test/libsolidity/semanticTests/libraries/internal_library_function_attached_to_external_function_type.sol @@ -16,6 +16,5 @@ contract C { return this.identity.double(value); } } - // ---- // test(uint256): 5 -> 10 diff --git a/test/libsolidity/semanticTests/libraries/internal_library_function_attached_to_interface.sol b/test/libsolidity/semanticTests/libraries/internal_library_function_attached_to_interface.sol index e00fd4612069..13228115a0e5 100644 --- a/test/libsolidity/semanticTests/libraries/internal_library_function_attached_to_interface.sol +++ b/test/libsolidity/semanticTests/libraries/internal_library_function_attached_to_interface.sol @@ -15,6 +15,5 @@ contract C { return I(e).foo(); } } - // ---- // test() -> 42 diff --git a/test/libsolidity/semanticTests/libraries/internal_library_function_attached_to_internal_function_type.sol b/test/libsolidity/semanticTests/libraries/internal_library_function_attached_to_internal_function_type.sol index c566da79cbc9..4397711c6f52 100644 --- a/test/libsolidity/semanticTests/libraries/internal_library_function_attached_to_internal_function_type.sol +++ b/test/libsolidity/semanticTests/libraries/internal_library_function_attached_to_internal_function_type.sol @@ -15,6 +15,5 @@ contract C { return identity.double(value); } } - // ---- // test(uint256): 5 -> 10 diff --git a/test/libsolidity/semanticTests/libraries/internal_library_function_attached_to_internal_function_type_named_selector.sol b/test/libsolidity/semanticTests/libraries/internal_library_function_attached_to_internal_function_type_named_selector.sol index d66bac750fc2..4305b6d40e11 100644 --- a/test/libsolidity/semanticTests/libraries/internal_library_function_attached_to_internal_function_type_named_selector.sol +++ b/test/libsolidity/semanticTests/libraries/internal_library_function_attached_to_internal_function_type_named_selector.sol @@ -15,6 +15,5 @@ contract C { return identity.selector(value); } } - // ---- // test(uint256): 5 -> 10 diff --git a/test/libsolidity/semanticTests/libraries/internal_library_function_attached_to_struct.sol b/test/libsolidity/semanticTests/libraries/internal_library_function_attached_to_struct.sol index f59ec9440dff..e9f95c0ac1d2 100644 --- a/test/libsolidity/semanticTests/libraries/internal_library_function_attached_to_struct.sol +++ b/test/libsolidity/semanticTests/libraries/internal_library_function_attached_to_struct.sol @@ -21,6 +21,5 @@ contract C { return x.data[3]; } } - // ---- // f() -> 2 diff --git a/test/libsolidity/semanticTests/libraries/internal_library_function_calling_private.sol b/test/libsolidity/semanticTests/libraries/internal_library_function_calling_private.sol index 2283c30ff5fc..5ef12f69b41f 100644 --- a/test/libsolidity/semanticTests/libraries/internal_library_function_calling_private.sol +++ b/test/libsolidity/semanticTests/libraries/internal_library_function_calling_private.sol @@ -21,6 +21,5 @@ contract C { return x[3]; } } - // ---- // f() -> 2 diff --git a/test/libsolidity/semanticTests/libraries/internal_library_function_return_var_size.sol b/test/libsolidity/semanticTests/libraries/internal_library_function_return_var_size.sol index 21417b599b43..d6e0e926208b 100644 --- a/test/libsolidity/semanticTests/libraries/internal_library_function_return_var_size.sol +++ b/test/libsolidity/semanticTests/libraries/internal_library_function_return_var_size.sol @@ -21,6 +21,5 @@ contract C { return x.f()[3]; } } - // ---- // f() -> 2 diff --git a/test/libsolidity/semanticTests/libraries/internal_types_in_library.sol b/test/libsolidity/semanticTests/libraries/internal_types_in_library.sol index 7b4e05b72e02..169f2e295b6b 100644 --- a/test/libsolidity/semanticTests/libraries/internal_types_in_library.sol +++ b/test/libsolidity/semanticTests/libraries/internal_types_in_library.sol @@ -19,8 +19,6 @@ contract Test { b = Lib.find(data["abc"], 3); } } -// ==== -// compileToEwasm: false // ---- // library: Lib // f() -> 4, 0x11 diff --git a/test/libsolidity/semanticTests/libraries/library_call_in_homestead.sol b/test/libsolidity/semanticTests/libraries/library_call_in_homestead.sol index a49dc602ad97..44526da68a6a 100644 --- a/test/libsolidity/semanticTests/libraries/library_call_in_homestead.sol +++ b/test/libsolidity/semanticTests/libraries/library_call_in_homestead.sol @@ -6,7 +6,6 @@ contract Test { } } // ==== -// compileToEwasm: false // EVMVersion: >=homestead // ---- // library: Lib diff --git a/test/libsolidity/semanticTests/libraries/library_enum_as_an_expression.sol b/test/libsolidity/semanticTests/libraries/library_enum_as_an_expression.sol index f24d93c2d940..a385fb29a311 100644 --- a/test/libsolidity/semanticTests/libraries/library_enum_as_an_expression.sol +++ b/test/libsolidity/semanticTests/libraries/library_enum_as_an_expression.sol @@ -9,6 +9,5 @@ contract Tsra { return 1; } } - // ---- // f() -> 1 diff --git a/test/libsolidity/semanticTests/libraries/library_references_preserve.sol b/test/libsolidity/semanticTests/libraries/library_references_preserve.sol index ce41e54e98cb..41c16d2f3a8c 100644 --- a/test/libsolidity/semanticTests/libraries/library_references_preserve.sol +++ b/test/libsolidity/semanticTests/libraries/library_references_preserve.sol @@ -40,7 +40,6 @@ contract C { return b.getSum(); } } - // ---- // library: L1 // library: L2 diff --git a/test/libsolidity/semanticTests/libraries/library_stray_values.sol b/test/libsolidity/semanticTests/libraries/library_stray_values.sol index 61f52b86c82a..3acc8557024f 100644 --- a/test/libsolidity/semanticTests/libraries/library_stray_values.sol +++ b/test/libsolidity/semanticTests/libraries/library_stray_values.sol @@ -6,8 +6,6 @@ contract Test { return x + 9; } } -// ==== -// compileToEwasm: false // ---- // library: Lib // f(uint256): 33 -> 0x2a diff --git a/test/libsolidity/semanticTests/libraries/library_struct_as_an_expression.sol b/test/libsolidity/semanticTests/libraries/library_struct_as_an_expression.sol index d7df52434136..96ee9bcffed7 100644 --- a/test/libsolidity/semanticTests/libraries/library_struct_as_an_expression.sol +++ b/test/libsolidity/semanticTests/libraries/library_struct_as_an_expression.sol @@ -12,6 +12,5 @@ contract Tsra { return 1; } } - // ---- // f() -> 1 diff --git a/test/libsolidity/semanticTests/libraries/mapping_arguments_in_library.sol b/test/libsolidity/semanticTests/libraries/mapping_arguments_in_library.sol index 8a82350dc4f8..cfbf7b0c7d15 100644 --- a/test/libsolidity/semanticTests/libraries/mapping_arguments_in_library.sol +++ b/test/libsolidity/semanticTests/libraries/mapping_arguments_in_library.sol @@ -20,8 +20,6 @@ contract Test { return Lib.get(m, key); } } -// ==== -// compileToEwasm: false // ---- // library: Lib // set(uint256,uint256): 1, 42 -> 0 diff --git a/test/libsolidity/semanticTests/libraries/mapping_returns_in_library.sol b/test/libsolidity/semanticTests/libraries/mapping_returns_in_library.sol index a8188fcc65bd..da521f6bada5 100644 --- a/test/libsolidity/semanticTests/libraries/mapping_returns_in_library.sol +++ b/test/libsolidity/semanticTests/libraries/mapping_returns_in_library.sol @@ -24,8 +24,6 @@ contract Test { return b[key]; } } -// ==== -// compileToEwasm: false // ---- // library: Lib // set(bool,uint256,uint256): true, 1, 42 -> 0 diff --git a/test/libsolidity/semanticTests/libraries/mapping_returns_in_library_named.sol b/test/libsolidity/semanticTests/libraries/mapping_returns_in_library_named.sol index 6ddad7979b82..e5963c1b3fe6 100644 --- a/test/libsolidity/semanticTests/libraries/mapping_returns_in_library_named.sol +++ b/test/libsolidity/semanticTests/libraries/mapping_returns_in_library_named.sol @@ -22,8 +22,6 @@ contract Test { return (a[0], a[1], a[2], b[0], b[1], b[2]); } } -// ==== -// compileToEwasm: false // ---- // library: Lib // f() -> 0, 0x2a, 0, 0, 0x15, 0x54 diff --git a/test/libsolidity/semanticTests/libraries/payable_function_calls_library.sol b/test/libsolidity/semanticTests/libraries/payable_function_calls_library.sol index 5e78713b7ef7..178f22b40f92 100644 --- a/test/libsolidity/semanticTests/libraries/payable_function_calls_library.sol +++ b/test/libsolidity/semanticTests/libraries/payable_function_calls_library.sol @@ -6,8 +6,6 @@ contract C { return L.f(); } } -// ==== -// compileToEwasm: false // ---- // library: L // f(): 27 -> 7 diff --git a/test/libsolidity/semanticTests/libraries/using_for_by_name.sol b/test/libsolidity/semanticTests/libraries/using_for_by_name.sol index f9add4cb837d..d6c7f313e236 100644 --- a/test/libsolidity/semanticTests/libraries/using_for_by_name.sol +++ b/test/libsolidity/semanticTests/libraries/using_for_by_name.sol @@ -7,8 +7,6 @@ contract C { return x.mul({x: a}); } } -// ==== -// compileToEwasm: false // ---- // library: D // f(uint256): 7 -> 0x2a diff --git a/test/libsolidity/semanticTests/libraries/using_for_overload.sol b/test/libsolidity/semanticTests/libraries/using_for_overload.sol index 5bc0bc948c16..5dd67fba06be 100644 --- a/test/libsolidity/semanticTests/libraries/using_for_overload.sol +++ b/test/libsolidity/semanticTests/libraries/using_for_overload.sol @@ -11,8 +11,6 @@ contract C { return x.mul(a); } } -// ==== -// compileToEwasm: false // ---- // library: D // f(uint256): 7 -> 0x2a diff --git a/test/libsolidity/semanticTests/libraries/using_library_mappings_public.sol b/test/libsolidity/semanticTests/libraries/using_library_mappings_public.sol index 41c700976c7c..b180d52e4e39 100644 --- a/test/libsolidity/semanticTests/libraries/using_library_mappings_public.sol +++ b/test/libsolidity/semanticTests/libraries/using_library_mappings_public.sol @@ -16,8 +16,6 @@ contract Test { return (m1[0], m1[1], m1[2], m2[0], m2[1], m2[2]); } } -// ==== -// compileToEwasm: false // ---- // library: Lib // f() -> 1, 0, 0x2a, 0x17, 0, 0x63 diff --git a/test/libsolidity/semanticTests/libraries/using_library_mappings_return.sol b/test/libsolidity/semanticTests/libraries/using_library_mappings_return.sol index 3ac843eedaae..d46ed0a56a38 100644 --- a/test/libsolidity/semanticTests/libraries/using_library_mappings_return.sol +++ b/test/libsolidity/semanticTests/libraries/using_library_mappings_return.sol @@ -14,8 +14,6 @@ contract Test { return (m[0][0], m[0][1], m[0][2], m[1][0], m[1][1], m[1][2]); } } -// ==== -// compileToEwasm: false // ---- // library: Lib // f() -> 1, 0, 0x2a, 0x17, 0, 0x63 diff --git a/test/libsolidity/semanticTests/libraries/using_library_structs.sol b/test/libsolidity/semanticTests/libraries/using_library_structs.sol index 465dcebb1757..e709a5b5b93c 100644 --- a/test/libsolidity/semanticTests/libraries/using_library_structs.sol +++ b/test/libsolidity/semanticTests/libraries/using_library_structs.sol @@ -17,8 +17,6 @@ contract Test { b = data["abc"].b[19]; } } -// ==== -// compileToEwasm: false // ---- // library: Lib // f() -> 7, 8 diff --git a/test/libsolidity/semanticTests/literals/denominations.sol b/test/libsolidity/semanticTests/literals/denominations.sol index 9aec493cd1b9..f423775a613a 100644 --- a/test/libsolidity/semanticTests/literals/denominations.sol +++ b/test/libsolidity/semanticTests/literals/denominations.sol @@ -3,7 +3,5 @@ contract C { function f() public view returns(uint) { return x; } } -// ==== -// compileToEwasm: also // ---- // f() -> 1000000001000000001 diff --git a/test/libsolidity/semanticTests/literals/escape.sol b/test/libsolidity/semanticTests/literals/escape.sol index c198f21dc474..96fa9b11e631 100644 --- a/test/libsolidity/semanticTests/literals/escape.sol +++ b/test/libsolidity/semanticTests/literals/escape.sol @@ -7,7 +7,5 @@ contract C return (encoded.length, encoded[0], encoded[1]); } } -// ==== -// compileToEwasm: also // ---- // f() -> 2, 0x5c00000000000000000000000000000000000000000000000000000000000000, 0x5c00000000000000000000000000000000000000000000000000000000000000 diff --git a/test/libsolidity/semanticTests/literals/ether.sol b/test/libsolidity/semanticTests/literals/ether.sol index d2942a0657ae..16cb75315233 100644 --- a/test/libsolidity/semanticTests/literals/ether.sol +++ b/test/libsolidity/semanticTests/literals/ether.sol @@ -3,7 +3,5 @@ contract C { function f() public view returns(uint) { return x; } } -// ==== -// compileToEwasm: also // ---- // f() -> 1000000000000000000 diff --git a/test/libsolidity/semanticTests/literals/gwei.sol b/test/libsolidity/semanticTests/literals/gwei.sol index 3058ee720e79..bb8cc6ab0a71 100644 --- a/test/libsolidity/semanticTests/literals/gwei.sol +++ b/test/libsolidity/semanticTests/literals/gwei.sol @@ -3,7 +3,5 @@ contract C { function f() public view returns(uint) { return x; } } -// ==== -// compileToEwasm: also // ---- // f() -> 1000000000 diff --git a/test/libsolidity/semanticTests/literals/hex_string_with_non_printable_characters.sol b/test/libsolidity/semanticTests/literals/hex_string_with_non_printable_characters.sol index d10904cfaf33..3edd6049c000 100644 --- a/test/libsolidity/semanticTests/literals/hex_string_with_non_printable_characters.sol +++ b/test/libsolidity/semanticTests/literals/hex_string_with_non_printable_characters.sol @@ -5,7 +5,5 @@ contract C { } } } -// ==== -// compileToEwasm: also // ---- // f() -> 0x000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f diff --git a/test/libsolidity/semanticTests/literals/hex_string_with_underscore.sol b/test/libsolidity/semanticTests/literals/hex_string_with_underscore.sol index b14297a94a2f..db7f70f83bdc 100644 --- a/test/libsolidity/semanticTests/literals/hex_string_with_underscore.sol +++ b/test/libsolidity/semanticTests/literals/hex_string_with_underscore.sol @@ -3,7 +3,5 @@ contract C { return hex"12_34_5678_9A"; } } -// ==== -// compileToEwasm: also // ---- // f() -> 32, 5, left(0x123456789A) diff --git a/test/libsolidity/semanticTests/literals/scientific_notation.sol b/test/libsolidity/semanticTests/literals/scientific_notation.sol index b03adee3938a..5e0d80148aec 100644 --- a/test/libsolidity/semanticTests/literals/scientific_notation.sol +++ b/test/libsolidity/semanticTests/literals/scientific_notation.sol @@ -23,9 +23,6 @@ contract C { return -2.5e1; } } - -// ==== -// compileToEwasm: also // ---- // f() -> 20000000000 // g() -> 2 diff --git a/test/libsolidity/semanticTests/literals/wei.sol b/test/libsolidity/semanticTests/literals/wei.sol index bf115f1dce27..08bba771b0de 100644 --- a/test/libsolidity/semanticTests/literals/wei.sol +++ b/test/libsolidity/semanticTests/literals/wei.sol @@ -3,7 +3,5 @@ contract C { function f() public view returns(uint) { return x; } } -// ==== -// compileToEwasm: also // ---- // f() -> 1 diff --git a/test/libsolidity/semanticTests/memoryManagement/assembly_access.sol b/test/libsolidity/semanticTests/memoryManagement/assembly_access.sol index e69c93e46ba6..d2ed3575ecec 100644 --- a/test/libsolidity/semanticTests/memoryManagement/assembly_access.sol +++ b/test/libsolidity/semanticTests/memoryManagement/assembly_access.sol @@ -10,7 +10,5 @@ contract C { assert(y != 0); } } -// ==== -// compileToEwasm: also // ---- // f() -> diff --git a/test/libsolidity/semanticTests/memoryManagement/struct_allocation.sol b/test/libsolidity/semanticTests/memoryManagement/struct_allocation.sol index f3a326534105..5b471e1a7e14 100644 --- a/test/libsolidity/semanticTests/memoryManagement/struct_allocation.sol +++ b/test/libsolidity/semanticTests/memoryManagement/struct_allocation.sol @@ -17,8 +17,6 @@ contract C { return memorySizeAfter - memorySizeBefore; } } -// ==== -// compileToEwasm: also // ---- // withValue() -> 0x00 // withoutValue() -> 0x60 diff --git a/test/libsolidity/semanticTests/metaTypes/name_other_contract.sol b/test/libsolidity/semanticTests/metaTypes/name_other_contract.sol index 4f9bfe971e81..efdaedf50257 100644 --- a/test/libsolidity/semanticTests/metaTypes/name_other_contract.sol +++ b/test/libsolidity/semanticTests/metaTypes/name_other_contract.sol @@ -22,8 +22,6 @@ contract Test is C { return type(I).name; } } -// ==== -// compileToEwasm: also // ---- // c() -> 0x20, 1, "C" // a() -> 0x20, 1, "A" diff --git a/test/libsolidity/semanticTests/modifiers/access_through_contract_name.sol b/test/libsolidity/semanticTests/modifiers/access_through_contract_name.sol index f56d611c2436..4d1538d7cfb7 100644 --- a/test/libsolidity/semanticTests/modifiers/access_through_contract_name.sol +++ b/test/libsolidity/semanticTests/modifiers/access_through_contract_name.sol @@ -12,8 +12,6 @@ contract C is A { return 10; } } -// ==== -// compileToEwasm: also // ---- // x() -> 7 // f() -> 9 diff --git a/test/libsolidity/semanticTests/modifiers/access_through_module_name.sol b/test/libsolidity/semanticTests/modifiers/access_through_module_name.sol index 925797b7ebd1..58c60014311f 100644 --- a/test/libsolidity/semanticTests/modifiers/access_through_module_name.sol +++ b/test/libsolidity/semanticTests/modifiers/access_through_module_name.sol @@ -15,8 +15,6 @@ contract C { r = 10; } } -// ==== -// compileToEwasm: also // ---- // x() -> 0x00 // f() -> 1, 9 diff --git a/test/libsolidity/semanticTests/modifiers/break_in_modifier.sol b/test/libsolidity/semanticTests/modifiers/break_in_modifier.sol index b15a80df14cd..67fc0e6be6c0 100644 --- a/test/libsolidity/semanticTests/modifiers/break_in_modifier.sol +++ b/test/libsolidity/semanticTests/modifiers/break_in_modifier.sol @@ -14,8 +14,6 @@ contract C { x = t; } } -// ==== -// compileToEwasm: also // ---- // x() -> 0 // f() -> diff --git a/test/libsolidity/semanticTests/modifiers/continue_in_modifier.sol b/test/libsolidity/semanticTests/modifiers/continue_in_modifier.sol index bc4c79739365..2879c55eaf0b 100644 --- a/test/libsolidity/semanticTests/modifiers/continue_in_modifier.sol +++ b/test/libsolidity/semanticTests/modifiers/continue_in_modifier.sol @@ -13,9 +13,6 @@ contract C { x = t; } } - -// ==== -// compileToEwasm: also // ---- // x() -> 0 // f() -> diff --git a/test/libsolidity/semanticTests/modifiers/function_modifier.sol b/test/libsolidity/semanticTests/modifiers/function_modifier.sol index cca7e04b1aeb..e1978ba871f9 100644 --- a/test/libsolidity/semanticTests/modifiers/function_modifier.sol +++ b/test/libsolidity/semanticTests/modifiers/function_modifier.sol @@ -7,9 +7,6 @@ contract C { if (msg.value > 0) _; } } - -// ==== -// compileToEwasm: also // ---- // getOne() -> 0 // getOne(), 1 wei -> 1 diff --git a/test/libsolidity/semanticTests/modifiers/function_modifier_calling_functions_in_creation_context.sol b/test/libsolidity/semanticTests/modifiers/function_modifier_calling_functions_in_creation_context.sol index 182baec8c581..bae503250173 100644 --- a/test/libsolidity/semanticTests/modifiers/function_modifier_calling_functions_in_creation_context.sol +++ b/test/libsolidity/semanticTests/modifiers/function_modifier_calling_functions_in_creation_context.sol @@ -44,8 +44,5 @@ contract C is A { data |= 0x4000; } } - -// ==== -// compileToEwasm: also // ---- // getData() -> 0x4300 diff --git a/test/libsolidity/semanticTests/modifiers/function_modifier_empty.sol b/test/libsolidity/semanticTests/modifiers/function_modifier_empty.sol index 222f87f97ee1..16cbad1a4ab9 100644 --- a/test/libsolidity/semanticTests/modifiers/function_modifier_empty.sol +++ b/test/libsolidity/semanticTests/modifiers/function_modifier_empty.sol @@ -12,8 +12,5 @@ contract C is A { if (false) _; } } - -// ==== -// compileToEwasm: also // ---- // f() -> false diff --git a/test/libsolidity/semanticTests/modifiers/function_modifier_for_constructor.sol b/test/libsolidity/semanticTests/modifiers/function_modifier_for_constructor.sol index 71cbc4203773..f32a238145db 100644 --- a/test/libsolidity/semanticTests/modifiers/function_modifier_for_constructor.sol +++ b/test/libsolidity/semanticTests/modifiers/function_modifier_for_constructor.sol @@ -22,7 +22,5 @@ contract C is A { _; } } -// ==== -// compileToEwasm: also // ---- // getData() -> 6 diff --git a/test/libsolidity/semanticTests/modifiers/function_modifier_library.sol b/test/libsolidity/semanticTests/modifiers/function_modifier_library.sol index f10ebb0e74bb..c50fb5ddec51 100644 --- a/test/libsolidity/semanticTests/modifiers/function_modifier_library.sol +++ b/test/libsolidity/semanticTests/modifiers/function_modifier_library.sol @@ -23,6 +23,5 @@ contract Test { return s.v; } } - // ---- // f() -> 0x202 diff --git a/test/libsolidity/semanticTests/modifiers/function_modifier_library_inheritance.sol b/test/libsolidity/semanticTests/modifiers/function_modifier_library_inheritance.sol index 3d5e97de00f2..e87ac7a41330 100644 --- a/test/libsolidity/semanticTests/modifiers/function_modifier_library_inheritance.sol +++ b/test/libsolidity/semanticTests/modifiers/function_modifier_library_inheritance.sol @@ -29,6 +29,5 @@ contract Test { return s.v; } } - // ---- // f() -> 0x202 diff --git a/test/libsolidity/semanticTests/modifiers/function_modifier_local_variables.sol b/test/libsolidity/semanticTests/modifiers/function_modifier_local_variables.sol index dc44d6659801..c3b10475fcca 100644 --- a/test/libsolidity/semanticTests/modifiers/function_modifier_local_variables.sol +++ b/test/libsolidity/semanticTests/modifiers/function_modifier_local_variables.sol @@ -13,9 +13,6 @@ contract C { return 3; } } - -// ==== -// compileToEwasm: also // ---- // f(bool): true -> 0 // f(bool): false -> 3 diff --git a/test/libsolidity/semanticTests/modifiers/function_modifier_loop_viair.sol b/test/libsolidity/semanticTests/modifiers/function_modifier_loop_viair.sol index 86da5500ec53..81caba767061 100644 --- a/test/libsolidity/semanticTests/modifiers/function_modifier_loop_viair.sol +++ b/test/libsolidity/semanticTests/modifiers/function_modifier_loop_viair.sol @@ -10,6 +10,5 @@ contract C { } // ==== // compileViaYul: true -// compileToEwasm: also // ---- // f() -> 1 diff --git a/test/libsolidity/semanticTests/modifiers/function_modifier_multi_invocation_viair.sol b/test/libsolidity/semanticTests/modifiers/function_modifier_multi_invocation_viair.sol index ae8431d3cc59..929b006e3f83 100644 --- a/test/libsolidity/semanticTests/modifiers/function_modifier_multi_invocation_viair.sol +++ b/test/libsolidity/semanticTests/modifiers/function_modifier_multi_invocation_viair.sol @@ -10,7 +10,6 @@ contract C { } // ==== // compileViaYul: true -// compileToEwasm: also // ---- // f(bool): false -> 1 // f(bool): true -> 1 diff --git a/test/libsolidity/semanticTests/modifiers/function_modifier_multiple_times.sol b/test/libsolidity/semanticTests/modifiers/function_modifier_multiple_times.sol index 83f855d2c7db..5cda8b6d2063 100644 --- a/test/libsolidity/semanticTests/modifiers/function_modifier_multiple_times.sol +++ b/test/libsolidity/semanticTests/modifiers/function_modifier_multiple_times.sol @@ -9,9 +9,6 @@ contract C { return a; } } - -// ==== -// compileToEwasm: also // ---- // f(uint256): 3 -> 10 // a() -> 10 diff --git a/test/libsolidity/semanticTests/modifiers/function_modifier_multiple_times_local_vars.sol b/test/libsolidity/semanticTests/modifiers/function_modifier_multiple_times_local_vars.sol index 264d256bdac3..780b5a360c8d 100644 --- a/test/libsolidity/semanticTests/modifiers/function_modifier_multiple_times_local_vars.sol +++ b/test/libsolidity/semanticTests/modifiers/function_modifier_multiple_times_local_vars.sol @@ -12,9 +12,6 @@ contract C { return a; } } - -// ==== -// compileToEwasm: also // ---- // f(uint256): 3 -> 10 // a() -> 0 diff --git a/test/libsolidity/semanticTests/modifiers/function_modifier_overriding.sol b/test/libsolidity/semanticTests/modifiers/function_modifier_overriding.sol index bef92dac2efb..16d6b821637a 100644 --- a/test/libsolidity/semanticTests/modifiers/function_modifier_overriding.sol +++ b/test/libsolidity/semanticTests/modifiers/function_modifier_overriding.sol @@ -14,8 +14,5 @@ contract C is A { if (false) _; } } - -// ==== -// compileToEwasm: also // ---- // f() -> false diff --git a/test/libsolidity/semanticTests/modifiers/function_return_parameter.sol b/test/libsolidity/semanticTests/modifiers/function_return_parameter.sol index e1a0c36d3bde..ecc7851b4ba2 100644 --- a/test/libsolidity/semanticTests/modifiers/function_return_parameter.sol +++ b/test/libsolidity/semanticTests/modifiers/function_return_parameter.sol @@ -4,7 +4,5 @@ contract B { modifier mod1(uint a, bool b) { if (b) _; } modifier mod2(bytes7 a) { while (a == "1234567") _; } } -// ==== -// compileToEwasm: also // ---- // f(uint8): 5 -> 0x00 diff --git a/test/libsolidity/semanticTests/modifiers/function_return_parameter_complex.sol b/test/libsolidity/semanticTests/modifiers/function_return_parameter_complex.sol index ab14d14c280b..530fadf63662 100644 --- a/test/libsolidity/semanticTests/modifiers/function_return_parameter_complex.sol +++ b/test/libsolidity/semanticTests/modifiers/function_return_parameter_complex.sol @@ -26,8 +26,6 @@ contract A { r = x; } } -// ==== -// compileToEwasm: also // ---- // f() -> 0x10, 0x20, 0x40 // x() -> 1 diff --git a/test/libsolidity/semanticTests/modifiers/modifer_recursive.sol b/test/libsolidity/semanticTests/modifiers/modifer_recursive.sol index 006af1c2cc12..a69a26f5ce28 100644 --- a/test/libsolidity/semanticTests/modifiers/modifer_recursive.sol +++ b/test/libsolidity/semanticTests/modifiers/modifer_recursive.sol @@ -8,9 +8,6 @@ contract C { return x == 0 ? 2 : f(x - 1)**2; } } - -// ==== -// compileToEwasm: also // ---- // called() -> 0x00 // f(uint256): 5 -> 0x0100000000 diff --git a/test/libsolidity/semanticTests/modifiers/modifier_in_constructor_ice.sol b/test/libsolidity/semanticTests/modifiers/modifier_in_constructor_ice.sol index 88a2fa1071d0..136743d53089 100644 --- a/test/libsolidity/semanticTests/modifiers/modifier_in_constructor_ice.sol +++ b/test/libsolidity/semanticTests/modifiers/modifier_in_constructor_ice.sol @@ -1,7 +1,5 @@ // The IR of this contract used to throw contract A { modifier m1{_;} } contract B is A { constructor() A() m1{} } -// ==== -// compileToEwasm: also // ---- // constructor() -> diff --git a/test/libsolidity/semanticTests/modifiers/modifier_init_return.sol b/test/libsolidity/semanticTests/modifiers/modifier_init_return.sol index df4fa914c6c4..d4c72e1632d4 100644 --- a/test/libsolidity/semanticTests/modifiers/modifier_init_return.sol +++ b/test/libsolidity/semanticTests/modifiers/modifier_init_return.sol @@ -7,9 +7,6 @@ contract C { r[2] = 3; } } - -// ==== -// compileToEwasm: also // ---- // f(uint256): 9 -> 0x00, 0x00, 0x00, 0x00, 0x00 // f(uint256): 10 -> 0x00, 0x00, 3, 0x00, 0x00 diff --git a/test/libsolidity/semanticTests/modifiers/modifiers_in_construction_context.sol b/test/libsolidity/semanticTests/modifiers/modifiers_in_construction_context.sol index 3f2b4ebea144..30cce5a79d79 100644 --- a/test/libsolidity/semanticTests/modifiers/modifiers_in_construction_context.sol +++ b/test/libsolidity/semanticTests/modifiers/modifiers_in_construction_context.sol @@ -7,7 +7,5 @@ contract B is A { modifier m2 { _; } constructor() A() m1 m2 { } } -// ==== -// compileToEwasm: also // ---- // constructor() -> diff --git a/test/libsolidity/semanticTests/modifiers/return_does_not_skip_modifier.sol b/test/libsolidity/semanticTests/modifiers/return_does_not_skip_modifier.sol index 1d71e5ac97a5..0d9bbfe32b2a 100644 --- a/test/libsolidity/semanticTests/modifiers/return_does_not_skip_modifier.sol +++ b/test/libsolidity/semanticTests/modifiers/return_does_not_skip_modifier.sol @@ -9,9 +9,6 @@ contract C { return 2; } } - -// ==== -// compileToEwasm: also // ---- // x() -> 0 // f() -> 2 diff --git a/test/libsolidity/semanticTests/modifiers/return_in_modifier.sol b/test/libsolidity/semanticTests/modifiers/return_in_modifier.sol index ffc503ae2050..00e2bb32846c 100644 --- a/test/libsolidity/semanticTests/modifiers/return_in_modifier.sol +++ b/test/libsolidity/semanticTests/modifiers/return_in_modifier.sol @@ -13,9 +13,6 @@ contract C { x = t; } } - -// ==== -// compileToEwasm: also // ---- // x() -> 0 // f() -> diff --git a/test/libsolidity/semanticTests/modifiers/stacked_return_with_modifiers.sol b/test/libsolidity/semanticTests/modifiers/stacked_return_with_modifiers.sol index a9b6bfa6c135..616a2183c02d 100644 --- a/test/libsolidity/semanticTests/modifiers/stacked_return_with_modifiers.sol +++ b/test/libsolidity/semanticTests/modifiers/stacked_return_with_modifiers.sol @@ -15,8 +15,6 @@ contract C { } } } -// ==== -// compileToEwasm: also // ---- // x() -> 0 // f() -> 42 diff --git a/test/libsolidity/semanticTests/multiSource/circular_import.sol b/test/libsolidity/semanticTests/multiSource/circular_import.sol index 15d75fde50cc..4c4ba4b28ae3 100644 --- a/test/libsolidity/semanticTests/multiSource/circular_import.sol +++ b/test/libsolidity/semanticTests/multiSource/circular_import.sol @@ -9,7 +9,5 @@ contract C { return f() - g(); } } -// ==== -// compileToEwasm: also // ---- // foo() -> 1 diff --git a/test/libsolidity/semanticTests/multiSource/circular_import_2.sol b/test/libsolidity/semanticTests/multiSource/circular_import_2.sol index de47c0380fec..639629372e93 100644 --- a/test/libsolidity/semanticTests/multiSource/circular_import_2.sol +++ b/test/libsolidity/semanticTests/multiSource/circular_import_2.sol @@ -10,7 +10,5 @@ contract C { return h() - f() - g(); } } -// ==== -// compileToEwasm: also // ---- // foo() -> 992 diff --git a/test/libsolidity/semanticTests/multiSource/circular_reimport.sol b/test/libsolidity/semanticTests/multiSource/circular_reimport.sol index 8b7fc32a594f..a866b0f547df 100644 --- a/test/libsolidity/semanticTests/multiSource/circular_reimport.sol +++ b/test/libsolidity/semanticTests/multiSource/circular_reimport.sol @@ -12,7 +12,5 @@ contract C { return f() - g() - h(); } } -// ==== -// compileToEwasm: also // ---- // foo() -> 0x60 diff --git a/test/libsolidity/semanticTests/multiSource/circular_reimport_2.sol b/test/libsolidity/semanticTests/multiSource/circular_reimport_2.sol index 3ae209daa8a4..3ff3a1a6029f 100644 --- a/test/libsolidity/semanticTests/multiSource/circular_reimport_2.sol +++ b/test/libsolidity/semanticTests/multiSource/circular_reimport_2.sol @@ -12,7 +12,5 @@ contract C { return 10000 + f() - g() - h(); } } -// ==== -// compileToEwasm: also // ---- // foo() -> 0x2324 diff --git a/test/libsolidity/semanticTests/multiSource/free_different_interger_types.sol b/test/libsolidity/semanticTests/multiSource/free_different_interger_types.sol index 5c428636681e..a103ef071afd 100644 --- a/test/libsolidity/semanticTests/multiSource/free_different_interger_types.sol +++ b/test/libsolidity/semanticTests/multiSource/free_different_interger_types.sol @@ -8,7 +8,5 @@ contract C { return (g(2), g(false)); } } -// ==== -// compileToEwasm: also // ---- // foo() -> 24, true diff --git a/test/libsolidity/semanticTests/multiSource/free_function_resolution_base_contract.sol b/test/libsolidity/semanticTests/multiSource/free_function_resolution_base_contract.sol index 4e91d42fb434..321e16ae32b1 100644 --- a/test/libsolidity/semanticTests/multiSource/free_function_resolution_base_contract.sol +++ b/test/libsolidity/semanticTests/multiSource/free_function_resolution_base_contract.sol @@ -12,7 +12,5 @@ contract D is C { return g(); } } -// ==== -// compileToEwasm: also // ---- // h() -> 1337 diff --git a/test/libsolidity/semanticTests/multiSource/free_function_resolution_override_virtual.sol b/test/libsolidity/semanticTests/multiSource/free_function_resolution_override_virtual.sol index 6df3631a769b..f111273d8f58 100644 --- a/test/libsolidity/semanticTests/multiSource/free_function_resolution_override_virtual.sol +++ b/test/libsolidity/semanticTests/multiSource/free_function_resolution_override_virtual.sol @@ -12,7 +12,5 @@ contract D is C { return f(); } } -// ==== -// compileToEwasm: also // ---- // g() -> 1337 diff --git a/test/libsolidity/semanticTests/multiSource/free_function_resolution_override_virtual_super.sol b/test/libsolidity/semanticTests/multiSource/free_function_resolution_override_virtual_super.sol index 71fed293ba6f..ae802d7c0a37 100644 --- a/test/libsolidity/semanticTests/multiSource/free_function_resolution_override_virtual_super.sol +++ b/test/libsolidity/semanticTests/multiSource/free_function_resolution_override_virtual_super.sol @@ -12,7 +12,5 @@ contract D is C { return super.g(); } } -// ==== -// compileToEwasm: also // ---- // g() -> 1337 diff --git a/test/libsolidity/semanticTests/multiSource/free_function_resolution_override_virtual_transitive.sol b/test/libsolidity/semanticTests/multiSource/free_function_resolution_override_virtual_transitive.sol index e31fdfa3db5a..71723f0fa5b3 100644 --- a/test/libsolidity/semanticTests/multiSource/free_function_resolution_override_virtual_transitive.sol +++ b/test/libsolidity/semanticTests/multiSource/free_function_resolution_override_virtual_transitive.sol @@ -19,7 +19,5 @@ contract E is D { return super.g() + 1; } } -// ==== -// compileToEwasm: also // ---- // g() -> 1339 diff --git a/test/libsolidity/semanticTests/multiSource/free_function_transitive_import.sol b/test/libsolidity/semanticTests/multiSource/free_function_transitive_import.sol index 585ef8986d9f..dec4c3f29e99 100644 --- a/test/libsolidity/semanticTests/multiSource/free_function_transitive_import.sol +++ b/test/libsolidity/semanticTests/multiSource/free_function_transitive_import.sol @@ -20,8 +20,5 @@ contract E is D { return f(); } } - -// ==== -// compileToEwasm: also // ---- // i() -> 1337 diff --git a/test/libsolidity/semanticTests/multiSource/import.sol b/test/libsolidity/semanticTests/multiSource/import.sol index bcaf6f290638..2a0f43d53978 100644 --- a/test/libsolidity/semanticTests/multiSource/import.sol +++ b/test/libsolidity/semanticTests/multiSource/import.sol @@ -7,8 +7,6 @@ import "A"; contract B is A { function f(uint256 x) public view returns(uint256) { return x; } } -// ==== -// compileToEwasm: also // ---- // f(uint256): 1337 -> 1337 // g(uint256): 1337 -> 1338 diff --git a/test/libsolidity/semanticTests/multiSource/imported_free_function_via_alias.sol b/test/libsolidity/semanticTests/multiSource/imported_free_function_via_alias.sol index f980805ed9f6..c57693674535 100644 --- a/test/libsolidity/semanticTests/multiSource/imported_free_function_via_alias.sol +++ b/test/libsolidity/semanticTests/multiSource/imported_free_function_via_alias.sol @@ -13,7 +13,5 @@ contract D is M.C { return super.g() + f() * 10000; } } -// ==== -// compileToEwasm: also // ---- // g() -> 61337 diff --git a/test/libsolidity/semanticTests/multiSource/imported_free_function_via_alias_direct_call.sol b/test/libsolidity/semanticTests/multiSource/imported_free_function_via_alias_direct_call.sol index 5188f0e4a3b6..a5f43f8b1c7a 100644 --- a/test/libsolidity/semanticTests/multiSource/imported_free_function_via_alias_direct_call.sol +++ b/test/libsolidity/semanticTests/multiSource/imported_free_function_via_alias_direct_call.sol @@ -8,7 +8,5 @@ contract D { return g() + f() * 10000; } } -// ==== -// compileToEwasm: also // ---- // h() -> 61337 diff --git a/test/libsolidity/semanticTests/multiSource/reimport_imported_function.sol b/test/libsolidity/semanticTests/multiSource/reimport_imported_function.sol index a31b438ff8ee..02b4821433f4 100644 --- a/test/libsolidity/semanticTests/multiSource/reimport_imported_function.sol +++ b/test/libsolidity/semanticTests/multiSource/reimport_imported_function.sol @@ -9,7 +9,5 @@ contract C { return h(); } } -// ==== -// compileToEwasm: also // ---- // foo() -> 1337 diff --git a/test/libsolidity/semanticTests/operators/compound_assign.sol b/test/libsolidity/semanticTests/operators/compound_assign.sol index 6ede4522d443..ed91f3b6c586 100644 --- a/test/libsolidity/semanticTests/operators/compound_assign.sol +++ b/test/libsolidity/semanticTests/operators/compound_assign.sol @@ -9,8 +9,6 @@ contract test { return value2 += 7; } } -// ==== -// compileToEwasm: also // ---- // f(uint256,uint256): 0, 6 -> 7 // f(uint256,uint256): 1, 3 -> 0x23 diff --git a/test/libsolidity/semanticTests/operators/shifts/shift_bytes_cleanup_viaYul.sol b/test/libsolidity/semanticTests/operators/shifts/shift_bytes_cleanup_viaYul.sol index 68a370454504..36b6e8b59375 100644 --- a/test/libsolidity/semanticTests/operators/shifts/shift_bytes_cleanup_viaYul.sol +++ b/test/libsolidity/semanticTests/operators/shifts/shift_bytes_cleanup_viaYul.sol @@ -13,7 +13,6 @@ contract C { } } // ==== -// compileToEwasm: also // compileViaYul: true // ---- // l(uint8): 64 -> 0x3930313233343536373839300000000000000000000000000000000000000000 diff --git a/test/libsolidity/semanticTests/operators/shifts/shift_cleanup.sol b/test/libsolidity/semanticTests/operators/shifts/shift_cleanup.sol index 9f13f4bdce84..0adc5ae55641 100644 --- a/test/libsolidity/semanticTests/operators/shifts/shift_cleanup.sol +++ b/test/libsolidity/semanticTests/operators/shifts/shift_cleanup.sol @@ -8,8 +8,5 @@ contract C { } } } - -// ==== -// compileToEwasm: also // ---- // f() -> 0x0 diff --git a/test/libsolidity/semanticTests/operators/shifts/shift_cleanup_garbled.sol b/test/libsolidity/semanticTests/operators/shifts/shift_cleanup_garbled.sol index 560def3b4e87..452884f26340 100644 --- a/test/libsolidity/semanticTests/operators/shifts/shift_cleanup_garbled.sol +++ b/test/libsolidity/semanticTests/operators/shifts/shift_cleanup_garbled.sol @@ -6,8 +6,5 @@ contract C { x >>= 8; } } - -// ==== -// compileToEwasm: also // ---- // f() -> 0x0 diff --git a/test/libsolidity/semanticTests/operators/shifts/shift_constant_left.sol b/test/libsolidity/semanticTests/operators/shifts/shift_constant_left.sol index 1af4930060f0..bc0c9f48445a 100644 --- a/test/libsolidity/semanticTests/operators/shifts/shift_constant_left.sol +++ b/test/libsolidity/semanticTests/operators/shifts/shift_constant_left.sol @@ -1,7 +1,5 @@ contract C { uint256 public a = 0x42 << 8; } -// ==== -// compileToEwasm: also // ---- // a() -> 0x4200 diff --git a/test/libsolidity/semanticTests/operators/shifts/shift_constant_left_assignment.sol b/test/libsolidity/semanticTests/operators/shifts/shift_constant_left_assignment.sol index aa75ca487882..3d245e9bf325 100644 --- a/test/libsolidity/semanticTests/operators/shifts/shift_constant_left_assignment.sol +++ b/test/libsolidity/semanticTests/operators/shifts/shift_constant_left_assignment.sol @@ -4,8 +4,5 @@ contract C { a <<= 8; } } - -// ==== -// compileToEwasm: also // ---- // f() -> 0x4200 diff --git a/test/libsolidity/semanticTests/operators/shifts/shift_constant_right.sol b/test/libsolidity/semanticTests/operators/shifts/shift_constant_right.sol index c39407215537..64403475093a 100644 --- a/test/libsolidity/semanticTests/operators/shifts/shift_constant_right.sol +++ b/test/libsolidity/semanticTests/operators/shifts/shift_constant_right.sol @@ -1,7 +1,5 @@ contract C { uint256 public a = 0x4200 >> 8; } -// ==== -// compileToEwasm: also // ---- // a() -> 0x42 diff --git a/test/libsolidity/semanticTests/operators/shifts/shift_constant_right_assignment.sol b/test/libsolidity/semanticTests/operators/shifts/shift_constant_right_assignment.sol index 0a959aa11b0c..ded331a79491 100644 --- a/test/libsolidity/semanticTests/operators/shifts/shift_constant_right_assignment.sol +++ b/test/libsolidity/semanticTests/operators/shifts/shift_constant_right_assignment.sol @@ -4,8 +4,5 @@ contract C { a >>= 8; } } - -// ==== -// compileToEwasm: also // ---- // f() -> 0x42 diff --git a/test/libsolidity/semanticTests/operators/shifts/shift_left.sol b/test/libsolidity/semanticTests/operators/shifts/shift_left.sol index 058d233e906c..47afab5ec1f8 100644 --- a/test/libsolidity/semanticTests/operators/shifts/shift_left.sol +++ b/test/libsolidity/semanticTests/operators/shifts/shift_left.sol @@ -3,9 +3,6 @@ contract C { return a << b; } } - -// ==== -// compileToEwasm: also // ---- // f(uint256,uint256): 0x4266, 0x0 -> 0x4266 // f(uint256,uint256): 0x4266, 0x8 -> 0x426600 diff --git a/test/libsolidity/semanticTests/operators/shifts/shift_left_assignment.sol b/test/libsolidity/semanticTests/operators/shifts/shift_left_assignment.sol index 55883ddaef24..afa82c6f7920 100644 --- a/test/libsolidity/semanticTests/operators/shifts/shift_left_assignment.sol +++ b/test/libsolidity/semanticTests/operators/shifts/shift_left_assignment.sol @@ -4,9 +4,6 @@ contract C { return a; } } - -// ==== -// compileToEwasm: also // ---- // f(uint256,uint256): 0x4266, 0x0 -> 0x4266 // f(uint256,uint256): 0x4266, 0x8 -> 0x426600 diff --git a/test/libsolidity/semanticTests/operators/shifts/shift_left_assignment_different_type.sol b/test/libsolidity/semanticTests/operators/shifts/shift_left_assignment_different_type.sol index 2242d2a16836..44fd4a924a1b 100644 --- a/test/libsolidity/semanticTests/operators/shifts/shift_left_assignment_different_type.sol +++ b/test/libsolidity/semanticTests/operators/shifts/shift_left_assignment_different_type.sol @@ -4,9 +4,6 @@ contract C { return a; } } - -// ==== -// compileToEwasm: also // ---- // f(uint256,uint8): 0x4266, 0x0 -> 0x4266 // f(uint256,uint8): 0x4266, 0x8 -> 0x426600 diff --git a/test/libsolidity/semanticTests/operators/shifts/shift_left_larger_type.sol b/test/libsolidity/semanticTests/operators/shifts/shift_left_larger_type.sol index a1c3fc4cfca0..3d6d7c7e2b9c 100644 --- a/test/libsolidity/semanticTests/operators/shifts/shift_left_larger_type.sol +++ b/test/libsolidity/semanticTests/operators/shifts/shift_left_larger_type.sol @@ -6,7 +6,5 @@ contract C { return y << x; } } -// ==== -// compileToEwasm: also // ---- // f() -> 0 diff --git a/test/libsolidity/semanticTests/operators/shifts/shift_left_uint32.sol b/test/libsolidity/semanticTests/operators/shifts/shift_left_uint32.sol index 6a208e9fc0e7..d66e2f4cbf74 100644 --- a/test/libsolidity/semanticTests/operators/shifts/shift_left_uint32.sol +++ b/test/libsolidity/semanticTests/operators/shifts/shift_left_uint32.sol @@ -3,9 +3,6 @@ contract C { return a << b; } } - -// ==== -// compileToEwasm: also // ---- // f(uint32,uint32): 0x4266, 0x0 -> 0x4266 // f(uint32,uint32): 0x4266, 0x8 -> 0x426600 diff --git a/test/libsolidity/semanticTests/operators/shifts/shift_left_uint8.sol b/test/libsolidity/semanticTests/operators/shifts/shift_left_uint8.sol index f9517fb618c7..d6d6d77bb163 100644 --- a/test/libsolidity/semanticTests/operators/shifts/shift_left_uint8.sol +++ b/test/libsolidity/semanticTests/operators/shifts/shift_left_uint8.sol @@ -3,9 +3,6 @@ contract C { return a << b; } } - -// ==== -// compileToEwasm: also // ---- // f(uint8,uint8): 0x66, 0x0 -> 0x66 // f(uint8,uint8): 0x66, 0x8 -> 0 diff --git a/test/libsolidity/semanticTests/operators/shifts/shift_negative_constant_left.sol b/test/libsolidity/semanticTests/operators/shifts/shift_negative_constant_left.sol index e303e73eac8d..7671ce19de6e 100644 --- a/test/libsolidity/semanticTests/operators/shifts/shift_negative_constant_left.sol +++ b/test/libsolidity/semanticTests/operators/shifts/shift_negative_constant_left.sol @@ -1,7 +1,5 @@ contract C { int256 public a = -0x42 << 8; } -// ==== -// compileToEwasm: also // ---- // a() -> -16896 diff --git a/test/libsolidity/semanticTests/operators/shifts/shift_negative_constant_right.sol b/test/libsolidity/semanticTests/operators/shifts/shift_negative_constant_right.sol index 32ae16edcd8b..e9a76d2c94ba 100644 --- a/test/libsolidity/semanticTests/operators/shifts/shift_negative_constant_right.sol +++ b/test/libsolidity/semanticTests/operators/shifts/shift_negative_constant_right.sol @@ -1,7 +1,5 @@ contract C { int256 public a = -0x4200 >> 8; } -// ==== -// compileToEwasm: also // ---- // a() -> -66 diff --git a/test/libsolidity/semanticTests/operators/shifts/shift_overflow.sol b/test/libsolidity/semanticTests/operators/shifts/shift_overflow.sol index 3e63bc8eba51..5b0491b36728 100644 --- a/test/libsolidity/semanticTests/operators/shifts/shift_overflow.sol +++ b/test/libsolidity/semanticTests/operators/shifts/shift_overflow.sol @@ -7,9 +7,6 @@ contract C { return x << y; } } - -// ==== -// compileToEwasm: also // ---- // leftU(uint8,uint8): 255, 8 -> 0 // leftU(uint8,uint8): 255, 1 -> 254 diff --git a/test/libsolidity/semanticTests/operators/shifts/shift_right.sol b/test/libsolidity/semanticTests/operators/shifts/shift_right.sol index 97ca0a5c437e..4947b21d45a6 100644 --- a/test/libsolidity/semanticTests/operators/shifts/shift_right.sol +++ b/test/libsolidity/semanticTests/operators/shifts/shift_right.sol @@ -3,9 +3,6 @@ contract C { return a >> b; } } - -// ==== -// compileToEwasm: also // ---- // f(uint256,uint256): 0x4266, 0x0 -> 0x4266 // f(uint256,uint256): 0x4266, 0x8 -> 0x42 diff --git a/test/libsolidity/semanticTests/operators/shifts/shift_right_assignment.sol b/test/libsolidity/semanticTests/operators/shifts/shift_right_assignment.sol index b427210843e8..f9206b092f4b 100644 --- a/test/libsolidity/semanticTests/operators/shifts/shift_right_assignment.sol +++ b/test/libsolidity/semanticTests/operators/shifts/shift_right_assignment.sol @@ -4,9 +4,6 @@ contract C { return a; } } - -// ==== -// compileToEwasm: also // ---- // f(uint256,uint256): 0x4266, 0x0 -> 0x4266 // f(uint256,uint256): 0x4266, 0x8 -> 0x42 diff --git a/test/libsolidity/semanticTests/operators/shifts/shift_right_garbled_signed_v2.sol b/test/libsolidity/semanticTests/operators/shifts/shift_right_garbled_signed_v2.sol index c7fa354955c6..2b1afb52be25 100644 --- a/test/libsolidity/semanticTests/operators/shifts/shift_right_garbled_signed_v2.sol +++ b/test/libsolidity/semanticTests/operators/shifts/shift_right_garbled_signed_v2.sol @@ -18,8 +18,6 @@ contract C { return a >> b; } } -// ==== -// compileToEwasm: also // ---- // f(int8,uint8): 0x00, 0x03 -> 0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe // f(int8,uint8): 0x00, 0x04 -> 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff diff --git a/test/libsolidity/semanticTests/operators/shifts/shift_right_garbled_v2.sol b/test/libsolidity/semanticTests/operators/shifts/shift_right_garbled_v2.sol index ecb51e902a9a..8cf89f4b0039 100644 --- a/test/libsolidity/semanticTests/operators/shifts/shift_right_garbled_v2.sol +++ b/test/libsolidity/semanticTests/operators/shifts/shift_right_garbled_v2.sol @@ -10,8 +10,6 @@ contract C { return a >> b; } } -// ==== -// compileToEwasm: also // ---- // f(uint8,uint8): 0x00, 0x04 -> 0x0f // f(uint8,uint8): 0x00, 0x1004 -> FAILURE diff --git a/test/libsolidity/semanticTests/operators/shifts/shift_right_negative_literal.sol b/test/libsolidity/semanticTests/operators/shifts/shift_right_negative_literal.sol index 630f4905ea24..e24118afe130 100644 --- a/test/libsolidity/semanticTests/operators/shifts/shift_right_negative_literal.sol +++ b/test/libsolidity/semanticTests/operators/shifts/shift_right_negative_literal.sol @@ -47,9 +47,6 @@ contract C { return (-4267 >> 17) == -1; } } - -// ==== -// compileToEwasm: also // ---- // f1() -> true // f2() -> true diff --git a/test/libsolidity/semanticTests/operators/shifts/shift_right_negative_lvalue.sol b/test/libsolidity/semanticTests/operators/shifts/shift_right_negative_lvalue.sol index 6d2f7ae5823b..5dcde06f2bc1 100644 --- a/test/libsolidity/semanticTests/operators/shifts/shift_right_negative_lvalue.sol +++ b/test/libsolidity/semanticTests/operators/shifts/shift_right_negative_lvalue.sol @@ -3,9 +3,6 @@ contract C { return a >> b; } } - -// ==== -// compileToEwasm: also // ---- // f(int256,uint256): -4266, 0 -> -4266 // f(int256,uint256): -4266, 1 -> -2133 diff --git a/test/libsolidity/semanticTests/operators/shifts/shift_right_negative_lvalue_assignment.sol b/test/libsolidity/semanticTests/operators/shifts/shift_right_negative_lvalue_assignment.sol index 74b704f48ec0..00ac9662e829 100644 --- a/test/libsolidity/semanticTests/operators/shifts/shift_right_negative_lvalue_assignment.sol +++ b/test/libsolidity/semanticTests/operators/shifts/shift_right_negative_lvalue_assignment.sol @@ -4,9 +4,6 @@ contract C { return a; } } - -// ==== -// compileToEwasm: also // ---- // f(int256,uint256): -4266, 0 -> -4266 // f(int256,uint256): -4266, 1 -> -2133 diff --git a/test/libsolidity/semanticTests/operators/shifts/shift_right_negative_lvalue_int16.sol b/test/libsolidity/semanticTests/operators/shifts/shift_right_negative_lvalue_int16.sol index 533c93bc9212..50612a6f306d 100644 --- a/test/libsolidity/semanticTests/operators/shifts/shift_right_negative_lvalue_int16.sol +++ b/test/libsolidity/semanticTests/operators/shifts/shift_right_negative_lvalue_int16.sol @@ -3,9 +3,6 @@ contract C { return a >> b; } } - -// ==== -// compileToEwasm: also // ---- // f(int16,uint16): -4266, 0 -> -4266 // f(int16,uint16): -4266, 1 -> -2133 diff --git a/test/libsolidity/semanticTests/operators/shifts/shift_right_negative_lvalue_int32.sol b/test/libsolidity/semanticTests/operators/shifts/shift_right_negative_lvalue_int32.sol index 3dc12b2230a9..024eb3254624 100644 --- a/test/libsolidity/semanticTests/operators/shifts/shift_right_negative_lvalue_int32.sol +++ b/test/libsolidity/semanticTests/operators/shifts/shift_right_negative_lvalue_int32.sol @@ -3,9 +3,6 @@ contract C { return a >> b; } } - -// ==== -// compileToEwasm: also // ---- // f(int32,uint32): -4266, 0 -> -4266 // f(int32,uint32): -4266, 1 -> -2133 diff --git a/test/libsolidity/semanticTests/operators/shifts/shift_right_negative_lvalue_int8.sol b/test/libsolidity/semanticTests/operators/shifts/shift_right_negative_lvalue_int8.sol index f6dda7059775..9cff6c3b5249 100644 --- a/test/libsolidity/semanticTests/operators/shifts/shift_right_negative_lvalue_int8.sol +++ b/test/libsolidity/semanticTests/operators/shifts/shift_right_negative_lvalue_int8.sol @@ -3,9 +3,6 @@ contract C { return a >> b; } } - -// ==== -// compileToEwasm: also // ---- // f(int8,uint8): -66, 0 -> -66 // f(int8,uint8): -66, 1 -> -33 diff --git a/test/libsolidity/semanticTests/operators/shifts/shift_right_negative_lvalue_signextend_int16_v2.sol b/test/libsolidity/semanticTests/operators/shifts/shift_right_negative_lvalue_signextend_int16_v2.sol index d81e00fd52da..f2c024483015 100644 --- a/test/libsolidity/semanticTests/operators/shifts/shift_right_negative_lvalue_signextend_int16_v2.sol +++ b/test/libsolidity/semanticTests/operators/shifts/shift_right_negative_lvalue_signextend_int16_v2.sol @@ -6,8 +6,6 @@ contract C { return a >> b; } } -// ==== -// compileToEwasm: also // ---- // f(int16,uint16): 0xff99, 0x00 -> FAILURE // f(int16,uint16): 0xff99, 0x01 -> FAILURE diff --git a/test/libsolidity/semanticTests/operators/shifts/shift_right_negative_lvalue_signextend_int32_v2.sol b/test/libsolidity/semanticTests/operators/shifts/shift_right_negative_lvalue_signextend_int32_v2.sol index cac3a53b6c59..9c3090a783a9 100644 --- a/test/libsolidity/semanticTests/operators/shifts/shift_right_negative_lvalue_signextend_int32_v2.sol +++ b/test/libsolidity/semanticTests/operators/shifts/shift_right_negative_lvalue_signextend_int32_v2.sol @@ -6,8 +6,6 @@ contract C { return a >> b; } } -// ==== -// compileToEwasm: also // ---- // f(int32,uint32): 0xffffff99, 0x00 -> FAILURE // f(int32,uint32): 0xffffff99, 0x01 -> FAILURE diff --git a/test/libsolidity/semanticTests/operators/shifts/shift_right_negative_lvalue_signextend_int8_v2.sol b/test/libsolidity/semanticTests/operators/shifts/shift_right_negative_lvalue_signextend_int8_v2.sol index 0fe10c9379fc..8d3cec4e31e3 100644 --- a/test/libsolidity/semanticTests/operators/shifts/shift_right_negative_lvalue_signextend_int8_v2.sol +++ b/test/libsolidity/semanticTests/operators/shifts/shift_right_negative_lvalue_signextend_int8_v2.sol @@ -6,8 +6,6 @@ contract C { return a >> b; } } -// ==== -// compileToEwasm: also // ---- // f(int8,uint8): 0x99, 0x00 -> FAILURE // f(int8,uint8): 0x99, 0x01 -> FAILURE diff --git a/test/libsolidity/semanticTests/operators/shifts/shift_right_uint32.sol b/test/libsolidity/semanticTests/operators/shifts/shift_right_uint32.sol index a5d1ed51cf8a..2619ea334d51 100644 --- a/test/libsolidity/semanticTests/operators/shifts/shift_right_uint32.sol +++ b/test/libsolidity/semanticTests/operators/shifts/shift_right_uint32.sol @@ -3,9 +3,6 @@ contract C { return a >> b; } } - -// ==== -// compileToEwasm: also // ---- // f(uint32,uint32): 0x4266, 0x0 -> 0x4266 // f(uint32,uint32): 0x4266, 0x8 -> 0x42 diff --git a/test/libsolidity/semanticTests/operators/shifts/shift_right_uint8.sol b/test/libsolidity/semanticTests/operators/shifts/shift_right_uint8.sol index 7ac59b3fc6d8..1792d8755193 100644 --- a/test/libsolidity/semanticTests/operators/shifts/shift_right_uint8.sol +++ b/test/libsolidity/semanticTests/operators/shifts/shift_right_uint8.sol @@ -3,9 +3,6 @@ contract C { return a >> b; } } - -// ==== -// compileToEwasm: also // ---- // f(uint8,uint8): 0x66, 0x0 -> 0x66 // f(uint8,uint8): 0x66, 0x8 -> 0x0 diff --git a/test/libsolidity/semanticTests/operators/shifts/shift_underflow_negative_rvalue.sol b/test/libsolidity/semanticTests/operators/shifts/shift_underflow_negative_rvalue.sol index 111357e9ee81..6f4f95e919f3 100644 --- a/test/libsolidity/semanticTests/operators/shifts/shift_underflow_negative_rvalue.sol +++ b/test/libsolidity/semanticTests/operators/shifts/shift_underflow_negative_rvalue.sol @@ -7,9 +7,6 @@ contract C { return a >> b; } } - -// ==== -// compileToEwasm: also // ---- // f(int256,uint256): 1, -1 -> 0 // g(int256,uint256): 1, -1 -> 0 diff --git a/test/libsolidity/semanticTests/operators/userDefined/unchecked_operators.sol b/test/libsolidity/semanticTests/operators/userDefined/unchecked_operators.sol index 684ea1b433ad..9f3fd5d4e4d1 100644 --- a/test/libsolidity/semanticTests/operators/userDefined/unchecked_operators.sol +++ b/test/libsolidity/semanticTests/operators/userDefined/unchecked_operators.sol @@ -19,7 +19,6 @@ contract D { } } } - // ---- // testUncheckedOperator() -> 4 // testUncheckedOperatorInUncheckedBlock() -> 4 diff --git a/test/libsolidity/semanticTests/optimizer/shift_bytes.sol b/test/libsolidity/semanticTests/optimizer/shift_bytes.sol index 49d693a777de..6c7eef895cf6 100644 --- a/test/libsolidity/semanticTests/optimizer/shift_bytes.sol +++ b/test/libsolidity/semanticTests/optimizer/shift_bytes.sol @@ -37,8 +37,6 @@ contract C { return (x, y, z); } } -// ==== -// compileToEwasm: also // ---- // f(uint256): 0x0102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f -> 0x1f, 0x1f, 3 // g(uint256): 0x0102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f -> 1, 3, 5 diff --git a/test/libsolidity/semanticTests/payable/no_nonpayable_circumvention_by_modifier.sol b/test/libsolidity/semanticTests/payable/no_nonpayable_circumvention_by_modifier.sol index 4c6557cd7a6f..c36095914363 100644 --- a/test/libsolidity/semanticTests/payable/no_nonpayable_circumvention_by_modifier.sol +++ b/test/libsolidity/semanticTests/payable/no_nonpayable_circumvention_by_modifier.sol @@ -9,8 +9,6 @@ contract C { return msg.value; } } -// ==== -// compileToEwasm: also // ---- // f(), 27 wei -> FAILURE // balance -> 0 diff --git a/test/libsolidity/semanticTests/receive/empty_calldata_calls_receive.sol b/test/libsolidity/semanticTests/receive/empty_calldata_calls_receive.sol index 1be435ff689f..ce04cd73745b 100644 --- a/test/libsolidity/semanticTests/receive/empty_calldata_calls_receive.sol +++ b/test/libsolidity/semanticTests/receive/empty_calldata_calls_receive.sol @@ -2,8 +2,6 @@ contract A { uint public x; receive () external payable { ++x; } } -// ==== -// compileToEwasm: also // ---- // x() -> 0 // () diff --git a/test/libsolidity/semanticTests/receive/ether_and_data.sol b/test/libsolidity/semanticTests/receive/ether_and_data.sol index df3c89884b5a..4c48df8d47ad 100644 --- a/test/libsolidity/semanticTests/receive/ether_and_data.sol +++ b/test/libsolidity/semanticTests/receive/ether_and_data.sol @@ -1,8 +1,6 @@ contract C { receive () payable external { } } -// ==== -// compileToEwasm: also // ---- // (), 1 ether // (), 1 ether: 1 -> FAILURE diff --git a/test/libsolidity/semanticTests/receive/inherited.sol b/test/libsolidity/semanticTests/receive/inherited.sol index 9ca685399fbf..36273068ac9b 100644 --- a/test/libsolidity/semanticTests/receive/inherited.sol +++ b/test/libsolidity/semanticTests/receive/inherited.sol @@ -4,8 +4,6 @@ contract A { function getData() public returns (uint r) { return data; } } contract B is A {} -// ==== -// compileToEwasm: also // ---- // getData() -> 0 // () -> diff --git a/test/libsolidity/semanticTests/reverts/assert_require.sol b/test/libsolidity/semanticTests/reverts/assert_require.sol index ee60fc192cdd..bc4db3602c72 100644 --- a/test/libsolidity/semanticTests/reverts/assert_require.sol +++ b/test/libsolidity/semanticTests/reverts/assert_require.sol @@ -13,9 +13,6 @@ contract C { return true; } } - -// ==== -// compileToEwasm: also // ---- // f() -> FAILURE, hex"4e487b71", 0x01 // g(bool): false -> FAILURE, hex"4e487b71", 0x01 diff --git a/test/libsolidity/semanticTests/reverts/error_struct.sol b/test/libsolidity/semanticTests/reverts/error_struct.sol index 4ca57bd6eeaf..d6171a416a8c 100644 --- a/test/libsolidity/semanticTests/reverts/error_struct.sol +++ b/test/libsolidity/semanticTests/reverts/error_struct.sol @@ -10,8 +10,6 @@ contract C { return _struct.error; } } -// ==== -// compileToEwasm: also // ---- // f() -> FAILURE, hex"f8a8fd6d" // g(uint256): 7 -> 7 diff --git a/test/libsolidity/semanticTests/reverts/invalid_enum_as_external_arg.sol b/test/libsolidity/semanticTests/reverts/invalid_enum_as_external_arg.sol index 1e3e34cb1a9a..28c4e01f9955 100644 --- a/test/libsolidity/semanticTests/reverts/invalid_enum_as_external_arg.sol +++ b/test/libsolidity/semanticTests/reverts/invalid_enum_as_external_arg.sol @@ -17,6 +17,5 @@ contract C { } // ==== // EVMVersion: >=byzantium -// compileToEwasm: also // ---- // test() -> FAILURE, hex"4e487b71", 0x21 # should throw # diff --git a/test/libsolidity/semanticTests/reverts/invalid_enum_as_external_ret.sol b/test/libsolidity/semanticTests/reverts/invalid_enum_as_external_ret.sol index 987931fa7d26..7416d295fc7c 100644 --- a/test/libsolidity/semanticTests/reverts/invalid_enum_as_external_ret.sol +++ b/test/libsolidity/semanticTests/reverts/invalid_enum_as_external_ret.sol @@ -23,10 +23,8 @@ contract C { _ret = tmp; } } - // ==== // EVMVersion: >=byzantium -// compileToEwasm: also // ---- // test_return() -> FAILURE, hex"4e487b71", 33 # both should throw # // test_inline_assignment() -> FAILURE, hex"4e487b71", 33 diff --git a/test/libsolidity/semanticTests/reverts/invalid_enum_compared.sol b/test/libsolidity/semanticTests/reverts/invalid_enum_compared.sol index afdbd20b6721..527a4320235d 100644 --- a/test/libsolidity/semanticTests/reverts/invalid_enum_compared.sol +++ b/test/libsolidity/semanticTests/reverts/invalid_enum_compared.sol @@ -24,7 +24,6 @@ contract C { } // ==== // EVMVersion: >=byzantium -// compileToEwasm: also // ---- // test_eq_ok() -> 1 // test_eq() -> FAILURE, hex"4e487b71", 33 # both should throw # diff --git a/test/libsolidity/semanticTests/reverts/invalid_enum_stored.sol b/test/libsolidity/semanticTests/reverts/invalid_enum_stored.sol index fdf5e6bbb17c..8049a977e746 100644 --- a/test/libsolidity/semanticTests/reverts/invalid_enum_stored.sol +++ b/test/libsolidity/semanticTests/reverts/invalid_enum_stored.sol @@ -18,7 +18,6 @@ contract C { } // ==== // EVMVersion: >=byzantium -// compileToEwasm: also // ---- // test_store_ok() -> 1 // x() -> 0 diff --git a/test/libsolidity/semanticTests/reverts/invalid_instruction.sol b/test/libsolidity/semanticTests/reverts/invalid_instruction.sol index f4f64a11e5bb..69d9a0cd3605 100644 --- a/test/libsolidity/semanticTests/reverts/invalid_instruction.sol +++ b/test/libsolidity/semanticTests/reverts/invalid_instruction.sol @@ -5,8 +5,5 @@ contract C { } } } - -// ==== -// compileToEwasm: also // ---- // f() -> FAILURE diff --git a/test/libsolidity/semanticTests/reverts/revert.sol b/test/libsolidity/semanticTests/reverts/revert.sol index cac02076d551..2d733b4e7db2 100644 --- a/test/libsolidity/semanticTests/reverts/revert.sol +++ b/test/libsolidity/semanticTests/reverts/revert.sol @@ -13,9 +13,6 @@ contract C { } } } - -// ==== -// compileToEwasm: also // ---- // f() -> FAILURE // a() -> 42 diff --git a/test/libsolidity/semanticTests/reverts/revert_return_area.sol b/test/libsolidity/semanticTests/reverts/revert_return_area.sol index fa8156b3000b..8ab4ca22722c 100644 --- a/test/libsolidity/semanticTests/reverts/revert_return_area.sol +++ b/test/libsolidity/semanticTests/reverts/revert_return_area.sol @@ -12,7 +12,6 @@ contract C { } } } - // ==== // EVMVersion: >=byzantium // ---- diff --git a/test/libsolidity/semanticTests/reverts/simple_throw.sol b/test/libsolidity/semanticTests/reverts/simple_throw.sol index 0d43c97e96f3..1c1bfee0b377 100644 --- a/test/libsolidity/semanticTests/reverts/simple_throw.sol +++ b/test/libsolidity/semanticTests/reverts/simple_throw.sol @@ -5,9 +5,6 @@ contract Test { return 2; } } - -// ==== -// compileToEwasm: also // ---- // f(uint256): 11 -> 21 // f(uint256): 1 -> FAILURE diff --git a/test/libsolidity/semanticTests/smoke/basic.sol b/test/libsolidity/semanticTests/smoke/basic.sol index 81e8bd829cb4..8f05c4262598 100644 --- a/test/libsolidity/semanticTests/smoke/basic.sol +++ b/test/libsolidity/semanticTests/smoke/basic.sol @@ -28,8 +28,6 @@ contract C { return a * 7; } } -// ==== -// compileToEwasm: also // ---- // d() -> // e(), 1 wei -> 1 diff --git a/test/libsolidity/semanticTests/smoke/failure.sol b/test/libsolidity/semanticTests/smoke/failure.sol index eeb82a3ce4da..14cf1e627304 100644 --- a/test/libsolidity/semanticTests/smoke/failure.sol +++ b/test/libsolidity/semanticTests/smoke/failure.sol @@ -16,7 +16,6 @@ contract C { // ==== // EVMVersion: >homestead // allowNonExistingFunctions: true -// compileToEwasm: also // ---- // _() -> FAILURE // e() -> FAILURE, hex"08c379a0", 0x20, 0x13, "Transaction failed." diff --git a/test/libsolidity/semanticTests/smoke/fallback.sol b/test/libsolidity/semanticTests/smoke/fallback.sol index 5a4f89d8437e..b0e515db3210 100644 --- a/test/libsolidity/semanticTests/smoke/fallback.sol +++ b/test/libsolidity/semanticTests/smoke/fallback.sol @@ -8,8 +8,6 @@ contract A { externalData = msg.data; } } -// ==== -// compileToEwasm: also // ---- // data() -> 0 // () diff --git a/test/libsolidity/semanticTests/smoke/multiline.sol b/test/libsolidity/semanticTests/smoke/multiline.sol index 97fbd5b3bee1..624b19473d36 100644 --- a/test/libsolidity/semanticTests/smoke/multiline.sol +++ b/test/libsolidity/semanticTests/smoke/multiline.sol @@ -5,7 +5,6 @@ contract C { } // ==== // allowNonExistingFunctions: true -// compileToEwasm: also // ---- // f(uint256,uint256,uint256,uint256,uint256): 1, 1, 1, 1, 1 // -> 5 diff --git a/test/libsolidity/semanticTests/smoke/multiline_comments.sol b/test/libsolidity/semanticTests/smoke/multiline_comments.sol index cdfe43f5ec23..17de40fc4dab 100644 --- a/test/libsolidity/semanticTests/smoke/multiline_comments.sol +++ b/test/libsolidity/semanticTests/smoke/multiline_comments.sol @@ -3,8 +3,6 @@ contract C { return a + b + c + d + e; } } -// ==== -// compileToEwasm: also // ---- // f(uint256,uint256,uint256,uint256,uint256): 1, 1, 1, 1, 1 // # A comment on the function parameters. # diff --git a/test/libsolidity/semanticTests/smoke/structs.sol b/test/libsolidity/semanticTests/smoke/structs.sol index 813d6954c0f2..d6df382c95b1 100644 --- a/test/libsolidity/semanticTests/smoke/structs.sol +++ b/test/libsolidity/semanticTests/smoke/structs.sol @@ -17,8 +17,6 @@ contract C { return T(23, 42, "any"); } } -// ==== -// compileToEwasm: also // ---- // s() -> 23, 42 // t() -> 0x20, 23, 42, 0x60, 3, "any" diff --git a/test/libsolidity/semanticTests/specialFunctions/abi_encode_with_signature_from_string.sol b/test/libsolidity/semanticTests/specialFunctions/abi_encode_with_signature_from_string.sol index f38eee42973c..80f734a31a1c 100644 --- a/test/libsolidity/semanticTests/specialFunctions/abi_encode_with_signature_from_string.sol +++ b/test/libsolidity/semanticTests/specialFunctions/abi_encode_with_signature_from_string.sol @@ -8,7 +8,5 @@ contract C { assert(r1[i] == r2[i]); } } -// ==== -// compileToEwasm: false // ---- // f() -> 0x40, 0xa0, 0x24, -813742827273327954027712588510533233455028711326166692885570228492575965184, 26959946667150639794667015087019630673637144422540572481103610249216, 0x24, -813742827273327954027712588510533233455028711326166692885570228492575965184, 26959946667150639794667015087019630673637144422540572481103610249216 diff --git a/test/libsolidity/semanticTests/specialFunctions/abi_functions_member_access.sol b/test/libsolidity/semanticTests/specialFunctions/abi_functions_member_access.sol index 4c46d1ea00d8..b255b1880b0e 100644 --- a/test/libsolidity/semanticTests/specialFunctions/abi_functions_member_access.sol +++ b/test/libsolidity/semanticTests/specialFunctions/abi_functions_member_access.sol @@ -7,7 +7,5 @@ contract C { abi.decode; } } -// ==== -// compileToEwasm: also // ---- // f() -> diff --git a/test/libsolidity/semanticTests/state/block_coinbase.sol b/test/libsolidity/semanticTests/state/block_coinbase.sol index 5087fe732369..e7aae2fc739a 100644 --- a/test/libsolidity/semanticTests/state/block_coinbase.sol +++ b/test/libsolidity/semanticTests/state/block_coinbase.sol @@ -3,8 +3,6 @@ contract C { return block.coinbase; } } -// ==== -// compileToEwasm: also // ---- // f() -> 0x7878787878787878787878787878787878787878 // f() -> 0x7878787878787878787878787878787878787878 diff --git a/test/libsolidity/semanticTests/state/block_difficulty.sol b/test/libsolidity/semanticTests/state/block_difficulty.sol index 4f6a6b08ff46..921200ddf26a 100644 --- a/test/libsolidity/semanticTests/state/block_difficulty.sol +++ b/test/libsolidity/semanticTests/state/block_difficulty.sol @@ -4,7 +4,6 @@ contract C { } } // ==== -// compileToEwasm: also // EVMVersion: 200000000 diff --git a/test/libsolidity/semanticTests/state/block_difficulty_post_paris.sol b/test/libsolidity/semanticTests/state/block_difficulty_post_paris.sol index 9fb467e6f5f1..226a8bbb8b4b 100644 --- a/test/libsolidity/semanticTests/state/block_difficulty_post_paris.sol +++ b/test/libsolidity/semanticTests/state/block_difficulty_post_paris.sol @@ -4,7 +4,6 @@ contract C { } } // ==== -// compileToEwasm: also // EVMVersion: >=paris // ---- // f() -> 0xa86c2e601b6c44eb4848f7d23d9df3113fbcac42041c49cbed5000cb4f118777 diff --git a/test/libsolidity/semanticTests/state/block_gaslimit.sol b/test/libsolidity/semanticTests/state/block_gaslimit.sol index 3ccc37543cb5..0201068b630b 100644 --- a/test/libsolidity/semanticTests/state/block_gaslimit.sol +++ b/test/libsolidity/semanticTests/state/block_gaslimit.sol @@ -3,8 +3,6 @@ contract C { return block.gaslimit; } } -// ==== -// compileToEwasm: also // ---- // f() -> 20000000 // f() -> 20000000 diff --git a/test/libsolidity/semanticTests/state/block_number.sol b/test/libsolidity/semanticTests/state/block_number.sol index a55c2a3cac22..01ec30966a3d 100644 --- a/test/libsolidity/semanticTests/state/block_number.sol +++ b/test/libsolidity/semanticTests/state/block_number.sol @@ -4,8 +4,6 @@ contract C { return block.number; } } -// ==== -// compileToEwasm: also // ---- // constructor() // f() -> 2 diff --git a/test/libsolidity/semanticTests/state/block_prevrandao.sol b/test/libsolidity/semanticTests/state/block_prevrandao.sol index 24d5f2af6350..590265da9fcd 100644 --- a/test/libsolidity/semanticTests/state/block_prevrandao.sol +++ b/test/libsolidity/semanticTests/state/block_prevrandao.sol @@ -4,7 +4,6 @@ contract C { } } // ==== -// compileToEwasm: also // EVMVersion: >=paris // ---- // f() -> 0xa86c2e601b6c44eb4848f7d23d9df3113fbcac42041c49cbed5000cb4f118777 diff --git a/test/libsolidity/semanticTests/state/block_prevrandao_pre_paris.sol b/test/libsolidity/semanticTests/state/block_prevrandao_pre_paris.sol index efc4d226f51d..6824cab5caff 100644 --- a/test/libsolidity/semanticTests/state/block_prevrandao_pre_paris.sol +++ b/test/libsolidity/semanticTests/state/block_prevrandao_pre_paris.sol @@ -4,7 +4,6 @@ contract C { } } // ==== -// compileToEwasm: also // EVMVersion: 200000000 diff --git a/test/libsolidity/semanticTests/state/block_timestamp.sol b/test/libsolidity/semanticTests/state/block_timestamp.sol index 84cfe3b9f461..485ae4be32cc 100644 --- a/test/libsolidity/semanticTests/state/block_timestamp.sol +++ b/test/libsolidity/semanticTests/state/block_timestamp.sol @@ -4,8 +4,6 @@ contract C { return block.timestamp; } } -// ==== -// compileToEwasm: also // ---- // constructor() # This is the 1st block # // f() -> 0x1e # This is the 2nd block (each block is "15 seconds") # diff --git a/test/libsolidity/semanticTests/state/gasleft.sol b/test/libsolidity/semanticTests/state/gasleft.sol index 9f50ef46dc3c..6ce623ce81ea 100644 --- a/test/libsolidity/semanticTests/state/gasleft.sol +++ b/test/libsolidity/semanticTests/state/gasleft.sol @@ -3,8 +3,6 @@ contract C { return gasleft() > 0; } } -// ==== -// compileToEwasm: also // ---- // f() -> true // f() -> true diff --git a/test/libsolidity/semanticTests/state/msg_sender.sol b/test/libsolidity/semanticTests/state/msg_sender.sol index eda4e5a059d0..951d1f529201 100644 --- a/test/libsolidity/semanticTests/state/msg_sender.sol +++ b/test/libsolidity/semanticTests/state/msg_sender.sol @@ -3,7 +3,5 @@ contract C { return msg.sender; } } -// ==== -// compileToEwasm: also // ---- // f() -> 0x1212121212121212121212121212120000000012 diff --git a/test/libsolidity/semanticTests/state/msg_sig.sol b/test/libsolidity/semanticTests/state/msg_sig.sol index 858ee98539ef..f2f26e24567f 100644 --- a/test/libsolidity/semanticTests/state/msg_sig.sol +++ b/test/libsolidity/semanticTests/state/msg_sig.sol @@ -6,8 +6,6 @@ contract C { return msg.sig; } } -// ==== -// compileToEwasm: also // ---- // f() -> 0x26121ff000000000000000000000000000000000000000000000000000000000 // g() -> 0xe2179b8e00000000000000000000000000000000000000000000000000000000 diff --git a/test/libsolidity/semanticTests/state/msg_value.sol b/test/libsolidity/semanticTests/state/msg_value.sol index 2d14d1d7b8a4..143183b865a3 100644 --- a/test/libsolidity/semanticTests/state/msg_value.sol +++ b/test/libsolidity/semanticTests/state/msg_value.sol @@ -3,8 +3,6 @@ contract C { return msg.value; } } -// ==== -// compileToEwasm: also // ---- // f() -> 0 // f(), 12 ether -> 12000000000000000000 diff --git a/test/libsolidity/semanticTests/state/tx_gasprice.sol b/test/libsolidity/semanticTests/state/tx_gasprice.sol index 59ddfbe5cfe4..0d6dc6ae9c42 100644 --- a/test/libsolidity/semanticTests/state/tx_gasprice.sol +++ b/test/libsolidity/semanticTests/state/tx_gasprice.sol @@ -3,8 +3,6 @@ contract C { return tx.gasprice; } } -// ==== -// compileToEwasm: also // ---- // f() -> 3000000000 // f() -> 3000000000 diff --git a/test/libsolidity/semanticTests/state/tx_origin.sol b/test/libsolidity/semanticTests/state/tx_origin.sol index 838353824384..aa726c355262 100644 --- a/test/libsolidity/semanticTests/state/tx_origin.sol +++ b/test/libsolidity/semanticTests/state/tx_origin.sol @@ -3,8 +3,6 @@ contract C { return tx.origin; } } -// ==== -// compileToEwasm: also // ---- // f() -> 0x9292929292929292929292929292929292929292 // f() -> 0x9292929292929292929292929292929292929292 diff --git a/test/libsolidity/semanticTests/state/uncalled_blockhash.sol b/test/libsolidity/semanticTests/state/uncalled_blockhash.sol index 02c55c7d332b..4e2526c72846 100644 --- a/test/libsolidity/semanticTests/state/uncalled_blockhash.sol +++ b/test/libsolidity/semanticTests/state/uncalled_blockhash.sol @@ -3,7 +3,5 @@ contract C { return (blockhash)(block.number - 1); } } -// ==== -// compileToEwasm: also // ---- // f() -> 0x3737373737373737373737373737373737373737373737373737373737373738 diff --git a/test/libsolidity/semanticTests/state_var_initialization.sol b/test/libsolidity/semanticTests/state_var_initialization.sol index 93b22bfa9137..a8b0f108a868 100644 --- a/test/libsolidity/semanticTests/state_var_initialization.sol +++ b/test/libsolidity/semanticTests/state_var_initialization.sol @@ -7,8 +7,6 @@ contract C { k = k - i; } } -// ==== -// compileToEwasm: also // ---- // i() -> 2 // k() -> 0 diff --git a/test/libsolidity/semanticTests/state_variables_init_order.sol b/test/libsolidity/semanticTests/state_variables_init_order.sol index b6ac20cd0e27..6f8a59c14d37 100644 --- a/test/libsolidity/semanticTests/state_variables_init_order.sol +++ b/test/libsolidity/semanticTests/state_variables_init_order.sol @@ -8,7 +8,5 @@ contract A { } contract B is A { } -// ==== -// compileToEwasm: also // ---- // x() -> 1 diff --git a/test/libsolidity/semanticTests/state_variables_init_order_2.sol b/test/libsolidity/semanticTests/state_variables_init_order_2.sol index 95c0b420077a..9003898e6129 100644 --- a/test/libsolidity/semanticTests/state_variables_init_order_2.sol +++ b/test/libsolidity/semanticTests/state_variables_init_order_2.sol @@ -12,7 +12,5 @@ contract B is A { z = x; } } -// ==== -// compileToEwasm: also // ---- // z() -> 1 diff --git a/test/libsolidity/semanticTests/statements/do_while_loop_continue.sol b/test/libsolidity/semanticTests/statements/do_while_loop_continue.sol index 761cc76bda2b..76f2bc4ae6e4 100644 --- a/test/libsolidity/semanticTests/statements/do_while_loop_continue.sol +++ b/test/libsolidity/semanticTests/statements/do_while_loop_continue.sol @@ -10,7 +10,5 @@ contract test { return 42; } } -// ==== -// compileToEwasm: also // ---- // f() -> 42 diff --git a/test/libsolidity/semanticTests/storage/packed_functions.sol b/test/libsolidity/semanticTests/storage/packed_functions.sol index 4a49a614f3b5..564a3fabf355 100644 --- a/test/libsolidity/semanticTests/storage/packed_functions.sol +++ b/test/libsolidity/semanticTests/storage/packed_functions.sol @@ -38,7 +38,6 @@ contract C { return 8; } } - // ---- // set() -> // t1() -> 7 diff --git a/test/libsolidity/semanticTests/storage/packed_storage_overflow.sol b/test/libsolidity/semanticTests/storage/packed_storage_overflow.sol index c10931f99ddb..af2ecc70c9d5 100644 --- a/test/libsolidity/semanticTests/storage/packed_storage_overflow.sol +++ b/test/libsolidity/semanticTests/storage/packed_storage_overflow.sol @@ -11,7 +11,5 @@ contract C { return (x, c, b, a); } } -// ==== -// compileToEwasm: also // ---- // f() -> 0x1234, 0x0, 0x0, 0xfffe diff --git a/test/libsolidity/semanticTests/storage/packed_storage_signed.sol b/test/libsolidity/semanticTests/storage/packed_storage_signed.sol index b457d0731b68..92cb82c90c6f 100644 --- a/test/libsolidity/semanticTests/storage/packed_storage_signed.sol +++ b/test/libsolidity/semanticTests/storage/packed_storage_signed.sol @@ -19,8 +19,5 @@ contract C { x4 = d; } } - -// ==== -// compileToEwasm: also // ---- // test() -> -2, 4, -112, 0 diff --git a/test/libsolidity/semanticTests/storage/packed_storage_structs_bytes.sol b/test/libsolidity/semanticTests/storage/packed_storage_structs_bytes.sol index a3131d564f2a..b1686d90748d 100644 --- a/test/libsolidity/semanticTests/storage/packed_storage_structs_bytes.sol +++ b/test/libsolidity/semanticTests/storage/packed_storage_structs_bytes.sol @@ -40,9 +40,6 @@ contract C { y == 0x07; } } - -// ==== -// compileToEwasm: also // ---- // test() -> true // gas irOptimized: 132505 diff --git a/test/libsolidity/semanticTests/storage/packed_storage_structs_enum.sol b/test/libsolidity/semanticTests/storage/packed_storage_structs_enum.sol index d9e897762d1f..cda71d33da9f 100644 --- a/test/libsolidity/semanticTests/storage/packed_storage_structs_enum.sol +++ b/test/libsolidity/semanticTests/storage/packed_storage_structs_enum.sol @@ -28,8 +28,5 @@ contract C { return 1; } } - -// ==== -// compileToEwasm: also // ---- // test() -> 1 diff --git a/test/libsolidity/semanticTests/storage/packed_storage_structs_uint.sol b/test/libsolidity/semanticTests/storage/packed_storage_structs_uint.sol index d01f07268534..ea3c03d64426 100644 --- a/test/libsolidity/semanticTests/storage/packed_storage_structs_uint.sol +++ b/test/libsolidity/semanticTests/storage/packed_storage_structs_uint.sol @@ -25,8 +25,5 @@ contract C { return 1; } } - -// ==== -// compileToEwasm: also // ---- // test() -> 1 diff --git a/test/libsolidity/semanticTests/storage/simple_accessor.sol b/test/libsolidity/semanticTests/storage/simple_accessor.sol index 72398d9abba5..7aaeb4dbb98c 100644 --- a/test/libsolidity/semanticTests/storage/simple_accessor.sol +++ b/test/libsolidity/semanticTests/storage/simple_accessor.sol @@ -4,7 +4,5 @@ contract test { data = 8; } } -// ==== -// compileToEwasm: also // ---- // data() -> 8 diff --git a/test/libsolidity/semanticTests/storage/state_smoke_test.sol b/test/libsolidity/semanticTests/storage/state_smoke_test.sol index 0bcdd1ad396d..1b464531b523 100644 --- a/test/libsolidity/semanticTests/storage/state_smoke_test.sol +++ b/test/libsolidity/semanticTests/storage/state_smoke_test.sol @@ -10,8 +10,6 @@ contract test { else value2 = value; } } -// ==== -// compileToEwasm: also // ---- // get(uint8): 0x00 -> 0 // get(uint8): 0x01 -> 0 diff --git a/test/libsolidity/semanticTests/strings/concat/string_concat_empty_argument_list.sol b/test/libsolidity/semanticTests/strings/concat/string_concat_empty_argument_list.sol index b5db79e8f245..0297bd26f125 100644 --- a/test/libsolidity/semanticTests/strings/concat/string_concat_empty_argument_list.sol +++ b/test/libsolidity/semanticTests/strings/concat/string_concat_empty_argument_list.sol @@ -3,7 +3,5 @@ contract C { return string.concat(); } } -// ==== -// compileToEwasm: also // ---- // f() -> 0x20, 0 diff --git a/test/libsolidity/semanticTests/strings/concat/string_concat_empty_strings.sol b/test/libsolidity/semanticTests/strings/concat/string_concat_empty_strings.sol index f452c3b3524e..b90235b3f83f 100644 --- a/test/libsolidity/semanticTests/strings/concat/string_concat_empty_strings.sol +++ b/test/libsolidity/semanticTests/strings/concat/string_concat_empty_strings.sol @@ -18,8 +18,6 @@ contract C { return string.concat(b, "abc", b, "abc", b); } } -// ==== -// compileToEwasm: also // ---- // f() -> 0x20, 0 // g() -> 0x20, 6, "abcabc" diff --git a/test/libsolidity/semanticTests/strings/empty_string.sol b/test/libsolidity/semanticTests/strings/empty_string.sol index d1a6fc5849e8..f023c7236913 100644 --- a/test/libsolidity/semanticTests/strings/empty_string.sol +++ b/test/libsolidity/semanticTests/strings/empty_string.sol @@ -3,7 +3,5 @@ contract C { return ""; } } -// ==== -// compileToEwasm: also // ---- // f() -> 0x20, 0 diff --git a/test/libsolidity/semanticTests/strings/return_string.sol b/test/libsolidity/semanticTests/strings/return_string.sol index 4393d7dcc788..704a7859cdd5 100644 --- a/test/libsolidity/semanticTests/strings/return_string.sol +++ b/test/libsolidity/semanticTests/strings/return_string.sol @@ -10,8 +10,6 @@ contract Main { r = s; } } -// ==== -// compileToEwasm: also // ---- // set(string): 0x20, 5, "Julia" -> // get1() -> 0x20, 5, "Julia" diff --git a/test/libsolidity/semanticTests/strings/string_escapes.sol b/test/libsolidity/semanticTests/strings/string_escapes.sol index 3ccae698f065..ea178d645e47 100644 --- a/test/libsolidity/semanticTests/strings/string_escapes.sol +++ b/test/libsolidity/semanticTests/strings/string_escapes.sol @@ -4,7 +4,5 @@ contract test { return escapeCharacters; } } -// ==== -// compileToEwasm: also // ---- // f() -> 0x090a0d27225c0000000000000000000000000000000000000000000000000000 diff --git a/test/libsolidity/semanticTests/strings/unicode_escapes.sol b/test/libsolidity/semanticTests/strings/unicode_escapes.sol index 95c322f5b28f..401d8b61e4ec 100644 --- a/test/libsolidity/semanticTests/strings/unicode_escapes.sol +++ b/test/libsolidity/semanticTests/strings/unicode_escapes.sol @@ -15,8 +15,6 @@ contract C { return "\u0024\u00A2\u20AC"; } } -// ==== -// compileToEwasm: also // ---- // oneByteUTF8() -> 0x20, 7, "aaa$aaa" // twoBytesUTF8() -> 0x20, 8, "aaa\xc2\xa2aaa" diff --git a/test/libsolidity/semanticTests/strings/unicode_string.sol b/test/libsolidity/semanticTests/strings/unicode_string.sol index 516febe6ed55..e06556fb5466 100644 --- a/test/libsolidity/semanticTests/strings/unicode_string.sol +++ b/test/libsolidity/semanticTests/strings/unicode_string.sol @@ -7,8 +7,6 @@ contract C { and 😈"; } } -// ==== -// compileToEwasm: also // ---- // f() -> 0x20, 0x14, "\xf0\x9f\x98\x83, \xf0\x9f\x98\xad, and \xf0\x9f\x98\x88" // g() -> 0x20, 0x14, "\xf0\x9f\x98\x83, \xf0\x9f\x98\xad, and \xf0\x9f\x98\x88" diff --git a/test/libsolidity/semanticTests/structs/array_of_recursive_struct.sol b/test/libsolidity/semanticTests/structs/array_of_recursive_struct.sol index f62f4c084528..f5f53cc40d06 100644 --- a/test/libsolidity/semanticTests/structs/array_of_recursive_struct.sol +++ b/test/libsolidity/semanticTests/structs/array_of_recursive_struct.sol @@ -8,7 +8,5 @@ contract Test { assert(val[0].vals.length == 42); } } -// ==== -// compileToEwasm: also // ---- // func() -> diff --git a/test/libsolidity/semanticTests/structs/calldata/calldata_struct.sol b/test/libsolidity/semanticTests/structs/calldata/calldata_struct.sol index ca635aeb4351..418f9e93a8f6 100644 --- a/test/libsolidity/semanticTests/structs/calldata/calldata_struct.sol +++ b/test/libsolidity/semanticTests/structs/calldata/calldata_struct.sol @@ -12,8 +12,5 @@ contract C { b = s.b; } } - -// ==== -// compileToEwasm: also // ---- // f((uint256,uint256)): 42, 23 -> 42, 23 diff --git a/test/libsolidity/semanticTests/structs/calldata/calldata_struct_and_ints.sol b/test/libsolidity/semanticTests/structs/calldata/calldata_struct_and_ints.sol index 144df2d61688..5bdd1b42fb94 100644 --- a/test/libsolidity/semanticTests/structs/calldata/calldata_struct_and_ints.sol +++ b/test/libsolidity/semanticTests/structs/calldata/calldata_struct_and_ints.sol @@ -15,6 +15,5 @@ contract C { return (a, s.a, s.b, b); } } - // ---- // f(uint256,(uint256,uint256),uint256): 1, 2, 3, 4 -> 1, 2, 3, 4 diff --git a/test/libsolidity/semanticTests/structs/calldata/calldata_struct_array_member_dynamic.sol b/test/libsolidity/semanticTests/structs/calldata/calldata_struct_array_member_dynamic.sol index e6972e03f34b..14f770a35070 100644 --- a/test/libsolidity/semanticTests/structs/calldata/calldata_struct_array_member_dynamic.sol +++ b/test/libsolidity/semanticTests/structs/calldata/calldata_struct_array_member_dynamic.sol @@ -18,7 +18,5 @@ contract C { c = s.c; } } -// ==== -// compileToEwasm: also // ---- // f((uint32,uint256[],uint64)): 0x20, 42, 0x60, 23, 2, 1, 2 -> 42, 1, 2, 23 diff --git a/test/libsolidity/semanticTests/structs/calldata/calldata_struct_to_memory.sol b/test/libsolidity/semanticTests/structs/calldata/calldata_struct_to_memory.sol index 76e6f7c1d880..3aeb0dcbca27 100644 --- a/test/libsolidity/semanticTests/structs/calldata/calldata_struct_to_memory.sol +++ b/test/libsolidity/semanticTests/structs/calldata/calldata_struct_to_memory.sol @@ -12,8 +12,5 @@ contract C { return (m.a, m.b, m.c[1]); } } - -// ==== -// compileToEwasm: also // ---- // f((uint256,uint256,bytes2)): 42, 23, "ab" -> 42, 23, "b" diff --git a/test/libsolidity/semanticTests/structs/calldata/calldata_struct_to_storage.sol b/test/libsolidity/semanticTests/structs/calldata/calldata_struct_to_storage.sol index 74d30f5052e3..6b56a73c2ca8 100644 --- a/test/libsolidity/semanticTests/structs/calldata/calldata_struct_to_storage.sol +++ b/test/libsolidity/semanticTests/structs/calldata/calldata_struct_to_storage.sol @@ -15,8 +15,5 @@ contract C { return (s.a, s.b, s.c[1]); } } - -// ==== -// compileToEwasm: also // ---- // f(uint32,(uint256,uint64,bytes2),uint256): 1, 42, 23, "ab", 1 -> 42, 23, "b" diff --git a/test/libsolidity/semanticTests/structs/calldata/calldata_struct_with_array_to_memory.sol b/test/libsolidity/semanticTests/structs/calldata/calldata_struct_with_array_to_memory.sol index 7ae085dbb5b3..b7b3058b4259 100644 --- a/test/libsolidity/semanticTests/structs/calldata/calldata_struct_with_array_to_memory.sol +++ b/test/libsolidity/semanticTests/structs/calldata/calldata_struct_with_array_to_memory.sol @@ -16,6 +16,5 @@ contract C { return (m.a, m.b[0], m.b[1], m.c); } } - // ---- // f((uint256,uint256[2],uint256)): 42, 1, 2, 23 -> 42, 1, 2, 23 diff --git a/test/libsolidity/semanticTests/structs/calldata/calldata_struct_with_bytes_to_memory.sol b/test/libsolidity/semanticTests/structs/calldata/calldata_struct_with_bytes_to_memory.sol index 0adc4c5a7be6..3fa7a33fda6e 100644 --- a/test/libsolidity/semanticTests/structs/calldata/calldata_struct_with_bytes_to_memory.sol +++ b/test/libsolidity/semanticTests/structs/calldata/calldata_struct_with_bytes_to_memory.sol @@ -16,6 +16,5 @@ contract C { return (m.a, m.b[0], m.b[1], m.c); } } - // ---- // f((uint256,bytes,uint256)): 0x20, 42, 0x60, 23, 2, "ab" -> 42, "a", "b", 23 diff --git a/test/libsolidity/semanticTests/structs/calldata/calldata_structs.sol b/test/libsolidity/semanticTests/structs/calldata/calldata_structs.sol index 6092b161d926..b73077131295 100644 --- a/test/libsolidity/semanticTests/structs/calldata/calldata_structs.sol +++ b/test/libsolidity/semanticTests/structs/calldata/calldata_structs.sol @@ -22,8 +22,5 @@ contract C { e = s3.b; } } - -// ==== -// compileToEwasm: also // ---- // f((uint256,uint256),(uint256),(uint256,uint256)): 1, 2, 3, 4, 5 -> 1, 2, 3, 4, 5 diff --git a/test/libsolidity/semanticTests/structs/calldata/dynamic_nested.sol b/test/libsolidity/semanticTests/structs/calldata/dynamic_nested.sol index 2b7544139403..633c4c7b321f 100644 --- a/test/libsolidity/semanticTests/structs/calldata/dynamic_nested.sol +++ b/test/libsolidity/semanticTests/structs/calldata/dynamic_nested.sol @@ -7,7 +7,5 @@ contract C { return (s.children.length, s.a, s.children[0].b, s.children[1].b); } } -// ==== -// compileToEwasm: also // ---- // f((uint256,(uint256)[])): 32, 17, 64, 2, 23, 42 -> 2, 17, 23, 42 diff --git a/test/libsolidity/semanticTests/structs/calldata/dynamically_encoded.sol b/test/libsolidity/semanticTests/structs/calldata/dynamically_encoded.sol index b4beff94169d..0dfa2cea3f53 100644 --- a/test/libsolidity/semanticTests/structs/calldata/dynamically_encoded.sol +++ b/test/libsolidity/semanticTests/structs/calldata/dynamically_encoded.sol @@ -6,7 +6,5 @@ contract C { return (s.a.length, s.a[0], s.a[1]); } } -// ==== -// compileToEwasm: also // ---- // f((uint256[])): 32, 32, 2, 42, 23 -> 2, 42, 23 diff --git a/test/libsolidity/semanticTests/structs/copy_from_mapping.sol b/test/libsolidity/semanticTests/structs/copy_from_mapping.sol index 9aa41a34255b..df118de3231d 100644 --- a/test/libsolidity/semanticTests/structs/copy_from_mapping.sol +++ b/test/libsolidity/semanticTests/structs/copy_from_mapping.sol @@ -34,7 +34,6 @@ contract C { } } - // ---- // to_state() -> 0x20, 0x60, 0xa0, 7, 3, 0x666F6F0000000000000000000000000000000000000000000000000000000000, 2, 13, 14 // gas irOptimized: 121497 diff --git a/test/libsolidity/semanticTests/structs/copy_struct_with_nested_array_from_calldata_to_memory.sol b/test/libsolidity/semanticTests/structs/copy_struct_with_nested_array_from_calldata_to_memory.sol index 8ccc30936e8f..6c22c71da8c8 100644 --- a/test/libsolidity/semanticTests/structs/copy_struct_with_nested_array_from_calldata_to_memory.sol +++ b/test/libsolidity/semanticTests/structs/copy_struct_with_nested_array_from_calldata_to_memory.sol @@ -10,7 +10,6 @@ contract C { return s; } } - // ---- // test((uint8[1],uint8[])): 0x20, 3, 0x40, 2, 7, 11 -> 0x20, 3, 0x40, 2, 7, 11 // test((uint8[1],uint8[])): 0x20, 3, 0x40, 3, 17, 19, 23 -> 0x20, 3, 0x40, 3, 17, 19, 23 diff --git a/test/libsolidity/semanticTests/structs/copy_struct_with_nested_array_from_calldata_to_storage.sol b/test/libsolidity/semanticTests/structs/copy_struct_with_nested_array_from_calldata_to_storage.sol index fa67deb2c0d1..dcf2a3a27720 100644 --- a/test/libsolidity/semanticTests/structs/copy_struct_with_nested_array_from_calldata_to_storage.sol +++ b/test/libsolidity/semanticTests/structs/copy_struct_with_nested_array_from_calldata_to_storage.sol @@ -17,6 +17,5 @@ contract C { require(s.y[1] == 11); } } - // ---- // test((uint8[1],uint8[])): 0x20, 3, 0x40, 2, 7, 11 diff --git a/test/libsolidity/semanticTests/structs/copy_struct_with_nested_array_from_memory_to_memory.sol b/test/libsolidity/semanticTests/structs/copy_struct_with_nested_array_from_memory_to_memory.sol index c340289adf44..3d132641f4f9 100644 --- a/test/libsolidity/semanticTests/structs/copy_struct_with_nested_array_from_memory_to_memory.sol +++ b/test/libsolidity/semanticTests/structs/copy_struct_with_nested_array_from_memory_to_memory.sol @@ -10,7 +10,6 @@ contract C { return r; } } - // ---- // test((uint8[1],uint8[])): 0x20, 3, 0x40, 2, 7, 11 -> 0x20, 0, 0x40, 0 // test((uint8[1],uint8[])): 0x20, 3, 0x40, 3, 17, 19, 23 -> 0x20, 0, 0x40, 0 diff --git a/test/libsolidity/semanticTests/structs/copy_struct_with_nested_array_from_storage_to_storage.sol b/test/libsolidity/semanticTests/structs/copy_struct_with_nested_array_from_storage_to_storage.sol index 3f29790d8356..880b7433dd2d 100644 --- a/test/libsolidity/semanticTests/structs/copy_struct_with_nested_array_from_storage_to_storage.sol +++ b/test/libsolidity/semanticTests/structs/copy_struct_with_nested_array_from_storage_to_storage.sol @@ -22,6 +22,5 @@ contract C { require(dst.y[1] == 11); } } - // ---- // test() diff --git a/test/libsolidity/semanticTests/structs/copy_substructures_from_mapping.sol b/test/libsolidity/semanticTests/structs/copy_substructures_from_mapping.sol index 29618bb044b6..66954a7f5c16 100644 --- a/test/libsolidity/semanticTests/structs/copy_substructures_from_mapping.sol +++ b/test/libsolidity/semanticTests/structs/copy_substructures_from_mapping.sol @@ -42,7 +42,6 @@ contract C { } } - // ---- // to_state() -> 0x20, 0x60, 0xa0, 7, 3, 0x666F6F0000000000000000000000000000000000000000000000000000000000, 2, 13, 14 // gas irOptimized: 121598 diff --git a/test/libsolidity/semanticTests/structs/copy_substructures_to_mapping.sol b/test/libsolidity/semanticTests/structs/copy_substructures_to_mapping.sol index ec989b508ef6..065187cdc348 100644 --- a/test/libsolidity/semanticTests/structs/copy_substructures_to_mapping.sol +++ b/test/libsolidity/semanticTests/structs/copy_substructures_to_mapping.sol @@ -50,7 +50,6 @@ contract C { return m[2]; } } - // ---- // from_memory() -> 0x20, 0x60, 0xa0, 0x15, 3, 0x666F6F0000000000000000000000000000000000000000000000000000000000, 2, 13, 14 // gas irOptimized: 123029 diff --git a/test/libsolidity/semanticTests/structs/copy_to_mapping.sol b/test/libsolidity/semanticTests/structs/copy_to_mapping.sol index e5c02001fe13..5b99efc6477d 100644 --- a/test/libsolidity/semanticTests/structs/copy_to_mapping.sol +++ b/test/libsolidity/semanticTests/structs/copy_to_mapping.sol @@ -43,7 +43,6 @@ contract C { return m[3]; } } - // ---- // from_state() -> 0x20, 0x60, 0xa0, 21, 3, 0x666F6F0000000000000000000000000000000000000000000000000000000000, 2, 13, 14 // gas irOptimized: 121693 diff --git a/test/libsolidity/semanticTests/structs/global.sol b/test/libsolidity/semanticTests/structs/global.sol index d51194ca0a8c..052122538eb9 100644 --- a/test/libsolidity/semanticTests/structs/global.sol +++ b/test/libsolidity/semanticTests/structs/global.sol @@ -6,7 +6,5 @@ contract C { return (s.a, s.b); } } -// ==== -// compileToEwasm: also // ---- // f((uint256,uint256)): 42, 23 -> 42, 23 diff --git a/test/libsolidity/semanticTests/structs/lone_struct_array_type.sol b/test/libsolidity/semanticTests/structs/lone_struct_array_type.sol index fe6de19f4698..9434e40454f8 100644 --- a/test/libsolidity/semanticTests/structs/lone_struct_array_type.sol +++ b/test/libsolidity/semanticTests/structs/lone_struct_array_type.sol @@ -9,8 +9,5 @@ contract C { return 3; } } - -// ==== -// compileToEwasm: also // ---- // f() -> 3 diff --git a/test/libsolidity/semanticTests/structs/memory_struct_named_constructor.sol b/test/libsolidity/semanticTests/structs/memory_struct_named_constructor.sol index 445961e2da3c..f844c08fac01 100644 --- a/test/libsolidity/semanticTests/structs/memory_struct_named_constructor.sol +++ b/test/libsolidity/semanticTests/structs/memory_struct_named_constructor.sol @@ -11,8 +11,5 @@ contract C { return S({x: true, a: 8}); } } - -// ==== -// compileToEwasm: also // ---- // s() -> 8, true diff --git a/test/libsolidity/semanticTests/structs/memory_structs_as_function_args.sol b/test/libsolidity/semanticTests/structs/memory_structs_as_function_args.sol index a76518684b5f..96b9569920ea 100644 --- a/test/libsolidity/semanticTests/structs/memory_structs_as_function_args.sol +++ b/test/libsolidity/semanticTests/structs/memory_structs_as_function_args.sol @@ -27,8 +27,5 @@ contract Test { s.z = z; } } - -// ==== -// compileToEwasm: also // ---- // test() -> 1, 2, 3 diff --git a/test/libsolidity/semanticTests/structs/memory_structs_nested.sol b/test/libsolidity/semanticTests/structs/memory_structs_nested.sol index 3fee9b210528..e541fa975733 100644 --- a/test/libsolidity/semanticTests/structs/memory_structs_nested.sol +++ b/test/libsolidity/semanticTests/structs/memory_structs_nested.sol @@ -37,8 +37,5 @@ contract Test { s.s.z = z; } } - -// ==== -// compileToEwasm: also // ---- // test() -> 1, 2, 3, 4 diff --git a/test/libsolidity/semanticTests/structs/memory_structs_nested_load.sol b/test/libsolidity/semanticTests/structs/memory_structs_nested_load.sol index 12b514a23c6a..3089f97b52ac 100644 --- a/test/libsolidity/semanticTests/structs/memory_structs_nested_load.sol +++ b/test/libsolidity/semanticTests/structs/memory_structs_nested_load.sol @@ -64,8 +64,6 @@ contract Test { a2 = m_x.a[1]; } } -// ==== -// compileToEwasm: also // ---- // load() -> 0x01, 0x02, 0x03, 0x04, 0x05, 0x06 // gas irOptimized: 110326 diff --git a/test/libsolidity/semanticTests/structs/memory_structs_read_write.sol b/test/libsolidity/semanticTests/structs/memory_structs_read_write.sol index 5cafe53232bd..fe319d19df26 100644 --- a/test/libsolidity/semanticTests/structs/memory_structs_read_write.sol +++ b/test/libsolidity/semanticTests/structs/memory_structs_read_write.sol @@ -49,9 +49,6 @@ contract Test { a = s.a[1]; } } - -// ==== -// compileToEwasm: also // ---- // testInit() -> 0, 0, 0, 0, true // testCopyRead() -> 1, 2, 3, 4 diff --git a/test/libsolidity/semanticTests/structs/multislot_struct_allocation.sol b/test/libsolidity/semanticTests/structs/multislot_struct_allocation.sol index 3336b30b1ca7..648c962cf9b8 100644 --- a/test/libsolidity/semanticTests/structs/multislot_struct_allocation.sol +++ b/test/libsolidity/semanticTests/structs/multislot_struct_allocation.sol @@ -15,8 +15,5 @@ contract C { return s.a.x(1); } } - - - // ---- // f() -> 2 diff --git a/test/libsolidity/semanticTests/structs/nested_struct_allocation.sol b/test/libsolidity/semanticTests/structs/nested_struct_allocation.sol index 64328b2dee87..0037d9573e8a 100644 --- a/test/libsolidity/semanticTests/structs/nested_struct_allocation.sol +++ b/test/libsolidity/semanticTests/structs/nested_struct_allocation.sol @@ -12,7 +12,5 @@ contract C { return s.a.b; } } -// ==== -// compileToEwasm: also // ---- // f() -> 1 diff --git a/test/libsolidity/semanticTests/structs/recursive_structs.sol b/test/libsolidity/semanticTests/structs/recursive_structs.sol index 58f178e5ec52..f8944f11f355 100644 --- a/test/libsolidity/semanticTests/structs/recursive_structs.sol +++ b/test/libsolidity/semanticTests/structs/recursive_structs.sol @@ -14,8 +14,5 @@ contract C { return 1; } } - -// ==== -// compileToEwasm: also // ---- // f() -> 1 diff --git a/test/libsolidity/semanticTests/structs/simple_struct_allocation.sol b/test/libsolidity/semanticTests/structs/simple_struct_allocation.sol index c05d87b37c54..e45626d3168c 100644 --- a/test/libsolidity/semanticTests/structs/simple_struct_allocation.sol +++ b/test/libsolidity/semanticTests/structs/simple_struct_allocation.sol @@ -8,7 +8,5 @@ contract C { return s.a; } } -// ==== -// compileToEwasm: also // ---- // f() -> 1 diff --git a/test/libsolidity/semanticTests/structs/struct_assign_reference_to_struct.sol b/test/libsolidity/semanticTests/structs/struct_assign_reference_to_struct.sol index 357863abb48d..47b9a9ece202 100644 --- a/test/libsolidity/semanticTests/structs/struct_assign_reference_to_struct.sol +++ b/test/libsolidity/semanticTests/structs/struct_assign_reference_to_struct.sol @@ -31,8 +31,5 @@ contract test { ret_global1 = data1.m_value; // = 3. Changed due to the assignment to x.m_value } } - -// ==== -// compileToEwasm: also // ---- // assign() -> 2, 2, 3, 3 diff --git a/test/libsolidity/semanticTests/structs/struct_copy.sol b/test/libsolidity/semanticTests/structs/struct_copy.sol index 956416a967e6..6da42ebec7d4 100644 --- a/test/libsolidity/semanticTests/structs/struct_copy.sol +++ b/test/libsolidity/semanticTests/structs/struct_copy.sol @@ -33,7 +33,6 @@ contract c { c = data[k].c; } } - // ---- // set(uint256): 7 -> true // gas irOptimized: 109896 diff --git a/test/libsolidity/semanticTests/structs/struct_copy_via_local.sol b/test/libsolidity/semanticTests/structs/struct_copy_via_local.sol index 53d1ca93a9d7..22d9dd29deb5 100644 --- a/test/libsolidity/semanticTests/structs/struct_copy_via_local.sol +++ b/test/libsolidity/semanticTests/structs/struct_copy_via_local.sol @@ -15,9 +15,6 @@ contract c { return data2.a == data1.a && data2.b == data1.b; } } - -// ==== -// compileToEwasm: also // ---- // test() -> true // gas irOptimized: 109713 diff --git a/test/libsolidity/semanticTests/structs/struct_delete_member.sol b/test/libsolidity/semanticTests/structs/struct_delete_member.sol index c881d8a9367c..7f991f401bc5 100644 --- a/test/libsolidity/semanticTests/structs/struct_delete_member.sol +++ b/test/libsolidity/semanticTests/structs/struct_delete_member.sol @@ -15,8 +15,5 @@ contract test { ret_value = data1.m_value; } } - -// ==== -// compileToEwasm: also // ---- // deleteMember() -> 0 diff --git a/test/libsolidity/semanticTests/structs/struct_delete_storage.sol b/test/libsolidity/semanticTests/structs/struct_delete_storage.sol index 776ceddc6e4f..31558cfbe288 100644 --- a/test/libsolidity/semanticTests/structs/struct_delete_storage.sol +++ b/test/libsolidity/semanticTests/structs/struct_delete_storage.sol @@ -17,7 +17,5 @@ contract C { assert(a == 17); } } -// ==== -// compileToEwasm: also // ---- // f() -> diff --git a/test/libsolidity/semanticTests/structs/struct_delete_storage_small.sol b/test/libsolidity/semanticTests/structs/struct_delete_storage_small.sol index 21140e45eec8..046e4ec6d6b6 100644 --- a/test/libsolidity/semanticTests/structs/struct_delete_storage_small.sol +++ b/test/libsolidity/semanticTests/structs/struct_delete_storage_small.sol @@ -19,7 +19,6 @@ contract C { } } // ==== -// compileToEwasm: also // compileViaYul: true // ---- // f() -> 0 diff --git a/test/libsolidity/semanticTests/structs/struct_delete_struct_in_mapping.sol b/test/libsolidity/semanticTests/structs/struct_delete_struct_in_mapping.sol index b5c8a2cfa622..ae21f6f865b8 100644 --- a/test/libsolidity/semanticTests/structs/struct_delete_struct_in_mapping.sol +++ b/test/libsolidity/semanticTests/structs/struct_delete_struct_in_mapping.sol @@ -13,6 +13,5 @@ contract test { return campaigns[0].m_value; } } - // ---- // deleteIt() -> 0 diff --git a/test/libsolidity/semanticTests/structs/struct_memory_to_storage.sol b/test/libsolidity/semanticTests/structs/struct_memory_to_storage.sol index 66657fc6764c..290c812ccdca 100644 --- a/test/libsolidity/semanticTests/structs/struct_memory_to_storage.sol +++ b/test/libsolidity/semanticTests/structs/struct_memory_to_storage.sol @@ -21,8 +21,5 @@ contract C { return (x.s.a, x.s.b, x.s.c); } } - -// ==== -// compileToEwasm: also // ---- // f() -> 42, 23, 34 diff --git a/test/libsolidity/semanticTests/structs/struct_memory_to_storage_function_ptr.sol b/test/libsolidity/semanticTests/structs/struct_memory_to_storage_function_ptr.sol index 46094d3766d6..c19875062f9b 100644 --- a/test/libsolidity/semanticTests/structs/struct_memory_to_storage_function_ptr.sol +++ b/test/libsolidity/semanticTests/structs/struct_memory_to_storage_function_ptr.sol @@ -26,9 +26,6 @@ contract C { return x.s.a; } } - -// ==== -// compileToEwasm: also // ---- // f() -> 42, 23, 34, 42, 42 // gas irOptimized: 110388 diff --git a/test/libsolidity/semanticTests/structs/struct_named_constructor.sol b/test/libsolidity/semanticTests/structs/struct_named_constructor.sol index 2433da86664f..f16f61e3213e 100644 --- a/test/libsolidity/semanticTests/structs/struct_named_constructor.sol +++ b/test/libsolidity/semanticTests/structs/struct_named_constructor.sol @@ -9,8 +9,5 @@ contract C { s = S({x: true, a: 1}); } } - -// ==== -// compileToEwasm: also // ---- // s() -> 1, true diff --git a/test/libsolidity/semanticTests/structs/struct_referencing.sol b/test/libsolidity/semanticTests/structs/struct_referencing.sol index cbe8a72bfc78..93fad63befcf 100644 --- a/test/libsolidity/semanticTests/structs/struct_referencing.sol +++ b/test/libsolidity/semanticTests/structs/struct_referencing.sol @@ -45,8 +45,6 @@ contract C is I { function a1() public pure returns (uint) { S memory s; return L.a(s); } function a2() public pure returns (uint) { L.S memory s; return L.a(s); } } -// ==== -// compileToEwasm: false // ---- // library: L // f() -> 1 diff --git a/test/libsolidity/semanticTests/structs/struct_storage_to_memory.sol b/test/libsolidity/semanticTests/structs/struct_storage_to_memory.sol index 8b9035d188f6..26862fd008fc 100644 --- a/test/libsolidity/semanticTests/structs/struct_storage_to_memory.sol +++ b/test/libsolidity/semanticTests/structs/struct_storage_to_memory.sol @@ -19,8 +19,5 @@ contract C { return (m.s.a, m.s.b, m.s.c); } } - -// ==== -// compileToEwasm: also // ---- // f() -> 42, 23, 34 diff --git a/test/libsolidity/semanticTests/structs/struct_storage_to_memory_function_ptr.sol b/test/libsolidity/semanticTests/structs/struct_storage_to_memory_function_ptr.sol index c3aa23c3be85..5ec25fb3632c 100644 --- a/test/libsolidity/semanticTests/structs/struct_storage_to_memory_function_ptr.sol +++ b/test/libsolidity/semanticTests/structs/struct_storage_to_memory_function_ptr.sol @@ -25,8 +25,5 @@ contract C { return x.s.a; } } - -// ==== -// compileToEwasm: also // ---- // f() -> 42, 23, 34, 42, 42 diff --git a/test/libsolidity/semanticTests/structs/using_for_function_on_struct.sol b/test/libsolidity/semanticTests/structs/using_for_function_on_struct.sol index f97935fb67e1..7b51b59fcf0a 100644 --- a/test/libsolidity/semanticTests/structs/using_for_function_on_struct.sol +++ b/test/libsolidity/semanticTests/structs/using_for_function_on_struct.sol @@ -7,8 +7,6 @@ contract C { return x.mul(a); } } -// ==== -// compileToEwasm: false // ---- // library: D // f(uint256): 7 -> 0x15 diff --git a/test/libsolidity/semanticTests/types/assign_calldata_value_type.sol b/test/libsolidity/semanticTests/types/assign_calldata_value_type.sol index 04724f4c794f..8350628e4764 100644 --- a/test/libsolidity/semanticTests/types/assign_calldata_value_type.sol +++ b/test/libsolidity/semanticTests/types/assign_calldata_value_type.sol @@ -5,7 +5,5 @@ contract C { return (x, b); } } -// ==== -// compileToEwasm: also // ---- // f(uint256): 23 -> 42, 23 diff --git a/test/libsolidity/semanticTests/types/convert_fixed_bytes_to_fixed_bytes_greater_size.sol b/test/libsolidity/semanticTests/types/convert_fixed_bytes_to_fixed_bytes_greater_size.sol index 09558a697b07..fdfafa9e2a34 100644 --- a/test/libsolidity/semanticTests/types/convert_fixed_bytes_to_fixed_bytes_greater_size.sol +++ b/test/libsolidity/semanticTests/types/convert_fixed_bytes_to_fixed_bytes_greater_size.sol @@ -3,7 +3,5 @@ contract Test { return bytes4(input); } } -// ==== -// compileToEwasm: also // ---- // bytesToBytes(bytes2): "ab" -> "ab" diff --git a/test/libsolidity/semanticTests/types/convert_fixed_bytes_to_fixed_bytes_same_size.sol b/test/libsolidity/semanticTests/types/convert_fixed_bytes_to_fixed_bytes_same_size.sol index 5417800271c3..5c9a6cdc5ac3 100644 --- a/test/libsolidity/semanticTests/types/convert_fixed_bytes_to_fixed_bytes_same_size.sol +++ b/test/libsolidity/semanticTests/types/convert_fixed_bytes_to_fixed_bytes_same_size.sol @@ -3,7 +3,5 @@ contract Test { return bytes4(input); } } -// ==== -// compileToEwasm: also // ---- // bytesToBytes(bytes4): "abcd" -> "abcd" diff --git a/test/libsolidity/semanticTests/types/convert_fixed_bytes_to_fixed_bytes_smaller_size.sol b/test/libsolidity/semanticTests/types/convert_fixed_bytes_to_fixed_bytes_smaller_size.sol index 5868492940cf..2052c9da9278 100644 --- a/test/libsolidity/semanticTests/types/convert_fixed_bytes_to_fixed_bytes_smaller_size.sol +++ b/test/libsolidity/semanticTests/types/convert_fixed_bytes_to_fixed_bytes_smaller_size.sol @@ -3,7 +3,5 @@ contract Test { return bytes2(input); } } -// ==== -// compileToEwasm: also // ---- // bytesToBytes(bytes4): "abcd" -> "ab" diff --git a/test/libsolidity/semanticTests/types/convert_fixed_bytes_to_uint_greater_size.sol b/test/libsolidity/semanticTests/types/convert_fixed_bytes_to_uint_greater_size.sol index 93906e6e0e93..b0ab07f549f2 100644 --- a/test/libsolidity/semanticTests/types/convert_fixed_bytes_to_uint_greater_size.sol +++ b/test/libsolidity/semanticTests/types/convert_fixed_bytes_to_uint_greater_size.sol @@ -3,7 +3,5 @@ contract Test { return uint64(uint32(s)); } } -// ==== -// compileToEwasm: also // ---- // bytesToUint(bytes4): "abcd" -> 0x61626364 diff --git a/test/libsolidity/semanticTests/types/convert_fixed_bytes_to_uint_same_min_size.sol b/test/libsolidity/semanticTests/types/convert_fixed_bytes_to_uint_same_min_size.sol index 52a99511d1cf..ff1dfebfd657 100644 --- a/test/libsolidity/semanticTests/types/convert_fixed_bytes_to_uint_same_min_size.sol +++ b/test/libsolidity/semanticTests/types/convert_fixed_bytes_to_uint_same_min_size.sol @@ -3,7 +3,5 @@ contract Test { return uint8(s); } } -// ==== -// compileToEwasm: also // ---- // bytesToUint(bytes1): "a" -> 0x61 diff --git a/test/libsolidity/semanticTests/types/convert_fixed_bytes_to_uint_same_type.sol b/test/libsolidity/semanticTests/types/convert_fixed_bytes_to_uint_same_type.sol index e13f99cd6016..390bf4b01d51 100644 --- a/test/libsolidity/semanticTests/types/convert_fixed_bytes_to_uint_same_type.sol +++ b/test/libsolidity/semanticTests/types/convert_fixed_bytes_to_uint_same_type.sol @@ -3,7 +3,5 @@ contract Test { return uint(s); } } -// ==== -// compileToEwasm: also // ---- // bytesToUint(bytes32): "abc2" -> left(0x61626332) diff --git a/test/libsolidity/semanticTests/types/convert_fixed_bytes_to_uint_smaller_size.sol b/test/libsolidity/semanticTests/types/convert_fixed_bytes_to_uint_smaller_size.sol index aae1576e5a69..eb450993e492 100644 --- a/test/libsolidity/semanticTests/types/convert_fixed_bytes_to_uint_smaller_size.sol +++ b/test/libsolidity/semanticTests/types/convert_fixed_bytes_to_uint_smaller_size.sol @@ -3,7 +3,5 @@ contract Test { return uint16(uint32(s)); } } -// ==== -// compileToEwasm: also // ---- // bytesToUint(bytes4): "abcd" -> 0x6364 diff --git a/test/libsolidity/semanticTests/types/convert_uint_to_fixed_bytes_greater_size.sol b/test/libsolidity/semanticTests/types/convert_uint_to_fixed_bytes_greater_size.sol index cf170a2aaf34..9949b477b290 100644 --- a/test/libsolidity/semanticTests/types/convert_uint_to_fixed_bytes_greater_size.sol +++ b/test/libsolidity/semanticTests/types/convert_uint_to_fixed_bytes_greater_size.sol @@ -3,7 +3,5 @@ contract Test { return bytes8(uint64(h)); } } -// ==== -// compileToEwasm: also // ---- // UintToBytes(uint16): 0x6162 -> "\x00\x00\x00\x00\x00\x00ab" diff --git a/test/libsolidity/semanticTests/types/convert_uint_to_fixed_bytes_same_min_size.sol b/test/libsolidity/semanticTests/types/convert_uint_to_fixed_bytes_same_min_size.sol index 18a09dfe549a..60b9a4cf0105 100644 --- a/test/libsolidity/semanticTests/types/convert_uint_to_fixed_bytes_same_min_size.sol +++ b/test/libsolidity/semanticTests/types/convert_uint_to_fixed_bytes_same_min_size.sol @@ -3,7 +3,5 @@ contract Test { return bytes1(h); } } -// ==== -// compileToEwasm: also // ---- // UintToBytes(uint8): 0x61 -> "a" diff --git a/test/libsolidity/semanticTests/types/convert_uint_to_fixed_bytes_same_size.sol b/test/libsolidity/semanticTests/types/convert_uint_to_fixed_bytes_same_size.sol index 10c3a351dec1..5662d909e6f0 100644 --- a/test/libsolidity/semanticTests/types/convert_uint_to_fixed_bytes_same_size.sol +++ b/test/libsolidity/semanticTests/types/convert_uint_to_fixed_bytes_same_size.sol @@ -3,7 +3,5 @@ contract Test { return bytes32(h); } } -// ==== -// compileToEwasm: also // ---- // uintToBytes(uint256): left(0x616263) -> left(0x616263) diff --git a/test/libsolidity/semanticTests/types/convert_uint_to_fixed_bytes_smaller_size.sol b/test/libsolidity/semanticTests/types/convert_uint_to_fixed_bytes_smaller_size.sol index 8abc70d3d313..963cbc3427fa 100644 --- a/test/libsolidity/semanticTests/types/convert_uint_to_fixed_bytes_smaller_size.sol +++ b/test/libsolidity/semanticTests/types/convert_uint_to_fixed_bytes_smaller_size.sol @@ -3,7 +3,5 @@ contract Test { return bytes2(uint16(h)); } } -// ==== -// compileToEwasm: also // ---- // uintToBytes(uint32): 0x61626364 -> "cd" diff --git a/test/libsolidity/semanticTests/types/external_function_to_address.sol b/test/libsolidity/semanticTests/types/external_function_to_address.sol index d2f5523b170f..fb938d37aaca 100644 --- a/test/libsolidity/semanticTests/types/external_function_to_address.sol +++ b/test/libsolidity/semanticTests/types/external_function_to_address.sol @@ -6,8 +6,6 @@ contract C { return cb.address; } } -// ==== -// compileToEwasm: also // ---- // f() -> true // g(function): hex"00000000000000000000000000000000000004226121ff00000000000000000" -> 0x42 diff --git a/test/libsolidity/semanticTests/types/mapping/copy_from_mapping_to_mapping.sol b/test/libsolidity/semanticTests/types/mapping/copy_from_mapping_to_mapping.sol index daf5d000c864..b17ba6d9160b 100644 --- a/test/libsolidity/semanticTests/types/mapping/copy_from_mapping_to_mapping.sol +++ b/test/libsolidity/semanticTests/types/mapping/copy_from_mapping_to_mapping.sol @@ -27,7 +27,6 @@ contract C { return dst[0]; } } - // ---- // f() -> 0x20, 7, 8, 9, 0xa0, 13, 2, 0x40, 0xa0, 2, 3, 4, 2, 3, 4 // gas irOptimized: 197082 diff --git a/test/libsolidity/semanticTests/types/mapping/copy_struct_to_array_stored_in_mapping.sol b/test/libsolidity/semanticTests/types/mapping/copy_struct_to_array_stored_in_mapping.sol index 26a33682d5c3..43f2a80fc79a 100644 --- a/test/libsolidity/semanticTests/types/mapping/copy_struct_to_array_stored_in_mapping.sol +++ b/test/libsolidity/semanticTests/types/mapping/copy_struct_to_array_stored_in_mapping.sol @@ -47,7 +47,6 @@ contract C { return m2[0]; } } - // ---- // from_storage_to_static_array() -> 0, 7 // from_storage_to_dynamic_array() -> 0x20, 1, 7 diff --git a/test/libsolidity/semanticTests/types/mapping/user_defined_types_mapping_storage.sol b/test/libsolidity/semanticTests/types/mapping/user_defined_types_mapping_storage.sol index ef092f3ea6b9..a8a8fca44cec 100644 --- a/test/libsolidity/semanticTests/types/mapping/user_defined_types_mapping_storage.sol +++ b/test/libsolidity/semanticTests/types/mapping/user_defined_types_mapping_storage.sol @@ -19,7 +19,6 @@ contract C { return uintMap[3] == 4; } } - // ---- // library: L // testAB() -> true diff --git a/test/libsolidity/semanticTests/types/nested_tuples.sol b/test/libsolidity/semanticTests/types/nested_tuples.sol index c3e96240a5cf..32203a9cbed7 100644 --- a/test/libsolidity/semanticTests/types/nested_tuples.sol +++ b/test/libsolidity/semanticTests/types/nested_tuples.sol @@ -26,8 +26,6 @@ contract test { return a; } } -// ==== -// compileToEwasm: also // ---- // f0() -> 2, true // f1() -> 1 diff --git a/test/libsolidity/semanticTests/types/packing_signed_types.sol b/test/libsolidity/semanticTests/types/packing_signed_types.sol index 392a52f2cf5f..2d2e0e16e608 100644 --- a/test/libsolidity/semanticTests/types/packing_signed_types.sol +++ b/test/libsolidity/semanticTests/types/packing_signed_types.sol @@ -4,7 +4,5 @@ contract test { return int8(x); } } -// ==== -// compileToEwasm: also // ---- // run() -> 0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffa diff --git a/test/libsolidity/semanticTests/types/packing_unpacking_types.sol b/test/libsolidity/semanticTests/types/packing_unpacking_types.sol index 7d12c47a44f0..8b500cca1351 100644 --- a/test/libsolidity/semanticTests/types/packing_unpacking_types.sol +++ b/test/libsolidity/semanticTests/types/packing_unpacking_types.sol @@ -5,8 +5,6 @@ contract test { y = y * 0x10000000000000000 | ~c; } } -// ==== -// compileToEwasm: also // ---- // run(bool,uint32,uint64): true, 0x0f0f0f0f, 0xf0f0f0f0f0f0f0f0 // -> 0x0000000000000000000000000000000000000001f0f0f0f00f0f0f0f0f0f0f0f diff --git a/test/libsolidity/semanticTests/types/strings.sol b/test/libsolidity/semanticTests/types/strings.sol index 9242eca2e099..f76116bba319 100644 --- a/test/libsolidity/semanticTests/types/strings.sol +++ b/test/libsolidity/semanticTests/types/strings.sol @@ -10,9 +10,6 @@ contract test { large = small; } } - -// ==== -// compileToEwasm: also // ---- // fixedBytesHex() -> "\xaa\xbb\x00\xff" // fixedBytes() -> "abc\x00\xff__" diff --git a/test/libsolidity/semanticTests/types/tuple_assign_multi_slot_grow.sol b/test/libsolidity/semanticTests/types/tuple_assign_multi_slot_grow.sol index 5ac35853bfd1..6574dcb59771 100644 --- a/test/libsolidity/semanticTests/types/tuple_assign_multi_slot_grow.sol +++ b/test/libsolidity/semanticTests/types/tuple_assign_multi_slot_grow.sol @@ -7,7 +7,5 @@ contract C { } } -// ==== -// compileToEwasm: also // ---- // f() -> 0x30, 0x31, 0x32 diff --git a/test/libsolidity/semanticTests/types/type_conversion_cleanup.sol b/test/libsolidity/semanticTests/types/type_conversion_cleanup.sol index 320290c9f3a4..d3d2b01bbcb4 100644 --- a/test/libsolidity/semanticTests/types/type_conversion_cleanup.sol +++ b/test/libsolidity/semanticTests/types/type_conversion_cleanup.sol @@ -1,7 +1,5 @@ contract Test { function test() public returns (uint ret) { return uint(uint160(address(uint160(uint128(type(uint200).max))))); } } -// ==== -// compileToEwasm: also // ---- // test() -> 0xffffffffffffffffffffffffffffffff diff --git a/test/libsolidity/semanticTests/underscore/as_function.sol b/test/libsolidity/semanticTests/underscore/as_function.sol index 8f9fe0b5978d..be60a01bc351 100644 --- a/test/libsolidity/semanticTests/underscore/as_function.sol +++ b/test/libsolidity/semanticTests/underscore/as_function.sol @@ -12,8 +12,6 @@ contract C { return 33; } } -// ==== -// compileToEwasm: also // ---- // _() -> 88 // g() -> 88 diff --git a/test/libsolidity/semanticTests/uninitializedFunctionPointer/invalidInConstructor.sol b/test/libsolidity/semanticTests/uninitializedFunctionPointer/invalidInConstructor.sol index e2551a2a8f5b..e4e6453c5e15 100644 --- a/test/libsolidity/semanticTests/uninitializedFunctionPointer/invalidInConstructor.sol +++ b/test/libsolidity/semanticTests/uninitializedFunctionPointer/invalidInConstructor.sol @@ -19,7 +19,5 @@ contract Test { new C(); } } -// ==== -// compileToEwasm: also // ---- // f() -> FAILURE, hex"4e487b71", 0x51 diff --git a/test/libsolidity/semanticTests/uninitializedFunctionPointer/invalidStoredInConstructor.sol b/test/libsolidity/semanticTests/uninitializedFunctionPointer/invalidStoredInConstructor.sol index 209ad8bb2487..fbaca1a67a33 100644 --- a/test/libsolidity/semanticTests/uninitializedFunctionPointer/invalidStoredInConstructor.sol +++ b/test/libsolidity/semanticTests/uninitializedFunctionPointer/invalidStoredInConstructor.sol @@ -19,7 +19,5 @@ contract Test { new C(); } } -// ==== -// compileToEwasm: also // ---- // f() -> FAILURE, hex"4e487b71", 0x51 diff --git a/test/libsolidity/semanticTests/uninitializedFunctionPointer/store2.sol b/test/libsolidity/semanticTests/uninitializedFunctionPointer/store2.sol index 0f446f775b0e..1c1e596abd64 100644 --- a/test/libsolidity/semanticTests/uninitializedFunctionPointer/store2.sol +++ b/test/libsolidity/semanticTests/uninitializedFunctionPointer/store2.sol @@ -35,7 +35,5 @@ contract InvalidTest { x++; } } -// ==== -// compileToEwasm: also // ---- // run() -> FAILURE, hex"4e487b71", 0x51 diff --git a/test/libsolidity/semanticTests/uninitializedFunctionPointer/storeInConstructor.sol b/test/libsolidity/semanticTests/uninitializedFunctionPointer/storeInConstructor.sol index e534e42313b2..08a96792c2ad 100644 --- a/test/libsolidity/semanticTests/uninitializedFunctionPointer/storeInConstructor.sol +++ b/test/libsolidity/semanticTests/uninitializedFunctionPointer/storeInConstructor.sol @@ -14,8 +14,6 @@ contract InvalidTest { storedFn(); } } -// ==== -// compileToEwasm: also // ---- // f() -> FAILURE, hex"4e487b71", 0x51 // f() -> FAILURE, hex"4e487b71", 0x51 diff --git a/test/libsolidity/semanticTests/uninitializedFunctionPointer/uninitialized_internal_storage_function_via_yul.sol b/test/libsolidity/semanticTests/uninitializedFunctionPointer/uninitialized_internal_storage_function_via_yul.sol index 1c69ffef23e0..bf8eab8ced87 100644 --- a/test/libsolidity/semanticTests/uninitializedFunctionPointer/uninitialized_internal_storage_function_via_yul.sol +++ b/test/libsolidity/semanticTests/uninitializedFunctionPointer/uninitialized_internal_storage_function_via_yul.sol @@ -13,6 +13,5 @@ contract Test { } // ==== // compileViaYul: true -// compileToEwasm: also // ---- // f() -> true diff --git a/test/libsolidity/semanticTests/userDefinedValueType/cleanup.sol b/test/libsolidity/semanticTests/userDefinedValueType/cleanup.sol index cc5304ed752b..cc165e879e5b 100644 --- a/test/libsolidity/semanticTests/userDefinedValueType/cleanup.sol +++ b/test/libsolidity/semanticTests/userDefinedValueType/cleanup.sol @@ -33,7 +33,6 @@ contract C { return (a, b, c); } } - // ---- // ret() -> 0xff // f(uint8): 0x1ff -> FAILURE diff --git a/test/libsolidity/semanticTests/userDefinedValueType/cleanup_abicoderv1.sol b/test/libsolidity/semanticTests/userDefinedValueType/cleanup_abicoderv1.sol index f5de5e5010b1..727c66063333 100644 --- a/test/libsolidity/semanticTests/userDefinedValueType/cleanup_abicoderv1.sol +++ b/test/libsolidity/semanticTests/userDefinedValueType/cleanup_abicoderv1.sol @@ -33,7 +33,6 @@ contract C { return (a, b, c); } } - // ==== // compileViaYul: false // ---- diff --git a/test/libsolidity/semanticTests/userDefinedValueType/conversion.sol b/test/libsolidity/semanticTests/userDefinedValueType/conversion.sol index bcdc9440e999..24b316f9cf4a 100644 --- a/test/libsolidity/semanticTests/userDefinedValueType/conversion.sol +++ b/test/libsolidity/semanticTests/userDefinedValueType/conversion.sol @@ -27,7 +27,6 @@ contract C { return MyUInt8.wrap(uint8(MyUInt16.unwrap(a))); } } - // ---- // f(uint256): 1 -> 1 // f(uint256): 2 -> 2 diff --git a/test/libsolidity/semanticTests/userDefinedValueType/conversion_abicoderv1.sol b/test/libsolidity/semanticTests/userDefinedValueType/conversion_abicoderv1.sol index af91aab0c453..e8fbfb246036 100644 --- a/test/libsolidity/semanticTests/userDefinedValueType/conversion_abicoderv1.sol +++ b/test/libsolidity/semanticTests/userDefinedValueType/conversion_abicoderv1.sol @@ -27,7 +27,6 @@ contract C { return MyUInt8.wrap(uint8(MyUInt16.unwrap(a))); } } - // ==== // compileViaYul: false // ---- diff --git a/test/libsolidity/semanticTests/userDefinedValueType/storage_layout_struct.sol b/test/libsolidity/semanticTests/userDefinedValueType/storage_layout_struct.sol index ee63c185d334..8c51b2921b1a 100644 --- a/test/libsolidity/semanticTests/userDefinedValueType/storage_layout_struct.sol +++ b/test/libsolidity/semanticTests/userDefinedValueType/storage_layout_struct.sol @@ -150,7 +150,6 @@ contract C { } } } - // ---- // storage_a() -> 0, 0 // set_a(int64,int64): 100, 200 -> diff --git a/test/libsolidity/semanticTests/userDefinedValueType/zero_cost_abstraction_comparison_elementary.sol b/test/libsolidity/semanticTests/userDefinedValueType/zero_cost_abstraction_comparison_elementary.sol index 1c3b66b28da0..2c5a15bb93ac 100644 --- a/test/libsolidity/semanticTests/userDefinedValueType/zero_cost_abstraction_comparison_elementary.sol +++ b/test/libsolidity/semanticTests/userDefinedValueType/zero_cost_abstraction_comparison_elementary.sol @@ -15,7 +15,6 @@ contract C { return a + b; } } - // ---- // getX() -> 0 // gas irOptimized: 23379 diff --git a/test/libsolidity/semanticTests/userDefinedValueType/zero_cost_abstraction_comparison_userdefined.sol b/test/libsolidity/semanticTests/userDefinedValueType/zero_cost_abstraction_comparison_userdefined.sol index 55e38689fc37..2f275c543b11 100644 --- a/test/libsolidity/semanticTests/userDefinedValueType/zero_cost_abstraction_comparison_userdefined.sol +++ b/test/libsolidity/semanticTests/userDefinedValueType/zero_cost_abstraction_comparison_userdefined.sol @@ -16,7 +16,6 @@ contract C { return MyInt.wrap(MyInt.unwrap(a) + MyInt.unwrap(b)); } } - // ---- // getX() -> 0 // gas irOptimized: 23379 diff --git a/test/libsolidity/semanticTests/using/free_function_multi.sol b/test/libsolidity/semanticTests/using/free_function_multi.sol index feec1beb3980..31ac50bc3a94 100644 --- a/test/libsolidity/semanticTests/using/free_function_multi.sol +++ b/test/libsolidity/semanticTests/using/free_function_multi.sol @@ -17,7 +17,6 @@ function id(uint x) pure returns (uint) { function zero(uint) pure returns (uint) { return 0; } - // ---- // f(uint256): 10 -> 10 // g(uint256): 10 -> 0 diff --git a/test/libsolidity/semanticTests/using/free_functions_individual.sol b/test/libsolidity/semanticTests/using/free_functions_individual.sol index 170eae4d0f12..5a14cd7cb230 100644 --- a/test/libsolidity/semanticTests/using/free_functions_individual.sol +++ b/test/libsolidity/semanticTests/using/free_functions_individual.sol @@ -19,8 +19,6 @@ function id(uint x) pure returns (uint) { function zero(uint) pure returns (uint) { return 0; } - - // ---- // f(uint256): 10 -> 10 // g(uint256): 10 -> 0 diff --git a/test/libsolidity/semanticTests/using/using_global_for_global.sol b/test/libsolidity/semanticTests/using/using_global_for_global.sol index 77bbb896fa9d..67a31c3415cc 100644 --- a/test/libsolidity/semanticTests/using/using_global_for_global.sol +++ b/test/libsolidity/semanticTests/using/using_global_for_global.sol @@ -13,6 +13,5 @@ contract C { return r.f().g(); } } - // ---- // f(uint256): 100 -> 111 \ No newline at end of file diff --git a/test/libsolidity/semanticTests/variables/delete_local.sol b/test/libsolidity/semanticTests/variables/delete_local.sol index 21f4c8edfca5..1d00bace1f61 100644 --- a/test/libsolidity/semanticTests/variables/delete_local.sol +++ b/test/libsolidity/semanticTests/variables/delete_local.sol @@ -5,7 +5,5 @@ contract test { res = v; } } -// ==== -// compileToEwasm: also // ---- // delLocal() -> 0 diff --git a/test/libsolidity/semanticTests/variables/delete_locals.sol b/test/libsolidity/semanticTests/variables/delete_locals.sol index 8c14639d36d8..e442b8e853fa 100644 --- a/test/libsolidity/semanticTests/variables/delete_locals.sol +++ b/test/libsolidity/semanticTests/variables/delete_locals.sol @@ -8,7 +8,5 @@ contract test { res2 = x; } } -// ==== -// compileToEwasm: also // ---- // delLocal() -> 6, 7 diff --git a/test/libsolidity/semanticTests/variables/public_state_overridding.sol b/test/libsolidity/semanticTests/variables/public_state_overridding.sol index 752c429cacc1..78e0fb447833 100644 --- a/test/libsolidity/semanticTests/variables/public_state_overridding.sol +++ b/test/libsolidity/semanticTests/variables/public_state_overridding.sol @@ -11,8 +11,6 @@ contract X is A function set() public { test = 2; } } -// ==== -// compileToEwasm: also // ---- // test() -> 0 // set() -> diff --git a/test/libsolidity/semanticTests/variables/public_state_overridding_dynamic_struct.sol b/test/libsolidity/semanticTests/variables/public_state_overridding_dynamic_struct.sol index 2195c85e10c0..15226b5e0997 100644 --- a/test/libsolidity/semanticTests/variables/public_state_overridding_dynamic_struct.sol +++ b/test/libsolidity/semanticTests/variables/public_state_overridding_dynamic_struct.sol @@ -16,10 +16,6 @@ contract X is A function set() public { test.v = 2; test.s = "statevar"; } } - - -// ==== -// compileToEwasm: also // ---- // test() -> 0, 64, 0 // set() -> diff --git a/test/libsolidity/semanticTests/variables/public_state_overridding_mapping_to_dynamic_struct.sol b/test/libsolidity/semanticTests/variables/public_state_overridding_mapping_to_dynamic_struct.sol index 5a3df6d21498..62aa616e891c 100644 --- a/test/libsolidity/semanticTests/variables/public_state_overridding_mapping_to_dynamic_struct.sol +++ b/test/libsolidity/semanticTests/variables/public_state_overridding_mapping_to_dynamic_struct.sol @@ -16,8 +16,6 @@ contract X is A function set() public { test[42].v = 2; test[42].s = "statevar"; } } - - // ---- // test(uint256): 0 -> 0, 64, 0 // test(uint256): 42 -> 0, 64, 0 diff --git a/test/libsolidity/semanticTests/various/address_code.sol b/test/libsolidity/semanticTests/various/address_code.sol index b944100b96f1..2712503a45c5 100644 --- a/test/libsolidity/semanticTests/various/address_code.sol +++ b/test/libsolidity/semanticTests/various/address_code.sol @@ -12,8 +12,6 @@ contract C { function g() public view returns (uint) { return address(0).code.length; } function h() public view returns (uint) { return address(1).code.length; } } -// ==== -// compileToEwasm: also // ---- // constructor() -> // gas irOptimized: 175145 diff --git a/test/libsolidity/semanticTests/various/assignment_to_const_var_involving_expression.sol b/test/libsolidity/semanticTests/various/assignment_to_const_var_involving_expression.sol index 0aa7ceb954c9..110240ce938d 100644 --- a/test/libsolidity/semanticTests/various/assignment_to_const_var_involving_expression.sol +++ b/test/libsolidity/semanticTests/various/assignment_to_const_var_involving_expression.sol @@ -5,8 +5,5 @@ contract C { return x + 1; } } - -// ==== -// compileToEwasm: also // ---- // f() -> 0x57a diff --git a/test/libsolidity/semanticTests/various/balance.sol b/test/libsolidity/semanticTests/various/balance.sol index 916c7fbff6df..8638f409c062 100644 --- a/test/libsolidity/semanticTests/various/balance.sol +++ b/test/libsolidity/semanticTests/various/balance.sol @@ -5,9 +5,6 @@ contract test { return address(this).balance; } } - -// ==== -// compileToEwasm: also // ---- // constructor(), 23 wei -> // getBalance() -> 23 diff --git a/test/libsolidity/semanticTests/various/byte_optimization_bug.sol b/test/libsolidity/semanticTests/various/byte_optimization_bug.sol index f023e971f4d6..b850ea327e5e 100644 --- a/test/libsolidity/semanticTests/various/byte_optimization_bug.sol +++ b/test/libsolidity/semanticTests/various/byte_optimization_bug.sol @@ -11,9 +11,6 @@ contract C { } } } - -// ==== -// compileToEwasm: also // ---- // f(uint256): 2 -> 0 // g(uint256): 2 -> 2 diff --git a/test/libsolidity/semanticTests/various/code_access_create.sol b/test/libsolidity/semanticTests/various/code_access_create.sol index 839608aaf5ac..075682129cda 100644 --- a/test/libsolidity/semanticTests/various/code_access_create.sol +++ b/test/libsolidity/semanticTests/various/code_access_create.sol @@ -21,7 +21,6 @@ contract C { return d.f(); } } - // ---- // test() -> 7 // gas legacy: 100849 diff --git a/test/libsolidity/semanticTests/various/code_access_runtime.sol b/test/libsolidity/semanticTests/various/code_access_runtime.sol index d22d3e43cb35..9a9e7a80bf90 100644 --- a/test/libsolidity/semanticTests/various/code_access_runtime.sol +++ b/test/libsolidity/semanticTests/various/code_access_runtime.sol @@ -19,7 +19,6 @@ contract C { return 42; } } - // ==== // EVMVersion: >=constantinople // ---- diff --git a/test/libsolidity/semanticTests/various/code_length.sol b/test/libsolidity/semanticTests/various/code_length.sol index 84fd393bd721..97a7637976eb 100644 --- a/test/libsolidity/semanticTests/various/code_length.sol +++ b/test/libsolidity/semanticTests/various/code_length.sol @@ -57,8 +57,6 @@ contract C { } } -// ==== -// compileToEwasm: also // ---- // constructor() // gas legacy: 124168 diff --git a/test/libsolidity/semanticTests/various/code_length_contract_member.sol b/test/libsolidity/semanticTests/various/code_length_contract_member.sol index 8486671ed858..ff883139a46e 100644 --- a/test/libsolidity/semanticTests/various/code_length_contract_member.sol +++ b/test/libsolidity/semanticTests/various/code_length_contract_member.sol @@ -11,7 +11,5 @@ contract C { return (s.code.length, s.another.length, address(this).code.length > 50); } } -// ==== -// compileToEwasm: also // ---- // f() -> 0x20, 0x20, true diff --git a/test/libsolidity/semanticTests/various/codebalance_assembly.sol b/test/libsolidity/semanticTests/various/codebalance_assembly.sol index be2b89f29e63..fad0d3e5b465 100644 --- a/test/libsolidity/semanticTests/various/codebalance_assembly.sol +++ b/test/libsolidity/semanticTests/various/codebalance_assembly.sol @@ -17,7 +17,6 @@ contract C { } } } - // ==== // EVMVersion: >=constantinople // ---- diff --git a/test/libsolidity/semanticTests/various/codehash.sol b/test/libsolidity/semanticTests/various/codehash.sol index f787ca5be8aa..fa7dab9dab9f 100644 --- a/test/libsolidity/semanticTests/various/codehash.sol +++ b/test/libsolidity/semanticTests/various/codehash.sol @@ -11,7 +11,6 @@ contract C { return address(this).codehash != 0; } } - // ==== // EVMVersion: >=constantinople // ---- diff --git a/test/libsolidity/semanticTests/various/codehash_assembly.sol b/test/libsolidity/semanticTests/various/codehash_assembly.sol index 71e3a20ef52a..fe2210fa107a 100644 --- a/test/libsolidity/semanticTests/various/codehash_assembly.sol +++ b/test/libsolidity/semanticTests/various/codehash_assembly.sol @@ -15,7 +15,6 @@ contract C { } } } - // ==== // EVMVersion: >=constantinople // ---- diff --git a/test/libsolidity/semanticTests/various/contract_binary_dependencies.sol b/test/libsolidity/semanticTests/various/contract_binary_dependencies.sol index 561e316880d8..0ebf772fbad7 100644 --- a/test/libsolidity/semanticTests/various/contract_binary_dependencies.sol +++ b/test/libsolidity/semanticTests/various/contract_binary_dependencies.sol @@ -15,9 +15,6 @@ contract C { new B(); } } - -// ==== -// compileToEwasm: also // ---- // constructor() -> // gas irOptimized: 100415 diff --git a/test/libsolidity/semanticTests/various/crazy_elementary_typenames_on_stack.sol b/test/libsolidity/semanticTests/various/crazy_elementary_typenames_on_stack.sol index 135543898f32..bc16bacbb6f4 100644 --- a/test/libsolidity/semanticTests/various/crazy_elementary_typenames_on_stack.sol +++ b/test/libsolidity/semanticTests/various/crazy_elementary_typenames_on_stack.sol @@ -8,8 +8,5 @@ contract C { return uint256(x); } } - -// ==== -// compileToEwasm: also // ---- // f() -> -7 diff --git a/test/libsolidity/semanticTests/various/cross_contract_types.sol b/test/libsolidity/semanticTests/various/cross_contract_types.sol index b0cf070a7bcc..9c7728a02c25 100644 --- a/test/libsolidity/semanticTests/various/cross_contract_types.sol +++ b/test/libsolidity/semanticTests/various/cross_contract_types.sol @@ -12,8 +12,5 @@ contract Test { r = x.b; } } - -// ==== -// compileToEwasm: also // ---- // f() -> 3 diff --git a/test/libsolidity/semanticTests/various/decayed_tuple.sol b/test/libsolidity/semanticTests/various/decayed_tuple.sol index f143b98471db..799da3481791 100644 --- a/test/libsolidity/semanticTests/various/decayed_tuple.sol +++ b/test/libsolidity/semanticTests/various/decayed_tuple.sol @@ -5,7 +5,5 @@ contract C { return x; } } -// ==== -// compileToEwasm: also // ---- // f() -> 2 diff --git a/test/libsolidity/semanticTests/various/destructuring_assignment.sol b/test/libsolidity/semanticTests/various/destructuring_assignment.sol index e2c8c52638b7..1534891dc1b8 100644 --- a/test/libsolidity/semanticTests/various/destructuring_assignment.sol +++ b/test/libsolidity/semanticTests/various/destructuring_assignment.sol @@ -31,7 +31,6 @@ contract C { if (x != 456 || memBytes.length != s.length || y[2] != 789) return 11; } } - // ---- // f(bytes): 0x20, 0x5, "abcde" -> 0 // gas irOptimized: 241853 diff --git a/test/libsolidity/semanticTests/various/empty_name_return_parameter.sol b/test/libsolidity/semanticTests/various/empty_name_return_parameter.sol index 906df85cc858..71eb0077c91f 100644 --- a/test/libsolidity/semanticTests/various/empty_name_return_parameter.sol +++ b/test/libsolidity/semanticTests/various/empty_name_return_parameter.sol @@ -3,8 +3,5 @@ contract test { return k; } } - -// ==== -// compileToEwasm: also // ---- // f(uint256): 9 -> 9 diff --git a/test/libsolidity/semanticTests/various/external_types_in_calls.sol b/test/libsolidity/semanticTests/various/external_types_in_calls.sol index 6b28f542c731..e8742c2346b0 100644 --- a/test/libsolidity/semanticTests/various/external_types_in_calls.sol +++ b/test/libsolidity/semanticTests/various/external_types_in_calls.sol @@ -22,7 +22,6 @@ contract C { return C1(address(9)); } } - // ---- // test() -> 9, 7 // gas legacy: 127514 diff --git a/test/libsolidity/semanticTests/various/flipping_sign_tests.sol b/test/libsolidity/semanticTests/various/flipping_sign_tests.sol index f2f63575a10e..174fb993f7bd 100644 --- a/test/libsolidity/semanticTests/various/flipping_sign_tests.sol +++ b/test/libsolidity/semanticTests/various/flipping_sign_tests.sol @@ -5,8 +5,5 @@ contract test { return true; } } - -// ==== -// compileToEwasm: also // ---- // f() -> true diff --git a/test/libsolidity/semanticTests/various/gasleft_decrease.sol b/test/libsolidity/semanticTests/various/gasleft_decrease.sol index 22566bfb1855..ab7302743f64 100644 --- a/test/libsolidity/semanticTests/various/gasleft_decrease.sol +++ b/test/libsolidity/semanticTests/various/gasleft_decrease.sol @@ -14,9 +14,6 @@ contract C { return true; } } - -// ==== -// compileToEwasm: also // ---- // f() -> true // g() -> true diff --git a/test/libsolidity/semanticTests/various/gasleft_shadow_resolution.sol b/test/libsolidity/semanticTests/various/gasleft_shadow_resolution.sol index 3fe3ba10d3d6..280bc496095b 100644 --- a/test/libsolidity/semanticTests/various/gasleft_shadow_resolution.sol +++ b/test/libsolidity/semanticTests/various/gasleft_shadow_resolution.sol @@ -7,8 +7,5 @@ contract C { return gasleft(); } } - -// ==== -// compileToEwasm: also // ---- // f() -> 0 diff --git a/test/libsolidity/semanticTests/various/inline_member_init.sol b/test/libsolidity/semanticTests/various/inline_member_init.sol index 7d3b754928e7..5c48b5d72e2c 100644 --- a/test/libsolidity/semanticTests/various/inline_member_init.sol +++ b/test/libsolidity/semanticTests/various/inline_member_init.sol @@ -14,7 +14,5 @@ contract test { c = m_c; } } -// ==== -// compileToEwasm: also // ---- // get() -> 5, 6, 8 diff --git a/test/libsolidity/semanticTests/various/inline_member_init_inheritence.sol b/test/libsolidity/semanticTests/various/inline_member_init_inheritence.sol index 825bd6d2f9e3..b440b35a83b0 100644 --- a/test/libsolidity/semanticTests/various/inline_member_init_inheritence.sol +++ b/test/libsolidity/semanticTests/various/inline_member_init_inheritence.sol @@ -18,8 +18,6 @@ contract Derived is Base { return m_derived; } } -// ==== -// compileToEwasm: also // ---- // getBMember() -> 5 // getDMember() -> 6 diff --git a/test/libsolidity/semanticTests/various/inline_tuple_with_rational_numbers.sol b/test/libsolidity/semanticTests/various/inline_tuple_with_rational_numbers.sol index f8c396dd161b..e85a38dd6b2a 100644 --- a/test/libsolidity/semanticTests/various/inline_tuple_with_rational_numbers.sol +++ b/test/libsolidity/semanticTests/various/inline_tuple_with_rational_numbers.sol @@ -4,8 +4,5 @@ contract c { return foo3[0]; } } - -// ==== -// compileToEwasm: also // ---- // f() -> 1 diff --git a/test/libsolidity/semanticTests/various/iszero_bnot_correct.sol b/test/libsolidity/semanticTests/various/iszero_bnot_correct.sol index 5744272cee13..d797ab9cd4b8 100644 --- a/test/libsolidity/semanticTests/various/iszero_bnot_correct.sol +++ b/test/libsolidity/semanticTests/various/iszero_bnot_correct.sol @@ -14,8 +14,5 @@ contract C { return true; } } - -// ==== -// compileToEwasm: also // ---- // f() -> true diff --git a/test/libsolidity/semanticTests/various/literal_empty_string.sol b/test/libsolidity/semanticTests/various/literal_empty_string.sol index bf4da54099af..44154fa55b99 100644 --- a/test/libsolidity/semanticTests/various/literal_empty_string.sol +++ b/test/libsolidity/semanticTests/various/literal_empty_string.sol @@ -11,7 +11,6 @@ contract C { this.f("", 2); } } - // ---- // x() -> 0 // a() -> 0 diff --git a/test/libsolidity/semanticTests/various/memory_overwrite.sol b/test/libsolidity/semanticTests/various/memory_overwrite.sol index 930b06f4a0ab..3ab16a3e88f4 100644 --- a/test/libsolidity/semanticTests/various/memory_overwrite.sol +++ b/test/libsolidity/semanticTests/various/memory_overwrite.sol @@ -5,8 +5,5 @@ contract C { x[0] = 0x62; } } - -// ==== -// compileToEwasm: also // ---- // f() -> 0x20, 5, "b23a5" diff --git a/test/libsolidity/semanticTests/various/multi_modifiers.sol b/test/libsolidity/semanticTests/various/multi_modifiers.sol index b6d8dd84c9b0..07f6c038d3db 100644 --- a/test/libsolidity/semanticTests/various/multi_modifiers.sol +++ b/test/libsolidity/semanticTests/various/multi_modifiers.sol @@ -16,8 +16,6 @@ contract C { x += 3; } } -// ==== -// compileToEwasm: also // ---- // f1() -> // x() -> 0x08 diff --git a/test/libsolidity/semanticTests/various/multi_variable_declaration.sol b/test/libsolidity/semanticTests/various/multi_variable_declaration.sol index e054329c911f..de4ecdbe46bd 100644 --- a/test/libsolidity/semanticTests/various/multi_variable_declaration.sol +++ b/test/libsolidity/semanticTests/various/multi_variable_declaration.sol @@ -42,7 +42,5 @@ contract C { return f1() && f2(); } } -// ==== -// compileToEwasm: also // ---- // f() -> true diff --git a/test/libsolidity/semanticTests/various/nested_calldata_struct.sol b/test/libsolidity/semanticTests/various/nested_calldata_struct.sol index 8ba68599e93d..b11241322cec 100644 --- a/test/libsolidity/semanticTests/various/nested_calldata_struct.sol +++ b/test/libsolidity/semanticTests/various/nested_calldata_struct.sol @@ -21,8 +21,5 @@ contract C { return (s.a, s.b, s.s.a, s.s.b, s.c); } } - -// ==== -// compileToEwasm: also // ---- // f((uint256,uint256,(uint256,uint256),uint256)): 1, 2, 3, 4, 5 -> 1, 2, 3, 4, 5 diff --git a/test/libsolidity/semanticTests/various/nested_calldata_struct_to_memory.sol b/test/libsolidity/semanticTests/various/nested_calldata_struct_to_memory.sol index 595f88f54548..25cd645e45bd 100644 --- a/test/libsolidity/semanticTests/various/nested_calldata_struct_to_memory.sol +++ b/test/libsolidity/semanticTests/various/nested_calldata_struct_to_memory.sol @@ -22,6 +22,5 @@ contract C { return (m.a, m.b, m.s.a, m.s.b, m.c); } } - // ---- // f((uint256,uint256,(uint256,uint256),uint256)): 1, 2, 3, 4, 5 -> 1, 2, 3, 4, 5 diff --git a/test/libsolidity/semanticTests/various/positive_integers_to_signed.sol b/test/libsolidity/semanticTests/various/positive_integers_to_signed.sol index 4c23564995bb..4c0d7114588e 100644 --- a/test/libsolidity/semanticTests/various/positive_integers_to_signed.sol +++ b/test/libsolidity/semanticTests/various/positive_integers_to_signed.sol @@ -3,8 +3,6 @@ contract test { int8 public y = 127; int16 public q = 250; } -// ==== -// compileToEwasm: also // ---- // x() -> 2 // y() -> 127 diff --git a/test/libsolidity/semanticTests/various/senders_balance.sol b/test/libsolidity/semanticTests/various/senders_balance.sol index 9f391e2a17ea..6a8da27784f1 100644 --- a/test/libsolidity/semanticTests/various/senders_balance.sol +++ b/test/libsolidity/semanticTests/various/senders_balance.sol @@ -14,7 +14,6 @@ contract D { return c.f(); } } - // ---- // constructor(), 27 wei -> // gas irOptimized: 169377 diff --git a/test/libsolidity/semanticTests/various/single_copy_with_multiple_inheritance.sol b/test/libsolidity/semanticTests/various/single_copy_with_multiple_inheritance.sol index c1dab1895d8f..69c4c4121dee 100644 --- a/test/libsolidity/semanticTests/various/single_copy_with_multiple_inheritance.sol +++ b/test/libsolidity/semanticTests/various/single_copy_with_multiple_inheritance.sol @@ -26,9 +26,6 @@ contract B is Base { contract Derived is Base, B, A {} - -// ==== -// compileToEwasm: also // ---- // getViaB() -> 0 // setViaA(uint256): 23 -> diff --git a/test/libsolidity/semanticTests/various/skip_dynamic_types_for_structs.sol b/test/libsolidity/semanticTests/various/skip_dynamic_types_for_structs.sol index ec94f73a1f18..efff7a95073a 100644 --- a/test/libsolidity/semanticTests/various/skip_dynamic_types_for_structs.sol +++ b/test/libsolidity/semanticTests/various/skip_dynamic_types_for_structs.sol @@ -17,7 +17,6 @@ contract C { return (x, y); } } - // ---- // g() -> 2, 6 // gas irOptimized: 178542 diff --git a/test/libsolidity/semanticTests/various/state_variable_local_variable_mixture.sol b/test/libsolidity/semanticTests/various/state_variable_local_variable_mixture.sol index d3203160a620..f7add5fba191 100644 --- a/test/libsolidity/semanticTests/various/state_variable_local_variable_mixture.sol +++ b/test/libsolidity/semanticTests/various/state_variable_local_variable_mixture.sol @@ -6,7 +6,5 @@ contract A { x = A.y; } } -// ==== -// compileToEwasm: also // ---- // a() -> 2 diff --git a/test/libsolidity/semanticTests/various/state_variable_under_contract_name.sol b/test/libsolidity/semanticTests/various/state_variable_under_contract_name.sol index e71d802fbf71..1167da57e08d 100644 --- a/test/libsolidity/semanticTests/various/state_variable_under_contract_name.sol +++ b/test/libsolidity/semanticTests/various/state_variable_under_contract_name.sol @@ -5,7 +5,5 @@ contract Scope { stateVar = Scope.stateVar; } } -// ==== -// compileToEwasm: also // ---- // getStateVar() -> 42 diff --git a/test/libsolidity/semanticTests/various/string_tuples.sol b/test/libsolidity/semanticTests/various/string_tuples.sol index 935c0b3c2035..57028ae39a05 100644 --- a/test/libsolidity/semanticTests/various/string_tuples.sol +++ b/test/libsolidity/semanticTests/various/string_tuples.sol @@ -11,8 +11,6 @@ contract C { return ("abc"); } } -// ==== -// compileToEwasm: also // ---- // f() -> 0x40, 0x8, 0x3, "abc" // g() -> 0x40, 0x80, 0x3, "abc", 0x3, "def" diff --git a/test/libsolidity/semanticTests/various/super.sol b/test/libsolidity/semanticTests/various/super.sol index 9035f0ca2a80..cd1b4a71afd8 100644 --- a/test/libsolidity/semanticTests/various/super.sol +++ b/test/libsolidity/semanticTests/various/super.sol @@ -24,8 +24,5 @@ contract D is B, C { return super.f() | 8; } } - -// ==== -// compileToEwasm: also // ---- // f() -> 15 diff --git a/test/libsolidity/semanticTests/various/super_alone.sol b/test/libsolidity/semanticTests/various/super_alone.sol index 069df9a91c2b..223e31762c86 100644 --- a/test/libsolidity/semanticTests/various/super_alone.sol +++ b/test/libsolidity/semanticTests/various/super_alone.sol @@ -3,8 +3,5 @@ contract A { super; } } - -// ==== -// compileToEwasm: also // ---- // f() -> diff --git a/test/libsolidity/semanticTests/various/super_parentheses.sol b/test/libsolidity/semanticTests/various/super_parentheses.sol index 3c687d9c19ee..fd7944764dec 100644 --- a/test/libsolidity/semanticTests/various/super_parentheses.sol +++ b/test/libsolidity/semanticTests/various/super_parentheses.sol @@ -24,8 +24,5 @@ contract D is B, C { return ((super).f)() | 8; } } - -// ==== -// compileToEwasm: also // ---- // f() -> 15 diff --git a/test/libsolidity/semanticTests/various/swap_in_storage_overwrite.sol b/test/libsolidity/semanticTests/various/swap_in_storage_overwrite.sol index a21065bf7219..482847b67f64 100644 --- a/test/libsolidity/semanticTests/various/swap_in_storage_overwrite.sol +++ b/test/libsolidity/semanticTests/various/swap_in_storage_overwrite.sol @@ -22,9 +22,6 @@ contract c { (x, y) = (y, x); } } - -// ==== -// compileToEwasm: also // ---- // x() -> 0, 0 // y() -> 0, 0 diff --git a/test/libsolidity/semanticTests/various/test_underscore_in_hex.sol b/test/libsolidity/semanticTests/various/test_underscore_in_hex.sol index 76c6828cd2b6..b9503e44c667 100644 --- a/test/libsolidity/semanticTests/various/test_underscore_in_hex.sol +++ b/test/libsolidity/semanticTests/various/test_underscore_in_hex.sol @@ -5,8 +5,6 @@ contract test { return cond ? x : y; } } -// ==== -// compileToEwasm: also // ---- // f(bool): true -> 0x1234ab // f(bool): false -> 0x1234abcd1234 diff --git a/test/libsolidity/semanticTests/various/typed_multi_variable_declaration.sol b/test/libsolidity/semanticTests/various/typed_multi_variable_declaration.sol index 018ee9669874..c9f12fdaefd4 100644 --- a/test/libsolidity/semanticTests/various/typed_multi_variable_declaration.sol +++ b/test/libsolidity/semanticTests/various/typed_multi_variable_declaration.sol @@ -21,8 +21,5 @@ contract C { return true; } } - -// ==== -// compileToEwasm: also // ---- // f() -> true diff --git a/test/libsolidity/semanticTests/various/value_complex.sol b/test/libsolidity/semanticTests/various/value_complex.sol index a799b7d9bf2c..80f8bb55cc82 100644 --- a/test/libsolidity/semanticTests/various/value_complex.sol +++ b/test/libsolidity/semanticTests/various/value_complex.sol @@ -17,7 +17,6 @@ contract test { return h.getBalance{value: amount + 3, gas: 1000}(); } } - // ---- // constructor(), 20 wei -> // gas irOptimized: 174351 diff --git a/test/libsolidity/semanticTests/various/value_insane.sol b/test/libsolidity/semanticTests/various/value_insane.sol index 8718bd42249f..4a4432758458 100644 --- a/test/libsolidity/semanticTests/various/value_insane.sol +++ b/test/libsolidity/semanticTests/various/value_insane.sol @@ -16,7 +16,6 @@ contract test { return h.getBalance{value: amount + 3, gas: 1000}(); } } - // ---- // constructor(), 20 wei -> // gas irOptimized: 175215 diff --git a/test/libsolidity/semanticTests/various/write_storage_external.sol b/test/libsolidity/semanticTests/various/write_storage_external.sol index 0bbe522484da..a8959b24ea81 100644 --- a/test/libsolidity/semanticTests/various/write_storage_external.sol +++ b/test/libsolidity/semanticTests/various/write_storage_external.sol @@ -33,7 +33,6 @@ contract D { return c.x(); } } - // ---- // f() -> 3 // g() -> 8 diff --git a/test/libsolidity/semanticTests/viaYul/assert.sol b/test/libsolidity/semanticTests/viaYul/assert.sol index aa8de1c277ae..bd1cabc48be3 100644 --- a/test/libsolidity/semanticTests/viaYul/assert.sol +++ b/test/libsolidity/semanticTests/viaYul/assert.sol @@ -13,8 +13,6 @@ contract C { assert(true); } } -// ==== -// compileToEwasm: also // ---- // f(bool): true -> true // f(bool): false -> FAILURE, hex"4e487b71", 0x01 diff --git a/test/libsolidity/semanticTests/viaYul/assert_and_require.sol b/test/libsolidity/semanticTests/viaYul/assert_and_require.sol index 290ef35b31d7..a403b5d64a65 100644 --- a/test/libsolidity/semanticTests/viaYul/assert_and_require.sol +++ b/test/libsolidity/semanticTests/viaYul/assert_and_require.sol @@ -10,8 +10,6 @@ contract C { require(b); } } -// ==== -// compileToEwasm: also // ---- // f(bool): true -> true // f(bool): false -> FAILURE, hex"4e487b71", 0x01 diff --git a/test/libsolidity/semanticTests/viaYul/assign_tuple_from_function_call.sol b/test/libsolidity/semanticTests/viaYul/assign_tuple_from_function_call.sol index c36cc26dc0f0..5da58b31641d 100644 --- a/test/libsolidity/semanticTests/viaYul/assign_tuple_from_function_call.sol +++ b/test/libsolidity/semanticTests/viaYul/assign_tuple_from_function_call.sol @@ -9,8 +9,6 @@ contract C { (,,a) = f(); } } -// ==== -// compileToEwasm: also // ---- // g() -> 3, 2, 1 // h() -> 3 diff --git a/test/libsolidity/semanticTests/viaYul/cleanup/checked_arithmetic.sol b/test/libsolidity/semanticTests/viaYul/cleanup/checked_arithmetic.sol index a81ab4577a2c..19b7cb846430 100644 --- a/test/libsolidity/semanticTests/viaYul/cleanup/checked_arithmetic.sol +++ b/test/libsolidity/semanticTests/viaYul/cleanup/checked_arithmetic.sol @@ -51,7 +51,6 @@ contract C { } } // ==== -// compileToEwasm: also // compileViaYul: true // ---- // add() -> 1, 1 diff --git a/test/libsolidity/semanticTests/viaYul/cleanup/comparison.sol b/test/libsolidity/semanticTests/viaYul/cleanup/comparison.sol index ab3d92a18b3b..035c2690614a 100644 --- a/test/libsolidity/semanticTests/viaYul/cleanup/comparison.sol +++ b/test/libsolidity/semanticTests/viaYul/cleanup/comparison.sol @@ -30,8 +30,6 @@ contract C { return (x < y); } } -// ==== -// compileToEwasm: also // ---- // eq() -> true // neq() -> false diff --git a/test/libsolidity/semanticTests/viaYul/comparison.sol b/test/libsolidity/semanticTests/viaYul/comparison.sol index 0b0763b6eab7..1ac2aec17558 100644 --- a/test/libsolidity/semanticTests/viaYul/comparison.sol +++ b/test/libsolidity/semanticTests/viaYul/comparison.sol @@ -36,8 +36,6 @@ contract C { return a != b; } } -// ==== -// compileToEwasm: also // ---- // f(address): 0x1234 -> false // f(address): 0x00 -> true diff --git a/test/libsolidity/semanticTests/viaYul/comparison_functions.sol b/test/libsolidity/semanticTests/viaYul/comparison_functions.sol index 89d90e577b31..a004299b3b75 100644 --- a/test/libsolidity/semanticTests/viaYul/comparison_functions.sol +++ b/test/libsolidity/semanticTests/viaYul/comparison_functions.sol @@ -24,8 +24,6 @@ contract C { inv = internal1 != invalid; } } -// ==== -// compileToEwasm: also // ---- // equal() -> true, false, false // unequal() -> false, true, true diff --git a/test/libsolidity/semanticTests/viaYul/conditional/conditional_multiple.sol b/test/libsolidity/semanticTests/viaYul/conditional/conditional_multiple.sol index 9e1e8c77877d..828398f57b40 100644 --- a/test/libsolidity/semanticTests/viaYul/conditional/conditional_multiple.sol +++ b/test/libsolidity/semanticTests/viaYul/conditional/conditional_multiple.sol @@ -4,7 +4,5 @@ contract A { return x; } } -// ==== -// compileToEwasm: also // ---- // f() -> 7 diff --git a/test/libsolidity/semanticTests/viaYul/conditional/conditional_true_false_literal.sol b/test/libsolidity/semanticTests/viaYul/conditional/conditional_true_false_literal.sol index 3eda8bfc7681..c2bbb08d5294 100644 --- a/test/libsolidity/semanticTests/viaYul/conditional/conditional_true_false_literal.sol +++ b/test/libsolidity/semanticTests/viaYul/conditional/conditional_true_false_literal.sol @@ -5,7 +5,5 @@ contract A { return x + y; } } -// ==== -// compileToEwasm: also // ---- // f() -> 2 diff --git a/test/libsolidity/semanticTests/viaYul/conditional/conditional_tuple.sol b/test/libsolidity/semanticTests/viaYul/conditional/conditional_tuple.sol index a0b206a12833..51030f9a3a25 100644 --- a/test/libsolidity/semanticTests/viaYul/conditional/conditional_tuple.sol +++ b/test/libsolidity/semanticTests/viaYul/conditional/conditional_tuple.sol @@ -4,8 +4,6 @@ contract A { return (a, b); } } -// ==== -// compileToEwasm: also // ---- // f(bool): true -> 1, 2 // f(bool): false -> 3, 4 diff --git a/test/libsolidity/semanticTests/viaYul/conditional/conditional_with_assignment.sol b/test/libsolidity/semanticTests/viaYul/conditional/conditional_with_assignment.sol index a132e887307c..80d4dde60dc6 100644 --- a/test/libsolidity/semanticTests/viaYul/conditional/conditional_with_assignment.sol +++ b/test/libsolidity/semanticTests/viaYul/conditional/conditional_with_assignment.sol @@ -7,7 +7,5 @@ contract A { return (x, y1, y2, z); } } -// ==== -// compileToEwasm: also // ---- // f() -> 6, 1, 5, 5 diff --git a/test/libsolidity/semanticTests/viaYul/conditional/conditional_with_variables.sol b/test/libsolidity/semanticTests/viaYul/conditional/conditional_with_variables.sol index c5bf8e01851c..4de296630d46 100644 --- a/test/libsolidity/semanticTests/viaYul/conditional/conditional_with_variables.sol +++ b/test/libsolidity/semanticTests/viaYul/conditional/conditional_with_variables.sol @@ -7,7 +7,5 @@ contract A { return (x, y, z, w); } } -// ==== -// compileToEwasm: also // ---- // f() -> 3, 1, 3, 1 diff --git a/test/libsolidity/semanticTests/viaYul/conversion/explicit_cast_assignment.sol b/test/libsolidity/semanticTests/viaYul/conversion/explicit_cast_assignment.sol index 5d0d50dadd03..cc5a156e20dc 100644 --- a/test/libsolidity/semanticTests/viaYul/conversion/explicit_cast_assignment.sol +++ b/test/libsolidity/semanticTests/viaYul/conversion/explicit_cast_assignment.sol @@ -4,7 +4,5 @@ contract C { x = y; } } -// ==== -// compileToEwasm: also // ---- // f() -> 0x78 diff --git a/test/libsolidity/semanticTests/viaYul/conversion/explicit_cast_function_call.sol b/test/libsolidity/semanticTests/viaYul/conversion/explicit_cast_function_call.sol index 34cc69ffeb3d..0ab4b34a741d 100644 --- a/test/libsolidity/semanticTests/viaYul/conversion/explicit_cast_function_call.sol +++ b/test/libsolidity/semanticTests/viaYul/conversion/explicit_cast_function_call.sol @@ -6,7 +6,5 @@ contract C { x = f(bytes4(uint32(0x12345678))); } } -// ==== -// compileToEwasm: also // ---- // g() -> 0x1234567800000000000000000000000000000000000000000000000000000000 diff --git a/test/libsolidity/semanticTests/viaYul/conversion/explicit_cast_local_assignment.sol b/test/libsolidity/semanticTests/viaYul/conversion/explicit_cast_local_assignment.sol index fe07146e18fb..425c6eaedd68 100644 --- a/test/libsolidity/semanticTests/viaYul/conversion/explicit_cast_local_assignment.sol +++ b/test/libsolidity/semanticTests/viaYul/conversion/explicit_cast_local_assignment.sol @@ -4,7 +4,5 @@ contract C { x = b; } } -// ==== -// compileToEwasm: also // ---- // f(uint256): 0x12345678 -> 0x78 diff --git a/test/libsolidity/semanticTests/viaYul/conversion/implicit_cast_assignment.sol b/test/libsolidity/semanticTests/viaYul/conversion/implicit_cast_assignment.sol index 05d265343c80..e22466010c83 100644 --- a/test/libsolidity/semanticTests/viaYul/conversion/implicit_cast_assignment.sol +++ b/test/libsolidity/semanticTests/viaYul/conversion/implicit_cast_assignment.sol @@ -8,7 +8,5 @@ contract C { x = y; } } -// ==== -// compileToEwasm: also // ---- // f() -> 0x78 diff --git a/test/libsolidity/semanticTests/viaYul/conversion/implicit_cast_function_call.sol b/test/libsolidity/semanticTests/viaYul/conversion/implicit_cast_function_call.sol index a2c2d92077a6..e62d45b3576f 100644 --- a/test/libsolidity/semanticTests/viaYul/conversion/implicit_cast_function_call.sol +++ b/test/libsolidity/semanticTests/viaYul/conversion/implicit_cast_function_call.sol @@ -11,7 +11,5 @@ contract C { x = f(a); } } -// ==== -// compileToEwasm: also // ---- // g() -> 0x78 diff --git a/test/libsolidity/semanticTests/viaYul/conversion/implicit_cast_local_assignment.sol b/test/libsolidity/semanticTests/viaYul/conversion/implicit_cast_local_assignment.sol index e582ff394e2f..3793b4e0cf21 100644 --- a/test/libsolidity/semanticTests/viaYul/conversion/implicit_cast_local_assignment.sol +++ b/test/libsolidity/semanticTests/viaYul/conversion/implicit_cast_local_assignment.sol @@ -7,7 +7,5 @@ contract C { y = z; } } -// ==== -// compileToEwasm: also // ---- // f() -> 0x78 diff --git a/test/libsolidity/semanticTests/viaYul/define_tuple_from_function_call.sol b/test/libsolidity/semanticTests/viaYul/define_tuple_from_function_call.sol index 24c72943fff1..3e1559bcfa2f 100644 --- a/test/libsolidity/semanticTests/viaYul/define_tuple_from_function_call.sol +++ b/test/libsolidity/semanticTests/viaYul/define_tuple_from_function_call.sol @@ -11,8 +11,6 @@ contract C { return a; } } -// ==== -// compileToEwasm: also // ---- // g() -> 3, 2, 1 // h() -> 3 diff --git a/test/libsolidity/semanticTests/viaYul/delete.sol b/test/libsolidity/semanticTests/viaYul/delete.sol index 3439bc4df9f5..6a0f3d598618 100644 --- a/test/libsolidity/semanticTests/viaYul/delete.sol +++ b/test/libsolidity/semanticTests/viaYul/delete.sol @@ -18,8 +18,6 @@ contract C { return func() == internal_func(); } } -// ==== -// compileToEwasm: also // ---- // call_deleted_internal_func() -> FAILURE, hex"4e487b71", 0x51 // call_internal_func() -> true diff --git a/test/libsolidity/semanticTests/viaYul/detect_add_overflow.sol b/test/libsolidity/semanticTests/viaYul/detect_add_overflow.sol index 6e6f108a629b..412998b55993 100644 --- a/test/libsolidity/semanticTests/viaYul/detect_add_overflow.sol +++ b/test/libsolidity/semanticTests/viaYul/detect_add_overflow.sol @@ -6,8 +6,6 @@ contract C { x = a + b; } } -// ==== -// compileToEwasm: also // ---- // f(uint256,uint256): 5, 6 -> 11 // f(uint256,uint256): -2, 1 -> -1 diff --git a/test/libsolidity/semanticTests/viaYul/detect_add_overflow_signed.sol b/test/libsolidity/semanticTests/viaYul/detect_add_overflow_signed.sol index 0e7d2db37d15..5c721ac2f2bf 100644 --- a/test/libsolidity/semanticTests/viaYul/detect_add_overflow_signed.sol +++ b/test/libsolidity/semanticTests/viaYul/detect_add_overflow_signed.sol @@ -6,8 +6,6 @@ contract C { x = a + b; } } -// ==== -// compileToEwasm: also // ---- // f(int256,int256): 5, 6 -> 11 // f(int256,int256): -2, 1 -> -1 diff --git a/test/libsolidity/semanticTests/viaYul/detect_div_overflow.sol b/test/libsolidity/semanticTests/viaYul/detect_div_overflow.sol index ab3d97f46da7..d4cefe12f651 100644 --- a/test/libsolidity/semanticTests/viaYul/detect_div_overflow.sol +++ b/test/libsolidity/semanticTests/viaYul/detect_div_overflow.sol @@ -9,8 +9,6 @@ contract C { x = a / b; } } -// ==== -// compileToEwasm: also // ---- // f(uint256,uint256): 10, 3 -> 3 // f(uint256,uint256): 1, 0 -> FAILURE, hex"4e487b71", 0x12 diff --git a/test/libsolidity/semanticTests/viaYul/detect_mod_zero.sol b/test/libsolidity/semanticTests/viaYul/detect_mod_zero.sol index 5307f958984f..0d0432987459 100644 --- a/test/libsolidity/semanticTests/viaYul/detect_mod_zero.sol +++ b/test/libsolidity/semanticTests/viaYul/detect_mod_zero.sol @@ -6,8 +6,6 @@ contract C { x = a % b; } } -// ==== -// compileToEwasm: also // ---- // f(uint256,uint256): 10, 3 -> 1 // f(uint256,uint256): 10, 2 -> 0 diff --git a/test/libsolidity/semanticTests/viaYul/detect_mod_zero_signed.sol b/test/libsolidity/semanticTests/viaYul/detect_mod_zero_signed.sol index 102df82f3003..e97bc4cc30a2 100644 --- a/test/libsolidity/semanticTests/viaYul/detect_mod_zero_signed.sol +++ b/test/libsolidity/semanticTests/viaYul/detect_mod_zero_signed.sol @@ -6,8 +6,6 @@ contract C { x = a % b; } } -// ==== -// compileToEwasm: also // ---- // f(int256,int256): 10, 3 -> 1 // f(int256,int256): 10, 2 -> 0 diff --git a/test/libsolidity/semanticTests/viaYul/detect_mul_overflow.sol b/test/libsolidity/semanticTests/viaYul/detect_mul_overflow.sol index 8cc64ffa07dc..935d03752dc5 100644 --- a/test/libsolidity/semanticTests/viaYul/detect_mul_overflow.sol +++ b/test/libsolidity/semanticTests/viaYul/detect_mul_overflow.sol @@ -6,8 +6,6 @@ contract C { x = a * b; } } -// ==== -// compileToEwasm: also // ---- // f(uint256,uint256): 5, 6 -> 30 // f(uint256,uint256): -1, 1 -> -1 diff --git a/test/libsolidity/semanticTests/viaYul/detect_mul_overflow_signed.sol b/test/libsolidity/semanticTests/viaYul/detect_mul_overflow_signed.sol index a9581c49f721..213b1a6d3b24 100644 --- a/test/libsolidity/semanticTests/viaYul/detect_mul_overflow_signed.sol +++ b/test/libsolidity/semanticTests/viaYul/detect_mul_overflow_signed.sol @@ -9,8 +9,6 @@ contract C { x = a * b; } } -// ==== -// compileToEwasm: also // ---- // f(int256,int256): 5, 6 -> 30 // f(int256,int256): -1, 1 -> -1 diff --git a/test/libsolidity/semanticTests/viaYul/detect_sub_overflow.sol b/test/libsolidity/semanticTests/viaYul/detect_sub_overflow.sol index 1f6a0d7e5adc..ee059137a028 100644 --- a/test/libsolidity/semanticTests/viaYul/detect_sub_overflow.sol +++ b/test/libsolidity/semanticTests/viaYul/detect_sub_overflow.sol @@ -6,8 +6,6 @@ contract C { x = a - b; } } -// ==== -// compileToEwasm: also // ---- // f(uint256,uint256): 6, 5 -> 1 // f(uint256,uint256): 6, 6 -> 0 diff --git a/test/libsolidity/semanticTests/viaYul/detect_sub_overflow_signed.sol b/test/libsolidity/semanticTests/viaYul/detect_sub_overflow_signed.sol index 34992607903f..a247af68bff8 100644 --- a/test/libsolidity/semanticTests/viaYul/detect_sub_overflow_signed.sol +++ b/test/libsolidity/semanticTests/viaYul/detect_sub_overflow_signed.sol @@ -6,8 +6,6 @@ contract C { x = a - b; } } -// ==== -// compileToEwasm: also // ---- // f(int256,int256): 5, 6 -> -1 // f(int256,int256): -2, 1 -> -3 diff --git a/test/libsolidity/semanticTests/viaYul/dirty_memory_dynamic_array.sol b/test/libsolidity/semanticTests/viaYul/dirty_memory_dynamic_array.sol index 8b34fd801f85..36a253b02452 100644 --- a/test/libsolidity/semanticTests/viaYul/dirty_memory_dynamic_array.sol +++ b/test/libsolidity/semanticTests/viaYul/dirty_memory_dynamic_array.sol @@ -13,7 +13,6 @@ contract C { } } // ==== -// compileToEwasm: also // compileViaYul: true // ---- // f() -> true diff --git a/test/libsolidity/semanticTests/viaYul/dirty_memory_int32.sol b/test/libsolidity/semanticTests/viaYul/dirty_memory_int32.sol index 636572d500f3..fc2fe4251658 100644 --- a/test/libsolidity/semanticTests/viaYul/dirty_memory_int32.sol +++ b/test/libsolidity/semanticTests/viaYul/dirty_memory_int32.sol @@ -13,7 +13,6 @@ contract C { } } // ==== -// compileToEwasm: also // compileViaYul: true // ---- // f() -> true diff --git a/test/libsolidity/semanticTests/viaYul/dirty_memory_static_array.sol b/test/libsolidity/semanticTests/viaYul/dirty_memory_static_array.sol index 2e9acb27c322..4742bae2dfdf 100644 --- a/test/libsolidity/semanticTests/viaYul/dirty_memory_static_array.sol +++ b/test/libsolidity/semanticTests/viaYul/dirty_memory_static_array.sol @@ -13,7 +13,6 @@ contract C { } } // ==== -// compileToEwasm: also // compileViaYul: true // ---- // f() -> true diff --git a/test/libsolidity/semanticTests/viaYul/dirty_memory_struct.sol b/test/libsolidity/semanticTests/viaYul/dirty_memory_struct.sol index 7c14280502a9..411cbe069e6a 100644 --- a/test/libsolidity/semanticTests/viaYul/dirty_memory_struct.sol +++ b/test/libsolidity/semanticTests/viaYul/dirty_memory_struct.sol @@ -17,7 +17,6 @@ contract C { } } // ==== -// compileToEwasm: also // compileViaYul: true // ---- // f() -> true diff --git a/test/libsolidity/semanticTests/viaYul/dirty_memory_uint32.sol b/test/libsolidity/semanticTests/viaYul/dirty_memory_uint32.sol index cfd2c05af9bb..a23a566c5bbe 100644 --- a/test/libsolidity/semanticTests/viaYul/dirty_memory_uint32.sol +++ b/test/libsolidity/semanticTests/viaYul/dirty_memory_uint32.sol @@ -13,7 +13,6 @@ contract C { } } // ==== -// compileToEwasm: also // compileViaYul: true // ---- // f() -> true diff --git a/test/libsolidity/semanticTests/viaYul/exp.sol b/test/libsolidity/semanticTests/viaYul/exp.sol index 1ca5842ab078..324256b456df 100644 --- a/test/libsolidity/semanticTests/viaYul/exp.sol +++ b/test/libsolidity/semanticTests/viaYul/exp.sol @@ -3,8 +3,6 @@ contract C { return x**y; } } -// ==== -// compileToEwasm: also // ---- // f(uint256,uint256): 0, 0 -> 1 // f(uint256,uint256): 0, 1 -> 0x00 diff --git a/test/libsolidity/semanticTests/viaYul/exp_literals.sol b/test/libsolidity/semanticTests/viaYul/exp_literals.sol index 55ed66eb3fc9..382d75184ff5 100644 --- a/test/libsolidity/semanticTests/viaYul/exp_literals.sol +++ b/test/libsolidity/semanticTests/viaYul/exp_literals.sol @@ -29,7 +29,6 @@ contract C { } // ==== -// compileToEwasm: also // compileViaYul: true // ---- // exp_2(uint256): 255 -> 57896044618658097711785492504343953926634992332820282019728792003956564819968 diff --git a/test/libsolidity/semanticTests/viaYul/exp_literals_success.sol b/test/libsolidity/semanticTests/viaYul/exp_literals_success.sol index d28a56eb4f17..12ab33924293 100644 --- a/test/libsolidity/semanticTests/viaYul/exp_literals_success.sol +++ b/test/libsolidity/semanticTests/viaYul/exp_literals_success.sol @@ -28,8 +28,6 @@ contract C { } } -// ==== -// compileToEwasm: also // ---- // exp_2(uint256): 255 -> 57896044618658097711785492504343953926634992332820282019728792003956564819968 // exp_minus_2(uint256): 255 -> -57896044618658097711785492504343953926634992332820282019728792003956564819968 diff --git a/test/libsolidity/semanticTests/viaYul/exp_neg.sol b/test/libsolidity/semanticTests/viaYul/exp_neg.sol index de58d65926cd..a6ba617d7945 100644 --- a/test/libsolidity/semanticTests/viaYul/exp_neg.sol +++ b/test/libsolidity/semanticTests/viaYul/exp_neg.sol @@ -3,8 +3,6 @@ contract C { return x**y; } } -// ==== -// compileToEwasm: also // ---- // f(int256,uint256): 0, 0 -> 1 // f(int256,uint256): 0, 1 -> 0x00 diff --git a/test/libsolidity/semanticTests/viaYul/exp_neg_overflow.sol b/test/libsolidity/semanticTests/viaYul/exp_neg_overflow.sol index 9d4b59d5286b..a966e3ccdbf3 100644 --- a/test/libsolidity/semanticTests/viaYul/exp_neg_overflow.sol +++ b/test/libsolidity/semanticTests/viaYul/exp_neg_overflow.sol @@ -6,8 +6,6 @@ contract C { return x**y; } } -// ==== -// compileToEwasm: also // ---- // f(int8,uint256): 2, 6 -> 64 // f(int8,uint256): 2, 7 -> FAILURE, hex"4e487b71", 0x11 diff --git a/test/libsolidity/semanticTests/viaYul/exp_overflow.sol b/test/libsolidity/semanticTests/viaYul/exp_overflow.sol index 8ba9c1d4ad77..7a100c2be003 100644 --- a/test/libsolidity/semanticTests/viaYul/exp_overflow.sol +++ b/test/libsolidity/semanticTests/viaYul/exp_overflow.sol @@ -6,8 +6,6 @@ contract C { return x**y; } } -// ==== -// compileToEwasm: also // ---- // f(uint8,uint8): 2, 7 -> 0x80 // f(uint8,uint8): 2, 8 -> FAILURE, hex"4e487b71", 0x11 diff --git a/test/libsolidity/semanticTests/viaYul/exp_various.sol b/test/libsolidity/semanticTests/viaYul/exp_various.sol index a1a69ed03143..3e9cf9d40bb6 100644 --- a/test/libsolidity/semanticTests/viaYul/exp_various.sol +++ b/test/libsolidity/semanticTests/viaYul/exp_various.sol @@ -6,8 +6,6 @@ contract C { return x**y; } } -// ==== -// compileToEwasm: also // ---- // f(uint8,uint8): 0, 0 -> 1 // f(uint8,uint8): 0, 1 -> 0x00 diff --git a/test/libsolidity/semanticTests/viaYul/function_address.sol b/test/libsolidity/semanticTests/viaYul/function_address.sol index e7d6c49a2261..0c1c58dd821d 100644 --- a/test/libsolidity/semanticTests/viaYul/function_address.sol +++ b/test/libsolidity/semanticTests/viaYul/function_address.sol @@ -9,8 +9,6 @@ contract C { return a.address; } } -// ==== -// compileToEwasm: also // ---- // f() -> 0xc06afe3a8444fc0004668591e8306bfb9968e79e // g() -> true diff --git a/test/libsolidity/semanticTests/viaYul/function_entry_checks.sol b/test/libsolidity/semanticTests/viaYul/function_entry_checks.sol index 29812e01892a..6f5f90824f60 100644 --- a/test/libsolidity/semanticTests/viaYul/function_entry_checks.sol +++ b/test/libsolidity/semanticTests/viaYul/function_entry_checks.sol @@ -16,8 +16,6 @@ contract C { function t(uint) public pure { } } -// ==== -// compileToEwasm: also // ---- // f() -> 0 // g(uint256,uint256): 1, -2 -> 0 diff --git a/test/libsolidity/semanticTests/viaYul/function_pointers.sol b/test/libsolidity/semanticTests/viaYul/function_pointers.sol index 8bc69baa8783..b34f01981788 100644 --- a/test/libsolidity/semanticTests/viaYul/function_pointers.sol +++ b/test/libsolidity/semanticTests/viaYul/function_pointers.sol @@ -16,8 +16,6 @@ contract C { k1()(); } } -// ==== -// compileToEwasm: also // ---- // f() -> FAILURE, hex"4e487b71", 0x51 // g() -> FAILURE diff --git a/test/libsolidity/semanticTests/viaYul/function_selector.sol b/test/libsolidity/semanticTests/viaYul/function_selector.sol index d21afdcf545b..4737a36d9a94 100644 --- a/test/libsolidity/semanticTests/viaYul/function_selector.sol +++ b/test/libsolidity/semanticTests/viaYul/function_selector.sol @@ -6,8 +6,6 @@ contract C { return a.selector; } } -// ==== -// compileToEwasm: also // ---- // f() -> left(0x26121ff0) // h(function): left(0x1122334400112233445566778899AABBCCDDEEFF42424242) -> left(0x42424242) diff --git a/test/libsolidity/semanticTests/viaYul/if.sol b/test/libsolidity/semanticTests/viaYul/if.sol index d2f582bb1b56..0fe752d51020 100644 --- a/test/libsolidity/semanticTests/viaYul/if.sol +++ b/test/libsolidity/semanticTests/viaYul/if.sol @@ -59,8 +59,6 @@ contract C { } while(false); } } -// ==== -// compileToEwasm: also // ---- // f(bool): 0 -> 23 // f(bool): 1 -> 42 diff --git a/test/libsolidity/semanticTests/viaYul/local_address_assignment.sol b/test/libsolidity/semanticTests/viaYul/local_address_assignment.sol index 35a2765ff54f..529513eafff5 100644 --- a/test/libsolidity/semanticTests/viaYul/local_address_assignment.sol +++ b/test/libsolidity/semanticTests/viaYul/local_address_assignment.sol @@ -4,7 +4,5 @@ contract C { x = b; } } -// ==== -// compileToEwasm: also // ---- // f(address): 0x1234 -> 0x1234 diff --git a/test/libsolidity/semanticTests/viaYul/local_assignment.sol b/test/libsolidity/semanticTests/viaYul/local_assignment.sol index 978b905e3869..f77d25c663d4 100644 --- a/test/libsolidity/semanticTests/viaYul/local_assignment.sol +++ b/test/libsolidity/semanticTests/viaYul/local_assignment.sol @@ -4,7 +4,5 @@ contract C { x = b; } } -// ==== -// compileToEwasm: also // ---- // f(uint256): 6 -> 6 diff --git a/test/libsolidity/semanticTests/viaYul/local_bool_assignment.sol b/test/libsolidity/semanticTests/viaYul/local_bool_assignment.sol index c95cbf41aca1..d32e281dad56 100644 --- a/test/libsolidity/semanticTests/viaYul/local_bool_assignment.sol +++ b/test/libsolidity/semanticTests/viaYul/local_bool_assignment.sol @@ -4,7 +4,5 @@ contract C { x = b; } } -// ==== -// compileToEwasm: also // ---- // f(bool): true -> true diff --git a/test/libsolidity/semanticTests/viaYul/local_tuple_assignment.sol b/test/libsolidity/semanticTests/viaYul/local_tuple_assignment.sol index a6b14a9e0201..ff7f0785574e 100644 --- a/test/libsolidity/semanticTests/viaYul/local_tuple_assignment.sol +++ b/test/libsolidity/semanticTests/viaYul/local_tuple_assignment.sol @@ -21,8 +21,6 @@ contract C { (((d))) = (13); } } -// ==== -// compileToEwasm: also // ---- // x() -> 17 // f(uint256,uint256): 23, 42 -> 23, 42 diff --git a/test/libsolidity/semanticTests/viaYul/local_variable_without_init.sol b/test/libsolidity/semanticTests/viaYul/local_variable_without_init.sol index f11cd661f943..f1b2b1740bc3 100644 --- a/test/libsolidity/semanticTests/viaYul/local_variable_without_init.sol +++ b/test/libsolidity/semanticTests/viaYul/local_variable_without_init.sol @@ -4,7 +4,5 @@ contract C { return x; } } -// ==== -// compileToEwasm: also // ---- // f() -> 0 diff --git a/test/libsolidity/semanticTests/viaYul/loops/break.sol b/test/libsolidity/semanticTests/viaYul/loops/break.sol index 939cd0b7f646..77ecface7958 100644 --- a/test/libsolidity/semanticTests/viaYul/loops/break.sol +++ b/test/libsolidity/semanticTests/viaYul/loops/break.sol @@ -23,8 +23,6 @@ contract C { } while (x < 3); } } -// ==== -// compileToEwasm: also // ---- // f() -> 2 // g() -> 2 diff --git a/test/libsolidity/semanticTests/viaYul/loops/continue.sol b/test/libsolidity/semanticTests/viaYul/loops/continue.sol index 25e57dac19c5..b9c3f167d3a7 100644 --- a/test/libsolidity/semanticTests/viaYul/loops/continue.sol +++ b/test/libsolidity/semanticTests/viaYul/loops/continue.sol @@ -29,8 +29,6 @@ contract C { x = x + a; } } -// ==== -// compileToEwasm: also // ---- // f() -> 11 // g() -> 11 diff --git a/test/libsolidity/semanticTests/viaYul/loops/return.sol b/test/libsolidity/semanticTests/viaYul/loops/return.sol index 3f3b709bae3d..ee7062e70073 100644 --- a/test/libsolidity/semanticTests/viaYul/loops/return.sol +++ b/test/libsolidity/semanticTests/viaYul/loops/return.sol @@ -26,8 +26,6 @@ contract C { } while (x < 3); } } -// ==== -// compileToEwasm: also // ---- // f() -> 1 // g() -> 1 diff --git a/test/libsolidity/semanticTests/viaYul/loops/simple.sol b/test/libsolidity/semanticTests/viaYul/loops/simple.sol index 3a09098ab22a..a4d076325c39 100644 --- a/test/libsolidity/semanticTests/viaYul/loops/simple.sol +++ b/test/libsolidity/semanticTests/viaYul/loops/simple.sol @@ -29,8 +29,6 @@ contract C { for (;;) {break;} } } -// ==== -// compileToEwasm: also // ---- // f() -> 1024 // g() -> 1024 diff --git a/test/libsolidity/semanticTests/viaYul/memory_struct_allow.sol b/test/libsolidity/semanticTests/viaYul/memory_struct_allow.sol index 47213b7b4847..9f87c7b97d0f 100644 --- a/test/libsolidity/semanticTests/viaYul/memory_struct_allow.sol +++ b/test/libsolidity/semanticTests/viaYul/memory_struct_allow.sol @@ -15,7 +15,5 @@ contract C { return (s.a, s.b); } } -// ==== -// compileToEwasm: also // ---- // f() -> 0, 0 diff --git a/test/libsolidity/semanticTests/viaYul/msg_sender.sol b/test/libsolidity/semanticTests/viaYul/msg_sender.sol index 520c9be4e3e3..058f142f8694 100644 --- a/test/libsolidity/semanticTests/viaYul/msg_sender.sol +++ b/test/libsolidity/semanticTests/viaYul/msg_sender.sol @@ -5,7 +5,5 @@ contract C { return x == msg.sender; } } -// ==== -// compileToEwasm: also // ---- // test() -> true diff --git a/test/libsolidity/semanticTests/viaYul/require.sol b/test/libsolidity/semanticTests/viaYul/require.sol index 7546921f18ac..39677b4f5d3f 100644 --- a/test/libsolidity/semanticTests/viaYul/require.sol +++ b/test/libsolidity/semanticTests/viaYul/require.sol @@ -30,7 +30,6 @@ contract C { } // ==== // EVMVersion: >=byzantium -// compileToEwasm: also // ---- // f(bool): true -> true // f(bool): false -> FAILURE diff --git a/test/libsolidity/semanticTests/viaYul/return.sol b/test/libsolidity/semanticTests/viaYul/return.sol index c42353e60f36..f58632b964e8 100644 --- a/test/libsolidity/semanticTests/viaYul/return.sol +++ b/test/libsolidity/semanticTests/viaYul/return.sol @@ -4,7 +4,5 @@ contract C { x = 3; } } -// ==== -// compileToEwasm: also // ---- // f() -> 7 diff --git a/test/libsolidity/semanticTests/viaYul/return_and_convert.sol b/test/libsolidity/semanticTests/viaYul/return_and_convert.sol index 547838371eb7..78e9e3bea0c0 100644 --- a/test/libsolidity/semanticTests/viaYul/return_and_convert.sol +++ b/test/libsolidity/semanticTests/viaYul/return_and_convert.sol @@ -5,7 +5,5 @@ contract C { return b; } } -// ==== -// compileToEwasm: also // ---- // f() -> 255 diff --git a/test/libsolidity/semanticTests/viaYul/return_storage_pointers.sol b/test/libsolidity/semanticTests/viaYul/return_storage_pointers.sol index fd886596fda4..936058124b48 100644 --- a/test/libsolidity/semanticTests/viaYul/return_storage_pointers.sol +++ b/test/libsolidity/semanticTests/viaYul/return_storage_pointers.sol @@ -10,7 +10,5 @@ contract C { } } -// ==== -// compileToEwasm: also // ---- // g() -> 0, 0 diff --git a/test/libsolidity/semanticTests/viaYul/short_circuit.sol b/test/libsolidity/semanticTests/viaYul/short_circuit.sol index 5823f7734061..b160bbd77e94 100644 --- a/test/libsolidity/semanticTests/viaYul/short_circuit.sol +++ b/test/libsolidity/semanticTests/viaYul/short_circuit.sol @@ -8,8 +8,6 @@ contract C { y = x; } } -// ==== -// compileToEwasm: also // ---- // or(uint256): 0 -> true, 0 // and(uint256): 0 -> true, 8 diff --git a/test/libsolidity/semanticTests/viaYul/simple_assignment.sol b/test/libsolidity/semanticTests/viaYul/simple_assignment.sol index 016f7438dfb3..ed0ba28784dd 100644 --- a/test/libsolidity/semanticTests/viaYul/simple_assignment.sol +++ b/test/libsolidity/semanticTests/viaYul/simple_assignment.sol @@ -4,7 +4,5 @@ contract C { y = b; } } -// ==== -// compileToEwasm: also // ---- // f(uint256,uint256): 5, 6 -> 5, 6 diff --git a/test/libsolidity/semanticTests/viaYul/simple_inline_asm.sol b/test/libsolidity/semanticTests/viaYul/simple_inline_asm.sol index 99e0cbcdfa65..8e8cd78e87f2 100644 --- a/test/libsolidity/semanticTests/viaYul/simple_inline_asm.sol +++ b/test/libsolidity/semanticTests/viaYul/simple_inline_asm.sol @@ -11,7 +11,5 @@ contract C { x = a + b + c; } } -// ==== -// compileToEwasm: also // ---- // f() -> 6 diff --git a/test/libsolidity/semanticTests/viaYul/smoke_test.sol b/test/libsolidity/semanticTests/viaYul/smoke_test.sol index 6460ad90f31f..53a11869fefd 100644 --- a/test/libsolidity/semanticTests/viaYul/smoke_test.sol +++ b/test/libsolidity/semanticTests/viaYul/smoke_test.sol @@ -2,6 +2,5 @@ contract C { } // ==== // allowNonExistingFunctions: true -// compileToEwasm: also // ---- // f() -> FAILURE diff --git a/test/libsolidity/semanticTests/viaYul/storage/dirty_storage_bytes.sol b/test/libsolidity/semanticTests/viaYul/storage/dirty_storage_bytes.sol index f61808084b75..d1ec20db09b5 100644 --- a/test/libsolidity/semanticTests/viaYul/storage/dirty_storage_bytes.sol +++ b/test/libsolidity/semanticTests/viaYul/storage/dirty_storage_bytes.sol @@ -12,7 +12,5 @@ contract C { correct = r == (0x64 << 248); } } -// ==== -// compileToEwasm: also // ---- // f() -> true diff --git a/test/libsolidity/semanticTests/viaYul/storage/dirty_storage_static_array.sol b/test/libsolidity/semanticTests/viaYul/storage/dirty_storage_static_array.sol index 59b63ddf2f83..7c035f05362a 100644 --- a/test/libsolidity/semanticTests/viaYul/storage/dirty_storage_static_array.sol +++ b/test/libsolidity/semanticTests/viaYul/storage/dirty_storage_static_array.sol @@ -12,7 +12,5 @@ contract C { correct = (s[0] == 0x01) && (r == 0x01); } } -// ==== -// compileToEwasm: also // ---- // f() -> true diff --git a/test/libsolidity/semanticTests/viaYul/storage/packed_storage.sol b/test/libsolidity/semanticTests/viaYul/storage/packed_storage.sol index a39c0797dece..5253a6a1ab16 100644 --- a/test/libsolidity/semanticTests/viaYul/storage/packed_storage.sol +++ b/test/libsolidity/semanticTests/viaYul/storage/packed_storage.sol @@ -10,7 +10,5 @@ contract C { _x = x; } } -// ==== -// compileToEwasm: also // ---- // f(uint8): 6 -> 9 diff --git a/test/libsolidity/semanticTests/viaYul/storage/simple_storage.sol b/test/libsolidity/semanticTests/viaYul/storage/simple_storage.sol index df2575a8877d..03d7ed92051c 100644 --- a/test/libsolidity/semanticTests/viaYul/storage/simple_storage.sol +++ b/test/libsolidity/semanticTests/viaYul/storage/simple_storage.sol @@ -10,8 +10,6 @@ contract C { _y = y; } } -// ==== -// compileToEwasm: also // ---- // setX(uint256): 6 -> 6 // setY(uint256): 2 -> 2 diff --git a/test/libsolidity/semanticTests/viaYul/string_format.sol b/test/libsolidity/semanticTests/viaYul/string_format.sol index 49746adb4616..5869ea2e76fb 100644 --- a/test/libsolidity/semanticTests/viaYul/string_format.sol +++ b/test/libsolidity/semanticTests/viaYul/string_format.sol @@ -4,8 +4,6 @@ contract C { function g() external pure returns (bytes32) { return "abcabc"; } function h() external pure returns (bytes4) { return 0xcafecafe; } } -// ==== -// compileToEwasm: also // ---- // f1() -> 0x20, 6, left(0x616263616263) // f2() -> 32, 47, 44048183223289766195424279195050628400112610419087780792899004030957505095210, 18165586057823232067963737336409268114628061002662705707816940456850361417728 diff --git a/test/libsolidity/semanticTests/viaYul/string_literals.sol b/test/libsolidity/semanticTests/viaYul/string_literals.sol index f1140ffb4d7a..985d26354253 100644 --- a/test/libsolidity/semanticTests/viaYul/string_literals.sol +++ b/test/libsolidity/semanticTests/viaYul/string_literals.sol @@ -18,8 +18,6 @@ contract C { x = "abc"; } } -// ==== -// compileToEwasm: also // ---- // short_dyn() -> 0x20, 3, "abc" // long_dyn() -> 0x20, 80, "12345678901234567890123456789012", "34567890123456789012345678901234", "5678901234567890" diff --git a/test/libsolidity/semanticTests/viaYul/tuple_evaluation_order.sol b/test/libsolidity/semanticTests/viaYul/tuple_evaluation_order.sol index edde645880fb..e1a1689b7fc0 100644 --- a/test/libsolidity/semanticTests/viaYul/tuple_evaluation_order.sol +++ b/test/libsolidity/semanticTests/viaYul/tuple_evaluation_order.sol @@ -8,7 +8,5 @@ contract C { return (x, y); } } -// ==== -// compileToEwasm: also // ---- // f() -> 3, 1 diff --git a/test/libsolidity/semanticTests/viaYul/unary_fixedbytes.sol b/test/libsolidity/semanticTests/viaYul/unary_fixedbytes.sol index f0e811ac237c..d8e640713a05 100644 --- a/test/libsolidity/semanticTests/viaYul/unary_fixedbytes.sol +++ b/test/libsolidity/semanticTests/viaYul/unary_fixedbytes.sol @@ -58,8 +58,6 @@ contract C { return r; } } -// ==== -// compileToEwasm: also // ---- // conv(bytes25): left(0xff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff) -> 0xff00ff00ff00ff00ff00ff00ff00ff00ffffffffffffffffffffffffffffffff // upcast(bytes25): left(0xff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff) -> 0xff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff0000000000000000 diff --git a/test/libsolidity/semanticTests/viaYul/unary_operations.sol b/test/libsolidity/semanticTests/viaYul/unary_operations.sol index 37a6e90d8447..17d8dad03472 100644 --- a/test/libsolidity/semanticTests/viaYul/unary_operations.sol +++ b/test/libsolidity/semanticTests/viaYul/unary_operations.sol @@ -84,7 +84,6 @@ contract C { } // ==== // compileViaYul: true -// compileToEwasm: also // ---- // preincr_s8(int8): 128 -> FAILURE // postincr_s8(int8): 128 -> FAILURE diff --git a/test/libsolidity/semanticTests/viaYul/various_inline_asm.sol b/test/libsolidity/semanticTests/viaYul/various_inline_asm.sol index dc9057121d06..b440d8e136c6 100644 --- a/test/libsolidity/semanticTests/viaYul/various_inline_asm.sol +++ b/test/libsolidity/semanticTests/viaYul/various_inline_asm.sol @@ -17,7 +17,5 @@ contract C { x = a + b + c; } } -// ==== -// compileToEwasm: also // ---- // f() -> 70 diff --git a/test/libsolidity/semanticTests/viaYul/virtual_functions.sol b/test/libsolidity/semanticTests/viaYul/virtual_functions.sol index ea43914b73c6..798f90ffd431 100644 --- a/test/libsolidity/semanticTests/viaYul/virtual_functions.sol +++ b/test/libsolidity/semanticTests/viaYul/virtual_functions.sol @@ -23,8 +23,6 @@ contract C is X { x = 3; } } -// ==== -// compileToEwasm: also // ---- // f() -> 3 // f1() -> 3 diff --git a/test/libsolidity/semanticTests/virtualFunctions/internal_virtual_function_calls.sol b/test/libsolidity/semanticTests/virtualFunctions/internal_virtual_function_calls.sol index 7c5658ae2b60..28705ee40ee8 100644 --- a/test/libsolidity/semanticTests/virtualFunctions/internal_virtual_function_calls.sol +++ b/test/libsolidity/semanticTests/virtualFunctions/internal_virtual_function_calls.sol @@ -14,8 +14,5 @@ contract Derived is Base { return 2; } } - -// ==== -// compileToEwasm: also // ---- // f() -> 2 diff --git a/test/libsolidity/semanticTests/virtualFunctions/internal_virtual_function_calls_through_dispatch.sol b/test/libsolidity/semanticTests/virtualFunctions/internal_virtual_function_calls_through_dispatch.sol index f74a2df7a9be..d83343048399 100644 --- a/test/libsolidity/semanticTests/virtualFunctions/internal_virtual_function_calls_through_dispatch.sol +++ b/test/libsolidity/semanticTests/virtualFunctions/internal_virtual_function_calls_through_dispatch.sol @@ -19,8 +19,5 @@ contract Derived is Base { return f(); } } - -// ==== -// compileToEwasm: also // ---- // h() -> 2 diff --git a/test/libsolidity/semanticTests/virtualFunctions/virtual_function_calls.sol b/test/libsolidity/semanticTests/virtualFunctions/virtual_function_calls.sol index d277712f0d3d..ea543a786fdc 100644 --- a/test/libsolidity/semanticTests/virtualFunctions/virtual_function_calls.sol +++ b/test/libsolidity/semanticTests/virtualFunctions/virtual_function_calls.sol @@ -14,9 +14,6 @@ contract Derived is Base { return 2; } } - -// ==== -// compileToEwasm: also // ---- // g() -> 2 // f() -> 2 diff --git a/test/libsolidity/semanticTests/virtualFunctions/virtual_function_usage_in_constructor_arguments.sol b/test/libsolidity/semanticTests/virtualFunctions/virtual_function_usage_in_constructor_arguments.sol index d8417e3e266a..55a50a5c91cb 100644 --- a/test/libsolidity/semanticTests/virtualFunctions/virtual_function_usage_in_constructor_arguments.sol +++ b/test/libsolidity/semanticTests/virtualFunctions/virtual_function_usage_in_constructor_arguments.sol @@ -27,6 +27,5 @@ contract Derived is Base { return 2; } } - // ---- // getA() -> 2 diff --git a/test/libsolidity/smtCheckerTests/array_members/push_overflow_2_safe.sol b/test/libsolidity/smtCheckerTests/array_members/push_overflow_2_safe.sol index 5c0466ace414..798f8fce7bfd 100644 --- a/test/libsolidity/smtCheckerTests/array_members/push_overflow_2_safe.sol +++ b/test/libsolidity/smtCheckerTests/array_members/push_overflow_2_safe.sol @@ -9,7 +9,6 @@ contract C { assert(x[0] == 42 || x[0] == 23); } } - // ==== // SMTEngine: all // ---- diff --git a/test/libsolidity/smtCheckerTests/array_members/push_struct_member_1.sol b/test/libsolidity/smtCheckerTests/array_members/push_struct_member_1.sol index 15330f39b0fe..bb69ec9eeceb 100644 --- a/test/libsolidity/smtCheckerTests/array_members/push_struct_member_1.sol +++ b/test/libsolidity/smtCheckerTests/array_members/push_struct_member_1.sol @@ -12,7 +12,6 @@ contract C { t.s.b.push(); } } - // ==== // SMTEngine: all // ---- diff --git a/test/libsolidity/smtCheckerTests/array_members/push_struct_member_2.sol b/test/libsolidity/smtCheckerTests/array_members/push_struct_member_2.sol index 091ec74af698..ad7a675b0b0d 100644 --- a/test/libsolidity/smtCheckerTests/array_members/push_struct_member_2.sol +++ b/test/libsolidity/smtCheckerTests/array_members/push_struct_member_2.sol @@ -13,7 +13,6 @@ contract C { t.s[0].b.push(); } } - // ==== // SMTEngine: all // ---- diff --git a/test/libsolidity/smtCheckerTests/complex/MerkleProof.sol b/test/libsolidity/smtCheckerTests/complex/MerkleProof.sol index 606625d3fe22..ac268409d8ac 100644 --- a/test/libsolidity/smtCheckerTests/complex/MerkleProof.sol +++ b/test/libsolidity/smtCheckerTests/complex/MerkleProof.sol @@ -30,7 +30,6 @@ library MerkleProof { return computedHash == root; } } - // ==== // SMTEngine: all // ---- diff --git a/test/libsolidity/smtCheckerTests/control_flow/side_effects_inside_if_1.sol b/test/libsolidity/smtCheckerTests/control_flow/side_effects_inside_if_1.sol new file mode 100644 index 000000000000..9bea0383ad1d --- /dev/null +++ b/test/libsolidity/smtCheckerTests/control_flow/side_effects_inside_if_1.sol @@ -0,0 +1,15 @@ +contract C { + function f() public pure { + uint x; + if (++x < 3) {} + + assert(x == 1); // should hold + assert(x != 1); // should fail + } +} +// ==== +// SMTEngine: bmc +// ---- +// Warning 6838: (72-79): BMC: Condition is always true. +// Warning 4661: (132-146): BMC: Assertion violation happens here. +// Info 6002: BMC: 2 verification condition(s) proved safe! Enable the model checker option "show proved safe" to see all of them. diff --git a/test/libsolidity/smtCheckerTests/control_flow/side_effects_inside_if_2.sol b/test/libsolidity/smtCheckerTests/control_flow/side_effects_inside_if_2.sol new file mode 100644 index 000000000000..1780a7e20b16 --- /dev/null +++ b/test/libsolidity/smtCheckerTests/control_flow/side_effects_inside_if_2.sol @@ -0,0 +1,26 @@ +contract C { + uint x; + + function inc() internal returns (uint) { + // BMC inlines function calls and also looks at functions in isolation, + // therefore it says once that this is safe, when called by `f`, + // but also that it is unsafe just looking at this function (false positive). + ++x; + return x; + } + + function f() public { + require(x < 1000); + uint y = x; + if (inc() < 3) {} + + assert(x == y + 1); // should hold + assert(x != y + 1); // should fail + } +} +// ==== +// SMTEngine: bmc +// ---- +// Warning 2661: (318-321): BMC: Overflow (resulting value larger than 2**256 - 1) happens here. +// Warning 4661: (499-517): BMC: Assertion violation happens here. +// Info 6002: BMC: 4 verification condition(s) proved safe! Enable the model checker option "show proved safe" to see all of them. diff --git a/test/libsolidity/smtCheckerTests/control_flow/side_effects_inside_if_3.sol b/test/libsolidity/smtCheckerTests/control_flow/side_effects_inside_if_3.sol new file mode 100644 index 000000000000..2e415a7b08cb --- /dev/null +++ b/test/libsolidity/smtCheckerTests/control_flow/side_effects_inside_if_3.sol @@ -0,0 +1,30 @@ +contract C { + uint x; + + function inc() internal returns (uint) { + // BMC inlines function calls and also looks at functions in isolation, + // therefore it says once that this is safe, when called by `f`, + // but also that it is unsafe just looking at this function (false positive). + ++x; + return x; + } + + function inc2() internal returns (uint) { + return inc(); + } + + function f() public { + require(x < 1000); + uint y = x; + if (inc2() < 3) {} + + assert(x == y + 1); // should hold + assert(x != y + 1); // should fail + } +} +// ==== +// SMTEngine: bmc +// ---- +// Warning 2661: (318-321): BMC: Overflow (resulting value larger than 2**256 - 1) happens here. +// Warning 4661: (575-593): BMC: Assertion violation happens here. +// Info 6002: BMC: 4 verification condition(s) proved safe! Enable the model checker option "show proved safe" to see all of them. diff --git a/test/libsolidity/smtCheckerTests/control_flow/side_effects_inside_if_4.sol b/test/libsolidity/smtCheckerTests/control_flow/side_effects_inside_if_4.sol new file mode 100644 index 000000000000..6e624184e11e --- /dev/null +++ b/test/libsolidity/smtCheckerTests/control_flow/side_effects_inside_if_4.sol @@ -0,0 +1,15 @@ +contract C { + function f() public pure { + uint x = 2; + if (--x < 3) {} + + assert(x == 1); // should hold + assert(x != 1); // should fail + } +} +// ==== +// SMTEngine: bmc +// ---- +// Warning 6838: (76-83): BMC: Condition is always true. +// Warning 4661: (136-150): BMC: Assertion violation happens here. +// Info 6002: BMC: 2 verification condition(s) proved safe! Enable the model checker option "show proved safe" to see all of them. diff --git a/test/libsolidity/smtCheckerTests/control_flow/side_effects_inside_ternary_1.sol b/test/libsolidity/smtCheckerTests/control_flow/side_effects_inside_ternary_1.sol new file mode 100644 index 000000000000..9801b99b5667 --- /dev/null +++ b/test/libsolidity/smtCheckerTests/control_flow/side_effects_inside_ternary_1.sol @@ -0,0 +1,16 @@ +contract C { + function f() public pure { + uint x; + uint y = (++x < 3) ? ++x : --x; + + assert(y == x); // should hold; + assert(x == 2); // should hold + assert(x != 2); // should fail + } +} +// ==== +// SMTEngine: bmc +// ---- +// Warning 6838: (77-86): BMC: Condition is always true. +// Warning 4661: (188-202): BMC: Assertion violation happens here. +// Info 6002: BMC: 5 verification condition(s) proved safe! Enable the model checker option "show proved safe" to see all of them. diff --git a/test/libsolidity/smtCheckerTests/control_flow/side_effects_inside_ternary_2.sol b/test/libsolidity/smtCheckerTests/control_flow/side_effects_inside_ternary_2.sol new file mode 100644 index 000000000000..54d72960b942 --- /dev/null +++ b/test/libsolidity/smtCheckerTests/control_flow/side_effects_inside_ternary_2.sol @@ -0,0 +1,27 @@ +contract C { + uint x; + + function inc() internal returns (uint) { + // BMC inlines function calls and also looks at functions in isolation, + // therefore it says once that this is safe, when called by `f`, + // but also that it is unsafe just looking at this function (false positive). + ++x; + return x; + } + + function f() public { + require(x < 1000); + uint z = x; + uint y = (inc() < 3) ? inc() : inc(); + + assert(y == x); + assert(x == z + 2); // should hold + assert(x != z + 2); // should fail + } +} +// ==== +// SMTEngine: bmc +// ---- +// Warning 2661: (318-321): BMC: Overflow (resulting value larger than 2**256 - 1) happens here. +// Warning 4661: (543-561): BMC: Assertion violation happens here. +// Info 6002: BMC: 5 verification condition(s) proved safe! Enable the model checker option "show proved safe" to see all of them. diff --git a/test/libsolidity/smtCheckerTests/control_flow/side_effects_inside_ternary_3.sol b/test/libsolidity/smtCheckerTests/control_flow/side_effects_inside_ternary_3.sol new file mode 100644 index 000000000000..18e36c8fd22f --- /dev/null +++ b/test/libsolidity/smtCheckerTests/control_flow/side_effects_inside_ternary_3.sol @@ -0,0 +1,31 @@ +contract C { + uint x; + + function inc() internal returns (uint) { + // BMC inlines function calls and also looks at functions in isolation, + // therefore it says once that this is safe, when called by `f`, + // but also that it is unsafe just looking at this function (false positive). + ++x; + return x; + } + + function inc2() internal returns (uint) { + return inc(); + } + + function f() public { + require(x < 1000); + uint z = x; + uint y = (inc2() < 3) ? inc2() : inc2(); + + assert(y == x); // should hold + assert(x == z + 2); // should hold + assert(x != z + 2); // should fail + } +} +// ==== +// SMTEngine: bmc +// ---- +// Warning 2661: (318-321): BMC: Overflow (resulting value larger than 2**256 - 1) happens here. +// Warning 4661: (636-654): BMC: Assertion violation happens here. +// Info 6002: BMC: 5 verification condition(s) proved safe! Enable the model checker option "show proved safe" to see all of them. diff --git a/test/libsolidity/smtCheckerTests/control_flow/side_effects_inside_ternary_4.sol b/test/libsolidity/smtCheckerTests/control_flow/side_effects_inside_ternary_4.sol new file mode 100644 index 000000000000..e24cdf297d63 --- /dev/null +++ b/test/libsolidity/smtCheckerTests/control_flow/side_effects_inside_ternary_4.sol @@ -0,0 +1,16 @@ +contract C { + function f() public pure { + uint x = 2; + uint y = (--x < 3) ? --x : 0; + + assert(y == x); // should hold + assert(x == 0); // should hold + assert(x != 0); // should fail + } +} +// ==== +// SMTEngine: bmc +// ---- +// Warning 6838: (81-90): BMC: Condition is always true. +// Warning 4661: (189-203): BMC: Assertion violation happens here. +// Info 6002: BMC: 4 verification condition(s) proved safe! Enable the model checker option "show proved safe" to see all of them. diff --git a/test/libsolidity/smtCheckerTests/deployment/deploy_trusted_flow.sol b/test/libsolidity/smtCheckerTests/deployment/deploy_trusted_flow.sol index dcc81be6432e..eb0a0c0498ae 100644 --- a/test/libsolidity/smtCheckerTests/deployment/deploy_trusted_flow.sol +++ b/test/libsolidity/smtCheckerTests/deployment/deploy_trusted_flow.sol @@ -21,11 +21,8 @@ contract C { // SMTIgnoreOS: macos // ---- // Warning 4984: (47-50): CHC: Overflow (resulting value larger than 2**256 - 1) might happen here. -// Warning 6328: (167-185): CHC: Assertion violation might happen here. // Warning 6328: (215-233): CHC: Assertion violation might happen here. -// Warning 6328: (267-285): CHC: Assertion violation might happen here. // Warning 6328: (304-322): CHC: Assertion violation happens here. +// Info 1391: CHC: 2 verification condition(s) proved safe! Enable the model checker option "show proved safe" to see all of them. // Warning 2661: (47-50): BMC: Overflow (resulting value larger than 2**256 - 1) happens here. -// Warning 4661: (167-185): BMC: Assertion violation happens here. // Warning 4661: (215-233): BMC: Assertion violation happens here. -// Warning 4661: (267-285): BMC: Assertion violation happens here. diff --git a/test/libsolidity/smtCheckerTests/external_calls/underflow_only_in_external_call.sol b/test/libsolidity/smtCheckerTests/external_calls/underflow_only_in_external_call.sol new file mode 100644 index 000000000000..a0c3a06b4d9a --- /dev/null +++ b/test/libsolidity/smtCheckerTests/external_calls/underflow_only_in_external_call.sol @@ -0,0 +1,23 @@ +contract C { + + uint v; + bool guard = true; + + function dec() public returns (uint) { + if (guard) return 0; + --v; + return v; + } + + function f() public returns (uint) { + guard = false; + uint ret = this.dec(); + guard = true; + return ret; + } +} +// ==== +// SMTEngine: chc +// SMTTargets: underflow +// ---- +// Warning 3944: (109-112): CHC: Underflow (resulting value less than 0) happens here. diff --git a/test/libsolidity/smtCheckerTests/function_selector/homer.sol b/test/libsolidity/smtCheckerTests/function_selector/homer.sol index f4536e5bf0eb..a3bb0c64ba1a 100644 --- a/test/libsolidity/smtCheckerTests/function_selector/homer.sol +++ b/test/libsolidity/smtCheckerTests/function_selector/homer.sol @@ -38,8 +38,6 @@ contract Homer is ERC165, Simpson { assert(supportsInterface(type(PeaceMaker).interfaceId)); } } - - // ==== // SMTEngine: all // ---- diff --git a/test/libsolidity/smtCheckerTests/functions/functions_identity_1.sol b/test/libsolidity/smtCheckerTests/functions/functions_identity_1.sol index 5bf37f0815cd..40a023bb47e3 100644 --- a/test/libsolidity/smtCheckerTests/functions/functions_identity_1.sol +++ b/test/libsolidity/smtCheckerTests/functions/functions_identity_1.sol @@ -9,7 +9,6 @@ contract C assert(x > 0); } } - // ==== // SMTEngine: all // ---- diff --git a/test/libsolidity/smtCheckerTests/functions/functions_identity_1_fail.sol b/test/libsolidity/smtCheckerTests/functions/functions_identity_1_fail.sol index c77359fd424a..ceb42881ff3b 100644 --- a/test/libsolidity/smtCheckerTests/functions/functions_identity_1_fail.sol +++ b/test/libsolidity/smtCheckerTests/functions/functions_identity_1_fail.sol @@ -9,7 +9,6 @@ contract C assert(x > 0); } } - // ==== // SMTEngine: all // ---- diff --git a/test/libsolidity/smtCheckerTests/functions/functions_identity_2.sol b/test/libsolidity/smtCheckerTests/functions/functions_identity_2.sol index 1ecdd5c8b87d..54d0abaf7543 100644 --- a/test/libsolidity/smtCheckerTests/functions/functions_identity_2.sol +++ b/test/libsolidity/smtCheckerTests/functions/functions_identity_2.sol @@ -13,7 +13,6 @@ contract C assert(x > 0); } } - // ==== // SMTEngine: all // ---- diff --git a/test/libsolidity/smtCheckerTests/functions/functions_identity_2_fail.sol b/test/libsolidity/smtCheckerTests/functions/functions_identity_2_fail.sol index 33f37ffcc9c5..4d6ff0a64711 100644 --- a/test/libsolidity/smtCheckerTests/functions/functions_identity_2_fail.sol +++ b/test/libsolidity/smtCheckerTests/functions/functions_identity_2_fail.sol @@ -13,7 +13,6 @@ contract C assert(x > 0); } } - // ==== // SMTEngine: all // ---- diff --git a/test/libsolidity/smtCheckerTests/functions/functions_identity_as_tuple.sol b/test/libsolidity/smtCheckerTests/functions/functions_identity_as_tuple.sol index 4c9885ff6e34..e140fdedce29 100644 --- a/test/libsolidity/smtCheckerTests/functions/functions_identity_as_tuple.sol +++ b/test/libsolidity/smtCheckerTests/functions/functions_identity_as_tuple.sol @@ -9,7 +9,6 @@ contract C assert(x > 0); } } - // ==== // SMTEngine: all // ---- diff --git a/test/libsolidity/smtCheckerTests/functions/functions_identity_as_tuple_fail.sol b/test/libsolidity/smtCheckerTests/functions/functions_identity_as_tuple_fail.sol index 9da6fd551ec1..b511dc63bc02 100644 --- a/test/libsolidity/smtCheckerTests/functions/functions_identity_as_tuple_fail.sol +++ b/test/libsolidity/smtCheckerTests/functions/functions_identity_as_tuple_fail.sol @@ -9,7 +9,6 @@ contract C assert(x > 0); } } - // ==== // SMTEngine: all // ---- diff --git a/test/libsolidity/smtCheckerTests/functions/functions_library_internal.sol b/test/libsolidity/smtCheckerTests/functions/functions_library_internal.sol new file mode 100644 index 000000000000..405c3f71507e --- /dev/null +++ b/test/libsolidity/smtCheckerTests/functions/functions_library_internal.sol @@ -0,0 +1,14 @@ +library L { + function value(function()internal a, uint256 b) internal {} +} +contract C { + using L for function()internal; + + function f() public { + function()internal x; + x.value(42); + } +} +// ==== +// SMTEngine: all +// ---- diff --git a/test/libsolidity/smtCheckerTests/functions/functions_recursive.sol b/test/libsolidity/smtCheckerTests/functions/functions_recursive.sol index 4f664fb04102..0e3699e6be72 100644 --- a/test/libsolidity/smtCheckerTests/functions/functions_recursive.sol +++ b/test/libsolidity/smtCheckerTests/functions/functions_recursive.sol @@ -11,7 +11,6 @@ contract C assert(a == 0); } } - // ==== // SMTEngine: all // ---- diff --git a/test/libsolidity/smtCheckerTests/functions/functions_storage_var_1.sol b/test/libsolidity/smtCheckerTests/functions/functions_storage_var_1.sol index b7148bc7305b..2b6289b95fa9 100644 --- a/test/libsolidity/smtCheckerTests/functions/functions_storage_var_1.sol +++ b/test/libsolidity/smtCheckerTests/functions/functions_storage_var_1.sol @@ -10,7 +10,6 @@ contract C assert(a > 0); } } - // ==== // SMTEngine: all // ---- diff --git a/test/libsolidity/smtCheckerTests/functions/functions_storage_var_1_fail.sol b/test/libsolidity/smtCheckerTests/functions/functions_storage_var_1_fail.sol index e775c97a9a0a..3e045cee7036 100644 --- a/test/libsolidity/smtCheckerTests/functions/functions_storage_var_1_fail.sol +++ b/test/libsolidity/smtCheckerTests/functions/functions_storage_var_1_fail.sol @@ -10,7 +10,6 @@ contract C assert(a > 0); } } - // ==== // SMTEngine: all // SMTIgnoreOS: macos diff --git a/test/libsolidity/smtCheckerTests/functions/functions_storage_var_2.sol b/test/libsolidity/smtCheckerTests/functions/functions_storage_var_2.sol index 5bfb5dcc8e71..001067a28ad3 100644 --- a/test/libsolidity/smtCheckerTests/functions/functions_storage_var_2.sol +++ b/test/libsolidity/smtCheckerTests/functions/functions_storage_var_2.sol @@ -11,7 +11,6 @@ contract C assert(a > 1); } } - // ==== // SMTEngine: all // ---- diff --git a/test/libsolidity/smtCheckerTests/functions/functions_storage_var_2_fail.sol b/test/libsolidity/smtCheckerTests/functions/functions_storage_var_2_fail.sol index 29fd5aefbce5..35906db3b991 100644 --- a/test/libsolidity/smtCheckerTests/functions/functions_storage_var_2_fail.sol +++ b/test/libsolidity/smtCheckerTests/functions/functions_storage_var_2_fail.sol @@ -11,7 +11,6 @@ contract C assert(a > 0); } } - // ==== // SMTEngine: all // ---- diff --git a/test/libsolidity/smtCheckerTests/functions/functions_trivial_condition_for.sol b/test/libsolidity/smtCheckerTests/functions/functions_trivial_condition_for.sol deleted file mode 100644 index 681d42aefcb5..000000000000 --- a/test/libsolidity/smtCheckerTests/functions/functions_trivial_condition_for.sol +++ /dev/null @@ -1,8 +0,0 @@ -contract C -{ - function f(bool x) public pure { require(x); for (;x;) {} } -} -// ==== -// SMTEngine: all -// ---- -// Warning 6838: (65-66): BMC: Condition is always true. diff --git a/test/libsolidity/smtCheckerTests/functions/functions_trivial_condition_while.sol b/test/libsolidity/smtCheckerTests/functions/functions_trivial_condition_while.sol deleted file mode 100644 index 91bfd981c119..000000000000 --- a/test/libsolidity/smtCheckerTests/functions/functions_trivial_condition_while.sol +++ /dev/null @@ -1,8 +0,0 @@ -contract C -{ - function f(bool x) public pure { require(x); while (x) {} } -} -// ==== -// SMTEngine: all -// ---- -// Warning 6838: (66-67): BMC: Condition is always true. diff --git a/test/libsolidity/smtCheckerTests/functions/library_after_contract.sol b/test/libsolidity/smtCheckerTests/functions/library_after_contract.sol index e98556f99455..7fe00f5724cc 100644 --- a/test/libsolidity/smtCheckerTests/functions/library_after_contract.sol +++ b/test/libsolidity/smtCheckerTests/functions/library_after_contract.sol @@ -10,7 +10,6 @@ library L { return x; } } - // ==== // SMTEngine: all // ---- diff --git a/test/libsolidity/smtCheckerTests/loops/do_while_1_false_positives.sol b/test/libsolidity/smtCheckerTests/loops/do_while_1.sol similarity index 100% rename from test/libsolidity/smtCheckerTests/loops/do_while_1_false_positives.sol rename to test/libsolidity/smtCheckerTests/loops/do_while_1.sol diff --git a/test/libsolidity/smtCheckerTests/loops/do_while_bmc_iterations_1.sol b/test/libsolidity/smtCheckerTests/loops/do_while_bmc_iterations_1.sol new file mode 100644 index 000000000000..bff046b06332 --- /dev/null +++ b/test/libsolidity/smtCheckerTests/loops/do_while_bmc_iterations_1.sol @@ -0,0 +1,16 @@ +contract C +{ + function f(uint x) public pure { + require(x == 0); + do { + ++x; + } while (x < 2); + assert(x == 2); + } +} +// ==== +// SMTEngine: bmc +// SMTSolvers: z3 +// BMCLoopIterations: 3 +// ---- +// Info 6002: BMC: 2 verification condition(s) proved safe! Enable the model checker option "show proved safe" to see all of them. diff --git a/test/libsolidity/smtCheckerTests/loops/do_while_bmc_iterations_2.sol b/test/libsolidity/smtCheckerTests/loops/do_while_bmc_iterations_2.sol new file mode 100644 index 000000000000..92cbc1bea18f --- /dev/null +++ b/test/libsolidity/smtCheckerTests/loops/do_while_bmc_iterations_2.sol @@ -0,0 +1,20 @@ +contract C +{ + function f() public pure { + uint x; + do { + ++x; + { + ++x; + ++x; + } + } while (x < 3); + assert(x == 3); + } +} +// ==== +// SMTEngine: bmc +// SMTSolvers: z3 +// BMCLoopIterations: 3 +// ---- +// Info 6002: BMC: 4 verification condition(s) proved safe! Enable the model checker option "show proved safe" to see all of them. diff --git a/test/libsolidity/smtCheckerTests/loops/do_while_bmc_iterations_3.sol b/test/libsolidity/smtCheckerTests/loops/do_while_bmc_iterations_3.sol new file mode 100644 index 000000000000..d4a37786c236 --- /dev/null +++ b/test/libsolidity/smtCheckerTests/loops/do_while_bmc_iterations_3.sol @@ -0,0 +1,18 @@ +contract C +{ + function f() public pure { + uint x; + do { + if (x >= 2) + ++x; + ++x; + } while (x < 3); + assert(x == 4); + } +} +// ==== +// SMTEngine: bmc +// SMTSolvers: z3 +// BMCLoopIterations: 5 +// ---- +// Info 6002: BMC: 3 verification condition(s) proved safe! Enable the model checker option "show proved safe" to see all of them. diff --git a/test/libsolidity/smtCheckerTests/loops/do_while_bmc_iterations_4.sol b/test/libsolidity/smtCheckerTests/loops/do_while_bmc_iterations_4.sol new file mode 100644 index 000000000000..cce896b70c7f --- /dev/null +++ b/test/libsolidity/smtCheckerTests/loops/do_while_bmc_iterations_4.sol @@ -0,0 +1,15 @@ +contract C { + function f() public pure { + uint x; + do { + ++x; + } while (true); + assert(x == 1); + } +} +// ==== +// SMTEngine: bmc +// SMTSolvers: z3 +// BMCLoopIterations: 1 +// ---- +// Info 6002: BMC: 2 verification condition(s) proved safe! Enable the model checker option "show proved safe" to see all of them. diff --git a/test/libsolidity/smtCheckerTests/loops/do_while_bmc_iterations_5.sol b/test/libsolidity/smtCheckerTests/loops/do_while_bmc_iterations_5.sol new file mode 100644 index 000000000000..6f25a4f5c124 --- /dev/null +++ b/test/libsolidity/smtCheckerTests/loops/do_while_bmc_iterations_5.sol @@ -0,0 +1,22 @@ +contract C { + uint x; + + function condition() private returns(bool) { + ++x; + return x < 3; + } + + function f() public { + require(x == 0); + do { + } while (condition()); + assert(x == 3); + } +} +// ==== +// SMTEngine: bmc +// SMTSolvers: z3 +// BMCLoopIterations: 5 +// ---- +// Warning 2661: (77-80): BMC: Overflow (resulting value larger than 2**256 - 1) happens here. +// Info 6002: BMC: 2 verification condition(s) proved safe! Enable the model checker option "show proved safe" to see all of them. diff --git a/test/libsolidity/smtCheckerTests/loops/do_while_bmc_iterations_assertion_fails_1.sol b/test/libsolidity/smtCheckerTests/loops/do_while_bmc_iterations_assertion_fails_1.sol new file mode 100644 index 000000000000..54ede91c2df6 --- /dev/null +++ b/test/libsolidity/smtCheckerTests/loops/do_while_bmc_iterations_assertion_fails_1.sol @@ -0,0 +1,17 @@ +contract C +{ + function f(uint x) public pure { + require(x == 0); + do { + ++x; + } while (x < 2); + assert(x == 3); + } +} +// ==== +// SMTEngine: bmc +// SMTSolvers: z3 +// BMCLoopIterations: 3 +// ---- +// Warning 4661: (102-116): BMC: Assertion violation happens here. +// Info 6002: BMC: 1 verification condition(s) proved safe! Enable the model checker option "show proved safe" to see all of them. diff --git a/test/libsolidity/smtCheckerTests/loops/do_while_bmc_iterations_assertion_fails_2.sol b/test/libsolidity/smtCheckerTests/loops/do_while_bmc_iterations_assertion_fails_2.sol new file mode 100644 index 000000000000..8c742b749d0c --- /dev/null +++ b/test/libsolidity/smtCheckerTests/loops/do_while_bmc_iterations_assertion_fails_2.sol @@ -0,0 +1,19 @@ +contract C { + function f() public pure { + uint x; + do { + ++x; + break; + } while (x < 3); + assert(x == 0); + assert(x == 1); + } +} +// ==== +// SMTEngine: bmc +// SMTSolvers: z3 +// BMCLoopIterations: 2 +// ---- +// Warning 5740: (87-92): Unreachable code. +// Warning 4661: (97-111): BMC: Assertion violation happens here. +// Info 6002: BMC: 2 verification condition(s) proved safe! Enable the model checker option "show proved safe" to see all of them. diff --git a/test/libsolidity/smtCheckerTests/loops/do_while_bmc_iterations_assertion_fails_3.sol b/test/libsolidity/smtCheckerTests/loops/do_while_bmc_iterations_assertion_fails_3.sol new file mode 100644 index 000000000000..0742c5cdc211 --- /dev/null +++ b/test/libsolidity/smtCheckerTests/loops/do_while_bmc_iterations_assertion_fails_3.sol @@ -0,0 +1,17 @@ +contract C { + function f() public pure { + uint x; + do { + ++x; + continue; + } while (x < 2); + assert(x == 0); + } +} +// ==== +// SMTEngine: bmc +// SMTSolvers: z3 +// BMCLoopIterations: 2 +// ---- +// Warning 4661: (100-114): BMC: Assertion violation happens here. +// Info 6002: BMC: 1 verification condition(s) proved safe! Enable the model checker option "show proved safe" to see all of them. diff --git a/test/libsolidity/smtCheckerTests/loops/do_while_bmc_iterations_break_1.sol b/test/libsolidity/smtCheckerTests/loops/do_while_bmc_iterations_break_1.sol new file mode 100644 index 000000000000..e7bb9d145ce2 --- /dev/null +++ b/test/libsolidity/smtCheckerTests/loops/do_while_bmc_iterations_break_1.sol @@ -0,0 +1,17 @@ +contract C { + function f() public pure { + uint x; + do { + ++x; + break; + } while (x < 3); + assert(x == 1); + } +} +// ==== +// SMTEngine: bmc +// SMTSolvers: z3 +// BMCLoopIterations: 4 +// ---- +// Warning 5740: (87-92): Unreachable code. +// Info 6002: BMC: 2 verification condition(s) proved safe! Enable the model checker option "show proved safe" to see all of them. diff --git a/test/libsolidity/smtCheckerTests/loops/do_while_bmc_iterations_break_2.sol b/test/libsolidity/smtCheckerTests/loops/do_while_bmc_iterations_break_2.sol new file mode 100644 index 000000000000..9dec60544d1e --- /dev/null +++ b/test/libsolidity/smtCheckerTests/loops/do_while_bmc_iterations_break_2.sol @@ -0,0 +1,17 @@ +contract C { + function f() public pure { + uint x = 0; + do { + if (x > 0) + break; + ++x; + } while (x < 3); + assert(x == 1); + } +} +// ==== +// SMTEngine: bmc +// SMTSolvers: z3 +// BMCLoopIterations: 3 +// ---- +// Info 6002: BMC: 2 verification condition(s) proved safe! Enable the model checker option "show proved safe" to see all of them. diff --git a/test/libsolidity/smtCheckerTests/loops/do_while_bmc_iterations_break_3.sol b/test/libsolidity/smtCheckerTests/loops/do_while_bmc_iterations_break_3.sol new file mode 100644 index 000000000000..0f1c7d033024 --- /dev/null +++ b/test/libsolidity/smtCheckerTests/loops/do_while_bmc_iterations_break_3.sol @@ -0,0 +1,19 @@ +contract C { + function f() public pure { + uint x = 0; + do { + if (x >= 0) { + ++x; + break; + } + ++x; + } while (x < 3); + assert(x == 1); + } +} +// ==== +// SMTEngine: bmc +// SMTSolvers: z3 +// BMCLoopIterations: 4 +// ---- +// Info 6002: BMC: 3 verification condition(s) proved safe! Enable the model checker option "show proved safe" to see all of them. diff --git a/test/libsolidity/smtCheckerTests/loops/do_while_bmc_iterations_break_4.sol b/test/libsolidity/smtCheckerTests/loops/do_while_bmc_iterations_break_4.sol new file mode 100644 index 000000000000..c2c046809ff4 --- /dev/null +++ b/test/libsolidity/smtCheckerTests/loops/do_while_bmc_iterations_break_4.sol @@ -0,0 +1,19 @@ +contract C { + function f() public pure { + uint x = 0; + do { + if (x > 0) { + ++x; + break; + } + ++x; + } while (x < 3); + assert(x == 2); + } +} +// ==== +// SMTEngine: bmc +// SMTSolvers: z3 +// BMCLoopIterations: 4 +// ---- +// Info 6002: BMC: 3 verification condition(s) proved safe! Enable the model checker option "show proved safe" to see all of them. diff --git a/test/libsolidity/smtCheckerTests/loops/do_while_bmc_iterations_break_5.sol b/test/libsolidity/smtCheckerTests/loops/do_while_bmc_iterations_break_5.sol new file mode 100644 index 000000000000..4379d4f61362 --- /dev/null +++ b/test/libsolidity/smtCheckerTests/loops/do_while_bmc_iterations_break_5.sol @@ -0,0 +1,19 @@ +contract C { + function f() public pure { + uint x = 0; + do { + ++x; + if (x > 1) { + ++x; + break; + } + } while (x < 3); + assert(x == 3); + } +} +// ==== +// SMTEngine: bmc +// SMTSolvers: z3 +// BMCLoopIterations: 4 +// ---- +// Info 6002: BMC: 3 verification condition(s) proved safe! Enable the model checker option "show proved safe" to see all of them. diff --git a/test/libsolidity/smtCheckerTests/loops/do_while_bmc_iterations_break_6.sol b/test/libsolidity/smtCheckerTests/loops/do_while_bmc_iterations_break_6.sol new file mode 100644 index 000000000000..d0a917fa915c --- /dev/null +++ b/test/libsolidity/smtCheckerTests/loops/do_while_bmc_iterations_break_6.sol @@ -0,0 +1,23 @@ +contract C { + function f() public pure { + uint x; + do { + ++x; + if (x > 0) { + x = 2; + break; + } + if (x > 1) { + x = 3; + break; + } + } while (x < 3); + assert(x == 2); + } +} +// ==== +// SMTEngine: bmc +// SMTSolvers: z3 +// BMCLoopIterations: 3 +// ---- +// Info 6002: BMC: 2 verification condition(s) proved safe! Enable the model checker option "show proved safe" to see all of them. diff --git a/test/libsolidity/smtCheckerTests/loops/do_while_bmc_iterations_break_7.sol b/test/libsolidity/smtCheckerTests/loops/do_while_bmc_iterations_break_7.sol new file mode 100644 index 000000000000..52c3270ba7ea --- /dev/null +++ b/test/libsolidity/smtCheckerTests/loops/do_while_bmc_iterations_break_7.sol @@ -0,0 +1,23 @@ +contract C { + function f() public pure { + uint x; + do { + ++x; + if (x > 1) { + x = 3; + break; + } + if (x > 0) { + x = 2; + break; + } + } while (x < 3); + assert(x == 2); + } +} +// ==== +// SMTEngine: bmc +// SMTSolvers: z3 +// BMCLoopIterations: 3 +// ---- +// Info 6002: BMC: 2 verification condition(s) proved safe! Enable the model checker option "show proved safe" to see all of them. diff --git a/test/libsolidity/smtCheckerTests/loops/do_while_bmc_iterations_break_8.sol b/test/libsolidity/smtCheckerTests/loops/do_while_bmc_iterations_break_8.sol new file mode 100644 index 000000000000..c25f982126df --- /dev/null +++ b/test/libsolidity/smtCheckerTests/loops/do_while_bmc_iterations_break_8.sol @@ -0,0 +1,17 @@ +contract C { + function f() public pure { + uint x; + do { + break; + } while (++x < 2); + // loop condition is not executed after break + assert(x == 0); + } +} +// ==== +// SMTEngine: bmc +// SMTSolvers: z3 +// BMCLoopIterations: 3 +// ---- +// Warning 5740: (79-86): Unreachable code. +// Info 6002: BMC: 2 verification condition(s) proved safe! Enable the model checker option "show proved safe" to see all of them. diff --git a/test/libsolidity/smtCheckerTests/loops/do_while_bmc_iterations_break_continue_1.sol b/test/libsolidity/smtCheckerTests/loops/do_while_bmc_iterations_break_continue_1.sol new file mode 100644 index 000000000000..53ce958fab1a --- /dev/null +++ b/test/libsolidity/smtCheckerTests/loops/do_while_bmc_iterations_break_continue_1.sol @@ -0,0 +1,21 @@ +contract C { + function f() public pure { + uint x; + do { + if (x > 1) { + break; + } + if (x >= 0) { + x = 10; + continue; + } + } while (x < 3); + assert(x == 10); + } +} +// ==== +// SMTEngine: bmc +// SMTSolvers: z3 +// BMCLoopIterations: 3 +// ---- +// Info 6002: BMC: 1 verification condition(s) proved safe! Enable the model checker option "show proved safe" to see all of them. diff --git a/test/libsolidity/smtCheckerTests/loops/do_while_bmc_iterations_break_continue_2.sol b/test/libsolidity/smtCheckerTests/loops/do_while_bmc_iterations_break_continue_2.sol new file mode 100644 index 000000000000..12d6fff6f5a8 --- /dev/null +++ b/test/libsolidity/smtCheckerTests/loops/do_while_bmc_iterations_break_continue_2.sol @@ -0,0 +1,22 @@ +contract C { + function f() public pure { + uint x; + do { + if (x > 1) { + x = 3; + break; + } + if (x >= 0) { + x = 2; + continue; + } + } while (x < 4); + assert(x == 3); + } +} +// ==== +// SMTEngine: bmc +// SMTSolvers: z3 +// BMCLoopIterations: 3 +// ---- +// Info 6002: BMC: 1 verification condition(s) proved safe! Enable the model checker option "show proved safe" to see all of them. diff --git a/test/libsolidity/smtCheckerTests/loops/do_while_bmc_iterations_continue_1.sol b/test/libsolidity/smtCheckerTests/loops/do_while_bmc_iterations_continue_1.sol new file mode 100644 index 000000000000..aa69cb90cc4a --- /dev/null +++ b/test/libsolidity/smtCheckerTests/loops/do_while_bmc_iterations_continue_1.sol @@ -0,0 +1,19 @@ +contract C { + function f() public pure { + uint x = 0; + do { + ++x; + if (x == 3) { + continue; + } + ++x; + } while (x < 3); + assert(x == 3); + } +} +// ==== +// SMTEngine: bmc +// SMTSolvers: z3 +// BMCLoopIterations: 4 +// ---- +// Info 6002: BMC: 3 verification condition(s) proved safe! Enable the model checker option "show proved safe" to see all of them. diff --git a/test/libsolidity/smtCheckerTests/loops/do_while_bmc_iterations_continue_2.sol b/test/libsolidity/smtCheckerTests/loops/do_while_bmc_iterations_continue_2.sol new file mode 100644 index 000000000000..83826575de5e --- /dev/null +++ b/test/libsolidity/smtCheckerTests/loops/do_while_bmc_iterations_continue_2.sol @@ -0,0 +1,25 @@ +contract C { + function f() public pure { + uint x = 0; + uint y = 0; + do { + ++x; + if (x == 2) { + ++x; + y = 1; + continue; + } + if (x == 3) { + y = 2; + continue; + } + } while (x < 3); + assert(y == 1); + } +} +// ==== +// SMTEngine: bmc +// SMTSolvers: z3 +// BMCLoopIterations: 4 +// ---- +// Info 6002: BMC: 3 verification condition(s) proved safe! Enable the model checker option "show proved safe" to see all of them. diff --git a/test/libsolidity/smtCheckerTests/loops/do_while_bmc_iterations_continue_3.sol b/test/libsolidity/smtCheckerTests/loops/do_while_bmc_iterations_continue_3.sol new file mode 100644 index 000000000000..1afe9034e0d7 --- /dev/null +++ b/test/libsolidity/smtCheckerTests/loops/do_while_bmc_iterations_continue_3.sol @@ -0,0 +1,24 @@ +contract C { + function f() public pure { + uint x = 0; + uint y = 0; + do { + ++x; + if (x > 0) { + y = 1; + continue; + } + if (x > 0) { + y = 2; + continue; + } + } while (x < 3); + assert(y == 1); + } +} +// ==== +// SMTEngine: bmc +// SMTSolvers: z3 +// BMCLoopIterations: 4 +// ---- +// Info 6002: BMC: 2 verification condition(s) proved safe! Enable the model checker option "show proved safe" to see all of them. diff --git a/test/libsolidity/smtCheckerTests/loops/do_while_bmc_iterations_continue_4.sol b/test/libsolidity/smtCheckerTests/loops/do_while_bmc_iterations_continue_4.sol new file mode 100644 index 000000000000..69ad6529c62f --- /dev/null +++ b/test/libsolidity/smtCheckerTests/loops/do_while_bmc_iterations_continue_4.sol @@ -0,0 +1,25 @@ +contract C +{ + function f(uint x) public pure { + require(x == 0); + uint i; + do { + ++i; + if (i == 2) { + x = 2; + continue; + } + if (i == 1) { + x = 1; + continue; + } + } while (i < 3); + assert(x == 2); + } +} +// ==== +// SMTEngine: bmc +// SMTSolvers: z3 +// BMCLoopIterations: 4 +// ---- +// Info 6002: BMC: 2 verification condition(s) proved safe! Enable the model checker option "show proved safe" to see all of them. diff --git a/test/libsolidity/smtCheckerTests/loops/do_while_bmc_iterations_nested.sol b/test/libsolidity/smtCheckerTests/loops/do_while_bmc_iterations_nested.sol new file mode 100644 index 000000000000..62d1b793df5c --- /dev/null +++ b/test/libsolidity/smtCheckerTests/loops/do_while_bmc_iterations_nested.sol @@ -0,0 +1,22 @@ +contract C +{ + function f(uint z) public pure { + uint x = 0; + require(z == 0); + do { + uint y = 0; + do { + ++z; + ++y; + } while (y < 2); + ++x; + } while (x < 2); + assert(z == 4); + } +} +// ==== +// SMTEngine: bmc +// SMTSolvers: z3 +// BMCLoopIterations: 3 +// ---- +// Info 6002: BMC: 4 verification condition(s) proved safe! Enable the model checker option "show proved safe" to see all of them. diff --git a/test/libsolidity/smtCheckerTests/loops/do_while_bmc_iterations_nested_break.sol b/test/libsolidity/smtCheckerTests/loops/do_while_bmc_iterations_nested_break.sol new file mode 100644 index 000000000000..267e18ec64d8 --- /dev/null +++ b/test/libsolidity/smtCheckerTests/loops/do_while_bmc_iterations_nested_break.sol @@ -0,0 +1,24 @@ +contract C +{ + function f(uint z) public pure { + uint x = 0; + require(z == 0); + do { + uint y = 0; + do { + if (y > 0) + break; + ++z; + ++y; + } while (y < 2); + ++x; + } while (x < 2); + assert(z == 2); + } +} +// ==== +// SMTEngine: bmc +// SMTSolvers: z3 +// BMCLoopIterations: 3 +// ---- +// Info 6002: BMC: 4 verification condition(s) proved safe! Enable the model checker option "show proved safe" to see all of them. diff --git a/test/libsolidity/smtCheckerTests/loops/do_while_bmc_iterations_nested_continue.sol b/test/libsolidity/smtCheckerTests/loops/do_while_bmc_iterations_nested_continue.sol new file mode 100644 index 000000000000..42ef9bccc5a0 --- /dev/null +++ b/test/libsolidity/smtCheckerTests/loops/do_while_bmc_iterations_nested_continue.sol @@ -0,0 +1,24 @@ +contract C +{ + function f(uint z) public pure { + uint x = 0; + require(z == 0); + do { + uint y = 0; + do { + ++y; + if (y > 0) + continue; + ++z; + } while (y < 2); + ++x; + } while (x < 2); + assert(z == 0); + } +} +// ==== +// SMTEngine: bmc +// SMTSolvers: z3 +// BMCLoopIterations: 3 +// ---- +// Info 6002: BMC: 4 verification condition(s) proved safe! Enable the model checker option "show proved safe" to see all of them. diff --git a/test/libsolidity/smtCheckerTests/loops/do_while_bmc_iterations_semantics_1.sol b/test/libsolidity/smtCheckerTests/loops/do_while_bmc_iterations_semantics_1.sol new file mode 100644 index 000000000000..6656817809b5 --- /dev/null +++ b/test/libsolidity/smtCheckerTests/loops/do_while_bmc_iterations_semantics_1.sol @@ -0,0 +1,20 @@ +contract C { + function f() public pure { + uint x = 0; + int y = 0; + do { + if (x >= 3) + y = 1; + ++x; + } while (x < 3 || y == 1); + // BMC loop iteration setting is not enough to leave the loop + assert(x == 0); // should hold - no assumptions on value if didn't complete loop + assert(y == 0); // should hold - no assumptions on value if didn't complete loop + } +} +// ==== +// SMTEngine: bmc +// SMTSolvers: z3 +// BMCLoopIterations: 1 +// ---- +// Info 6002: BMC: 3 verification condition(s) proved safe! Enable the model checker option "show proved safe" to see all of them. diff --git a/test/libsolidity/smtCheckerTests/loops/do_while_bmc_iterations_semantics_2.sol b/test/libsolidity/smtCheckerTests/loops/do_while_bmc_iterations_semantics_2.sol new file mode 100644 index 000000000000..b98bba18a0cb --- /dev/null +++ b/test/libsolidity/smtCheckerTests/loops/do_while_bmc_iterations_semantics_2.sol @@ -0,0 +1,20 @@ +contract C { + function f() public pure { + uint x = 0; + int y = 0; + do { + if (x >= 3) + y = 1; + ++x; + } while (x < 3 || y == 1); + // BMC loop iteration setting is just enough to leave the loop + assert(x == 3); // should hold + assert(y == 1); // should hold + } +} +// ==== +// SMTEngine: bmc +// SMTSolvers: z3 +// BMCLoopIterations: 4 +// ---- +// Info 6002: BMC: 3 verification condition(s) proved safe! Enable the model checker option "show proved safe" to see all of them. diff --git a/test/libsolidity/smtCheckerTests/loops/do_while_bmc_iterations_semantics_3.sol b/test/libsolidity/smtCheckerTests/loops/do_while_bmc_iterations_semantics_3.sol new file mode 100644 index 000000000000..2a5866e162cf --- /dev/null +++ b/test/libsolidity/smtCheckerTests/loops/do_while_bmc_iterations_semantics_3.sol @@ -0,0 +1,20 @@ +contract C { + function f() public pure { + uint x = 0; + int y = 0; + do { + if (x >= 3) + y = 1; + ++x; + } while (x < 3 || y == 1); + // BMC loop iteration setting is more than enough to leave the loop + assert(x == 3); // should hold + assert(y == 1); // should hold + } +} +// ==== +// SMTEngine: bmc +// SMTSolvers: z3 +// BMCLoopIterations: 5 +// ---- +// Info 6002: BMC: 3 verification condition(s) proved safe! Enable the model checker option "show proved safe" to see all of them. diff --git a/test/libsolidity/smtCheckerTests/loops/do_while_bmc_iterations_shallow_unroll.sol b/test/libsolidity/smtCheckerTests/loops/do_while_bmc_iterations_shallow_unroll.sol new file mode 100644 index 000000000000..449d41c67cb9 --- /dev/null +++ b/test/libsolidity/smtCheckerTests/loops/do_while_bmc_iterations_shallow_unroll.sol @@ -0,0 +1,19 @@ +contract C { + function f(uint x) public pure { + require(x == 0); + uint y; + do { + ++y; + if (y == 2) + x = 3; + } while (y < 3); + // nothing is reported because loop condition is true after unrolling the loop one time + assert(x == 4); + } +} +// ==== +// SMTEngine: bmc +// SMTSolvers: z3 +// BMCLoopIterations: 1 +// ---- +// Info 6002: BMC: 2 verification condition(s) proved safe! Enable the model checker option "show proved safe" to see all of them. diff --git a/test/libsolidity/smtCheckerTests/loops/for_1_fail.sol b/test/libsolidity/smtCheckerTests/loops/for_1_fail.sol deleted file mode 100644 index 7d179aa101d9..000000000000 --- a/test/libsolidity/smtCheckerTests/loops/for_1_fail.sol +++ /dev/null @@ -1,19 +0,0 @@ -contract C -{ - function f(uint x) public pure { - require(x < 100); - for(uint i = 0; i < 10; ++i) { - // Overflows due to resetting x. - x = x + 1; - } - assert(x < 14); - } -} -// ==== -// SMTEngine: all -// SMTSolvers: z3 -// ---- -// Warning 4984: (143-148): CHC: Overflow (resulting value larger than 2**256 - 1) might happen here. -// Warning 6328: (156-170): CHC: Assertion violation happens here. -// Info 1391: CHC: 1 verification condition(s) proved safe! Enable the model checker option "show proved safe" to see all of them. -// Warning 2661: (143-148): BMC: Overflow (resulting value larger than 2**256 - 1) happens here. diff --git a/test/libsolidity/smtCheckerTests/loops/for_1_false_positive.sol b/test/libsolidity/smtCheckerTests/loops/for_1_false_positive.sol index 46694d785a62..0b4ac7e68824 100644 --- a/test/libsolidity/smtCheckerTests/loops/for_1_false_positive.sol +++ b/test/libsolidity/smtCheckerTests/loops/for_1_false_positive.sol @@ -14,4 +14,4 @@ contract C // ---- // Warning 4984: (106-111): CHC: Overflow (resulting value larger than 2**256 - 1) might happen here. // Info 1391: CHC: 1 verification condition(s) proved safe! Enable the model checker option "show proved safe" to see all of them. -// Warning 2661: (106-111): BMC: Overflow (resulting value larger than 2**256 - 1) happens here. +// Info 6002: BMC: 1 verification condition(s) proved safe! Enable the model checker option "show proved safe" to see all of them. diff --git a/test/libsolidity/smtCheckerTests/loops/for_loop_bmc_iterations_1.sol b/test/libsolidity/smtCheckerTests/loops/for_loop_bmc_iterations_1.sol new file mode 100644 index 000000000000..a352b6e38fab --- /dev/null +++ b/test/libsolidity/smtCheckerTests/loops/for_loop_bmc_iterations_1.sol @@ -0,0 +1,15 @@ +contract C +{ + function f() public pure { + uint x; + for (uint i = 0; i < 2; ++i) + ++x; + assert(x == 2); + } +} +// ==== +// SMTEngine: bmc +// SMTSolvers: z3 +// BMCLoopIterations: 3 +// ---- +// Info 6002: BMC: 3 verification condition(s) proved safe! Enable the model checker option "show proved safe" to see all of them. diff --git a/test/libsolidity/smtCheckerTests/loops/for_loop_bmc_iterations_2.sol b/test/libsolidity/smtCheckerTests/loops/for_loop_bmc_iterations_2.sol new file mode 100644 index 000000000000..d460ea770c49 --- /dev/null +++ b/test/libsolidity/smtCheckerTests/loops/for_loop_bmc_iterations_2.sol @@ -0,0 +1,15 @@ +contract C +{ + function f() public pure { + uint x; + for (uint i = 0; i < 3; ++i) + x = i; + assert(x == 2); + } +} +// ==== +// SMTEngine: bmc +// SMTSolvers: z3 +// BMCLoopIterations: 3 +// ---- +// Info 6002: BMC: 2 verification condition(s) proved safe! Enable the model checker option "show proved safe" to see all of them. diff --git a/test/libsolidity/smtCheckerTests/loops/for_loop_bmc_iterations_3.sol b/test/libsolidity/smtCheckerTests/loops/for_loop_bmc_iterations_3.sol new file mode 100644 index 000000000000..63b43466895e --- /dev/null +++ b/test/libsolidity/smtCheckerTests/loops/for_loop_bmc_iterations_3.sol @@ -0,0 +1,16 @@ +contract C +{ + function f() public pure { + uint x; + for (uint i = 0; i < 3; ++i) + if (i > 1) + x = 10; + assert(x == 10); + } +} +// ==== +// SMTEngine: bmc +// SMTSolvers: z3 +// BMCLoopIterations: 3 +// ---- +// Info 6002: BMC: 2 verification condition(s) proved safe! Enable the model checker option "show proved safe" to see all of them. diff --git a/test/libsolidity/smtCheckerTests/loops/for_loop_bmc_iterations_4.sol b/test/libsolidity/smtCheckerTests/loops/for_loop_bmc_iterations_4.sol new file mode 100644 index 000000000000..e3fea509a579 --- /dev/null +++ b/test/libsolidity/smtCheckerTests/loops/for_loop_bmc_iterations_4.sol @@ -0,0 +1,15 @@ +contract C +{ + function f() public pure { + uint x; + for (uint i = 0; i < 0; ++i) + ++x; + assert(x == 0); + } +} +// ==== +// SMTEngine: bmc +// SMTSolvers: z3 +// BMCLoopIterations: 3 +// ---- +// Info 6002: BMC: 3 verification condition(s) proved safe! Enable the model checker option "show proved safe" to see all of them. diff --git a/test/libsolidity/smtCheckerTests/loops/for_loop_bmc_iterations_5.sol b/test/libsolidity/smtCheckerTests/loops/for_loop_bmc_iterations_5.sol new file mode 100644 index 000000000000..38437fce2496 --- /dev/null +++ b/test/libsolidity/smtCheckerTests/loops/for_loop_bmc_iterations_5.sol @@ -0,0 +1,14 @@ +contract C +{ + function f() public pure { + uint x; + for (; x < 0; ++x) {} + assert(x == 0); + } +} +// ==== +// SMTEngine: bmc +// SMTSolvers: z3 +// BMCLoopIterations: 1 +// ---- +// Info 6002: BMC: 2 verification condition(s) proved safe! Enable the model checker option "show proved safe" to see all of them. diff --git a/test/libsolidity/smtCheckerTests/loops/for_loop_bmc_iterations_6.sol b/test/libsolidity/smtCheckerTests/loops/for_loop_bmc_iterations_6.sol new file mode 100644 index 000000000000..cdbc41485164 --- /dev/null +++ b/test/libsolidity/smtCheckerTests/loops/for_loop_bmc_iterations_6.sol @@ -0,0 +1,16 @@ +contract C +{ + function f() public pure { + uint x = 0; + for (uint i = 1; i < 3;) { + x = i; + } + assert(x == 1); + } +} +// ==== +// SMTEngine: bmc +// SMTSolvers: z3 +// BMCLoopIterations: 3 +// ---- +// Info 6002: BMC: 1 verification condition(s) proved safe! Enable the model checker option "show proved safe" to see all of them. diff --git a/test/libsolidity/smtCheckerTests/loops/for_loop_bmc_iterations_7.sol b/test/libsolidity/smtCheckerTests/loops/for_loop_bmc_iterations_7.sol new file mode 100644 index 000000000000..834529b32a5c --- /dev/null +++ b/test/libsolidity/smtCheckerTests/loops/for_loop_bmc_iterations_7.sol @@ -0,0 +1,23 @@ +contract C +{ + uint x; + + function condition() private returns(bool) { + ++x; + return x < 3; + } + + function f() public { + require(x == 0); + for (; condition();) { + } + assert(x == 3); + } +} +// ==== +// SMTEngine: bmc +// SMTSolvers: z3 +// BMCLoopIterations: 5 +// ---- +// Warning 2661: (71-74): BMC: Overflow (resulting value larger than 2**256 - 1) happens here. +// Info 6002: BMC: 2 verification condition(s) proved safe! Enable the model checker option "show proved safe" to see all of them. diff --git a/test/libsolidity/smtCheckerTests/loops/for_loop_bmc_iterations_8.sol b/test/libsolidity/smtCheckerTests/loops/for_loop_bmc_iterations_8.sol new file mode 100644 index 000000000000..421c965e1c57 --- /dev/null +++ b/test/libsolidity/smtCheckerTests/loops/for_loop_bmc_iterations_8.sol @@ -0,0 +1,31 @@ +contract C +{ + uint x; + uint y; + + function condition() private returns(bool) { + ++x; + return x < 3; + } + + function expression() private { + ++y; + } + + function f() public { + require(x == 0); + require(y == 0); + for (; condition(); expression()) { + } + assert(x == 3); + assert(y == 2); + } +} +// ==== +// SMTEngine: bmc +// SMTSolvers: z3 +// BMCLoopIterations: 5 +// ---- +// Warning 2661: (80-83): BMC: Overflow (resulting value larger than 2**256 - 1) happens here. +// Warning 2661: (140-143): BMC: Overflow (resulting value larger than 2**256 - 1) happens here. +// Info 6002: BMC: 4 verification condition(s) proved safe! Enable the model checker option "show proved safe" to see all of them. diff --git a/test/libsolidity/smtCheckerTests/loops/for_loop_bmc_iterations_assertion_fails_1.sol b/test/libsolidity/smtCheckerTests/loops/for_loop_bmc_iterations_assertion_fails_1.sol new file mode 100644 index 000000000000..67290785b060 --- /dev/null +++ b/test/libsolidity/smtCheckerTests/loops/for_loop_bmc_iterations_assertion_fails_1.sol @@ -0,0 +1,16 @@ +contract C +{ + function f() public pure { + uint x; + for (uint i = 0; i < 2; ++i) + ++x; + assert(x == 1); + } +} +// ==== +// SMTEngine: bmc +// SMTSolvers: z3 +// BMCLoopIterations: 3 +// ---- +// Warning 4661: (92-106): BMC: Assertion violation happens here. +// Info 6002: BMC: 2 verification condition(s) proved safe! Enable the model checker option "show proved safe" to see all of them. diff --git a/test/libsolidity/smtCheckerTests/loops/for_loop_bmc_iterations_assertion_fails_2.sol b/test/libsolidity/smtCheckerTests/loops/for_loop_bmc_iterations_assertion_fails_2.sol new file mode 100644 index 000000000000..cd1ae918f591 --- /dev/null +++ b/test/libsolidity/smtCheckerTests/loops/for_loop_bmc_iterations_assertion_fails_2.sol @@ -0,0 +1,19 @@ +contract C { + function f() public pure { + uint x; + for (uint i = 0; i < 2; ++i) { + ++x; + break; + } + assert(x == 0); + assert(x == 1); + } +} +// ==== +// SMTEngine: bmc +// SMTSolvers: z3 +// BMCLoopIterations: 3 +// ---- +// Warning 5740: (77-80): Unreachable code. +// Warning 4661: (108-122): BMC: Assertion violation happens here. +// Info 6002: BMC: 3 verification condition(s) proved safe! Enable the model checker option "show proved safe" to see all of them. diff --git a/test/libsolidity/smtCheckerTests/loops/for_loop_bmc_iterations_assertion_fails_3.sol b/test/libsolidity/smtCheckerTests/loops/for_loop_bmc_iterations_assertion_fails_3.sol new file mode 100644 index 000000000000..8e1cb97bc8a1 --- /dev/null +++ b/test/libsolidity/smtCheckerTests/loops/for_loop_bmc_iterations_assertion_fails_3.sol @@ -0,0 +1,17 @@ +contract C { + function f() public pure { + uint x; + for (uint i = 0; i < 2; ++i) { + ++x; + continue; + } + assert(x == 0); + } +} +// ==== +// SMTEngine: bmc +// SMTSolvers: z3 +// BMCLoopIterations: 3 +// ---- +// Warning 4661: (111-125): BMC: Assertion violation happens here. +// Info 6002: BMC: 2 verification condition(s) proved safe! Enable the model checker option "show proved safe" to see all of them. diff --git a/test/libsolidity/smtCheckerTests/loops/for_loop_bmc_iterations_break_1.sol b/test/libsolidity/smtCheckerTests/loops/for_loop_bmc_iterations_break_1.sol new file mode 100644 index 000000000000..26958bf1d254 --- /dev/null +++ b/test/libsolidity/smtCheckerTests/loops/for_loop_bmc_iterations_break_1.sol @@ -0,0 +1,19 @@ +contract C +{ + function f() public pure { + uint x; + for (uint i = 0; i < 3; ++i) { + break; + ++x; + } + assert(x == 0); + } +} +// ==== +// SMTEngine: bmc +// SMTSolvers: z3 +// BMCLoopIterations: 4 +// ---- +// Warning 5740: (77-80): Unreachable code. +// Warning 5740: (97-100): Unreachable code. +// Info 6002: BMC: 3 verification condition(s) proved safe! Enable the model checker option "show proved safe" to see all of them. diff --git a/test/libsolidity/smtCheckerTests/loops/for_loop_bmc_iterations_break_2.sol b/test/libsolidity/smtCheckerTests/loops/for_loop_bmc_iterations_break_2.sol new file mode 100644 index 000000000000..cada2d85195e --- /dev/null +++ b/test/libsolidity/smtCheckerTests/loops/for_loop_bmc_iterations_break_2.sol @@ -0,0 +1,18 @@ +contract C +{ + function f() public pure { + uint x; + for (uint i = 0; i < 3; ++i) { + ++x; + break; + } + assert(x == 1); + } +} +// ==== +// SMTEngine: bmc +// SMTSolvers: z3 +// BMCLoopIterations: 4 +// ---- +// Warning 5740: (77-80): Unreachable code. +// Info 6002: BMC: 3 verification condition(s) proved safe! Enable the model checker option "show proved safe" to see all of them. diff --git a/test/libsolidity/smtCheckerTests/loops/for_loop_bmc_iterations_break_3.sol b/test/libsolidity/smtCheckerTests/loops/for_loop_bmc_iterations_break_3.sol new file mode 100644 index 000000000000..eb947d555feb --- /dev/null +++ b/test/libsolidity/smtCheckerTests/loops/for_loop_bmc_iterations_break_3.sol @@ -0,0 +1,18 @@ +contract C +{ + function f() public pure { + uint x; + for (uint i = 0; i < 3; ++i) { + if (i > 0) + break; + ++x; + } + assert(x == 1); + } +} +// ==== +// SMTEngine: bmc +// SMTSolvers: z3 +// BMCLoopIterations: 4 +// ---- +// Info 6002: BMC: 3 verification condition(s) proved safe! Enable the model checker option "show proved safe" to see all of them. diff --git a/test/libsolidity/smtCheckerTests/loops/for_loop_bmc_iterations_break_4.sol b/test/libsolidity/smtCheckerTests/loops/for_loop_bmc_iterations_break_4.sol new file mode 100644 index 000000000000..3d4855abfab1 --- /dev/null +++ b/test/libsolidity/smtCheckerTests/loops/for_loop_bmc_iterations_break_4.sol @@ -0,0 +1,18 @@ +contract C +{ + function f() public pure { + uint x; + for (uint i = 0; i < 3; ++i) { + ++x; + if (i > 0) + break; + } + assert(x == 2); + } +} +// ==== +// SMTEngine: bmc +// SMTSolvers: z3 +// BMCLoopIterations: 4 +// ---- +// Info 6002: BMC: 3 verification condition(s) proved safe! Enable the model checker option "show proved safe" to see all of them. diff --git a/test/libsolidity/smtCheckerTests/loops/for_loop_bmc_iterations_break_5.sol b/test/libsolidity/smtCheckerTests/loops/for_loop_bmc_iterations_break_5.sol new file mode 100644 index 000000000000..f21255502a75 --- /dev/null +++ b/test/libsolidity/smtCheckerTests/loops/for_loop_bmc_iterations_break_5.sol @@ -0,0 +1,23 @@ +contract C +{ + function f() public pure { + uint x; + for (uint i = 0; i < 3; ++i) { + if (i > 1) { + x = 1; + break; + } + if (i > 1) { + x = 2; + break; + } + } + assert(x == 1); + } +} +// ==== +// SMTEngine: bmc +// SMTSolvers: z3 +// BMCLoopIterations: 4 +// ---- +// Info 6002: BMC: 2 verification condition(s) proved safe! Enable the model checker option "show proved safe" to see all of them. diff --git a/test/libsolidity/smtCheckerTests/loops/for_loop_bmc_iterations_break_6.sol b/test/libsolidity/smtCheckerTests/loops/for_loop_bmc_iterations_break_6.sol new file mode 100644 index 000000000000..401491e9049b --- /dev/null +++ b/test/libsolidity/smtCheckerTests/loops/for_loop_bmc_iterations_break_6.sol @@ -0,0 +1,23 @@ +contract C +{ + function f() public pure { + uint x; + for (uint i = 0; i < 3; ++i) { + if (i > 1) { + x = 1; + break; + } + if (i >= 1) { + x = 2; + break; + } + } + assert(x == 2); + } +} +// ==== +// SMTEngine: bmc +// SMTSolvers: z3 +// BMCLoopIterations: 4 +// ---- +// Info 6002: BMC: 2 verification condition(s) proved safe! Enable the model checker option "show proved safe" to see all of them. diff --git a/test/libsolidity/smtCheckerTests/loops/for_loop_bmc_iterations_break_7.sol b/test/libsolidity/smtCheckerTests/loops/for_loop_bmc_iterations_break_7.sol new file mode 100644 index 000000000000..4bb4ffdf0408 --- /dev/null +++ b/test/libsolidity/smtCheckerTests/loops/for_loop_bmc_iterations_break_7.sol @@ -0,0 +1,17 @@ +contract C +{ + function f() public pure { + uint x; + for (;;) { + ++x; + break; + } + assert(x == 1); + } +} +// ==== +// SMTEngine: bmc +// SMTSolvers: z3 +// BMCLoopIterations: 4 +// ---- +// Info 6002: BMC: 2 verification condition(s) proved safe! Enable the model checker option "show proved safe" to see all of them. diff --git a/test/libsolidity/smtCheckerTests/loops/for_loop_bmc_iterations_break_8.sol b/test/libsolidity/smtCheckerTests/loops/for_loop_bmc_iterations_break_8.sol new file mode 100644 index 000000000000..a88a031e75e1 --- /dev/null +++ b/test/libsolidity/smtCheckerTests/loops/for_loop_bmc_iterations_break_8.sol @@ -0,0 +1,18 @@ +contract C +{ + function f() public pure { + uint x; + for (;;) { + break; + ++x; + } + assert(x == 0); + } +} +// ==== +// SMTEngine: bmc +// SMTSolvers: z3 +// BMCLoopIterations: 4 +// ---- +// Warning 5740: (78-81): Unreachable code. +// Info 6002: BMC: 2 verification condition(s) proved safe! Enable the model checker option "show proved safe" to see all of them. diff --git a/test/libsolidity/smtCheckerTests/loops/for_loop_bmc_iterations_break_9.sol b/test/libsolidity/smtCheckerTests/loops/for_loop_bmc_iterations_break_9.sol new file mode 100644 index 000000000000..4ce3d9268e89 --- /dev/null +++ b/test/libsolidity/smtCheckerTests/loops/for_loop_bmc_iterations_break_9.sol @@ -0,0 +1,17 @@ +contract C +{ + function f() public pure { + uint x; + for (;x < 2;) { + ++x; + break; + } + assert(x == 1); + } +} +// ==== +// SMTEngine: bmc +// SMTSolvers: z3 +// BMCLoopIterations: 3 +// ---- +// Info 6002: BMC: 2 verification condition(s) proved safe! Enable the model checker option "show proved safe" to see all of them. diff --git a/test/libsolidity/smtCheckerTests/loops/for_loop_bmc_iterations_break_continue_1.sol b/test/libsolidity/smtCheckerTests/loops/for_loop_bmc_iterations_break_continue_1.sol new file mode 100644 index 000000000000..b999f9cf6176 --- /dev/null +++ b/test/libsolidity/smtCheckerTests/loops/for_loop_bmc_iterations_break_continue_1.sol @@ -0,0 +1,22 @@ +contract C +{ + function f() public pure { + uint x; + for (uint i = 0; i < 3; ++i) { + if (i > 1) { + break; + } + if (i >= 0) { + x = 10; + continue; + } + } + assert(x == 10); + } +} +// ==== +// SMTEngine: bmc +// SMTSolvers: z3 +// BMCLoopIterations: 3 +// ---- +// Info 6002: BMC: 2 verification condition(s) proved safe! Enable the model checker option "show proved safe" to see all of them. diff --git a/test/libsolidity/smtCheckerTests/loops/for_loop_bmc_iterations_break_continue_2.sol b/test/libsolidity/smtCheckerTests/loops/for_loop_bmc_iterations_break_continue_2.sol new file mode 100644 index 000000000000..0da0f5d9940f --- /dev/null +++ b/test/libsolidity/smtCheckerTests/loops/for_loop_bmc_iterations_break_continue_2.sol @@ -0,0 +1,23 @@ +contract C +{ + function f() public pure { + uint x; + for (uint i = 0; i < 2; ++i) { + if (i > 0) { + x = 1; + break; + } + if (i >= 0) { + x = 2; + continue; + } + } + assert(x == 1); + } +} +// ==== +// SMTEngine: bmc +// SMTSolvers: z3 +// BMCLoopIterations: 2 +// ---- +// Info 6002: BMC: 2 verification condition(s) proved safe! Enable the model checker option "show proved safe" to see all of them. diff --git a/test/libsolidity/smtCheckerTests/loops/for_loop_bmc_iterations_break_continue_3.sol b/test/libsolidity/smtCheckerTests/loops/for_loop_bmc_iterations_break_continue_3.sol new file mode 100644 index 000000000000..9f762bb43674 --- /dev/null +++ b/test/libsolidity/smtCheckerTests/loops/for_loop_bmc_iterations_break_continue_3.sol @@ -0,0 +1,22 @@ +contract C +{ + function f() public pure { + uint x; + for (uint i = 0; i < 3; ++i) { + if (i > 0) { + x = 1; + break; + } else { + x = 2; + continue; + } + } + assert(x == 1); + } +} +// ==== +// SMTEngine: bmc +// SMTSolvers: z3 +// BMCLoopIterations: 3 +// ---- +// Info 6002: BMC: 2 verification condition(s) proved safe! Enable the model checker option "show proved safe" to see all of them. diff --git a/test/libsolidity/smtCheckerTests/loops/for_loop_bmc_iterations_continue_1.sol b/test/libsolidity/smtCheckerTests/loops/for_loop_bmc_iterations_continue_1.sol new file mode 100644 index 000000000000..44983ecddc11 --- /dev/null +++ b/test/libsolidity/smtCheckerTests/loops/for_loop_bmc_iterations_continue_1.sol @@ -0,0 +1,18 @@ +contract C +{ + function f(uint x) public pure { + require(x == 0); + for (uint i = 0; i < 3; ++i) { + if (i > 1) + continue; + ++x; + } + assert(x == 2); + } +} +// ==== +// SMTEngine: bmc +// SMTSolvers: z3 +// BMCLoopIterations: 4 +// ---- +// Info 6002: BMC: 3 verification condition(s) proved safe! Enable the model checker option "show proved safe" to see all of them. diff --git a/test/libsolidity/smtCheckerTests/loops/for_loop_bmc_iterations_continue_2.sol b/test/libsolidity/smtCheckerTests/loops/for_loop_bmc_iterations_continue_2.sol new file mode 100644 index 000000000000..2c7fc1236755 --- /dev/null +++ b/test/libsolidity/smtCheckerTests/loops/for_loop_bmc_iterations_continue_2.sol @@ -0,0 +1,23 @@ +contract C +{ + function f() public pure { + uint x; + for (uint i = 0; i < 2; ++i) { + if (i == 1) { + x = 1; + continue; + } + if (i == 0) { + x = 2; + continue; + } + } + assert(x == 1); + } +} +// ==== +// SMTEngine: bmc +// SMTSolvers: z3 +// BMCLoopIterations: 4 +// ---- +// Info 6002: BMC: 2 verification condition(s) proved safe! Enable the model checker option "show proved safe" to see all of them. diff --git a/test/libsolidity/smtCheckerTests/loops/for_loop_bmc_iterations_continue_3.sol b/test/libsolidity/smtCheckerTests/loops/for_loop_bmc_iterations_continue_3.sol new file mode 100644 index 000000000000..b74709e484fd --- /dev/null +++ b/test/libsolidity/smtCheckerTests/loops/for_loop_bmc_iterations_continue_3.sol @@ -0,0 +1,24 @@ +contract C +{ + function f(uint x) public pure { + require(x == 0); + for (uint i = 0; i < 3; ++i) { + if (x > 1) { + x = 10; + continue; + } + if (x > 0) { + x = 11; + continue; + } + ++x; + } + assert(x == 10); + } +} +// ==== +// SMTEngine: bmc +// SMTSolvers: z3 +// BMCLoopIterations: 4 +// ---- +// Info 6002: BMC: 3 verification condition(s) proved safe! Enable the model checker option "show proved safe" to see all of them. diff --git a/test/libsolidity/smtCheckerTests/loops/for_loop_bmc_iterations_continue_4.sol b/test/libsolidity/smtCheckerTests/loops/for_loop_bmc_iterations_continue_4.sol new file mode 100644 index 000000000000..246aa74c9710 --- /dev/null +++ b/test/libsolidity/smtCheckerTests/loops/for_loop_bmc_iterations_continue_4.sol @@ -0,0 +1,24 @@ +contract C +{ + function f() public pure { + uint x; + for (; x < 2; ++x) { + if (x > 1) { + x = 10; + continue; + } + if (x > 0) { + x = 11; + continue; + } + } + // x > 0 branch triggers x = 11 and continue triggers ++x loop expression + assert(x == 12); + } +} +// ==== +// SMTEngine: bmc +// SMTSolvers: z3 +// BMCLoopIterations: 4 +// ---- +// Info 6002: BMC: 2 verification condition(s) proved safe! Enable the model checker option "show proved safe" to see all of them. diff --git a/test/libsolidity/smtCheckerTests/loops/for_loop_bmc_iterations_continue_5.sol b/test/libsolidity/smtCheckerTests/loops/for_loop_bmc_iterations_continue_5.sol new file mode 100644 index 000000000000..270d8d4df8a1 --- /dev/null +++ b/test/libsolidity/smtCheckerTests/loops/for_loop_bmc_iterations_continue_5.sol @@ -0,0 +1,17 @@ +contract C +{ + function f() public pure { + uint x; + for (; x < 2; ++x) { + continue; + } + // loop expression is executed after continue + assert(x == 2); + } +} +// ==== +// SMTEngine: bmc +// SMTSolvers: z3 +// BMCLoopIterations: 4 +// ---- +// Info 6002: BMC: 2 verification condition(s) proved safe! Enable the model checker option "show proved safe" to see all of them. diff --git a/test/libsolidity/smtCheckerTests/loops/for_loop_bmc_iterations_false_positive.sol b/test/libsolidity/smtCheckerTests/loops/for_loop_bmc_iterations_false_positive.sol new file mode 100644 index 000000000000..20071a64aaba --- /dev/null +++ b/test/libsolidity/smtCheckerTests/loops/for_loop_bmc_iterations_false_positive.sol @@ -0,0 +1,16 @@ +contract C +{ + function f() public pure { + uint x = 0; + for (;;) { + x = 1; + } + assert(x == 1000); + } +} +// ==== +// SMTEngine: bmc +// SMTSolvers: z3 +// BMCLoopIterations: 3 +// ---- +// Info 6002: BMC: 1 verification condition(s) proved safe! Enable the model checker option "show proved safe" to see all of them. diff --git a/test/libsolidity/smtCheckerTests/loops/for_loop_bmc_iterations_nested.sol b/test/libsolidity/smtCheckerTests/loops/for_loop_bmc_iterations_nested.sol new file mode 100644 index 000000000000..d63e2ca5c697 --- /dev/null +++ b/test/libsolidity/smtCheckerTests/loops/for_loop_bmc_iterations_nested.sol @@ -0,0 +1,17 @@ +contract C +{ + function f() public pure { + uint x; + for (uint i = 0; i < 2; ++i) { + for (uint j = 0; j < 2; ++j) + ++x; + } + assert(x == 4); + } +} +// ==== +// SMTEngine: bmc +// SMTSolvers: z3 +// BMCLoopIterations: 4 +// ---- +// Info 6002: BMC: 4 verification condition(s) proved safe! Enable the model checker option "show proved safe" to see all of them. diff --git a/test/libsolidity/smtCheckerTests/loops/for_loop_bmc_iterations_nested_break.sol b/test/libsolidity/smtCheckerTests/loops/for_loop_bmc_iterations_nested_break.sol new file mode 100644 index 000000000000..c302decafec8 --- /dev/null +++ b/test/libsolidity/smtCheckerTests/loops/for_loop_bmc_iterations_nested_break.sol @@ -0,0 +1,22 @@ +contract C +{ + function f(uint x) public pure { + require(x == 0); + for (uint i = 0; i < 2; ++i) { + for (uint j = 0; j < 2; ++j) { + x = x + 1; + break; + } + break; + } + assert(x == 1); + } +} +// ==== +// SMTEngine: bmc +// SMTSolvers: z3 +// BMCLoopIterations: 3 +// ---- +// Warning 5740: (92-95): Unreachable code. +// Warning 5740: (126-129): Unreachable code. +// Info 6002: BMC: 4 verification condition(s) proved safe! Enable the model checker option "show proved safe" to see all of them. diff --git a/test/libsolidity/smtCheckerTests/loops/for_loop_bmc_iterations_nested_continue.sol b/test/libsolidity/smtCheckerTests/loops/for_loop_bmc_iterations_nested_continue.sol new file mode 100644 index 000000000000..8c07d096a772 --- /dev/null +++ b/test/libsolidity/smtCheckerTests/loops/for_loop_bmc_iterations_nested_continue.sol @@ -0,0 +1,20 @@ +contract C +{ + function f() public pure { + uint x = 0; + for (uint i = 0; i < 2; ++i) { + for (uint j = 0; j < 2; ++j) { + if (i > 0) + continue; + ++x; + } + } + assert(x == 2); + } +} +// ==== +// SMTEngine: bmc +// SMTSolvers: z3 +// BMCLoopIterations: 4 +// ---- +// Info 6002: BMC: 4 verification condition(s) proved safe! Enable the model checker option "show proved safe" to see all of them. diff --git a/test/libsolidity/smtCheckerTests/loops/for_loop_bmc_iterations_semantics_1.sol b/test/libsolidity/smtCheckerTests/loops/for_loop_bmc_iterations_semantics_1.sol new file mode 100644 index 000000000000..915c0e6908ee --- /dev/null +++ b/test/libsolidity/smtCheckerTests/loops/for_loop_bmc_iterations_semantics_1.sol @@ -0,0 +1,19 @@ +contract C { + function f() public pure { + uint x = 0; + int y = 0; + for (; x < 3 || y == 1; ++x) { + if (x >= 3) + y = 1; + } + // BMC loop iteration setting is not enough to leave the loop + assert(x == 0); // should hold - no assumptions on value if didn't complete loop + assert(y == 0); // should hold - no assumptions on value if didn't complete loop + } +} +// ==== +// SMTEngine: bmc +// SMTSolvers: z3 +// BMCLoopIterations: 3 +// ---- +// Info 6002: BMC: 3 verification condition(s) proved safe! Enable the model checker option "show proved safe" to see all of them. diff --git a/test/libsolidity/smtCheckerTests/loops/for_loop_bmc_iterations_semantics_2.sol b/test/libsolidity/smtCheckerTests/loops/for_loop_bmc_iterations_semantics_2.sol new file mode 100644 index 000000000000..337515c9a03c --- /dev/null +++ b/test/libsolidity/smtCheckerTests/loops/for_loop_bmc_iterations_semantics_2.sol @@ -0,0 +1,19 @@ +contract C { + function f() public pure { + uint x = 0; + int y = 0; + for (; x < 3 || y == 1; ++x) { + if (x >= 3) + y = 1; + } + // BMC loop iteration setting is just enough to leave the loop + assert(x == 3); // should hold - no assumptions on value if didn't complete loop + assert(y == 0); // should hold - no assumptions on value if didn't complete loop + } +} +// ==== +// SMTEngine: bmc +// SMTSolvers: z3 +// BMCLoopIterations: 4 +// ---- +// Info 6002: BMC: 3 verification condition(s) proved safe! Enable the model checker option "show proved safe" to see all of them. diff --git a/test/libsolidity/smtCheckerTests/loops/for_loop_bmc_iterations_semantics_3.sol b/test/libsolidity/smtCheckerTests/loops/for_loop_bmc_iterations_semantics_3.sol new file mode 100644 index 000000000000..5ff9d17782a8 --- /dev/null +++ b/test/libsolidity/smtCheckerTests/loops/for_loop_bmc_iterations_semantics_3.sol @@ -0,0 +1,19 @@ +contract C { + function f() public pure { + uint x = 0; + int y = 0; + for (; x < 3 || y == 1; ++x) { + if (x >= 3) + y = 1; + } + // BMC loop iteration setting is more than enough to leave the loop + assert(x == 3); // should hold - no assumptions on value if didn't complete loop + assert(y == 0); // should hold - no assumptions on value if didn't complete loop + } +} +// ==== +// SMTEngine: bmc +// SMTSolvers: z3 +// BMCLoopIterations: 5 +// ---- +// Info 6002: BMC: 3 verification condition(s) proved safe! Enable the model checker option "show proved safe" to see all of them. diff --git a/test/libsolidity/smtCheckerTests/loops/for_loop_bmc_iterations_shallow_unroll.sol b/test/libsolidity/smtCheckerTests/loops/for_loop_bmc_iterations_shallow_unroll.sol new file mode 100644 index 000000000000..8bfecdfa59ce --- /dev/null +++ b/test/libsolidity/smtCheckerTests/loops/for_loop_bmc_iterations_shallow_unroll.sol @@ -0,0 +1,17 @@ +contract C +{ + function f() public pure { + uint x = 0; + for (uint i = 0; i < 2; ++i) { + ++x; + } + // nothing is reported because loop condition is still true after BMCLoopIterations + assert(x == 3); + } +} +// ==== +// SMTEngine: bmc +// SMTSolvers: z3 +// BMCLoopIterations: 1 +// ---- +// Info 6002: BMC: 3 verification condition(s) proved safe! Enable the model checker option "show proved safe" to see all of them. diff --git a/test/libsolidity/smtCheckerTests/loops/for_loop_trivial_condition_1.sol b/test/libsolidity/smtCheckerTests/loops/for_loop_trivial_condition_1.sol index d667a55c854d..36af4f9b4155 100644 --- a/test/libsolidity/smtCheckerTests/loops/for_loop_trivial_condition_1.sol +++ b/test/libsolidity/smtCheckerTests/loops/for_loop_trivial_condition_1.sol @@ -10,4 +10,3 @@ contract C { // SMTSolvers: z3 // ---- // Info 1391: CHC: 1 verification condition(s) proved safe! Enable the model checker option "show proved safe" to see all of them. -// Warning 6838: (90-96): BMC: Condition is always true. diff --git a/test/libsolidity/smtCheckerTests/loops/for_loop_trivial_condition_2.sol b/test/libsolidity/smtCheckerTests/loops/for_loop_trivial_condition_2.sol index 65caca9826b3..0847066a0536 100644 --- a/test/libsolidity/smtCheckerTests/loops/for_loop_trivial_condition_2.sol +++ b/test/libsolidity/smtCheckerTests/loops/for_loop_trivial_condition_2.sol @@ -13,4 +13,3 @@ contract C { // SMTSolvers: z3 // ---- // Info 1391: CHC: 1 verification condition(s) proved safe! Enable the model checker option "show proved safe" to see all of them. -// Warning 6838: (106-112): BMC: Condition is always true. diff --git a/test/libsolidity/smtCheckerTests/loops/for_loop_unreachable_1.sol b/test/libsolidity/smtCheckerTests/loops/for_loop_unreachable_1.sol deleted file mode 100644 index 4fdaa6bcf059..000000000000 --- a/test/libsolidity/smtCheckerTests/loops/for_loop_unreachable_1.sol +++ /dev/null @@ -1,13 +0,0 @@ -contract C { - function f(uint x) public pure { - require(x == 2); - for (; x > 2;) {} - assert(x == 2); - } -} -// ==== -// SMTEngine: all -// SMTSolvers: z3 -// ---- -// Info 1391: CHC: 1 verification condition(s) proved safe! Enable the model checker option "show proved safe" to see all of them. -// Warning 6838: (90-95): BMC: Condition is always false. diff --git a/test/libsolidity/smtCheckerTests/loops/while_bmc_iterations_1.sol b/test/libsolidity/smtCheckerTests/loops/while_bmc_iterations_1.sol new file mode 100644 index 000000000000..11a4e7587b08 --- /dev/null +++ b/test/libsolidity/smtCheckerTests/loops/while_bmc_iterations_1.sol @@ -0,0 +1,18 @@ +contract C { + function f(uint x) public pure { + require(x == 0); + uint y; + while (y < 3) { + ++y; + if (y == 2) + x = 3; + } + assert(x == 3); + } +} +// ==== +// SMTEngine: bmc +// SMTSolvers: z3 +// BMCLoopIterations: 2 +// ---- +// Info 6002: BMC: 2 verification condition(s) proved safe! Enable the model checker option "show proved safe" to see all of them. diff --git a/test/libsolidity/smtCheckerTests/loops/while_bmc_iterations_2.sol b/test/libsolidity/smtCheckerTests/loops/while_bmc_iterations_2.sol new file mode 100644 index 000000000000..075e342eae58 --- /dev/null +++ b/test/libsolidity/smtCheckerTests/loops/while_bmc_iterations_2.sol @@ -0,0 +1,19 @@ +contract C { + function f() public pure { + uint x; + while (x < 3) { + ++x; + { + ++x; + ++x; + } + } + assert(x == 3); + } +} +// ==== +// SMTEngine: bmc +// SMTSolvers: z3 +// BMCLoopIterations: 3 +// ---- +// Info 6002: BMC: 4 verification condition(s) proved safe! Enable the model checker option "show proved safe" to see all of them. diff --git a/test/libsolidity/smtCheckerTests/loops/while_bmc_iterations_3.sol b/test/libsolidity/smtCheckerTests/loops/while_bmc_iterations_3.sol new file mode 100644 index 000000000000..2596af24f79a --- /dev/null +++ b/test/libsolidity/smtCheckerTests/loops/while_bmc_iterations_3.sol @@ -0,0 +1,17 @@ +contract C { + function f() public pure { + uint x; + while (x < 3) { + if (x >= 2) + ++x; + ++x; + } + assert(x == 4); + } +} +// ==== +// SMTEngine: bmc +// SMTSolvers: z3 +// BMCLoopIterations: 5 +// ---- +// Info 6002: BMC: 3 verification condition(s) proved safe! Enable the model checker option "show proved safe" to see all of them. diff --git a/test/libsolidity/smtCheckerTests/loops/while_bmc_iterations_4.sol b/test/libsolidity/smtCheckerTests/loops/while_bmc_iterations_4.sol new file mode 100644 index 000000000000..8bfbe32d1a15 --- /dev/null +++ b/test/libsolidity/smtCheckerTests/loops/while_bmc_iterations_4.sol @@ -0,0 +1,15 @@ +contract C { + function f(uint x) public pure { + x = 0; + while (x < 1) { + ++x; + } + assert(x == 1); + } +} +// ==== +// SMTEngine: bmc +// SMTSolvers: z3 +// BMCLoopIterations: 3 +// ---- +// Info 6002: BMC: 2 verification condition(s) proved safe! Enable the model checker option "show proved safe" to see all of them. diff --git a/test/libsolidity/smtCheckerTests/loops/while_bmc_iterations_5.sol b/test/libsolidity/smtCheckerTests/loops/while_bmc_iterations_5.sol new file mode 100644 index 000000000000..f3166cee8633 --- /dev/null +++ b/test/libsolidity/smtCheckerTests/loops/while_bmc_iterations_5.sol @@ -0,0 +1,15 @@ +contract C { + function f() public pure { + uint x; + while (true) { + ++x; + } + assert(x == 1000); + } +} +// ==== +// SMTEngine: bmc +// SMTSolvers: z3 +// BMCLoopIterations: 1 +// ---- +// Info 6002: BMC: 2 verification condition(s) proved safe! Enable the model checker option "show proved safe" to see all of them. diff --git a/test/libsolidity/smtCheckerTests/loops/while_bmc_iterations_7.sol b/test/libsolidity/smtCheckerTests/loops/while_bmc_iterations_7.sol new file mode 100644 index 000000000000..3f6a5b4bfa34 --- /dev/null +++ b/test/libsolidity/smtCheckerTests/loops/while_bmc_iterations_7.sol @@ -0,0 +1,22 @@ +contract C { + uint x; + + function condition() private returns(bool) { + ++x; + return x < 3; + } + + function f() public { + require(x == 0); + while (condition()) { + } + assert(x == 3); + } +} +// ==== +// SMTEngine: bmc +// SMTSolvers: z3 +// BMCLoopIterations: 5 +// ---- +// Warning 2661: (77-80): BMC: Overflow (resulting value larger than 2**256 - 1) happens here. +// Info 6002: BMC: 2 verification condition(s) proved safe! Enable the model checker option "show proved safe" to see all of them. diff --git a/test/libsolidity/smtCheckerTests/loops/while_bmc_iterations_assertion_fails_1.sol b/test/libsolidity/smtCheckerTests/loops/while_bmc_iterations_assertion_fails_1.sol new file mode 100644 index 000000000000..a43c7489e78f --- /dev/null +++ b/test/libsolidity/smtCheckerTests/loops/while_bmc_iterations_assertion_fails_1.sol @@ -0,0 +1,17 @@ +contract C +{ + function f(uint x) public pure { + require(x == 0); + while (x < 2) { + ++x; + } + assert(x == 3); + } +} +// ==== +// SMTEngine: bmc +// SMTSolvers: z3 +// BMCLoopIterations: 3 +// ---- +// Warning 4661: (98-112): BMC: Assertion violation happens here. +// Info 6002: BMC: 1 verification condition(s) proved safe! Enable the model checker option "show proved safe" to see all of them. diff --git a/test/libsolidity/smtCheckerTests/loops/while_bmc_iterations_assertion_fails_2.sol b/test/libsolidity/smtCheckerTests/loops/while_bmc_iterations_assertion_fails_2.sol new file mode 100644 index 000000000000..c16f755b663a --- /dev/null +++ b/test/libsolidity/smtCheckerTests/loops/while_bmc_iterations_assertion_fails_2.sol @@ -0,0 +1,18 @@ +contract C { + function f() public pure { + uint x; + while (x < 2) { + ++x; + break; + } + assert(x == 0); + assert(x == 1); + } +} +// ==== +// SMTEngine: bmc +// SMTSolvers: z3 +// BMCLoopIterations: 2 +// ---- +// Warning 4661: (93-107): BMC: Assertion violation happens here. +// Info 6002: BMC: 2 verification condition(s) proved safe! Enable the model checker option "show proved safe" to see all of them. diff --git a/test/libsolidity/smtCheckerTests/loops/while_bmc_iterations_assertion_fails_3.sol b/test/libsolidity/smtCheckerTests/loops/while_bmc_iterations_assertion_fails_3.sol new file mode 100644 index 000000000000..acaf4f9a3ec5 --- /dev/null +++ b/test/libsolidity/smtCheckerTests/loops/while_bmc_iterations_assertion_fails_3.sol @@ -0,0 +1,17 @@ +contract C { + function f() public pure { + uint x; + while (x < 2) { + ++x; + continue; + } + assert(x == 1); + } +} +// ==== +// SMTEngine: bmc +// SMTSolvers: z3 +// BMCLoopIterations: 3 +// ---- +// Warning 4661: (96-110): BMC: Assertion violation happens here. +// Info 6002: BMC: 1 verification condition(s) proved safe! Enable the model checker option "show proved safe" to see all of them. diff --git a/test/libsolidity/smtCheckerTests/loops/while_bmc_iterations_break_1.sol b/test/libsolidity/smtCheckerTests/loops/while_bmc_iterations_break_1.sol new file mode 100644 index 000000000000..c8b45bac04fd --- /dev/null +++ b/test/libsolidity/smtCheckerTests/loops/while_bmc_iterations_break_1.sol @@ -0,0 +1,16 @@ +contract C { + function f() public pure { + uint x; + while (x < 3) { + ++x; + break; + } + assert(x == 1); + } +} +// ==== +// SMTEngine: bmc +// SMTSolvers: z3 +// BMCLoopIterations: 3 +// ---- +// Info 6002: BMC: 2 verification condition(s) proved safe! Enable the model checker option "show proved safe" to see all of them. diff --git a/test/libsolidity/smtCheckerTests/loops/while_bmc_iterations_break_2.sol b/test/libsolidity/smtCheckerTests/loops/while_bmc_iterations_break_2.sol new file mode 100644 index 000000000000..c4a8c2f39bc3 --- /dev/null +++ b/test/libsolidity/smtCheckerTests/loops/while_bmc_iterations_break_2.sol @@ -0,0 +1,17 @@ +contract C { + function f() public pure { + uint x; + while (x < 3) { + if (x > 0) + break; + ++x; + } + assert(x == 1); + } +} +// ==== +// SMTEngine: bmc +// SMTSolvers: z3 +// BMCLoopIterations: 3 +// ---- +// Info 6002: BMC: 2 verification condition(s) proved safe! Enable the model checker option "show proved safe" to see all of them. diff --git a/test/libsolidity/smtCheckerTests/loops/while_bmc_iterations_break_3.sol b/test/libsolidity/smtCheckerTests/loops/while_bmc_iterations_break_3.sol new file mode 100644 index 000000000000..c089b906bc86 --- /dev/null +++ b/test/libsolidity/smtCheckerTests/loops/while_bmc_iterations_break_3.sol @@ -0,0 +1,19 @@ +contract C { + function f() public pure { + uint x; + while (x < 3) { + if (x > 0) { + ++x; + break; + } + ++x; + } + assert(x == 2); + } +} +// ==== +// SMTEngine: bmc +// SMTSolvers: z3 +// BMCLoopIterations: 3 +// ---- +// Info 6002: BMC: 3 verification condition(s) proved safe! Enable the model checker option "show proved safe" to see all of them. diff --git a/test/libsolidity/smtCheckerTests/loops/while_bmc_iterations_break_4.sol b/test/libsolidity/smtCheckerTests/loops/while_bmc_iterations_break_4.sol new file mode 100644 index 000000000000..d1939871bf39 --- /dev/null +++ b/test/libsolidity/smtCheckerTests/loops/while_bmc_iterations_break_4.sol @@ -0,0 +1,19 @@ +contract C { + function f() public pure { + uint x; + while (x < 3) { + ++x; + if (x > 0) { + ++x; + break; + } + } + assert(x == 2); + } +} +// ==== +// SMTEngine: bmc +// SMTSolvers: z3 +// BMCLoopIterations: 3 +// ---- +// Info 6002: BMC: 3 verification condition(s) proved safe! Enable the model checker option "show proved safe" to see all of them. diff --git a/test/libsolidity/smtCheckerTests/loops/while_bmc_iterations_break_5.sol b/test/libsolidity/smtCheckerTests/loops/while_bmc_iterations_break_5.sol new file mode 100644 index 000000000000..f7ba610a69d2 --- /dev/null +++ b/test/libsolidity/smtCheckerTests/loops/while_bmc_iterations_break_5.sol @@ -0,0 +1,19 @@ +contract C { + function f() public pure { + uint x; + while (x < 3) { + ++x; + if (x > 1) { + ++x; + break; + } + } + assert(x == 3); + } +} +// ==== +// SMTEngine: bmc +// SMTSolvers: z3 +// BMCLoopIterations: 3 +// ---- +// Info 6002: BMC: 3 verification condition(s) proved safe! Enable the model checker option "show proved safe" to see all of them. diff --git a/test/libsolidity/smtCheckerTests/loops/while_bmc_iterations_break_6.sol b/test/libsolidity/smtCheckerTests/loops/while_bmc_iterations_break_6.sol new file mode 100644 index 000000000000..0546e48c0ddb --- /dev/null +++ b/test/libsolidity/smtCheckerTests/loops/while_bmc_iterations_break_6.sol @@ -0,0 +1,23 @@ +contract C { + function f() public pure { + uint x; + while (x < 3) { + ++x; + if (x > 0) { + x = 2; + break; + } + if (x > 1) { + x = 3; + break; + } + } + assert(x == 2); + } +} +// ==== +// SMTEngine: bmc +// SMTSolvers: z3 +// BMCLoopIterations: 3 +// ---- +// Info 6002: BMC: 2 verification condition(s) proved safe! Enable the model checker option "show proved safe" to see all of them. diff --git a/test/libsolidity/smtCheckerTests/loops/while_bmc_iterations_break_7.sol b/test/libsolidity/smtCheckerTests/loops/while_bmc_iterations_break_7.sol new file mode 100644 index 000000000000..8e4d3b6261d0 --- /dev/null +++ b/test/libsolidity/smtCheckerTests/loops/while_bmc_iterations_break_7.sol @@ -0,0 +1,23 @@ +contract C { + function f() public pure { + uint x; + while (x < 3) { + ++x; + if (x > 1) { + x = 3; + break; + } + if (x > 0) { + x = 2; + break; + } + } + assert(x == 2); + } +} +// ==== +// SMTEngine: bmc +// SMTSolvers: z3 +// BMCLoopIterations: 3 +// ---- +// Info 6002: BMC: 2 verification condition(s) proved safe! Enable the model checker option "show proved safe" to see all of them. diff --git a/test/libsolidity/smtCheckerTests/loops/while_bmc_iterations_break_8.sol b/test/libsolidity/smtCheckerTests/loops/while_bmc_iterations_break_8.sol new file mode 100644 index 000000000000..be6b04bb2728 --- /dev/null +++ b/test/libsolidity/smtCheckerTests/loops/while_bmc_iterations_break_8.sol @@ -0,0 +1,19 @@ +contract C { + function f() public pure { + uint x = 0; + while (x < 3) { + if (x >= 0) { + ++x; + break; + } + ++x; + } + assert(x == 1); + } +} +// ==== +// SMTEngine: bmc +// SMTSolvers: z3 +// BMCLoopIterations: 4 +// ---- +// Info 6002: BMC: 3 verification condition(s) proved safe! Enable the model checker option "show proved safe" to see all of them. diff --git a/test/libsolidity/smtCheckerTests/loops/while_bmc_iterations_break_9.sol b/test/libsolidity/smtCheckerTests/loops/while_bmc_iterations_break_9.sol new file mode 100644 index 000000000000..caaa4f570ac5 --- /dev/null +++ b/test/libsolidity/smtCheckerTests/loops/while_bmc_iterations_break_9.sol @@ -0,0 +1,18 @@ +contract C { + function f() public pure { + uint x = 0; + while (x < 3) { + ++x; + break; + ++x; + } + assert(x == 1); + } +} +// ==== +// SMTEngine: bmc +// SMTSolvers: z3 +// BMCLoopIterations: 4 +// ---- +// Warning 5740: (94-97): Unreachable code. +// Info 6002: BMC: 3 verification condition(s) proved safe! Enable the model checker option "show proved safe" to see all of them. diff --git a/test/libsolidity/smtCheckerTests/loops/while_bmc_iterations_break_continue_1.sol b/test/libsolidity/smtCheckerTests/loops/while_bmc_iterations_break_continue_1.sol new file mode 100644 index 000000000000..bb9554523453 --- /dev/null +++ b/test/libsolidity/smtCheckerTests/loops/while_bmc_iterations_break_continue_1.sol @@ -0,0 +1,21 @@ +contract C { + function f() public pure { + uint x; + while (x < 3) { + if (x > 1) { + break; + } + if (x >= 0) { + x = 10; + continue; + } + } + assert(x == 10); + } +} +// ==== +// SMTEngine: bmc +// SMTSolvers: z3 +// BMCLoopIterations: 3 +// ---- +// Info 6002: BMC: 1 verification condition(s) proved safe! Enable the model checker option "show proved safe" to see all of them. diff --git a/test/libsolidity/smtCheckerTests/loops/while_bmc_iterations_break_continue_2.sol b/test/libsolidity/smtCheckerTests/loops/while_bmc_iterations_break_continue_2.sol new file mode 100644 index 000000000000..b65404e22f76 --- /dev/null +++ b/test/libsolidity/smtCheckerTests/loops/while_bmc_iterations_break_continue_2.sol @@ -0,0 +1,22 @@ +contract C { + function f() public pure { + uint x; + while (x < 3) { + if (x > 1) { + x = 3; + break; + } + if (x >= 0) { + x = 2; + continue; + } + } + assert(x == 3); + } +} +// ==== +// SMTEngine: bmc +// SMTSolvers: z3 +// BMCLoopIterations: 3 +// ---- +// Info 6002: BMC: 1 verification condition(s) proved safe! Enable the model checker option "show proved safe" to see all of them. diff --git a/test/libsolidity/smtCheckerTests/loops/while_bmc_iterations_continue_1.sol b/test/libsolidity/smtCheckerTests/loops/while_bmc_iterations_continue_1.sol new file mode 100644 index 000000000000..e17fa303734b --- /dev/null +++ b/test/libsolidity/smtCheckerTests/loops/while_bmc_iterations_continue_1.sol @@ -0,0 +1,19 @@ +contract C { + function f() public pure { + uint x; + uint i; + while (i < 3) { + ++i; + if (i > 1) + continue; + ++x; + } + assert(x == 1); + } +} +// ==== +// SMTEngine: bmc +// SMTSolvers: z3 +// BMCLoopIterations: 4 +// ---- +// Info 6002: BMC: 3 verification condition(s) proved safe! Enable the model checker option "show proved safe" to see all of them. diff --git a/test/libsolidity/smtCheckerTests/loops/while_bmc_iterations_continue_2.sol b/test/libsolidity/smtCheckerTests/loops/while_bmc_iterations_continue_2.sol new file mode 100644 index 000000000000..3670f8dacb4e --- /dev/null +++ b/test/libsolidity/smtCheckerTests/loops/while_bmc_iterations_continue_2.sol @@ -0,0 +1,24 @@ +contract C { + function f(uint x) public pure { + require(x == 0); + uint i; + while (i < 3) { + ++i; + if (i == 2) { + x = 2; + continue; + } + if (i == 1) { + x = 1; + continue; + } + } + assert(x == 2); + } +} +// ==== +// SMTEngine: bmc +// SMTSolvers: z3 +// BMCLoopIterations: 4 +// ---- +// Info 6002: BMC: 2 verification condition(s) proved safe! Enable the model checker option "show proved safe" to see all of them. diff --git a/test/libsolidity/smtCheckerTests/loops/while_bmc_iterations_nested.sol b/test/libsolidity/smtCheckerTests/loops/while_bmc_iterations_nested.sol new file mode 100644 index 000000000000..887ce60f7dff --- /dev/null +++ b/test/libsolidity/smtCheckerTests/loops/while_bmc_iterations_nested.sol @@ -0,0 +1,22 @@ +contract C { + function f(uint z) public pure { + uint x = 0; + require(z == 0); + while (x < 2) { + uint y = 0; + while (y < 2) { + ++z; + ++y; + } + ++x; + } + assert(z == 4); + } +} +// ==== +// SMTEngine: bmc +// SMTSolvers: z3 +// BMCLoopIterations: 3 +// ---- +// Info 6002: BMC: 4 verification condition(s) proved safe! Enable the model checker option "show proved safe" to see all of them. + diff --git a/test/libsolidity/smtCheckerTests/loops/while_bmc_iterations_nested_break.sol b/test/libsolidity/smtCheckerTests/loops/while_bmc_iterations_nested_break.sol new file mode 100644 index 000000000000..170c5a3c3c9f --- /dev/null +++ b/test/libsolidity/smtCheckerTests/loops/while_bmc_iterations_nested_break.sol @@ -0,0 +1,23 @@ +contract C { + function f(uint z) public pure { + uint x = 0; + require(z == 0); + while (x < 2) { + uint y = 0; + while (y < 2) { + if (y > 0) + break; + ++z; + ++y; + } + ++x; + } + assert(z == 2); + } +} +// ==== +// SMTEngine: bmc +// SMTSolvers: z3 +// BMCLoopIterations: 3 +// ---- +// Info 6002: BMC: 4 verification condition(s) proved safe! Enable the model checker option "show proved safe" to see all of them. diff --git a/test/libsolidity/smtCheckerTests/loops/while_bmc_iterations_nested_continue.sol b/test/libsolidity/smtCheckerTests/loops/while_bmc_iterations_nested_continue.sol new file mode 100644 index 000000000000..66ad2081b45f --- /dev/null +++ b/test/libsolidity/smtCheckerTests/loops/while_bmc_iterations_nested_continue.sol @@ -0,0 +1,23 @@ +contract C { + function f() public pure { + uint x; + uint i; + while (i < 3) { + ++i; + uint j; + while (j < 3) { + ++j; + if (i > 1) + continue; + ++x; + } + } + assert(x == 3); + } +} +// ==== +// SMTEngine: bmc +// SMTSolvers: z3 +// BMCLoopIterations: 4 +// ---- +// Info 6002: BMC: 4 verification condition(s) proved safe! Enable the model checker option "show proved safe" to see all of them. diff --git a/test/libsolidity/smtCheckerTests/loops/while_bmc_iterations_semantics_1.sol b/test/libsolidity/smtCheckerTests/loops/while_bmc_iterations_semantics_1.sol new file mode 100644 index 000000000000..eb497be7cb81 --- /dev/null +++ b/test/libsolidity/smtCheckerTests/loops/while_bmc_iterations_semantics_1.sol @@ -0,0 +1,20 @@ +contract C { + function f() public pure { + uint x = 0; + int y = 0; + while (x < 3 || y == 1) { + if (x >= 3) + y = 1; + ++x; + } + // BMC loop iteration setting is not enough to leave the loop + assert(x == 3); + assert(y == 1); + } +} +// ==== +// SMTEngine: bmc +// SMTSolvers: z3 +// BMCLoopIterations: 3 +// ---- +// Info 6002: BMC: 3 verification condition(s) proved safe! Enable the model checker option "show proved safe" to see all of them. diff --git a/test/libsolidity/smtCheckerTests/loops/while_bmc_iterations_semantics_2.sol b/test/libsolidity/smtCheckerTests/loops/while_bmc_iterations_semantics_2.sol new file mode 100644 index 000000000000..90682c7f77ec --- /dev/null +++ b/test/libsolidity/smtCheckerTests/loops/while_bmc_iterations_semantics_2.sol @@ -0,0 +1,21 @@ +contract C { + function f() public pure { + uint x = 0; + int y = 0; + while (x < 3 || y == 1) { + if (x >= 3) + y = 1; + ++x; + } + // BMC loop iteration setting is just enough to leave the loop + assert(x == 3); // should hold + assert(y == 1); // should fail + } +} +// ==== +// SMTEngine: bmc +// SMTSolvers: z3 +// BMCLoopIterations: 4 +// ---- +// Warning 4661: (240-254): BMC: Assertion violation happens here. +// Info 6002: BMC: 2 verification condition(s) proved safe! Enable the model checker option "show proved safe" to see all of them. diff --git a/test/libsolidity/smtCheckerTests/loops/while_bmc_iterations_semantics_3.sol b/test/libsolidity/smtCheckerTests/loops/while_bmc_iterations_semantics_3.sol new file mode 100644 index 000000000000..992ac7f802f8 --- /dev/null +++ b/test/libsolidity/smtCheckerTests/loops/while_bmc_iterations_semantics_3.sol @@ -0,0 +1,20 @@ +contract C { + function f() public pure { + uint x = 0; + int y = 0; + while (x < 3 || y == 1) { + if (x >= 3) + y = 1; + ++x; + } + // BMC loop iteration setting is more than enough to leave the loop + assert(x == 3); // should hold + assert(y == 0); // should hold + } +} +// ==== +// SMTEngine: bmc +// SMTSolvers: z3 +// BMCLoopIterations: 5 +// ---- +// Info 6002: BMC: 3 verification condition(s) proved safe! Enable the model checker option "show proved safe" to see all of them. diff --git a/test/libsolidity/smtCheckerTests/loops/while_bmc_iterations_shallow_unroll.sol b/test/libsolidity/smtCheckerTests/loops/while_bmc_iterations_shallow_unroll.sol new file mode 100644 index 000000000000..3134e35c47b2 --- /dev/null +++ b/test/libsolidity/smtCheckerTests/loops/while_bmc_iterations_shallow_unroll.sol @@ -0,0 +1,17 @@ +contract C { + function f() public pure { + uint x = 0; + while (x < 5) { + x = x + 1; + } + // nothing is reported because loop condition is true after unrolling the loop one time + assert(x == 5); + assert(x == 3); + } +} +// ==== +// SMTEngine: bmc +// SMTSolvers: z3 +// BMCLoopIterations: 1 +// ---- +// Info 6002: BMC: 3 verification condition(s) proved safe! Enable the model checker option "show proved safe" to see all of them. diff --git a/test/libsolidity/smtCheckerTests/loops/while_break_direct.sol b/test/libsolidity/smtCheckerTests/loops/while_break_direct.sol index 783a2f268936..4a6245b0fdec 100644 --- a/test/libsolidity/smtCheckerTests/loops/while_break_direct.sol +++ b/test/libsolidity/smtCheckerTests/loops/while_break_direct.sol @@ -1,5 +1,4 @@ -contract C -{ +contract C { function f(uint x) public pure { x = 0; while (x < 10) @@ -12,4 +11,3 @@ contract C // SMTSolvers: z3 // ---- // Info 1391: CHC: 1 verification condition(s) proved safe! Enable the model checker option "show proved safe" to see all of them. -// Warning 6838: (65-71): BMC: Condition is always true. diff --git a/test/libsolidity/smtCheckerTests/operators/assignment_contract_member_variable_array_2.sol b/test/libsolidity/smtCheckerTests/operators/assignment_contract_member_variable_array_2.sol index 694d110e195e..15bb168a72a0 100644 --- a/test/libsolidity/smtCheckerTests/operators/assignment_contract_member_variable_array_2.sol +++ b/test/libsolidity/smtCheckerTests/operators/assignment_contract_member_variable_array_2.sol @@ -5,7 +5,6 @@ contract A { A.a[0] = 2; } } - // ==== // SMTEngine: all // ---- diff --git a/test/libsolidity/smtCheckerTests/out_of_bounds/array_2d_4.sol b/test/libsolidity/smtCheckerTests/out_of_bounds/array_2d_4.sol index 2a9f39d1a2fa..ee7ab8bcc739 100644 --- a/test/libsolidity/smtCheckerTests/out_of_bounds/array_2d_4.sol +++ b/test/libsolidity/smtCheckerTests/out_of_bounds/array_2d_4.sol @@ -24,4 +24,4 @@ contract C { // Info 1391: CHC: 1 verification condition(s) proved safe! Enable the model checker option "show proved safe" to see all of them. // Warning 2661: (184-197): BMC: Overflow (resulting value larger than 2**256 - 1) happens here. // Warning 2661: (228-244): BMC: Overflow (resulting value larger than 2**256 - 1) happens here. -// Info 6002: BMC: 4 verification condition(s) proved safe! Enable the model checker option "show proved safe" to see all of them. +// Info 6002: BMC: 2 verification condition(s) proved safe! Enable the model checker option "show proved safe" to see all of them. diff --git a/test/libsolidity/smtCheckerTests/special/msg_parens_1.sol b/test/libsolidity/smtCheckerTests/special/msg_parens_1.sol index 6eb19e5e8030..6368eb2ddd12 100644 --- a/test/libsolidity/smtCheckerTests/special/msg_parens_1.sol +++ b/test/libsolidity/smtCheckerTests/special/msg_parens_1.sol @@ -9,5 +9,5 @@ contract C { // SMTIgnoreOS: macos // SMTIgnoreCex: yes // ---- -// Warning 6328: (46-71): CHC: Assertion violation happens here. -// Warning 6328: (75-113): CHC: Assertion violation happens here. +// TypeError 9717: (90-93): Invalid mobile type in true expression. +// TypeError 3703: (96-99): Invalid mobile type in false expression. diff --git a/test/libsolidity/smtCheckerTests/special/msg_value_inheritance_3.sol b/test/libsolidity/smtCheckerTests/special/msg_value_inheritance_3.sol index b2f083e025e4..fc8d6e08f300 100644 --- a/test/libsolidity/smtCheckerTests/special/msg_value_inheritance_3.sol +++ b/test/libsolidity/smtCheckerTests/special/msg_value_inheritance_3.sol @@ -15,7 +15,6 @@ contract C is A, B { assert(msg.value >= 0); // should hold } } - // ==== // SMTEngine: all // ---- diff --git a/test/libsolidity/smtCheckerTests/special/range_check.sol b/test/libsolidity/smtCheckerTests/special/range_check.sol index 210aed4daea4..8880a68a7a0f 100644 --- a/test/libsolidity/smtCheckerTests/special/range_check.sol +++ b/test/libsolidity/smtCheckerTests/special/range_check.sol @@ -55,7 +55,6 @@ contract D { } } } - // ==== // SMTEngine: all // ---- diff --git a/test/libsolidity/smtCheckerTests/try_catch/try_inside_if.sol b/test/libsolidity/smtCheckerTests/try_catch/try_inside_if.sol index 4c82cebd99fb..4a65bd9a3003 100644 --- a/test/libsolidity/smtCheckerTests/try_catch/try_inside_if.sol +++ b/test/libsolidity/smtCheckerTests/try_catch/try_inside_if.sol @@ -8,7 +8,6 @@ contract C { } } } - // ==== // SMTEngine: all // ---- diff --git a/test/libsolidity/smtCheckerTests/try_catch/try_inside_while.sol b/test/libsolidity/smtCheckerTests/try_catch/try_inside_while.sol index 8d54f103f90b..63976d59f9cc 100644 --- a/test/libsolidity/smtCheckerTests/try_catch/try_inside_while.sol +++ b/test/libsolidity/smtCheckerTests/try_catch/try_inside_while.sol @@ -11,4 +11,3 @@ contract C { // SMTEngine: all // ---- // Warning 6321: (43-47): Unnamed return variable can remain unassigned. Add an explicit return with value to all non-reverting code paths or name the variable. -// Warning 6838: (59-63): BMC: Condition is always true. diff --git a/test/libsolidity/smtCheckerTests/types/static_array_implicit_push_3.sol b/test/libsolidity/smtCheckerTests/types/static_array_implicit_push_3.sol index 6b5d727caaef..37ef3158e1e8 100644 --- a/test/libsolidity/smtCheckerTests/types/static_array_implicit_push_3.sol +++ b/test/libsolidity/smtCheckerTests/types/static_array_implicit_push_3.sol @@ -5,7 +5,6 @@ contract D { data.push(inner); } } - // ==== // SMTEngine: all // ---- diff --git a/test/libsolidity/smtCheckerTests/types/static_array_implicit_push_4.sol b/test/libsolidity/smtCheckerTests/types/static_array_implicit_push_4.sol index 7173d57ba45c..f0049b3f3dce 100644 --- a/test/libsolidity/smtCheckerTests/types/static_array_implicit_push_4.sol +++ b/test/libsolidity/smtCheckerTests/types/static_array_implicit_push_4.sol @@ -5,7 +5,6 @@ contract D { data.push(inner); } } - // ==== // SMTEngine: all // ---- diff --git a/test/libsolidity/smtCheckerTests/types/struct/struct_external_function_pointer.sol b/test/libsolidity/smtCheckerTests/types/struct/struct_external_function_pointer.sol new file mode 100644 index 000000000000..494d2dcf2b6f --- /dev/null +++ b/test/libsolidity/smtCheckerTests/types/struct/struct_external_function_pointer.sol @@ -0,0 +1,33 @@ +struct S { + function() external returns (uint) x; +} +contract C { + + function X() public pure returns (uint) { + return 1; + } + + uint y; + uint z; + + function setZ(uint _z) public { + z = _z; + } + + + function f() public returns (uint) { + S memory s; + s.x = this.X; + require(y == 0); + require(z == 0); + uint ret = s.x(); + assert(y == 0); // should hold + assert(z == 0); // can report violation due to overapproximation after externall call s.x() + return ret; + } +} + + +// ---- +// Warning 6328: (431-445): CHC: Assertion violation happens here. +// Info 1391: CHC: 1 verification condition(s) proved safe! Enable the model checker option "show proved safe" to see all of them. diff --git a/test/libsolidity/smtCheckerTests/unchecked/unchecked_double_with_modifier.sol b/test/libsolidity/smtCheckerTests/unchecked/unchecked_double_with_modifier.sol index 55931bfa98b4..5db44309d1d1 100644 --- a/test/libsolidity/smtCheckerTests/unchecked/unchecked_double_with_modifier.sol +++ b/test/libsolidity/smtCheckerTests/unchecked/unchecked_double_with_modifier.sol @@ -11,8 +11,6 @@ contract C { unchecked { t(); } } } - - // ==== // SMTEngine: all // ---- diff --git a/test/libsolidity/syntaxTests/conversion/implicit_conversion_of_super_in_operators.sol b/test/libsolidity/syntaxTests/conversion/implicit_conversion_of_super_in_operators.sol index 40e9075e1fc3..234657a224e1 100644 --- a/test/libsolidity/syntaxTests/conversion/implicit_conversion_of_super_in_operators.sol +++ b/test/libsolidity/syntaxTests/conversion/implicit_conversion_of_super_in_operators.sol @@ -53,4 +53,4 @@ contract C { // TypeError 7366: (480-493): Operator -= not compatible with types type(contract super C) and contract C. // TypeError 4247: (503-508): Expression has to be an lvalue. // TypeError 7366: (503-516): Operator += not compatible with types type(contract super C) and contract C. -// TypeError 1080: (527-546): True expression's type type(contract super C) does not match false expression's type contract C. +// TypeError 9717: (534-539): Invalid mobile type in true expression. diff --git a/test/libsolidity/syntaxTests/errors/error_ternary_operator.sol b/test/libsolidity/syntaxTests/errors/error_ternary_operator.sol new file mode 100644 index 000000000000..c4600a858caf --- /dev/null +++ b/test/libsolidity/syntaxTests/errors/error_ternary_operator.sol @@ -0,0 +1,11 @@ +error MyCustomError(uint, bool); + +contract C { + function f() pure public { + true ? MyCustomError : MyCustomError; + } +} + +// ---- +// TypeError 9717: (93-106): Invalid mobile type in true expression. +// TypeError 3703: (109-122): Invalid mobile type in false expression. diff --git a/test/libsolidity/syntaxTests/errors/error_ternary_operator_different_types.sol b/test/libsolidity/syntaxTests/errors/error_ternary_operator_different_types.sol deleted file mode 100644 index 680ab8058e1a..000000000000 --- a/test/libsolidity/syntaxTests/errors/error_ternary_operator_different_types.sol +++ /dev/null @@ -1,18 +0,0 @@ -error MyCustomError(uint, bool); -error MyCustomError2(uint, bool); -error MyCustomError3(uint, bool, bool); - -contract C { - function f() pure public { - true ? MyCustomError : MyCustomError; - true ? MyCustomError : MyCustomError2; - true ? MyCustomError : MyCustomError3; - true ? MyCustomError : true; - true ? true : MyCustomError; - } -} - -// ---- -// TypeError 1080: (253-290): True expression's type error MyCustomError(uint256,bool) does not match false expression's type error MyCustomError3(uint256,bool,bool). -// TypeError 1080: (300-327): True expression's type error MyCustomError(uint256,bool) does not match false expression's type bool. -// TypeError 1080: (337-364): True expression's type bool does not match false expression's type error MyCustomError(uint256,bool). diff --git a/test/libsolidity/syntaxTests/events/event_selector_access_foreign_contract.sol b/test/libsolidity/syntaxTests/events/event_selector_access_foreign_contract.sol index b878543fc07f..ccc2b199cff9 100644 --- a/test/libsolidity/syntaxTests/events/event_selector_access_foreign_contract.sol +++ b/test/libsolidity/syntaxTests/events/event_selector_access_foreign_contract.sol @@ -8,4 +8,3 @@ contract C { } } // ---- -// TypeError 9582: (110-113): Member "E" not found or not visible after argument-dependent lookup in type(contract D). diff --git a/test/libsolidity/syntaxTests/events/event_selector_access_interface.sol b/test/libsolidity/syntaxTests/events/event_selector_access_interface.sol index 2877fee5659b..2b4cd4e92992 100644 --- a/test/libsolidity/syntaxTests/events/event_selector_access_interface.sol +++ b/test/libsolidity/syntaxTests/events/event_selector_access_interface.sol @@ -8,4 +8,3 @@ contract C { } } // ---- -// TypeError 9582: (111-114): Member "E" not found or not visible after argument-dependent lookup in type(contract I). diff --git a/test/libsolidity/syntaxTests/events/event_selector_syntax.sol b/test/libsolidity/syntaxTests/events/event_selector_syntax.sol index ecbfe9bc51c5..fec21b55f53b 100644 --- a/test/libsolidity/syntaxTests/events/event_selector_syntax.sol +++ b/test/libsolidity/syntaxTests/events/event_selector_syntax.sol @@ -2,19 +2,34 @@ library L { event E(bytes32, bool, bytes indexed); } +interface I { + event E(bytes32, bool, bytes indexed); +} + +contract A { + event E(bytes32, bool, bytes indexed); +} + contract B { event E(bytes32, bool, bytes indexed); } contract C is B { bytes32 public librarySelector = L.E.selector; + bytes32 public interfaceSelector = I.E.selector; + bytes32 public foreignContractSelector = A.E.selector; bytes32 inheritedSelector = E.selector; function f() public { assert(librarySelector == L.E.selector); + assert(interfaceSelector == I.E.selector); + assert(foreignContractSelector == A.E.selector); assert(E.selector == B.E.selector); emit E(E.selector, true, "123"); + emit I.E((B.E.selector), true, "123"); + emit A.E((B.E.selector), true, "123"); emit L.E((B.E.selector), true, "123"); } } +// ---- diff --git a/test/libsolidity/syntaxTests/events/event_ternary_operator.sol b/test/libsolidity/syntaxTests/events/event_ternary_operator.sol new file mode 100644 index 000000000000..0ba773241f4c --- /dev/null +++ b/test/libsolidity/syntaxTests/events/event_ternary_operator.sol @@ -0,0 +1,10 @@ +contract C { + event MyCustomEvent(uint); + function f() pure public { + true ? MyCustomEvent : MyCustomEvent; + } +} + +// ---- +// TypeError 9717: (90-103): Invalid mobile type in true expression. +// TypeError 3703: (106-119): Invalid mobile type in false expression. diff --git a/test/libsolidity/syntaxTests/events/event_ternary_operator_different_types.sol b/test/libsolidity/syntaxTests/events/event_ternary_operator_different_types.sol deleted file mode 100644 index ca2f1e1d6852..000000000000 --- a/test/libsolidity/syntaxTests/events/event_ternary_operator_different_types.sol +++ /dev/null @@ -1,17 +0,0 @@ -contract C { - event MyCustomEvent(uint); - event MyCustomEvent2(uint); - event MyCustomEvent3(uint, bool); - function f() pure public { - true ? MyCustomEvent : MyCustomEvent; - true ? MyCustomEvent : MyCustomEvent2; - true ? MyCustomEvent : MyCustomEvent3; - true ? MyCustomEvent : true; - true ? true : MyCustomEvent; - } -} - -// ---- -// TypeError 1080: (246-283): True expression's type event MyCustomEvent(uint256) does not match false expression's type event MyCustomEvent3(uint256,bool). -// TypeError 1080: (293-320): True expression's type event MyCustomEvent(uint256) does not match false expression's type bool. -// TypeError 1080: (330-357): True expression's type bool does not match false expression's type event MyCustomEvent(uint256). diff --git a/test/libsolidity/syntaxTests/experimental/parsing_stdlib_import_1.sol b/test/libsolidity/syntaxTests/experimental/parsing_stdlib_import_1.sol new file mode 100644 index 000000000000..beec24c1e4d3 --- /dev/null +++ b/test/libsolidity/syntaxTests/experimental/parsing_stdlib_import_1.sol @@ -0,0 +1,8 @@ +pragma experimental solidity; + +import std.stub; +// ==== +// EVMVersion: >=constantinople +// ---- +// Warning 2264: (std.stub:63-92): Experimental features are turned on. Do not use experimental features on live deployments. +// Warning 2264: (0-29): Experimental features are turned on. Do not use experimental features on live deployments. diff --git a/test/libsolidity/syntaxTests/experimental/parsing_stdlib_import_2.sol b/test/libsolidity/syntaxTests/experimental/parsing_stdlib_import_2.sol new file mode 100644 index 000000000000..85d3a4ac7baf --- /dev/null +++ b/test/libsolidity/syntaxTests/experimental/parsing_stdlib_import_2.sol @@ -0,0 +1,8 @@ +pragma experimental solidity; + +import std.stub as stub; +// ==== +// EVMVersion: >=constantinople +// ---- +// Warning 2264: (std.stub:63-92): Experimental features are turned on. Do not use experimental features on live deployments. +// Warning 2264: (0-29): Experimental features are turned on. Do not use experimental features on live deployments. diff --git a/test/libsolidity/syntaxTests/experimental/parsing_stdlib_import_3.sol b/test/libsolidity/syntaxTests/experimental/parsing_stdlib_import_3.sol new file mode 100644 index 000000000000..7e51a73b1017 --- /dev/null +++ b/test/libsolidity/syntaxTests/experimental/parsing_stdlib_import_3.sol @@ -0,0 +1,8 @@ +pragma experimental solidity; + +import { identity } from std.stub; +// ==== +// EVMVersion: >=constantinople +// ---- +// Warning 2264: (std.stub:63-92): Experimental features are turned on. Do not use experimental features on live deployments. +// Warning 2264: (0-29): Experimental features are turned on. Do not use experimental features on live deployments. diff --git a/test/libsolidity/syntaxTests/experimental/parsing_stdlib_import_4.sol b/test/libsolidity/syntaxTests/experimental/parsing_stdlib_import_4.sol new file mode 100644 index 000000000000..3c4ff41d6c73 --- /dev/null +++ b/test/libsolidity/syntaxTests/experimental/parsing_stdlib_import_4.sol @@ -0,0 +1,8 @@ +pragma experimental solidity; + +import * as stub from std.stub; +// ==== +// EVMVersion: >=constantinople +// ---- +// Warning 2264: (std.stub:63-92): Experimental features are turned on. Do not use experimental features on live deployments. +// Warning 2264: (0-29): Experimental features are turned on. Do not use experimental features on live deployments. diff --git a/test/libsolidity/syntaxTests/experimental/parsing_stdlib_import_without_pragma_1.sol b/test/libsolidity/syntaxTests/experimental/parsing_stdlib_import_without_pragma_1.sol new file mode 100644 index 000000000000..0106846f98e2 --- /dev/null +++ b/test/libsolidity/syntaxTests/experimental/parsing_stdlib_import_without_pragma_1.sol @@ -0,0 +1,3 @@ +import std.stub; +// ---- +// ParserError 9478: (7-10): Expected string literal (path), "*" or alias list. diff --git a/test/libsolidity/syntaxTests/experimental/parsing_stdlib_import_without_pragma_2.sol b/test/libsolidity/syntaxTests/experimental/parsing_stdlib_import_without_pragma_2.sol new file mode 100644 index 000000000000..3a6c1848bab9 --- /dev/null +++ b/test/libsolidity/syntaxTests/experimental/parsing_stdlib_import_without_pragma_2.sol @@ -0,0 +1,3 @@ +import { identity } from std.stub; +// ---- +// ParserError 6845: (25-28): Expected import path. diff --git a/test/libsolidity/syntaxTests/functionTypes/declaration_type_conversion.sol b/test/libsolidity/syntaxTests/functionTypes/declaration_type_conversion.sol new file mode 100644 index 000000000000..c31c49aea99b --- /dev/null +++ b/test/libsolidity/syntaxTests/functionTypes/declaration_type_conversion.sol @@ -0,0 +1,12 @@ +contract D { + function f() external {} + function g() external {} +} +contract C { + function f(bool c) public pure { + (c ? D.f : D.g); + } +} +// ---- +// TypeError 9717: (121-124): Invalid mobile type in true expression. +// TypeError 3703: (127-130): Invalid mobile type in false expression. diff --git a/test/libsolidity/syntaxTests/functionTypes/declaration_type_conversion_internal_base.sol b/test/libsolidity/syntaxTests/functionTypes/declaration_type_conversion_internal_base.sol new file mode 100644 index 000000000000..210211b287f0 --- /dev/null +++ b/test/libsolidity/syntaxTests/functionTypes/declaration_type_conversion_internal_base.sol @@ -0,0 +1,11 @@ +contract C { + function f() internal {} + function g() internal {} +} + +contract D is C { + function h(bool b) public pure { + (b ? C.f : C.g); + } +} +// ---- diff --git a/test/libsolidity/syntaxTests/functionTypes/from_ternary_expression.sol b/test/libsolidity/syntaxTests/functionTypes/from_ternary_expression.sol new file mode 100644 index 000000000000..62ad8aa93d6c --- /dev/null +++ b/test/libsolidity/syntaxTests/functionTypes/from_ternary_expression.sol @@ -0,0 +1,8 @@ +contract C { + function f() public pure returns (uint x) { + x = (true ? addmod : addmod)(3, 4, 5); + } +} +// ---- +// TypeError 9717: (81-87): Invalid mobile type in true expression. +// TypeError 3703: (90-96): Invalid mobile type in false expression. diff --git a/test/libsolidity/syntaxTests/functionTypes/selector_ternary_contract_external_function.sol b/test/libsolidity/syntaxTests/functionTypes/selector_ternary_contract_external_function.sol new file mode 100644 index 000000000000..847caad06f34 --- /dev/null +++ b/test/libsolidity/syntaxTests/functionTypes/selector_ternary_contract_external_function.sol @@ -0,0 +1,10 @@ +contract C { + function f() external pure { } + function g() external pure { } + function test(bool b) public returns(bytes4) { + (b ? C.f : C.g).selector; + } +} +// ---- +// TypeError 9717: (147-150): Invalid mobile type in true expression. +// TypeError 3703: (153-156): Invalid mobile type in false expression. diff --git a/test/libsolidity/syntaxTests/functionTypes/selector_ternary_different_contract_public_function.sol b/test/libsolidity/syntaxTests/functionTypes/selector_ternary_different_contract_public_function.sol new file mode 100644 index 000000000000..5f5edfa9fcc6 --- /dev/null +++ b/test/libsolidity/syntaxTests/functionTypes/selector_ternary_different_contract_public_function.sol @@ -0,0 +1,13 @@ +contract C { + function f() public pure { } + function g() public pure { } +} + +contract A { + function test(bool b) public returns(bytes4) { + (b ? C.f : C.g).selector; + } +} +// ---- +// TypeError 9717: (159-162): Invalid mobile type in true expression. +// TypeError 3703: (165-168): Invalid mobile type in false expression. diff --git a/test/libsolidity/syntaxTests/functionTypes/selector_ternary_different_contracts_external_function.sol b/test/libsolidity/syntaxTests/functionTypes/selector_ternary_different_contracts_external_function.sol new file mode 100644 index 000000000000..e015f4315021 --- /dev/null +++ b/test/libsolidity/syntaxTests/functionTypes/selector_ternary_different_contracts_external_function.sol @@ -0,0 +1,16 @@ +contract C { + function f() external pure { } +} + +contract D { + function g() external pure { } +} + +contract A { + function test(bool b) public returns(bytes4) { + (b ? C.f : D.g).selector; + } +} +// ---- +// TypeError 9717: (179-182): Invalid mobile type in true expression. +// TypeError 3703: (185-188): Invalid mobile type in false expression. diff --git a/test/libsolidity/syntaxTests/functionTypes/selector_ternary_different_interface_external_function.sol b/test/libsolidity/syntaxTests/functionTypes/selector_ternary_different_interface_external_function.sol new file mode 100644 index 000000000000..4109a14ced16 --- /dev/null +++ b/test/libsolidity/syntaxTests/functionTypes/selector_ternary_different_interface_external_function.sol @@ -0,0 +1,16 @@ +interface I1 { + function f() external pure; +} + +interface I2 { + function g() external pure; +} + +contract C { + function test(bool b) public returns(bytes4) { + (b ? I1.f : I2.g).selector; + } +} +// ---- +// TypeError 9717: (177-181): Invalid mobile type in true expression. +// TypeError 3703: (184-188): Invalid mobile type in false expression. diff --git a/test/libsolidity/syntaxTests/functionTypes/ternary_contract_delegate_function.sol b/test/libsolidity/syntaxTests/functionTypes/ternary_contract_delegate_function.sol new file mode 100644 index 000000000000..810f5eb21075 --- /dev/null +++ b/test/libsolidity/syntaxTests/functionTypes/ternary_contract_delegate_function.sol @@ -0,0 +1,12 @@ +library L { + function f() external {} +} + +contract C { + function test() public { + (true ? L.f : L.f).selector; + } +} + +// ---- +// TypeError 9582: (94-121): Member "selector" not found or not visible after argument-dependent lookup in function (). diff --git a/test/libsolidity/syntaxTests/immutable/conditional_return_uninitialized.sol b/test/libsolidity/syntaxTests/immutable/conditional_return_uninitialized.sol index 77e73c51f5c2..d2c473fbb945 100644 --- a/test/libsolidity/syntaxTests/immutable/conditional_return_uninitialized.sol +++ b/test/libsolidity/syntaxTests/immutable/conditional_return_uninitialized.sol @@ -7,5 +7,3 @@ contract C { x = 1; } } -// ---- -// TypeError 2658: (86-93): Construction control flow ends without initializing all immutable state variables. diff --git a/test/libsolidity/syntaxTests/immutable/conditionally_initialized.sol b/test/libsolidity/syntaxTests/immutable/conditionally_initialized.sol index 052a1b59746a..312a76083a88 100644 --- a/test/libsolidity/syntaxTests/immutable/conditionally_initialized.sol +++ b/test/libsolidity/syntaxTests/immutable/conditionally_initialized.sol @@ -5,5 +5,3 @@ contract C { x = 1; } } -// ---- -// TypeError 4599: (86-87): Cannot write to immutable here: Immutable variables cannot be initialized inside an if statement. diff --git a/test/libsolidity/syntaxTests/immutable/ctor_initialization_indirect_reading.sol b/test/libsolidity/syntaxTests/immutable/ctor_initialization_indirect_reading.sol index 0ee583b56200..b23d161c174b 100644 --- a/test/libsolidity/syntaxTests/immutable/ctor_initialization_indirect_reading.sol +++ b/test/libsolidity/syntaxTests/immutable/ctor_initialization_indirect_reading.sol @@ -4,7 +4,5 @@ contract C { x = f(); } - function f() public pure returns (uint) { return 3 + x; } + function f() public view returns (uint) { return 3 + x; } } -// ---- -// TypeError 7733: (136-137): Immutable variables cannot be read before they are initialized. diff --git a/test/libsolidity/syntaxTests/immutable/ctor_initialization_reading.sol b/test/libsolidity/syntaxTests/immutable/ctor_initialization_reading.sol index 38ff92945f14..5df8d162f6c2 100644 --- a/test/libsolidity/syntaxTests/immutable/ctor_initialization_reading.sol +++ b/test/libsolidity/syntaxTests/immutable/ctor_initialization_reading.sol @@ -4,5 +4,3 @@ contract C { x = 3 + x; } } -// ---- -// TypeError 7733: (71-72): Immutable variables cannot be read before they are initialized. diff --git a/test/libsolidity/syntaxTests/immutable/ctor_modifier_args.sol b/test/libsolidity/syntaxTests/immutable/ctor_modifier_args.sol index 0a966f7c37b3..09c3aefa704c 100644 --- a/test/libsolidity/syntaxTests/immutable/ctor_modifier_args.sol +++ b/test/libsolidity/syntaxTests/immutable/ctor_modifier_args.sol @@ -9,4 +9,3 @@ contract C { function f(uint a) internal pure {} } // ---- -// TypeError 1581: (59-60): Cannot write to immutable here: Immutable variables can only be initialized inline or assigned directly in the constructor. diff --git a/test/libsolidity/syntaxTests/immutable/ctor_modifier_reading.sol b/test/libsolidity/syntaxTests/immutable/ctor_modifier_reading.sol index 5e3442e55eea..113cda75fc20 100644 --- a/test/libsolidity/syntaxTests/immutable/ctor_modifier_reading.sol +++ b/test/libsolidity/syntaxTests/immutable/ctor_modifier_reading.sol @@ -10,5 +10,3 @@ contract C { function f(uint a) internal pure {} } -// ---- -// TypeError 7733: (119-120): Immutable variables cannot be read before they are initialized. diff --git a/test/libsolidity/syntaxTests/immutable/decrement.sol b/test/libsolidity/syntaxTests/immutable/decrement.sol index dd081438a3a2..4931b5f9f9e6 100644 --- a/test/libsolidity/syntaxTests/immutable/decrement.sol +++ b/test/libsolidity/syntaxTests/immutable/decrement.sol @@ -4,5 +4,3 @@ contract C { x--; } } -// ---- -// TypeError 3969: (63-64): Immutable variables must be initialized using an assignment. diff --git a/test/libsolidity/syntaxTests/immutable/delete.sol b/test/libsolidity/syntaxTests/immutable/delete.sol deleted file mode 100644 index bbb418c17f77..000000000000 --- a/test/libsolidity/syntaxTests/immutable/delete.sol +++ /dev/null @@ -1,8 +0,0 @@ -contract C { - uint immutable x; - constructor() { - delete x; - } -} -// ---- -// TypeError 3969: (70-71): Immutable variables must be initialized using an assignment. diff --git a/test/libsolidity/syntaxTests/immutable/delete_and_initialize.sol b/test/libsolidity/syntaxTests/immutable/delete_and_initialize.sol deleted file mode 100644 index 1e55d90ce885..000000000000 --- a/test/libsolidity/syntaxTests/immutable/delete_and_initialize.sol +++ /dev/null @@ -1,8 +0,0 @@ -contract C { - uint immutable x = 3; - constructor() { - delete x; - } -} -// ---- -// TypeError 2718: (74-75): Immutable variables cannot be modified after initialization. diff --git a/test/libsolidity/syntaxTests/immutable/function_initialization_reading.sol b/test/libsolidity/syntaxTests/immutable/function_initialization_reading.sol index 7933f8e7f9c2..e276ba7835e0 100644 --- a/test/libsolidity/syntaxTests/immutable/function_initialization_reading.sol +++ b/test/libsolidity/syntaxTests/immutable/function_initialization_reading.sol @@ -1,7 +1,5 @@ contract C { uint immutable x = f(); - function f() public pure returns (uint) { return 3 + x; } + function f() public view returns (uint) { return 3 + x; } } -// ---- -// TypeError 7733: (99-100): Immutable variables cannot be read before they are initialized. diff --git a/test/libsolidity/syntaxTests/immutable/function_pointer_initializing.sol b/test/libsolidity/syntaxTests/immutable/function_pointer_initializing.sol index 0d9dabf90ac3..cc175d0831d5 100644 --- a/test/libsolidity/syntaxTests/immutable/function_pointer_initializing.sol +++ b/test/libsolidity/syntaxTests/immutable/function_pointer_initializing.sol @@ -11,4 +11,3 @@ contract C is B(C.f) { } // ---- // TypeError 1581: (200-201): Cannot write to immutable here: Immutable variables can only be initialized inline or assigned directly in the constructor. -// TypeError 1574: (109-110): Immutable state variable already initialized. diff --git a/test/libsolidity/syntaxTests/immutable/function_pointer_reading.sol b/test/libsolidity/syntaxTests/immutable/function_pointer_reading.sol index e94fd155ccd9..2658d35d2324 100644 --- a/test/libsolidity/syntaxTests/immutable/function_pointer_reading.sol +++ b/test/libsolidity/syntaxTests/immutable/function_pointer_reading.sol @@ -7,7 +7,6 @@ abstract contract B { } contract C is B(C.f) { - function f() internal returns(uint) { return x + 2; } + function f() internal view returns(uint) { return x + 2; } } // ---- -// TypeError 7733: (200-201): Immutable variables cannot be read before they are initialized. diff --git a/test/libsolidity/syntaxTests/immutable/increment.sol b/test/libsolidity/syntaxTests/immutable/increment.sol index 020620159c84..62506d88ff73 100644 --- a/test/libsolidity/syntaxTests/immutable/increment.sol +++ b/test/libsolidity/syntaxTests/immutable/increment.sol @@ -4,5 +4,3 @@ contract C { x++; } } -// ---- -// TypeError 3969: (63-64): Immutable variables must be initialized using an assignment. diff --git a/test/libsolidity/syntaxTests/immutable/increment_decrement.sol b/test/libsolidity/syntaxTests/immutable/increment_decrement.sol deleted file mode 100644 index 7b8092e1e32f..000000000000 --- a/test/libsolidity/syntaxTests/immutable/increment_decrement.sol +++ /dev/null @@ -1,11 +0,0 @@ -contract C { - uint immutable x; - uint immutable y; - constructor() { - ++x; - --y; - } -} -// ---- -// TypeError 3969: (77-78): Immutable variables must be initialized using an assignment. -// TypeError 3969: (86-87): Immutable variables must be initialized using an assignment. diff --git a/test/libsolidity/syntaxTests/immutable/indirect_reading_during_statevar_init.sol b/test/libsolidity/syntaxTests/immutable/indirect_reading_during_statevar_init.sol index eaa2186f10ea..985e5d0b395e 100644 --- a/test/libsolidity/syntaxTests/immutable/indirect_reading_during_statevar_init.sol +++ b/test/libsolidity/syntaxTests/immutable/indirect_reading_during_statevar_init.sol @@ -2,7 +2,6 @@ contract C { uint immutable x = 0; uint y = f(); - function f() internal returns(uint) { return x; } + function f() internal pure returns(uint) { return x; } } // ---- -// TypeError 7733: (107-108): Immutable variables cannot be read before they are initialized. diff --git a/test/libsolidity/syntaxTests/immutable/inheritance_ctor_argument.sol b/test/libsolidity/syntaxTests/immutable/inheritance_ctor_argument.sol index bc084400e60b..025f5616129c 100644 --- a/test/libsolidity/syntaxTests/immutable/inheritance_ctor_argument.sol +++ b/test/libsolidity/syntaxTests/immutable/inheritance_ctor_argument.sol @@ -10,5 +10,3 @@ contract C is B { uint immutable y; constructor() B(y = 3) { } } -// ---- -// TypeError 1581: (148-149): Cannot write to immutable here: Immutable variables can only be initialized inline or assigned directly in the constructor. diff --git a/test/libsolidity/syntaxTests/immutable/inheritance_ctor_inherit_specifier_argument_init.sol b/test/libsolidity/syntaxTests/immutable/inheritance_ctor_inherit_specifier_argument_init.sol index 503f182d6cd2..f1787ab428a2 100644 --- a/test/libsolidity/syntaxTests/immutable/inheritance_ctor_inherit_specifier_argument_init.sol +++ b/test/libsolidity/syntaxTests/immutable/inheritance_ctor_inherit_specifier_argument_init.sol @@ -9,5 +9,3 @@ contract B { contract C is B(C.y = 3) { uint immutable y; } -// ---- -// TypeError 1581: (104-107): Cannot write to immutable here: Immutable variables can only be initialized inline or assigned directly in the constructor. diff --git a/test/libsolidity/syntaxTests/immutable/inheritance_ctor_inherit_specifier_argument_reading.sol b/test/libsolidity/syntaxTests/immutable/inheritance_ctor_inherit_specifier_argument_reading.sol index 2c670df6c5aa..0ac37261feef 100644 --- a/test/libsolidity/syntaxTests/immutable/inheritance_ctor_inherit_specifier_argument_reading.sol +++ b/test/libsolidity/syntaxTests/immutable/inheritance_ctor_inherit_specifier_argument_reading.sol @@ -12,5 +12,3 @@ contract C is B(C.y) { y = 3; } } -// ---- -// TypeError 7733: (104-107): Immutable variables cannot be read before they are initialized. diff --git a/test/libsolidity/syntaxTests/immutable/inheritance_virtual_functions.sol b/test/libsolidity/syntaxTests/immutable/inheritance_virtual_functions.sol index dc11b8a61c5c..addd3249c8e0 100644 --- a/test/libsolidity/syntaxTests/immutable/inheritance_virtual_functions.sol +++ b/test/libsolidity/syntaxTests/immutable/inheritance_virtual_functions.sol @@ -5,15 +5,14 @@ contract B { x = xInit(); } - function xInit() internal virtual returns(uint) { + function xInit() internal view virtual returns(uint) { return 3; } } contract C is B { - function xInit() internal override returns(uint) { + function xInit() internal view override returns(uint) { return x; } } // ---- -// TypeError 7733: (253-254): Immutable variables cannot be read before they are initialized. diff --git a/test/libsolidity/syntaxTests/immutable/inheritance_virtual_modifiers.sol b/test/libsolidity/syntaxTests/immutable/inheritance_virtual_modifiers.sol index 95ea3e686b09..31f510dccca5 100644 --- a/test/libsolidity/syntaxTests/immutable/inheritance_virtual_modifiers.sol +++ b/test/libsolidity/syntaxTests/immutable/inheritance_virtual_modifiers.sol @@ -17,5 +17,3 @@ contract C is B { _; f(x); } } -// ---- -// TypeError 7733: (245-246): Immutable variables cannot be read before they are initialized. diff --git a/test/libsolidity/syntaxTests/immutable/inheritance_wrong_ctor.sol b/test/libsolidity/syntaxTests/immutable/inheritance_wrong_ctor.sol index 748d9da55bc2..d7586c433d39 100644 --- a/test/libsolidity/syntaxTests/immutable/inheritance_wrong_ctor.sol +++ b/test/libsolidity/syntaxTests/immutable/inheritance_wrong_ctor.sol @@ -7,5 +7,3 @@ contract C is B { x = 3; } } -// ---- -// TypeError 7484: (88-89): Cannot write to immutable here: Immutable variables must be initialized in the constructor of the contract they are defined in. diff --git a/test/libsolidity/syntaxTests/immutable/init_in_constructor_modifier_param.sol b/test/libsolidity/syntaxTests/immutable/init_in_constructor_modifier_param.sol new file mode 100644 index 000000000000..f638ae7bf952 --- /dev/null +++ b/test/libsolidity/syntaxTests/immutable/init_in_constructor_modifier_param.sol @@ -0,0 +1,6 @@ +contract D { + uint immutable t; + modifier m(uint) { _; } + constructor() m(t = 2) {} +} +// ---- diff --git a/test/libsolidity/syntaxTests/immutable/init_in_ctor_param.sol b/test/libsolidity/syntaxTests/immutable/init_in_ctor_param.sol index b67d149b2aac..63c6057d3e69 100644 --- a/test/libsolidity/syntaxTests/immutable/init_in_ctor_param.sol +++ b/test/libsolidity/syntaxTests/immutable/init_in_ctor_param.sol @@ -3,5 +3,3 @@ contract D is C { uint immutable t; constructor() C(t=2) {} } -// ---- -// TypeError 1581: (92-93): Cannot write to immutable here: Immutable variables can only be initialized inline or assigned directly in the constructor. diff --git a/test/libsolidity/syntaxTests/immutable/init_in_function_modifier_param.sol b/test/libsolidity/syntaxTests/immutable/init_in_function_modifier_param.sol new file mode 100644 index 000000000000..b42943959179 --- /dev/null +++ b/test/libsolidity/syntaxTests/immutable/init_in_function_modifier_param.sol @@ -0,0 +1,7 @@ +contract D { + uint immutable t; + modifier m(uint) { _; } + function f() public m(t = 2) {} +} +// ---- +// TypeError 1581: (89-90): Cannot write to immutable here: Immutable variables can only be initialized inline or assigned directly in the constructor. diff --git a/test/libsolidity/syntaxTests/immutable/init_in_function_via_contract_name.sol b/test/libsolidity/syntaxTests/immutable/init_in_function_via_contract_name.sol new file mode 100644 index 000000000000..01163f2fe215 --- /dev/null +++ b/test/libsolidity/syntaxTests/immutable/init_in_function_via_contract_name.sol @@ -0,0 +1,11 @@ +contract B { + uint immutable x; +} + +contract C is B { + function f() public { + B.x = 42; + } +} +// ---- +// TypeError 1581: (90-93): Cannot write to immutable here: Immutable variables can only be initialized inline or assigned directly in the constructor. diff --git a/test/libsolidity/syntaxTests/immutable/init_in_function_via_super.sol b/test/libsolidity/syntaxTests/immutable/init_in_function_via_super.sol new file mode 100644 index 000000000000..941b5e5167b2 --- /dev/null +++ b/test/libsolidity/syntaxTests/immutable/init_in_function_via_super.sol @@ -0,0 +1,13 @@ +contract B { + uint immutable x; + + function g() public {} +} + +contract C is B { + function f() public { + super.x = 42; + } +} +// ---- +// TypeError 9582: (118-125): Member "x" not found or not visible after argument-dependent lookup in type(contract super C). diff --git a/test/libsolidity/syntaxTests/immutable/init_in_inheritance_specifier_param.sol b/test/libsolidity/syntaxTests/immutable/init_in_inheritance_specifier_param.sol index 63662e1b7abc..f80c238e6391 100644 --- a/test/libsolidity/syntaxTests/immutable/init_in_inheritance_specifier_param.sol +++ b/test/libsolidity/syntaxTests/immutable/init_in_inheritance_specifier_param.sol @@ -1,6 +1,4 @@ contract C { constructor(uint) {} } contract D is C(D.t = 2) { - uint immutable t; + uint immutable t; } -// ---- -// TypeError 1581: (52-55): Cannot write to immutable here: Immutable variables can only be initialized inline or assigned directly in the constructor. diff --git a/test/libsolidity/syntaxTests/immutable/init_in_modifier_param.sol b/test/libsolidity/syntaxTests/immutable/init_in_modifier_param.sol deleted file mode 100644 index 3e354b4e92c4..000000000000 --- a/test/libsolidity/syntaxTests/immutable/init_in_modifier_param.sol +++ /dev/null @@ -1,7 +0,0 @@ -contract D { - uint immutable t; - modifier m(uint) { _; } - constructor() m(t=2) {} -} -// ---- -// TypeError 1581: (77-78): Cannot write to immutable here: Immutable variables can only be initialized inline or assigned directly in the constructor. diff --git a/test/libsolidity/syntaxTests/immutable/loop_initialized.sol b/test/libsolidity/syntaxTests/immutable/loop_initialized.sol index d8c8ca47fe5e..1cbe9add1a6c 100644 --- a/test/libsolidity/syntaxTests/immutable/loop_initialized.sol +++ b/test/libsolidity/syntaxTests/immutable/loop_initialized.sol @@ -5,5 +5,3 @@ contract C { x = 1; } } -// ---- -// TypeError 6672: (88-89): Cannot write to immutable here: Immutable variables cannot be initialized inside a loop. diff --git a/test/libsolidity/syntaxTests/immutable/multiple_inheritance_virtual_functions.sol b/test/libsolidity/syntaxTests/immutable/multiple_inheritance_virtual_functions.sol index 33749c8cdc3d..a87ec76805a3 100644 --- a/test/libsolidity/syntaxTests/immutable/multiple_inheritance_virtual_functions.sol +++ b/test/libsolidity/syntaxTests/immutable/multiple_inheritance_virtual_functions.sol @@ -13,7 +13,7 @@ contract B { return f(); } - function f() internal virtual returns(uint) { return 3; } + function f() internal view virtual returns(uint) { return 3; } } contract C is A, B { @@ -21,9 +21,8 @@ contract C is A, B { return B.xInit(); } - function f() internal override(A, B) returns(uint) { + function f() internal view override(A, B) returns(uint) { return x; } } // ---- -// TypeError 7733: (489-490): Immutable variables cannot be read before they are initialized. diff --git a/test/libsolidity/syntaxTests/immutable/multiple_inheritance_virtual_functions_with_super.sol b/test/libsolidity/syntaxTests/immutable/multiple_inheritance_virtual_functions_with_super.sol index 11da864db234..8b8c5dd2818d 100644 --- a/test/libsolidity/syntaxTests/immutable/multiple_inheritance_virtual_functions_with_super.sol +++ b/test/libsolidity/syntaxTests/immutable/multiple_inheritance_virtual_functions_with_super.sol @@ -13,7 +13,7 @@ contract B { return f(); } - function f() internal virtual returns(uint) { return 3; } + function f() internal view virtual returns(uint) { return 3; } } contract C is A, B { @@ -21,9 +21,8 @@ contract C is A, B { return super.xInit(); } - function f() internal override(A, B) returns(uint) { + function f() internal view override(A, B) returns(uint) { return x; } } // ---- -// TypeError 7733: (493-494): Immutable variables cannot be read before they are initialized. diff --git a/test/libsolidity/syntaxTests/immutable/multiple_initializations.sol b/test/libsolidity/syntaxTests/immutable/multiple_initializations.sol index 93e01db3017c..8fe5ddcfc0ea 100644 --- a/test/libsolidity/syntaxTests/immutable/multiple_initializations.sol +++ b/test/libsolidity/syntaxTests/immutable/multiple_initializations.sol @@ -5,5 +5,3 @@ contract C { x = 4; } } -// ---- -// TypeError 1574: (78-79): Immutable state variable already initialized. diff --git a/test/libsolidity/syntaxTests/immutable/private_state_var.sol b/test/libsolidity/syntaxTests/immutable/private_state_var.sol index 50af6ace8d0d..cce1ca0f5fb3 100644 --- a/test/libsolidity/syntaxTests/immutable/private_state_var.sol +++ b/test/libsolidity/syntaxTests/immutable/private_state_var.sol @@ -16,5 +16,3 @@ contract C is B { function f() internal view override returns(uint) { return readX(); } } -// ---- -// TypeError 7733: (202-203): Immutable variables cannot be read before they are initialized. diff --git a/test/libsolidity/syntaxTests/immutable/read_in_function_before_init.sol b/test/libsolidity/syntaxTests/immutable/read_in_function_before_init.sol index 3ca0df2700f3..b4f56a269d07 100644 --- a/test/libsolidity/syntaxTests/immutable/read_in_function_before_init.sol +++ b/test/libsolidity/syntaxTests/immutable/read_in_function_before_init.sol @@ -2,11 +2,9 @@ abstract contract A { uint public t; constructor() { t = f(); } - function f() virtual view internal returns (uint); + function f() virtual pure internal returns (uint); } contract B is A { uint immutable x = 2; - function f() override view internal returns (uint) { return x; } + function f() override pure internal returns (uint) { return x; } } -// ---- -// TypeError 7733: (223-224): Immutable variables cannot be read before they are initialized. diff --git a/test/libsolidity/syntaxTests/immutable/read_in_function_before_init2.sol b/test/libsolidity/syntaxTests/immutable/read_in_function_before_init2.sol index 6e939b0b28f1..7234e0ef0a30 100644 --- a/test/libsolidity/syntaxTests/immutable/read_in_function_before_init2.sol +++ b/test/libsolidity/syntaxTests/immutable/read_in_function_before_init2.sol @@ -3,5 +3,3 @@ contract C { uint x = f(); function f() internal pure returns (uint) { return t; } } -// ---- -// TypeError 7733: (106-107): Immutable variables cannot be read before they are initialized. diff --git a/test/libsolidity/syntaxTests/immutable/reading_after_initialization_function.sol b/test/libsolidity/syntaxTests/immutable/reading_after_initialization_function.sol index 70d4ac4c8413..618ad36f4333 100644 --- a/test/libsolidity/syntaxTests/immutable/reading_after_initialization_function.sol +++ b/test/libsolidity/syntaxTests/immutable/reading_after_initialization_function.sol @@ -1,5 +1,5 @@ contract C { - uint immutable x ; + uint immutable x; constructor() { @@ -13,4 +13,3 @@ contract C { } } // ---- -// TypeError 7733: (145-146): Immutable variables cannot be read before they are initialized. diff --git a/test/libsolidity/syntaxTests/immutable/reading_during_statevar_init.sol b/test/libsolidity/syntaxTests/immutable/reading_during_statevar_init.sol index ae73679eabc2..755de6481a29 100644 --- a/test/libsolidity/syntaxTests/immutable/reading_during_statevar_init.sol +++ b/test/libsolidity/syntaxTests/immutable/reading_during_statevar_init.sol @@ -2,5 +2,3 @@ contract C { uint immutable x = 0; uint y = x; } -// ---- -// TypeError 7733: (52-53): Immutable variables cannot be read before they are initialized. diff --git a/test/libsolidity/syntaxTests/immutable/return_uninitialized.sol b/test/libsolidity/syntaxTests/immutable/return_uninitialized.sol index 852b5d350b0f..3a0b3f436799 100644 --- a/test/libsolidity/syntaxTests/immutable/return_uninitialized.sol +++ b/test/libsolidity/syntaxTests/immutable/return_uninitialized.sol @@ -7,4 +7,4 @@ contract C { } } // ---- -// TypeError 2658: (63-70): Construction control flow ends without initializing all immutable state variables. +// Warning 5740: (80-85): Unreachable code. diff --git a/test/libsolidity/syntaxTests/immutable/state_var_external_access_read.sol b/test/libsolidity/syntaxTests/immutable/state_var_external_access_read.sol new file mode 100644 index 000000000000..64b24b069dbe --- /dev/null +++ b/test/libsolidity/syntaxTests/immutable/state_var_external_access_read.sol @@ -0,0 +1,13 @@ +contract C { + uint immutable public x = 42; + + function g() external view returns (uint) {} + + function f() public view returns (uint) { + return this.x(); + } + + function h() public view returns (function () external view returns (uint)) { + return this.x; + } +} diff --git a/test/libsolidity/syntaxTests/immutable/state_var_external_access_write.sol b/test/libsolidity/syntaxTests/immutable/state_var_external_access_write.sol new file mode 100644 index 000000000000..4baa743cb201 --- /dev/null +++ b/test/libsolidity/syntaxTests/immutable/state_var_external_access_write.sol @@ -0,0 +1,11 @@ +contract C { + uint immutable public x = 42; + + function g() external view returns (uint) {} + + function f() public view { + this.x = this.g; + } +} +// ---- +// TypeError 4247: (137-143): Expression has to be an lvalue. diff --git a/test/libsolidity/syntaxTests/immutable/try_catch_initialized.sol b/test/libsolidity/syntaxTests/immutable/try_catch_initialized.sol index 2d901a020091..fe969a20d04c 100644 --- a/test/libsolidity/syntaxTests/immutable/try_catch_initialized.sol +++ b/test/libsolidity/syntaxTests/immutable/try_catch_initialized.sol @@ -31,12 +31,5 @@ contract B revert(); } } - // ==== // EVMVersion: >=byzantium -// ---- -// TypeError 4130: (108-116): Cannot write to immutable here: Immutable variables cannot be initialized inside a try/catch statement. -// TypeError 4130: (144-152): Cannot write to immutable here: Immutable variables cannot be initialized inside a try/catch statement. -// TypeError 4130: (216-224): Cannot write to immutable here: Immutable variables cannot be initialized inside a try/catch statement. -// TypeError 4130: (297-305): Cannot write to immutable here: Immutable variables cannot be initialized inside a try/catch statement. -// TypeError 4130: (357-365): Cannot write to immutable here: Immutable variables cannot be initialized inside a try/catch statement. diff --git a/test/libsolidity/syntaxTests/immutable/uninitialized.sol b/test/libsolidity/syntaxTests/immutable/uninitialized.sol index d1791fe0f843..bf7c68a847d9 100644 --- a/test/libsolidity/syntaxTests/immutable/uninitialized.sol +++ b/test/libsolidity/syntaxTests/immutable/uninitialized.sol @@ -1,5 +1,3 @@ contract C { uint immutable x; } -// ---- -// TypeError 2658: (0-36): Construction control flow ends without initializing all immutable state variables. diff --git a/test/libsolidity/syntaxTests/immutable/uninitialized_private_state_var.sol b/test/libsolidity/syntaxTests/immutable/uninitialized_private_state_var.sol index 544111e4c87a..70bd1448a9c5 100644 --- a/test/libsolidity/syntaxTests/immutable/uninitialized_private_state_var.sol +++ b/test/libsolidity/syntaxTests/immutable/uninitialized_private_state_var.sol @@ -16,6 +16,3 @@ contract C is B { function f() internal view override returns(uint) { return readX(); } } -// ---- -// TypeError 2658: (0-202): Construction control flow ends without initializing all immutable state variables. -// TypeError 2658: (204-361): Construction control flow ends without initializing all immutable state variables. diff --git a/test/libsolidity/syntaxTests/immutable/variable_declaration_already.sol b/test/libsolidity/syntaxTests/immutable/variable_declaration_already.sol index 06d2bfa79857..2917f276b794 100644 --- a/test/libsolidity/syntaxTests/immutable/variable_declaration_already.sol +++ b/test/libsolidity/syntaxTests/immutable/variable_declaration_already.sol @@ -3,6 +3,3 @@ contract C { uint immutable x = z = y = 3; uint immutable y = 5; } -// ---- -// TypeError 1581: (66-67): Cannot write to immutable here: Immutable variables can only be initialized inline or assigned directly in the constructor. -// TypeError 1581: (62-63): Cannot write to immutable here: Immutable variables can only be initialized inline or assigned directly in the constructor. diff --git a/test/libsolidity/syntaxTests/immutable/variable_declaration_value.sol b/test/libsolidity/syntaxTests/immutable/variable_declaration_value.sol index 2c98ffd791c3..6451c8e207de 100644 --- a/test/libsolidity/syntaxTests/immutable/variable_declaration_value.sol +++ b/test/libsolidity/syntaxTests/immutable/variable_declaration_value.sol @@ -1,5 +1,3 @@ contract C { int immutable x = x = 5; } -// ---- -// TypeError 1581: (35-36): Cannot write to immutable here: Immutable variables can only be initialized inline or assigned directly in the constructor. diff --git a/test/libsolidity/syntaxTests/imports/module_function_from_ternary_expression.sol b/test/libsolidity/syntaxTests/imports/module_function_from_ternary_expression.sol new file mode 100644 index 000000000000..d97bbee3d372 --- /dev/null +++ b/test/libsolidity/syntaxTests/imports/module_function_from_ternary_expression.sol @@ -0,0 +1,19 @@ +==== Source: A ==== +function f() pure returns (uint) { + return 42; +} +==== Source: B ==== +function f() pure returns (uint) { + return 24; +} +==== Source: C ==== +import "A" as A; +import "B" as B; + +contract C { + function f(bool b) public pure returns (uint) { + return (b ? A : B).f(); + } +} +// ---- +// TypeError 1080: (C:116-125): True expression's type module "A" does not match false expression's type module "B". diff --git a/test/libsolidity/syntaxTests/inline_arrays/unnamed_type_tuple_in_inline_array.sol b/test/libsolidity/syntaxTests/inline_arrays/unnamed_type_tuple_in_inline_array.sol new file mode 100644 index 000000000000..21f112c5cf41 --- /dev/null +++ b/test/libsolidity/syntaxTests/inline_arrays/unnamed_type_tuple_in_inline_array.sol @@ -0,0 +1,7 @@ +contract C { + function f() public { + [(1, 2, 3), (4, 5, 6)]; + } +} +// ---- +// TypeError 9656: (47-69): Unable to deduce nameable type for array elements. Try adding explicit type conversion for the first element. diff --git a/test/libsolidity/syntaxTests/inline_arrays/unnamed_types_in_inline_array_1.sol b/test/libsolidity/syntaxTests/inline_arrays/unnamed_types_in_inline_array_1.sol index d00f818a7ef1..b848b7b12bdf 100644 --- a/test/libsolidity/syntaxTests/inline_arrays/unnamed_types_in_inline_array_1.sol +++ b/test/libsolidity/syntaxTests/inline_arrays/unnamed_types_in_inline_array_1.sol @@ -4,4 +4,4 @@ contract C { } } // ---- -// TypeError 9656: (47-52): Unable to deduce nameable type for array elements. Try adding explicit type conversion for the first element. +// TypeError 9563: (48-51): Invalid mobile type. diff --git a/test/libsolidity/syntaxTests/inline_arrays/unnamed_types_in_inline_array_2.sol b/test/libsolidity/syntaxTests/inline_arrays/unnamed_types_in_inline_array_2.sol index 0abd5ca25683..7f659209c5be 100644 --- a/test/libsolidity/syntaxTests/inline_arrays/unnamed_types_in_inline_array_2.sol +++ b/test/libsolidity/syntaxTests/inline_arrays/unnamed_types_in_inline_array_2.sol @@ -4,4 +4,4 @@ contract C { } } // ---- -// TypeError 9656: (47-56): Unable to deduce nameable type for array elements. Try adding explicit type conversion for the first element. +// TypeError 9563: (48-55): Invalid mobile type. diff --git a/test/libsolidity/syntaxTests/inline_arrays/unnamed_types_in_inline_array_3.sol b/test/libsolidity/syntaxTests/inline_arrays/unnamed_types_in_inline_array_3.sol new file mode 100644 index 000000000000..78c5493e5f8b --- /dev/null +++ b/test/libsolidity/syntaxTests/inline_arrays/unnamed_types_in_inline_array_3.sol @@ -0,0 +1,7 @@ +contract C { + function f() public pure { + [uint]; + } +} +// ---- +// TypeError 9563: (53-57): Invalid mobile type. diff --git a/test/libsolidity/syntaxTests/metaTypes/array_type_from_ternary.sol b/test/libsolidity/syntaxTests/metaTypes/array_type_from_ternary.sol new file mode 100644 index 000000000000..b4f11310ce3e --- /dev/null +++ b/test/libsolidity/syntaxTests/metaTypes/array_type_from_ternary.sol @@ -0,0 +1,8 @@ +contract C { + function f(bool c) public { + (c ? uint[2] : uint[2])[3]; + } +} +// ---- +// TypeError 9717: (58-65): Invalid mobile type in true expression. +// TypeError 3703: (68-75): Invalid mobile type in false expression. diff --git a/test/libsolidity/syntaxTests/metaTypes/contract_from_ternary.sol b/test/libsolidity/syntaxTests/metaTypes/contract_from_ternary.sol new file mode 100644 index 000000000000..7f4f17552ef1 --- /dev/null +++ b/test/libsolidity/syntaxTests/metaTypes/contract_from_ternary.sol @@ -0,0 +1,9 @@ +contract C { + function f() public pure { } + function g(bool c) public { + (c ? C : C).f(); + } +} +// ---- +// TypeError 9717: (91-92): Invalid mobile type in true expression. +// TypeError 3703: (95-96): Invalid mobile type in false expression. diff --git a/test/libsolidity/syntaxTests/metaTypes/explicit_type_conversion.sol b/test/libsolidity/syntaxTests/metaTypes/explicit_type_conversion.sol new file mode 100644 index 000000000000..3afd4d296f0c --- /dev/null +++ b/test/libsolidity/syntaxTests/metaTypes/explicit_type_conversion.sol @@ -0,0 +1,8 @@ +contract C { + function f(bool c) pure public returns (int) { + return (c ? int : int)(0); + } +} +// ---- +// TypeError 9717: (84-87): Invalid mobile type in true expression. +// TypeError 3703: (90-93): Invalid mobile type in false expression. diff --git a/test/libsolidity/syntaxTests/metaTypes/library_from_ternary.sol b/test/libsolidity/syntaxTests/metaTypes/library_from_ternary.sol new file mode 100644 index 000000000000..e1e147a15c06 --- /dev/null +++ b/test/libsolidity/syntaxTests/metaTypes/library_from_ternary.sol @@ -0,0 +1,12 @@ +library L { + function f() public pure { } +} + +contract C { + function g(bool c) public { + (c ? L : L).f(); + } +} +// ---- +// TypeError 9717: (106-107): Invalid mobile type in true expression. +// TypeError 3703: (110-111): Invalid mobile type in false expression. diff --git a/test/libsolidity/syntaxTests/metaTypes/max_keyword_from_ternary_with_type_expression.sol b/test/libsolidity/syntaxTests/metaTypes/max_keyword_from_ternary_with_type_expression.sol new file mode 100644 index 000000000000..ce4a1262300d --- /dev/null +++ b/test/libsolidity/syntaxTests/metaTypes/max_keyword_from_ternary_with_type_expression.sol @@ -0,0 +1,8 @@ +contract C { + function max(bool isUint) pure public returns (uint8) { + return (isUint ? type(uint8) : type(int8)).max; + } +} +// ---- +// TypeError 9717: (98-109): Invalid mobile type in true expression. +// TypeError 3703: (112-122): Invalid mobile type in false expression. diff --git a/test/libsolidity/syntaxTests/metaTypes/runtimeCode_from_ternary_with_type_expression.sol b/test/libsolidity/syntaxTests/metaTypes/runtimeCode_from_ternary_with_type_expression.sol new file mode 100644 index 000000000000..b2b9b2adcb6b --- /dev/null +++ b/test/libsolidity/syntaxTests/metaTypes/runtimeCode_from_ternary_with_type_expression.sol @@ -0,0 +1,16 @@ +contract A { + function f() public {} +} + +contract B { + function g() public {} +} + +contract C { + function ab(bool getA) pure public returns (bytes memory) { + return (getA ? type(A) : type(B)).runtimeCode; + } +} +// ---- +// TypeError 9717: (186-193): Invalid mobile type in true expression. +// TypeError 3703: (196-203): Invalid mobile type in false expression. diff --git a/test/libsolidity/syntaxTests/metaTypes/struct_from_ternary.sol b/test/libsolidity/syntaxTests/metaTypes/struct_from_ternary.sol new file mode 100644 index 000000000000..5d531d23fc0b --- /dev/null +++ b/test/libsolidity/syntaxTests/metaTypes/struct_from_ternary.sol @@ -0,0 +1,14 @@ +struct S { + uint x; + uint y; + uint z; +} + +contract C { + function f(bool c) public pure { + S memory s = (c ? S : S)(0, 1, 2); + } +} +// ---- +// TypeError 9717: (126-127): Invalid mobile type in true expression. +// TypeError 3703: (130-131): Invalid mobile type in false expression. diff --git a/test/libsolidity/syntaxTests/metaTypes/type_expression_nested_ternary_max_keyword.sol b/test/libsolidity/syntaxTests/metaTypes/type_expression_nested_ternary_max_keyword.sol new file mode 100644 index 000000000000..9e926738d2e8 --- /dev/null +++ b/test/libsolidity/syntaxTests/metaTypes/type_expression_nested_ternary_max_keyword.sol @@ -0,0 +1,8 @@ +contract C { + function f(bool b) public pure returns (uint) { + return type(b ? uint : uint).max; + } +} +// ---- +// TypeError 9717: (89-93): Invalid mobile type in true expression. +// TypeError 3703: (96-100): Invalid mobile type in false expression. diff --git a/test/libsolidity/syntaxTests/metaTypes/type_expression_tuple_max.sol b/test/libsolidity/syntaxTests/metaTypes/type_expression_tuple_max.sol new file mode 100644 index 000000000000..c5a5e82c3c08 --- /dev/null +++ b/test/libsolidity/syntaxTests/metaTypes/type_expression_tuple_max.sol @@ -0,0 +1,6 @@ +contract C { + function max() public pure returns (uint8) { + return (type(uint8)).max; + } +} +// ---- diff --git a/test/libsolidity/syntaxTests/metaTypes/type_from_ternary_condition.sol b/test/libsolidity/syntaxTests/metaTypes/type_from_ternary_condition.sol new file mode 100644 index 000000000000..b015641738c6 --- /dev/null +++ b/test/libsolidity/syntaxTests/metaTypes/type_from_ternary_condition.sol @@ -0,0 +1,8 @@ +contract C { + function f(bool c) pure public { + type(c ? uint : uint); + } +} +// ---- +// TypeError 9717: (67-71): Invalid mobile type in true expression. +// TypeError 3703: (74-78): Invalid mobile type in false expression. diff --git a/test/libsolidity/syntaxTests/metaTypes/type_max.sol b/test/libsolidity/syntaxTests/metaTypes/type_max.sol new file mode 100644 index 000000000000..4d3b5886e391 --- /dev/null +++ b/test/libsolidity/syntaxTests/metaTypes/type_max.sol @@ -0,0 +1,6 @@ +contract C { + function max() public pure returns (uint8) { + return type(uint8).max; + } +} +// ---- diff --git a/test/libsolidity/syntaxTests/metaTypes/type_max_from_ternary_expression.sol b/test/libsolidity/syntaxTests/metaTypes/type_max_from_ternary_expression.sol new file mode 100644 index 000000000000..873b2e679b95 --- /dev/null +++ b/test/libsolidity/syntaxTests/metaTypes/type_max_from_ternary_expression.sol @@ -0,0 +1,8 @@ +contract C { + function max(bool isUint) public returns (uint8) { + return (isUint ? type(uint8) : type(int8)).max; + } +} +// ---- +// TypeError 9717: (93-104): Invalid mobile type in true expression. +// TypeError 3703: (107-117): Invalid mobile type in false expression. diff --git a/test/libsolidity/syntaxTests/metaTypes/type_runtimecode.sol b/test/libsolidity/syntaxTests/metaTypes/type_runtimecode.sol new file mode 100644 index 000000000000..6b054b4dacfb --- /dev/null +++ b/test/libsolidity/syntaxTests/metaTypes/type_runtimecode.sol @@ -0,0 +1,9 @@ +contract A { +} + +contract C { + function f() public pure returns (bytes memory) { + return type(A).runtimeCode; + } +} +// ---- diff --git a/test/libsolidity/syntaxTests/metaTypes/type_runtimecode_from_ternary_expression_.sol b/test/libsolidity/syntaxTests/metaTypes/type_runtimecode_from_ternary_expression_.sol new file mode 100644 index 000000000000..8fcf65480e12 --- /dev/null +++ b/test/libsolidity/syntaxTests/metaTypes/type_runtimecode_from_ternary_expression_.sol @@ -0,0 +1,14 @@ +contract A { +} + +contract B { +} + +contract C { + function f(bool getA) public returns (bytes memory) { + return (getA ? type(A) : type(B)).runtimeCode; + } +} +// ---- +// TypeError 9717: (126-133): Invalid mobile type in true expression. +// TypeError 3703: (136-143): Invalid mobile type in false expression. diff --git a/test/libsolidity/syntaxTests/pragma/experimental_solidity.sol b/test/libsolidity/syntaxTests/pragma/experimental_solidity.sol new file mode 100644 index 000000000000..b6f871d87ffa --- /dev/null +++ b/test/libsolidity/syntaxTests/pragma/experimental_solidity.sol @@ -0,0 +1,5 @@ +pragma experimental solidity; +// ==== +// EVMVersion: >=constantinople +// ---- +// Warning 2264: (0-29): Experimental features are turned on. Do not use experimental features on live deployments. diff --git a/test/libsolidity/syntaxTests/pragma/experimental_solidity_multisource_not_all_enable.sol b/test/libsolidity/syntaxTests/pragma/experimental_solidity_multisource_not_all_enable.sol new file mode 100644 index 000000000000..fe4125e84303 --- /dev/null +++ b/test/libsolidity/syntaxTests/pragma/experimental_solidity_multisource_not_all_enable.sol @@ -0,0 +1,26 @@ +==== Source: A.sol ==== +contract A {} +==== Source: B.sol ==== +pragma experimental solidity; +import "A.sol"; +contract B { + A a; +} +==== Source: C.sol ==== +pragma experimental solidity; +import "A.sol"; +contract C { + A a; +} +==== Source: D.sol ==== +pragma experimental solidity; +import "A.sol"; +contract D { + A a; +} +// ==== +// EVMVersion: >=constantinople +// ---- +// ParserError 2141: (B.sol:0-29): File declares "pragma experimental solidity". If you want to enable the experimental mode, all source units must include the pragma. +// ParserError 2141: (C.sol:0-29): File declares "pragma experimental solidity". If you want to enable the experimental mode, all source units must include the pragma. +// ParserError 2141: (D.sol:0-29): File declares "pragma experimental solidity". If you want to enable the experimental mode, all source units must include the pragma. diff --git a/test/libsolidity/syntaxTests/pragma/experimental_solidity_out_of_order_1.sol b/test/libsolidity/syntaxTests/pragma/experimental_solidity_out_of_order_1.sol new file mode 100644 index 000000000000..d6741b0d3a99 --- /dev/null +++ b/test/libsolidity/syntaxTests/pragma/experimental_solidity_out_of_order_1.sol @@ -0,0 +1,7 @@ +contract A {} + +pragma experimental solidity; +// ==== +// EVMVersion: >=constantinople +// ---- +// ParserError 8185: (45-45): Experimental pragma "solidity" can only be set at the beginning of the source unit. diff --git a/test/libsolidity/syntaxTests/pragma/experimental_solidity_out_of_order_2.sol b/test/libsolidity/syntaxTests/pragma/experimental_solidity_out_of_order_2.sol new file mode 100644 index 000000000000..940bd3fbb369 --- /dev/null +++ b/test/libsolidity/syntaxTests/pragma/experimental_solidity_out_of_order_2.sol @@ -0,0 +1,15 @@ +function f() pure returns (uint) +{ + return 1; +} + +pragma experimental solidity; + +struct A +{ + uint256 x; +} +// ==== +// EVMVersion: >=constantinople +// ---- +// ParserError 8185: (83-89): Experimental pragma "solidity" can only be set at the beginning of the source unit. diff --git a/test/libsolidity/syntaxTests/pragma/experimental_solidity_wrong_evm_version.sol b/test/libsolidity/syntaxTests/pragma/experimental_solidity_wrong_evm_version.sol new file mode 100644 index 000000000000..3e070535b03d --- /dev/null +++ b/test/libsolidity/syntaxTests/pragma/experimental_solidity_wrong_evm_version.sol @@ -0,0 +1,8 @@ +pragma experimental solidity; + +contract C {} + +// ==== +// EVMVersion: 0 ? int : int)); + } +} +// ---- +// TypeError 9717: (97-100): Invalid mobile type in true expression. +// TypeError 3703: (103-106): Invalid mobile type in false expression. diff --git a/test/libsolidity/syntaxTests/specialFunctions/abidecode/abi_decode_invalid_argument_tuple_type.sol b/test/libsolidity/syntaxTests/specialFunctions/abidecode/abi_decode_invalid_argument_tuple_type.sol new file mode 100644 index 000000000000..317244a0940b --- /dev/null +++ b/test/libsolidity/syntaxTests/specialFunctions/abidecode/abi_decode_invalid_argument_tuple_type.sol @@ -0,0 +1,7 @@ +contract C { + function f() pure public { + abi.decode("", ((uint, int))); + } +} +// ---- +// TypeError 1039: (68-79): Argument has to be a type name. diff --git a/test/libsolidity/syntaxTests/specialFunctions/abidecode/abi_decode_invalid_argument_type_expression.sol b/test/libsolidity/syntaxTests/specialFunctions/abidecode/abi_decode_invalid_argument_type_expression.sol new file mode 100644 index 000000000000..84640abd2a20 --- /dev/null +++ b/test/libsolidity/syntaxTests/specialFunctions/abidecode/abi_decode_invalid_argument_type_expression.sol @@ -0,0 +1,7 @@ +contract C { + function f() pure public { + abi.decode("", (type(uint))); + } +} +// ---- +// TypeError 1039: (68-78): Argument has to be a type name. diff --git a/test/libsolidity/syntaxTests/specialFunctions/abidecode/abi_decode_member_acess.sol b/test/libsolidity/syntaxTests/specialFunctions/abidecode/abi_decode_member_acess.sol new file mode 100644 index 000000000000..5078fcdebf3c --- /dev/null +++ b/test/libsolidity/syntaxTests/specialFunctions/abidecode/abi_decode_member_acess.sol @@ -0,0 +1,19 @@ +library L { + struct S { int a; } + enum State { idle, running, blocked } +} + +contract D { + struct X { uint b; } + enum Color { red, green, blue } +} + +contract C { + function f() pure public { + abi.decode("", (L.S)); + abi.decode("", (L.State)); + abi.decode("", (D.X)); + abi.decode("", (D.Color)); + } +} +// ---- diff --git a/test/libsolidity/syntaxTests/specialFunctions/abidecode/abi_decode_unitary_nested_tuple.sol b/test/libsolidity/syntaxTests/specialFunctions/abidecode/abi_decode_unitary_nested_tuple.sol new file mode 100644 index 000000000000..8da0f0a0906e --- /dev/null +++ b/test/libsolidity/syntaxTests/specialFunctions/abidecode/abi_decode_unitary_nested_tuple.sol @@ -0,0 +1,13 @@ +struct S { int a; } + +contract C { + function f() pure public { + abi.decode("", (((uint)))); + abi.decode("", ((((uint))))); + abi.decode("", (((S)))); + } +} +// ---- +// Warning 6133: (73-99): Statement has no effect. +// Warning 6133: (109-137): Statement has no effect. +// Warning 6133: (147-170): Statement has no effect. diff --git a/test/libyul/Common.cpp b/test/libyul/Common.cpp index 11896d2f910f..800684f35376 100644 --- a/test/libyul/Common.cpp +++ b/test/libyul/Common.cpp @@ -29,7 +29,6 @@ #include #include #include -#include #include #include @@ -119,11 +118,6 @@ std::map const vali "yul", [](langutil::EVMVersion) -> yul::Dialect const& { return yul::Dialect::yulDeprecated(); } - }, - { - "ewasm", - [](langutil::EVMVersion) -> yul::Dialect const& - { return yul::WasmDialect::instance(); } } }; diff --git a/test/libyul/EwasmTranslationTest.cpp b/test/libyul/EwasmTranslationTest.cpp deleted file mode 100644 index f40bc2e42042..000000000000 --- a/test/libyul/EwasmTranslationTest.cpp +++ /dev/null @@ -1,127 +0,0 @@ -/* - This file is part of solidity. - - solidity is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - solidity is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with solidity. If not, see . -*/ -// SPDX-License-Identifier: GPL-3.0 - -#include - -#include - -#include - -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -#include - -#include -#include - -#include - -using namespace solidity; -using namespace solidity::util; -using namespace solidity::langutil; -using namespace solidity::yul; -using namespace solidity::yul::test; -using namespace solidity::frontend; -using namespace solidity::frontend::test; -using namespace std; - - -EwasmTranslationTest::EwasmTranslationTest(string const& _filename): - EVMVersionRestrictedTestCase(_filename) -{ - m_source = m_reader.source(); - m_expectation = m_reader.simpleExpectations(); -} - -TestCase::TestResult EwasmTranslationTest::run(ostream& _stream, string const& _linePrefix, bool const _formatted) -{ - if (!parse(_stream, _linePrefix, _formatted)) - return TestResult::FatalError; - - *m_object = EVMToEwasmTranslator( - EVMDialect::strictAssemblyForEVMObjects(solidity::test::CommonOptions::get().evmVersion()), - m_stack - ).run(*m_object); - - // Add call to "main()". - m_object->code->statements.emplace_back( - ExpressionStatement{{}, FunctionCall{{}, Identifier{{}, "main"_yulstring}, {}}} - ); - - m_obtainedResult = interpret(); - - return checkResult(_stream, _linePrefix, _formatted); -} - -bool EwasmTranslationTest::parse(ostream& _stream, string const& _linePrefix, bool const _formatted) -{ - m_stack = YulStack( - solidity::test::CommonOptions::get().evmVersion(), - solidity::test::CommonOptions::get().eofVersion(), - YulStack::Language::StrictAssembly, - solidity::frontend::OptimiserSettings::none(), - DebugInfoSelection::All() - ); - if (m_stack.parseAndAnalyze("", m_source)) - { - m_object = m_stack.parserResult(); - return true; - } - else - { - AnsiColorized(_stream, _formatted, {formatting::BOLD, formatting::RED}) << _linePrefix << "Error parsing source." << endl; - SourceReferenceFormatter{_stream, m_stack, true, false} - .printErrorInformation(m_stack.errors()); - return false; - } -} - -string EwasmTranslationTest::interpret() -{ - InterpreterState state; - state.maxTraceSize = 10000; - state.maxSteps = 1000000; - state.maxExprNesting = 64; - try - { - Interpreter::run( - state, - WasmDialect{}, - *m_object->code, - /*disableExternalCalls=*/true, - /*disableMemoryTracing=*/false - ); - } - catch (InterpreterTerminatedGeneric const&) - { - } - - stringstream result; - state.dumpTraceAndState(result, false); - return result.str(); -} diff --git a/test/libyul/EwasmTranslationTest.h b/test/libyul/EwasmTranslationTest.h deleted file mode 100644 index d54b8732a0ed..000000000000 --- a/test/libyul/EwasmTranslationTest.h +++ /dev/null @@ -1,54 +0,0 @@ -/* - This file is part of solidity. - - solidity is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - solidity is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with solidity. If not, see . -*/ -// SPDX-License-Identifier: GPL-3.0 - -#pragma once - -#include - -#include - -namespace solidity::yul -{ -struct Object; -class YulStack; -} - -namespace solidity::yul::test -{ - -class EwasmTranslationTest: public solidity::frontend::test::EVMVersionRestrictedTestCase -{ -public: - static std::unique_ptr create(Config const& _config) - { - return std::make_unique(_config.filename); - } - - explicit EwasmTranslationTest(std::string const& _filename); - - TestResult run(std::ostream& _stream, std::string const& _linePrefix = "", bool const _formatted = false) override; - -private: - bool parse(std::ostream& _stream, std::string const& _linePrefix, bool const _formatted); - std::string interpret(); - - std::shared_ptr m_object; - YulStack m_stack; -}; - -} diff --git a/test/libyul/ObjectCompilerTest.cpp b/test/libyul/ObjectCompilerTest.cpp index 3a8d966922cb..74a680b9b7c0 100644 --- a/test/libyul/ObjectCompilerTest.cpp +++ b/test/libyul/ObjectCompilerTest.cpp @@ -59,7 +59,6 @@ ObjectCompilerTest::ObjectCompilerTest(string const& _filename): }, "minimal" ); - m_wasm = m_reader.boolSetting("wasm", false); m_expectation = m_reader.simpleExpectations(); } @@ -68,7 +67,7 @@ TestCase::TestResult ObjectCompilerTest::run(ostream& _stream, string const& _li YulStack stack( EVMVersion(), nullopt, - m_wasm ? YulStack::Language::Ewasm : YulStack::Language::StrictAssembly, + YulStack::Language::StrictAssembly, OptimiserSettings::preset(m_optimisationPreset), DebugInfoSelection::All() ); @@ -81,33 +80,22 @@ TestCase::TestResult ObjectCompilerTest::run(ostream& _stream, string const& _li } stack.optimize(); - if (m_wasm) - { - MachineAssemblyObject obj = stack.assemble(YulStack::Machine::Ewasm); - solAssert(obj.bytecode, ""); + MachineAssemblyObject obj = stack.assemble(YulStack::Machine::EVM); + solAssert(obj.bytecode, ""); + solAssert(obj.sourceMappings, ""); - m_obtainedResult = "Text:\n" + obj.assembly + "\n"; - m_obtainedResult += "Binary:\n" + util::toHex(obj.bytecode->bytecode) + "\n"; - } + m_obtainedResult = "Assembly:\n" + obj.assembly; + if (obj.bytecode->bytecode.empty()) + m_obtainedResult += "-- empty bytecode --\n"; else - { - MachineAssemblyObject obj = stack.assemble(YulStack::Machine::EVM); - solAssert(obj.bytecode, ""); - solAssert(obj.sourceMappings, ""); - - m_obtainedResult = "Assembly:\n" + obj.assembly; - if (obj.bytecode->bytecode.empty()) - m_obtainedResult += "-- empty bytecode --\n"; - else - m_obtainedResult += - "Bytecode: " + - util::toHex(obj.bytecode->bytecode) + - "\nOpcodes: " + - boost::trim_copy(evmasm::disassemble(obj.bytecode->bytecode, solidity::test::CommonOptions::get().evmVersion())) + - "\nSourceMappings:" + - (obj.sourceMappings->empty() ? "" : " " + *obj.sourceMappings) + - "\n"; - } + m_obtainedResult += + "Bytecode: " + + util::toHex(obj.bytecode->bytecode) + + "\nOpcodes: " + + boost::trim_copy(evmasm::disassemble(obj.bytecode->bytecode, solidity::test::CommonOptions::get().evmVersion())) + + "\nSourceMappings:" + + (obj.sourceMappings->empty() ? "" : " " + *obj.sourceMappings) + + "\n"; return checkResult(_stream, _linePrefix, _formatted); } diff --git a/test/libyul/ObjectCompilerTest.h b/test/libyul/ObjectCompilerTest.h index c7880fe55637..fe899870022e 100644 --- a/test/libyul/ObjectCompilerTest.h +++ b/test/libyul/ObjectCompilerTest.h @@ -55,7 +55,6 @@ class ObjectCompilerTest: public solidity::frontend::test::TestCase void disambiguate(); frontend::OptimisationPreset m_optimisationPreset; - bool m_wasm = false; }; } diff --git a/test/libyul/YulOptimizerTest.cpp b/test/libyul/YulOptimizerTest.cpp index 6404fa7c6a62..b50bcb38e58f 100644 --- a/test/libyul/YulOptimizerTest.cpp +++ b/test/libyul/YulOptimizerTest.cpp @@ -24,7 +24,6 @@ #include #include -#include #include #include @@ -53,12 +52,6 @@ YulOptimizerTest::YulOptimizerTest(string const& _filename): BOOST_THROW_EXCEPTION(runtime_error("Filename path has to contain a directory: \"" + _filename + "\".")); m_optimizerStep = std::prev(std::prev(path.end()))->string(); - if (m_optimizerStep == "reasoningBasedSimplifier" && ( - solidity::test::CommonOptions::get().disableSMT || - ReasoningBasedSimplifier::invalidInCurrentEnvironment() - )) - m_shouldRun = false; - m_source = m_reader.source(); auto dialectName = m_reader.stringSetting("dialect", "evm"); diff --git a/test/libyul/YulOptimizerTestCommon.cpp b/test/libyul/YulOptimizerTestCommon.cpp index 7623efc12cad..7e2a4c9593fc 100644 --- a/test/libyul/YulOptimizerTestCommon.cpp +++ b/test/libyul/YulOptimizerTestCommon.cpp @@ -49,7 +49,6 @@ #include #include #include -#include #include #include #include @@ -61,8 +60,6 @@ #include #include #include -#include -#include #include #include @@ -99,6 +96,7 @@ YulOptimizerTestCommon::YulOptimizerTestCommon( }}, {"blockFlattener", [&]() { disambiguate(); + FunctionGrouper::run(*m_context, *m_ast); BlockFlattener::run(*m_context, *m_ast); }}, {"constantOptimiser", [&]() { @@ -170,6 +168,12 @@ YulOptimizerTestCommon::YulOptimizerTestCommon( FullInliner::run(*m_context, *m_ast); ExpressionJoiner::run(*m_context, *m_ast); }}, + {"fullInlinerWithoutSplitter", [&]() { + disambiguate(); + FunctionHoister::run(*m_context, *m_ast); + FunctionGrouper::run(*m_context, *m_ast); + FullInliner::run(*m_context, *m_ast); + }}, {"mainFunction", [&]() { disambiguate(); FunctionGrouper::run(*m_context, *m_ast); @@ -291,10 +295,6 @@ YulOptimizerTestCommon::YulOptimizerTestCommon( LiteralRematerialiser::run(*m_context, *m_ast); StructuralSimplifier::run(*m_context, *m_ast); }}, - {"reasoningBasedSimplifier", [&]() { - disambiguate(); - ReasoningBasedSimplifier::run(*m_context, *m_object->code); - }}, {"equivalentFunctionCombiner", [&]() { disambiguate(); ForLoopInitRewriter::run(*m_context, *m_ast); @@ -326,11 +326,6 @@ YulOptimizerTestCommon::YulOptimizerTestCommon( StackCompressor::run(*m_dialect, *m_object, true, maxIterations); BlockFlattener::run(*m_context, *m_ast); }}, - {"wordSizeTransform", [&]() { - disambiguate(); - ExpressionSplitter::run(*m_context, *m_ast); - WordSizeTransform::run(*m_dialect, *m_dialect, *m_ast, *m_nameDispenser); - }}, {"fullSuite", [&]() { GasMeter meter(dynamic_cast(*m_dialect), false, 200); OptimiserSuite::run( @@ -356,7 +351,7 @@ YulOptimizerTestCommon::YulOptimizerTestCommon( // Mark all variables with a name starting with "$" for escalation to memory. struct FakeUnreachableGenerator: ASTWalker { - map> fakeUnreachables; + map> fakeUnreachables; using ASTWalker::operator(); void operator()(FunctionDefinition const& _function) override { @@ -372,7 +367,8 @@ YulOptimizerTestCommon::YulOptimizerTestCommon( void visitVariableName(YulString _var) { if (!_var.empty() && _var.str().front() == '$') - fakeUnreachables[m_currentFunction].insert(_var); + if (!util::contains(fakeUnreachables[m_currentFunction], _var)) + fakeUnreachables[m_currentFunction].emplace_back(_var); } void operator()(VariableDeclaration const& _varDecl) override { @@ -430,8 +426,7 @@ string YulOptimizerTestCommon::randomOptimiserStep(unsigned _seed) // it can sometimes drain memory. if ( optimiserStep == "mainFunction" || - optimiserStep == "wordSizeTransform" || - optimiserStep == "reasoningBasedSimplifier" + optimiserStep == "wordSizeTransform" ) // "Fullsuite" is fuzzed roughly four times more frequently than // other steps because of the filtering in place above. diff --git a/test/libyul/evmCodeTransform/unassigned_return_variable.yul b/test/libyul/evmCodeTransform/unassigned_return_variable.yul new file mode 100644 index 000000000000..666fefe1aa64 --- /dev/null +++ b/test/libyul/evmCodeTransform/unassigned_return_variable.yul @@ -0,0 +1,19 @@ +{ + // This used to throw during stack layout generation. + function g(b,s) -> y { + y := g(b, g(y, s)) + } +} +// ==== +// stackOptimization: true +// ---- +// /* "":0:111 */ +// stop +// /* "":60:109 */ +// tag_1: +// pop +// /* "":99:100 */ +// 0x00 +// /* "":97:104 */ +// tag_1 +// jump // in diff --git a/test/libyul/ewasmTranslationTests/address.yul b/test/libyul/ewasmTranslationTests/address.yul deleted file mode 100644 index 0290bad4d487..000000000000 --- a/test/libyul/ewasmTranslationTests/address.yul +++ /dev/null @@ -1,9 +0,0 @@ -{ - sstore(0, address()) -} -// ---- -// Trace: -// Memory dump: -// 20: 0000000000000000000000000000000000000000000000000000000011111111 -// Storage dump: -// 0000000000000000000000000000000000000000000000000000000000000000: 0000000000000000000000000000000000000000000000000000000011111111 diff --git a/test/libyul/ewasmTranslationTests/arithmetic_add.yul b/test/libyul/ewasmTranslationTests/arithmetic_add.yul deleted file mode 100644 index b2203070fcf4..000000000000 --- a/test/libyul/ewasmTranslationTests/arithmetic_add.yul +++ /dev/null @@ -1,35 +0,0 @@ -{ - sstore(0, add(0, 1)) - sstore(1, add(1, not(0))) - sstore(2, add(0, 0)) - sstore(3, add(1, 2)) - sstore(4, add(0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe, 1)) - sstore(5, add( - 0x8000000000000000000000000000000000000000000000000000000000000000, 1 - )) - sstore(6, add(not(0), 1)) - sstore(7, add(0xffffffffffffffffffffffffffffffff, 1)) - sstore(8, add(0xffffffffffffffff, 1)) - sstore(9, add(0xffffffffffffffffffffffffffffffff0000000000000000, 1)) - sstore(10, add(0xffffffffffffffffffffffffffffffffffffffffffffffff, 3)) - sstore(11, add(0xffffffffffffffffffffffffffffffff, 3)) - sstore(12, add(0xffffffffffffffff, 3)) - sstore(13, add(0xffffffffffffffffffffffffffffffff0000000000000000, 3)) -} -// ---- -// Trace: -// Memory dump: -// 0: 000000000000000000000000000000000000000000000000000000000000000d -// 20: 0000000000000000ffffffffffffffffffffffffffffffff0000000000000003 -// Storage dump: -// 0000000000000000000000000000000000000000000000000000000000000000: 0000000000000000000000000000000000000000000000000000000000000001 -// 0000000000000000000000000000000000000000000000000000000000000003: 0000000000000000000000000000000000000000000000000000000000000003 -// 0000000000000000000000000000000000000000000000000000000000000004: ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff -// 0000000000000000000000000000000000000000000000000000000000000005: 8000000000000000000000000000000000000000000000000000000000000001 -// 0000000000000000000000000000000000000000000000000000000000000007: 0000000000000000000000000000000100000000000000000000000000000000 -// 0000000000000000000000000000000000000000000000000000000000000008: 0000000000000000000000000000000000000000000000010000000000000000 -// 0000000000000000000000000000000000000000000000000000000000000009: 0000000000000000ffffffffffffffffffffffffffffffff0000000000000001 -// 000000000000000000000000000000000000000000000000000000000000000a: 0000000000000001000000000000000000000000000000000000000000000002 -// 000000000000000000000000000000000000000000000000000000000000000b: 0000000000000000000000000000000100000000000000000000000000000002 -// 000000000000000000000000000000000000000000000000000000000000000c: 0000000000000000000000000000000000000000000000010000000000000002 -// 000000000000000000000000000000000000000000000000000000000000000d: 0000000000000000ffffffffffffffffffffffffffffffff0000000000000003 diff --git a/test/libyul/ewasmTranslationTests/arithmetic_addmod.yul b/test/libyul/ewasmTranslationTests/arithmetic_addmod.yul deleted file mode 100644 index 40b84764ede8..000000000000 --- a/test/libyul/ewasmTranslationTests/arithmetic_addmod.yul +++ /dev/null @@ -1,25 +0,0 @@ -{ - sstore(0, addmod(0, 1, 1)) - sstore(1, addmod(0, 1, 2)) - sstore(2, addmod(3, 1, 2)) - sstore(3, addmod(1, not(0), 5)) - sstore(4, addmod(0, 0, 0)) - sstore(5, addmod(0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe, 1, 1)) - sstore(6, addmod(0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe, 1, 0)) - sstore(7, addmod(0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffd, 1, 5)) - sstore(8, addmod( - 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff, - 0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe, - 5 - )) -} -// ---- -// Trace: -// Memory dump: -// 0: 0000000000000000000000000000000000000000000000000000000000000008 -// 20: 0000000000000000000000000000000000000000000000000000000000000004 -// Storage dump: -// 0000000000000000000000000000000000000000000000000000000000000001: 0000000000000000000000000000000000000000000000000000000000000001 -// 0000000000000000000000000000000000000000000000000000000000000003: 0000000000000000000000000000000000000000000000000000000000000001 -// 0000000000000000000000000000000000000000000000000000000000000007: 0000000000000000000000000000000000000000000000000000000000000004 -// 0000000000000000000000000000000000000000000000000000000000000008: 0000000000000000000000000000000000000000000000000000000000000004 diff --git a/test/libyul/ewasmTranslationTests/arithmetic_div.yul b/test/libyul/ewasmTranslationTests/arithmetic_div.yul deleted file mode 100644 index f32c244a9f03..000000000000 --- a/test/libyul/ewasmTranslationTests/arithmetic_div.yul +++ /dev/null @@ -1,34 +0,0 @@ -{ - sstore(0, div(0, 1)) - sstore(1, div(1, not(0))) - sstore(2, div(0, 0)) - sstore(3, div(1, 2)) - sstore(4, div(0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe, 1)) - sstore(5, div( - 0x8000000000000000000000000000000000000000000000000000000000000000, 1 - )) - sstore(6, div(not(0), 1)) - sstore(7, div(0xffffffffffffffffffffffffffffffff, 1)) - sstore(8, div(0xffffffffffffffff, 1)) - sstore(9, div(0xffffffffffffffffffffffffffffffff0000000000000000, 1)) - sstore(10, div(0xffffffffffffffffffffffffffffffffffffffffffffffff, 3)) - sstore(11, div(0xffffffffffffffffffffffffffffffff, 3)) - sstore(12, div(0xffffffffffffffff, 3)) - sstore(13, div(0xffffffffffffffffffffffffffffffff0000000000000000, 3)) -} -// ---- -// Trace: -// Memory dump: -// 0: 000000000000000000000000000000000000000000000000000000000000000d -// 20: 0000000000000000555555555555555555555555555555550000000000000000 -// Storage dump: -// 0000000000000000000000000000000000000000000000000000000000000004: fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe -// 0000000000000000000000000000000000000000000000000000000000000005: 8000000000000000000000000000000000000000000000000000000000000000 -// 0000000000000000000000000000000000000000000000000000000000000006: ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff -// 0000000000000000000000000000000000000000000000000000000000000007: 00000000000000000000000000000000ffffffffffffffffffffffffffffffff -// 0000000000000000000000000000000000000000000000000000000000000008: 000000000000000000000000000000000000000000000000ffffffffffffffff -// 0000000000000000000000000000000000000000000000000000000000000009: 0000000000000000ffffffffffffffffffffffffffffffff0000000000000000 -// 000000000000000000000000000000000000000000000000000000000000000a: 0000000000000000555555555555555555555555555555555555555555555555 -// 000000000000000000000000000000000000000000000000000000000000000b: 0000000000000000000000000000000055555555555555555555555555555555 -// 000000000000000000000000000000000000000000000000000000000000000c: 0000000000000000000000000000000000000000000000005555555555555555 -// 000000000000000000000000000000000000000000000000000000000000000d: 0000000000000000555555555555555555555555555555550000000000000000 diff --git a/test/libyul/ewasmTranslationTests/arithmetic_exp.yul b/test/libyul/ewasmTranslationTests/arithmetic_exp.yul deleted file mode 100644 index 6428e73437bf..000000000000 --- a/test/libyul/ewasmTranslationTests/arithmetic_exp.yul +++ /dev/null @@ -1,40 +0,0 @@ -{ - sstore(0, exp(0, 1)) - sstore(1, exp(1, not(0))) - sstore(2, exp(0, 0)) - sstore(3, exp(1, 2)) - sstore(4, exp(0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe, 1)) - sstore(5, exp( - 0x8000000000000000000000000000000000000000000000000000000000000000, 1 - )) - sstore(6, exp(not(0), 1)) - sstore(7, exp(0xffffffffffffffffffffffffffffffff, 2)) - sstore(8, exp(0xffffffffffffffff, 2)) - sstore(9, exp(0xffffffffffffffffffffffffffffffff0000000000000000, 2)) - sstore(10, exp(0xffffffffffffffffffffffffffffffffffffffffffffffff, 3)) - sstore(11, exp(0xffffffffffffffffffffffffffffffff, 3)) - sstore(12, exp(0xffffffffffffffff, 3)) - sstore(13, exp(0xffffffffffffffffffffffffffffffff0000000000000000, 3)) - sstore(14, exp(2, 256)) - sstore(15, exp(2, 255)) -} -// ---- -// Trace: -// Memory dump: -// 0: 000000000000000000000000000000000000000000000000000000000000000f -// 20: 8000000000000000000000000000000000000000000000000000000000000000 -// Storage dump: -// 0000000000000000000000000000000000000000000000000000000000000001: 0000000000000000000000000000000000000000000000000000000000000001 -// 0000000000000000000000000000000000000000000000000000000000000002: 0000000000000000000000000000000000000000000000000000000000000001 -// 0000000000000000000000000000000000000000000000000000000000000003: 0000000000000000000000000000000000000000000000000000000000000001 -// 0000000000000000000000000000000000000000000000000000000000000004: fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe -// 0000000000000000000000000000000000000000000000000000000000000005: 8000000000000000000000000000000000000000000000000000000000000000 -// 0000000000000000000000000000000000000000000000000000000000000006: ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff -// 0000000000000000000000000000000000000000000000000000000000000007: fffffffffffffffffffffffffffffffe00000000000000000000000000000001 -// 0000000000000000000000000000000000000000000000000000000000000008: 00000000000000000000000000000000fffffffffffffffe0000000000000001 -// 0000000000000000000000000000000000000000000000000000000000000009: 0000000000000000000000000000000100000000000000000000000000000000 -// 000000000000000000000000000000000000000000000000000000000000000a: 0000000000000002ffffffffffffffffffffffffffffffffffffffffffffffff -// 000000000000000000000000000000000000000000000000000000000000000b: 00000000000000000000000000000002ffffffffffffffffffffffffffffffff -// 000000000000000000000000000000000000000000000000000000000000000c: 0000000000000000fffffffffffffffd0000000000000002ffffffffffffffff -// 000000000000000000000000000000000000000000000000000000000000000d: ffffffffffffffff000000000000000000000000000000000000000000000000 -// 000000000000000000000000000000000000000000000000000000000000000f: 8000000000000000000000000000000000000000000000000000000000000000 diff --git a/test/libyul/ewasmTranslationTests/arithmetic_mod.yul b/test/libyul/ewasmTranslationTests/arithmetic_mod.yul deleted file mode 100644 index 38cc808bf4a2..000000000000 --- a/test/libyul/ewasmTranslationTests/arithmetic_mod.yul +++ /dev/null @@ -1,29 +0,0 @@ -{ - sstore(0, mod(0, 1)) - sstore(1, mod(1, not(0))) - sstore(2, mod(0, 0)) - sstore(3, mod(1, 2)) - sstore(4, mod(not(0), 1)) - sstore(5, mod( - 0x8000000000000000000000000000000000000000000000000000000000000000, 1 - )) - sstore(6, mod(not(0), 1)) - sstore(7, mod(0xffffffffffffffffffffffffffffffff, 1)) - sstore(8, mod(0xffffffffffffffffffffffffffffffffffffffffffffffff, 0xfffffffffffffffffffffffffffffffe)) - sstore(9, mod(0xffffffffffffffffffffffffffffffffffffffffffffffff, 5)) - sstore(10, mod(0xffffffffffffffffffffffffffffffffffffffffffffffff, 4)) - sstore(11, mod(0xffffffffffffffffffffffffffffffff, 3)) - sstore(12, mod(0xffffffffffffffff, 3)) - sstore(13, mod(0xffffffffffffffffffffffffffffffff0000000000000000, 0xffffffffffffffff43342553000)) -} -// ---- -// Trace: -// Memory dump: -// 0: 000000000000000000000000000000000000000000000000000000000000000d -// 20: 0000000000000000000000000000000000000aacffffffff8b3c03a314db9000 -// Storage dump: -// 0000000000000000000000000000000000000000000000000000000000000001: 0000000000000000000000000000000000000000000000000000000000000001 -// 0000000000000000000000000000000000000000000000000000000000000003: 0000000000000000000000000000000000000000000000000000000000000001 -// 0000000000000000000000000000000000000000000000000000000000000008: 000000000000000000000000000000000000000000000001ffffffffffffffff -// 000000000000000000000000000000000000000000000000000000000000000a: 0000000000000000000000000000000000000000000000000000000000000003 -// 000000000000000000000000000000000000000000000000000000000000000d: 0000000000000000000000000000000000000aacffffffff8b3c03a314db9000 diff --git a/test/libyul/ewasmTranslationTests/arithmetic_mul.yul b/test/libyul/ewasmTranslationTests/arithmetic_mul.yul deleted file mode 100644 index 73e1bf3d86ba..000000000000 --- a/test/libyul/ewasmTranslationTests/arithmetic_mul.yul +++ /dev/null @@ -1,36 +0,0 @@ -{ - sstore(0, mul(0, 1)) - sstore(1, mul(1, not(0))) - sstore(2, mul(0, 0)) - sstore(3, mul(1, 2)) - sstore(4, mul(0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe, 1)) - sstore(5, mul( - 0x8000000000000000000000000000000000000000000000000000000000000000, 1 - )) - sstore(6, mul(not(0), 1)) - sstore(7, mul(0xffffffffffffffffffffffffffffffff, 1)) - sstore(8, mul(0xffffffffffffffff, 1)) - sstore(9, mul(0xffffffffffffffffffffffffffffffff0000000000000000, 1)) - sstore(10, mul(0xffffffffffffffffffffffffffffffffffffffffffffffff, 3)) - sstore(11, mul(0xffffffffffffffffffffffffffffffff, 3)) - sstore(12, mul(0xffffffffffffffff, 3)) - sstore(13, mul(0xffffffffffffffffffffffffffffffff0000000000000000, 3)) -} -// ---- -// Trace: -// Memory dump: -// 0: 000000000000000000000000000000000000000000000000000000000000000d -// 20: 0000000000000002fffffffffffffffffffffffffffffffd0000000000000000 -// Storage dump: -// 0000000000000000000000000000000000000000000000000000000000000001: ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff -// 0000000000000000000000000000000000000000000000000000000000000003: 0000000000000000000000000000000000000000000000000000000000000002 -// 0000000000000000000000000000000000000000000000000000000000000004: fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe -// 0000000000000000000000000000000000000000000000000000000000000005: 8000000000000000000000000000000000000000000000000000000000000000 -// 0000000000000000000000000000000000000000000000000000000000000006: ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff -// 0000000000000000000000000000000000000000000000000000000000000007: 00000000000000000000000000000000ffffffffffffffffffffffffffffffff -// 0000000000000000000000000000000000000000000000000000000000000008: 000000000000000000000000000000000000000000000000ffffffffffffffff -// 0000000000000000000000000000000000000000000000000000000000000009: 0000000000000000ffffffffffffffffffffffffffffffff0000000000000000 -// 000000000000000000000000000000000000000000000000000000000000000a: 0000000000000002fffffffffffffffffffffffffffffffffffffffffffffffd -// 000000000000000000000000000000000000000000000000000000000000000b: 00000000000000000000000000000002fffffffffffffffffffffffffffffffd -// 000000000000000000000000000000000000000000000000000000000000000c: 000000000000000000000000000000000000000000000002fffffffffffffffd -// 000000000000000000000000000000000000000000000000000000000000000d: 0000000000000002fffffffffffffffffffffffffffffffd0000000000000000 diff --git a/test/libyul/ewasmTranslationTests/arithmetic_mulmod.yul b/test/libyul/ewasmTranslationTests/arithmetic_mulmod.yul deleted file mode 100644 index ef6efafd4214..000000000000 --- a/test/libyul/ewasmTranslationTests/arithmetic_mulmod.yul +++ /dev/null @@ -1,27 +0,0 @@ -{ - sstore(0, mulmod(0, 1, 2)) - sstore(1, mulmod(1, not(0), 5)) - sstore(2, mulmod(0, 0, 5)) - sstore(3, mulmod(1, 3, 2)) - sstore(4, mulmod(0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe, - 1, - 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff)) - sstore(5, mulmod(0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe, 1, 1)) - sstore(6, mulmod(0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe, 1, 0)) - sstore(7, mulmod(0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffd, 1, 5)) - sstore(8, mulmod( - not(0), - 0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe, - 25 - )) -} -// ---- -// Trace: -// Memory dump: -// 0: 0000000000000000000000000000000000000000000000000000000000000008 -// 20: 000000000000000000000000000000000000000000000000000000000000000f -// Storage dump: -// 0000000000000000000000000000000000000000000000000000000000000003: 0000000000000000000000000000000000000000000000000000000000000001 -// 0000000000000000000000000000000000000000000000000000000000000004: fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe -// 0000000000000000000000000000000000000000000000000000000000000007: 0000000000000000000000000000000000000000000000000000000000000003 -// 0000000000000000000000000000000000000000000000000000000000000008: 000000000000000000000000000000000000000000000000000000000000000f diff --git a/test/libyul/ewasmTranslationTests/arithmetic_sdiv.yul b/test/libyul/ewasmTranslationTests/arithmetic_sdiv.yul deleted file mode 100644 index 0cefb340586c..000000000000 --- a/test/libyul/ewasmTranslationTests/arithmetic_sdiv.yul +++ /dev/null @@ -1,33 +0,0 @@ -{ - sstore(0, sdiv(0, 1)) - sstore(1, sdiv(0, not(0))) - sstore(2, sdiv(0, 0)) - sstore(3, sdiv(1, 2)) - sstore(4, sdiv(not(0), 0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe)) - sstore(5, sdiv(0x8000000000000000000000000000000000000000000000000000000000000000, not(0))) - sstore(6, sdiv(not(0), 0x8000000000000000000000000000000000000000000000000000000000000000)) - sstore(7, sdiv(0x7000000000000000000000000000000000000000000000000000000000000000, 1)) - sstore(8, sdiv(1, 0x7000000000000000000000000000000000000000000000000000000000000000)) - sstore(9, sdiv(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff, not(0))) - sstore(10, sdiv(not(0), 0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff)) - sstore(11, sdiv(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff, 1)) - sstore(12, sdiv(not(0), not(0))) - sstore(13, sdiv( - 0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe, - 0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe - )) - sstore(14, sdiv(0x8000000000000000000000000000000000000000000000000000000000000001, not(0))) -} -// ---- -// Trace: -// Memory dump: -// 0: 000000000000000000000000000000000000000000000000000000000000000e -// 20: 7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff -// Storage dump: -// 0000000000000000000000000000000000000000000000000000000000000005: 8000000000000000000000000000000000000000000000000000000000000000 -// 0000000000000000000000000000000000000000000000000000000000000007: 7000000000000000000000000000000000000000000000000000000000000000 -// 0000000000000000000000000000000000000000000000000000000000000009: 8000000000000000000000000000000000000000000000000000000000000001 -// 000000000000000000000000000000000000000000000000000000000000000b: 7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff -// 000000000000000000000000000000000000000000000000000000000000000c: 0000000000000000000000000000000000000000000000000000000000000001 -// 000000000000000000000000000000000000000000000000000000000000000d: 0000000000000000000000000000000000000000000000000000000000000001 -// 000000000000000000000000000000000000000000000000000000000000000e: 7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff diff --git a/test/libyul/ewasmTranslationTests/arithmetic_smod.yul b/test/libyul/ewasmTranslationTests/arithmetic_smod.yul deleted file mode 100644 index cffb8f73d3c7..000000000000 --- a/test/libyul/ewasmTranslationTests/arithmetic_smod.yul +++ /dev/null @@ -1,33 +0,0 @@ -{ - sstore(0, smod(0, 1)) - sstore(1, smod(1, not(0))) - sstore(2, smod(0, 0)) - sstore(3, smod(1, 2)) - sstore(4, smod(not(0), 1)) - sstore(5, smod( - 0x8000000000000000000000000000000000000000000000000000000000000000, 1 - )) - sstore(6, smod(not(0), 1)) - sstore(7, smod(0xffffffffffffffffffffffffffffffff, 1)) - sstore(8, smod(0xffffffffffffffffffffffffffffffffffffffffffffffff, 0xfffffffffffffffffffffffffffffffe)) - sstore(9, smod(0xffffffffffffffffffffffffffffffffffffffffffffffff, 5)) - sstore(10, smod(0xffffffffffffffffffffffffffffffffffffffffffffffff, 4)) - sstore(11, smod(0xffffffffffffffffffffffffffffffff, 3)) - sstore(12, smod(0xffffffffffffffff, 3)) - sstore(13, smod(0xffffffffffffffffffffffffffffffff0000000000000000, 0xffffffffffffffff43342553000)) - sstore(14, smod( - 0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffd, - 0xffffffffffffffff43342553000 - )) -} -// ---- -// Trace: -// Memory dump: -// 0: 000000000000000000000000000000000000000000000000000000000000000e -// 20: fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffd -// Storage dump: -// 0000000000000000000000000000000000000000000000000000000000000003: 0000000000000000000000000000000000000000000000000000000000000001 -// 0000000000000000000000000000000000000000000000000000000000000008: 000000000000000000000000000000000000000000000001ffffffffffffffff -// 000000000000000000000000000000000000000000000000000000000000000a: 0000000000000000000000000000000000000000000000000000000000000003 -// 000000000000000000000000000000000000000000000000000000000000000d: 0000000000000000000000000000000000000aacffffffff8b3c03a314db9000 -// 000000000000000000000000000000000000000000000000000000000000000e: fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffd diff --git a/test/libyul/ewasmTranslationTests/arithmetic_sub.yul b/test/libyul/ewasmTranslationTests/arithmetic_sub.yul deleted file mode 100644 index fefb5d682439..000000000000 --- a/test/libyul/ewasmTranslationTests/arithmetic_sub.yul +++ /dev/null @@ -1,36 +0,0 @@ -{ - sstore(0, sub(0, 1)) - sstore(1, sub(1, not(0))) - sstore(2, sub(0, 0)) - sstore(3, sub(1, 2)) - sstore(4, sub(0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff, 1)) - sstore(5, sub( - 0x8000000000000000000000000000000000000000000000000000000000000000, 1 - )) - sstore(6, sub(not(0), 1)) - sstore(7, sub(not(0), not(0))) - sstore(8, sub(0x1000000000000000000000000000000000000000000000000, 1)) - sstore(9, sub(0x100000000000000000000000000000000, 1)) - sstore(10, sub(0x10000000000000000, 1)) - sstore(11, sub(0x1000000000000000000000000000000000000000000000000, 3)) - sstore(12, sub(0x100000000000000000000000000000000, 3)) - sstore(13, sub(0x10000000000000000, 3)) -} -// ---- -// Trace: -// Memory dump: -// 0: 000000000000000000000000000000000000000000000000000000000000000d -// 20: 000000000000000000000000000000000000000000000000fffffffffffffffd -// Storage dump: -// 0000000000000000000000000000000000000000000000000000000000000000: ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff -// 0000000000000000000000000000000000000000000000000000000000000001: 0000000000000000000000000000000000000000000000000000000000000002 -// 0000000000000000000000000000000000000000000000000000000000000003: ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff -// 0000000000000000000000000000000000000000000000000000000000000004: fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe -// 0000000000000000000000000000000000000000000000000000000000000005: 7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff -// 0000000000000000000000000000000000000000000000000000000000000006: fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe -// 0000000000000000000000000000000000000000000000000000000000000008: 0000000000000000ffffffffffffffffffffffffffffffffffffffffffffffff -// 0000000000000000000000000000000000000000000000000000000000000009: 00000000000000000000000000000000ffffffffffffffffffffffffffffffff -// 000000000000000000000000000000000000000000000000000000000000000a: 000000000000000000000000000000000000000000000000ffffffffffffffff -// 000000000000000000000000000000000000000000000000000000000000000b: 0000000000000000fffffffffffffffffffffffffffffffffffffffffffffffd -// 000000000000000000000000000000000000000000000000000000000000000c: 00000000000000000000000000000000fffffffffffffffffffffffffffffffd -// 000000000000000000000000000000000000000000000000000000000000000d: 000000000000000000000000000000000000000000000000fffffffffffffffd diff --git a/test/libyul/ewasmTranslationTests/balance.yul b/test/libyul/ewasmTranslationTests/balance.yul deleted file mode 100644 index f8bb5017aed1..000000000000 --- a/test/libyul/ewasmTranslationTests/balance.yul +++ /dev/null @@ -1,12 +0,0 @@ -{ - sstore(0, balance(address())) - sstore(1, balance(0)) -} -// ---- -// Trace: -// Memory dump: -// 0: 0000000000000000000000000000000000000000000000000000000000000001 -// 20: 0000000000000000000000000000000000000000000000000000000022222222 -// Storage dump: -// 0000000000000000000000000000000000000000000000000000000000000000: 0000000000000000000000000000000000000000000000000000000022222222 -// 0000000000000000000000000000000000000000000000000000000000000001: 0000000000000000000000000000000000000000000000000000000022222222 diff --git a/test/libyul/ewasmTranslationTests/bitwise_and.yul b/test/libyul/ewasmTranslationTests/bitwise_and.yul deleted file mode 100644 index 6d5bfbb237d3..000000000000 --- a/test/libyul/ewasmTranslationTests/bitwise_and.yul +++ /dev/null @@ -1,24 +0,0 @@ -{ - sstore(0, and(not(0), 0)) - sstore(1, and(not(0), not(0))) - sstore(2, and(not(0), 0xffffffffffffffff)) - sstore(3, and(not(0), 0xffffffffffffffffff00000000000000)) - sstore(4, and(not(0), 0xffffffffffffffffff00000000000000ffffffffffffffff)) - sstore(5, and(not(0), 0xffffffffffffffffff00000000000000ffffffffffffffff0000000000000000)) - sstore(6, and(not(0), 0xaaaaaaaaaaaaaa555555555555555555aa5555555555555aa555555555555555)) - sstore(7, and( - 0x5555555555550000aaaaaaaaaaaaaa000000aaaaaaaaa000000aaaaaaaaaaaaa, - 0xaaaaaaaaaaaaaa555555555555555555aa5555555555555aa555555555555555 - )) -} -// ---- -// Trace: -// Memory dump: -// 0: 0000000000000000000000000000000000000000000000000000000000000007 -// Storage dump: -// 0000000000000000000000000000000000000000000000000000000000000001: ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff -// 0000000000000000000000000000000000000000000000000000000000000002: 000000000000000000000000000000000000000000000000ffffffffffffffff -// 0000000000000000000000000000000000000000000000000000000000000003: 00000000000000000000000000000000ffffffffffffffffff00000000000000 -// 0000000000000000000000000000000000000000000000000000000000000004: 0000000000000000ffffffffffffffffff00000000000000ffffffffffffffff -// 0000000000000000000000000000000000000000000000000000000000000005: ffffffffffffffffff00000000000000ffffffffffffffff0000000000000000 -// 0000000000000000000000000000000000000000000000000000000000000006: aaaaaaaaaaaaaa555555555555555555aa5555555555555aa555555555555555 diff --git a/test/libyul/ewasmTranslationTests/bitwise_not.yul b/test/libyul/ewasmTranslationTests/bitwise_not.yul deleted file mode 100644 index 706d810b4aed..000000000000 --- a/test/libyul/ewasmTranslationTests/bitwise_not.yul +++ /dev/null @@ -1,25 +0,0 @@ -{ - sstore(0, not(0)) - sstore(1, not(not(0))) - sstore(2, not(0xffffffffffffffff)) - sstore(3, not(0xffffffffffffffffff00000000000000)) - sstore(4, not(0xffffffffffffffffff00000000000000ffffffffffffffff)) - sstore(5, not(0xffffffffffffffffff00000000000000ffffffffffffffff0000000000000000)) - sstore(6, not(0xaaaaaaaaaaaaaa555555555555555555aa5555555555555aa555555555555555)) - sstore(7, not(0x5555555555550000aaaaaaaaaaaaaa000000aaaaaaaaa000000aaaaaaaaaaaaa)) - sstore(8, not(0xaaaaaaaaaaaaaa555555555555555555aa5555555555555aa555555555555555)) -} -// ---- -// Trace: -// Memory dump: -// 0: 0000000000000000000000000000000000000000000000000000000000000008 -// 20: 55555555555555aaaaaaaaaaaaaaaaaa55aaaaaaaaaaaaa55aaaaaaaaaaaaaaa -// Storage dump: -// 0000000000000000000000000000000000000000000000000000000000000000: ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff -// 0000000000000000000000000000000000000000000000000000000000000002: ffffffffffffffffffffffffffffffffffffffffffffffff0000000000000000 -// 0000000000000000000000000000000000000000000000000000000000000003: ffffffffffffffffffffffffffffffff000000000000000000ffffffffffffff -// 0000000000000000000000000000000000000000000000000000000000000004: ffffffffffffffff000000000000000000ffffffffffffff0000000000000000 -// 0000000000000000000000000000000000000000000000000000000000000005: 000000000000000000ffffffffffffff0000000000000000ffffffffffffffff -// 0000000000000000000000000000000000000000000000000000000000000006: 55555555555555aaaaaaaaaaaaaaaaaa55aaaaaaaaaaaaa55aaaaaaaaaaaaaaa -// 0000000000000000000000000000000000000000000000000000000000000007: aaaaaaaaaaaaffff55555555555555ffffff555555555ffffff5555555555555 -// 0000000000000000000000000000000000000000000000000000000000000008: 55555555555555aaaaaaaaaaaaaaaaaa55aaaaaaaaaaaaa55aaaaaaaaaaaaaaa diff --git a/test/libyul/ewasmTranslationTests/bitwise_or.yul b/test/libyul/ewasmTranslationTests/bitwise_or.yul deleted file mode 100644 index d9d645d86a6c..000000000000 --- a/test/libyul/ewasmTranslationTests/bitwise_or.yul +++ /dev/null @@ -1,26 +0,0 @@ -{ - sstore(0, or(0, 0)) - sstore(1, or(0, not(0))) - sstore(2, or(0, 0xffffffffffffffff)) - sstore(3, or(0, 0xffffffffffffffffff00000000000000)) - sstore(4, or(0, 0xffffffffffffffffff00000000000000ffffffffffffffff)) - sstore(5, or(0, 0xffffffffffffffffff00000000000000ffffffffffffffff0000000000000000)) - sstore(6, or(0, 0xaaaaaaaaaaaaaa555555555555555555aa5555555555555aa555555555555555)) - sstore(7, or( - 0x5555555555550000aaaaaaaaaaaaaa000000aaaaaaaaa000000aaaaaaaaaaaaa, - 0xaaaaaaaaaaaaaa555555555555555555aa5555555555555aa555555555555555 - )) -} -// ---- -// Trace: -// Memory dump: -// 0: 0000000000000000000000000000000000000000000000000000000000000007 -// 20: ffffffffffffaa55ffffffffffffff55aa55fffffffff55aa55fffffffffffff -// Storage dump: -// 0000000000000000000000000000000000000000000000000000000000000001: ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff -// 0000000000000000000000000000000000000000000000000000000000000002: 000000000000000000000000000000000000000000000000ffffffffffffffff -// 0000000000000000000000000000000000000000000000000000000000000003: 00000000000000000000000000000000ffffffffffffffffff00000000000000 -// 0000000000000000000000000000000000000000000000000000000000000004: 0000000000000000ffffffffffffffffff00000000000000ffffffffffffffff -// 0000000000000000000000000000000000000000000000000000000000000005: ffffffffffffffffff00000000000000ffffffffffffffff0000000000000000 -// 0000000000000000000000000000000000000000000000000000000000000006: aaaaaaaaaaaaaa555555555555555555aa5555555555555aa555555555555555 -// 0000000000000000000000000000000000000000000000000000000000000007: ffffffffffffaa55ffffffffffffff55aa55fffffffff55aa55fffffffffffff diff --git a/test/libyul/ewasmTranslationTests/bitwise_xor.yul b/test/libyul/ewasmTranslationTests/bitwise_xor.yul deleted file mode 100644 index b358bacb5f20..000000000000 --- a/test/libyul/ewasmTranslationTests/bitwise_xor.yul +++ /dev/null @@ -1,27 +0,0 @@ -{ - sstore(0, xor(0xffff, 0)) - sstore(1, xor(0xffff, not(0))) - sstore(2, xor(0xffff, 0xffffffffffffffff)) - sstore(3, xor(0xffff, 0xffffffffffffffffff00000000000000)) - sstore(4, xor(0xffff, 0xffffffffffffffffff00000000000000ffffffffffffffff)) - sstore(5, xor(0xffff, 0xffffffffffffffffff00000000000000ffffffffffffffff0000000000000000)) - sstore(6, xor(0xffff, 0xaaaaaaaaaaaaaa555555555555555555aa5555555555555aa555555555555555)) - sstore(7, xor( - 0x5555555555550000aaaaaaaaaaaaaa000000aaaaaaaaa000000aaaaaaaaaaaaa, - 0xaaaaaaaaaaaaaa555555555555555555aa5555555555555aa555555555555555 - )) -} -// ---- -// Trace: -// Memory dump: -// 0: 0000000000000000000000000000000000000000000000000000000000000007 -// 20: ffffffffffffaa55ffffffffffffff55aa55fffffffff55aa55fffffffffffff -// Storage dump: -// 0000000000000000000000000000000000000000000000000000000000000000: 000000000000000000000000000000000000000000000000000000000000ffff -// 0000000000000000000000000000000000000000000000000000000000000001: ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0000 -// 0000000000000000000000000000000000000000000000000000000000000002: 000000000000000000000000000000000000000000000000ffffffffffff0000 -// 0000000000000000000000000000000000000000000000000000000000000003: 00000000000000000000000000000000ffffffffffffffffff0000000000ffff -// 0000000000000000000000000000000000000000000000000000000000000004: 0000000000000000ffffffffffffffffff00000000000000ffffffffffff0000 -// 0000000000000000000000000000000000000000000000000000000000000005: ffffffffffffffffff00000000000000ffffffffffffffff000000000000ffff -// 0000000000000000000000000000000000000000000000000000000000000006: aaaaaaaaaaaaaa555555555555555555aa5555555555555aa55555555555aaaa -// 0000000000000000000000000000000000000000000000000000000000000007: ffffffffffffaa55ffffffffffffff55aa55fffffffff55aa55fffffffffffff diff --git a/test/libyul/ewasmTranslationTests/blockhash.yul b/test/libyul/ewasmTranslationTests/blockhash.yul deleted file mode 100644 index 8b906232f2c0..000000000000 --- a/test/libyul/ewasmTranslationTests/blockhash.yul +++ /dev/null @@ -1,9 +0,0 @@ -{ - sstore(0, blockhash(1023)) -} -// ---- -// Trace: -// Memory dump: -// 20: 00000000000000000000000000000000000000000000000000000000aaaaa9a9 -// Storage dump: -// 0000000000000000000000000000000000000000000000000000000000000000: 00000000000000000000000000000000000000000000000000000000aaaaa9a9 diff --git a/test/libyul/ewasmTranslationTests/calldatacopy.yul b/test/libyul/ewasmTranslationTests/calldatacopy.yul deleted file mode 100644 index 0d7d57af0da0..000000000000 --- a/test/libyul/ewasmTranslationTests/calldatacopy.yul +++ /dev/null @@ -1,8 +0,0 @@ -{ - calldatacopy(0, 0, 32) - sstore(0, mload(0)) -} -// ---- -// Trace: -// Memory dump: -// Storage dump: diff --git a/test/libyul/ewasmTranslationTests/calldataload.yul b/test/libyul/ewasmTranslationTests/calldataload.yul deleted file mode 100644 index f0b4008f6b15..000000000000 --- a/test/libyul/ewasmTranslationTests/calldataload.yul +++ /dev/null @@ -1,7 +0,0 @@ -{ - sstore(0, calldataload(0)) -} -// ---- -// Trace: -// Memory dump: -// Storage dump: diff --git a/test/libyul/ewasmTranslationTests/calldatasize.yul b/test/libyul/ewasmTranslationTests/calldatasize.yul deleted file mode 100644 index 229f6b461468..000000000000 --- a/test/libyul/ewasmTranslationTests/calldatasize.yul +++ /dev/null @@ -1,7 +0,0 @@ -{ - sstore(0, calldatasize()) -} -// ---- -// Trace: -// Memory dump: -// Storage dump: diff --git a/test/libyul/ewasmTranslationTests/caller.yul b/test/libyul/ewasmTranslationTests/caller.yul deleted file mode 100644 index 1abb288d507e..000000000000 --- a/test/libyul/ewasmTranslationTests/caller.yul +++ /dev/null @@ -1,9 +0,0 @@ -{ - sstore(0, caller()) -} -// ---- -// Trace: -// Memory dump: -// 20: 0000000000000000000000000000000000000000000000000000000044444444 -// Storage dump: -// 0000000000000000000000000000000000000000000000000000000000000000: 0000000000000000000000000000000000000000000000000000000044444444 diff --git a/test/libyul/ewasmTranslationTests/callvalue.yul b/test/libyul/ewasmTranslationTests/callvalue.yul deleted file mode 100644 index 5d34b58b6718..000000000000 --- a/test/libyul/ewasmTranslationTests/callvalue.yul +++ /dev/null @@ -1,9 +0,0 @@ -{ - sstore(0, callvalue()) -} -// ---- -// Trace: -// Memory dump: -// 20: 0000000000000000000000000000000000000000000000000000000055555555 -// Storage dump: -// 0000000000000000000000000000000000000000000000000000000000000000: 0000000000000000000000000000000000000000000000000000000055555555 diff --git a/test/libyul/ewasmTranslationTests/chainid.yul b/test/libyul/ewasmTranslationTests/chainid.yul deleted file mode 100644 index 73a82f44231a..000000000000 --- a/test/libyul/ewasmTranslationTests/chainid.yul +++ /dev/null @@ -1,10 +0,0 @@ -{ - sstore(0, chainid()) -} -// ==== -// EVMVersion: >=istanbul -// ---- -// Trace: -// INVALID() -// Memory dump: -// Storage dump: diff --git a/test/libyul/ewasmTranslationTests/codecopy.yul b/test/libyul/ewasmTranslationTests/codecopy.yul deleted file mode 100644 index 5b980c6b1cda..000000000000 --- a/test/libyul/ewasmTranslationTests/codecopy.yul +++ /dev/null @@ -1,11 +0,0 @@ -{ - codecopy(0x100, 0, codesize()) - sstore(0, mload(0x100)) -} -// ---- -// Trace: -// Memory dump: -// 20: 636f6465636f6465636f6465636f6465636f6465000000000000000000000000 -// 140: 636f6465636f6465636f6465636f6465636f6465000000000000000000000000 -// Storage dump: -// 0000000000000000000000000000000000000000000000000000000000000000: 636f6465636f6465636f6465636f6465636f6465000000000000000000000000 diff --git a/test/libyul/ewasmTranslationTests/codesize.yul b/test/libyul/ewasmTranslationTests/codesize.yul deleted file mode 100644 index ae96335fab21..000000000000 --- a/test/libyul/ewasmTranslationTests/codesize.yul +++ /dev/null @@ -1,9 +0,0 @@ -{ - sstore(0, codesize()) -} -// ---- -// Trace: -// Memory dump: -// 20: 0000000000000000000000000000000000000000000000000000000000000014 -// Storage dump: -// 0000000000000000000000000000000000000000000000000000000000000000: 0000000000000000000000000000000000000000000000000000000000000014 diff --git a/test/libyul/ewasmTranslationTests/coinbase.yul b/test/libyul/ewasmTranslationTests/coinbase.yul deleted file mode 100644 index b83e298f545e..000000000000 --- a/test/libyul/ewasmTranslationTests/coinbase.yul +++ /dev/null @@ -1,9 +0,0 @@ -{ - sstore(0, coinbase()) -} -// ---- -// Trace: -// Memory dump: -// 20: 0000000000000000000000000000000000000000000000000000000077777777 -// Storage dump: -// 0000000000000000000000000000000000000000000000000000000000000000: 0000000000000000000000000000000000000000000000000000000077777777 diff --git a/test/libyul/ewasmTranslationTests/comparison_eq.yul b/test/libyul/ewasmTranslationTests/comparison_eq.yul deleted file mode 100644 index d65d49cf900d..000000000000 --- a/test/libyul/ewasmTranslationTests/comparison_eq.yul +++ /dev/null @@ -1,28 +0,0 @@ -{ - sstore(0, eq(0, 0)) - sstore(1, eq(not(0), not(0))) - sstore(2, eq(0, not(0))) - sstore(3, eq(not(0), 0xffffffffffffffff)) - sstore(4, eq(0xfffffffffffffff000000000000000, 0xfffffffffffffff000000000000000)) - sstore(5, eq(0x000000000000000fffffffffffffff, 0xfffffffffffffff000000000000000)) - sstore(6, eq(0xfffffffffffffff000000000000000fffffffffffffff, 0xfffffffffffffff000000000000000fffffffffffffff)) - sstore(7, eq(0xfffffffffffffff000000000000000fffffffffffffff, 0x000000000000000ffffffffffffffffffffffffffffff)) - sstore(8, eq( - 0xaaaaaaaaaaaaaaaa5555555555555555ffffffffffffffff0000000000000000, - 0xaaaaaaaaaaaaaaaa5555555555555555ffffffffffffffff0000000000000000 - )) - sstore(9, eq( - 0xaaaaaaaaaaaaaaaa6666666666666666ffffffffffffffff0000000000000000, - 0xaaaaaaaaaaaaaaaa5555555555555555ffffffffffffffff0000000000000000 - )) -} -// ---- -// Trace: -// Memory dump: -// 0: 0000000000000000000000000000000000000000000000000000000000000009 -// Storage dump: -// 0000000000000000000000000000000000000000000000000000000000000000: 0000000000000000000000000000000000000000000000000000000000000001 -// 0000000000000000000000000000000000000000000000000000000000000001: 0000000000000000000000000000000000000000000000000000000000000001 -// 0000000000000000000000000000000000000000000000000000000000000004: 0000000000000000000000000000000000000000000000000000000000000001 -// 0000000000000000000000000000000000000000000000000000000000000006: 0000000000000000000000000000000000000000000000000000000000000001 -// 0000000000000000000000000000000000000000000000000000000000000008: 0000000000000000000000000000000000000000000000000000000000000001 diff --git a/test/libyul/ewasmTranslationTests/comparison_gt.yul b/test/libyul/ewasmTranslationTests/comparison_gt.yul deleted file mode 100644 index bda8b94e1485..000000000000 --- a/test/libyul/ewasmTranslationTests/comparison_gt.yul +++ /dev/null @@ -1,36 +0,0 @@ -{ - sstore(0, gt(1, 0)) - sstore(1, gt(0, 1)) - sstore(2, gt(0, 0)) - sstore(3, gt(not(0), 0xffffffffffffffff)) - sstore(4, gt(0xffffffffffffffff, not(0))) - sstore(5, gt(not(0), not(0))) - sstore(6, gt(not(0), 0xffffffffffffffff0000000000000000)) - sstore(7, gt(0xffffffffffffffff0000000000000000, not(0))) - sstore(8, gt(0xffffffffffffffff0000000000000000, 0xffffffffffffffff0000000000000000)) - sstore(9, gt(not(0), 0xffffffffffffffff0000000000000000ffffffffffffffff)) - sstore(10, gt(0xffffffffffffffff0000000000000000ffffffffffffffff, not(0))) - sstore(11, gt(0xffffffffffffffff0000000000000000ffffffffffffffff, 0xffffffffffffffff0000000000000000ffffffffffffffff)) - sstore(12, gt(not(0), 0xffffffffffffffff0000000000000000ffffffffffffffff0000000000000000)) - sstore(13, gt(0xffffffffffffffff0000000000000000ffffffffffffffff0000000000000000, not(0))) - sstore(14, gt( - 0xffffffffffffffff0000000000000000ffffffffffffffff0000000000000000, - 0xffffffffffffffff0000000000000000ffffffffffffffff0000000000000000) - ) - sstore(15, gt( - 0xffffffffffffffff0000000000000000ffffffffffffffff0000000000000001, - 0xffffffffffffffff0000000000000000ffffffffffffffff0000000000000000) - ) -} -// ---- -// Trace: -// Memory dump: -// 0: 000000000000000000000000000000000000000000000000000000000000000f -// 20: 0000000000000000000000000000000000000000000000000000000000000001 -// Storage dump: -// 0000000000000000000000000000000000000000000000000000000000000000: 0000000000000000000000000000000000000000000000000000000000000001 -// 0000000000000000000000000000000000000000000000000000000000000003: 0000000000000000000000000000000000000000000000000000000000000001 -// 0000000000000000000000000000000000000000000000000000000000000006: 0000000000000000000000000000000000000000000000000000000000000001 -// 0000000000000000000000000000000000000000000000000000000000000009: 0000000000000000000000000000000000000000000000000000000000000001 -// 000000000000000000000000000000000000000000000000000000000000000c: 0000000000000000000000000000000000000000000000000000000000000001 -// 000000000000000000000000000000000000000000000000000000000000000f: 0000000000000000000000000000000000000000000000000000000000000001 diff --git a/test/libyul/ewasmTranslationTests/comparison_lt.yul b/test/libyul/ewasmTranslationTests/comparison_lt.yul deleted file mode 100644 index be57da46e3fe..000000000000 --- a/test/libyul/ewasmTranslationTests/comparison_lt.yul +++ /dev/null @@ -1,36 +0,0 @@ -{ - sstore(0, lt(1, 0)) - sstore(1, lt(0, 1)) - sstore(2, lt(0, 0)) - sstore(3, lt(not(0), 0xffffffffffffffff)) - sstore(4, lt(0xffffffffffffffff, not(0))) - sstore(5, lt(not(0), not(0))) - sstore(6, lt(not(0), 0xffffffffffffffff0000000000000000)) - sstore(7, lt(0xffffffffffffffff0000000000000000, not(0))) - sstore(8, lt(0xffffffffffffffff0000000000000000, 0xffffffffffffffff0000000000000000)) - sstore(9, lt(not(0), 0xffffffffffffffff0000000000000000ffffffffffffffff)) - sstore(10, lt(0xffffffffffffffff0000000000000000ffffffffffffffff, not(0))) - sstore(11, lt(0xffffffffffffffff0000000000000000ffffffffffffffff, 0xffffffffffffffff0000000000000000ffffffffffffffff)) - sstore(12, lt(not(0), 0xffffffffffffffff0000000000000000ffffffffffffffff0000000000000000)) - sstore(13, lt(0xffffffffffffffff0000000000000000ffffffffffffffff0000000000000000, not(0))) - sstore(14, lt( - 0xffffffffffffffff0000000000000000ffffffffffffffff0000000000000000, - 0xffffffffffffffff0000000000000000ffffffffffffffff0000000000000000) - ) - sstore(15, lt( - 0xffffffffffffffff0000000000000000ffffffffffffffff0000000000000000, - 0xffffffffffffffff0000000000000000ffffffffffffffff0000000000000001) - ) -} -// ---- -// Trace: -// Memory dump: -// 0: 000000000000000000000000000000000000000000000000000000000000000f -// 20: 0000000000000000000000000000000000000000000000000000000000000001 -// Storage dump: -// 0000000000000000000000000000000000000000000000000000000000000001: 0000000000000000000000000000000000000000000000000000000000000001 -// 0000000000000000000000000000000000000000000000000000000000000004: 0000000000000000000000000000000000000000000000000000000000000001 -// 0000000000000000000000000000000000000000000000000000000000000007: 0000000000000000000000000000000000000000000000000000000000000001 -// 000000000000000000000000000000000000000000000000000000000000000a: 0000000000000000000000000000000000000000000000000000000000000001 -// 000000000000000000000000000000000000000000000000000000000000000d: 0000000000000000000000000000000000000000000000000000000000000001 -// 000000000000000000000000000000000000000000000000000000000000000f: 0000000000000000000000000000000000000000000000000000000000000001 diff --git a/test/libyul/ewasmTranslationTests/comparison_sgt.yul b/test/libyul/ewasmTranslationTests/comparison_sgt.yul deleted file mode 100644 index 60def7e31e4e..000000000000 --- a/test/libyul/ewasmTranslationTests/comparison_sgt.yul +++ /dev/null @@ -1,54 +0,0 @@ -{ - sstore(0, sgt(0, 1)) - sstore(1, sgt(0, not(0))) - sstore(2, sgt(0, 0)) - sstore(3, sgt(1, 2)) - sstore(4, sgt(not(0), 0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe)) - sstore(5, sgt(0x8000000000000000000000000000000000000000000000000000000000000000, not(0))) - sstore(6, sgt(not(0), 0x8000000000000000000000000000000000000000000000000000000000000000)) - sstore(7, sgt(0x7000000000000000000000000000000000000000000000000000000000000000, 1)) - sstore(8, sgt(1, 0x7000000000000000000000000000000000000000000000000000000000000000)) - sstore(9, sgt(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff, not(0))) - sstore(10, sgt(not(0), 0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff)) - sstore(11, sgt(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff, 1)) - sstore(12, sgt(1, 0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff)) - sstore(13, sgt( - 0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff, - 0x8fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff - )) - sstore(14, sgt( - 0x8fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff, - 0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff - )) - sstore(15, sgt( - 0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff, - not(0) - )) - sstore(16, sgt( - not(0), - 0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff - )) - sstore(17, sgt( - not(0), - 0x8fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff - )) - sstore(18, sgt( - 0x8fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff, - not(0) - )) - -} -// ---- -// Trace: -// Memory dump: -// 0: 0000000000000000000000000000000000000000000000000000000000000012 -// Storage dump: -// 0000000000000000000000000000000000000000000000000000000000000001: 0000000000000000000000000000000000000000000000000000000000000001 -// 0000000000000000000000000000000000000000000000000000000000000004: 0000000000000000000000000000000000000000000000000000000000000001 -// 0000000000000000000000000000000000000000000000000000000000000006: 0000000000000000000000000000000000000000000000000000000000000001 -// 0000000000000000000000000000000000000000000000000000000000000007: 0000000000000000000000000000000000000000000000000000000000000001 -// 0000000000000000000000000000000000000000000000000000000000000009: 0000000000000000000000000000000000000000000000000000000000000001 -// 000000000000000000000000000000000000000000000000000000000000000b: 0000000000000000000000000000000000000000000000000000000000000001 -// 000000000000000000000000000000000000000000000000000000000000000d: 0000000000000000000000000000000000000000000000000000000000000001 -// 000000000000000000000000000000000000000000000000000000000000000f: 0000000000000000000000000000000000000000000000000000000000000001 -// 0000000000000000000000000000000000000000000000000000000000000011: 0000000000000000000000000000000000000000000000000000000000000001 diff --git a/test/libyul/ewasmTranslationTests/comparison_slt.yul b/test/libyul/ewasmTranslationTests/comparison_slt.yul deleted file mode 100644 index 577f6e9f1f77..000000000000 --- a/test/libyul/ewasmTranslationTests/comparison_slt.yul +++ /dev/null @@ -1,55 +0,0 @@ -{ - sstore(0, slt(0, 1)) - sstore(1, slt(0, not(0))) - sstore(2, slt(0, 0)) - sstore(3, slt(1, 2)) - sstore(4, slt(not(0), 0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe)) - sstore(5, slt(0x8000000000000000000000000000000000000000000000000000000000000000, not(0))) - sstore(6, slt(not(0), 0x8000000000000000000000000000000000000000000000000000000000000000)) - sstore(7, slt(0x7000000000000000000000000000000000000000000000000000000000000000, 1)) - sstore(8, slt(1, 0x7000000000000000000000000000000000000000000000000000000000000000)) - sstore(9, slt(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff, not(0))) - sstore(10, slt(not(0), 0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff)) - sstore(11, slt(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff, 1)) - sstore(12, slt(1, 0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff)) - sstore(13, slt( - 0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff, - 0x8fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff - )) - sstore(14, slt( - 0x8fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff, - 0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff - )) - sstore(15, slt( - 0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff, - not(0) - )) - sstore(16, slt( - not(0), - 0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff - )) - sstore(17, slt( - not(0), - 0x8fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff - )) - sstore(18, slt( - 0x8fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff, - not(0) - )) - -} -// ---- -// Trace: -// Memory dump: -// 0: 0000000000000000000000000000000000000000000000000000000000000012 -// 20: 0000000000000000000000000000000000000000000000000000000000000001 -// Storage dump: -// 0000000000000000000000000000000000000000000000000000000000000000: 0000000000000000000000000000000000000000000000000000000000000001 -// 0000000000000000000000000000000000000000000000000000000000000003: 0000000000000000000000000000000000000000000000000000000000000001 -// 0000000000000000000000000000000000000000000000000000000000000005: 0000000000000000000000000000000000000000000000000000000000000001 -// 0000000000000000000000000000000000000000000000000000000000000008: 0000000000000000000000000000000000000000000000000000000000000001 -// 000000000000000000000000000000000000000000000000000000000000000a: 0000000000000000000000000000000000000000000000000000000000000001 -// 000000000000000000000000000000000000000000000000000000000000000c: 0000000000000000000000000000000000000000000000000000000000000001 -// 000000000000000000000000000000000000000000000000000000000000000e: 0000000000000000000000000000000000000000000000000000000000000001 -// 0000000000000000000000000000000000000000000000000000000000000010: 0000000000000000000000000000000000000000000000000000000000000001 -// 0000000000000000000000000000000000000000000000000000000000000012: 0000000000000000000000000000000000000000000000000000000000000001 diff --git a/test/libyul/ewasmTranslationTests/datacopy.yul b/test/libyul/ewasmTranslationTests/datacopy.yul deleted file mode 100644 index 8812e7c9bec3..000000000000 --- a/test/libyul/ewasmTranslationTests/datacopy.yul +++ /dev/null @@ -1,20 +0,0 @@ -object "main" -{ - code { - datacopy(0, and(dataoffset("main"), 15), and(datasize("main"), 15)) - datacopy(32, and(dataoffset("sub"), 15), and(datasize("sub"), 15)) - sstore(0, mload(0)) - sstore(1, mload(32)) - } - object "sub" { code { sstore(0, 1) } } -} -// ---- -// Trace: -// Memory dump: -// 0: 0000000000000000000000000000000000000000000000000000000000000001 -// 20: 636f6465636f6465000000000000000000000000000000000000000000000000 -// 40: 6465636f00000000000000000000000000000000000000000000000000000000 -// 60: 636f6465636f6465000000000000000000000000000000000000000000000000 -// Storage dump: -// 0000000000000000000000000000000000000000000000000000000000000000: 6465636f00000000000000000000000000000000000000000000000000000000 -// 0000000000000000000000000000000000000000000000000000000000000001: 636f6465636f6465000000000000000000000000000000000000000000000000 diff --git a/test/libyul/ewasmTranslationTests/dataoffset.yul b/test/libyul/ewasmTranslationTests/dataoffset.yul deleted file mode 100644 index d9dc12c9cd52..000000000000 --- a/test/libyul/ewasmTranslationTests/dataoffset.yul +++ /dev/null @@ -1,16 +0,0 @@ -object "main" -{ - code { - sstore(0, dataoffset("main")) - sstore(1, dataoffset("sub")) - } - object "sub" { code { sstore(0, 1) } } -} -// ---- -// Trace: -// Memory dump: -// 0: 0000000000000000000000000000000000000000000000000000000000000001 -// 20: 000000000000000000000000000000000000000000000000000000000000070c -// Storage dump: -// 0000000000000000000000000000000000000000000000000000000000000000: 000000000000000000000000000000000000000000000000000000000000006e -// 0000000000000000000000000000000000000000000000000000000000000001: 000000000000000000000000000000000000000000000000000000000000070c diff --git a/test/libyul/ewasmTranslationTests/datasize.yul b/test/libyul/ewasmTranslationTests/datasize.yul deleted file mode 100644 index 637c2c36de1f..000000000000 --- a/test/libyul/ewasmTranslationTests/datasize.yul +++ /dev/null @@ -1,16 +0,0 @@ -object "main" -{ - code { - sstore(0, datasize("main")) - sstore(1, datasize("sub")) - } - object "sub" { code { sstore(0, 1) } } -} -// ---- -// Trace: -// Memory dump: -// 0: 0000000000000000000000000000000000000000000000000000000000000001 -// 20: 0000000000000000000000000000000000000000000000000000000000000109 -// Storage dump: -// 0000000000000000000000000000000000000000000000000000000000000000: 0000000000000000000000000000000000000000000000000000000000000b64 -// 0000000000000000000000000000000000000000000000000000000000000001: 0000000000000000000000000000000000000000000000000000000000000109 diff --git a/test/libyul/ewasmTranslationTests/difficulty.yul b/test/libyul/ewasmTranslationTests/difficulty.yul deleted file mode 100644 index 52e4275b43f2..000000000000 --- a/test/libyul/ewasmTranslationTests/difficulty.yul +++ /dev/null @@ -1,11 +0,0 @@ -{ - sstore(0, difficulty()) -} -// ==== -// EVMVersion: =constantinople -// ---- -// Trace: -// INVALID() -// Memory dump: -// 0: 0000000000000000000000000000000000000000000000000000000011111111 -// Storage dump: diff --git a/test/libyul/ewasmTranslationTests/extcodesize.yul b/test/libyul/ewasmTranslationTests/extcodesize.yul deleted file mode 100644 index fb12db5ea70a..000000000000 --- a/test/libyul/ewasmTranslationTests/extcodesize.yul +++ /dev/null @@ -1,9 +0,0 @@ -{ - sstore(0, extcodesize(address())) -} -// ---- -// Trace: -// Memory dump: -// 20: 000000000000000000000000000000000000000000000000000000000000077b -// Storage dump: -// 0000000000000000000000000000000000000000000000000000000000000000: 000000000000000000000000000000000000000000000000000000000000077b diff --git a/test/libyul/ewasmTranslationTests/gas.yul b/test/libyul/ewasmTranslationTests/gas.yul deleted file mode 100644 index ef7125b26265..000000000000 --- a/test/libyul/ewasmTranslationTests/gas.yul +++ /dev/null @@ -1,9 +0,0 @@ -{ - sstore(0, gas()) -} -// ---- -// Trace: -// Memory dump: -// 20: 0000000000000000000000000000000000000000000000000000000000000099 -// Storage dump: -// 0000000000000000000000000000000000000000000000000000000000000000: 0000000000000000000000000000000000000000000000000000000000000099 diff --git a/test/libyul/ewasmTranslationTests/gaslimit.yul b/test/libyul/ewasmTranslationTests/gaslimit.yul deleted file mode 100644 index d1d0cc2a8338..000000000000 --- a/test/libyul/ewasmTranslationTests/gaslimit.yul +++ /dev/null @@ -1,9 +0,0 @@ -{ - sstore(0, gaslimit()) -} -// ---- -// Trace: -// Memory dump: -// 20: 00000000000000000000000000000000000000000000000000000000003d0900 -// Storage dump: -// 0000000000000000000000000000000000000000000000000000000000000000: 00000000000000000000000000000000000000000000000000000000003d0900 diff --git a/test/libyul/ewasmTranslationTests/gasprice.yul b/test/libyul/ewasmTranslationTests/gasprice.yul deleted file mode 100644 index 2c9d80452071..000000000000 --- a/test/libyul/ewasmTranslationTests/gasprice.yul +++ /dev/null @@ -1,9 +0,0 @@ -{ - sstore(0, gasprice()) -} -// ---- -// Trace: -// Memory dump: -// 20: 0000000000000000000000000000000000000000000000000000000066666666 -// Storage dump: -// 0000000000000000000000000000000000000000000000000000000000000000: 0000000000000000000000000000000000000000000000000000000066666666 diff --git a/test/libyul/ewasmTranslationTests/invalid.yul b/test/libyul/ewasmTranslationTests/invalid.yul deleted file mode 100644 index c9844978aba5..000000000000 --- a/test/libyul/ewasmTranslationTests/invalid.yul +++ /dev/null @@ -1,14 +0,0 @@ -{ - sstore(0, 0x1234) - mstore(1, 0) - invalid() - sstore(0, 0x5678) - mstore(1, 0xff) -} -// ---- -// Trace: -// INVALID() -// Memory dump: -// 20: 0000000000000000000000000000000000000000000000000000000000001234 -// Storage dump: -// 0000000000000000000000000000000000000000000000000000000000000000: 0000000000000000000000000000000000000000000000000000000000001234 diff --git a/test/libyul/ewasmTranslationTests/iszero.yul b/test/libyul/ewasmTranslationTests/iszero.yul deleted file mode 100644 index 5175e22451c9..000000000000 --- a/test/libyul/ewasmTranslationTests/iszero.yul +++ /dev/null @@ -1,14 +0,0 @@ -{ - let x := 0 - let y := 0x0102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f20 - let z := 0x0000000000000000000111111111111111111111100000000000000000000000 - sstore(0, iszero(x)) - sstore(1, iszero(y)) - sstore(2, iszero(z)) -} -// ---- -// Trace: -// Memory dump: -// 0: 0000000000000000000000000000000000000000000000000000000000000002 -// Storage dump: -// 0000000000000000000000000000000000000000000000000000000000000000: 0000000000000000000000000000000000000000000000000000000000000001 diff --git a/test/libyul/ewasmTranslationTests/keccak256.yul b/test/libyul/ewasmTranslationTests/keccak256.yul deleted file mode 100644 index 81a650345c78..000000000000 --- a/test/libyul/ewasmTranslationTests/keccak256.yul +++ /dev/null @@ -1,9 +0,0 @@ -{ - sstore(0, keccak256(0, 0)) - sstore(0, keccak256(0, 0x20)) -} -// ---- -// Trace: -// INVALID() -// Memory dump: -// Storage dump: diff --git a/test/libyul/ewasmTranslationTests/log0.yul b/test/libyul/ewasmTranslationTests/log0.yul deleted file mode 100644 index 6b02e598ba3a..000000000000 --- a/test/libyul/ewasmTranslationTests/log0.yul +++ /dev/null @@ -1,8 +0,0 @@ -{ - log0(0x20, 0x40) -} -// ---- -// Trace: -// LOG0() -// Memory dump: -// Storage dump: diff --git a/test/libyul/ewasmTranslationTests/log1.yul b/test/libyul/ewasmTranslationTests/log1.yul deleted file mode 100644 index 296484bd7548..000000000000 --- a/test/libyul/ewasmTranslationTests/log1.yul +++ /dev/null @@ -1,8 +0,0 @@ -{ - log1(0x20, 0x40, 0x60) -} -// ---- -// Trace: -// LOG1() -// Memory dump: -// Storage dump: diff --git a/test/libyul/ewasmTranslationTests/log2.yul b/test/libyul/ewasmTranslationTests/log2.yul deleted file mode 100644 index 887fef66f73f..000000000000 --- a/test/libyul/ewasmTranslationTests/log2.yul +++ /dev/null @@ -1,8 +0,0 @@ -{ - log2(0x20, 0x40, 0x60, 0x80) -} -// ---- -// Trace: -// LOG2() -// Memory dump: -// Storage dump: diff --git a/test/libyul/ewasmTranslationTests/log3.yul b/test/libyul/ewasmTranslationTests/log3.yul deleted file mode 100644 index 8ff23e2bdbd5..000000000000 --- a/test/libyul/ewasmTranslationTests/log3.yul +++ /dev/null @@ -1,8 +0,0 @@ -{ - log3(0x20, 0x40, 0x60, 0x80, 0xa0) -} -// ---- -// Trace: -// LOG3() -// Memory dump: -// Storage dump: diff --git a/test/libyul/ewasmTranslationTests/log4.yul b/test/libyul/ewasmTranslationTests/log4.yul deleted file mode 100644 index 152595e288bc..000000000000 --- a/test/libyul/ewasmTranslationTests/log4.yul +++ /dev/null @@ -1,8 +0,0 @@ -{ - log4(0x20, 0x40, 0x60, 0x80, 0xa0, 0xb0) -} -// ---- -// Trace: -// LOG4() -// Memory dump: -// Storage dump: diff --git a/test/libyul/ewasmTranslationTests/loop_break.yul b/test/libyul/ewasmTranslationTests/loop_break.yul deleted file mode 100644 index b473988d5fbb..000000000000 --- a/test/libyul/ewasmTranslationTests/loop_break.yul +++ /dev/null @@ -1,13 +0,0 @@ -{ - let i := 0 - for { } lt(i, 10) { i := add(i, 1) } { - if eq(i, 3) { break } - } - sstore(0, i) -} -// ---- -// Trace: -// Memory dump: -// 20: 0000000000000000000000000000000000000000000000000000000000000003 -// Storage dump: -// 0000000000000000000000000000000000000000000000000000000000000000: 0000000000000000000000000000000000000000000000000000000000000003 diff --git a/test/libyul/ewasmTranslationTests/loop_continue.yul b/test/libyul/ewasmTranslationTests/loop_continue.yul deleted file mode 100644 index 31200c2fe240..000000000000 --- a/test/libyul/ewasmTranslationTests/loop_continue.yul +++ /dev/null @@ -1,22 +0,0 @@ -{ - let i := 0 - for { } lt(i, 10) { i := add(i, 1) } { - if eq(i, 3) { continue } - sstore(add(i, 0x10), i) - } - sstore(0, i) -} -// ---- -// Trace: -// Memory dump: -// 20: 000000000000000000000000000000000000000000000000000000000000000a -// Storage dump: -// 0000000000000000000000000000000000000000000000000000000000000000: 000000000000000000000000000000000000000000000000000000000000000a -// 0000000000000000000000000000000000000000000000000000000000000011: 0000000000000000000000000000000000000000000000000000000000000001 -// 0000000000000000000000000000000000000000000000000000000000000012: 0000000000000000000000000000000000000000000000000000000000000002 -// 0000000000000000000000000000000000000000000000000000000000000014: 0000000000000000000000000000000000000000000000000000000000000004 -// 0000000000000000000000000000000000000000000000000000000000000015: 0000000000000000000000000000000000000000000000000000000000000005 -// 0000000000000000000000000000000000000000000000000000000000000016: 0000000000000000000000000000000000000000000000000000000000000006 -// 0000000000000000000000000000000000000000000000000000000000000017: 0000000000000000000000000000000000000000000000000000000000000007 -// 0000000000000000000000000000000000000000000000000000000000000018: 0000000000000000000000000000000000000000000000000000000000000008 -// 0000000000000000000000000000000000000000000000000000000000000019: 0000000000000000000000000000000000000000000000000000000000000009 diff --git a/test/libyul/ewasmTranslationTests/memoryguard.yul b/test/libyul/ewasmTranslationTests/memoryguard.yul deleted file mode 100644 index 5aafc88d23b5..000000000000 --- a/test/libyul/ewasmTranslationTests/memoryguard.yul +++ /dev/null @@ -1,12 +0,0 @@ -{ - mstore(0x40, memoryguard(0x0102030405060708)) - sstore(1, mload(0x40)) -} -// ---- -// Trace: -// Memory dump: -// 0: 0000000000000000000000000000000000000000000000000000000000000001 -// 20: 0000000000000000000000000000000000000000000000000102030405060708 -// 80: 0000000000000000000000000000000000000000000000000102030405060708 -// Storage dump: -// 0000000000000000000000000000000000000000000000000000000000000001: 0000000000000000000000000000000000000000000000000102030405060708 diff --git a/test/libyul/ewasmTranslationTests/msize.yul b/test/libyul/ewasmTranslationTests/msize.yul deleted file mode 100644 index b45b2aae07ea..000000000000 --- a/test/libyul/ewasmTranslationTests/msize.yul +++ /dev/null @@ -1,12 +0,0 @@ -{ - sstore(0, msize()) - mstore(0x20, 0x0102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f20) - mstore(0x40, mload(0x20)) - sstore(1, mload(0x40)) - sstore(2, msize()) -} -// ---- -// Trace: -// INVALID() -// Memory dump: -// Storage dump: diff --git a/test/libyul/ewasmTranslationTests/mstore8.yul b/test/libyul/ewasmTranslationTests/mstore8.yul deleted file mode 100644 index 78d10180003f..000000000000 --- a/test/libyul/ewasmTranslationTests/mstore8.yul +++ /dev/null @@ -1,15 +0,0 @@ -{ - mstore(0x30, not(0)) - mstore8(0x20, 0xaa) - mstore8(0x26, 0xcc) - mstore8(0x3b, 0x11) - sstore(0, mload(0x20)) -} -// ---- -// Trace: -// Memory dump: -// 20: aa0000000000cc000000000000000000ffffffffffffffffffffff11ffffffff -// 60: aa0000000000cc000000000000000000ffffffffffffffffffffff11ffffffff -// 80: ffffffffffffffffffffffffffffffff00000000000000000000000000000000 -// Storage dump: -// 0000000000000000000000000000000000000000000000000000000000000000: aa0000000000cc000000000000000000ffffffffffffffffffffff11ffffffff diff --git a/test/libyul/ewasmTranslationTests/mstore_mload.yul b/test/libyul/ewasmTranslationTests/mstore_mload.yul deleted file mode 100644 index 95646abe252f..000000000000 --- a/test/libyul/ewasmTranslationTests/mstore_mload.yul +++ /dev/null @@ -1,14 +0,0 @@ -{ - mstore(0x20, 0x0102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f20) - mstore(0x40, mload(0x20)) - sstore(1, mload(0x40)) -} -// ---- -// Trace: -// Memory dump: -// 0: 0000000000000000000000000000000000000000000000000000000000000001 -// 20: 0102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f20 -// 60: 0102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f20 -// 80: 0102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f20 -// Storage dump: -// 0000000000000000000000000000000000000000000000000000000000000001: 0102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f20 diff --git a/test/libyul/ewasmTranslationTests/number.yul b/test/libyul/ewasmTranslationTests/number.yul deleted file mode 100644 index 83250247aa74..000000000000 --- a/test/libyul/ewasmTranslationTests/number.yul +++ /dev/null @@ -1,9 +0,0 @@ -{ - sstore(0, number()) -} -// ---- -// Trace: -// Memory dump: -// 20: 0000000000000000000000000000000000000000000000000000000000000400 -// Storage dump: -// 0000000000000000000000000000000000000000000000000000000000000000: 0000000000000000000000000000000000000000000000000000000000000400 diff --git a/test/libyul/ewasmTranslationTests/origin.yul b/test/libyul/ewasmTranslationTests/origin.yul deleted file mode 100644 index 16fe9181f268..000000000000 --- a/test/libyul/ewasmTranslationTests/origin.yul +++ /dev/null @@ -1,9 +0,0 @@ -{ - sstore(0, origin()) -} -// ---- -// Trace: -// Memory dump: -// 20: 0000000000000000000000000000000000000000000000000000000033333333 -// Storage dump: -// 0000000000000000000000000000000000000000000000000000000000000000: 0000000000000000000000000000000000000000000000000000000033333333 diff --git a/test/libyul/ewasmTranslationTests/return.yul b/test/libyul/ewasmTranslationTests/return.yul deleted file mode 100644 index bb8b141708a5..000000000000 --- a/test/libyul/ewasmTranslationTests/return.yul +++ /dev/null @@ -1,11 +0,0 @@ -{ - mstore(0x20, 0x1234556677889900aa) - return(0x20, 30) - invalid() -} -// ---- -// Trace: -// RETURN() [000000000000000000000000000000000000000000000012345566778899] -// Memory dump: -// 60: 00000000000000000000000000000000000000000000001234556677889900aa -// Storage dump: diff --git a/test/libyul/ewasmTranslationTests/returndatacopy.yul b/test/libyul/ewasmTranslationTests/returndatacopy.yul deleted file mode 100644 index c90b16f13c82..000000000000 --- a/test/libyul/ewasmTranslationTests/returndatacopy.yul +++ /dev/null @@ -1,10 +0,0 @@ -{ - returndatacopy(0x100, 0, returndatasize()) - sstore(0, mload(0x100)) -} -// ==== -// EVMVersion: >=byzantium -// ---- -// Trace: -// Memory dump: -// Storage dump: diff --git a/test/libyul/ewasmTranslationTests/returndatasize.yul b/test/libyul/ewasmTranslationTests/returndatasize.yul deleted file mode 100644 index b6aea851d662..000000000000 --- a/test/libyul/ewasmTranslationTests/returndatasize.yul +++ /dev/null @@ -1,9 +0,0 @@ -{ - sstore(0, returndatasize()) -} -// ==== -// EVMVersion: >=byzantium -// ---- -// Trace: -// Memory dump: -// Storage dump: diff --git a/test/libyul/ewasmTranslationTests/revert.yul b/test/libyul/ewasmTranslationTests/revert.yul deleted file mode 100644 index fbb5fc272002..000000000000 --- a/test/libyul/ewasmTranslationTests/revert.yul +++ /dev/null @@ -1,13 +0,0 @@ -{ - mstore(0x20, 0x1234556677889900aa) - revert(0x20, 30) - invalid() -} -// ==== -// EVMVersion: >=byzantium -// ---- -// Trace: -// REVERT() [000000000000000000000000000000000000000000000012345566778899] -// Memory dump: -// 60: 00000000000000000000000000000000000000000000001234556677889900aa -// Storage dump: diff --git a/test/libyul/ewasmTranslationTests/selfbalance.yul b/test/libyul/ewasmTranslationTests/selfbalance.yul deleted file mode 100644 index 32037fb5ac25..000000000000 --- a/test/libyul/ewasmTranslationTests/selfbalance.yul +++ /dev/null @@ -1,10 +0,0 @@ -{ - sstore(0, selfbalance()) -} -// ==== -// EVMVersion: >=istanbul -// ---- -// Trace: -// INVALID() -// Memory dump: -// Storage dump: diff --git a/test/libyul/ewasmTranslationTests/selfdestruct.yul b/test/libyul/ewasmTranslationTests/selfdestruct.yul deleted file mode 100644 index c000393fb7c5..000000000000 --- a/test/libyul/ewasmTranslationTests/selfdestruct.yul +++ /dev/null @@ -1,10 +0,0 @@ -{ - selfdestruct(0xffffffffffffffffffffffffffffffffffffffff) - invalid() -} -// ---- -// Trace: -// SELFDESTRUCT() -// Memory dump: -// 0: 000000000000000000000000ffffffffffffffffffffffffffffffffffffffff -// Storage dump: diff --git a/test/libyul/ewasmTranslationTests/shifts.yul b/test/libyul/ewasmTranslationTests/shifts.yul deleted file mode 100644 index c3e9b6036a44..000000000000 --- a/test/libyul/ewasmTranslationTests/shifts.yul +++ /dev/null @@ -1,22 +0,0 @@ -{ - let x := 0x0102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f20 - let y := shl(120, x) - let z := shr(136, y) - sstore(0, y) - sstore(1, z) - sstore(2, sar(136, 0x801112131415161718191a1b1c1d1e1f20000000000000000000000000000000)) - sstore(3, sar(256, 0x801112131415161718191a1b1c1d1e1f20000000000000000000000000000000)) - sstore(4, sar(136, 0x701112131415161718191a1b1c1d1e1f20000000000000000000000000000000)) - sstore(5, sar(256, 0x701112131415161718191a1b1c1d1e1f20000000000000000000000000000000)) -} -// ==== -// EVMVersion: >=constantinople -// ---- -// Trace: -// INVALID() -// Memory dump: -// 0: 0000000000000000000000000000000000000000000000000000000000000001 -// 20: 0000000000000000000000000000000000101112131415161718191a1b1c1d1e -// Storage dump: -// 0000000000000000000000000000000000000000000000000000000000000000: 101112131415161718191a1b1c1d1e1f20000000000000000000000000000000 -// 0000000000000000000000000000000000000000000000000000000000000001: 0000000000000000000000000000000000101112131415161718191a1b1c1d1e diff --git a/test/libyul/ewasmTranslationTests/signextend.yul b/test/libyul/ewasmTranslationTests/signextend.yul deleted file mode 100644 index f39d5926b943..000000000000 --- a/test/libyul/ewasmTranslationTests/signextend.yul +++ /dev/null @@ -1,16 +0,0 @@ -{ - sstore(0, signextend(0, 0x86)) - sstore(1, signextend(0, 0x76)) - sstore(2, signextend(32, not(0))) - sstore(3, signextend(5, 0xff8844553322)) -} -// ---- -// Trace: -// Memory dump: -// 0: 0000000000000000000000000000000000000000000000000000000000000003 -// 20: ffffffffffffffffffffffffffffffffffffffffffffffffffffff8844553322 -// Storage dump: -// 0000000000000000000000000000000000000000000000000000000000000000: ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff86 -// 0000000000000000000000000000000000000000000000000000000000000001: 0000000000000000000000000000000000000000000000000000000000000076 -// 0000000000000000000000000000000000000000000000000000000000000002: ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff -// 0000000000000000000000000000000000000000000000000000000000000003: ffffffffffffffffffffffffffffffffffffffffffffffffffffff8844553322 diff --git a/test/libyul/ewasmTranslationTests/simple_mstore.yul b/test/libyul/ewasmTranslationTests/simple_mstore.yul deleted file mode 100644 index dd9ac1d5eda6..000000000000 --- a/test/libyul/ewasmTranslationTests/simple_mstore.yul +++ /dev/null @@ -1,8 +0,0 @@ -{ - mstore(0x20, 0x0102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f20) -} -// ---- -// Trace: -// Memory dump: -// 60: 0102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f20 -// Storage dump: diff --git a/test/libyul/ewasmTranslationTests/simple_sload.yul b/test/libyul/ewasmTranslationTests/simple_sload.yul deleted file mode 100644 index 6d4131a99e95..000000000000 --- a/test/libyul/ewasmTranslationTests/simple_sload.yul +++ /dev/null @@ -1,16 +0,0 @@ -{ - sstore(1, 7) - sstore(2, sub(0, 1)) - sstore(3, sload(1)) - sstore(4, sload(2)) -} -// ---- -// Trace: -// Memory dump: -// 0: 0000000000000000000000000000000000000000000000000000000000000004 -// 20: ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff -// Storage dump: -// 0000000000000000000000000000000000000000000000000000000000000001: 0000000000000000000000000000000000000000000000000000000000000007 -// 0000000000000000000000000000000000000000000000000000000000000002: ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff -// 0000000000000000000000000000000000000000000000000000000000000003: 0000000000000000000000000000000000000000000000000000000000000007 -// 0000000000000000000000000000000000000000000000000000000000000004: ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff diff --git a/test/libyul/ewasmTranslationTests/simple_sstore.yul b/test/libyul/ewasmTranslationTests/simple_sstore.yul deleted file mode 100644 index 8fbb4923ae2b..000000000000 --- a/test/libyul/ewasmTranslationTests/simple_sstore.yul +++ /dev/null @@ -1,12 +0,0 @@ -{ - sstore(1, 7) - sstore(2, sub(0, 1)) -} -// ---- -// Trace: -// Memory dump: -// 0: 0000000000000000000000000000000000000000000000000000000000000002 -// 20: ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff -// Storage dump: -// 0000000000000000000000000000000000000000000000000000000000000001: 0000000000000000000000000000000000000000000000000000000000000007 -// 0000000000000000000000000000000000000000000000000000000000000002: ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff diff --git a/test/libyul/ewasmTranslationTests/smoke.yul b/test/libyul/ewasmTranslationTests/smoke.yul deleted file mode 100644 index f7f1a1aefb8a..000000000000 --- a/test/libyul/ewasmTranslationTests/smoke.yul +++ /dev/null @@ -1,5 +0,0 @@ -{} -// ---- -// Trace: -// Memory dump: -// Storage dump: diff --git a/test/libyul/ewasmTranslationTests/smoke_call.yul b/test/libyul/ewasmTranslationTests/smoke_call.yul deleted file mode 100644 index 6d93770161e1..000000000000 --- a/test/libyul/ewasmTranslationTests/smoke_call.yul +++ /dev/null @@ -1,10 +0,0 @@ -{ - sstore(0, call(gas(), address(), 42, 0, 0x20, 0x20, 0x20)) -} -// ---- -// Trace: -// CALL() -// Memory dump: -// 20: 0000000000000000000000000000000000000000000000000000000000000001 -// Storage dump: -// 0000000000000000000000000000000000000000000000000000000000000000: 0000000000000000000000000000000000000000000000000000000000000001 diff --git a/test/libyul/ewasmTranslationTests/smoke_callcode.yul b/test/libyul/ewasmTranslationTests/smoke_callcode.yul deleted file mode 100644 index dd22ef261178..000000000000 --- a/test/libyul/ewasmTranslationTests/smoke_callcode.yul +++ /dev/null @@ -1,10 +0,0 @@ -{ - sstore(0, callcode(gas(), address(), 42, 0, 0x20, 0x20, 0x20)) -} -// ---- -// Trace: -// CALLCODE() -// Memory dump: -// 20: 0000000000000000000000000000000000000000000000000000000000000001 -// Storage dump: -// 0000000000000000000000000000000000000000000000000000000000000000: 0000000000000000000000000000000000000000000000000000000000000001 diff --git a/test/libyul/ewasmTranslationTests/smoke_create.yul b/test/libyul/ewasmTranslationTests/smoke_create.yul deleted file mode 100644 index 7650e9e6c140..000000000000 --- a/test/libyul/ewasmTranslationTests/smoke_create.yul +++ /dev/null @@ -1,11 +0,0 @@ -{ - let size := codesize() - codecopy(0, 0, size) - sstore(0, create(42, 0, size)) -} -// ---- -// Trace: -// CREATE() -// Memory dump: -// 40: 636f6465636f6465636f6465636f6465636f6465000000000000000000000000 -// Storage dump: diff --git a/test/libyul/ewasmTranslationTests/smoke_create2.yul b/test/libyul/ewasmTranslationTests/smoke_create2.yul deleted file mode 100644 index 32d789ea9abb..000000000000 --- a/test/libyul/ewasmTranslationTests/smoke_create2.yul +++ /dev/null @@ -1,13 +0,0 @@ -{ - let size := codesize() - codecopy(0x40, 0, size) - sstore(0, create2(42, 0, size, 0x20)) -} -// ==== -// EVMVersion: >=constantinople -// ---- -// Trace: -// INVALID() -// Memory dump: -// 80: 636f6465636f6465636f6465636f6465636f6465000000000000000000000000 -// Storage dump: diff --git a/test/libyul/ewasmTranslationTests/smoke_delegatecall.yul b/test/libyul/ewasmTranslationTests/smoke_delegatecall.yul deleted file mode 100644 index 30ad4b96d220..000000000000 --- a/test/libyul/ewasmTranslationTests/smoke_delegatecall.yul +++ /dev/null @@ -1,10 +0,0 @@ -{ - sstore(0, delegatecall(gas(), address(), 0, 0x20, 0x20, 0x20)) -} -// ---- -// Trace: -// DELEGATECALL() -// Memory dump: -// 20: 0000000000000000000000000000000000000000000000000000000000000001 -// Storage dump: -// 0000000000000000000000000000000000000000000000000000000000000000: 0000000000000000000000000000000000000000000000000000000000000001 diff --git a/test/libyul/ewasmTranslationTests/smoke_staticcall.yul b/test/libyul/ewasmTranslationTests/smoke_staticcall.yul deleted file mode 100644 index 25faaa9ee93c..000000000000 --- a/test/libyul/ewasmTranslationTests/smoke_staticcall.yul +++ /dev/null @@ -1,12 +0,0 @@ -{ - sstore(0, staticcall(gas(), address(), 0, 0x20, 0x20, 0x20)) -} -// ==== -// EVMVersion: >=byzantium -// ---- -// Trace: -// STATICCALL() -// Memory dump: -// 20: 0000000000000000000000000000000000000000000000000000000000000001 -// Storage dump: -// 0000000000000000000000000000000000000000000000000000000000000000: 0000000000000000000000000000000000000000000000000000000000000001 diff --git a/test/libyul/ewasmTranslationTests/timestamp.yul b/test/libyul/ewasmTranslationTests/timestamp.yul deleted file mode 100644 index 9982590dfdc0..000000000000 --- a/test/libyul/ewasmTranslationTests/timestamp.yul +++ /dev/null @@ -1,9 +0,0 @@ -{ - sstore(0, timestamp()) -} -// ---- -// Trace: -// Memory dump: -// 20: 0000000000000000000000000000000000000000000000000000000088888888 -// Storage dump: -// 0000000000000000000000000000000000000000000000000000000000000000: 0000000000000000000000000000000000000000000000000000000088888888 diff --git a/test/libyul/objectCompiler/data.yul b/test/libyul/objectCompiler/data.yul index 611715b6535d..caa6499218db 100644 --- a/test/libyul/objectCompiler/data.yul +++ b/test/libyul/objectCompiler/data.yul @@ -5,8 +5,10 @@ object "a" { } // ---- // Assembly: +// /* "source":20:22 */ +// stop // stop // data_acaf3289d7b601cbd114fb36c4d29c85bbfd5e133f14cb355c3fd8d99367964f 48656c6c6f2c20576f726c6421 -// Bytecode: fe -// Opcodes: INVALID -// SourceMappings: +// Bytecode: 00fe +// Opcodes: STOP INVALID +// SourceMappings: 20:2:0:-:0 diff --git a/test/libyul/objectCompiler/datacopy.yul b/test/libyul/objectCompiler/datacopy.yul index a5fbfb7b0bcb..cb9fbcb18ba2 100644 --- a/test/libyul/objectCompiler/datacopy.yul +++ b/test/libyul/objectCompiler/datacopy.yul @@ -42,9 +42,11 @@ object "a" { // 0x00 // /* "source":178:206 */ // mstore +// /* "source":135:212 */ +// stop // stop // data_acaf3289d7b601cbd114fb36c4d29c85bbfd5e133f14cb355c3fd8d99367964f 48656c6c6f2c20576f726c6421 // } -// Bytecode: 6008600b5f3960085ff3fe5f8055600d5f52fe -// Opcodes: PUSH1 0x8 PUSH1 0xB PUSH0 CODECOPY PUSH1 0x8 PUSH0 RETURN INVALID PUSH0 DUP1 SSTORE PUSH1 0xD PUSH0 MSTORE INVALID +// Bytecode: 6009600b5f3960095ff3fe5f8055600d5f5200fe +// Opcodes: PUSH1 0x9 PUSH1 0xB PUSH0 CODECOPY PUSH1 0x9 PUSH0 RETURN INVALID PUSH0 DUP1 SSTORE PUSH1 0xD PUSH0 MSTORE STOP INVALID // SourceMappings: 57:15:0:-:0;38:17;35:1;26:47;88:15;85:1;78:26 diff --git a/test/libyul/objectCompiler/dataoffset_code.yul b/test/libyul/objectCompiler/dataoffset_code.yul index e363ec7c6129..58521c87f9be 100644 --- a/test/libyul/objectCompiler/dataoffset_code.yul +++ b/test/libyul/objectCompiler/dataoffset_code.yul @@ -13,6 +13,8 @@ object "a" { // 0x00 // /* "source":22:50 */ // sstore +// /* "source":20:52 */ +// stop // stop // // sub_0: assembly { @@ -22,9 +24,11 @@ object "a" { // 0x00 // /* "source":81:93 */ // sstore +// /* "source":79:95 */ +// stop // stop // data_acaf3289d7b601cbd114fb36c4d29c85bbfd5e133f14cb355c3fd8d99367964f 48656c6c6f2c20576f726c6421 // } -// Bytecode: 60055f55fe60085f55fe -// Opcodes: PUSH1 0x5 PUSH0 SSTORE INVALID PUSH1 0x8 PUSH0 SSTORE INVALID -// SourceMappings: 32:17:0:-:0;29:1;22:28 +// Bytecode: 60065f5500fe60085f5500fe +// Opcodes: PUSH1 0x6 PUSH0 SSTORE STOP INVALID PUSH1 0x8 PUSH0 SSTORE STOP INVALID +// SourceMappings: 32:17:0:-:0;29:1;22:28;20:32 diff --git a/test/libyul/objectCompiler/dataoffset_data.yul b/test/libyul/objectCompiler/dataoffset_data.yul index 2bb68e8a8a90..61f0c4418957 100644 --- a/test/libyul/objectCompiler/dataoffset_data.yul +++ b/test/libyul/objectCompiler/dataoffset_data.yul @@ -10,8 +10,10 @@ object "a" { // 0x00 // /* "source":22:52 */ // sstore +// /* "source":20:54 */ +// stop // stop // data_acaf3289d7b601cbd114fb36c4d29c85bbfd5e133f14cb355c3fd8d99367964f 48656c6c6f2c20576f726c6421 -// Bytecode: 60055f55fe48656c6c6f2c20576f726c6421 -// Opcodes: PUSH1 0x5 PUSH0 SSTORE INVALID BASEFEE PUSH6 0x6C6C6F2C2057 PUSH16 0x726C6421000000000000000000000000 -// SourceMappings: 32:19:0:-:0;29:1;22:30 +// Bytecode: 60065f5500fe48656c6c6f2c20576f726c6421 +// Opcodes: PUSH1 0x6 PUSH0 SSTORE STOP INVALID BASEFEE PUSH6 0x6C6C6F2C2057 PUSH16 0x726C6421000000000000000000000000 +// SourceMappings: 32:19:0:-:0;29:1;22:30;20:34 diff --git a/test/libyul/objectCompiler/dataoffset_self.yul b/test/libyul/objectCompiler/dataoffset_self.yul index e56097ab573c..7c38b9502a1b 100644 --- a/test/libyul/objectCompiler/dataoffset_self.yul +++ b/test/libyul/objectCompiler/dataoffset_self.yul @@ -10,8 +10,10 @@ object "a" { // dup1 // /* "source":22:48 */ // sstore +// /* "source":20:50 */ +// stop // stop // data_acaf3289d7b601cbd114fb36c4d29c85bbfd5e133f14cb355c3fd8d99367964f 48656c6c6f2c20576f726c6421 -// Bytecode: 5f8055fe -// Opcodes: PUSH0 DUP1 SSTORE INVALID -// SourceMappings: 32:15:0:-:0;29:1;22:26 +// Bytecode: 5f805500fe +// Opcodes: PUSH0 DUP1 SSTORE STOP INVALID +// SourceMappings: 32:15:0:-:0;29:1;22:26;20:30 diff --git a/test/libyul/objectCompiler/datasize_code.yul b/test/libyul/objectCompiler/datasize_code.yul index 0a379cb33aa8..4e559ab895c6 100644 --- a/test/libyul/objectCompiler/datasize_code.yul +++ b/test/libyul/objectCompiler/datasize_code.yul @@ -13,6 +13,8 @@ object "a" { // 0x00 // /* "source":22:48 */ // sstore +// /* "source":20:50 */ +// stop // stop // // sub_0: assembly { @@ -22,9 +24,11 @@ object "a" { // 0x00 // /* "source":79:91 */ // sstore +// /* "source":77:93 */ +// stop // stop // data_acaf3289d7b601cbd114fb36c4d29c85bbfd5e133f14cb355c3fd8d99367964f 48656c6c6f2c20576f726c6421 // } -// Bytecode: 60055f55fe -// Opcodes: PUSH1 0x5 PUSH0 SSTORE INVALID -// SourceMappings: 32:15:0:-:0;29:1;22:26 +// Bytecode: 60065f5500fe +// Opcodes: PUSH1 0x6 PUSH0 SSTORE STOP INVALID +// SourceMappings: 32:15:0:-:0;29:1;22:26;20:30 diff --git a/test/libyul/objectCompiler/datasize_data.yul b/test/libyul/objectCompiler/datasize_data.yul index 815e78fe4fa4..3281bd9ba7c3 100644 --- a/test/libyul/objectCompiler/datasize_data.yul +++ b/test/libyul/objectCompiler/datasize_data.yul @@ -10,8 +10,10 @@ object "a" { // 0x00 // /* "source":22:50 */ // sstore +// /* "source":20:52 */ +// stop // stop // data_acaf3289d7b601cbd114fb36c4d29c85bbfd5e133f14cb355c3fd8d99367964f 48656c6c6f2c20576f726c6421 -// Bytecode: 600d5f55fe -// Opcodes: PUSH1 0xD PUSH0 SSTORE INVALID -// SourceMappings: 32:17:0:-:0;29:1;22:28 +// Bytecode: 600d5f5500fe +// Opcodes: PUSH1 0xD PUSH0 SSTORE STOP INVALID +// SourceMappings: 32:17:0:-:0;29:1;22:28;20:32 diff --git a/test/libyul/objectCompiler/datasize_self.yul b/test/libyul/objectCompiler/datasize_self.yul index 178e3a948246..6bc520af58e7 100644 --- a/test/libyul/objectCompiler/datasize_self.yul +++ b/test/libyul/objectCompiler/datasize_self.yul @@ -10,8 +10,10 @@ object "a" { // 0x00 // /* "source":22:46 */ // sstore +// /* "source":20:48 */ +// stop // stop // data_acaf3289d7b601cbd114fb36c4d29c85bbfd5e133f14cb355c3fd8d99367964f 48656c6c6f2c20576f726c6421 -// Bytecode: 60055f55fe -// Opcodes: PUSH1 0x5 PUSH0 SSTORE INVALID -// SourceMappings: 32:13:0:-:0;29:1;22:24 +// Bytecode: 60065f5500fe +// Opcodes: PUSH1 0x6 PUSH0 SSTORE STOP INVALID +// SourceMappings: 32:13:0:-:0;29:1;22:24;20:28 diff --git a/test/libyul/objectCompiler/function_series.yul b/test/libyul/objectCompiler/function_series.yul index 10a018160a81..7be2db96b923 100644 --- a/test/libyul/objectCompiler/function_series.yul +++ b/test/libyul/objectCompiler/function_series.yul @@ -3,6 +3,10 @@ object "Contract" { function f() {} function g() {} sstore(0, 1) + + // NOTE: msize forces the compiler to completely disable the Yul optimizer. + // Otherwise the functions would get optimized out. + pop(msize()) } } @@ -26,6 +30,10 @@ object "Contract" { // 0x00 // /* "source":73:85 */ // sstore -// Bytecode: 6009565b5b565b5b565b60015f55 -// Opcodes: PUSH1 0x9 JUMP JUMPDEST JUMPDEST JUMP JUMPDEST JUMPDEST JUMP JUMPDEST PUSH1 0x1 PUSH0 SSTORE -// SourceMappings: 33:15:0:-:0;;;;:::o;53:::-;;:::o;:::-;83:1;80;73:12 +// /* "source":231:238 */ +// msize +// /* "source":227:239 */ +// pop +// Bytecode: 6009565b5b565b5b565b60015f555950 +// Opcodes: PUSH1 0x9 JUMP JUMPDEST JUMPDEST JUMP JUMPDEST JUMPDEST JUMP JUMPDEST PUSH1 0x1 PUSH0 SSTORE MSIZE POP +// SourceMappings: 33:15:0:-:0;;;;:::o;53:::-;;:::o;:::-;83:1;80;73:12;231:7;227:12 diff --git a/test/libyul/objectCompiler/immutable_long_name_does_not_end_up_in_bytecode.yul b/test/libyul/objectCompiler/immutable_long_name_does_not_end_up_in_bytecode.yul index e991dc6b7bd1..285a8a8d548d 100644 --- a/test/libyul/objectCompiler/immutable_long_name_does_not_end_up_in_bytecode.yul +++ b/test/libyul/objectCompiler/immutable_long_name_does_not_end_up_in_bytecode.yul @@ -15,6 +15,8 @@ object "a" { // 0x00 // /* "source":32:219 */ // assignImmutable("0x85a5b1db611c82c46f5fa18e39ae218397536256c451e5de155a86de843a9ad6") -// Bytecode: 7312345678901234567890123456789012345678905f5050 -// Opcodes: PUSH20 0x1234567890123456789012345678901234567890 PUSH0 POP POP -// SourceMappings: 167:42:0:-:0;58:1;32:187; +// /* "source":22:225 */ +// stop +// Bytecode: 7312345678901234567890123456789012345678905f505000 +// Opcodes: PUSH20 0x1234567890123456789012345678901234567890 PUSH0 POP POP STOP +// SourceMappings: 167:42:0:-:0;58:1;32:187;;22:203 diff --git a/test/libyul/objectCompiler/jump_tags.yul b/test/libyul/objectCompiler/jump_tags.yul index ba0984b1022e..0d1f1ff791ab 100644 --- a/test/libyul/objectCompiler/jump_tags.yul +++ b/test/libyul/objectCompiler/jump_tags.yul @@ -3,6 +3,10 @@ object "Contract" { function f() { g(1) } function g(x) { if x { leave } g(add(x, 2)) } g(1) + + // NOTE: msize forces the compiler to completely disable the Yul optimizer. + // Otherwise f() would get optimized out. + pop(msize()) } } @@ -62,6 +66,10 @@ object "Contract" { // tag_2 // jump // in // tag_9: -// Bytecode: 6026565b600b6001600e565b5b565b8015601857506024565b602260028201600e565b505b565b602e6001600e565b -// Opcodes: PUSH1 0x26 JUMP JUMPDEST PUSH1 0xB PUSH1 0x1 PUSH1 0xE JUMP JUMPDEST JUMPDEST JUMP JUMPDEST DUP1 ISZERO PUSH1 0x18 JUMPI POP PUSH1 0x24 JUMP JUMPDEST PUSH1 0x22 PUSH1 0x2 DUP3 ADD PUSH1 0xE JUMP JUMPDEST POP JUMPDEST JUMP JUMPDEST PUSH1 0x2E PUSH1 0x1 PUSH1 0xE JUMP JUMPDEST -// SourceMappings: 33:21:0:-:0;;;48:4;50:1;48:4;:::i;:::-;33:21;:::o;59:45::-;78:1;75:14;;;82:5;;;75:14;90:12;99:1;96;92:9;90:12;:::i;:::-;59:45;;:::o;:::-;109:4;111:1;109:4;:::i;:::- +// /* "source":249:256 */ +// msize +// /* "source":245:257 */ +// pop +// Bytecode: 6026565b600b6001600e565b5b565b8015601857506024565b602260028201600e565b505b565b602e6001600e565b5950 +// Opcodes: PUSH1 0x26 JUMP JUMPDEST PUSH1 0xB PUSH1 0x1 PUSH1 0xE JUMP JUMPDEST JUMPDEST JUMP JUMPDEST DUP1 ISZERO PUSH1 0x18 JUMPI POP PUSH1 0x24 JUMP JUMPDEST PUSH1 0x22 PUSH1 0x2 DUP3 ADD PUSH1 0xE JUMP JUMPDEST POP JUMPDEST JUMP JUMPDEST PUSH1 0x2E PUSH1 0x1 PUSH1 0xE JUMP JUMPDEST MSIZE POP +// SourceMappings: 33:21:0:-:0;;;48:4;50:1;48:4;:::i;:::-;33:21;:::o;59:45::-;78:1;75:14;;;82:5;;;75:14;90:12;99:1;96;92:9;90:12;:::i;:::-;59:45;;:::o;:::-;109:4;111:1;109:4;:::i;:::-;249:7;245:12 diff --git a/test/libyul/objectCompiler/linkersymbol.yul b/test/libyul/objectCompiler/linkersymbol.yul index a28ee23e23e0..c4da288e618f 100644 --- a/test/libyul/objectCompiler/linkersymbol.yul +++ b/test/libyul/objectCompiler/linkersymbol.yul @@ -7,7 +7,15 @@ object "a" { } // ---- // Assembly: +// /* "source":179:180 */ +// 0x00 +// /* "source":174:177 */ +// 0x80 +// /* "source":171:172 */ +// 0x04 // /* "source":44:79 */ +// dup2 +// dup4 // linkerSymbol("f919ba91ac99f96129544b80b9516b27a80e376b9dc693819d0b18b7e0395612") // /* "source":109:119 */ // 0x18530aaf @@ -15,29 +23,15 @@ object "a" { // 0xe3 // /* "source":100:120 */ // shl -// /* "source":95:98 */ -// 0x80 // /* "source":88:121 */ +// dup4 // mstore -// /* "source":179:180 */ -// 0x00 -// /* "source":174:177 */ -// 0x80 -// /* "source":171:172 */ -// 0x04 -// /* "source":166:169 */ -// 0x80 -// /* "source":163:164 */ -// 0x00 -// /* "source":157:161 */ -// dup6 // /* "source":150:155 */ // gas // /* "source":145:181 */ // call -// /* "source":22:187 */ -// pop -// pop -// Bytecode: 7300000000000000000000000000000000000000006318530aaf60e31b6080525f6080600460805f855af15050 -// Opcodes: PUSH20 0x0 PUSH4 0x18530AAF PUSH1 0xE3 SHL PUSH1 0x80 MSTORE PUSH0 PUSH1 0x80 PUSH1 0x4 PUSH1 0x80 PUSH0 DUP6 GAS CALL POP POP -// SourceMappings: 44:35:0:-:0;109:10;104:3;100:20;95:3;88:33;179:1;174:3;171:1;166:3;163:1;157:4;150:5;145:36;22:165; +// /* "source":130:181 */ +// stop +// Bytecode: 5f6080600481837300000000000000000000000000000000000000006318530aaf60e31b83525af100 +// Opcodes: PUSH0 PUSH1 0x80 PUSH1 0x4 DUP2 DUP4 PUSH20 0x0 PUSH4 0x18530AAF PUSH1 0xE3 SHL DUP4 MSTORE GAS CALL STOP +// SourceMappings: 179:1:0:-:0;174:3;171:1;44:35;;;109:10;104:3;100:20;88:33;;150:5;145:36;130:51 diff --git a/test/libyul/objectCompiler/metadata.yul b/test/libyul/objectCompiler/metadata.yul index 5a75507ba129..335522d04d2b 100644 --- a/test/libyul/objectCompiler/metadata.yul +++ b/test/libyul/objectCompiler/metadata.yul @@ -25,21 +25,18 @@ object "A" { // 0x0e // /* "source":62:75 */ // 0x03 -// /* "source":90:91 */ -// dup2 +// /* "source":80:92 */ +// swap1 // /* "source":87:88 */ // 0x00 // /* "source":80:92 */ // sstore -// /* "source":108:109 */ -// dup1 // /* "source":104:106 */ // 0x20 // /* "source":97:110 */ // sstore // /* "source":20:114 */ -// pop -// pop +// stop // stop // data_211450822d7f8c345093893187e7e1fbebc4ec67af72601920194be14104e336 48656c6c6f2c20576f726c643221 // data_e1629b9dda060bb30c7908346f6af189c16773fa148d3366701fbaa35d54f3c8 414243 @@ -47,14 +44,12 @@ object "A" { // sub_0: assembly { // /* "source":157:176 */ // data_211450822d7f8c345093893187e7e1fbebc4ec67af72601920194be14104e336 -// /* "source":193:194 */ -// dup1 // /* "source":190:191 */ // 0x00 // /* "source":183:195 */ // sstore // /* "source":140:201 */ -// pop +// stop // stop // data_211450822d7f8c345093893187e7e1fbebc4ec67af72601920194be14104e336 48656c6c6f2c20576f726c643221 // @@ -62,6 +57,6 @@ object "A" { // } // // auxdata: 0x4d32 -// Bytecode: 600e6003815f55806020555050fe4d32 -// Opcodes: PUSH1 0xE PUSH1 0x3 DUP2 PUSH0 SSTORE DUP1 PUSH1 0x20 SSTORE POP POP INVALID 0x4D ORIGIN -// SourceMappings: 35:13:0:-:0;62;90:1;87;80:12;108:1;104:2;97:13;20:94; +// Bytecode: 600e6003905f5560205500fe4d32 +// Opcodes: PUSH1 0xE PUSH1 0x3 SWAP1 PUSH0 SSTORE PUSH1 0x20 SSTORE STOP INVALID 0x4D ORIGIN +// SourceMappings: 35:13:0:-:0;62;80:12;87:1;80:12;104:2;97:13;20:94 diff --git a/test/libyul/objectCompiler/namedObject.yul b/test/libyul/objectCompiler/namedObject.yul index 940160fd26e1..d55c3ca25335 100644 --- a/test/libyul/objectCompiler/namedObject.yul +++ b/test/libyul/objectCompiler/namedObject.yul @@ -3,4 +3,8 @@ object "a" { } // ---- // Assembly: -// -- empty bytecode -- +// /* "source":20:22 */ +// stop +// Bytecode: 00 +// Opcodes: STOP +// SourceMappings: 20:2:0:-:0 diff --git a/test/libyul/objectCompiler/namedObjectCode.yul b/test/libyul/objectCompiler/namedObjectCode.yul index f9e97bec4af3..5936aa744337 100644 --- a/test/libyul/objectCompiler/namedObjectCode.yul +++ b/test/libyul/objectCompiler/namedObjectCode.yul @@ -9,6 +9,8 @@ object "a" { // 0x00 // /* "source":22:34 */ // sstore -// Bytecode: 60015f55 -// Opcodes: PUSH1 0x1 PUSH0 SSTORE -// SourceMappings: 32:1:0:-:0;29;22:12 +// /* "source":20:36 */ +// stop +// Bytecode: 60015f5500 +// Opcodes: PUSH1 0x1 PUSH0 SSTORE STOP +// SourceMappings: 32:1:0:-:0;29;22:12;20:16 diff --git a/test/libyul/objectCompiler/simple.yul b/test/libyul/objectCompiler/simple.yul index d94b53de9020..b84c49a5a43d 100644 --- a/test/libyul/objectCompiler/simple.yul +++ b/test/libyul/objectCompiler/simple.yul @@ -9,6 +9,8 @@ // 0x00 // /* "source":4:16 */ // sstore -// Bytecode: 60015f55 -// Opcodes: PUSH1 0x1 PUSH0 SSTORE -// SourceMappings: 14:1:0:-:0;11;4:12 +// /* "source":0:18 */ +// stop +// Bytecode: 60015f5500 +// Opcodes: PUSH1 0x1 PUSH0 SSTORE STOP +// SourceMappings: 14:1:0:-:0;11;4:12;0:18 diff --git a/test/libyul/objectCompiler/smoke.yul b/test/libyul/objectCompiler/smoke.yul index b2e44d4dcd82..3f1079aa7090 100644 --- a/test/libyul/objectCompiler/smoke.yul +++ b/test/libyul/objectCompiler/smoke.yul @@ -2,4 +2,8 @@ } // ---- // Assembly: -// -- empty bytecode -- +// /* "source":0:3 */ +// stop +// Bytecode: 00 +// Opcodes: STOP +// SourceMappings: 0:3:0:-:0 diff --git a/test/libyul/objectCompiler/sourceLocations.yul b/test/libyul/objectCompiler/sourceLocations.yul index 849d275fec2e..1c84773249d7 100644 --- a/test/libyul/objectCompiler/sourceLocations.yul +++ b/test/libyul/objectCompiler/sourceLocations.yul @@ -46,9 +46,10 @@ object "a" { // sstore // /* "abc.sol":2:5 */ // mstore(0x00, 0x0d) +// stop // stop // data_acaf3289d7b601cbd114fb36c4d29c85bbfd5e133f14cb355c3fd8d99367964f 48656c6c6f2c20576f726c6421 // } -// Bytecode: 6008600b5f3960085ff3fe5f8055600d5f52fe -// Opcodes: PUSH1 0x8 PUSH1 0xB PUSH0 CODECOPY PUSH1 0x8 PUSH0 RETURN INVALID PUSH0 DUP1 SSTORE PUSH1 0xD PUSH0 MSTORE INVALID +// Bytecode: 6009600b5f3960095ff3fe5f8055600d5f5200fe +// Opcodes: PUSH1 0x9 PUSH1 0xB PUSH0 CODECOPY PUSH1 0x9 PUSH0 RETURN INVALID PUSH0 DUP1 SSTORE PUSH1 0xD PUSH0 MSTORE STOP INVALID // SourceMappings: 0:2::-:0;;;;5:1;0:2; diff --git a/test/libyul/objectCompiler/subObject.yul b/test/libyul/objectCompiler/subObject.yul index f99b071af5cb..46fc03f10ea8 100644 --- a/test/libyul/objectCompiler/subObject.yul +++ b/test/libyul/objectCompiler/subObject.yul @@ -6,6 +6,8 @@ object "a" { } // ---- // Assembly: +// /* "source":20:22 */ +// stop // stop // data_acaf3289d7b601cbd114fb36c4d29c85bbfd5e133f14cb355c3fd8d99367964f 48656c6c6f2c20576f726c6421 // @@ -16,7 +18,9 @@ object "a" { // 0x00 // /* "source":139:151 */ // sstore +// /* "source":137:153 */ +// stop // } -// Bytecode: fe -// Opcodes: INVALID -// SourceMappings: +// Bytecode: 00fe +// Opcodes: STOP INVALID +// SourceMappings: 20:2:0:-:0 diff --git a/test/libyul/objectCompiler/subObjectAccess.yul b/test/libyul/objectCompiler/subObjectAccess.yul index e8bf0bcafc2c..291749220a45 100644 --- a/test/libyul/objectCompiler/subObjectAccess.yul +++ b/test/libyul/objectCompiler/subObjectAccess.yul @@ -80,69 +80,55 @@ object "A" { // /* "source":192:207 */ // dataSize(sub_0.sub_0) // /* "source":224:241 */ +// swap1 // dataOffset(sub_0.sub_1) // /* "source":258:273 */ +// swap3 // dataSize(sub_0.sub_1) // /* "source":291:310 */ +// swap5 // dataOffset(sub_0.sub_0.sub_0) // /* "source":328:345 */ +// swap7 // dataSize(sub_0.sub_0.sub_0) -// /* "source":361:364 */ -// dup10 +// /* "source":351:365 */ +// swap9 // /* "source":358:359 */ // 0x00 // /* "source":351:365 */ // sstore -// /* "source":381:384 */ -// dup9 // /* "source":377:379 */ // 0x20 // /* "source":370:385 */ // sstore -// /* "source":401:404 */ -// dup8 // /* "source":397:399 */ // 0x40 // /* "source":390:405 */ // sstore -// /* "source":421:424 */ -// dup7 // /* "source":417:419 */ // 0x60 // /* "source":410:425 */ // sstore -// /* "source":442:446 */ -// dup6 // /* "source":437:440 */ // 0x80 // /* "source":430:447 */ // sstore -// /* "source":464:468 */ -// dup5 // /* "source":459:462 */ // 0xa0 // /* "source":452:469 */ // sstore -// /* "source":486:490 */ -// dup4 // /* "source":481:484 */ // 0xc0 // /* "source":474:491 */ // sstore -// /* "source":508:512 */ -// dup3 // /* "source":503:506 */ // 0xe0 // /* "source":496:513 */ // sstore -// /* "source":530:535 */ -// dup2 // /* "source":525:528 */ // 0x0100 // /* "source":518:536 */ // sstore -// /* "source":553:558 */ -// dup1 // /* "source":548:551 */ // 0x0120 // /* "source":541:559 */ @@ -166,41 +152,33 @@ object "A" { // /* "source":756:769 */ // dataSize(sub_1) // /* "source":788:805 */ +// swap1 // dataOffset(sub_0.sub_0) // /* "source":824:839 */ +// swap3 // dataSize(sub_0.sub_0) -// /* "source":857:860 */ -// dup6 +// /* "source":847:861 */ +// swap5 // /* "source":854:855 */ // 0x00 // /* "source":847:861 */ // sstore -// /* "source":879:882 */ -// dup5 // /* "source":875:877 */ // 0x20 // /* "source":868:883 */ // sstore -// /* "source":901:904 */ -// dup4 // /* "source":897:899 */ // 0x40 // /* "source":890:905 */ // sstore -// /* "source":923:926 */ -// dup3 // /* "source":919:921 */ // 0x60 // /* "source":912:927 */ // sstore -// /* "source":946:950 */ -// dup2 // /* "source":941:944 */ // 0x80 // /* "source":934:951 */ // sstore -// /* "source":970:974 */ -// dup1 // /* "source":965:968 */ // 0xa0 // /* "source":958:975 */ @@ -218,14 +196,12 @@ object "A" { // dataOffset(sub_0) // /* "source":1087:1100 */ // dataSize(sub_0) -// /* "source":1120:1123 */ -// dup2 +// /* "source":1110:1124 */ +// swap1 // /* "source":1117:1118 */ // 0x00 // /* "source":1110:1124 */ // sstore -// /* "source":1144:1147 */ -// dup1 // /* "source":1140:1142 */ // 0x20 // /* "source":1133:1148 */ @@ -249,6 +225,6 @@ object "A" { // invalid // } // } -// Bytecode: 5f608e6042603a607d6011607c6001607c6001895f55886020558760405586606055856080558460a0558360c0558260e055816101005580610120556101405ff3fe602860116039600160396001855f55846020558360405582606055816080558060a05560c05ff3fe60106001815f558060205560405ff3fefefefe60106001815f558060205560405ff3fefe -// Opcodes: PUSH0 PUSH1 0x8E PUSH1 0x42 PUSH1 0x3A PUSH1 0x7D PUSH1 0x11 PUSH1 0x7C PUSH1 0x1 PUSH1 0x7C PUSH1 0x1 DUP10 PUSH0 SSTORE DUP9 PUSH1 0x20 SSTORE DUP8 PUSH1 0x40 SSTORE DUP7 PUSH1 0x60 SSTORE DUP6 PUSH1 0x80 SSTORE DUP5 PUSH1 0xA0 SSTORE DUP4 PUSH1 0xC0 SSTORE DUP3 PUSH1 0xE0 SSTORE DUP2 PUSH2 0x100 SSTORE DUP1 PUSH2 0x120 SSTORE PUSH2 0x140 PUSH0 RETURN INVALID PUSH1 0x28 PUSH1 0x11 PUSH1 0x39 PUSH1 0x1 PUSH1 0x39 PUSH1 0x1 DUP6 PUSH0 SSTORE DUP5 PUSH1 0x20 SSTORE DUP4 PUSH1 0x40 SSTORE DUP3 PUSH1 0x60 SSTORE DUP2 PUSH1 0x80 SSTORE DUP1 PUSH1 0xA0 SSTORE PUSH1 0xC0 PUSH0 RETURN INVALID PUSH1 0x10 PUSH1 0x1 DUP2 PUSH0 SSTORE DUP1 PUSH1 0x20 SSTORE PUSH1 0x40 PUSH0 RETURN INVALID INVALID INVALID INVALID PUSH1 0x10 PUSH1 0x1 DUP2 PUSH0 SSTORE DUP1 PUSH1 0x20 SSTORE PUSH1 0x40 PUSH0 RETURN INVALID INVALID -// SourceMappings: 37:15:0:-:0;68:13;97:15;128:13;158:17;192:15;224:17;258:15;291:19;328:17;361:3;358:1;351:14;381:3;377:2;370:15;401:3;397:2;390:15;421:3;417:2;410:15;442:4;437:3;430:17;464:4;459:3;452:17;486:4;481:3;474:17;508:4;503:3;496:17;530:5;525:3;518:18;553:5;548:3;541:18;574:3;571:1;564:14 +// Bytecode: 5f6084603d603660746010906073926001946073966001985f5560205560405560605560805560a05560c05560e05561010055610120556101405ff3fe6025601060356001906035926001945f5560205560405560605560805560a05560c05ff3fe600f6001905f5560205560405ff3fefefefe600f6001905f5560205560405ff3fefe +// Opcodes: PUSH0 PUSH1 0x84 PUSH1 0x3D PUSH1 0x36 PUSH1 0x74 PUSH1 0x10 SWAP1 PUSH1 0x73 SWAP3 PUSH1 0x1 SWAP5 PUSH1 0x73 SWAP7 PUSH1 0x1 SWAP9 PUSH0 SSTORE PUSH1 0x20 SSTORE PUSH1 0x40 SSTORE PUSH1 0x60 SSTORE PUSH1 0x80 SSTORE PUSH1 0xA0 SSTORE PUSH1 0xC0 SSTORE PUSH1 0xE0 SSTORE PUSH2 0x100 SSTORE PUSH2 0x120 SSTORE PUSH2 0x140 PUSH0 RETURN INVALID PUSH1 0x25 PUSH1 0x10 PUSH1 0x35 PUSH1 0x1 SWAP1 PUSH1 0x35 SWAP3 PUSH1 0x1 SWAP5 PUSH0 SSTORE PUSH1 0x20 SSTORE PUSH1 0x40 SSTORE PUSH1 0x60 SSTORE PUSH1 0x80 SSTORE PUSH1 0xA0 SSTORE PUSH1 0xC0 PUSH0 RETURN INVALID PUSH1 0xF PUSH1 0x1 SWAP1 PUSH0 SSTORE PUSH1 0x20 SSTORE PUSH1 0x40 PUSH0 RETURN INVALID INVALID INVALID INVALID PUSH1 0xF PUSH1 0x1 SWAP1 PUSH0 SSTORE PUSH1 0x20 SSTORE PUSH1 0x40 PUSH0 RETURN INVALID INVALID +// SourceMappings: 37:15:0:-:0;68:13;97:15;128:13;158:17;192:15;224:17;;258:15;;291:19;;328:17;;351:14;358:1;351:14;377:2;370:15;397:2;390:15;417:2;410:15;437:3;430:17;459:3;452:17;481:3;474:17;503:3;496:17;525:3;518:18;548:3;541:18;574:3;571:1;564:14 diff --git a/test/libyul/objectCompiler/subSubObject.yul b/test/libyul/objectCompiler/subSubObject.yul index a36f97619e94..a9936d58fbdb 100644 --- a/test/libyul/objectCompiler/subSubObject.yul +++ b/test/libyul/objectCompiler/subSubObject.yul @@ -12,6 +12,8 @@ object "a" { } // ---- // Assembly: +// /* "source":20:22 */ +// stop // stop // data_acaf3289d7b601cbd114fb36c4d29c85bbfd5e133f14cb355c3fd8d99367964f 48656c6c6f2c20576f726c6421 // @@ -22,6 +24,8 @@ object "a" { // 0x00 // /* "source":143:155 */ // sstore +// /* "source":141:157 */ +// stop // stop // // sub_0: assembly { @@ -31,10 +35,12 @@ object "a" { // 0x02 // /* "source":193:205 */ // sstore +// /* "source":191:207 */ +// stop // stop // data_6adf031833174bbe4c85eafe59ddb54e6584648c2c962c6f94791ab49caa0ad4 123456 // } // } -// Bytecode: fe -// Opcodes: INVALID -// SourceMappings: +// Bytecode: 00fe +// Opcodes: STOP INVALID +// SourceMappings: 20:2:0:-:0 diff --git a/test/libyul/objectCompiler/wasm/no_main_function.yul b/test/libyul/objectCompiler/wasm/no_main_function.yul deleted file mode 100644 index 2dd91a166236..000000000000 --- a/test/libyul/objectCompiler/wasm/no_main_function.yul +++ /dev/null @@ -1,22 +0,0 @@ -{ - function not_main() { - i64.drop(i64.add(0, 1)) - } -} -// ==== -// wasm: true -// ---- -// Text: -// (module -// (memory $memory (export "memory") 1) -// -// (func $not_main -// (block $label_ -// (drop (i64.add (i64.const 0) (i64.const 1))) -// ) -// ) -// -// ) -// -// Binary: -// 0061736d01000000010401600000020100030201000503010001060100070a01066d656d6f727902000a0d010b000240420042017c1a0b0b diff --git a/test/libyul/objectCompiler/wasm/simple.yul b/test/libyul/objectCompiler/wasm/simple.yul deleted file mode 100644 index b158aea52bf0..000000000000 --- a/test/libyul/objectCompiler/wasm/simple.yul +++ /dev/null @@ -1,23 +0,0 @@ -{ - function main() { - i64.drop(i64.add(0, 1)) - } -} -// ==== -// wasm: true -// ---- -// Text: -// (module -// (memory $memory (export "memory") 1) -// (export "main" (func $main)) -// -// (func $main -// (block $label_ -// (drop (i64.add (i64.const 0) (i64.const 1))) -// ) -// ) -// -// ) -// -// Binary: -// 0061736d01000000010401600000020100030201000503010001060100071102066d656d6f72790200046d61696e00000a0d010b000240420042017c1a0b0b diff --git a/test/libyul/objectCompiler/wasm/subObject.yul b/test/libyul/objectCompiler/wasm/subObject.yul deleted file mode 100644 index 683e64be1e98..000000000000 --- a/test/libyul/objectCompiler/wasm/subObject.yul +++ /dev/null @@ -1,22 +0,0 @@ -object "a" { - code {} - // Unreferenced data is not added to the assembled bytecode. - data "str" "Hello, World!" - object "sub" { code { function main() { i64.drop(11) } } } -} -// ==== -// wasm: true -// ---- -// Text: -// (module -// ;; custom section for sub-module -// ;; The Keccak-256 hash of the text representation of "sub": 78ac3419d75c8d6f42f663717b8e964eeb994d77ff175145133084422dbd23d7 -// ;; (@custom "sub" "0061736d01000000010401600000020100030201000503010001060100071102066d656d6f72790200046d61696e00000a0a0108000240420b1a0b0b") -// ;; custom section for data -// ;; (@custom "str" "48656c6c6f2c20576f726c6421") -// (memory $memory (export "memory") 1) -// -// ) -// -// Binary: -// 0061736d010000000101000201000301000503010001060100070a01066d656d6f727902000040037375620061736d01000000010401600000020100030201000503010001060100071102066d656d6f72790200046d61696e00000a0a0108000240420b1a0b0b00110373747248656c6c6f2c20576f726c64210a0100 diff --git a/test/libyul/objectCompiler/wasm/subObjectAccess.yul b/test/libyul/objectCompiler/wasm/subObjectAccess.yul deleted file mode 100644 index 8acced97f69d..000000000000 --- a/test/libyul/objectCompiler/wasm/subObjectAccess.yul +++ /dev/null @@ -1,79 +0,0 @@ -object "A" { - code { - function main() { - // TODO: support this - // i64.drop(dataoffset("A")) - // i64.drop(datasize("A")) - i64.drop(dataoffset("B")) - i64.drop(datasize("B")) - // TODO: support sub-subobjects - // i64.drop(dataoffset("B.C")) - // i64.drop(datasize("B.C")) - // i64.drop(dataoffset("B.E")) - // i64.drop(datasize("B.E")) - // i64.drop(dataoffset("B.C.D")) - // i64.drop(datasize("B.C.D")) - } - } - - data "data1" "Hello, World!" - - object "B" { - code { - function main() { - i64.drop(dataoffset("C")) - i64.drop(datasize("C")) - i64.drop(dataoffset("E")) - i64.drop(datasize("E")) - // i64.drop(dataoffset("C.D")) - // i64.drop(datasize("C.D")) - } - } - object "C" { - code { - function main() { - i64.drop(dataoffset("D")) - i64.drop(datasize("D")) - } - } - object "D" { - code { - function main() { - unreachable() - } - } - } - } - object "E" { - code { - function main() { - unreachable() - } - } - } - } -} -// ==== -// wasm: true -// ---- -// Text: -// (module -// ;; custom section for sub-module -// ;; The Keccak-256 hash of the text representation of "B": ccfc48ce1c0d0542ffd25ae6858777b2f7b8a6d2b6608f679458182e719f5434 -// ;; (@custom "B" "0061736d01000000010401600000020100030201000503010001060100071102066d656d6f72790200046d61696e0000007f01430061736d01000000010401600000020100030201000503010001060100071102066d656d6f72790200046d61696e0000003c01440061736d01000000010401600000020100030201000503010001060100071102066d656d6f72790200046d61696e00000a080106000240000b0b0a0d010b00024042341a423a1a0b0b003c01450061736d01000000010401600000020100030201000503010001060100071102066d656d6f72790200046d61696e00000a080106000240000b0b0a15011300024042341a42fd001a42b5011a423a1a0b0b") -// ;; custom section for data -// ;; (@custom "data1" "48656c6c6f2c20576f726c6421") -// (memory $memory (export "memory") 1) -// (export "main" (func $main)) -// -// (func $main -// (block $label_ -// (drop (dataoffset "B")) -// (drop (datasize "B")) -// ) -// ) -// -// ) -// -// Binary: -// 0061736d01000000010401600000020100030201000503010001060100071102066d656d6f72790200046d61696e000000880201420061736d01000000010401600000020100030201000503010001060100071102066d656d6f72790200046d61696e0000007f01430061736d01000000010401600000020100030201000503010001060100071102066d656d6f72790200046d61696e0000003c01440061736d01000000010401600000020100030201000503010001060100071102066d656d6f72790200046d61696e00000a080106000240000b0b0a0d010b00024042341a423a1a0b0b003c01450061736d01000000010401600000020100030201000503010001060100071102066d656d6f72790200046d61696e00000a080106000240000b0b0a15011300024042341a42fd001a42b5011a423a1a0b0b001305646174613148656c6c6f2c20576f726c64210a0e010c00024042351a4286021a0b0b diff --git a/test/libyul/yulOptimizerTests/conditionalSimplifier/add_correct_type_wasm.yul b/test/libyul/yulOptimizerTests/conditionalSimplifier/add_correct_type_wasm.yul deleted file mode 100644 index de92aad7aefa..000000000000 --- a/test/libyul/yulOptimizerTests/conditionalSimplifier/add_correct_type_wasm.yul +++ /dev/null @@ -1,19 +0,0 @@ -{ - let y:i32 := 0:i32 - for {} true { } { - if y { break } - } -} -// ==== -// dialect: ewasm -// ---- -// step: conditionalSimplifier -// -// { -// let y:i32 := 0:i32 -// for { } true { } -// { -// if y { break } -// y := false -// } -// } diff --git a/test/libyul/yulOptimizerTests/expressionSplitter/typed.yul b/test/libyul/yulOptimizerTests/expressionSplitter/typed.yul deleted file mode 100644 index 4bae497d6392..000000000000 --- a/test/libyul/yulOptimizerTests/expressionSplitter/typed.yul +++ /dev/null @@ -1,43 +0,0 @@ -{ - function fun(x: i32, y) -> t: i32, z: i32 { - z := i32.add(x, i32.add(z, z)) - - } - i64.store(i32.load(5:i32), i64.load(8:i32)) - let i := 0 - for {} i32.eqz(i32.load(9:i32)) { i := i64.add(i, 1) } { - let f: i32, g: i32 := fun(i32.load(1:i32), i64.load(i32.load(0: i32))) - } -} -// ==== -// dialect: ewasm -// ---- -// step: expressionSplitter -// -// { -// function fun(x:i32, y) -> t:i32, z:i32 -// { -// let _1:i32 := i32.add(z, z) -// z := i32.add(x, _1) -// } -// let _2:i32 := 8:i32 -// let _3 := i64.load(_2) -// let _4:i32 := 5:i32 -// let _5:i32 := i32.load(_4) -// i64.store(_5, _3) -// let i := 0 -// for { } -// i32.eqz(i32.load(9:i32)) -// { -// let _6 := 1 -// i := i64.add(i, _6) -// } -// { -// let _7:i32 := 0:i32 -// let _8:i32 := i32.load(_7) -// let _9 := i64.load(_8) -// let _10:i32 := 1:i32 -// let _11:i32 := i32.load(_10) -// let f:i32, g:i32 := fun(_11, _9) -// } -// } diff --git a/test/libyul/yulOptimizerTests/fakeStackLimitEvader/connected.yul b/test/libyul/yulOptimizerTests/fakeStackLimitEvader/connected.yul index 82ab48a513b2..99e92c183edc 100644 --- a/test/libyul/yulOptimizerTests/fakeStackLimitEvader/connected.yul +++ b/test/libyul/yulOptimizerTests/fakeStackLimitEvader/connected.yul @@ -36,13 +36,13 @@ // } // function f() -> x // { -// mstore(0x20, 0) -// mstore(0x20, 42) +// mstore(0x40, 0) +// mstore(0x40, 42) // let $x3_4, $x4_5 := g() // mstore(0x00, $x4_5) -// mstore(0x40, $x3_4) -// x := mul(add(mload(0x20), mload(0x40)), h(mload(0x00))) -// sstore(mload(0x40), mload(0x00)) +// mstore(0x20, $x3_4) +// x := mul(add(mload(0x40), mload(0x20)), h(mload(0x00))) +// sstore(mload(0x20), mload(0x00)) // } // function h(v) -> a_1 // { diff --git a/test/libyul/yulOptimizerTests/fakeStackLimitEvader/stub.yul b/test/libyul/yulOptimizerTests/fakeStackLimitEvader/stub.yul index d2fcb116ea74..e86619e464b2 100644 --- a/test/libyul/yulOptimizerTests/fakeStackLimitEvader/stub.yul +++ b/test/libyul/yulOptimizerTests/fakeStackLimitEvader/stub.yul @@ -30,10 +30,10 @@ // mstore(0x40, memoryguard(0x80)) // function f() // { -// mstore(0x40, 0) -// mstore(0x60, 42) -// sstore(mload(0x40), mload(0x60)) -// mstore(0x40, 21) +// mstore(0x60, 0) +// mstore(0x40, 42) +// sstore(mload(0x60), mload(0x40)) +// mstore(0x60, 21) // } // function g(gx) // { @@ -60,9 +60,9 @@ // { // let $hx_9, $hy_10, $hz_11, $hw_12 := tuple4() // mstore(0x00, $hw_12) -// mstore(0x60, $hz_11) +// mstore(0x20, $hz_11) // mstore(0x40, $hy_10) -// mstore(0x20, $hx_9) +// mstore(0x60, $hx_9) // { // let hx_13, $hy_14, hz_15, $hw_16 := tuple4() // mstore(0x00, $hw_16) @@ -73,7 +73,7 @@ // { // let $hx_17, $hy_18, hz_19, hw_20 := tuple4() // mstore(0x40, $hy_18) -// mstore(0x20, $hx_17) +// mstore(0x60, $hx_17) // hw := hw_20 // hz := hz_19 // } diff --git a/test/libyul/yulOptimizerTests/fullInliner/call_arguments_with_side_effects.yul b/test/libyul/yulOptimizerTests/fullInliner/call_arguments_with_side_effects.yul new file mode 100644 index 000000000000..94b0c72d2934 --- /dev/null +++ b/test/libyul/yulOptimizerTests/fullInliner/call_arguments_with_side_effects.yul @@ -0,0 +1,29 @@ +{ + function fun_revert() -> ret { revert(0, 0) } + function fun_return() -> ret { return(0, 0) } + function empty(a, b) {} + + // Evaluation order in Yul is right to left so fun_revert() should run first. + empty(fun_return(), fun_revert()) +} +// ---- +// step: fullInliner +// +// { +// { +// let ret_7 := 0 +// revert(0, 0) +// let _1 := ret_7 +// let ret_1_10 := 0 +// return(0, 0) +// let _2 := ret_1_10 +// let b_13 := _1 +// let a_14 := _2 +// } +// function fun_revert() -> ret +// { revert(0, 0) } +// function fun_return() -> ret_1 +// { return(0, 0) } +// function empty(a, b) +// { } +// } diff --git a/test/libyul/yulOptimizerTests/fullInliner/call_arguments_without_side_effects.yul b/test/libyul/yulOptimizerTests/fullInliner/call_arguments_without_side_effects.yul new file mode 100644 index 000000000000..747ac8084912 --- /dev/null +++ b/test/libyul/yulOptimizerTests/fullInliner/call_arguments_without_side_effects.yul @@ -0,0 +1,51 @@ +{ + function empty(a, b, c) {} + + // Constants + empty(111, 222, 333) + + // Variables + let x := 111 + let y := 222 + let z := 333 + empty(x, y, z) + + // Calls + empty(mload(111), sload(222), calldataload(333)) + + // Mix + let a := 222 + empty(111, a, mload(333)) +} +// ---- +// step: fullInliner +// +// { +// { +// let _1 := 333 +// let _2 := 222 +// let _3 := 111 +// let c_13 := _1 +// let b_14 := _2 +// let a_15 := _3 +// let x := 111 +// let y := 222 +// let c_16 := 333 +// let b_17 := y +// let a_18 := x +// let _5 := calldataload(333) +// let _7 := sload(222) +// let _9 := mload(111) +// let c_19 := _5 +// let b_20 := _7 +// let a_21 := _9 +// let a_1 := 222 +// let _11 := mload(333) +// let _12 := 111 +// let c_22 := _11 +// let b_23 := a_1 +// let a_24 := _12 +// } +// function empty(a, b, c) +// { } +// } diff --git a/test/libyul/yulOptimizerTests/fullInliner/move_up_rightwards_argument.yul b/test/libyul/yulOptimizerTests/fullInliner/move_up_rightwards_argument.yul index 7bc959ec8f58..1f777237ac82 100644 --- a/test/libyul/yulOptimizerTests/fullInliner/move_up_rightwards_argument.yul +++ b/test/libyul/yulOptimizerTests/fullInliner/move_up_rightwards_argument.yul @@ -13,12 +13,13 @@ // let _2 := mload(5) // let _4 := mload(4) // let _6 := mload(3) -// let a_13 := mload(2) +// let _8 := mload(2) +// let c_13 := _4 // let b_14 := _6 -// let c_15 := _4 +// let a_15 := _8 // let x_16 := 0 -// x_16 := add(a_13, b_14) -// x_16 := mul(x_16, c_15) +// x_16 := add(a_15, b_14) +// x_16 := mul(x_16, c_13) // let _10 := add(x_16, _2) // let y := add(mload(1), _10) // } diff --git a/test/libyul/yulOptimizerTests/fullInliner/multi_fun.yul b/test/libyul/yulOptimizerTests/fullInliner/multi_fun.yul index a5194457a408..b30078cb61f4 100644 --- a/test/libyul/yulOptimizerTests/fullInliner/multi_fun.yul +++ b/test/libyul/yulOptimizerTests/fullInliner/multi_fun.yul @@ -12,13 +12,14 @@ // let a_8 := 3 // let x_9 := 0 // x_9 := add(a_8, a_8) -// let b_10 := x_9 -// let c_11 := _1 +// let _3 := x_9 +// let c_10 := _1 +// let b_11 := _3 // let y_12 := 0 -// let a_6_13 := b_10 +// let a_6_13 := b_11 // let x_7_14 := 0 // x_7_14 := add(a_6_13, a_6_13) -// y_12 := mul(mload(c_11), x_7_14) +// y_12 := mul(mload(c_10), x_7_14) // let y_1 := y_12 // } // function f(a) -> x diff --git a/test/libyul/yulOptimizerTests/fullInlinerWithoutSplitter/call_arguments_with_side_effects.yul b/test/libyul/yulOptimizerTests/fullInlinerWithoutSplitter/call_arguments_with_side_effects.yul new file mode 100644 index 000000000000..a89dd89137d5 --- /dev/null +++ b/test/libyul/yulOptimizerTests/fullInlinerWithoutSplitter/call_arguments_with_side_effects.yul @@ -0,0 +1,22 @@ +{ + function fun_revert() -> ret { revert(0, 0) } + function fun_return() -> ret { return(0, 0) } + function empty(a, b) {} + + // Evaluation order in Yul is right to left so fun_revert() should run first. + empty(fun_return(), fun_revert()) +} +// ---- +// step: fullInlinerWithoutSplitter +// +// { +// { +// empty(fun_return(), fun_revert()) +// } +// function fun_revert() -> ret +// { revert(0, 0) } +// function fun_return() -> ret_1 +// { return(0, 0) } +// function empty(a, b) +// { } +// } diff --git a/test/libyul/yulOptimizerTests/fullInlinerWithoutSplitter/call_arguments_without_side_effects.yul b/test/libyul/yulOptimizerTests/fullInlinerWithoutSplitter/call_arguments_without_side_effects.yul new file mode 100644 index 000000000000..8f903b48445d --- /dev/null +++ b/test/libyul/yulOptimizerTests/fullInlinerWithoutSplitter/call_arguments_without_side_effects.yul @@ -0,0 +1,40 @@ +{ + function empty(a, b, c) {} + + // Constants + empty(111, 222, 333) + + // Variables + let x := 111 + let y := 222 + let z := 333 + empty(x, y, z) + + // Calls + empty(mload(111), sload(222), calldataload(333)) + + // Mix + let a := 222 + empty(111, a, mload(333)) +} +// ---- +// step: fullInlinerWithoutSplitter +// +// { +// { +// let c_1 := 333 +// let b_2 := 222 +// let a_3 := 111 +// let x := 111 +// let y := 222 +// let z := 333 +// let c_4 := z +// let b_5 := y +// let a_6 := x +// empty(mload(111), sload(222), calldataload(333)) +// let a_1 := 222 +// empty(111, a_1, mload(333)) +// } +// function empty(a, b, c) +// { } +// } diff --git a/test/libyul/yulOptimizerTests/fullInlinerWithoutSplitter/simple.sol b/test/libyul/yulOptimizerTests/fullInlinerWithoutSplitter/simple.sol new file mode 100644 index 000000000000..80b975903ca7 --- /dev/null +++ b/test/libyul/yulOptimizerTests/fullInlinerWithoutSplitter/simple.sol @@ -0,0 +1,19 @@ +{ + function f(a) -> x { + x := add(a, a) + } + let y := f(2) +} +// ---- +// step: fullInlinerWithoutSplitter +// +// { +// { +// let a_1 := 2 +// let x_2 := 0 +// x_2 := add(a_1, a_1) +// let y := x_2 +// } +// function f(a) -> x +// { x := add(a, a) } +// } diff --git a/test/libyul/yulOptimizerTests/fullSuite/call_arguments_with_side_effects.yul b/test/libyul/yulOptimizerTests/fullSuite/call_arguments_with_side_effects.yul new file mode 100644 index 000000000000..c8c969d8846d --- /dev/null +++ b/test/libyul/yulOptimizerTests/fullSuite/call_arguments_with_side_effects.yul @@ -0,0 +1,12 @@ +{ + function fun_revert() -> ret { revert(0, 0) } + function fun_return() -> ret { return(0, 0) } + function empty(a, b) {} + + // Evaluation order in Yul is always right to left so optimized code should reach the revert first. + empty(fun_return(), fun_revert()) +} +// ---- +// step: fullSuite +// +// { { revert(0, 0) } } diff --git a/test/libyul/yulOptimizerTests/fullSuite/call_arguments_without_side_effects.yul b/test/libyul/yulOptimizerTests/fullSuite/call_arguments_without_side_effects.yul new file mode 100644 index 000000000000..fc36bdfa37a0 --- /dev/null +++ b/test/libyul/yulOptimizerTests/fullSuite/call_arguments_without_side_effects.yul @@ -0,0 +1,48 @@ +{ + function empty(a, b, c) { + mstore(a, 1) + mstore(b, 1) + mstore(c, 1) + } + + // Constants + empty(1, 2, 3) + + // Variables + let x := 4 + let y := 5 + let z := 6 + empty(x, y, z) + + // Calls + empty(mload(7), sload(8), calldataload(9)) + + // Mix + let a := 12 + empty(11, a, mload(13)) + + return(0, 32) +} +// ---- +// step: fullSuite +// +// { +// { +// let _1 := 1 +// mstore(_1, _1) +// mstore(2, _1) +// mstore(3, _1) +// mstore(4, _1) +// mstore(5, _1) +// mstore(6, _1) +// let _2 := sload(8) +// mstore(mload(7), _1) +// mstore(_2, _1) +// mstore(calldataload(9), _1) +// let _3 := mload(13) +// mstore(11, _1) +// mstore(12, _1) +// mstore(_3, _1) +// return(0, 32) +// } +// } diff --git a/test/libyul/yulOptimizerTests/reasoningBasedSimplifier/arith.yul b/test/libyul/yulOptimizerTests/reasoningBasedSimplifier/arith.yul deleted file mode 100644 index 7ff930766342..000000000000 --- a/test/libyul/yulOptimizerTests/reasoningBasedSimplifier/arith.yul +++ /dev/null @@ -1,13 +0,0 @@ -{ - let x := 7 - let y := 8 - if eq(add(x, y), 15) { } -} -// ---- -// step: reasoningBasedSimplifier -// -// { -// let x := 7 -// let y := 8 -// if 1 { } -// } diff --git a/test/libyul/yulOptimizerTests/reasoningBasedSimplifier/arith_movable.yul b/test/libyul/yulOptimizerTests/reasoningBasedSimplifier/arith_movable.yul deleted file mode 100644 index 2080a678c0bf..000000000000 --- a/test/libyul/yulOptimizerTests/reasoningBasedSimplifier/arith_movable.yul +++ /dev/null @@ -1,19 +0,0 @@ -{ - function f() -> z - { - z := 15 - } - let x := 7 - let y := 8 - if eq(add(x, y), f()) { } -} -// ---- -// step: reasoningBasedSimplifier -// -// { -// function f() -> z -// { z := 15 } -// let x := 7 -// let y := 8 -// if eq(add(x, y), f()) { } -// } diff --git a/test/libyul/yulOptimizerTests/reasoningBasedSimplifier/arith_non_movable.yul b/test/libyul/yulOptimizerTests/reasoningBasedSimplifier/arith_non_movable.yul deleted file mode 100644 index ed50224d02a6..000000000000 --- a/test/libyul/yulOptimizerTests/reasoningBasedSimplifier/arith_non_movable.yul +++ /dev/null @@ -1,23 +0,0 @@ -{ - function f() -> z - { - sstore(1, 15) - z := 15 - } - let x := 7 - let y := 8 - if eq(add(x, y), f()) { } -} -// ---- -// step: reasoningBasedSimplifier -// -// { -// function f() -> z -// { -// sstore(1, 15) -// z := 15 -// } -// let x := 7 -// let y := 8 -// if eq(add(x, y), f()) { } -// } diff --git a/test/libyul/yulOptimizerTests/reasoningBasedSimplifier/mulcheck.yul b/test/libyul/yulOptimizerTests/reasoningBasedSimplifier/mulcheck.yul deleted file mode 100644 index 31a342339332..000000000000 --- a/test/libyul/yulOptimizerTests/reasoningBasedSimplifier/mulcheck.yul +++ /dev/null @@ -1,32 +0,0 @@ -{ - let vloc_x := calldataload(0) - let vloc_y := calldataload(1) - if lt(vloc_x, shl(100, 1)) { - if lt(vloc_y, shl(100, 1)) { - if iszero(and(iszero(iszero(vloc_x)), gt(vloc_y, div(not(0), vloc_x)))) { - let vloc := mul(vloc_x, vloc_y) - sstore(0, vloc) - } - } - } -} -// ==== -// EVMVersion: >=constantinople -// ---- -// step: reasoningBasedSimplifier -// -// { -// let vloc_x := calldataload(0) -// let vloc_y := calldataload(1) -// if lt(vloc_x, shl(100, 1)) -// { -// if lt(vloc_y, shl(100, 1)) -// { -// if 1 -// { -// let vloc := mul(vloc_x, vloc_y) -// sstore(0, vloc) -// } -// } -// } -// } diff --git a/test/libyul/yulOptimizerTests/reasoningBasedSimplifier/mulmod.yul b/test/libyul/yulOptimizerTests/reasoningBasedSimplifier/mulmod.yul deleted file mode 100644 index f5226acf7743..000000000000 --- a/test/libyul/yulOptimizerTests/reasoningBasedSimplifier/mulmod.yul +++ /dev/null @@ -1,31 +0,0 @@ -{ - let x := calldataload(0) - let y := calldataload(32) - let z := calldataload(64) - let result := mulmod(x, y, z) - - // should be zero - if gt(result, z) { sstore(0, 1) } - - // mulmod is equal to mod of product for small numbers - if and(and(lt(x, 1000), lt(y, 1000)), lt(z, 1000)) { - if eq(result, mod(mul(x, y), z)) { sstore(0, 9) } - } - - // but not in general - if and(and(gt(x, sub(0, 5)), eq(y, 2)), eq(z, 3)) { - if eq(result, mod(mul(x, y), z)) { sstore(0, 5) } - } -} -// ---- -// step: reasoningBasedSimplifier -// -// { -// let x := calldataload(0) -// let y := calldataload(32) -// let z := calldataload(64) -// let result := mulmod(x, y, z) -// if 0 { } -// if and(and(lt(x, 1000), lt(y, 1000)), lt(z, 1000)) { if 1 { sstore(0, 9) } } -// if and(and(gt(x, sub(0, 5)), eq(y, 2)), eq(z, 3)) { if 0 { } } -// } diff --git a/test/libyul/yulOptimizerTests/reasoningBasedSimplifier/negative_rounding.yul b/test/libyul/yulOptimizerTests/reasoningBasedSimplifier/negative_rounding.yul deleted file mode 100644 index 6e4b3f5edee3..000000000000 --- a/test/libyul/yulOptimizerTests/reasoningBasedSimplifier/negative_rounding.yul +++ /dev/null @@ -1,16 +0,0 @@ -{ - let x := sub(0, 7) - let y := 2 - // (-7)/2 == -3 on the evm - if iszero(add(sdiv(x, y), 3)) { } - if iszero(add(sdiv(x, y), 4)) { } -} -// ---- -// step: reasoningBasedSimplifier -// -// { -// let x := sub(0, 7) -// let y := 2 -// if 1 { } -// if 0 { } -// } diff --git a/test/libyul/yulOptimizerTests/reasoningBasedSimplifier/nested.yul b/test/libyul/yulOptimizerTests/reasoningBasedSimplifier/nested.yul deleted file mode 100644 index d7002c99b561..000000000000 --- a/test/libyul/yulOptimizerTests/reasoningBasedSimplifier/nested.yul +++ /dev/null @@ -1,26 +0,0 @@ -{ - let x := calldataload(2) - let t := lt(x, 20) - if t { - if lt(x, 21) { } - if lt(x, 20) { } - if lt(x, 19) { } - if gt(x, 20) { } - if iszero(gt(x, 20)) { } - } -} -// ---- -// step: reasoningBasedSimplifier -// -// { -// let x := calldataload(2) -// let t := lt(x, 20) -// if t -// { -// if 1 { } -// if 1 { } -// if lt(x, 19) { } -// if 0 { } -// if 1 { } -// } -// } diff --git a/test/libyul/yulOptimizerTests/reasoningBasedSimplifier/signed_division.yul b/test/libyul/yulOptimizerTests/reasoningBasedSimplifier/signed_division.yul deleted file mode 100644 index 1e409079e8a7..000000000000 --- a/test/libyul/yulOptimizerTests/reasoningBasedSimplifier/signed_division.yul +++ /dev/null @@ -1,31 +0,0 @@ -{ - let y := calldataload(0) - let t := calldataload(32) - - if sgt(sub(y, 1), y) { - // y - 1 > y, i.e. y is the most negative value - if eq(sdiv(y, sub(0, 1)), y) { - // should be true: y / -1 == y - sstore(0, 7) - } - if iszero(eq(y, t)) { - // t is not the most negative value - if eq(sdiv(t, sub(0, 1)), sub(0, t)) { - // should be true: t / -1 = 0 - t - sstore(1, 7) - } - } - } -} -// ---- -// step: reasoningBasedSimplifier -// -// { -// let y := calldataload(0) -// let t := calldataload(32) -// if sgt(sub(y, 1), y) -// { -// if 1 { sstore(0, 7) } -// if iszero(eq(y, t)) { if 1 { sstore(1, 7) } } -// } -// } diff --git a/test/libyul/yulOptimizerTests/reasoningBasedSimplifier/smod.yul b/test/libyul/yulOptimizerTests/reasoningBasedSimplifier/smod.yul deleted file mode 100644 index 12f04c857cc7..000000000000 --- a/test/libyul/yulOptimizerTests/reasoningBasedSimplifier/smod.yul +++ /dev/null @@ -1,53 +0,0 @@ -{ - // 7 % 5 == 2 - // 7 % -5 == 2 - // -7 % 5 == -2 - // -7 % -5 == -2 - // -5 % -5 == 0 - let x := calldataload(0) - let y := calldataload(32) - let result := smod(x, y) - if eq(x, 7) { - if eq(y, 5) { - if eq(result, 2) { sstore(0, 7)} - } - if eq(y, sub(0, 5)) { - if eq(result, 2) { sstore(0, 7)} - } - } - if eq(x, sub(0, 7)) { - if eq(y, 5) { - if eq(result, sub(0, 2)) { sstore(0, 7)} - } - if eq(y, sub(0, 5)) { - if eq(result, sub(0, 2)) { sstore(0, 7)} - } - } - if eq(x, sub(0, 5)) { - if eq(y, sub(0, 5)) { - if eq(result, 0) { sstore(0, 7)} - } - } -} -// ---- -// step: reasoningBasedSimplifier -// -// { -// let x := calldataload(0) -// let y := calldataload(32) -// let result := smod(x, y) -// if eq(x, 7) -// { -// if eq(y, 5) { if 1 { sstore(0, 7) } } -// if eq(y, sub(0, 5)) { if 1 { sstore(0, 7) } } -// } -// if eq(x, sub(0, 7)) -// { -// if eq(y, 5) { if 1 { sstore(0, 7) } } -// if eq(y, sub(0, 5)) { if 1 { sstore(0, 7) } } -// } -// if eq(x, sub(0, 5)) -// { -// if eq(y, sub(0, 5)) { if 1 { sstore(0, 7) } } -// } -// } diff --git a/test/libyul/yulOptimizerTests/reasoningBasedSimplifier/smoke.yul b/test/libyul/yulOptimizerTests/reasoningBasedSimplifier/smoke.yul deleted file mode 100644 index 6f860dc13242..000000000000 --- a/test/libyul/yulOptimizerTests/reasoningBasedSimplifier/smoke.yul +++ /dev/null @@ -1,5 +0,0 @@ -{ } -// ---- -// step: reasoningBasedSimplifier -// -// { } diff --git a/test/libyul/yulOptimizerTests/reasoningBasedSimplifier/wrapping.yul b/test/libyul/yulOptimizerTests/reasoningBasedSimplifier/wrapping.yul deleted file mode 100644 index 69f5c6769757..000000000000 --- a/test/libyul/yulOptimizerTests/reasoningBasedSimplifier/wrapping.yul +++ /dev/null @@ -1,15 +0,0 @@ -{ - let x := 7 - let y := 8 - if gt(sub(x, y), 20) { } - if eq(sub(x, y), 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) {} -} -// ---- -// step: reasoningBasedSimplifier -// -// { -// let x := 7 -// let y := 8 -// if 1 { } -// if 1 { } -// } diff --git a/test/libyul/yulOptimizerTests/stackLimitEvader/too_many_args_14.yul b/test/libyul/yulOptimizerTests/stackLimitEvader/too_many_args_14.yul index 74c74e36f301..02614c492db8 100644 --- a/test/libyul/yulOptimizerTests/stackLimitEvader/too_many_args_14.yul +++ b/test/libyul/yulOptimizerTests/stackLimitEvader/too_many_args_14.yul @@ -39,17 +39,17 @@ // mstore(0x0140, b12) // mstore(0x0120, b13) // mstore(0x0100, b14) -// mstore(0xc0, b17) -// mstore(0xa0, b18) -// mstore(0x80, b19) -// mstore(0xe0, b29) +// mstore(0xe0, b17) +// mstore(0xc0, b18) +// mstore(0xa0, b19) +// mstore(0x80, b29) // sstore(0, mload(0x0100)) // sstore(1, b15) // sstore(2, b16) -// sstore(3, mload(0xc0)) -// sstore(4, mload(0xa0)) -// sstore(5, mload(0x80)) -// sstore(6, mload(0xe0)) -// v := add(mload(0x02a0), mload(0xe0)) +// sstore(3, mload(0xe0)) +// sstore(4, mload(0xc0)) +// sstore(5, mload(0xa0)) +// sstore(6, mload(0x80)) +// v := add(mload(0x02a0), mload(0x80)) // } // } diff --git a/test/libyul/yulOptimizerTests/stackLimitEvader/too_many_args_15.yul b/test/libyul/yulOptimizerTests/stackLimitEvader/too_many_args_15.yul index 8df48f3768eb..9ce9be70ab88 100644 --- a/test/libyul/yulOptimizerTests/stackLimitEvader/too_many_args_15.yul +++ b/test/libyul/yulOptimizerTests/stackLimitEvader/too_many_args_15.yul @@ -42,20 +42,20 @@ // mstore(0x0160, b13) // mstore(0x0140, b14) // mstore(0x0120, b15) -// mstore(0xc0, b17) -// mstore(0xa0, b18) -// mstore(0x80, b19) -// mstore(0xe0, b29) -// mstore(0x0100, b30) +// mstore(0x0100, b17) +// mstore(0xe0, b18) +// mstore(0xc0, b19) +// mstore(0xa0, b29) +// mstore(0x80, b30) // sstore(0, mload(0x0140)) // sstore(1, mload(0x0120)) // sstore(2, b16) -// sstore(3, mload(0xc0)) -// sstore(4, mload(0xa0)) -// sstore(5, mload(0x80)) -// sstore(6, mload(0xe0)) -// sstore(7, mload(0x0100)) -// v := mload(0x0100) -// sstore(mload(0x02e0), mload(0x0100)) +// sstore(3, mload(0x0100)) +// sstore(4, mload(0xe0)) +// sstore(5, mload(0xc0)) +// sstore(6, mload(0xa0)) +// sstore(7, mload(0x80)) +// v := mload(0x80) +// sstore(mload(0x02e0), mload(0x80)) // } // } diff --git a/test/libyul/yulOptimizerTests/stackLimitEvader/too_many_args_16.yul b/test/libyul/yulOptimizerTests/stackLimitEvader/too_many_args_16.yul index 42e1aabc2663..5a3b3454c591 100644 --- a/test/libyul/yulOptimizerTests/stackLimitEvader/too_many_args_16.yul +++ b/test/libyul/yulOptimizerTests/stackLimitEvader/too_many_args_16.yul @@ -43,21 +43,21 @@ // mstore(0x0180, b14) // mstore(0x0160, b15) // mstore(0x0140, b16) -// mstore(0xc0, b17) -// mstore(0xa0, b18) -// mstore(0x80, b19) -// mstore(0xe0, b29) -// mstore(0x0120, b30) -// mstore(0x0100, b31) +// mstore(0x0120, b17) +// mstore(0x0100, b18) +// mstore(0xe0, b19) +// mstore(0xc0, b29) +// mstore(0xa0, b30) +// mstore(0x80, b31) // sstore(0, mload(0x0180)) // sstore(1, mload(0x0160)) // sstore(2, mload(0x0140)) -// sstore(3, mload(0xc0)) -// sstore(4, mload(0xa0)) -// sstore(5, mload(0x80)) -// sstore(6, mload(0xe0)) -// sstore(7, mload(0x0120)) -// sstore(8, mload(0x0100)) -// v := add(mload(0x0320), mload(0x0100)) +// sstore(3, mload(0x0120)) +// sstore(4, mload(0x0100)) +// sstore(5, mload(0xe0)) +// sstore(6, mload(0xc0)) +// sstore(7, mload(0xa0)) +// sstore(8, mload(0x80)) +// v := add(mload(0x0320), mload(0x80)) // } // } diff --git a/test/libyul/yulOptimizerTests/stackLimitEvader/verbatim_many_arguments.yul b/test/libyul/yulOptimizerTests/stackLimitEvader/verbatim_many_arguments.yul index cb4d69269025..bde030f68ec3 100644 --- a/test/libyul/yulOptimizerTests/stackLimitEvader/verbatim_many_arguments.yul +++ b/test/libyul/yulOptimizerTests/stackLimitEvader/verbatim_many_arguments.yul @@ -39,8 +39,8 @@ // mstore(0x0140, 7) // mstore(0x0160, 8) // mstore(0x0180, 9) -// mstore(0x01c0, 10) -// mstore(0x01a0, 11) +// mstore(0x01a0, 10) +// mstore(0x01c0, 11) // mstore(0x01e0, 12) // let a_13 := 13 // let a_14 := 14 @@ -50,6 +50,6 @@ // let a_18 := 18 // let a_19 := 19 // let a_20 := 20 -// verbatim_20i_0o("test", mload(0x80), mload(0xa0), mload(0xc0), mload(0xe0), mload(0x0100), mload(0x0120), mload(0x0140), mload(0x0160), mload(0x0180), mload(0x01c0), mload(0x01a0), mload(0x01e0), a_13, a_14, a_15, a_16, a_17, a_18, a_19, a_20) +// verbatim_20i_0o("test", mload(0x80), mload(0xa0), mload(0xc0), mload(0xe0), mload(0x0100), mload(0x0120), mload(0x0140), mload(0x0160), mload(0x0180), mload(0x01a0), mload(0x01c0), mload(0x01e0), a_13, a_14, a_15, a_16, a_17, a_18, a_19, a_20) // } // } diff --git a/test/libyul/yulOptimizerTests/stackLimitEvader/verbatim_many_arguments_and_returns.yul b/test/libyul/yulOptimizerTests/stackLimitEvader/verbatim_many_arguments_and_returns.yul index de023e9190b7..46435dd210dc 100644 --- a/test/libyul/yulOptimizerTests/stackLimitEvader/verbatim_many_arguments_and_returns.yul +++ b/test/libyul/yulOptimizerTests/stackLimitEvader/verbatim_many_arguments_and_returns.yul @@ -51,17 +51,17 @@ // { // { // mstore(0x40, memoryguard(0x0280)) -// mstore(0x80, 1) -// mstore(0xa0, 2) -// mstore(0xc0, 3) -// mstore(0xe0, 4) -// mstore(0x0100, 5) -// mstore(0x0120, 6) -// mstore(0x0140, 7) -// mstore(0x0160, 8) -// mstore(0x0180, 9) -// mstore(0x0240, 10) -// mstore(0x0220, 11) +// mstore(0x0100, 1) +// mstore(0x0120, 2) +// mstore(0x0140, 3) +// mstore(0x0160, 4) +// mstore(0x0180, 5) +// mstore(0x01a0, 6) +// mstore(0x01c0, 7) +// mstore(0x01e0, 8) +// mstore(0x0200, 9) +// mstore(0x0220, 10) +// mstore(0x0240, 11) // mstore(0x0260, 12) // let a_13 := 13 // let a_14 := 14 @@ -71,11 +71,11 @@ // let a_18 := 18 // let a_19 := 19 // let a_20 := 20 -// let b_1_1, b_2_2, b_3_3, b_4_4, b_5_5, b_6_6, b_7_7, b_8_8, b_9_9, b_10_10, b_11_11, b_12_12, b_13_13, b_14_14, b_15_15, b_16_16, b_17_17, b_18_18, b_19_19, b_20_20 := verbatim_20i_20o("test", mload(0x80), mload(0xa0), mload(0xc0), mload(0xe0), mload(0x0100), mload(0x0120), mload(0x0140), mload(0x0160), mload(0x0180), mload(0x0240), mload(0x0220), mload(0x0260), a_13, a_14, a_15, a_16, a_17, a_18, a_19, a_20) -// mstore(0x01a0, b_4_4) -// mstore(0x01c0, b_3_3) -// mstore(0x01e0, b_2_2) -// mstore(0x0200, b_1_1) +// let b_1_1, b_2_2, b_3_3, b_4_4, b_5_5, b_6_6, b_7_7, b_8_8, b_9_9, b_10_10, b_11_11, b_12_12, b_13_13, b_14_14, b_15_15, b_16_16, b_17_17, b_18_18, b_19_19, b_20_20 := verbatim_20i_20o("test", mload(0x0100), mload(0x0120), mload(0x0140), mload(0x0160), mload(0x0180), mload(0x01a0), mload(0x01c0), mload(0x01e0), mload(0x0200), mload(0x0220), mload(0x0240), mload(0x0260), a_13, a_14, a_15, a_16, a_17, a_18, a_19, a_20) +// mstore(0x80, b_4_4) +// mstore(0xa0, b_3_3) +// mstore(0xc0, b_2_2) +// mstore(0xe0, b_1_1) // let b_20 := b_20_20 // let b_19 := b_19_19 // let b_18 := b_18_18 @@ -92,10 +92,10 @@ // let b_7 := b_7_7 // let b_6 := b_6_6 // let b_5 := b_5_5 -// sstore(1, mload(0x0200)) -// sstore(2, mload(0x01e0)) -// sstore(3, mload(0x01c0)) -// sstore(4, mload(0x01a0)) +// sstore(1, mload(0xe0)) +// sstore(2, mload(0xc0)) +// sstore(3, mload(0xa0)) +// sstore(4, mload(0x80)) // sstore(5, b_5) // sstore(6, b_6) // sstore(7, b_7) diff --git a/test/libyul/yulOptimizerTests/wordSizeTransform/constant_assignment.yul b/test/libyul/yulOptimizerTests/wordSizeTransform/constant_assignment.yul deleted file mode 100644 index 10f8814a66ed..000000000000 --- a/test/libyul/yulOptimizerTests/wordSizeTransform/constant_assignment.yul +++ /dev/null @@ -1,18 +0,0 @@ -{ - let val := 1234567890123456789012345678901234567890123456789012345678901234567890 - val := 9876543219876543219876543219876543219876543219876543219876543219876543210 -} - -// ---- -// step: wordSizeTransform -// -// { -// let val_0 := 196678011949 -// let val_1 := 17592899865401375162 -// let val_2 := 3392951883154430155 -// let val_3 := 12452437124710337234 -// val_0 := 1573424111353538 -// val_1 := 11180339179422519519 -// val_2 := 5225342777609112214 -// val_3 := 12264064093151869674 -// } diff --git a/test/libyul/yulOptimizerTests/wordSizeTransform/function_call.yul b/test/libyul/yulOptimizerTests/wordSizeTransform/function_call.yul deleted file mode 100644 index 3aef8c99ceea..000000000000 --- a/test/libyul/yulOptimizerTests/wordSizeTransform/function_call.yul +++ /dev/null @@ -1,43 +0,0 @@ -{ - function swap(x, y) -> a, b - { - a := y - b := x - } - function main(v1, v2) -> r1, r2 - { - let tmp := 11111111111111111111111111111111111111111111111111111111111111111111111111111 - r1, r2 := swap(v1, tmp) - r1, r2 := swap(2222222222222222222222222222222222222222222222222222222222222222222, r2) - } -} - -// ---- -// step: wordSizeTransform -// -// { -// function swap(x_0, x_1, x_2, x_3, y_0, y_1, y_2, y_3) -> a_0, a_1, a_2, a_3, b_0, b_1, b_2, b_3 -// { -// a_0 := y_0 -// a_1 := y_1 -// a_2 := y_2 -// a_3 := y_3 -// b_0 := x_0 -// b_1 := x_1 -// b_2 := x_2 -// b_3 := x_3 -// } -// function main(v1_0, v1_1, v1_2, v1_3, v2_0, v2_1, v2_2, v2_3) -> r1_0, r1_1, r1_2, r1_3, r2_0, r2_1, r2_2, r2_3 -// { -// let tmp_0 := 1770102123480502530 -// let tmp_1 := 591943673742124792 -// let tmp_2 := 13663686148824196892 -// let tmp_3 := 8198552921648689607 -// r1_0, r1_1, r1_2, r1_3, r2_0, r2_1, r2_2, r2_3 := swap(v1_0, v1_1, v1_2, v1_3, tmp_0, tmp_1, tmp_2, tmp_3) -// let _1_0 := 354020424 -// let _1_1 := 12840787883880108911 -// let _1_2 := 12527970737989311368 -// let _1_3 := 16397105843297379214 -// r1_0, r1_1, r1_2, r1_3, r2_0, r2_1, r2_2, r2_3 := swap(_1_0, _1_1, _1_2, _1_3, r2_0, r2_1, r2_2, r2_3) -// } -// } diff --git a/test/libyul/yulOptimizerTests/wordSizeTransform/functional_instruction.yul b/test/libyul/yulOptimizerTests/wordSizeTransform/functional_instruction.yul deleted file mode 100644 index 5ac0bfc00a8d..000000000000 --- a/test/libyul/yulOptimizerTests/wordSizeTransform/functional_instruction.yul +++ /dev/null @@ -1,17 +0,0 @@ -{ - let x := add(999999999999999999999999999999999999999999999999999999999999999, 77777777777777777777777777777777777777777777777777777777777777) -} -// ---- -// step: wordSizeTransform -// -// { -// let _1_0 := 12390 -// let _1_1 := 13186919961226471680 -// let _1_2 := 18324050535993369984 -// let _1_3 := 15884696285694336113 -// let _2_0 := 159309 -// let _2_1 := 3525417123811528497 -// let _2_2 := 6328259118096044006 -// let _2_3 := 9223372036854775807 -// let x_0, x_1, x_2, x_3 := add(_2_0, _2_1, _2_2, _2_3, _1_0, _1_1, _1_2, _1_3) -// } diff --git a/test/libyul/yulOptimizerTests/wordSizeTransform/if.yul b/test/libyul/yulOptimizerTests/wordSizeTransform/if.yul deleted file mode 100644 index b799760f839f..000000000000 --- a/test/libyul/yulOptimizerTests/wordSizeTransform/if.yul +++ /dev/null @@ -1,49 +0,0 @@ -{ - if calldataload(0) { sstore(0, 1) } - if add(calldataload(0), calldataload(1)) { sstore(0, 2) } -} -// ---- -// step: wordSizeTransform -// -// { -// let _1_0 := 0 -// let _1_1 := 0 -// let _1_2 := 0 -// let _1_3 := 0 -// let _2_0, _2_1, _2_2, _2_3 := calldataload(_1_0, _1_1, _1_2, _1_3) -// if or_bool(_2_0, _2_1, _2_2, _2_3) -// { -// let _3_0 := 0 -// let _3_1 := 0 -// let _3_2 := 0 -// let _3_3 := 1 -// let _4_0 := 0 -// let _4_1 := 0 -// let _4_2 := 0 -// let _4_3 := 0 -// sstore(_4_0, _4_1, _4_2, _4_3, _3_0, _3_1, _3_2, _3_3) -// } -// let _5_0 := 0 -// let _5_1 := 0 -// let _5_2 := 0 -// let _5_3 := 1 -// let _6_0, _6_1, _6_2, _6_3 := calldataload(_5_0, _5_1, _5_2, _5_3) -// let _7_0 := 0 -// let _7_1 := 0 -// let _7_2 := 0 -// let _7_3 := 0 -// let _8_0, _8_1, _8_2, _8_3 := calldataload(_7_0, _7_1, _7_2, _7_3) -// let _9_0, _9_1, _9_2, _9_3 := add(_8_0, _8_1, _8_2, _8_3, _6_0, _6_1, _6_2, _6_3) -// if or_bool(_9_0, _9_1, _9_2, _9_3) -// { -// let _10_0 := 0 -// let _10_1 := 0 -// let _10_2 := 0 -// let _10_3 := 2 -// let _11_0 := 0 -// let _11_1 := 0 -// let _11_2 := 0 -// let _11_3 := 0 -// sstore(_11_0, _11_1, _11_2, _11_3, _10_0, _10_1, _10_2, _10_3) -// } -// } diff --git a/test/libyul/yulOptimizerTests/wordSizeTransform/or_bool_renamed.yul b/test/libyul/yulOptimizerTests/wordSizeTransform/or_bool_renamed.yul deleted file mode 100644 index 803b289708f7..000000000000 --- a/test/libyul/yulOptimizerTests/wordSizeTransform/or_bool_renamed.yul +++ /dev/null @@ -1,25 +0,0 @@ -{ - let or_bool := 2 - if or_bool { sstore(0, 1) } -} -// ---- -// step: wordSizeTransform -// -// { -// let or_bool_3_0 := 0 -// let or_bool_3_1 := 0 -// let or_bool_3_2 := 0 -// let or_bool_3_3 := 2 -// if or_bool(or_bool_3_0, or_bool_3_1, or_bool_3_2, or_bool_3_3) -// { -// let _1_0 := 0 -// let _1_1 := 0 -// let _1_2 := 0 -// let _1_3 := 1 -// let _2_0 := 0 -// let _2_1 := 0 -// let _2_2 := 0 -// let _2_3 := 0 -// sstore(_2_0, _2_1, _2_2, _2_3, _1_0, _1_1, _1_2, _1_3) -// } -// } diff --git a/test/libyul/yulOptimizerTests/wordSizeTransform/switch_1.yul b/test/libyul/yulOptimizerTests/wordSizeTransform/switch_1.yul deleted file mode 100644 index d40e2283fc12..000000000000 --- a/test/libyul/yulOptimizerTests/wordSizeTransform/switch_1.yul +++ /dev/null @@ -1,71 +0,0 @@ -{ - switch calldataload(0) - case 0 { sstore(0, 1) } - case 1 { sstore(1, 1) } - case 2 { sstore(2, 1) } - case 3 { sstore(3, 1) } -} -// ---- -// step: wordSizeTransform -// -// { -// let _1_0 := 0 -// let _1_1 := 0 -// let _1_2 := 0 -// let _1_3 := 0 -// let _2_0, _2_1, _2_2, _2_3 := calldataload(_1_0, _1_1, _1_2, _1_3) -// switch _2_0 -// case 0 { -// switch _2_1 -// case 0 { -// switch _2_2 -// case 0 { -// switch _2_3 -// case 0 { -// let _3_0 := 0 -// let _3_1 := 0 -// let _3_2 := 0 -// let _3_3 := 1 -// let _4_0 := 0 -// let _4_1 := 0 -// let _4_2 := 0 -// let _4_3 := 0 -// sstore(_4_0, _4_1, _4_2, _4_3, _3_0, _3_1, _3_2, _3_3) -// } -// case 1 { -// let _5_0 := 0 -// let _5_1 := 0 -// let _5_2 := 0 -// let _5_3 := 1 -// let _6_0 := 0 -// let _6_1 := 0 -// let _6_2 := 0 -// let _6_3 := 1 -// sstore(_6_0, _6_1, _6_2, _6_3, _5_0, _5_1, _5_2, _5_3) -// } -// case 2 { -// let _7_0 := 0 -// let _7_1 := 0 -// let _7_2 := 0 -// let _7_3 := 1 -// let _8_0 := 0 -// let _8_1 := 0 -// let _8_2 := 0 -// let _8_3 := 2 -// sstore(_8_0, _8_1, _8_2, _8_3, _7_0, _7_1, _7_2, _7_3) -// } -// case 3 { -// let _9_0 := 0 -// let _9_1 := 0 -// let _9_2 := 0 -// let _9_3 := 1 -// let _10_0 := 0 -// let _10_1 := 0 -// let _10_2 := 0 -// let _10_3 := 3 -// sstore(_10_0, _10_1, _10_2, _10_3, _9_0, _9_1, _9_2, _9_3) -// } -// } -// } -// } -// } diff --git a/test/libyul/yulOptimizerTests/wordSizeTransform/switch_2.yul b/test/libyul/yulOptimizerTests/wordSizeTransform/switch_2.yul deleted file mode 100644 index a9612a392776..000000000000 --- a/test/libyul/yulOptimizerTests/wordSizeTransform/switch_2.yul +++ /dev/null @@ -1,77 +0,0 @@ -{ - switch calldataload(0) - case 0x01000000000000000000000000000000000000010 { sstore(0, 1) } - case 0x02000000000000000000000000000000000000010 { sstore(1, 1) } - case 0x01000000000000000000000000000000000000020 { sstore(2, 1) } - case 0x02000000000000000000000000000000000000020 { sstore(3, 1) } -} -// ---- -// step: wordSizeTransform -// -// { -// let _1_0 := 0 -// let _1_1 := 0 -// let _1_2 := 0 -// let _1_3 := 0 -// let _2_0, _2_1, _2_2, _2_3 := calldataload(_1_0, _1_1, _1_2, _1_3) -// switch _2_0 -// case 0 { -// switch _2_1 -// case 268435456 { -// switch _2_2 -// case 0 { -// switch _2_3 -// case 16 { -// let _3_0 := 0 -// let _3_1 := 0 -// let _3_2 := 0 -// let _3_3 := 1 -// let _4_0 := 0 -// let _4_1 := 0 -// let _4_2 := 0 -// let _4_3 := 0 -// sstore(_4_0, _4_1, _4_2, _4_3, _3_0, _3_1, _3_2, _3_3) -// } -// case 32 { -// let _7_0 := 0 -// let _7_1 := 0 -// let _7_2 := 0 -// let _7_3 := 1 -// let _8_0 := 0 -// let _8_1 := 0 -// let _8_2 := 0 -// let _8_3 := 2 -// sstore(_8_0, _8_1, _8_2, _8_3, _7_0, _7_1, _7_2, _7_3) -// } -// } -// } -// case 536870912 { -// switch _2_2 -// case 0 { -// switch _2_3 -// case 16 { -// let _5_0 := 0 -// let _5_1 := 0 -// let _5_2 := 0 -// let _5_3 := 1 -// let _6_0 := 0 -// let _6_1 := 0 -// let _6_2 := 0 -// let _6_3 := 1 -// sstore(_6_0, _6_1, _6_2, _6_3, _5_0, _5_1, _5_2, _5_3) -// } -// case 32 { -// let _9_0 := 0 -// let _9_1 := 0 -// let _9_2 := 0 -// let _9_3 := 1 -// let _10_0 := 0 -// let _10_1 := 0 -// let _10_2 := 0 -// let _10_3 := 3 -// sstore(_10_0, _10_1, _10_2, _10_3, _9_0, _9_1, _9_2, _9_3) -// } -// } -// } -// } -// } diff --git a/test/libyul/yulOptimizerTests/wordSizeTransform/switch_3.yul b/test/libyul/yulOptimizerTests/wordSizeTransform/switch_3.yul deleted file mode 100644 index 403c579623ac..000000000000 --- a/test/libyul/yulOptimizerTests/wordSizeTransform/switch_3.yul +++ /dev/null @@ -1,89 +0,0 @@ -{ - switch calldataload(0) - case 0 { sstore(0, 1) } - case 1 { sstore(1, 1) } - case 2 { sstore(2, 1) } - case 3 { sstore(3, 1) } - default { sstore(8, 9) } -} -// ---- -// step: wordSizeTransform -// -// { -// let _1_0 := 0 -// let _1_1 := 0 -// let _1_2 := 0 -// let _1_3 := 0 -// let _2_0, _2_1, _2_2, _2_3 := calldataload(_1_0, _1_1, _1_2, _1_3) -// let run_default -// switch _2_0 -// case 0 { -// switch _2_1 -// case 0 { -// switch _2_2 -// case 0 { -// switch _2_3 -// case 0 { -// let _3_0 := 0 -// let _3_1 := 0 -// let _3_2 := 0 -// let _3_3 := 1 -// let _4_0 := 0 -// let _4_1 := 0 -// let _4_2 := 0 -// let _4_3 := 0 -// sstore(_4_0, _4_1, _4_2, _4_3, _3_0, _3_1, _3_2, _3_3) -// } -// case 1 { -// let _5_0 := 0 -// let _5_1 := 0 -// let _5_2 := 0 -// let _5_3 := 1 -// let _6_0 := 0 -// let _6_1 := 0 -// let _6_2 := 0 -// let _6_3 := 1 -// sstore(_6_0, _6_1, _6_2, _6_3, _5_0, _5_1, _5_2, _5_3) -// } -// case 2 { -// let _7_0 := 0 -// let _7_1 := 0 -// let _7_2 := 0 -// let _7_3 := 1 -// let _8_0 := 0 -// let _8_1 := 0 -// let _8_2 := 0 -// let _8_3 := 2 -// sstore(_8_0, _8_1, _8_2, _8_3, _7_0, _7_1, _7_2, _7_3) -// } -// case 3 { -// let _9_0 := 0 -// let _9_1 := 0 -// let _9_2 := 0 -// let _9_3 := 1 -// let _10_0 := 0 -// let _10_1 := 0 -// let _10_2 := 0 -// let _10_3 := 3 -// sstore(_10_0, _10_1, _10_2, _10_3, _9_0, _9_1, _9_2, _9_3) -// } -// default { run_default := true } -// } -// default { run_default := true } -// } -// default { run_default := true } -// } -// default { run_default := true } -// if run_default -// { -// let _11_0 := 0 -// let _11_1 := 0 -// let _11_2 := 0 -// let _11_3 := 9 -// let _12_0 := 0 -// let _12_1 := 0 -// let _12_2 := 0 -// let _12_3 := 8 -// sstore(_12_0, _12_1, _12_2, _12_3, _11_0, _11_1, _11_2, _11_3) -// } -// } diff --git a/test/libyul/yulOptimizerTests/wordSizeTransform/switch_4.yul b/test/libyul/yulOptimizerTests/wordSizeTransform/switch_4.yul deleted file mode 100644 index d1f45a6231fd..000000000000 --- a/test/libyul/yulOptimizerTests/wordSizeTransform/switch_4.yul +++ /dev/null @@ -1,97 +0,0 @@ -{ - switch calldataload(0) - case 0x01000000000000000000000000000000000000010 { sstore(0, 1) } - case 0x02000000000000000000000000000000000000010 { sstore(1, 1) } - case 0x01000000000000000000000000000000000000020 { sstore(2, 1) } - case 0x02000000000000000000000000000000000000020 { sstore(3, 1) } - default { sstore(8, 9) } -} -// ---- -// step: wordSizeTransform -// -// { -// let _1_0 := 0 -// let _1_1 := 0 -// let _1_2 := 0 -// let _1_3 := 0 -// let _2_0, _2_1, _2_2, _2_3 := calldataload(_1_0, _1_1, _1_2, _1_3) -// let run_default -// switch _2_0 -// case 0 { -// switch _2_1 -// case 268435456 { -// switch _2_2 -// case 0 { -// switch _2_3 -// case 16 { -// let _3_0 := 0 -// let _3_1 := 0 -// let _3_2 := 0 -// let _3_3 := 1 -// let _4_0 := 0 -// let _4_1 := 0 -// let _4_2 := 0 -// let _4_3 := 0 -// sstore(_4_0, _4_1, _4_2, _4_3, _3_0, _3_1, _3_2, _3_3) -// } -// case 32 { -// let _7_0 := 0 -// let _7_1 := 0 -// let _7_2 := 0 -// let _7_3 := 1 -// let _8_0 := 0 -// let _8_1 := 0 -// let _8_2 := 0 -// let _8_3 := 2 -// sstore(_8_0, _8_1, _8_2, _8_3, _7_0, _7_1, _7_2, _7_3) -// } -// default { run_default := true } -// } -// default { run_default := true } -// } -// case 536870912 { -// switch _2_2 -// case 0 { -// switch _2_3 -// case 16 { -// let _5_0 := 0 -// let _5_1 := 0 -// let _5_2 := 0 -// let _5_3 := 1 -// let _6_0 := 0 -// let _6_1 := 0 -// let _6_2 := 0 -// let _6_3 := 1 -// sstore(_6_0, _6_1, _6_2, _6_3, _5_0, _5_1, _5_2, _5_3) -// } -// case 32 { -// let _9_0 := 0 -// let _9_1 := 0 -// let _9_2 := 0 -// let _9_3 := 1 -// let _10_0 := 0 -// let _10_1 := 0 -// let _10_2 := 0 -// let _10_3 := 3 -// sstore(_10_0, _10_1, _10_2, _10_3, _9_0, _9_1, _9_2, _9_3) -// } -// default { run_default := true } -// } -// default { run_default := true } -// } -// default { run_default := true } -// } -// default { run_default := true } -// if run_default -// { -// let _11_0 := 0 -// let _11_1 := 0 -// let _11_2 := 0 -// let _11_3 := 9 -// let _12_0 := 0 -// let _12_1 := 0 -// let _12_2 := 0 -// let _12_3 := 8 -// sstore(_12_0, _12_1, _12_2, _12_3, _11_0, _11_1, _11_2, _11_3) -// } -// } diff --git a/test/libyul/yulOptimizerTests/wordSizeTransform/switch_5.yul b/test/libyul/yulOptimizerTests/wordSizeTransform/switch_5.yul deleted file mode 100644 index a02243a25a10..000000000000 --- a/test/libyul/yulOptimizerTests/wordSizeTransform/switch_5.yul +++ /dev/null @@ -1,29 +0,0 @@ -{ - switch calldataload(0) - default { sstore(8, 9) } -} -// ---- -// step: wordSizeTransform -// -// { -// let _1_0 := 0 -// let _1_1 := 0 -// let _1_2 := 0 -// let _1_3 := 0 -// let _2_0, _2_1, _2_2, _2_3 := calldataload(_1_0, _1_1, _1_2, _1_3) -// let run_default -// switch _2_0 -// default { run_default := true } -// if run_default -// { -// let _3_0 := 0 -// let _3_1 := 0 -// let _3_2 := 0 -// let _3_3 := 9 -// let _4_0 := 0 -// let _4_1 := 0 -// let _4_2 := 0 -// let _4_3 := 8 -// sstore(_4_0, _4_1, _4_2, _4_3, _3_0, _3_1, _3_2, _3_3) -// } -// } diff --git a/test/libyul/yulSyntaxTests/for_loop_condition_fail_ewasm.yul b/test/libyul/yulSyntaxTests/for_loop_condition_fail_ewasm.yul deleted file mode 100644 index ec7a162dc15a..000000000000 --- a/test/libyul/yulSyntaxTests/for_loop_condition_fail_ewasm.yul +++ /dev/null @@ -1,8 +0,0 @@ -{ - let x - for {} x {} {} -} -// ==== -// dialect: ewasm -// ---- -// TypeError 1733: (23-24): Expected a value of boolean type "i32" but got "i64" diff --git a/test/libyul/yulSyntaxTests/linkersymbol_ewasm.yul b/test/libyul/yulSyntaxTests/linkersymbol_ewasm.yul deleted file mode 100644 index 051359c07582..000000000000 --- a/test/libyul/yulSyntaxTests/linkersymbol_ewasm.yul +++ /dev/null @@ -1,7 +0,0 @@ -{ - linkersymbol("contract/library.sol:L") -} -// ==== -// dialect: ewasm -// ---- -// DeclarationError 4619: (6-18): Function "linkersymbol" not found. diff --git a/test/libyul/yulSyntaxTests/type_check_cases.yul b/test/libyul/yulSyntaxTests/type_check_cases.yul deleted file mode 100644 index 4e09457c89f5..000000000000 --- a/test/libyul/yulSyntaxTests/type_check_cases.yul +++ /dev/null @@ -1,8 +0,0 @@ -{ - switch 7:i64 - case 0:i64 {} - case 2:i64 {} -} -// ==== -// dialect: ewasm -// ---- diff --git a/test/libyul/yulSyntaxTests/type_check_cases_fail.yul b/test/libyul/yulSyntaxTests/type_check_cases_fail.yul deleted file mode 100644 index d9b4c0204a66..000000000000 --- a/test/libyul/yulSyntaxTests/type_check_cases_fail.yul +++ /dev/null @@ -1,10 +0,0 @@ -{ - switch 7:i32 - case 0:i64 {} - case 2:i64 {} -} -// ==== -// dialect: ewasm -// ---- -// TypeError 3781: (28-33): Expected a value of type "i32" but got "i64". -// TypeError 3781: (46-51): Expected a value of type "i32" but got "i64". diff --git a/test/libyul/yulSyntaxTests/type_check_if_condition.yul b/test/libyul/yulSyntaxTests/type_check_if_condition.yul deleted file mode 100644 index eaccf63f6408..000000000000 --- a/test/libyul/yulSyntaxTests/type_check_if_condition.yul +++ /dev/null @@ -1,7 +0,0 @@ -{ - let x:i32 - if x {} -} -// ==== -// dialect: ewasm -// ---- diff --git a/test/libyul/yulSyntaxTests/type_check_if_condition_fail.yul b/test/libyul/yulSyntaxTests/type_check_if_condition_fail.yul deleted file mode 100644 index c8711338ff6a..000000000000 --- a/test/libyul/yulSyntaxTests/type_check_if_condition_fail.yul +++ /dev/null @@ -1,8 +0,0 @@ -{ - let x:i64 - if x {} -} -// ==== -// dialect: ewasm -// ---- -// TypeError 1733: (23-24): Expected a value of boolean type "i32" but got "i64" diff --git a/test/scripts/test_bytecodecompare_prepare_report.py b/test/scripts/test_bytecodecompare_prepare_report.py index e0a8ca76a6d9..097ffa2be931 100644 --- a/test/scripts/test_bytecodecompare_prepare_report.py +++ b/test/scripts/test_bytecodecompare_prepare_report.py @@ -9,7 +9,8 @@ # NOTE: This test file file only works with scripts/ added to PYTHONPATH so pylint can't find the imports # pragma pylint: disable=import-error -from bytecodecompare.prepare_report import CompilerInterface, FileReport, ContractReport, SMTUse, Statistics +from bytecodecompare.prepare_report import ExecutionArchitecture, CompilerInterface, FileReport, ContractReport +from bytecodecompare.prepare_report import SettingsPreset, SMTUse, Statistics from bytecodecompare.prepare_report import load_source, parse_cli_output, parse_standard_json_output, prepare_compiler_input # pragma pylint: enable=import-error @@ -223,8 +224,9 @@ def test_prepare_compiler_input_should_work_with_standard_json_interface(self): (command_line, compiler_input) = prepare_compiler_input( Path('solc'), + ExecutionArchitecture.NATIVE, SMT_SMOKE_TEST_SOL_PATH, - optimize=True, + preset=SettingsPreset.LEGACY_OPTIMIZE, force_no_optimize_yul=False, interface=CompilerInterface.STANDARD_JSON, smt_use=SMTUse.DISABLE, @@ -237,8 +239,9 @@ def test_prepare_compiler_input_should_work_with_standard_json_interface(self): def test_prepare_compiler_input_should_work_with_cli_interface(self): (command_line, compiler_input) = prepare_compiler_input( Path('solc'), + ExecutionArchitecture.NATIVE, SMT_SMOKE_TEST_SOL_PATH, - optimize=True, + preset=SettingsPreset.LEGACY_OPTIMIZE, force_no_optimize_yul=False, interface=CompilerInterface.CLI, smt_use=SMTUse.DISABLE, @@ -265,6 +268,7 @@ def test_prepare_compiler_input_for_json_preserves_newlines(self): }, 'settings': { 'optimizer': {'enabled': True}, + 'viaIR': True, 'outputSelection': {'*': {'*': ['evm.bytecode.object', 'metadata']}}, 'modelChecker': {'engine': 'none'}, } @@ -272,8 +276,9 @@ def test_prepare_compiler_input_for_json_preserves_newlines(self): (command_line, compiler_input) = prepare_compiler_input( Path('solc'), + ExecutionArchitecture.NATIVE, SMT_CONTRACT_WITH_MIXED_NEWLINES_SOL_PATH, - optimize=True, + preset=SettingsPreset.VIA_IR_OPTIMIZE, force_no_optimize_yul=False, interface=CompilerInterface.STANDARD_JSON, smt_use=SMTUse.DISABLE, @@ -286,8 +291,9 @@ def test_prepare_compiler_input_for_json_preserves_newlines(self): def test_prepare_compiler_input_for_cli_preserves_newlines(self): (_command_line, compiler_input) = prepare_compiler_input( Path('solc'), + ExecutionArchitecture.NATIVE, SMT_CONTRACT_WITH_MIXED_NEWLINES_SOL_PATH, - optimize=True, + preset=SettingsPreset.LEGACY_OPTIMIZE, force_no_optimize_yul=True, interface=CompilerInterface.CLI, smt_use=SMTUse.DISABLE, @@ -299,8 +305,9 @@ def test_prepare_compiler_input_for_cli_preserves_newlines(self): def test_prepare_compiler_input_for_cli_should_handle_force_no_optimize_yul_flag(self): (command_line, compiler_input) = prepare_compiler_input( Path('solc'), + ExecutionArchitecture.NATIVE, SMT_SMOKE_TEST_SOL_PATH, - optimize=False, + preset=SettingsPreset.LEGACY_NO_OPTIMIZE, force_no_optimize_yul=True, interface=CompilerInterface.CLI, smt_use=SMTUse.DISABLE, @@ -316,8 +323,9 @@ def test_prepare_compiler_input_for_cli_should_handle_force_no_optimize_yul_flag def test_prepare_compiler_input_for_cli_should_not_use_metadata_option_if_not_supported(self): (command_line, compiler_input) = prepare_compiler_input( Path('solc'), + ExecutionArchitecture.NATIVE, SMT_SMOKE_TEST_SOL_PATH, - optimize=True, + preset=SettingsPreset.VIA_IR_OPTIMIZE, force_no_optimize_yul=False, interface=CompilerInterface.CLI, smt_use=SMTUse.PRESERVE, @@ -326,7 +334,7 @@ def test_prepare_compiler_input_for_cli_should_not_use_metadata_option_if_not_su self.assertEqual( command_line, - ['solc', str(SMT_SMOKE_TEST_SOL_PATH), '--bin', '--optimize'], + ['solc', str(SMT_SMOKE_TEST_SOL_PATH), '--bin', '--optimize', '--via-ir'], ) self.assertEqual(compiler_input, SMT_SMOKE_TEST_SOL_CODE) diff --git a/test/solc/CommandLineParser.cpp b/test/solc/CommandLineParser.cpp index 6fdecd7faee3..4a76ce4f1593 100644 --- a/test/solc/CommandLineParser.cpp +++ b/test/solc/CommandLineParser.cpp @@ -132,7 +132,7 @@ BOOST_AUTO_TEST_CASE(cli_mode_options) "dir1/file1.sol:L=0x1234567890123456789012345678901234567890," "dir2/file2.sol:L=0x1111122222333334444455555666667777788888", "--ast-compact-json", "--asm", "--asm-json", "--opcodes", "--bin", "--bin-runtime", "--abi", - "--ir", "--ir-optimized", "--ewasm", "--hashes", "--userdoc", "--devdoc", "--metadata", "--storage-layout", + "--ir", "--ir-ast-json", "--ir-optimized", "--ir-optimized-ast-json", "--hashes", "--userdoc", "--devdoc", "--metadata", "--storage-layout", "--gas", "--combined-json=" "abi,metadata,bin,bin-runtime,opcodes,asm,storage-layout,generated-sources,generated-sources-runtime," @@ -140,8 +140,10 @@ BOOST_AUTO_TEST_CASE(cli_mode_options) "--metadata-hash=swarm", "--metadata-literal", "--optimize", + "--optimize-yul", "--optimize-runs=1000", "--yul-optimizations=agf", + "--model-checker-bmc-loop-iterations=2", "--model-checker-contracts=contract1.yul:A,contract2.yul:B", "--model-checker-div-mod-no-slacks", "--model-checker-engine=bmc", @@ -152,7 +154,7 @@ BOOST_AUTO_TEST_CASE(cli_mode_options) "--model-checker-show-unsupported", "--model-checker-solvers=z3,smtlib2", "--model-checker-targets=underflow,divByZero", - "--model-checker-timeout=5", + "--model-checker-timeout=5" }; if (inputMode == InputMode::CompilerWithASTImport) @@ -195,7 +197,6 @@ BOOST_AUTO_TEST_CASE(cli_mode_options) true, true, true, true, true, true, }; - expectedOptions.compiler.outputs.ewasmIR = false; expectedOptions.compiler.estimateGas = true; expectedOptions.compiler.combinedJsonRequests = { true, true, true, true, true, @@ -205,17 +206,20 @@ BOOST_AUTO_TEST_CASE(cli_mode_options) }; expectedOptions.metadata.hash = CompilerStack::MetadataHash::Bzzr1; expectedOptions.metadata.literalSources = true; - expectedOptions.optimizer.enabled = true; + expectedOptions.optimizer.optimizeEvmasm = true; + expectedOptions.optimizer.optimizeYul = true; expectedOptions.optimizer.expectedExecutionsPerDeployment = 1000; expectedOptions.optimizer.yulSteps = "agf"; expectedOptions.modelChecker.initialize = true; expectedOptions.modelChecker.settings = { + 2, {{{"contract1.yul", {"A"}}, {"contract2.yul", {"B"}}}}, true, {true, false}, {ModelCheckerExtCalls::Mode::TRUSTED}, {{InvariantType::Contract, InvariantType::Reentrancy}}, + false, // --model-checker-print-query true, true, true, @@ -249,13 +253,6 @@ BOOST_AUTO_TEST_CASE(via_ir_options) BOOST_AUTO_TEST_CASE(assembly_mode_options) { static vector, YulStack::Machine, YulStack::Language>> const allowedCombinations = { - {{"--machine=ewasm", "--yul-dialect=ewasm", "--assemble"}, YulStack::Machine::Ewasm, YulStack::Language::Ewasm}, - {{"--machine=ewasm", "--yul-dialect=ewasm", "--yul"}, YulStack::Machine::Ewasm, YulStack::Language::Ewasm}, - {{"--machine=ewasm", "--yul-dialect=ewasm", "--strict-assembly"}, YulStack::Machine::Ewasm, YulStack::Language::Ewasm}, - {{"--machine=ewasm", "--yul-dialect=evm", "--assemble"}, YulStack::Machine::Ewasm, YulStack::Language::StrictAssembly}, - {{"--machine=ewasm", "--yul-dialect=evm", "--yul"}, YulStack::Machine::Ewasm, YulStack::Language::StrictAssembly}, - {{"--machine=ewasm", "--yul-dialect=evm", "--strict-assembly"}, YulStack::Machine::Ewasm, YulStack::Language::StrictAssembly}, - {{"--machine=ewasm", "--strict-assembly"}, YulStack::Machine::Ewasm, YulStack::Language::Ewasm}, {{"--machine=evm", "--yul-dialect=evm", "--assemble"}, YulStack::Machine::EVM, YulStack::Language::StrictAssembly}, {{"--machine=evm", "--yul-dialect=evm", "--yul"}, YulStack::Machine::EVM, YulStack::Language::StrictAssembly}, {{"--machine=evm", "--yul-dialect=evm", "--strict-assembly"}, YulStack::Machine::EVM, YulStack::Language::StrictAssembly}, @@ -299,11 +296,10 @@ BOOST_AUTO_TEST_CASE(assembly_mode_options) "--asm", "--bin", "--ir-optimized", - "--ewasm", - "--ewasm-ir", + "--ast-compact-json", }; commandLine += assemblyOptions; - if (expectedLanguage == YulStack::Language::StrictAssembly || expectedLanguage == YulStack::Language::Ewasm) + if (expectedLanguage == YulStack::Language::StrictAssembly) commandLine += vector{ "--optimize", "--optimize-runs=1000", @@ -340,11 +336,11 @@ BOOST_AUTO_TEST_CASE(assembly_mode_options) expectedOptions.compiler.outputs.asm_ = true; expectedOptions.compiler.outputs.binary = true; expectedOptions.compiler.outputs.irOptimized = true; - expectedOptions.compiler.outputs.ewasm = true; - expectedOptions.compiler.outputs.ewasmIR = true; - if (expectedLanguage == YulStack::Language::StrictAssembly || expectedLanguage == YulStack::Language::Ewasm) + expectedOptions.compiler.outputs.astCompactJson = true; + if (expectedLanguage == YulStack::Language::StrictAssembly) { - expectedOptions.optimizer.enabled = true; + expectedOptions.optimizer.optimizeEvmasm = true; + expectedOptions.optimizer.optimizeYul = true; expectedOptions.optimizer.yulSteps = "agf"; expectedOptions.optimizer.expectedExecutionsPerDeployment = 1000; } @@ -443,6 +439,39 @@ BOOST_AUTO_TEST_CASE(invalid_options_input_modes_combinations) } } +BOOST_AUTO_TEST_CASE(optimizer_flags) +{ + OptimiserSettings yulOnly = OptimiserSettings::minimal(); + yulOnly.runYulOptimiser = true; + yulOnly.optimizeStackAllocation = true; + + OptimiserSettings evmasmOnly = OptimiserSettings::standard(); + evmasmOnly.runYulOptimiser = false; + + map, OptimiserSettings> settingsMap = { + {{}, OptimiserSettings::minimal()}, + {{"--optimize"}, OptimiserSettings::standard()}, + {{"--no-optimize-yul"}, OptimiserSettings::minimal()}, + {{"--optimize-yul"}, yulOnly}, + {{"--optimize", "--no-optimize-yul"}, evmasmOnly}, + {{"--optimize", "--optimize-yul"}, OptimiserSettings::standard()}, + }; + + map inputModeFlagMap = { + {InputMode::Compiler, ""}, + {InputMode::CompilerWithASTImport, "--import-ast"}, + {InputMode::Assembler, "--strict-assembly"}, + }; + + for (auto const& [inputMode, inputModeFlag]: inputModeFlagMap) + for (auto const& [optimizerFlags, expectedOptimizerSettings]: settingsMap) + { + vector commandLine = {"solc", inputModeFlag, "file"}; + commandLine += optimizerFlags; + BOOST_CHECK(parseCommandLine(commandLine).optimiserSettings() == expectedOptimizerSettings); + } +} + BOOST_AUTO_TEST_CASE(default_optimiser_sequence) { CommandLineOptions const& commandLineOptions = parseCommandLine({"solc", "contract.sol", "--optimize"}); diff --git a/test/solc/Common.h b/test/solc/Common.h index 3575bea74e96..69131bf2caa0 100644 --- a/test/solc/Common.h +++ b/test/solc/Common.h @@ -28,6 +28,7 @@ BOOST_TEST_DONT_PRINT_LOG_VALUE(solidity::frontend::CommandLineOptions) BOOST_TEST_DONT_PRINT_LOG_VALUE(solidity::frontend::InputMode) +BOOST_TEST_DONT_PRINT_LOG_VALUE(solidity::frontend::OptimiserSettings) namespace solidity::frontend::test { diff --git a/test/soltest.cpp b/test/soltest.cpp index 2120acc2dfce..6aa100248875 100644 --- a/test/soltest.cpp +++ b/test/soltest.cpp @@ -133,7 +133,6 @@ int registerTests( boost::unit_test::test_suite& _suite, boost::filesystem::path const& _basepath, boost::filesystem::path const& _path, - bool _enforceCompileToEwasm, vector const& _labels, TestCase::TestCaseCreator _testCaseCreator, solidity::test::Batcher& _batcher @@ -146,7 +145,6 @@ int registerTests( solidity::test::CommonOptions::get().evmVersion(), solidity::test::CommonOptions::get().eofVersion(), solidity::test::CommonOptions::get().vmPaths, - _enforceCompileToEwasm, solidity::test::CommonOptions::get().enforceGasTest, solidity::test::CommonOptions::get().enforceGasTestMinValue, }; @@ -164,7 +162,6 @@ int registerTests( numTestsAdded += registerTests( *sub_suite, _basepath, _path / entry.path().filename(), - _enforceCompileToEwasm, _labels, _testCaseCreator, _batcher @@ -269,7 +266,6 @@ test_suite* init_unit_test_suite(int /*argc*/, char* /*argv*/[]) master, options.testPath / ts.path, ts.subpath, - options.enforceCompileToEwasm, ts.labels, ts.testCaseCreator, batcher diff --git a/test/stopAfterParseTests.sh b/test/stopAfterParseTests.sh index 503c4357924d..7d74704c5e38 100755 --- a/test/stopAfterParseTests.sh +++ b/test/stopAfterParseTests.sh @@ -11,7 +11,7 @@ SOLIDITY_BUILD_DIR=${SOLIDITY_BUILD_DIR:-${REPO_ROOT}/build} SOLC=${SOLIDITY_BUILD_DIR}/solc/solc SPLITSOURCES=${REPO_ROOT}/scripts/splitSources.py -FILETMP=$(mktemp -d) +FILETMP=$(mktemp -d -t "stop-after-parse-tests-XXXXXX") cd "$FILETMP" || exit 1 diff --git a/test/tools/CMakeLists.txt b/test/tools/CMakeLists.txt index 0bb8896cd8e0..5a2ba8da3f95 100644 --- a/test/tools/CMakeLists.txt +++ b/test/tools/CMakeLists.txt @@ -36,7 +36,6 @@ add_executable(isoltest ../libyul/ControlFlowGraphTest.cpp ../libyul/ControlFlowSideEffectsTest.cpp ../libyul/EVMCodeTransformTest.cpp - ../libyul/EwasmTranslationTest.cpp ../libyul/FunctionSideEffects.cpp ../libyul/ObjectCompilerTest.cpp ../libyul/SyntaxTest.cpp diff --git a/test/tools/fuzzer_common.cpp b/test/tools/fuzzer_common.cpp index 60b871cf7935..1bb04bf66aad 100644 --- a/test/tools/fuzzer_common.cpp +++ b/test/tools/fuzzer_common.cpp @@ -105,11 +105,13 @@ void FuzzerUtil::testCompiler( { forceSMT(_input); compiler.setModelCheckerSettings({ + /*bmcLoopIterations*/1, frontend::ModelCheckerContracts::Default(), /*divModWithSlacks*/true, frontend::ModelCheckerEngine::All(), frontend::ModelCheckerExtCalls{}, frontend::ModelCheckerInvariants::All(), + /*printQuery=*/false, /*showProvedSafe=*/false, /*showUnproved=*/false, /*showUnsupported=*/false, diff --git a/test/tools/isoltest.cpp b/test/tools/isoltest.cpp index 4739a54e9c3b..2d93bdbc2b9a 100644 --- a/test/tools/isoltest.cpp +++ b/test/tools/isoltest.cpp @@ -161,7 +161,6 @@ TestTool::Result TestTool::process() m_options.evmVersion(), m_options.eofVersion(), m_options.vmPaths, - m_options.enforceCompileToEwasm, m_options.enforceGasTest, m_options.enforceGasTestMinValue }); diff --git a/test/tools/ossfuzz/StackReuseCodegenFuzzer.cpp b/test/tools/ossfuzz/StackReuseCodegenFuzzer.cpp index d7779a58d914..fb502af52778 100644 --- a/test/tools/ossfuzz/StackReuseCodegenFuzzer.cpp +++ b/test/tools/ossfuzz/StackReuseCodegenFuzzer.cpp @@ -27,6 +27,9 @@ #include #include +#include +#include + #include #include @@ -47,6 +50,24 @@ using namespace std; static evmc::VM evmone = evmc::VM{evmc_create_evmone()}; +namespace +{ +/// @returns true if there are recursive functions, false otherwise. +bool recursiveFunctionExists(Dialect const& _dialect, yul::Object& _object) +{ + auto recursiveFunctions = CallGraphGenerator::callGraph(*_object.code).recursiveFunctions(); + for(auto&& [function, variables]: CompilabilityChecker{ + _dialect, + _object, + true + }.unreachableVariables + ) + if(recursiveFunctions.count(function)) + return true; + return false; +} +} + DEFINE_PROTO_FUZZER(Program const& _input) { // Solidity creates an invalid instruction for subobjects, so we simply @@ -78,45 +99,58 @@ DEFINE_PROTO_FUZZER(Program const& _input) settings.runYulOptimiser = false; settings.optimizeStackAllocation = false; bytes unoptimisedByteCode; + bool recursiveFunction = false; + bool unoptimizedStackTooDeep = false; try { - unoptimisedByteCode = YulAssembler{version, nullopt, settings, yul_source}.assemble(); + YulAssembler assembler{version, nullopt, settings, yul_source}; + unoptimisedByteCode = assembler.assemble(); + auto yulObject = assembler.object(); + recursiveFunction = recursiveFunctionExists( + EVMDialect::strictAssemblyForEVMObjects(version), + *yulObject + ); } catch (solidity::yul::StackTooDeepError const&) { - return; + unoptimizedStackTooDeep = true; } - evmc::Result deployResult = YulEvmoneUtility{}.deployCode(unoptimisedByteCode, hostContext); - if (deployResult.status_code != EVMC_SUCCESS) - return; - auto callMessage = YulEvmoneUtility{}.callMessage(deployResult.create_address); - evmc::Result callResult = hostContext.call(callMessage); - // If the fuzzer synthesized input does not contain the revert opcode which - // we lazily check by string find, the EVM call should not revert. - bool noRevertInSource = yul_source.find("revert") == string::npos; - bool noInvalidInSource = yul_source.find("invalid") == string::npos; - if (noInvalidInSource) - solAssert( - callResult.status_code != EVMC_INVALID_INSTRUCTION, - "Invalid instruction." - ); - if (noRevertInSource) + ostringstream unoptimizedState; + bool noRevertInSource = true; + bool noInvalidInSource = true; + if (!unoptimizedStackTooDeep) + { + evmc::Result deployResult = YulEvmoneUtility{}.deployCode(unoptimisedByteCode, hostContext); + if (deployResult.status_code != EVMC_SUCCESS) + return; + auto callMessage = YulEvmoneUtility{}.callMessage(deployResult.create_address); + evmc::Result callResult = hostContext.call(callMessage); + // If the fuzzer synthesized input does not contain the revert opcode which + // we lazily check by string find, the EVM call should not revert. + noRevertInSource = yul_source.find("revert") == string::npos; + noInvalidInSource = yul_source.find("invalid") == string::npos; + if (noInvalidInSource) + solAssert( + callResult.status_code != EVMC_INVALID_INSTRUCTION, + "Invalid instruction." + ); + if (noRevertInSource) + solAssert( + callResult.status_code != EVMC_REVERT, + "SolidityEvmoneInterface: EVM One reverted" + ); + // Bail out on serious errors encountered during a call. + if (YulEvmoneUtility{}.seriousCallError(callResult.status_code)) + return; solAssert( - callResult.status_code != EVMC_REVERT, - "SolidityEvmoneInterface: EVM One reverted" + (callResult.status_code == EVMC_SUCCESS || + (!noRevertInSource && callResult.status_code == EVMC_REVERT) || + (!noInvalidInSource && callResult.status_code == EVMC_INVALID_INSTRUCTION)), + "Unoptimised call failed." ); - // Bail out on serious errors encountered during a call. - if (YulEvmoneUtility{}.seriousCallError(callResult.status_code)) - return; - solAssert( - (callResult.status_code == EVMC_SUCCESS || - (!noRevertInSource && callResult.status_code == EVMC_REVERT) || - (!noInvalidInSource && callResult.status_code == EVMC_INVALID_INSTRUCTION)), - "Unoptimised call failed." - ); - ostringstream unoptimizedState; - unoptimizedState << EVMHostPrinter{hostContext, deployResult.create_address}.state(); + unoptimizedState << EVMHostPrinter{hostContext, deployResult.create_address}.state(); + } settings.runYulOptimiser = true; settings.optimizeStackAllocation = true; @@ -127,9 +161,14 @@ DEFINE_PROTO_FUZZER(Program const& _input) } catch (solidity::yul::StackTooDeepError const&) { - return; + if (!recursiveFunction) + throw; + else + return; } + if (unoptimizedStackTooDeep) + return; // Reset host before running optimised code. hostContext.reset(); evmc::Result deployResultOpt = YulEvmoneUtility{}.deployCode(optimisedByteCode, hostContext); @@ -158,8 +197,13 @@ DEFINE_PROTO_FUZZER(Program const& _input) ostringstream optimizedState; optimizedState << EVMHostPrinter{hostContext, deployResultOpt.create_address}.state(); - solAssert( - unoptimizedState.str() == optimizedState.str(), - "State of unoptimised and optimised stack reused code do not match." - ); + if (unoptimizedState.str() != optimizedState.str()) + { + cout << unoptimizedState.str() << endl; + cout << optimizedState.str() << endl; + solAssert( + false, + "State of unoptimised and optimised stack reused code do not match." + ); + } } diff --git a/test/tools/ossfuzz/YulEvmoneInterface.cpp b/test/tools/ossfuzz/YulEvmoneInterface.cpp index f3a9f74453d5..b89245443049 100644 --- a/test/tools/ossfuzz/YulEvmoneInterface.cpp +++ b/test/tools/ossfuzz/YulEvmoneInterface.cpp @@ -38,6 +38,11 @@ bytes YulAssembler::assemble() return m_stack.assemble(YulStack::Machine::EVM).bytecode->bytecode; } +std::shared_ptr YulAssembler::object() +{ + return m_stack.parserResult(); +} + evmc::Result YulEvmoneUtility::deployCode(bytes const& _input, EVMHost& _host) { // Zero initialize all message fields diff --git a/test/tools/ossfuzz/YulEvmoneInterface.h b/test/tools/ossfuzz/YulEvmoneInterface.h index 9224a949dea1..71a47507e817 100644 --- a/test/tools/ossfuzz/YulEvmoneInterface.h +++ b/test/tools/ossfuzz/YulEvmoneInterface.h @@ -47,6 +47,7 @@ class YulAssembler m_optimiseYul(_optSettings.runYulOptimiser) {} solidity::bytes assemble(); + std::shared_ptr object(); private: solidity::yul::YulStack m_stack; std::string m_yulProgram; diff --git a/test/tools/ossfuzz/protoToAbiV2.h b/test/tools/ossfuzz/protoToAbiV2.h index 7038ed7064a3..be583d49711c 100644 --- a/test/tools/ossfuzz/protoToAbiV2.h +++ b/test/tools/ossfuzz/protoToAbiV2.h @@ -390,7 +390,7 @@ class ProtoConverter return m_isLastDynParamRightPadded; } - /// Convert delimter to a comma or null string. + /// Convert delimiter to a comma or null string. static std::string delimiterToString(Delimiter _delimiter, bool _space = true); /// Generates number in the range [1, @param _n] uniformly at random. unsigned randomNumberOneToN(unsigned _n) diff --git a/test/tools/ossfuzz/protoToYul.cpp b/test/tools/ossfuzz/protoToYul.cpp index 25b5a977df84..80768578934b 100644 --- a/test/tools/ossfuzz/protoToYul.cpp +++ b/test/tools/ossfuzz/protoToYul.cpp @@ -640,7 +640,7 @@ void ProtoConverter::visit(UnaryOp const& _x) { m_output << "mod("; visit(_x.operand()); - m_output << ", " << to_string(s_maxMemory) << ")"; + m_output << ", " << to_string(s_maxMemory - 32) << ")"; } else visit(_x.operand()); @@ -1125,12 +1125,21 @@ void ProtoConverter::visit(StoreFunc const& _x) // Write to memory within bounds, storage is unbounded if (storeType == StoreFunc::SSTORE) visit(_x.loc()); - else + else if (storeType == StoreFunc::MSTORE8) { m_output << "mod("; visit(_x.loc()); m_output << ", " << to_string(s_maxMemory) << ")"; } + else if (storeType == StoreFunc::MSTORE) + { + // Since we write 32 bytes, ensure it does not exceed + // upper bound on memory. + m_output << "mod("; + visit(_x.loc()); + m_output << ", " << to_string(s_maxMemory - 32) << ")"; + + } m_output << ", "; visit(_x.val()); m_output << ")\n"; @@ -1706,7 +1715,7 @@ void ProtoConverter::fillFunctionCallInput(unsigned _numInParams) case 1: { // Access memory within stipulated bounds - slot = "mod(" + dictionaryToken() + ", " + to_string(s_maxMemory) + ")"; + slot = "mod(" + dictionaryToken() + ", " + to_string(s_maxMemory - 32) + ")"; m_output << "mload(" << slot << ")"; break; } @@ -1940,6 +1949,8 @@ void ProtoConverter::visit(Program const& _x) { case Program::kBlock: m_output << "{\n"; + m_output << "mstore(memoryguard(0x10000), 1)\n"; + m_output << "sstore(mload(calldataload(0)), 1)\n"; visit(_x.block()); m_output << "}\n"; break; diff --git a/test/tools/ossfuzz/protoToYul.h b/test/tools/ossfuzz/protoToYul.h index 00559fa93aa6..b7f7c72e5a8e 100644 --- a/test/tools/ossfuzz/protoToYul.h +++ b/test/tools/ossfuzz/protoToYul.h @@ -344,11 +344,12 @@ class ProtoConverter static unsigned constexpr s_modOutputParams = 5; /// Hard-coded identifier for a Yul object's data block static auto constexpr s_dataIdentifier = "datablock"; - /// Upper bound on memory writes = 2**32 - 1 - /// See: https://eips.ethereum.org/EIPS/eip-1985#memory-size - static unsigned constexpr s_maxMemory = 4294967295; + /// Upper bound on memory writes is 64KB in order to + /// preserve semantic equivalence in the presence of + /// memory guard + static unsigned constexpr s_maxMemory = 65536; /// Upper bound on size for range copy functions - static unsigned constexpr s_maxSize = 65536; + static unsigned constexpr s_maxSize = 32768; /// Predicate to keep track of for body scope. If false, break/continue /// statements can not be created. bool m_inForBodyScope; diff --git a/test/tools/yulInterpreter/CMakeLists.txt b/test/tools/yulInterpreter/CMakeLists.txt index cc1b40f074f6..235e8fac10a6 100644 --- a/test/tools/yulInterpreter/CMakeLists.txt +++ b/test/tools/yulInterpreter/CMakeLists.txt @@ -1,8 +1,6 @@ set(sources EVMInstructionInterpreter.h EVMInstructionInterpreter.cpp - EwasmBuiltinInterpreter.h - EwasmBuiltinInterpreter.cpp Interpreter.h Interpreter.cpp Inspector.h diff --git a/test/tools/yulInterpreter/EwasmBuiltinInterpreter.cpp b/test/tools/yulInterpreter/EwasmBuiltinInterpreter.cpp deleted file mode 100644 index fdba09aa46d4..000000000000 --- a/test/tools/yulInterpreter/EwasmBuiltinInterpreter.cpp +++ /dev/null @@ -1,617 +0,0 @@ -/* - This file is part of solidity. - - solidity is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - solidity is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with solidity. If not, see . -*/ -// SPDX-License-Identifier: GPL-3.0 -/** - * Yul interpreter module that evaluates Ewasm builtins. - */ - -#include - -#include - -#include -#include - -#include - -#include -#include - -#include - -using namespace std; -using namespace solidity; -using namespace solidity::yul; -using namespace solidity::yul::test; - -using solidity::util::h160; -using solidity::util::h256; - -namespace -{ - -/// Copy @a _size bytes of @a _source at offset @a _sourceOffset to -/// @a _target at offset @a _targetOffset. Behaves as if @a _source would -/// continue with an infinite sequence of zero bytes beyond its end. -void copyZeroExtended( - map& _target, bytes const& _source, - size_t _targetOffset, size_t _sourceOffset, size_t _size -) -{ - for (size_t i = 0; i < _size; ++i) - _target[_targetOffset + i] = _sourceOffset + i < _source.size() ? _source[_sourceOffset + i] : 0; -} - -/// Count leading zeros for uint64. Following WebAssembly rules, it returns 64 for @a _v being zero. -/// NOTE: the clz builtin of the compiler may or may not do this -uint64_t clz64(uint64_t _v) -{ - if (_v == 0) - return 64; - - uint64_t r = 0; - while (!(_v & 0x8000000000000000)) - { - r += 1; - _v = _v << 1; - } - return r; -} - -/// Count trailing zeros for uint32. Following WebAssembly rules, it returns 32 for @a _v being zero. -/// NOTE: the ctz builtin of the compiler may or may not do this -uint32_t ctz32(uint32_t _v) -{ - if (_v == 0) - return 32; - - uint32_t r = 0; - while (!(_v & 1)) - { - r++; - _v >>= 1; - } - return r; -} - -/// Count trailing zeros for uint64. Following WebAssembly rules, it returns 64 for @a _v being zero. -/// NOTE: the ctz builtin of the compiler may or may not do this -uint64_t ctz64(uint64_t _v) -{ - if (_v == 0) - return 64; - - uint64_t r = 0; - while (!(_v & 1)) - { - r++; - _v >>= 1; - } - return r; -} - -/// Count number of bits set for uint64 -uint64_t popcnt(uint64_t _v) -{ - uint64_t r = 0; - while (_v) - { - r += (_v & 1); - _v >>= 1; - } - return r; -} - -} - -u256 EwasmBuiltinInterpreter::evalBuiltin( - YulString _functionName, - vector const& _arguments, - vector const& _evaluatedArguments -) -{ - vector arg; - for (u256 const& a: _evaluatedArguments) - arg.emplace_back(uint64_t(a & uint64_t(-1))); - - string const fun = _functionName.str(); - if (fun == "datasize" || fun == "dataoffset") - { - string arg = std::get(_arguments.at(0)).value.str(); - if (arg.length() < 32) - arg.resize(32, 0); - if (fun == "datasize") - return u256(util::keccak256(arg)) & 0xfff; - else if (fun == "dataoffset") - { - // Force different value than for datasize - arg[31]++; - arg[31]++; - return u256(util::keccak256(arg)) & 0xfff; - } - } - else if (fun == "datacopy") - { - // This is identical to codecopy. - accessMemory(_evaluatedArguments.at(0), _evaluatedArguments.at(2)); - copyZeroExtended( - m_state.memory, - m_state.code, - static_cast(_evaluatedArguments.at(0)), - static_cast(_evaluatedArguments.at(1) & numeric_limits::max()), - static_cast(_evaluatedArguments.at(2)) - ); - return 0; - } - else if (fun == "i32.drop" || fun == "i64.drop" || fun == "nop") - return {}; - else if (fun == "i32.select") - { - if ((arg.at(2) & 0xffffffff) == 0) - return arg.at(1); - else - return arg.at(0); - } - else if (fun == "i64.select") - { - if ((arg.at(2) & 0xffffffffffffffff) == 0) - return arg.at(1); - else - return arg.at(0); - } - else if (fun == "i32.wrap_i64") - return arg.at(0) & uint32_t(-1); - else if (fun == "i64.extend_i32_u") - // Return the same as above because everything is u256 anyway. - return arg.at(0) & uint32_t(-1); - else if (fun == "unreachable") - { - logTrace(evmasm::Instruction::INVALID, {}); - BOOST_THROW_EXCEPTION(ExplicitlyTerminated()); - } - else if (fun == "i64.store") - { - accessMemory(arg[0], 8); - writeMemoryWord(arg[0], arg[1]); - return 0; - } - else if (fun == "i64.store8" || fun == "i32.store8") - { - accessMemory(arg[0], 1); - writeMemoryByte(arg[0], static_cast(arg[1] & 0xff)); - return 0; - } - else if (fun == "i64.load") - { - accessMemory(arg[0], 8); - return readMemoryWord(arg[0]); - } - else if (fun == "i32.store") - { - accessMemory(arg[0], 4); - writeMemoryHalfWord(arg[0], static_cast(arg[1])); - return 0; - } - else if (fun == "i32.load") - { - accessMemory(arg[0], 4); - return readMemoryHalfWord(arg[0]); - } - else if (fun == "i32.clz") - // NOTE: the clz implementation assumes 64-bit inputs, hence the adjustment - return clz64(arg[0] & uint32_t(-1)) - 32; - else if (fun == "i64.clz") - return clz64(arg[0]); - else if (fun == "i32.ctz") - return ctz32(uint32_t(arg[0] & uint32_t(-1))); - else if (fun == "i64.ctz") - return ctz64(arg[0]); - - string prefix = fun; - string suffix; - auto dot = prefix.find("."); - if (dot != string::npos) - { - suffix = prefix.substr(dot + 1); - prefix.resize(dot); - } - - if (prefix == "i32") - { - vector halfWordArgs; - for (uint64_t a: arg) - halfWordArgs.push_back(uint32_t(a & uint32_t(-1))); - return evalWasmBuiltin(suffix, halfWordArgs); - } - else if (prefix == "i64") - return evalWasmBuiltin(suffix, arg); - else if (prefix == "eth") - return evalEthBuiltin(suffix, arg); - - yulAssert(false, "Unknown builtin: " + fun + " (or implementation did not return)"); - - return 0; -} - -template -u256 EwasmBuiltinInterpreter::evalWasmBuiltin(string const& _fun, vector const& _arguments) -{ - vector const& arg = _arguments; - - if (_fun == "add") - return arg[0] + arg[1]; - else if (_fun == "sub") - return arg[0] - arg[1]; - else if (_fun == "mul") - return arg[0] * arg[1]; - else if (_fun == "div_u") - { - if (arg[1] == 0) - BOOST_THROW_EXCEPTION(ExplicitlyTerminated()); - else - return arg[0] / arg[1]; - } - else if (_fun == "rem_u") - { - if (arg[1] == 0) - BOOST_THROW_EXCEPTION(ExplicitlyTerminated()); - else - return arg[0] % arg[1]; - } - else if (_fun == "and") - return arg[0] & arg[1]; - else if (_fun == "or") - return arg[0] | arg[1]; - else if (_fun == "xor") - return arg[0] ^ arg[1]; - else if (_fun == "shl") - return arg[0] << arg[1]; - else if (_fun == "shr_u") - return arg[0] >> arg[1]; - else if (_fun == "eq") - return arg[0] == arg[1] ? 1 : 0; - else if (_fun == "ne") - return arg[0] != arg[1] ? 1 : 0; - else if (_fun == "eqz") - return arg[0] == 0 ? 1 : 0; - else if (_fun == "popcnt") - return popcnt(arg[0]); - else if (_fun == "lt_u") - return arg[0] < arg[1] ? 1 : 0; - else if (_fun == "gt_u") - return arg[0] > arg[1] ? 1 : 0; - else if (_fun == "le_u") - return arg[0] <= arg[1] ? 1 : 0; - else if (_fun == "ge_u") - return arg[0] >= arg[1] ? 1 : 0; - - yulAssert(false, "Unknown builtin: " + _fun + " (or implementation did not return)"); - - return 0; -} - -u256 EwasmBuiltinInterpreter::evalEthBuiltin(string const& _fun, vector const& _arguments) -{ - vector const& arg = _arguments; - - if (_fun == "getAddress") - { - writeAddress(arg[0], m_state.address); - return 0; - } - else if (_fun == "getExternalBalance") - { - readAddress(arg[0]); - writeU128(arg[1], m_state.balance); - return 0; - } - else if (_fun == "getBlockHash") - { - if (arg[0] >= m_state.blockNumber || arg[0] + 256 < m_state.blockNumber) - return 1; - else - { - writeBytes32(arg[1], h256(0xaaaaaaaa + u256(arg[0] - m_state.blockNumber - 256))); - return 0; - } - } - else if (_fun == "call") - { - readAddress(arg[1]); - readU128(arg[2]); - accessMemory(arg[3], arg[4]); - logTrace(evmasm::Instruction::CALL, {}); - return arg[0] & 1; - } - else if (_fun == "callDataCopy") - { - if (arg[1] + arg[2] < arg[1] || arg[1] + arg[2] > m_state.calldata.size()) - BOOST_THROW_EXCEPTION(ExplicitlyTerminated()); - accessMemory(arg[0], arg[2]); - copyZeroExtended( - m_state.memory, m_state.calldata, - size_t(arg[0]), size_t(arg[1]), size_t(arg[2]) - ); - return {}; - } - else if (_fun == "getCallDataSize") - return m_state.calldata.size(); - else if (_fun == "callCode") - { - readAddress(arg[1]); - readU128(arg[2]); - accessMemory(arg[3], arg[4]); - logTrace(evmasm::Instruction::CALLCODE, {}); - return arg[0] & 1; - } - else if (_fun == "callDelegate") - { - readAddress(arg[1]); - accessMemory(arg[2], arg[3]); - logTrace(evmasm::Instruction::DELEGATECALL, {}); - return arg[0] & 1; - } - else if (_fun == "callStatic") - { - readAddress(arg[1]); - accessMemory(arg[2], arg[3]); - logTrace(evmasm::Instruction::STATICCALL, {}); - return arg[0] & 1; - } - else if (_fun == "storageStore") - { - m_state.storage[readBytes32(arg[0])] = readBytes32(arg[1]); - return 0; - } - else if (_fun == "storageLoad") - { - writeBytes32(arg[1], m_state.storage[readBytes32(arg[0])]); - return 0; - } - else if (_fun == "getCaller") - { - writeAddress(arg[0], m_state.caller); - return 0; - } - else if (_fun == "getCallValue") - { - writeU128(arg[0], m_state.callvalue); - return 0; - } - else if (_fun == "codeCopy") - { - accessMemory(arg[0], arg[2]); - copyZeroExtended( - m_state.memory, m_state.code, - size_t(arg[0]), size_t(arg[1]), size_t(arg[2]) - ); - return 0; - } - else if (_fun == "getCodeSize") - return m_state.code.size(); - else if (_fun == "getBlockCoinbase") - { - writeAddress(arg[0], m_state.coinbase); - return 0; - } - else if (_fun == "create") - { - readU128(arg[0]); - accessMemory(arg[1], arg[2]); - logTrace(evmasm::Instruction::CREATE, {}); - writeAddress(arg[3], h160(0xcccccc + arg[1])); - return 1; - } - else if (_fun == "getBlockBaseFee") - { - writeU128(arg[0], m_state.basefee); - return 0; - } - else if (_fun == "getBlockDifficulty") - { - writeU256(arg[0], m_state.difficulty); - return 0; - } - else if (_fun == "externalCodeCopy") - { - readAddress(arg[0]); - accessMemory(arg[1], arg[3]); - // TODO this way extcodecopy and codecopy do the same thing. - copyZeroExtended( - m_state.memory, m_state.code, - size_t(arg[1]), size_t(arg[2]), size_t(arg[3]) - ); - return 0; - } - else if (_fun == "getExternalCodeSize") - // Generate "random" code length. - return uint32_t(u256(keccak256(h256(readAddress(arg[0]), h256::AlignLeft))) & 0xfff); - else if (_fun == "getGasLeft") - return 0x99; - else if (_fun == "getBlockGasLimit") - return uint64_t(m_state.gaslimit); - else if (_fun == "getTxGasPrice") - { - writeU128(arg[0], m_state.gasprice); - return 0; - } - else if (_fun == "log") - { - accessMemory(arg[0], arg[1]); - uint64_t numberOfTopics = arg[2]; - if (numberOfTopics > 4) - BOOST_THROW_EXCEPTION(ExplicitlyTerminated()); - if (numberOfTopics > 0) - readBytes32(arg[3]); - if (numberOfTopics > 1) - readBytes32(arg[4]); - if (numberOfTopics > 2) - readBytes32(arg[5]); - if (numberOfTopics > 3) - readBytes32(arg[6]); - logTrace(evmasm::logInstruction(static_cast(numberOfTopics)), {}); - return 0; - } - else if (_fun == "getBlockNumber") - return m_state.blockNumber; - else if (_fun == "getTxOrigin") - { - writeAddress(arg[0], m_state.origin); - return 0; - } - else if (_fun == "finish") - { - bytes data; - accessMemory(arg[0], arg[1]); - data = readMemory(arg[0], arg[1]); - logTrace(evmasm::Instruction::RETURN, {}, data); - BOOST_THROW_EXCEPTION(ExplicitlyTerminated()); - } - else if (_fun == "revert") - { - bytes data; - accessMemory(arg[0], arg[1]); - data = readMemory(arg[0], arg[1]); - logTrace(evmasm::Instruction::REVERT, {}, data); - BOOST_THROW_EXCEPTION(ExplicitlyTerminated()); - } - else if (_fun == "getReturnDataSize") - return m_state.returndata.size(); - else if (_fun == "returnDataCopy") - { - if (arg[1] + arg[2] < arg[1] || arg[1] + arg[2] > m_state.returndata.size()) - BOOST_THROW_EXCEPTION(ExplicitlyTerminated()); - accessMemory(arg[0], arg[2]); - copyZeroExtended( - m_state.memory, m_state.calldata, - size_t(arg[0]), size_t(arg[1]), size_t(arg[2]) - ); - return {}; - } - else if (_fun == "selfDestruct") - { - readAddress(arg[0]); - logTrace(evmasm::Instruction::SELFDESTRUCT, {}); - BOOST_THROW_EXCEPTION(ExplicitlyTerminated()); - } - else if (_fun == "getBlockTimestamp") - return m_state.timestamp; - - yulAssert(false, "Unknown builtin: " + _fun + " (or implementation did not return)"); - - return 0; -} - -void EwasmBuiltinInterpreter::accessMemory(u256 const& _offset, u256 const& _size) -{ - // Single WebAssembly page. - // TODO: Support expansion in this interpreter. - m_state.msize = 65536; - - if (((_offset + _size) < _offset) || ((_offset + _size) > m_state.msize)) - // Ewasm throws out of bounds exception as opposed to the EVM. - BOOST_THROW_EXCEPTION(ExplicitlyTerminated()); -} - -bytes EwasmBuiltinInterpreter::readMemory(uint64_t _offset, uint64_t _size) -{ - yulAssert(_size <= 0xffff, "Too large read."); - bytes data(size_t(_size), uint8_t(0)); - for (size_t i = 0; i < data.size(); ++i) - data[i] = m_state.memory[_offset + i]; - return data; -} - -uint64_t EwasmBuiltinInterpreter::readMemoryWord(uint64_t _offset) -{ - uint64_t r = 0; - for (size_t i = 0; i < 8; i++) - r |= uint64_t(m_state.memory[_offset + i]) << (i * 8); - return r; -} - -uint32_t EwasmBuiltinInterpreter::readMemoryHalfWord(uint64_t _offset) -{ - uint32_t r = 0; - for (size_t i = 0; i < 4; i++) - r |= uint32_t(m_state.memory[_offset + i]) << (i * 8); - return r; -} - -void EwasmBuiltinInterpreter::writeMemory(uint64_t _offset, bytes const& _value) -{ - for (size_t i = 0; i < _value.size(); i++) - m_state.memory[_offset + i] = _value[i]; -} - -void EwasmBuiltinInterpreter::writeMemoryWord(uint64_t _offset, uint64_t _value) -{ - for (size_t i = 0; i < 8; i++) - m_state.memory[_offset + i] = uint8_t((_value >> (i * 8)) & 0xff); -} - -void EwasmBuiltinInterpreter::writeMemoryHalfWord(uint64_t _offset, uint32_t _value) -{ - for (size_t i = 0; i < 4; i++) - m_state.memory[_offset + i] = uint8_t((_value >> (i * 8)) & 0xff); -} - -void EwasmBuiltinInterpreter::writeMemoryByte(uint64_t _offset, uint8_t _value) -{ - m_state.memory[_offset] = _value; -} - -void EwasmBuiltinInterpreter::writeU256(uint64_t _offset, u256 _value, size_t _croppedTo) -{ - accessMemory(_offset, _croppedTo); - for (size_t i = 0; i < _croppedTo; i++) - { - m_state.memory[_offset + i] = uint8_t(_value & 0xff); - _value >>= 8; - } -} - -u256 EwasmBuiltinInterpreter::readU256(uint64_t _offset, size_t _croppedTo) -{ - accessMemory(_offset, _croppedTo); - u256 value{0}; - for (size_t i = 0; i < _croppedTo; i++) - value = (value << 8) | m_state.memory[_offset + _croppedTo - 1 - i]; - - return value; -} - -void EwasmBuiltinInterpreter::logTrace(evmasm::Instruction _instruction, std::vector const& _arguments, bytes const& _data) -{ - logTrace(evmasm::instructionInfo(_instruction, langutil::EVMVersion()).name, _arguments, _data); -} - -void EwasmBuiltinInterpreter::logTrace(std::string const& _pseudoInstruction, std::vector const& _arguments, bytes const& _data) -{ - string message = _pseudoInstruction + "("; - for (size_t i = 0; i < _arguments.size(); ++i) - message += (i > 0 ? ", " : "") + formatNumber(_arguments[i]); - message += ")"; - if (!_data.empty()) - message += " [" + util::toHex(_data) + "]"; - m_state.trace.emplace_back(std::move(message)); - if (m_state.maxTraceSize > 0 && m_state.trace.size() >= m_state.maxTraceSize) - { - m_state.trace.emplace_back("Trace size limit reached."); - BOOST_THROW_EXCEPTION(TraceLimitReached()); - } -} diff --git a/test/tools/yulInterpreter/EwasmBuiltinInterpreter.h b/test/tools/yulInterpreter/EwasmBuiltinInterpreter.h deleted file mode 100644 index 1837f7509eb1..000000000000 --- a/test/tools/yulInterpreter/EwasmBuiltinInterpreter.h +++ /dev/null @@ -1,138 +0,0 @@ -/* - This file is part of solidity. - - solidity is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - solidity is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with solidity. If not, see . -*/ -// SPDX-License-Identifier: GPL-3.0 -/** - * Yul interpreter module that evaluates Ewasm builtins. - */ - -#pragma once - -#include - -#include -#include - -#include - -namespace solidity::evmasm -{ -enum class Instruction: uint8_t; -} - -namespace solidity::yul -{ -class YulString; -struct BuiltinFunctionForEVM; -} - -namespace solidity::yul::test -{ - -struct InterpreterState; - -/** - * Interprets Ewasm builtins based on the current state and logs instructions with - * side-effects. - * - * Since this is mainly meant to be used for differential fuzz testing, it is focused - * on a single contract only, does not do any gas counting and differs from the correct - * implementation in many ways: - * - * - If memory access to a "large" memory position is performed, a deterministic - * value is returned. Data that is stored in a "large" memory position is not - * retained. - * - The blockhash instruction returns a fixed value if the argument is in range. - * - Extcodesize returns a deterministic value depending on the address. - * - Extcodecopy copies a deterministic value depending on the address. - * - And many other things - * - * The main focus is that the generated execution trace is the same for equivalent executions - * and likely to be different for non-equivalent executions. - * - * The type names are following the Ewasm specification (https://github.com/ewasm/design/blob/master/eth_interface.md). - */ -class EwasmBuiltinInterpreter -{ -public: - explicit EwasmBuiltinInterpreter(InterpreterState& _state): - m_state(_state) - {} - /// Evaluate builtin function - u256 evalBuiltin( - YulString _functionName, - std::vector const& _arguments, - std::vector const& _evaluatedArguments - ); - -private: - template - u256 evalWasmBuiltin( - std::string const& _fun, - std::vector const& _arguments - ); - u256 evalEthBuiltin( - std::string const& _fun, - std::vector const& _arguments - ); - - /// Checks if the memory access is not too large for the interpreter and adjusts - /// msize accordingly. - void accessMemory(u256 const& _offset, u256 const& _size = 32); - /// @returns the memory contents at the provided address. - /// Does not adjust msize, use @a accessMemory for that - bytes readMemory(uint64_t _offset, uint64_t _size = 32); - /// @returns the memory contents (8 bytes) at the provided address (little-endian). - /// Does not adjust msize, use @a accessMemory for that - uint64_t readMemoryWord(uint64_t _offset); - /// @returns the memory contents (4 bytes) at the provided address (little-endian). - /// Does not adjust msize, use @a accessMemory for that - uint32_t readMemoryHalfWord(uint64_t _offset); - /// Writes bytes to memory. - /// Does not adjust msize, use @a accessMemory for that - void writeMemory(uint64_t _offset, bytes const& _value); - /// Writes a word to memory (little-endian) - /// Does not adjust msize, use @a accessMemory for that - void writeMemoryWord(uint64_t _offset, uint64_t _value); - /// Writes a 4-byte value to memory (little-endian) - /// Does not adjust msize, use @a accessMemory for that - void writeMemoryHalfWord(uint64_t _offset, uint32_t _value); - /// Writes a byte to memory - /// Does not adjust msize, use @a accessMemory for that - void writeMemoryByte(uint64_t _offset, uint8_t _value); - - /// Helper for eth.* builtins. Writes to memory (little-endian) and always returns zero. - void writeU256(uint64_t _offset, u256 _value, size_t _croppedTo = 32); - void writeU128(uint64_t _offset, u256 _value) { writeU256(_offset, std::move(_value), 16); } - /// Helper for eth.* builtins. Writes to memory (as a byte string). - void writeBytes32(uint64_t _offset, util::h256 _value) { accessMemory(_offset, 32); writeMemory(_offset, _value.asBytes()); } - void writeAddress(uint64_t _offset, util::h160 _value) { accessMemory(_offset, 20); writeMemory(_offset, _value.asBytes()); } - /// Helper for eth.* builtins. Reads from memory (little-endian) and returns the value. - u256 readU256(uint64_t _offset, size_t _croppedTo = 32); - u256 readU128(uint64_t _offset) { return readU256(_offset, 16); } - /// Helper for eth.* builtins. Reads from memory (as a byte string). - util::h256 readBytes32(uint64_t _offset) { accessMemory(_offset, 32); return util::h256(readMemory(_offset, 32)); } - util::h160 readAddress(uint64_t _offset) { accessMemory(_offset, 20); return util::h160(readMemory(_offset, 20)); } - - void logTrace(evmasm::Instruction _instruction, std::vector const& _arguments = {}, bytes const& _data = {}); - /// Appends a log to the trace representing an instruction or similar operation by string, - /// with arguments and auxiliary data (if nonempty). - void logTrace(std::string const& _pseudoInstruction, std::vector const& _arguments = {}, bytes const& _data = {}); - - InterpreterState& m_state; -}; - -} diff --git a/test/tools/yulInterpreter/Interpreter.cpp b/test/tools/yulInterpreter/Interpreter.cpp index b66967e26fb8..aadd22b4db77 100644 --- a/test/tools/yulInterpreter/Interpreter.cpp +++ b/test/tools/yulInterpreter/Interpreter.cpp @@ -22,13 +22,11 @@ #include #include -#include #include #include #include #include -#include #include @@ -329,13 +327,6 @@ void ExpressionEvaluator::operator()(FunctionCall const& _funCall) return; } } - else if (WasmDialect const* dialect = dynamic_cast(&m_dialect)) - if (dialect->builtin(_funCall.functionName.name)) - { - EwasmBuiltinInterpreter interpreter(m_state); - setValue(interpreter.evalBuiltin(_funCall.functionName.name, _funCall.arguments, values())); - return; - } Scope* scope = &m_scope; for (; scope; scope = scope->parent) diff --git a/test/tools/yulopti.cpp b/test/tools/yulopti.cpp index ad98ab9bee07..20491afe1657 100644 --- a/test/tools/yulopti.cpp +++ b/test/tools/yulopti.cpp @@ -37,7 +37,6 @@ #include #include #include -#include #include diff --git a/test/yulPhaser/Chromosome.cpp b/test/yulPhaser/Chromosome.cpp index 90e278f42ef1..1d12bf18c161 100644 --- a/test/yulPhaser/Chromosome.cpp +++ b/test/yulPhaser/Chromosome.cpp @@ -138,7 +138,7 @@ BOOST_AUTO_TEST_CASE(output_operator_should_create_concise_and_unambiguous_strin BOOST_TEST(chromosome.length() == allSteps.size()); BOOST_TEST(chromosome.optimisationSteps() == allSteps); - BOOST_TEST(toString(chromosome) == "flcCUnDEvejsxIOoighFTLMRmVatrpuSd"); + BOOST_TEST(toString(chromosome) == "flcCUnDEvejsxIOoighFTLMmVatrpuSd"); } BOOST_AUTO_TEST_CASE(optimisationSteps_should_translate_chromosomes_genes_to_optimisation_step_names) diff --git a/tools/yulPhaser/README.md b/tools/yulPhaser/README.md index 3bc72b5379df..99004d4c93cc 100644 --- a/tools/yulPhaser/README.md +++ b/tools/yulPhaser/README.md @@ -82,7 +82,7 @@ solc/solc --optimize --ir-optimized --yul-optimizations ### How to choose good parameters Choosing good parameters for a genetic algorithm is not a trivial task but phaser's defaults are generally enough to find a sequence that gives results comparable or better than one hand-crafted by an experienced developer for a given set of programs. The difficult part is providing a fairly representative set of input files. -If the files you give don't need certain optimisations the tool will find sequences that don't use these optimisations and perform badly for programs that could benefit from them. +If the files you give do not need certain optimisations the tool will find sequences that do not use these optimisations and perform badly for programs that could benefit from them. If all the provided files greatly benefit from a specific optimisation, the sequence may not work well for programs that do not. We have conducted [a set of rough experiments](https://github.com/ethereum/solidity/issues/7806#issuecomment-598644491) to evaluate some combinations of parameter values. @@ -91,5 +91,5 @@ The conclusions were used to adjust the defaults but you might still benefit fro 1. The algorithm that performed the best was `GEWEP`. 2. Using longer sequences in the initial population yields better results. The algorithm is good at removing superfluous steps. 3. Preserving the top sequences from previous rounds improves results. Elite should contain at least a few individuals, especially when using the `classic` algorithm. -4. Don't set mutation/deletion/addition chance too high. It makes results worse because it destroys the good patterns preserved by crossover. Values around 1-5% seem to work best. +4. Do not set mutation/deletion/addition chance too high. It makes results worse because it destroys the good patterns preserved by crossover. Values around 1-5% seem to work best. 5. Keep the algorithm running for 1000 rounds or more. It usually finds good sequences faster than that but it can shorten them significantly if you let it run longer. This is especially important when starting with long sequences.