-
Notifications
You must be signed in to change notification settings - Fork 6
bugfix(smartcontract): device interface create, update validation #2700
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
5aefc71 to
f3e4ee5
Compare
There was a problem hiding this 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 implements validation rules for device interfaces, ensuring CYOA can only be set on physical interfaces and enforcing consistent validation logic between create and update operations. The changes remove the requirement to tag interfaces and add comprehensive test coverage.
Changes:
- Added validation to restrict
interface-cyoato physical interfaces only - Applied the same validation logic to both create and update interface operations
- Added comprehensive e2e and unit tests for interface validation scenarios
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| smartcontract/programs/doublezero-serviceability/src/state/interface.rs | Added CYOA validation logic restricting it to physical interfaces, updated public IP validation for loopback interfaces with user_tunnel_endpoint, and added unit tests |
| smartcontract/programs/doublezero-serviceability/src/processors/device/interface/update.rs | Added validation call to update operation to ensure consistent validation with create operation |
| smartcontract/programs/doublezero-serviceability/src/error.rs | Added new error variant InvalidCyoaOnLoopback for CYOA validation failures |
| smartcontract/cli/src/device/interface/update.rs | Simplified loopback type validation logic in CLI update command |
| e2e/interface_validation_test.go | Added comprehensive e2e tests validating CYOA restrictions and public IP handling across interface lifecycle |
| e2e/activator_interface_delete_test.go | Updated test to use loopback-type instead of interface-cyoa for loopback interface |
| CHANGELOG.md | Documented interface validation changes and new e2e tests |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| // Test 4: Public IP on loopback without user_tunnel_endpoint should be rejected | ||
| if !t.Run("public_ip_on_loopback_without_ute_rejected", func(t *testing.T) { | ||
| testInterfaceName := "Loopback103" | ||
| publicIP := "203.0.113.20/32" // TEST-NET-3 public IP |
Copilot
AI
Jan 22, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as previous comment - clarify that 203.0.113.0/24 is the TEST-NET-3 block per RFC 5737.
52b3350 to
fcc9c27
Compare
…e tests for device interface lifecyle (#2664)
fcc9c27 to
f80ad36
Compare
Co-authored-by: Steven Normore <snormore@gmail.com>
Co-authored-by: Steven Normore <snormore@gmail.com>
Summary of Changes
From @ben-malbeclabs 's feedback, this PR removes the requirement to tag an interface, only allows
interface-cyoaon a physical interface, and uses the same validation logic on update as for create.Closes #2664
Testing Verification