Skip to content

geolocation: add result destination for LocationOffsets#3480

Open
ben-dz wants to merge 1 commit intomainfrom
bdz/geolocation-alt-offset-dest
Open

geolocation: add result destination for LocationOffsets#3480
ben-dz wants to merge 1 commit intomainfrom
bdz/geolocation-alt-offset-dest

Conversation

@ben-dz
Copy link
Copy Markdown
Contributor

@ben-dz ben-dz commented Apr 7, 2026

Resolves: #3468

Summary of Changes

  • Rust SDK SetResultDestinationCommand that builds the onchain transaction with user PDA + probe account metas
  • CLI user set-result-destination --destination <host:port> (or --clear) with client-side validation of IP routability and domain format before transaction submission
  • Display result_destination in user get output (shows "none" when unset)
  • Go SDK ResultDestination string field on GeolocationUser with backwards-compatible deserialization (old accounts default to "")
  • Subcommand registration in the geolocation CLI binary

Stacked on #3501 which adds the onchain SetResultDestination instruction and result_destination field.

Diff Breakdown

Category Files Lines (+/-) Net
Core logic 3 +425 / -8 +417
Scaffolding 6 +13 / -0 +13
Tests 1 +49 / -2 +47

Core logic is the CLI command (290 lines including validation + tests), Rust SDK command (118 lines), and Go SDK deserialization. Scaffolding is trait wiring and subcommand registration.

Key files (click to expand)
  • smartcontract/cli/src/geolocation/user/set_result_destination.rs — CLI command with clap args, client-side host:port validation (IP routability + domain format per RFC 1035), mock tests for set/clear/invalid inputs
  • smartcontract/sdk/rs/src/geolocation/geolocation_user/set_result_destination.rs — Rust SDK command: validates code, derives user PDA, passes probe account metas to execute_transaction
  • sdk/geolocation/go/state.goResultDestination string field, serialize/deserialize with try-decode-default for backwards compat
  • sdk/geolocation/go/state_test.go — round-trip and backwards-compat tests (truncated data defaults to empty)
  • smartcontract/cli/src/geoclicommand.rsset_result_destination trait method + impl

Testing Verification

  • CLI mock tests: set destination, clear, missing destination flag, 9 invalid destination cases (private IPs, bad ports, malformed domains)
  • Go SDK: round-trip test with non-empty destination, empty-targets test, backwards-compat test (truncated data)
  • All tests pass: 289 CLI, 165 SDK, 82 geolocation, Go SDK green

@ben-dz ben-dz added this to the Geo Location milestone Apr 7, 2026
@ben-dz ben-dz marked this pull request as ready for review April 8, 2026 13:00
@ben-dz ben-dz requested review from karl-dz and nikw9944 and removed request for karl-dz and nikw9944 April 8, 2026 13:02
@ben-dz ben-dz marked this pull request as draft April 8, 2026 13:13
@ben-dz ben-dz marked this pull request as ready for review April 8, 2026 15:17
@ben-dz ben-dz requested review from juan-malbeclabs, karl-dz and nikw9944 and removed request for juan-malbeclabs April 8, 2026 15:17
@ben-dz ben-dz force-pushed the bdz/geolocation-alt-offset-dest branch 3 times, most recently from a822d1c to baf7ff2 Compare April 9, 2026 17:19
@ben-dz ben-dz changed the base branch from main to bdz/geolocation-alt-offset-onchain-only April 9, 2026 17:22
@ben-dz ben-dz force-pushed the bdz/geolocation-alt-offset-dest branch from baf7ff2 to a0d9f8e Compare April 9, 2026 17:31
@ben-dz ben-dz force-pushed the bdz/geolocation-alt-offset-onchain-only branch from 84e4f3b to 569f815 Compare April 9, 2026 17:31
@ben-dz ben-dz requested a review from juan-malbeclabs April 10, 2026 12:48
@ben-dz ben-dz marked this pull request as draft April 10, 2026 12:48
Base automatically changed from bdz/geolocation-alt-offset-onchain-only to main April 10, 2026 20:16
Rust SDK command, CLI with client-side destination validation, display in
user get, Go SDK deserialization with backwards compatibility.
@ben-dz ben-dz force-pushed the bdz/geolocation-alt-offset-dest branch from a0d9f8e to cd0e330 Compare April 10, 2026 20:38
@ben-dz ben-dz marked this pull request as ready for review April 10, 2026 20:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant