Files
zeekay 6ce66aa857 The X-chain reads its wire out of the schema
Every offset, every stride and every list shape the X-Chain has was
written twice: once in the Go reference and once by hand here. They are
now written once, in schema/wire.zap, and zapgen prints
include/lux/xvm/gen/wire_zap.hpp from it — 1,258 lines of hand-written
accessor and builder gone, replaced by 143 lines of schema.

What is left in wire.hpp is what the bytes MEAN, which is the only thing
that was ever this chain's to say: the two-byte (TypeKind, ShapeKind)
discriminator a shape travels behind, the walker over a packed envelope
run, the quorum gate on an owner group, and the conversions from the
wire's byte runs to Id and ShortId. It spells no offset.

Two things fell out of the split rather than being decided:

The expected fx family is now an argument to the one parse gate instead
of a field to re-check afterwards. Fifteen call sites each read a
TypeKind back off the payload and compared it to the family they were
already reading for; the gate takes the family and refuses a mismatch
itself.

A mint authority, a property state output and a bare owner group have
the same four fields and were three classes. They are one struct in the
schema and three ShapeKinds in wire.hpp, which is where the difference
actually is.

Two shapes the schema had to be able to say, and now can. Outs and Ins
are lists of records that carry a tail, so they are runs of relative
pointers; the address list is a run of fixed-width records. Both come
out of the element type. And NFTMintOperation reserves 36 bytes for
fields that end at 32 — `struct NFTMintOperation @36` says so, because
the wire does.

The bytes did not move, and that was checked two ways. First
side-by-side: the hand-written builder and the generated one, fed the
same values, over all twenty shapes including an empty list, an empty
transaction and a pointer list whose elements carry their own tails —
identical after the 2-byte prefix, 20 of 20. Then the golden suite,
which is not the generator's opinion of itself: test/golden.hpp is
printed by the GO implementation, and wire_test asserts against it
verbatim. 59 of 59, and the full suite 14/14.
2026-09-06 12:44:48 -07:00
..