Skip to content

Commit

Permalink
Merge pull request #1944 from tmckenzie51/tiffany/listStorageKeys-to-…
Browse files Browse the repository at this point in the history
…snakecase

Add list_storage_keys, deprecate listStorageKeys
  • Loading branch information
tmckenzie51 authored Apr 23, 2021
2 parents 71ef3cd + 16a68e1 commit 09d47f2
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 2 deletions.
1 change: 1 addition & 0 deletions newsfragments/1944.feature.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Add list_storage_keys deprecate listStorageKeys
16 changes: 15 additions & 1 deletion web3/_utils/module_testing/parity_module.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,21 @@ def test_add_reserved_peer(self, web3: "Web3") -> None:
def test_list_storage_keys_no_support(
self, web3: "Web3", emitter_contract_address: ChecksumAddress
) -> None:
keys = web3.parity.listStorageKeys(emitter_contract_address, 10, None)
keys = web3.parity.list_storage_keys(emitter_contract_address, 10, None)
assert keys == []

def test_list_storage_keys(
self, web3: "Web3", emitter_contract_address: ChecksumAddress
) -> None:
keys = web3.parity.list_storage_keys(emitter_contract_address, 10, None)
assert keys == []

def test_listStorageKeys_deprecated(
self, web3: "Web3", emitter_contract_address: ChecksumAddress
) -> None:
with pytest.warns(DeprecationWarning,
match='listStorageKeys is deprecated in favor of list_storage_keys'):
keys = web3.parity.listStorageKeys(emitter_contract_address, 10, None)
assert keys == []

def test_mode(self, web3: "Web3") -> None:
Expand Down
6 changes: 5 additions & 1 deletion web3/parity.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
RPC,
)
from web3.method import (
DeprecatedMethod,
Method,
default_root_munger,
)
Expand Down Expand Up @@ -133,7 +134,7 @@ def list_storage_keys_munger(
block_identifier = self.default_block
return (address, quantity, hash_, block_identifier)

listStorageKeys: Method[Callable[..., List[Hash32]]] = Method(
list_storage_keys: Method[Callable[..., List[Hash32]]] = Method(
RPC.parity_listStorageKeys,
mungers=[list_storage_keys_munger],
)
Expand Down Expand Up @@ -218,3 +219,6 @@ def trace_transactions_munger(
RPC.parity_mode,
mungers=None
)

# Deprecated Methods
listStorageKeys = DeprecatedMethod(list_storage_keys, 'listStorageKeys', 'list_storage_keys')

0 comments on commit 09d47f2

Please sign in to comment.