feat: add delegated signing support to PayerRegistry with authorize/revoke/query functions#259
feat: add delegated signing support to PayerRegistry with authorize/revoke/query functions#259
Conversation
…evoke/query functions
Summary by OctaneNew ContractsNo new contracts were added. Updated Contracts
🔗 Commit Hash: 68aec14 |
WalkthroughA new delegation system was added to PayerRegistry, enabling payers to authorize and revoke delegates with optional expiry times. The system includes authorization checks, revocation capabilities, and query functions to verify delegation status and retrieve delegation details. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Suggested labels
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
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 |
Add delegated signing to
|
Overview
Detailed findings
|
Add Delegated Signing Support to PayerRegistry
Summary
This PR implements the smart contract portion of user-funded messages via delegated signing (xmtp/xmtpd#1599). This allows XMTP users to authorize gateways to sign payer envelopes on their behalf, enabling users to pay for their own message sending rather than relying on gateway operators.
Problem
Currently, message fees are always charged to whoever signs the
PayerEnvelope(the gateway). Users cannot pay for their own messages even if they've funded an on-chain payer balance, because the gateway always signs with its own key.Solution
Users can now authorize gateways on-chain to act as delegates:
Changes
New Struct:
New Events:
DelegationAuthorized(address indexed payer, address indexed delegate, uint64 expiry)DelegationRevoked(address indexed payer, address indexed delegate)New Errors:
ZeroDelegate()DelegationAlreadyExists()DelegationDoesNotExist()DelegationExpiryInPast()New Functions:
authorize(address delegate, uint64 expiry)- Grant delegation to a gatewayrevoke(address delegate)- Revoke delegationisAuthorized(address payer, address delegate) → bool- Check if delegation is valid and not expiredgetDelegation(address payer, address delegate) → Delegation- Get delegation detailsTesting
Related
feat/delegated-signing)Summary by CodeRabbit
Release Notes