mirror of
https://github.com/luxfi/node.git
synced 2026-10-30 15:24:05 +00:00
The module already called itself github.com/luxfi/node while containing no node in Go: cmd/luxd was twenty-one lines that printed the size of a few types, and the Go column of the matrix measured a VM plugin. A repo that fetches the thing it claims to be has not replaced it, so the Go sources move in — 1515 files, the daemon and everything under it — and the build reaches outside this module for nothing. Rust and C++ sit beside it unchanged and are still measured against it by the differential. That is the point of one repo: the reference implementation and the two ports are the same checkout, so parity is a thing you can run rather than a thing you assert. Verified: builds, and the closure carries no lux-private — checked at build time rather than believed. The daemon starts twelve chains on a local network (P X C Q Z A B G K M F, plus D through its plugin) and reports healthy.
539 lines
13 KiB
Go
539 lines
13 KiB
Go
// Code generated by zip; DO NOT EDIT.
|
|
|
|
package api
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
genesis "github.com/luxfi/node/vms/example/xsvm/genesis"
|
|
warp "github.com/luxfi/node/vms/platformvm/warp"
|
|
zap "github.com/zap-proto/go"
|
|
)
|
|
|
|
// ---- BalanceArgs -------------------------------------------------------
|
|
|
|
const (
|
|
balanceArgsAddressAt = 0
|
|
balanceArgsAssetIDAt = 20
|
|
balanceArgsSize = 56
|
|
)
|
|
|
|
var _ interface {
|
|
MarshalZAP() ([]byte, error)
|
|
UnmarshalZAP([]byte) error
|
|
} = (*BalanceArgs)(nil)
|
|
|
|
// MarshalZAP writes BalanceArgs from constant offsets.
|
|
func (x *BalanceArgs) MarshalZAP() ([]byte, error) {
|
|
if x == nil {
|
|
return nil, nil
|
|
}
|
|
b := zap.NewBuilder(balanceArgsSize + 256)
|
|
ob := b.StartObject(balanceArgsSize)
|
|
ob.SetBytesFixed(balanceArgsAddressAt, x.Address[:])
|
|
ob.SetBytesFixed(balanceArgsAssetIDAt, x.AssetID[:])
|
|
ob.FinishAsRoot()
|
|
return b.Finish(), nil
|
|
}
|
|
|
|
// UnmarshalZAP reads BalanceArgs out of the buffer that arrived.
|
|
func (x *BalanceArgs) UnmarshalZAP(data []byte) error {
|
|
if x == nil || len(data) == 0 {
|
|
return nil
|
|
}
|
|
m, err := zap.Parse(data)
|
|
if err != nil {
|
|
return fmt.Errorf("BalanceArgs: %w", err)
|
|
}
|
|
o := m.Root()
|
|
copy(x.Address[:], o.BytesFixed(balanceArgsAddressAt, 20))
|
|
copy(x.AssetID[:], o.BytesFixed(balanceArgsAssetIDAt, 32))
|
|
return nil
|
|
}
|
|
|
|
// ---- BalanceReply ------------------------------------------------------
|
|
|
|
const (
|
|
balanceReplyBalanceAt = 0
|
|
balanceReplySize = 8
|
|
)
|
|
|
|
var _ interface {
|
|
MarshalZAP() ([]byte, error)
|
|
UnmarshalZAP([]byte) error
|
|
} = (*BalanceReply)(nil)
|
|
|
|
// MarshalZAP writes BalanceReply from constant offsets.
|
|
func (x *BalanceReply) MarshalZAP() ([]byte, error) {
|
|
if x == nil {
|
|
return nil, nil
|
|
}
|
|
b := zap.NewBuilder(balanceReplySize + 256)
|
|
ob := b.StartObject(balanceReplySize)
|
|
ob.SetUint64(balanceReplyBalanceAt, uint64(x.Balance))
|
|
ob.FinishAsRoot()
|
|
return b.Finish(), nil
|
|
}
|
|
|
|
// UnmarshalZAP reads BalanceReply out of the buffer that arrived.
|
|
func (x *BalanceReply) UnmarshalZAP(data []byte) error {
|
|
if x == nil || len(data) == 0 {
|
|
return nil
|
|
}
|
|
m, err := zap.Parse(data)
|
|
if err != nil {
|
|
return fmt.Errorf("BalanceReply: %w", err)
|
|
}
|
|
o := m.Root()
|
|
x.Balance = uint64(o.Uint64(balanceReplyBalanceAt))
|
|
return nil
|
|
}
|
|
|
|
// ---- BlockArgs ---------------------------------------------------------
|
|
|
|
const (
|
|
blockArgsBlockIDAt = 0
|
|
blockArgsSize = 32
|
|
)
|
|
|
|
var _ interface {
|
|
MarshalZAP() ([]byte, error)
|
|
UnmarshalZAP([]byte) error
|
|
} = (*BlockArgs)(nil)
|
|
|
|
// MarshalZAP writes BlockArgs from constant offsets.
|
|
func (x *BlockArgs) MarshalZAP() ([]byte, error) {
|
|
if x == nil {
|
|
return nil, nil
|
|
}
|
|
b := zap.NewBuilder(blockArgsSize + 256)
|
|
ob := b.StartObject(blockArgsSize)
|
|
ob.SetBytesFixed(blockArgsBlockIDAt, x.BlockID[:])
|
|
ob.FinishAsRoot()
|
|
return b.Finish(), nil
|
|
}
|
|
|
|
// UnmarshalZAP reads BlockArgs out of the buffer that arrived.
|
|
func (x *BlockArgs) UnmarshalZAP(data []byte) error {
|
|
if x == nil || len(data) == 0 {
|
|
return nil
|
|
}
|
|
m, err := zap.Parse(data)
|
|
if err != nil {
|
|
return fmt.Errorf("BlockArgs: %w", err)
|
|
}
|
|
o := m.Root()
|
|
copy(x.BlockID[:], o.BytesFixed(blockArgsBlockIDAt, 32))
|
|
return nil
|
|
}
|
|
|
|
// ---- GenesisReply ------------------------------------------------------
|
|
|
|
const (
|
|
genesisReplyGenesisAt = 0
|
|
genesisReplySize = 8
|
|
)
|
|
|
|
var _ interface {
|
|
MarshalZAP() ([]byte, error)
|
|
UnmarshalZAP([]byte) error
|
|
} = (*GenesisReply)(nil)
|
|
|
|
// MarshalZAP writes GenesisReply from constant offsets.
|
|
func (x *GenesisReply) MarshalZAP() ([]byte, error) {
|
|
if x == nil {
|
|
return nil, nil
|
|
}
|
|
b := zap.NewBuilder(genesisReplySize + 256)
|
|
ob := b.StartObject(genesisReplySize)
|
|
if x.Genesis != nil {
|
|
innerGenesis, err := x.Genesis.MarshalZAP()
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
ob.SetBytes(genesisReplyGenesisAt, innerGenesis)
|
|
}
|
|
ob.FinishAsRoot()
|
|
return b.Finish(), nil
|
|
}
|
|
|
|
// UnmarshalZAP reads GenesisReply out of the buffer that arrived.
|
|
func (x *GenesisReply) UnmarshalZAP(data []byte) error {
|
|
if x == nil || len(data) == 0 {
|
|
return nil
|
|
}
|
|
m, err := zap.Parse(data)
|
|
if err != nil {
|
|
return fmt.Errorf("GenesisReply: %w", err)
|
|
}
|
|
o := m.Root()
|
|
if raw := o.Bytes(genesisReplyGenesisAt); len(raw) > 0 {
|
|
var v genesis.Genesis
|
|
if err := v.UnmarshalZAP(raw); err != nil {
|
|
return err
|
|
}
|
|
x.Genesis = &v
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// ---- IssueTxArgs -------------------------------------------------------
|
|
|
|
const (
|
|
issueTxArgsTxAt = 0
|
|
issueTxArgsSize = 8
|
|
)
|
|
|
|
var _ interface {
|
|
MarshalZAP() ([]byte, error)
|
|
UnmarshalZAP([]byte) error
|
|
} = (*IssueTxArgs)(nil)
|
|
|
|
// MarshalZAP writes IssueTxArgs from constant offsets.
|
|
func (x *IssueTxArgs) MarshalZAP() ([]byte, error) {
|
|
if x == nil {
|
|
return nil, nil
|
|
}
|
|
b := zap.NewBuilder(issueTxArgsSize + 256)
|
|
ob := b.StartObject(issueTxArgsSize)
|
|
ob.SetBytes(issueTxArgsTxAt, []byte(x.Tx))
|
|
ob.FinishAsRoot()
|
|
return b.Finish(), nil
|
|
}
|
|
|
|
// UnmarshalZAP reads IssueTxArgs out of the buffer that arrived.
|
|
func (x *IssueTxArgs) UnmarshalZAP(data []byte) error {
|
|
if x == nil || len(data) == 0 {
|
|
return nil
|
|
}
|
|
m, err := zap.Parse(data)
|
|
if err != nil {
|
|
return fmt.Errorf("IssueTxArgs: %w", err)
|
|
}
|
|
o := m.Root()
|
|
x.Tx = []uint8(append([]byte(nil), o.Bytes(issueTxArgsTxAt)...))
|
|
return nil
|
|
}
|
|
|
|
// ---- IssueTxReply ------------------------------------------------------
|
|
|
|
const (
|
|
issueTxReplyTxIDAt = 0
|
|
issueTxReplySize = 32
|
|
)
|
|
|
|
var _ interface {
|
|
MarshalZAP() ([]byte, error)
|
|
UnmarshalZAP([]byte) error
|
|
} = (*IssueTxReply)(nil)
|
|
|
|
// MarshalZAP writes IssueTxReply from constant offsets.
|
|
func (x *IssueTxReply) MarshalZAP() ([]byte, error) {
|
|
if x == nil {
|
|
return nil, nil
|
|
}
|
|
b := zap.NewBuilder(issueTxReplySize + 256)
|
|
ob := b.StartObject(issueTxReplySize)
|
|
ob.SetBytesFixed(issueTxReplyTxIDAt, x.TxID[:])
|
|
ob.FinishAsRoot()
|
|
return b.Finish(), nil
|
|
}
|
|
|
|
// UnmarshalZAP reads IssueTxReply out of the buffer that arrived.
|
|
func (x *IssueTxReply) UnmarshalZAP(data []byte) error {
|
|
if x == nil || len(data) == 0 {
|
|
return nil
|
|
}
|
|
m, err := zap.Parse(data)
|
|
if err != nil {
|
|
return fmt.Errorf("IssueTxReply: %w", err)
|
|
}
|
|
o := m.Root()
|
|
copy(x.TxID[:], o.BytesFixed(issueTxReplyTxIDAt, 32))
|
|
return nil
|
|
}
|
|
|
|
// ---- LoanArgs ----------------------------------------------------------
|
|
|
|
const (
|
|
loanArgsChainIDAt = 0
|
|
loanArgsSize = 32
|
|
)
|
|
|
|
var _ interface {
|
|
MarshalZAP() ([]byte, error)
|
|
UnmarshalZAP([]byte) error
|
|
} = (*LoanArgs)(nil)
|
|
|
|
// MarshalZAP writes LoanArgs from constant offsets.
|
|
func (x *LoanArgs) MarshalZAP() ([]byte, error) {
|
|
if x == nil {
|
|
return nil, nil
|
|
}
|
|
b := zap.NewBuilder(loanArgsSize + 256)
|
|
ob := b.StartObject(loanArgsSize)
|
|
ob.SetBytesFixed(loanArgsChainIDAt, x.ChainID[:])
|
|
ob.FinishAsRoot()
|
|
return b.Finish(), nil
|
|
}
|
|
|
|
// UnmarshalZAP reads LoanArgs out of the buffer that arrived.
|
|
func (x *LoanArgs) UnmarshalZAP(data []byte) error {
|
|
if x == nil || len(data) == 0 {
|
|
return nil
|
|
}
|
|
m, err := zap.Parse(data)
|
|
if err != nil {
|
|
return fmt.Errorf("LoanArgs: %w", err)
|
|
}
|
|
o := m.Root()
|
|
copy(x.ChainID[:], o.BytesFixed(loanArgsChainIDAt, 32))
|
|
return nil
|
|
}
|
|
|
|
// ---- LoanReply ---------------------------------------------------------
|
|
|
|
const (
|
|
loanReplyAmountAt = 0
|
|
loanReplySize = 8
|
|
)
|
|
|
|
var _ interface {
|
|
MarshalZAP() ([]byte, error)
|
|
UnmarshalZAP([]byte) error
|
|
} = (*LoanReply)(nil)
|
|
|
|
// MarshalZAP writes LoanReply from constant offsets.
|
|
func (x *LoanReply) MarshalZAP() ([]byte, error) {
|
|
if x == nil {
|
|
return nil, nil
|
|
}
|
|
b := zap.NewBuilder(loanReplySize + 256)
|
|
ob := b.StartObject(loanReplySize)
|
|
ob.SetUint64(loanReplyAmountAt, uint64(x.Amount))
|
|
ob.FinishAsRoot()
|
|
return b.Finish(), nil
|
|
}
|
|
|
|
// UnmarshalZAP reads LoanReply out of the buffer that arrived.
|
|
func (x *LoanReply) UnmarshalZAP(data []byte) error {
|
|
if x == nil || len(data) == 0 {
|
|
return nil
|
|
}
|
|
m, err := zap.Parse(data)
|
|
if err != nil {
|
|
return fmt.Errorf("LoanReply: %w", err)
|
|
}
|
|
o := m.Root()
|
|
x.Amount = uint64(o.Uint64(loanReplyAmountAt))
|
|
return nil
|
|
}
|
|
|
|
// ---- MessageArgs -------------------------------------------------------
|
|
|
|
const (
|
|
messageArgsTxIDAt = 0
|
|
messageArgsSize = 32
|
|
)
|
|
|
|
var _ interface {
|
|
MarshalZAP() ([]byte, error)
|
|
UnmarshalZAP([]byte) error
|
|
} = (*MessageArgs)(nil)
|
|
|
|
// MarshalZAP writes MessageArgs from constant offsets.
|
|
func (x *MessageArgs) MarshalZAP() ([]byte, error) {
|
|
if x == nil {
|
|
return nil, nil
|
|
}
|
|
b := zap.NewBuilder(messageArgsSize + 256)
|
|
ob := b.StartObject(messageArgsSize)
|
|
ob.SetBytesFixed(messageArgsTxIDAt, x.TxID[:])
|
|
ob.FinishAsRoot()
|
|
return b.Finish(), nil
|
|
}
|
|
|
|
// UnmarshalZAP reads MessageArgs out of the buffer that arrived.
|
|
func (x *MessageArgs) UnmarshalZAP(data []byte) error {
|
|
if x == nil || len(data) == 0 {
|
|
return nil
|
|
}
|
|
m, err := zap.Parse(data)
|
|
if err != nil {
|
|
return fmt.Errorf("MessageArgs: %w", err)
|
|
}
|
|
o := m.Root()
|
|
copy(x.TxID[:], o.BytesFixed(messageArgsTxIDAt, 32))
|
|
return nil
|
|
}
|
|
|
|
// ---- MessageReply ------------------------------------------------------
|
|
|
|
const (
|
|
messageReplyMessageAt = 0
|
|
messageReplySignatureAt = 8
|
|
messageReplySize = 16
|
|
)
|
|
|
|
var _ interface {
|
|
MarshalZAP() ([]byte, error)
|
|
UnmarshalZAP([]byte) error
|
|
} = (*MessageReply)(nil)
|
|
|
|
// MarshalZAP writes MessageReply from constant offsets.
|
|
func (x *MessageReply) MarshalZAP() ([]byte, error) {
|
|
if x == nil {
|
|
return nil, nil
|
|
}
|
|
b := zap.NewBuilder(messageReplySize + 256)
|
|
ob := b.StartObject(messageReplySize)
|
|
if x.Message != nil {
|
|
innerMessage, err := x.Message.MarshalZAP()
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
ob.SetBytes(messageReplyMessageAt, innerMessage)
|
|
}
|
|
ob.SetBytes(messageReplySignatureAt, []byte(x.Signature))
|
|
ob.FinishAsRoot()
|
|
return b.Finish(), nil
|
|
}
|
|
|
|
// UnmarshalZAP reads MessageReply out of the buffer that arrived.
|
|
func (x *MessageReply) UnmarshalZAP(data []byte) error {
|
|
if x == nil || len(data) == 0 {
|
|
return nil
|
|
}
|
|
m, err := zap.Parse(data)
|
|
if err != nil {
|
|
return fmt.Errorf("MessageReply: %w", err)
|
|
}
|
|
o := m.Root()
|
|
if raw := o.Bytes(messageReplyMessageAt); len(raw) > 0 {
|
|
var v warp.UnsignedMessage
|
|
if err := v.UnmarshalZAP(raw); err != nil {
|
|
return err
|
|
}
|
|
x.Message = &v
|
|
}
|
|
x.Signature = []uint8(append([]byte(nil), o.Bytes(messageReplySignatureAt)...))
|
|
return nil
|
|
}
|
|
|
|
// ---- NetworkReply ------------------------------------------------------
|
|
|
|
const (
|
|
networkReplyNetworkIDAt = 0
|
|
networkReplyChainIDAt = 4
|
|
networkReplySize = 40
|
|
)
|
|
|
|
var _ interface {
|
|
MarshalZAP() ([]byte, error)
|
|
UnmarshalZAP([]byte) error
|
|
} = (*NetworkReply)(nil)
|
|
|
|
// MarshalZAP writes NetworkReply from constant offsets.
|
|
func (x *NetworkReply) MarshalZAP() ([]byte, error) {
|
|
if x == nil {
|
|
return nil, nil
|
|
}
|
|
b := zap.NewBuilder(networkReplySize + 256)
|
|
ob := b.StartObject(networkReplySize)
|
|
ob.SetUint32(networkReplyNetworkIDAt, uint32(x.NetworkID))
|
|
ob.SetBytesFixed(networkReplyChainIDAt, x.ChainID[:])
|
|
ob.FinishAsRoot()
|
|
return b.Finish(), nil
|
|
}
|
|
|
|
// UnmarshalZAP reads NetworkReply out of the buffer that arrived.
|
|
func (x *NetworkReply) UnmarshalZAP(data []byte) error {
|
|
if x == nil || len(data) == 0 {
|
|
return nil
|
|
}
|
|
m, err := zap.Parse(data)
|
|
if err != nil {
|
|
return fmt.Errorf("NetworkReply: %w", err)
|
|
}
|
|
o := m.Root()
|
|
x.NetworkID = uint32(o.Uint32(networkReplyNetworkIDAt))
|
|
copy(x.ChainID[:], o.BytesFixed(networkReplyChainIDAt, 32))
|
|
return nil
|
|
}
|
|
|
|
// ---- NonceArgs ---------------------------------------------------------
|
|
|
|
const (
|
|
nonceArgsAddressAt = 0
|
|
nonceArgsSize = 24
|
|
)
|
|
|
|
var _ interface {
|
|
MarshalZAP() ([]byte, error)
|
|
UnmarshalZAP([]byte) error
|
|
} = (*NonceArgs)(nil)
|
|
|
|
// MarshalZAP writes NonceArgs from constant offsets.
|
|
func (x *NonceArgs) MarshalZAP() ([]byte, error) {
|
|
if x == nil {
|
|
return nil, nil
|
|
}
|
|
b := zap.NewBuilder(nonceArgsSize + 256)
|
|
ob := b.StartObject(nonceArgsSize)
|
|
ob.SetBytesFixed(nonceArgsAddressAt, x.Address[:])
|
|
ob.FinishAsRoot()
|
|
return b.Finish(), nil
|
|
}
|
|
|
|
// UnmarshalZAP reads NonceArgs out of the buffer that arrived.
|
|
func (x *NonceArgs) UnmarshalZAP(data []byte) error {
|
|
if x == nil || len(data) == 0 {
|
|
return nil
|
|
}
|
|
m, err := zap.Parse(data)
|
|
if err != nil {
|
|
return fmt.Errorf("NonceArgs: %w", err)
|
|
}
|
|
o := m.Root()
|
|
copy(x.Address[:], o.BytesFixed(nonceArgsAddressAt, 20))
|
|
return nil
|
|
}
|
|
|
|
// ---- NonceReply --------------------------------------------------------
|
|
|
|
const (
|
|
nonceReplyNonceAt = 0
|
|
nonceReplySize = 8
|
|
)
|
|
|
|
var _ interface {
|
|
MarshalZAP() ([]byte, error)
|
|
UnmarshalZAP([]byte) error
|
|
} = (*NonceReply)(nil)
|
|
|
|
// MarshalZAP writes NonceReply from constant offsets.
|
|
func (x *NonceReply) MarshalZAP() ([]byte, error) {
|
|
if x == nil {
|
|
return nil, nil
|
|
}
|
|
b := zap.NewBuilder(nonceReplySize + 256)
|
|
ob := b.StartObject(nonceReplySize)
|
|
ob.SetUint64(nonceReplyNonceAt, uint64(x.Nonce))
|
|
ob.FinishAsRoot()
|
|
return b.Finish(), nil
|
|
}
|
|
|
|
// UnmarshalZAP reads NonceReply out of the buffer that arrived.
|
|
func (x *NonceReply) UnmarshalZAP(data []byte) error {
|
|
if x == nil || len(data) == 0 {
|
|
return nil
|
|
}
|
|
m, err := zap.Parse(data)
|
|
if err != nil {
|
|
return fmt.Errorf("NonceReply: %w", err)
|
|
}
|
|
o := m.Root()
|
|
x.Nonce = uint64(o.Uint64(nonceReplyNonceAt))
|
|
return nil
|
|
}
|