fix[ux]: fix validation for abi_encode() method_id kwarg#4369
Merged
charles-cooper merged 5 commits intovyperlang:masterfrom Dec 6, 2024
Merged
fix[ux]: fix validation for abi_encode() method_id kwarg#4369charles-cooper merged 5 commits intovyperlang:masterfrom
abi_encode() method_id kwarg#4369charles-cooper merged 5 commits intovyperlang:masterfrom
Conversation
code like in the test case (`abi_encode(..., method_id=b"123")`) will panic due to the assertion in `_parse_method_id()`, since the original typecheck only checked that the method_id is <=4 bytes. this adds a rule to validate that bytestring method ids are exactly 4 bytes directly in `abi_encode()`'s typecheck routine.
Collaborator
pcaversaccio
left a comment
There was a problem hiding this comment.
While I was reviewing the PR, I thought of the case where method_id should be None and why x"" or b"" is disallowed. Opinions?
Collaborator
There was a problem hiding this comment.
Having a test for the empty case x"" is always something sane to do IMO.
pcaversaccio
approved these changes
Nov 21, 2024
Collaborator
|
lgtm, let's just please merge https://github.com/charles-cooper/vyper/pull/51/files |
cyberthirst
approved these changes
Nov 29, 2024
…thod-id add method_id tests
abi_encode() method_id kwarg
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.
code like in the test case (
abi_encode(..., method_id=b"123")) will panic due to the assertion in_parse_method_id(), since the original typecheck only checked that the method_id is <=4 bytes. this adds a rule to validate that bytestring method ids are exactly 4 bytes directly inabi_encode()'s typecheck routine.What I did
fix #4354
How I did it
How to verify it
Commit message
Commit message for the final, squashed PR. (Optional, but reviewers will appreciate it! Please see our commit message style guide for what we would ideally like to see in a commit message.)
Description for the changelog
Cute Animal Picture