-
Notifications
You must be signed in to change notification settings - Fork 3
Enable Device Location Update with Reference Counter Management #1987
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 PR introduces functionality for updating a device's location while maintaining proper reference counting for both the old and new location accounts. The changes enable users to specify a new location via CLI and SDK commands, with the smart contract processor validating the location change and adjusting reference counts accordingly.
Key Changes:
- Added optional
location_pkfield to update device commands in CLI and SDK - Implemented location account validation and reference counter management in the smart contract processor
- Added
InvalidActualLocationerror variant for handling mismatched location accounts
Reviewed Changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| smartcontract/sdk/rs/src/commands/device/update.rs | Added location_pk field and updated account metadata to include both old and new location accounts |
| smartcontract/programs/doublezero-serviceability/src/processors/device/update.rs | Implemented location update logic with validation and reference count management |
| smartcontract/programs/doublezero-serviceability/src/error.rs | Added InvalidActualLocation error variant with conversions |
| smartcontract/cli/src/device/update.rs | Added location CLI argument and conversion logic |
| smartcontract/programs/doublezero-serviceability/tests/*.rs | Updated tests to include location accounts in device update operations |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
02f7989 to
070f656
Compare
smartcontract/programs/doublezero-serviceability/src/processors/device/update.rs
Outdated
Show resolved
Hide resolved
16fc043 to
956e143
Compare
|
|
||
| ### Breaking | ||
|
|
||
| - Updated the device update command to allow modifying a device’s location. |
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.
Can this be removed from Breaking now that it's compatible?
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.
This change is compatible with other versions.
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.
Since it's compatible can you remove this entry from the Breaking section
smartcontract/programs/doublezero-serviceability/src/processors/device/update.rs
Show resolved
Hide resolved
e348ce4 to
d7fa8c2
Compare
update device location instruction for reference counter management
d7fa8c2 to
935a9b7
Compare
This PR adds the ability to update a device’s location while properly managing the reference counters for both the previous and the new location.
Device Location Management Enhancements
locationfield to the CLI (UpdateDeviceCliCommand) and SDK (UpdateDeviceCommand) update device commands, allowing users to specify a device location public key. [1] [2]process_update_device) to handle location account updates: checks if the location changes, validates the old location, updates reference counts for both old and new locations, and writes the changes to the respective accounts. [1] [2]Error Handling Improvements
InvalidActualLocationinDoubleZeroErrorto handle cases where the device's location public key does not match the expected account, with corresponding conversions and tests. [1] [2] [3] [4]Testing and Validation
Codebase Maintenance
location::Location) are available.These changes collectively ensure that device location updates are handled safely and consistently, with proper error reporting and test coverage.
Testing Verification