diff --git a/.github/workflows/black.yml b/.github/workflows/black.yml index 6242bd1cb..9834a4654 100644 --- a/.github/workflows/black.yml +++ b/.github/workflows/black.yml @@ -36,7 +36,7 @@ jobs: cp pyproject.toml .github/linters - name: Black - uses: docker://github/super-linter:v3 + uses: docker://github/super-linter:v4 if: always() env: # run linter on everything to catch preexisting problems diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 04d9ceb03..24352f124 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -55,4 +55,4 @@ jobs: TEST_TYPE: ${{ matrix.type }} GITHUB_ETHERSCAN: ${{ secrets.GITHUB_ETHERSCAN }} run: | - bash scripts/ci_test_${TEST_TYPE}.sh + bash "scripts/ci_test_${TEST_TYPE}.sh" diff --git a/.github/workflows/linter.yml b/.github/workflows/linter.yml index d6f783c4f..00c1ad61d 100644 --- a/.github/workflows/linter.yml +++ b/.github/workflows/linter.yml @@ -36,7 +36,7 @@ jobs: cp pyproject.toml .github/linters - name: Lint everything else - uses: docker://github/super-linter:v3 + uses: docker://github/super-linter:v4 if: always() env: # run linter on everything to catch preexisting problems diff --git a/.github/workflows/pylint.yml b/.github/workflows/pylint.yml index 80b213aff..a803ad932 100644 --- a/.github/workflows/pylint.yml +++ b/.github/workflows/pylint.yml @@ -36,7 +36,7 @@ jobs: cp pyproject.toml .github/linters - name: Pylint - uses: docker://github/super-linter:v3 + uses: docker://github/super-linter:v4 if: always() env: # run linter on everything to catch preexisting problems diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 99447671f..5270dafac 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -37,7 +37,7 @@ To run them locally in the root dir of the repository: - `pylint slither tests --rcfile pyproject.toml` - `black . --config pyproject.toml` -We use pylint `2.8.2` black `20.8b1`. +We use pylint `2.12.2` black `21.10b0`. ### Detectors tests For each new detector, at least one regression tests must be present. diff --git a/README.md b/README.md index 77a86a972..6842b972f 100644 --- a/README.md +++ b/README.md @@ -177,7 +177,7 @@ git clone https://github.com/crytic/slither.git && cd slither python3 setup.py install ``` -We recommend using an Python virtual environment, as detailed in the [Developer Installation Instructions](https://github.com/trailofbits/slither/wiki/Developer-installation), if you prefer to install Slither via git. +We recommend using a Python virtual environment, as detailed in the [Developer Installation Instructions](https://github.com/trailofbits/slither/wiki/Developer-installation), if you prefer to install Slither via git. ### Using Docker diff --git a/plugin_example/README.md b/plugin_example/README.md index 6f8c4a6c1..1a0f915c8 100644 --- a/plugin_example/README.md +++ b/plugin_example/README.md @@ -1,6 +1,6 @@ # Slither, Plugin Example -This repo contains an example of plugin for Slither. +This repository contains an example of plugin for Slither. See the [detector documentation](https://github.com/trailofbits/slither/wiki/Adding-a-new-detector). diff --git a/pyproject.toml b/pyproject.toml index 5a22e3c53..33e4b3fec 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -18,5 +18,6 @@ logging-fstring-interpolation, logging-not-lazy, duplicate-code, import-error, -unsubscriptable-object +unsubscriptable-object, +consider-using-f-string """ diff --git a/setup.py b/setup.py index 417e54afb..762f4cd08 100644 --- a/setup.py +++ b/setup.py @@ -1,5 +1,8 @@ from setuptools import setup, find_packages +with open("README.md", "r", encoding="utf-8") as f: + long_description = f.read() + setup( name="slither-analyzer", description="Slither is a Solidity static analysis framework written in Python 3.", @@ -16,7 +19,7 @@ setup( ], # dependency_links=["git+https://github.com/crytic/crytic-compile.git@master#egg=crytic-compile"], license="AGPL-3.0", - long_description=open("README.md", "r", encoding="utf-8").read(), + long_description=long_description, entry_points={ "console_scripts": [ "slither = slither.__main__:main", diff --git a/slither/__main__.py b/slither/__main__.py index eafa5a4c0..b92e727b7 100644 --- a/slither/__main__.py +++ b/slither/__main__.py @@ -173,13 +173,11 @@ def get_detectors_and_printers(): detector = None if not all(issubclass(detector, AbstractDetector) for detector in plugin_detectors): raise Exception( - "Error when loading plugin %s, %r is not a detector" % (entry_point, detector) + f"Error when loading plugin {entry_point}, {detector} is not a detector" ) printer = None if not all(issubclass(printer, AbstractPrinter) for printer in plugin_printers): - raise Exception( - "Error when loading plugin %s, %r is not a printer" % (entry_point, printer) - ) + raise Exception(f"Error when loading plugin {entry_point}, {printer} is not a printer") # We convert those to lists in case someone returns a tuple detectors += list(plugin_detectors) @@ -253,7 +251,7 @@ def choose_printers(args, all_printer_classes): if printer in printers: printers_to_run.append(printers[printer]) else: - raise Exception("Error: {} is not a printer".format(printer)) + raise Exception(f"Error: {printer} is not a printer") return printers_to_run @@ -303,7 +301,7 @@ def parse_args(detector_classes, printer_classes): # pylint: disable=too-many-s group_detector.add_argument( "--detect", help="Comma-separated list of detectors, defaults to all, " - "available detectors: {}".format(", ".join(d.ARGUMENT for d in detector_classes)), + f"available detectors: {', '.join(d.ARGUMENT for d in detector_classes)}", action="store", dest="detectors_to_run", default=defaults_flag_in_config["detectors_to_run"], @@ -312,7 +310,7 @@ def parse_args(detector_classes, printer_classes): # pylint: disable=too-many-s group_printer.add_argument( "--print", help="Comma-separated list fo contract information printers, " - "available printers: {}".format(", ".join(d.ARGUMENT for d in printer_classes)), + f"available printers: {', '.join(d.ARGUMENT for d in printer_classes)}", action="store", dest="printers_to_run", default=defaults_flag_in_config["printers_to_run"], @@ -657,7 +655,7 @@ def main_impl(all_detector_classes, all_printer_classes): outputting_sarif = args.sarif is not None outputting_sarif_stdout = args.sarif == "-" outputting_zip = args.zip is not None - if args.zip_type not in ZIP_TYPES_ACCEPTED.keys(): + if args.zip_type not in ZIP_TYPES_ACCEPTED: to_log = f'Zip type not accepted, it must be one of {",".join(ZIP_TYPES_ACCEPTED.keys())}' logger.error(to_log) diff --git a/slither/analyses/data_dependency/data_dependency.py b/slither/analyses/data_dependency/data_dependency.py index 638b1fc78..46d5add39 100644 --- a/slither/analyses/data_dependency/data_dependency.py +++ b/slither/analyses/data_dependency/data_dependency.py @@ -284,8 +284,8 @@ def compute_dependency_contract(contract, compilation_unit: "SlitherCompilationU if KEY_SSA in contract.context: return - contract.context[KEY_SSA] = dict() - contract.context[KEY_SSA_UNPROTECTED] = dict() + contract.context[KEY_SSA] = {} + contract.context[KEY_SSA_UNPROTECTED] = {} for function in contract.functions + contract.modifiers: compute_dependency_function(function) @@ -365,8 +365,8 @@ def compute_dependency_function(function): if KEY_SSA in function.context: return - function.context[KEY_SSA] = dict() - function.context[KEY_SSA_UNPROTECTED] = dict() + function.context[KEY_SSA] = {} + function.context[KEY_SSA_UNPROTECTED] = {} is_protected = function.is_protected() for node in function.nodes: @@ -417,7 +417,7 @@ def convert_variable_to_non_ssa(v): def convert_to_non_ssa(data_depencies): # Need to create new set() as its changed during iteration - ret = dict() + ret = {} for (k, values) in data_depencies.items(): var = convert_variable_to_non_ssa(k) if not var in ret: diff --git a/slither/core/compilation_unit.py b/slither/core/compilation_unit.py index 0647040b9..d8582b31a 100644 --- a/slither/core/compilation_unit.py +++ b/slither/core/compilation_unit.py @@ -61,7 +61,7 @@ class SlitherCompilationUnit(Context): self.counter_slithir_temporary = 0 self.counter_slithir_reference = 0 - self.scopes: Dict[Filename, FileScope] = dict() + self.scopes: Dict[Filename, FileScope] = {} @property def core(self) -> "SlitherCore": diff --git a/slither/core/declarations/contract.py b/slither/core/declarations/contract.py index dc71ccf5a..2a0adbca4 100644 --- a/slither/core/declarations/contract.py +++ b/slither/core/declarations/contract.py @@ -1093,9 +1093,11 @@ class Contract(SourceMapping): # pylint: disable=too-many-public-methods if initializable in self.inheritance: self._is_upgradeable = True else: - for c in self.inheritance + [self]: + for contract in self.inheritance + [self]: # This might lead to false positive - lower_name = c.name.lower() + # Not sure why pylint is having a trouble here + # pylint: disable=no-member + lower_name = contract.name.lower() if "upgradeable" in lower_name or "upgradable" in lower_name: self._is_upgradeable = True break @@ -1257,7 +1259,7 @@ class Contract(SourceMapping): # pylint: disable=too-many-public-methods """ from slither.slithir.variables import StateIRVariable - all_ssa_state_variables_instances = dict() + all_ssa_state_variables_instances = {} for contract in self.inheritance: for v in contract.state_variables_declared: @@ -1275,8 +1277,8 @@ class Contract(SourceMapping): # pylint: disable=too-many-public-methods func.generate_slithir_ssa(all_ssa_state_variables_instances) def fix_phi(self): - last_state_variables_instances = dict() - initial_state_variables_instances = dict() + last_state_variables_instances = {} + initial_state_variables_instances = {} for v in self._initial_state_variables: last_state_variables_instances[v.canonical_name] = [] initial_state_variables_instances[v.canonical_name] = v diff --git a/slither/core/declarations/function.py b/slither/core/declarations/function.py index f118990a7..9b2b4d214 100644 --- a/slither/core/declarations/function.py +++ b/slither/core/declarations/function.py @@ -882,7 +882,7 @@ class Function(SourceMapping, metaclass=ABCMeta): # pylint: disable=too-many-pu from slither.slithir.variables import Constant if self._return_values is None: - return_values = list() + return_values = [] returns = [n for n in self.nodes if n.type == NodeType.RETURN] [ # pylint: disable=expression-not-assigned return_values.extend(ir.values) @@ -903,7 +903,7 @@ class Function(SourceMapping, metaclass=ABCMeta): # pylint: disable=too-many-pu from slither.slithir.variables import Constant if self._return_values_ssa is None: - return_values_ssa = list() + return_values_ssa = [] returns = [n for n in self.nodes if n.type == NodeType.RETURN] [ # pylint: disable=expression-not-assigned return_values_ssa.extend(ir.values) @@ -1599,16 +1599,16 @@ class Function(SourceMapping, metaclass=ABCMeta): # pylint: disable=too-many-pu from slither.core.cfg.node import NodeType if not self.is_implemented: - return dict() + return {} if self._entry_point is None: - return dict() + return {} # node, values - to_explore: List[Tuple["Node", Dict]] = [(self._entry_point, dict())] + to_explore: List[Tuple["Node", Dict]] = [(self._entry_point, {})] # node -> values - explored: Dict = dict() + explored: Dict = {} # name -> instances - ret: Dict = dict() + ret: Dict = {} while to_explore: node, values = to_explore[0] diff --git a/slither/core/declarations/structure.py b/slither/core/declarations/structure.py index 860e56954..eb5f5e00d 100644 --- a/slither/core/declarations/structure.py +++ b/slither/core/declarations/structure.py @@ -12,7 +12,7 @@ class Structure(SourceMapping): super().__init__() self._name = None self._canonical_name = None - self._elems: Dict[str, "StructureVariable"] = dict() + self._elems: Dict[str, "StructureVariable"] = {} # Name of the elements in the order of declaration self._elems_ordered: List[str] = [] self.compilation_unit = compilation_unit diff --git a/slither/core/scope/scope.py b/slither/core/scope/scope.py index 08a534470..95b78a827 100644 --- a/slither/core/scope/scope.py +++ b/slither/core/scope/scope.py @@ -23,19 +23,19 @@ class FileScope: self.filename = filename self.accessible_scopes: List[FileScope] = [] - self.contracts: Dict[str, Contract] = dict() + self.contracts: Dict[str, Contract] = {} # Custom error are a list instead of a dict # Because we parse the function signature later on # So we simplify the logic and have the scope fields all populated self.custom_errors: Set[CustomErrorTopLevel] = set() - self.enums: Dict[str, EnumTopLevel] = dict() + self.enums: Dict[str, EnumTopLevel] = {} # Functions is a list instead of a dict # Because we parse the function signature later on # So we simplify the logic and have the scope fields all populated self.functions: Set[FunctionTopLevel] = set() self.imports: Set[Import] = set() self.pragmas: Set[Pragma] = set() - self.structures: Dict[str, StructureTopLevel] = dict() + self.structures: Dict[str, StructureTopLevel] = {} def add_accesible_scopes(self) -> bool: """ diff --git a/slither/core/slither_core.py b/slither/core/slither_core.py index 77f64ccd2..58e3279c4 100644 --- a/slither/core/slither_core.py +++ b/slither/core/slither_core.py @@ -254,7 +254,7 @@ class SlitherCore(Context): filename = self._previous_results_filename try: if os.path.isfile(filename): - with open(filename) as f: + with open(filename, encoding="utf8") as f: self._previous_results = json.load(f) if self._previous_results: for r in self._previous_results: diff --git a/slither/core/solidity_types/array_type.py b/slither/core/solidity_types/array_type.py index f07780e72..a93a976b9 100644 --- a/slither/core/solidity_types/array_type.py +++ b/slither/core/solidity_types/array_type.py @@ -46,7 +46,7 @@ class ArrayType(Type): def __str__(self): if self._length: - return str(self._type) + "[{}]".format(str(self._length_value)) + return str(self._type) + f"[{str(self._length_value)}]" return str(self._type) + "[]" def __eq__(self, other): diff --git a/slither/core/solidity_types/elementary_type.py b/slither/core/solidity_types/elementary_type.py index 423265845..b3d8e99dc 100644 --- a/slither/core/solidity_types/elementary_type.py +++ b/slither/core/solidity_types/elementary_type.py @@ -194,7 +194,7 @@ class ElementaryType(Type): @property def storage_size(self) -> Tuple[int, bool]: - if self._type == "string" or self._type == "bytes": + if self._type in ["string", "bytes"]: return 32, True if self.size is None: return 32, True diff --git a/slither/detectors/abstract_detector.py b/slither/detectors/abstract_detector.py index 5b3fe0e25..c01a43c22 100644 --- a/slither/detectors/abstract_detector.py +++ b/slither/detectors/abstract_detector.py @@ -72,27 +72,27 @@ class AbstractDetector(metaclass=abc.ABCMeta): if not self.HELP: raise IncorrectDetectorInitialization( - "HELP is not initialized {}".format(self.__class__.__name__) + f"HELP is not initialized {self.__class__.__name__}" ) if not self.ARGUMENT: raise IncorrectDetectorInitialization( - "ARGUMENT is not initialized {}".format(self.__class__.__name__) + f"ARGUMENT is not initialized {self.__class__.__name__}" ) if not self.WIKI: raise IncorrectDetectorInitialization( - "WIKI is not initialized {}".format(self.__class__.__name__) + f"WIKI is not initialized {self.__class__.__name__}" ) if not self.WIKI_TITLE: raise IncorrectDetectorInitialization( - "WIKI_TITLE is not initialized {}".format(self.__class__.__name__) + f"WIKI_TITLE is not initialized {self.__class__.__name__}" ) if not self.WIKI_DESCRIPTION: raise IncorrectDetectorInitialization( - "WIKI_DESCRIPTION is not initialized {}".format(self.__class__.__name__) + f"WIKI_DESCRIPTION is not initialized {self.__class__.__name__}" ) if not self.WIKI_EXPLOIT_SCENARIO and self.IMPACT not in [ @@ -100,17 +100,17 @@ class AbstractDetector(metaclass=abc.ABCMeta): DetectorClassification.OPTIMIZATION, ]: raise IncorrectDetectorInitialization( - "WIKI_EXPLOIT_SCENARIO is not initialized {}".format(self.__class__.__name__) + f"WIKI_EXPLOIT_SCENARIO is not initialized {self.__class__.__name__}" ) if not self.WIKI_RECOMMENDATION: raise IncorrectDetectorInitialization( - "WIKI_RECOMMENDATION is not initialized {}".format(self.__class__.__name__) + f"WIKI_RECOMMENDATION is not initialized {self.__class__.__name__}" ) if re.match("^[a-zA-Z0-9_-]*$", self.ARGUMENT) is None: raise IncorrectDetectorInitialization( - "ARGUMENT has illegal character {}".format(self.__class__.__name__) + f"ARGUMENT has illegal character {self.__class__.__name__}" ) if self.IMPACT not in [ @@ -121,7 +121,7 @@ class AbstractDetector(metaclass=abc.ABCMeta): DetectorClassification.OPTIMIZATION, ]: raise IncorrectDetectorInitialization( - "IMPACT is not initialized {}".format(self.__class__.__name__) + f"IMPACT is not initialized {self.__class__.__name__}" ) if self.CONFIDENCE not in [ @@ -132,7 +132,7 @@ class AbstractDetector(metaclass=abc.ABCMeta): DetectorClassification.OPTIMIZATION, ]: raise IncorrectDetectorInitialization( - "CONFIDENCE is not initialized {}".format(self.__class__.__name__) + f"CONFIDENCE is not initialized {self.__class__.__name__}" ) def _log(self, info: str) -> None: @@ -160,7 +160,7 @@ class AbstractDetector(metaclass=abc.ABCMeta): self._format(self.compilation_unit, result) if not "patches" in result: continue - result["patches_diff"] = dict() + result["patches_diff"] = {} for file in result["patches"]: original_txt = self.compilation_unit.core.source_code[file].encode("utf8") patched_txt = original_txt @@ -189,9 +189,7 @@ class AbstractDetector(metaclass=abc.ABCMeta): if results and self.slither.triage_mode: while True: indexes = input( - 'Results to hide during next runs: "0,1,...,{}" or "All" (enter to not hide results): '.format( - len(results) - ) + f'Results to hide during next runs: "0,1,...,{len(results)}" or "All" (enter to not hide results): ' ) if indexes == "All": self.slither.save_results_to_hide(results) @@ -243,7 +241,7 @@ class AbstractDetector(metaclass=abc.ABCMeta): info = "\n" for idx, result in enumerate(results): if self.slither.triage_mode: - info += "{}: ".format(idx) + info += f"{idx}: " info += result["description"] - info += "Reference: {}".format(self.WIKI) + info += f"Reference: {self.WIKI}" self._log(info) diff --git a/slither/detectors/compiler_bugs/reused_base_constructor.py b/slither/detectors/compiler_bugs/reused_base_constructor.py index eabf99557..2ad0b0a6a 100644 --- a/slither/detectors/compiler_bugs/reused_base_constructor.py +++ b/slither/detectors/compiler_bugs/reused_base_constructor.py @@ -77,7 +77,7 @@ The constructor of `A` is called multiple times in `D` and `E`: :param contract: The contract to detect explicit calls to a base constructor with arguments to. :return: Dictionary of function:list(tuple): { constructor : [(invoking_contract, called_by_constructor]} """ - results = dict() + results = {} # Create a set to track all completed contracts processed_contracts = set() diff --git a/slither/detectors/statements/incorrect_strict_equality.py b/slither/detectors/statements/incorrect_strict_equality.py index 20843e425..9a2234f4f 100644 --- a/slither/detectors/statements/incorrect_strict_equality.py +++ b/slither/detectors/statements/incorrect_strict_equality.py @@ -106,7 +106,7 @@ contract Crowdsale{ # Retrieve all tainted (node, function) pairs def tainted_equality_nodes(self, funcs, taints): - results = dict() + results = {} taints += self.sources_taint for func in funcs: diff --git a/slither/detectors/statements/write_after_write.py b/slither/detectors/statements/write_after_write.py index c9978188f..ea654f79d 100644 --- a/slither/detectors/statements/write_after_write.py +++ b/slither/detectors/statements/write_after_write.py @@ -88,7 +88,7 @@ def _detect_write_after_write( _handle_ir(ir, written, ret) if len(node.sons) > 1: - written = dict() + written = {} for son in node.sons: _detect_write_after_write(son, explored, dict(written), ret) @@ -128,7 +128,7 @@ class WriteAfterWrite(AbstractDetector): for function in contract.functions: if function.entry_point: ret = [] - _detect_write_after_write(function.entry_point, set(), dict(), ret) + _detect_write_after_write(function.entry_point, set(), {}, ret) for var, node1, node2 in ret: info = [var, " is written in both\n\t", node1, "\n\t", node2, "\n"] diff --git a/slither/formatters/attributes/constant_pragma.py b/slither/formatters/attributes/constant_pragma.py index 8cb35b81e..572ad2fdf 100644 --- a/slither/formatters/attributes/constant_pragma.py +++ b/slither/formatters/attributes/constant_pragma.py @@ -34,7 +34,7 @@ def custom_format(slither, result): def _analyse_versions(used_solc_versions): - replace_solc_versions = list() + replace_solc_versions = [] for version in used_solc_versions: replace_solc_versions.append(_determine_solc_version_replacement(version)) if not all(version == replace_solc_versions[0] for version in replace_solc_versions): diff --git a/slither/printers/abstract_printer.py b/slither/printers/abstract_printer.py index 7a60aa1ae..f58f92f91 100644 --- a/slither/printers/abstract_printer.py +++ b/slither/printers/abstract_printer.py @@ -21,17 +21,17 @@ class AbstractPrinter(metaclass=abc.ABCMeta): if not self.HELP: raise IncorrectPrinterInitialization( - "HELP is not initialized {}".format(self.__class__.__name__) + f"HELP is not initialized {self.__class__.__name__}" ) if not self.ARGUMENT: raise IncorrectPrinterInitialization( - "ARGUMENT is not initialized {}".format(self.__class__.__name__) + f"ARGUMENT is not initialized {self.__class__.__name__}" ) if not self.WIKI: raise IncorrectPrinterInitialization( - "WIKI is not initialized {}".format(self.__class__.__name__) + f"WIKI is not initialized {self.__class__.__name__}" ) def info(self, info): diff --git a/slither/printers/inheritance/inheritance_graph.py b/slither/printers/inheritance/inheritance_graph.py index f0da17c59..7ff819a55 100644 --- a/slither/printers/inheritance/inheritance_graph.py +++ b/slither/printers/inheritance/inheritance_graph.py @@ -102,10 +102,10 @@ class PrinterInheritanceGraph(AbstractPrinter): if len(contract.immediate_inheritance) == 1: ret += "%s -> %s;\n" % (contract.name, contract.immediate_inheritance[0]) else: - for i in range(0, len(contract.immediate_inheritance)): + for i, immediate_inheritance in enumerate(contract.immediate_inheritance): ret += '%s -> %s [ label="%s" ];\n' % ( contract.name, - contract.immediate_inheritance[i], + immediate_inheritance, i + 1, ) diff --git a/slither/printers/summary/evm.py b/slither/printers/summary/evm.py index 6b600257a..027b41ef3 100644 --- a/slither/printers/summary/evm.py +++ b/slither/printers/summary/evm.py @@ -57,6 +57,7 @@ def _extract_evm_info(slither): return evm_info +# pylint: disable=too-many-locals class PrinterEVM(AbstractPrinter): ARGUMENT = "evm" HELP = "Print the evm instructions of nodes in functions" @@ -84,9 +85,8 @@ class PrinterEVM(AbstractPrinter): contract_file = self.slither.source_code[ contract.source_mapping["filename_absolute"] ].encode("utf-8") - contract_file_lines = open( - contract.source_mapping["filename_absolute"], "r" - ).readlines() + with open(contract.source_mapping["filename_absolute"], "r", encoding="utf8") as f: + contract_file_lines = f.readlines() contract_pcs = {} contract_cfg = {} diff --git a/slither/printers/summary/human_summary.py b/slither/printers/summary/human_summary.py index c3c94c9a1..ec1282f78 100644 --- a/slither/printers/summary/human_summary.py +++ b/slither/printers/summary/human_summary.py @@ -308,7 +308,7 @@ class PrinterHumanSummary(AbstractPrinter): "number_lines_assembly": 0, "standard_libraries": [], "ercs": [], - "number_findings": dict(), + "number_findings": {}, "detectors": [], } diff --git a/slither/slithir/convert.py b/slither/slithir/convert.py index 4e624df0e..a1ebef063 100644 --- a/slither/slithir/convert.py +++ b/slither/slithir/convert.py @@ -490,7 +490,7 @@ def propagate_types(ir, node: "Node"): # pylint: disable=too-many-locals # propagate the type node_function = node.function using_for = ( - node_function.contract.using_for if isinstance(node_function, FunctionContract) else dict() + node_function.contract.using_for if isinstance(node_function, FunctionContract) else {} ) if isinstance(ir, OperationWithLValue): # Force assignment in case of missing previous correct type @@ -853,7 +853,7 @@ def extract_tmp_call(ins: TmpCall, contract: Optional[Contract]): # pylint: dis # } node_func = ins.node.function using_for = ( - node_func.contract.using_for if isinstance(node_func, FunctionContract) else dict() + node_func.contract.using_for if isinstance(node_func, FunctionContract) else {} ) targeted_libraries = ( diff --git a/slither/slithir/tmp_operations/argument.py b/slither/slithir/tmp_operations/argument.py index 1e1ab79f3..746bc13f2 100644 --- a/slither/slithir/tmp_operations/argument.py +++ b/slither/slithir/tmp_operations/argument.py @@ -42,5 +42,5 @@ class Argument(Operation): def __str__(self): call_id = "none" if self.call_id: - call_id = "(id ({}))".format(self.call_id) - return "ARG_{} {} {}".format(self._type.name, str(self._argument), call_id) + call_id = f"(id ({self.call_id}))" + return f"ARG_{self._type.name} {str(self._argument)} {call_id}" diff --git a/slither/slithir/utils/ssa.py b/slither/slithir/utils/ssa.py index b3b0edebc..a6499f362 100644 --- a/slither/slithir/utils/ssa.py +++ b/slither/slithir/utils/ssa.py @@ -109,7 +109,7 @@ def add_ssa_ir(function, all_state_variables_instances): if not function.is_implemented: return - init_definition = dict() + init_definition = {} for v in function.parameters: if v.name: init_definition[v.name] = (v, function.entry_point) @@ -127,7 +127,7 @@ def add_ssa_ir(function, all_state_variables_instances): # rvalues are fixed in solc_parsing.declaration.function function.entry_point.add_ssa_ir(Phi(StateIRVariable(variable_instance), set())) - add_phi_origins(function.entry_point, init_definition, dict()) + add_phi_origins(function.entry_point, init_definition, {}) for node in function.nodes: for (variable, nodes) in node.phi_origins_local_variables.values(): @@ -143,7 +143,7 @@ def add_ssa_ir(function, all_state_variables_instances): # continue node.add_ssa_ir(Phi(StateIRVariable(variable), nodes)) - init_local_variables_instances = dict() + init_local_variables_instances = {} for v in function.parameters: if v.name: new_var = LocalIRVariable(v) @@ -232,9 +232,9 @@ def generate_ssa_irs( # these variables are lived only during the liveness of the block # They dont need phi function - temporary_variables_instances = dict() - reference_variables_instances = dict() - tuple_variables_instances = dict() + temporary_variables_instances = {} + reference_variables_instances = {} + tuple_variables_instances = {} for ir in node.irs: new_ir = copy_ir( diff --git a/slither/solc_parsing/declarations/function.py b/slither/solc_parsing/declarations/function.py index 7551411ea..50eda9acc 100644 --- a/slither/solc_parsing/declarations/function.py +++ b/slither/solc_parsing/declarations/function.py @@ -83,8 +83,8 @@ class FunctionSolc(CallerContextExpression): self._analyze_type() - self._node_to_nodesolc: Dict[Node, NodeSolc] = dict() - self._node_to_yulobject: Dict[Node, YulBlock] = dict() + self._node_to_nodesolc: Dict[Node, NodeSolc] = {} + self._node_to_yulobject: Dict[Node, YulBlock] = {} self._local_variables_parser: List[ Union[LocalVariableSolc, LocalVariableInitFromTupleSolc] diff --git a/slither/solc_parsing/slither_compilation_unit_solc.py b/slither/solc_parsing/slither_compilation_unit_solc.py index fc1c5b3eb..ffc201714 100644 --- a/slither/solc_parsing/slither_compilation_unit_solc.py +++ b/slither/solc_parsing/slither_compilation_unit_solc.py @@ -37,7 +37,7 @@ class SlitherCompilationUnitSolc: self._parsed = False self._analyzed = False - self._underlying_contract_to_parser: Dict[Contract, ContractSolc] = dict() + self._underlying_contract_to_parser: Dict[Contract, ContractSolc] = {} self._structures_top_level_parser: List[StructureTopLevelSolc] = [] self._custom_error_parser: List[CustomErrorSolc] = [] self._variables_top_level_parser: List[TopLevelVariableSolc] = [] @@ -636,7 +636,7 @@ Please rename it, this name is reserved for Slither's internals""" for func in self._compilation_unit.functions_top_level: func.generate_slithir_and_analyze() - func.generate_slithir_ssa(dict()) + func.generate_slithir_ssa({}) self._compilation_unit.propagate_function_calls() for contract in self._compilation_unit.contracts: contract.fix_phi() diff --git a/slither/tools/flattening/export/export.py b/slither/tools/flattening/export/export.py index 75b9ac941..e9b4552ef 100644 --- a/slither/tools/flattening/export/export.py +++ b/slither/tools/flattening/export/export.py @@ -37,7 +37,7 @@ def save_to_disk(files: List[Export]): Save projects to a zip """ for file in files: - with open(file.filename, "w") as f: + with open(file.filename, "w", encoding="utf8") as f: logger.info(f"Export {file.filename}") f.write(file.content) @@ -53,5 +53,5 @@ def export_as_json(files: List[Export], filename: str): print(json.dumps(files_as_dict)) else: logger.info(f"Export {filename}") - with open(filename, "w") as f: + with open(filename, "w", encoding="utf8") as f: json.dump(files_as_dict, f) diff --git a/slither/tools/mutator/mutators/MIA.py b/slither/tools/mutator/mutators/MIA.py index b8a33cb95..d0ff1b3ea 100644 --- a/slither/tools/mutator/mutators/MIA.py +++ b/slither/tools/mutator/mutators/MIA.py @@ -11,7 +11,7 @@ class MIA(AbstractMutator): # pylint: disable=too-few-public-methods def _mutate(self): - result = dict() + result = {} for contract in self.slither.contracts: diff --git a/slither/tools/mutator/mutators/MVIE.py b/slither/tools/mutator/mutators/MVIE.py index 1c631edcf..7e91b9324 100644 --- a/slither/tools/mutator/mutators/MVIE.py +++ b/slither/tools/mutator/mutators/MVIE.py @@ -11,7 +11,7 @@ class MVIE(AbstractMutator): # pylint: disable=too-few-public-methods def _mutate(self): - result = dict() + result = {} for contract in self.slither.contracts: diff --git a/slither/tools/mutator/mutators/MVIV.py b/slither/tools/mutator/mutators/MVIV.py index cbdf7fdf0..db1fb4d33 100644 --- a/slither/tools/mutator/mutators/MVIV.py +++ b/slither/tools/mutator/mutators/MVIV.py @@ -11,7 +11,7 @@ class MVIV(AbstractMutator): # pylint: disable=too-few-public-methods def _mutate(self): - result = dict() + result = {} for contract in self.slither.contracts: diff --git a/slither/tools/mutator/mutators/abstract_mutator.py b/slither/tools/mutator/mutators/abstract_mutator.py index 26f47c3c3..d01970923 100644 --- a/slither/tools/mutator/mutators/abstract_mutator.py +++ b/slither/tools/mutator/mutators/abstract_mutator.py @@ -41,33 +41,33 @@ class AbstractMutator(metaclass=abc.ABCMeta): # pylint: disable=too-few-public- if not self.NAME: raise IncorrectMutatorInitialization( - "NAME is not initialized {}".format(self.__class__.__name__) + f"NAME is not initialized {self.__class__.__name__}" ) if not self.HELP: raise IncorrectMutatorInitialization( - "HELP is not initialized {}".format(self.__class__.__name__) + f"HELP is not initialized {self.__class__.__name__}" ) if self.FAULTCLASS == FaulClass.Undefined: raise IncorrectMutatorInitialization( - "FAULTCLASS is not initialized {}".format(self.__class__.__name__) + f"FAULTCLASS is not initialized {self.__class__.__name__}" ) if self.FAULTNATURE == FaultNature.Undefined: raise IncorrectMutatorInitialization( - "FAULTNATURE is not initialized {}".format(self.__class__.__name__) + f"FAULTNATURE is not initialized {self.__class__.__name__}" ) if rate < 0 or rate > 100: raise IncorrectMutatorInitialization( - "rate must be between 0 and 100 {}".format(self.__class__.__name__) + f"rate must be between 0 and 100 {self.__class__.__name__}" ) @abc.abstractmethod def _mutate(self) -> Dict: """TODO Documentation""" - return dict() + return {} def mutate(self) -> None: all_patches = self._mutate() diff --git a/slither/tools/properties/utils.py b/slither/tools/properties/utils.py index 541d85712..bdc5bdd68 100644 --- a/slither/tools/properties/utils.py +++ b/slither/tools/properties/utils.py @@ -32,5 +32,5 @@ def write_file( logger.info(yellow(f"Overwrite {file_to_write}")) else: logger.info(green(f"Write {file_to_write}")) - with open(file_to_write, "w") as f: + with open(file_to_write, "w", encoding="utf8") as f: f.write(content) diff --git a/slither/tools/similarity/__main__.py b/slither/tools/similarity/__main__.py index f7b2692ad..21ba88681 100755 --- a/slither/tools/similarity/__main__.py +++ b/slither/tools/similarity/__main__.py @@ -95,7 +95,7 @@ def main(): elif mode == "plot": plot(args) else: - to_log = "Invalid mode!. It should be one of these: %s" % ", ".join(modes) + to_log = f"Invalid mode!. It should be one of these: {', '.join(modes)}" logger.error(to_log) sys.exit(-1) diff --git a/slither/tools/similarity/cache.py b/slither/tools/similarity/cache.py index 81df40972..53fc7f5f0 100644 --- a/slither/tools/similarity/cache.py +++ b/slither/tools/similarity/cache.py @@ -9,7 +9,7 @@ except ImportError: def load_cache(infile, nsamples=None): - cache = dict() + cache = {} with np.load(infile, allow_pickle=True) as data: array = data["arr_0"][0] for i, (x, y) in enumerate(array): diff --git a/slither/tools/similarity/encode.py b/slither/tools/similarity/encode.py index 5313e9c7c..67ed008b2 100644 --- a/slither/tools/similarity/encode.py +++ b/slither/tools/similarity/encode.py @@ -75,7 +75,7 @@ def parse_target(target): def load_and_encode(infile, vmodel, ext=None, nsamples=None, **kwargs): - r = dict() + r = {} if infile.endswith(".npz"): r = load_cache(infile, nsamples=nsamples) else: @@ -222,7 +222,7 @@ def encode_ir(ir): # pylint: disable=too-many-branches def encode_contract(cfilename, **kwargs): - r = dict() + r = {} # Init slither try: diff --git a/slither/tools/similarity/plot.py b/slither/tools/similarity/plot.py index 1645f8188..44f94b240 100644 --- a/slither/tools/similarity/plot.py +++ b/slither/tools/similarity/plot.py @@ -50,8 +50,8 @@ def plot(args): # pylint: disable=too-many-locals logger.info("Loading data..") cache = load_and_encode(infile, **vars(args)) - data = list() - fs = list() + data = [] + fs = [] logger.info("Procesing data..") for (f, c, n), y in cache.items(): diff --git a/slither/tools/similarity/test.py b/slither/tools/similarity/test.py index 51cedd53a..41e58d2b0 100755 --- a/slither/tools/similarity/test.py +++ b/slither/tools/similarity/test.py @@ -34,7 +34,7 @@ def test(args): cache = load_and_encode(infile, model, **vars(args)) # save_cache("cache.npz", cache) - r = dict() + r = {} for x, y in cache.items(): r[x] = similarity(fvector, y) diff --git a/slither/tools/similarity/train.py b/slither/tools/similarity/train.py index 52b1a0e66..46d8b3e53 100755 --- a/slither/tools/similarity/train.py +++ b/slither/tools/similarity/train.py @@ -24,7 +24,7 @@ def train(args): # pylint: disable=too-many-locals contracts = load_contracts(dirname, **vars(args)) logger.info("Saving extracted data into %s", last_data_train_filename) cache = [] - with open(last_data_train_filename, "w") as f: + with open(last_data_train_filename, "w", encoding="utf8") as f: for filename in contracts: # cache[filename] = dict() for (filename_inner, contract, function), ir in encode_contract( diff --git a/slither/tools/slither_format/__main__.py b/slither/tools/slither_format/__main__.py index 4c9bcab5e..a3d63d922 100644 --- a/slither/tools/slither_format/__main__.py +++ b/slither/tools/slither_format/__main__.py @@ -66,7 +66,7 @@ def parse_args(): group_detector.add_argument( "--detect", help="Comma-separated list of detectors, defaults to all, " - "available detectors: {}".format(", ".join(d for d in available_detectors)), + f"available detectors: {', '.join(d for d in available_detectors)}", action="store", dest="detectors_to_run", default="all", @@ -75,7 +75,7 @@ def parse_args(): group_detector.add_argument( "--exclude", help="Comma-separated list of detectors to exclude," - "available detectors: {}".format(", ".join(d for d in available_detectors)), + "available detectors: {', '.join(d for d in available_detectors)}", action="store", dest="detectors_to_exclude", default="all", diff --git a/slither/tools/slither_format/slither_format.py b/slither/tools/slither_format/slither_format.py index 63ceb2a43..a33deb636 100644 --- a/slither/tools/slither_format/slither_format.py +++ b/slither/tools/slither_format/slither_format.py @@ -72,7 +72,7 @@ def slither_format(slither, **kwargs): # pylint: disable=too-many-locals filename = f"fix_{counter}.patch" path = Path(export_result, filename) logger.info(f"\t- {filename}") - with open(path, "w") as f: + with open(path, "w", encoding="utf8") as f: f.write(diff) counter += 1 @@ -90,10 +90,10 @@ def choose_detectors(detectors_to_run, detectors_to_exclude): cls_detectors_to_run = [] exclude = detectors_to_exclude.split(",") if detectors_to_run == "all": - for d in all_detectors: - if d in exclude: + for key, detector in all_detectors.items(): + if key in exclude: continue - cls_detectors_to_run.append(all_detectors[d]) + cls_detectors_to_run.append(detector) else: exclude = detectors_to_exclude.split(",") for d in detectors_to_run.split(","): diff --git a/slither/tools/upgradeability/__main__.py b/slither/tools/upgradeability/__main__.py index f0d4a250d..882486a60 100644 --- a/slither/tools/upgradeability/__main__.py +++ b/slither/tools/upgradeability/__main__.py @@ -208,7 +208,7 @@ def main(): proxy_contracts = proxy.get_contract_from_name(args.proxy_name) if len(proxy_contracts) != 1: - info = "Proxy {} not found in {}".format(args.proxy_name, proxy.filename) + info = f"Proxy {args.proxy_name} not found in {proxy.filename}" logger.error(red(info)) if args.json: output_to_json(args.json, str(info), json_results) @@ -230,8 +230,8 @@ def main(): v2_contracts = variable2.get_contract_from_name(args.new_contract_name) if len(v2_contracts) != 1: - info = "New logic contract {} not found in {}".format( - args.new_contract_name, variable2.filename + info = ( + f"New logic contract {args.new_contract_name} not found in {variable2.filename}" ) logger.error(red(info)) if args.json: diff --git a/slither/tools/upgradeability/checks/abstract_checks.py b/slither/tools/upgradeability/checks/abstract_checks.py index 7493ee1c1..1f42e92e5 100644 --- a/slither/tools/upgradeability/checks/abstract_checks.py +++ b/slither/tools/upgradeability/checks/abstract_checks.py @@ -64,48 +64,40 @@ class AbstractCheck(metaclass=abc.ABCMeta): self.contract_v2 = contract_v2 if not self.ARGUMENT: - raise IncorrectCheckInitialization( - "NAME is not initialized {}".format(self.__class__.__name__) - ) + raise IncorrectCheckInitialization(f"NAME is not initialized {self.__class__.__name__}") if not self.HELP: - raise IncorrectCheckInitialization( - "HELP is not initialized {}".format(self.__class__.__name__) - ) + raise IncorrectCheckInitialization(f"HELP is not initialized {self.__class__.__name__}") if not self.WIKI: - raise IncorrectCheckInitialization( - "WIKI is not initialized {}".format(self.__class__.__name__) - ) + raise IncorrectCheckInitialization(f"WIKI is not initialized {self.__class__.__name__}") if not self.WIKI_TITLE: raise IncorrectCheckInitialization( - "WIKI_TITLE is not initialized {}".format(self.__class__.__name__) + f"WIKI_TITLE is not initialized {self.__class__.__name__}" ) if not self.WIKI_DESCRIPTION: raise IncorrectCheckInitialization( - "WIKI_DESCRIPTION is not initialized {}".format(self.__class__.__name__) + f"WIKI_DESCRIPTION is not initialized {self.__class__.__name__}" ) if not self.WIKI_EXPLOIT_SCENARIO and self.IMPACT not in [ CheckClassification.INFORMATIONAL ]: raise IncorrectCheckInitialization( - "WIKI_EXPLOIT_SCENARIO is not initialized {}".format(self.__class__.__name__) + f"WIKI_EXPLOIT_SCENARIO is not initialized {self.__class__.__name__}" ) if not self.WIKI_RECOMMENDATION: raise IncorrectCheckInitialization( - "WIKI_RECOMMENDATION is not initialized {}".format(self.__class__.__name__) + f"WIKI_RECOMMENDATION is not initialized {self.__class__.__name__}" ) if self.REQUIRE_PROXY and self.REQUIRE_CONTRACT_V2: # This is not a fundatemenal issues # But it requires to change __main__ to avoid running two times the detectors - txt = "REQUIRE_PROXY and REQUIRE_CONTRACT_V2 needs change in __main___ {}".format( - self.__class__.__name__ - ) + txt = f"REQUIRE_PROXY and REQUIRE_CONTRACT_V2 needs change in __main___ {self.__class__.__name__}" raise IncorrectCheckInitialization(txt) if self.IMPACT not in [ @@ -115,17 +107,17 @@ class AbstractCheck(metaclass=abc.ABCMeta): CheckClassification.INFORMATIONAL, ]: raise IncorrectCheckInitialization( - "IMPACT is not initialized {}".format(self.__class__.__name__) + f"IMPACT is not initialized {self.__class__.__name__}" ) if self.REQUIRE_CONTRACT_V2 and contract_v2 is None: raise IncorrectCheckInitialization( - "ContractV2 is not initialized {}".format(self.__class__.__name__) + f"ContractV2 is not initialized {self.__class__.__name__}" ) if self.REQUIRE_PROXY and proxy is None: raise IncorrectCheckInitialization( - "Proxy is not initialized {}".format(self.__class__.__name__) + f"Proxy is not initialized {self.__class__.__name__}" ) @abc.abstractmethod diff --git a/slither/utils/command_line.py b/slither/utils/command_line.py index 1920d0fa0..39ab82820 100644 --- a/slither/utils/command_line.py +++ b/slither/utils/command_line.py @@ -54,7 +54,7 @@ defaults_flag_in_config = { def read_config_file(args): if os.path.isfile(args.config_file): try: - with open(args.config_file) as f: + with open(args.config_file, encoding="utf8") as f: config = json.load(f) for key, elem in config.items(): if key not in defaults_flag_in_config: diff --git a/tests/ast-parsing/compile/assembly-0.8.11-compact.zip b/tests/ast-parsing/compile/assembly-0.8.11-compact.zip new file mode 100644 index 000000000..a05d93b61 Binary files /dev/null and b/tests/ast-parsing/compile/assembly-0.8.11-compact.zip differ diff --git a/tests/ast-parsing/compile/assignment-0.8.11-compact.zip b/tests/ast-parsing/compile/assignment-0.8.11-compact.zip new file mode 100644 index 000000000..b4d165e65 Binary files /dev/null and b/tests/ast-parsing/compile/assignment-0.8.11-compact.zip differ diff --git a/tests/ast-parsing/compile/binaryoperation-0.8.11-compact.zip b/tests/ast-parsing/compile/binaryoperation-0.8.11-compact.zip new file mode 100644 index 000000000..2005dd1ee Binary files /dev/null and b/tests/ast-parsing/compile/binaryoperation-0.8.11-compact.zip differ diff --git a/tests/ast-parsing/compile/break-0.8.11-compact.zip b/tests/ast-parsing/compile/break-0.8.11-compact.zip new file mode 100644 index 000000000..4ccb9f85a Binary files /dev/null and b/tests/ast-parsing/compile/break-0.8.11-compact.zip differ diff --git a/tests/ast-parsing/compile/call_to_variable-0.8.11-compact.zip b/tests/ast-parsing/compile/call_to_variable-0.8.11-compact.zip new file mode 100644 index 000000000..de5429ac4 Binary files /dev/null and b/tests/ast-parsing/compile/call_to_variable-0.8.11-compact.zip differ diff --git a/tests/ast-parsing/compile/comment-0.8.11-compact.zip b/tests/ast-parsing/compile/comment-0.8.11-compact.zip new file mode 100644 index 000000000..85bc0d91a Binary files /dev/null and b/tests/ast-parsing/compile/comment-0.8.11-compact.zip differ diff --git a/tests/ast-parsing/compile/conditional-0.8.11-compact.zip b/tests/ast-parsing/compile/conditional-0.8.11-compact.zip new file mode 100644 index 000000000..760fc233c Binary files /dev/null and b/tests/ast-parsing/compile/conditional-0.8.11-compact.zip differ diff --git a/tests/ast-parsing/compile/continue-0.8.11-compact.zip b/tests/ast-parsing/compile/continue-0.8.11-compact.zip new file mode 100644 index 000000000..0e4a67800 Binary files /dev/null and b/tests/ast-parsing/compile/continue-0.8.11-compact.zip differ diff --git a/tests/ast-parsing/compile/contract-0.8.11-compact.zip b/tests/ast-parsing/compile/contract-0.8.11-compact.zip new file mode 100644 index 000000000..c39f89c8b Binary files /dev/null and b/tests/ast-parsing/compile/contract-0.8.11-compact.zip differ diff --git a/tests/ast-parsing/compile/custom_error-0.8.11-compact.zip b/tests/ast-parsing/compile/custom_error-0.8.11-compact.zip new file mode 100644 index 000000000..2d63a3708 Binary files /dev/null and b/tests/ast-parsing/compile/custom_error-0.8.11-compact.zip differ diff --git a/tests/ast-parsing/compile/dowhile-0.8.11-compact.zip b/tests/ast-parsing/compile/dowhile-0.8.11-compact.zip new file mode 100644 index 000000000..8e85d1089 Binary files /dev/null and b/tests/ast-parsing/compile/dowhile-0.8.11-compact.zip differ diff --git a/tests/ast-parsing/compile/emit-0.8.11-compact.zip b/tests/ast-parsing/compile/emit-0.8.11-compact.zip new file mode 100644 index 000000000..97188dd87 Binary files /dev/null and b/tests/ast-parsing/compile/emit-0.8.11-compact.zip differ diff --git a/tests/ast-parsing/compile/enum-0.8.11-compact.zip b/tests/ast-parsing/compile/enum-0.8.11-compact.zip new file mode 100644 index 000000000..31dcb58e8 Binary files /dev/null and b/tests/ast-parsing/compile/enum-0.8.11-compact.zip differ diff --git a/tests/ast-parsing/compile/event-0.8.11-compact.zip b/tests/ast-parsing/compile/event-0.8.11-compact.zip new file mode 100644 index 000000000..6843ddd97 Binary files /dev/null and b/tests/ast-parsing/compile/event-0.8.11-compact.zip differ diff --git a/tests/ast-parsing/compile/for-0.8.11-compact.zip b/tests/ast-parsing/compile/for-0.8.11-compact.zip new file mode 100644 index 000000000..4a5d1efea Binary files /dev/null and b/tests/ast-parsing/compile/for-0.8.11-compact.zip differ diff --git a/tests/ast-parsing/compile/function-0.8.11-compact.zip b/tests/ast-parsing/compile/function-0.8.11-compact.zip new file mode 100644 index 000000000..001b1600c Binary files /dev/null and b/tests/ast-parsing/compile/function-0.8.11-compact.zip differ diff --git a/tests/ast-parsing/compile/functioncall-0.8.11-compact.zip b/tests/ast-parsing/compile/functioncall-0.8.11-compact.zip new file mode 100644 index 000000000..1a29f5143 Binary files /dev/null and b/tests/ast-parsing/compile/functioncall-0.8.11-compact.zip differ diff --git a/tests/ast-parsing/compile/if-0.8.11-compact.zip b/tests/ast-parsing/compile/if-0.8.11-compact.zip new file mode 100644 index 000000000..d67fe05e5 Binary files /dev/null and b/tests/ast-parsing/compile/if-0.8.11-compact.zip differ diff --git a/tests/ast-parsing/compile/indexaccess-0.8.11-compact.zip b/tests/ast-parsing/compile/indexaccess-0.8.11-compact.zip new file mode 100644 index 000000000..8294b6554 Binary files /dev/null and b/tests/ast-parsing/compile/indexaccess-0.8.11-compact.zip differ diff --git a/tests/ast-parsing/compile/indexrangeaccess-0.8.11-compact.zip b/tests/ast-parsing/compile/indexrangeaccess-0.8.11-compact.zip new file mode 100644 index 000000000..128cdab6a Binary files /dev/null and b/tests/ast-parsing/compile/indexrangeaccess-0.8.11-compact.zip differ diff --git a/tests/ast-parsing/compile/library_implicit_conversion-0.8.11-compact.zip b/tests/ast-parsing/compile/library_implicit_conversion-0.8.11-compact.zip new file mode 100644 index 000000000..8e5600ffb Binary files /dev/null and b/tests/ast-parsing/compile/library_implicit_conversion-0.8.11-compact.zip differ diff --git a/tests/ast-parsing/compile/literal-0.8.11-compact.zip b/tests/ast-parsing/compile/literal-0.8.11-compact.zip new file mode 100644 index 000000000..c70ca932e Binary files /dev/null and b/tests/ast-parsing/compile/literal-0.8.11-compact.zip differ diff --git a/tests/ast-parsing/compile/memberaccess-0.8.11-compact.zip b/tests/ast-parsing/compile/memberaccess-0.8.11-compact.zip new file mode 100644 index 000000000..f0f8b9734 Binary files /dev/null and b/tests/ast-parsing/compile/memberaccess-0.8.11-compact.zip differ diff --git a/tests/ast-parsing/compile/minmax-0.8.11-compact.zip b/tests/ast-parsing/compile/minmax-0.8.11-compact.zip new file mode 100644 index 000000000..43d5c7dc6 Binary files /dev/null and b/tests/ast-parsing/compile/minmax-0.8.11-compact.zip differ diff --git a/tests/ast-parsing/compile/modifier-0.8.11-compact.zip b/tests/ast-parsing/compile/modifier-0.8.11-compact.zip new file mode 100644 index 000000000..711d1fda8 Binary files /dev/null and b/tests/ast-parsing/compile/modifier-0.8.11-compact.zip differ diff --git a/tests/ast-parsing/compile/newexpression-0.8.11-compact.zip b/tests/ast-parsing/compile/newexpression-0.8.11-compact.zip new file mode 100644 index 000000000..9de0dcebb Binary files /dev/null and b/tests/ast-parsing/compile/newexpression-0.8.11-compact.zip differ diff --git a/tests/ast-parsing/compile/pragma-0.8.11-compact.zip b/tests/ast-parsing/compile/pragma-0.8.11-compact.zip new file mode 100644 index 000000000..bbddf7975 Binary files /dev/null and b/tests/ast-parsing/compile/pragma-0.8.11-compact.zip differ diff --git a/tests/ast-parsing/compile/push-0.8.11-compact.zip b/tests/ast-parsing/compile/push-0.8.11-compact.zip new file mode 100644 index 000000000..799471e49 Binary files /dev/null and b/tests/ast-parsing/compile/push-0.8.11-compact.zip differ diff --git a/tests/ast-parsing/compile/return-0.8.11-compact.zip b/tests/ast-parsing/compile/return-0.8.11-compact.zip new file mode 100644 index 000000000..13ee2afb5 Binary files /dev/null and b/tests/ast-parsing/compile/return-0.8.11-compact.zip differ diff --git a/tests/ast-parsing/compile/scope-0.8.11-compact.zip b/tests/ast-parsing/compile/scope-0.8.11-compact.zip new file mode 100644 index 000000000..a9e5c52e3 Binary files /dev/null and b/tests/ast-parsing/compile/scope-0.8.11-compact.zip differ diff --git a/tests/ast-parsing/compile/struct-0.8.11-compact.zip b/tests/ast-parsing/compile/struct-0.8.11-compact.zip new file mode 100644 index 000000000..e52ba4f5b Binary files /dev/null and b/tests/ast-parsing/compile/struct-0.8.11-compact.zip differ diff --git a/tests/ast-parsing/compile/throw-0.8.11-compact.zip b/tests/ast-parsing/compile/throw-0.8.11-compact.zip new file mode 100644 index 000000000..a5bec5259 Binary files /dev/null and b/tests/ast-parsing/compile/throw-0.8.11-compact.zip differ diff --git a/tests/ast-parsing/compile/top-level-0.8.11-compact.zip b/tests/ast-parsing/compile/top-level-0.8.11-compact.zip new file mode 100644 index 000000000..429c3a1e8 Binary files /dev/null and b/tests/ast-parsing/compile/top-level-0.8.11-compact.zip differ diff --git a/tests/ast-parsing/compile/top-level-import-0.8.11-compact.zip b/tests/ast-parsing/compile/top-level-import-0.8.11-compact.zip new file mode 100644 index 000000000..fa5af877d Binary files /dev/null and b/tests/ast-parsing/compile/top-level-import-0.8.11-compact.zip differ diff --git a/tests/ast-parsing/compile/top-level-import-bis-0.8.11-compact.zip b/tests/ast-parsing/compile/top-level-import-bis-0.8.11-compact.zip new file mode 100644 index 000000000..59e7e93f2 Binary files /dev/null and b/tests/ast-parsing/compile/top-level-import-bis-0.8.11-compact.zip differ diff --git a/tests/ast-parsing/compile/top-level-nested-import-0.8.11-compact.zip b/tests/ast-parsing/compile/top-level-nested-import-0.8.11-compact.zip new file mode 100644 index 000000000..f7c01751d Binary files /dev/null and b/tests/ast-parsing/compile/top-level-nested-import-0.8.11-compact.zip differ diff --git a/tests/ast-parsing/compile/trycatch-0.8.11-compact.zip b/tests/ast-parsing/compile/trycatch-0.8.11-compact.zip new file mode 100644 index 000000000..1b30a2ec2 Binary files /dev/null and b/tests/ast-parsing/compile/trycatch-0.8.11-compact.zip differ diff --git a/tests/ast-parsing/compile/tupleexpression-0.8.11-compact.zip b/tests/ast-parsing/compile/tupleexpression-0.8.11-compact.zip new file mode 100644 index 000000000..66e0220db Binary files /dev/null and b/tests/ast-parsing/compile/tupleexpression-0.8.11-compact.zip differ diff --git a/tests/ast-parsing/compile/unaryexpression-0.8.11-compact.zip b/tests/ast-parsing/compile/unaryexpression-0.8.11-compact.zip new file mode 100644 index 000000000..dec4f7eb1 Binary files /dev/null and b/tests/ast-parsing/compile/unaryexpression-0.8.11-compact.zip differ diff --git a/tests/ast-parsing/compile/unchecked-0.8.11-compact.zip b/tests/ast-parsing/compile/unchecked-0.8.11-compact.zip new file mode 100644 index 000000000..f82f084db Binary files /dev/null and b/tests/ast-parsing/compile/unchecked-0.8.11-compact.zip differ diff --git a/tests/ast-parsing/compile/units_and_global_variables-0.8.11-compact.zip b/tests/ast-parsing/compile/units_and_global_variables-0.8.11-compact.zip new file mode 100644 index 000000000..3244a816d Binary files /dev/null and b/tests/ast-parsing/compile/units_and_global_variables-0.8.11-compact.zip differ diff --git a/tests/ast-parsing/compile/using-for-0.8.11-compact.zip b/tests/ast-parsing/compile/using-for-0.8.11-compact.zip new file mode 100644 index 000000000..016d51e38 Binary files /dev/null and b/tests/ast-parsing/compile/using-for-0.8.11-compact.zip differ diff --git a/tests/ast-parsing/compile/variable-0.8.11-compact.zip b/tests/ast-parsing/compile/variable-0.8.11-compact.zip new file mode 100644 index 000000000..a2812d048 Binary files /dev/null and b/tests/ast-parsing/compile/variable-0.8.11-compact.zip differ diff --git a/tests/ast-parsing/compile/variabledeclaration-0.8.11-compact.zip b/tests/ast-parsing/compile/variabledeclaration-0.8.11-compact.zip new file mode 100644 index 000000000..462d0e468 Binary files /dev/null and b/tests/ast-parsing/compile/variabledeclaration-0.8.11-compact.zip differ diff --git a/tests/ast-parsing/compile/while-0.8.11-compact.zip b/tests/ast-parsing/compile/while-0.8.11-compact.zip new file mode 100644 index 000000000..0d0cb687e Binary files /dev/null and b/tests/ast-parsing/compile/while-0.8.11-compact.zip differ diff --git a/tests/ast-parsing/compile/yul-0.8.11-compact.zip b/tests/ast-parsing/compile/yul-0.8.11-compact.zip new file mode 100644 index 000000000..8b29281f0 Binary files /dev/null and b/tests/ast-parsing/compile/yul-0.8.11-compact.zip differ diff --git a/tests/ast-parsing/expected/assembly-0.8.11-compact.json b/tests/ast-parsing/expected/assembly-0.8.11-compact.json new file mode 100644 index 000000000..d0a1cb33e --- /dev/null +++ b/tests/ast-parsing/expected/assembly-0.8.11-compact.json @@ -0,0 +1,5 @@ +{ + "C": { + "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: INLINE ASM 1\n\"];\n1->2;\n2[label=\"Node Type: NEW VARIABLE 2\n\"];\n2->3;\n3[label=\"Node Type: EXPRESSION 3\n\"];\n3->4;\n4[label=\"Node Type: INLINE ASM 4\n\"];\n4->5;\n5[label=\"Node Type: NEW VARIABLE 5\n\"];\n5->6;\n6[label=\"Node Type: EXPRESSION 6\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/assignment-0.8.11-compact.json b/tests/ast-parsing/expected/assignment-0.8.11-compact.json new file mode 100644 index 000000000..8f9f9857b --- /dev/null +++ b/tests/ast-parsing/expected/assignment-0.8.11-compact.json @@ -0,0 +1,5 @@ +{ + "C": { + "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: NEW VARIABLE 1\n\"];\n1->2;\n2[label=\"Node Type: EXPRESSION 2\n\"];\n2->3;\n3[label=\"Node Type: EXPRESSION 3\n\"];\n3->4;\n4[label=\"Node Type: EXPRESSION 4\n\"];\n4->5;\n5[label=\"Node Type: EXPRESSION 5\n\"];\n5->6;\n6[label=\"Node Type: EXPRESSION 6\n\"];\n6->7;\n7[label=\"Node Type: EXPRESSION 7\n\"];\n7->8;\n8[label=\"Node Type: EXPRESSION 8\n\"];\n8->9;\n9[label=\"Node Type: EXPRESSION 9\n\"];\n9->10;\n10[label=\"Node Type: EXPRESSION 10\n\"];\n10->11;\n11[label=\"Node Type: EXPRESSION 11\n\"];\n11->12;\n12[label=\"Node Type: EXPRESSION 12\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/binaryoperation-0.8.11-compact.json b/tests/ast-parsing/expected/binaryoperation-0.8.11-compact.json new file mode 100644 index 000000000..8939b57f2 --- /dev/null +++ b/tests/ast-parsing/expected/binaryoperation-0.8.11-compact.json @@ -0,0 +1,5 @@ +{ + "C": { + "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: EXPRESSION 1\n\"];\n1->2;\n2[label=\"Node Type: EXPRESSION 2\n\"];\n2->3;\n3[label=\"Node Type: EXPRESSION 3\n\"];\n3->4;\n4[label=\"Node Type: EXPRESSION 4\n\"];\n4->5;\n5[label=\"Node Type: EXPRESSION 5\n\"];\n5->6;\n6[label=\"Node Type: EXPRESSION 6\n\"];\n6->7;\n7[label=\"Node Type: EXPRESSION 7\n\"];\n7->8;\n8[label=\"Node Type: EXPRESSION 8\n\"];\n8->9;\n9[label=\"Node Type: EXPRESSION 9\n\"];\n9->10;\n10[label=\"Node Type: EXPRESSION 10\n\"];\n10->11;\n11[label=\"Node Type: EXPRESSION 11\n\"];\n11->12;\n12[label=\"Node Type: EXPRESSION 12\n\"];\n12->13;\n13[label=\"Node Type: EXPRESSION 13\n\"];\n13->14;\n14[label=\"Node Type: EXPRESSION 14\n\"];\n14->15;\n15[label=\"Node Type: EXPRESSION 15\n\"];\n15->16;\n16[label=\"Node Type: EXPRESSION 16\n\"];\n16->17;\n17[label=\"Node Type: EXPRESSION 17\n\"];\n17->18;\n18[label=\"Node Type: EXPRESSION 18\n\"];\n18->19;\n19[label=\"Node Type: EXPRESSION 19\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/break-0.8.11-compact.json b/tests/ast-parsing/expected/break-0.8.11-compact.json new file mode 100644 index 000000000..b9b7fc93e --- /dev/null +++ b/tests/ast-parsing/expected/break-0.8.11-compact.json @@ -0,0 +1,5 @@ +{ + "C": { + "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: NEW VARIABLE 1\n\"];\n1->4;\n2[label=\"Node Type: BEGIN_LOOP 2\n\"];\n2->5;\n3[label=\"Node Type: END_LOOP 3\n\"];\n3->13;\n4[label=\"Node Type: NEW VARIABLE 4\n\"];\n4->2;\n5[label=\"Node Type: IF_LOOP 5\n\"];\n5->6[label=\"True\"];\n5->3[label=\"False\"];\n6[label=\"Node Type: IF 6\n\"];\n6->7[label=\"True\"];\n6->8[label=\"False\"];\n7[label=\"Node Type: BREAK 7\n\"];\n7->3;\n8[label=\"Node Type: END_IF 8\n\"];\n8->9;\n9[label=\"Node Type: EXPRESSION 9\n\"];\n9->10;\n10[label=\"Node Type: EXPRESSION 10\n\"];\n10->5;\n11[label=\"Node Type: BEGIN_LOOP 11\n\"];\n11->14;\n12[label=\"Node Type: END_LOOP 12\n\"];\n13[label=\"Node Type: NEW VARIABLE 13\n\"];\n13->11;\n14[label=\"Node Type: IF_LOOP 14\n\"];\n14->17[label=\"True\"];\n14->12[label=\"False\"];\n15[label=\"Node Type: BEGIN_LOOP 15\n\"];\n15->18;\n16[label=\"Node Type: END_LOOP 16\n\"];\n16->24;\n17[label=\"Node Type: NEW VARIABLE 17\n\"];\n17->15;\n18[label=\"Node Type: IF_LOOP 18\n\"];\n18->19[label=\"True\"];\n18->16[label=\"False\"];\n19[label=\"Node Type: IF 19\n\"];\n19->20[label=\"True\"];\n19->21[label=\"False\"];\n20[label=\"Node Type: BREAK 20\n\"];\n20->16;\n21[label=\"Node Type: END_IF 21\n\"];\n21->22;\n22[label=\"Node Type: EXPRESSION 22\n\"];\n22->23;\n23[label=\"Node Type: EXPRESSION 23\n\"];\n23->18;\n24[label=\"Node Type: EXPRESSION 24\n\"];\n24->14;\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/call_to_variable-0.8.11-compact.json b/tests/ast-parsing/expected/call_to_variable-0.8.11-compact.json new file mode 100644 index 000000000..113bb5a14 --- /dev/null +++ b/tests/ast-parsing/expected/call_to_variable-0.8.11-compact.json @@ -0,0 +1,6 @@ +{ + "C": {}, + "D": { + "f(C)": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: EXPRESSION 1\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/comment-0.8.11-compact.json b/tests/ast-parsing/expected/comment-0.8.11-compact.json new file mode 100644 index 000000000..a53745acd --- /dev/null +++ b/tests/ast-parsing/expected/comment-0.8.11-compact.json @@ -0,0 +1,5 @@ +{ + "A": { + "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/conditional-0.8.11-compact.json b/tests/ast-parsing/expected/conditional-0.8.11-compact.json new file mode 100644 index 000000000..6ef3d40e7 --- /dev/null +++ b/tests/ast-parsing/expected/conditional-0.8.11-compact.json @@ -0,0 +1,5 @@ +{ + "C": { + "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->6;\n6[label=\"Node Type: IF 6\n\"];\n6->7[label=\"True\"];\n6->8[label=\"False\"];\n7[label=\"Node Type: EXPRESSION 7\n\"];\n7->9;\n8[label=\"Node Type: EXPRESSION 8\n\"];\n8->9;\n9[label=\"Node Type: END_IF 9\n\"];\n9->10;\n10[label=\"Node Type: IF 10\n\"];\n10->11[label=\"True\"];\n10->12[label=\"False\"];\n11[label=\"Node Type: EXPRESSION 11\n\"];\n11->13;\n12[label=\"Node Type: EXPRESSION 12\n\"];\n12->13;\n13[label=\"Node Type: END_IF 13\n\"];\n13->14;\n14[label=\"Node Type: IF 14\n\"];\n14->16[label=\"True\"];\n14->26[label=\"False\"];\n16[label=\"Node Type: EXPRESSION 16\n\"];\n16->17;\n17[label=\"Node Type: END_IF 17\n\"];\n17->18;\n18[label=\"Node Type: IF 18\n\"];\n18->19[label=\"True\"];\n18->20[label=\"False\"];\n19[label=\"Node Type: EXPRESSION 19\n\"];\n19->21;\n20[label=\"Node Type: EXPRESSION 20\n\"];\n20->21;\n21[label=\"Node Type: END_IF 21\n\"];\n21->22;\n22[label=\"Node Type: IF 22\n\"];\n22->23[label=\"True\"];\n22->24[label=\"False\"];\n23[label=\"Node Type: EXPRESSION 23\n\"];\n23->25;\n24[label=\"Node Type: EXPRESSION 24\n\"];\n24->25;\n25[label=\"Node Type: END_IF 25\n\"];\n26[label=\"Node Type: IF 26\n\"];\n26->27[label=\"True\"];\n26->28[label=\"False\"];\n27[label=\"Node Type: EXPRESSION 27\n\"];\n27->29;\n28[label=\"Node Type: EXPRESSION 28\n\"];\n28->29;\n29[label=\"Node Type: END_IF 29\n\"];\n29->17;\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/continue-0.8.11-compact.json b/tests/ast-parsing/expected/continue-0.8.11-compact.json new file mode 100644 index 000000000..bba15d9bd --- /dev/null +++ b/tests/ast-parsing/expected/continue-0.8.11-compact.json @@ -0,0 +1,5 @@ +{ + "C": { + "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: NEW VARIABLE 1\n\"];\n1->4;\n2[label=\"Node Type: BEGIN_LOOP 2\n\"];\n2->5;\n3[label=\"Node Type: END_LOOP 3\n\"];\n3->13;\n4[label=\"Node Type: NEW VARIABLE 4\n\"];\n4->2;\n5[label=\"Node Type: IF_LOOP 5\n\"];\n5->6[label=\"True\"];\n5->3[label=\"False\"];\n6[label=\"Node Type: IF 6\n\"];\n6->7[label=\"True\"];\n6->8[label=\"False\"];\n7[label=\"Node Type: CONTINUE 7\n\"];\n7->2;\n8[label=\"Node Type: END_IF 8\n\"];\n8->9;\n9[label=\"Node Type: EXPRESSION 9\n\"];\n9->10;\n10[label=\"Node Type: EXPRESSION 10\n\"];\n10->5;\n11[label=\"Node Type: BEGIN_LOOP 11\n\"];\n11->14;\n12[label=\"Node Type: END_LOOP 12\n\"];\n13[label=\"Node Type: NEW VARIABLE 13\n\"];\n13->11;\n14[label=\"Node Type: IF_LOOP 14\n\"];\n14->17[label=\"True\"];\n14->12[label=\"False\"];\n15[label=\"Node Type: BEGIN_LOOP 15\n\"];\n15->18;\n16[label=\"Node Type: END_LOOP 16\n\"];\n16->24;\n17[label=\"Node Type: NEW VARIABLE 17\n\"];\n17->15;\n18[label=\"Node Type: IF_LOOP 18\n\"];\n18->19[label=\"True\"];\n18->16[label=\"False\"];\n19[label=\"Node Type: IF 19\n\"];\n19->20[label=\"True\"];\n19->21[label=\"False\"];\n20[label=\"Node Type: CONTINUE 20\n\"];\n20->15;\n21[label=\"Node Type: END_IF 21\n\"];\n21->22;\n22[label=\"Node Type: EXPRESSION 22\n\"];\n22->23;\n23[label=\"Node Type: EXPRESSION 23\n\"];\n23->18;\n24[label=\"Node Type: EXPRESSION 24\n\"];\n24->14;\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/contract-0.8.11-compact.json b/tests/ast-parsing/expected/contract-0.8.11-compact.json new file mode 100644 index 000000000..1df28fb3d --- /dev/null +++ b/tests/ast-parsing/expected/contract-0.8.11-compact.json @@ -0,0 +1,19 @@ +{ + "A": {}, + "B": { + "constructor(uint256)": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n" + }, + "C": { + "constructor(uint256)": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n" + }, + "D": { + "constructor(uint256)": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n", + "constructor()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: EXPRESSION 1\n\"];\n}\n" + }, + "E": { + "constructor(uint256)": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n" + }, + "F": {}, + "G": {}, + "H": {} +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/custom_error-0.8.11-compact.json b/tests/ast-parsing/expected/custom_error-0.8.11-compact.json new file mode 100644 index 000000000..995b49f83 --- /dev/null +++ b/tests/ast-parsing/expected/custom_error-0.8.11-compact.json @@ -0,0 +1,16 @@ +{ + "VendingMachine": { + "err0()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: EXPRESSION 1\n\"];\n}\n", + "err1()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: NEW VARIABLE 1\n\"];\n1->2;\n2[label=\"Node Type: EXPRESSION 2\n\"];\n}\n", + "err2()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: EXPRESSION 1\n\"];\n}\n", + "err3()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: EXPRESSION 1\n\"];\n}\n" + }, + "A": { + "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: EXPRESSION 1\n\"];\n}\n" + }, + "B": { + "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: EXPRESSION 1\n\"];\n}\n", + "g()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: EXPRESSION 1\n\"];\n}\n", + "h()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: RETURN 1\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/dowhile-0.8.11-compact.json b/tests/ast-parsing/expected/dowhile-0.8.11-compact.json new file mode 100644 index 000000000..1cf317575 --- /dev/null +++ b/tests/ast-parsing/expected/dowhile-0.8.11-compact.json @@ -0,0 +1,5 @@ +{ + "C": { + "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: NEW VARIABLE 1\n\"];\n1->2;\n2[label=\"Node Type: BEGIN_LOOP 2\n\"];\n2->4;\n3[label=\"Node Type: IF_LOOP 3\n\"];\n3->4[label=\"True\"];\n3->5[label=\"False\"];\n4[label=\"Node Type: EXPRESSION 4\n\"];\n4->3;\n5[label=\"Node Type: END_LOOP 5\n\"];\n5->6;\n6[label=\"Node Type: EXPRESSION 6\n\"];\n6->7;\n7[label=\"Node Type: BEGIN_LOOP 7\n\"];\n7->9;\n8[label=\"Node Type: IF_LOOP 8\n\"];\n8->9[label=\"True\"];\n8->10[label=\"False\"];\n9[label=\"Node Type: EXPRESSION 9\n\"];\n9->8;\n10[label=\"Node Type: END_LOOP 10\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/emit-0.8.11-compact.json b/tests/ast-parsing/expected/emit-0.8.11-compact.json new file mode 100644 index 000000000..b043ced39 --- /dev/null +++ b/tests/ast-parsing/expected/emit-0.8.11-compact.json @@ -0,0 +1,5 @@ +{ + "C": { + "emitWithKeyword()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: EXPRESSION 1\n\"];\n1->2;\n2[label=\"Node Type: EXPRESSION 2\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/enum-0.8.11-compact.json b/tests/ast-parsing/expected/enum-0.8.11-compact.json new file mode 100644 index 000000000..0008a4469 --- /dev/null +++ b/tests/ast-parsing/expected/enum-0.8.11-compact.json @@ -0,0 +1,3 @@ +{ + "C": {} +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/event-0.8.11-compact.json b/tests/ast-parsing/expected/event-0.8.11-compact.json new file mode 100644 index 000000000..0008a4469 --- /dev/null +++ b/tests/ast-parsing/expected/event-0.8.11-compact.json @@ -0,0 +1,3 @@ +{ + "C": {} +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/for-0.8.11-compact.json b/tests/ast-parsing/expected/for-0.8.11-compact.json new file mode 100644 index 000000000..fe24348d8 --- /dev/null +++ b/tests/ast-parsing/expected/for-0.8.11-compact.json @@ -0,0 +1,15 @@ +{ + "C": { + "normalLoopBlockBody()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: NEW VARIABLE 1\n\"];\n1->4;\n2[label=\"Node Type: BEGIN_LOOP 2\n\"];\n2->5;\n3[label=\"Node Type: END_LOOP 3\n\"];\n4[label=\"Node Type: NEW VARIABLE 4\n\"];\n4->2;\n5[label=\"Node Type: IF_LOOP 5\n\"];\n5->6[label=\"True\"];\n5->3[label=\"False\"];\n6[label=\"Node Type: EXPRESSION 6\n\"];\n6->7;\n7[label=\"Node Type: EXPRESSION 7\n\"];\n7->5;\n}\n", + "normalLoopExprBody()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: NEW VARIABLE 1\n\"];\n1->4;\n2[label=\"Node Type: BEGIN_LOOP 2\n\"];\n2->5;\n3[label=\"Node Type: END_LOOP 3\n\"];\n4[label=\"Node Type: NEW VARIABLE 4\n\"];\n4->2;\n5[label=\"Node Type: IF_LOOP 5\n\"];\n5->6[label=\"True\"];\n5->3[label=\"False\"];\n6[label=\"Node Type: EXPRESSION 6\n\"];\n6->7;\n7[label=\"Node Type: EXPRESSION 7\n\"];\n7->5;\n}\n", + "normalLoopNoBody()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: NEW VARIABLE 1\n\"];\n1->4;\n2[label=\"Node Type: BEGIN_LOOP 2\n\"];\n2->5;\n3[label=\"Node Type: END_LOOP 3\n\"];\n4[label=\"Node Type: NEW VARIABLE 4\n\"];\n4->2;\n5[label=\"Node Type: IF_LOOP 5\n\"];\n5->6[label=\"True\"];\n5->3[label=\"False\"];\n6[label=\"Node Type: EXPRESSION 6\n\"];\n6->5;\n}\n", + "loopNoPre()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: NEW VARIABLE 1\n\"];\n1->2;\n2[label=\"Node Type: NEW VARIABLE 2\n\"];\n2->3;\n3[label=\"Node Type: BEGIN_LOOP 3\n\"];\n3->5;\n4[label=\"Node Type: END_LOOP 4\n\"];\n5[label=\"Node Type: IF_LOOP 5\n\"];\n5->6[label=\"True\"];\n5->4[label=\"False\"];\n6[label=\"Node Type: EXPRESSION 6\n\"];\n6->7;\n7[label=\"Node Type: EXPRESSION 7\n\"];\n7->5;\n}\n", + "loopNoCond()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: NEW VARIABLE 1\n\"];\n1->4;\n2[label=\"Node Type: BEGIN_LOOP 2\n\"];\n2->5;\n3[label=\"Node Type: END_LOOP 3\n\"];\n4[label=\"Node Type: NEW VARIABLE 4\n\"];\n4->2;\n5[label=\"Node Type: IF 5\n\"];\n5->6[label=\"True\"];\n5->7[label=\"False\"];\n6[label=\"Node Type: BREAK 6\n\"];\n6->3;\n7[label=\"Node Type: END_IF 7\n\"];\n7->8;\n8[label=\"Node Type: EXPRESSION 8\n\"];\n8->9;\n9[label=\"Node Type: EXPRESSION 9\n\"];\n9->2;\n}\n", + "loopNoPost()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: NEW VARIABLE 1\n\"];\n1->4;\n2[label=\"Node Type: BEGIN_LOOP 2\n\"];\n2->5;\n3[label=\"Node Type: END_LOOP 3\n\"];\n4[label=\"Node Type: NEW VARIABLE 4\n\"];\n4->2;\n5[label=\"Node Type: IF_LOOP 5\n\"];\n5->6[label=\"True\"];\n5->3[label=\"False\"];\n6[label=\"Node Type: EXPRESSION 6\n\"];\n6->7;\n7[label=\"Node Type: EXPRESSION 7\n\"];\n7->5;\n}\n", + "loopNoPreCond()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: NEW VARIABLE 1\n\"];\n1->2;\n2[label=\"Node Type: NEW VARIABLE 2\n\"];\n2->3;\n3[label=\"Node Type: BEGIN_LOOP 3\n\"];\n3->5;\n4[label=\"Node Type: END_LOOP 4\n\"];\n5[label=\"Node Type: IF 5\n\"];\n5->6[label=\"True\"];\n5->7[label=\"False\"];\n6[label=\"Node Type: BREAK 6\n\"];\n6->4;\n7[label=\"Node Type: END_IF 7\n\"];\n7->8;\n8[label=\"Node Type: EXPRESSION 8\n\"];\n8->9;\n9[label=\"Node Type: EXPRESSION 9\n\"];\n9->3;\n}\n", + "loopNoPrePost()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: NEW VARIABLE 1\n\"];\n1->2;\n2[label=\"Node Type: NEW VARIABLE 2\n\"];\n2->3;\n3[label=\"Node Type: BEGIN_LOOP 3\n\"];\n3->5;\n4[label=\"Node Type: END_LOOP 4\n\"];\n5[label=\"Node Type: IF_LOOP 5\n\"];\n5->6[label=\"True\"];\n5->4[label=\"False\"];\n6[label=\"Node Type: EXPRESSION 6\n\"];\n6->7;\n7[label=\"Node Type: EXPRESSION 7\n\"];\n7->5;\n}\n", + "loopNoCondPost()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: NEW VARIABLE 1\n\"];\n1->4;\n2[label=\"Node Type: BEGIN_LOOP 2\n\"];\n2->5;\n3[label=\"Node Type: END_LOOP 3\n\"];\n4[label=\"Node Type: NEW VARIABLE 4\n\"];\n4->2;\n5[label=\"Node Type: IF 5\n\"];\n5->6[label=\"True\"];\n5->7[label=\"False\"];\n6[label=\"Node Type: BREAK 6\n\"];\n6->3;\n7[label=\"Node Type: END_IF 7\n\"];\n7->8;\n8[label=\"Node Type: EXPRESSION 8\n\"];\n8->9;\n9[label=\"Node Type: EXPRESSION 9\n\"];\n9->2;\n}\n", + "loopNoPreCondPost()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: NEW VARIABLE 1\n\"];\n1->2;\n2[label=\"Node Type: NEW VARIABLE 2\n\"];\n2->3;\n3[label=\"Node Type: BEGIN_LOOP 3\n\"];\n3->5;\n4[label=\"Node Type: END_LOOP 4\n\"];\n5[label=\"Node Type: IF 5\n\"];\n5->6[label=\"True\"];\n5->7[label=\"False\"];\n6[label=\"Node Type: BREAK 6\n\"];\n6->4;\n7[label=\"Node Type: END_IF 7\n\"];\n7->8;\n8[label=\"Node Type: EXPRESSION 8\n\"];\n8->9;\n9[label=\"Node Type: EXPRESSION 9\n\"];\n9->3;\n}\n", + "loopNoPreCondPostBody()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: BEGIN_LOOP 1\n\"];\n1->1;\n1->2;\n2[label=\"Node Type: END_LOOP 2\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/function-0.8.11-compact.json b/tests/ast-parsing/expected/function-0.8.11-compact.json new file mode 100644 index 000000000..50465d36d --- /dev/null +++ b/tests/ast-parsing/expected/function-0.8.11-compact.json @@ -0,0 +1,52 @@ +{ + "C1": { + "constructor()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n", + "fallback()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n", + "receive()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n" + }, + "C2": { + "constructor()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n", + "fallback()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n", + "receive()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n" + }, + "C3": { + "constructor()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n", + "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: EXPRESSION 1\n\"];\n1->2;\n2[label=\"Node Type: EXPRESSION 2\n\"];\n}\n", + "modifierNoArgs()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: _ 1\n\"];\n}\n", + "modifierWithArgs(uint256)": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: _ 1\n\"];\n}\n" + }, + "C4": { + "hasArgs(uint256,uint256)": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n", + "hasReturns()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n", + "hasArgsAndReturns(uint256,uint256)": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n" + }, + "C5": { + "payableFunc()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n", + "externalFunc()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n", + "publicFunc()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n", + "internalFunc()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n", + "privateFunc()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n", + "pureFunc()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n", + "viewFunc()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n", + "abstractFunc()": "digraph{\n}\n" + }, + "C6": { + "abstractFunc()": "digraph{\n}\n", + "abstractFunc2()": "digraph{\n}\n" + }, + "C7": { + "abstractFunc3()": "digraph{\n}\n" + }, + "C8": { + "abstractFunc3()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n", + "abstractFunc()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n", + "abstractFunc2()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n", + "payableFunc()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n", + "externalFunc()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n", + "publicFunc()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n", + "internalFunc()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n", + "privateFunc()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n", + "pureFunc()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n", + "viewFunc()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/functioncall-0.8.11-compact.json b/tests/ast-parsing/expected/functioncall-0.8.11-compact.json new file mode 100644 index 000000000..f266b62b1 --- /dev/null +++ b/tests/ast-parsing/expected/functioncall-0.8.11-compact.json @@ -0,0 +1,10 @@ +{ + "I": { + "constructor()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n" + }, + "C": { + "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: EXPRESSION 1\n\"];\n1->2;\n2[label=\"Node Type: EXPRESSION 2\n\"];\n2->3;\n3[label=\"Node Type: EXPRESSION 3\n\"];\n3->4;\n4[label=\"Node Type: EXPRESSION 4\n\"];\n4->5;\n5[label=\"Node Type: EXPRESSION 5\n\"];\n5->6;\n6[label=\"Node Type: EXPRESSION 6\n\"];\n6->7;\n7[label=\"Node Type: EXPRESSION 7\n\"];\n7->8;\n8[label=\"Node Type: EXPRESSION 8\n\"];\n8->9;\n9[label=\"Node Type: EXPRESSION 9\n\"];\n9->10;\n10[label=\"Node Type: NEW VARIABLE 10\n\"];\n10->11;\n11[label=\"Node Type: EXPRESSION 11\n\"];\n11->12;\n12[label=\"Node Type: EXPRESSION 12\n\"];\n12->13;\n13[label=\"Node Type: EXPRESSION 13\n\"];\n13->14;\n14[label=\"Node Type: EXPRESSION 14\n\"];\n14->15;\n15[label=\"Node Type: EXPRESSION 15\n\"];\n15->16;\n16[label=\"Node Type: EXPRESSION 16\n\"];\n16->17;\n17[label=\"Node Type: EXPRESSION 17\n\"];\n17->18;\n18[label=\"Node Type: EXPRESSION 18\n\"];\n18->19;\n19[label=\"Node Type: EXPRESSION 19\n\"];\n19->20;\n20[label=\"Node Type: EXPRESSION 20\n\"];\n}\n", + "publicTarget()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n", + "internalTarget(uint256,uint256)": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/if-0.8.11-compact.json b/tests/ast-parsing/expected/if-0.8.11-compact.json new file mode 100644 index 000000000..c0c884b4e --- /dev/null +++ b/tests/ast-parsing/expected/if-0.8.11-compact.json @@ -0,0 +1,8 @@ +{ + "C": { + "ifWithoutElse()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: IF 1\n\"];\n1->2[label=\"True\"];\n1->3[label=\"False\"];\n2[label=\"Node Type: EXPRESSION 2\n\"];\n2->3;\n3[label=\"Node Type: END_IF 3\n\"];\n}\n", + "ifWithElse()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: IF 1\n\"];\n1->2[label=\"True\"];\n1->3[label=\"False\"];\n2[label=\"Node Type: EXPRESSION 2\n\"];\n2->4;\n3[label=\"Node Type: EXPRESSION 3\n\"];\n3->4;\n4[label=\"Node Type: END_IF 4\n\"];\n}\n", + "ifWithElseIf()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: IF 1\n\"];\n1->2[label=\"True\"];\n1->3[label=\"False\"];\n2[label=\"Node Type: EXPRESSION 2\n\"];\n2->9;\n3[label=\"Node Type: IF 3\n\"];\n3->4[label=\"True\"];\n3->5[label=\"False\"];\n4[label=\"Node Type: EXPRESSION 4\n\"];\n4->8;\n5[label=\"Node Type: IF 5\n\"];\n5->6[label=\"True\"];\n5->7[label=\"False\"];\n6[label=\"Node Type: EXPRESSION 6\n\"];\n6->7;\n7[label=\"Node Type: END_IF 7\n\"];\n7->8;\n8[label=\"Node Type: END_IF 8\n\"];\n8->9;\n9[label=\"Node Type: END_IF 9\n\"];\n}\n", + "ifWithElseIfElse()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: IF 1\n\"];\n1->2[label=\"True\"];\n1->3[label=\"False\"];\n2[label=\"Node Type: EXPRESSION 2\n\"];\n2->7;\n3[label=\"Node Type: IF 3\n\"];\n3->4[label=\"True\"];\n3->5[label=\"False\"];\n4[label=\"Node Type: EXPRESSION 4\n\"];\n4->6;\n5[label=\"Node Type: EXPRESSION 5\n\"];\n5->6;\n6[label=\"Node Type: END_IF 6\n\"];\n6->7;\n7[label=\"Node Type: END_IF 7\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/indexaccess-0.8.11-compact.json b/tests/ast-parsing/expected/indexaccess-0.8.11-compact.json new file mode 100644 index 000000000..43190fcd6 --- /dev/null +++ b/tests/ast-parsing/expected/indexaccess-0.8.11-compact.json @@ -0,0 +1,5 @@ +{ + "C": { + "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: NEW VARIABLE 1\n\"];\n1->2;\n2[label=\"Node Type: EXPRESSION 2\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/indexrangeaccess-0.8.11-compact.json b/tests/ast-parsing/expected/indexrangeaccess-0.8.11-compact.json new file mode 100644 index 000000000..f4529bc86 --- /dev/null +++ b/tests/ast-parsing/expected/indexrangeaccess-0.8.11-compact.json @@ -0,0 +1,5 @@ +{ + "C": { + "f(bytes)": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: EXPRESSION 1\n\"];\n1->2;\n2[label=\"Node Type: EXPRESSION 2\n\"];\n2->3;\n3[label=\"Node Type: EXPRESSION 3\n\"];\n3->4;\n4[label=\"Node Type: EXPRESSION 4\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/library_implicit_conversion-0.8.11-compact.json b/tests/ast-parsing/expected/library_implicit_conversion-0.8.11-compact.json new file mode 100644 index 000000000..81b56547c --- /dev/null +++ b/tests/ast-parsing/expected/library_implicit_conversion-0.8.11-compact.json @@ -0,0 +1,23 @@ +{ + "LibByte": { + "t(uint256,bytes1)": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: RETURN 1\n\"];\n}\n", + "t(uint256,bytes32)": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: RETURN 1\n\"];\n}\n" + }, + "TestByte": { + "test()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: NEW VARIABLE 1\n\"];\n1->2;\n2[label=\"Node Type: RETURN 2\n\"];\n}\n" + }, + "LibUint": { + "t(uint256,uint8)": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: RETURN 1\n\"];\n}\n", + "t(uint256,uint256)": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: RETURN 1\n\"];\n}\n" + }, + "TestUint": { + "test()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: NEW VARIABLE 1\n\"];\n1->2;\n2[label=\"Node Type: RETURN 2\n\"];\n}\n" + }, + "LibInt": { + "t(uint256,int8)": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: RETURN 1\n\"];\n}\n", + "t(uint256,int256)": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: RETURN 1\n\"];\n}\n" + }, + "TestUintWithVariableiAndConversion": { + "test()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: NEW VARIABLE 1\n\"];\n1->2;\n2[label=\"Node Type: NEW VARIABLE 2\n\"];\n2->3;\n3[label=\"Node Type: RETURN 3\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/literal-0.8.11-compact.json b/tests/ast-parsing/expected/literal-0.8.11-compact.json new file mode 100644 index 000000000..e1a35a0e7 --- /dev/null +++ b/tests/ast-parsing/expected/literal-0.8.11-compact.json @@ -0,0 +1,5 @@ +{ + "C": { + "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: EXPRESSION 1\n\"];\n1->2;\n2[label=\"Node Type: EXPRESSION 2\n\"];\n2->3;\n3[label=\"Node Type: EXPRESSION 3\n\"];\n3->4;\n4[label=\"Node Type: EXPRESSION 4\n\"];\n4->5;\n5[label=\"Node Type: EXPRESSION 5\n\"];\n5->6;\n6[label=\"Node Type: EXPRESSION 6\n\"];\n6->7;\n7[label=\"Node Type: EXPRESSION 7\n\"];\n7->8;\n8[label=\"Node Type: EXPRESSION 8\n\"];\n8->9;\n9[label=\"Node Type: EXPRESSION 9\n\"];\n9->10;\n10[label=\"Node Type: EXPRESSION 10\n\"];\n10->11;\n11[label=\"Node Type: EXPRESSION 11\n\"];\n11->12;\n12[label=\"Node Type: EXPRESSION 12\n\"];\n12->13;\n13[label=\"Node Type: EXPRESSION 13\n\"];\n13->14;\n14[label=\"Node Type: EXPRESSION 14\n\"];\n14->15;\n15[label=\"Node Type: EXPRESSION 15\n\"];\n15->16;\n16[label=\"Node Type: EXPRESSION 16\n\"];\n16->17;\n17[label=\"Node Type: EXPRESSION 17\n\"];\n17->18;\n18[label=\"Node Type: EXPRESSION 18\n\"];\n18->19;\n19[label=\"Node Type: EXPRESSION 19\n\"];\n19->20;\n20[label=\"Node Type: EXPRESSION 20\n\"];\n20->21;\n21[label=\"Node Type: EXPRESSION 21\n\"];\n21->22;\n22[label=\"Node Type: EXPRESSION 22\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/memberaccess-0.8.11-compact.json b/tests/ast-parsing/expected/memberaccess-0.8.11-compact.json new file mode 100644 index 000000000..b66694f7a --- /dev/null +++ b/tests/ast-parsing/expected/memberaccess-0.8.11-compact.json @@ -0,0 +1,7 @@ +{ + "I": {}, + "F": {}, + "C": { + "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: NEW VARIABLE 1\n\"];\n1->2;\n2[label=\"Node Type: EXPRESSION 2\n\"];\n2->3;\n3[label=\"Node Type: NEW VARIABLE 3\n\"];\n3->4;\n4[label=\"Node Type: EXPRESSION 4\n\"];\n4->5;\n5[label=\"Node Type: EXPRESSION 5\n\"];\n5->6;\n6[label=\"Node Type: EXPRESSION 6\n\"];\n6->7;\n7[label=\"Node Type: EXPRESSION 7\n\"];\n7->8;\n8[label=\"Node Type: EXPRESSION 8\n\"];\n8->9;\n9[label=\"Node Type: EXPRESSION 9\n\"];\n9->10;\n10[label=\"Node Type: EXPRESSION 10\n\"];\n10->11;\n11[label=\"Node Type: EXPRESSION 11\n\"];\n11->12;\n12[label=\"Node Type: EXPRESSION 12\n\"];\n12->13;\n13[label=\"Node Type: EXPRESSION 13\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/minmax-0.8.11-compact.json b/tests/ast-parsing/expected/minmax-0.8.11-compact.json new file mode 100644 index 000000000..228af371a --- /dev/null +++ b/tests/ast-parsing/expected/minmax-0.8.11-compact.json @@ -0,0 +1,5 @@ +{ + "C": { + "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: NEW VARIABLE 1\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/modifier-0.8.11-compact.json b/tests/ast-parsing/expected/modifier-0.8.11-compact.json new file mode 100644 index 000000000..34aad8ef1 --- /dev/null +++ b/tests/ast-parsing/expected/modifier-0.8.11-compact.json @@ -0,0 +1,8 @@ +{ + "C": { + "onePlaceholder()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: _ 1\n\"];\n}\n", + "multiplePlaceholders()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: _ 1\n\"];\n1->2;\n2[label=\"Node Type: _ 2\n\"];\n2->3;\n3[label=\"Node Type: _ 3\n\"];\n}\n", + "acceptsVar(uint256)": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: _ 1\n\"];\n}\n", + "noParams()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: _ 1\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/newexpression-0.8.11-compact.json b/tests/ast-parsing/expected/newexpression-0.8.11-compact.json new file mode 100644 index 000000000..e46dafe75 --- /dev/null +++ b/tests/ast-parsing/expected/newexpression-0.8.11-compact.json @@ -0,0 +1,8 @@ +{ + "B": { + "constructor()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n" + }, + "C": { + "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: EXPRESSION 1\n\"];\n1->2;\n2[label=\"Node Type: EXPRESSION 2\n\"];\n2->3;\n3[label=\"Node Type: EXPRESSION 3\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/pragma-0.8.11-compact.json b/tests/ast-parsing/expected/pragma-0.8.11-compact.json new file mode 100644 index 000000000..0008a4469 --- /dev/null +++ b/tests/ast-parsing/expected/pragma-0.8.11-compact.json @@ -0,0 +1,3 @@ +{ + "C": {} +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/push-0.8.11-compact.json b/tests/ast-parsing/expected/push-0.8.11-compact.json new file mode 100644 index 000000000..a1a35e654 --- /dev/null +++ b/tests/ast-parsing/expected/push-0.8.11-compact.json @@ -0,0 +1,5 @@ +{ + "C": { + "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: EXPRESSION 1\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/return-0.8.11-compact.json b/tests/ast-parsing/expected/return-0.8.11-compact.json new file mode 100644 index 000000000..7eddd38f6 --- /dev/null +++ b/tests/ast-parsing/expected/return-0.8.11-compact.json @@ -0,0 +1,9 @@ +{ + "C": { + "returnConstant()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: RETURN 1\n\"];\n}\n", + "returnVariable()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: NEW VARIABLE 1\n\"];\n1->2;\n2[label=\"Node Type: RETURN 2\n\"];\n}\n", + "returnTuple()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: NEW VARIABLE 1\n\"];\n1->2;\n2[label=\"Node Type: NEW VARIABLE 2\n\"];\n2->3;\n3[label=\"Node Type: RETURN 3\n\"];\n}\n", + "returnTernary()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: NEW VARIABLE 1\n\"];\n1->3;\n3[label=\"Node Type: IF 3\n\"];\n3->4[label=\"True\"];\n3->5[label=\"False\"];\n4[label=\"Node Type: RETURN 4\n\"];\n5[label=\"Node Type: RETURN 5\n\"];\n}\n", + "returnDelete()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: RETURN 1\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/scope-0.8.11-compact.json b/tests/ast-parsing/expected/scope-0.8.11-compact.json new file mode 100644 index 000000000..00c3dbb1a --- /dev/null +++ b/tests/ast-parsing/expected/scope-0.8.11-compact.json @@ -0,0 +1,8 @@ +{ + "Scope": { + "nested_scope()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: NEW VARIABLE 1\n\"];\n1->2;\n2[label=\"Node Type: NEW VARIABLE 2\n\"];\n2->3;\n3[label=\"Node Type: NEW VARIABLE 3\n\"];\n}\n", + "if_scope()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: IF 1\n\"];\n1->2[label=\"True\"];\n1->3[label=\"False\"];\n2[label=\"Node Type: NEW VARIABLE 2\n\"];\n2->4;\n3[label=\"Node Type: NEW VARIABLE 3\n\"];\n3->4;\n4[label=\"Node Type: END_IF 4\n\"];\n}\n", + "while_scope()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: NEW VARIABLE 1\n\"];\n1->2;\n2[label=\"Node Type: BEGIN_LOOP 2\n\"];\n2->3;\n3[label=\"Node Type: IF_LOOP 3\n\"];\n3->4[label=\"True\"];\n3->5[label=\"False\"];\n4[label=\"Node Type: NEW VARIABLE 4\n\"];\n4->3;\n5[label=\"Node Type: END_LOOP 5\n\"];\n}\n", + "for_scope()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: NEW VARIABLE 1\n\"];\n1->4;\n2[label=\"Node Type: BEGIN_LOOP 2\n\"];\n2->5;\n3[label=\"Node Type: END_LOOP 3\n\"];\n4[label=\"Node Type: NEW VARIABLE 4\n\"];\n4->2;\n5[label=\"Node Type: IF_LOOP 5\n\"];\n5->6[label=\"True\"];\n5->3[label=\"False\"];\n6[label=\"Node Type: NEW VARIABLE 6\n\"];\n6->7;\n7[label=\"Node Type: EXPRESSION 7\n\"];\n7->5;\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/struct-0.8.11-compact.json b/tests/ast-parsing/expected/struct-0.8.11-compact.json new file mode 100644 index 000000000..0008a4469 --- /dev/null +++ b/tests/ast-parsing/expected/struct-0.8.11-compact.json @@ -0,0 +1,3 @@ +{ + "C": {} +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/throw-0.8.11-compact.json b/tests/ast-parsing/expected/throw-0.8.11-compact.json new file mode 100644 index 000000000..0008a4469 --- /dev/null +++ b/tests/ast-parsing/expected/throw-0.8.11-compact.json @@ -0,0 +1,3 @@ +{ + "C": {} +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/top-level-0.8.11-compact.json b/tests/ast-parsing/expected/top-level-0.8.11-compact.json new file mode 100644 index 000000000..9e26dfeeb --- /dev/null +++ b/tests/ast-parsing/expected/top-level-0.8.11-compact.json @@ -0,0 +1 @@ +{} \ No newline at end of file diff --git a/tests/ast-parsing/expected/top-level-import-0.8.11-compact.json b/tests/ast-parsing/expected/top-level-import-0.8.11-compact.json new file mode 100644 index 000000000..a1a35e654 --- /dev/null +++ b/tests/ast-parsing/expected/top-level-import-0.8.11-compact.json @@ -0,0 +1,5 @@ +{ + "C": { + "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: EXPRESSION 1\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/top-level-import-bis-0.8.11-compact.json b/tests/ast-parsing/expected/top-level-import-bis-0.8.11-compact.json new file mode 100644 index 000000000..a1a35e654 --- /dev/null +++ b/tests/ast-parsing/expected/top-level-import-bis-0.8.11-compact.json @@ -0,0 +1,5 @@ +{ + "C": { + "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: EXPRESSION 1\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/top-level-nested-import-0.8.11-compact.json b/tests/ast-parsing/expected/top-level-nested-import-0.8.11-compact.json new file mode 100644 index 000000000..a1a35e654 --- /dev/null +++ b/tests/ast-parsing/expected/top-level-nested-import-0.8.11-compact.json @@ -0,0 +1,5 @@ +{ + "C": { + "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: EXPRESSION 1\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/trycatch-0.8.11-compact.json b/tests/ast-parsing/expected/trycatch-0.8.11-compact.json new file mode 100644 index 000000000..6099f6be4 --- /dev/null +++ b/tests/ast-parsing/expected/trycatch-0.8.11-compact.json @@ -0,0 +1,9 @@ +{ + "ERC20": { + "balanceOf(address)": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: RETURN 1\n\"];\n}\n" + }, + "C": { + "tryCatchFunctionCall()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: NEW VARIABLE 1\n\"];\n1->2;\n2[label=\"Node Type: TRY 2\n\"];\n2->3;\n2->5;\n2->7;\n3[label=\"Node Type: CATCH 3\n\"];\n3->4;\n4[label=\"Node Type: EXPRESSION 4\n\"];\n4->7;\n5[label=\"Node Type: CATCH 5\n\"];\n5->6;\n6[label=\"Node Type: EXPRESSION 6\n\"];\n6->7;\n7[label=\"Node Type: TRY 7\n\"];\n7->8;\n7->10;\n7->12;\n8[label=\"Node Type: CATCH 8\n\"];\n8->9;\n9[label=\"Node Type: EXPRESSION 9\n\"];\n9->12;\n10[label=\"Node Type: CATCH 10\n\"];\n10->11;\n11[label=\"Node Type: EXPRESSION 11\n\"];\n11->12;\n12[label=\"Node Type: TRY 12\n\"];\n12->13;\n12->15;\n12->17;\n12->19;\n13[label=\"Node Type: CATCH 13\n\"];\n13->14;\n14[label=\"Node Type: EXPRESSION 14\n\"];\n14->19;\n15[label=\"Node Type: CATCH 15\n\"];\n15->16;\n16[label=\"Node Type: EXPRESSION 16\n\"];\n16->19;\n17[label=\"Node Type: CATCH 17\n\"];\n17->18;\n18[label=\"Node Type: EXPRESSION 18\n\"];\n18->19;\n19[label=\"Node Type: TRY 19\n\"];\n19->20;\n19->21;\n20[label=\"Node Type: CATCH 20\n\"];\n21[label=\"Node Type: CATCH 21\n\"];\n21->22;\n22[label=\"Node Type: EXPRESSION 22\n\"];\n}\n", + "tryCatchContractDeployment()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: TRY 1\n\"];\n1->2;\n1->6;\n2[label=\"Node Type: CATCH 2\n\"];\n2->3;\n3[label=\"Node Type: TRY 3\n\"];\n3->4;\n3->5;\n4[label=\"Node Type: CATCH 4\n\"];\n5[label=\"Node Type: CATCH 5\n\"];\n6[label=\"Node Type: CATCH 6\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/tupleexpression-0.8.11-compact.json b/tests/ast-parsing/expected/tupleexpression-0.8.11-compact.json new file mode 100644 index 000000000..b5912e6b8 --- /dev/null +++ b/tests/ast-parsing/expected/tupleexpression-0.8.11-compact.json @@ -0,0 +1,5 @@ +{ + "C": { + "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: NEW VARIABLE 1\n\"];\n1->2;\n2[label=\"Node Type: NEW VARIABLE 2\n\"];\n2->3;\n3[label=\"Node Type: EXPRESSION 3\n\"];\n3->4;\n4[label=\"Node Type: EXPRESSION 4\n\"];\n4->5;\n5[label=\"Node Type: EXPRESSION 5\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/unaryexpression-0.8.11-compact.json b/tests/ast-parsing/expected/unaryexpression-0.8.11-compact.json new file mode 100644 index 000000000..f7fcf9203 --- /dev/null +++ b/tests/ast-parsing/expected/unaryexpression-0.8.11-compact.json @@ -0,0 +1,5 @@ +{ + "C": { + "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: NEW VARIABLE 1\n\"];\n1->2;\n2[label=\"Node Type: EXPRESSION 2\n\"];\n2->3;\n3[label=\"Node Type: EXPRESSION 3\n\"];\n3->4;\n4[label=\"Node Type: EXPRESSION 4\n\"];\n4->5;\n5[label=\"Node Type: EXPRESSION 5\n\"];\n5->6;\n6[label=\"Node Type: EXPRESSION 6\n\"];\n6->7;\n7[label=\"Node Type: NEW VARIABLE 7\n\"];\n7->8;\n8[label=\"Node Type: EXPRESSION 8\n\"];\n8->9;\n9[label=\"Node Type: EXPRESSION 9\n\"];\n9->10;\n10[label=\"Node Type: NEW VARIABLE 10\n\"];\n10->11;\n11[label=\"Node Type: EXPRESSION 11\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/unchecked-0.8.11-compact.json b/tests/ast-parsing/expected/unchecked-0.8.11-compact.json new file mode 100644 index 000000000..557c3d932 --- /dev/null +++ b/tests/ast-parsing/expected/unchecked-0.8.11-compact.json @@ -0,0 +1,6 @@ +{ + "C": { + "f(uint256,uint256)": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: RETURN 1\n\"];\n}\n", + "g(uint256,uint256)": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: RETURN 1\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/units_and_global_variables-0.8.11-compact.json b/tests/ast-parsing/expected/units_and_global_variables-0.8.11-compact.json new file mode 100644 index 000000000..f1a57c142 --- /dev/null +++ b/tests/ast-parsing/expected/units_and_global_variables-0.8.11-compact.json @@ -0,0 +1,18 @@ +{ + "A": {}, + "I": {}, + "Test": { + "ether_unit()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: EXPRESSION 1\n\"];\n1->2;\n2[label=\"Node Type: EXPRESSION 2\n\"];\n}\n", + "time_unit()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: EXPRESSION 1\n\"];\n1->2;\n2[label=\"Node Type: EXPRESSION 2\n\"];\n2->3;\n3[label=\"Node Type: EXPRESSION 3\n\"];\n3->4;\n4[label=\"Node Type: EXPRESSION 4\n\"];\n4->5;\n5[label=\"Node Type: EXPRESSION 5\n\"];\n}\n", + "block_and_transactions()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: EXPRESSION 1\n\"];\n1->2;\n2[label=\"Node Type: EXPRESSION 2\n\"];\n2->3;\n3[label=\"Node Type: EXPRESSION 3\n\"];\n3->4;\n4[label=\"Node Type: EXPRESSION 4\n\"];\n4->5;\n5[label=\"Node Type: EXPRESSION 5\n\"];\n5->6;\n6[label=\"Node Type: EXPRESSION 6\n\"];\n6->7;\n7[label=\"Node Type: EXPRESSION 7\n\"];\n7->8;\n8[label=\"Node Type: EXPRESSION 8\n\"];\n8->9;\n9[label=\"Node Type: EXPRESSION 9\n\"];\n9->10;\n10[label=\"Node Type: EXPRESSION 10\n\"];\n10->11;\n11[label=\"Node Type: EXPRESSION 11\n\"];\n11->12;\n12[label=\"Node Type: EXPRESSION 12\n\"];\n12->13;\n13[label=\"Node Type: EXPRESSION 13\n\"];\n13->14;\n14[label=\"Node Type: EXPRESSION 14\n\"];\n14->15;\n15[label=\"Node Type: EXPRESSION 15\n\"];\n15->16;\n16[label=\"Node Type: EXPRESSION 16\n\"];\n}\n", + "abi_encode()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: NEW VARIABLE 1\n\"];\n1->2;\n2[label=\"Node Type: EXPRESSION 2\n\"];\n2->3;\n3[label=\"Node Type: EXPRESSION 3\n\"];\n3->4;\n4[label=\"Node Type: EXPRESSION 4\n\"];\n4->5;\n5[label=\"Node Type: NEW VARIABLE 5\n\"];\n5->6;\n6[label=\"Node Type: EXPRESSION 6\n\"];\n6->7;\n7[label=\"Node Type: NEW VARIABLE 7\n\"];\n7->8;\n8[label=\"Node Type: EXPRESSION 8\n\"];\n}\n", + "member()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: NEW VARIABLE 1\n\"];\n1->2;\n2[label=\"Node Type: NEW VARIABLE 2\n\"];\n2->3;\n3[label=\"Node Type: EXPRESSION 3\n\"];\n}\n", + "error_handling()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: EXPRESSION 1\n\"];\n1->2;\n2[label=\"Node Type: EXPRESSION 2\n\"];\n2->3;\n3[label=\"Node Type: EXPRESSION 3\n\"];\n3->4;\n4[label=\"Node Type: EXPRESSION 4\n\"];\n4->5;\n5[label=\"Node Type: EXPRESSION 5\n\"];\n}\n", + "math_and_crypto()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: EXPRESSION 1\n\"];\n1->2;\n2[label=\"Node Type: EXPRESSION 2\n\"];\n2->3;\n3[label=\"Node Type: EXPRESSION 3\n\"];\n3->4;\n4[label=\"Node Type: EXPRESSION 4\n\"];\n4->5;\n5[label=\"Node Type: EXPRESSION 5\n\"];\n5->6;\n6[label=\"Node Type: NEW VARIABLE 6\n\"];\n6->7;\n7[label=\"Node Type: NEW VARIABLE 7\n\"];\n7->8;\n8[label=\"Node Type: NEW VARIABLE 8\n\"];\n8->9;\n9[label=\"Node Type: NEW VARIABLE 9\n\"];\n9->10;\n10[label=\"Node Type: EXPRESSION 10\n\"];\n}\n", + "address_related()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: NEW VARIABLE 1\n\"];\n1->2;\n2[label=\"Node Type: EXPRESSION 2\n\"];\n2->3;\n3[label=\"Node Type: EXPRESSION 3\n\"];\n3->4;\n4[label=\"Node Type: EXPRESSION 4\n\"];\n4->5;\n5[label=\"Node Type: EXPRESSION 5\n\"];\n5->6;\n6[label=\"Node Type: EXPRESSION 6\n\"];\n6->7;\n7[label=\"Node Type: EXPRESSION 7\n\"];\n7->8;\n8[label=\"Node Type: EXPRESSION 8\n\"];\n8->9;\n9[label=\"Node Type: EXPRESSION 9\n\"];\n}\n", + "return_addr()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n}\n", + "address_edge_case()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: EXPRESSION 1\n\"];\n1->2;\n2[label=\"Node Type: EXPRESSION 2\n\"];\n2->3;\n3[label=\"Node Type: EXPRESSION 3\n\"];\n}\n", + "contract_related()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: EXPRESSION 1\n\"];\n1->2;\n2[label=\"Node Type: NEW VARIABLE 2\n\"];\n2->3;\n3[label=\"Node Type: EXPRESSION 3\n\"];\n}\n", + "type_related()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: EXPRESSION 1\n\"];\n1->2;\n2[label=\"Node Type: EXPRESSION 2\n\"];\n2->3;\n3[label=\"Node Type: EXPRESSION 3\n\"];\n3->4;\n4[label=\"Node Type: EXPRESSION 4\n\"];\n4->5;\n5[label=\"Node Type: EXPRESSION 5\n\"];\n5->6;\n6[label=\"Node Type: EXPRESSION 6\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/using-for-0.8.11-compact.json b/tests/ast-parsing/expected/using-for-0.8.11-compact.json new file mode 100644 index 000000000..27fa7c323 --- /dev/null +++ b/tests/ast-parsing/expected/using-for-0.8.11-compact.json @@ -0,0 +1,9 @@ +{ + "L1": { + "f(uint256)": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: RETURN 1\n\"];\n}\n" + }, + "L2": { + "f(bytes32)": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: RETURN 1\n\"];\n}\n" + }, + "C": {} +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/variable-0.8.11-compact.json b/tests/ast-parsing/expected/variable-0.8.11-compact.json new file mode 100644 index 000000000..97689fda1 --- /dev/null +++ b/tests/ast-parsing/expected/variable-0.8.11-compact.json @@ -0,0 +1,5 @@ +{ + "C": { + "basic()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: NEW VARIABLE 1\n\"];\n1->2;\n2[label=\"Node Type: NEW VARIABLE 2\n\"];\n2->3;\n3[label=\"Node Type: NEW VARIABLE 3\n\"];\n3->4;\n4[label=\"Node Type: NEW VARIABLE 4\n\"];\n4->5;\n5[label=\"Node Type: NEW VARIABLE 5\n\"];\n5->6;\n6[label=\"Node Type: NEW VARIABLE 6\n\"];\n6->7;\n7[label=\"Node Type: NEW VARIABLE 7\n\"];\n7->8;\n8[label=\"Node Type: NEW VARIABLE 8\n\"];\n8->9;\n9[label=\"Node Type: NEW VARIABLE 9\n\"];\n9->10;\n10[label=\"Node Type: NEW VARIABLE 10\n\"];\n10->11;\n11[label=\"Node Type: NEW VARIABLE 11\n\"];\n11->12;\n12[label=\"Node Type: NEW VARIABLE 12\n\"];\n12->13;\n13[label=\"Node Type: NEW VARIABLE 13\n\"];\n13->14;\n14[label=\"Node Type: NEW VARIABLE 14\n\"];\n14->15;\n15[label=\"Node Type: NEW VARIABLE 15\n\"];\n15->16;\n16[label=\"Node Type: NEW VARIABLE 16\n\"];\n16->17;\n17[label=\"Node Type: NEW VARIABLE 17\n\"];\n17->18;\n18[label=\"Node Type: NEW VARIABLE 18\n\"];\n18->19;\n19[label=\"Node Type: NEW VARIABLE 19\n\"];\n19->20;\n20[label=\"Node Type: NEW VARIABLE 20\n\"];\n20->21;\n21[label=\"Node Type: NEW VARIABLE 21\n\"];\n21->22;\n22[label=\"Node Type: NEW VARIABLE 22\n\"];\n22->23;\n23[label=\"Node Type: NEW VARIABLE 23\n\"];\n23->24;\n24[label=\"Node Type: NEW VARIABLE 24\n\"];\n24->25;\n25[label=\"Node Type: NEW VARIABLE 25\n\"];\n25->26;\n26[label=\"Node Type: NEW VARIABLE 26\n\"];\n26->27;\n27[label=\"Node Type: NEW VARIABLE 27\n\"];\n27->28;\n28[label=\"Node Type: NEW VARIABLE 28\n\"];\n28->29;\n29[label=\"Node Type: NEW VARIABLE 29\n\"];\n29->30;\n30[label=\"Node Type: NEW VARIABLE 30\n\"];\n30->31;\n31[label=\"Node Type: NEW VARIABLE 31\n\"];\n31->32;\n32[label=\"Node Type: NEW VARIABLE 32\n\"];\n32->33;\n33[label=\"Node Type: NEW VARIABLE 33\n\"];\n33->34;\n34[label=\"Node Type: NEW VARIABLE 34\n\"];\n34->35;\n35[label=\"Node Type: NEW VARIABLE 35\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/variabledeclaration-0.8.11-compact.json b/tests/ast-parsing/expected/variabledeclaration-0.8.11-compact.json new file mode 100644 index 000000000..f9182c607 --- /dev/null +++ b/tests/ast-parsing/expected/variabledeclaration-0.8.11-compact.json @@ -0,0 +1,5 @@ +{ + "C": { + "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: NEW VARIABLE 1\n\"];\n1->2;\n2[label=\"Node Type: NEW VARIABLE 2\n\"];\n2->3;\n3[label=\"Node Type: NEW VARIABLE 3\n\"];\n3->4;\n4[label=\"Node Type: NEW VARIABLE 4\n\"];\n4->5;\n5[label=\"Node Type: NEW VARIABLE 5\n\"];\n5->6;\n6[label=\"Node Type: NEW VARIABLE 6\n\"];\n6->7;\n7[label=\"Node Type: NEW VARIABLE 7\n\"];\n7->8;\n8[label=\"Node Type: NEW VARIABLE 8\n\"];\n8->12;\n10[label=\"Node Type: NEW VARIABLE 10\n\"];\n10->11;\n11[label=\"Node Type: NEW VARIABLE 11\n\"];\n12[label=\"Node Type: IF 12\n\"];\n12->13[label=\"True\"];\n12->14[label=\"False\"];\n13[label=\"Node Type: EXPRESSION 13\n\"];\n13->15;\n14[label=\"Node Type: EXPRESSION 14\n\"];\n14->15;\n15[label=\"Node Type: END_IF 15\n\"];\n15->10;\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/while-0.8.11-compact.json b/tests/ast-parsing/expected/while-0.8.11-compact.json new file mode 100644 index 000000000..4d9657391 --- /dev/null +++ b/tests/ast-parsing/expected/while-0.8.11-compact.json @@ -0,0 +1,5 @@ +{ + "C": { + "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: NEW VARIABLE 1\n\"];\n1->2;\n2[label=\"Node Type: BEGIN_LOOP 2\n\"];\n2->3;\n3[label=\"Node Type: IF_LOOP 3\n\"];\n3->4[label=\"True\"];\n3->5[label=\"False\"];\n4[label=\"Node Type: EXPRESSION 4\n\"];\n4->3;\n5[label=\"Node Type: END_LOOP 5\n\"];\n5->6;\n6[label=\"Node Type: EXPRESSION 6\n\"];\n6->7;\n7[label=\"Node Type: BEGIN_LOOP 7\n\"];\n7->8;\n8[label=\"Node Type: IF_LOOP 8\n\"];\n8->9[label=\"True\"];\n8->10[label=\"False\"];\n9[label=\"Node Type: EXPRESSION 9\n\"];\n9->8;\n10[label=\"Node Type: END_LOOP 10\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/expected/yul-0.8.11-compact.json b/tests/ast-parsing/expected/yul-0.8.11-compact.json new file mode 100644 index 000000000..c7716d2db --- /dev/null +++ b/tests/ast-parsing/expected/yul-0.8.11-compact.json @@ -0,0 +1,7 @@ +{ + "L": {}, + "C": { + "f(uint256,uint256[])": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: NEW VARIABLE 1\n\"];\n1->2;\n2[label=\"Node Type: NEW VARIABLE 2\n\"];\n2->3;\n3[label=\"Node Type: INLINE ASM 3\n\"];\n3->4;\n4[label=\"Node Type: NEW VARIABLE 4\n\"];\n4->5;\n5[label=\"Node Type: EXPRESSION 5\n\"];\n5->6;\n6[label=\"Node Type: NEW VARIABLE 6\n\"];\n6->7;\n7[label=\"Node Type: EXPRESSION 7\n\"];\n7->8;\n8[label=\"Node Type: NEW VARIABLE 8\n\"];\n8->9;\n9[label=\"Node Type: EXPRESSION 9\n\"];\n9->10;\n10[label=\"Node Type: NEW VARIABLE 10\n\"];\n10->11;\n11[label=\"Node Type: EXPRESSION 11\n\"];\n11->12;\n12[label=\"Node Type: EXPRESSION 12\n\"];\n12->13;\n13[label=\"Node Type: EXPRESSION 13\n\"];\n13->14;\n14[label=\"Node Type: EXPRESSION 14\n\"];\n14->15;\n15[label=\"Node Type: EXPRESSION 15\n\"];\n15->16;\n16[label=\"Node Type: NEW VARIABLE 16\n\"];\n16->17;\n17[label=\"Node Type: EXPRESSION 17\n\"];\n17->18;\n18[label=\"Node Type: NEW VARIABLE 18\n\"];\n18->19;\n19[label=\"Node Type: EXPRESSION 19\n\"];\n19->20;\n20[label=\"Node Type: NEW VARIABLE 20\n\"];\n20->21;\n21[label=\"Node Type: EXPRESSION 21\n\"];\n21->22;\n22[label=\"Node Type: NEW VARIABLE 22\n\"];\n22->23;\n23[label=\"Node Type: EXPRESSION 23\n\"];\n23->24;\n24[label=\"Node Type: EXPRESSION 24\n\"];\n24->25;\n25[label=\"Node Type: EXPRESSION 25\n\"];\n25->26;\n26[label=\"Node Type: EXPRESSION 26\n\"];\n26->27;\n27[label=\"Node Type: EXPRESSION 27\n\"];\n27->28;\n28[label=\"Node Type: NEW VARIABLE 28\n\"];\n28->29;\n29[label=\"Node Type: EXPRESSION 29\n\"];\n}\n", + "f()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: INLINE ASM 1\n\"];\n1->2;\n2[label=\"Node Type: EXPRESSION 2\n\"];\n}\n" + } +} \ No newline at end of file diff --git a/tests/test_ast_parsing.py b/tests/test_ast_parsing.py index 5543ef02f..20f92cfc7 100644 --- a/tests/test_ast_parsing.py +++ b/tests/test_ast_parsing.py @@ -26,7 +26,7 @@ ALL_04 = range(0, 27) ALL_05 = range(0, 18) ALL_06 = range(0, 13) ALL_07 = range(0, 7) -ALL_08 = range(0, 11) +ALL_08 = range(0, 12) # these are tests that are currently failing right now XFAIL = ( @@ -107,9 +107,9 @@ def get_tests(solc_versions) -> Dict[str, List[str]]: tests[test_name].append(test_ver) - for key in tests: - if len(tests[key]) > 1: - tests[key] = sorted(tests[key], key=StrictVersion) + for key, test in tests.items(): + if len(test) > 1: + tests[key] = sorted(test, key=StrictVersion) # validate tests for test, vers in tests.items(): @@ -232,7 +232,7 @@ def test_parsing(test_item: Item): actual = generate_output(sl) try: - with open(expected_file, "r") as f: + with open(expected_file, "r", encoding="utf8") as f: expected = json.load(f) except OSError: pytest.xfail("the file for this test was not generated") @@ -244,9 +244,13 @@ def test_parsing(test_item: Item): for change in diff.get("values_changed", []): path_list = re.findall(r"\['(.*?)'\]", change.path()) path = "_".join(path_list) - with open(f"test_artifacts/{id_test(test_item)}_{path}_expected.dot", "w") as f: + with open( + f"test_artifacts/{id_test(test_item)}_{path}_expected.dot", "w", encoding="utf8" + ) as f: f.write(change.t1) - with open(f"test_artifacts/{id_test(test_item)}_{path}_actual.dot", "w") as f: + with open( + f"test_artifacts/{id_test(test_item)}_{path}_actual.dot", "w", encoding="utf8" + ) as f: f.write(change.t2) assert not diff, diff.pretty() @@ -290,7 +294,7 @@ def _generate_test(test_item: Item, skip_existing=False): actual = generate_output(sl) print(f"Generate {expected_file}") - with open(expected_file, "w") as f: + with open(expected_file, "w", encoding="utf8") as f: json.dump(actual, f, indent=" ") diff --git a/tests/test_detectors.py b/tests/test_detectors.py index 8d26b12cb..01d1d899a 100644 --- a/tests/test_detectors.py +++ b/tests/test_detectors.py @@ -1280,7 +1280,7 @@ def _generate_test(test_item: Test, skip_existing=False): ) results = json.loads(results_as_string) - with open(expected_result_path, "w") as f: + with open(expected_result_path, "w", encoding="utf8") as f: f.write(json.dumps(results, indent=4))