Skip to content

feat: filter governance events by address#601

Merged
wolf31o2 merged 1 commit intomainfrom
feat/filter-gov-by-addr
Feb 6, 2026
Merged

feat: filter governance events by address#601
wolf31o2 merged 1 commit intomainfrom
feat/filter-gov-by-addr

Conversation

@wolf31o2
Copy link
Copy Markdown
Member

@wolf31o2 wolf31o2 commented Feb 2, 2026

Closes #490


Summary by cubic

Add address-based filtering for Cardano governance events. This surfaces only proposals, treasury withdrawals, and vote delegations tied to the configured addresses.

  • New Features
    • Match proposal RewardAccount against stake addresses.
    • Match treasury withdrawal recipients against payment or stake addresses.
    • Match vote delegation certificates by stake credential hash (handles header-byte cases).
    • Apply address filter in governance event pipeline; added unit tests for pass/fail cases.

Written for commit 78b62b8. Summary will update on new commits.

Summary by CodeRabbit

  • New Features

    • Governance event filtering now supports matching by reward accounts, treasury withdrawal addresses (payment and stake forms), and stake credential hashes.
  • Tests

    • Added comprehensive tests covering reward account matches, treasury withdrawal cases, stake credential hash matching, and negative/no-address scenarios.

@wolf31o2 wolf31o2 requested a review from a team as a code owner February 2, 2026 21:25
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Feb 2, 2026

📝 Walkthrough

Walkthrough

This change adds address filtering for Cardano governance events by introducing matchAddressFilterGovernance(ge event.GovernanceEvent) bool. The filter checks proposal reward accounts, treasury withdrawal addresses (payment and stake), and stake credential hashes (hex-decoded, with last 28 bytes considered) against configured address filters. filterGovernanceEvent now calls this method when address filters are present. Hex decoding support was added and tests covering multiple governance address scenarios were included.

Possibly related PRs

  • blinklabs-io/adder PR 578: Introduces the GovernanceEvent type and related chainsync emission used by the new governance-address filtering logic.
🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'feat: filter governance events by address' is concise, specific, and directly describes the main change in the changeset.
Linked Issues check ✅ Passed The PR implements address-based filtering for governance events, covering proposals, treasury withdrawals, and vote delegations as required by issue #490.
Out of Scope Changes check ✅ Passed All changes are focused on governance event address filtering; no unrelated modifications detected.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/filter-gov-by-addr

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 2 files

@wolf31o2 wolf31o2 force-pushed the feat/filter-gov-by-addr branch from 75d43f8 to aa3fc76 Compare February 2, 2026 21:51
@wolf31o2 wolf31o2 changed the title feat: gilter governance events by address feat: filter governance events by address Feb 2, 2026
@wolf31o2 wolf31o2 force-pushed the feat/filter-gov-by-addr branch 4 times, most recently from 9ea3f59 to c0d67f1 Compare February 5, 2026 22:52
Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In `@filter/cardano/cardano.go`:
- Around line 232-244: matchStakeCertificates is comparing 28-byte credBytes to
entries in stakeCredentialHashes that include a 1-byte header (29 bytes), so the
equality check always fails; update matchStakeCertificates to mirror the logic
in matchAddressFilterGovernance: for each filterHash from stakeCredentialHashes,
if len(filterHash) > 28 set hashToCompare = filterHash[len(filterHash)-28:] else
hashToCompare = filterHash, then compare bytes.Equal(credBytes, hashToCompare);
this ensures header-byte handling is consistent between
matchAddressFilterGovernance and matchStakeCertificates.

Signed-off-by: Chris Gianelloni <wolf31o2@blinklabs.io>
@wolf31o2 wolf31o2 force-pushed the feat/filter-gov-by-addr branch from c0d67f1 to 78b62b8 Compare February 6, 2026 00:04
@wolf31o2 wolf31o2 merged commit 44137a1 into main Feb 6, 2026
10 checks passed
@wolf31o2 wolf31o2 deleted the feat/filter-gov-by-addr branch February 6, 2026 02:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Filter for Addresses in transaction/governance event types

2 participants