Skip to content

sdk/geolocation: add Go SDK for geolocation program#3025

Closed
ben-dz wants to merge 2 commits intomainfrom
bdz/doublezero-3011
Closed

sdk/geolocation: add Go SDK for geolocation program#3025
ben-dz wants to merge 2 commits intomainfrom
bdz/doublezero-3011

Conversation

@ben-dz
Copy link
Contributor

@ben-dz ben-dz commented Feb 17, 2026

Resolves: #3011

Summary of Changes

  • Add a complete Go SDK for the doublezero-geolocation Solana program, providing instruction builders, state deserialization, PDA derivation, and an RPC client
  • Instruction builders for all 7 program instructions: InitProgramConfig, UpdateProgramConfig, CreateGeoProbe, UpdateGeoProbe, DeleteGeoProbe, AddParentDevice, RemoveParentDevice
  • Borsh-compatible state serialization/deserialization for GeolocationProgramConfig and GeoProbe accounts, with field layout matching the Rust onchain structs
  • PDA derivation helpers for program config, geo probe, and program data accounts
  • Transaction executor with signature polling, finalization waiting, and configurable visibility timeout
  • High-level Client with read methods (GetProgramConfig, GetGeoProbeByCode, GetGeoProbes) and write methods for all instructions

Diff Breakdown

Category Files Lines (+/-) Net
Core logic 12 +1192 / -0 +1192
Tests 8 +1582 / -0 +1582

All new code — 43% core logic, 57% tests.

Key files (click to expand)
  • client.go — High-level SDK client with read/write methods for all geolocation accounts and instructions
  • executor.go — Transaction executor with blockhash fetching, signing, submission, and finalization polling
  • state.go — Borsh serialization/deserialization for GeolocationProgramConfig and GeoProbe state structs
  • create_geo_probe.go — CreateGeoProbe instruction builder with validation and account metas
  • update_geo_probe.go — UpdateGeoProbe instruction builder with optional fields (IP, port, metrics publisher)
  • add_parent_device.go — AddParentDevice instruction builder
  • remove_parent_device.go — RemoveParentDevice instruction builder with device pubkey in instruction data
  • constants.go — Instruction discriminant indices, PDA seeds, and validation limits

Testing Verification

  • 47 unit tests covering state roundtrip serialization, deserialization edge cases (wrong account type, truncated data, trailing bytes), all 7 instruction builders (happy path + validation errors), PDA derivation, client read methods with mock RPC, and executor error scenarios (missing signer, RPC failures, visibility timeout, finalization timeout)
  • All instruction account metas and serialized args verified against the Rust onchain program source

@ben-dz ben-dz linked an issue Feb 17, 2026 that may be closed by this pull request
@ben-dz ben-dz marked this pull request as draft February 17, 2026 17:56
@ben-dz ben-dz added this to the Geo Location milestone Feb 17, 2026
@ben-dz ben-dz changed the base branch from main to bdz/doublezero-2952 February 18, 2026 14:50
@ben-dz ben-dz changed the base branch from bdz/doublezero-2952 to main February 18, 2026 14:53
@nikw9944 nikw9944 changed the base branch from main to bdz/doublezero-2952 February 20, 2026 21:15
@nikw9944 nikw9944 force-pushed the bdz/doublezero-3011 branch 2 times, most recently from ae5246b to 72c5675 Compare February 20, 2026 22:16
@nikw9944 nikw9944 force-pushed the bdz/doublezero-3011 branch from 72c5675 to 151e520 Compare March 4, 2026 22:40
@nikw9944 nikw9944 changed the base branch from bdz/doublezero-2952 to main March 4, 2026 22:40
@ben-dz
Copy link
Contributor Author

ben-dz commented Mar 5, 2026

This has been split into PR #3179 and PR#3180

@ben-dz ben-dz closed this Mar 5, 2026
@ben-dz ben-dz deleted the bdz/doublezero-3011 branch March 5, 2026 22:19
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.

geolocation: Go SDK — GeoProbe types and client methods

2 participants