geolocation: add result destination for LocationOffsets#3480
Open
geolocation: add result destination for LocationOffsets#3480
Conversation
f4daf9f to
8d29067
Compare
…ion field Add optional result_destination string field to GeolocationUser (backwards- compatible via BorshDeserializeIncremental). New SetResultDestination instruction sets/clears the destination in host:port format (IP or domain), validates publicly routable IPs and domain format, and bumps target_update_count on all referenced probes.
Rust SDK command, CLI with client-side destination validation, display in user get, Go SDK deserialization with backwards compatibility.
8d29067 to
a822d1c
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary of Changes
result_destinationstring field toGeolocationUserso measurement results (LocationOffsets) can be sent to an alternate endpoint instead of the target IP — critical for ICMP targets that aren't running geolocation software, and useful for centralizing result collectionhost:portformat (e.g.,185.199.108.1:9000orresults.example.com:9000); empty string = not setSetResultDestinationonchain instruction validates the destination (public IP or valid domain + port), updates the field, and bumpstarget_update_counton all referenced probes so agents re-discover the changedz-cli geolocation user set-result-destination --user <code> --destination <host:port>(or--clear), with client-side validation before transaction submission"")RFC: rfcs/rrfc16-geolocation-verification.md
Diff Breakdown
~40% of net additions are tests; core logic includes the onchain processor with domain/IP validation, Rust SDK command, and Go SDK deserialization.
Key files (click to expand)
smartcontract/cli/src/geolocation/user/set_result_destination.rs— CLI command with clap args, client-side destination validation (IP + domain), mock testssmartcontract/programs/doublezero-geolocation/src/processors/geolocation_user/set_result_destination.rs— onchain processor: validates signer, parses host:port, checks IP routability or domain format, bumps probetarget_update_countsmartcontract/sdk/rs/src/geolocation/geolocation_user/set_result_destination.rs— Rust SDK command that builds the transaction with user PDA + probe account metassmartcontract/programs/doublezero-geolocation/src/state/geolocation_user.rs— newresult_destination: Stringfield withBorshDeserializeIncremental, backwards-compat via#[incremental(default)]sdk/geolocation/go/state.go— Go SDK struct + serialize/deserialize with try-decode-default for old accountssmartcontract/programs/doublezero-geolocation/src/instructions.rs—SetResultDestinationvariant added to instruction enumTesting Verification