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 linearcodec-backed ParserCodecs.
Production callers (luxfi/sdk/wallet/chain/x/..., luxfi/node/vms/xvm/...) construct their codecs inline. This helper exists strictly so the in-tree test files don't need to duplicate the wiring.
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 linearcodec registries and two codec.Manager instances, one for runtime txs and one for genesis txs (with the larger MaxInt32 size budget). Each call produces independent codecs — safe to use per-test.
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 linearcodec-backed codec.Manager for runtime tx wire bytes. 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.