-
Notifications
You must be signed in to change notification settings - Fork 5
Network Provisioning [3/3] Device & Link provisioning #2560
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
base: main
Are you sure you want to change the base?
Conversation
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 pull request implements a comprehensive health management framework for Devices and Links, transitioning from simple suspend/resume operations to an intent-based provisioning model with explicit health tracking. The changes introduce a health_oracle authority, new health and desired status enums, and updated state transition logic to support multi-stage device and link provisioning workflows.
Key Changes:
- Added
health_oracle_pkto global state for authorizing health operations - Replaced suspend/resume commands with
set-healthcommands anddesired_statusfields - Introduced new provisioning states (
DeviceProvisioning,LinkProvisioning,ReadyForService) for devices and links
Reviewed changes
Copilot reviewed 111 out of 111 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
smartcontract/programs/doublezero-serviceability/src/state/device.rs |
Added DeviceHealth, DeviceDesiredStatus enums and status transition logic |
smartcontract/programs/doublezero-serviceability/src/state/link.rs |
Added LinkHealth, LinkDesiredStatus enums and status transition logic |
smartcontract/programs/doublezero-serviceability/src/state/globalstate.rs |
Added health_oracle_pk field to global state |
smartcontract/programs/doublezero-serviceability/src/processors/device/sethealth.rs |
New processor for setting device health status |
smartcontract/programs/doublezero-serviceability/src/processors/link/sethealth.rs |
New processor for setting link health status |
smartcontract/programs/doublezero-serviceability/src/processors/device/update.rs |
Updated to support desired_status field and call check_status_transition |
smartcontract/programs/doublezero-serviceability/src/processors/link/update.rs |
Updated to support desired_status field and call check_status_transition |
smartcontract/sdk/rs/src/commands/device/sethealth.rs |
New SDK command for setting device health |
smartcontract/sdk/rs/src/commands/link/sethealth.rs |
New SDK command for setting link health |
smartcontract/cli/src/device/sethealth.rs |
New CLI command for setting device health |
smartcontract/cli/src/link/sethealth.rs |
New CLI command for setting link health |
| Various test files | Updated test data to include new health and desired status fields |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
smartcontract/programs/doublezero-serviceability/PROVISIONING.md
Outdated
Show resolved
Hide resolved
2fdfe85 to
e4d7b3c
Compare
fc9cd45 to
ff2dcb5
Compare
896f91a to
9d06b77
Compare
a1c258f to
e3f8efc
Compare
a758863 to
9537945
Compare
- Introduced DeviceHealth and LinkHealth enums to represent the health status of devices and links. - Implemented sethealth functionality for devices and links, allowing updates to their health status. - Updated global state to include health_oracle_pk for managing health-related operations. - Modified existing processors and state structures to accommodate health management features. - Enhanced tests to validate health status changes and ensure proper functionality. feat: add health attribute to device and link structures and update related functionality feat: enhance health management for devices and links with new states and updates fix: update comments for DeviceHealth enum and correct user_airdrop_lamports calculation fix: update log message in process_set_health_device function Update device health status from ReadyForService to ReadyForUsers - Changed instances of DeviceHealth::ReadyForService to DeviceHealth::ReadyForUsers across multiple files in the activator, client, and smartcontract directories. - Updated related test cases to reflect the new device health status. - Adjusted the DeviceHealth enum to include ReadyForLinks and modify the corresponding string representations. Add changelog feat: add health management for devices and links - Introduced DeviceHealth and LinkHealth enums to represent the health status of devices and links. - Implemented sethealth functionality for devices and links, allowing updates to their health status. - Updated global state to include health_oracle_pk for managing health-related operations. - Modified existing processors and state structures to accommodate health management features. - Enhanced tests to validate health status changes and ensure proper functionality. feat: add health attribute to device and link structures and update related functionality feat: enhance health management for devices and links with new states and updates fix: update comments for DeviceHealth enum and correct user_airdrop_lamports calculation fix: update log message in process_set_health_device function Update device health status from ReadyForService to ReadyForUsers - Changed instances of DeviceHealth::ReadyForService to DeviceHealth::ReadyForUsers across multiple files in the activator, client, and smartcontract directories. - Updated related test cases to reflect the new device health status. - Adjusted the DeviceHealth enum to include ReadyForLinks and modify the corresponding string representations. Refactor device and link status management to incorporate provisioning states - Updated device status checks in tests and processors to reflect new provisioning states. - Changed device status from `Activated` to `DeviceProvisioning` in multiple test cases. - Introduced `LinkDesiredStatus` and `DeviceDesiredStatus` enums to manage desired states. - Removed deprecated `suspend` and `resume` commands for devices and links. - Added comprehensive provisioning documentation outlining device and link state transitions. - Adjusted health checks to align with new provisioning logic. feat(cli): add set health commands for devices and links - Implemented `SetDeviceHealthCliCommand` for updating device health status via CLI. - Added corresponding tests to ensure successful health updates and error handling for existing codes and public IPs. - Created `SetLinkHealthCliCommand` for updating link health status with similar functionality and tests. - Introduced `SetDeviceHealthCommand` and `SetLinkHealthCommand` in the SDK for executing health updates on devices and links. - Enhanced error handling in the commands to manage existing device codes and public IP conflicts. test: add status transition tests for devices and links fix(changelog): correct typo in desired status entry for Devices and Links cleanup: remove unnecessary blank lines in test module feat: update device and link health management to include status transitions update latency sample tests to use contributor accounts improve code formatting and readability in latency sample tests feat: add allow_latency method for Device and Link; update error messages for activation status update code in tests fix: improve command formatting in link creation and updates for better readability fix: reorder link health setting for correct execution flow in user ban test feat: update device activation status during creation and set health to ready-for-service Update last rebase fix e2e fix e2e fix rebase errors feat: enhance device and link activation tests with health status updates feat: add desired status option for device and link creation commands - Introduced `desired_status` field in `CreateDeviceCliCommand` and `CreateDZXLinkCliCommand` to allow specifying the desired status during device and link creation. - Updated the `CreateWANLinkCliCommand` similarly to support desired status. - Modified the `process_create_device` and `process_create_link` functions to handle the new desired status field. - Enhanced tests to validate the desired status functionality for devices and links. - Updated relevant test cases to assert the correct status after activation.
…s updates - Removed redundant health status updates for devices in `GetOrCreateDeviceOnchain` and `CreateDeviceOnchain` methods. - Updated test scripts to create devices and links with desired status in a single command, eliminating separate health status commands. - Adjusted the `start-test.sh` script to reflect the new command structure for device and link creation. - Ensured consistency across various test files by applying the new command structure for link creation.
9537945 to
c3c5cad
Compare
This pull request introduces comprehensive health management capabilities for Devices and Links, refactors CLI commands to support health operations, and updates tests and core logic to reflect new health-related states. The changes enhance the system's ability to explicitly track, authorize, and update health status for network components, improving operational control and reliability.
Health Management Enhancements
health_oracleto the smart contract global configuration, enabling management and authorization of health-related operations for Devices and Links. [1] [2]DeviceHealth,DeviceDesiredStatus,LinkHealth, andLinkDesiredStatus, and updated relevant state, processor, and test logic. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] [14] [15] [16] [17]CLI Refactoring for Health Operations
SuspendandResumedevice commands in favor of new internalSetHealthcommands for Devices and Links, allowing authorized health status updates via CLI. [1] [2] [3] [4] [5] [6] [7] [8]Processor and Metrics Updates
DeviceProvisioning,ReadyForService). [1] [2] [3]Test Suite Expansion
Changelog Documentation
CHANGELOG.mdto document all notable health management changes, including the addition ofhealth_oracle, health state tracking, and introduction of "desired status" for Devices and Links.Closes #2026
Closes #2297
Testing Verification