From 3d76f4e15fd1c9261b0548798c559e55ac715263 Mon Sep 17 00:00:00 2001 From: Bernhard Mueller Date: Mon, 30 Oct 2017 10:05:08 +0700 Subject: [PATCH] Update unit test --- myth | 2 +- mythril/disassembler/callgraph.py | 4 ++-- tests/svm_test.py | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/myth b/myth index 6cde6ffe..3eeec4e5 100755 --- a/myth +++ b/myth @@ -203,7 +203,7 @@ elif (args.graph) or (args.fire_lasers): if args.enable_physics is not None: physics = True - html = generate_callgraph(modules, args.enable_physics) + html = generate_callgraph(modules, contracts[0].address, args.enable_physics) try: with open(args.graph, "w") as f: diff --git a/mythril/disassembler/callgraph.py b/mythril/disassembler/callgraph.py index 499cd5f1..cf360d36 100644 --- a/mythril/disassembler/callgraph.py +++ b/mythril/disassembler/callgraph.py @@ -130,11 +130,11 @@ def serialize(_svm, color_map): -def generate_callgraph(modules, physics): +def generate_callgraph(modules, main_address, physics): _svm = svm.SVM(modules) - _svm.sym_exec() + _svm.sym_exec(main_address) i = 0 diff --git a/tests/svm_test.py b/tests/svm_test.py index 4050a339..ecaf943f 100644 --- a/tests/svm_test.py +++ b/tests/svm_test.py @@ -11,6 +11,6 @@ class SVMTestCase(unittest.TestCase): modules['0x0000000000000000000000000000000000000000'] = {'name': 'metaCoin', 'address': '0x0000000000000000000000000000000000000000', 'creation_code': '', 'code': '60606040526004361061004c576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806327e235e314610051578063412664ae1461009e575b600080fd5b341561005c57600080fd5b610088600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919050506100f8565b6040518082815260200191505060405180910390f35b34156100a957600080fd5b6100de600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610110565b604051808215151515815260200191505060405180910390f35b60006020528060005260406000206000915090505481565b6000816000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054101561016157600090506101fe565b816000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282540392505081905550816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282540192505081905550600090505b929150505600a165627a7a72305820fd4fa106da498514e90965a45ffecc1da53a0cd8bb7a7135910f8612245a46370029'} modules['0x0000000000000000000000000000000000000000']['disassembly'] = Disassembly(modules['0x0000000000000000000000000000000000000000']['code']) - html = generate_callgraph(modules, False) + html = generate_callgraph(modules, '0x0000000000000000000000000000000000000000', False) self.assertTrue("var nodes = [\n{id: \'metaCoin:" in html)