Skip to content

serviceability: prevent linking interfaces with CYOA or DIA assignments#2986

Open
ben-malbeclabs wants to merge 10 commits intomainfrom
bc/cyoa-dia-link-guardrails
Open

serviceability: prevent linking interfaces with CYOA or DIA assignments#2986
ben-malbeclabs wants to merge 10 commits intomainfrom
bc/cyoa-dia-link-guardrails

Conversation

@ben-malbeclabs
Copy link
Contributor

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.

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
Copy link
Contributor

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 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 CreateLink and ActivateLink when either interface has CYOA/DIA set.
  • Smart contract: reject UpdateDeviceInterface attempts to set CYOA/DIA on an already-linked (Activated) interface.
  • CLI: add early validation in link wan-create and link dzx-create to 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.

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

Comments