Skip to content

Conversation

vkjr
Copy link
Contributor

@vkjr vkjr commented Aug 22, 2025

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 got gasLimit as a second argument which actually used as multiplier. As a result - overflow happened.

Affected areas

Bridge

Architecture compliance

Screencapture of the functionality

CleanShot 2025-08-22 at 12 27 44

How to test

  • open status
  • start "Bridge", select everything required
  • wait for the fees to appear
  • make sure fee is not displayed as 0.00 USD

@@ -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) {
Copy link
Contributor Author

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

Copy link
Contributor

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.

@status-im-auto
Copy link
Member

status-im-auto commented Aug 22, 2025

Jenkins Builds

Click to see older builds (8)
Commit #️⃣ Finished (UTC) Duration Platform Result
✔️ d2f7776 #1 2025-08-22 11:37:50 ~7 min tests/nim 📄log
✔️ d2f7776 #1 2025-08-22 11:43:29 ~12 min macos/aarch64 🍎dmg
✔️ d2f7776 #1 2025-08-22 11:44:04 ~13 min tests/ui 📄log
✔️ d2f7776 #1 2025-08-22 11:46:54 ~16 min linux/x86_64 📦tgz
✔️ d2f7776 #1 2025-08-22 11:50:58 ~20 min macos/aarch64-nwaku 🍎dmg
✔️ d2f7776 #1 2025-08-22 11:53:08 ~22 min linux/x86_64-nwaku 📦tgz
✔️ d2f7776 pr18704 2025-08-22 11:57:40 ~10 min tests/e2e 📊rpt
✔️ d2f7776 #1 2025-08-22 12:13:52 ~42 min windows/x86_64 💿exe
Commit #️⃣ Finished (UTC) Duration Platform Result
✔️ ed36745 #2 2025-08-22 13:25:29 ~9 min tests/nim 📄log
✔️ ed36745 #2 2025-08-22 13:29:24 ~13 min linux/x86_64 📦tgz
✔️ ed36745 #2 2025-08-22 13:30:51 ~14 min tests/ui 📄log
✔️ ed36745 #2 2025-08-22 13:36:44 ~20 min macos/aarch64 🍎dmg
✔️ ed36745 #2 2025-08-22 13:37:03 ~20 min linux/x86_64-nwaku 📦tgz
✔️ ed36745 pr18704 2025-08-22 13:39:59 ~10 min tests/e2e 📊rpt
✔️ ed36745 #2 2025-08-22 13:40:07 ~23 min macos/aarch64-nwaku 🍎dmg
✔️ ed36745 #2 2025-08-22 13:52:22 ~36 min windows/x86_64 💿exe
✔️ b180863 #3 2025-08-25 10:07:55 ~7 min tests/nim 📄log
✔️ b180863 #3 2025-08-25 10:12:42 ~11 min macos/aarch64 🍎dmg
✔️ b180863 #3 2025-08-25 10:13:41 ~12 min linux/x86_64 📦tgz
✔️ b180863 #3 2025-08-25 10:14:03 ~13 min tests/ui 📄log
✔️ b180863 #3 2025-08-25 10:18:02 ~17 min macos/aarch64-nwaku 🍎dmg
✔️ b180863 #3 2025-08-25 10:21:03 ~20 min linux/x86_64-nwaku 📦tgz
✔️ b180863 pr18704 2025-08-25 10:26:34 ~12 min tests/e2e 📊rpt
✔️ b180863 #3 2025-08-25 10:36:54 ~35 min windows/x86_64 💿exe

@vkjr vkjr requested review from alaibe, dlipicar and saledjenic August 22, 2025 12:27
@vkjr vkjr self-assigned this Aug 22, 2025
@vkjr vkjr added the bug-bash-2.35 Tasks found during the 2.35 busg bas label Aug 22, 2025
@@ -855,7 +855,7 @@ QtObject {

function getGasDecimalValue(chainID, gasValue, gasLimit) {
Copy link
Contributor

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"

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Renamed it 👍

@@ -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))
Copy link
Contributor

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) {
Copy link
Contributor

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.

let rawValue = nativeTokenGasToRaw(chainID, gasValue)
rawValue = StatusQUtils.AmountsArithmetic.times(rawValue, StatusQUtils.AmountsArithmetic.fromNumber(1, gasLimit))
return nativeTokenRawToDecimal(chainID, rawValue)
function calculateGasCost(chainID, gasPriceInGwei, gasAmount) {
Copy link
Contributor

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.

@vkjr vkjr merged commit 91d2c72 into master Aug 25, 2025
9 checks passed
@vkjr vkjr deleted the fix/vkjr-wrong-bridge-fee branch August 25, 2025 12:01
vkjr added a commit that referenced this pull request Aug 25, 2025
* Fixed issue with absent gas fee

* function reanamed to improve readability

* argument renamed accordingly to pr review
alaibe pushed a commit that referenced this pull request Aug 27, 2025
* Fixed issue with absent gas fee

* function reanamed to improve readability

* argument renamed accordingly to pr review
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug-bash-2.35 Tasks found during the 2.35 busg bas
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Wrong ETH fee on Bridge modal
5 participants