-
Notifications
You must be signed in to change notification settings - Fork 153
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
Create similar interface to ethereum.tools.tester
#156
Comments
Have you looked into doing this using web3.py? https://web3py.readthedocs.io/en/latest/examples.html#contract-unit-tests-in-python I'm closing as wontfix but only because I don't believe this functionality belongs in this specific library. I'd still like to understand your use case and understand whether we have tooling and documentation to accommodate it. |
I am just looking for something which is either compatible with or as easy to use as However, PyEthereum seems unmaintained... |
We've intentionally left compilation out of web3.py so that's a complicated one. It turns out that maintaining code that does compilation that handles anything other than the most trivial cases is costly. We've experimented with the concept in some places like Is there more than the compilation part? @njgheorghita wanna chime in on any specifics about where our efforts on doing compilation in the context of testing ended up or whether any of the ethpm work you've done might help here. |
ya, I think I'm just gonna give up on this for now. Web3.py is a pain to use, and py-evm won't deploy my contract:
*rolleyes* wtf Neither eth-tester or py-evm seem to provide a nice way of emitting an opcode trace to find out why. At least with PyEthereum I can turn logging on, but I can't even seem to do that for py-evm. And the examples for Web3.py are outdated and APIs expose way too much of the internals so they break at every revision. It's a shame, the workflow for PyEthereum was really simple to use and let me write unittests for Solidity code in Python without needing hundreds of lines of bootstrap code. |
@HarryR I'm sorry your experience has been what it is. I've spoken with @kclowes who's leading development of the web3 library that we've got some shortcomings to address with respect to the things you've surfaced. Here's my take-away at what we're going to try to make better.
If you want to try and get at the trace logs, I think you can get there with something close to the following. import logging
logger = logging.getLogger('eth')
logger.setLevel(0) # might also work at 5 or 8, can't remember which is our DEBUG2 log level You may also need to hook the logger up to the stdout stream or something to get at the logs. |
The
ethereum.tools.tester
interface is really useful, it allows me to provide the source code for a smart-contract, have it automatically compiled, then interact with it as if it were a normal object.This is documented at: https://github.com/ethereum/pyethereum/wiki/Using-pyethereum.tester
I think this is an invaluable component of the Python Ethereum ecosystem, but PyEthereum doesn't support the new opcodes (which are emitted as part of the standard prelude by the Solidity 0.5.x compiler), and
eth-tester
is not just incompatible withethereum.tools.tester
but doesn't provide an easy to use wrapper interface.Cross-posting from the PyEthereum issue: ethereum/pyethereum#897
Example:
The text was updated successfully, but these errors were encountered: