sdk: regenerate device fixtures with legacy and future-version variants#3676
Open
sdk: regenerate device fixtures with legacy and future-version variants#3676
Conversation
Updates `device.{bin,json}` to the post-#3667 on-disk shape (custom
Device serializer, populated `new_interfaces` with one Vpnv4 loopback
carrying a FlexAlgoNodeSegment and one physical user-tunnel-endpoint).
Adds `device_legacy.{bin,json}` (no trailing vec, exercises the SDK
legacy-fallback path) and `device_future_version.{bin,json}` (last
trailing element doctored to version=5 with 8 trailing junk bytes,
exercises the SDK skip-to-end path). Adds Go fixture-driven tests;
extends Python/TS fixture tests to cover all three Device fixtures.
Refs #3661.
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
sdk/serviceability/testdata/fixtures/device.{bin,json}through Device's custom Borsh serializer (post-smartcontract: append new_interfaces vec to Device with custom serializer #3667 on-disk shape) with a populatednew_interfacesvec: one Vpnv4 loopback carrying aFlexAlgoNodeSegment, one physical user-tunnel-endpoint. The legacyinterfacesslot is now the V2 projection ofnew_interfaces(always V2 per smartcontract: revert default Interface to V2; keep V3 for migrate/backfill #3653), so the fixture exercises the populated-trailing-vec read path.device_legacy.{bin,json}— pre-smartcontract: append new_interfaces vec to Device with custom serializer #3667 byte shape with only the legacyinterfacesvec populated and no trailing bytes. SDKs detect the absent trailing vec and rebuildnew_interfacesfrom the legacy enum vec, stamping each entry withVersion=CURRENT_INTERFACE_VERSIONandSize=0.device_future_version.{bin,json}— same shape asdevice.bin, but the last trailing-vec element is doctored toversion=5withsize += 8and 80xABfiller bytes appended at end-of-file. SDKs read the known body fields, thenseek(start + size)over the junk.smartcontract/sdk/go/serviceability/fixture_test.go) — first fixture-loader for the Go serviceability SDK, mirroring the pattern insdk/revdist/go/fixture_test.go. Extends Python/TS fixture tests to cover all three Device fixtures.link.bin(+3 bytes) andsdk/telemetry/testdata/fixtures/generate-fixtures/Cargo.lockare pre-existing fixture rot picked up bymake generate-fixtures.Closes #3661. Depends on #3673 (size-prefixed Interface readers, already merged).
Testing Verification
cd sdk/serviceability/testdata/fixtures/generate-fixtures && cargo runregenerates all fixtures deterministically.go test ./smartcontract/sdk/go/serviceability/...—TestFixtureDevice,TestFixtureDeviceLegacy,TestFixtureDeviceFutureVersionall green.cd sdk/serviceability/python && uv run pytest serviceability/tests/test_fixtures.py— 16 tests pass, including the three new Device test classes.cd sdk/serviceability/typescript && bun test serviceability/tests/fixtures.test.ts— 16 tests pass, including the new "Device legacy" and "Device future-version" describe blocks.xxd device_future_version.bin | tailshows the doctored0x05version byte and 8x0xABfiller at end-of-file; trailing-elementsizeisoriginal + 8exactly.