[V108-specific] Clean up failed-refund THORChain coins
[V108-specific]
[Update: Following feedback, midgard!486 (merged) was rewritten
(commit midgard@6fa1ebc5 rather than midgard@cad44e1d ),
and this MR's commit 845c5a9d removed for the time being.
|
The change is to recognise a synth supply change from the EventMintBurn's Reason, rather than from EventRefund interpretation specific to block height and/or a Mocknet environment variable.]
[Further thoughts/questions: Consider if a large Saver withdraw fails from a halted chain (e.g. between adding to the swap queue and swap attempt), and cannot be refunded to the withdrawal address because of the withdrawal address not being a THORChain address.
Should the synths be burnt?
Should they be sent to a Treasury address for manual swapping to the Saver later?
Should they be automatically re-added (add liquidity) to the Saver vault they came from?
(Edit: However, add liquidity also fails when the chain is halted.)
|
Whatever the case they shouldn't be left in the Pool Module (breaking its synth balance invariant);
this MR seeks to burn them, but I would be interested in knowing if there's interest in automatic re-add-liquidity or not.]
Intended to close #1468 (closed)
'[BUG] failed swaps from saver withdraws leaves synths abandoned on Asgard'.
|
[Update: Now also intended to close #1463 (closed)
'When something does go wrong, native-THORChain refund reasons lack crucial information',
having incorporated !2755 (closed)
'Emit all refund events (with any 'fail to refund' information) after their txout attempt'.]
[Edit: A requested different approach for Midgard renders the below environment variable irrelevant, thus removed from this MR;
nonetheless leaving a note of the commits used, namely
845c5a9d
and
midgard@cad44e1d
.]
With particular thanks to Ursa for the environmental variable method of informing Midgard that the environment is Mocknet
(for from-block-height-0 code behaviour for smoke tests and from implementation-version block height for persistent networks),
this MR is paired with midgard!486 (merged) to reflect the synth depth changes,
for which the Mainnet block height in the Midgard MR is a placeholder value intended to be replaced by the implementation block of this THORNode MR.