pvmcodectest

package
v1.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 6, 2026 License: BSD-3-Clause Imports: 8 Imported by: 0

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 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.

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 NewMessageCodec

func NewMessageCodec() warpmsg.Codec

NewMessageCodec returns a ZAP-native Manager with the canonical warp/message types registered.

func NewMetadataCodec

func NewMetadataCodec() zap_codec.MultiManager

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.

Returns a multi-version Manager with two inner codec versions registered: 0 (v0-only tag) and 1 (v0 + v1 tags). The Manager 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 ZAP-native Manager for genesis tx wire bytes (MaxInt32 size budget). Same caveat as NewPVMRuntimeCodec — the Manager is returned as both Codec and LinearRegistry.

func NewPVMRuntimeCodec

func NewPVMRuntimeCodec() (txs.Codec, txs.LinearRegistry)

NewPVMRuntimeCodec returns a single ZAP-native Manager seeded with the full PVM tx type set. Used by tests that need a txs.Codec directly without going through a Parser. The same Manager is returned as both Codec and LinearRegistry — it satisfies both interfaces by shape.

func NewPayloadCodec

func NewPayloadCodec() payload.Codec

NewPayloadCodec returns a ZAP-native Manager 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

func NewWarpCodec() warp.Codec

NewWarpCodec returns a ZAP-native Manager 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 registries. Tests that exercise both the regular and genesis codec paths (e.g. proto/p/block, proto/p/state) pull a single bundle. Codec and Registry slots reference the same underlying *zap_codec.Manager per side — the Manager satisfies both interfaces by shape.

func NewPVMCodecs

func NewPVMCodecs() PVMCodecs

NewPVMCodecs returns a PVMCodecs bundle backed by two fresh ZAP-native 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 managers 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).

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL