Skip to content

Commit

Permalink
Merge branch 'master' into tiffany/getFilterChanges-to-snakecase
Browse files Browse the repository at this point in the history
  • Loading branch information
tmckenzie51 authored Apr 2, 2021
2 parents 268119d + d9accbe commit 9d3690d
Show file tree
Hide file tree
Showing 65 changed files with 555 additions and 280 deletions.
114 changes: 74 additions & 40 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version: 2.0
version: 2.1

# heavily inspired by https://raw.githubusercontent.com/pinax/pinax-wiki/6bd2a99ab6f702e300d708532a6d1d9aa638b9f8/.circleci/config.yml

Expand Down Expand Up @@ -116,7 +116,7 @@ ethpm_steps: &ethpm_steps
- checkout
- restore_cache:
keys:
- cache-{{ .Environment.CIRCLE_JOB }}-{{ checksum "setup.py" }}-{{ checksum "tox.ini" }}
- ethpm-cache-{{ .Environment.CIRCLE_JOB }}-{{ checksum "setup.py" }}-{{ checksum "tox.ini" }}
- run:
name: install ipfs
command:
Expand All @@ -142,10 +142,34 @@ ethpm_steps: &ethpm_steps
- .tox
- ~/.cache/pip
- ~/.local
- ./eggs
- ~/.ethash
- ~/.py-geth
key: cache-{{ .Environment.CIRCLE_JOB }}-{{ checksum "setup.py" }}-{{ checksum "tox.ini" }}
key: ethpm-cache-{{ .Environment.CIRCLE_JOB }}-{{ checksum "setup.py" }}-{{ checksum "tox.ini" }}

orbs:
win: circleci/[email protected]

windows_steps: &windows_steps
executor:
name: win/default
shell: bash.exe
working_directory: C:\Users\circleci\project\web3py
steps:
- checkout
- restore_cache:
keys:
- windows-cache-{{ .Environment.CIRCLE_JOB }}-{{ checksum "setup.py" }}-{{ checksum "tox.ini" }}
- run:
name: checkout ethpm-spec submodule
command: git submodule update --init --recursive
- run:
name: install dependencies
command: pip install --user tox
- run:
name: run tox
command: 'C:/Users/circleci/AppData/Roaming/Python/Python37/Scripts/tox.exe -r'
- save_cache:
paths:
- .tox
key: windows-cache-{{ .Environment.CIRCLE_JOB }}-{{ checksum "setup.py" }}-{{ checksum "tox.ini" }}


jobs:
Expand Down Expand Up @@ -189,29 +213,29 @@ jobs:
# Please don't use this key for any shenanigans
WEB3_INFURA_PROJECT_ID: 7707850c2fb7465ebe6f150d67182e22

py36-integration-goethereum-ipc-1.9.19:
py36-integration-goethereum-ipc:
<<: *geth_steps
docker:
- image: circleci/python:3.6
environment:
TOXENV: py36-integration-goethereum-ipc
GETH_VERSION: v1.9.19
GETH_VERSION: v1.10.1

py36-integration-goethereum-http-1.9.19:
py36-integration-goethereum-http:
<<: *geth_steps
docker:
- image: circleci/python:3.6
environment:
TOXENV: py36-integration-goethereum-http
GETH_VERSION: v1.9.19
GETH_VERSION: v1.10.1

py36-integration-goethereum-ws-1.9.19:
py36-integration-goethereum-ws:
<<: *geth_steps
docker:
- image: circleci/python:3.6
environment:
TOXENV: py36-integration-goethereum-ws
GETH_VERSION: v1.9.19
GETH_VERSION: v1.10.1

# py36-integration-parity-ipc:
# <<: *parity_steps
Expand Down Expand Up @@ -247,12 +271,14 @@ jobs:
environment:
TOXENV: py36-integration-ethtester
ETHEREUM_TESTER_CHAIN_BACKEND: eth_tester.backends.PyEVMBackend

py36-wheel-cli:
<<: *common
docker:
- image: circleci/python:3.6
environment:
TOXENV: py36-wheel-cli
environment:
TOXENV: py36-wheel-cli

#
# Python 3.7
#
Expand All @@ -279,29 +305,29 @@ jobs:
# Please don't use this key for any shenanigans
WEB3_INFURA_PROJECT_ID: 7707850c2fb7465ebe6f150d67182e22

