3 Commits
Author SHA1 Message Date
Hanzo AI fe366196b6 zap_codec/zap_native: rip BE-fallback + LegacyEnabled, forward-only
Forward-only ZAP. No backwards-compat shims:
- zap_codec multi.go: drop BE-fallback read path
- zap_codec zapcodec.go: drop BE-fallback read path + peekVersionBE helper
- zap_native codec_select.go: rip LegacyEnabled var + LUXD_ENABLE_LEGACY_CODEC
  env knob + ErrLegacyCodecDisabled. Comment block simplified.

ZAPActivationUnix stays at 1766708400 (Dec 25 2025 16:20 PST — Quasar
activation timestamp, same as all other forks). ShouldUseZAPForWrite
returns true unconditionally — ZAP is the only wire format.

Tests cleaned: drop LegacyEnabled toggle scenarios in
TestShouldUseZAPForWrite and TestRed_V15. Pin ZAPActivationUnix value
to the Quasar timestamp.

Validators upgrading from v1.28.x DBs cannot mount in this layout
(pre-LP-023 BE-encoded P-chain state is unreadable). Mainnet/testnet/
devnet operators must rebootstrap from genesis + RLP re-import.
2026-06-06 17:12:24 -07:00
Hanzo AI a7014e0340 zap_codec: BE-fallback read for pre-LP-023 (v1.28.x) P-chain state
Validators upgrading from luxd v1.28.x hold P-chain state written with
the pre-LP-023 BE codec version prefix. zap_codec.Unmarshal now tries
LE first; on unknown version, falls back to BE before erroring.

Behaviour:
- LE matches → use LE codec (post-Dec-25-2025 writers)
- LE unknown, BE matches → use BE codec with BE prefix, advance offset
  past VersionSize, decode body
- Both unknown → ErrUnknownVersion as before

Disambiguation is safe because registered version IDs are small (0..N
for the handful of codec generations). Palindromic byte-pair values
agree under both endianness, so the only ambiguous case is small N where
both BE and LE happen to be registered — practically impossible with
the current registry.

Also:
- ZAPActivationUnix: 0 → 1766708400 (Dec 25 2025 16:20 PST) — same as
  all other Quasar-Edition forks. Documents that LP-023 was a network
  activation, not a binary cutover.
- LegacyEnabled: defaults true unless LUXD_ENABLE_LEGACY_CODEC=0 — keeps
  legacy linearcodec path reachable for historical bytes that didn't
  migrate through the BE-fallback shim.
2026-06-06 16:55:39 -07:00
Hanzo AI 5f375f2db6 proto: lift zap_native from node/vms/platformvm/txs/ to proto/zap_native
Decouples the platformvm ZAP TxKind dispatch from luxfi/node so
proto/p can consume it directly for the codec rip (#101 Wave 1B).
Previously the package lived downstream of proto, making the proto/p
migration architecturally impossible.

Package name kept as zap_native (236 outer-luxfi/zap references would
otherwise need aliasing). Directory matches. Public sub-package (not
internal/) so node's 8 existing consumers can also import it via the
new path:

  github.com/luxfi/node/vms/platformvm/txs/zap_native
    ↓
  github.com/luxfi/proto/zap_native

Standalone tests pass:
  ok  github.com/luxfi/proto/zap_native
2026-06-05 14:40:27 -07:00