Add a delegateCall test regarding memory #25
Merged
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.
This test asserts that the delegateCall function of the delegateCall library leaves the memory in the same state as a the targetDelegateCallBehaviour function - which was the first implementation of the delegateCall library before being optimized in yul. This test compares the free memory pointer value and the full memory state using both functions.
The idea behind targetDelegateCallBehaviourAndReturnMemoryAndPointer is to write in the memory before and after the delegateCall to not be in a trivial state with only 0's in memory. We test the memory on various data types returned by the delegateCall.
Note: it is possible to make a full working implementation having this test failing (like having the free mem pointer further than ref implem) but is I believe not safe to do.