Skip to content

Commit

Permalink
Merge branch 'master' into swap-solidity-err-for-tx-err
Browse files Browse the repository at this point in the history
  • Loading branch information
kclowes authored Jan 8, 2021
2 parents dedf33c + eba67ce commit 7a9c4a9
Show file tree
Hide file tree
Showing 26 changed files with 448 additions and 29 deletions.
2 changes: 1 addition & 1 deletion .bumpversion.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[bumpversion]
current_version = 5.13.1
current_version = 5.14.0
commit = True
tag = True
parse = (?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)(-(?P<stage>[^.]*)\.(?P<devnum>\d+))?
Expand Down
12 changes: 11 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,17 @@ output/*/index.html
# Sphinx
docs/_build
docs/modules.rst
docs/web3.*
docs/web3.auto.infura.rst
docs/web3.auto.rst
docs/web3.gas_strategies.rst
docs/web3.middleware.rst
docs/web3.providers.eth_tester.rst
docs/web3.providers.rst
docs/web3.rst
docs/web3.scripts.release.rst
docs/web3.scripts.rst
docs/web3.tools.pytest_ethereum.rst
docs/web3.tools.rst

# Blockchain
chains
Expand Down
1 change: 1 addition & 0 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ Table of Contents

web3.main
web3.eth
web3.beacon
web3.pm
web3.net
web3.miner
Expand Down
24 changes: 24 additions & 0 deletions docs/releases.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,30 @@ v5 Breaking Changes Summary

.. towncrier release notes start
v5.14.0 (2021-01-05)
--------------------

Bugfixes
~~~~~~~~

- Remove docs/web3.* from the gitignore to allow for the beacon docs to be added to git,
and add ``beacon`` to the default web3 modules that get loaded. (`#1824 <https://github.com/ethereum/web3.py/issues/1824>`__)
- Remove auto-documenting from the Beacon API (`#1825 <https://github.com/ethereum/web3.py/issues/1825>`__)


Features
~~~~~~~~

- Introduce experimental Ethereum 2.0 beacon node API (`#1758 <https://github.com/ethereum/web3.py/issues/1758>`__)
- Add new get_balance method on Eth class. Deprecated getBalance. (`#1806 <https://github.com/ethereum/web3.py/issues/1806>`__)


Misc
~~~~

- `#1815 <https://github.com/ethereum/web3.py/issues/1815>`__, `#1816 <https://github.com/ethereum/web3.py/issues/1816>`__


v5.13.1 (2020-12-03)
--------------------

Expand Down
9 changes: 9 additions & 0 deletions docs/web3.beacon.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
Web3 Eth 2.0 Beacon API
=======================

Module contents
---------------

Docs coming soon!

See ``web3/beacon/main.py`` for available methods.
2 changes: 1 addition & 1 deletion docs/web3.eth.rst
Original file line number Diff line number Diff line change
Expand Up @@ -643,7 +643,7 @@ The following methods are available on the ``web3.eth`` namespace.
'0xe670ec64341771606e55d6b4ca35a1a6b75ee3d5145a99d05921026d1527331'
.. py:method:: Eth.signTransaction()
.. py:method:: Eth.signTransaction(transaction)
* Delegates to ``eth_signTransaction`` RPC Method.

Expand Down
7 changes: 5 additions & 2 deletions ethpm/_utils/chains.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import re
from typing import (
TYPE_CHECKING,
Any,
Tuple,
)
Expand All @@ -24,10 +25,12 @@
from ethpm.constants import (
SUPPORTED_CHAIN_IDS,
)
from web3 import Web3

if TYPE_CHECKING:
from web3 import Web3 # noqa: F401

def get_genesis_block_hash(web3: Web3) -> HexBytes:

def get_genesis_block_hash(web3: "Web3") -> HexBytes:
return web3.eth.getBlock(BlockNumber(0))["hash"]


Expand Down
7 changes: 5 additions & 2 deletions ethpm/_utils/deployments.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from typing import (
TYPE_CHECKING,
Any,
Dict,
Generator,
Expand All @@ -22,7 +23,9 @@
BytecodeLinkingError,
EthPMValidationError,
)
from web3 import Web3

if TYPE_CHECKING:
from web3 import Web3 # noqa: F401


def get_linked_deployments(deployments: Dict[str, Any]) -> Dict[str, Any]:
Expand Down Expand Up @@ -85,7 +88,7 @@ def normalize_linked_references(


def validate_deployments_tx_receipt(
deployments: Dict[str, Any], w3: Web3, allow_missing_data: bool = False
deployments: Dict[str, Any], w3: "Web3", allow_missing_data: bool = False
) -> None:
"""
Validate that address and block hash found in deployment data match what is found on-chain.
Expand Down
7 changes: 5 additions & 2 deletions ethpm/contract.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from typing import ( # noqa: F401
TYPE_CHECKING,
Any,
Dict,
List,
Expand Down Expand Up @@ -26,7 +27,6 @@
from ethpm.validation.misc import (
validate_empty_bytes,
)
from web3 import Web3
from web3._utils.validation import (
validate_address,
)
Expand All @@ -35,6 +35,9 @@
ContractConstructor,
)

if TYPE_CHECKING:
from web3 import Web3 # noqa: F401


class LinkableContract(Contract):
"""
Expand All @@ -57,7 +60,7 @@ def __init__(self, address: bytes, **kwargs: Any) -> None:

@classmethod
def factory(
cls, web3: Web3, class_name: str = None, **kwargs: Any
cls, web3: "Web3", class_name: str = None, **kwargs: Any
) -> Contract:
dep_link_refs = kwargs.get("unlinked_references")
bytecode = kwargs.get("bytecode")
Expand Down
13 changes: 8 additions & 5 deletions ethpm/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
Path,
)
from typing import (
TYPE_CHECKING,
Any,
Dict,
Generator,
Expand Down Expand Up @@ -78,18 +79,20 @@
from ethpm.validation.uri import (
validate_single_matching_uri,
)
from web3 import Web3
from web3._utils.validation import (
validate_address,
)
from web3.eth import (
Contract,
)

if TYPE_CHECKING:
from web3 import Web3 # noqa: F401


class Package(object):
def __init__(
self, manifest: Dict[str, Any], w3: Web3, uri: Optional[str] = None
self, manifest: Dict[str, Any], w3: "Web3", uri: Optional[str] = None
) -> None:
"""
A package should be created using one of the available
Expand All @@ -116,7 +119,7 @@ def __init__(
self.manifest = manifest
self._uri = uri

def update_w3(self, w3: Web3) -> "Package":
def update_w3(self, w3: "Web3") -> "Package":
"""
Returns a new instance of `Package` containing the same manifest,
but connected to a different web3 instance.
Expand Down Expand Up @@ -198,7 +201,7 @@ def contract_types(self) -> List[str]:
raise ValueError("No contract types found in manifest; {self.__repr__()}.")

@classmethod
def from_file(cls, file_path: Path, w3: Web3) -> "Package":
def from_file(cls, file_path: Path, w3: "Web3") -> "Package":
"""
Returns a ``Package`` instantiated by a manifest located at the provided Path.
``file_path`` arg must be a ``pathlib.Path`` instance.
Expand All @@ -216,7 +219,7 @@ def from_file(cls, file_path: Path, w3: Web3) -> "Package":
return cls(manifest, w3, file_path.as_uri())

@classmethod
def from_uri(cls, uri: URI, w3: Web3) -> "Package":
def from_uri(cls, uri: URI, w3: "Web3") -> "Package":
"""
Returns a Package object instantiated by a manifest located at a content-addressed URI.
A valid ``Web3`` instance is also required.
Expand Down
7 changes: 5 additions & 2 deletions ethpm/tools/builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
)
import tempfile
from typing import (
TYPE_CHECKING,
Any,
Callable,
Dict,
Expand Down Expand Up @@ -62,11 +63,13 @@
from ethpm.validation.package import (
validate_package_name,
)
from web3 import Web3
from web3._utils.validation import (
validate_address,
)

if TYPE_CHECKING:
from web3 import Web3 # noqa: F401


def build(obj: Dict[str, Any], *fns: Callable[..., Any]) -> Dict[str, Any]:
"""
Expand Down Expand Up @@ -837,7 +840,7 @@ def validate(manifest: Manifest) -> Manifest:


@curry
def as_package(w3: Web3, manifest: Manifest) -> Package:
def as_package(w3: "Web3", manifest: Manifest) -> Package:
"""
Return a Package object instantiated with the provided manifest and web3 instance.
"""
Expand Down
11 changes: 8 additions & 3 deletions ethpm/uri.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
import json
from typing import (
TYPE_CHECKING,
)

from eth_typing import (
URI,
Expand Down Expand Up @@ -35,11 +38,13 @@
from ethpm.exceptions import (
CannotHandleURI,
)
from web3 import Web3
from web3.types import (
BlockNumber,
)

if TYPE_CHECKING:
from web3 import Web3 # noqa F401


def resolve_uri_contents(uri: URI, fingerprint: bool = None) -> bytes:
resolvable_backends = get_resolvable_backends_for_uri(uri)
Expand Down Expand Up @@ -96,7 +101,7 @@ def is_supported_content_addressed_uri(uri: URI) -> bool:
return True


def create_latest_block_uri(w3: Web3, from_blocks_ago: int = 3) -> URI:
def create_latest_block_uri(w3: "Web3", from_blocks_ago: int = 3) -> URI:
"""
Creates a block uri for the given w3 instance.
Defaults to 3 blocks prior to the "latest" block to accommodate for block reorgs.
Expand All @@ -115,7 +120,7 @@ def create_latest_block_uri(w3: Web3, from_blocks_ago: int = 3) -> URI:


@curry
def check_if_chain_matches_chain_uri(web3: Web3, blockchain_uri: URI) -> bool:
def check_if_chain_matches_chain_uri(web3: "Web3", blockchain_uri: URI) -> bool:
chain_id, resource_type, resource_hash = parse_BIP122_uri(blockchain_uri)
genesis_block = web3.eth.getBlock("earliest")

Expand Down
2 changes: 1 addition & 1 deletion ethpm/validation/misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from web3 import Web3


def validate_w3_instance(w3: Web3) -> None:
def validate_w3_instance(w3: "Web3") -> None:
if w3 is None or not isinstance(w3, Web3):
raise ValueError("Package does not have valid web3 instance.")

Expand Down
7 changes: 5 additions & 2 deletions ethpm/validation/uri.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import hashlib
from typing import (
TYPE_CHECKING,
List,
)
from urllib import (
Expand Down Expand Up @@ -34,7 +35,9 @@
from ethpm.validation.package import (
validate_package_name,
)
from web3 import Web3

if TYPE_CHECKING:
from web3 import Web3 # noqa: F401


def validate_ipfs_uri(uri: str) -> None:
Expand Down Expand Up @@ -116,7 +119,7 @@ def validate_registry_uri_scheme(scheme: str) -> None:
)


def validate_single_matching_uri(all_blockchain_uris: List[str], w3: Web3) -> str:
def validate_single_matching_uri(all_blockchain_uris: List[str], w3: "Web3") -> str:
"""
Return a single block URI after validating that it is the *only* URI in
all_blockchain_uris that matches the w3 instance.
Expand Down
1 change: 0 additions & 1 deletion newsfragments/1806.feature.rst

This file was deleted.

2 changes: 2 additions & 0 deletions newsfragments/1813.bugfix.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
PR #1585 changed the error that was coming back from eth-tester when the Revert opcode was called,
which broke some tests in downstream libraries. This PR reverts back to raising the original error.
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
setup(
name='web3',
# *IMPORTANT*: Don't manually change the version here. Use the 'bumpversion' utility.
version='5.13.1',
version='5.14.0',
description="""Web3.py""",
long_description_content_type='text/markdown',
long_description=long_description,
Expand Down
Loading

0 comments on commit 7a9c4a9

Please sign in to comment.