Skip to content

Commit

Permalink
Make the results deterministic (#2114)
Browse files Browse the repository at this point in the history
  • Loading branch information
smonicas authored Sep 8, 2023
1 parent ff52901 commit 65cc68d
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions slither/detectors/statements/divide_before_multiply.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Module detecting possible loss of precision due to divide before multiple
"""
from collections import defaultdict
from typing import DefaultDict, List, Set, Tuple
from typing import DefaultDict, List, Tuple

from slither.core.cfg.node import Node
from slither.core.declarations.contract import Contract
Expand Down Expand Up @@ -63,7 +63,7 @@ def is_assert(node: Node) -> bool:

# pylint: disable=too-many-branches
def _explore(
to_explore: Set[Node], f_results: List[List[Node]], divisions: DefaultDict[LVALUE, List[Node]]
to_explore: List[Node], f_results: List[List[Node]], divisions: DefaultDict[LVALUE, List[Node]]
) -> None:
explored = set()
while to_explore: # pylint: disable=too-many-nested-blocks
Expand Down Expand Up @@ -114,7 +114,7 @@ def _explore(
f_results.append(node_results)

for son in node.sons:
to_explore.add(son)
to_explore.append(son)


def detect_divide_before_multiply(
Expand Down Expand Up @@ -145,7 +145,7 @@ def detect_divide_before_multiply(
# track all the division results (and the assignment of the division results)
divisions: DefaultDict[LVALUE, List[Node]] = defaultdict(list)

_explore({function.entry_point}, f_results, divisions)
_explore([function.entry_point], f_results, divisions)

for f_result in f_results:
results.append((function, f_result))
Expand Down

0 comments on commit 65cc68d

Please sign in to comment.