ethereum / eth-utils

Utility functions for working with ethereum related codebases.
https://eth-utils.readthedocs.io/en/latest/
MIT License
320 stars 152 forks source link

Upgrade eth-hash to v0.3.0 #208

Closed carver closed 3 years ago

carver commented 3 years ago

What was wrong?

Have to cast/ignore the types from eth-hash, because they weren't being executed.

How was it fixed?

Get the latest type exports from eth-hash v0.3.0

To-Do

Cute Animal Picture

put a cute animal picture link inside the parentheses

carver commented 3 years ago

Hm, weird. What I wanted to do was:

diff --git a/eth_utils/crypto.py b/eth_utils/crypto.py
index b69343c..ae6e15c 100644
--- a/eth_utils/crypto.py
+++ b/eth_utils/crypto.py
@@ -8,5 +8,4 @@ from .conversions import to_bytes
 def keccak(
     primitive: Union[bytes, int, bool] = None, hexstr: str = None, text: str = None
 ) -> bytes:
-    input_bytes = to_bytes(primitive, hexstr, text)
-    return cast(bytes, keccak_256(input_bytes))
+    return keccak_256(to_bytes(primitive, hexstr, text))

But even when eth-hash is upgraded to v0.3.0, mypy doesn't recognize the type of keccak_256.

carver commented 3 years ago

Argh, I missed the touched file eth_hash/py.typed