Documentation
¶
Overview ¶
Package xcodectest is the canonical test wiring for the proto/x XVM codec set. proto/x carries no github.com/luxfi/codec import after the Wave 1A rip (#101); this helper package is the bridge that lets test suites under proto/x construct ZAP-native ParserCodecs.
Production callers (luxfi/sdk/wallet/chain/x/..., luxfi/node/vms/xvm/...) construct their codecs inline via proto/zap_codec. This helper exists strictly so the in-tree test files don't need to duplicate the wiring.
Wire format is ZAP-native (little-endian) — proto/zap_codec is the single canonical construction site for the wire codec choice (LP-023).
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func New ¶
func New() txs.ParserCodecs
New returns a ParserCodecs bundle backed by two fresh ZAP-native Manager instances, one for runtime txs and one for genesis txs (with the larger math.MaxInt32 size budget). Each call produces independent codecs — safe to use per-test. Both Codec slots and both Registry slots reference the same underlying *zap_codec.Manager per side: the Manager satisfies both proto/x/txs.Codec (Marshal/Unmarshal/Size) and proto/x/txs.Registry (RegisterType) by shape.
Tx-level and fx-owned wire payload types are registered when this bundle is handed to txs.NewParser — see parser.go fxOwnedTypes for the canonical per-fx registration list.
func NewRuntimeCodec ¶
NewRuntimeCodec returns a single ZAP-native Manager that satisfies both txs.Codec and txs.Registry. Used by tests that need a Codec directly without going through a Parser. Fx types are NOT auto- registered here — callers that need fx payload roundtrip should use New().
Types ¶
type CodecMock ¶
type CodecMock struct {
// contains filtered or unexported fields
}
CodecMock is a gomock-driven mock of the txs.Codec interface.
It mirrors the legacy luxfi/codec/codecmock.Manager API surface so existing tests can be ported by swapping the import: codecmock.NewManager → xcodectest.NewCodecMock. The package deliberately does not depend on github.com/luxfi/codec — proto/x carries no such import after Wave 1A.
func NewCodecMock ¶
func NewCodecMock(ctrl *gomock.Controller) *CodecMock
NewCodecMock creates a fresh CodecMock.
func (*CodecMock) EXPECT ¶
func (m *CodecMock) EXPECT() *CodecMockRecorder
EXPECT returns the recorder so tests can program expectations.
type CodecMockRecorder ¶
type CodecMockRecorder struct {
// contains filtered or unexported fields
}
CodecMockRecorder is the mock recorder.
func (*CodecMockRecorder) Marshal ¶
func (mr *CodecMockRecorder) Marshal(version, source any) *gomock.Call
Marshal expectation.