From c442aeac925d7eff91d841b78ec39080682d66ed Mon Sep 17 00:00:00 2001 From: Arnold K Date: Fri, 26 Jun 2026 04:25:41 -0600 Subject: [PATCH 1/2] fix: represent authorization list r/s as uint256 per EIP-7702 (part 1/2) Update formatter and TypedDict. r and s are uint256 per EIP-7702 spec. --- web3/_utils/method_formatters.py | 4 ++-- web3/types.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/web3/_utils/method_formatters.py b/web3/_utils/method_formatters.py index db475ac9e4..a58bc4dd51 100644 --- a/web3/_utils/method_formatters.py +++ b/web3/_utils/method_formatters.py @@ -244,8 +244,8 @@ def storage_key_to_hexstr(value: bytes | int | str) -> HexStr: "address": to_checksum_address, "nonce": to_integer_if_hex, "yParity": to_integer_if_hex, - "r": to_hexbytes(32, variable_length=True), - "s": to_hexbytes(32, variable_length=True), + "r": to_integer_if_hex, + "s": to_integer_if_hex, } ), ), diff --git a/web3/types.py b/web3/types.py index c3ae0b4834..aeaed8888a 100644 --- a/web3/types.py +++ b/web3/types.py @@ -111,8 +111,8 @@ class SetCodeAuthorizationData(TypedDict): address: ChecksumAddress nonce: Nonce yParity: int - r: HexBytes - s: HexBytes + r: int + s: int # syntax b/c "from" keyword not allowed w/ class construction From fc5dd29c1a9b6f3b114bceb8ccc634289ccd0c14 Mon Sep 17 00:00:00 2001 From: Arnold K Date: Fri, 26 Jun 2026 04:31:50 -0600 Subject: [PATCH 2/2] fix: update EIP-7702 test assertions (r/s now int, not HexBytes) Fixes #3716. --- web3/_utils/module_testing/eth_module.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/web3/_utils/module_testing/eth_module.py b/web3/_utils/module_testing/eth_module.py index c811e96a23..b58a9837fa 100644 --- a/web3/_utils/module_testing/eth_module.py +++ b/web3/_utils/module_testing/eth_module.py @@ -774,8 +774,8 @@ async def test_async_sign_authorization_send_raw_and_send_set_code_transactions( assert get_auth["address"] == async_math_contract.address assert get_auth["nonce"] == nonce + 1 assert isinstance(get_auth["yParity"], int) - assert isinstance(get_auth["r"], HexBytes) - assert isinstance(get_auth["s"], HexBytes) + assert isinstance(get_auth["r"], int) + assert isinstance(get_auth["s"], int) # reset code reset_auth = { @@ -3919,8 +3919,8 @@ def test_sign_authorization_send_raw_and_send_set_code_transactions( assert get_auth["address"] == math_contract.address assert get_auth["nonce"] == nonce + 1 assert isinstance(get_auth["yParity"], int) - assert isinstance(get_auth["r"], HexBytes) - assert isinstance(get_auth["s"], HexBytes) + assert isinstance(get_auth["r"], int) + assert isinstance(get_auth["s"], int) # reset code reset_auth = {