Files
zeekay 83227ce150 vm/chains/atomic: hand-rolled binary marshal, drop github.com/luxfi/codec
Wave 2E of codec final rip (#101). The package-local Codec singleton
no longer wraps a reflectcodec-backed codec.Manager + linearcodec; it
is a hand-rolled two-shape marshaller for the [2]ids.ID sharedID seed
and the *dbElement value record stored under each shared-memory key.

Public surface is preserved bit-for-bit:

  - Codec, CodecVersion, Manager interface
  - Marshal(version, source) ([]byte, error)
  - Unmarshal(bytes, dest) (uint16, error)

Wire format for both supported shapes is byte-identical to the legacy
reflectcodec output (verified out-of-band against a side-by-side
linearcodec run; new codec_test.go pins fixtures). Existing on-disk
shared-memory state and bootstrapped peers therefore remain readable.

The codec is now closed by type: any source/dest outside the two
registered shapes is rejected with ErrUnsupportedType at marshal /
unmarshal time. Adding a new shape is a deliberate change — register
a case in marshalValue/unmarshalValue.

Max blob size dropped from math.MaxInt to a 64 MiB explicit cap; the
two registered shapes are bounded well under that and the cap
prevents pathological inputs from allocating up to memory exhaustion
at unmarshal time.

No consumer changes required: the singleton + interface preserve the
exact call surface every internal call site (memory.go::sharedID,
state.go::SetValue / RemoveValue / loadValue) already uses.
2026-06-06 02:40:41 -07:00
..