ivicanikolicsg / MAIAN

MAIAN: automatic tool for finding trace vulnerabilities in Ethereum smart contracts
MIT License
556 stars 157 forks source link

TypeError: __deepcopy__() takes exactly 1 argument (2 given) #6

Closed kryptoklob closed 6 years ago

kryptoklob commented 6 years ago

When attempting to analyze this contract from source for Prodigal vulnerabilities, I get the following error:

python maian.py -s ~/powh.sol PowhCoin3 -c 1

====================================================================================================
[ ] Compiling Solidity contract from the file /home/caleb/powh.sol ...  Done 
/home/caleb/.local/lib/python2.7/site-packages/web3/main.py:130: DeprecationWarning: Python 2 support is ending! Please upgrade to Python 3 promptly. Support will end at the beginning of 2018.
  category=DeprecationWarning,
/home/caleb/.local/lib/python2.7/site-packages/web3/main.py:130: DeprecationWarning: Python 2 support is ending! Please upgrade to Python 3 promptly. Support will end at the beginning of 2018.
  category=DeprecationWarning,
[ ] Connecting to PRIVATE blockchain emptychain  ... ESTABLISHED 
[ ] Sending Ether to contract 0x9e536236abf2288a7864c6a1afaa4cb98d464306  ..... tx[0] mined  Sent! 
[ ] Deploying contract ....... confirmed at address: 0x9E536236ABF2288a7864C6A1AfaA4Cb98D464306 
[ ] Contract code length on the blockchain :    11184  : 0x60606040526004361061011d5760... 
[ ] Contract address saved in file: ./out/PowhCoin3.address 
[ ] The contract balance: 44   Positive balance
[ ] Check if contract is PRODIGAL

[ ] Contract address   : 0x9E536236ABF2288a7864C6A1AfaA4Cb98D464306
[ ] Contract bytecode  : 60606040526004361061011d576000357c0100000000000000...
[ ] Bytecode length    : 11182
[ ] Blockchain contract: True
[ ] Debug              : False

[ ] Search with call depth: 1   : Traceback (most recent call last):
  File "maian.py", line 182, in <module>
    main(sys.argv[1:])
  File "maian.py", line 143, in main
    elif 1== MyGlobals.checktype: ret = check_leak.check_one_contract_on_ether_leak(code, contract_address, MyGlobals.debug, MyGlobals.read_from_blockchain, True, fhashes)
  File "/home/caleb/MAIAN/tool/check_leak.py", line 105, in check_one_contract_on_ether_leak
    run_one_check( i, ops, contract_address, debug, read_from_blockchain )
  File "/home/caleb/MAIAN/tool/check_leak.py", line 77, in run_one_check
    execute_one_block(ops,stack,0, trace, storage, mmemory, data, configurations,  ['CALL','SUICIDE'], ether_leak, 0, 0, debug, read_from_blockchain )
  File "/home/caleb/MAIAN/tool/execute_block.py", line 88, in execute_one_block
    newpos, halt = execute( ops, stack, pos, storage, mmemory, data, trace, calldepth, debug, read_from_blockchain  )
  File "/home/caleb/MAIAN/tool/execute_instruction.py", line 429, in execute
    t = copy.deepcopy( args[1] )
  File "/usr/lib/python2.7/copy.py", line 163, in deepcopy
    y = copier(x, memo)
  File "/usr/lib/python2.7/copy.py", line 257, in _deepcopy_dict
    y[deepcopy(key, memo)] = deepcopy(value, memo)
  File "/usr/lib/python2.7/copy.py", line 163, in deepcopy
    y = copier(x, memo)
  File "/usr/lib/python2.7/copy.py", line 285, in _deepcopy_inst
    return x.__deepcopy__(memo)
TypeError: __deepcopy__() takes exactly 1 argument (2 given)
fmgoncalves commented 6 years ago

I ran into the same issue and found out it is a bug in one of the dependencies, z3. I already made a PR for it, so if you re-install Z3 from my fork, MAIAN should work :)

gundas commented 6 years ago

It works after updating Z3. Thanks!

fmgoncalves commented 6 years ago

Z3 already merged the fix, so it's safe to close this issue now @MAIAN-tool @nusnikolic