Files
zeekay 7cf87b230b node-unified is the node
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.
2026-09-07 16:15:25 -07:00

52 lines
1.6 KiB
Go

// Copyright (C) 2019-2025, Lux Industries Inc. All rights reserved.
// See the file LICENSE for licensing terms.
package payload
import (
"encoding/base64"
"testing"
"github.com/stretchr/testify/require"
"github.com/luxfi/ids"
"github.com/luxfi/zap"
)
func TestAddressedCall(t *testing.T) {
require := require.New(t)
shortID := ids.GenerateTestShortID()
addressedPayload, err := NewAddressedCall(
shortID[:],
[]byte{1, 2, 3},
)
require.NoError(err)
addressedPayloadBytes := addressedPayload.Bytes()
parsedAddressedPayload, err := ParseAddressedCall(addressedPayloadBytes)
require.NoError(err)
require.Equal(addressedPayload, parsedAddressedPayload)
}
func TestParseAddressedCallJunk(t *testing.T) {
_, err := ParseAddressedCall(junkBytes)
require.ErrorIs(t, err, zap.ErrBufferTooSmall)
}
// TestAddressedCallBytes pins the native-ZAP wire (golden generated from the
// struct-is-wire encoder at cutover; re-genesis retired the codec wire). Any
// future encoder change that shifts these bytes is a wire break — fail loudly.
func TestAddressedCallBytes(t *testing.T) {
require := require.New(t)
base64Payload := "WkFQAAIAAAAQAAAANAAAAAEQAAAAEAAAABgAAAADAAAAAQIDAAAAAAAAAAAAAAAAAAoLDA=="
addressedPayload, err := NewAddressedCall(
[]byte{1, 2, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
[]byte{10, 11, 12},
)
require.NoError(err)
require.Equal(base64Payload, base64.StdEncoding.EncodeToString(addressedPayload.Bytes()))
// structural pin: pkind discriminator sits at the first object byte.
require.Equal(uint8(pkindAddressedCall), addressedPayload.Bytes()[zap.HeaderSize])
}