diff --git a/docs/README-freebsd.md b/docs/README-freebsd.md index 63f61009d3..b77da83dc1 100644 --- a/docs/README-freebsd.md +++ b/docs/README-freebsd.md @@ -4,10 +4,11 @@ ### Prerequisites -Make sure you've UTF-8 defined for charset and lang in your [~/.login_conf](https://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/using-localization.html), +Make sure you've UTF-8 defined for charset and lang in your [~/.login_conf](https://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/using-localization.html), otherwise almost every Python 3 module will fail to install. `~/.login_conf`: + ``` me:\ :charset=UTF-8:\ @@ -17,6 +18,7 @@ me:\ Also make sure you've defined valid include and library paths in `~/.pydistutils.cfg`, otherwise native compilations fail. `~/.pydistutils.cfg`: + ``` [build_ext] include_dirs=/usr/local/include @@ -48,6 +50,7 @@ pip install -e .\[dev\] #### Prerequisites for integration tests: ##### geth (https://github.com/ethereum/go-ethereum/wiki/Installation-Instructions-for-FreeBSD) + ``` pkg install go cd /tmp @@ -56,23 +59,3 @@ cd go-ethereum make geth cp build/bin/geth /usr/local/bin/ ``` - -##### parity (https://github.com/paukstis/freebsd_parity/blob/v1.6/README.md) -``` -BROKEN (build crashes on FreeBSD 11.2) -``` - -``` -cd web3.py -tox -e py36-core -tox -e py36-ens -tox -e py36-integration -etc - -or - -py.test tests/core -py.test tests/ens -py.test tests/integration -etc -``` diff --git a/docs/contributing.rst b/docs/contributing.rst index 7dce894116..cdc1da9266 100644 --- a/docs/contributing.rst +++ b/docs/contributing.rst @@ -452,7 +452,5 @@ version explicitly, like ``make release bump="--new-version 4.0.0-alpha.1 devnum .. _how to create documentation: https://github.com/ethereum/snake-charmers-tactical-manual/blob/master/documentation.md .. _working on pull requests: https://help.github.com/articles/about-pull-requests/ .. _py-geth: https://github.com/ethereum/py-geth -.. _Github releases: https://github.com/openethereum/openethereum/releases -.. _Build the binary: https://github.com/openethereum/openethereum/#3-building- .. _pytest documentation: https://docs.pytest.org/en/latest .. _pytest documentation on fixtures: https://docs.pytest.org/en/latest/how-to/fixtures.html diff --git a/docs/index.rst b/docs/index.rst index 87b3c6a5b5..e04dbcaa16 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -69,7 +69,6 @@ Table of Contents web3.net web3.miner web3.geth - web3.parity web3.utils gas_price ens diff --git a/docs/middleware.rst b/docs/middleware.rst index 42dc7aa76e..f99ecafcc3 100644 --- a/docs/middleware.rst +++ b/docs/middleware.rst @@ -104,7 +104,7 @@ Middleware Order ~~~~~~~~~~~~~~~~~~ Think of the middleware as being layered in an onion, where you initiate a web3.py request at -the outermost layer of the onion, and the Ethereum node (like geth or parity) receives and responds +the outermost layer of the onion, and the Ethereum node (like geth) receives and responds to the request inside the innermost layer of the onion. Here is a (simplified) diagram: .. code-block:: none diff --git a/docs/node.rst b/docs/node.rst index 8fdf7ba473..19e066e68c 100644 --- a/docs/node.rst +++ b/docs/node.rst @@ -24,8 +24,6 @@ How do I choose which node to use? Due to the nature of Ethereum, this is largely a question of personal preference, but it has significant ramifications on security and usability. Further, node software is evolving quickly, so please do your own research about the current options. -We won't advocate for any particular node, -but list some popular options and some basic details on each. One of the key decisions is whether to use a local node or a hosted node. A quick summary is at :ref:`local_vs_hosted`. @@ -47,20 +45,16 @@ node manage keys for you (a popular option), you must use a local node. Note that even if you run a node on your own machine, you are still trusting the node software with any accounts you create on the node. -The most popular self-run node options are: - -- `geth (go-ethereum) `_ -- `parity `_ - -You can find a fuller list of node software at `ethdocs.org -`_. +You can find a list of node software at `ethereum.org +`__. Some people decide that the time it takes to sync a local node from scratch is too high, especially if they are just exploring Ethereum for the first time. One way to work around this issue is to use a hosted node. -The most popular hosted node option is `Infura `_. -You can connect to it as if it were a local node, +Hosted node options can also be found at +`ethereum.org `__. +You can connect to a hosted node as if it were a local node, with a few caveats. It cannot (and *should not*) host private keys for you, meaning that some common methods like :meth:`w3.eth.send_transaction() ` are not directly available. To send transactions @@ -94,20 +88,10 @@ then you connect to the main Ethereum network. If you want to test these things without using real ether, though, then you need to connect to a test network. There are several test networks to -choose from, Rinkeby and Goerli being the longest running. - -There are some alternative networks that limit the damage of spam attacks, but -they are not standardized across node software. Geth runs their own (Rinkeby). -See a full comparison in this `Stackexchange Q&A -`_. - -So roughly, choose this way: - -- If using Parity, connect to Kovan -- If using Geth, connect to Rinkeby -- If using a different node, or testing mining, connect to Ropsten +choose from; view the list on +`ethereum.org `__. -Each of their networks has their own version of Ether. Main network ether must +Each network has its own version of Ether. Main network ether must be purchased, naturally, but test network ether is usually available for free. See :ref:`faucets` diff --git a/docs/web3.eth.account.rst b/docs/web3.eth.account.rst index 2c609fe67a..b4ce47b384 100644 --- a/docs/web3.eth.account.rst +++ b/docs/web3.eth.account.rst @@ -10,7 +10,7 @@ Local vs Hosted Nodes Local Node A local node is started and controlled by you. It is as safe as you keep it. - When you run ``geth`` or ``parity`` on your machine, you are running a local node. + When you run ``geth`` on your machine, for example, you are running a local node. Hosted Node A hosted node is controlled by someone else. When you connect to Infura, you are diff --git a/docs/web3.geth.rst b/docs/web3.geth.rst index 4d928764a5..d21bf2a8e0 100644 --- a/docs/web3.geth.rst +++ b/docs/web3.geth.rst @@ -312,7 +312,7 @@ GethTxPool API The ``web3.geth.txpool`` object exposes methods to interact with the RPC APIs under the ``txpool_`` namespace. These methods are only exposed under the ``geth`` namespace -since they are not standard nor supported in Parity. +since they are not standard. The following methods are available on the ``web3.geth.txpool`` namespace. diff --git a/docs/web3.main.rst b/docs/web3.main.rst index 4a99351726..aa92c2e293 100644 --- a/docs/web3.main.rst +++ b/docs/web3.main.rst @@ -359,10 +359,6 @@ Each ``Web3`` instance also exposes these namespaced API modules. See :doc:`./web3.geth` -.. py:attribute:: Web3.parity - - See :doc:`./web3.parity` - These internal modules inherit from the ``web3.module.Module`` class which give them some configurations internal to the web3.py library. diff --git a/docs/web3.parity.rst b/docs/web3.parity.rst deleted file mode 100644 index cf4c2cf7e7..0000000000 --- a/docs/web3.parity.rst +++ /dev/null @@ -1,82 +0,0 @@ -Parity API -========== - - .. note:: Parity is no longer being maintained, so this API will no longer be receiving active updates. It will be removed in v6. - -.. py:module:: web3.parity - -The ``web3.parity`` object exposes modules that enable you to interact with the JSON-RPC endpoints supported by `Parity `_ that are not defined in the standard set of Ethereum JSONRPC endpoints according to `EIP 1474 `_. - -.. py:module:: web3.parity.personal - -ParityPersonal --------------- - -The following methods are available on the ``web3.parity.personal`` namespace. - -.. py:method:: list_accounts() - - * Delegates to ``personal_listAccounts`` RPC Method - - Returns the list of known accounts. - - .. code-block:: python - - >>> web3.parity.personal.list_accounts() - ['0xd3CdA913deB6f67967B99D67aCDFa1712C293601'] - - -.. py:method:: import_raw_key(self, private_key, passphrase) - - * Delegates to ``personal_importRawKey`` RPC Method - - Adds the given ``private_key`` to the node's keychain, encrypted with the - given ``passphrase``. Returns the address of the imported account. - - .. code-block:: python - - >>> web3.parity.personal.import_raw_key(some_private_key, 'the-passphrase') - '0xd3CdA913deB6f67967B99D67aCDFa1712C293601' - -.. py:method:: new_account(self, password) - - * Delegates to ``personal_newAccount`` RPC Method - - Generates a new account in the node's keychain encrypted with the - given ``passphrase``. Returns the address of the created account. - - .. code-block:: python - - >>> web3.parity.personal.new_account('the-passphrase') - '0xd3CdA913deB6f67967B99D67aCDFa1712C293601' - -.. py:method:: unlock_account(self, account, passphrase, duration=None) - - * Delegates to ``personal_unlockAccount`` RPC Method - - Unlocks the given ``account`` for ``duration`` seconds. If ``duration`` is - ``None`` then the account will remain unlocked indefinitely. Returns - boolean as to whether the account was successfully unlocked. - - .. code-block:: python - - # Invalid call to personal_unlockAccount on Parity currently returns True, due to Parity bug - >>> web3.parity.personal.unlock_account('0xd3CdA913deB6f67967B99D67aCDFa1712C293601', 'wrong-passphrase') - True - >>> web3.parity.personal.unlock_account('0xd3CdA913deB6f67967B99D67aCDFa1712C293601', 'the-passphrase') - True - -.. py:method:: send_transaction(self, transaction, passphrase) - - * Delegates to ``personal_sendTransaction`` RPC Method - - Sends the transaction. - -.. py:method:: sign_typed_data(self, jsonMessage, account, passphrase) - - * Delegates to ``personal_signTypedData`` RPC Method - - Please note that the ``jsonMessage`` argument is the loaded JSON Object - and **NOT** the JSON String itself. - - Signs the ``Structured Data`` (or ``Typed Data``) with the passphrase of the given ``account`` diff --git a/newsfragments/2718.breaking.rst b/newsfragments/2718.breaking.rst new file mode 100644 index 0000000000..eb1d881074 --- /dev/null +++ b/newsfragments/2718.breaking.rst @@ -0,0 +1 @@ +Remove Parity module and references. diff --git a/web3/_utils/method_formatters.py b/web3/_utils/method_formatters.py index 9ade35e6e7..1f49e49916 100644 --- a/web3/_utils/method_formatters.py +++ b/web3/_utils/method_formatters.py @@ -88,7 +88,6 @@ from web3.exceptions import ( BlockNotFound, ContractLogicError, - InvalidParityMode, OffchainLookup, TransactionNotFound, ) @@ -642,16 +641,9 @@ def raise_contract_logic_error_on_revert(response: RPCResponse) -> RPCResponse: return response -def raise_invalid_parity_mode(response: RPCResponse) -> NoReturn: - # eth-tester sends back an invalid RPCError, which makes mypy complain - error_message = response["error"].get("message") # type: ignore - raise InvalidParityMode(error_message) - - ERROR_FORMATTERS: Dict[RPCEndpoint, Callable[..., Any]] = { RPC.eth_estimateGas: raise_contract_logic_error_on_revert, RPC.eth_call: raise_contract_logic_error_on_revert, - RPC.parity_setMode: raise_invalid_parity_mode, } diff --git a/web3/_utils/rpc_abi.py b/web3/_utils/rpc_abi.py index 08baa90bad..a38ba679d6 100644 --- a/web3/_utils/rpc_abi.py +++ b/web3/_utils/rpc_abi.py @@ -125,14 +125,6 @@ class RPC: net_peerCount = RPCEndpoint("net_peerCount") net_version = RPCEndpoint("net_version") - # parity - parity_addReservedPeer = RPCEndpoint("parity_addReservedPeer") - parity_enode = RPCEndpoint("parity_enode") - parity_listStorageKeys = RPCEndpoint("parity_listStorageKeys") - parity_netPeers = RPCEndpoint("parity_netPeers") - parity_mode = RPCEndpoint("parity_mode") - parity_setMode = RPCEndpoint("parity_setMode") - # personal personal_ecRecover = RPCEndpoint("personal_ecRecover") personal_importRawKey = RPCEndpoint("personal_importRawKey") @@ -220,8 +212,6 @@ class RPC: "personal_sign": [None, "address", None], "personal_signTypedData": [None, "address", None], "trace_call": TRACE_PARAMS_ABIS, - # parity - "parity_listStorageKeys": ["address", None, None, None], } diff --git a/web3/exceptions.py b/web3/exceptions.py index 8f4daab8ee..a24a95c2f2 100644 --- a/web3/exceptions.py +++ b/web3/exceptions.py @@ -259,14 +259,6 @@ def __init__(self, payload: Dict[str, Any]) -> None: super().__init__() -class InvalidParityMode(TypeError, ValueError): - # Inherits from TypeError for backwards compatibility - """ - Raised when web3.parity.set_mode() is called with no or invalid args - """ - pass - - class InvalidTransaction(Exception): """ Raised when a transaction includes an invalid combination of arguments. diff --git a/web3/main.py b/web3/main.py index 7f47a04c39..f38c321b9c 100644 --- a/web3/main.py +++ b/web3/main.py @@ -93,10 +93,6 @@ AsyncNet, Net, ) -from web3.parity import ( - Parity, - ParityPersonal, -) from web3.providers import ( AsyncBaseProvider, BaseProvider, @@ -138,12 +134,6 @@ def get_default_modules() -> Dict[str, Union[Type[Module], Sequence[Any]]]: "eth": Eth, "net": Net, "version": Version, - "parity": ( - Parity, - { - "personal": ParityPersonal, - }, - ), "geth": ( Geth, { @@ -231,7 +221,6 @@ def to_checksum_address(value: Union[AnyAddress, str, bytes]) -> ChecksumAddress # mypy Types eth: Eth - parity: Parity geth: Geth net: Net async_net: AsyncNet diff --git a/web3/parity.py b/web3/parity.py deleted file mode 100644 index d3a4c7f4a0..0000000000 --- a/web3/parity.py +++ /dev/null @@ -1,212 +0,0 @@ -from typing import ( - Callable, - List, - Optional, - Tuple, - Union, -) -import warnings - -from eth_typing import ( - Address, - ChecksumAddress, - Hash32, - HexStr, -) -from eth_utils import ( - is_checksum_address, -) -from eth_utils.toolz import ( - assoc, -) - -from web3._utils.personal import ( - ec_recover, - import_raw_key, - list_accounts, - new_account, - send_transaction, - sign, - sign_typed_data, - unlock_account, -) -from web3._utils.rpc_abi import ( - RPC, -) -from web3.method import ( - Method, - default_root_munger, -) -from web3.module import ( - Module, -) -from web3.types import ( - ENS, - BlockIdentifier, - EnodeURI, - ParityBlockTrace, - ParityFilterParams, - ParityFilterTrace, - ParityMode, - ParityNetPeers, - ParityTraceMode, - TxParams, - _Hash32, -) - - -class ParityPersonal(Module): - """ - https://wiki.parity.io/JSONRPC-personal-module - """ - - ec_recover = ec_recover - import_raw_key = import_raw_key - list_accounts = list_accounts - new_account = new_account - send_transaction = send_transaction - sign = sign - sign_typed_data = sign_typed_data - unlock_account = unlock_account - - -class Parity(Module): - """ - https://paritytech.github.io/wiki/JSONRPC-parity-module - """ - - _default_block: BlockIdentifier = "latest" - personal: ParityPersonal - - enode: Method[Callable[[], str]] = Method( - RPC.parity_enode, - is_property=True, - ) - - """ property default_block """ - - @property - def default_block(self) -> BlockIdentifier: - return self._default_block - - @default_block.setter - def default_block(self, value: BlockIdentifier) -> None: - self._default_block = value - - @property - def defaultBlock(self) -> BlockIdentifier: - warnings.warn( - "defaultBlock is deprecated in favor of default_block", - category=DeprecationWarning, - ) - return self._default_block - - @defaultBlock.setter - def defaultBlock(self, value: BlockIdentifier) -> None: - warnings.warn( - "defaultBlock is deprecated in favor of default_block", - category=DeprecationWarning, - ) - self._default_block = value - - def list_storage_keys_munger( - self, - address: Union[Address, ChecksumAddress, ENS, Hash32], - quantity: int, - hash_: Hash32, - block_identifier: Optional[BlockIdentifier] = None, - ) -> Tuple[ - Union[Address, ChecksumAddress, ENS, Hash32], int, Hash32, BlockIdentifier - ]: - if block_identifier is None: - block_identifier = self.default_block - return (address, quantity, hash_, block_identifier) - - list_storage_keys: Method[Callable[..., List[Hash32]]] = Method( - RPC.parity_listStorageKeys, - mungers=[list_storage_keys_munger], - ) - - net_peers: Method[Callable[[], ParityNetPeers]] = Method( - RPC.parity_netPeers, is_property=True - ) - - add_reserved_peer: Method[Callable[[EnodeURI], bool]] = Method( - RPC.parity_addReservedPeer, - mungers=[default_root_munger], - ) - - def trace_replay_transaction_munger( - self, - block_identifier: Union[_Hash32, BlockIdentifier], - mode: ParityTraceMode = ["trace"], - ) -> Tuple[Union[BlockIdentifier, _Hash32], ParityTraceMode]: - return (block_identifier, mode) - - trace_replay_transaction: Method[Callable[..., ParityBlockTrace]] = Method( - RPC.trace_replayTransaction, - mungers=[trace_replay_transaction_munger], - ) - - trace_replay_block_transactions: Method[ - Callable[..., List[ParityBlockTrace]] - ] = Method( - RPC.trace_replayBlockTransactions, mungers=[trace_replay_transaction_munger] - ) - - trace_block: Method[Callable[[BlockIdentifier], List[ParityBlockTrace]]] = Method( - RPC.trace_block, - mungers=[default_root_munger], - ) - - trace_filter: Method[ - Callable[[ParityFilterParams], List[ParityFilterTrace]] - ] = Method( - RPC.trace_filter, - mungers=[default_root_munger], - ) - - trace_transaction: Method[Callable[[_Hash32], List[ParityFilterTrace]]] = Method( - RPC.trace_transaction, - mungers=[default_root_munger], - ) - - def trace_call_munger( - self, - transaction: TxParams, - mode: ParityTraceMode = ["trace"], - block_identifier: Optional[BlockIdentifier] = None, - ) -> Tuple[TxParams, ParityTraceMode, BlockIdentifier]: - # TODO: move to middleware - if "from" not in transaction and is_checksum_address( - self.w3.eth.default_account - ): - transaction = assoc(transaction, "from", self.w3.eth.default_account) - - # TODO: move to middleware - if block_identifier is None: - block_identifier = self.default_block - - return (transaction, mode, block_identifier) - - trace_call: Method[Callable[..., ParityBlockTrace]] = Method( - RPC.trace_call, - mungers=[trace_call_munger], - ) - - def trace_transactions_munger( - self, raw_transaction: HexStr, mode: ParityTraceMode = ["trace"] - ) -> Tuple[HexStr, ParityTraceMode]: - return (raw_transaction, mode) - - trace_raw_transaction: Method[Callable[..., ParityBlockTrace]] = Method( - RPC.trace_rawTransaction, - mungers=[trace_transactions_munger], - ) - - set_mode: Method[Callable[[ParityMode], bool]] = Method( - RPC.parity_setMode, - mungers=[default_root_munger], - ) - - mode: Method[Callable[[], ParityMode]] = Method(RPC.parity_mode, is_property=True) diff --git a/web3/providers/ipc.py b/web3/providers/ipc.py index 61b235521a..dd3688d9e7 100644 --- a/web3/providers/ipc.py +++ b/web3/providers/ipc.py @@ -92,48 +92,16 @@ def get_default_ipc_path() -> str: # type: ignore if os.path.exists(ipc_path): return ipc_path - ipc_path = os.path.expanduser( - os.path.join( - "~", - "Library", - "Application Support", - "io.parity.ethereum", - "jsonrpc.ipc", - ) - ) - if os.path.exists(ipc_path): - return ipc_path - - base_trinity_path = Path("~").expanduser() / ".local" / "share" / "trinity" - ipc_path = str(base_trinity_path / "mainnet" / "ipcs-eth1" / "jsonrpc.ipc") - if Path(ipc_path).exists(): - return str(ipc_path) - elif sys.platform.startswith("linux") or sys.platform.startswith("freebsd"): ipc_path = os.path.expanduser(os.path.join("~", ".ethereum", "geth.ipc")) if os.path.exists(ipc_path): return ipc_path - ipc_path = os.path.expanduser( - os.path.join("~", ".local", "share", "io.parity.ethereum", "jsonrpc.ipc") - ) - if os.path.exists(ipc_path): - return ipc_path - - base_trinity_path = Path("~").expanduser() / ".local" / "share" / "trinity" - ipc_path = str(base_trinity_path / "mainnet" / "ipcs-eth1" / "jsonrpc.ipc") - if Path(ipc_path).exists(): - return str(ipc_path) - elif sys.platform == "win32": ipc_path = os.path.join("\\\\", ".", "pipe", "geth.ipc") if os.path.exists(ipc_path): return ipc_path - ipc_path = os.path.join("\\\\", ".", "pipe", "jsonrpc.ipc") - if os.path.exists(ipc_path): - return ipc_path - else: raise ValueError( f"Unsupported platform '{sys.platform}'. Only darwin/linux/win32/" diff --git a/web3/types.py b/web3/types.py index d3d4da1cd5..24fa43e05f 100644 --- a/web3/types.py +++ b/web3/types.py @@ -423,29 +423,3 @@ class GethWallet(TypedDict): accounts: Sequence[Dict[str, str]] status: str url: str - - -# -# web3.parity types -# - -ParityBlockTrace = NewType("ParityBlockTrace", Dict[str, Any]) -ParityFilterTrace = NewType("ParityFilterTrace", Dict[str, Any]) -ParityMode = Literal["active", "passive", "dark", "offline"] -ParityTraceMode = Sequence[Literal["trace", "vmTrace", "stateDiff"]] - - -class ParityNetPeers(TypedDict): - active: int - connected: int - max: int - peers: List[Dict[Any, Any]] - - -class ParityFilterParams(TypedDict, total=False): - after: int - count: int - fromAddress: Sequence[Union[Address, ChecksumAddress, ENS]] - fromBlock: BlockIdentifier - toAddress: Sequence[Union[Address, ChecksumAddress, ENS]] - toBlock: BlockIdentifier