-
Notifications
You must be signed in to change notification settings - Fork 220
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
Various fallback improvements #1611
base: main
Are you sure you want to change the base?
Conversation
07bc473
to
e2acdaa
Compare
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## main #1611 +/- ##
==========================================
- Coverage 88.44% 88.42% -0.03%
==========================================
Files 150 150
Lines 68322 68503 +181
==========================================
+ Hits 60429 60572 +143
- Misses 7893 7931 +38 ☔ View full report in Codecov by Sentry. |
@@ -384,6 +384,11 @@ is executed. This made clear in the declarations; ``receive()`` must be declared | |||
with value and no ``receive()`` function is defined, then the call reverts, likewise if | |||
call is made without value and no ``fallback()`` is defined, then the call also reverts. | |||
|
|||
The fallback function can defined in two ways. First, it can have no parameters or return | |||
values. Alternatively, it must have a ``bytes`` parameter and ``bytes`` return value. In this | |||
case, the parameter contains the undecoded input (also known as calldata or instruction data), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
undecoded = encoded?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The wording is not great. What I mean is the raw bytes data before going through borsh/scale/eth decoding.
Allow the following: contract A { // Take raw calldata as argument and return return data fallback(bytes calldata input) external payable (bytes memory) {} } Allow a function to be called fallback: contract A { // Will give a warning that's not a fallback function, // just a regular functon function fallback() public {} } Signed-off-by: Sean Young <[email protected]>
@seanyoung I'll be preparing a release in the upcoming days, I think this would be nice to have in :) |
Allow the following:
Allow a function to be called fallback:
This should make proxy contracts much easier to implement.
Also fixes all fallback/receive related failures in the evm tests.