ivicanikolicsg / MAIAN

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

Error deploying contract: gas required exceeds allowance or always failing transaction #4

Closed kryptoklob closed 6 years ago

kryptoklob commented 6 years ago

Issue: I attempted to run the MAIAN tool on this contract. I copied the source code to unicorn_source.sol, and ran the following command:

python maian.py -s ~/unicorn_source.sol UnicornBreeding

Here is the output:

[ ] Compiling Solidity contract from the file /home/caleb/unicorn_source.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 Traceback (most recent call last):
  File "maian.py", line 177, in <module>
    main(sys.argv[1:])
  File "maian.py", line 120, in main
    if args.soliditycode:   contract_address = deploy_contract(args.soliditycode[1], MyGlobals.etherbase_account)
  File "/home/caleb/MAIAN/tool/contracts.py", line 92, in deploy_contract
    transaction_creation_hash = MyGlobals.web3.eth.sendTransaction( {'from':etherbase, 'data': ('0x' if byt[0:2]!='0x' else '') +byt } )
  File "/home/caleb/.local/lib/python2.7/site-packages/web3/eth.py", line 216, in sendTransaction
    get_buffered_gas_estimate(self.web3, transaction),
  File "/home/caleb/.local/lib/python2.7/site-packages/web3/utils/transactions.py", line 28, in get_buffered_gas_estimate
    gas_estimate = web3.eth.estimateGas(gas_estimate_transaction)
  File "/home/caleb/.local/lib/python2.7/site-packages/web3/eth.py", line 263, in estimateGas
    [transaction],
  File "/home/caleb/.local/lib/python2.7/site-packages/web3/manager.py", line 96, in request_blocking
    raise ValueError(response["error"])
ValueError: {u'message': u'gas required exceeds allowance or always failing transaction', u'code': -32000}

Is this a Python2.7 issue? I attempted to use Python 3, but I ran into dependency issues.

ivicanikolicsg commented 6 years ago

Fixed. It is not Python issue

kryptoklob commented 6 years ago

Works for me now, thanks @nusnikolic !