ADD: Automatic Solvency Check
Current
The system will happily go into insolvency and not defend or stop it.
Desired
Nodes check for solvency continuously. As soon as they detect an issue, they report to thorchain insolvency:vault
. When more than 1/3rd + 1 of the nodes report insolvency, the system automatically halts.
Interfaces monitoring for halted=true
will stop sending transactions. No more will be observed or signed out.
Nodes/Devs will be forced to deal with the issue (new update) or send funds in to correct the issue (no more trading can be done until rectified).
Nodes keep checking, when the system returns to solvency, they report to THORChain. Once 2/3rds agree the system is solvent, it returns to trading automatically.
Implementation
Insolvency
- Each node scans all the vaults on-chain via local nodes. (use super-tools infra).
- When insolvency on any vault (not the pool), compared to the wallet, they report
insolvent:vault
- Add
insolvency_reported = [<vault>]
to/node
endpoint to track which nodes are reporting - When 1/3rd + 1, then halt trading and outbounds
Return to Solvency
- When nodes report solvency again
solvent:vault
they are tracked on/node
endpoint - When 2/3rds, restart trading
Edge cases
Ygg theft
When a ygg steals, the system tracks it and knows about it. so the system is not insolvent. The vault is updated with the stolen assets.
Gas issues
Gas assets may temporarily go insolvent (used more than should), especially ETH.
Solvency buffer should then be applied to gas assets ie 100 * transactions (using the current gas rates for a typical tx on that chain) eg, 100 sat byte * 250 bytes = 25k sats on BTC.