zkvmwire

package
v1.2.4 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2026 License: BSD-3-Clause Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const KindZKVMUTXO zapv1.KindByte = 0x03

KindZKVMUTXO is the wire discriminator for ZKVMUTXO.

View Source
const OffsetZKVMUTXO_CiphertextLen = 60

OffsetZKVMUTXO_CiphertextLen is the byte offset of the CiphertextLen field.

View Source
const OffsetZKVMUTXO_CiphertextOff = 56

OffsetZKVMUTXO_CiphertextOff is the byte offset of the CiphertextOff field.

View Source
const OffsetZKVMUTXO_CommitmentLen = 52

OffsetZKVMUTXO_CommitmentLen is the byte offset of the CommitmentLen field.

View Source
const OffsetZKVMUTXO_CommitmentOff = 48

OffsetZKVMUTXO_CommitmentOff is the byte offset of the CommitmentOff field.

View Source
const OffsetZKVMUTXO_EphemeralPKLen = 68

OffsetZKVMUTXO_EphemeralPKLen is the byte offset of the EphemeralPKLen field.

View Source
const OffsetZKVMUTXO_EphemeralPKOff = 64

OffsetZKVMUTXO_EphemeralPKOff is the byte offset of the EphemeralPKOff field.

View Source
const OffsetZKVMUTXO_Height = 8

OffsetZKVMUTXO_Height is the byte offset of the Height field.

View Source
const OffsetZKVMUTXO_OutputIndex = 4

OffsetZKVMUTXO_OutputIndex is the byte offset of the OutputIndex field.

View Source
const OffsetZKVMUTXO_TxID = 16

OffsetZKVMUTXO_TxID is the byte offset of the TxID field.

View Source
const SizeZKVMUTXO = 72

SizeZKVMUTXO is the fixed object payload size in bytes.

Variables

View Source
var ZKVMUTXOSchemaFields = struct {
	OutputIndex    zapv1.Field[ZKVMUTXOSchema, uint32]
	Height         zapv1.Field[ZKVMUTXOSchema, uint64]
	CommitmentOff  zapv1.Field[ZKVMUTXOSchema, uint32]
	CommitmentLen  zapv1.Field[ZKVMUTXOSchema, uint32]
	CiphertextOff  zapv1.Field[ZKVMUTXOSchema, uint32]
	CiphertextLen  zapv1.Field[ZKVMUTXOSchema, uint32]
	EphemeralPKOff zapv1.Field[ZKVMUTXOSchema, uint32]
	EphemeralPKLen zapv1.Field[ZKVMUTXOSchema, uint32]
}{
	OutputIndex:    zapv1.At[ZKVMUTXOSchema, uint32](4),
	Height:         zapv1.At[ZKVMUTXOSchema, uint64](8),
	CommitmentOff:  zapv1.At[ZKVMUTXOSchema, uint32](48),
	CommitmentLen:  zapv1.At[ZKVMUTXOSchema, uint32](52),
	CiphertextOff:  zapv1.At[ZKVMUTXOSchema, uint32](56),
	CiphertextLen:  zapv1.At[ZKVMUTXOSchema, uint32](60),
	EphemeralPKOff: zapv1.At[ZKVMUTXOSchema, uint32](64),
	EphemeralPKLen: zapv1.At[ZKVMUTXOSchema, uint32](68),
}

ZKVMUTXOSchemaFields is the namespace of every scalar field accessor for ZKVMUTXO. Use with zapv1.Read / zapv1.Write for type-safe access. Byte-array fields are emitted as standalone functions, see below.

Functions

func NewZKVMUTXO

func NewZKVMUTXO(outputIndex uint32, height uint64, commitmentOff uint32, commitmentLen uint32, ciphertextOff uint32, ciphertextLen uint32, ephemeralPKOff uint32, ephemeralPKLen uint32, txID [32]byte) (zapv1.View[ZKVMUTXOSchema], []byte)

NewZKVMUTXO builds a fresh ZKVMUTXO in a ZAP buffer.

Hand-rolled fast path: inlines v1 primitives (zap.NewBuilder, [*Builder.StartObject], [*ObjectBuilder.Set*], [*Builder.Finish]) so the entire build expands at the call site. Result: 1 heap alloc (the buffer), zero overhead vs v1.

func WrapZKVMUTXO

func WrapZKVMUTXO(b []byte) (zapv1.View[ZKVMUTXOSchema], error)

WrapZKVMUTXO parses a ZAP buffer into a typed [zapv1.View[ZKVMUTXO]]. Validates the wire frame and the kind discriminator at offset 0; returns *zapv1.SchemaError on kind mismatch.

Hand-rolled fast path: inlines zap.Parse (which is itself inlineable). Zero heap allocs on the happy path; matches v1 hand-rolled performance.

func ZKVMUTXOTxID

func ZKVMUTXOTxID(v zapv1.View[ZKVMUTXOSchema]) [32]byte

ZKVMUTXOTxID reads the 32-byte inline TxID field of ZKVMUTXO.

Zero-copy on the read side (v1's Object.BytesFixedSlice returns a sub-slice of the underlying buffer); the returned [32]byte is a value copy so the caller's slot owns the bytes after the View's buffer is freed.

Types

type ZKVMUTXOSchema

type ZKVMUTXOSchema struct{}

ZKVMUTXOSchema is the v2 schema marker for ZKVMUTXO. Methods are constant- returning so concrete-typed [zapv1.Wrap[ZKVMUTXOSchema]] calls fold to literals at the call site.

func (ZKVMUTXOSchema) Kind

func (ZKVMUTXOSchema) Kind() zapv1.KindByte

func (ZKVMUTXOSchema) Name

func (ZKVMUTXOSchema) Name() string

func (ZKVMUTXOSchema) Size

func (ZKVMUTXOSchema) Size() int

Jump to

Keyboard shortcuts

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