Skip to content

evm: Require the exact size for the EIP-7702 delegation designator - #1713

Open
zexoverz wants to merge 2 commits into
ipsilon:masterfrom
zexoverz:1494-delegation-length
Open

zexoverz wants to merge 2 commits into
ipsilon:masterfrom
zexoverz:1494-delegation-length

Conversation

@zexoverz

Copy link
Copy Markdown
Contributor

is_code_delegated() only checked for the 0xef0100 prefix, and get_delegate_address() copied a 23 byte window, so code longer than the designator was treated as a delegation and code shorter than it produced a partial delegate address. Both now require exactly 23 bytes, and the address lookup reads one byte past the designator so a longer code is caught without a separate code size call. The state test loader keeps its "invalid size" message by checking the magic on its own.

New evm fixture tests cover the 3, 22, 23 and 24 byte cases on the CALL path. They live in their own file because the state_transition fixture validates the prestate and rejects those codes up front, which is the right behaviour for fixtures.

Fixes #1494

The designator is 0xef0100 followed by the delegate address, 23 bytes.
is_code_delegated() only checked the prefix, and get_delegate_address()
copied a 23-byte window so longer code looked like a delegation and
shorter code yielded a partial address. Check the size in both, reading
one byte past the designator so a longer code is detected without an
extra host call. The state test loader keeps its size diagnostic by
checking the magic separately.

Fixes ipsilon#1494
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.

Core EIP-7702 delegation parser accepts non-23-byte designators

1 participant