sdk/geolocation: add Go write SDK for user lifecycle and result destination#3567
Open
sdk/geolocation: add Go write SDK for user lifecycle and result destination#3567
Conversation
871966e to
8b51d23
Compare
ben-dz
added a commit
that referenced
this pull request
Apr 23, 2026
…3558) Resolves: #3557 ## Summary of Changes - New Go write SDK for the geolocation program focused on target management: instruction builders for `AddTarget` and `RemoveTarget`, plus a transaction executor. - Instruction builders follow the telemetry write SDK pattern: `*InstructionConfig` struct + `Validate()` + `Build*Instruction()` returning a self-contained `solana.Instruction`, using `near/borsh-go` to match the Rust program's Borsh layout. - User lifecycle (`CreateGeolocationUser`, `UpdateGeolocationUser`, `DeleteGeolocationUser`) and `SetResultDestination` are deferred to a follow-on PR (#3567) to keep this reviewable — my immediate consumer only needs add/remove targets. ## Diff Breakdown | Category | Files | Lines (+/-) | Net | |------------|-------|-------------|------| | Core logic | 5 | +475 / -0 | +475 | | Tests | 4 | +389 / -0 | +389 | Pure-additive new package; ~45% of the diff is tests. ## Testing Verification - Borsh serialization tests pin discriminator bytes, field ordering, and IP/port/target-pk layout against the Rust program's expected layout for Add/Remove. - Private-IP validation covers all reserved ranges (10/8, 172.16/12, 192.168/16, 127/8, 0.0.0.0) for outbound target types. - Account-meta ordering verified against the Rust SDK command builders. - Executor error paths covered: missing signer, missing program ID.
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.
Stacked on #3558. Once that merges, GitHub retargets this PR to
mainautomatically.Summary of Changes
CreateGeolocationUser,UpdateGeolocationUser,DeleteGeolocationUser, andSetResultDestination.executor.SetResultDestination(ctx, code, destination, opts)helper that fetches the user, derives the exact set of probe accounts fromuser.Targetsvia the exportedDeriveUniqueProbePKs, and submits the instruction — so Go consumers don't have to re-implement the dedupe logic the Rust CLI does today.ExecutorRPCClientwithGetAccountInfoso the executor can read onchain state before writing.Diff Breakdown
Pure-additive; ~70% of the diff is tests.
Testing Verification
Option<Pubkey>encoding against the Rust program's expected layout for each new instruction.SetResultDestinationhelper error paths covered: missing signer, missing program ID, account not found, owner mismatch, empty code; dedupe behavior covered via pure-function tests ofDeriveUniqueProbePKs(empty, all-unique, duplicates-preserving-first-occurrence).