mirror of https://github.com/ConsenSys/mythril
Initial StateAnnotation Implementation (#762)
* Initial StateAnnotation Implementation * add function return type Co-Authored-By: JoranHonig <JoranHonig@users.noreply.github.com> * add return type to annotate Co-Authored-By: JoranHonig <JoranHonig@users.noreply.github.com> * Add return type to annotations Co-Authored-By: JoranHonig <JoranHonig@users.noreply.github.com> * add retyrn type to annotate Co-Authored-By: JoranHonig <JoranHonig@users.noreply.github.com> * add type hints to worldstate __init__ Co-Authored-By: JoranHonig <JoranHonig@users.noreply.github.com> * add return type to annotations Co-Authored-By: JoranHonig <JoranHonig@users.noreply.github.com> * style fixes * Add listpull/784/head
parent
7c2e60fede
commit
aafe06c0df
@ -0,0 +1,31 @@ |
|||||||
|
class StateAnnotation: |
||||||
|
""" |
||||||
|
The StateAnnotation class is used to persist information over traces. This allows modules to reason about traces |
||||||
|
without the need to traverse the state space themselves. |
||||||
|
""" |
||||||
|
|
||||||
|
@property |
||||||
|
def persist_to_world_state(self) -> bool: |
||||||
|
""" |
||||||
|
If this function returns true then laser will also annotate the world state. |
||||||
|
|
||||||
|
If you want annotations to persist through different user initiated message call transactions |
||||||
|
then this should be enabled. |
||||||
|
|
||||||
|
The default is set to False |
||||||
|
""" |
||||||
|
return False |
||||||
|
|
||||||
|
|
||||||
|
class NoCopyAnnotation(StateAnnotation): |
||||||
|
""" |
||||||
|
This class provides a base annotation class for annotations that shouldn't be copied on every new state. |
||||||
|
Rather the same object should be propagated. |
||||||
|
This is very useful if you are looking to analyze a property over multiple substates |
||||||
|
""" |
||||||
|
|
||||||
|
def __copy__(self): |
||||||
|
return self |
||||||
|
|
||||||
|
def __deepcopy__(self, _): |
||||||
|
return self |
Loading…
Reference in new issue