From 7db976fefd423e13147ecc2859484491ebb89c46 Mon Sep 17 00:00:00 2001 From: Feist Josselin Date: Fri, 26 Jan 2024 12:19:57 +0100 Subject: [PATCH 1/2] Add support for transfer --- test_generator/fuzzers/Echidna.py | 6 ++++++ test_generator/main.py | 12 +++++++++--- test_generator/templates/foundry_templates.py | 10 ++++++++++ 3 files changed, 25 insertions(+), 3 deletions(-) diff --git a/test_generator/fuzzers/Echidna.py b/test_generator/fuzzers/Echidna.py index fbea8a7..2fad55c 100644 --- a/test_generator/fuzzers/Echidna.py +++ b/test_generator/fuzzers/Echidna.py @@ -75,6 +75,12 @@ def _parse_call_object(self, call_dict: dict[Any, Any]) -> tuple[str, str]: return (call_str, "") function_name = call_dict["call"]["contents"][0] + + if not function_name: + template = jinja2.Template(templates["TRANSFER"]) + call_str = template.render(time_delay=time_delay, block_delay=block_delay) + return (call_str, "") + function_parameters = call_dict["call"]["contents"][1] if len(function_parameters) == 0: function_parameters = "" diff --git a/test_generator/main.py b/test_generator/main.py index 2a8a4d8..4aa555c 100644 --- a/test_generator/main.py +++ b/test_generator/main.py @@ -58,12 +58,18 @@ def create_poc(self) -> str: full_path = os.path.join(self.fuzzer.reproducer_dir, entry) if os.path.isfile(full_path): - with open(full_path, "r", encoding="utf-8") as file: - file_list.append(json.load(file)) + try: + with open(full_path, "r", encoding="utf-8") as file: + file_list.append(json.load(file)) + except Exception: # pylint: disable=broad-except + print(f"Fail on {full_path}") # 2. Parse each reproducer file and add each test function to the functions list for idx, file in enumerate(file_list): - tests_list.append(self.fuzzer.parse_reproducer(file, idx)) + try: + tests_list.append(self.fuzzer.parse_reproducer(file, idx)) + except Exception: # pylint: disable=broad-except + print(f"Parsing fail on {file}: index: {idx}") # 4. Generate the test file template = jinja2.Template(templates["CONTRACT"]) diff --git a/test_generator/templates/foundry_templates.py b/test_generator/templates/foundry_templates.py index df39cc2..d06830f 100644 --- a/test_generator/templates/foundry_templates.py +++ b/test_generator/templates/foundry_templates.py @@ -35,6 +35,15 @@ {%- endif %} """ +__TRANSFER__TEMPLATE: str = """ + {%- if has_delay -%} + vm.warp(block.timestamp + {{time_delay}}); + vm.roll(block.number + {{block_delay}}); + {%- endif %} + vm.prank({{caller}}); + target.transfer({{value}}); +""" + __EMPTY_CALL_TEMPLATE: str = """ // This is an empty call which just increases the block number and timestamp vm.warp(block.timestamp + {{time_delay}}); @@ -60,6 +69,7 @@ templates: dict = { "CONTRACT": __CONTRACT_TEMPLATE, "CALL": __CALL_TEMPLATE, + "TRANSFER": __TRANSFER__TEMPLATE, "EMPTY_CALL": __EMPTY_CALL_TEMPLATE, "TEST": __TEST_TEMPLATE, "INTERFACE": __INTERFACE_TEMPLATE, From a38e45b2cd5f8c08271c646a4a0110c3f4132c39 Mon Sep 17 00:00:00 2001 From: tuturu-tech Date: Tue, 6 Feb 2024 11:04:09 +0100 Subject: [PATCH 2/2] refactor transfer support, add test contract, add value transfer test --- test_generator/fuzzers/Echidna.py | 8 +- test_generator/templates/foundry_templates.py | 3 +- tests/conftest.py | 10 + .../coverage/8964748257296776910.txt | 1 + .../corpus-value/covered.1707213004.html | 1022 +++++++++++++++++ .../corpus-value/covered.1707213004.lcov | 384 +++++++ .../corpus-value/covered.1707213004.txt | 986 ++++++++++++++++ .../reproducers/-3813008174787504499.txt | 1 + tests/test_data/src/ValueTransfer.sol | 16 + .../test/ValueTransfer_Echidna_Test.t.sol | 25 + tests/test_types_echidna.py | 31 + tests/test_types_medusa.py | 31 + 12 files changed, 2514 insertions(+), 4 deletions(-) create mode 100644 tests/test_data/echidna-corpora/corpus-value/coverage/8964748257296776910.txt create mode 100644 tests/test_data/echidna-corpora/corpus-value/covered.1707213004.html create mode 100644 tests/test_data/echidna-corpora/corpus-value/covered.1707213004.lcov create mode 100644 tests/test_data/echidna-corpora/corpus-value/covered.1707213004.txt create mode 100644 tests/test_data/echidna-corpora/corpus-value/reproducers/-3813008174787504499.txt create mode 100644 tests/test_data/src/ValueTransfer.sol create mode 100644 tests/test_data/test/ValueTransfer_Echidna_Test.t.sol diff --git a/test_generator/fuzzers/Echidna.py b/test_generator/fuzzers/Echidna.py index 2fad55c..3537e6a 100644 --- a/test_generator/fuzzers/Echidna.py +++ b/test_generator/fuzzers/Echidna.py @@ -68,6 +68,8 @@ def _parse_call_object(self, call_dict: dict[Any, Any]) -> tuple[str, str]: time_delay = int(call_dict["delay"][0], 16) block_delay = int(call_dict["delay"][1], 16) has_delay = time_delay > 0 or block_delay > 0 + value = int(call_dict["value"], 16) + caller = call_dict["src"] if call_dict["call"]["tag"] == "NoCall": template = jinja2.Template(templates["EMPTY"]) @@ -78,14 +80,14 @@ def _parse_call_object(self, call_dict: dict[Any, Any]) -> tuple[str, str]: if not function_name: template = jinja2.Template(templates["TRANSFER"]) - call_str = template.render(time_delay=time_delay, block_delay=block_delay) + call_str = template.render( + time_delay=time_delay, block_delay=block_delay, value=value, caller=caller + ) return (call_str, "") function_parameters = call_dict["call"]["contents"][1] if len(function_parameters) == 0: function_parameters = "" - caller = call_dict["src"] - value = int(call_dict["value"], 16) slither_entry_point = None diff --git a/test_generator/templates/foundry_templates.py b/test_generator/templates/foundry_templates.py index d06830f..0017f77 100644 --- a/test_generator/templates/foundry_templates.py +++ b/test_generator/templates/foundry_templates.py @@ -41,7 +41,8 @@ vm.roll(block.number + {{block_delay}}); {%- endif %} vm.prank({{caller}}); - target.transfer({{value}}); + (bool success, ) = payable(address(target)).call{value: {{value}}}(""); + require(success, "Low level call failed."); """ __EMPTY_CALL_TEMPLATE: str = """ diff --git a/tests/conftest.py b/tests/conftest.py index 7f15d9f..4f556a1 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -83,3 +83,13 @@ def structs_and_enums() -> TestGenerator: corpus_dir = "corpus-struct" return TestGenerator(target, target_path, corpus_dir) + + +@pytest.fixture +def value_transfer() -> TestGenerator: + """Fixture for the ValueTransfer test contract""" + target = "ValueTransfer" + target_path = "./src/ValueTransfer.sol" + corpus_dir = "corpus-value" + + return TestGenerator(target, target_path, corpus_dir) diff --git a/tests/test_data/echidna-corpora/corpus-value/coverage/8964748257296776910.txt b/tests/test_data/echidna-corpora/corpus-value/coverage/8964748257296776910.txt new file mode 100644 index 0000000..e538a5e --- /dev/null +++ b/tests/test_data/echidna-corpora/corpus-value/coverage/8964748257296776910.txt @@ -0,0 +1 @@ +[{"call":{"contents":["check_balance",[]],"tag":"SolCall"},"delay":["0x000000000000000000000000000000000000000000000000000000000004eb42","0x0000000000000000000000000000000000000000000000000000000000000015"],"dst":"0x00a329c0648769A73afAc7F9381E08FB43dBEA72","gas":12500000,"gasprice":"0x0000000000000000000000000000000000000000000000000000000000000000","src":"0x0000000000000000000000000000000000030000","value":"0x0000000000000000000000000000000000000000000000000000000000000000"},{"call":{"contents":["check_balance",[]],"tag":"SolCall"},"delay":["0x0000000000000000000000000000000000000000000000000000000000007b6a","0x000000000000000000000000000000000000000000000000000000000000b31c"],"dst":"0x00a329c0648769A73afAc7F9381E08FB43dBEA72","gas":12500000,"gasprice":"0x0000000000000000000000000000000000000000000000000000000000000000","src":"0x0000000000000000000000000000000000010000","value":"0x0000000000000000000000000000000000000000000000000000000000000000"},{"call":{"contents":["check_balance",[]],"tag":"SolCall"},"delay":["0x00000000000000000000000000000000000000000000000000000000000103ef","0x0000000000000000000000000000000000000000000000000000000000005caa"],"dst":"0x00a329c0648769A73afAc7F9381E08FB43dBEA72","gas":12500000,"gasprice":"0x0000000000000000000000000000000000000000000000000000000000000000","src":"0x0000000000000000000000000000000000030000","value":"0x0000000000000000000000000000000000000000000000000000000000000000"},{"call":{"contents":["",[]],"tag":"SolCall"},"delay":["0x00000000000000000000000000000000000000000000000000000000000712e5","0x000000000000000000000000000000000000000000000000000000000000defe"],"dst":"0x00a329c0648769A73afAc7F9381E08FB43dBEA72","gas":12500000,"gasprice":"0x0000000000000000000000000000000000000000000000000000000000000000","src":"0x0000000000000000000000000000000000010000","value":"0x00000000000000000000000000000000000000000000000232820703f4e5ad47"},{"call":{"contents":["check_balance",[]],"tag":"SolCall"},"delay":["0x000000000000000000000000000000000000000000000000000000000000000a","0x00000000000000000000000000000000000000000000000000000000000080fc"],"dst":"0x00a329c0648769A73afAc7F9381E08FB43dBEA72","gas":12500000,"gasprice":"0x0000000000000000000000000000000000000000000000000000000000000000","src":"0x0000000000000000000000000000000000010000","value":"0x0000000000000000000000000000000000000000000000000000000000000000"},{"call":{"contents":["",[]],"tag":"SolCall"},"delay":["0x00000000000000000000000000000000000000000000000000000000000214c9","0x000000000000000000000000000000000000000000000000000000000000d619"],"dst":"0x00a329c0648769A73afAc7F9381E08FB43dBEA72","gas":12500000,"gasprice":"0x0000000000000000000000000000000000000000000000000000000000000000","src":"0x0000000000000000000000000000000000020000","value":"0x00000000000000000000000000000000000000000000000465040e07e9cb5a8f"},{"call":{"contents":["",[]],"tag":"SolCall"},"delay":["0x0000000000000000000000000000000000000000000000000000000000065679","0x0000000000000000000000000000000000000000000000000000000000002f7b"],"dst":"0x00a329c0648769A73afAc7F9381E08FB43dBEA72","gas":12500000,"gasprice":"0x0000000000000000000000000000000000000000000000000000000000000000","src":"0x0000000000000000000000000000000000010000","value":"0x000000000000000000000000000000000000000000000003a38d91324a4be2d4"},{"call":{"contents":["check_balance",[]],"tag":"SolCall"},"delay":["0x00000000000000000000000000000000000000000000000000000000000103ef","0x000000000000000000000000000000000000000000000000000000000000e8a0"],"dst":"0x00a329c0648769A73afAc7F9381E08FB43dBEA72","gas":12500000,"gasprice":"0x0000000000000000000000000000000000000000000000000000000000000000","src":"0x0000000000000000000000000000000000010000","value":"0x0000000000000000000000000000000000000000000000000000000000000000"},{"call":{"contents":["",[]],"tag":"SolCall"},"delay":["0x000000000000000000000000000000000000000000000000000000000006c82f","0x000000000000000000000000000000000000000000000000000000000000619b"],"dst":"0x00a329c0648769A73afAc7F9381E08FB43dBEA72","gas":12500000,"gasprice":"0x0000000000000000000000000000000000000000000000000000000000000000","src":"0x0000000000000000000000000000000000030000","value":"0x000000000000000000000000000000000000000000000001c06d85f8415e4865"},{"call":{"contents":["check_balance",[]],"tag":"SolCall"},"delay":["0x000000000000000000000000000000000000000000000000000000000004daf5","0x00000000000000000000000000000000000000000000000000000000000013bd"],"dst":"0x00a329c0648769A73afAc7F9381E08FB43dBEA72","gas":12500000,"gasprice":"0x0000000000000000000000000000000000000000000000000000000000000000","src":"0x0000000000000000000000000000000000020000","value":"0x0000000000000000000000000000000000000000000000000000000000000000"},{"call":{"contents":["check_balance",[]],"tag":"SolCall"},"delay":["0x00000000000000000000000000000000000000000000000000000000000804a4","0x000000000000000000000000000000000000000000000000000000000000824d"],"dst":"0x00a329c0648769A73afAc7F9381E08FB43dBEA72","gas":12500000,"gasprice":"0x0000000000000000000000000000000000000000000000000000000000000000","src":"0x0000000000000000000000000000000000010000","value":"0x0000000000000000000000000000000000000000000000000000000000000000"},{"call":{"contents":["",[]],"tag":"SolCall"},"delay":["0x0000000000000000000000000000000000000000000000000000000000000000","0x0000000000000000000000000000000000000000000000000000000000000000"],"dst":"0x00a329c0648769A73afAc7F9381E08FB43dBEA72","gas":12500000,"gasprice":"0x0000000000000000000000000000000000000000000000000000000000000000","src":"0x0000000000000000000000000000000000020000","value":"0x0000000000000000000000000000000000000000000000023d0474e1a60cef66"},{"call":{"contents":["",[]],"tag":"SolCall"},"delay":["0x0000000000000000000000000000000000000000000000000000000000062123","0x000000000000000000000000000000000000000000000000000000000000138c"],"dst":"0x00a329c0648769A73afAc7F9381E08FB43dBEA72","gas":12500000,"gasprice":"0x0000000000000000000000000000000000000000000000000000000000000000","src":"0x0000000000000000000000000000000000020000","value":"0x00000000000000000000000000000000000000000000000417377dfa4760893a"},{"call":{"contents":["check_balance",[]],"tag":"SolCall"},"delay":["0x000000000000000000000000000000000000000000000000000000000004eb32","0x000000000000000000000000000000000000000000000000000000000000d376"],"dst":"0x00a329c0648769A73afAc7F9381E08FB43dBEA72","gas":12500000,"gasprice":"0x0000000000000000000000000000000000000000000000000000000000000000","src":"0x0000000000000000000000000000000000010000","value":"0x0000000000000000000000000000000000000000000000000000000000000000"},{"call":{"contents":["check_balance",[]],"tag":"SolCall"},"delay":["0x000000000000000000000000000000000000000000000000000000000005c068","0x000000000000000000000000000000000000000000000000000000000000b7e3"],"dst":"0x00a329c0648769A73afAc7F9381E08FB43dBEA72","gas":12500000,"gasprice":"0x0000000000000000000000000000000000000000000000000000000000000000","src":"0x0000000000000000000000000000000000030000","value":"0x0000000000000000000000000000000000000000000000000000000000000000"},{"call":{"contents":["",[]],"tag":"SolCall"},"delay":["0x000000000000000000000000000000000000000000000000000000000006b721","0x000000000000000000000000000000000000000000000000000000000000b556"],"dst":"0x00a329c0648769A73afAc7F9381E08FB43dBEA72","gas":12500000,"gasprice":"0x0000000000000000000000000000000000000000000000000000000000000000","src":"0x0000000000000000000000000000000000010000","value":"0x000000000000000000000000000000000000000000000001d1c6c8996525f169"},{"call":{"contents":["",[]],"tag":"SolCall"},"delay":["0x000000000000000000000000000000000000000000000000000000000004eb3e","0x000000000000000000000000000000000000000000000000000000000000ea4d"],"dst":"0x00a329c0648769A73afAc7F9381E08FB43dBEA72","gas":12500000,"gasprice":"0x0000000000000000000000000000000000000000000000000000000000000000","src":"0x0000000000000000000000000000000000030000","value":"0x0000000000000000000000000000000000000000000000004f13dfbe729c5085"},{"call":{"contents":["",[]],"tag":"SolCall"},"delay":["0x0000000000000000000000000000000000000000000000000000000000000006","0x0000000000000000000000000000000000000000000000000000000000002e81"],"dst":"0x00a329c0648769A73afAc7F9381E08FB43dBEA72","gas":12500000,"gasprice":"0x0000000000000000000000000000000000000000000000000000000000000000","src":"0x0000000000000000000000000000000000010000","value":"0x000000000000000000000000000000000000000000000000000000005ae26349"},{"call":{"contents":["check_balance",[]],"tag":"SolCall"},"delay":["0x0000000000000000000000000000000000000000000000000000000000076ea6","0x000000000000000000000000000000000000000000000000000000000000139e"],"dst":"0x00a329c0648769A73afAc7F9381E08FB43dBEA72","gas":12500000,"gasprice":"0x0000000000000000000000000000000000000000000000000000000000000000","src":"0x0000000000000000000000000000000000010000","value":"0x0000000000000000000000000000000000000000000000000000000000000000"},{"call":{"contents":["",[]],"tag":"SolCall"},"delay":["0x00000000000000000000000000000000000000000000000000000000000582b0","0x000000000000000000000000000000000000000000000000000000000000cf13"],"dst":"0x00a329c0648769A73afAc7F9381E08FB43dBEA72","gas":12500000,"gasprice":"0x0000000000000000000000000000000000000000000000000000000000000000","src":"0x0000000000000000000000000000000000010000","value":"0x00000000000000000000000000000000000000000000000000000000ffffffff"},{"call":{"contents":["",[]],"tag":"SolCall"},"delay":["0x000000000000000000000000000000000000000000000000000000000007d1b7","0x000000000000000000000000000000000000000000000000000000000000cf13"],"dst":"0x00a329c0648769A73afAc7F9381E08FB43dBEA72","gas":12500000,"gasprice":"0x0000000000000000000000000000000000000000000000000000000000000000","src":"0x0000000000000000000000000000000000010000","value":"0x00000000000000000000000000000000000000000000000344965c2d45d8fe48"},{"call":{"contents":["",[]],"tag":"SolCall"},"delay":["0x00000000000000000000000000000000000000000000000000000000000189e3","0x0000000000000000000000000000000000000000000000000000000000002578"],"dst":"0x00a329c0648769A73afAc7F9381E08FB43dBEA72","gas":12500000,"gasprice":"0x0000000000000000000000000000000000000000000000000000000000000000","src":"0x0000000000000000000000000000000000020000","value":"0x000000000000000000000000000000000000000000000003511689ec198fffe8"},{"call":{"contents":["check_balance",[]],"tag":"SolCall"},"delay":["0x0000000000000000000000000000000000000000000000000000000000063720","0x000000000000000000000000000000000000000000000000000000000000b556"],"dst":"0x00a329c0648769A73afAc7F9381E08FB43dBEA72","gas":12500000,"gasprice":"0x0000000000000000000000000000000000000000000000000000000000000000","src":"0x0000000000000000000000000000000000030000","value":"0x0000000000000000000000000000000000000000000000000000000000000000"},{"call":{"contents":["check_balance",[]],"tag":"SolCall"},"delay":["0x00000000000000000000000000000000000000000000000000000000000650ac","0x0000000000000000000000000000000000000000000000000000000000000005"],"dst":"0x00a329c0648769A73afAc7F9381E08FB43dBEA72","gas":12500000,"gasprice":"0x0000000000000000000000000000000000000000000000000000000000000000","src":"0x0000000000000000000000000000000000030000","value":"0x0000000000000000000000000000000000000000000000000000000000000000"},{"call":{"contents":["check_balance",[]],"tag":"SolCall"},"delay":["0x0000000000000000000000000000000000000000000000000000000000077bce","0x00000000000000000000000000000000000000000000000000000000000009d2"],"dst":"0x00a329c0648769A73afAc7F9381E08FB43dBEA72","gas":12500000,"gasprice":"0x0000000000000000000000000000000000000000000000000000000000000000","src":"0x0000000000000000000000000000000000010000","value":"0x0000000000000000000000000000000000000000000000000000000000000000"},{"call":{"contents":["check_balance",[]],"tag":"SolCall"},"delay":["0x000000000000000000000000000000000000000000000000000000000005bd20","0x000000000000000000000000000000000000000000000000000000000000d065"],"dst":"0x00a329c0648769A73afAc7F9381E08FB43dBEA72","gas":12500000,"gasprice":"0x0000000000000000000000000000000000000000000000000000000000000000","src":"0x0000000000000000000000000000000000020000","value":"0x0000000000000000000000000000000000000000000000000000000000000000"},{"call":{"contents":["check_balance",[]],"tag":"SolCall"},"delay":["0x0000000000000000000000000000000000000000000000000000000000074d9f","0x0000000000000000000000000000000000000000000000000000000000005daa"],"dst":"0x00a329c0648769A73afAc7F9381E08FB43dBEA72","gas":12500000,"gasprice":"0x0000000000000000000000000000000000000000000000000000000000000000","src":"0x0000000000000000000000000000000000020000","value":"0x0000000000000000000000000000000000000000000000000000000000000000"},{"call":{"contents":["check_balance",[]],"tag":"SolCall"},"delay":["0x0000000000000000000000000000000000000000000000000000000000000005","0x0000000000000000000000000000000000000000000000000000000000000231"],"dst":"0x00a329c0648769A73afAc7F9381E08FB43dBEA72","gas":12500000,"gasprice":"0x0000000000000000000000000000000000000000000000000000000000000000","src":"0x0000000000000000000000000000000000030000","value":"0x0000000000000000000000000000000000000000000000000000000000000000"},{"call":{"contents":["check_balance",[]],"tag":"SolCall"},"delay":["0x0000000000000000000000000000000000000000000000000000000000000000","0x0000000000000000000000000000000000000000000000000000000000000000"],"dst":"0x00a329c0648769A73afAc7F9381E08FB43dBEA72","gas":12500000,"gasprice":"0x0000000000000000000000000000000000000000000000000000000000000000","src":"0x0000000000000000000000000000000000020000","value":"0x0000000000000000000000000000000000000000000000000000000000000000"},{"call":{"contents":["check_balance",[]],"tag":"SolCall"},"delay":["0x00000000000000000000000000000000000000000000000000000000000094ab","0x0000000000000000000000000000000000000000000000000000000000001475"],"dst":"0x00a329c0648769A73afAc7F9381E08FB43dBEA72","gas":12500000,"gasprice":"0x0000000000000000000000000000000000000000000000000000000000000000","src":"0x0000000000000000000000000000000000030000","value":"0x0000000000000000000000000000000000000000000000000000000000000000"},{"call":{"contents":["check_balance",[]],"tag":"SolCall"},"delay":["0x0000000000000000000000000000000000000000000000000000000000007b6a","0x00000000000000000000000000000000000000000000000000000000000064ce"],"dst":"0x00a329c0648769A73afAc7F9381E08FB43dBEA72","gas":12500000,"gasprice":"0x0000000000000000000000000000000000000000000000000000000000000000","src":"0x0000000000000000000000000000000000010000","value":"0x0000000000000000000000000000000000000000000000000000000000000000"},{"call":{"contents":["check_balance",[]],"tag":"SolCall"},"delay":["0x00000000000000000000000000000000000000000000000000000000000142ef","0x0000000000000000000000000000000000000000000000000000000000000552"],"dst":"0x00a329c0648769A73afAc7F9381E08FB43dBEA72","gas":12500000,"gasprice":"0x0000000000000000000000000000000000000000000000000000000000000000","src":"0x0000000000000000000000000000000000030000","value":"0x0000000000000000000000000000000000000000000000000000000000000000"},{"call":{"contents":["check_balance",[]],"tag":"SolCall"},"delay":["0x000000000000000000000000000000000000000000000000000000000008af1a","0x0000000000000000000000000000000000000000000000000000000000000015"],"dst":"0x00a329c0648769A73afAc7F9381E08FB43dBEA72","gas":12500000,"gasprice":"0x0000000000000000000000000000000000000000000000000000000000000000","src":"0x0000000000000000000000000000000000020000","value":"0x0000000000000000000000000000000000000000000000000000000000000000"},{"call":{"contents":["check_balance",[]],"tag":"SolCall"},"delay":["0x000000000000000000000000000000000000000000000000000000000000c247","0x00000000000000000000000000000000000000000000000000000000000020ff"],"dst":"0x00a329c0648769A73afAc7F9381E08FB43dBEA72","gas":12500000,"gasprice":"0x0000000000000000000000000000000000000000000000000000000000000000","src":"0x0000000000000000000000000000000000020000","value":"0x0000000000000000000000000000000000000000000000000000000000000000"},{"call":{"contents":["",[]],"tag":"SolCall"},"delay":["0x00000000000000000000000000000000000000000000000000000000000712e3","0x0000000000000000000000000000000000000000000000000000000000007a00"],"dst":"0x00a329c0648769A73afAc7F9381E08FB43dBEA72","gas":12500000,"gasprice":"0x0000000000000000000000000000000000000000000000000000000000000000","src":"0x0000000000000000000000000000000000020000","value":"0x000000000000000000000000000000000000000000000000094f1778dc022648"},{"call":{"contents":["check_balance",[]],"tag":"SolCall"},"delay":["0x000000000000000000000000000000000000000000000000000000000006b504","0x00000000000000000000000000000000000000000000000000000000000000ff"],"dst":"0x00a329c0648769A73afAc7F9381E08FB43dBEA72","gas":12500000,"gasprice":"0x0000000000000000000000000000000000000000000000000000000000000000","src":"0x0000000000000000000000000000000000030000","value":"0x0000000000000000000000000000000000000000000000000000000000000000"},{"call":{"contents":["",[]],"tag":"SolCall"},"delay":["0x000000000000000000000000000000000000000000000000000000000006a2ce","0x000000000000000000000000000000000000000000000000000000000000753b"],"dst":"0x00a329c0648769A73afAc7F9381E08FB43dBEA72","gas":12500000,"gasprice":"0x0000000000000000000000000000000000000000000000000000000000000000","src":"0x0000000000000000000000000000000000010000","value":"0x000000000000000000000000000000000000000000000003a38d9132ca4be2d3"},{"call":{"contents":["check_balance",[]],"tag":"SolCall"},"delay":["0x00000000000000000000000000000000000000000000000000000000000712e2","0x00000000000000000000000000000000000000000000000000000000000087a0"],"dst":"0x00a329c0648769A73afAc7F9381E08FB43dBEA72","gas":12500000,"gasprice":"0x0000000000000000000000000000000000000000000000000000000000000000","src":"0x0000000000000000000000000000000000010000","value":"0x0000000000000000000000000000000000000000000000000000000000000000"},{"call":{"contents":["",[]],"tag":"SolCall"},"delay":["0x0000000000000000000000000000000000000000000000000000000000000005","0x00000000000000000000000000000000000000000000000000000000000026c0"],"dst":"0x00a329c0648769A73afAc7F9381E08FB43dBEA72","gas":12500000,"gasprice":"0x0000000000000000000000000000000000000000000000000000000000000000","src":"0x0000000000000000000000000000000000020000","value":"0x0000000000000000000000000000000000000000000000039a3e79b9ee49bc8b"},{"call":{"contents":["check_balance",[]],"tag":"SolCall"},"delay":["0x0000000000000000000000000000000000000000000000000000000000043af0","0x00000000000000000000000000000000000000000000000000000000000087a0"],"dst":"0x00a329c0648769A73afAc7F9381E08FB43dBEA72","gas":12500000,"gasprice":"0x0000000000000000000000000000000000000000000000000000000000000000","src":"0x0000000000000000000000000000000000030000","value":"0x0000000000000000000000000000000000000000000000000000000000000000"},{"call":{"contents":["",[]],"tag":"SolCall"},"delay":["0x0000000000000000000000000000000000000000000000000000000000000013","0x00000000000000000000000000000000000000000000000000000000000087a0"],"dst":"0x00a329c0648769A73afAc7F9381E08FB43dBEA72","gas":12500000,"gasprice":"0x0000000000000000000000000000000000000000000000000000000000000000","src":"0x0000000000000000000000000000000000010000","value":"0x000000000000000000000000000000000000000000000000c5f51b770436bde6"},{"call":{"contents":["",[]],"tag":"SolCall"},"delay":["0x0000000000000000000000000000000000000000000000000000000000065679","0x00000000000000000000000000000000000000000000000000000000000009d0"],"dst":"0x00a329c0648769A73afAc7F9381E08FB43dBEA72","gas":12500000,"gasprice":"0x0000000000000000000000000000000000000000000000000000000000000000","src":"0x0000000000000000000000000000000000020000","value":"0x000000000000000000000000000000000000000000000002cc4e435f8ea9d250"},{"call":{"contents":["",[]],"tag":"SolCall"},"delay":["0x000000000000000000000000000000000000000000000000000000000003a63f","0x0000000000000000000000000000000000000000000000000000000000005ef7"],"dst":"0x00a329c0648769A73afAc7F9381E08FB43dBEA72","gas":12500000,"gasprice":"0x0000000000000000000000000000000000000000000000000000000000000000","src":"0x0000000000000000000000000000000000030000","value":"0x00000000000000000000000000000000000000000000000318de3cd233a35ef3"},{"call":{"contents":["check_balance",[]],"tag":"SolCall"},"delay":["0x000000000000000000000000000000000000000000000000000000000004daf5","0x0000000000000000000000000000000000000000000000000000000000000015"],"dst":"0x00a329c0648769A73afAc7F9381E08FB43dBEA72","gas":12500000,"gasprice":"0x0000000000000000000000000000000000000000000000000000000000000000","src":"0x0000000000000000000000000000000000010000","value":"0x0000000000000000000000000000000000000000000000000000000000000000"},{"call":{"contents":["",[]],"tag":"SolCall"},"delay":["0x0000000000000000000000000000000000000000000000000000000000064ad5","0x0000000000000000000000000000000000000000000000000000000000002f15"],"dst":"0x00a329c0648769A73afAc7F9381E08FB43dBEA72","gas":12500000,"gasprice":"0x0000000000000000000000000000000000000000000000000000000000000000","src":"0x0000000000000000000000000000000000010000","value":"0x000000000000000000000000000000000000000000000000f229d1c0ffd10be2"},{"call":{"contents":["check_balance",[]],"tag":"SolCall"},"delay":["0x0000000000000000000000000000000000000000000000000000000000076ea6","0x0000000000000000000000000000000000000000000000000000000000008980"],"dst":"0x00a329c0648769A73afAc7F9381E08FB43dBEA72","gas":12500000,"gasprice":"0x0000000000000000000000000000000000000000000000000000000000000000","src":"0x0000000000000000000000000000000000030000","value":"0x0000000000000000000000000000000000000000000000000000000000000000"},{"call":{"contents":["check_balance",[]],"tag":"SolCall"},"delay":["0x0000000000000000000000000000000000000000000000000000000000000001","0x000000000000000000000000000000000000000000000000000000000000eb58"],"dst":"0x00a329c0648769A73afAc7F9381E08FB43dBEA72","gas":12500000,"gasprice":"0x0000000000000000000000000000000000000000000000000000000000000000","src":"0x0000000000000000000000000000000000030000","value":"0x0000000000000000000000000000000000000000000000000000000000000000"},{"call":{"contents":["check_balance",[]],"tag":"SolCall"},"delay":["0x0000000000000000000000000000000000000000000000000000000000041001","0x0000000000000000000000000000000000000000000000000000000000006ffe"],"dst":"0x00a329c0648769A73afAc7F9381E08FB43dBEA72","gas":12500000,"gasprice":"0x0000000000000000000000000000000000000000000000000000000000000000","src":"0x0000000000000000000000000000000000030000","value":"0x0000000000000000000000000000000000000000000000000000000000000000"},{"call":{"contents":["check_balance",[]],"tag":"SolCall"},"delay":["0x000000000000000000000000000000000000000000000000000000000001c18d","0x0000000000000000000000000000000000000000000000000000000000004033"],"dst":"0x00a329c0648769A73afAc7F9381E08FB43dBEA72","gas":12500000,"gasprice":"0x0000000000000000000000000000000000000000000000000000000000000000","src":"0x0000000000000000000000000000000000010000","value":"0x0000000000000000000000000000000000000000000000000000000000000000"},{"call":{"contents":["",[]],"tag":"SolCall"},"delay":["0x0000000000000000000000000000000000000000000000000000000000080772","0x0000000000000000000000000000000000000000000000000000000000002e81"],"dst":"0x00a329c0648769A73afAc7F9381E08FB43dBEA72","gas":12500000,"gasprice":"0x0000000000000000000000000000000000000000000000000000000000000000","src":"0x0000000000000000000000000000000000020000","value":"0x000000000000000000000000000000000000000000000003a38d9132ca4be2d0"},{"call":{"contents":["",[]],"tag":"SolCall"},"delay":["0x0000000000000000000000000000000000000000000000000000000000033659","0x00000000000000000000000000000000000000000000000000000000000030cd"],"dst":"0x00a329c0648769A73afAc7F9381E08FB43dBEA72","gas":12500000,"gasprice":"0x0000000000000000000000000000000000000000000000000000000000000000","src":"0x0000000000000000000000000000000000020000","value":"0x0000000000000000000000000000000000000000000000000000000000000013"},{"call":{"contents":["check_balance",[]],"tag":"SolCall"},"delay":["0x0000000000000000000000000000000000000000000000000000000000070f76","0x000000000000000000000000000000000000000000000000000000000000a663"],"dst":"0x00a329c0648769A73afAc7F9381E08FB43dBEA72","gas":12500000,"gasprice":"0x0000000000000000000000000000000000000000000000000000000000000000","src":"0x0000000000000000000000000000000000020000","value":"0x0000000000000000000000000000000000000000000000000000000000000000"},{"call":{"contents":["check_balance",[]],"tag":"SolCall"},"delay":["0x0000000000000000000000000000000000000000000000000000000000038e43","0x0000000000000000000000000000000000000000000000000000000000005ef7"],"dst":"0x00a329c0648769A73afAc7F9381E08FB43dBEA72","gas":12500000,"gasprice":"0x0000000000000000000000000000000000000000000000000000000000000000","src":"0x0000000000000000000000000000000000010000","value":"0x0000000000000000000000000000000000000000000000000000000000000000"},{"call":{"contents":["check_balance",[]],"tag":"SolCall"},"delay":["0x0000000000000000000000000000000000000000000000000000000000007b6a","0x000000000000000000000000000000000000000000000000000000000000eb58"],"dst":"0x00a329c0648769A73afAc7F9381E08FB43dBEA72","gas":12500000,"gasprice":"0x0000000000000000000000000000000000000000000000000000000000000000","src":"0x0000000000000000000000000000000000010000","value":"0x0000000000000000000000000000000000000000000000000000000000000000"},{"call":{"contents":["",[]],"tag":"SolCall"},"delay":["0x0000000000000000000000000000000000000000000000000000000000028928","0x0000000000000000000000000000000000000000000000000000000000001475"],"dst":"0x00a329c0648769A73afAc7F9381E08FB43dBEA72","gas":12500000,"gasprice":"0x0000000000000000000000000000000000000000000000000000000000000000","src":"0x0000000000000000000000000000000000020000","value":"0x00000000000000000000000000000000000000000000000232820703f4e5ad47"},{"call":{"contents":["check_balance",[]],"tag":"SolCall"},"delay":["0x000000000000000000000000000000000000000000000000000000000001cae0","0x000000000000000000000000000000000000000000000000000000000000d1ae"],"dst":"0x00a329c0648769A73afAc7F9381E08FB43dBEA72","gas":12500000,"gasprice":"0x0000000000000000000000000000000000000000000000000000000000000000","src":"0x0000000000000000000000000000000000010000","value":"0x0000000000000000000000000000000000000000000000000000000000000000"},{"call":{"contents":["",[]],"tag":"SolCall"},"delay":["0x000000000000000000000000000000000000000000000000000000000006b721","0x000000000000000000000000000000000000000000000000000000000000b0cd"],"dst":"0x00a329c0648769A73afAc7F9381E08FB43dBEA72","gas":12500000,"gasprice":"0x0000000000000000000000000000000000000000000000000000000000000000","src":"0x0000000000000000000000000000000000020000","value":"0x000000000000000000000000000000000000000000000001c06d85f8415e4865"},{"call":{"contents":["",[]],"tag":"SolCall"},"delay":["0x000000000000000000000000000000000000000000000000000000000000b056","0x000000000000000000000000000000000000000000000000000000000000eb58"],"dst":"0x00a329c0648769A73afAc7F9381E08FB43dBEA72","gas":12500000,"gasprice":"0x0000000000000000000000000000000000000000000000000000000000000000","src":"0x0000000000000000000000000000000000030000","value":"0x0000000000000000000000000000000000000000000000008aaf546096a883e0"},{"call":{"contents":["check_balance",[]],"tag":"SolCall"},"delay":["0x0000000000000000000000000000000000000000000000000000000000061e55","0x00000000000000000000000000000000000000000000000000000000000047fd"],"dst":"0x00a329c0648769A73afAc7F9381E08FB43dBEA72","gas":12500000,"gasprice":"0x0000000000000000000000000000000000000000000000000000000000000000","src":"0x0000000000000000000000000000000000030000","value":"0x0000000000000000000000000000000000000000000000000000000000000000"},{"call":{"contents":["check_balance",[]],"tag":"SolCall"},"delay":["0x0000000000000000000000000000000000000000000000000000000000058c8f","0x0000000000000000000000000000000000000000000000000000000000005707"],"dst":"0x00a329c0648769A73afAc7F9381E08FB43dBEA72","gas":12500000,"gasprice":"0x0000000000000000000000000000000000000000000000000000000000000000","src":"0x0000000000000000000000000000000000030000","value":"0x0000000000000000000000000000000000000000000000000000000000000000"},{"call":{"contents":["check_balance",[]],"tag":"SolCall"},"delay":["0x000000000000000000000000000000000000000000000000000000000006a9f7","0x00000000000000000000000000000000000000000000000000000000000009d2"],"dst":"0x00a329c0648769A73afAc7F9381E08FB43dBEA72","gas":12500000,"gasprice":"0x0000000000000000000000000000000000000000000000000000000000000000","src":"0x0000000000000000000000000000000000020000","value":"0x0000000000000000000000000000000000000000000000000000000000000000"},{"call":{"contents":["",[]],"tag":"SolCall"},"delay":["0x000000000000000000000000000000000000000000000000000000000000007f","0x000000000000000000000000000000000000000000000000000000000000acf2"],"dst":"0x00a329c0648769A73afAc7F9381E08FB43dBEA72","gas":12500000,"gasprice":"0x0000000000000000000000000000000000000000000000000000000000000000","src":"0x0000000000000000000000000000000000020000","value":"0x000000000000000000000000000000000000000000000003a38d9132ca4b62d4"},{"call":{"contents":["",[]],"tag":"SolCall"},"delay":["0x000000000000000000000000000000000000000000000000000000000008a347","0x00000000000000000000000000000000000000000000000000000000000009d0"],"dst":"0x00a329c0648769A73afAc7F9381E08FB43dBEA72","gas":12500000,"gasprice":"0x0000000000000000000000000000000000000000000000000000000000000000","src":"0x0000000000000000000000000000000000030000","value":"0x000000000000000000000000000000000000000000000001c06d85f8415e4865"},{"call":{"contents":["",[]],"tag":"SolCall"},"delay":["0x00000000000000000000000000000000000000000000000000000000000214c8","0x00000000000000000000000000000000000000000000000000000000000009d0"],"dst":"0x00a329c0648769A73afAc7F9381E08FB43dBEA72","gas":12500000,"gasprice":"0x0000000000000000000000000000000000000000000000000000000000000000","src":"0x0000000000000000000000000000000000030000","value":"0x0000000000000000000000000000000000000000000000000000000000000003"},{"call":{"contents":["",[]],"tag":"SolCall"},"delay":["0x0000000000000000000000000000000000000000000000000000000000038f38","0x0000000000000000000000000000000000000000000000000000000000000014"],"dst":"0x00a329c0648769A73afAc7F9381E08FB43dBEA72","gas":12500000,"gasprice":"0x0000000000000000000000000000000000000000000000000000000000000000","src":"0x0000000000000000000000000000000000030000","value":"0x0000000000000000000000000000000000000000000000000000000000ffffff"},{"call":{"contents":["check_balance",[]],"tag":"SolCall"},"delay":["0x0000000000000000000000000000000000000000000000000000000000051251","0x00000000000000000000000000000000000000000000000000000000000047fd"],"dst":"0x00a329c0648769A73afAc7F9381E08FB43dBEA72","gas":12500000,"gasprice":"0x0000000000000000000000000000000000000000000000000000000000000000","src":"0x0000000000000000000000000000000000010000","value":"0x0000000000000000000000000000000000000000000000000000000000000000"},{"call":{"contents":["",[]],"tag":"SolCall"},"delay":["0x000000000000000000000000000000000000000000000000000000000001b73c","0x000000000000000000000000000000000000000000000000000000000000b0cd"],"dst":"0x00a329c0648769A73afAc7F9381E08FB43dBEA72","gas":12500000,"gasprice":"0x0000000000000000000000000000000000000000000000000000000000000000","src":"0x0000000000000000000000000000000000010000","value":"0x0000000000000000000000000000000000000000000000000000000000000005"},{"call":{"contents":["",[]],"tag":"SolCall"},"delay":["0x0000000000000000000000000000000000000000000000000000000000006123","0x000000000000000000000000000000000000000000000000000000000000c107"],"dst":"0x00a329c0648769A73afAc7F9381E08FB43dBEA72","gas":12500000,"gasprice":"0x0000000000000000000000000000000000000000000000000000000000000000","src":"0x0000000000000000000000000000000000020000","value":"0x000000000000000000000000000000000000000000000003a38d9132ca4b62d4"},{"call":{"contents":["",[]],"tag":"SolCall"},"delay":["0x0000000000000000000000000000000000000000000000000000000000064ad5","0x00000000000000000000000000000000000000000000000000000000000026ee"],"dst":"0x00a329c0648769A73afAc7F9381E08FB43dBEA72","gas":12500000,"gasprice":"0x0000000000000000000000000000000000000000000000000000000000000000","src":"0x0000000000000000000000000000000000010000","value":"0x0000000000000000000000000000000000000000000000052b582d82bf5078a1"},{"call":{"contents":["",[]],"tag":"SolCall"},"delay":["0x000000000000000000000000000000000000000000000000000000000003340a","0x0000000000000000000000000000000000000000000000000000000000000231"],"dst":"0x00a329c0648769A73afAc7F9381E08FB43dBEA72","gas":12500000,"gasprice":"0x0000000000000000000000000000000000000000000000000000000000000000","src":"0x0000000000000000000000000000000000020000","value":"0x0000000000000000000000000000000000000000000000000000000000007fff"},{"call":{"contents":["check_balance",[]],"tag":"SolCall"},"delay":["0x000000000000000000000000000000000000000000000000000000000004eb43","0x000000000000000000000000000000000000000000000000000000000000a7c8"],"dst":"0x00a329c0648769A73afAc7F9381E08FB43dBEA72","gas":12500000,"gasprice":"0x0000000000000000000000000000000000000000000000000000000000000000","src":"0x0000000000000000000000000000000000010000","value":"0x0000000000000000000000000000000000000000000000000000000000000000"},{"call":{"contents":["check_balance",[]],"tag":"SolCall"},"delay":["0x000000000000000000000000000000000000000000000000000000000001c5dc","0x000000000000000000000000000000000000000000000000000000000000619b"],"dst":"0x00a329c0648769A73afAc7F9381E08FB43dBEA72","gas":12500000,"gasprice":"0x0000000000000000000000000000000000000000000000000000000000000000","src":"0x0000000000000000000000000000000000030000","value":"0x0000000000000000000000000000000000000000000000000000000000000000"},{"call":{"contents":["check_balance",[]],"tag":"SolCall"},"delay":["0x00000000000000000000000000000000000000000000000000000000000189e3","0x0000000000000000000000000000000000000000000000000000000000001396"],"dst":"0x00a329c0648769A73afAc7F9381E08FB43dBEA72","gas":12500000,"gasprice":"0x0000000000000000000000000000000000000000000000000000000000000000","src":"0x0000000000000000000000000000000000020000","value":"0x0000000000000000000000000000000000000000000000014c3699028aaa9a77"},{"call":{"contents":["check_balance",[]],"tag":"SolCall"},"delay":["0x000000000000000000000000000000000000000000000000000000000002fa33","0x000000000000000000000000000000000000000000000000000000000000138d"],"dst":"0x00a329c0648769A73afAc7F9381E08FB43dBEA72","gas":12500000,"gasprice":"0x0000000000000000000000000000000000000000000000000000000000000000","src":"0x0000000000000000000000000000000000010000","value":"0x0000000000000000000000000000000000000000000000000000000000000000"},{"call":{"contents":["",[]],"tag":"SolCall"},"delay":["0x000000000000000000000000000000000000000000000000000000000003a569","0x0000000000000000000000000000000000000000000000000000000000004f13"],"dst":"0x00a329c0648769A73afAc7F9381E08FB43dBEA72","gas":12500000,"gasprice":"0x0000000000000000000000000000000000000000000000000000000000000000","src":"0x0000000000000000000000000000000000030000","value":"0x000000000000000000000000000000000000000000000003f88a2e44315d24b7"},{"call":{"contents":["",[]],"tag":"SolCall"},"delay":["0x00000000000000000000000000000000000000000000000000000000000875e1","0x00000000000000000000000000000000000000000000000000000000000002e3"],"dst":"0x00a329c0648769A73afAc7F9381E08FB43dBEA72","gas":12500000,"gasprice":"0x0000000000000000000000000000000000000000000000000000000000000000","src":"0x0000000000000000000000000000000000010000","value":"0x000000000000000000000000000000000000000000000003a38d9132c9cbe2d4"},{"call":{"contents":["",[]],"tag":"SolCall"},"delay":["0x0000000000000000000000000000000000000000000000000000000000063720","0x000000000000000000000000000000000000000000000000000000000000597d"],"dst":"0x00a329c0648769A73afAc7F9381E08FB43dBEA72","gas":12500000,"gasprice":"0x0000000000000000000000000000000000000000000000000000000000000000","src":"0x0000000000000000000000000000000000030000","value":"0x000000000000000000000000000000000000000000000002ddd8e136b16a8f30"},{"call":{"contents":["",[]],"tag":"SolCall"},"delay":["0x0000000000000000000000000000000000000000000000000000000000022cb0","0x0000000000000000000000000000000000000000000000000000000000000320"],"dst":"0x00a329c0648769A73afAc7F9381E08FB43dBEA72","gas":12500000,"gasprice":"0x0000000000000000000000000000000000000000000000000000000000000000","src":"0x0000000000000000000000000000000000020000","value":"0x00000000000000000000000000000000000000000000000463b15d71999c1388"},{"call":{"contents":["check_balance",[]],"tag":"SolCall"},"delay":["0x000000000000000000000000000000000000000000000000000000000008a317","0x0000000000000000000000000000000000000000000000000000000000003c09"],"dst":"0x00a329c0648769A73afAc7F9381E08FB43dBEA72","gas":12500000,"gasprice":"0x0000000000000000000000000000000000000000000000000000000000000000","src":"0x0000000000000000000000000000000000020000","value":"0x0000000000000000000000000000000000000000000000000000000000000000"},{"call":{"contents":["",[]],"tag":"SolCall"},"delay":["0x000000000000000000000000000000000000000000000000000000000003340a","0x00000000000000000000000000000000000000000000000000000000000087a0"],"dst":"0x00a329c0648769A73afAc7F9381E08FB43dBEA72","gas":12500000,"gasprice":"0x0000000000000000000000000000000000000000000000000000000000000000","src":"0x0000000000000000000000000000000000030000","value":"0x0000000000000000000000000000000000000000000000023d0474e1a60cef66"},{"call":{"contents":["check_balance",[]],"tag":"SolCall"},"delay":["0x0000000000000000000000000000000000000000000000000000000000011d50","0x000000000000000000000000000000000000000000000000000000000000619b"],"dst":"0x00a329c0648769A73afAc7F9381E08FB43dBEA72","gas":12500000,"gasprice":"0x0000000000000000000000000000000000000000000000000000000000000000","src":"0x0000000000000000000000000000000000010000","value":"0x0000000000000000000000000000000000000000000000000000000000000000"},{"call":{"contents":["",[]],"tag":"SolCall"},"delay":["0x00000000000000000000000000000000000000000000000000000000000712e2","0x000000000000000000000000000000000000000000000000000000000000ea4f"],"dst":"0x00a329c0648769A73afAc7F9381E08FB43dBEA72","gas":12500000,"gasprice":"0x0000000000000000000000000000000000000000000000000000000000000000","src":"0x0000000000000000000000000000000000030000","value":"0x0000000000000000000000000000000000000000000000047318dbb84a78a662"},{"call":{"contents":["check_balance",[]],"tag":"SolCall"},"delay":["0x0000000000000000000000000000000000000000000000000000000000000001","0x0000000000000000000000000000000000000000000000000000000000003ed9"],"dst":"0x00a329c0648769A73afAc7F9381E08FB43dBEA72","gas":12500000,"gasprice":"0x0000000000000000000000000000000000000000000000000000000000000000","src":"0x0000000000000000000000000000000000010000","value":"0x0000000000000000000000000000000000000000000000000000000000000000"},{"call":{"contents":["check_balance",[]],"tag":"SolCall"},"delay":["0x000000000000000000000000000000000000000000000000000000000001cae0","0x0000000000000000000000000000000000000000000000000000000000001cb2"],"dst":"0x00a329c0648769A73afAc7F9381E08FB43dBEA72","gas":12500000,"gasprice":"0x0000000000000000000000000000000000000000000000000000000000000000","src":"0x0000000000000000000000000000000000010000","value":"0x0000000000000000000000000000000000000000000000000000000000000000"},{"call":{"contents":["",[]],"tag":"SolCall"},"delay":["0x000000000000000000000000000000000000000000000000000000000006b504","0x0000000000000000000000000000000000000000000000000000000000009590"],"dst":"0x00a329c0648769A73afAc7F9381E08FB43dBEA72","gas":12500000,"gasprice":"0x0000000000000000000000000000000000000000000000000000000000000000","src":"0x0000000000000000000000000000000000010000","value":"0x0000000000000000000000000000000000000000000000039a3e79b9ee49bc8b"},{"call":{"contents":["check_balance",[]],"tag":"SolCall"},"delay":["0x0000000000000000000000000000000000000000000000000000000000007fff","0x0000000000000000000000000000000000000000000000000000000000004ddd"],"dst":"0x00a329c0648769A73afAc7F9381E08FB43dBEA72","gas":12500000,"gasprice":"0x0000000000000000000000000000000000000000000000000000000000000000","src":"0x0000000000000000000000000000000000010000","value":"0x0000000000000000000000000000000000000000000000000000000000000000"},{"call":{"contents":["check_balance",[]],"tag":"SolCall"},"delay":["0x0000000000000000000000000000000000000000000000000000000000000002","0x0000000000000000000000000000000000000000000000000000000000007660"],"dst":"0x00a329c0648769A73afAc7F9381E08FB43dBEA72","gas":12500000,"gasprice":"0x0000000000000000000000000000000000000000000000000000000000000000","src":"0x0000000000000000000000000000000000020000","value":"0x0000000000000000000000000000000000000000000000000000000000000000"},{"call":{"contents":["check_balance",[]],"tag":"SolCall"},"delay":["0x00000000000000000000000000000000000000000000000000000000000214ca","0x000000000000000000000000000000000000000000000000000000000000755a"],"dst":"0x00a329c0648769A73afAc7F9381E08FB43dBEA72","gas":12500000,"gasprice":"0x0000000000000000000000000000000000000000000000000000000000000000","src":"0x0000000000000000000000000000000000030000","value":"0x0000000000000000000000000000000000000000000000000000000000000000"},{"call":{"contents":["check_balance",[]],"tag":"SolCall"},"delay":["0x0000000000000000000000000000000000000000000000000000000000024b01","0x000000000000000000000000000000000000000000000000000000000000cf13"],"dst":"0x00a329c0648769A73afAc7F9381E08FB43dBEA72","gas":12500000,"gasprice":"0x0000000000000000000000000000000000000000000000000000000000000000","src":"0x0000000000000000000000000000000000020000","value":"0x0000000000000000000000000000000000000000000000000000000000000000"},{"call":{"contents":["check_balance",[]],"tag":"SolCall"},"delay":["0x0000000000000000000000000000000000000000000000000000000000080772","0x0000000000000000000000000000000000000000000000000000000000005ef7"],"dst":"0x00a329c0648769A73afAc7F9381E08FB43dBEA72","gas":12500000,"gasprice":"0x0000000000000000000000000000000000000000000000000000000000000000","src":"0x0000000000000000000000000000000000030000","value":"0x0000000000000000000000000000000000000000000000000000000000000000"},{"call":{"contents":["",[]],"tag":"SolCall"},"delay":["0x000000000000000000000000000000000000000000000000000000000006d828","0x000000000000000000000000000000000000000000000000000000000000eb58"],"dst":"0x00a329c0648769A73afAc7F9381E08FB43dBEA72","gas":12500000,"gasprice":"0x0000000000000000000000000000000000000000000000000000000000000000","src":"0x0000000000000000000000000000000000020000","value":"0x000000000000000000000000000000000000000000000004f150ca6c8707643f"},{"call":{"contents":["check_balance",[]],"tag":"SolCall"},"delay":["0x000000000000000000000000000000000000000000000000000000000001c5dc","0x0000000000000000000000000000000000000000000000000000000000001414"],"dst":"0x00a329c0648769A73afAc7F9381E08FB43dBEA72","gas":12500000,"gasprice":"0x0000000000000000000000000000000000000000000000000000000000000000","src":"0x0000000000000000000000000000000000030000","value":"0x0000000000000000000000000000000000000000000000000000000000000000"},{"call":{"contents":["check_balance",[]],"tag":"SolCall"},"delay":["0x00000000000000000000000000000000000000000000000000000000000712e4","0x0000000000000000000000000000000000000000000000000000000000005c65"],"dst":"0x00a329c0648769A73afAc7F9381E08FB43dBEA72","gas":12500000,"gasprice":"0x0000000000000000000000000000000000000000000000000000000000000000","src":"0x0000000000000000000000000000000000020000","value":"0x0000000000000000000000000000000000000000000000000000000000000000"},{"call":{"contents":["check_balance",[]],"tag":"SolCall"},"delay":["0x000000000000000000000000000000000000000000000000000000000005caa0","0x000000000000000000000000000000000000000000000000000000000000ea96"],"dst":"0x00a329c0648769A73afAc7F9381E08FB43dBEA72","gas":12500000,"gasprice":"0x0000000000000000000000000000000000000000000000000000000000000000","src":"0x0000000000000000000000000000000000020000","value":"0x0000000000000000000000000000000000000000000000000000000000000000"},{"call":{"contents":["check_balance",[]],"tag":"SolCall"},"delay":["0x00000000000000000000000000000000000000000000000000000000000189e3","0x0000000000000000000000000000000000000000000000000000000000000552"],"dst":"0x00a329c0648769A73afAc7F9381E08FB43dBEA72","gas":12500000,"gasprice":"0x0000000000000000000000000000000000000000000000000000000000000000","src":"0x0000000000000000000000000000000000020000","value":"0x0000000000000000000000000000000000000000000000000000000000000000"},{"call":{"contents":["check_balance",[]],"tag":"SolCall"},"delay":["0x000000000000000000000000000000000000000000000000000000000003340a","0x000000000000000000000000000000000000000000000000000000000000defe"],"dst":"0x00a329c0648769A73afAc7F9381E08FB43dBEA72","gas":12500000,"gasprice":"0x0000000000000000000000000000000000000000000000000000000000000000","src":"0x0000000000000000000000000000000000020000","value":"0x0000000000000000000000000000000000000000000000000000000000000000"},{"call":{"contents":["",[]],"tag":"SolCall"},"delay":["0x000000000000000000000000000000000000000000000000000000000007f467","0x000000000000000000000000000000000000000000000000000000000000a475"],"dst":"0x00a329c0648769A73afAc7F9381E08FB43dBEA72","gas":12500000,"gasprice":"0x0000000000000000000000000000000000000000000000000000000000000000","src":"0x0000000000000000000000000000000000030000","value":"0x00000000000000000000000000000000000000000000000202be8cc22d1f3078"},{"call":{"contents":["check_balance",[]],"tag":"SolCall"},"delay":["0x0000000000000000000000000000000000000000000000000000000000000004","0x00000000000000000000000000000000000000000000000000000000000009de"],"dst":"0x00a329c0648769A73afAc7F9381E08FB43dBEA72","gas":12500000,"gasprice":"0x0000000000000000000000000000000000000000000000000000000000000000","src":"0x0000000000000000000000000000000000010000","value":"0x0000000000000000000000000000000000000000000000000000000000000000"},{"call":{"contents":["check_balance",[]],"tag":"SolCall"},"delay":["0x000000000000000000000000000000000000000000000000000000000003256a","0x0000000000000000000000000000000000000000000000000000000000002f15"],"dst":"0x00a329c0648769A73afAc7F9381E08FB43dBEA72","gas":12500000,"gasprice":"0x0000000000000000000000000000000000000000000000000000000000000000","src":"0x0000000000000000000000000000000000020000","value":"0x0000000000000000000000000000000000000000000000000000000000000000"},{"call":{"contents":["",[]],"tag":"SolCall"},"delay":["0x0000000000000000000000000000000000000000000000000000000000007fff","0x0000000000000000000000000000000000000000000000000000000000007a00"],"dst":"0x00a329c0648769A73afAc7F9381E08FB43dBEA72","gas":12500000,"gasprice":"0x0000000000000000000000000000000000000000000000000000000000000000","src":"0x0000000000000000000000000000000000030000","value":"0x0000000000000000000000000000000000000000000000000000000000000002"}] \ No newline at end of file diff --git a/tests/test_data/echidna-corpora/corpus-value/covered.1707213004.html b/tests/test_data/echidna-corpora/corpus-value/covered.1707213004.html new file mode 100644 index 0000000..fe13756 --- /dev/null +++ b/tests/test_data/echidna-corpora/corpus-value/covered.1707213004.html @@ -0,0 +1,1022 @@ +/Users/elvisskozdopolj/Documents/GitHub/test-generator/tests/test_data/src/BasicTypes.sol + + 1 | | pragma solidity ^0.8.0; + 2 | | + 3 | | // Ran from test directory: echidna . --contract BasicTypes --test-mode assertion --test-limit 100000 --corpus-dir echidna-corpora/corpus-basic --crytic-args "--foundry-ignore-compile" + 4 | | // Ran from test directory: test-generator ./src/BasicTypes.sol --corpus-dir echidna-corpora/corpus-basic --contract "BasicTypes" --test-directory "./test/" --inheritance-path "../src/" --fuzzer echidna + 5 | | contract BasicTypes { + 6 | | + 7 | | // ------------------------------ + 8 | | // -- bool -- + 9 | | // ------------------------------ + 10 | | bool first; + 11 | | + 12 | | function setBool(bool set) public { + 13 | | first = set; + 14 | | } + 15 | | + 16 | | function check_bool() public { + 17 | | if (first) { + 18 | | assert(false); + 19 | | } + 20 | | } + 21 | | + 22 | | // ------------------------------ + 23 | | // -- uint -- + 24 | | // ------------------------------ + 25 | | uint256 _uint256 = 3; + 26 | | + 27 | | function setUint256(uint256 input) public { + 28 | | _uint256 = input; + 29 | | } + 30 | | + 31 | | function check_uint256() public { + 32 | | if (_uint256 % 2 == 0) { + 33 | | assert(false); + 34 | | } + 35 | | } + 36 | | + 37 | | function check_large_uint256() public { + 38 | | if (_uint256 == type(uint256).max) { + 39 | | assert(false); + 40 | | } + 41 | | } + 42 | | + 43 | | // ------------------------------ + 44 | | // -- int -- + 45 | | // ------------------------------ + 46 | | int256 _int256 = 3; + 47 | | + 48 | | function setInt256(int256 input) public { + 49 | | _int256 = input; + 50 | | } + 51 | | + 52 | | function check_int256() public { + 53 | | if (_int256 % 2 == 0) { + 54 | | assert(false); + 55 | | } + 56 | | } + 57 | | + 58 | | function check_large_positive_int256() public { + 59 | | if (_int256 == type(int256).max) { + 60 | | assert(false); + 61 | | } + 62 | | } + 63 | | + 64 | | function check_large_negative_int256() public { + 65 | | if (_int256 == type(int256).min) { + 66 | | assert(false); + 67 | | } + 68 | | } + 69 | | // ------------------------------ + 70 | | // -- address -- + 71 | | // ------------------------------ + 72 | | address providedAddress; + 73 | | + 74 | | function setAddress(address input) public { + 75 | | require(input != address(0)); + 76 | | providedAddress = input; + 77 | | } + 78 | | + 79 | | function check_address() public { + 80 | | if (providedAddress != address(0)) { + 81 | | assert(false); + 82 | | } + 83 | | } + 84 | | // ------------------------------ + 85 | | // -- string -- + 86 | | // ------------------------------ + 87 | | string providedString; + 88 | | + 89 | | function setString(string memory input) public { + 90 | | require(bytes(input).length > 20); + 91 | | providedString = input; + 92 | | } + 93 | | + 94 | | function check_string() public { + 95 | | if (bytes(providedString).length > 20) { + 96 | | assert(false); + 97 | | } + 98 | | } + 99 | | + 100 | | function check_specific_string(string memory provided) public { + 101 | | require(bytes(provided).length > 0); + 102 | | if (keccak256(bytes(provided)) == keccak256(bytes(hex"00"))) { + 103 | | assert(false); + 104 | | } + 105 | | } + 106 | | + 107 | | // ------------------------------ + 108 | | // -- bytes -- + 109 | | // ------------------------------ + 110 | | bytes providedBytes; + 111 | | bytes32 providedBytes32; + 112 | | + 113 | | // TODO bytes32, etc. + 114 | | function setBytes(bytes memory input) public { + 115 | | require(input.length > 20); + 116 | | providedBytes = input; + 117 | | } + 118 | | + 119 | | function check_bytes() public { + 120 | | if (providedBytes.length > 20) { + 121 | | assert(false); + 122 | | } + 123 | | } + 124 | | + 125 | | /// @notice bytes32 has decoding issues right now + 126 | | /* function setBytes32(bytes32 input) public { + 127 | | require(input != bytes32(0)); + 128 | | providedBytes32 = input; + 129 | | } + 130 | | + 131 | | function check_bytes32() public { + 132 | | if (providedBytes32 != bytes32(0)) { + 133 | | assert(false); + 134 | | } + 135 | | } */ + 136 | | + 137 | | // ------------------------------ + 138 | | // -- combination -- + 139 | | // ------------------------------ + 140 | | bool combBool; + 141 | | uint256 combUint256; + 142 | | int256 combInt256; + 143 | | address combAddress; + 144 | | string combString; + 145 | | bytes combBytes; + 146 | | + 147 | | function setCombination(bool bool_input, uint256 unsigned_input, int256 signed_input, address address_input, string memory str_input, bytes memory bytes_input) public { + 148 | | combBool = bool_input; + 149 | | combUint256 = unsigned_input; + 150 | | combInt256 = signed_input; + 151 | | combAddress = address_input; + 152 | | combString = str_input; + 153 | | combBytes = bytes_input; + 154 | | } + 155 | | + 156 | | function check_combined_input() public { + 157 | | if (combBool && combUint256 > 0 && combInt256 < 0 && combAddress != address(0) && bytes(combString).length > 0 && combBytes.length > 0) { + 158 | | assert(false); + 159 | | } + 160 | | } + 161 | | } + + +
+ +/Users/elvisskozdopolj/Documents/GitHub/test-generator/tests/test_data/src/DynamicArrays.sol + + 1 | | pragma solidity ^0.8.0; + 2 | | + 3 | | // Ran from test directory: echidna . --contract DynamicArrays --test-mode assertion --test-limit 100000 --corpus-dir echidna-corpora/corpus-dyn-arr --crytic-args "--foundry-ignore-compile" + 4 | | // Ran from test directory: test-generator ./src/DynamicArrays.sol --corpus-dir echidna-corpora/corpus-dyn-arr --contract "DynamicArrays" --test-directory "./test/" --inheritance-path "../src/" --fuzzer echidna + 5 | | contract DynamicArrays { + 6 | | + 7 | | // ------------------------------ + 8 | | // -- bool array -- + 9 | | // ------------------------------ + 10 | | bool[] boolDynArr; + 11 | | + 12 | | function addBoolArr(bool[] memory input) public { + 13 | | for(uint256 i; i < input.length; i++) { + 14 | | boolDynArr.push(input[i]); + 15 | | } + 16 | | } + 17 | | + 18 | | function check_boolArr() public { + 19 | | uint256 count; + 20 | | for(uint256 i; i < boolDynArr.length; i++) { + 21 | | if (boolDynArr[i]) { + 22 | | count++; + 23 | | } + 24 | | } + 25 | | + 26 | | if (count > 3) { + 27 | | assert(false); + 28 | | } + 29 | | } + 30 | | // ------------------------------ + 31 | | // -- uint array -- + 32 | | // ------------------------------ + 33 | | uint256[] uintDynArr; + 34 | | + 35 | | function addUintArr(uint256[] memory input) public { + 36 | | for (uint256 i; i < input.length; i++) { + 37 | | uintDynArr.push(input[i]); + 38 | | } + 39 | | } + 40 | | + 41 | | function check_uintDynArr() public { + 42 | | uint256 sum; + 43 | | for(uint256 i; i < uintDynArr.length; i++) { + 44 | | sum += uintDynArr[i]; + 45 | | } + 46 | | + 47 | | if (sum != 0 && sum % 3 == 0) { + 48 | | assert(false); + 49 | | } + 50 | | } + 51 | | + 52 | | // ------------------------------ + 53 | | // -- int array -- + 54 | | // ------------------------------ + 55 | | int256[] intDynArr; + 56 | | + 57 | | function addIntArr(int256[] memory input) public { + 58 | | for (uint256 i; i < input.length; i++) { + 59 | | intDynArr.push(input[i]); + 60 | | } + 61 | | } + 62 | | + 63 | | function check_intDynArr() public { + 64 | | int256 sum; + 65 | | for(uint256 i; i < intDynArr.length; i++) { + 66 | | sum += intDynArr[i]; + 67 | | } + 68 | | + 69 | | if (sum != 0 && sum % 3 == 0) { + 70 | | assert(false); + 71 | | } + 72 | | } + 73 | | + 74 | | // ------------------------------ + 75 | | // -- address array -- + 76 | | // ------------------------------ + 77 | | address[] addressDynArr; + 78 | | + 79 | | function addAddressArr(address[] memory input) public { + 80 | | for(uint256 i; i < input.length; i++) { + 81 | | addressDynArr.push(input[i]); + 82 | | } + 83 | | } + 84 | | + 85 | | function check_addressDynArr() public { + 86 | | uint256 count = 0; + 87 | | // At least 3 should be non-zero + 88 | | for(uint256 i; i < addressDynArr.length; i++) { + 89 | | if(addressDynArr[i] != address(0)) { + 90 | | count++; + 91 | | } + 92 | | } + 93 | | + 94 | | if (count > 3) { + 95 | | assert(false); + 96 | | } + 97 | | } + 98 | | // ------------------------------ + 99 | | // -- string array -- + 100 | | // ------------------------------ + 101 | | string[] strDynArr; + 102 | | + 103 | | function addStrArr(string[] memory input) public { + 104 | | for(uint256 i; i < input.length; i++) { + 105 | | strDynArr.push(input[i]); + 106 | | } + 107 | | } + 108 | | + 109 | | function check_strDynArr() public { + 110 | | uint256 count; + 111 | | for(uint256 i; i < strDynArr.length; i++) { + 112 | | if (bytes(strDynArr[i]).length > 0) { + 113 | | count++; + 114 | | } + 115 | | } + 116 | | if (count > 3) { + 117 | | assert(false); + 118 | | } + 119 | | } + 120 | | + 121 | | // ------------------------------ + 122 | | // -- bytes array -- + 123 | | // ------------------------------ + 124 | | bytes[] bytesDynArr; + 125 | | + 126 | | function addBytesArr(bytes[] memory input) public { + 127 | | for(uint256 i; i < input.length; i++) { + 128 | | bytesDynArr.push(input[i]); + 129 | | } + 130 | | } + 131 | | + 132 | | function check_bytesArr() public { + 133 | | uint256 count; + 134 | | for(uint256 i; i < bytesDynArr.length; i++) { + 135 | | if(bytesDynArr[i].length > 0) { + 136 | | count++; + 137 | | } + 138 | | } + 139 | | + 140 | | if (count > 3) { + 141 | | assert(false); + 142 | | } + 143 | | } + 144 | | } + + +
+ +/Users/elvisskozdopolj/Documents/GitHub/test-generator/tests/test_data/src/FixedArrays.sol + + 1 | | pragma solidity ^0.8.0; + 2 | | + 3 | | // Ran from test directory: echidna . --contract FixedArrays --test-mode assertion --test-limit 100000 --corpus-dir echidna-corpora/corpus-fixed-arr --crytic-args "--foundry-ignore-compile" + 4 | | // Ran from test directory: test-generator ./src/FixedArrays.sol --corpus-dir echidna-corpora/corpus-fixed-arr --contract "FixedArrays" --test-directory "./test/" --inheritance-path "../src/" --fuzzer echidna + 5 | | contract FixedArrays { + 6 | | + 7 | | // ------------------------------ + 8 | | // -- bool array -- + 9 | | // ------------------------------ + 10 | | bool[3] boolArr; + 11 | | + 12 | | function addBoolArr(bool[3] memory input) public { + 13 | | for(uint256 i; i < boolArr.length; i++) { + 14 | | boolArr[i] = input[i]; + 15 | | } + 16 | | } + 17 | | + 18 | | function check_boolArr() public { + 19 | | if (boolArr[0] && !boolArr[1] && boolArr[2]) { + 20 | | assert(false); + 21 | | } + 22 | | } + 23 | | // ------------------------------ + 24 | | // -- uint array -- + 25 | | // ------------------------------ + 26 | | uint256[2] uintArr; + 27 | | + 28 | | function addUintArr(uint256[2] memory input) public { + 29 | | for(uint256 i; i < uintArr.length; i++) { + 30 | | uintArr[i] = input[i]; + 31 | | } + 32 | | } + 33 | | + 34 | | function check_uintArr() public { + 35 | | uint256 sum; + 36 | | for(uint256 i; i < uintArr.length; i++) { + 37 | | sum += uintArr[i]; + 38 | | } + 39 | | if (sum == 5) { + 40 | | assert(false); + 41 | | } + 42 | | } + 43 | | // ------------------------------ + 44 | | // -- int array -- + 45 | | // ------------------------------ + 46 | | int256[2] intArr; + 47 | | + 48 | | function addIntArr(int256[2] memory input) public { + 49 | | for(uint256 i; i < intArr.length; i++) { + 50 | | intArr[i] = input[i]; + 51 | | } + 52 | | } + 53 | | + 54 | | function check_intArr() public { + 55 | | int256 sum; + 56 | | for(uint256 i; i < intArr.length; i++) { + 57 | | sum += intArr[i]; + 58 | | } + 59 | | if (sum == 5) { + 60 | | assert(false); + 61 | | } + 62 | | } + 63 | | + 64 | | // ------------------------------ + 65 | | // -- address array -- + 66 | | // ------------------------------ + 67 | | address[4] addressArr; + 68 | | + 69 | | function addAddressArr(address[4] memory input) public { + 70 | | for(uint256 i; i < addressArr.length; i++) { + 71 | | addressArr[i] = input[i]; + 72 | | } + 73 | | } + 74 | | + 75 | | function check_addressArr() public { + 76 | | uint256 count = 1; + 77 | | // At least 3 should be non-zero + 78 | | for(uint256 i; i < addressArr.length; i++) { + 79 | | if(addressArr[i] != address(0)) { + 80 | | count++; + 81 | | } + 82 | | } + 83 | | + 84 | | if (count == addressArr.length) { + 85 | | assert(false); + 86 | | } + 87 | | } + 88 | | // ------------------------------ + 89 | | // -- string array -- + 90 | | // ------------------------------ + 91 | | string[2] strArr; + 92 | | + 93 | | function addStrArr(string[2] memory input) public { + 94 | | for(uint256 i; i < strArr.length; i++) { + 95 | | strArr[i] = input[i]; + 96 | | } + 97 | | } + 98 | | + 99 | | function check_strArr() public { + 100 | | if (bytes(strArr[0]).length > 0 && bytes(strArr[1]).length > 0) { + 101 | | assert(false); + 102 | | } + 103 | | } + 104 | | // ------------------------------ + 105 | | // -- bytes array -- + 106 | | // ------------------------------ + 107 | | bytes[2] bytesArr; + 108 | | + 109 | | function addBytesArr(bytes[2] memory input) public { + 110 | | for(uint256 i; i < bytesArr.length; i++) { + 111 | | bytesArr[i] = input[i]; + 112 | | } + 113 | | } + 114 | | + 115 | | function check_bytesArr() public { + 116 | | if (bytesArr[0].length > 0 && bytesArr[1].length > 0) { + 117 | | assert(false); + 118 | | } + 119 | | } + 120 | | } + + +
+ +/Users/elvisskozdopolj/Documents/GitHub/test-generator/tests/test_data/src/IStruct.sol + + 1 | | interface IStruct { + 2 | | struct Inherited { + 3 | | uint256 uintType; + 4 | | bool boolType; + 5 | | } + 6 | | } + + +
+ +/Users/elvisskozdopolj/Documents/GitHub/test-generator/tests/test_data/src/MultiDimensionalDynamicArrays.sol + + 1 | | pragma solidity ^0.8.0; + 2 | | + 3 | | // Ran from test directory: echidna . --contract MultiDimensionalDynamicArrays --test-mode assertion --test-limit 100000 --corpus-dir echidna-corpora/corpus-multi-dyn-arr --crytic-args "--foundry-ignore-compile" + 4 | | // Ran from test directory: test-generator ./src/MultiDimensionalDynamicArrays.sol --corpus-dir echidna-corpora/corpus-multi-dyn-arr --contract "MultiDimensionalDynamicArrays" --test-directory "./test/" --inheritance-path "../src/" --fuzzer echidna + 5 | | contract MultiDimensionalDynamicArrays { + 6 | | // ----- 2-dimensional arrays ------ + 7 | | + 8 | | // ------------------------------ + 9 | | // -- bool array -- + 10 | | // ------------------------------ + 11 | | bool[][] boolArr; + 12 | | + 13 | | function addBoolArr(bool[][] memory input) public { + 14 | | for (uint256 i; i < input.length; i++) { + 15 | | boolArr[i] = input[i]; + 16 | | } + 17 | | } + 18 | | + 19 | | function check_boolArr() public { + 20 | | uint256 count; + 21 | | for (uint256 i; i < boolArr.length; i++) { + 22 | | for (uint256 j; j < boolArr[i].length; i++) { + 23 | | if (boolArr[i][j]) { + 24 | | count++; + 25 | | } + 26 | | } + 27 | | } + 28 | | + 29 | | if (count > 3) { + 30 | | assert(false); + 31 | | } + 32 | | } + 33 | | + 34 | | // ------------------------------ + 35 | | // -- uint array -- + 36 | | // ------------------------------ + 37 | | uint256[][] uintArr; + 38 | | + 39 | | function addUintArr(uint256[][] memory input) public { + 40 | | for (uint256 i; i < input.length; i++) { + 41 | | uintArr[i] = input[i]; + 42 | | } + 43 | | } + 44 | | + 45 | | function check_uintArr() public { + 46 | | uint256 sum; + 47 | | for (uint256 i; i < uintArr.length; i++) { + 48 | | for (uint256 j; i < uintArr[i].length; i++) { + 49 | | sum += uintArr[i][j]; + 50 | | } + 51 | | } + 52 | | if (sum > 10) { + 53 | | assert(false); + 54 | | } + 55 | | } + 56 | | + 57 | | // ------------------------------ + 58 | | // -- int array -- + 59 | | // ------------------------------ + 60 | | int256[][] intArr; + 61 | | + 62 | | function addIntArr(int256[][] memory input) public { + 63 | | for (uint256 i; i < input.length; i++) { + 64 | | intArr[i] = input[i]; + 65 | | } + 66 | | } + 67 | | + 68 | | function check_intArr() public { + 69 | | int256 sum; + 70 | | for (uint256 i; i < intArr.length; i++) { + 71 | | for (uint256 j; j < intArr[i].length; i++) { + 72 | | sum += intArr[i][j]; + 73 | | } + 74 | | } + 75 | | if (sum == 5) { + 76 | | assert(false); + 77 | | } + 78 | | } + 79 | | + 80 | | // ------------------------------ + 81 | | // -- address array -- + 82 | | // ------------------------------ + 83 | | address[][] addressArr; + 84 | | + 85 | | function addAddressArr(address[][] memory input) public { + 86 | | for (uint256 i; i < input.length; i++) { + 87 | | addressArr[i] = input[i]; + 88 | | } + 89 | | } + 90 | | + 91 | | function check_addressArr() public { + 92 | | uint256 count = 1; + 93 | | // At least 3 should be non-zero + 94 | | for (uint256 i; i < addressArr.length; i++) { + 95 | | for (uint256 j; j < addressArr[i].length; i++) { + 96 | | if (addressArr[i][j] != address(0)) { + 97 | | count++; + 98 | | } + 99 | | } + 100 | | } + 101 | | + 102 | | if (count > addressArr.length) { + 103 | | assert(false); + 104 | | } + 105 | | } + 106 | | + 107 | | // ------------------------------ + 108 | | // -- string array -- + 109 | | // ------------------------------ + 110 | | string[][] strArr; + 111 | | + 112 | | function addStrArr(string[][] memory input) public { + 113 | | for (uint256 i; i < input.length; i++) { + 114 | | strArr[i] = input[i]; + 115 | | } + 116 | | } + 117 | | + 118 | | function check_strArr() public { + 119 | | uint256 count; + 120 | | for (uint256 i; i < strArr.length; i++) { + 121 | | for (uint256 j; j < strArr[i].length; j++) { + 122 | | if (bytes(strArr[i][j]).length > 0) { + 123 | | count++; + 124 | | } + 125 | | } + 126 | | } + 127 | | if (count == 2) { + 128 | | assert(false); + 129 | | } + 130 | | } + 131 | | + 132 | | // ------------------------------ + 133 | | // -- bytes array -- + 134 | | // ------------------------------ + 135 | | bytes[][] bytesArr; + 136 | | + 137 | | function addBytesArr(bytes[][] memory input) public { + 138 | | for (uint256 i; i < input.length; i++) { + 139 | | bytesArr[i] = input[i]; + 140 | | } + 141 | | } + 142 | | + 143 | | function check_bytesArr() public { + 144 | | uint256 count; + 145 | | for (uint256 i; i < bytesArr.length; i++) { + 146 | | for (uint256 j; j < bytesArr[i].length; j++) { + 147 | | if (bytesArr[i][j].length > 0) { + 148 | | count++; + 149 | | } + 150 | | } + 151 | | } + 152 | | + 153 | | if (count == 4) { + 154 | | assert(false); + 155 | | } + 156 | | } + 157 | | } + 158 | | + + +
+ +/Users/elvisskozdopolj/Documents/GitHub/test-generator/tests/test_data/src/MultiDimensionalFixedArrays.sol + + 1 | | pragma solidity ^0.8.0; + 2 | | + 3 | | // Ran from test directory: echidna . --contract MultiDimensionalFixedArrays --test-mode assertion --test-limit 100000 --corpus-dir echidna-corpora/corpus-multi-fixed-arr --crytic-args "--foundry-ignore-compile" + 4 | | // Ran from test directory: test-generator ./src/MultiDimensionalFixedArrays.sol --corpus-dir echidna-corpora/corpus-multi-fixed-arr --contract "MultiDimensionalFixedArrays" --test-directory "./test/" --inheritance-path "../src/" --fuzzer echidna + 5 | | contract MultiDimensionalFixedArrays { + 6 | | /* ----- 2-dimensional arrays */ + 7 | | + 8 | | // ------------------------------ + 9 | | // -- bool array -- + 10 | | // ------------------------------ + 11 | | bool[3][2] boolArr; + 12 | | + 13 | | function addBoolArr(bool[3][2] memory input) public { + 14 | | for (uint256 i; i < boolArr.length; i++) { + 15 | | boolArr[i] = input[i]; + 16 | | } + 17 | | } + 18 | | + 19 | | function check_boolArr() public { + 20 | | uint256 count; + 21 | | for (uint256 i; i < boolArr.length; i++) { + 22 | | for (uint256 j; j < boolArr[i].length; i++) { + 23 | | if (boolArr[i][j]) { + 24 | | count++; + 25 | | } + 26 | | } + 27 | | } + 28 | | + 29 | | if (count > 3) { + 30 | | assert(false); + 31 | | } + 32 | | } + 33 | | + 34 | | // ------------------------------ + 35 | | // -- uint array -- + 36 | | // ------------------------------ + 37 | | uint256[2][3] uintArr; + 38 | | + 39 | | function addUintArr(uint256[2][3] memory input) public { + 40 | | for (uint256 i; i < uintArr.length; i++) { + 41 | | uintArr[i] = input[i]; + 42 | | } + 43 | | } + 44 | | + 45 | | function check_uintArr() public { + 46 | | uint256 sum; + 47 | | for (uint256 i; i < uintArr.length; i++) { + 48 | | for (uint256 j; i < uintArr[i].length; i++) { + 49 | | sum += uintArr[i][j]; + 50 | | } + 51 | | } + 52 | | if (sum > 10) { + 53 | | assert(false); + 54 | | } + 55 | | } + 56 | | + 57 | | // ------------------------------ + 58 | | // -- int array -- + 59 | | // ------------------------------ + 60 | | int256[2][1] intArr; + 61 | | + 62 | | function addIntArr(int256[2][1] memory input) public { + 63 | | for (uint256 i; i < intArr.length; i++) { + 64 | | intArr[i] = input[i]; + 65 | | } + 66 | | } + 67 | | + 68 | | function check_intArr() public { + 69 | | int256 sum; + 70 | | for (uint256 i; i < intArr.length; i++) { + 71 | | for (uint256 j; j < intArr[i].length; i++) { + 72 | | sum += intArr[i][j]; + 73 | | } + 74 | | } + 75 | | if (sum == 5) { + 76 | | assert(false); + 77 | | } + 78 | | } + 79 | | + 80 | | // ------------------------------ + 81 | | // -- address array -- + 82 | | // ------------------------------ + 83 | | address[4][2] addressArr; + 84 | | + 85 | | function addAddressArr(address[4][2] memory input) public { + 86 | | for (uint256 i; i < addressArr.length; i++) { + 87 | | addressArr[i] = input[i]; + 88 | | } + 89 | | } + 90 | | + 91 | | function check_addressArr() public { + 92 | | uint256 count = 1; + 93 | | // At least 3 should be non-zero + 94 | | for (uint256 i; i < addressArr.length; i++) { + 95 | | for (uint256 j; j < addressArr[i].length; i++) { + 96 | | if (addressArr[i][j] != address(0)) { + 97 | | count++; + 98 | | } + 99 | | } + 100 | | } + 101 | | + 102 | | if (count > addressArr.length) { + 103 | | assert(false); + 104 | | } + 105 | | } + 106 | | + 107 | | // ------------------------------ + 108 | | // -- string array -- + 109 | | // ------------------------------ + 110 | | string[2][1] strArr; + 111 | | + 112 | | function addStrArr(string[2][1] memory input) public { + 113 | | for (uint256 i; i < strArr.length; i++) { + 114 | | strArr[i] = input[i]; + 115 | | } + 116 | | } + 117 | | + 118 | | function check_strArr() public { + 119 | | uint256 count; + 120 | | for (uint256 i; i < strArr.length; i++) { + 121 | | for (uint256 j; j < strArr[i].length; j++) { + 122 | | if (bytes(strArr[i][j]).length > 0) { + 123 | | count++; + 124 | | } + 125 | | } + 126 | | } + 127 | | if (count == 2) { + 128 | | assert(false); + 129 | | } + 130 | | } + 131 | | + 132 | | // ------------------------------ + 133 | | // -- bytes array -- + 134 | | // ------------------------------ + 135 | | bytes[2][2] bytesArr; + 136 | | + 137 | | function addBytesArr(bytes[2][2] memory input) public { + 138 | | for (uint256 i; i < bytesArr.length; i++) { + 139 | | bytesArr[i] = input[i]; + 140 | | } + 141 | | } + 142 | | + 143 | | function check_bytesArr() public { + 144 | | uint256 count; + 145 | | for (uint256 i; i < bytesArr.length; i++) { + 146 | | for (uint256 j; j < bytesArr[i].length; j++) { + 147 | | if (bytesArr[i][j].length > 0) { + 148 | | count++; + 149 | | } + 150 | | } + 151 | | } + 152 | | + 153 | | if (count == 4) { + 154 | | assert(false); + 155 | | } + 156 | | } + 157 | | } + 158 | | + + +
+ +/Users/elvisskozdopolj/Documents/GitHub/test-generator/tests/test_data/src/TimeAdvancement.sol + + 1 | | pragma solidity ^0.8.0; + 2 | | + 3 | | // Ran from test directory: echidna . --contract TimeAdvancement --test-mode assertion --test-limit 10000 --corpus-dir echidna-corpora/corpus-time --crytic-args "--foundry-ignore-compile" + 4 | | // Ran from test directory: test-generator ./src/TupleTypes.sol --corpus-dir echidna-corpora/corpus-struct --contract "TupleTypes" --test-directory "./test/" --inheritance-path "../src/" --fuzzer echidna + 5 | | + 6 | | contract TimeAdvancement { + 7 | | bool timeSet; + 8 | | bool blockSet; + 9 | | uint256 timestamp; + 10 | | uint256 blockNumber; + 11 | | + 12 | | // ------------------------------ + 13 | | // -- timestamp -- + 14 | | // ------------------------------ + 15 | | + 16 | | function setTimestamp() public { + 17 | | timeSet = true; + 18 | | timestamp = block.timestamp; + 19 | | } + 20 | | + 21 | | function check_timestamp() public { + 22 | | if (timeSet) { + 23 | | assert(block.timestamp <= timestamp); + 24 | | } + 25 | | } + 26 | | // ------------------------------ + 27 | | // -- block number -- + 28 | | // ------------------------------ + 29 | | + 30 | | function setBlock() public { + 31 | | blockSet = true; + 32 | | blockNumber = block.number; + 33 | | } + 34 | | + 35 | | function check_block() public { + 36 | | if (blockSet) { + 37 | | assert(block.number <= blockNumber); + 38 | | } + 39 | | } + 40 | | + 41 | | // ------------------------------ + 42 | | // -- both -- + 43 | | // ------------------------------ + 44 | | + 45 | | function check_time_and_block() public { + 46 | | if (blockSet && timeSet) { + 47 | | assert(block.timestamp <= timestamp || block.number <= blockNumber); + 48 | | } + 49 | | } + 50 | | + 51 | | } + + +
+ +/Users/elvisskozdopolj/Documents/GitHub/test-generator/tests/test_data/src/TupleTypes.sol + + 1 | | pragma solidity ^0.8.0; + 2 | | + 3 | | import "./IStruct.sol"; + 4 | | + 5 | | // Ran from test directory: echidna . --contract TupleTypes --test-mode assertion --test-limit 100000 --corpus-dir echidna-corpora/corpus-struct --crytic-args "--foundry-ignore-compile" + 6 | | // Ran from test directory: test-generator ./src/TupleTypes.sol --corpus-dir echidna-corpora/corpus-struct --contract "TupleTypes" --test-directory "./test/" --inheritance-path "../src/" --fuzzer echidna + 7 | | contract TupleTypes { + 8 | | struct ElementaryStruct { + 9 | | uint256 uintType; + 10 | | int256 intType; + 11 | | string stringType; + 12 | | bool boolType; + 13 | | } + 14 | | + 15 | | struct NestedStruct { + 16 | | ElementaryStruct structType; + 17 | | uint256 uintType; + 18 | | } + 19 | | + 20 | | struct FixedArrayStruct { + 21 | | uint256[2] fixedSized; + 22 | | } + 23 | | + 24 | | struct DynamicArrayStruct { + 25 | | uint256[] dynSized; + 26 | | } + 27 | | + 28 | | enum Enumerable { + 29 | | ZERO, + 30 | | ONE, + 31 | | TWO + 32 | | } + 33 | | + 34 | | ElementaryStruct testStruct; + 35 | | NestedStruct nestedStruct; + 36 | | FixedArrayStruct fixedArrayStruct; + 37 | | DynamicArrayStruct dynArrayStruct; + 38 | | Enumerable testEnum; + 39 | | IStruct.Inherited inheritedStruct; + 40 | | + 41 | | // ------------------------------------ + 42 | | // -- Elementary struct -- + 43 | | // ------------------------------------ + 44 | | + 45 | | function updateElementaryStruct(ElementaryStruct memory input) public { + 46 | | testStruct = input; + 47 | | } + 48 | | + 49 | | function check_elementaryStruct() public { + 50 | | ElementaryStruct memory test = testStruct; + 51 | | if ( + 52 | | test.uintType > 0 && + 53 | | test.intType < 0 && + 54 | | bytes(test.stringType).length > 0 && + 55 | | test.boolType + 56 | | ) { + 57 | | assert(false); + 58 | | } + 59 | | } + 60 | | + 61 | | // ------------------------------------ + 62 | | // -- Nested struct -- + 63 | | // ------------------------------------ + 64 | | function updateNestedStruct(NestedStruct memory input) public { + 65 | | nestedStruct = input; + 66 | | } + 67 | | + 68 | | function check_nestedStruct() public { + 69 | | NestedStruct memory test = nestedStruct; + 70 | | if ( + 71 | | test.structType.boolType && + 72 | | test.structType.intType < 0 && + 73 | | bytes(test.structType.stringType).length > 0 && + 74 | | test.structType.uintType > 0 && + 75 | | test.uintType > 0 + 76 | | ) { + 77 | | assert(false); + 78 | | } + 79 | | } + 80 | | + 81 | | // ------------------------------------ + 82 | | // -- Fixed Arr struct -- + 83 | | // ------------------------------------ + 84 | | function updateFixedArrStruct(FixedArrayStruct memory input) public { + 85 | | fixedArrayStruct = input; + 86 | | } + 87 | | + 88 | | function check_fixedArrStruct() public { + 89 | | FixedArrayStruct memory test = fixedArrayStruct; + 90 | | uint256 count; + 91 | | for (uint256 i; i < test.fixedSized.length; i++) { + 92 | | if (test.fixedSized[i] > 0) { + 93 | | count++; + 94 | | } + 95 | | } + 96 | | + 97 | | if (count > 0) { + 98 | | assert(false); + 99 | | } + 100 | | } + 101 | | + 102 | | // ------------------------------------ + 103 | | // -- Dyn Arr struct -- + 104 | | // ------------------------------------ + 105 | | function updateDynArrStruct(DynamicArrayStruct memory input) public { + 106 | | dynArrayStruct = input; + 107 | | } + 108 | | + 109 | | function check_dynamicArrStruct() public { + 110 | | DynamicArrayStruct memory test = dynArrayStruct; + 111 | | uint256 count; + 112 | | for (uint256 i; i < test.dynSized.length; i++) { + 113 | | if (test.dynSized[i] > 0) { + 114 | | count++; + 115 | | } + 116 | | } + 117 | | + 118 | | if (count > 0) { + 119 | | assert(false); + 120 | | } + 121 | | } + 122 | | + 123 | | // ------------------------------------ + 124 | | // -- Enum -- + 125 | | // ------------------------------------ + 126 | | + 127 | | function updateEnum(Enumerable input) public { + 128 | | testEnum = input; + 129 | | } + 130 | | + 131 | | function check_enum() public { + 132 | | if (testEnum == Enumerable.TWO) { + 133 | | assert(false); + 134 | | } + 135 | | } + 136 | | + 137 | | // ------------------------------------ + 138 | | // -- Inherited struct -- + 139 | | // ------------------------------------ + 140 | | function updateInheritedStruct(IStruct.Inherited memory input) public { + 141 | | inheritedStruct = input; + 142 | | } + 143 | | + 144 | | function check_inheritedStruct() public { + 145 | | IStruct.Inherited memory test = inheritedStruct; + 146 | | if ( + 147 | | test.uintType > 0 && + 148 | | test.boolType + 149 | | ) { + 150 | | assert(false); + 151 | | } + 152 | | } + 153 | | } + 154 | | + + +
+ +/Users/elvisskozdopolj/Documents/GitHub/test-generator/tests/test_data/src/ValueTransfer.sol + + 1 | | pragma solidity ^0.8.0; + 2 | | + 3 | | // Ran from tests/test_data/ directory: echidna . --contract ValueTransfer --test-mode assertion --test-limit 1000000 --corpus-dir echidna-corpora/corpus-value + 4 | | // Ran from tests/test_data/ directory: test-generator ./src/ValueTransfer.sol --corpus-dir echidna-corpora/corpus-value --contract "ValueTransfer" --test-directory "./test/" --inheritance-path "../src/" --fuzzer echidna + 5 | * | contract ValueTransfer { + 6 | | + 7 | *r | function check_balance() public { + 8 | * | if (address(this).balance > 0) { + 9 | * | assert(false); + 10 | | } + 11 | | } + 12 | | + 13 | | fallback() external payable { + 14 | | // Just receive Ether + 15 | | } + 16 | | } + + +
+ diff --git a/tests/test_data/echidna-corpora/corpus-value/covered.1707213004.lcov b/tests/test_data/echidna-corpora/corpus-value/covered.1707213004.lcov new file mode 100644 index 0000000..00efe4d --- /dev/null +++ b/tests/test_data/echidna-corpora/corpus-value/covered.1707213004.lcov @@ -0,0 +1,384 @@ +TN: +SF:/Users/elvisskozdopolj/Documents/GitHub/test-generator/tests/test_data/src/BasicTypes.sol +DA:1,0 +DA:5,0 +DA:12,0 +DA:13,0 +DA:16,0 +DA:17,0 +DA:18,0 +DA:25,0 +DA:27,0 +DA:28,0 +DA:31,0 +DA:32,0 +DA:37,0 +DA:38,0 +DA:39,0 +DA:46,0 +DA:48,0 +DA:49,0 +DA:52,0 +DA:53,0 +DA:54,0 +DA:58,0 +DA:59,0 +DA:60,0 +DA:64,0 +DA:65,0 +DA:66,0 +DA:74,0 +DA:75,0 +DA:76,0 +DA:79,0 +DA:80,0 +DA:81,0 +DA:89,0 +DA:90,0 +DA:91,0 +DA:94,0 +DA:95,0 +DA:100,0 +DA:101,0 +DA:102,0 +DA:103,0 +DA:114,0 +DA:115,0 +DA:116,0 +DA:119,0 +DA:120,0 +DA:147,0 +DA:148,0 +DA:149,0 +DA:150,0 +DA:151,0 +DA:152,0 +DA:153,0 +DA:156,0 +DA:157,0 +DA:158,0 +end_of_record + +SF:/Users/elvisskozdopolj/Documents/GitHub/test-generator/tests/test_data/src/DynamicArrays.sol +DA:5,0 +DA:12,0 +DA:13,0 +DA:14,0 +DA:18,0 +DA:19,0 +DA:20,0 +DA:21,0 +DA:22,0 +DA:35,0 +DA:36,0 +DA:37,0 +DA:41,0 +DA:42,0 +DA:43,0 +DA:44,0 +DA:47,0 +DA:57,0 +DA:58,0 +DA:59,0 +DA:63,0 +DA:64,0 +DA:65,0 +DA:66,0 +DA:69,0 +DA:70,0 +DA:79,0 +DA:80,0 +DA:81,0 +DA:85,0 +DA:86,0 +DA:88,0 +DA:89,0 +DA:90,0 +DA:103,0 +DA:104,0 +DA:105,0 +DA:109,0 +DA:110,0 +DA:111,0 +DA:112,0 +DA:113,0 +DA:116,0 +DA:117,0 +DA:126,0 +DA:127,0 +DA:128,0 +DA:132,0 +DA:133,0 +DA:134,0 +DA:135,0 +DA:136,0 +end_of_record + +SF:/Users/elvisskozdopolj/Documents/GitHub/test-generator/tests/test_data/src/FixedArrays.sol +DA:5,0 +DA:12,0 +DA:13,0 +DA:14,0 +DA:18,0 +DA:19,0 +DA:20,0 +DA:28,0 +DA:29,0 +DA:30,0 +DA:34,0 +DA:35,0 +DA:36,0 +DA:37,0 +DA:48,0 +DA:49,0 +DA:50,0 +DA:54,0 +DA:55,0 +DA:56,0 +DA:57,0 +DA:59,0 +DA:60,0 +DA:69,0 +DA:70,0 +DA:71,0 +DA:75,0 +DA:76,0 +DA:78,0 +DA:79,0 +DA:80,0 +DA:84,0 +DA:85,0 +DA:93,0 +DA:94,0 +DA:95,0 +DA:99,0 +DA:100,0 +DA:101,0 +DA:109,0 +DA:110,0 +DA:111,0 +DA:115,0 +DA:116,0 +end_of_record + +SF:/Users/elvisskozdopolj/Documents/GitHub/test-generator/tests/test_data/src/IStruct.sol +end_of_record + +SF:/Users/elvisskozdopolj/Documents/GitHub/test-generator/tests/test_data/src/MultiDimensionalDynamicArrays.sol +DA:5,0 +DA:13,0 +DA:14,0 +DA:15,0 +DA:19,0 +DA:20,0 +DA:21,0 +DA:22,0 +DA:23,0 +DA:24,0 +DA:29,0 +DA:30,0 +DA:39,0 +DA:40,0 +DA:41,0 +DA:45,0 +DA:46,0 +DA:47,0 +DA:48,0 +DA:49,0 +DA:52,0 +DA:53,0 +DA:62,0 +DA:63,0 +DA:64,0 +DA:68,0 +DA:69,0 +DA:70,0 +DA:71,0 +DA:72,0 +DA:75,0 +DA:76,0 +DA:85,0 +DA:86,0 +DA:87,0 +DA:91,0 +DA:92,0 +DA:94,0 +DA:95,0 +DA:96,0 +DA:97,0 +DA:102,0 +DA:103,0 +DA:112,0 +DA:113,0 +DA:114,0 +DA:118,0 +DA:119,0 +DA:120,0 +DA:121,0 +DA:122,0 +DA:123,0 +DA:127,0 +DA:128,0 +DA:137,0 +DA:138,0 +DA:139,0 +DA:143,0 +DA:144,0 +DA:145,0 +DA:146,0 +DA:147,0 +DA:148,0 +DA:153,0 +DA:154,0 +end_of_record + +SF:/Users/elvisskozdopolj/Documents/GitHub/test-generator/tests/test_data/src/MultiDimensionalFixedArrays.sol +DA:5,0 +DA:13,0 +DA:14,0 +DA:15,0 +DA:19,0 +DA:20,0 +DA:21,0 +DA:22,0 +DA:23,0 +DA:24,0 +DA:29,0 +DA:30,0 +DA:39,0 +DA:40,0 +DA:41,0 +DA:45,0 +DA:46,0 +DA:47,0 +DA:48,0 +DA:49,0 +DA:52,0 +DA:53,0 +DA:62,0 +DA:63,0 +DA:64,0 +DA:68,0 +DA:69,0 +DA:70,0 +DA:71,0 +DA:72,0 +DA:75,0 +DA:76,0 +DA:85,0 +DA:86,0 +DA:87,0 +DA:91,0 +DA:92,0 +DA:94,0 +DA:95,0 +DA:96,0 +DA:97,0 +DA:102,0 +DA:103,0 +DA:112,0 +DA:113,0 +DA:114,0 +DA:118,0 +DA:119,0 +DA:120,0 +DA:121,0 +DA:122,0 +DA:123,0 +DA:127,0 +DA:128,0 +DA:137,0 +DA:138,0 +DA:139,0 +DA:143,0 +DA:144,0 +DA:145,0 +DA:146,0 +DA:147,0 +DA:148,0 +DA:153,0 +DA:154,0 +end_of_record + +SF:/Users/elvisskozdopolj/Documents/GitHub/test-generator/tests/test_data/src/TimeAdvancement.sol +DA:6,0 +DA:16,0 +DA:17,0 +DA:18,0 +DA:21,0 +DA:22,0 +DA:23,0 +DA:30,0 +DA:31,0 +DA:32,0 +DA:35,0 +DA:36,0 +DA:37,0 +DA:45,0 +DA:46,0 +DA:47,0 +end_of_record + +SF:/Users/elvisskozdopolj/Documents/GitHub/test-generator/tests/test_data/src/TupleTypes.sol +DA:7,0 +DA:45,0 +DA:46,0 +DA:49,0 +DA:50,0 +DA:51,0 +DA:52,0 +DA:53,0 +DA:54,0 +DA:55,0 +DA:57,0 +DA:64,0 +DA:65,0 +DA:68,0 +DA:69,0 +DA:70,0 +DA:71,0 +DA:72,0 +DA:73,0 +DA:74,0 +DA:75,0 +DA:77,0 +DA:84,0 +DA:85,0 +DA:88,0 +DA:89,0 +DA:90,0 +DA:91,0 +DA:92,0 +DA:93,0 +DA:105,0 +DA:106,0 +DA:109,0 +DA:110,0 +DA:111,0 +DA:112,0 +DA:113,0 +DA:114,0 +DA:118,0 +DA:119,0 +DA:127,0 +DA:128,0 +DA:131,0 +DA:132,0 +DA:133,0 +DA:140,0 +DA:141,0 +DA:144,0 +DA:145,0 +DA:146,0 +DA:147,0 +DA:148,0 +DA:150,0 +end_of_record + +SF:/Users/elvisskozdopolj/Documents/GitHub/test-generator/tests/test_data/src/ValueTransfer.sol +DA:5,19 +DA:7,14 +DA:8,4 +DA:9,4 +end_of_record + diff --git a/tests/test_data/echidna-corpora/corpus-value/covered.1707213004.txt b/tests/test_data/echidna-corpora/corpus-value/covered.1707213004.txt new file mode 100644 index 0000000..5168689 --- /dev/null +++ b/tests/test_data/echidna-corpora/corpus-value/covered.1707213004.txt @@ -0,0 +1,986 @@ +/Users/elvisskozdopolj/Documents/GitHub/test-generator/tests/test_data/src/BasicTypes.sol + 1 | | pragma solidity ^0.8.0; + 2 | | + 3 | | // Ran from test directory: echidna . --contract BasicTypes --test-mode assertion --test-limit 100000 --corpus-dir echidna-corpora/corpus-basic --crytic-args "--foundry-ignore-compile" + 4 | | // Ran from test directory: test-generator ./src/BasicTypes.sol --corpus-dir echidna-corpora/corpus-basic --contract "BasicTypes" --test-directory "./test/" --inheritance-path "../src/" --fuzzer echidna + 5 | | contract BasicTypes { + 6 | | + 7 | | // ------------------------------ + 8 | | // -- bool -- + 9 | | // ------------------------------ + 10 | | bool first; + 11 | | + 12 | | function setBool(bool set) public { + 13 | | first = set; + 14 | | } + 15 | | + 16 | | function check_bool() public { + 17 | | if (first) { + 18 | | assert(false); + 19 | | } + 20 | | } + 21 | | + 22 | | // ------------------------------ + 23 | | // -- uint -- + 24 | | // ------------------------------ + 25 | | uint256 _uint256 = 3; + 26 | | + 27 | | function setUint256(uint256 input) public { + 28 | | _uint256 = input; + 29 | | } + 30 | | + 31 | | function check_uint256() public { + 32 | | if (_uint256 % 2 == 0) { + 33 | | assert(false); + 34 | | } + 35 | | } + 36 | | + 37 | | function check_large_uint256() public { + 38 | | if (_uint256 == type(uint256).max) { + 39 | | assert(false); + 40 | | } + 41 | | } + 42 | | + 43 | | // ------------------------------ + 44 | | // -- int -- + 45 | | // ------------------------------ + 46 | | int256 _int256 = 3; + 47 | | + 48 | | function setInt256(int256 input) public { + 49 | | _int256 = input; + 50 | | } + 51 | | + 52 | | function check_int256() public { + 53 | | if (_int256 % 2 == 0) { + 54 | | assert(false); + 55 | | } + 56 | | } + 57 | | + 58 | | function check_large_positive_int256() public { + 59 | | if (_int256 == type(int256).max) { + 60 | | assert(false); + 61 | | } + 62 | | } + 63 | | + 64 | | function check_large_negative_int256() public { + 65 | | if (_int256 == type(int256).min) { + 66 | | assert(false); + 67 | | } + 68 | | } + 69 | | // ------------------------------ + 70 | | // -- address -- + 71 | | // ------------------------------ + 72 | | address providedAddress; + 73 | | + 74 | | function setAddress(address input) public { + 75 | | require(input != address(0)); + 76 | | providedAddress = input; + 77 | | } + 78 | | + 79 | | function check_address() public { + 80 | | if (providedAddress != address(0)) { + 81 | | assert(false); + 82 | | } + 83 | | } + 84 | | // ------------------------------ + 85 | | // -- string -- + 86 | | // ------------------------------ + 87 | | string providedString; + 88 | | + 89 | | function setString(string memory input) public { + 90 | | require(bytes(input).length > 20); + 91 | | providedString = input; + 92 | | } + 93 | | + 94 | | function check_string() public { + 95 | | if (bytes(providedString).length > 20) { + 96 | | assert(false); + 97 | | } + 98 | | } + 99 | | + 100 | | function check_specific_string(string memory provided) public { + 101 | | require(bytes(provided).length > 0); + 102 | | if (keccak256(bytes(provided)) == keccak256(bytes(hex"00"))) { + 103 | | assert(false); + 104 | | } + 105 | | } + 106 | | + 107 | | // ------------------------------ + 108 | | // -- bytes -- + 109 | | // ------------------------------ + 110 | | bytes providedBytes; + 111 | | bytes32 providedBytes32; + 112 | | + 113 | | // TODO bytes32, etc. + 114 | | function setBytes(bytes memory input) public { + 115 | | require(input.length > 20); + 116 | | providedBytes = input; + 117 | | } + 118 | | + 119 | | function check_bytes() public { + 120 | | if (providedBytes.length > 20) { + 121 | | assert(false); + 122 | | } + 123 | | } + 124 | | + 125 | | /// @notice bytes32 has decoding issues right now + 126 | | /* function setBytes32(bytes32 input) public { + 127 | | require(input != bytes32(0)); + 128 | | providedBytes32 = input; + 129 | | } + 130 | | + 131 | | function check_bytes32() public { + 132 | | if (providedBytes32 != bytes32(0)) { + 133 | | assert(false); + 134 | | } + 135 | | } */ + 136 | | + 137 | | // ------------------------------ + 138 | | // -- combination -- + 139 | | // ------------------------------ + 140 | | bool combBool; + 141 | | uint256 combUint256; + 142 | | int256 combInt256; + 143 | | address combAddress; + 144 | | string combString; + 145 | | bytes combBytes; + 146 | | + 147 | | function setCombination(bool bool_input, uint256 unsigned_input, int256 signed_input, address address_input, string memory str_input, bytes memory bytes_input) public { + 148 | | combBool = bool_input; + 149 | | combUint256 = unsigned_input; + 150 | | combInt256 = signed_input; + 151 | | combAddress = address_input; + 152 | | combString = str_input; + 153 | | combBytes = bytes_input; + 154 | | } + 155 | | + 156 | | function check_combined_input() public { + 157 | | if (combBool && combUint256 > 0 && combInt256 < 0 && combAddress != address(0) && bytes(combString).length > 0 && combBytes.length > 0) { + 158 | | assert(false); + 159 | | } + 160 | | } + 161 | | } + +/Users/elvisskozdopolj/Documents/GitHub/test-generator/tests/test_data/src/DynamicArrays.sol + 1 | | pragma solidity ^0.8.0; + 2 | | + 3 | | // Ran from test directory: echidna . --contract DynamicArrays --test-mode assertion --test-limit 100000 --corpus-dir echidna-corpora/corpus-dyn-arr --crytic-args "--foundry-ignore-compile" + 4 | | // Ran from test directory: test-generator ./src/DynamicArrays.sol --corpus-dir echidna-corpora/corpus-dyn-arr --contract "DynamicArrays" --test-directory "./test/" --inheritance-path "../src/" --fuzzer echidna + 5 | | contract DynamicArrays { + 6 | | + 7 | | // ------------------------------ + 8 | | // -- bool array -- + 9 | | // ------------------------------ + 10 | | bool[] boolDynArr; + 11 | | + 12 | | function addBoolArr(bool[] memory input) public { + 13 | | for(uint256 i; i < input.length; i++) { + 14 | | boolDynArr.push(input[i]); + 15 | | } + 16 | | } + 17 | | + 18 | | function check_boolArr() public { + 19 | | uint256 count; + 20 | | for(uint256 i; i < boolDynArr.length; i++) { + 21 | | if (boolDynArr[i]) { + 22 | | count++; + 23 | | } + 24 | | } + 25 | | + 26 | | if (count > 3) { + 27 | | assert(false); + 28 | | } + 29 | | } + 30 | | // ------------------------------ + 31 | | // -- uint array -- + 32 | | // ------------------------------ + 33 | | uint256[] uintDynArr; + 34 | | + 35 | | function addUintArr(uint256[] memory input) public { + 36 | | for (uint256 i; i < input.length; i++) { + 37 | | uintDynArr.push(input[i]); + 38 | | } + 39 | | } + 40 | | + 41 | | function check_uintDynArr() public { + 42 | | uint256 sum; + 43 | | for(uint256 i; i < uintDynArr.length; i++) { + 44 | | sum += uintDynArr[i]; + 45 | | } + 46 | | + 47 | | if (sum != 0 && sum % 3 == 0) { + 48 | | assert(false); + 49 | | } + 50 | | } + 51 | | + 52 | | // ------------------------------ + 53 | | // -- int array -- + 54 | | // ------------------------------ + 55 | | int256[] intDynArr; + 56 | | + 57 | | function addIntArr(int256[] memory input) public { + 58 | | for (uint256 i; i < input.length; i++) { + 59 | | intDynArr.push(input[i]); + 60 | | } + 61 | | } + 62 | | + 63 | | function check_intDynArr() public { + 64 | | int256 sum; + 65 | | for(uint256 i; i < intDynArr.length; i++) { + 66 | | sum += intDynArr[i]; + 67 | | } + 68 | | + 69 | | if (sum != 0 && sum % 3 == 0) { + 70 | | assert(false); + 71 | | } + 72 | | } + 73 | | + 74 | | // ------------------------------ + 75 | | // -- address array -- + 76 | | // ------------------------------ + 77 | | address[] addressDynArr; + 78 | | + 79 | | function addAddressArr(address[] memory input) public { + 80 | | for(uint256 i; i < input.length; i++) { + 81 | | addressDynArr.push(input[i]); + 82 | | } + 83 | | } + 84 | | + 85 | | function check_addressDynArr() public { + 86 | | uint256 count = 0; + 87 | | // At least 3 should be non-zero + 88 | | for(uint256 i; i < addressDynArr.length; i++) { + 89 | | if(addressDynArr[i] != address(0)) { + 90 | | count++; + 91 | | } + 92 | | } + 93 | | + 94 | | if (count > 3) { + 95 | | assert(false); + 96 | | } + 97 | | } + 98 | | // ------------------------------ + 99 | | // -- string array -- + 100 | | // ------------------------------ + 101 | | string[] strDynArr; + 102 | | + 103 | | function addStrArr(string[] memory input) public { + 104 | | for(uint256 i; i < input.length; i++) { + 105 | | strDynArr.push(input[i]); + 106 | | } + 107 | | } + 108 | | + 109 | | function check_strDynArr() public { + 110 | | uint256 count; + 111 | | for(uint256 i; i < strDynArr.length; i++) { + 112 | | if (bytes(strDynArr[i]).length > 0) { + 113 | | count++; + 114 | | } + 115 | | } + 116 | | if (count > 3) { + 117 | | assert(false); + 118 | | } + 119 | | } + 120 | | + 121 | | // ------------------------------ + 122 | | // -- bytes array -- + 123 | | // ------------------------------ + 124 | | bytes[] bytesDynArr; + 125 | | + 126 | | function addBytesArr(bytes[] memory input) public { + 127 | | for(uint256 i; i < input.length; i++) { + 128 | | bytesDynArr.push(input[i]); + 129 | | } + 130 | | } + 131 | | + 132 | | function check_bytesArr() public { + 133 | | uint256 count; + 134 | | for(uint256 i; i < bytesDynArr.length; i++) { + 135 | | if(bytesDynArr[i].length > 0) { + 136 | | count++; + 137 | | } + 138 | | } + 139 | | + 140 | | if (count > 3) { + 141 | | assert(false); + 142 | | } + 143 | | } + 144 | | } + +/Users/elvisskozdopolj/Documents/GitHub/test-generator/tests/test_data/src/FixedArrays.sol + 1 | | pragma solidity ^0.8.0; + 2 | | + 3 | | // Ran from test directory: echidna . --contract FixedArrays --test-mode assertion --test-limit 100000 --corpus-dir echidna-corpora/corpus-fixed-arr --crytic-args "--foundry-ignore-compile" + 4 | | // Ran from test directory: test-generator ./src/FixedArrays.sol --corpus-dir echidna-corpora/corpus-fixed-arr --contract "FixedArrays" --test-directory "./test/" --inheritance-path "../src/" --fuzzer echidna + 5 | | contract FixedArrays { + 6 | | + 7 | | // ------------------------------ + 8 | | // -- bool array -- + 9 | | // ------------------------------ + 10 | | bool[3] boolArr; + 11 | | + 12 | | function addBoolArr(bool[3] memory input) public { + 13 | | for(uint256 i; i < boolArr.length; i++) { + 14 | | boolArr[i] = input[i]; + 15 | | } + 16 | | } + 17 | | + 18 | | function check_boolArr() public { + 19 | | if (boolArr[0] && !boolArr[1] && boolArr[2]) { + 20 | | assert(false); + 21 | | } + 22 | | } + 23 | | // ------------------------------ + 24 | | // -- uint array -- + 25 | | // ------------------------------ + 26 | | uint256[2] uintArr; + 27 | | + 28 | | function addUintArr(uint256[2] memory input) public { + 29 | | for(uint256 i; i < uintArr.length; i++) { + 30 | | uintArr[i] = input[i]; + 31 | | } + 32 | | } + 33 | | + 34 | | function check_uintArr() public { + 35 | | uint256 sum; + 36 | | for(uint256 i; i < uintArr.length; i++) { + 37 | | sum += uintArr[i]; + 38 | | } + 39 | | if (sum == 5) { + 40 | | assert(false); + 41 | | } + 42 | | } + 43 | | // ------------------------------ + 44 | | // -- int array -- + 45 | | // ------------------------------ + 46 | | int256[2] intArr; + 47 | | + 48 | | function addIntArr(int256[2] memory input) public { + 49 | | for(uint256 i; i < intArr.length; i++) { + 50 | | intArr[i] = input[i]; + 51 | | } + 52 | | } + 53 | | + 54 | | function check_intArr() public { + 55 | | int256 sum; + 56 | | for(uint256 i; i < intArr.length; i++) { + 57 | | sum += intArr[i]; + 58 | | } + 59 | | if (sum == 5) { + 60 | | assert(false); + 61 | | } + 62 | | } + 63 | | + 64 | | // ------------------------------ + 65 | | // -- address array -- + 66 | | // ------------------------------ + 67 | | address[4] addressArr; + 68 | | + 69 | | function addAddressArr(address[4] memory input) public { + 70 | | for(uint256 i; i < addressArr.length; i++) { + 71 | | addressArr[i] = input[i]; + 72 | | } + 73 | | } + 74 | | + 75 | | function check_addressArr() public { + 76 | | uint256 count = 1; + 77 | | // At least 3 should be non-zero + 78 | | for(uint256 i; i < addressArr.length; i++) { + 79 | | if(addressArr[i] != address(0)) { + 80 | | count++; + 81 | | } + 82 | | } + 83 | | + 84 | | if (count == addressArr.length) { + 85 | | assert(false); + 86 | | } + 87 | | } + 88 | | // ------------------------------ + 89 | | // -- string array -- + 90 | | // ------------------------------ + 91 | | string[2] strArr; + 92 | | + 93 | | function addStrArr(string[2] memory input) public { + 94 | | for(uint256 i; i < strArr.length; i++) { + 95 | | strArr[i] = input[i]; + 96 | | } + 97 | | } + 98 | | + 99 | | function check_strArr() public { + 100 | | if (bytes(strArr[0]).length > 0 && bytes(strArr[1]).length > 0) { + 101 | | assert(false); + 102 | | } + 103 | | } + 104 | | // ------------------------------ + 105 | | // -- bytes array -- + 106 | | // ------------------------------ + 107 | | bytes[2] bytesArr; + 108 | | + 109 | | function addBytesArr(bytes[2] memory input) public { + 110 | | for(uint256 i; i < bytesArr.length; i++) { + 111 | | bytesArr[i] = input[i]; + 112 | | } + 113 | | } + 114 | | + 115 | | function check_bytesArr() public { + 116 | | if (bytesArr[0].length > 0 && bytesArr[1].length > 0) { + 117 | | assert(false); + 118 | | } + 119 | | } + 120 | | } + +/Users/elvisskozdopolj/Documents/GitHub/test-generator/tests/test_data/src/IStruct.sol + 1 | | interface IStruct { + 2 | | struct Inherited { + 3 | | uint256 uintType; + 4 | | bool boolType; + 5 | | } + 6 | | } + +/Users/elvisskozdopolj/Documents/GitHub/test-generator/tests/test_data/src/MultiDimensionalDynamicArrays.sol + 1 | | pragma solidity ^0.8.0; + 2 | | + 3 | | // Ran from test directory: echidna . --contract MultiDimensionalDynamicArrays --test-mode assertion --test-limit 100000 --corpus-dir echidna-corpora/corpus-multi-dyn-arr --crytic-args "--foundry-ignore-compile" + 4 | | // Ran from test directory: test-generator ./src/MultiDimensionalDynamicArrays.sol --corpus-dir echidna-corpora/corpus-multi-dyn-arr --contract "MultiDimensionalDynamicArrays" --test-directory "./test/" --inheritance-path "../src/" --fuzzer echidna + 5 | | contract MultiDimensionalDynamicArrays { + 6 | | // ----- 2-dimensional arrays ------ + 7 | | + 8 | | // ------------------------------ + 9 | | // -- bool array -- + 10 | | // ------------------------------ + 11 | | bool[][] boolArr; + 12 | | + 13 | | function addBoolArr(bool[][] memory input) public { + 14 | | for (uint256 i; i < input.length; i++) { + 15 | | boolArr[i] = input[i]; + 16 | | } + 17 | | } + 18 | | + 19 | | function check_boolArr() public { + 20 | | uint256 count; + 21 | | for (uint256 i; i < boolArr.length; i++) { + 22 | | for (uint256 j; j < boolArr[i].length; i++) { + 23 | | if (boolArr[i][j]) { + 24 | | count++; + 25 | | } + 26 | | } + 27 | | } + 28 | | + 29 | | if (count > 3) { + 30 | | assert(false); + 31 | | } + 32 | | } + 33 | | + 34 | | // ------------------------------ + 35 | | // -- uint array -- + 36 | | // ------------------------------ + 37 | | uint256[][] uintArr; + 38 | | + 39 | | function addUintArr(uint256[][] memory input) public { + 40 | | for (uint256 i; i < input.length; i++) { + 41 | | uintArr[i] = input[i]; + 42 | | } + 43 | | } + 44 | | + 45 | | function check_uintArr() public { + 46 | | uint256 sum; + 47 | | for (uint256 i; i < uintArr.length; i++) { + 48 | | for (uint256 j; i < uintArr[i].length; i++) { + 49 | | sum += uintArr[i][j]; + 50 | | } + 51 | | } + 52 | | if (sum > 10) { + 53 | | assert(false); + 54 | | } + 55 | | } + 56 | | + 57 | | // ------------------------------ + 58 | | // -- int array -- + 59 | | // ------------------------------ + 60 | | int256[][] intArr; + 61 | | + 62 | | function addIntArr(int256[][] memory input) public { + 63 | | for (uint256 i; i < input.length; i++) { + 64 | | intArr[i] = input[i]; + 65 | | } + 66 | | } + 67 | | + 68 | | function check_intArr() public { + 69 | | int256 sum; + 70 | | for (uint256 i; i < intArr.length; i++) { + 71 | | for (uint256 j; j < intArr[i].length; i++) { + 72 | | sum += intArr[i][j]; + 73 | | } + 74 | | } + 75 | | if (sum == 5) { + 76 | | assert(false); + 77 | | } + 78 | | } + 79 | | + 80 | | // ------------------------------ + 81 | | // -- address array -- + 82 | | // ------------------------------ + 83 | | address[][] addressArr; + 84 | | + 85 | | function addAddressArr(address[][] memory input) public { + 86 | | for (uint256 i; i < input.length; i++) { + 87 | | addressArr[i] = input[i]; + 88 | | } + 89 | | } + 90 | | + 91 | | function check_addressArr() public { + 92 | | uint256 count = 1; + 93 | | // At least 3 should be non-zero + 94 | | for (uint256 i; i < addressArr.length; i++) { + 95 | | for (uint256 j; j < addressArr[i].length; i++) { + 96 | | if (addressArr[i][j] != address(0)) { + 97 | | count++; + 98 | | } + 99 | | } + 100 | | } + 101 | | + 102 | | if (count > addressArr.length) { + 103 | | assert(false); + 104 | | } + 105 | | } + 106 | | + 107 | | // ------------------------------ + 108 | | // -- string array -- + 109 | | // ------------------------------ + 110 | | string[][] strArr; + 111 | | + 112 | | function addStrArr(string[][] memory input) public { + 113 | | for (uint256 i; i < input.length; i++) { + 114 | | strArr[i] = input[i]; + 115 | | } + 116 | | } + 117 | | + 118 | | function check_strArr() public { + 119 | | uint256 count; + 120 | | for (uint256 i; i < strArr.length; i++) { + 121 | | for (uint256 j; j < strArr[i].length; j++) { + 122 | | if (bytes(strArr[i][j]).length > 0) { + 123 | | count++; + 124 | | } + 125 | | } + 126 | | } + 127 | | if (count == 2) { + 128 | | assert(false); + 129 | | } + 130 | | } + 131 | | + 132 | | // ------------------------------ + 133 | | // -- bytes array -- + 134 | | // ------------------------------ + 135 | | bytes[][] bytesArr; + 136 | | + 137 | | function addBytesArr(bytes[][] memory input) public { + 138 | | for (uint256 i; i < input.length; i++) { + 139 | | bytesArr[i] = input[i]; + 140 | | } + 141 | | } + 142 | | + 143 | | function check_bytesArr() public { + 144 | | uint256 count; + 145 | | for (uint256 i; i < bytesArr.length; i++) { + 146 | | for (uint256 j; j < bytesArr[i].length; j++) { + 147 | | if (bytesArr[i][j].length > 0) { + 148 | | count++; + 149 | | } + 150 | | } + 151 | | } + 152 | | + 153 | | if (count == 4) { + 154 | | assert(false); + 155 | | } + 156 | | } + 157 | | } + 158 | | + +/Users/elvisskozdopolj/Documents/GitHub/test-generator/tests/test_data/src/MultiDimensionalFixedArrays.sol + 1 | | pragma solidity ^0.8.0; + 2 | | + 3 | | // Ran from test directory: echidna . --contract MultiDimensionalFixedArrays --test-mode assertion --test-limit 100000 --corpus-dir echidna-corpora/corpus-multi-fixed-arr --crytic-args "--foundry-ignore-compile" + 4 | | // Ran from test directory: test-generator ./src/MultiDimensionalFixedArrays.sol --corpus-dir echidna-corpora/corpus-multi-fixed-arr --contract "MultiDimensionalFixedArrays" --test-directory "./test/" --inheritance-path "../src/" --fuzzer echidna + 5 | | contract MultiDimensionalFixedArrays { + 6 | | /* ----- 2-dimensional arrays */ + 7 | | + 8 | | // ------------------------------ + 9 | | // -- bool array -- + 10 | | // ------------------------------ + 11 | | bool[3][2] boolArr; + 12 | | + 13 | | function addBoolArr(bool[3][2] memory input) public { + 14 | | for (uint256 i; i < boolArr.length; i++) { + 15 | | boolArr[i] = input[i]; + 16 | | } + 17 | | } + 18 | | + 19 | | function check_boolArr() public { + 20 | | uint256 count; + 21 | | for (uint256 i; i < boolArr.length; i++) { + 22 | | for (uint256 j; j < boolArr[i].length; i++) { + 23 | | if (boolArr[i][j]) { + 24 | | count++; + 25 | | } + 26 | | } + 27 | | } + 28 | | + 29 | | if (count > 3) { + 30 | | assert(false); + 31 | | } + 32 | | } + 33 | | + 34 | | // ------------------------------ + 35 | | // -- uint array -- + 36 | | // ------------------------------ + 37 | | uint256[2][3] uintArr; + 38 | | + 39 | | function addUintArr(uint256[2][3] memory input) public { + 40 | | for (uint256 i; i < uintArr.length; i++) { + 41 | | uintArr[i] = input[i]; + 42 | | } + 43 | | } + 44 | | + 45 | | function check_uintArr() public { + 46 | | uint256 sum; + 47 | | for (uint256 i; i < uintArr.length; i++) { + 48 | | for (uint256 j; i < uintArr[i].length; i++) { + 49 | | sum += uintArr[i][j]; + 50 | | } + 51 | | } + 52 | | if (sum > 10) { + 53 | | assert(false); + 54 | | } + 55 | | } + 56 | | + 57 | | // ------------------------------ + 58 | | // -- int array -- + 59 | | // ------------------------------ + 60 | | int256[2][1] intArr; + 61 | | + 62 | | function addIntArr(int256[2][1] memory input) public { + 63 | | for (uint256 i; i < intArr.length; i++) { + 64 | | intArr[i] = input[i]; + 65 | | } + 66 | | } + 67 | | + 68 | | function check_intArr() public { + 69 | | int256 sum; + 70 | | for (uint256 i; i < intArr.length; i++) { + 71 | | for (uint256 j; j < intArr[i].length; i++) { + 72 | | sum += intArr[i][j]; + 73 | | } + 74 | | } + 75 | | if (sum == 5) { + 76 | | assert(false); + 77 | | } + 78 | | } + 79 | | + 80 | | // ------------------------------ + 81 | | // -- address array -- + 82 | | // ------------------------------ + 83 | | address[4][2] addressArr; + 84 | | + 85 | | function addAddressArr(address[4][2] memory input) public { + 86 | | for (uint256 i; i < addressArr.length; i++) { + 87 | | addressArr[i] = input[i]; + 88 | | } + 89 | | } + 90 | | + 91 | | function check_addressArr() public { + 92 | | uint256 count = 1; + 93 | | // At least 3 should be non-zero + 94 | | for (uint256 i; i < addressArr.length; i++) { + 95 | | for (uint256 j; j < addressArr[i].length; i++) { + 96 | | if (addressArr[i][j] != address(0)) { + 97 | | count++; + 98 | | } + 99 | | } + 100 | | } + 101 | | + 102 | | if (count > addressArr.length) { + 103 | | assert(false); + 104 | | } + 105 | | } + 106 | | + 107 | | // ------------------------------ + 108 | | // -- string array -- + 109 | | // ------------------------------ + 110 | | string[2][1] strArr; + 111 | | + 112 | | function addStrArr(string[2][1] memory input) public { + 113 | | for (uint256 i; i < strArr.length; i++) { + 114 | | strArr[i] = input[i]; + 115 | | } + 116 | | } + 117 | | + 118 | | function check_strArr() public { + 119 | | uint256 count; + 120 | | for (uint256 i; i < strArr.length; i++) { + 121 | | for (uint256 j; j < strArr[i].length; j++) { + 122 | | if (bytes(strArr[i][j]).length > 0) { + 123 | | count++; + 124 | | } + 125 | | } + 126 | | } + 127 | | if (count == 2) { + 128 | | assert(false); + 129 | | } + 130 | | } + 131 | | + 132 | | // ------------------------------ + 133 | | // -- bytes array -- + 134 | | // ------------------------------ + 135 | | bytes[2][2] bytesArr; + 136 | | + 137 | | function addBytesArr(bytes[2][2] memory input) public { + 138 | | for (uint256 i; i < bytesArr.length; i++) { + 139 | | bytesArr[i] = input[i]; + 140 | | } + 141 | | } + 142 | | + 143 | | function check_bytesArr() public { + 144 | | uint256 count; + 145 | | for (uint256 i; i < bytesArr.length; i++) { + 146 | | for (uint256 j; j < bytesArr[i].length; j++) { + 147 | | if (bytesArr[i][j].length > 0) { + 148 | | count++; + 149 | | } + 150 | | } + 151 | | } + 152 | | + 153 | | if (count == 4) { + 154 | | assert(false); + 155 | | } + 156 | | } + 157 | | } + 158 | | + +/Users/elvisskozdopolj/Documents/GitHub/test-generator/tests/test_data/src/TimeAdvancement.sol + 1 | | pragma solidity ^0.8.0; + 2 | | + 3 | | // Ran from test directory: echidna . --contract TimeAdvancement --test-mode assertion --test-limit 10000 --corpus-dir echidna-corpora/corpus-time --crytic-args "--foundry-ignore-compile" + 4 | | // Ran from test directory: test-generator ./src/TupleTypes.sol --corpus-dir echidna-corpora/corpus-struct --contract "TupleTypes" --test-directory "./test/" --inheritance-path "../src/" --fuzzer echidna + 5 | | + 6 | | contract TimeAdvancement { + 7 | | bool timeSet; + 8 | | bool blockSet; + 9 | | uint256 timestamp; + 10 | | uint256 blockNumber; + 11 | | + 12 | | // ------------------------------ + 13 | | // -- timestamp -- + 14 | | // ------------------------------ + 15 | | + 16 | | function setTimestamp() public { + 17 | | timeSet = true; + 18 | | timestamp = block.timestamp; + 19 | | } + 20 | | + 21 | | function check_timestamp() public { + 22 | | if (timeSet) { + 23 | | assert(block.timestamp <= timestamp); + 24 | | } + 25 | | } + 26 | | // ------------------------------ + 27 | | // -- block number -- + 28 | | // ------------------------------ + 29 | | + 30 | | function setBlock() public { + 31 | | blockSet = true; + 32 | | blockNumber = block.number; + 33 | | } + 34 | | + 35 | | function check_block() public { + 36 | | if (blockSet) { + 37 | | assert(block.number <= blockNumber); + 38 | | } + 39 | | } + 40 | | + 41 | | // ------------------------------ + 42 | | // -- both -- + 43 | | // ------------------------------ + 44 | | + 45 | | function check_time_and_block() public { + 46 | | if (blockSet && timeSet) { + 47 | | assert(block.timestamp <= timestamp || block.number <= blockNumber); + 48 | | } + 49 | | } + 50 | | + 51 | | } + +/Users/elvisskozdopolj/Documents/GitHub/test-generator/tests/test_data/src/TupleTypes.sol + 1 | | pragma solidity ^0.8.0; + 2 | | + 3 | | import "./IStruct.sol"; + 4 | | + 5 | | // Ran from test directory: echidna . --contract TupleTypes --test-mode assertion --test-limit 100000 --corpus-dir echidna-corpora/corpus-struct --crytic-args "--foundry-ignore-compile" + 6 | | // Ran from test directory: test-generator ./src/TupleTypes.sol --corpus-dir echidna-corpora/corpus-struct --contract "TupleTypes" --test-directory "./test/" --inheritance-path "../src/" --fuzzer echidna + 7 | | contract TupleTypes { + 8 | | struct ElementaryStruct { + 9 | | uint256 uintType; + 10 | | int256 intType; + 11 | | string stringType; + 12 | | bool boolType; + 13 | | } + 14 | | + 15 | | struct NestedStruct { + 16 | | ElementaryStruct structType; + 17 | | uint256 uintType; + 18 | | } + 19 | | + 20 | | struct FixedArrayStruct { + 21 | | uint256[2] fixedSized; + 22 | | } + 23 | | + 24 | | struct DynamicArrayStruct { + 25 | | uint256[] dynSized; + 26 | | } + 27 | | + 28 | | enum Enumerable { + 29 | | ZERO, + 30 | | ONE, + 31 | | TWO + 32 | | } + 33 | | + 34 | | ElementaryStruct testStruct; + 35 | | NestedStruct nestedStruct; + 36 | | FixedArrayStruct fixedArrayStruct; + 37 | | DynamicArrayStruct dynArrayStruct; + 38 | | Enumerable testEnum; + 39 | | IStruct.Inherited inheritedStruct; + 40 | | + 41 | | // ------------------------------------ + 42 | | // -- Elementary struct -- + 43 | | // ------------------------------------ + 44 | | + 45 | | function updateElementaryStruct(ElementaryStruct memory input) public { + 46 | | testStruct = input; + 47 | | } + 48 | | + 49 | | function check_elementaryStruct() public { + 50 | | ElementaryStruct memory test = testStruct; + 51 | | if ( + 52 | | test.uintType > 0 && + 53 | | test.intType < 0 && + 54 | | bytes(test.stringType).length > 0 && + 55 | | test.boolType + 56 | | ) { + 57 | | assert(false); + 58 | | } + 59 | | } + 60 | | + 61 | | // ------------------------------------ + 62 | | // -- Nested struct -- + 63 | | // ------------------------------------ + 64 | | function updateNestedStruct(NestedStruct memory input) public { + 65 | | nestedStruct = input; + 66 | | } + 67 | | + 68 | | function check_nestedStruct() public { + 69 | | NestedStruct memory test = nestedStruct; + 70 | | if ( + 71 | | test.structType.boolType && + 72 | | test.structType.intType < 0 && + 73 | | bytes(test.structType.stringType).length > 0 && + 74 | | test.structType.uintType > 0 && + 75 | | test.uintType > 0 + 76 | | ) { + 77 | | assert(false); + 78 | | } + 79 | | } + 80 | | + 81 | | // ------------------------------------ + 82 | | // -- Fixed Arr struct -- + 83 | | // ------------------------------------ + 84 | | function updateFixedArrStruct(FixedArrayStruct memory input) public { + 85 | | fixedArrayStruct = input; + 86 | | } + 87 | | + 88 | | function check_fixedArrStruct() public { + 89 | | FixedArrayStruct memory test = fixedArrayStruct; + 90 | | uint256 count; + 91 | | for (uint256 i; i < test.fixedSized.length; i++) { + 92 | | if (test.fixedSized[i] > 0) { + 93 | | count++; + 94 | | } + 95 | | } + 96 | | + 97 | | if (count > 0) { + 98 | | assert(false); + 99 | | } + 100 | | } + 101 | | + 102 | | // ------------------------------------ + 103 | | // -- Dyn Arr struct -- + 104 | | // ------------------------------------ + 105 | | function updateDynArrStruct(DynamicArrayStruct memory input) public { + 106 | | dynArrayStruct = input; + 107 | | } + 108 | | + 109 | | function check_dynamicArrStruct() public { + 110 | | DynamicArrayStruct memory test = dynArrayStruct; + 111 | | uint256 count; + 112 | | for (uint256 i; i < test.dynSized.length; i++) { + 113 | | if (test.dynSized[i] > 0) { + 114 | | count++; + 115 | | } + 116 | | } + 117 | | + 118 | | if (count > 0) { + 119 | | assert(false); + 120 | | } + 121 | | } + 122 | | + 123 | | // ------------------------------------ + 124 | | // -- Enum -- + 125 | | // ------------------------------------ + 126 | | + 127 | | function updateEnum(Enumerable input) public { + 128 | | testEnum = input; + 129 | | } + 130 | | + 131 | | function check_enum() public { + 132 | | if (testEnum == Enumerable.TWO) { + 133 | | assert(false); + 134 | | } + 135 | | } + 136 | | + 137 | | // ------------------------------------ + 138 | | // -- Inherited struct -- + 139 | | // ------------------------------------ + 140 | | function updateInheritedStruct(IStruct.Inherited memory input) public { + 141 | | inheritedStruct = input; + 142 | | } + 143 | | + 144 | | function check_inheritedStruct() public { + 145 | | IStruct.Inherited memory test = inheritedStruct; + 146 | | if ( + 147 | | test.uintType > 0 && + 148 | | test.boolType + 149 | | ) { + 150 | | assert(false); + 151 | | } + 152 | | } + 153 | | } + 154 | | + +/Users/elvisskozdopolj/Documents/GitHub/test-generator/tests/test_data/src/ValueTransfer.sol + 1 | | pragma solidity ^0.8.0; + 2 | | + 3 | | // Ran from tests/test_data/ directory: echidna . --contract ValueTransfer --test-mode assertion --test-limit 1000000 --corpus-dir echidna-corpora/corpus-value + 4 | | // Ran from tests/test_data/ directory: test-generator ./src/ValueTransfer.sol --corpus-dir echidna-corpora/corpus-value --contract "ValueTransfer" --test-directory "./test/" --inheritance-path "../src/" --fuzzer echidna + 5 | * | contract ValueTransfer { + 6 | | + 7 | *r | function check_balance() public { + 8 | * | if (address(this).balance > 0) { + 9 | * | assert(false); + 10 | | } + 11 | | } + 12 | | + 13 | | fallback() external payable { + 14 | | // Just receive Ether + 15 | | } + 16 | | } + diff --git a/tests/test_data/echidna-corpora/corpus-value/reproducers/-3813008174787504499.txt b/tests/test_data/echidna-corpora/corpus-value/reproducers/-3813008174787504499.txt new file mode 100644 index 0000000..a4a7e0c --- /dev/null +++ b/tests/test_data/echidna-corpora/corpus-value/reproducers/-3813008174787504499.txt @@ -0,0 +1 @@ +[{"call":{"contents":["",[]],"tag":"SolCall"},"delay":["0x0000000000000000000000000000000000000000000000000000000000000000","0x0000000000000000000000000000000000000000000000000000000000000000"],"dst":"0x00a329c0648769A73afAc7F9381E08FB43dBEA72","gas":12500000,"gasprice":"0x0000000000000000000000000000000000000000000000000000000000000000","src":"0x0000000000000000000000000000000000010000","value":"0x0000000000000000000000000000000000000000000000000000000000000001"},{"call":{"contents":["check_balance",[]],"tag":"SolCall"},"delay":["0x0000000000000000000000000000000000000000000000000000000000000000","0x0000000000000000000000000000000000000000000000000000000000000000"],"dst":"0x00a329c0648769A73afAc7F9381E08FB43dBEA72","gas":12500000,"gasprice":"0x0000000000000000000000000000000000000000000000000000000000000000","src":"0x0000000000000000000000000000000000010000","value":"0x0000000000000000000000000000000000000000000000000000000000000000"}] \ No newline at end of file diff --git a/tests/test_data/src/ValueTransfer.sol b/tests/test_data/src/ValueTransfer.sol new file mode 100644 index 0000000..0ca8237 --- /dev/null +++ b/tests/test_data/src/ValueTransfer.sol @@ -0,0 +1,16 @@ +pragma solidity ^0.8.0; + +// Ran from tests/test_data/ directory: echidna . --contract ValueTransfer --test-mode assertion --test-limit 1000000 --corpus-dir echidna-corpora/corpus-value +// Ran from tests/test_data/ directory: test-generator ./src/ValueTransfer.sol --corpus-dir echidna-corpora/corpus-value --contract "ValueTransfer" --test-directory "./test/" --inheritance-path "../src/" --fuzzer echidna +contract ValueTransfer { + + function check_balance() public { + if (address(this).balance > 0) { + assert(false); + } + } + + fallback() external payable { + // Just receive Ether + } +} \ No newline at end of file diff --git a/tests/test_data/test/ValueTransfer_Echidna_Test.t.sol b/tests/test_data/test/ValueTransfer_Echidna_Test.t.sol new file mode 100644 index 0000000..4eb801f --- /dev/null +++ b/tests/test_data/test/ValueTransfer_Echidna_Test.t.sol @@ -0,0 +1,25 @@ +// SPDX-License-Identifier: UNLICENSED +pragma solidity ^0.8.13; +import "forge-std/Test.sol"; +import "forge-std/console2.sol"; +import "../src/ValueTransfer.sol"; + +contract ValueTransfer_Echidna_Test is Test { + ValueTransfer target; + + function setUp() public { + target = new ValueTransfer(); + } + function test_auto_check_balance_0() public { + + vm.prank(0x0000000000000000000000000000000000010000); + (bool success, ) = payable(address(target)).call{value: 1}(""); + require(success, "Low level call failed."); + + vm.prank(0x0000000000000000000000000000000000010000); + target.check_balance(); + } + +} + + \ No newline at end of file diff --git a/tests/test_types_echidna.py b/tests/test_types_echidna.py index af39c89..1e46b35 100644 --- a/tests/test_types_echidna.py +++ b/tests/test_types_echidna.py @@ -131,3 +131,34 @@ def test_echidna_structs_and_enums(structs_and_enums: TestGenerator) -> None: assert tests_passed == 0 else: assert False, "No tests were ran" + + +def test_echidna_value_transfer(value_transfer: TestGenerator) -> None: + """Tests the BasicTypes contract with an Echidna corpus""" + value_transfer.echidna_generate_tests() + # Ensure the file was created + path = os.path.join(os.getcwd(), "test", "ValueTransfer_Echidna_Test.t.sol") + assert os.path.exists(path) + + # Ensure the file can be compiled + subprocess.run(["forge", "build", "--build-info"], capture_output=True, text=True, check=True) + + # Ensure the file can be tested + result = subprocess.run( + ["forge", "test", "--match-contract", "ValueTransfer_Echidna_Test"], + capture_output=True, + text=True, + check=False, + ) + + # Remove ansi escape sequences + ansi_escape = re.compile(r"\x1B(?:[@-Z\\-_]|\[[0-?]*[ -/]*[@-~])") + output = ansi_escape.sub("", result.stdout) + + # Ensure all tests fail + match = re.search(PATTERN, output) + if match: + tests_passed = int(match.group(2)) + assert tests_passed == 0 + else: + assert False, "No tests were ran" diff --git a/tests/test_types_medusa.py b/tests/test_types_medusa.py index 4eea348..c2f6586 100644 --- a/tests/test_types_medusa.py +++ b/tests/test_types_medusa.py @@ -131,3 +131,34 @@ def test_medusa_structs_and_enums(structs_and_enums: TestGenerator) -> None: assert tests_passed == 0 else: assert False, "No tests were ran" + + +def test_medusa_value_transfer(value_transfer: TestGenerator) -> None: + """Tests the BasicTypes contract with a Medusa corpus""" + value_transfer.medusa_generate_tests() + # Ensure the file was created + path = os.path.join(os.getcwd(), "test", "ValueTransfer_Medusa_Test.t.sol") + assert os.path.exists(path) + + # Ensure the file can be compiled + subprocess.run(["forge", "build", "--build-info"], capture_output=True, text=True, check=True) + + # Ensure the file can be tested + result = subprocess.run( + ["forge", "test", "--match-contract", "ValueTransfer_Medusa_Test"], + capture_output=True, + text=True, + check=False, + ) + + # Remove ansi escape sequences + ansi_escape = re.compile(r"\x1B(?:[@-Z\\-_]|\[[0-?]*[ -/]*[@-~])") + output = ansi_escape.sub("", result.stdout) + + # Ensure all tests fail + match = re.search(PATTERN, output) + if match: + tests_passed = int(match.group(2)) + assert tests_passed == 0 + else: + assert False, "No tests were ran"