Skip to content

Commit 206d345

Browse files
authored
removed deprecated sha3 methods (#2479)
1 parent a8f9b05 commit 206d345

File tree

4 files changed

+1
-70
lines changed

4 files changed

+1
-70
lines changed

docs/web3.main.rst

Lines changed: 0 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -304,54 +304,6 @@ Cryptographic Hashing
304304
assert(data2 == hex"4e03657aea45a94fc7d47ba826c8d667c0d1e6e33a64a036ec44f58fa12d6c45");
305305
306306
307-
.. py:classmethod:: Web3.sha3(primitive=None, hexstr=None, text=None)
308-
309-
.. WARNING::
310-
This method has been deprecated for :meth:`~Web3.keccak`
311-
312-
Returns the Keccak SHA256 of the given value. Text is encoded to UTF-8 before
313-
computing the hash, just like Solidity. Any of the following are
314-
valid and equivalent:
315-
316-
.. code-block:: python
317-
318-
>>> Web3.sha3(0x747874)
319-
>>> Web3.sha3(b'\x74\x78\x74')
320-
>>> Web3.sha3(hexstr='0x747874')
321-
>>> Web3.sha3(hexstr='747874')
322-
>>> Web3.sha3(text='txt')
323-
HexBytes('0xd7278090a36507640ea6b7a0034b69b0d240766fa3f98e3722be93c613b29d2e')
324-
325-
.. py:classmethod:: Web3.soliditySha3(abi_types, value)
326-
327-
.. WARNING::
328-
This method has been deprecated for :meth:`~Web3.solidityKeccak`
329-
330-
331-
Returns the sha3 as it would be computed by the solidity ``sha3`` function
332-
on the provided ``value`` and ``abi_types``. The ``abi_types`` value
333-
should be a list of solidity type strings which correspond to each of the
334-
provided values.
335-
336-
337-
.. code-block:: python
338-
339-
>>> Web3.soliditySha3(['bool'], [True])
340-
HexBytes("0x5fe7f977e71dba2ea1a68e21057beebb9be2ac30c6410aa38d4f3fbe41dcffd2")
341-
342-
>>> Web3.soliditySha3(['uint8', 'uint8', 'uint8'], [97, 98, 99])
343-
HexBytes("0x4e03657aea45a94fc7d47ba826c8d667c0d1e6e33a64a036ec44f58fa12d6c45")
344-
345-
>>> Web3.soliditySha3(['uint8[]'], [[97, 98, 99]])
346-
HexBytes("0x233002c671295529bcc50b76a2ef2b0de2dac2d93945fca745255de1a9e4017e")
347-
348-
>>> Web3.soliditySha3(['address'], ["0x49EdDD3769c0712032808D86597B84ac5c2F5614"])
349-
HexBytes("0x2ff37b5607484cd4eecf6d13292e22bd6e5401eaffcc07e279583bc742c68882")
350-
351-
>>> Web3.soliditySha3(['address'], ["ethereumfoundation.eth"])
352-
HexBytes("0x913c99ea930c78868f1535d34cd705ab85929b2eaaf70fcd09677ecd6e5d75e9")
353-
354-
355307
Check Encodability
356308
~~~~~~~~~~~~~~~~~~~~
357309

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
sha3 and soliditySha3 were previously deprecated and now removed

tests/core/web3-module/test_keccak.py

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -97,10 +97,3 @@ def test_keccak_raise_if_hexstr_and_text():
9797
def test_keccak_raise_if_no_args():
9898
with pytest.raises(TypeError):
9999
Web3.keccak()
100-
101-
102-
def test_deprecated_bound_method():
103-
w3 = Web3()
104-
h = HexBytes('0x0f355f04c0a06eebac1d219b34c598f85a1169badee164be8a30345944885fe8')
105-
with pytest.warns(DeprecationWarning, match='sha3 is deprecated in favor of keccak'):
106-
assert w3.sha3(text='cowmö') == h

web3/main.py

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,6 @@
5151
build_strict_registry,
5252
map_abi_data,
5353
)
54-
from web3._utils.decorators import (
55-
deprecated_for,
56-
)
5754
from web3._utils.empty import (
5855
empty,
5956
)
@@ -276,13 +273,6 @@ def api(self) -> str:
276273
from web3 import __version__
277274
return __version__
278275

279-
@staticmethod
280-
@deprecated_for("keccak")
281-
@apply_to_return_value(HexBytes)
282-
def sha3(primitive: Optional[Primitives] = None, text: Optional[str] = None,
283-
hexstr: Optional[HexStr] = None) -> bytes:
284-
return Web3.keccak(primitive, text, hexstr)
285-
286276
@staticmethod
287277
@apply_to_return_value(HexBytes)
288278
def keccak(primitive: Optional[Primitives] = None, text: Optional[str] = None,
@@ -298,11 +288,6 @@ def keccak(primitive: Optional[Primitives] = None, text: Optional[str] = None,
298288
"or keccak(0x747874)."
299289
)
300290

301-
@combomethod
302-
@deprecated_for("solidityKeccak")
303-
def soliditySha3(cls, abi_types: List[TypeStr], values: List[Any]) -> bytes:
304-
return cls.solidityKeccak(abi_types, values)
305-
306291
@combomethod
307292
def solidityKeccak(cls, abi_types: List[TypeStr], values: List[Any]) -> bytes:
308293
"""

0 commit comments

Comments
 (0)