-
Notifications
You must be signed in to change notification settings - Fork 11
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
fix: add null addresses checks in creditGasFees #302
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
nvtaveras
changed the title
fix: check for 0x addresses in creditGasFees
fix: add null addresses checks in creditGasFees
Nov 22, 2023
nvtaveras
force-pushed
the
fix/MU04Hotfix
branch
from
November 22, 2023 13:56
04458be
to
b81af8e
Compare
baroooo
reviewed
Nov 22, 2023
philbow61
reviewed
Nov 22, 2023
baroooo
approved these changes
Nov 23, 2023
philbow61
approved these changes
Nov 23, 2023
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.
LGTM ⛷️
nvtaveras
added a commit
that referenced
this pull request
Dec 1, 2023
nvtaveras
added a commit
that referenced
this pull request
Dec 4, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Description
While testing MU04 on Baklava we noticed that gas payment with stables was broken and after some digging we realized that this is due to a slight change in the implementation details of the
creditGasFees
function after switching to the StableTokenV2 implementation.TL;DR is that there were checks for the null address in the v1 implementation that were removed in v2, which makes the tx fail when the node attempts to include it in a block due to the
gatewayFeeRecipient
address being0x
and the underlying call to_transfer(from, 0x, amount)
failing.This change adds a null address check for each recipient addresses and it also keeps track of any amount that can't be transferred to recipients so that it's burned at the end of the function for proper accounting purposes.
Other changes
Fixed a slight typo of
conmunityFund
which was repeated throughout the code.Tested
Backwards compatibility
This is actually backwards compatible with the original V1 implementation that has proper null checks before the balances of the different accounts are manipulated https://github.com/mento-protocol/mento-core/blob/develop/contracts/legacy/StableToken.sol#L581-L587