Skip to content

Conversation

@martinsander00
Copy link
Contributor

Resolves: #1996

Summary of Changes

  • Fixed CreateMulticastGroup to derive the PDA using the incremented globalstate.account_index instead of the client-provided value.index
  • Ensures the smart contract is the authoritative source of truth for account indices, preventing clients from passing arbitrary index values that could cause PDA-to-index mismatches
  • CHANGELOG.md update: Added entry under changes

Testing Verification

  • Existing test test_multicastgroup passes, validates that multicast groups are created with correct index values and all operations work properly
  • Added test_multicastgroup_create_with_wrong_index_fails to verify that clients cannot pass incorrect index values

@martinsander00 martinsander00 force-pushed the use-correct-index-multicast-1996 branch 4 times, most recently from ab74472 to 614c74d Compare December 25, 2025 03:58
@martinsander00 martinsander00 force-pushed the use-correct-index-multicast-1996 branch from 614c74d to 12eb42a Compare January 5, 2026 21:13
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes a security issue in the CreateMulticastGroup function by ensuring the smart contract is the authoritative source for account indices. Previously, clients could pass arbitrary index values, potentially causing PDA-to-index mismatches.

Key Changes:

  • Modified PDA derivation to use the incremented globalstate.account_index instead of the client-provided value.index
  • Moved global state parsing earlier in the function to enable this validation
  • Added test coverage to verify clients cannot create multicast groups with incorrect index values

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
smartcontract/programs/doublezero-serviceability/src/processors/multicastgroup/create.rs Updated PDA derivation logic to use contract-controlled index and reordered global state parsing
smartcontract/programs/doublezero-serviceability/tests/multicastgroup_test.rs Added test verifying rejection of incorrect client-provided indices
CHANGELOG.md Documented the security fix for multicast group creation

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@martinsander00 martinsander00 force-pushed the use-correct-index-multicast-1996 branch 5 times, most recently from 0157171 to 6a4c4da Compare January 6, 2026 19:31
@martinsander00 martinsander00 force-pushed the use-correct-index-multicast-1996 branch from 6a4c4da to 4227356 Compare January 6, 2026 19:41
Copy link
Contributor

@juan-malbeclabs juan-malbeclabs left a comment

Choose a reason for hiding this comment

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

LGTM

@martinsander00 martinsander00 merged commit d7eab32 into malbeclabs:main Jan 6, 2026
21 checks passed
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.

Use Incremented Global Account Index When Deriving Multicast Group PDA

2 participants