feat(adder): DRep Registrations and Retiring#615
Conversation
…ation certificates Signed-off-by: Akhil Repala <arepala@blinklabs.io>
📝 WalkthroughWalkthroughAdds DRep certificate event support: new event constants and a DRepCertificateEvent struct; extraction helpers to pull DRep certificates from transactions and a public ExtractDRepCertificates function; mapping from certificate types to event types; emission of DRep certificate events during block/transaction processing in chainsync; Cardano filter logic to evaluate DRepCertificateEvent payloads; and tests for DRep certificate filtering. Possibly related PRs
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
⚔️ Resolve merge conflicts (beta)
No actionable comments were generated in the recent review. 🎉 🧹 Recent nitpick comments
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 `@event/governance.go`:
- Around line 480-522: The DRep ID is always encoded with Bech32("drep") causing
wrong IDs for script-hash credentials; in extractDRepCertificate check the
credential type via c.DrepCredential.CredType (0 = key hash, 1 = script hash)
and choose the bech32 prefix accordingly (use "drep" for key-hash and
"drep_script" for script-hash) when setting DRepId for all handled cert structs
(*lcommon.RegistrationDrepCertificate, *lcommon.DeregistrationDrepCertificate,
*lcommon.UpdateDrepCertificate); mirror the same credential-type logic used in
extractVoteDelegation to ensure DRepId matches the precomputed filter variants.
🧹 Nitpick comments (2)
event/governance.go (1)
462-478: Minor: redundant nil-length check.Lines 474–476 return
nilwhenresultis empty, butresultis alreadynil(its zero value) when no certificates match and nothing was appended. The guard is harmless but unnecessary.input/chainsync/chainsync.go (1)
642-662: Duplicated DRep emission block — consider extracting a helper.This block is an exact copy of lines 514–534 (the
handleRollForwardpath), differing only in how the event is dispatched (c.eventChan <-vs.tmpEvents = append). The governance event emission has the same duplication, so this is a pre-existing pattern, but as the number of event types grows it will become harder to keep them in sync.
Signed-off-by: Akhil Repala <arepala@blinklabs.io>
Closes #485
Summary by cubic
Adds dedicated events for DRep registration, update, and deregistration, plus filtering by DRep ID so consumers can subscribe. Refactors DRep parsing for reuse. Addresses #485.
New Features
Bug Fixes
Written for commit 1720570. Summary will update on new commits.
Summary by CodeRabbit
New Features
Tests