[ADD] Subsidize ETH failed transaction for gas
How the network subsidise external chain gas
Each transcation broadcast on external chain , the network need to spend some on Gas , gas is quite un predictable, so the network doesn't account for gas until the outbound has been observed back.
When an outbound transaction get observed on external chain, then the network will take some RUNE from reserve , and do a mini swap, from RUNE -> the gas asset.
"tx": {
"id": "C3B48D2F25B6C0D7F34B8F01793F3BD419A27972508859C7374580F7263EE2A6",
"chain": "ETH",
"from_address": "0x94724a455e7f18a966bd2076af23cbacf374b16d",
"to_address": "0xf88bF5B54f91a43baFd022Fd5CA7F84a22CA27DB",
"coins": [
{
"asset": "ETH.FOX-0XC770EEFAD204B5180DF6A14EE197D99D808EE52D",
"amount": "1568338845838"
}
],
"gas": [
{
"asset": "ETH.ETH",
"amount": "1571700"
}
],
"memo": "OUT:7E07DA18120685D8D6ABEC346190085C4CACC3B20CE5FEB388A8D05B6D213E37"
}
This works well mostly
-
On Binance chain , gas is fix , and a transaction ether success of fail , if it fail , the gas will not be spent
-
On UTXO chain , once an outbound get broadcast , given the network pay very high gas fee , so it will be written to block
The problem:
On ETH chain , the network sometimes get into a situation that transaction failed due to "out of gas". for example: https://etherscan.io/tx/0xec08814f63d6dd18425ba8eb07b7c8b3327446a72107d4f8a3b1795d8e7aa524 , When this happen , the gas has been burned , however the transaction has been reverted.
At the moment, bifrost only observe successful transaction , when a transaction is failed , bifrost doesn't report it back to thornode.
Thornode doesn't know that bifrost attempted to send out a transaction , but failed due to out of gas, thus ,the network will not subsides the failed transaction for gas.
Use transaction(https://etherscan.io/tx/0xec08814f63d6dd18425ba8eb07b7c8b3327446a72107d4f8a3b1795d8e7aa524) for an example ,it spent 0.01627479 ETH on Gas, but failed , so 0.01627479 ETH get burned.
The network still account for those 0.01627479 ETH, however it has been burned on ETH chain already.
The vault is slightly insolvent, it case a few issues
- Asgard vault , churn will fail if no one top up asgard vault, solvency checker will be trigged to halt ETH chain
- Yggdrasil vault, node operator when leave the network will have to top up the ETH vault to pay for the gas , otherwise it can't unbond
Solution
- Bifrost observe failed transaction on ETH
- For a failed transaction , bifrost determinate whether it is an outbound transaction
- if the failed transaction is an outbound transaction , the bifrost craft a tx in item. With correct gas , and 10 GWei ETH
- Bifrost forward the transaction to THORNode , which cause thornode to slash the vault , and gas will be subsidised