Documentation
¶
Overview ¶
Package pvmcodectest is the PVM-aware companion to proto/internal/pcodectest. It carries the proto/p package imports (block / txs / warp / warp/message / warp/payload) so the basic pcodectest helpers can stay free of those imports — that split lets tests inside proto/p/txs (the lowest layer in the PVM dep graph) reach for pcodectest without closing a test-time import cycle.
Use pcodectest when you just need a linearcodec + codec.Manager pair. Use pvmcodectest when you need the PVM type set registered against that codec — proto/p/{block,state,txs/executor,txs/fee} etc. reach for the helpers here.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewMessageCodec ¶
NewMessageCodec returns a codec.Manager + linearcodec pair with the canonical warp/message types registered.
func NewMetadataCodec ¶
NewMetadataCodec returns the validator/delegator metadata codec registered with the v0:"true" and v1:"true" tag layouts. This is a SEPARATE codec from the block/genesis codec — proto/p/state holds it as a distinct field on *state.
Return type is the codec.Manager concrete (which satisfies state.MetadataCodec by shape) so this helper can stay independent of the proto/p/state package and avoid an import cycle on the state_test files that need this codec.
func NewPVMGenesisCodec ¶
func NewPVMGenesisCodec() (txs.Codec, txs.LinearRegistry)
NewPVMGenesisCodec returns a single linearcodec-backed codec.Manager for genesis tx wire bytes (MaxInt32 size budget).
func NewPVMRuntimeCodec ¶
func NewPVMRuntimeCodec() (txs.Codec, txs.LinearRegistry)
NewPVMRuntimeCodec returns a single linearcodec-backed codec.Manager for runtime tx wire bytes. Used by tests that need a txs.Codec directly without going through a Parser.
func NewPayloadCodec ¶
NewPayloadCodec returns a codec.Manager + linearcodec pair with the canonical warp payload types (Hash, AddressedCall) registered. Used by proto/p/warp/payload tests in lieu of the legacy package-level payload.Codec singleton.
NOTE: this helper imports proto/p/warp/payload — proto/p/warp/payload tests that need their own codec must construct it inline rather than reach for this helper (would close a test-time import cycle).
func NewWarpCodec ¶
NewWarpCodec returns a codec.Manager + linearcodec pair with the canonical proto/p/warp signature + teleport types registered.
Types ¶
type PVMCodecs ¶
type PVMCodecs struct {
Codec txs.Codec
GenesisCodec txs.Codec
Registry txs.LinearRegistry
GenesisRegistry txs.LinearRegistry
}
PVMCodecs bundles the runtime and genesis PVM codecs with their underlying linearcodec registries. Tests that exercise both the regular and genesis codec paths (e.g. proto/p/block, proto/p/state) pull a single bundle.
func NewPVMCodecs ¶
func NewPVMCodecs() PVMCodecs
NewPVMCodecs returns a PVMCodecs 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. Both registries are pre-seeded with the full Apricot/Banff/Durango/ Quasar block + tx type set, including the historical SkipRegistrations pre-amble.
NOTE: this helper imports proto/p/block (which imports proto/p/txs). Tests inside proto/p/{block,txs} that need their own codec must construct it inline rather than reach for this helper (would close a test-time import cycle).