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

Refactor generate_testcase events and fix eth verbose trace plugin #1305

Merged
merged 11 commits into from Dec 17, 2018

Conversation

Projects
None yet
2 participants
@disconnect3d
Copy link
Contributor

disconnect3d commented Dec 14, 2018

This PR fixes VerboseTrace plugin for ethereum and adds a testcase for it.

It also refactors some small parts of code and refactors/changes things a bit.

Important changes

  1. VerboseTrace ethereum plugin saves output to <testcase>.verbose_trace for each generated testcase.

  2. The Generated testcase No. X - MSG message is now generated by ManticoreBase and so is standarized between ethereum and native.

  3. The will_generate_testcase_callback interface/arguments has been changed from: state, test_id, msg to state, testcase, msg. This is because:

  • as a test_id we passed a name or prefix instead of id (I'd assume e.g. a number or something unique). Second of all, we now pass a Testcase object
  • it also enables plugins to write output for a given generated testcase (see how VerboseTrace does that).
  1. The Executor class does not publish will_generate_testcase event anymore and instead forwards testcase generation to ManticoreBase through a internal_generate_testcase event. This event SHALL NEVER be used externally. When ManticoreBase receives it, it creates a Testcase object and publishes a will_generate_testcase event sending this testcase instance to the clients.

  2. Removed State.generate_testcase. Note that a testcase can still be generated in two ways:

  • by using Executor.generate_testcase - this is used internally by Executor.run to generate testcases for a terminated state and solver errors EDIT: Removed
  • by using ManticoreEVM.generate_testcase(self, state, message='', only_if=None, name='user') which is used by scripts to check smart contracts. As a result, there is no way to generate a testcase for native stuff. Is that okay? Shall we move this to ManticoreBase?

Refactoring changes

  1. The self.last_reg_state = {} attribute of Plugin class is never used and has been removed.

  2. Removed inheritance from object - an old thing from Python 2, not needed in Python 3.

  3. Added some comments to Solver._init to make it more explicit what is it and what is it for.


This change is Reviewable

disconnect3d added some commits Dec 13, 2018

WIP

@disconnect3d disconnect3d requested review from feliam , yan and mossberg Dec 14, 2018

disconnect3d added some commits Dec 14, 2018

Merge branch 'master' into eth-verbose-trace-plugin
* master:
  Fix logging regressions (#1304)
Show resolved Hide resolved manticore/core/executor.py Outdated
Show resolved Hide resolved manticore/core/manticore.py Outdated

@disconnect3d disconnect3d changed the title Eth verbose trace plugin Refactor generate_testcase and fix eth verbose trace plugin Dec 17, 2018

@disconnect3d disconnect3d changed the title Refactor generate_testcase and fix eth verbose trace plugin Refactor generate_testcase events and fix eth verbose trace plugin Dec 17, 2018

@disconnect3d disconnect3d merged commit 580b358 into master Dec 17, 2018

5 checks passed

codeclimate 1 fixed issue
Details
codeclimate/total-coverage 70% (0.0% change)
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
continuous-integration/travis-ci/push The Travis CI build passed
Details
license/cla Contributor License Agreement is signed.
Details

@disconnect3d disconnect3d deleted the eth-verbose-trace-plugin branch Dec 17, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment