smartcontract: verify access pass belongs to payer on multicast group subscribe#3442
Merged
snormore merged 2 commits intohotfix/v0.15.0from Apr 3, 2026
Merged
Conversation
… subscribe (#3439) - `SubscribeMulticastGroup` now verifies that the access pass provided belongs to the payer (i.e. `accesspass.user_payer == payer`) - Foundation allowlist members are exempt and may use any access pass on behalf of a user - `globalstate` is now a required account in both the onchain and non-onchain allocation paths (previously only required for onchain) - `test_subscribe_unauthorized_payer_rejected`: non-foundation payer with a mismatched access pass receives `Unauthorized` (Custom(22)) - `test_subscribe_foundation_admin_payer_differs_from_user_owner` and `test_unsubscribe_foundation_admin_payer_differs_from_user_owner`: foundation admins added to the allowlist can subscribe/unsubscribe on behalf of users - All existing `multicastgroup_subscribe_test`, `user_onchain_allocation_test`, and `create_subscribe_user_test` integration tests pass
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary of Changes
SubscribeMulticastGroupnow validates that the access pass provided belongs to the payer (accesspass.user_payer == payer); unauthorized payors receiveUnauthorized(error 22)globalstateis now a required account in the non-onchain-allocation path when 6+ accounts are provided; the 5-account layout is preserved as a backward-compatible fallback (payer must equal access pass owner in that case)globalstateinSubscribeMulticastGroupcallsDiff Breakdown
Heavily test-weighted change: the core logic addition is modest; the bulk is new and updated integration tests covering the new auth check.
Key files (click to expand)
smartcontract/programs/doublezero-serviceability/src/processors/multicastgroup/subscribe.rs— added payer-vs-access-pass ownership check; refactored account layout to acceptglobalstatein the non-onchain path; moved globalstate PDA validation earliersmartcontract/programs/doublezero-serviceability/tests/multicastgroup_subscribe_test.rs— addedtest_subscribe_unauthorized_payer_rejected,test_subscribe_unauthorized_payer_rejected_without_globalstate; updated foundation admin tests to add callers to the allowlist before subscribing; addedglobalstateto all subscribe instruction account listssmartcontract/programs/doublezero-serviceability/tests/user_onchain_allocation_test.rs— addedglobalstateaccount to allSubscribeMulticastGroupcalls throughout onchain allocation testssmartcontract/sdk/rs/src/commands/multicastgroup/subscribe.rs— movedglobalstatebefore the optional onchain-allocation accounts; updated unit test expectationssmartcontract/programs/doublezero-serviceability/tests/create_subscribe_user_test.rs— addedglobalstateto subscribe calls in publisher lifecycle testssmartcontract/sdk/rs/src/commands/user/delete.rs— updated mock expectations to includeglobalstatein subscribe account listsTesting Verification
test_subscribe_unauthorized_payer_rejected: a non-foundation payer using someone else's access pass receivesUnauthorized(Custom(22))test_subscribe_unauthorized_payer_rejected_without_globalstate: same rejection occurs in the 5-account backward-compat layout when payer ≠ access pass ownertest_subscribe_foundation_admin_payer_differs_from_user_ownerandtest_unsubscribe_foundation_admin_payer_differs_from_user_owner: foundation admins added to the allowlist can subscribe/unsubscribe on behalf of usersmulticastgroup_subscribe_test,user_onchain_allocation_test, andcreate_subscribe_user_testintegration tests pass