diff --git a/tests/integration/geth-1.10.6-fixture.zip b/tests/integration/geth-1.10.6-fixture.zip new file mode 100644 index 0000000000..c2f738bc38 Binary files /dev/null and b/tests/integration/geth-1.10.6-fixture.zip differ diff --git a/tests/integration/go_ethereum/conftest.py b/tests/integration/go_ethereum/conftest.py index 2ae80cb3ca..cb4be4357f 100644 --- a/tests/integration/go_ethereum/conftest.py +++ b/tests/integration/go_ethereum/conftest.py @@ -19,7 +19,7 @@ KEYFILE_PW = 'web3py-test' -GETH_FIXTURE_ZIP = 'geth-1.10.8-fixture.zip' +GETH_FIXTURE_ZIP = 'geth-1.10.6-fixture.zip' @pytest.fixture(scope='module') diff --git a/web3/_utils/validation.py b/web3/_utils/validation.py index 65fcb9f1c0..ebfc2f94e3 100644 --- a/web3/_utils/validation.py +++ b/web3/_utils/validation.py @@ -160,21 +160,30 @@ def is_not_address_string(value: Any) -> bool: is_checksum_address(value) and not is_hex_address(value)) +def is_hex_integer(value: Any) -> bool: + return (is_integer(value) and not is_string(value) and not is_bytes(value) and not + is_checksum_address(value) and not is_hex_address(value)) + + def validate_address(value: Any) -> None: """ Helper function for validating an address """ + if is_hex_integer(value): + value = str(value) + if is_not_address_string(value): if not is_valid_ens_name(value): raise InvalidAddress(f"ENS name: '{value}' is invalid.") return + if is_bytes(value): if not is_binary_address(value): raise InvalidAddress("Address must be 20 bytes when input type is bytes", value) return if not isinstance(value, str): - raise TypeError('Address {} must be provided as a string'.format(value)) + raise TypeError('Address {} must be provided as a string or a hex'.format(value)) if not is_hex_address(value): raise InvalidAddress("Address must be 20 bytes, as a hex string with a 0x prefix", value) if not is_checksum_address(value):