parallel
parallel copied to clipboard
How to handle bond | unbond | rebond's failure?
The exchange rate of every era will not be the same. Let's image that exchange_rate will always increase. Then if unbond fails, the next unbond will unbond more on the relaychain. This is still ok, because requests in unstake queue use old exchange rate (smaller). The money withdrawn from relaychain will definitely be bigger enough to cover them.
However, if the exchange_rate goes down then maybe we cannot cover unstake requests in that era
To solve this, maybe total_unstake_amount
should be staking currency
's amount
If unbond fails, shall UnbondIndex still increase? seems we shouldn't
Maybe we can consider store 'MatchingLedger' in each period, so if unbond failed in current period, it won't affect next period. we can fix the failed period by governance
Maybe unbond_index should advance if:
- unbond_amount == 0 => unbond_index += 1
- unbond_amount != 0 => after receiving notification, unbond_index += 1