feat(contracts): liquidation safeguards, recovery sequencing, and gated telemetry (#1165, #1172, #1174) - #1218
Merged
Junirezz merged 2 commits intoAug 25, 2026
Conversation
…ed telemetry Addresses Junirezz#1165, Junirezz#1172, and Junirezz#1174, and repairs the vault test targets so the new tests can actually run. Junirezz#1165 — liquidation_safeguards.rs Pure, pre-mutation decision layer for strategy shortfalls: assess_shortfall classifies a position as healthy/degraded/impaired against an operator-set tolerance (rounding shortfall bps up so a sub-basis-point loss never reads as zero), check_recovery_preconditions rejects recovery attempted on a live vault, below the governance threshold, against a solvent position, or for more than the measured shortfall, and socialize_loss applies a write-down with a floor at zero. Junirezz#1172 — recovery_sequence.rs Models vault accounting as a state machine where `apply` is transactional by construction: it validates, computes the whole next state, and only then returns it, so a failing step provably leaves the caller's state untouched. Regression tests interleave deposits, withdrawals, yield accrual, and fee changes with injected failures and assert that state is unchanged after an interruption, the invariants hold at every point, and a corrected retry lands on the same state as a clean run. Junirezz#1174 — telemetry.rs + `diagnostics` entry point One consistent aggregate-only snapshot of vault state plus a derived health classification. Off by default and enabled only by an admin-authorised set_diagnostics_enabled. The snapshot reads vault-local storage only — it never calls the strategy or oracle, so it stays answerable when an external dependency is what is broken. Field policy (no addresses, no per-user balances, no credentials) is enforced by a test, not just prose. Pre-existing build repairs, needed because neither vault test target compiled: - event_tests: import the `Events` testutils trait, fix a stale helper name - formal_verification_tests: replace an unavailable `alloc` Vec with an array - feature_tests: drop `.unwrap()` on client methods that return `()`, and use the RescueUnauthorized code the contract actually returns - deposit_withdraw_props: route fee/treasury changes through the Junirezz#969 timelock API that replaced the removed direct setters - lib.rs: move the `#[cfg(test)]` queue-seed helper out of `#[contractimpl]`; under the `testutils` feature the macro generated a client method referencing a module that cfg stripped, breaking every integration test target Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01MymD3u1QnAaBBb5AGD71S8
|
@Samuel1-ona Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #1165
Closes #1172
Closes #1174
Closes #1164