Hanzo AI 767ff47d22 proto/p/state: decouple MetadataCodec from block codec
The validator/delegator metadata codec uses a versioned tag schema
(v0:"true" / v1:"true") that is SEPARATE from the block/genesis codec
and the runtime tx codec. My previous commit incorrectly aliased
state.MetadataCodec to block.Codec; this commit restores it as a
distinct codec.Manager-shaped interface.

* state.MetadataCodec is now a standalone interface type (codec.Manager
  shape). state.New takes (genesisCodec block.Codec, txCodec txs.Codec,
  metadataCodec MetadataCodec) — three distinct codec parameters,
  each with its own type-registration story.

* proto/internal/pcodectest.NewMetadataCodec constructs the metadata
  codec with the v0 + v1 linearcodec layouts. Returns codec.Manager
  rather than state.MetadataCodec so the helper can stay independent
  of proto/p/state (which would otherwise create a test-time import
  cycle: pcodectest → state → state_test → pcodectest).

* state.go's metadata operations now use s.metadataCodec, not
  s.genesisCodec. Previously the sed sweep folded both into
  genesisCodec — this commit teases them back apart.

* state.statetest.New wires the new metadataCodec parameter through.

* parseValidatorMetadata, parseDelegatorMetadata,
  WriteValidatorMetadata, writeDelegatorMetadata, writeCurrentDelegatorDiff
  all take MetadataCodec as a parameter.

Test files (_test.go) still on luxfi/codec — Wave 2A test sweep
continues in the next commit.
2026-06-06 01:17:20 -07:00
2026-06-02 23:08:09 -07:00
2026-06-02 23:08:09 -07:00
2026-02-14 05:26:23 -08:00
2026-03-11 10:35:54 -07:00

luxfi/proto

Canonical schema definitions for the Lux platform. Module path is github.com/luxfi/proto — the directory now matches (was protocol/).

Layout: ZAP + gRPC side-by-side, 1:1

Same package paths under both zap/ and pb/ (or in files suffixed _zap.go and _pb.go for thin packages). The Go build picks one or the other based on the build tag:

Default (no tag) -tags grpc
zap/<pkg>/*_zap.go (//go:build !grpc) pb/<pkg>/*_pb.go (//go:build grpc)
ZAP-native types + codecs protobuf-generated types + codecs
Zero google.golang.org/grpc in dep graph Includes google.golang.org/grpc

ZAP is the canonical wire. The protobuf path exists only for external integrations that mandate OTLP-over-gRPC. Internal Lux services use ZAP exclusively.

Consolidation policy

New schemas land here. This directory is the single source of truth for any cross-package wire definition. The scattered per-repo proto/ subdirs (see below) are legacy — they should migrate into this module when the natural rewrite happens.

Existing scattered locations (do not add to them):

Path Status
~/work/lux/p2p/proto/{zap,pb,p2p}/ legacy — to migrate
~/work/lux/node/proto/zap/ legacy — to migrate
~/work/lux/vm/proto/pb/ legacy — to migrate
~/work/lux/api/schema/proto/ legacy — to migrate

Migration cost is one import-path bump per consumer. Not blocking — fold in as those packages are touched for unrelated reasons.

Hanzo mirror

~/work/hanzo/proto follows the same pattern for the Hanzo platform. See hanzoai/proto README.

S
Description
No description provided
Readme BSD-3-Clause
59 MiB
Languages
Go 96.9%
ZAP 3.1%