|
|
|
@ -1,6 +1,6 @@ |
|
|
|
|
import pytest |
|
|
|
|
from mythril.mythril import MythrilConfig, MythrilDisassembler |
|
|
|
|
|
|
|
|
|
from mythril.exceptions import CriticalError |
|
|
|
|
|
|
|
|
|
storage_test = [ |
|
|
|
|
( |
|
|
|
@ -20,6 +20,13 @@ storage_test = [ |
|
|
|
|
"0x0000000000000000000000000000000000000000000000000000000000000000", |
|
|
|
|
], |
|
|
|
|
), |
|
|
|
|
( |
|
|
|
|
["mapping", "4588934759847", "10"], |
|
|
|
|
[ |
|
|
|
|
"45998575720532480608987132552042185415362901038635143236141343153058112000553: " |
|
|
|
|
"0x0000000000000000000000000000000000000000000000000000000000000000" |
|
|
|
|
], |
|
|
|
|
), |
|
|
|
|
( |
|
|
|
|
["4588934759847", "1", "array"], |
|
|
|
|
[ |
|
|
|
@ -42,3 +49,21 @@ def test_get_data_from_storage(params, ans): |
|
|
|
|
for a, b in zip(outtext, ans): |
|
|
|
|
assert a == b |
|
|
|
|
assert outtext == ans |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
storage_test_extra_params = [ |
|
|
|
|
(["1", "2", "3", "4"]), |
|
|
|
|
(["mapping", "1"]), |
|
|
|
|
(["a", "b", "c"]), |
|
|
|
|
] |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@pytest.mark.parametrize("params", storage_test_extra_params) |
|
|
|
|
def test_get_data_from_storage_extra_params(params): |
|
|
|
|
config = MythrilConfig() |
|
|
|
|
config.set_api_rpc_infura() |
|
|
|
|
disassembler = MythrilDisassembler(eth=config.eth, solc_version="0.4.23") |
|
|
|
|
with pytest.raises(CriticalError): |
|
|
|
|
disassembler.get_state_variable_from_storage( |
|
|
|
|
"0x76799f77587738bfeef09452df215b63d2cfb08a", params |
|
|
|
|
) |
|
|
|
|