Skip to content

Commit 4dfed0d

Browse files
committed
Move eth_getStorageAt to snake_case
1 parent eba67ce commit 4dfed0d

File tree

5 files changed

+31
-15
lines changed

5 files changed

+31
-15
lines changed

docs/overview.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ API
145145
- :meth:`web3.eth.getBlockTransactionCount() <web3.eth.Eth.getBlockTransactionCount>`
146146
- :meth:`web3.eth.getCode() <web3.eth.Eth.getCode>`
147147
- :meth:`web3.eth.getProof() <web3.eth.Eth.getProof>`
148-
- :meth:`web3.eth.getStorageAt() <web3.eth.Eth.getStorageAt>`
148+
- :meth:`web3.eth.get_storage_at() <web3.eth.Eth.get_storage_at>`
149149
- :meth:`web3.eth.getTransaction() <web3.eth.Eth.getTransaction>`
150150
- :meth:`web3.eth.getTransactionByBlock() <web3.eth.Eth.getTransactionByBlock>`
151151
- :meth:`web3.eth.getTransactionCount() <web3.eth.Eth.getTransactionCount>`

docs/web3.eth.rst

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ The following methods are available on the ``web3.eth`` namespace.
192192
:meth:`~web3.eth.get_balance()`
193193

194194

195-
.. py:method:: Eth.getStorageAt(account, position, block_identifier=eth.defaultBlock)
195+
.. py:method:: Eth.get_storage_at(account, position, block_identifier=eth.defaultBlock)
196196
197197
* Delegates to ``eth_getStorageAt`` RPC Method
198198

@@ -207,6 +207,12 @@ The following methods are available on the ``web3.eth`` namespace.
207207
'0x00000000000000000000000000000000000000000000000000120a0b063499d4'
208208
209209
210+
.. py:method:: Eth.getStorageAt(account, position, block_identifier=eth.defaultBlock)
211+
212+
.. warning:: Deprecated: This method is deprecated in favor of
213+
:meth:`~web3.eth.get_storage_at()`
214+
215+
210216
.. py:method:: Eth.getProof(account, positions, block_identifier=eth.defaultBlock)
211217
212218
* Delegates to ``eth_getProof`` RPC Method

tests/integration/test_ethereum_tester.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -316,12 +316,16 @@ def test_eth_call_old_contract_state(self, eth_tester, web3, math_contract, unlo
316316
raise AssertionError("eth-tester was unexpectedly able to give the pending call result")
317317

318318
@pytest.mark.xfail(reason='json-rpc method is not implemented on eth-tester')
319-
def test_eth_getStorageAt(self, web3, emitter_contract_address):
320-
super().test_eth_getStorageAt(web3, emitter_contract_address)
319+
def test_eth_get_storage_at(self, web3, emitter_contract_address):
320+
super().test_eth_get_storage_at(web3, emitter_contract_address)
321321

322322
@pytest.mark.xfail(reason='json-rpc method is not implemented on eth-tester')
323-
def test_eth_getStorageAt_ens_name(self, web3, emitter_contract_address):
324-
super().test_eth_getStorageAt_ens_name(web3, emitter_contract_address)
323+
def test_eth_getStorageAt_deprecated(self, web3, emitter_contract_address):
324+
super().test_eth_getStorageAt_deprecated(web3, emitter_contract_address)
325+
326+
@pytest.mark.xfail(reason='json-rpc method is not implemented on eth-tester')
327+
def test_eth_get_storage_at_ens_name(self, web3, emitter_contract_address):
328+
super().test_eth_get_storage_at_ens_name(web3, emitter_contract_address)
325329

326330
def test_eth_estimateGas_with_block(self,
327331
web3,

web3/_utils/module_testing/eth_module.py

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -169,23 +169,30 @@ def test_eth_get_balance_with_ens_name(
169169
with pytest.raises(NameNotFound):
170170
web3.eth.get_balance(address)
171171

172-
def test_eth_getStorageAt(
172+
def test_eth_get_storage_at(
173173
self, web3: "Web3", emitter_contract_address: ChecksumAddress
174174
) -> None:
175-
storage = web3.eth.getStorageAt(emitter_contract_address, 0)
175+
storage = web3.eth.get_storage_at(emitter_contract_address, 0)
176176
assert isinstance(storage, HexBytes)
177177

178-
def test_eth_getStorageAt_ens_name(
178+
def test_eth_getStorageAt_deprecated(
179+
self, web3: "Web3", emitter_contract_address: ChecksumAddress
180+
) -> None:
181+
with pytest.warns(DeprecationWarning):
182+
storage = web3.eth.getStorageAt(emitter_contract_address, 0)
183+
assert isinstance(storage, HexBytes)
184+
185+
def test_eth_get_storage_at_ens_name(
179186
self, web3: "Web3", emitter_contract_address: ChecksumAddress
180187
) -> None:
181188
with ens_addresses(web3, {'emitter.eth': emitter_contract_address}):
182-
storage = web3.eth.getStorageAt('emitter.eth', 0)
189+
storage = web3.eth.get_storage_at('emitter.eth', 0)
183190
assert isinstance(storage, HexBytes)
184191

185-
def test_eth_getStorageAt_invalid_address(self, web3: "Web3") -> None:
192+
def test_eth_get_storage_at_invalid_address(self, web3: "Web3") -> None:
186193
coinbase = web3.eth.coinbase
187194
with pytest.raises(InvalidAddress):
188-
web3.eth.getStorageAt(ChecksumAddress(HexAddress(HexStr(coinbase.lower()))), 0)
195+
web3.eth.get_storage_at(ChecksumAddress(HexAddress(HexStr(coinbase.lower()))), 0)
189196

190197
def test_eth_getTransactionCount(
191198
self, web3: "Web3", unlocked_account_dual_type: ChecksumAddress

web3/eth.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -221,9 +221,7 @@ def get_storage_at_munger(
221221
block_identifier = self.defaultBlock
222222
return (account, position, block_identifier)
223223

224-
getStorageAt: Method[
225-
Callable[..., HexBytes]
226-
] = Method(
224+
get_storage_at: Method[Callable[..., HexBytes]] = Method(
227225
RPC.eth_getStorageAt,
228226
mungers=[get_storage_at_munger],
229227
)
@@ -567,3 +565,4 @@ def setGasPriceStrategy(self, gas_price_strategy: GasPriceStrategy) -> None:
567565

568566
# Deprecated Methods
569567
getBalance = DeprecatedMethod(get_balance, 'getBalance', 'get_balance')
568+
getStorageAt = DeprecatedMethod(get_storage_at, 'getStorageAt', 'get_storage_at')

0 commit comments

Comments
 (0)