fix: have inline fixed-length array arguments generate the appropriate SlithIR #26
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.
Notes
Rev1
When generating SlithIR for function calls with inline fixed-length array arguments, those arguments would be left as (python) lists instead of Variable objects. We would expect instead that a
InitArray
operation would be generated that initializes a temporary variable to that array, then have that temporary variable be the argument for the call.A core issue was that these inline fixed-length array arguments were equivalent to tuples in slither. The solc AST also characterizes them as tuples, but includes an extra field
isInlineArray
that distinguishes the two. slitherTupleExpression
s did not keep this information, so they could not be handled accordingly during SlithIR generation.This PR adds the
isInlineArray
information to theTupleExpression
class and uses it to properly generate the described "correct" SlithIR when an inline fixed-length array is a call argument.Testing
Run slither's
slithir
printer on the following code:Ensure that the expected SlithIR is generated. That is, the SlithIR of the calls to
take_arr
andtake_bool_arr
now have temporary variable arguments that were initialized to the arrays given, and that the call totake_not_arr
is still correct. Note as well that the expressions are also printed properly, using square brackets instead of parens for the array arguments.Related Issue
https://github.com/CertiKProject/slither-task/issues/212