Skip to content

Conversation

@kentbull
Copy link
Contributor

@kentbull kentbull commented Jan 9, 2026

This commit contains one big thing and a few small things, with heavy use of Claude Opus 4.5:

Big thing - add tests for the multisig delegation process

  • Fix earlier this year: Core multisig delegation escrow fix in eventing.py: added type guard if serder.ilk in (Ilks.dip, Ilks.drt) to ensure interaction events are not sent for approval and only dip and drt events are.
    • Tests for this:
      • tests/app/test_grouping.py - Updated with test_multisig_delegate() which covers the full end-to-end workflow:
      • tests/app/app_helpers.py - Contains:
        • EscrowDoer - Fast escrow processing for tests
        • openWit() / openCtrlWited() - Context managers for witness and controller setup
        • HabHelpers - OOBI resolution, witness receipts, and delegation seals
        • MultisigInceptLeader / MultisigInceptFollower - DoDoers for multisig inception coordination
        • MultisigDelegationApprover - DoDoer for delegation approval workflow
        • KeystateQueryDoer - Keystate discovery for anchor completion

The test is the majority of this PR.

This test is a new kind of test for the KERIpy codebase, one that operates at the level of Doers rather than using the internals of Parser, event handlers like Kevery, Tevery, and escrow processing. It uses the code similar to how the KLI does.

The multisig delegation test includes:

  • one witness to use to transmit messages back and forth
  • Delegator multisig formation
  • Delegate participants setup
  • OOBI exchanges
  • Delegation approval by both delegator participants
  • Keystate queries to discover the approval anchor
  • OOBI resolution of the delegate by delegator
  • Final verification assertions

Medium things

  • In core/eventing.py this adds a delegation seal check prior to escrowing a dip or drt to cover the case of a delegator OOBIing with the delegate AFTER approving the delegate's dip or drt.
    • What was happening was that even AFTER approving the delegation the dip was ending up back on the .delegables escrow following an OOBI resolution of the delegate by the delegator even though the delegator had already approved the dip. Looking up the seal again here is necessary to avoid re-escrowing an already approved dip or drt event.
    • This prepares the codebase for the delegatee KEL sharing mechanism Phil mentions in Have to share delegated AID with delegator after completion #307.
  • kli multisig join fix with if "di" in ked else None to if "di" in oicp.ked else None

Small Things

  • pass cf through in habbing.py so that temp=True works in tests.
  • delegables.rem() fix in delegate/confirm.py

logger.info(msg)
logger.debug("Event Body=\n%s\n", serder.pretty())
raise MissingDelegableApprovalError(msg)
# Before escrowing, check if we already have the seal in our KEL
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is a more subtle error I encountered while writing the test. The bug shows up for a delegator only after delegation completes and the delegator is trying to OOBI with the delegate in order to see the delegate's KEL in .kevers.

What was happening was that the dip event was incorrectly getting put back in to the .delegables escrow in response to the KEL replay from the OOBI resolve even though the dip was already approved.

@kentbull kentbull changed the title test: add multisig delegation test and test Doers fix,test: add multisig delegation test and test Doers; fix incorrect dip,drt re-escrow Jan 9, 2026
- Add tests/app/app_helpers.py with test orchestration Doers:
  - MultisigInceptLeader/Follower for multisig inception coordination
  - MultisigDelegationApprover for delegation approval with leader/follower support
  - KeystateQueryDoer for querying keystate from witnesses
  - openWit/openCtrlWited context managers for test setup
  - HabHelpers with OOBI resolution and witness receipt collection helpers
- Add test_multisig_delegate end-to-end test covering full delegation workflow
- eventing.py: Add seal lookup before escrowing DIP events to prevent
  re-escrowing events where delegation was already approved (e.g., via OOBI)
@kentbull kentbull force-pushed the add-multisig-delegation-test branch from f22ce69 to 3e4553d Compare January 12, 2026 19:57
@kentbull kentbull marked this pull request as draft January 15, 2026 15:34
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.

1 participant