Skip to content

fix: serviceability: return InvalidPublicIp for device public IP validation#3686

Open
nikw9944 wants to merge 1 commit intomainfrom
adhoc
Open

fix: serviceability: return InvalidPublicIp for device public IP validation#3686
nikw9944 wants to merge 1 commit intomainfrom
adhoc

Conversation

@nikw9944
Copy link
Copy Markdown
Contributor

@nikw9944 nikw9944 commented May 8, 2026

Summary

  • Fix Device::validate() to return InvalidPublicIp (variant 62) instead of InvalidClientIp (variant 26) when the device public IP fails the is_global() check
  • Update Go SDK error formatter test to use the correct error code so the test example is coherent

The bug caused the CLI to display "Invalid Client IP" when the program log said "Invalid public IP":

❯ doublezero device update --pubkey 4CkvmyquGN4qtXLNj3hpJcqYbb7PCanLbU1rQHHdp6xp --status drained
Program Logs:
Program GYhQDKuESrasNZGyhMJhGYFtbzNijYhcrN9poSqCQVah invoke [1]
Program log: Instruction: UpdateDevice(status: Some(Drained), resource_count: 0, )
Program log: Invalid public IP: 0.1.2.3
Program GYhQDKuESrasNZGyhMJhGYFtbzNijYhcrN9poSqCQVah consumed 8544 of 200000 compute units
Program GYhQDKuESrasNZGyhMJhGYFtbzNijYhcrN9poSqCQVah failed: custom program error: 0x1a
Error: Invalid Client IP

After this fix, the CLI will display "Invalid Public IP: IP conflicts with DZ prefix" which matches the InvalidPublicIp variant's error message.

… device public IP validation

Device.validate() was returning InvalidClientIp (variant 26) when the
public IP failed the is_global() check, but the correct error is
InvalidPublicIp (variant 62). This caused the CLI to display
"Invalid Client IP" even though the program log said
"Invalid public IP: <addr>".

Also update the Go SDK error formatter test to use the correct error
code (62/0x3e) so the test example is coherent.
@nikw9944 nikw9944 changed the title serviceability: return InvalidPublicIp for device public IP validation fix: serviceability: return InvalidPublicIp for device public IP validation May 8, 2026
@nikw9944
Copy link
Copy Markdown
Contributor Author

nikw9944 commented May 8, 2026

Code review

No issues found. Checked for bugs and CLAUDE.md compliance.

🤖 Generated with Claude Code

- If this code review was useful, please react with 👍. Otherwise, react with 👎.

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.

1 participant