Documentation
¶
Index ¶
- Constants
- Variables
- func LightClientBlockHeaderRequestBlockContentHash(v zapv2.View[LCBlockHeaderReqSchema]) [32]byte
- func NewLightClientBlockHeaderRequest(version uint8, chainID uint32, blockHeight uint64, certMinTier uint8, ...) (zapv2.View[LCBlockHeaderReqSchema], []byte)
- func WrapLightClientBlockHeaderRequest(b []byte) (zapv2.View[LCBlockHeaderReqSchema], error)
- type LCBlockHeaderReqSchema
Constants ¶
const KindLightClientBlockHeaderRequest zapv2.KindByte = 0x50
KindLightClientBlockHeaderRequest is the wire discriminator for LightClientBlockHeaderRequest.
const OffsetLightClientBlockHeaderRequest_BlockContentHash = 14
OffsetLightClientBlockHeaderRequest_BlockContentHash is the byte offset of the BlockContentHash field.
const OffsetLightClientBlockHeaderRequest_BlockHeight = 6
OffsetLightClientBlockHeaderRequest_BlockHeight is the byte offset of the BlockHeight field.
const OffsetLightClientBlockHeaderRequest_CertMinTier = 46
OffsetLightClientBlockHeaderRequest_CertMinTier is the byte offset of the CertMinTier field.
const OffsetLightClientBlockHeaderRequest_ChainID = 2
OffsetLightClientBlockHeaderRequest_ChainID is the byte offset of the ChainID field.
const OffsetLightClientBlockHeaderRequest_RequestID = 47
OffsetLightClientBlockHeaderRequest_RequestID is the byte offset of the RequestID field.
const OffsetLightClientBlockHeaderRequest_Version = 1
OffsetLightClientBlockHeaderRequest_Version is the byte offset of the Version field.
const SizeLightClientBlockHeaderRequest = 51
SizeLightClientBlockHeaderRequest is the fixed object payload size in bytes.
Variables ¶
var LCBlockHeaderReqSchemaFields = struct { Version zapv2.Field[LCBlockHeaderReqSchema, uint8] ChainID zapv2.Field[LCBlockHeaderReqSchema, uint32] BlockHeight zapv2.Field[LCBlockHeaderReqSchema, uint64] CertMinTier zapv2.Field[LCBlockHeaderReqSchema, uint8] RequestID zapv2.Field[LCBlockHeaderReqSchema, uint32] }{ Version: zapv2.At[LCBlockHeaderReqSchema, uint8](1), ChainID: zapv2.At[LCBlockHeaderReqSchema, uint32](2), BlockHeight: zapv2.At[LCBlockHeaderReqSchema, uint64](6), CertMinTier: zapv2.At[LCBlockHeaderReqSchema, uint8](46), RequestID: zapv2.At[LCBlockHeaderReqSchema, uint32](47), }
LCBlockHeaderReqSchemaFields is the namespace of every scalar field accessor for LightClientBlockHeaderRequest. Use with zapv2.Read / zapv2.Write for type-safe access. Byte-array fields are emitted as standalone functions, see below.
Functions ¶
func LightClientBlockHeaderRequestBlockContentHash ¶
func LightClientBlockHeaderRequestBlockContentHash(v zapv2.View[LCBlockHeaderReqSchema]) [32]byte
LightClientBlockHeaderRequestBlockContentHash reads the 32-byte inline BlockContentHash field of LightClientBlockHeaderRequest.
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.
func NewLightClientBlockHeaderRequest ¶
func NewLightClientBlockHeaderRequest(version uint8, chainID uint32, blockHeight uint64, certMinTier uint8, requestID uint32, blockContentHash [32]byte) (zapv2.View[LCBlockHeaderReqSchema], []byte)
NewLightClientBlockHeaderRequest builds a fresh LightClientBlockHeaderRequest 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 WrapLightClientBlockHeaderRequest ¶
func WrapLightClientBlockHeaderRequest(b []byte) (zapv2.View[LCBlockHeaderReqSchema], error)
WrapLightClientBlockHeaderRequest parses a ZAP buffer into a typed [zapv2.View[LightClientBlockHeaderRequest]]. Validates the wire frame and the kind discriminator at offset 0; returns *zapv2.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.
Types ¶
type LCBlockHeaderReqSchema ¶
type LCBlockHeaderReqSchema struct{}
LCBlockHeaderReqSchema is the v2 schema marker for LightClientBlockHeaderRequest. Methods are constant- returning so concrete-typed [zapv2.Wrap[LCBlockHeaderReqSchema]] calls fold to literals at the call site.
func (LCBlockHeaderReqSchema) Kind ¶
func (LCBlockHeaderReqSchema) Kind() zapv2.KindByte
func (LCBlockHeaderReqSchema) Name ¶
func (LCBlockHeaderReqSchema) Name() string
func (LCBlockHeaderReqSchema) Size ¶
func (LCBlockHeaderReqSchema) Size() int