InactiveVault refunds are sending outbound fees from pools to the Reserve
I came across this when looking into GetGasRate
/GetMaxGas
code
( #1859 (comment 1754443053) )
, specifically how if the TxOutItem isn't Migrate/Ragnarok/Lending
( https://gitlab.com/thorchain/thornode/-/blob/v1.127.0/x/thorchain/manager_txout_current.go#L501 )
THORChain deducts an output-coin outbound fee (which can be of variable size relative to MaxGas),
sending the equivalent RUNE to the Reserve,
|
and if the output is a gas asset and either the TxOutItem is Ragnarok or the VaultStatus is InactiveVault
the txout manager deducts the MaxGas directly instead to cover the gas.
|
My initial focus was on that the VaultStatus is InactiveVault (0) even for a RUNE outbound,
but when seeking to tidy the conditional of the GetVault
call I noticed that THORChain sends a RUNE outbound fee even for InactiveVault refunds
(despite that liquidity providers receive no swap fee or other income from those InactiveVault inbounds).
https://thornode-v1.ninerealms.com/blocks/14414256
"time": "2024-01-24T22:39:45.060893438Z",
https://thornode-v1.ninerealms.com/thorchain/block?height=14414256
{
"chain": "BTC",
"code": "104",
"coin": "961362 BTC.BTC",
"from": "bc1qalr93usm8955sqh3zzn53ajs6pejwccrkn74aj",
"id": "AB5FBAB8D24CAA12117EBF77505E432E35349B6BE6097766A2BA8D86D346A86C",
"memo": "=:ETH.USDT-EC7:0xF47464CA5Cf90adf8C712da12E8e952A63078a1C:0/1/0:tr:0",
"reason": "observed inbound tx to an inactive vault",
"to": "bc1qyj862v4wdms3uv5fp3qnc78lfetew44zqj3awq",
"type": "refund"
}
{
"coins": "39000 BTC.BTC",
"pool_deduct": "383721308",
"tx_id": "AB5FBAB8D24CAA12117EBF77505E432E35349B6BE6097766A2BA8D86D346A86C",
"type": "fee"
},
{
"amount": "383721308rune",
"recipient": "thor1dheycdevq39qlkxs2a6wuuzyn4aqxhve4qxtxt",
"sender": "thor1g98cy3n9mmjrpn0sxmn63lztelera37n8n67c0",
"type": "transfer"
},
(3.8 RUNE deducted from the BTC.BTC pool because of an InactiveVault inbound which had never been added to the pool.)
Further,
https://thornode-v1.ninerealms.com/thorchain/tx/details/AB5FBAB8D24CAA12117EBF77505E432E35349B6BE6097766A2BA8D86D346A86C
the inbound amount was 961362 satoshi, but the both the Actions and OutTxs item's main and gas amounts each summed to 922362 satoshi
(39000 fewer), indicating that the refunded amount was double-deducted for both MaxGas cost and outbound fee,
despite that THORChain was unable to use the deducted outbound fee for its pools.
Regression test illustrating this (with a broken invariant, despite no bond slash):
92dc8691
https://gitlab.com/thorchain/thornode/-/jobs/6087417029