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

Add py-revm as an alternative to pyevm #104

Open
bout3fiddy opened this issue Nov 8, 2023 · 8 comments
Open

Add py-revm as an alternative to pyevm #104

bout3fiddy opened this issue Nov 8, 2023 · 8 comments
Assignees
Labels
enhancement New feature or request

Comments

@bout3fiddy
Copy link
Contributor

The default evm backend for titanoboa is: pyevm

This issue is a wishlist to introduce pyrevm as an alternative backend to pyevm.

The objective is to add pyrevm as an alternative backend. This would mean that the user would have access to pyevm as well.

My concern is: pyevm is quite simple: it's just a pip install py-evm and you're good to go. With revm, one would need to install revm and then py-revm and that might just be an additional layer of friction. Is this an over-concern?

@charles-cooper
Copy link
Member

@bout3fiddy i think the UX issue is an over-concern. i think the concept of installing an alternative backend to get some particular feature (or performance boost, as is the case here) is pretty understandable

@DanielSchiavini
Copy link
Collaborator

I don't know how much work is involved in extracting the interface with the backend to some interface that can be injected. It sounds like a good idea to make this configurable by environment, considering other backends might evolve in the future.

@charles-cooper
Copy link
Member

@DanielSchiavini mostly, i have been inheriting from Environment and overriding deploy_code and execute_code. this is kind of the high level API that i expect most backends can conform to. there are a few things which we rely on monkey-patching py-evm for though, which might take some finagling to get pyrevm to do the same.

@DanielSchiavini
Copy link
Collaborator

If that part of the work would need to be done anyway to get pyrevm working.. is there a reason to drop pyevm?

@charles-cooper
Copy link
Member

i'm not sure we want to drop py-evm since it's still very monkey-patchable. i think it's useful to have the backend be pluggable. for instance, if pyrevm doesn't have the same functionality as py-evm, we might want to have "enable pyrevm but at the cost of features" type functionality.

@bout3fiddy
Copy link
Contributor Author

bout3fiddy commented Nov 9, 2023

I'm sort of imagining the UX to be a bit like:

from boa import set_env
from boa.evm import pyrevm, pyevm  # here we're refactoring different backends into an 'evm' folder
# from boa.evm import halmos  # maybe this is possible one day too?

# set pyevm backend:
# boa.set_env(pyevm.Env())  # this is default so user doesn't necessarily need to set it explicitly

# set pyrevm backend:
boa.set_env(pyrevm.Env())  # this must be explicitly set to enable revm

...

contract = boa.loads("..../SomeContract.vy") 
boa.env.set_balance(contract, 100)  # add 100 ETH to contract

The api for set_balance is similar already: https://github.com/gakonst/pyrevm/blob/6554e943c9e2d8aa23ea2cabfeda7fcaa348d8ed/pytest/test.py#L63

How does this look/feel ?

@bout3fiddy bout3fiddy added the enhancement New feature or request label Nov 20, 2023
@charles-cooper
Copy link
Member

https://twitter.com/rakitadragan/status/1745632344873030049 -- revm seems patchable now(!)

@DanielSchiavini
Copy link
Collaborator

@bout3fiddy is a basic implementation useful for you guys? That should be easy - pyrevm works well with the Vyper pipelines. But that misses some features compared with boa+pyevm.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants