Skip to content

Commit c0fa743

Browse files
dbfreempacrobkclowes
authored
removed more depecrated methods in geth and parity (#2480)
* removed more depecrated methods in geth and parity * remove deprecated methods from Net module and add newsfragments Co-authored-by: pacrob <[email protected]> Co-authored-by: kclowes <[email protected]>
1 parent 6945072 commit c0fa743

21 files changed

+7
-516
lines changed

docs/providers.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ For example, the following retrieves the client enode endpoint for both geth and
138138
enode = w3.parity.enode
139139
140140
elif connected and w3.clientVersion.startswith('Geth'):
141-
enode = w3.geth.admin.nodeInfo['enode']
141+
enode = w3.geth.admin.node_info['enode']
142142
143143
else:
144144
enode = None
@@ -399,7 +399,7 @@ AsyncHTTPProvider
399399
... 'admin' : (AsyncGethAdmin,)})
400400
... },
401401
... middlewares=[] # See supported middleware section below for middleware options
402-
... )
402+
... )
403403
>>> custom_session = ClientSession() # If you want to pass in your own session
404404
>>> await w3.provider.cache_async_session(custom_session) # This method is an async method so it needs to be handled accordingly
405405

docs/web3.geth.rst

-70
Original file line numberDiff line numberDiff line change
@@ -54,12 +54,6 @@ The ``web3.geth.admin`` object exposes methods to interact with the RPC APIs und
5454
}
5555
5656
57-
.. py:method:: nodeInfo()
58-
59-
.. warning:: Deprecated: This method is deprecated in favor of
60-
:meth:`~web3.geth.admin.node_info()`
61-
62-
6357
.. py:method:: peers()
6458
6559
* Delegates to ``admin_peers`` RPC Method
@@ -118,10 +112,6 @@ The ``web3.geth.admin`` object exposes methods to interact with the RPC APIs und
118112
True
119113
120114
121-
.. py:method:: addPeer(node_url)
122-
123-
.. warning:: Deprecated: This method is deprecated in favor of :meth:`~web3.geth.admin.add_peer()`
124-
125115
.. py:method:: start_rpc(host='localhost', port=8545, cors="", apis="eth,net,web3")
126116
127117
* Delegates to ``admin_startRPC`` RPC Method
@@ -137,12 +127,6 @@ The ``web3.geth.admin`` object exposes methods to interact with the RPC APIs und
137127
True
138128
139129
140-
.. py:method:: startRPC(host='localhost', port=8545, cors="", apis="eth,net,web3")
141-
142-
.. warning:: Deprecated: This method is deprecated in favor of
143-
:meth:`~web3.geth.admin.start_rpc()`
144-
145-
146130
.. py:method:: start_ws(host='localhost', port=8546, cors="", apis="eth,net,web3")
147131
148132
* Delegates to ``admin_startWS`` RPC Method
@@ -158,12 +142,6 @@ The ``web3.geth.admin`` object exposes methods to interact with the RPC APIs und
158142
True
159143
160144
161-
.. py:method:: startWS(host='localhost', port=8546, cors="", apis="eth,net,web3")
162-
163-
.. warning:: Deprecated: This method is deprecated in favor of
164-
:meth:`~web3.geth.admin.start_ws()`
165-
166-
167145
.. py:method:: stop_rpc()
168146
169147
* Delegates to ``admin_stopRPC`` RPC Method
@@ -176,12 +154,6 @@ The ``web3.geth.admin`` object exposes methods to interact with the RPC APIs und
176154
True
177155
178156
179-
.. py:method:: stopRPC()
180-
181-
.. warning:: Deprecated: This method is deprecated in favor of
182-
:meth:`~web3.geth.admin.stop_rpc()`
183-
184-
185157
.. py:method:: stop_ws()
186158
187159
* Delegates to ``admin_stopWS`` RPC Method
@@ -194,12 +166,6 @@ The ``web3.geth.admin`` object exposes methods to interact with the RPC APIs und
194166
True
195167
196168
197-
.. py:method:: stopWS()
198-
199-
.. warning:: Deprecated: This method is deprecated in favor of
200-
:meth:`~web3.geth.admin.stop_ws()`
201-
202-
203169
.. py:module:: web3.geth.personal
204170
205171
GethPersonal API
@@ -219,12 +185,6 @@ The following methods are available on the ``web3.geth.personal`` namespace.
219185
['0xd3CdA913deB6f67967B99D67aCDFa1712C293601']
220186
221187
222-
.. py:method:: listAccounts()
223-
224-
.. warning:: Deprecated: This method is deprecated in favor of
225-
:meth:`~web3.geth.personal.list_accounts()`
226-
227-
228188
.. py:method:: list_wallets()
229189
230190
* Delegates to ``personal_listWallets`` RPC Method
@@ -257,12 +217,6 @@ The following methods are available on the ``web3.geth.personal`` namespace.
257217
'0xd3CdA913deB6f67967B99D67aCDFa1712C293601'
258218
259219
260-
.. py:method:: importRawKey()
261-
262-
.. warning:: Deprecated: This method is deprecated in favor of
263-
:meth:`~web3.geth.personal.import_raw_key()`
264-
265-
266220
.. py:method:: new_account(self, passphrase)
267221
268222
* Delegates to ``personal_newAccount`` RPC Method
@@ -276,12 +230,6 @@ The following methods are available on the ``web3.geth.personal`` namespace.
276230
'0xd3CdA913deB6f67967B99D67aCDFa1712C293601'
277231
278232
279-
.. py:method:: newAccount()
280-
281-
.. warning:: Deprecated: This method is deprecated in favor of
282-
:meth:`~web3.geth.personal.new_account()`
283-
284-
285233
.. py:method:: lock_account(self, account)
286234
287235
* Delegates to ``personal_lockAccount`` RPC Method
@@ -293,12 +241,6 @@ The following methods are available on the ``web3.geth.personal`` namespace.
293241
>>> web3.geth.personal.lock_account('0xd3CdA913deB6f67967B99D67aCDFa1712C293601')
294242
295243
296-
.. py:method:: lockAccount()
297-
298-
.. warning:: Deprecated: This method is deprecated in favor of
299-
:meth:`~web3.geth.personal.lock_account()`
300-
301-
302244
.. py:method:: unlock_account(self, account, passphrase, duration=None)
303245
304246
* Delegates to ``personal_unlockAccount`` RPC Method
@@ -317,25 +259,13 @@ The following methods are available on the ``web3.geth.personal`` namespace.
317259
True
318260
319261
320-
.. py:method:: unlockAccount()
321-
322-
.. warning:: Deprecated: This method is deprecated in favor of
323-
:meth:`~web3.geth.personal.unlock_account()`
324-
325-
326262
.. py:method:: send_transaction(self, transaction, passphrase)
327263
328264
* Delegates to ``personal_sendTransaction`` RPC Method
329265

