decred / dcrdex

The Decred Decentralized Exchange (DEX), powered by atomic-swaps.
Other
186 stars 96 forks source link

eth: insanely high ETH wallet balance observed briefly #2185

Closed norwnd closed 1 year ago

norwnd commented 1 year ago

I had some DCR-ETH trades processing on testnet, latest master (-race build, which could slow some things down to make some bugs more prominent, with @martonp's https://github.com/decred/dcrdex/pull/2183 change - that's latest commit I see on my local master),

I had ~3 trades settling, and wanted to place 4th but didn't have enough ETH available in DEX wallet (according to error message I got, see screenshot below), so I decided to send some more to my DEX ETH account (from external Metamask wallet), once I sent funds and switched to DEX browser page to check funds arrived ... I saw that arrived a lot more than should have! and it changed (I don't think I refreshed page) back to the value it should have been displaying in ~20 seconds. But, the transaction I sent from Metamask wasn't mined at all while I was observing all that, I found it displayed in Pending on Etherscan ~10 mins later (I set custom fee that was a bit too low in Metamask when sending this txn):

image

tried to reproduce but couldn't, also could potentially be a provider glitch (I'm using only 1 provider - Infura), the general idea to reproduce would be to place a bunch of DCR-ETH orders (both buy and sell) so they match against themselves, and try to top up ETH wallet in the meantime,

screenshot for error I got when placing 4th DCR-ETH order (just in case it's somehow relevant):

image

attaching full log: insanely-high-eth-balance.txt

chappjc commented 1 year ago

Good report. I'd look for unsigned integer subtraction in the balance code. Looks like underflow. Since you said the transaction was really pending, that's probably a clue.

chappjc commented 1 year ago

resolved by https://github.com/decred/dcrdex/pull/2211