Skip to content

sdk: add size-prefixed Interface readers (Go/Python/TS)#3673

Merged
elitegreg merged 2 commits intomainfrom
gm/issue-3660-sdk-sized-interface-readers
May 6, 2026
Merged

sdk: add size-prefixed Interface readers (Go/Python/TS)#3673
elitegreg merged 2 commits intomainfrom
gm/issue-3660-sdk-sized-interface-readers

Conversation

@elitegreg
Copy link
Copy Markdown
Contributor

Summary

  • Go, Python, and TypeScript serviceability SDKs now parse the trailing new_interfaces vec on Device introduced by serviceability: add new_interfaces vec to Device with custom serializer #3665, with size-prefixed (u16 size + u8 version + body) forward-compat framing.
  • Empty trailing falls back to rebuilding new_interfaces from the legacy enum vec, matching the Rust device reader. Length mismatch between the legacy and trailing vecs is surfaced as an error: Python/TS raise; Go sets a sticky Device.DeserializeError field so the existing void-returning DeserializeDevice signature is preserved.
  • Bumps CURRENT_INTERFACE_VERSION / CurrentInterfaceVersion to 4 across the three SDKs to match Rust's CURRENT_INTERFACE_SCHEMA_VERSION.

Closes #3660. Builds on #3666 / #3667.

Testing Verification

  • Hand-built byte-vector tests added in each SDK covering: populated trailing vec, legacy account rebuild, declared-length mismatch, and future-version skip.
  • make sdk-test — all SDK suites green (Go: serviceability + borsh-incremental + revdist; Python: 119 passed; TypeScript: 142 passed across 5 files).
  • Cross-language framing assertion: empty-name body length is 42 bytes, so on-disk size for an empty-name V4 element is 45 — verified in all three test files.
  • Fixture-driven coverage is deferred to the follow-up fixtures issue per sdk: add size-prefixed Interface readers (Go/Python/TS) #3660.

@elitegreg elitegreg marked this pull request as ready for review May 5, 2026 20:49
Comment thread sdk/serviceability/python/serviceability/state.py
elitegreg added 2 commits May 6, 2026 02:03
Teach the read-only serviceability SDKs to parse the trailing
new_interfaces vec on Device introduced by #3665, mirroring the legacy
fallback semantics of the Rust device reader.

- New per-element framing is u16 size + u8 version + body, with size
  including the 3-byte prefix so unknown future versions can be skipped
  in O(1).
- Empty trailing => rebuild new_interfaces from the legacy interfaces
  vec, stamped with the current schema version.
- Non-empty trailing whose declared length differs from the legacy vec
  is surfaced as an error: Python/TS raise; Go sets a sticky
  Device.DeserializeError so the existing void-returning signature is
  preserved.
- Bump CURRENT_INTERFACE_VERSION / CurrentInterfaceVersion to 4 across
  SDKs to match Rust's CURRENT_INTERFACE_SCHEMA_VERSION.

Hand-built byte-vector tests cover the populated-trailing, legacy
rebuild, length-mismatch, and future-version-skip scenarios in each
language. Fixture-driven coverage lands in a follow-up issue per #3660.
@elitegreg elitegreg force-pushed the gm/issue-3660-sdk-sized-interface-readers branch from 6bef0b5 to bf6b9a7 Compare May 6, 2026 02:03
@elitegreg elitegreg enabled auto-merge (squash) May 6, 2026 02:14
@elitegreg elitegreg merged commit 916801d into main May 6, 2026
33 checks passed
@elitegreg elitegreg deleted the gm/issue-3660-sdk-sized-interface-readers branch May 6, 2026 02:36
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.

sdk: add size-prefixed Interface readers (Go/Python/TS)

2 participants