Skip to content

Commit

Permalink
remove deprecated methods from Net module and add newsfragments
Browse files Browse the repository at this point in the history
  • Loading branch information
pacrob committed Jun 2, 2022
1 parent 5a44998 commit 7fe617f
Show file tree
Hide file tree
Showing 6 changed files with 2 additions and 48 deletions.
11 changes: 0 additions & 11 deletions docs/web3.net.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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:

Expand All @@ -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:

Expand Down
1 change: 1 addition & 0 deletions newsfragments/2480.breaking-change.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Remove deprecated methods from Geth, Parity and Net modules
1 change: 1 addition & 0 deletions newsfragments/2480.doc.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Remove deprecated methods from Geth, Parity, and Net modules
16 changes: 0 additions & 16 deletions tests/integration/test_ethereum_tester.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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,
Expand All @@ -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)
10 changes: 0 additions & 10 deletions web3/_utils/module_testing/net_module.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
11 changes: 0 additions & 11 deletions web3/net.py
Original file line number Diff line number Diff line change
@@ -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,
)
Expand All @@ -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()
Expand All @@ -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
Expand Down

0 comments on commit 7fe617f

Please sign in to comment.