-
Notifications
You must be signed in to change notification settings - Fork 87
Fixed issue with absent gas fee #18704
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
Conversation
@@ -71,8 +71,8 @@ Rectangle { | |||
GasSelector { | |||
id: gasSelector | |||
width: parent.width | |||
getGasNativeCryptoValue: function(gasPrice, gasAmount) { | |||
return Utils.getGasDecimalValue(root.selectedAsset.chainId, gasPrice, gasAmount) | |||
getGasNativeCryptoValue: function(gasPrice, gasAmount, chainId) { |
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.
While searching for a bug I also noticed that root.selectedAsset.chainId
is undefined
most of the time, so replaced it with argument modelData.fromNetwork
passed from GasSelector
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.
Hmm yeah Bridge is still multi-chain so I guess the token model used for the selector doesn't have a single chain associated with them. Perhaps if we do SimpleBridge like we did SimpleSend we can revert this.
Jenkins BuildsClick to see older builds (8)
|
ui/imports/utils/Utils.qml
Outdated
@@ -855,7 +855,7 @@ QtObject { | |||
|
|||
function getGasDecimalValue(chainID, gasValue, gasLimit) { |
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.
ugh this function's name is not very clear. Even the arguments have confusing name, they should be something like "gasPrice" and "gasAmount"
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.
Renamed it 👍
ui/imports/utils/Utils.qml
Outdated
@@ -855,7 +855,7 @@ QtObject { | |||
|
|||
function getGasDecimalValue(chainID, gasValue, gasLimit) { | |||
let rawValue = nativeTokenGasToRaw(chainID, gasValue) | |||
rawValue = StatusQUtils.AmountsArithmetic.times(rawValue, StatusQUtils.AmountsArithmetic.fromNumber(1, gasLimit)) | |||
rawValue = StatusQUtils.AmountsArithmetic.times(rawValue, StatusQUtils.AmountsArithmetic.fromNumber(gasLimit)) |
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.
nice catch!
@@ -71,8 +71,8 @@ Rectangle { | |||
GasSelector { | |||
id: gasSelector | |||
width: parent.width | |||
getGasNativeCryptoValue: function(gasPrice, gasAmount) { | |||
return Utils.getGasDecimalValue(root.selectedAsset.chainId, gasPrice, gasAmount) | |||
getGasNativeCryptoValue: function(gasPrice, gasAmount, chainId) { |
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.
Hmm yeah Bridge is still multi-chain so I guess the token model used for the selector doesn't have a single chain associated with them. Perhaps if we do SimpleBridge like we did SimpleSend we can revert this.
ui/imports/utils/Utils.qml
Outdated
let rawValue = nativeTokenGasToRaw(chainID, gasValue) | ||
rawValue = StatusQUtils.AmountsArithmetic.times(rawValue, StatusQUtils.AmountsArithmetic.fromNumber(1, gasLimit)) | ||
return nativeTokenRawToDecimal(chainID, rawValue) | ||
function calculateGasCost(chainID, gasPriceInGwei, gasAmount) { |
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.
This function is general, and I wouldn't put Gwei
in a variable name. Maybe better to name it gasPriceInGasUnit
or just gasPrice
and add a comment.
* Fixed issue with absent gas fee * function reanamed to improve readability * argument renamed accordingly to pr review
* Fixed issue with absent gas fee * function reanamed to improve readability * argument renamed accordingly to pr review
What does the PR do
Fixes #18649
Before the fix estimated "Ethereum transaction fee" for bridge was displayed as "0.00 USD" (while total fee was calculated correctly).
That happened because of incorrect usage of
AmountsArithmetic.fromNumber()
function that gotgasLimit
as a second argument which actually used as multiplier. As a result - overflow happened.Affected areas
Bridge
Architecture compliance
My PR is consistent with this document: QML Architecture Guidelines
Screencapture of the functionality
How to test