manticore icon indicating copy to clipboard operation
manticore copied to clipboard

Manticore throwing python "AttributeError: NoneType"

Open gh0st27 opened this issue 2 years ago • 7 comments

Summary of the problem

I am trying to run manticore against basic contract but it is not working and throwing following python exception. AttributeError: 'NoneType' object has no attribute 'result'

Manticore version

root@ghost-VirtualBox:/home/ghost/challange/Sale# manticore --version Manticore 0.3.6

Python version

root@ghost-VirtualBox:/home/ghost/challange/Sale# python3 --version Python 3.8.10

OS / Environment

root@ghost-VirtualBox:/home/ghost/challange/Sale# uname -a Linux ghost-VirtualBox 5.11.0-41-generic #45~20.04.1-Ubuntu SMP Wed Nov 10 10:20:10 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux

Dependencies

Step to reproduce the behavior

Run manticore against any contract results in error.

Expected behavior

Manitore should run without any error.

Actual behavior

Any relevant logs

root@ghost-VirtualBox:/home/ghost/challange/Sale# manticore . 2021-12-15 23:47:37,208: [18135] m.main:INFO: Registered plugins: IntrospectionAPIPlugin, <class 'manticore.ethereum.plugins.SkipRevertBasicBlocks'>, <class 'manticore.ethereum.plugins.FilterFunctions'> 2021-12-15 23:47:37,210: [18135] m.main:INFO: Beginning analysis 2021-12-15 23:47:37,212: [18135] m.e.manticore:INFO: Starting symbolic create contract 2021-12-15 23:48:03,559: [18135] m.e.manticore:INFO: Failed to build contract None Solidity file must contain exactly one contract or you must select one. Contracts found: Migrations, PrivateSale Process Process-9: Traceback (most recent call last): File "/usr/lib/python3.8/multiprocessing/process.py", line 315, in _bootstrap self.run() File "/usr/lib/python3.8/multiprocessing/process.py", line 108, in run self._target(*self._args, **self._kwargs) File "/usr/local/lib/python3.8/dist-packages/manticore/ethereum/manticore.py", line 1756, in worker_finalize finalizer(q.get_nowait()) File "/usr/local/lib/python3.8/dist-packages/manticore/ethereum/manticore.py", line 1747, in finalizer if only_alive_states and last_tx.result in {"REVERT", "THROW", "TXERROR"}: AttributeError: 'NoneType' object has no attribute 'result' 2021-12-15 23:48:03,704: [18135] m.c.manticore:INFO: Results in /home/ghost/challange/Sale/mcore_gvrdqlw4 2021-12-15 23:48:03,704: [18135] m.c.manticore:WARNING: Manticore failed to run

gh0st27 avatar Dec 15 '21 18:12 gh0st27

I'm encountering the same issue when running manticore against any contract (such as https://github.com/trailofbits/manticore/blob/master/examples/evm/umd_example.sol ), using the same Python & manticore version. Notably I'm using solidity 0.6.12 in case that matters.

2022-01-04 22:00:00,675: [15901] m.main:INFO: Registered plugins: IntrospectionAPIPlugin, <class 'manticore.ethereum.plugins.SkipRevertBasicBlocks'>, <class 'manticore.ethereum.plugins.FilterFunctions'>
2022-01-04 22:00:00,675: [15901] m.main:INFO: Beginning analysis
2022-01-04 22:00:00,676: [15901] m.e.manticore:INFO: Starting symbolic create contract
Process Process-6:
Traceback (most recent call last):
  File "/usr/lib/python3.8/multiprocessing/process.py", line 315, in _bootstrap
    self.run()
  File "/usr/lib/python3.8/multiprocessing/process.py", line 108, in run
    self._target(*self._args, **self._kwargs)
  File "/home/ubuntu/.local/lib/python3.8/site-packages/manticore/ethereum/manticore.py", line 1756, in worker_finalize
    finalizer(q.get_nowait())
  File "/home/ubuntu/.local/lib/python3.8/site-packages/manticore/ethereum/manticore.py", line 1747, in finalizer
    if only_alive_states and last_tx.result in {"REVERT", "THROW", "TXERROR"}:
AttributeError: 'NoneType' object has no attribute 'result'
2022-01-04 22:00:00,744: [15901] m.c.manticore:INFO: Results in /home/ubuntu/mcore_j6zdiclm
2022-01-04 22:00:00,745: [15901] m.c.manticore:WARNING: Manticore failed to run

nezza avatar Jan 04 '22 21:01 nezza

+1

I found a few things that helped here. The version of manticore, the version of crytic-compile, and the version of python.

I had to run a few permutations of all, since the documentation if a bit light on this. Try using python 3.6.5, and crytic-compile 0.2.1, and manticore 0.3.6

I also had an issue where the location of the contract was incorrect path. I still don't know why this was happening, but doing the above fixed it for me.

Jovonni avatar Jan 09 '22 19:01 Jovonni

Do you have enum and/or structs at file level in your projects?

fabianorodrigo avatar Mar 03 '22 21:03 fabianorodrigo

+1

I found a few things that helped here. The version of manticore, the version of crytic-compile, and the version of python.

I had to run a few permutations of all, since the documentation if a bit light on this. Try using python 3.6.5, and crytic-compile 0.2.1, and manticore 0.3.6

I also had an issue where the location of the contract was incorrect path. I still don't know why this was happening, but doing the above fixed it for me.

Hi, I just met the same problems... I've tried to switch my python interpreter to version 3.6.5 and crytic-compile 0.2.1, and manticore 0.3.6. But it still does not work. Do you have any further advice? Thank you very much. I just tried on my WSL with Ubuntu 20.04 LTS, I'm not sure about the potential incompatibility from WSL or Ubuntu versions.

CharesFang avatar May 20 '22 05:05 CharesFang

Hi everyone, I guess I have found the reason why we created a contract but got a None obj. It is due to insufficient balance of the owner account... We need to give a real big number to the owner balance, such as 10**20. I guess because the unit of the balance is Wei instead of eth

CharesFang avatar May 20 '22 08:05 CharesFang

I do suggest the Manticore developer should improve the error messages! That's really annoyed, and I just find a todo here, which might be probably neglected.

CharesFang avatar May 20 '22 08:05 CharesFang

@CharesFang you are my superman!!

sh1k4ku avatar Mar 06 '23 15:03 sh1k4ku