Expand description
Recovery logic for handling failed or stuck operations.
This module provides pure functions for determining and executing recovery actions when vault operations fail or get stuck in unexpected states.
§Recovery Actions
KernelAction::AbortAllocating: Cancel an allocation operation and return to IdleKernelAction::AbortWithdrawing: Cancel a withdrawal operation and refund escrowKernelAction::AbortRefreshing: Cancel a refresh operation and return to IdleKernelAction::SettlePayout: Complete a payout operation (success or failure path)
§Design Principles
- Recovery is deterministic based on state and provided timing context
- All recovery paths ensure escrow shares are properly handled
- Recovery should be safe to retry
Structs§
- Recovery
Context - Context for determining recovery actions.
- Recovery
Outcome - Outcome of a recovery operation.
- Recovery
Progress - Progress timestamps for an in-flight operation.
- Recovery
Stats - Compute recovery statistics from the current state.
Functions§
- compute_
payout_ failure_ outcome - Compute a failure payout outcome from escrow shares and idle restore amount.
- compute_
payout_ success_ outcome - Compute a success payout outcome from escrow and collected amounts.
- compute_
recovery_ stats - Compute recovery statistics from the current state.
- compute_
settlement_ shares - Compute the shares to burn and refund based on collected vs expected amounts.
- determine_
recovery_ action - Determine the appropriate recovery action for the current state.
- handle_
allocation_ failure - Handle a failed allocation operation.
- handle_
payout_ failure - Handle a failed payout operation.
- handle_
payout_ failure_ default - Handle a failed payout operation using the payout amount as the idle restore value.
- handle_
refresh_ failure - Handle a failed refresh operation.
- handle_
withdrawal_ failure - Handle a failed withdrawal operation.