Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NotImplementedError: __bool__ for Bool #1005

Open
evanpjensen opened this issue Jul 31, 2018 · 1 comment
Open

NotImplementedError: __bool__ for Bool #1005

evanpjensen opened this issue Jul 31, 2018 · 1 comment

Comments

@evanpjensen
Copy link
Contributor

OS / Environment

Distributor ID: Ubuntu
Description: Ubuntu 18.04.1 LTS
Release: 18.04
Codename: bionic

Manticore version

59a5ff0

Python version

Python 3.6.5

Summary of the problem

A shift where the right operand is symbolic can cause Manticore to error.

Step to reproduce the behavior

Run Manticore with no arguments on the following contract:

contract Contract {
  function shift(uint8 s) public pure returns(uint){
    return uint(1) << s;
  }
}

Expected behavior

No error

Actual behavior

Error

Any relevant logs

2018-07-31 00:17:33,471: [34152] m.main:INFO: Beginning analysis
2018-07-31 00:17:33,475: [34152] m.ethereum:INFO: Starting symbolic create contract
2018-07-31 00:17:33,707: [34152] m.ethereum:INFO: Starting symbolic transaction: 0
2018-07-31 00:17:34,780: [34152] m.c.executor:ERROR: Exception: __bool__ for Bool
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/dist-packages/manticore-0.1.10-py3.6.egg/manticore/core/executor.py", line 467, in run
    if not current_state.execute():
  File "/usr/local/lib/python3.6/dist-packages/manticore-0.1.10-py3.6.egg/manticore/core/state.py", line 127, in execute
    result = self._platform.execute()
  File "/usr/local/lib/python3.6/dist-packages/manticore-0.1.10-py3.6.egg/manticore/platforms/evm.py", line 1862, in execute
    self.current_vm.execute()
  File "/usr/local/lib/python3.6/dist-packages/manticore-0.1.10-py3.6.egg/manticore/platforms/evm.py", line 659, in execute
    result = self._handler(*arguments)
  File "/usr/local/lib/python3.6/dist-packages/manticore-0.1.10-py3.6.egg/manticore/platforms/evm.py", line 627, in _handler
    return implementation(*arguments)
  File "/usr/local/lib/python3.6/dist-packages/manticore-0.1.10-py3.6.egg/manticore/platforms/evm.py", line 827, in EXP
    self._consume(EXP_SUPPLEMENTAL_GAS * nbytes(exponent))
  File "/usr/local/lib/python3.6/dist-packages/manticore-0.1.10-py3.6.egg/manticore/platforms/evm.py", line 824, in nbytes
    if e >> (i * 8) == 0:
  File "/usr/local/lib/python3.6/dist-packages/manticore-0.1.10-py3.6.egg/manticore/core/smtlib/expression.py", line 131, in __bool__
    raise NotImplementedError("__bool__ for Bool")
NotImplementedError: __bool__ for Bool
@feliam
Copy link
Contributor

feliam commented Jul 31, 2018

Related to #921, #727

disconnect3d added a commit that referenced this issue Jan 21, 2019
Adds support for EXP aka POW, with concrete or solvable exponent, fixing #1005 effectively.

Not sure if we can do it any better - it seems z3 doesn't have exp/pow for bitvectors.
@ehennenfent ehennenfent added this to the Engine Refining milestone Jan 23, 2019
disconnect3d added a commit that referenced this issue Feb 11, 2019
* EVM: Add support for EXP with concrete/solvable exponent

Adds support for EXP aka POW, with concrete or solvable exponent, fixing #1005 effectively.

Not sure if we can do it any better - it seems z3 doesn't have exp/pow for bitvectors.

* Update operators.py

* Update evm.py

* Use concretized_args

* Move Operators.POW to EVM._exp

* Extend travis wait for output to 30m

* Extend travis build to 60m...

* Fix Operators.ITE -> Operators.ITEBV

* Split ethereum travis job to two jobs

* EVM.EXP: concretize base=SAMPLED

* Fix concrete tests: use to_constant

* Fix set storage in concrete tests
ehennenfent pushed a commit that referenced this issue May 17, 2019
* Add assertions to auto test gen

* Add symbolic tests

* Make calldata symbolic