330266
Sends the transaction.
331267

332268

333-
.. py:method:: sendTransaction()
334-
335-
.. warning:: Deprecated: This method is deprecated in favor of
336-
:meth:`~web3.geth.personal.send_transaction()`
337-
338-
339269
.. py:module:: web3.geth.txpool
340270
341271
GethTxPool API

docs/web3.net.rst

-11
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,6 @@ Properties
1212

1313
The following properties are available on the ``web3.net`` namespace.
1414

15-
.. py:method:: chainId
16-
:property:
17-
18-
.. warning:: Deprecated: This property is deprecated as of EIP 1474.
19-
2015
.. py:method:: listening
2116
:property:
2217

@@ -41,12 +36,6 @@ The following properties are available on the ``web3.net`` namespace.
4136
>>> web3.net.peer_count
4237
1
4338
44-
.. py:method:: peerCount
45-
:property:
46-
47-
.. warning:: Deprecated: This property is deprecated in favor of
48-
:attr:`~web3.geth.admin.peer_count`
49-
5039
.. py:method:: version
5140
:property:
5241

docs/web3.parity.rst

-29
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,6 @@ The following methods are available on the ``web3.parity.personal`` namespace.
2525
>>> web3.parity.personal.list_accounts()
2626
['0xd3CdA913deB6f67967B99D67aCDFa1712C293601']
2727
28-
.. py:method:: listAccounts
29-
30-
.. warning:: Deprecated: This method is deprecated in favor of
31-
:meth:`~web3.parity.personal.list_accounts()`
3228
3329
.. py:method:: import_raw_key(self, private_key, passphrase)
3430
@@ -42,11 +38,6 @@ The following methods are available on the ``web3.parity.personal`` namespace.
4238
>>> web3.parity.personal.import_raw_key(some_private_key, 'the-passphrase')
4339
'0xd3CdA913deB6f67967B99D67aCDFa1712C293601'
4440
45-
.. py:method:: importRawKey(self, private_key, passphrase)
46-
47-
.. warning:: Deprecated: This method is deprecated in favor of
48-
:meth:`~web3.parity.personal.import_raw_key()`
49-
5041
.. py:method:: new_account(self, password)
5142
5243
* Delegates to ``personal_newAccount`` RPC Method
@@ -59,11 +50,6 @@ The following methods are available on the ``web3.parity.personal`` namespace.
5950
>>> web3.parity.personal.new_account('the-passphrase')
6051
'0xd3CdA913deB6f67967B99D67aCDFa1712C293601'
6152
62-
.. py:method:: newAccount(self, password)
63-
64-
.. warning:: Deprecated: This method is deprecated in favor of
65-
:meth:`~web3.parity.personal.new_account()`
66-
6753
.. py:method:: unlock_account(self, account, passphrase, duration=None)
6854
6955
* Delegates to ``personal_unlockAccount`` RPC Method
@@ -80,22 +66,12 @@ The following methods are available on the ``web3.parity.personal`` namespace.
8066
>>> web3.parity.personal.unlock_account('0xd3CdA913deB6f67967B99D67aCDFa1712C293601', 'the-passphrase')
8167
True
8268
83-
.. py:method:: unlockAccount(self, account, passphrase, duration=None)
84-
85-
.. warning:: Deprecated: This method is deprecated in favor of
86-
:meth:`~web3.parity.personal.unlock_account()`
87-
8869
.. py:method:: send_transaction(self, transaction, passphrase)
8970
9071
* Delegates to ``personal_sendTransaction`` RPC Method
9172

