serviceability: remove InterfaceV3 entirely#3680
Draft
elitegreg wants to merge 2 commits intogm/rename-interface-canonicalfrom
Draft
serviceability: remove InterfaceV3 entirely#3680elitegreg wants to merge 2 commits intogm/rename-interface-canonicalfrom
elitegreg wants to merge 2 commits intogm/rename-interface-canonicalfrom
Conversation
V3 was added by an earlier change, never written to production accounts, and reverted in #3653. After #3667 stopped producing V3 (always-V2 projection of the legacy slot) and #3675 deleted the migrate processor, the type is dead weight. This removes it as if it never existed — no read shim, since no on-chain account ever held discriminant 3. - Delete InterfaceV3 struct + Default/From/TryFrom impls. - Delete InterfaceDeprecated::V3 variant; discriminant 3 is now an unused reserved slot. Unknown discriminants fall through to InterfaceV2::default(). - Drop V3 match arms in InterfaceDeprecated::to_v2 / size and in Device::TryFrom legacy-rebuild. - Drop V3 from Go/Python/TS SDKs: remove DeserializeInterfaceV3, version==3 / version === 3 branches, and the V3 cross-language Go test. - Delete the V3 cross-language byte-layout debug test in interface.rs and the V3 block in test_interface_version. On-disk write format unchanged.
Mainnet-beta has one device (la2r-dz01, interface Ethernet20/1) with a discriminant-3 (V3) entry in its legacy deprecated_interfaces slot, written by an admin path that no longer exists. The previous commit removed all V3 read handling, which caused byte misalignment on that account: the V3 body (V2 fields + flex_algo_node_segments vec) went unread, the cursor desynced, and downstream Device fields decoded as garbage. CI sdk-compat-test caught this against mainnet: "110 is not a valid DeviceHealth". Restore byte-level consumption of discriminant 3 in all readers (Rust + Go/Python/TS SDKs): read the V2 body and consume + drop the trailing flex_algo_node_segments vec, then surface the entry as V2. The InterfaceV3 struct stays deleted; only the wire-compat read path is restored. Segments live in the trailing forward-compat interfaces vec on Device post-#3667 — this slot loses them, matching the always-V2 projection on writes. Adds a Rust regression test that hand-crafts a Vec<InterfaceDeprecated> with a V3-encoded element followed by a V2 element and asserts the V3 bytes are fully consumed, so the trailing V2 still decodes — guards against the misalignment that broke CI.
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
Implements #3664 — the cleanup step of the forward-compatible Device interfaces refactor.
InterfaceV3was added then reverted in #3653, no longer produced after #3667's always-V2 legacy-slot projection, and the migrate processor that wrote it was deleted in #3675. No on-chain account ever held discriminant 3, so this removes the type entirely with no backward-compat read shim.InterfaceV3struct, its impls (Default,From<InterfaceV2>,TryFrom<&InterfaceV1>,TryFrom<&InterfaceV3> for InterfaceV2), and theInterfaceDeprecated::V3variant. Discriminant 3 is now an unused reserved slot inInterfaceDeprecated's encoding space; the customBorshDeserializefalls through unknown discriminants toInterfaceV2::default().InterfaceDeprecated::to_v2/sizeand in the legacy-rebuild path insideDevice::TryFrom<&[u8]>.DeserializeInterfaceV3(Go) and theversion == 3/version === 3legacy-slot branches (Python/TS); remove theTestDeserializeInterfaceV3CrossLanguageGo test.test_interface_v3_serialization_bytes) and the V3 block intest_interface_version.On-disk write format is unchanged; the trailing forward-compat
interfacesvec onDevicecontinues to carryflex_algo_node_segmentsvia the size-prefixed body.Branch base
This PR targets
gm/rename-interface-canonical(PR #3677, the rename) because issue #3664 depends on it. Once #3677 merges tomain, this branch will be rebased and retargeted tomain.Tests
state::interfacelib tests pass.make rust-fmt,make rust-lint,make rust-testgreen.go test ./...passes (smartcontract/sdk/go/serviceability).pytest121 passed / 24 skipped.bun tsc --noEmitclean;bun test144/144 passing.Testing Verification
test_state_compatibility_deviceand the SDK fixture tests againstdevice.{bin,json}/device_legacy.{bin,json}/device_future_version.{bin,json}are unaffected (fixtures don't contain V3 bytes — confirmed by the fixture generator using the always-V2 projection from smartcontract: append new_interfaces vec to Device with custom serializer #3667).make generate-fixturesproduces no diff (on-disk write format unchanged).