feat(recurring): add revokeCycles for admitted bits - #1758
Conversation
|
Warning This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
This stack of pull requests is managed by Graphite. Learn more about stacking. |
Greptile SummaryThis PR adds relayer-controlled per-cycle admission and revocation, allowing subscribers to self-trigger admitted recurring batch payments while retaining the existing payment validations.
Confidence Score: 5/5The PR appears safe to merge with no concrete blocking or independently actionable non-blocking issues identified. The subscriber self-trigger path requires both subscriber identity and a relayer-admitted cycle bit, while the existing signature, schedule bounds, due-time, cancellation, ordering, and duplicate-payment checks remain in force. Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
Caller[Batch trigger caller] --> Role{Has relayer role?}
Role -->|Yes| Validate[Validate signature and schedule]
Role -->|No| Subscriber{Caller is subscriber?}
Subscriber -->|No| RejectSubscriber[Revert NotSubscriber]
Subscriber -->|Yes| Admitted{Cycle bit admitted?}
Admitted -->|No| RejectAdmission[Revert NotAdmitted]
Admitted -->|Yes| Validate
Validate --> Guards[Check deadline, bounds, due time, cancellation, order, and unpaid state]
Guards --> Payment[Mark cycle paid and execute transfers]
Reviews (1): Last reviewed commit: "feat(recurring): add revokeCycles for ad..." | Re-trigger Greptile |

Subscriber Self-Trigger via Admitted Cycles
Adds a permissioned self-trigger path to
triggerRecurringPaymentBatch, allowing subscribers to initiate their own payment cycles without requiring the relayer to act, provided the relayer has explicitly admitted those cycles.How it works
admitCycles(scheduleKey, mask)— relayer sets bits in a per-schedule bitmap to mark which cycle indices a subscriber is allowed to self-trigger.revokeCycles(scheduleKey, mask)— relayer clears bits to withdraw self-trigger permission for specific cycles without affecting relayer-initiated triggers._assertRelayerOrAdmitted— internal check that gatestriggerRecurringPaymentBatch: callers withRELAYER_ROLEpass unconditionally; any other caller must be the subscriber and must have the target cycle's bit set inadmittedCycles.index == 0guard is moved before the admission check so it fails fast regardless of caller.triggerRecurringPayment(single-fee) entry point remains relayer-only and is unaffected by admission.All existing invariants (
NotDueYet,AlreadyPaid,Cancelled,Paused, strict ordering) continue to be enforced on the self-trigger path.New error
ERC20RecurringPaymentProxy__NotAdmitted— reverted when a subscriber attempts to trigger a cycle whose bit has not been set inadmittedCycles.