fix(3jane): align monitoring with live protocol state - #351
Merged
Conversation
The borrower default-watch dedupe key embedded snapshot.default_at, which
is derived from the live GRACE_PERIOD / DELINQUENCY_PERIOD values read from
ProtocolConfig. Any governance change to either period shifts default_at
for every borrower, invalidating all stored markers and re-sending the
delinquent/14d/7d/3d/1d/default milestones already delivered.
Key on market/borrower/cycle/bucket instead: the cycle id already scopes
the key to one obligation, and the milestone ladder is what we dedupe on.
This matches what the README already documented ("deduped per
borrower/cycle/default milestone").
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DCu8DmaNeuzuPTdtofofjW
spalen0
approved these changes
Sep 10, 2026
4 tasks
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.
Summary
ProtocolConfigvalues instead of Envio snapshots.Why
The independent 15% junior-buffer threshold contradicted the existing 111% overcollateralization threshold and caused an alert while the corresponding OC check was healthy. A single protection check now presents both equivalent views of the same ratio.
Borrower timing must follow current protocol configuration. Envio remains the source of borrower state, while live grace and delinquency periods are read at the same Ethereum block used for the rest of the monitoring snapshot.
The debt cap returned by the contract is denominated in waUSDC shares. Labeling it directly as USD understated the effective cap, so the monitor now reports both its native unit and current USDC equivalent.
Verification
uv run --extra dev ruff check protocols/3jane/main.py tests/test_3jane.pyuv run --extra dev pytest -q(867 passed, 6 skipped, 5 subtests passed)