py37-integration-goethereum-ipc-1.9.19:
py37-integration-goethereum-ipc:
<<: *geth_steps
docker:
- image: circleci/python:3.7
environment:
TOXENV: py37-integration-goethereum-ipc
GETH_VERSION: v1.9.19
GETH_VERSION: v1.10.1

py37-integration-goethereum-http-1.9.19:
py37-integration-goethereum-http:
<<: *geth_steps
docker:
- image: circleci/python:3.7
environment:
TOXENV: py37-integration-goethereum-http
GETH_VERSION: v1.9.19
GETH_VERSION: v1.10.1

py37-integration-goethereum-ws-1.9.19:
py37-integration-goethereum-ws:
<<: *geth_steps
docker:
- image: circleci/python:3.7
environment:
TOXENV: py37-integration-goethereum-ws
GETH_VERSION: v1.9.19
GETH_VERSION: v1.10.1

# py37-integration-parity-ipc:
# <<: *parity_steps
Expand Down Expand Up @@ -337,12 +363,19 @@ jobs:
environment:
TOXENV: py37-integration-ethtester
ETHEREUM_TESTER_CHAIN_BACKEND: eth_tester.backends.PyEVMBackend

py37-wheel-cli:
<<: *common
docker:
- image: circleci/python:3.7
environment:
TOXENV: py37-wheel-cli
environment:
TOXENV: py37-wheel-cli

py37-wheel-cli-windows:
<<: *windows_steps
environment:
TOXENV: py37-wheel-cli-windows

#
# Python 3.8
#
Expand All @@ -369,29 +402,29 @@ jobs:
# Please don't use this key for any shenanigans
WEB3_INFURA_PROJECT_ID: 7707850c2fb7465ebe6f150d67182e22

py38-integration-goethereum-ipc-1.9.19:
py38-integration-goethereum-ipc:
<<: *geth_steps
docker:
- image: circleci/python:3.8
environment:
TOXENV: py38-integration-goethereum-ipc
GETH_VERSION: v1.9.19
GETH_VERSION: v1.10.1

py38-integration-goethereum-http-1.9.19:
py38-integration-goethereum-http:
<<: *geth_steps
docker:
- image: circleci/python:3.8
environment:
TOXENV: py38-integration-goethereum-http
GETH_VERSION: v1.9.19
GETH_VERSION: v1.10.1

py38-integration-goethereum-ws-1.9.19:
py38-integration-goethereum-ws:
<<: *geth_steps
docker:
- image: circleci/python:3.8
environment:
TOXENV: py38-integration-goethereum-ws
GETH_VERSION: v1.9.19
GETH_VERSION: v1.10.1

# py38-integration-parity-ipc:
# <<: *parity_steps
Expand Down Expand Up @@ -432,11 +465,11 @@ jobs:
<<: *common
docker:
- image: circleci/python:3.8
environment:
TOXENV: py38-wheel-cli
environment:
TOXENV: py38-wheel-cli

