-
Notifications
You must be signed in to change notification settings - Fork 213
fix(world): support expectRevert and unusual nameless arguments in system libraries #3680
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
base: main
Are you sure you want to change the base?
Conversation
🦋 Changeset detectedLatest commit: 94354ea The changes in this PR will be included in the next version bump. This PR includes changesets to release 30 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
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.
love these 🔥 thank you boss
getting back to this now @dk1a , I was thinking that maybe instead of skipping the decoding when length is 0, we could use a lower level call (same as we do for view functions), that way the world call would not revert and we would have the control to make it revert with something like revertWithBytes directly from the library |
The view functions also get a length == 0 check actually (see SystemALib for example), after |
4 issues:
vm.expectRevert
before a system library call always fails with a confusingEvmError: Revert
, because the call is unexpectedly successful, but with an emptyresult
, which breaksabi.decode(result, (...))
address payable
parameter doesn't have a name,address
is parsed as its type, andpayable
as its namebytes calldata
) parameter doesn't have a name,/ calldata /
informatParams
doesn't capture it because there is no whitespace at the endcalldata
location, it doesn't get replaced withmemory
, unlike arguments2-4 are obviously related and fixed by the changes to
formatParams
, and formattingreturnParameters
too1 is much less related, but the fix for it is - after I conditionally skip
return
ifresult.length == 0
, this causes the solidity warningUnnamed return variable can remain unassigned. Add an explicit return with value to all non-reverting code paths or name the variable. solidity(6321)
.And using the same
formatParameters
forreturnParameters
, including aux names, avoids the warning by naming the variablesI thought it'd be more convenient to review this way, but I can separate the expectRevert stuff if you don't like it