|
| 1 | +from mythril.laser.ethereum.state.annotation import StateAnnotation |
| 2 | +from mythril.laser.ethereum.state.global_state import GlobalState |
| 3 | +from mythril.laser.ethereum.state.environment import Environment |
| 4 | +from mythril.laser.smt import Bool, BaseArray |
| 5 | +from typing import List, Tuple |
| 6 | + |
| 7 | +from copy import deepcopy, copy |
| 8 | + |
| 9 | + |
| 10 | +class SummaryTrackingAnnotation(StateAnnotation): |
| 11 | + """SummaryTrackingAnnotation |
| 12 | + This annotation is used by the symbolic summary plugin to keep track of data related to a summary that |
| 13 | + will be computed during the future exploration of the annotated world state. |
| 14 | + """ |
| 15 | + |
| 16 | + def __init__( |
| 17 | + self, |
| 18 | + entry: GlobalState, |
| 19 | + storage_pairs: List[Tuple[BaseArray, BaseArray]], |
| 20 | + storage_constraints: List[Bool], |
| 21 | + environment_pair: Tuple[Environment, Environment], |
| 22 | + balance_pair: Tuple[BaseArray, BaseArray], |
| 23 | + code: str, |
| 24 | + ): |
| 25 | + self.entry = entry |
| 26 | + self.trace = [] |
| 27 | + self.storage_pairs = storage_pairs |
| 28 | + self.storage_constraints = storage_constraints |
| 29 | + self.environment_pair = environment_pair |
| 30 | + self.balance_pair = balance_pair |
| 31 | + self.code = code |
| 32 | + |
| 33 | + def __copy__(self): |
| 34 | + |
| 35 | + annotation = SummaryTrackingAnnotation( |
| 36 | + entry=self.entry, |
| 37 | + storage_pairs=deepcopy(self.storage_pairs), |
| 38 | + storage_constraints=deepcopy(self.storage_constraints), |
| 39 | + environment_pair=deepcopy(self.environment_pair), |
| 40 | + balance_pair=deepcopy(self.balance_pair), |
| 41 | + code=self.code, |
| 42 | + ) |
| 43 | + annotation.trace = self.trace |
| 44 | + return annotation |
0 commit comments