status-im / status-desktop

Status Desktop client made in Nim & QML
https://status.app
Mozilla Public License 2.0
273 stars 76 forks source link

Estimated fee should be recalculated ~ every 10 sec on send transaction screen #14571

Open churik opened 2 months ago

churik commented 2 months ago

Bug Report

Description

The estimated fee for the transaction should be changed ~ every 10 sec depending on network. Currently it is not changing on Send TX screen, which can mislead the user.

Captured difference between MM in desktop in a video: meta_mask_mainnet_eth_gas_difference.mp4

Additional Information

alaibe commented 2 months ago

In order to achieve this, only a fee recalculation should be performed, not a full route recalculation.

Doing a full route recalculation could lead to a different route, e.g if fees increased, there might be a better route.

Question: shall we also recalculate fees of the bridge or only the fees in order to send the tx?

pavloburykh commented 1 month ago

Hey @alaibe @saledjenic ! What do you think, is this error on mobile related to current issue or I should log it separately?

It happens very often to me when confirming the transaction.

Status-debug-logs - 2024-05-14T150744.727.zip

photo_2024-05-14 15 06 04

alaibe commented 1 month ago

This is first time i see this error, it looks like a different error from this bug. Even if we recompute every x seconds, initially this shouldn't happen

However we have this check on backend:

if baseFee.Cmp(perc20) >= 0 {
        maxFeePerGasMedium = baseFee
    } else {
        maxFeePerGasMedium = perc20
    }

Which means that we already ensure base fee is lower than max fee per gas medium. It could be a rounding issue on mobile?

pavloburykh commented 1 month ago

Which means that we already ensure base fee is lower than max fee per gas medium. It could be a rounding issue on mobile?

@alaibe thank you for reply. I will log a separate issue for mobile so devs can investigate it.

saledjenic commented 1 month ago

@pavloburykh I guess you faced this error when you wanted to place a tx, it comes from the internal checks on the goethereum side, could be that something wrong is set on the sending tx side, but as Anthony said, I see it for the first time. Anyhow, the router is under checking and the next step is checking sending mult-transactions, maybe we will figure out what was wrong in your case there.

saledjenic commented 1 month ago

@briansztamfater I wouldn't say it's related. An input parameter that you should use is gasFeeMode which is one of values 0, 1 or 2 (corresponds to GasFeeMode = 0, GasFeeMedium = 1, GasFeeHigh = 2) the desktop app is hardcoded toGasFeeMedium`.

briansztamfater commented 1 month ago

@saledjenic Yes, sorry, deleted my comment because it was not related. I am doing some further research to discover what may be causing this issue.

briansztamfater commented 1 month ago

We are using medium gasFeeMode and just creating the request using the values received from the routes, so not sure what may be the cause of that error 🤔

briansztamfater commented 1 month ago

Could infura rate limit be the reason? I am not sure if we are obtaining baseFee values from Infura and that is causing error sometimes 🤔 .

05-14 14:31:39.055 25393 25510 E ReactNativeJS: 2024-05-14T11:31:38.984Z ERROR [status-im.contexts.wallet.send.events:495] - failed to send transaction {:event :wallet/send-transaction,
05-14 14:31:39.055 25393 25510 E ReactNativeJS:  :error
05-14 14:31:39.055 25393 25510 E ReactNativeJS:  {:code -32000,
05-14 14:31:39.055 25393 25510 E ReactNativeJS:   :message
05-14 14:31:39.055 25393 25510 E ReactNativeJS:   "fallback failed with '429 Too Many Requests: {\"jsonrpc\":\"2.0\",\"id\":7,\"error\":{\"code\":-32005,\"message\":\"daily request count exceeded, request rate limited\",\"data\":{\"see\":\"https://infura.io/dashboard\"}}}'. run error was 'max fee per gas less than block base fee: address 0x527d22094166ad33e7523D2CBCa287798e149C7F, maxFeePerGas: 10000000 baseFee: 10031000'"},
05-14 14:31:39.055 25393 25510 E ReactNativeJS:  :params
05-14 14:31:39.055 25393 25510 E ReactNativeJS:  [{:fromAddress "0x527d22094166ad33e7523d2cbca287798e149c7f",
05-14 14:31:39.055 25393 25510 E ReactNativeJS:    :toAddress "0x49bb53433278b8ff318a04ec2c30cf2e9655f940",
05-14 14:31:39.055 25393 25510 E ReactNativeJS:    :fromAsset "ETH",
05-14 14:31:39.055 25393 25510 E ReactNativeJS:    :toAsset "ETH",
05-14 14:31:39.055 25393 25510 E ReactNativeJS:    :fromAmount "0x9184e72a000",
05-14 14:31:39.055 25393 25510 E ReactNativeJS:    :type 0}
05-14 14:31:39.055 25393 25510 E ReactNativeJS:   [{:BridgeName "Transfer",
05-14 14:31:39.055 25393 25510 E ReactNativeJS:     :ChainID 42161,
05-14 14:31:39.055 25393 25510 E ReactNativeJS:     :TransferTx
05-14 14:31:39.055 25393 25510 E ReactNativeJS:     {:MaxFeePerGas "0x989680",
05-14 14:31:39.055 25393 25510 E ReactNativeJS:      :From "0x527d22094166ad33e7523d2cbca287798e149c7f",
05-14 14:31:39.055 25393 25510 E ReactNativeJS:      :MaxPriorityFeePerGas "0x0",
05-14 14:31:39.055 25393 25510 E ReactNativeJS:      :TxType "0x02",
05-14 14:31:39.055 25393 25510 E ReactNativeJS:      :Gas "0x9134",
05-14 14:31:39.055 25393 25510 E ReactNativeJS:      :Input "",
05-14 14:31:39.055 25393 25510 E ReactNativeJS:      :Data "0x",
05-14 14:31:39.055 25393 25510 E ReactNativeJS:      :Nonce nil,
05-14 14:31:39.055 25393 25510 E ReactNativeJS:      :Value "0x9184e72a000",
05-14 14:31:39.055 25393 25510 E ReactNativeJS:      :To "0x49bb53433278b8ff318a04ec2c30cf2e9655f940"}}]
05-14 14:31:39.055 25393 25510 E ReactNativeJS:   "0x0d45e19766c0cadfe3af48b801102a9de4337ee41088e3561d9f1e9897aeeeae"]}
saledjenic commented 1 month ago

@briansztamfater yes, and yes we fetch not only the baseFee from Infura, but many other things while calculating the best route.