Ensure that gas for swap tx submitted at same time as approval is in hex#10135
Merged
Ensure that gas for swap tx submitted at same time as approval is in hex#10135
Conversation
Contributor
|
CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes. |
darkwing
previously approved these changes
Jan 4, 2021
e55c39f to
1677637
Compare
darkwing
approved these changes
Jan 4, 2021
Collaborator
Builds ready [1677637]
Page Load Metrics (480 ± 47 ms)
|
This file contains hidden or 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
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Users have experienced the following issue with swaps:
To recreate this issue, you can do the following to test swaps on local host:
app/scripts/controllers/swaps.jsof metamask from 5000 to 15000ganache-cli --fork YOUR_INFURA_ENDPOINTThe account you have just imported should have 100 eth on the local network. You should be able to make swaps with this account.
This PR fixes this issue.
Before this PR, the
addUnapprovedTransactioncall on line 694 ofducks/swaps/swaps.jssilently fails when an approval is required because in that caseusedTradeTxParams.gasis set tomaxGas, which is a decimal number, but it is required to be a hex number. This issue was introduced here: https://github.com/MetaMask/metamask-extension/pull/10043/files#diff-79e282e22d97801a4a8ac7638c098e38eb40e3c46ad24ff4f7db7405dac2faabR606This PR correctly formats the
usedTradeTxParams.gasproperty, and everything works correctly again.We probably should also update our error handling so that this does not fail silently, but we should do so in another PR as this relates to this issue #9948, which requires a small amount of design work.