* EVM: Support exp aka pow (#1361)

* EVM: Add support for EXP with concrete/solvable exponent

Adds support for EXP aka POW, with concrete or solvable exponent, fixing #1005 effectively.

Not sure if we can do it any better - it seems z3 doesn't have exp/pow for bitvectors.

* Update operators.py

* Update evm.py

* Use concretized_args

* Move Operators.POW to EVM._exp

* Extend travis wait for output to 30m

* Extend travis build to 60m...

* Fix Operators.ITE -> Operators.ITEBV

* Split ethereum travis job to two jobs

* EVM.EXP: concretize base=SAMPLED

* Fix concrete tests: use to_constant

* Fix set storage in concrete tests

* Split ethereum_vm tests into concrete and symbolic

* Fix travis tests

* Split symbolic tests into two jobs

* Split VMTests even more

* More tests split

* [WIP][WIP][WIP] Moving executor functionality to ManticoreBase and refactor concurrency shared data

* Workspace locks

* Concurrency flavor configurable from commandline

* Asserts and refactorrrrrrrs

* Remove unused callback

* Some CC

* Some CC

* Some CC

* Fix solver vs Z3Solver

* Make solver a singleton based on tid/pid. REfactor m._save. Fix some tests

* typo and evm bugfix

* Fix some tests referecing global solver

* Fix concolic tests and more global solver refs

* Fix tests

* CC fixes

* Fix tests. Fix testcase id generation

* Move profiling to a plugin and fix tests

* Add solver intance ref to mem test

* Fix mem workspace tests

* Fix output checking tests

* Fix z3solver ref

* Relax verbosity/log tests

* Moved Workers to its own file

* Relax output tests

* Relax output tests

* Fix profiling test

* Fix more tests

* Default multiprocessing

* Try to clean mcore __del__

* Change Worker life span

* Fix Single mode

* CC

* revert verbosity travis

* CC and solver ref fix

* Relax ouput checking tests and some bugfixes

* running -> ready

* Fixing teeests

* add weak cache to _load

* del debug prints

* Adding config.py support for Enums

* Try/Remove generate_testcase event as it never occurs online. Fix tests

* Fix CC

* Kill the cache when start/stop run. Remove debugprints. clean tests

* Fix travis test _other_

* Fix native tests and timeout

* Fix state.must_be_true

* fix CC

* Changing fstat tets...:
~'

* LLLLLLLLinux tests

* Skip unicorn concrete test for now

* Try fix CodeClimate

* Try fix CodeClimate

* Update evm examples to newest solidity

* Complete transformation of consts.mprocessing to enum

* Add blank line (codeclimate)

* Using the enum instead of the string

* Using the enum instead of the string

* Merge and fix

* CC and debug print

* Move fee consumption to checkpoint so it is not done twice. Fix frontier test generator

* Fix Job Count (and force travis rebuild)

```
0.02s$ ./cc-test-reporter sum-coverage --output - --parts $JOB_COUNT coverage/codeclimate.*.json | ./cc-test-reporter upload-coverage --input -
Error: expected 3 parts, received 4 parts
```

* Add tx number to testcase log

* Del test verbosity
ehennenfent added a commit that referenced this issue May 21, 2019
* Add assertions to auto test gen

* Add symbolic tests

* Make calldata symbolic

* EVM: Support exp aka pow (#1361)

* EVM: Add support for EXP with concrete/solvable exponent

Adds support for EXP aka POW, with concrete or solvable exponent, fixing #1005 effectively.

Not sure if we can do it any better - it seems z3 doesn't have exp/pow for bitvectors.

* Update operators.py

* Update evm.py

* Use concretized_args

* Move Operators.POW to EVM._exp

* Extend travis wait for output to 30m

* Extend travis build to 60m...

* Fix Operators.ITE -> Operators.ITEBV

* Split ethereum travis job to two jobs

* EVM.EXP: concretize base=SAMPLED

* Fix concrete tests: use to_constant

* Fix set storage in concrete tests

* Split ethereum_vm tests into concrete and symbolic

* Fix travis tests

* Split symbolic tests into two jobs

* Split VMTests even more

* More tests split

* [WIP][WIP][WIP] Moving executor functionality to ManticoreBase and refactor concurrency shared data

* Workspace locks

* Concurrency flavor configurable from commandline

* Asserts and refactorrrrrrrs

* Remove unused callback

* Some CC

* Some CC

* Some CC

* Fix solver vs Z3Solver

* Make solver a singleton based on tid/pid. REfactor m._save. Fix some tests

* typo and evm bugfix

* Fix some tests referecing global solver

* Fix concolic tests and more global solver refs

* Fix tests

* CC fixes

* Fix tests. Fix testcase id generation

* Move profiling to a plugin and fix tests

* Add solver intance ref to mem test

* Fix mem workspace tests

* Fix output checking tests

* Fix z3solver ref

* Relax verbosity/log tests

* Moved Workers to its own file

* Relax output tests

* Relax output tests

* Fix profiling test

* Fix more tests

* Default multiprocessing

* Try to clean mcore __del__

* Change Worker life span

* Fix Single mode

* CC

* revert verbosity travis

* CC and solver ref fix

* Relax ouput checking tests and some bugfixes

* running -> ready

* Fixing teeests

* add weak cache to _load

* del debug prints

* Adding config.py support for Enums

* Try/Remove generate_testcase event as it never occurs online. Fix tests

* Fix CC

* Kill the cache when start/stop run. Remove debugprints. clean tests

* Fix travis test _other_

* Fix native tests and timeout

* Fix state.must_be_true

* fix CC

* Changing fstat tets...:
~'

* LLLLLLLLinux tests

* Skip unicorn concrete test for now

* Try fix CodeClimate

* Try fix CodeClimate

* Update evm examples to newest solidity

* Complete transformation of consts.mprocessing to enum

* Add blank line (codeclimate)

* Using the enum instead of the string

* Using the enum instead of the string

* Merge and fix

* CC and debug print

* Move fee consumption to checkpoint so it is not done twice. Fix frontier test generator

* Fix Job Count (and force travis rebuild)

```
0.02s$ ./cc-test-reporter sum-coverage --output - --parts $JOB_COUNT coverage/codeclimate.*.json | ./cc-test-reporter upload-coverage --input -
Error: expected 3 parts, received 4 parts
```

* Add tx number to testcase log

* Attempt to do vmtests on the fly

* Del test verbosity

* Update .travis.yml

Co-Authored-By: Eric Hennenfent <ecapstone@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants