Skip to content

removed more depecrated methods in geth and parity #2480

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
Jun 8, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions docs/providers.rst
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ For example, the following retrieves the client enode endpoint for both geth and
enode = w3.parity.enode

elif connected and w3.clientVersion.startswith('Geth'):
enode = w3.geth.admin.nodeInfo['enode']
enode = w3.geth.admin.node_info['enode']

else:
enode = None
Expand Down Expand Up @@ -399,7 +399,7 @@ AsyncHTTPProvider
... 'admin' : (AsyncGethAdmin,)})
... },
... middlewares=[] # See supported middleware section below for middleware options
... )
... )
>>> custom_session = ClientSession() # If you want to pass in your own session
>>> await w3.provider.cache_async_session(custom_session) # This method is an async method so it needs to be handled accordingly

Expand Down
70 changes: 0 additions & 70 deletions docs/web3.geth.rst
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,6 @@ The ``web3.geth.admin`` object exposes methods to interact with the RPC APIs und
}


.. py:method:: nodeInfo()

.. warning:: Deprecated: This method is deprecated in favor of
:meth:`~web3.geth.admin.node_info()`


.. py:method:: peers()

* Delegates to ``admin_peers`` RPC Method
Expand Down Expand Up @@ -118,10 +112,6 @@ The ``web3.geth.admin`` object exposes methods to interact with the RPC APIs und
True


.. py:method:: addPeer(node_url)

.. warning:: Deprecated: This method is deprecated in favor of :meth:`~web3.geth.admin.add_peer()`

.. py:method:: start_rpc(host='localhost', port=8545, cors="", apis="eth,net,web3")

* Delegates to ``admin_startRPC`` RPC Method
Expand All @@ -137,12 +127,6 @@ The ``web3.geth.admin`` object exposes methods to interact with the RPC APIs und
True


.. py:method:: startRPC(host='localhost', port=8545, cors="", apis="eth,net,web3")

.. warning:: Deprecated: This method is deprecated in favor of
:meth:`~web3.geth.admin.start_rpc()`


.. py:method:: start_ws(host='localhost', port=8546, cors="", apis="eth,net,web3")

* Delegates to ``admin_startWS`` RPC Method
Expand All @@ -158,12 +142,6 @@ The ``web3.geth.admin`` object exposes methods to interact with the RPC APIs und
True


.. py:method:: startWS(host='localhost', port=8546, cors="", apis="eth,net,web3")

.. warning:: Deprecated: This method is deprecated in favor of
:meth:`~web3.geth.admin.start_ws()`


.. py:method:: stop_rpc()

* Delegates to ``admin_stopRPC`` RPC Method
Expand All @@ -176,12 +154,6 @@ The ``web3.geth.admin`` object exposes methods to interact with the RPC APIs und
True


.. py:method:: stopRPC()

.. warning:: Deprecated: This method is deprecated in favor of
:meth:`~web3.geth.admin.stop_rpc()`


.. py:method:: stop_ws()

* Delegates to ``admin_stopWS`` RPC Method
Expand All @@ -194,12 +166,6 @@ The ``web3.geth.admin`` object exposes methods to interact with the RPC APIs und
True


.. py:method:: stopWS()

.. warning:: Deprecated: This method is deprecated in favor of
:meth:`~web3.geth.admin.stop_ws()`


.. py:module:: web3.geth.personal

GethPersonal API
Expand All @@ -219,12 +185,6 @@ The following methods are available on the ``web3.geth.personal`` namespace.
['0xd3CdA913deB6f67967B99D67aCDFa1712C293601']


.. py:method:: listAccounts()

.. warning:: Deprecated: This method is deprecated in favor of
:meth:`~web3.geth.personal.list_accounts()`


.. py:method:: list_wallets()

* Delegates to ``personal_listWallets`` RPC Method
Expand Down Expand Up @@ -257,12 +217,6 @@ The following methods are available on the ``web3.geth.personal`` namespace.
'0xd3CdA913deB6f67967B99D67aCDFa1712C293601'


.. py:method:: importRawKey()

.. warning:: Deprecated: This method is deprecated in favor of
:meth:`~web3.geth.personal.import_raw_key()`


.. py:method:: new_account(self, passphrase)

