ExchangeUnion / xud

Exchange Union Daemon 🔁 ⚡️
https://exchangeunion.com
GNU Affero General Public License v3.0
115 stars 44 forks source link

getbalance assertion after closechannel eth #2028

Open raladev opened 3 years ago

raladev commented 3 years ago

Background

Today I tried to withdraw funds from eth channel to connext wallet and after withdrawing my getbalance call started to return assertion error. I checked xud and connext logs, xud was contain only assertion and i found nothing interesting in connext logs.

After that I removed and initialized new env again to reproduce the assertion appearing again to get reliable steps, but i was not able to get it again, so it is something floating. :(

Xud logs:

Screenshot from 2020-12-08 00-37-36

Utils output:

simnet > getbalance

Balance:
┌──────────┬───────────────┬───────────────────────────────┬────────────────────────────┐
│ Currency │ Total Balance │ Wallet Balance (Not Tradable) │ Channel Balance (Tradable) │
├──────────┼───────────────┼───────────────────────────────┼────────────────────────────┤
│ BTC      │ 2.5           │ 0                             │ 2.5                        │
├──────────┼───────────────┼───────────────────────────────┼────────────────────────────┤
│ DAI      │ 0             │ 0                             │ 0                          │
├──────────┼───────────────┼───────────────────────────────┼────────────────────────────┤
│ ETH      │ 15            │ 0                             │ 15                         │
├──────────┼───────────────┼───────────────────────────────┼────────────────────────────┤
│ LTC      │ 5             │ 0                             │ 5                          │
├──────────┼───────────────┼───────────────────────────────┼────────────────────────────┤
│ USDT     │ 0             │ 0                             │ 0                          │
└──────────┴───────────────┴───────────────────────────────┴────────────────────────────┘
simnet > tradinglimits

Trading Limits:
┌──────────┬───────────┬──────────┬──────────────┬───────────────┐
│ Currency │ Max Buy   │ Max Sell │ Reserved Buy │ Reserved Sell │
├──────────┼───────────┼──────────┼──────────────┼───────────────┤
│ BTC      │ 2.4499095 │ 2.45     │ 0            │ 0             │
├──────────┼───────────┼──────────┼──────────────┼───────────────┤
│ DAI      │ 0         │ 0        │ 0            │ 0             │
├──────────┼───────────┼──────────┼──────────────┼───────────────┤
│ ETH      │ 6.3       │ 15       │ 0            │ 0             │
├──────────┼───────────┼──────────┼──────────────┼───────────────┤
│ LTC      │ 4.899638  │ 4.9      │ 0            │ 0             │
├──────────┼───────────┼──────────┼──────────────┼───────────────┤
│ USDT     │ 0         │ 0        │ 0            │ 0             │
└──────────┴───────────┴──────────┴──────────────┴───────────────┘
simnet > walletdeposit eth
{
  "address": "0x67e4E645f940e76d5eb60D82eA62F0Ee8809E568"
}
simnet > closechannel ETH --amount 2 --destination 0x67e4E645f940e76d5eb60D82eA62F0Ee8809E568
{
  "transactionIdsList": [
    "0x8ca794cee6d1c6a8f167168330d712fbd3986941e7050e827ad5e26cd3307237"
  ]
}
simnet > getbalance

Balance:
┌──────────┬───────────────┬───────────────────────────────┬────────────────────────────┐
│ Currency │ Total Balance │ Wallet Balance (Not Tradable) │ Channel Balance (Tradable) │
├──────────┼───────────────┼───────────────────────────────┼────────────────────────────┤
│ BTC      │ 2.5           │ 0                             │ 2.5                        │
├──────────┼───────────────┼───────────────────────────────┼────────────────────────────┤
│ DAI      │ 0             │ 0                             │ 0                          │
├──────────┼───────────────┼───────────────────────────────┼────────────────────────────┤
│ ETH      │ 13            │ 0                             │ 13                         │
├──────────┼───────────────┼───────────────────────────────┼────────────────────────────┤
│ LTC      │ 5             │ 0                             │ 5                          │
├──────────┼───────────────┼───────────────────────────────┼────────────────────────────┤
│ USDT     │ 0             │ 0                             │ 0                          │
└──────────┴───────────────┴───────────────────────────────┴────────────────────────────┘
simnet > tradinglimits

Trading Limits:
┌──────────┬───────────┬──────────┬──────────────┬───────────────┐
│ Currency │ Max Buy   │ Max Sell │ Reserved Buy │ Reserved Sell │
├──────────┼───────────┼──────────┼──────────────┼───────────────┤
│ BTC      │ 2.4499095 │ 2.45     │ 0            │ 0             │
├──────────┼───────────┼──────────┼──────────────┼───────────────┤
│ DAI      │ 0         │ 0        │ 0            │ 0             │
├──────────┼───────────┼──────────┼──────────────┼───────────────┤
│ ETH      │ 6.3       │ 13       │ 0            │ 0             │
├──────────┼───────────┼──────────┼──────────────┼───────────────┤
│ LTC      │ 4.899638  │ 4.9      │ 0            │ 0             │
├──────────┼───────────┼──────────┼──────────────┼───────────────┤
│ USDT     │ 0         │ 0        │ 0            │ 0             │
└──────────┴───────────┴──────────┴──────────────┴───────────────┘
simnet > getbalance
Error: 13 INTERNAL: Assertion failed
simnet > getbalance
Error: 13 INTERNAL: Assertion failed
simnet > getbalance
Error: 13 INTERNAL: Assertion failed
simnet > getbalance
Error: 13 INTERNAL: Assertion failed
simnet > getbalance
Error: 13 INTERNAL: Assertion failed
simnet > loglevel trace
success
simnet > getbalance
Error: 13 INTERNAL: Assertion failed
simnet > getbalance
Error: 13 INTERNAL: Assertion failed
simnet > getbalance
Error: 13 INTERNAL: Assertion failed
simnet > tradinglimits

Trading Limits:
┌──────────┬───────────┬──────────┬──────────────┬───────────────┐
│ Currency │ Max Buy   │ Max Sell │ Reserved Buy │ Reserved Sell │
├──────────┼───────────┼──────────┼──────────────┼───────────────┤
│ BTC      │ 2.4499095 │ 2.45     │ 0            │ 0             │
├──────────┼───────────┼──────────┼──────────────┼───────────────┤
│ DAI      │ 0         │ 0        │ 0            │ 0             │
├──────────┼───────────┼──────────┼──────────────┼───────────────┤
│ ETH      │ 6.3       │ 13       │ 0            │ 0             │
├──────────┼───────────┼──────────┼──────────────┼───────────────┤
│ LTC      │ 4.899638  │ 4.9      │ 0            │ 0             │
├──────────┼───────────┼──────────┼──────────────┼───────────────┤
│ USDT     │ 0         │ 0        │ 0            │ 0             │
└──────────┴───────────┴──────────┴──────────────┴───────────────┘
simnet > exit
kilrau commented 3 years ago

Since it is simnet I assume this is vector? If so, needs to be handled @erkarl Ideas?

raladev commented 3 years ago

Since it is simnet I assume this is vector?

Yeap it is vector. Most likely this case can be reproduced when updating old version of xud (without vector) to a new one.

ghost commented 3 years ago

Yeap it is vector. Most likely this case can be reproduced when updating old version of xud (without vector) to a new one.

Think it's caused by the mismatch in token addresses. I assume it doesn't reproduce with a fresh env?

raladev commented 3 years ago

Yeap it is vector. Most likely this case can be reproduced when updating old version of xud (without vector) to a new one.

Think it's caused by the mismatch in token addresses. I assume it doesn't reproduce with a fresh env?

yeap, did not get it on fully new env.

sangaman commented 3 years ago

That error generally means that we're trying to assign an illegal value to a grpc field, like a negative number to an unsigned int, or a value greater than 2^64 for a 64 bit int.

kilrau commented 3 years ago

So.. do we want to prevent such values to be assigned to a grpc field, if not I guess we can close here?