smartcontract: fix BackfillTopology account ordering and SID collision#3580
Merged
smartcontract: fix BackfillTopology account ordering and SID collision#3580
Conversation
Two bugs in the BackfillTopology instruction: 1. Account ordering: payer and system_program must come *after* the variable-length device account list, not before it. The processor now collects all remaining accounts and slices off the last two as payer/system_program. The SDK command is updated to match — payer and system_program are appended after device accounts in each batch. 2. SID collision: when base node_segment_idx values were assigned outside the SegmentRoutingIds allocator (e.g. via the activator), the bitmap doesn't know about them. Backfill now pre-collects all base SIDs in use across the device list and skips any allocated ID that conflicts, so flex-algo SIDs never duplicate a base SID.
- rustfmt: collapse flat_map closure to match nightly formatting - sdk/rs: remove unused payer variable from topology create test; update backfill mock expectation to match new account layout (payer removed from fixed accounts, appended by client infrastructure) - changelog: add entries for account ordering and SID collision fixes
elitegreg
requested changes
Apr 24, 2026
elitegreg
approved these changes
Apr 24, 2026
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
node_segment_idxvalues are assigned outside theSegmentRoutingIdsallocator (e.g. activator off-chain path), the on-chain bitmap has no record of them. Backfill now pre-collects all base SIDs in use and skips conflicting allocations, so flex-algo SIDs never duplicate a base SID.Diff Breakdown
Key files (click to expand)
smartcontract/programs/doublezero-serviceability/src/processors/topology/backfill.rs— account ordering fix, SID collision avoidancesmartcontract/sdk/rs/src/commands/topology/backfill.rs— remove payer/system_program from per-batch fixed accountssmartcontract/programs/doublezero-serviceability/tests/topology_test.rs— updated for new account ordering; SID collision test now expects index 2 (not 1)Testing Verification