From 747ceab1d029b2d79e21042dfb0fc8c4d100d81b Mon Sep 17 00:00:00 2001 From: Stuart Reed Date: Tue, 29 Oct 2024 09:26:40 -0600 Subject: [PATCH] Test for issue #3482 --- .../test_contract_ambiguous_functions.py | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/tests/core/contracts/test_contract_ambiguous_functions.py b/tests/core/contracts/test_contract_ambiguous_functions.py index bbdc0632bc..7cf3f2262c 100644 --- a/tests/core/contracts/test_contract_ambiguous_functions.py +++ b/tests/core/contracts/test_contract_ambiguous_functions.py @@ -266,6 +266,32 @@ def test_functions_error_messages(w3, method, args, expected_message, expected_e getattr(contract, method)(*args) +def test_ambiguous_functions_abi_element_identifier(w3): + abi = [ + { + "name": "isValidSignature", + "type": "function", + "inputs": [ + {"internalType": "bytes32", "name": "id", "type": "bytes32"}, + {"internalType": "bytes", "name": "id", "type": "bytes"}, + ], + }, + { + "name": "isValidSignature", + "type": "function", + "inputs": [ + {"internalType": "bytes", "name": "id", "type": "bytes"}, + {"internalType": "bytes", "name": "id", "type": "bytes"}, + ], + }, + ] + contract = w3.eth.contract(abi=abi) + fn_bytes = contract.get_function_by_signature("isValidSignature(bytes,bytes)") + assert fn_bytes.abi_element_identifier == "isValidSignature(bytes,bytes)" + fn_bytes32 = contract.get_function_by_signature("isValidSignature(bytes32,bytes)") + assert fn_bytes32.abi_element_identifier == "isValidSignature(bytes32,bytes)" + + def test_contract_function_methods(string_contract): set_value_func = string_contract.get_function_by_signature("setValue(string)") get_value_func = string_contract.get_function_by_signature("getValue()")