* Delegates to ``personal_newAccount`` RPC Method
Expand All @@ -276,12 +230,6 @@ The following methods are available on the ``web3.geth.personal`` namespace.
'0xd3CdA913deB6f67967B99D67aCDFa1712C293601'


.. py:method:: newAccount()

.. warning:: Deprecated: This method is deprecated in favor of
:meth:`~web3.geth.personal.new_account()`


.. py:method:: lock_account(self, account)

* Delegates to ``personal_lockAccount`` RPC Method
Expand All @@ -293,12 +241,6 @@ The following methods are available on the ``web3.geth.personal`` namespace.
>>> web3.geth.personal.lock_account('0xd3CdA913deB6f67967B99D67aCDFa1712C293601')


.. py:method:: lockAccount()

.. warning:: Deprecated: This method is deprecated in favor of
:meth:`~web3.geth.personal.lock_account()`


.. py:method:: unlock_account(self, account, passphrase, duration=None)

* Delegates to ``personal_unlockAccount`` RPC Method
Expand All @@ -317,25 +259,13 @@ The following methods are available on the ``web3.geth.personal`` namespace.
True


.. py:method:: unlockAccount()

.. warning:: Deprecated: This method is deprecated in favor of
:meth:`~web3.geth.personal.unlock_account()`


.. py:method:: send_transaction(self, transaction, passphrase)

* Delegates to ``personal_sendTransaction`` RPC Method

Sends the transaction.


.. py:method:: sendTransaction()

.. warning:: Deprecated: This method is deprecated in favor of
:meth:`~web3.geth.personal.send_transaction()`


.. py:module:: web3.geth.txpool

GethTxPool API
Expand Down
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
29 changes: 0 additions & 29 deletions docs/web3.parity.rst
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,6 @@ The following methods are available on the ``web3.parity.personal`` namespace.
>>> web3.parity.personal.list_accounts()
['0xd3CdA913deB6f67967B99D67aCDFa1712C293601']

.. py:method:: listAccounts

.. warning:: Deprecated: This method is deprecated in favor of
:meth:`~web3.parity.personal.list_accounts()`

.. py:method:: import_raw_key(self, private_key, passphrase)

Expand All @@ -42,11 +38,6 @@ The following methods are available on the ``web3.parity.personal`` namespace.
>>> web3.parity.personal.import_raw_key(some_private_key, 'the-passphrase')
'0xd3CdA913deB6f67967B99D67aCDFa1712C293601'

.. py:method:: importRawKey(self, private_key, passphrase)

.. warning:: Deprecated: This method is deprecated in favor of
:meth:`~web3.parity.personal.import_raw_key()`

.. py:method:: new_account(self, password)

* Delegates to ``personal_newAccount`` RPC Method
Expand All @@ -59,11 +50,6 @@ The following methods are available on the ``web3.parity.personal`` namespace.
>>> web3.parity.personal.new_account('the-passphrase')
'0xd3CdA913deB6f67967B99D67aCDFa1712C293601'

.. py:method:: newAccount(self, password)

.. warning:: Deprecated: This method is deprecated in favor of
:meth:`~web3.parity.personal.new_account()`

.. py:method:: unlock_account(self, account, passphrase, duration=None)

* Delegates to ``personal_unlockAccount`` RPC Method
Expand All @@ -80,22 +66,12 @@ The following methods are available on the ``web3.parity.personal`` namespace.
>>> web3.parity.personal.unlock_account('0xd3CdA913deB6f67967B99D67aCDFa1712C293601', 'the-passphrase')
True

.. py:method:: unlockAccount(self, account, passphrase, duration=None)

.. warning:: Deprecated: This method is deprecated in favor of
:meth:`~web3.parity.personal.unlock_account()`

.. py:method:: send_transaction(self, transaction, passphrase)

* Delegates to ``personal_sendTransaction`` RPC Method

Sends the transaction.

.. py:method:: sendTransaction(self, account, passphrase, duration=None)

.. warning:: Deprecated: This method is deprecated in favor of
:meth:`~web3.parity.personal.send_transaction()`

.. py:method:: sign_typed_data(self, jsonMessage, account, passphrase)

* Delegates to ``personal_signTypedData`` RPC Method
Expand All @@ -104,8 +80,3 @@ The following methods are available on the ``web3.parity.personal`` namespace.
and **NOT** the JSON String itself.

