fix: set the reference to the popped element to the correct type #44
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
The IR generated for calls to pop (for dynamic array types and
bytes
) would obtain a reference to the last element of the array and then delete it. But the type of this reference was alwaysuint256
even though it should have been the type of the array element.Now, we set the reference's type to the array element type. For
bytes
, we set the reference's type tobytes1
.Trail o' Bits developed a fix for this, but I think they used the wrong element type for
bytes
. It should bebytes1
but they usebytes
. I will file an issue with them about this.Testing
make test
and verify all tests succeed../evaluate.sh run 100
intool-eval
and verify all projects succeedpipenv run slither test.sol --print slithir
, wheretest.sol
contains the following:Examine the IR and verify that the deleted reference variable has the correct type. Also, try changing the array
a
's type tobytes
.Related Issue
https://github.com/CertiKProject/slither-task/issues/501)
Additional Comments
I commented in the issue I already filed in the Slither repo about handling
bytes
incorrectly.