Fix Signify multisig exchange leader election - #455
Conversation
KERIA represents edge-controlled multisig groups with SignifyGroupHab, while KERIpy's Exchanger applies sender election only to GroupHab. This caused every KERIA member to forward the same completed EXN and, for IPEX grants, the same supporting artifact stream. Add a KERIA-specific exchanger that applies the existing lowest-signature-index election to SignifyGroupHab and delegates every other habitat type to the base implementation. Wire Agent to use it and cover elected, non-elected, missing-signature, and fallback behavior.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #455 +/- ##
==========================================
+ Coverage 88.44% 88.47% +0.02%
==========================================
Files 26 26
Lines 5938 5950 +12
==========================================
+ Hits 5252 5264 +12
Misses 686 686 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
| raise KeyboardInterrupt("Agency shutdown complete. Exiting Agency.") | ||
|
|
||
|
|
||
| class SignifyExchanger(exchanging.Exchanger): |
There was a problem hiding this comment.
This works but why not update keripy to if not isinstance(hab, habbing.GroupHab) && isinstance(hab, habbing.SignifyGroupHab): to reduce the duplication in case they diverge?
There was a problem hiding this comment.
Good point, I'll do that.
There was a problem hiding this comment.
Actually, I'm not quite sure what you're referring to. Are you saying we should change KERIpy instead of KERIA?
There was a problem hiding this comment.
Yes, considering SignifyGroupHab still lives in keripy, I think the cleanest solution would be to update keripy rather than (almost) duplicate it here
Summary
SignifyGroupHabExchangerbehavior for single-signature and KERIpyGroupHabhabitatsWhy this is necessary
KERIA represents edge-controlled multisig groups with
SignifyGroupHab. KERIpy'sExchanger.lead()only recognizesGroupHab, andSignifyGroupHabis a sibling type rather than a subclass. The default path therefore treats every Signify group member like an ordinary habitat and allows every member to send.For a three-member multisig operation, each KERIA Agent independently completes the same EXN after collecting threshold signatures. Without election, all three Agents forward that identical EXN. IPEX grants amplify the cost because each sender also forwards the supporting KEL, TEL, and ACDC artifact stream. Recipient mailboxes correctly retain those deliveries, so downstream parsing and callback handling repeat the same work.
This was discovered while profiling a local QVI workflow: one grant produced 121 recipient mailbox entries, consisting of three identical 41-entry streams. The same grant EXN appeared at offsets 0, 41, and 82, and Sally (vLEI Reporting API - not a part of KERIA) produced three callbacks for a single grant where there should have just been one. Applying leader election reduced that delivery to one 41-entry stream and one callback when combined with the separate artifact-completeness work (from another branch coming in a follow on PR).
Election behavior
After the completed EXN signatures have been stored, the exchanger:
This changes transport responsibility only. It does not change signing, thresholds, exchange completion, or recipient mailbox semantics.
Scope
This PR intentionally does not change: