brave / brave-browser

Brave browser for Android, iOS, Linux, macOS, Windows.
https://brave.com
Mozilla Public License 2.0
17.01k stars 2.21k forks source link

Sometimes transactions stay in submitted state #35196

Open srirambv opened 6 months ago

srirambv commented 6 months ago

Description

Sometimes transactions stay in submitted state

Steps to Reproduce

  1. Submit a Solana Swap transaction
  2. If you are really lucky then transaction won't go through stays in submitted state
  3. Clicking on the block explorer button shows transaction not found message

Actual result:

Eg: Transaction link Solana

Expected result:

TBD

Reproduces how often:

Intermittent

Brave version (brave://version info)

Brave | 1.63.101 Chromium: 120.0.6099.199 (Official Build) nightly (64-bit) -- | -- Revision | 8d3f0a563e185b6a763cc8e210ab24775dfb9047 OS | Linux

Version/Channel Information:

Other Additional Information:

Miscellaneous Information:

cc: @onyb

AyushNigam11 commented 6 months ago

Verify that your wallet is configured correctly within the Brave browser. Check the settings to ensure that everything is set up according to your preferences.

jamesmudgett commented 5 months ago

Prompt the user to recreate the transaction or retry on core.

lukemulks commented 3 months ago

Hey all - I suspect this issue is most closely related to the issues I was encountering today.

On: Nightly v1.66.6 (Chromium 123.0.6312.46), Windows OS.

Solana has been seeing record high traffic; which may be a contributing factor, but not one worth dismissing the issue on.

The reason I say that is because I was able to successfully do the same transactions from both the Backpack wallet and Phantom without any issues.

Here's exactly what happened, and I was able to reproduce this with and without a hardware wallet attached.

  1. Attempt simple Solana SOL send transaction, p2p, to another Solana wallet.
  2. Transaction submits, then gets stuck in "submitted" state with spinning wheel for +30 minutes, without resolving. This feels like waiting for a mainnet ethereum transaction, and is anti-pattern UX for a Solana user.
  3. The transaction does not fail into "dropped" state; it remains stuck in endless submitted loop.

Experienced similar but slightly different behavior when making a simple p2p send of a Solana NFT.

  1. Initiate transaction
  2. Transaction hangs in submitted state for +1-2 minutes (roughly)
  3. Transaction fails over into "dropped state."

In both variations, the transactions were p2p sends to the same receiving address.

The NFT behavior is somewhat better than the fungible SPL behavior, but both fall into behavior that an Ethereum user would be accustomed to, but a Solana user would churn on.

Why? Because native Solana users are conditioned for a completely different transactional experience and norms.

Because Solana transactions cost less than a cent on average, tempo and frequency in the event of failover is much more rapid than Ethereum and EVM chains.

Solana users will try, fail, try, fail, try, fail, try => success in a rapid fashion, compared to Ethereum/EVM users where transactions take a long time to post and confirm on chain, and where transaction fees are impactful on failover.

It's just a different tempo.

The other factor that I suspect is coming into play is the addition of priority fees for Solana transactions, and how other wallets balance priority fee rating against network congestion.

I could be very wrong here, but I doubt I am outside of the neighborhood with this suspicion.

Before i break it down further, I want to be clear that I am going to great lengths here because the behavior made my experience transacting on Solana from our Wallet fundamentally broken and unusable today, and I had to resort to exporting and importing into Phantom and Backpack to perform the tasks I wanted to execute. Not intending to offend with that framing, or be hyperbolic, it's the fact of the matter.

Here's what I suspect is happening, based in what I am observing from the UX and from macro conditions in the Solana ecosystem.

A. I suspect we aren't setting priority fees at pace with the broader network conditions.

  1. With Solana having record use, and with use being in volume memecoin trading etc., dApps like Jupiter and others are making suggestions to users to increase slippage %s and increase priority fee settings on Solana transactions.

  2. The priority fees are not substantial compared to what users transact elsewhere, but with the volume of transactions taking place where priority fees are set, I suspect that one area we are falling over on is by not having some form of effective load balancing that increments up priority fees for bull market conditions. Perhaps we do; if so, I suspect we aren't incrementing at pace with macro.

  3. Perhaps we have a higher fee on the NFT transactions than the fungible transactions that trigger the dropout? Idk, but there's a difference there that finds resolution for the state change.

  4. I suspect that Phantom and Backpack are balancing an increase on priority fees automatically that result in a higher success rate...or I am completely wrong, but there's something going on that's resulting in greater success generally and desired usability with Phantom and Backpack that we should look at closely.

B. The way Brave Wallet handles Solana transaction failure appears to be counter pattern to expected Solana UX.

  1. It appears that a submitted transaction will hang and retry for a long duration. We should avoid that, imo. Solana transactions that fail should fail and show as failed fast for the user, so they can rapidly retry their transaction. This is how users transact on Solana. There isn't a long linger and wait; it's fail fast and reload until you hit success.

  2. Perhaps we are doing this, and aren't retrying...if that's the case, the duration set on this process is way too long. Again, I am seeing endless looping, which seems to hint at retry. If you observe what Jupiter or Bonkswap do, they have a 30 second timeout in which they determine success || fail and flag if failed. The user is alerted at that point and can manually retry. Fee loss is minimal so there's no risk at high fee and fast hammer until success when the network is ham with bullrun. My point is, show the failure very fast and alert the user so they can retry asap.

C. We don't give the user any dial to turn up priority fees on transactions.

  1. Paying for priority is cheap on Solana, either crank it up automatically, or give me an advanced carrot to drop and let me turn it up. We don't have to expose it, but let me be stupid with priority fee if I want to.

I may be missing the mark on some of the fine points above, but I am spot on with the usability concern. I don't like having to go elsewhere to transact, and crypto users are going to churn faster to other wallets when they're unable to transact.

I hope this is helpful; it isn't criticism, it's from a place of genuinely wanting to function competitively at parity on the tablestakes, and not being able to today when Solana usage was hitting all time highs.

lukemulks commented 3 months ago

Fwiw, would tag this as p2 or p1; the Wallet was unusable on Solana for me today and there wasn't enough context surfaced in the UX for me to know what was happening or how to adjust to have functional use.

lukemulks commented 3 months ago

+1 on this that surfaced from Community today over Twitter DM; it looks like in this case the transactions are dropping, but user is not clear on what's going on. Screenshot_20240319_115218_X Screenshot_20240319_115249_X

lukemulks commented 3 months ago

Received another report from Community Screenshot_20240320_192809_X

lukemulks commented 3 months ago

Screenshot_20240320_193238_X

User also +1'd in same discussion.

Do we have a read on what's going on?

Will attempt more transactions and see if I can repro with a session capture tonight.

lukemulks commented 3 months ago

Additional report from Twitter; this one from Android, and is displaying an ERROR as opposed to SUBMITTED or DROPPED Screenshot_20240320_214522_X

User mentions 5 attempts.

Screenshot_20240320_221157_X

I am not sure if all of these are related at this point given the 3 different states observed (dropped and error, which both have some finality; submitted, which even now remains hung and spinning since Friday).

lukemulks commented 3 months ago

High transaction failure rate being reported in Swap on Solana; same user able to swap on Jupiter without issue.

Have we looked into how we are handling priority fees for different tx types?

Getting more anecdotal reports from users expressing frustration because they keep hitting higher failure rate on transactions with us than other Solana wallets. Screenshot_20240322_130544_X 20240322_130551

Cc: @jamesmudgett

lukemulks commented 3 months ago

User that reported earlier in scrollback confirming he's still encountering the issue today. Screenshot_20240327_092505_X

Saoiray commented 3 months ago

Just wanted to add some +1s from Community.

https://community.brave.com/t/brave-wallet-mac-os-unable-to-send-or-swap-on-solona-network/539585

https://community.brave.com/t/cant-send-any-funds/539978

https://community.brave.com/t/sol-transactions-wont-go-through/538841

https://community.brave.com/t/cant-send-solana-sol/538186

https://community.brave.com/t/swap-usdc-to-solana-stuck-also-transfer-to-another-wallet/538167

https://community.brave.com/t/sent-transactions-being-dropped/537540

Anyone have details on the issue and if there is an ETA on fix? Kind of struggling on what to tell people overall.

lukemulks commented 3 months ago

Thanks @Saoiray - one of the users that posted one of the community posts reached out directly over DM and confirmed they hit the issue this morning. https://community.brave.com/t/brave-wallet-mac-os-unable-to-send-or-swap-on-solona-network/539585/3 ![Uploading Screenshot_20240328_115502_X.jpg…]()

yrliou commented 3 months ago

Thanks for all the reports, I think there are several issues being mixed up here. As far as I know, 1) Transactions stay in submitted state: For sending SOL directly from brave wallet, it shouldn't happen, it would be updated to dropped instead after blockhash is expired. For dApp transactions and swap transactions, we need to update them to dropped too after 150 blocks. 2) Transactions are dropped: The status update part is working as expected. A retry mechanism and priority fee might help in some cases, though it could be dropped for various reasons so we can't guarantee that it won't happen. https://solana.com/docs/core/transactions/retry#how-transactions-get-dropped. 3) Transactions have error, maybe blockhash is invalid/expired or something else, we could also provide retry in this case when applicable. One exception I have in mind from the top of my head is we can't issue retry on our end if the transaction is partial signed by other parties before handing over to our wallet to sign, cuz they need to re-sign too). 4) Harder to get transactions to be accepted using Brave Wallet: support priority fee might help.

