sdk: add size-prefixed Interface readers (Go/Python/TS)#3673
Merged
Conversation
ben-dz
reviewed
May 5, 2026
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.
6bef0b5 to
bf6b9a7
Compare
ben-dz
approved these changes
May 6, 2026
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
new_interfacesvec onDeviceintroduced by serviceability: add new_interfaces vec to Device with custom serializer #3665, with size-prefixed (u16 size + u8 version + body) forward-compat framing.new_interfacesfrom 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 stickyDevice.DeserializeErrorfield so the existing void-returningDeserializeDevicesignature is preserved.CURRENT_INTERFACE_VERSION/CurrentInterfaceVersionto4across the three SDKs to match Rust'sCURRENT_INTERFACE_SCHEMA_VERSION.Closes #3660. Builds on #3666 / #3667.
Testing Verification
make sdk-test— all SDK suites green (Go: serviceability + borsh-incremental + revdist; Python: 119 passed; TypeScript: 142 passed across 5 files).sizefor an empty-name V4 element is 45 — verified in all three test files.