Skip to content

Commit 5d6c278

Browse files
authored
Merge pull request #1926 from tmckenzie51/tiffany/submitHashRate-to-snakecase
deprecate submitHashrate in favor of submit_hashrate
2 parents e3bc832 + 9019fca commit 5d6c278

File tree

6 files changed

+26
-7
lines changed

6 files changed

+26
-7
lines changed

docs/web3.eth.rst

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1129,16 +1129,20 @@ with the filtering API.
11291129
.. warning:: Deprecated: This property is deprecated in favor of
11301130
:attr:`~web3.eth.Eth.get_logs()`
11311131

1132-
.. py:method:: Eth.submitHashrate(hashrate, nodeid)
1132+
.. py:method:: Eth.submit_hashrate(hashrate, nodeid)
11331133
11341134
* Delegates to ``eth_submitHashrate`` RPC Method
11351135

11361136
.. code-block:: python
11371137
11381138
>>> node_id = '59daa26581d0acd1fce254fb7e85952f4c09d0915afd33d3886cd914bc7d283c'
1139-
>>> web3.eth.submitHashrate(5000, node_id)
1139+
>>> web3.eth.submit_hashrate(5000, node_id)
11401140
True
11411141
1142+
.. py:method:: Eth.submitHashrate(hashrate, nodeid)
1143+
1144+
.. warning:: Deprecated: This property is deprecated in favor of
1145+
:attr:`~web3.eth.Eth.submit_hashrate()`
11421146

11431147
.. py:method:: Eth.submit_work(nonce, pow_hash, mix_digest)
11441148

newsfragments/1926.feature.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Add ``w3.eth.submit_hashrate`` deprecate ``w3.eth.submitHashrate``

tests/integration/go_ethereum/common.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,14 @@ def _check_web3_clientVersion(self, client_version):
2020

2121
class GoEthereumEthModuleTest(EthModuleTest):
2222
@pytest.mark.xfail(reason='eth_submitHashrate deprecated in 1.8.22 for ethash_submitHashRate')
23-
def test_eth_submitHashrate(self, web3):
23+
def test_eth_submit_hashrate(self, web3):
2424
# https://github.com/ethereum/go-ethereum/commit/51db5975cc5fb88db6a0dba1826b534fd4df29d7
25-
super().test_eth_submitHashrate(web3)
25+
super().test_eth_submit_hashrate(web3)
26+
27+
@pytest.mark.xfail(reason='eth_submitHashrate deprecated in 1.8.22 for ethash_submitHashRate')
28+
def test_eth_submitHashrate_deprecated(self, web3):
29+
# https://github.com/ethereum/go-ethereum/commit/51db5975cc5fb88db6a0dba1826b534fd4df29d7
30+
super().test_eth_submitHashrate_deprecated(web3)
2631

2732
@pytest.mark.xfail(
2833
strict=False,

tests/integration/test_ethereum_tester.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,9 @@ class TestEthereumTesterEthModule(EthModuleTest):
251251
test_eth_sign_transaction_ens_names = not_implemented(
252252
EthModuleTest.test_eth_sign_transaction_ens_names, ValueError
253253
)
254-
test_eth_submitHashrate = not_implemented(EthModuleTest.test_eth_submitHashrate, ValueError)
254+
test_eth_submitHashrate_deprecated = not_implemented(
255+
EthModuleTest.test_eth_submitHashrate_deprecated, ValueError)
256+
test_eth_submit_hashrate = not_implemented(EthModuleTest.test_eth_submit_hashrate, ValueError)
255257
test_eth_submitWork_deprecated = not_implemented(
256258
EthModuleTest.test_eth_submitWork_deprecated, ValueError)
257259
test_eth_submit_work = not_implemented(EthModuleTest.test_eth_submit_work, ValueError)

web3/_utils/module_testing/eth_module.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1470,7 +1470,13 @@ def test_eth_getCompilers_deprecation(self, web3: "Web3") -> None:
14701470
with pytest.raises(DeprecationWarning):
14711471
web3.eth.getCompilers()
14721472

1473-
def test_eth_submitHashrate(self, web3: "Web3") -> None:
1473+
def test_eth_submit_hashrate(self, web3: "Web3") -> None:
1474+
# node_id from EIP 1474: https://github.com/ethereum/EIPs/pull/1474/files
1475+
node_id = HexStr('59daa26581d0acd1fce254fb7e85952f4c09d0915afd33d3886cd914bc7d283c')
1476+
result = web3.eth.submit_hashrate(5000, node_id)
1477+
assert result is True
1478+
1479+
def test_eth_submitHashrate_deprecated(self, web3: "Web3") -> None:
14741480
# node_id from EIP 1474: https://github.com/ethereum/EIPs/pull/1474/files
14751481
node_id = HexStr('59daa26581d0acd1fce254fb7e85952f4c09d0915afd33d3886cd914bc7d283c')
14761482
result = web3.eth.submitHashrate(5000, node_id)

web3/eth.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -609,7 +609,7 @@ def filter_munger(
609609
mungers=[default_root_munger]
610610
)
611611

612-
submitHashrate: Method[Callable[[int, _Hash32], bool]] = Method(
612+
submit_hashrate: Method[Callable[[int, _Hash32], bool]] = Method(
613613
RPC.eth_submitHashrate,
614614
mungers=[default_root_munger],
615615
)
@@ -689,6 +689,7 @@ def setGasPriceStrategy(self, gas_price_strategy: GasPriceStrategy) -> None:
689689
getUncleCount = DeprecatedMethod(get_uncle_count, 'getUncleCount', 'get_uncle_count')
690690
sendTransaction = DeprecatedMethod(send_transaction, 'sendTransaction', 'send_transaction')
691691
signTransaction = DeprecatedMethod(sign_transaction, 'signTransaction', 'sign_transaction')
692+
submitHashrate = DeprecatedMethod(submit_hashrate, 'submitHashrate', 'submit_hashrate')
692693
submitWork = DeprecatedMethod(submit_work, 'submitWork', 'submit_work')
693694
getLogs = DeprecatedMethod(get_logs, 'getLogs', 'get_logs')
694695
sendRawTransaction = DeprecatedMethod(send_raw_transaction,

0 commit comments

Comments
 (0)