fix: Drep retirement should clear accounts, not expiration - #744
fix: Drep retirement should clear accounts, not expiration#744gonzalezzfelipe wants to merge 4 commits into
Conversation
|
Caution Review failedThe pull request is closed. WalkthroughRefactors DRep lifecycle to use retiring_epoch and deposit, removes deprecated fields, updates serialization indices, and adjusts apply/undo logic and sweep conditions. Extends certificate handling across minibf builders and routes, and updates governance active/retired checks to rely on retiring_epoch and current epoch. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
actor Chain
participant Visitor as DRepStateVisitor
participant Roll as DRepRegistration/UnRegistration
participant State as DRepState
Note over Chain,Visitor: Process governance certs within a block/epoch
Chain->>Visitor: visit_root(epoch)
Note right of Visitor: Store current epoch
alt Register DRep
Chain->>Visitor: visit_cert(RegDRep)
Visitor->>Roll: DRepRegistration::new(drep)
Roll->>State: apply() sets retiring_epoch=None
else Unregister DRep
Chain->>Visitor: visit_cert(UnRegDRep)
Visitor->>Roll: DRepUnRegistration::new(drep, epoch+1)
Roll->>State: apply() sets retiring_epoch=Some(epoch+1)
end
Note over Roll,State: undo restores prev_retiring_epoch
sequenceDiagram
autonumber
participant Sweep as Sweep::retires
participant Ctx as SweepCtx
participant State as DRepState
participant Delta as Deltas
Sweep->>Ctx: current starting epoch
Sweep->>State: read retiring_epoch, last_active_slot
alt should_retire_drep
Sweep->>Delta: push DRepDelegatorDrop for each delegator
end
alt should_expire_drep
Sweep->>Delta: push DRepExpiration
end
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45–60 minutes Possibly related PRs
Suggested reviewers
Poem
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (6)
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 |
Summary by CodeRabbit
New Features
Bug Fixes
Refactor