--- title: Bunker mode in Oracle tags: Oracle, withdrawals status: Draft author: Raman Siamionau created: 2022-10-21 updated: 2023-01-14 --- # Bunker mode ## Why bunker mode exists? When slashing begins we are not sure how much ETH our validators will lost. All begins with small amounts and if there are a lot of slashed validators penalty may increase to full validator's balance. ## Economic ![](https://hackmd.io/_uploads/Syl0TuSoi.png) The most safest case is to enable bunker mode when slashing begins. The most optimistic case is to enable bunker mode only when delta is negative. (That means are not expecting another loses and no additional slashing expected). ## Soft and Hard strategy #### Strategy 1 ```python def is_bunker_mode( lido_slashings_last_36d, non_lido_slashings_last_36d, median_rewards_per_day ): # calculate slashing losses by day based on current data losses_for_next_days = get_penalties_by_day( lido_slashings_last_36d, non_lido_slashings_last_36d ) # the minimum slashing duration is 36 days assert len(losses_for_next_days) >= 36 for loss_per_day in losses_for_next_days: if loss_per_day > median_rewards_per_day: return True return False ``` #### Strategy 2 ```python def is_bunker_mode( lido_slashed_valudators_balance_sum, lido_income_for_a_day, ): if lido_income_for_a_day < 0: return True if lido_slashed_valudators_balance_sum > lido_income_for_a_day: return True return False ``` #### Strategy 3 ```python def is_bunker_mode(...): if lido_income_for_a_day < 0: return True def risks(lido_validars_amount_slashed, total_validators_slashed_percent): return (e * max(total_validators_slashed_percent / 0.3, 0.01) + 1)**lido_validars_amount_slashed return risks(...) > 10 ``` If 10% of all validators were slashed ![](https://hackmd.io/_uploads/Sk63btBjj.png) If 30% of all validators were slashed ![](https://hackmd.io/_uploads/H1YqbFBoo.png)