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.
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
Change execution order to avoid reentry through the _beforeTokenTransfer hook #3611
Change execution order to avoid reentry through the _beforeTokenTransfer hook #3611
Changes from 3 commits
6c3ea96
52058b2
2c5204a
24996ed
abae8ca
41f343b
90f3c16
ec24469
b8fc567
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
It is wrong to remove this from here... We need to check that
from
is the owner at the time of the transfer, don't we? We should do the same we did in_burn
, and re-read the owner after the hook...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.
My impression was that it would be checked after the hook, and that would revert in the owner is not correct.
The risk is that the hook would be executed with an invalid
from
, and the revert would come after.There is a world in which the from is not valid, the before hook move the token from its current owner to the from, and then the test passes and we do what we have to do... The code would have to be really f****d up, but its possible.
My concern is that doing the test twice increase transfer cost by >100 gas (on probably the most common and scrutinized operation)