mirror of https://github.com/ConsenSys/mythril
Add partial abi support (#1655)
* Fix issues with arbitrary jump dest * Support abi * Add partial abi support * Fix test * Fix test directorypull/1662/head
parent
842e3da3a4
commit
d6e8813100
@ -0,0 +1,56 @@ |
||||
import pytest |
||||
|
||||
from mythril.analysis.report import Issue |
||||
from mythril.disassembler.disassembly import Disassembly |
||||
from mythril.laser.ethereum.state.environment import Environment |
||||
from mythril.laser.ethereum.state.account import Account |
||||
from mythril.laser.ethereum.state.machine_state import MachineState |
||||
from mythril.laser.ethereum.state.global_state import GlobalState |
||||
from mythril.laser.ethereum.state.world_state import WorldState |
||||
from mythril.laser.ethereum.instructions import Instruction |
||||
from mythril.laser.ethereum.transaction.transaction_models import MessageCallTransaction |
||||
from mythril.laser.smt import symbol_factory, simplify, LShR |
||||
|
||||
|
||||
test_data = ( |
||||
( |
||||
"0xa9059cbb000000000000000000000000010801010101010120020101020401010408040402", |
||||
"func(uint256,uint256)", |
||||
( |
||||
5887484186314823854737699484601117092168074244, |
||||
904625697166532776746648320380374280103671755200316906558262375061821325312, |
||||
), |
||||
), |
||||
( |
||||
"0xa9059cbb00000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000002", |
||||
"func(uint256,uint256)", |
||||
(2, 2), |
||||
), |
||||
( |
||||
"0xa0cce1b3000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000090000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000005000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000", |
||||
"func(bytes32,(bytes32,bytes32,uint8,uint8)[],(address[],uint32))", |
||||
( |
||||
b"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02", |
||||
( |
||||
( |
||||
b"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", |
||||
b"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x90", |
||||
0, |
||||
0, |
||||
), |
||||
( |
||||
b"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00P\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", |
||||
b"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", |
||||
1, |
||||
0, |
||||
), |
||||
), |
||||
(("0x0000000000000000000000000000000000000000",), 0), |
||||
), |
||||
), |
||||
) |
||||
|
||||
|
||||
@pytest.mark.parametrize("call_data, signature, expected", test_data) |
||||
def test_abi_decode(call_data, signature, expected): |
||||
assert Issue.resolve_input(call_data, signature) == expected |
Loading…
Reference in new issue