From 7fe617fdad26e5be30a2a4051bd194df7ad56910 Mon Sep 17 00:00:00 2001 From: pacrob Date: Thu, 2 Jun 2022 14:03:51 -0600 Subject: [PATCH] remove deprecated methods from Net module and add newsfragments --- docs/web3.net.rst | 11 ----------- newsfragments/2480.breaking-change.rst | 1 + newsfragments/2480.doc.rst | 1 + tests/integration/test_ethereum_tester.py | 16 ---------------- web3/_utils/module_testing/net_module.py | 10 ---------- web3/net.py | 11 ----------- 6 files changed, 2 insertions(+), 48 deletions(-) create mode 100644 newsfragments/2480.breaking-change.rst create mode 100644 newsfragments/2480.doc.rst diff --git a/docs/web3.net.rst b/docs/web3.net.rst index a774aa61c7..73448c0397 100644 --- a/docs/web3.net.rst +++ b/docs/web3.net.rst @@ -12,11 +12,6 @@ Properties The following properties are available on the ``web3.net`` namespace. -.. py:method:: chainId - :property: - - .. warning:: Deprecated: This property is deprecated as of EIP 1474. - .. py:method:: listening :property: @@ -41,12 +36,6 @@ The following properties are available on the ``web3.net`` namespace. >>> web3.net.peer_count 1 -.. py:method:: peerCount - :property: - - .. warning:: Deprecated: This property is deprecated in favor of - :attr:`~web3.geth.admin.peer_count` - .. py:method:: version :property: diff --git a/newsfragments/2480.breaking-change.rst b/newsfragments/2480.breaking-change.rst new file mode 100644 index 0000000000..5422602b39 --- /dev/null +++ b/newsfragments/2480.breaking-change.rst @@ -0,0 +1 @@ +Remove deprecated methods from Geth, Parity and Net modules diff --git a/newsfragments/2480.doc.rst b/newsfragments/2480.doc.rst new file mode 100644 index 0000000000..d6f8ebb17e --- /dev/null +++ b/newsfragments/2480.doc.rst @@ -0,0 +1 @@ +Remove deprecated methods from Geth, Parity, and Net modules diff --git a/tests/integration/test_ethereum_tester.py b/tests/integration/test_ethereum_tester.py index 2015c170fb..c0d07b1b8a 100644 --- a/tests/integration/test_ethereum_tester.py +++ b/tests/integration/test_ethereum_tester.py @@ -372,10 +372,6 @@ def test_eth_call_old_contract_state(self, eth_tester, w3, math_contract, unlock def test_eth_get_storage_at(self, w3, emitter_contract_address): super().test_eth_get_storage_at(w3, emitter_contract_address) - @pytest.mark.xfail(reason='json-rpc method is not implemented on eth-tester') - def test_eth_getStorageAt_deprecated(self, w3, emitter_contract_address): - super().test_eth_getStorageAt_deprecated(w3, emitter_contract_address) - @pytest.mark.xfail(reason='json-rpc method is not implemented on eth-tester') def test_eth_get_storage_at_ens_name(self, w3, emitter_contract_address): super().test_eth_get_storage_at_ens_name(w3, emitter_contract_address) @@ -509,10 +505,6 @@ class TestEthereumTesterPersonalModule(GoEthereumPersonalModuleTest): GoEthereumPersonalModuleTest.test_personal_sign_and_ecrecover, ValueError, ) - test_personal_sign_and_ecrecover_deprecated = not_implemented( - GoEthereumPersonalModuleTest.test_personal_sign_and_ecrecover, - ValueError, - ) # Test overridden here since eth-tester returns False rather than None for failed unlock def test_personal_unlock_account_failure(self, @@ -521,14 +513,6 @@ def test_personal_unlock_account_failure(self, result = w3.geth.personal.unlock_account(unlockable_account_dual_type, 'bad-password') assert result is False - def test_personal_unlockAccount_failure_deprecated(self, - w3, - unlockable_account_dual_type): - with pytest.warns(DeprecationWarning, - match="unlockAccount is deprecated in favor of unlock_account"): - result = w3.geth.personal.unlockAccount(unlockable_account_dual_type, 'bad-password') - assert result is False - @pytest.mark.xfail(raises=ValueError, reason="list_wallets not implemented in eth-tester") def test_personal_list_wallets(self, w3: "Web3") -> None: super().test_personal_list_wallets(w3) diff --git a/web3/_utils/module_testing/net_module.py b/web3/_utils/module_testing/net_module.py index dd894a735a..2ece0efb7f 100644 --- a/web3/_utils/module_testing/net_module.py +++ b/web3/_utils/module_testing/net_module.py @@ -30,16 +30,6 @@ def test_net_peer_count(self, w3: "Web3") -> None: assert is_integer(peer_count) - def test_net_peerCount(self, w3: "Web3") -> None: - with pytest.warns(DeprecationWarning): - peer_count = w3.net.peerCount - - assert is_integer(peer_count) - - def test_net_chainId_deprecation(self, w3: "Web3") -> None: - with pytest.raises(DeprecationWarning): - w3.net.chainId - class AsyncNetModuleTest: @pytest.mark.asyncio diff --git a/web3/net.py b/web3/net.py index fc5e3fc6d1..7f407ac487 100644 --- a/web3/net.py +++ b/web3/net.py @@ -1,14 +1,12 @@ from typing import ( Awaitable, Callable, - NoReturn, ) from web3._utils.rpc_abi import ( RPC, ) from web3.method import ( - DeprecatedMethod, Method, default_root_munger, ) @@ -33,10 +31,6 @@ class Net(Module): mungers=[default_root_munger], ) - @property - def chainId(self) -> NoReturn: - raise DeprecationWarning("This method has been deprecated in EIP 1474.") - @property def listening(self) -> bool: return self._listening() @@ -49,11 +43,6 @@ def peer_count(self) -> int: def version(self) -> str: return self._version() - # - # Deprecated Methods - # - peerCount = DeprecatedMethod(peer_count, 'peerCount', 'peer_count') # type: ignore - class AsyncNet(Module): is_async = True