fix(world): support expectRevert and unusual nameless arguments in system libraries #3680
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.
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