9273
Sends the transaction.
9374

94-
.. py:method:: sendTransaction(self, account, passphrase, duration=None)
95-
96-
.. warning:: Deprecated: This method is deprecated in favor of
97-
:meth:`~web3.parity.personal.send_transaction()`
98-
9975
.. py:method:: sign_typed_data(self, jsonMessage, account, passphrase)
10076
10177
* Delegates to ``personal_signTypedData`` RPC Method
@@ -104,8 +80,3 @@ The following methods are available on the ``web3.parity.personal`` namespace.
10480
and **NOT** the JSON String itself.
10581

10682
Signs the ``Structured Data`` (or ``Typed Data``) with the passphrase of the given ``account``
107-
108-
.. py:method:: signTypedData(self, jsonMessage, account, passphrase)
109-
110-
.. warning:: Deprecated: This method is deprecated in favor of
111-
:meth:`~web3.parity.personal.sign_typed_data()`
+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Remove deprecated methods from Geth, Parity and Net modules

newsfragments/2480.doc.rst

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Remove deprecated methods from Geth, Parity, and Net modules

tests/core/admin-module/test_admin_addPeer.py

-13
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,3 @@
1-
import pytest
2-
3-
4-
def test_admin_addPeer(w3, skip_if_testrpc):
5-
skip_if_testrpc(w3)
6-
7-
with pytest.warns(DeprecationWarning):
8-
result = w3.geth.admin.addPeer(
9-
'enode://44826a5d6a55f88a18298bca4773fca5749cdc3a5c9f308aa7d810e9b31123f3e7c5fba0b1d70aac5308426f47df2a128a6747040a3815cc7dd7167d03be320d@127.0.0.1:30304', # noqa: E501
10-
)
11-
assert result is True
12-
13-
141
def test_admin_add_peer(w3, skip_if_testrpc):
152
skip_if_testrpc(w3)
163

tests/core/admin-module/test_admin_nodeInfo.py

-13
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,3 @@
1-
import pytest
2-
3-
4-
def test_admin_nodeInfo(w3, skip_if_testrpc):
5-
skip_if_testrpc(w3)
6-
7-
with pytest.warns(DeprecationWarning):
8-
node_info = w3.geth.admin.nodeInfo
9-
10-
assert 'enode' in node_info
11-
assert 'id' in node_info
12-
13-
141
def test_admin_node_info(w3, skip_if_testrpc):
152
skip_if_testrpc(w3)
163

tests/core/eth-module/conftest.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ def extra_accounts(w3, account_password):
1212
num_accounts_to_create = 10 - len(w3.eth.accounts)
1313

1414
for i in range(num_accounts_to_create):
15-
w3.personal.newAccount(account_password)
15+
w3.personal.new_account(account_password)
1616

1717
return w3.eth.accounts
1818

Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import pytest
21
import random
32

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

27-
web3.geth.miner.setExtra(new_extra_data)
26+
web3.geth.miner.set_extra(new_extra_data)
2827

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

3837
assert after_extra == new_extra_data
39-
40-
41-
@flaky(max_runs=3)
42-
def test_miner_setExtra(web3_empty, wait_for_block):
43-
web3 = web3_empty
44-
45-
initial_extra = decode_hex(web3.eth.get_block(web3.eth.block_number)['extraData'])
46-
47-
new_extra_data = b'-this-is-32-bytes-of-extra-data-'
48-
49-
# sanity
50-
assert initial_extra != new_extra_data
51-
52-
with pytest.warns(DeprecationWarning):
53-
web3.geth.miner.setExtra(new_extra_data)
54-
with Timeout(60) as timeout:
55-
while True:
56-
extra_data = decode_hex(web3.eth.get_block(web3.eth.block_number)['extraData'])
57-
if extra_data == new_extra_data:
58-
break
59-
timeout.sleep(random.random())
60-
61-
after_extra = decode_hex(web3.eth.get_block(web3.eth.block_number)['extraData'])
62-
assert after_extra == new_extra_data
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import pytest
21
import random
32

43
from flaky import (
@@ -27,23 +26,3 @@ def test_miner_set_gas_price(web3_empty, wait_for_block):
2726

2827
after_gas_price = web3.eth.gas_price
2928
assert after_gas_price < initial_gas_price
30-
31-
32-
@flaky(max_runs=3)
33-
def test_miner_setGasPrice(web3_empty, wait_for_block):
34-
web3 = web3_empty
35-
36-
initial_gas_price = web3.eth.gas_price
37-
assert web3.eth.gas_price > 1000
38-
39-
# sanity check
40-
41-
with pytest.warns(DeprecationWarning):
42-
web3.geth.miner.setGasPrice(initial_gas_price // 2)
43-
44-
with Timeout(60) as timeout:
45-
while web3.eth.gas_price == initial_gas_price:
46-
timeout.sleep(random.random())
47-
48-
after_gas_price = web3.eth.gas_price
49-
assert after_gas_price < initial_gas_price

0 commit comments

Comments
 (0)