Get contract size from infura for EXTCODESIZE

pull/307/head
Nikhil Parasaram 6 years ago
parent 9d01a6107a
commit baa67f6ebe
  1. 18
      mythril/laser/ethereum/svm.py

@ -1,4 +1,5 @@
from mythril.laser.ethereum import helper, natives
from mythril import mythril
from ethereum import utils
from enum import Enum
from flags import Flags
@ -677,7 +678,22 @@ class LaserEVM:
elif op == 'EXTCODESIZE':
addr = state.stack.pop()
state.stack.append(BitVec("extcodesize", 256))
myth = mythril.Mythril()
try:
myth.set_api_rpc_infura()
except Exception as e:
logging.info("Error while connecting to infura")
state.stack.append(BitVec("extcodesize", 256))
continue
try:
_, code = myth.load_from_address(hex(helper.get_concrete_int(addr)))
except AttributeError:
logging.info("EXTCODECOPY is called with symbolic addr")
state.stack.append(BitVec("extcodesize", 256))
continue
state.stack.append(len(code.code) // 2)
elif op == 'EXTCODECOPY':
# Not implemented

Loading…
Cancel
Save