Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: calldatasize < 4 reverting instead of going to fallback #3408

Merged
merged 10 commits into from
May 17, 2023

Conversation

charles-cooper
Copy link
Member

@charles-cooper charles-cooper commented May 14, 2023

in the case that a selector matches calldata with less than 4 bytes, it currently will revert instead of going to the fallback. this commit fixes the behavior in the special case where no data besides the method id is expected in the calldata.

note this regression was originally introduced in 02339df.

What I did

How I did it

in the case where expected calldatasize == 4, we do not expect any extra data. therefore, if calldatasize < 4, we can assume the selector is wrong and go to fallback instead of reverting as if we were doing calldata validation.

How to verify it

see the test. calling fow() with the leading 3 bytes of the selector (i.e., 0xd88e0b instead of 0xd88e0b00) currently reverts on master, while on this branch it correctly goes to the fallback function.

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

Put a link to a cute animal picture inside the parenthesis-->

in the case that a selector matches calldata with less than 4 bytes, it
currently will revert instead of going to the fallback. this commit
fixes the behavior in the special case where no data besides the method
id is expected in the calldata.

note this change in behavior was originally introduced in 02339df.
@charles-cooper charles-cooper marked this pull request as ready for review May 14, 2023 17:05
@charles-cooper charles-cooper requested a review from fubuloubu May 14, 2023 17:05
@codecov-commenter
Copy link

codecov-commenter commented May 14, 2023

Codecov Report

Merging #3408 (45b9fce) into master (97ff017) will decrease coverage by 0.07%.
The diff coverage is 100.00%.

❗ Your organization is not using the GitHub App Integration. As a result you may experience degraded service beginning May 15th. Please install the Github App Integration for your organization. Read more.

@@            Coverage Diff             @@
##           master    #3408      +/-   ##
==========================================
- Coverage   88.96%   88.90%   -0.07%     
==========================================
  Files          86       86              
  Lines       10765    10804      +39     
  Branches     2445     2454       +9     
==========================================
+ Hits         9577     9605      +28     
- Misses        786      801      +15     
+ Partials      402      398       -4     
Impacted Files Coverage Δ
.../codegen/function_definitions/external_function.py 100.00% <100.00%> (ø)

... and 15 files with indirect coverage changes

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@charles-cooper charles-cooper added this to the v0.3.8 milestone May 15, 2023
@charles-cooper charles-cooper merged commit 9ecb97b into vyperlang:master May 17, 2023
@charles-cooper charles-cooper deleted the fix/calldata-revert branch May 17, 2023 16:41
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.

3 participants