Signs the ``Structured Data`` (or ``Typed Data``) with the passphrase of the given ``account``

.. py:method:: signTypedData(self, jsonMessage, account, passphrase)

.. warning:: Deprecated: This method is deprecated in favor of
:meth:`~web3.parity.personal.sign_typed_data()`
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
13 changes: 0 additions & 13 deletions tests/core/admin-module/test_admin_addPeer.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,3 @@
import pytest


def test_admin_addPeer(w3, skip_if_testrpc):
skip_if_testrpc(w3)

with pytest.warns(DeprecationWarning):
result = w3.geth.admin.addPeer(
'enode://44826a5d6a55f88a18298bca4773fca5749cdc3a5c9f308aa7d810e9b31123f3e7c5fba0b1d70aac5308426f47df2a128a6747040a3815cc7dd7167d03be320d@127.0.0.1:30304', # noqa: E501
)
assert result is True


def test_admin_add_peer(w3, skip_if_testrpc):
skip_if_testrpc(w3)

Expand Down
13 changes: 0 additions & 13 deletions tests/core/admin-module/test_admin_nodeInfo.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,3 @@
import pytest


def test_admin_nodeInfo(w3, skip_if_testrpc):
skip_if_testrpc(w3)

with pytest.warns(DeprecationWarning):
node_info = w3.geth.admin.nodeInfo

assert 'enode' in node_info
assert 'id' in node_info


def test_admin_node_info(w3, skip_if_testrpc):
skip_if_testrpc(w3)

Expand Down
2 changes: 1 addition & 1 deletion tests/core/eth-module/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ def extra_accounts(w3, account_password):
num_accounts_to_create = 10 - len(w3.eth.accounts)

for i in range(num_accounts_to_create):
w3.personal.newAccount(account_password)
w3.personal.new_account(account_password)

return w3.eth.accounts

Expand Down
27 changes: 1 addition & 26 deletions tests/core/mining-module/test_miner_setExtra.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import pytest
import random

from eth_utils import (
Expand All @@ -24,7 +23,7 @@ def test_miner_set_extra(web3_empty, wait_for_block):
# sanity
assert initial_extra != new_extra_data

web3.geth.miner.setExtra(new_extra_data)
web3.geth.miner.set_extra(new_extra_data)

with Timeout(60) as timeout:
while True:
Expand All @@ -36,27 +35,3 @@ def test_miner_set_extra(web3_empty, wait_for_block):
after_extra = decode_hex(web3.eth.get_block(web3.eth.block_number)['extraData'])

assert after_extra == new_extra_data


@flaky(max_runs=3)
def test_miner_setExtra(web3_empty, wait_for_block):
web3 = web3_empty

initial_extra = decode_hex(web3.eth.get_block(web3.eth.block_number)['extraData'])

new_extra_data = b'-this-is-32-bytes-of-extra-data-'

# sanity
assert initial_extra != new_extra_data

with pytest.warns(DeprecationWarning):
web3.geth.miner.setExtra(new_extra_data)
with Timeout(60) as timeout:
while True:
extra_data = decode_hex(web3.eth.get_block(web3.eth.block_number)['extraData'])
if extra_data == new_extra_data:
break
timeout.sleep(random.random())

after_extra = decode_hex(web3.eth.get_block(web3.eth.block_number)['extraData'])
assert after_extra == new_extra_data
21 changes: 0 additions & 21 deletions tests/core/mining-module/test_miner_setGasPrice.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import pytest
import random

from flaky import (
Expand Down Expand Up @@ -27,23 +26,3 @@ def test_miner_set_gas_price(web3_empty, wait_for_block):

after_gas_price = web3.eth.gas_price
assert after_gas_price < initial_gas_price


@flaky(max_runs=3)
def test_miner_setGasPrice(web3_empty, wait_for_block):
web3 = web3_empty

initial_gas_price = web3.eth.gas_price
assert web3.eth.gas_price > 1000

# sanity check

with pytest.warns(DeprecationWarning):
web3.geth.miner.setGasPrice(initial_gas_price // 2)

with Timeout(60) as timeout:
while web3.eth.gas_price == initial_gas_price:
timeout.sleep(random.random())

after_gas_price = web3.eth.gas_price
assert after_gas_price < initial_gas_price
Loading