smartcontract: integrate Index into multicast group lifecycle#3415
Draft
martinsander00 wants to merge 2 commits intomainfrom
Draft
smartcontract: integrate Index into multicast group lifecycle#3415martinsander00 wants to merge 2 commits intomainfrom
martinsander00 wants to merge 2 commits intomainfrom
Conversation
eee8619 to
913dd96
Compare
f95f302 to
a3008ee
Compare
a3008ee to
4a51bc6
Compare
b46c0e8 to
1d42f65
Compare
elitegreg
requested changes
Mar 31, 2026
smartcontract/programs/doublezero-serviceability/src/processors/multicastgroup/closeaccount.rs
Show resolved
Hide resolved
smartcontract/programs/doublezero-serviceability/src/processors/multicastgroup/delete.rs
Show resolved
Hide resolved
smartcontract/programs/doublezero-serviceability/src/processors/multicastgroup/update.rs
Outdated
Show resolved
Hide resolved
martinsander00
added a commit
that referenced
this pull request
Apr 1, 2026
Resolves: #3408 ## Summary - Introduce an Index account (PDA derived from entity type + lowercased code) for O(1) code-to-pubkey lookup and onchain uniqueness enforcement - Add standalone CreateIndex/DeleteIndex instructions (variants 104/105) for migration backfill of existing accounts - Add Index PDA derivation (`get_index_pda`) and Rust SDK command wrappers Split PR (1/2). Integration into multicast group lifecycle follows in #3415. New derivation workflow: #3256 (comment) ## Diff Breakdown | Category | Files | Lines (+/-) | Net | |------------------|-------|---------------|-------| | Onchain program | 12 | +373 / -4 | +369 | | Rust SDK | 4 | +75 / -0 | +75 | | Tests | 2 | +456 / -0 | +456 | | CHANGELOG | 1 | +2 / -0 | +2 | | **Total** | 18 | +906 / -4 | +902 | ~50% tests, ~41% onchain program, ~9% Rust SDK <details> <summary>Key files (click to expand)</summary> - `smartcontract/programs/doublezero-serviceability/src/state/index.rs` — new Index account struct (account_type + pubkey + bump_seed) with Borsh serialization - `smartcontract/programs/doublezero-serviceability/src/processors/index/create.rs` — standalone CreateIndex processor - `smartcontract/programs/doublezero-serviceability/src/processors/index/delete.rs` — standalone DeleteIndex processor - `smartcontract/programs/doublezero-serviceability/src/pda.rs` — `get_index_pda()` with case-insensitive seed derivation - `smartcontract/sdk/rs/src/commands/index/create.rs` — CreateIndex SDK command wrapper - `smartcontract/sdk/rs/src/commands/index/delete.rs` — DeleteIndex SDK command wrapper </details> ## Testing Verification - New `index_test.rs` with 5 tests: create, duplicate rejection, unauthorized create, delete, unauthorized delete - New test helpers for transactions with extra accounts - All existing tests continue to pass (no modifications to existing processors)
b0b790c to
b0fe8cf
Compare
Wire Index account management into multicast group create, update, delete, and close instructions. Update Rust SDK commands to derive and pass Index PDAs. Add close_index/rename_index args to control Index lifecycle during deactivation and updates. Update activator, Go/Python/TypeScript SDKs, and all integration tests.
b0fe8cf to
588613f
Compare
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.
Stacked on #3256
Summary
rename_index/close_indexargs to control Index lifecycle during updates and deactivationIndexaccount type to Go, Python, and TypeScript SDKsDiff Breakdown
~41% Rust SDK, ~28% onchain program, ~29% tests, ~2% other
Key files (click to expand)
smartcontract/programs/doublezero-serviceability/src/processors/multicastgroup/update.rs— atomic Index rename when multicast group code changessmartcontract/programs/doublezero-serviceability/src/processors/multicastgroup/create.rs— creates Index account alongside multicast groupsmartcontract/programs/doublezero-serviceability/src/processors/multicastgroup/delete.rs— closes Index during deletionsmartcontract/programs/doublezero-serviceability/src/processors/multicastgroup/closeaccount.rs— closes Index during account closesmartcontract/sdk/rs/src/commands/multicastgroup/get.rs— O(1) Index PDA lookup with fallback scan for pre-migration accountssmartcontract/sdk/rs/src/commands/multicastgroup/deactivate.rs— derives Index PDA for deactivation flowsmartcontract/sdk/rs/src/commands/multicastgroup/update.rs— derives old/new Index PDAs when code changesTesting Verification