smartcontract,controlplane: add flex-algo link/tenant CLI extensions and migrate command#3513
Open
ben-malbeclabs wants to merge 9 commits intobc/rfc18-pr2from
Open
smartcontract,controlplane: add flex-algo link/tenant CLI extensions and
migrate command#3513ben-malbeclabs wants to merge 9 commits intobc/rfc18-pr2from
ben-malbeclabs wants to merge 9 commits intobc/rfc18-pr2from
Conversation
This was referenced Apr 10, 2026
834ffe0 to
ed49424
Compare
6097a83 to
254484a
Compare
ed49424 to
93ecaeb
Compare
…and migrate command
…nd geolocation init error
topology create/delete/clear/backfill and link update all normalize the user-supplied topology name to lowercase before deriving PDAs or comparing against stored names. clear and link update use case-insensitive comparison to handle existing uppercase data during transition.
254484a to
c6e996d
Compare
elitegreg
added a commit
that referenced
this pull request
Apr 18, 2026
…y processors (#3497) RFC-18 flex-algo · PR 1 of 5 · see `rfcs/rfc-0018-flex-algo.md` Series: #3497 · #3512 · #3513 · #3514 · #3515 ## Summary of Changes - Adds `TopologyInfo` onchain account (RFC-18 flex-algo) with `admin_group_bit`, `flex_algo_number`, and `TopologyConstraint`; creates `AdminGroupBits` resource extension singleton for bit allocation - Adds four new foundation-only instructions (107–110): `CreateTopology`, `DeleteTopology`, `ClearTopology`, `BackfillTopology` - Extends `Link` with `link_topologies` (Vec<Pubkey>) and `link_flags` (LINK_FLAG_UNICAST_DRAINED); extends `Tenant` with `include_topologies`; adds `flex_algo_node_segments` to Interface V2 - `CreateLink` now requires the unicast-default topology account and auto-tags the link into it - `UpdateLink` gains foundation-gated `link_topologies` update and contributor-gated `unicast_drained` flag ## Diff Breakdown | Category | Files | Lines (+/-) | Net | |-------------|-------|---------------|-------| | Core logic | 22 | +1,306 / -38 | +1,268| | Scaffolding | 49 | +133 / -3 | +130 | | Tests | 27 | +4,592 / -74 | +4,518| The scaffolding is mechanical struct field additions (`link_topologies: vec![]`, `include_topologies: vec![]`, `flex_algo_node_segments: vec![]`) across CLI, SDK, activator, and client to keep the workspace compiling. Core logic is concentrated in the new topology processors, state types, and link/activate updates. <details> <summary>Key files (click to expand)</summary> - `smartcontract/programs/doublezero-serviceability/src/state/interface.rs` — updates Interface V2 (discriminant 1) to include `flex_algo_node_segments: Vec<FlexAlgoNodeSegment>`; V1 accounts (pre-CYOA format) are left as-is; pre-RFC-18 V2 accounts on mainnet are upgraded in-place by `MigrateDeviceInterfaces` before this deserialization path is used - `smartcontract/programs/doublezero-serviceability/src/state/topology.rs` — new `TopologyInfo` account: `admin_group_bit` (u8), `flex_algo_number` (128+bit), `TopologyConstraint` (IncludeAny/Exclude) - `smartcontract/programs/doublezero-serviceability/src/processors/topology/` — five new processors: create (allocates AdminGroupBit, validates IdRange 1–127), delete, clear (removes topology from all links), backfill (allocates FlexAlgoNodeSegment on all device interfaces) - `smartcontract/programs/doublezero-serviceability/src/processors/link/update.rs` — adds foundation-gated `link_topologies` update (validates each topology account onchain) and contributor-gated `unicast_drained` flag (LINK_FLAG_UNICAST_DRAINED bit 0) - `smartcontract/programs/doublezero-serviceability/src/processors/link/activate.rs` — requires `unicast_default_topology_account` as a mandatory account; auto-tags new link into the unicast-default topology on activation - `smartcontract/programs/doublezero-serviceability/src/processors/globalconfig/set.rs` — creates `AdminGroupBits` ResourceExtension PDA on global config initialization - `smartcontract/programs/doublezero-serviceability/src/state/link.rs` — adds `link_topologies: Vec<Pubkey>`, `link_flags: u64`, and `LINK_FLAG_UNICAST_DRAINED = 0x01` - `smartcontract/programs/doublezero-serviceability/src/instructions.rs` — registers four new instruction variants (CreateTopology=107, DeleteTopology=108, ClearTopology=109, BackfillTopology=110) </details> ## Testing Verification - `make rust-lint` and `make rust-test` pass clean on this branch - `topology_test.rs` (~2,400 lines) covers all four topology processors: create/delete/clear/backfill, including error paths (duplicate names, out-of-range bits, unauthorized signers, invalid topology accounts), segment allocation, and multi-topology backfill - Existing `link_wan_test.rs`, `tenant_test.rs`, and telemetry tests updated to account for the new mandatory `unicast_default_topology_account` in `ActivateLink` --------- Co-authored-by: Greg Mitchell <greg@malbeclabs.com>
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.
RFC-18 flex-algo · PR 3 of 5 · see
rfcs/rfc-0018-flex-algo.mdDepends on: #3512 (PR 2)
Series: #3497 · #3512 · #3513 · #3514 · #3515
Summary of Changes
doublezero link get/list/updateto display topology assignments (link_topologies) and drain status; adds--link-topology(comma-separated topology names,defaultto clear all) and--unicast-drainedflags tolink update; adds--topologyfilter tolink listdoublezero tenant get/list/updateto display included topologies (include_topologies) and adds--include-topologies(comma-separated topology names,defaultto clear) totenant updatedoublezero-admin migrate flex-algo [--dry-run]command that backfills link topology assignments and VPNv4 loopback flex-algo node segments across all existing devices and linksDiff Breakdown
Mostly core logic — the migrate command alone is 180 lines of backfill and dry-run orchestration.
Key files (click to expand)
controlplane/doublezero-admin/src/cli/migrate.rs— new:migrate flex-algocommand; validates UNICAST-DEFAULT PDA exists, backfills link topologies for all links, backfills flex-algo node segments for all VPNv4 loopback interfaces on all devices; supports--dry-runsmartcontract/cli/src/link/list.rs— adds--topology <name>filter and displayslink_topologies/unicast_drainedcolumns, resolving topology pubkeys to human-readable namessmartcontract/cli/src/link/get.rs— displays topology assignments and drain status; fetches topology map to resolve pubkeys to namessmartcontract/cli/src/link/update.rs— adds--link-topology(accepts comma-separated list of topology names; usedefaultto clear) and--unicast-drainedflagssmartcontract/cli/src/tenant/list.rs— displaysinclude_topologiescolumnsmartcontract/cli/src/tenant/get.rs— displays included topology namessmartcontract/cli/src/tenant/update.rs— adds--include-topologies(accepts comma-separated list; usedefaultto clear)Testing Verification
cargo test -p doublezero_sdk -p doublezero_cli -p doublezero-adminpassescargo clippy -- -D warningscleanmake rust-fmtapplied before commit