Fix type hints

state_merge
Nikhil Parasaram 5 years ago
parent 957b8ba778
commit 494040275c
  1. 4
      mythril/laser/ethereum/plugins/implementations/plugin_annotations.py
  2. 3
      mythril/laser/ethereum/state/global_state.py
  3. 6
      mythril/laser/ethereum/state/world_state.py

@ -78,7 +78,7 @@ class WSDependencyAnnotation(StateAnnotation):
result.annotations_stack = copy(self.annotations_stack)
return result
def check_merge_annotation(self, other):
def check_merge_annotation(self, other: "WSDependencyAnnotation"):
if len(self.annotations_stack) != len(other.annotations_stack):
return False
for a1, a2 in zip(self.annotations_stack, other.annotations_stack):
@ -86,6 +86,6 @@ class WSDependencyAnnotation(StateAnnotation):
return False
return True
def merge_annotations(self, other):
def merge_annotations(self, other: "WSDependencyAnnotation"):
for a1, a2 in zip(self.annotations_stack, other.annotations_stack):
a1.merge_annotation(a2)

@ -141,9 +141,6 @@ class GlobalState:
"""
self._annotations.append(annotation)
if annotation.persist_to_world_state:
self.world_state.annotate(annotation)
@property
def annotations(self) -> List[StateAnnotation]:
"""

@ -26,7 +26,7 @@ class WorldState:
def __init__(
self,
transaction_sequence=None,
annotations: List[StateAnnotation] = None,
annotations: List[WSDependencyAnnotation] = None,
constraints: Constraints = None,
) -> None:
"""Constructor for the world state. Initializes the accounts record.
@ -133,7 +133,7 @@ class WorldState:
if self._check_constraint_merge(state.constraints) is False:
return False
for v1, v2 in zip(state.annotations, self._annotations):
if v1.check_merge_annotation(v2) is False: # type: ignore
if v1.check_merge_annotation(v2) is False:
return False
return True
@ -144,7 +144,7 @@ class WorldState:
:return:
"""
for v1, v2 in zip(state.annotations, self._annotations):
v1.merge_annotations(v2) # type: ignore
v1.merge_annotations(v2)
def check_merge_condition(self, state: "WorldState"):
"""

Loading…
Cancel
Save