Quick summary of action items: 1) Update state to dropped for all types of transactions and provide retry mechanism: https://github.com/brave/brave-browser/issues/36930 2) Support priority fee: https://github.com/brave/brave-browser/issues/35866

lukemulks commented 3 months ago

Thank you @yrliou

Have received additional reports this morning too; hadn't seen reports from iPad.

Will share the update to the users who have reported and with the Community.

Screenshot_20240402_082612_X Screenshot_20240402_082622_X

Saoiray commented 3 months ago

Just had another on Community asking about this:

It works every time I clear the transaction history, and restart my computer. So , for now, I can do that. Make one transaction per session. sorry for the bother, thanks for your help

Same person, multiple topics:

https://community.brave.com/t/solana-transactions-failed/540868

https://community.brave.com/t/sending-in-brave-wallet-solana/541151

https://community.brave.com/t/swaps-from-november-2023-never-completed/540863

yrliou commented 3 months ago

Just want to add that we also have https://github.com/brave/brave-browser/issues/37310 planned to manage retries on our side when possible to improve the successful rate of our transaction, which I'll be worked on after https://github.com/brave/brave-browser/issues/36930.

yrliou commented 3 months ago

Also want to add that Solana network is congested these days, they posted https://twitter.com/SolanaFndn/status/1768685164970778972 for improvement people can do, priority fee is at the top of the list which we're working on too, tracking by https://github.com/brave/brave-browser/issues/35866.