Closed abitmore closed 2 years ago
Found the reason: https://github.com/bitshares/bitshares-core/blob/e52b9ffa3cb5c0a0dcdd3d3610486ce08925deba/libraries/chain/asset_evaluator.cpp#L1432-L1433 and (else) https://github.com/bitshares/bitshares-core/blob/e52b9ffa3cb5c0a0dcdd3d3610486ce08925deba/libraries/chain/asset_evaluator.cpp#L1467
When the individual settlement fund is not empty, and the price of the backing asset continues to fall, after a new price feed is published, current_feed
will not change, according to the code, return void_result()
will be executed, this means that check_call_orders()
will not be executed, so new individual settlement(s) will not happen although it (or they) should. In this case, when trying to update a debt position, the check_call_orders()
call will fail.
Similar suspicious code: https://github.com/bitshares/bitshares-core/blob/e52b9ffa3cb5c0a0dcdd3d3610486ce08925deba/libraries/chain/db_update.cpp#L498 and https://github.com/bitshares/bitshares-core/blob/e52b9ffa3cb5c0a0dcdd3d3610486ce08925deba/libraries/chain/asset_evaluator.cpp#L1004
To work around this issue, asset owners can temporarily or regularly update MCR (to a slightly lower value) to trigger individual settlements then update it back. See https://bitsharestalk.org/index.php?topic=33637.0.
When this occurs, these notes in the code are no longer true: https://github.com/bitshares/bitshares-core/blob/2c2e0ef4cc4e22b11630f0ca0ac8334760b52f10/libraries/chain/asset_evaluator.cpp#L1291-L1295
For the first note, although it is not true, but it just means that there is still a check_call_orders()
call missing, so nothing changes.
For the second note, in short, it is not true but also not critical. The details are as follows.
check_call_orders()
call closes a debt position (or more) and moves its (or their) collateral to the individual settlement fund, so the fund becomes non-empty again. In case when the force settlement request is too large to be fully filled, a new force settlement order will be created, and apply_force_settlement()
will be called (there is an issue here but it is not critical: https://github.com/bitshares/bitshares-core/issues/2587). It is possible that the apply_force_settlement()
call doesn't fill the force settlement either, in this case, the fund is not empty, and at the same time there is a force settlement.
current_feed.settlement_price * (1+force_settlement_offset)
, in this case, no matter if current_feed.settlement_price
is capped, the matching debt position should have sufficient collateral to pay at that price.median_feed.settlement_price
falls lower, current_feed.settlement_price
should not change (due to the bug). In this case, if check_call_orders()
got called somewhere else (E.G. due to the workaround), the force settlement will get matched with no issue.check_call_orders()
call again, the first force settlement will get matched with no issue.It should have been fixed by #2599. But missing test cases.
Added tests in #2606.
Bug Description
Unable to adjust debt position when individual settlement fund is not empty
Impacts Describe which portion(s) of BitShares Core may be impacted by this bug. Please tick at least one box.
CORE TEAM TASK LIST