Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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