serviceability: prevent linking interfaces with CYOA or DIA assignments#2986
Open
ben-malbeclabs wants to merge 10 commits intomainfrom
Open
serviceability: prevent linking interfaces with CYOA or DIA assignments#2986ben-malbeclabs wants to merge 10 commits intomainfrom
ben-malbeclabs wants to merge 10 commits intomainfrom
Conversation
Interfaces with CYOA or DIA assignments are edge-facing and should not be used for device-to-device links. This adds guardrails at multiple layers: - Smart contract: reject CreateLink and ActivateLink when either interface has CYOA or DIA set - Smart contract: reject UpdateDeviceInterface from setting CYOA or DIA on an already-linked (Activated) interface - CLI: early validation in wan-create and dzx-create commands Code and tests in this change were produced by Claude.
…drails # Conflicts: # CHANGELOG.md # smartcontract/programs/doublezero-serviceability/src/error.rs
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds guardrails to prevent device-to-device links (WAN/DZX) from being created or activated using interfaces that have edge-facing assignments (CYOA or DIA), and prevents setting those assignments on already-linked interfaces.
Changes:
- Smart contract: reject
CreateLinkandActivateLinkwhen either interface has CYOA/DIA set. - Smart contract: reject
UpdateDeviceInterfaceattempts to set CYOA/DIA on an already-linked (Activated) interface. - CLI: add early validation in
link wan-createandlink dzx-createto reject CYOA/DIA-assigned interfaces (plus added WAN CLI test).
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| smartcontract/programs/doublezero-serviceability/src/processors/link/create.rs | Adds edge-assignment checks during link creation. |
| smartcontract/programs/doublezero-serviceability/src/processors/link/activate.rs | Adds edge-assignment checks during link activation. |
| smartcontract/programs/doublezero-serviceability/src/processors/device/interface/update.rs | Blocks setting CYOA/DIA on Activated (linked) interfaces. |
| smartcontract/programs/doublezero-serviceability/src/error.rs | Introduces InterfaceHasEdgeAssignment error variant and mappings. |
| smartcontract/programs/doublezero-serviceability/tests/link_wan_test.rs | Adds integration tests covering edge-assignment rejection scenarios. |
| smartcontract/cli/src/link/wan_create.rs | Adds CLI-side validation + a new negative unit test. |
| smartcontract/cli/src/link/dzx_create.rs | Adds CLI-side validation for DZX create. |
| CHANGELOG.md | Documents the new guardrails and CLI validations. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
smartcontract/programs/doublezero-serviceability/src/processors/link/create.rs
Show resolved
Hide resolved
smartcontract/programs/doublezero-serviceability/src/processors/device/interface/update.rs
Show resolved
Hide resolved
smartcontract/programs/doublezero-serviceability/tests/link_wan_test.rs
Outdated
Show resolved
Hide resolved
Loopback interfaces in Activated status were incorrectly rejected by the new CYOA/DIA guard instead of the existing CyoaRequiresPhysical validation. Only physical interfaces can be part of links, so the linked-interface guard only needs to apply to them.
- Reword error message to cover both link-creation and interface-update directions - Assert specific Custom(81) error codes in link_wan_test instead of just is_err() - Add missing CLI test for DZX link creation rejecting CYOA interfaces
bgm-malbeclabs
approved these changes
Feb 18, 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.
Interfaces with CYOA or DIA assignments are edge-facing and should not be used for device-to-device links. This adds guardrails at multiple layers:
Code and tests in this change were produced by Claude.