Skip to content

fix: represent authorization list r/s as uint256 per EIP-7702#3864

Open
kushdab wants to merge 2 commits into
ApeWorX:mainfrom
kushdab:fix/eip7702-r-s-uint256
Open

fix: represent authorization list r/s as uint256 per EIP-7702#3864
kushdab wants to merge 2 commits into
ApeWorX:mainfrom
kushdab:fix/eip7702-r-s-uint256

Conversation

@kushdab

@kushdab kushdab commented Jun 26, 2026

Copy link
Copy Markdown

Fixes #3716.

Problem

EIP-7702 specifies r and s in authorization tuples as uint256 (integers), not bytes32. The current formatter converts them to HexBytes(32), which is incorrect for both the formatter and the SetCodeAuthorizationData TypedDict.

Changes

web3/_utils/method_formatters.py

# Before
"r": to_hexbytes(32, variable_length=True),
"s": to_hexbytes(32, variable_length=True),

# After
"r": to_integer_if_hex,
"s": to_integer_if_hex,

web3/types.py

# Before
r: HexBytes
s: HexBytes

# After
r: int
s: int

web3/_utils/module_testing/eth_module.py

# Before
assert isinstance(get_auth["r"], HexBytes)
assert isinstance(get_auth["s"], HexBytes)

# After
assert isinstance(get_auth["r"], int)
assert isinstance(get_auth["s"], int)

(Same change in both sync and async test methods.)

Testing

The existing EIP-7702 integration tests in eth_module.py are updated to assert int rather than HexBytes. The formatter change is covered by the existing test fixtures.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Serialization bug with authorization signatures

1 participant