Files
zeekay 299b9230bc A validator answer states its own ZAP wire
NodeID is [20]byte and TxID is [32]byte, and the derived codec refuses a
fixed array outright, so getValidatorsAt could not cross the op-call plane
at all. zap_gen.go is generated by zip.Codecs from the same layout the
plane encodes against.

go.sum was missing entries for this module own direct imports, so nothing
here built; go mod tidy records them.
2026-08-29 18:58:36 -07:00

63 lines
1.9 KiB
Go

// Code generated by zip; DO NOT EDIT.
package validators
import (
"fmt"
zap "github.com/zap-proto/go"
)
// ---- GetValidatorOutput ------------------------------------------------
const (
getValidatorOutputNodeIDAt = 0
getValidatorOutputPublicKeyAt = 24
getValidatorOutputCoronaPubKeyAt = 32
getValidatorOutputLightAt = 40
getValidatorOutputWeightAt = 48
getValidatorOutputTxIDAt = 56
getValidatorOutputSize = 88
)
var _ interface {
MarshalZAP() ([]byte, error)
UnmarshalZAP([]byte) error
} = (*GetValidatorOutput)(nil)
// MarshalZAP writes GetValidatorOutput from constant offsets.
func (x *GetValidatorOutput) MarshalZAP() ([]byte, error) {
if x == nil {
return nil, nil
}
b := zap.NewBuilder(getValidatorOutputSize + 256)
ob := b.StartObject(getValidatorOutputSize)
ob.SetBytesFixed(getValidatorOutputNodeIDAt, x.NodeID[:])
ob.SetBytes(getValidatorOutputPublicKeyAt, []byte(x.PublicKey))
ob.SetBytes(getValidatorOutputCoronaPubKeyAt, []byte(x.CoronaPubKey))
ob.SetUint64(getValidatorOutputLightAt, uint64(x.Light))
ob.SetUint64(getValidatorOutputWeightAt, uint64(x.Weight))
ob.SetBytesFixed(getValidatorOutputTxIDAt, x.TxID[:])
ob.FinishAsRoot()
return b.Finish(), nil
}
// UnmarshalZAP reads GetValidatorOutput out of the buffer that arrived.
func (x *GetValidatorOutput) UnmarshalZAP(data []byte) error {
if x == nil || len(data) == 0 {
return nil
}
m, err := zap.Parse(data)
if err != nil {
return fmt.Errorf("GetValidatorOutput: %w", err)
}
o := m.Root()
copy(x.NodeID[:], o.BytesFixed(getValidatorOutputNodeIDAt, 20))
x.PublicKey = []uint8(append([]byte(nil), o.Bytes(getValidatorOutputPublicKeyAt)...))
x.CoronaPubKey = []uint8(append([]byte(nil), o.Bytes(getValidatorOutputCoronaPubKeyAt)...))
x.Light = uint64(o.Uint64(getValidatorOutputLightAt))
x.Weight = uint64(o.Uint64(getValidatorOutputWeightAt))
copy(x.TxID[:], o.BytesFixed(getValidatorOutputTxIDAt, 32))
return nil
}