workflows:
version: 2
version: 2.1
test:
jobs:
# These are the longest running tests, start them first
Expand All @@ -447,29 +480,30 @@ workflows:
- docs
- py36-ens
- py36-ethpm
- py36-integration-goethereum-ipc-1.9.19
- py36-integration-goethereum-http-1.9.19
- py36-integration-goethereum-ws-1.9.19
- py36-integration-goethereum-ipc
- py36-integration-goethereum-http
- py36-integration-goethereum-ws
# - py36-integration-parity-ipc
# - py36-integration-parity-http
# - py36-integration-parity-ws
- py36-integration-ethtester-pyevm
- py36-wheel-cli
- py37-ens
- py37-ethpm
- py37-integration-goethereum-ipc-1.9.19
- py37-integration-goethereum-http-1.9.19
- py37-integration-goethereum-ws-1.9.19
- py37-integration-goethereum-ipc
- py37-integration-goethereum-http
- py37-integration-goethereum-ws
# - py37-integration-parity-ipc
# - py37-integration-parity-http
# - py37-integration-parity-ws
- py37-integration-ethtester-pyevm
- py37-wheel-cli
- py37-wheel-cli-windows
- py38-ens
- py38-ethpm
- py38-integration-goethereum-ipc-1.9.19
- py38-integration-goethereum-http-1.9.19
- py38-integration-goethereum-ws-1.9.19
- py38-integration-goethereum-ipc
- py38-integration-goethereum-http
- py38-integration-goethereum-ws
# - py38-integration-parity-ipc
# - py38-integration-parity-http
# - py38-integration-parity-ws
Expand Down
14 changes: 7 additions & 7 deletions docs/contracts.rst
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ To run this example, you will need to install a few extra features:
>>> tx_hash = Greeter.constructor().transact()
# Wait for the transaction to be mined, and get the transaction receipt
>>> tx_receipt = w3.eth.waitForTransactionReceipt(tx_hash)
>>> tx_receipt = w3.eth.wait_for_transaction_receipt(tx_hash)
>>> greeter = w3.eth.contract(
... address=tx_receipt.contractAddress,
Expand All @@ -95,7 +95,7 @@ To run this example, you will need to install a few extra features:
'Hello'
>>> tx_hash = greeter.functions.setGreeting('Nihao').transact()
>>> tx_receipt = w3.eth.waitForTransactionReceipt(tx_hash)
>>> tx_receipt = w3.eth.wait_for_transaction_receipt(tx_hash)
>>> greeter.functions.greet().call()
'Nihao'
Expand Down Expand Up @@ -686,7 +686,7 @@ Taking the following contract code as an example:
>>> ArraysContract = w3.eth.contract(abi=abi, bytecode=bytecode)

>>> tx_hash = ArraysContract.constructor([b'b']).transact()
>>> tx_receipt = w3.eth.waitForTransactionReceipt(tx_hash)
>>> tx_receipt = w3.eth.wait_for_transaction_receipt(tx_hash)

>>> array_contract = w3.eth.contract(
... address=tx_receipt.contractAddress,
Expand Down Expand Up @@ -1069,15 +1069,15 @@ Event Log Object
assert bob == '0x2B5AD5c4795c026514f8317c7a215E218DcCD6cF', bob
tx_hash = my_token_contract.constructor(1000000).transact({'from': alice, 'gas': 899000, 'gasPrice': 320000})
assert tx_hash == HexBytes('0x611aa2d5c3e51f08d0665c4529c5520ed32520d8a48ba2cf2aff3f2fce3f26e4'), tx_hash
txn_receipt = w3.eth.waitForTransactionReceipt(tx_hash)
txn_receipt = w3.eth.wait_for_transaction_receipt(tx_hash)
assert txn_receipt['contractAddress'] == '0xF2E246BB76DF876Cef8b38ae84130F4F55De395b', txn_receipt['contractAddress']
contract_address = txn_receipt['contractAddress']
contract = w3.eth.contract(contract_address, abi=ABI)
total_supply = contract.functions.totalSupply().call()
decimals = 10 ** 18
assert total_supply == 1000000 * decimals, total_supply
tx_hash = contract.functions.transfer(alice, 10).transact({'gas': 899000, 'gasPrice': 200000})
tx_receipt = w3.eth.waitForTransactionReceipt(tx_hash)
tx_receipt = w3.eth.wait_for_transaction_receipt(tx_hash)

.. doctest:: createFilter

Expand All @@ -1096,7 +1096,7 @@ Event Log Object
>>> transfer_filter.get_new_entries()
[]
>>> tx_hash = contract.functions.transfer(alice, 10).transact({'gas': 899000, 'gasPrice': 200000})
>>> tx_receipt = w3.eth.waitForTransactionReceipt(tx_hash)
>>> tx_receipt = w3.eth.wait_for_transaction_receipt(tx_hash)
>>> transfer_filter.get_new_entries()
[AttributeDict({'args': AttributeDict({'from': '0x7E5F4552091A69125d5DfCb7b8C2659029395Bdf',
'to': '0x7E5F4552091A69125d5DfCb7b8C2659029395Bdf',
Expand Down Expand Up @@ -1173,7 +1173,7 @@ For example:
ABI = json.loads('[{"constant":false,"inputs":[],"name":"return13","outputs":[{"name":"result","type":"int256"}],"type":"function"},{"constant":true,"inputs":[],"name":"counter","outputs":[{"name":"","type":"uint256"}],"type":"function"},{"constant":false,"inputs":[{"name":"amt","type":"uint256"}],"name":"increment","outputs":[{"name":"result","type":"uint256"}],"type":"function"},{"constant":false,"inputs":[{"name":"a","type":"int256"},{"name":"b","type":"int256"}],"name":"add","outputs":[{"name":"result","type":"int256"}],"type":"function"},{"constant":false,"inputs":[],"name":"increment","outputs":[{"name":"","type":"uint256"}],"type":"function"},{"constant":false,"inputs":[{"name":"a","type":"int256"}],"name":"multiply7","outputs":[{"name":"result","type":"int256"}],"type":"function"},{"anonymous":false,"inputs":[{"indexed":false,"name":"value","type":"uint256"}],"name":"increased","type":"event"}]')
contract = w3.eth.contract(abi=ABI, bytecode=bytecode)
deploy_txn = contract.constructor().transact()
deploy_receipt = w3.eth.waitForTransactionReceipt(deploy_txn)
deploy_receipt = w3.eth.wait_for_transaction_receipt(deploy_txn)
address = deploy_receipt.contractAddress

.. doctest:: contractcaller
Expand Down
26 changes: 16 additions & 10 deletions docs/contributing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -272,22 +272,28 @@ generated.
Geth fixtures
^^^^^^^^^^^^^

1. Install the desired Geth version on your machine locally. The Geth team only
explicitly supports the current version of their client at any given point,
so older versions are best installed via `py-geth`_. Note that ``py-geth``
will need updating to support each new version as well.
1. Install the desired Geth version on your machine locally. We recommend `py-geth`_ for
this purpose, because it enables you to easily manage multiple versions of Geth.

2. Specify the Geth binary and run the fixture creation script:
Note that ``py-geth`` will need updating to support each new Geth version as well.
Add newer Geth version to py-geth is straightforward; see past commits for a template.

If py-geth has the Geth version you need, install that version locally. For example:

.. code:: sh
$ python -m geth.install v1.10.1
2. Specify the Geth binary and run the fixture creation script (from within the web3.py directory):

.. code:: sh
$ GETH_BINARY=/path/to/py-geth/bin python /tests/integration/generate_fixtures/go_ethereum.py /tests/integration/geth-X.Y.Z-fixture
$ GETH_BINARY=~/.py-geth/geth-v1.10.1/bin/geth python ./tests/integration/generate_fixtures/go_ethereum.py ./tests/integration/geth-1.10.1-fixture
3. The output of this script is your fixture, a zip file. Store the fixture in the
``/tests/integration/`` directory and update the ``/tests/integration/go_ethereum/conftest.py``
file to point to the new fixture.
3. The output of this script is your fixture, a zip file, which is now stored in ``/tests/integration/``.
Update the ``/tests/integration/go_ethereum/conftest.py`` file to point to this new fixture. Delete the old fixture.

4. Run the tests. To ensure that the tests run with the correct Geth version,
4. Run the tests. To ensure that the tests run with the correct Geth version locally,
you may again include the ``GETH_BINARY`` environment variable.


Expand Down
4 changes: 2 additions & 2 deletions docs/ethpm.rst
Original file line number Diff line number Diff line change
Expand Up @@ -109,13 +109,13 @@ LinkableContract
>>> # Deploy SafeSendLib
>>> SafeSendFactory = EscrowPackage.get_contract_factory("SafeSendLib")
>>> safe_send_tx_hash = SafeSendFactory.constructor().transact()
>>> safe_send_tx_receipt = w3.eth.waitForTransactionReceipt(safe_send_tx_hash)
>>> safe_send_tx_receipt = w3.eth.wait_for_transaction_receipt(safe_send_tx_hash)

>>> # Link Escrow factory to deployed SafeSendLib instance
>>> LinkedEscrowFactory = EscrowFactory.link_bytecode({"SafeSendLib": safe_send_tx_receipt.contractAddress})
>>> assert LinkedEscrowFactory.needs_bytecode_linking is False
>>> escrow_tx_hash = LinkedEscrowFactory.constructor(w3.eth.accounts[0]).transact()
>>> escrow_tx_receipt = w3.eth.waitForTransactionReceipt(escrow_tx_hash)
>>> escrow_tx_receipt = w3.eth.wait_for_transaction_receipt(escrow_tx_hash)
>>> assert is_address(escrow_tx_receipt.contractAddress)


Expand Down
Loading

0 comments on commit 9d3690d

Please sign in to comment.