mirror of https://github.com/ConsenSys/mythril
blockchainethereumsmart-contractssoliditysecurityprogram-analysissecurity-analysissymbolic-execution
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
35 lines
879 B
35 lines
879 B
from mythril.laser.ethereum.taint_analysis import *
|
|
from mythril.laser.ethereum.state import GlobalState
|
|
|
|
|
|
def test_result_state():
|
|
# arrange
|
|
taint_result = TaintResult()
|
|
record = TaintRecord()
|
|
state = GlobalState(2, None, None)
|
|
state.mstate.stack = [1, 2, 3]
|
|
record.add_state(state)
|
|
record.stack = [False, False, False]
|
|
# act
|
|
taint_result.add_records([record])
|
|
tainted = taint_result.check(state, 2)
|
|
|
|
# assert
|
|
assert tainted is False
|
|
assert record in taint_result.records
|
|
|
|
|
|
def test_result_no_state():
|
|
# arrange
|
|
taint_result = TaintResult()
|
|
record = TaintRecord()
|
|
state = GlobalState(2, None, None)
|
|
state.mstate.stack = [1, 2, 3]
|
|
|
|
# act
|
|
taint_result.add_records([record])
|
|
tainted = taint_result.check(state, 2)
|
|
|
|
# assert
|
|
assert tainted is None
|
|
assert record in taint_result.records
|
|
|