Skip to content

sdk: regenerate device fixtures with legacy and future-version variants#3676

Open
elitegreg wants to merge 1 commit intomainfrom
gm/sdk-device-fixtures
Open

sdk: regenerate device fixtures with legacy and future-version variants#3676
elitegreg wants to merge 1 commit intomainfrom
gm/sdk-device-fixtures

Conversation

@elitegreg
Copy link
Copy Markdown
Contributor

Summary

  • Regenerates 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 populated new_interfaces vec: one Vpnv4 loopback carrying a FlexAlgoNodeSegment, one physical user-tunnel-endpoint. The legacy interfaces slot is now the V2 projection of new_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.
  • Adds device_legacy.{bin,json} — pre-smartcontract: append new_interfaces vec to Device with custom serializer #3667 byte shape with only the legacy interfaces vec populated and no trailing bytes. SDKs detect the absent trailing vec and rebuild new_interfaces from the legacy enum vec, stamping each entry with Version=CURRENT_INTERFACE_VERSION and Size=0.
  • Adds device_future_version.{bin,json} — same shape as device.bin, but the last trailing-vec element is doctored to version=5 with size += 8 and 8 0xAB filler bytes appended at end-of-file. SDKs read the known body fields, then seek(start + size) over the junk.
  • Adds Go fixture-driven tests (smartcontract/sdk/go/serviceability/fixture_test.go) — first fixture-loader for the Go serviceability SDK, mirroring the pattern in sdk/revdist/go/fixture_test.go. Extends Python/TS fixture tests to cover all three Device fixtures.
  • Drive-by: link.bin (+3 bytes) and sdk/telemetry/testdata/fixtures/generate-fixtures/Cargo.lock are pre-existing fixture rot picked up by make generate-fixtures.

Closes #3661. Depends on #3673 (size-prefixed Interface readers, already merged).

Testing Verification

  • cd sdk/serviceability/testdata/fixtures/generate-fixtures && cargo run regenerates all fixtures deterministically.
  • go test ./smartcontract/sdk/go/serviceability/...TestFixtureDevice, TestFixtureDeviceLegacy, TestFixtureDeviceFutureVersion all 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.
  • Verified xxd device_future_version.bin | tail shows the doctored 0x05 version byte and 8x 0xAB filler at end-of-file; trailing-element size is original + 8 exactly.

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.
@elitegreg elitegreg marked this pull request as ready for review May 6, 2026 03:35
@elitegreg elitegreg enabled auto-merge (squash) May 6, 2026 03:35
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: regenerate device fixtures and add legacy/future-version variants

1 participant