THIS LIBRARY IS NO LONGER MAINTAINED
ethereum / populus Goto Github PK
View Code? Open in Web Editor NEWThe Ethereum development framework with the most cute animal pictures
Home Page: http://populus.readthedocs.org/
The Ethereum development framework with the most cute animal pictures
Home Page: http://populus.readthedocs.org/
THIS LIBRARY IS NO LONGER MAINTAINED
Implement a backend system for the geth
related stuff. This will allow for pluggable backends like parity or cpp-ethereum.
This abstraction already partially exists in the populus.chain.Chain
class
put a cute animal picture here.
Hi,
When I attempt to run the unit tests via tox in a Debian-based host, the solidity compiler tests fail because my solc compiler has a slightly different version number and library references. Please see the attached log.
is it available ?
All of the documentation for populus deploy
needs to be updated in docs/deploy.rst
I'm trying to use populus in a flask app, "loading" the contracts and got this error, maybe the error is related to a misuse of the framework dunno, but if not I got a simple fix pushed on my fork :
File "/home/lotso/PycharmProjects/populus/populus/contracts/core.py", line 24, in __str__
return "{name}({address})".format(name=self.__class__.__name__, address=self._address)
this is how I try to get the contract
@app.route('/index')
def index():
try:
client = Client('127.0.0.1', '8545')
project_dir = os.path.abspath('/home/lotso/PycharmProjects/')
contracts_meta = utils.load_contracts(project_dir)
context = {
'contracts': package_contracts(contracts_meta),
'client': client,
}
contracts = context['contracts']
contract = contracts.MyContractTest(CONTRACT_ADDRESS, client)
e = None
except:
pass
return render_template('index.html', client=contract)
put a cute animal picture here.
Got the same error for commands:
$ populus deploy -d
$ populus chain run
(populus) petr@Lenovo-3000-G550:~/Projects/populus$ populus deploy -d
Traceback (most recent call last):
File "/home/petr/Projects/Venvs/populus/bin/populus", line 11, in <module>
sys.exit(main())
File "/home/petr/Projects/Venvs/populus/local/lib/python2.7/site-packages/click/core.py", line 716, in __call__
return self.main(*args, **kwargs)
File "/home/petr/Projects/Venvs/populus/local/lib/python2.7/site-packages/click/core.py", line 696, in main
rv = self.invoke(ctx)
File "/home/petr/Projects/Venvs/populus/local/lib/python2.7/site-packages/click/core.py", line 1060, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/home/petr/Projects/Venvs/populus/local/lib/python2.7/site-packages/click/core.py", line 889, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/home/petr/Projects/Venvs/populus/local/lib/python2.7/site-packages/click/core.py", line 534, in invoke
return callback(*args, **kwargs)
File "/home/petr/Projects/Venvs/populus/local/lib/python2.7/site-packages/populus/cli/deploy_cmd.py", line 113, in deploy
ensure_account_exists(dry_run_data_dir)
File "/home/petr/Projects/Venvs/populus/local/lib/python2.7/site-packages/populus/geth.py", line 271, in ensure_account_exists
accounts = get_geth_accounts(data_dir)
File "/home/petr/Projects/Venvs/populus/local/lib/python2.7/site-packages/populus/geth.py", line 234, in get_geth_accounts
raise subprocess.CalledProcessError(1, ' '.join(command))
subprocess.CalledProcessError: Command 'nice -n 20 geth --genesis /home/petr/Projects/Venvs/populus/local/lib/python2.7/site-packages/populus/genesis-test.json --datadir /home/petr/Projects/populus/chains/default --maxpeers 0 --networkid 123456 --port 37285 --ipcpath /tmp/tmpm5cVvH --shh --rpcapi db,eth,net,web3,shh --minerthreads 1 --unlock 0 --password /home/petr/Projects/Venvs/populus/local/lib/python2.7/site-packages/populus/default_blockchain_password --nodiscover account list' returned non-zero exit status 1
Support for Mutan compilation
The Project
class should allow overriding all of its various properties and methods from the populus.ini
file.
when running populus web runserver I got this error that the libraries folder doesn't exist.
➜ testpopulus populus web runserver
Compiling contracts...
Compiling contracts.js...
Collectind static assets...
Traceback (most recent call last):
File "/usr/local/bin/populus", line 11, in <module>
sys.exit(main())
File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 716, in __call__
return self.main(*args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 696, in main
rv = self.invoke(ctx)
File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 1060, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 1060, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 889, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 534, in invoke
return callback(*args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/populus/cli/web_cmd.py", line 95, in web_runserver
contracts_observer_thread.start()
File "/usr/local/lib/python2.7/dist-packages/watchdog/observers/api.py", line 255, in start
emitter.start()
File "/usr/local/lib/python2.7/dist-packages/watchdog/utils/__init__.py", line 111, in start
self.on_thread_start()
File "/usr/local/lib/python2.7/dist-packages/watchdog/observers/polling.py", line 77, in on_thread_start
self._snapshot = self._take_snapshot()
File "/usr/local/lib/python2.7/dist-packages/watchdog/observers/polling.py", line 74, in <lambda>
self.watch.path, self.watch.is_recursive, stat=stat, listdir=listdir)
File "/usr/local/lib/python2.7/dist-packages/watchdog/utils/dirsnapshot.py", line 207, in __init__
st = stat(path)
OSError: [Errno 2] No such file or directory: '/home/lotso/PycharmProjects/testpopulus/libraries'
I got no issue to do a little mkdir libraries but it would be simpler imho to create it with the init command.
Currently the runserver command doesn't spin up an RPC server. It should.
Concept for a new feature that sits somewhere in the middle of deploy
and migrate
. These would be pre-written scripts that can be executed from the command line. They are provided with full access to the project/chain/web3
objects as necessary. The idea is that there are programatic things that the user may want to do like querying for event logs. One prime example use case is the logic contained in ethereum-alarm-clock-client
. Ideally, that entire codebase would become a script within the ethereum-alarm-clock
codebase.
project
, chain
, and web3
objects.put a cute animal picture here.
Currently populous only looks in one single directory for contracts. This is dumb. You should be able to have a bunch of directories.
contract_dirs
and convert populus to search all of the provided directories.populus.ini
currently events are not implemented at all. They need to be.
When I attempt to run 'python setup.py install' from the repo, it seems to fail on the ethereum-ipc/rpc-client packages:
$> git pull origin master
$> mkdir depl
$> virtualenv depl/pop
$> source depl/pop/bin/activate
$> python setup.py install -v
...
Installed /home/user/src/populus/depl/pop/lib/python2.7/site-packages/ethereum-1.0.8-py2.7.egg
Searching for ethereum-ipc-client>=0.1.1
Reading https://pypi.python.org/simple/ethereum-ipc-client/
Found link: https://pypi.python.org/packages/any/e/ethereum-ipc-client/ethereum-ipc-client-0.1.0.macosx-10.11-x86_64.tar.gz#md5=c2950da8a0fda05253cc7fa70f73df68
Found link: https://pypi.python.org/packages/any/e/ethereum-ipc-client/ethereum-ipc-client-0.1.1.macosx-10.11-x86_64.tar.gz#md5=8fd7db4d539ce1d700fd15d17438c5c9
Found link: https://pypi.python.org/packages/any/e/ethereum-ipc-client/ethereum-ipc-client-0.1.2.macosx-10.11-x86_64.tar.gz#md5=aa5134ac45149483828809f8be92729b
Found link: https://pypi.python.org/packages/source/e/ethereum-ipc-client/ethereum-ipc-client-0.1.0.tar.gz#md5=fc9ce05a79a399ef131028233f63f71e
Found link: https://pypi.python.org/packages/source/e/ethereum-ipc-client/ethereum-ipc-client-0.1.1.tar.gz#md5=57efbe5c2883618798fb6388e8016226
Found link: https://pypi.python.org/packages/source/e/ethereum-ipc-client/ethereum-ipc-client-0.1.2.tar.gz#md5=4a5727fe1bc27986f47239720a66fc7f
Best match: ethereum-ipc-client 0.1.2.macosx-10.11-x86-64
Downloading https://pypi.python.org/packages/any/e/ethereum-ipc-client/ethereum-ipc-client-0.1.2.macosx-10.11-x86_64.tar.gz#md5=aa5134ac45149483828809f8be92729b
Validating md5 checksum for /tmp/easy_install-HtEYih/ethereum-ipc-client-0.1.2.macosx-10.11-x86_64.tar.gz
Processing ethereum-ipc-client-0.1.2.macosx-10.11-x86_64.tar.gz
Unpacking . to /tmp/easy_install-HtEYih/.
Unpacking ./Users to /tmp/easy_install-HtEYih/./Users
Unpacking ./Users/piper to /tmp/easy_install-HtEYih/./Users/piper
Unpacking ./Users/piper/python-environments to /tmp/easy_install-HtEYih/./Users/piper/python-environments
...
Unpacking ./Users/piper/python-environments/eth-ipc-client/lib/python2.7/site-packages/ethereum_ipc_client-0.1.2-py2.7.egg-info/top_level.txt to /tmp/easy_install-HtEYih/./Users/piper/python-environments/eth-ipc-client/lib/python2.7/site-packages/ethereum_ipc_client-0.1.2-py2.7.egg-info/top_level.txt
error: Couldn't find a setup script in /tmp/easy_install-HtEYih/ethereum-ipc-client-0.1.2.macosx-10.11-x86_64.tar.gz
If I manually install the ethereum-ipc/rpc-client packages with pip, everything works fine. It does not seem to matter whether I use virtualenv or not. It seems that it is downloading the any package which is a binary distribution from macosx, and then attempts to run the "setup.py" method like it were a source package.
This was working fine in the 0.6.5 version, but has stopped working now.
Write documentation for the populus.project.Project
object.
project.get_chain('my_chain')
populus.ini
filepopulus.ini
file.Currently, a contract function that returns anything other than an int256
or uint256
will throw an error.
Simply need to flesh out populus.contracts.decode_single
While populus deploy
is reasonably helpful, I think that populus should move forward by deprecating the deploy
command in favor of procedural migration scripts.
Support compilation of serpant.
The current implementation of migrations uses a Registrar
contract to keep track of migration data. Some users will not like the added gas overhead of writing this data to the blockchain.
Possible solution is to abstract this into a generic API so that alternative backends can be written for things like LevelDB
.
put a cute animal picture here.
Support for LLL compilation.
the reason is the --logfile flag is not understood :
➜ testpopulus git:(master) ✗ nice -n 20 geth --genesis /home/lotso/PycharmProjects/testpopulus/chains/default/genesis-block.json --datadir /home/lotso/PycharmProjects/testpopulus/chains/default --maxpeers 0 --networkid 123456 --port 42700 --ipcpath /tmp/tmpReFq6q --shh --rpcapi db,eth,net,web3,shh --minerthreads 1 --logfile /home/lotso/PycharmProjects/testpopulus/chains/default/logs/deploy-dry-run-20160411-160948.log --unlock 0 --password /usr/local/lib/python2.7/dist-packages/populus/default_blockchain_password --nodiscover --mine --rpc
Incorrect Usage.
NAME:
geth - the go-ethereum command line interface
USAGE:
geth [options] command [command options] [arguments...]
VERSION:
1.4.0-unstable
COMMANDS:
import import a blockchain file
export export blockchain into file
upgradedb upgrade chainblock database
removedb Remove blockchain and state databases
dump dump a specific block from storage
monitor Geth Monitor: node metrics monitoring and visualization
makedag generate ethash dag (for testing)
gpuinfo gpuinfo
gpubench benchmark GPU
version print ethereum version numbers
wallet ethereum presale wallet
account manage accounts
init bootstraps and initialises a new genesis block (JSON)
console Geth Console: interactive JavaScript environment
attach Geth Console: interactive JavaScript environment (connect to node)
js executes the given JavaScript files in the Geth JavaScript VM
help, h Shows a list of commands or help for one command
ETHEREUM OPTIONS:
--datadir "/home/lotso/.ethereum" Data directory for the databases and keystore
--keystore Directory for the keystore (default = inside the datadir)
--networkid "1" Network identifier (integer, 0=Olympic, 1=Frontier, 2=Morden)
--olympic Olympic network: pre-configured pre-release test network
--testnet Morden network: pre-configured test network with modified starting nonces (replay protection)
--dev Developer mode: pre-configured private network with several debugging flags
--genesis Insert/overwrite the genesis block (JSON format)
--identity Custom node name
--fast Enable fast syncing through state downloads
--lightkdf Reduce key-derivation RAM & CPU usage at some expense of KDF strength
--cache "128" Megabytes of memory allocated to internal caching (min 16MB / database forced)
--blockchainversion "3" Blockchain version (integer)
ACCOUNT OPTIONS:
--unlock Comma separated list of accounts to unlock
--password Password file to use for non-inteactive password input
API AND CONSOLE OPTIONS:
--rpc Enable the HTTP-RPC server
--rpcaddr "localhost" HTTP-RPC server listening interface
--rpcport "8545" HTTP-RPC server listening port
--rpcapi "eth,net,web3" API's offered over the HTTP-RPC interface
--ws Enable the WS-RPC server
--wsaddr "localhost" WS-RPC server listening interface
--wsport "8546" WS-RPC server listening port
--wsapi "eth,net,web3" API's offered over the WS-RPC interface
--wsdomains Domains from which to accept websockets requests (can be spoofed)
--ipcdisable Disable the IPC-RPC server
--ipcapi "admin,eth,debug,miner,net,shh,txpool,personal,web3" API's offered over the IPC-RPC interface
--ipcpath "geth.ipc" Filename for IPC socket/pipe within the datadir (explicit paths escape it)
--rpccorsdomain Comma separated list of domains from which to accept cross origin requests (browser enforced)
--jspath "." JavaScript root path for `loadScript` and document root for `admin.httpGet`
--exec Execute JavaScript statement (only in combination with console/attach)
NETWORKING OPTIONS:
--bootnodes Comma separated enode URLs for P2P discovery bootstrap
--port "30303" Network listening port
--maxpeers "25" Maximum number of network peers (network disabled if set to 0)
--maxpendpeers "0" Maximum number of pending connection attempts (defaults used if set to 0)
--nat "any" NAT port mapping mechanism (any|none|upnp|pmp|extip:<IP>)
--nodiscover Disables the peer discovery mechanism (manual peer addition)
--nodekey P2P node key file
--nodekeyhex P2P node key as hex (for testing)
MINER OPTIONS:
--mine Enable mining
--minerthreads "4" Number of CPU threads to use for mining
--minergpus List of GPUs to use for mining (e.g. '0,1' will use the first two GPUs found)
--autodag Enable automatic DAG pregeneration
--etherbase "0" Public address for block mining rewards (default = first account created)
--targetgaslimit "4712388" Target gas limit sets the artificial target gas floor for the blocks to mine
--gasprice "20000000000" Minimal gas price to accept for mining a transactions
--extradata Block extra data set by the miner (default = client version)
GAS PRICE ORACLE OPTIONS:
--gpomin "20000000000" Minimum suggested gas price
--gpomax "500000000000" Maximum suggested gas price
--gpofull "80" Full block threshold for gas price calculation (%)
--gpobasedown "10" Suggested gas price base step down ratio (1/1000)
--gpobaseup "100" Suggested gas price base step up ratio (1/1000)
--gpobasecf "110" Suggested gas price base correction factor (%)
VIRTUAL MACHINE OPTIONS:
--jitvm Enable the JIT VM
--forcejit Force the JIT VM to take precedence
--jitcache "64" Amount of cached JIT VM programs
LOGGING AND DEBUGGING OPTIONS:
--metrics Enable metrics collection and reporting
--verbosity "3" Logging verbosity: 0=silent, 1=error, 2=warn, 3=info, 4=core, 5=debug, 6=detail
--vmodule Per-module verbosity: comma-separated list of <pattern>=<level> (e.g. eth/*=6,p2p=5)
--backtrace ":0" Request a stack trace at a specific logging statement (e.g. "block.go:271")
--pprof Enable the pprof HTTP server
--pprofport "6060" pprof HTTP server listening port
--memprofilerate "524288" Turn on memory profiling with the given rate
--blockprofilerate "0" Turn on block profiling with the given rate
--cpuprofile Write CPU profile to the given file
--trace Write execution trace to the given file
EXPERIMENTAL OPTIONS:
--shh Enable Whisper
--natspec Enable NatSpec confirmation notice
MISCELLANEOUS OPTIONS:
--solc "solc" Solidity compiler command to be used
--help, -h show help
flag provided but not defined: -logfile
➜ testpopulous git:(master) ✗ populus deploy -d
Exception in thread Thread-2:
Traceback (most recent call last):
File "/usr/lib/python2.7/threading.py", line 801, in __bootstrap_inner
self.run()
File "/usr/lib/python2.7/threading.py", line 754, in run
self.__target(*self.__args, **self.__kwargs)
File "/usr/local/lib/python2.7/dist-packages/populus/geth.py", line 78, in enqueue_stream
logfile.write(line)
ValueError: I/O operation on closed file
Traceback (most recent call last):
File "/usr/local/bin/populus", line 11, in <module>
sys.exit(main())
File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 716, in __call__
return self.main(*args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 696, in main
rv = self.invoke(ctx)
File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 1060, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 889, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 534, in invoke
return callback(*args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/populus/cli/deploy_cmd.py", line 116, in deploy
wait_for_geth_to_start(dry_run_proc)
File "/usr/local/lib/python2.7/dist-packages/populus/geth.py", line 408, in wait_for_geth_to_start
raise ValueError("Geth process never started\n\n{0}".format(''.join(output)))
ValueError: Geth process never started
The populus.project.Project
object presents a friendly way to get at many different things from a project (compiled contracts, contract factories, directories, etc)
This interface is not really being used by most of the codebase.
Places that could benefit most from using this:
populus.cli.*
populus.plugin
================================================================================= ERRORS =================================================================================
_________________________________________________ ERROR at setup of test_contract_return13_function_signature[ethtester] _________________________________________________
Traceback (most recent call last):
File "/home/lotso/PycharmProjects/populus/tests/contracts/test_contract_object.py", line 26, in deployed_math
Math,
File "/usr/local/lib/python2.7/dist-packages/populus-0.8.0-py2.7.egg/populus/contracts/utils.py", line 80, in deploy_contract
txn_hash = rpc_client.send_transaction(**kwargs)
File "/usr/local/lib/python2.7/dist-packages/populus-0.8.0-py2.7.egg/populus/ethtester_client.py", line 222, in send_transaction
raise ValueError("Timeout waiting for {0}".format(request_id))
ValueError: Timeout waiting for 3eee5eb1-9eb3-4558-9c07-1a8b64d10add
------------------------------------------------------------------------- Captured stdout setup --------------------------------------------------------------------------
Resetting EVM state...
___________________________________________________ ERROR at setup of test_contract_add_function_signature[ethtester] ____________________________________________________
Traceback (most recent call last):
File "/home/lotso/PycharmProjects/populus/tests/contracts/test_contract_object.py", line 26, in deployed_math
Math,
File "/home/lotso/PycharmProjects/populus/tests/contracts/test_contract_object.py", line 26, in deployed_math [106/1488]
Math,
File "/usr/local/lib/python2.7/dist-packages/populus-0.8.0-py2.7.egg/populus/contracts/utils.py", line 80, in deploy_contract
txn_hash = rpc_client.send_transaction(**kwargs)
File "/usr/local/lib/python2.7/dist-packages/populus-0.8.0-py2.7.egg/populus/ethtester_client.py", line 222, in send_transaction
raise ValueError("Timeout waiting for {0}".format(request_id))
ValueError: Timeout waiting for 07406287-f52f-46ec-b661-4e1fb26ec8f4
------------------------------------------------------------------------- Captured stdout setup --------------------------------------------------------------------------
Resetting EVM state...
________________________________________________ ERROR at setup of test_contract_multiply7_function_signature[ethtester] _________________________________________________
Traceback (most recent call last):
File "/home/lotso/PycharmProjects/populus/tests/contracts/test_contract_object.py", line 26, in deployed_math
Math,
File "/usr/local/lib/python2.7/dist-packages/populus-0.8.0-py2.7.egg/populus/contracts/utils.py", line 80, in deploy_contract
txn_hash = rpc_client.send_transaction(**kwargs)
File "/usr/local/lib/python2.7/dist-packages/populus-0.8.0-py2.7.egg/populus/ethtester_client.py", line 222, in send_transaction
raise ValueError("Timeout waiting for {0}".format(request_id))
ValueError: Timeout waiting for a5b51918-52f3-4ab6-ab4c-cc88e73ad87c
------------------------------------------------------------------------- Captured stdout setup --------------------------------------------------------------------------
Resetting EVM state...
___________________________________________________ ERROR at setup of test_contract_function_call_return13[ethtester] ____________________________________________________
Traceback (most recent call last):
File "/home/lotso/PycharmProjects/populus/tests/contracts/test_contract_object.py", line 26, in deployed_math
Math,
File "/usr/local/lib/python2.7/dist-packages/populus-0.8.0-py2.7.egg/populus/contracts/utils.py", line 80, in deploy_contract
txn_hash = rpc_client.send_transaction(**kwargs)
File "/usr/local/lib/python2.7/dist-packages/populus-0.8.0-py2.7.egg/populus/ethtester_client.py", line 222, in send_transaction
raise ValueError("Timeout waiting for {0}".format(request_id))
ValueError: Timeout waiting for 67109b77-7fc6-4f56-ae6a-3630eb271a08
------------------------------------------------------------------------- Captured stdout setup --------------------------------------------------------------------------
Resetting EVM state...
___________________________________________________ ERROR at setup of test_contract_function_call_multiply7[ethtester] ___________________________________________________
Traceback (most recent call last):
File "/home/lotso/PycharmProjects/populus/tests/contracts/test_contract_object.py", line 26, in deployed_math
Math,
File "/usr/local/lib/python2.7/dist-packages/populus-0.8.0-py2.7.egg/populus/contracts/utils.py", line 80, in deploy_contract
txn_hash = rpc_client.send_transaction(**kwargs)
File "/usr/local/lib/python2.7/dist-packages/populus-0.8.0-py2.7.egg/populus/ethtester_client.py", line 222, in send_transaction
raise ValueError("Timeout waiting for {0}".format(request_id))
ValueError: Timeout waiting for 4270ec02-5304-4647-8841-0d7e49ec3448
------------------------------------------------------------------------- Captured stdout setup --------------------------------------------------------------------------
Resetting EVM state...
================================================================================ FAILURES ================================================================================
________________________________________________________________ test_deployment_with_no_args[ethtester] _________________________________________________________________
Traceback (most recent call last):
File "/home/lotso/PycharmProjects/populus/tests/contracts/test_contract_deployment.py", line 20, in test_deployment_with_no_args
Math,
File "/usr/local/lib/python2.7/dist-packages/populus-0.8.0-py2.7.egg/populus/contracts/utils.py", line 80, in deploy_contract
txn_hash = rpc_client.send_transaction(**kwargs)
File "/usr/local/lib/python2.7/dist-packages/populus-0.8.0-py2.7.egg/populus/ethtester_client.py", line 222, in send_transaction
raise ValueError("Timeout waiting for {0}".format(request_id))
ValueError: Timeout waiting for dc1b261d-9db6-4ec9-bef0-8db4c9c840f1
------------------------------------------------------------------------- Captured stdout setup --------------------------------------------------------------------------
Resetting EVM state...
Resetting EVM state... [53/1488]
_______________________________________________________________ test_deployment_with_endowment[ethtester] ________________________________________________________________
Traceback (most recent call last):
File "/home/lotso/PycharmProjects/populus/tests/contracts/test_contract_deployment.py", line 30, in test_deployment_with_endowment
value=1000,
File "/usr/local/lib/python2.7/dist-packages/populus-0.8.0-py2.7.egg/populus/contracts/utils.py", line 80, in deploy_contract
txn_hash = rpc_client.send_transaction(**kwargs)
File "/usr/local/lib/python2.7/dist-packages/populus-0.8.0-py2.7.egg/populus/ethtester_client.py", line 222, in send_transaction
raise ValueError("Timeout waiting for {0}".format(request_id))
ValueError: Timeout waiting for d9f0c86f-1b12-4afa-9398-7348298cf60d
------------------------------------------------------------------------- Captured stdout setup --------------------------------------------------------------------------
Resetting EVM state...
__________________________________________________________________ test_deployment_with_args[ethtester] __________________________________________________________________
Traceback (most recent call last):
File "/home/lotso/PycharmProjects/populus/tests/contracts/test_contract_deployment.py", line 42, in test_deployment_with_args
constructor_args=("John",),
File "/usr/local/lib/python2.7/dist-packages/populus-0.8.0-py2.7.egg/populus/contracts/utils.py", line 80, in deploy_contract
txn_hash = rpc_client.send_transaction(**kwargs)
File "/usr/local/lib/python2.7/dist-packages/populus-0.8.0-py2.7.egg/populus/ethtester_client.py", line 222, in send_transaction
raise ValueError("Timeout waiting for {0}".format(request_id))
ValueError: Timeout waiting for 7a7615e6-a62a-489d-89b0-ac80c3e1237b
------------------------------------------------------------------------- Captured stdout setup --------------------------------------------------------------------------
Resetting EVM state...
___________________________________________________________________ test_double_index_event[ethtester] ___________________________________________________________________
Traceback (most recent call last):
File "/home/lotso/PycharmProjects/populus/tests/contracts/test_event_logging.py", line 38, in test_double_index_event
txn_a_hash = deployed_logs_events.logDoubleIndex('test-key-a', 'test-key-b', 'test-val_a', 12345)
File "/usr/local/lib/python2.7/dist-packages/populus-0.8.0-py2.7.egg/populus/contracts/functions.py", line 58, in __call__
return self.sendTransaction(*args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/populus-0.8.0-py2.7.egg/populus/contracts/functions.py", line 88, in sendTransaction
**kwargs
File "/usr/local/lib/python2.7/dist-packages/populus-0.8.0-py2.7.egg/populus/ethtester_client.py", line 222, in send_transaction
raise ValueError("Timeout waiting for {0}".format(request_id))
ValueError: Timeout waiting for e4471269-b14f-4bb7-9128-3b7280947625
------------------------------------------------------------------------- Captured stdout setup --------------------------------------------------------------------------
Resetting EVM state...
__________________________________________________________________________ test_async_requests ___________________________________________________________________________
Traceback (most recent call last):
File "/home/lotso/PycharmProjects/populus/tests/ethtester/test_ethtester_async.py", line 36, in test_async_requests
assert not errors
AssertionError: assert not [ValueError('Timeout waiting for 404d2609-7545-404c-a8d8-3387a44070f2',), ValueError('Timeout waiting for 88da010f-1b1...g for 74127f4f-d499-43
52-9d93-4536e657ee9c',), ValueError('Timeout waiting for b0ee685e-8441-45c5-b0b6-e98f56d05fb9',)]
-------------------------------------------------------------------------- Captured stderr call --------------------------------------------------------------------------
Exception in thread Thread-58:
Traceback (most recent call last):
File "/usr/lib/python2.7/threading.py", line 801, in __bootstrap_inner
self.run()
File "/usr/lib/python2.7/threading.py", line 754, in run
self.__target(*self.__args, **self.__kwargs)
File "/home/lotso/PycharmProjects/populus/tests/ethtester/test_ethtester_async.py", line 25, in spam_block_number
pytest.fail(e.message)
File "/usr/lib/python2.7/dist-packages/_pytest/runner.py", line 486, in fail
raise Failed(msg=msg, pytrace=pytrace)
Failed: Timeout waiting for 88da010f-1b12-4ed3-88f8-dd2586dbe521
Failed: Timeout waiting for 88da010f-1b12-4ed3-88f8-dd2586dbe521 [0/1488]
Exception in thread Thread-60:
Traceback (most recent call last):
File "/usr/lib/python2.7/threading.py", line 801, in __bootstrap_inner
self.run()
File "/usr/lib/python2.7/threading.py", line 754, in run
self.__target(*self.__args, **self.__kwargs)
File "/home/lotso/PycharmProjects/populus/tests/ethtester/test_ethtester_async.py", line 25, in spam_block_number
pytest.fail(e.message)
File "/usr/lib/python2.7/dist-packages/_pytest/runner.py", line 486, in fail
raise Failed(msg=msg, pytrace=pytrace)
Failed: Timeout waiting for 74127f4f-d499-4352-9d93-4536e657ee9c
Exception in thread Thread-57:
Traceback (most recent call last):
File "/usr/lib/python2.7/threading.py", line 801, in __bootstrap_inner
self.run()
File "/usr/lib/python2.7/threading.py", line 754, in run
self.__target(*self.__args, **self.__kwargs)
File "/home/lotso/PycharmProjects/populus/tests/ethtester/test_ethtester_async.py", line 25, in spam_block_number
pytest.fail(e.message)
File "/usr/lib/python2.7/dist-packages/_pytest/runner.py", line 486, in fail
raise Failed(msg=msg, pytrace=pytrace)
Failed: Timeout waiting for 1fb36143-409c-44b8-a912-806c32ff9fd1
Exception in thread Thread-59:
Traceback (most recent call last):
File "/usr/lib/python2.7/threading.py", line 801, in __bootstrap_inner
self.run()
File "/usr/lib/python2.7/threading.py", line 754, in run
self.__target(*self.__args, **self.__kwargs)
File "/home/lotso/PycharmProjects/populus/tests/ethtester/test_ethtester_async.py", line 25, in spam_block_number
pytest.fail(e.message)
File "/usr/lib/python2.7/dist-packages/_pytest/runner.py", line 486, in fail
raise Failed(msg=msg, pytrace=pytrace)
Failed: Timeout waiting for 404d2609-7545-404c-a8d8-3387a44070f2
Exception in thread Thread-56:
Traceback (most recent call last):
File "/usr/lib/python2.7/threading.py", line 801, in __bootstrap_inner
self.run()
File "/usr/lib/python2.7/threading.py", line 754, in run
self.__target(*self.__args, **self.__kwargs)
File "/home/lotso/PycharmProjects/populus/tests/ethtester/test_ethtester_async.py", line 25, in spam_block_number
pytest.fail(e.message)
File "/usr/lib/python2.7/dist-packages/_pytest/runner.py", line 486, in fail
raise Failed(msg=msg, pytrace=pytrace)
Failed: Timeout waiting for b0ee685e-8441-45c5-b0b6-e98f56d05fb9
Currently the CLI interface just compiles/deployes all contracts. There needs to be better control for which contracts to compile/deploy.
There is an implicit import time gevent.monkey.patch_all()
in populus.__init__
.
This is harmful as it might break other libraries within the same Python process, as gevent gives pretty invasive treatment to Python stdlib. Thus, mere action of importing Populus might break your software in subtle ways.
If gevent event loop and monkey patching is required, I'd suggest to have an explicit init method that the user needs to call.
This is to track what's needed to make Populus run on Python 3.
At least the following should be needed:
Queue
/ queue
str
/ bytes
)Python 3 support in upstream dependencies:
I am currently working on a major revamp of the populus
library. Below is a list that I will continue to update as my work progresses. I'm very interested in any feedback on these changes as many of them are going to be breaking changes.
This refactor will also mark the beginning of the 1.x.x
line of releases. After this, any breaking changes to public API's will go through a deprecation process (to be determined).
populus web
command.py-solc
package for solidity compilationpy-geth
for running geth nodes.web3.py
for all blockchain interactions.populus compile
command.populus compile
command now runs with --optimize
enabled by default.<project-dir>/libraries
directory in favor of all source files being located in a single <project-dir>/contracts
directory.web3.py
The web3.py
interface for working with contracts is compliant with the web3.js
interface which is well documented. This should be an overall win for making use of populus easier for new adopters.
This change will break all uses of the populus.contracts.Contract
objects as well as all uses of the blockchain_client
. I recognize this is significant but I feel strongly this is the right way to go.
The docs should contain a tutorial. Probably a todo app.
How are you managing events/log outputs with this framework? I'm thinking that a sub-command called "eventlog" could be useful:
$> populus eventlog --contract MyContract
{MyContract{0xbb348...}, topic=MyDummyEvent, data=["I generated an event"]}
{MyContract{0xbb348...}, topic=MyDummyEvent, data=["I generated another event"]}
As shown, eventlog command would start a new filter via RPC call and check for changes from the running geth chain. The user could pass a set of filters to this command so that only the events that they want to see would be printed out. With the above incantation, the "--contract" filter would allow this sub-command to only print event logs from the "MyContract" contract. Other filters would including the contract specific address, the topic itself (ie, what event name generated this), and possibly a filter on the data content. This is obviously not an exhaustive list.
The user would launch this in a separate terminal, similar to the attach vs chain commands.
The output above obviously is just an example, but it would show the contract, the address, the topic, and data for that particular event generation. I'm think that the user would be able to pass a format string (or reference a file with the appropriate config) that would determine what gets printed out. Alternatively, we could just print everything and expect the user to use sed or awk.
Thoughts? Do you have anything in the works for this or no ?
The documentation for the pytest fixtures is mediocre. It needs to be improved with examples.
Currently all of the populus.chain.Chain
classes manage their own blockchains. We need one that represents someone running their own blockchain separately from populus.
populus.chain.ChainProxy
that just acts as a container for the chain properties that the rest of populus expects.populus.utils.cli
that does an interactive prompt to configure that chain.populus.ini
file so that people can use them like normal chains.populus chain run
fails with
Command 'nice -n 20 geth --genesis /usr/local/lib/python2.7/dist-packages/populus/genesis-test.json [...]' returned non-zero exit status 1
running the generated geth command manually returns
flag provided but not defined: -genesis
So apparently the "--genesis" flag was removed from geth.
The commands that wrap subprocess stuff should produce nice error messages when the binary isn't present on the machine
Currently populus compile
makes assumptions about directory layout. It doesn't allow to set build folder target.
I want to use the following deployment model
populus compile
to build .sol sourcepython setup.py sdist
to package my appcontracts.json
using Python pkg_resources
mechanismcontracts.json
folder is generated in the current project root, not inside my package namespace where I'd like to place it for sdist
. This is naturally easy to move. I am not sure if this workflow is correct, just double checking here before suggesting a patch.deploy_client_type
: 'ethtester'
(the default)During test runs, some Function.s()
calls will fail as follows:
Traceback (most recent call last):
[…]
File "[…]/python2.7/site-packages/populus/contracts/functions.py", line 64, in s
txn_hash = self(*args, **kwargs)
File "[…]/python2.7/site-packages/populus/contracts/functions.py", line 58, in __call__
return self.sendTransaction(*args, **kwargs)
File "[…]/python2.7/site-packages/populus/contracts/functions.py", line 88, in sendTransaction
**kwargs
File "[…]/python2.7/site-packages/populus/ethtester_client.py", line 220, in send_transaction
raise result
BlockGasLimitReached: <Transaction(c400)>: 'gaslimit' actual:6283184 target:3141592
(The failing call in question is not big, and nowhere near the block limit in terms of gas usage.)
I suspected that the problem is due to the test VM's blocks not being mined frequently enough, causing transactions to pile up in some circumstances until the limit is hit. Inserting an evm.mine()
call in front of the failing transaction prevents the problem, and seems to confirm this hypothesis.
I haven't been able to diagnose the exact cause leading up to the BlockGasLimitReached
failures, but I implemented a quick hacky fix in 142070f: this modifies populus.ethtester_client.EthTesterClient
to simply perform a mine()
before each transaction as well as after, which may be overkill, but seems to prevent the problem so far.
Suppose I have a contract with some parameters that can be passed in the constructor, how am I suppose to pass them within the framework ?
I posted on http://ethereum.stackexchange.com/questions/2937/populus-how-do-i-deploy-a-contract-with-args-in-the-constructor as well, sorry if this is not the place on github but maybe someone may have the same interrogation one day and look here... dunno ;)
When trying to use accounts
, I get the following error:
> return tuple("0x" + tester.encode_hex(account) for account in tester.accounts)
E AttributeError: 'module' object has no attribute 'encode_hex'
This is caused by interface changes in pyethereum. encode_hex
should be imported from ethereum.utils
.
I would gladly provide a PR to fix this.
Write documentation for both the command $ populus chain run
and the populus.chain.Chain
objects that you can use programatically in your code.
mainnet
and morden
chains.project.get_chain('...')
populus.chain.Chain
object exposes.This should support both the eth-testrpc
server and the test chains managed by populus chain
The migrations functionality opens up a path for populus to evolve into a full ethereum package manager. This idea isn't fully baked but it would look something like the following.
$ populus install 0xd3cda913deb6f67967b99d67acdfa1712c293601/math-utils
$ populus install pipermerriam/math-utils
$ populus install 0xd3cda913deb6f67967b99d67acdfa1712c293601
$ populus release
TODO: flesh this out conceptually.
The following should be loosely defined or thought about.
put a cute animal picture here.
Hi,
So I've been playing with your framework some. I've been banging my head against the wall trying to get a very simple contract to run for days. I've finally figured out how to get it work, and I think it may be because you have a very subtle bug in the default contract function "sendTransaction" method.
On line 62 of the file populus/contracts/function.py, you set the default 'gas' value if no 'gas' parameter is passed in the keyword arguments. You use the "get_max_gas" method which pulls the current gasLimit value from the running geth test chain. In my geth test chain, the "gasLimit" value seems to continuously decline all the time. I don't know why the gasLimit is constantly declining, but it seems to decline after every block.
The issue seems to be that by the time my transaction gets submitted to my test chain, the gasLimit value has declined below the "gas" value that is submitted with the transaction. The geth chain seems to then reject this transaction because it has exceeded the gasLimit.
Do you observe this behavior? To fix it, I've actually just divided the "get_max_gas" response by 2 and now all my transactions seem to go through perfectly. I realize this isn't a great way to do this. I'm thinking that using the 'solc' compiler's '--gas' option might be a better way to get estimates of the transaction gas requirement. Thoughts?
(As a side note, the VM rejecting transactions when the gas value is greater than gasLimit doesn't make any sense to me. It would seem to me that the more appropriate response, would be use a min function on the VM's gasLimit and the gas value sent in the transaction. Then, if the method would require more gas than the min of these two values, then the transaction should fail, not fail outright even for small low actual gas transactions. Do you have any idea why the geth transaction processing is implemented this way?)
I ran the tests and got some failures having to do with starting geth nodes.
Documentation for migrations needs to be written.
populus makemigration my_migration_name
)populus migrate init
)populus migrate
)populus.migrations.operations
)populus.migrations.registrar
)populus.migrations.deferred.RegistrarValue
and related subclasses)The JSON RPC client should be it's own library.
I was testing the populus web run
command.
I spent some time wondering why I couldn't interact with the web3 instance, only to realize the populus chain run
doesn’t pass args for the the rpccorsdomain
flag.
is my diagnostic correct ?
That would be a good improvment :) I know the web command is very beta, but still that would be cool :)
In the pre 1.0.0
versions of populus there was a command populus attach
that loaded the user into a python shell with their compiled contracts pre-loaded into the context. This was removed because of the fragility of the feature and inability to handle the maintenance overhead.
The removal of this feature has left a gap, which is easy access to things like the compiled contracts, a web3 instance, and the web3.eth.contract
objects.
The proposed way to fix this would be as follows.
>>> from populus.project import default_project as my_project, Project
>>> my_project
<Project at "/path/to/my-project/"> # this would be automatically created an linked to `os.getcwd()`
>>> Project(project_dir="/path/to/some-other-project")
<Project at "/path/to/some-other-project"> # or you can instantiate your own instance if the root project directory is located elsewhere.
>>> my_project.web3 # this would somehow be auto-configured with a test chain or something like that.
>>> my_project.compiled_contracts # All of the compiled contract data from your project.
{
"MyContract": {
"code": "0x...",
"code_runtime": "0x...",
"abi": "[...]",
}
}
>>> contract_factories = project.contract_factories
>>> MyContract = contract_factories.MyContract
>>> MyContract
<web3.contracts.Contract object>
>>> MyContract.deploy()
"0x...." # The deploy transaction from this contract factory.
This is all just in the idea phase. Feedback welcome. Please let me know any ways that you think this could be improved.
put a cute animal picture here.
The unit tests related to the solc compilation fail due to a version number issue of the solc compiler in Ubuntu vs Mac OS X.
Please see the tox log here:
build-log.txt
Brainstorming Tickets
populus install ...
For installing contracts for use as library code.
All of the fixtures found in populus.plugin
need to have documentation written for them in docs/testing.rst
and docs/fixtures.rst
.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.