Skip to content

Commit

Permalink
Merge pull request #2560 from crytic/echidna-printer
Browse files Browse the repository at this point in the history
Add assert information for echidna
  • Loading branch information
montyly authored Oct 24, 2024
2 parents d0929a8 + 537ee27 commit 89a7d58
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions slither/printers/guidance/echidna.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,17 +139,12 @@ def _extract_assert(contracts: List[Contract]) -> Dict[str, Dict[str, List[Dict]
"""
ret: Dict[str, Dict[str, List[Dict]]] = {}
for contract in contracts:
functions_using_assert = [] # Dict[str, List[Dict]] = defaultdict(list)
functions_using_assert: Dict[str, List[Dict]] = defaultdict(list)
for f in contract.functions_entry_points:
for ir in f.all_solidity_calls():
if ir.function == SolidityFunction("assert(bool)"):
functions_using_assert.append(_get_name(f))
break
# Revert https://github.com/crytic/slither/pull/2105 until format is supported by echidna.
# for node in f.all_nodes():
# if SolidityFunction("assert(bool)") in node.solidity_calls and node.source_mapping:
# func_name = _get_name(f)
# functions_using_assert[func_name].append(node.source_mapping.to_json())
if ir.function == SolidityFunction("assert(bool)") and ir.node.source_mapping:
func_name = _get_name(f)
functions_using_assert[func_name].append(ir.node.source_mapping.to_json())
if functions_using_assert:
ret[contract.name] = functions_using_assert
return ret
Expand Down

0 comments on commit 89a7d58

Please sign in to comment.