Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions newsfragments/3034.bugfix.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix ``AsyncWeb3.solidity_keccak`` to match ``Web3.solidity_keccak``.
20 changes: 18 additions & 2 deletions web3/_utils/module_testing/web3_module.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
Any,
NoReturn,
Sequence,
Union,
)

from eth_typing import (
Expand All @@ -16,6 +17,7 @@
)

from web3 import (
AsyncWeb3,
Web3,
)
from web3._utils.ens import (
Expand Down Expand Up @@ -221,9 +223,16 @@ def _check_web3_client_version(self, client_version: str) -> NoReturn:
),
),
)
@pytest.mark.parametrize(
"w3",
(
Web3,
AsyncWeb3,
),
)
def test_solidity_keccak(
self,
w3: "Web3",
w3: Union["Web3", "AsyncWeb3"],
types: Sequence[TypeStr],
values: Sequence[Any],
expected: HexBytes,
Expand Down Expand Up @@ -255,9 +264,16 @@ def test_solidity_keccak(
),
),
)
@pytest.mark.parametrize(
"w3",
(
Web3(),
AsyncWeb3(),
),
)
def test_solidity_keccak_ens(
self,
w3: "Web3",
w3: Union["Web3", "AsyncWeb3"],
types: Sequence[TypeStr],
values: Sequence[str],
expected: HexBytes,
Expand Down
10 changes: 2 additions & 8 deletions web3/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -286,9 +286,9 @@ def keccak(

@classmethod
def normalize_values(
cls, _w3: "BaseWeb3", abi_types: List[TypeStr], values: List[Any]
cls, w3: "BaseWeb3", abi_types: List[TypeStr], values: List[Any]
) -> List[Any]:
return map_abi_data(zip(abi_types, values))
return map_abi_data([abi_ens_resolver(w3)], abi_types, values)

@combomethod
def solidity_keccak(cls, abi_types: List[TypeStr], values: List[Any]) -> bytes:
Expand Down Expand Up @@ -450,12 +450,6 @@ def __init__(
def is_connected(self, show_traceback: bool = False) -> bool:
return self.provider.is_connected(show_traceback)

@classmethod
def normalize_values(
cls, w3: "BaseWeb3", abi_types: List[TypeStr], values: List[Any]
) -> List[Any]:
return map_abi_data([abi_ens_resolver(w3)], abi_types, values)

@property
def middleware_onion(self) -> MiddlewareOnion:
return cast(MiddlewareOnion, self.manager.middleware_onion)
Expand Down