fix(minibf): Unregistered dreps should figure as expired#887
Conversation
📝 WalkthroughWalkthroughAdds DRep unregistration detection and short‑circuit guards: introduces Changes
Sequence Diagram(s)(omitted) Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
No actionable comments were generated in the recent review. 🎉 Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@crates/cardano/src/model.rs`:
- Around line 1648-1654: The is_unregistered method currently uses unreachable!
in the (None, Some(_)) arm which can panic on corrupted or unexpected data;
change AccountState::is_unregistered to mirror AccountState::is_registered by
handling (None, Some(_)) safely—return false (or the appropriate boolean) and
emit a warning log instead of panicking so the process doesn't crash; update the
match in is_unregistered to remove unreachable! and add a log call (using the
existing logger or crate::log macros) referencing the unexpected (None, Some(_))
state.
🧹 Nitpick comments (1)
crates/minibf/src/routes/governance.rs (1)
127-141:is_drep_retiredduplicatesDRepState::is_unregistered()logic.The match on lines 136–140 is functionally identical to
DRepState::is_unregistered()added in this PR. Consider delegating to avoid the duplication.Suggested refactor
fn is_drep_retired(&self) -> bool { if self.is_special_case() { return false; } let Some(state) = self.state.as_ref() else { return false; }; - match (state.registered_at, state.unregistered_at) { - (Some(registered), Some(unregistered)) => unregistered > registered, - (Some(_), None) => false, - _ => false, - } + state.is_unregistered() }
Summary by CodeRabbit