corona → corona — final sweep (live source clean)

This commit is contained in:
Hanzo AI
2026-06-06 16:37:55 -07:00
parent f631cab2b8
commit b38d23a057
27 changed files with 1946 additions and 3305 deletions
+604
View File
@@ -0,0 +1,604 @@
// Copyright (C) 2019-2026, Lux Industries, Inc. All rights reserved.
// See the file LICENSE for licensing terms.
//go:build ignore
// Command regenfixtures regenerates wire-byte-anchored test fixtures
// after a wire-format change.
//
// Usage:
//
// go run ./internal/regenfixtures -pkg ./p/block
// go run ./internal/regenfixtures -pkg ./p/block -dry-run
// go run ./internal/regenfixtures -pkg ./p/block,./p/state
//
// Algorithm:
//
// 1. Run `go test -v -count=1 <pkg>` and capture stderr+stdout.
// 2. Parse each failure for `expected: []byte{...}` and `actual: []byte{...}`
// pairs (testify produces both in Not-equal failures).
// 3. For each `(expected, actual)` pair, scan the test files in <pkg>
// using go/parser to find every `[]byte{...}` composite literal.
// Decode each literal's byte values. If they match `expected`,
// rewrite that literal in-place with `actual`'s byte values
// formatted in canonical 16-bytes-per-line layout.
// 4. Emit a `// Regenerated post-LP-023 ZAP cutover` comment above
// each rewritten literal (idempotent — skip if already present).
//
// Design notes:
//
// - AST-based identification means comments inside the original
// literal (e.g. `// Codec version`) are dropped on regenerate.
// This is correct: the byte boundaries change with the wire
// format, so the prior comments would lie.
//
// - go/printer is not used to write the new literal because we want
// deterministic 16-bytes-per-line layout. We render the literal
// ourselves and string-splice it into the source.
//
// - We disambiguate composite literals by their byte payload, not
// their position. If the same expected bytes appear in multiple
// literals in the same file, all are rewritten to the same actual
// bytes. This is correct iff the test cases are uniquely keyed
// by their fixture — which is the case for every package we
// touch (a fixture is one block-or-tx's wire encoding).
package main
import (
"bytes"
"errors"
"flag"
"fmt"
"go/ast"
"go/parser"
"go/token"
"os"
"os/exec"
"path/filepath"
"regexp"
"sort"
"strconv"
"strings"
)
func main() {
var (
pkgFlag = flag.String("pkg", "", "comma-separated package paths to regenerate (relative to module root)")
dryRun = flag.Bool("dry-run", false, "report what would change without writing files")
verbose = flag.Bool("v", false, "verbose output")
annotateTag = flag.String("annotate", "Regenerated post-LP-023 ZAP cutover", "comment to add above rewritten literals")
)
flag.Parse()
if *pkgFlag == "" {
fmt.Fprintln(os.Stderr, "usage: regenfixtures -pkg <pkg1>[,<pkg2>...] [-dry-run] [-v]")
os.Exit(2)
}
pkgs := strings.Split(*pkgFlag, ",")
totalChanges := 0
totalFails := 0
for _, pkg := range pkgs {
pkg = strings.TrimSpace(pkg)
if pkg == "" {
continue
}
changes, fails, err := regenPackage(pkg, *dryRun, *verbose, *annotateTag)
if err != nil {
fmt.Fprintf(os.Stderr, "regenfixtures: %s: %v\n", pkg, err)
os.Exit(1)
}
totalChanges += changes
totalFails += fails
fmt.Printf("[%s] rewrote %d literal(s) across %d failure(s)\n", pkg, changes, fails)
}
fmt.Printf("\ntotal: %d literal(s) rewritten across %d failure(s)\n", totalChanges, totalFails)
}
func regenPackage(pkg string, dryRun, verbose bool, annotateTag string) (int, int, error) {
pairs, err := collectFailures(pkg, verbose)
if err != nil {
return 0, 0, fmt.Errorf("collect failures: %w", err)
}
if len(pairs) == 0 {
if verbose {
fmt.Printf("[%s] no Not-equal failures captured (package may already be green or fail before assertion)\n", pkg)
}
return 0, 0, nil
}
if verbose {
fmt.Printf("[%s] captured %d expected/actual pair(s)\n", pkg, len(pairs))
}
files, err := testFilesInPkg(pkg)
if err != nil {
return 0, 0, fmt.Errorf("enumerate test files: %w", err)
}
changes := 0
for _, file := range files {
n, err := rewriteFile(file, pairs, dryRun, verbose, annotateTag)
if err != nil {
return changes, len(pairs), fmt.Errorf("rewrite %s: %w", file, err)
}
changes += n
}
return changes, len(pairs), nil
}
// pair carries one expected/actual byte slice from a test failure.
type pair struct {
expected []byte
actual []byte
src string // free-form provenance (test name, file:line)
// kind indicates how this pair was scraped:
// "bytes" — testify Not-equal on []byte literals
// "string" — testify Not-equal on string literals (e.g. base64)
kind string
// raw versions of expected/actual as they appear in source — only
// populated for kind="string". For kind="bytes" we compare by the
// decoded byte payload, regardless of source formatting.
expectedRaw string
actualRaw string
}
// fingerprint returns a fixed-string for map keying on expected bytes.
func (p pair) fingerprint() string {
if p.kind == "string" {
return "s:" + p.expectedRaw
}
return "b:" + string(p.expected)
}
// collectFailures runs `go test -v -count=1` and parses Not-equal
// failures from the output.
func collectFailures(pkg string, verbose bool) ([]pair, error) {
cmd := exec.Command("go", "test", "-v", "-count=1", pkg)
out, _ := cmd.CombinedOutput()
if verbose {
fmt.Printf("--- go test output (%s, %d bytes) ---\n", pkg, len(out))
}
return parseFailures(string(out))
}
// reExpected matches `expected: []byte{...}` in testify Not-equal output.
var reExpected = regexp.MustCompile(`expected:\s*\[\]byte\{([^}]*)\}`)
var reActual = regexp.MustCompile(`actual\s*:\s*\[\]byte\{([^}]*)\}`)
var reTestLine = regexp.MustCompile(`Test:\s*(\S+)`)
var reErrTrace = regexp.MustCompile(`Error Trace:\s*(\S+)`)
// reExpectedString matches `expected: "..."` in testify Not-equal output.
// Strings are typically base64-encoded byte buffers in our test suite.
// We require the literal to be on its own line ending in `\n` to avoid
// pulling fragments out of multi-line strings.
var reExpectedString = regexp.MustCompile(`expected:\s*"([^"]*)"`)
var reActualString = regexp.MustCompile(`actual\s*:\s*"([^"]*)"`)
func parseFailures(output string) ([]pair, error) {
// Each failure block contains both an `expected:` and `actual:` line.
// We split on test boundaries and pull them in order. We don't
// require the lines to be adjacent — testify can interleave with
// the rendered Diff — but the next `actual:` after an `expected:`
// is its counterpart.
expectedMatches := reExpected.FindAllStringSubmatchIndex(output, -1)
actualMatches := reActual.FindAllStringSubmatchIndex(output, -1)
if len(expectedMatches) != len(actualMatches) {
// Not fatal — we pair what we can in order.
}
n := len(expectedMatches)
if len(actualMatches) < n {
n = len(actualMatches)
}
pairs := make([]pair, 0, n)
for i := 0; i < n; i++ {
expSrc := output[expectedMatches[i][2]:expectedMatches[i][3]]
actSrc := output[actualMatches[i][2]:actualMatches[i][3]]
exp, err := decodeGoByteList(expSrc)
if err != nil {
return nil, fmt.Errorf("parse expected: %w", err)
}
act, err := decodeGoByteList(actSrc)
if err != nil {
return nil, fmt.Errorf("parse actual: %w", err)
}
// Locate test name within the surrounding window.
windowStart := expectedMatches[i][0]
windowEnd := len(output)
if i+1 < len(expectedMatches) {
windowEnd = expectedMatches[i+1][0]
}
window := output[windowStart:windowEnd]
var src string
if m := reTestLine.FindStringSubmatch(window); m != nil {
src = m[1]
}
if m := reErrTrace.FindStringSubmatch(window); m != nil {
if src != "" {
src += " @ " + m[1]
} else {
src = m[1]
}
}
pairs = append(pairs, pair{expected: exp, actual: act, src: src, kind: "bytes"})
}
// Scrape string fixtures (e.g. base64-encoded byte buffers).
expectedStrMatches := reExpectedString.FindAllStringSubmatchIndex(output, -1)
actualStrMatches := reActualString.FindAllStringSubmatchIndex(output, -1)
nStr := len(expectedStrMatches)
if len(actualStrMatches) < nStr {
nStr = len(actualStrMatches)
}
for i := 0; i < nStr; i++ {
expSrc := output[expectedStrMatches[i][2]:expectedStrMatches[i][3]]
actSrc := output[actualStrMatches[i][2]:actualStrMatches[i][3]]
// Locate test name within the surrounding window.
windowStart := expectedStrMatches[i][0]
windowEnd := len(output)
if i+1 < len(expectedStrMatches) {
windowEnd = expectedStrMatches[i+1][0]
}
window := output[windowStart:windowEnd]
var src string
if m := reTestLine.FindStringSubmatch(window); m != nil {
src = m[1]
}
if m := reErrTrace.FindStringSubmatch(window); m != nil {
if src != "" {
src += " @ " + m[1]
} else {
src = m[1]
}
}
pairs = append(pairs, pair{
src: src,
kind: "string",
expectedRaw: expSrc,
actualRaw: actSrc,
})
}
// Deduplicate: same expected bytes can appear in many subtests
// (e.g., len(0) buffers); we want to map the union of expected→actual
// across all failures.
uniq := make(map[string]pair, len(pairs))
for _, p := range pairs {
key := p.fingerprint()
if existing, ok := uniq[key]; ok {
if !bytes.Equal(existing.actual, p.actual) {
return nil, fmt.Errorf(
"conflict: same expected bytes map to two different actual outputs (test1=%s, test2=%s)",
existing.src, p.src,
)
}
continue
}
uniq[key] = p
}
out := make([]pair, 0, len(uniq))
for _, p := range uniq {
out = append(out, p)
}
sort.Slice(out, func(i, j int) bool { return out[i].src < out[j].src })
return out, nil
}
// decodeGoByteList parses comma-separated Go byte literals like "0x0, 0x1, 0xff".
func decodeGoByteList(s string) ([]byte, error) {
s = strings.TrimSpace(s)
if s == "" {
return []byte{}, nil
}
parts := strings.Split(s, ",")
out := make([]byte, 0, len(parts))
for _, raw := range parts {
raw = strings.TrimSpace(raw)
if raw == "" {
continue
}
// Strip Go literal prefixes/suffixes — we only see 0x..
// or decimal here.
v, err := strconv.ParseUint(raw, 0, 8)
if err != nil {
return nil, fmt.Errorf("byte literal %q: %w", raw, err)
}
out = append(out, byte(v))
}
return out, nil
}
// testFilesInPkg lists *_test.go files in pkg (relative to module root).
func testFilesInPkg(pkg string) ([]string, error) {
dir, err := pkgDir(pkg)
if err != nil {
return nil, err
}
entries, err := os.ReadDir(dir)
if err != nil {
return nil, err
}
var out []string
for _, e := range entries {
if e.IsDir() {
continue
}
name := e.Name()
if strings.HasSuffix(name, "_test.go") {
out = append(out, filepath.Join(dir, name))
}
}
sort.Strings(out)
return out, nil
}
// pkgDir converts a Go package path like "./p/block" into a filesystem
// directory. We assume the current working directory IS the module
// root.
func pkgDir(pkg string) (string, error) {
pkg = strings.TrimPrefix(pkg, "./")
if pkg == "" || strings.HasPrefix(pkg, "/") {
return "", fmt.Errorf("invalid pkg path %q (must be relative to module root)", pkg)
}
if _, err := os.Stat(pkg); err != nil {
return "", fmt.Errorf("pkg dir %q: %w", pkg, err)
}
return pkg, nil
}
// rewriteFile rewrites every `[]byte{...}` literal in file whose decoded
// payload matches any pair's expected bytes. Returns the number of
// rewrites.
func rewriteFile(file string, pairs []pair, dryRun, verbose bool, annotateTag string) (int, error) {
src, err := os.ReadFile(file)
if err != nil {
return 0, err
}
fset := token.NewFileSet()
f, err := parser.ParseFile(fset, file, src, parser.ParseComments)
if err != nil {
// Best-effort: if parsing fails (e.g. syntax error introduced
// by earlier run), skip.
if verbose {
fmt.Printf(" parse %s: %v (skipping)\n", file, err)
}
return 0, nil
}
// Walk all CompositeLit nodes whose Type encodes []byte (either
// the literal `[]byte` or an alias resolving to it). We accept
// `[]byte` and `[]uint8`.
type rewrite struct {
startOff int // byte offset where replacement starts
endOff int // byte offset (exclusive) where replacement ends
newBytes []byte // replacement bytes (when !isString)
newStr string // replacement string literal (when isString)
isString bool // true if rewrite targets a string literal
oldHash string // for logging
}
var rewrites []rewrite
// Build a quick map of expected → actual for O(1) lookup.
wantBytes := make(map[string][]byte, len(pairs))
wantStrings := make(map[string]string, len(pairs))
for _, p := range pairs {
switch p.kind {
case "bytes":
wantBytes["b:"+string(p.expected)] = p.actual
case "string":
wantStrings["s:"+p.expectedRaw] = p.actualRaw
}
}
ast.Inspect(f, func(n ast.Node) bool {
// Byte slice composite literals.
if cl, ok := n.(*ast.CompositeLit); ok && cl.Type != nil && isByteSliceType(cl.Type) {
got, ok := decodeASTByteList(cl)
if !ok {
return true
}
actual, found := wantBytes["b:"+string(got)]
if !found {
return true
}
if bytes.Equal(got, actual) {
return true
}
lbrace := fset.Position(cl.Lbrace).Offset
rbrace := fset.Position(cl.Rbrace).Offset
rewrites = append(rewrites, rewrite{
startOff: lbrace,
endOff: rbrace + 1,
newBytes: actual,
oldHash: fmt.Sprintf("len=%d", len(got)),
})
return true
}
// String literals (e.g. base64-encoded byte buffers).
if bl, ok := n.(*ast.BasicLit); ok && bl.Kind == token.STRING {
unquoted, err := strconv.Unquote(bl.Value)
if err != nil {
return true
}
actual, found := wantStrings["s:"+unquoted]
if !found {
return true
}
if unquoted == actual {
return true
}
start := fset.Position(bl.Pos()).Offset
end := fset.Position(bl.End()).Offset
// Render quoted Go string literal with the new content.
replacement := strconv.Quote(actual)
rewrites = append(rewrites, rewrite{
startOff: start,
endOff: end,
newStr: replacement,
oldHash: fmt.Sprintf("strlen=%d", len(unquoted)),
isString: true,
})
return true
}
return true
})
if len(rewrites) == 0 {
return 0, nil
}
// Sort descending by start offset so we can splice in-place
// without invalidating earlier offsets.
sort.Slice(rewrites, func(i, j int) bool {
return rewrites[i].startOff > rewrites[j].startOff
})
if verbose {
fmt.Printf(" %s: %d literal(s) to rewrite\n", file, len(rewrites))
}
out := make([]byte, len(src))
copy(out, src)
for _, rw := range rewrites {
var replacement string
if rw.isString {
replacement = rw.newStr
} else {
replacement = renderByteLiteral(rw.newBytes, computeIndent(out, rw.startOff))
}
out = append(out[:rw.startOff], append([]byte(replacement), out[rw.endOff:]...)...)
}
// Optionally annotate: walk the literals once more from a fresh
// parse and prepend the comment if not already present. To keep
// the tool simple and deterministic, we skip annotation here —
// the regenerator's commit message and this tool's docstring
// document the wire-format change.
_ = annotateTag
if dryRun {
fmt.Printf("[dry-run] %s: would rewrite %d literal(s)\n", file, len(rewrites))
return len(rewrites), nil
}
if err := os.WriteFile(file, out, 0o644); err != nil {
return 0, err
}
return len(rewrites), nil
}
// isByteSliceType returns true for `[]byte` or `[]uint8`.
func isByteSliceType(e ast.Expr) bool {
arr, ok := e.(*ast.ArrayType)
if !ok {
return false
}
if arr.Len != nil {
return false
}
ident, ok := arr.Elt.(*ast.Ident)
if !ok {
return false
}
return ident.Name == "byte" || ident.Name == "uint8"
}
// decodeASTByteList decodes the elements of a []byte composite literal
// into raw bytes. Returns (bytes, true) on success. Returns false if
// the literal contains an unparseable element (an identifier reference,
// a slice expression, etc.). Accepts:
// - integer literals: 0x00, 42, 0o77
// - char literals: 'n' (decoded as rune)
// - string literals: "abc" (decoded as UTF-8 bytes)
func decodeASTByteList(cl *ast.CompositeLit) ([]byte, bool) {
out := make([]byte, 0, len(cl.Elts))
for _, elt := range cl.Elts {
bl, ok := elt.(*ast.BasicLit)
if !ok {
return nil, false
}
switch bl.Kind {
case token.INT:
v, err := strconv.ParseUint(bl.Value, 0, 8)
if err != nil {
return nil, false
}
out = append(out, byte(v))
case token.CHAR:
r, _, _, err := strconv.UnquoteChar(bl.Value[1:len(bl.Value)-1], '\'')
if err != nil {
return nil, false
}
if r > 0xff {
return nil, false
}
out = append(out, byte(r))
case token.STRING:
unquoted, err := strconv.Unquote(bl.Value)
if err != nil {
return nil, false
}
out = append(out, []byte(unquoted)...)
default:
return nil, false
}
}
return out, true
}
// computeIndent returns the whitespace from the start of the line up
// to offset. Used to indent multi-line literal content.
func computeIndent(src []byte, offset int) string {
lineStart := offset
for lineStart > 0 && src[lineStart-1] != '\n' {
lineStart--
}
// Indent is everything up to the first non-tab/space character
// on the line, OR up to offset, whichever is shorter.
indent := []byte{}
for i := lineStart; i < offset; i++ {
ch := src[i]
if ch == '\t' || ch == ' ' {
indent = append(indent, ch)
continue
}
break
}
return string(indent)
}
// renderByteLiteral renders a `{ 0x.., 0x.., ... }` body with one
// byte per line at 16 bytes per group, indented one tab deeper than
// the literal's opening `{`.
func renderByteLiteral(b []byte, indent string) string {
if len(b) == 0 {
return "{}"
}
innerIndent := indent + "\t"
var sb strings.Builder
sb.WriteString("{\n")
for i, v := range b {
if i%16 == 0 {
sb.WriteString(innerIndent)
}
fmt.Fprintf(&sb, "0x%02x,", v)
if i == len(b)-1 || (i+1)%16 == 0 {
sb.WriteByte('\n')
} else {
sb.WriteByte(' ')
}
}
sb.WriteString(indent)
sb.WriteByte('}')
return sb.String()
}
func init() {
// Defensive: any unexpected runtime panic should be surfaced
// with the tool's own banner.
if false {
_ = errors.New("unused")
}
}
+17 -48
View File
@@ -36,20 +36,11 @@ func TestBanffBlockSerialization(t *testing.T) {
},
},
bytes: []byte{
// Codec version
0x00, 0x00,
// Type ID
0x00, 0x00, 0x00, 0x1d,
// Rest
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x13,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
},
},
{
@@ -57,17 +48,10 @@ func TestBanffBlockSerialization(t *testing.T) {
ApricotCommitBlock: block.ApricotCommitBlock{},
},
bytes: []byte{
// Codec version
0x00, 0x00,
// Type ID
0x00, 0x00, 0x00, 0x1f,
// Rest
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
},
},
{
@@ -75,17 +59,10 @@ func TestBanffBlockSerialization(t *testing.T) {
ApricotAbortBlock: block.ApricotAbortBlock{},
},
bytes: []byte{
// Codec version
0x00, 0x00,
// Type ID
0x00, 0x00, 0x00, 0x1e,
// Rest
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
},
},
{
@@ -95,18 +72,10 @@ func TestBanffBlockSerialization(t *testing.T) {
},
},
bytes: []byte{
// Codec version
0x00, 0x00,
// Type ID
0x00, 0x00, 0x00, 0x20,
// Rest
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
},
},
}
+4 -12
View File
@@ -35,12 +35,8 @@ func TestParseDelegatorMetadata(t *testing.T) {
{
name: "potential reward + staker start time with codec v1",
bytes: []byte{
// codec version
0x00, 0x01,
// potential reward
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7b,
// staker start time
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0xc8,
0x01, 0x00, 0x7b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc8, 0x01, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00,
},
expected: &delegatorMetadata{
PotentialReward: 123,
@@ -118,12 +114,8 @@ func TestWriteDelegatorMetadata(t *testing.T) {
StakerStartTime: 456,
},
expected: []byte{
// codec version
0x00, 0x01,
// potential reward
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7b,
// staker start time
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0xc8,
0x01, 0x00, 0x7b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc8, 0x01, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00,
},
},
}
+9 -16
View File
@@ -195,15 +195,12 @@ func TestParseValidatorMetadata(t *testing.T) {
},
{
name: "pre-delegatee reward",
// Regenerated post-LP-023 ZAP cutover (LE wire format).
bytes: []byte{
// codec version
0x00, 0x00, 0x80, 0x8d, 0x5b, 0x00, 0x00, 0x00,
0x00, 0x00, 0xa0, 0xbb, 0x0d, 0x00, 0x00, 0x00,
0x00, 0x00, 0xa0, 0x86, 0x01, 0x00, 0x00, 0x00,
0x00, 0x00,
// up duration
0x00, 0x00, 0x00, 0x00, 0x00, 0x5B, 0x8D, 0x80,
// last updated
0x00, 0x00, 0x00, 0x00, 0x00, 0x0D, 0xBB, 0xA0,
// potential reward
0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x86, 0xA0,
},
expected: &validatorMetadata{
UpDuration: time.Duration(6000000),
@@ -214,17 +211,13 @@ func TestParseValidatorMetadata(t *testing.T) {
},
{
name: "potential delegatee reward",
// Regenerated post-LP-023 ZAP cutover (LE wire format).
bytes: []byte{
// codec version
0x00, 0x00, 0x80, 0x8d, 0x5b, 0x00, 0x00, 0x00,
0x00, 0x00, 0xa0, 0xbb, 0x0d, 0x00, 0x00, 0x00,
0x00, 0x00, 0xa0, 0x86, 0x01, 0x00, 0x00, 0x00,
0x00, 0x00, 0x20, 0x4e, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00,
// up duration
0x00, 0x00, 0x00, 0x00, 0x00, 0x5B, 0x8D, 0x80,
// last updated
0x00, 0x00, 0x00, 0x00, 0x00, 0x0D, 0xBB, 0xA0,
// potential reward
0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x86, 0xA0,
// potential delegatee reward
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x4E, 0x20,
},
expected: &validatorMetadata{
UpDuration: time.Duration(6000000),
+62
View File
@@ -0,0 +1,62 @@
// Copyright (C) 2019-2026, Lux Industries, Inc. All rights reserved.
// See the file LICENSE for licensing terms.
//go:build emit_fixtures
package state
import (
"encoding/hex"
"fmt"
"testing"
"time"
"github.com/luxfi/proto/internal/pvmcodectest"
)
// TestEmitValidatorMetadataFixtures emits the ZAP-native wire bytes for
// the validator-metadata fixtures used by TestParseValidatorMetadata.
// Run via `go test -tags emit_fixtures -run TestEmitValidatorMetadataFixtures -v`
// to capture the regenerated wire bytes, then paste them into
// metadata_validator_test.go.
func TestEmitValidatorMetadataFixtures(t *testing.T) {
c := pvmcodectest.NewMetadataCodec()
type emit struct {
name string
value interface{}
codecVer uint16
}
cases := []emit{
{
name: "pre-delegatee reward",
value: &preDelegateeRewardMetadata{
UpDuration: time.Duration(6000000),
LastUpdated: 900000,
PotentialReward: 100000,
},
codecVer: CodecVersion0,
},
{
name: "potential delegatee reward",
value: &validatorMetadata{
UpDuration: time.Duration(6000000),
LastUpdated: 900000,
PotentialReward: 100000,
PotentialDelegateeReward: 20000,
},
codecVer: CodecVersion0,
},
}
for _, c0 := range cases {
t.Run(c0.name, func(t *testing.T) {
b, err := c.Marshal(c0.codecVer, c0.value)
if err != nil {
t.Fatalf("Marshal %s: %v", c0.name, err)
}
fmt.Printf("EMIT_FIXTURE: %s = %s\n", c0.name, hex.EncodeToString(b))
})
}
}
+155 -623
View File
@@ -141,92 +141,28 @@ func TestAddPermissionlessPrimaryDelegatorSerialization(t *testing.T) {
require.NoError(simpleAddPrimaryTx.SyntacticVerify(rt))
expectedUnsignedSimpleAddPrimaryTxBytes := []byte{
// Codec version
0x00, 0x00,
// AddPermissionlessDelegatorTx type ID
0x00, 0x00, 0x00, 0x1a,
// Mainnet network ID
0x00, 0x00, 0x00, 0x01,
// P-chain blockchain ID
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
// Number of immediate outputs
0x00, 0x00, 0x00, 0x00,
// Number of inputs
0x00, 0x00, 0x00, 0x01,
// inputs[0]
// TxID
0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88,
0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88,
0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88,
0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88,
// Tx output index
0x00, 0x00, 0x00, 0x01,
// Mainnet LUX asset ID
0x51, 0xc2, 0x4f, 0xe7, 0xee, 0x02, 0x01, 0xff,
0x0f, 0x33, 0x5f, 0x51, 0x99, 0x28, 0xdb, 0x6e,
0xef, 0x62, 0x24, 0x25, 0x45, 0x52, 0xc9, 0x6b,
0x6b, 0x42, 0x5f, 0xbc, 0x18, 0xfa, 0x24, 0x3b,
// secp256k1fx transfer input type ID
0x00, 0x00, 0x00, 0x05,
// Amount = 2k LUX
0x00, 0x00, 0x00, 0x00, 0x77, 0x35, 0x94, 0x00,
// Number of input signature indices
0x00, 0x00, 0x00, 0x01,
// signature index
0x00, 0x00, 0x00, 0x01,
// memo length
0x00, 0x00, 0x00, 0x00,
// NodeID
0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88,
0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88,
0x11, 0x22, 0x33, 0x44,
// Start time
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x39,
// End time
0x00, 0x00, 0x00, 0x00, 0x01, 0x07, 0xdc, 0x39,
// Stake weight
0x00, 0x00, 0x00, 0x00, 0x77, 0x35, 0x94, 0x00,
// Primary network netID
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
// Number of locked outputs
0x00, 0x00, 0x00, 0x01,
// Mainnet LUX asset ID
0x51, 0xc2, 0x4f, 0xe7, 0xee, 0x02, 0x01, 0xff,
0x0f, 0x33, 0x5f, 0x51, 0x99, 0x28, 0xdb, 0x6e,
0xef, 0x62, 0x24, 0x25, 0x45, 0x52, 0xc9, 0x6b,
0x6b, 0x42, 0x5f, 0xbc, 0x18, 0xfa, 0x24, 0x3b,
// secp256k1fx transferable output type ID
0x00, 0x00, 0x00, 0x07,
// amount
0x00, 0x00, 0x00, 0x00, 0x77, 0x35, 0x94, 0x00,
// locktime
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
// threshold
0x00, 0x00, 0x00, 0x01,
// number of addresses
0x00, 0x00, 0x00, 0x01,
// addresses[0]
0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xaa, 0xbb,
0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xaa, 0xbb,
0x44, 0x55, 0x66, 0x77,
// secp256k1fx owner type ID
0x00, 0x00, 0x00, 0x0b,
// locktime
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
// threshold
0x00, 0x00, 0x00, 0x01,
// number of addresses
0x00, 0x00, 0x00, 0x01,
// addresses[0]
0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xaa, 0xbb,
0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xaa, 0xbb,
0x44, 0x55, 0x66, 0x77,
0x00, 0x00, 0x1a, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00,
0x00, 0x00, 0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88, 0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa,
0x99, 0x88, 0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88, 0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa,
0x99, 0x88, 0x01, 0x00, 0x00, 0x00, 0x51, 0xc2, 0x4f, 0xe7, 0xee, 0x02, 0x01, 0xff, 0x0f, 0x33,
0x5f, 0x51, 0x99, 0x28, 0xdb, 0x6e, 0xef, 0x62, 0x24, 0x25, 0x45, 0x52, 0xc9, 0x6b, 0x6b, 0x42,
0x5f, 0xbc, 0x18, 0xfa, 0x24, 0x3b, 0x05, 0x00, 0x00, 0x00, 0x00, 0x94, 0x35, 0x77, 0x00, 0x00,
0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x11, 0x22,
0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x11, 0x22,
0x33, 0x44, 0x39, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x39, 0xdc, 0x07, 0x01, 0x00, 0x00,
0x00, 0x00, 0x00, 0x94, 0x35, 0x77, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x51, 0xc2,
0x4f, 0xe7, 0xee, 0x02, 0x01, 0xff, 0x0f, 0x33, 0x5f, 0x51, 0x99, 0x28, 0xdb, 0x6e, 0xef, 0x62,
0x24, 0x25, 0x45, 0x52, 0xc9, 0x6b, 0x6b, 0x42, 0x5f, 0xbc, 0x18, 0xfa, 0x24, 0x3b, 0x07, 0x00,
0x00, 0x00, 0x00, 0x94, 0x35, 0x77, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99,
0xaa, 0xbb, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xaa, 0xbb, 0x44, 0x55, 0x66, 0x77, 0x0b, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00,
0x00, 0x00, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xaa, 0xbb, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99,
0xaa, 0xbb, 0x44, 0x55, 0x66, 0x77,
}
var unsignedSimpleAddPrimaryTx UnsignedTx = simpleAddPrimaryTx
unsignedSimpleAddPrimaryTxBytes, err := testCodec.Marshal(CodecVersion, &unsignedSimpleAddPrimaryTx)
@@ -397,221 +333,59 @@ func TestAddPermissionlessPrimaryDelegatorSerialization(t *testing.T) {
require.NoError(complexAddPrimaryTx.SyntacticVerify(rt))
expectedUnsignedComplexAddPrimaryTxBytes := []byte{
// Codec version
0x00, 0x00,
// AddPermissionlessDelegatorTx type ID
0x00, 0x00, 0x00, 0x1a,
// Mainnet network ID
0x00, 0x00, 0x00, 0x01,
// P-chain blockchain ID (31 zeros + 'P')
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x50,
// Number of immediate outputs
0x00, 0x00, 0x00, 0x03,
// outputs[0]
// Mainnet LUX asset ID
0x51, 0xc2, 0x4f, 0xe7, 0xee, 0x02, 0x01, 0xff,
0x0f, 0x33, 0x5f, 0x51, 0x99, 0x28, 0xdb, 0x6e,
0xef, 0x62, 0x24, 0x25, 0x45, 0x52, 0xc9, 0x6b,
0x6b, 0x42, 0x5f, 0xbc, 0x18, 0xfa, 0x24, 0x3b,
// secp256k1fx transfer output type ID
0x00, 0x00, 0x00, 0x07,
// amount
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
// locktime
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
// threshold
0x00, 0x00, 0x00, 0x01,
// number of addresses
0x00, 0x00, 0x00, 0x01,
// addresses[0]
0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xaa, 0xbb,
0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xaa, 0xbb,
0x44, 0x55, 0x66, 0x77,
// outputs[1]
// Mainnet LUX asset ID
0x51, 0xc2, 0x4f, 0xe7, 0xee, 0x02, 0x01, 0xff,
0x0f, 0x33, 0x5f, 0x51, 0x99, 0x28, 0xdb, 0x6e,
0xef, 0x62, 0x24, 0x25, 0x45, 0x52, 0xc9, 0x6b,
0x6b, 0x42, 0x5f, 0xbc, 0x18, 0xfa, 0x24, 0x3b,
// stakeable locked output type ID
0x00, 0x00, 0x00, 0x16,
// locktime
0x00, 0x00, 0x00, 0x00, 0x05, 0x39, 0x7f, 0xb1,
// secp256k1fx transfer output type ID
0x00, 0x00, 0x00, 0x07,
// amount
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
// locktime
0x00, 0x00, 0x00, 0x00, 0x00, 0xbc, 0x61, 0x4e,
// threshold
0x00, 0x00, 0x00, 0x00,
// number of addresses
0x00, 0x00, 0x00, 0x00,
// outputs[2]
// custom asset ID
0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31,
0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31,
0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31,
0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31,
// stakeable locked output type ID
0x00, 0x00, 0x00, 0x16,
// locktime
0x00, 0x00, 0x00, 0x00, 0x34, 0x3e, 0xfc, 0xea,
// secp256k1fx transfer output type ID
0x00, 0x00, 0x00, 0x07,
// amount
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
// locktime
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
// threshold
0x00, 0x00, 0x00, 0x01,
// number of addresses
0x00, 0x00, 0x00, 0x01,
// address[0]
0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xaa, 0xbb,
0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xaa, 0xbb,
0x44, 0x55, 0x66, 0x77,
// number of inputs
0x00, 0x00, 0x00, 0x03,
// inputs[0]
// TxID
0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88,
0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88,
0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88,
0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88,
// Tx output index
0x00, 0x00, 0x00, 0x01,
// Mainnet LUX asset ID
0x51, 0xc2, 0x4f, 0xe7, 0xee, 0x02, 0x01, 0xff,
0x0f, 0x33, 0x5f, 0x51, 0x99, 0x28, 0xdb, 0x6e,
0xef, 0x62, 0x24, 0x25, 0x45, 0x52, 0xc9, 0x6b,
0x6b, 0x42, 0x5f, 0xbc, 0x18, 0xfa, 0x24, 0x3b,
// secp256k1fx transfer input type ID
0x00, 0x00, 0x00, 0x05,
// amount
0x00, 0x00, 0x00, 0xe8, 0xd4, 0xa5, 0x10, 0x00,
// number of signature indices
0x00, 0x00, 0x00, 0x02,
// first signature index
0x00, 0x00, 0x00, 0x02,
// second signature index
0x00, 0x00, 0x00, 0x05,
// inputs[1]
// TxID
0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88,
0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88,
0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88,
0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88,
// Tx output index
0x00, 0x00, 0x00, 0x02,
// custom asset ID
0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31,
0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31,
0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31,
0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31,
// stakeable locked input type ID
0x00, 0x00, 0x00, 0x15,
// locktime
0x00, 0x00, 0x00, 0x00, 0x34, 0x3e, 0xfc, 0xea,
// secp256k1fx transfer input type ID
0x00, 0x00, 0x00, 0x05,
// amount
0xef, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
// number of signature indices
0x00, 0x00, 0x00, 0x01,
// signature index
0x00, 0x00, 0x00, 0x00,
// inputs[2]
// TxID
0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88,
0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88,
0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88,
0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88,
// Tx output index
0x00, 0x00, 0x00, 0x03,
// custom asset ID
0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31,
0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31,
0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31,
0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31,
// secp256k1 transfer input type ID
0x00, 0x00, 0x00, 0x05,
// amount
0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
// number of signature indices
0x00, 0x00, 0x00, 0x00,
// memo length
0x00, 0x00, 0x00, 0x14,
// memo
0xf0, 0x9f, 0x98, 0x85, 0x0a, 0x77, 0x65, 0x6c,
0x6c, 0x20, 0x74, 0x68, 0x61, 0x74, 0x27, 0x73,
0x01, 0x23, 0x45, 0x21,
// nodeID
0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88,
0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88,
0x11, 0x22, 0x33, 0x44,
// Start time
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x39,
// End time
0x00, 0x00, 0x00, 0x00, 0x01, 0x07, 0xdc, 0x39,
// Stake weight
0x00, 0x00, 0x00, 0x01, 0x2a, 0x05, 0xf2, 0x00,
// Primary Network net ID
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
// number of locked outputs
0x00, 0x00, 0x00, 0x02,
// Mainnet LUX asset ID
0x51, 0xc2, 0x4f, 0xe7, 0xee, 0x02, 0x01, 0xff,
0x0f, 0x33, 0x5f, 0x51, 0x99, 0x28, 0xdb, 0x6e,
0xef, 0x62, 0x24, 0x25, 0x45, 0x52, 0xc9, 0x6b,
0x6b, 0x42, 0x5f, 0xbc, 0x18, 0xfa, 0x24, 0x3b,
// secp256k1 transfer output type ID
0x00, 0x00, 0x00, 0x07,
// amount
0x00, 0x00, 0x00, 0x00, 0x77, 0x35, 0x94, 0x00,
// locktime
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
// threshold
0x00, 0x00, 0x00, 0x01,
// number of addresses
0x00, 0x00, 0x00, 0x01,
// addresses[0]
0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xaa, 0xbb,
0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xaa, 0xbb,
0x44, 0x55, 0x66, 0x77,
// Mainnet LUX asset ID
0x51, 0xc2, 0x4f, 0xe7, 0xee, 0x02, 0x01, 0xff,
0x0f, 0x33, 0x5f, 0x51, 0x99, 0x28, 0xdb, 0x6e,
0xef, 0x62, 0x24, 0x25, 0x45, 0x52, 0xc9, 0x6b,
0x6b, 0x42, 0x5f, 0xbc, 0x18, 0xfa, 0x24, 0x3b,
// stakeable locked output type ID
0x00, 0x00, 0x00, 0x16,
// locktime
0x00, 0x00, 0x00, 0x00, 0x3a, 0xde, 0x68, 0xb1,
// secp256k1 transfer output type ID
0x00, 0x00, 0x00, 0x07,
// amount
0x00, 0x00, 0x00, 0x00, 0xb2, 0xd0, 0x5e, 0x00,
// locktime
0x00, 0x00, 0x00, 0x00, 0x05, 0x39, 0x7f, 0xb1,
// threshold
0x00, 0x00, 0x00, 0x00,
// number of addresses
0x00, 0x00, 0x00, 0x00,
// secp256k1 owner type ID
0x00, 0x00, 0x00, 0x0b,
// locktime
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
// threshold
0x00, 0x00, 0x00, 0x00,
// number of addresses
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x1a, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x50, 0x03, 0x00, 0x00, 0x00, 0x51, 0xc2,
0x4f, 0xe7, 0xee, 0x02, 0x01, 0xff, 0x0f, 0x33, 0x5f, 0x51, 0x99, 0x28, 0xdb, 0x6e, 0xef, 0x62,
0x24, 0x25, 0x45, 0x52, 0xc9, 0x6b, 0x6b, 0x42, 0x5f, 0xbc, 0x18, 0xfa, 0x24, 0x3b, 0x07, 0x00,
0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99,
0xaa, 0xbb, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xaa, 0xbb, 0x44, 0x55, 0x66, 0x77, 0x51, 0xc2,
0x4f, 0xe7, 0xee, 0x02, 0x01, 0xff, 0x0f, 0x33, 0x5f, 0x51, 0x99, 0x28, 0xdb, 0x6e, 0xef, 0x62,
0x24, 0x25, 0x45, 0x52, 0xc9, 0x6b, 0x6b, 0x42, 0x5f, 0xbc, 0x18, 0xfa, 0x24, 0x3b, 0x16, 0x00,
0x00, 0x00, 0xb1, 0x7f, 0x39, 0x05, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x01, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x4e, 0x61, 0xbc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31, 0x99, 0x77,
0x55, 0x77, 0x11, 0x33, 0x55, 0x31, 0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31, 0x99, 0x77,
0x55, 0x77, 0x11, 0x33, 0x55, 0x31, 0x16, 0x00, 0x00, 0x00, 0xea, 0xfc, 0x3e, 0x34, 0x00, 0x00,
0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x44, 0x55,
0x66, 0x77, 0x88, 0x99, 0xaa, 0xbb, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xaa, 0xbb, 0x44, 0x55,
0x66, 0x77, 0x03, 0x00, 0x00, 0x00, 0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88, 0xff, 0xee,
0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88, 0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88, 0xff, 0xee,
0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88, 0x01, 0x00, 0x00, 0x00, 0x51, 0xc2, 0x4f, 0xe7, 0xee, 0x02,
0x01, 0xff, 0x0f, 0x33, 0x5f, 0x51, 0x99, 0x28, 0xdb, 0x6e, 0xef, 0x62, 0x24, 0x25, 0x45, 0x52,
0xc9, 0x6b, 0x6b, 0x42, 0x5f, 0xbc, 0x18, 0xfa, 0x24, 0x3b, 0x05, 0x00, 0x00, 0x00, 0x00, 0x10,
0xa5, 0xd4, 0xe8, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x05, 0x00,
0x00, 0x00, 0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88, 0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa,
0x99, 0x88, 0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88, 0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa,
0x99, 0x88, 0x02, 0x00, 0x00, 0x00, 0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31, 0x99, 0x77,
0x55, 0x77, 0x11, 0x33, 0x55, 0x31, 0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31, 0x99, 0x77,
0x55, 0x77, 0x11, 0x33, 0x55, 0x31, 0x15, 0x00, 0x00, 0x00, 0xea, 0xfc, 0x3e, 0x34, 0x00, 0x00,
0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xef, 0x01, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88, 0xff, 0xee,
0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88, 0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88, 0xff, 0xee,
0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88, 0x03, 0x00, 0x00, 0x00, 0x99, 0x77, 0x55, 0x77, 0x11, 0x33,
0x55, 0x31, 0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31, 0x99, 0x77, 0x55, 0x77, 0x11, 0x33,
0x55, 0x31, 0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0xf0, 0x9f,
0x98, 0x85, 0x0a, 0x77, 0x65, 0x6c, 0x6c, 0x20, 0x74, 0x68, 0x61, 0x74, 0x27, 0x73, 0x01, 0x23,
0x45, 0x21, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66,
0x77, 0x88, 0x11, 0x22, 0x33, 0x44, 0x39, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x39, 0xdc,
0x07, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf2, 0x05, 0x2a, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00,
0x00, 0x00, 0x51, 0xc2, 0x4f, 0xe7, 0xee, 0x02, 0x01, 0xff, 0x0f, 0x33, 0x5f, 0x51, 0x99, 0x28,
0xdb, 0x6e, 0xef, 0x62, 0x24, 0x25, 0x45, 0x52, 0xc9, 0x6b, 0x6b, 0x42, 0x5f, 0xbc, 0x18, 0xfa,
0x24, 0x3b, 0x07, 0x00, 0x00, 0x00, 0x00, 0x94, 0x35, 0x77, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x44, 0x55,
0x66, 0x77, 0x88, 0x99, 0xaa, 0xbb, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xaa, 0xbb, 0x44, 0x55,
0x66, 0x77, 0x51, 0xc2, 0x4f, 0xe7, 0xee, 0x02, 0x01, 0xff, 0x0f, 0x33, 0x5f, 0x51, 0x99, 0x28,
0xdb, 0x6e, 0xef, 0x62, 0x24, 0x25, 0x45, 0x52, 0xc9, 0x6b, 0x6b, 0x42, 0x5f, 0xbc, 0x18, 0xfa,
0x24, 0x3b, 0x16, 0x00, 0x00, 0x00, 0xb1, 0x68, 0xde, 0x3a, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00,
0x00, 0x00, 0x00, 0x5e, 0xd0, 0xb2, 0x00, 0x00, 0x00, 0x00, 0xb1, 0x7f, 0x39, 0x05, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
}
var unsignedComplexAddPrimaryTx UnsignedTx = complexAddPrimaryTx
unsignedComplexAddPrimaryTxBytes, err := testCodec.Marshal(CodecVersion, &unsignedComplexAddPrimaryTx)
@@ -888,113 +662,33 @@ func TestAddPermissionlessNetDelegatorSerialization(t *testing.T) {
require.NoError(simpleAddNetTx.SyntacticVerify(rt))
expectedUnsignedSimpleAddNetTxBytes := []byte{
// Codec version
0x00, 0x00,
// AddPermissionlessDelegationTx type ID
0x00, 0x00, 0x00, 0x1a,
// Mainnet network ID
0x00, 0x00, 0x00, 0x01,
// P-chain blockchain ID (31 zeros + 'P')
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x50,
// Number of immediate outputs
0x00, 0x00, 0x00, 0x00,
// Number of inputs
0x00, 0x00, 0x00, 0x02,
// inputs[0]
// TxID
0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88,
0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88,
0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88,
0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88,
// Tx output index
0x00, 0x00, 0x00, 0x01,
// Mainnet LUX asset ID
0x51, 0xc2, 0x4f, 0xe7, 0xee, 0x02, 0x01, 0xff,
0x0f, 0x33, 0x5f, 0x51, 0x99, 0x28, 0xdb, 0x6e,
0xef, 0x62, 0x24, 0x25, 0x45, 0x52, 0xc9, 0x6b,
0x6b, 0x42, 0x5f, 0xbc, 0x18, 0xfa, 0x24, 0x3b,
// secp256k1fx transfer input type ID
0x00, 0x00, 0x00, 0x05,
// Amount = 1 MilliLUX
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0xe8,
// Number of input signature indices
0x00, 0x00, 0x00, 0x01,
// signature index
0x00, 0x00, 0x00, 0x01,
// inputs[1]
// TxID
0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88,
0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88,
0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88,
0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88,
// Tx output index
0x00, 0x00, 0x00, 0x02,
// custom asset ID
0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31,
0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31,
0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31,
0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31,
// secp256k1fx transfer input type ID
0x00, 0x00, 0x00, 0x05,
// Amount
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
// Number of input signature indices
0x00, 0x00, 0x00, 0x01,
// signature index
0x00, 0x00, 0x00, 0x01,
// memo length
0x00, 0x00, 0x00, 0x00,
// NodeID
0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88,
0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88,
0x11, 0x22, 0x33, 0x44,
// Start time
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x39,
// End time
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x3a,
// Stake weight
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
// NetID
0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08,
0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18,
0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28,
0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38,
// Number of locked outputs
0x00, 0x00, 0x00, 0x01,
// custom asset ID
0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31,
0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31,
0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31,
0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31,
// secp256k1fx transferable output type ID
0x00, 0x00, 0x00, 0x07,
// amount
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
// locktime
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
// threshold
0x00, 0x00, 0x00, 0x01,
// number of addresses
0x00, 0x00, 0x00, 0x01,
// addresses[0]
0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xaa, 0xbb,
0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xaa, 0xbb,
0x44, 0x55, 0x66, 0x77,
// secp256k1fx owner type ID
0x00, 0x00, 0x00, 0x0b,
// locktime
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
// threshold
0x00, 0x00, 0x00, 0x01,
// number of addresses
0x00, 0x00, 0x00, 0x01,
// addresses[0]
0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xaa, 0xbb,
0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xaa, 0xbb,
0x44, 0x55, 0x66, 0x77,
0x00, 0x00, 0x1a, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x50, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00,
0x00, 0x00, 0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88, 0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa,
0x99, 0x88, 0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88, 0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa,
0x99, 0x88, 0x01, 0x00, 0x00, 0x00, 0x51, 0xc2, 0x4f, 0xe7, 0xee, 0x02, 0x01, 0xff, 0x0f, 0x33,
0x5f, 0x51, 0x99, 0x28, 0xdb, 0x6e, 0xef, 0x62, 0x24, 0x25, 0x45, 0x52, 0xc9, 0x6b, 0x6b, 0x42,
0x5f, 0xbc, 0x18, 0xfa, 0x24, 0x3b, 0x05, 0x00, 0x00, 0x00, 0xe8, 0x03, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa,
0x99, 0x88, 0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88, 0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa,
0x99, 0x88, 0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88, 0x02, 0x00, 0x00, 0x00, 0x99, 0x77,
0x55, 0x77, 0x11, 0x33, 0x55, 0x31, 0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31, 0x99, 0x77,
0x55, 0x77, 0x11, 0x33, 0x55, 0x31, 0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31, 0x05, 0x00,
0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x11, 0x22,
0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x11, 0x22, 0x33, 0x44, 0x39, 0x30, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x3a, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16,
0x17, 0x18, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36,
0x37, 0x38, 0x01, 0x00, 0x00, 0x00, 0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31, 0x99, 0x77,
0x55, 0x77, 0x11, 0x33, 0x55, 0x31, 0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31, 0x99, 0x77,
0x55, 0x77, 0x11, 0x33, 0x55, 0x31, 0x07, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00,
0x00, 0x00, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xaa, 0xbb, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99,
0xaa, 0xbb, 0x44, 0x55, 0x66, 0x77, 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99,
0xaa, 0xbb, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xaa, 0xbb, 0x44, 0x55, 0x66, 0x77,
}
var unsignedSimpleAddNetTx UnsignedTx = simpleAddNetTx
unsignedSimpleAddNetTxBytes, err := testCodec.Marshal(CodecVersion, &unsignedSimpleAddNetTx)
@@ -1165,221 +859,59 @@ func TestAddPermissionlessNetDelegatorSerialization(t *testing.T) {
require.NoError(complexAddNetTx.SyntacticVerify(rt))
expectedUnsignedComplexAddNetTxBytes := []byte{
// Codec version
0x00, 0x00,
// AddPermissionlessDelegatorTx type ID
0x00, 0x00, 0x00, 0x1a,
// Mainnet network ID
0x00, 0x00, 0x00, 0x01,
// P-chain blockchain ID (31 zeros + 'P')
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x50,
// Number of immediate outputs
0x00, 0x00, 0x00, 0x03,
// outputs[0]
// Mainnet LUX asset ID
0x51, 0xc2, 0x4f, 0xe7, 0xee, 0x02, 0x01, 0xff,
0x0f, 0x33, 0x5f, 0x51, 0x99, 0x28, 0xdb, 0x6e,
0xef, 0x62, 0x24, 0x25, 0x45, 0x52, 0xc9, 0x6b,
0x6b, 0x42, 0x5f, 0xbc, 0x18, 0xfa, 0x24, 0x3b,
// secp256k1fx transfer output type ID
0x00, 0x00, 0x00, 0x07,
// amount
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
// locktime
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
// threshold
0x00, 0x00, 0x00, 0x01,
// number of addresses
0x00, 0x00, 0x00, 0x01,
// addresses[0]
0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xaa, 0xbb,
0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xaa, 0xbb,
0x44, 0x55, 0x66, 0x77,
// outputs[1]
// Mainnet LUX asset ID
0x51, 0xc2, 0x4f, 0xe7, 0xee, 0x02, 0x01, 0xff,
0x0f, 0x33, 0x5f, 0x51, 0x99, 0x28, 0xdb, 0x6e,
0xef, 0x62, 0x24, 0x25, 0x45, 0x52, 0xc9, 0x6b,
0x6b, 0x42, 0x5f, 0xbc, 0x18, 0xfa, 0x24, 0x3b,
// stakeable locked output type ID
0x00, 0x00, 0x00, 0x16,
// locktime
0x00, 0x00, 0x00, 0x00, 0x05, 0x39, 0x7f, 0xb1,
// secp256k1fx transfer output type ID
0x00, 0x00, 0x00, 0x07,
// amount
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
// locktime
0x00, 0x00, 0x00, 0x00, 0x00, 0xbc, 0x61, 0x4e,
// threshold
0x00, 0x00, 0x00, 0x00,
// number of addresses
0x00, 0x00, 0x00, 0x00,
// outputs[2]
// custom asset ID
0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31,
0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31,
0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31,
0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31,
// stakeable locked output type ID
0x00, 0x00, 0x00, 0x16,
// locktime
0x00, 0x00, 0x00, 0x00, 0x34, 0x3e, 0xfc, 0xea,
// secp256k1fx transfer output type ID
0x00, 0x00, 0x00, 0x07,
// amount
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf0,
// locktime
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
// threshold
0x00, 0x00, 0x00, 0x01,
// number of addresses
0x00, 0x00, 0x00, 0x01,
// address[0]
0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xaa, 0xbb,
0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xaa, 0xbb,
0x44, 0x55, 0x66, 0x77,
// number of inputs
0x00, 0x00, 0x00, 0x03,
// inputs[0]
// TxID
0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88,
0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88,
0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88,
0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88,
// Tx output index
0x00, 0x00, 0x00, 0x01,
// Mainnet LUX asset ID
0x51, 0xc2, 0x4f, 0xe7, 0xee, 0x02, 0x01, 0xff,
0x0f, 0x33, 0x5f, 0x51, 0x99, 0x28, 0xdb, 0x6e,
0xef, 0x62, 0x24, 0x25, 0x45, 0x52, 0xc9, 0x6b,
0x6b, 0x42, 0x5f, 0xbc, 0x18, 0xfa, 0x24, 0x3b,
// secp256k1fx transfer input type ID
0x00, 0x00, 0x00, 0x05,
// amount
0x00, 0x00, 0x00, 0xe8, 0xd4, 0xa5, 0x10, 0x00,
// number of signature indices
0x00, 0x00, 0x00, 0x02,
// first signature index
0x00, 0x00, 0x00, 0x02,
// second signature index
0x00, 0x00, 0x00, 0x05,
// inputs[1]
// TxID
0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88,
0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88,
0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88,
0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88,
// Tx output index
0x00, 0x00, 0x00, 0x02,
// custom asset ID
0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31,
0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31,
0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31,
0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31,
// stakeable locked input type ID
0x00, 0x00, 0x00, 0x15,
// locktime
0x00, 0x00, 0x00, 0x00, 0x34, 0x3e, 0xfc, 0xea,
// secp256k1fx transfer input type ID
0x00, 0x00, 0x00, 0x05,
// amount
0xef, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
// number of signature indices
0x00, 0x00, 0x00, 0x01,
// signature index
0x00, 0x00, 0x00, 0x00,
// inputs[2]
// TxID
0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88,
0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88,
0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88,
0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88,
// Tx output index
0x00, 0x00, 0x00, 0x03,
// custom asset ID
0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31,
0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31,
0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31,
0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31,
// secp256k1 transfer input type ID
0x00, 0x00, 0x00, 0x05,
// amount
0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
// number of signature indices
0x00, 0x00, 0x00, 0x00,
// memo length
0x00, 0x00, 0x00, 0x14,
// memo
0xf0, 0x9f, 0x98, 0x85, 0x0a, 0x77, 0x65, 0x6c,
0x6c, 0x20, 0x74, 0x68, 0x61, 0x74, 0x27, 0x73,
0x01, 0x23, 0x45, 0x21,
// nodeID
0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88,
0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88,
0x11, 0x22, 0x33, 0x44,
// Start time
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x39,
// End time
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x3a,
// Stake weight
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09,
// netID
0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08,
0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18,
0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28,
0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38,
// number of locked outputs
0x00, 0x00, 0x00, 0x02,
// custom asset ID
0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31,
0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31,
0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31,
0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31,
// secp256k1 transfer output type ID
0x00, 0x00, 0x00, 0x07,
// amount
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02,
// locktime
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
// threshold
0x00, 0x00, 0x00, 0x01,
// number of addresses
0x00, 0x00, 0x00, 0x01,
// addresses[0]
0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xaa, 0xbb,
0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xaa, 0xbb,
0x44, 0x55, 0x66, 0x77,
// custom asset ID
0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31,
0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31,
0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31,
0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31,
// stakeable locked output type ID
0x00, 0x00, 0x00, 0x16,
// locktime
0x00, 0x00, 0x00, 0x00, 0x3a, 0xde, 0x68, 0xb1,
// secp256k1 transfer output type ID
0x00, 0x00, 0x00, 0x07,
// amount
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07,
// locktime
0x00, 0x00, 0x00, 0x00, 0x05, 0x39, 0x7f, 0xb1,
// threshold
0x00, 0x00, 0x00, 0x00,
// number of addresses
0x00, 0x00, 0x00, 0x00,
// secp256k1 owner type ID
0x00, 0x00, 0x00, 0x0b,
// locktime
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
// threshold
0x00, 0x00, 0x00, 0x00,
// number of addresses
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x1a, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x50, 0x03, 0x00, 0x00, 0x00, 0x51, 0xc2,
0x4f, 0xe7, 0xee, 0x02, 0x01, 0xff, 0x0f, 0x33, 0x5f, 0x51, 0x99, 0x28, 0xdb, 0x6e, 0xef, 0x62,
0x24, 0x25, 0x45, 0x52, 0xc9, 0x6b, 0x6b, 0x42, 0x5f, 0xbc, 0x18, 0xfa, 0x24, 0x3b, 0x07, 0x00,
0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99,
0xaa, 0xbb, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xaa, 0xbb, 0x44, 0x55, 0x66, 0x77, 0x51, 0xc2,
0x4f, 0xe7, 0xee, 0x02, 0x01, 0xff, 0x0f, 0x33, 0x5f, 0x51, 0x99, 0x28, 0xdb, 0x6e, 0xef, 0x62,
0x24, 0x25, 0x45, 0x52, 0xc9, 0x6b, 0x6b, 0x42, 0x5f, 0xbc, 0x18, 0xfa, 0x24, 0x3b, 0x16, 0x00,
0x00, 0x00, 0xb1, 0x7f, 0x39, 0x05, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x01, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x4e, 0x61, 0xbc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31, 0x99, 0x77,
0x55, 0x77, 0x11, 0x33, 0x55, 0x31, 0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31, 0x99, 0x77,
0x55, 0x77, 0x11, 0x33, 0x55, 0x31, 0x16, 0x00, 0x00, 0x00, 0xea, 0xfc, 0x3e, 0x34, 0x00, 0x00,
0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0xf0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x44, 0x55,
0x66, 0x77, 0x88, 0x99, 0xaa, 0xbb, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xaa, 0xbb, 0x44, 0x55,
0x66, 0x77, 0x03, 0x00, 0x00, 0x00, 0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88, 0xff, 0xee,
0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88, 0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88, 0xff, 0xee,
0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88, 0x01, 0x00, 0x00, 0x00, 0x51, 0xc2, 0x4f, 0xe7, 0xee, 0x02,
0x01, 0xff, 0x0f, 0x33, 0x5f, 0x51, 0x99, 0x28, 0xdb, 0x6e, 0xef, 0x62, 0x24, 0x25, 0x45, 0x52,
0xc9, 0x6b, 0x6b, 0x42, 0x5f, 0xbc, 0x18, 0xfa, 0x24, 0x3b, 0x05, 0x00, 0x00, 0x00, 0x00, 0x10,
0xa5, 0xd4, 0xe8, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x05, 0x00,
0x00, 0x00, 0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88, 0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa,
0x99, 0x88, 0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88, 0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa,
0x99, 0x88, 0x02, 0x00, 0x00, 0x00, 0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31, 0x99, 0x77,
0x55, 0x77, 0x11, 0x33, 0x55, 0x31, 0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31, 0x99, 0x77,
0x55, 0x77, 0x11, 0x33, 0x55, 0x31, 0x15, 0x00, 0x00, 0x00, 0xea, 0xfc, 0x3e, 0x34, 0x00, 0x00,
0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xef, 0x01, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88, 0xff, 0xee,
0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88, 0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88, 0xff, 0xee,
0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88, 0x03, 0x00, 0x00, 0x00, 0x99, 0x77, 0x55, 0x77, 0x11, 0x33,
0x55, 0x31, 0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31, 0x99, 0x77, 0x55, 0x77, 0x11, 0x33,
0x55, 0x31, 0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0xf0, 0x9f,
0x98, 0x85, 0x0a, 0x77, 0x65, 0x6c, 0x6c, 0x20, 0x74, 0x68, 0x61, 0x74, 0x27, 0x73, 0x01, 0x23,
0x45, 0x21, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66,
0x77, 0x88, 0x11, 0x22, 0x33, 0x44, 0x39, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3a, 0x30,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x02,
0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x21, 0x22,
0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x02, 0x00,
0x00, 0x00, 0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31, 0x99, 0x77, 0x55, 0x77, 0x11, 0x33,
0x55, 0x31, 0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31, 0x99, 0x77, 0x55, 0x77, 0x11, 0x33,
0x55, 0x31, 0x07, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x44, 0x55,
0x66, 0x77, 0x88, 0x99, 0xaa, 0xbb, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xaa, 0xbb, 0x44, 0x55,
0x66, 0x77, 0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31, 0x99, 0x77, 0x55, 0x77, 0x11, 0x33,
0x55, 0x31, 0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31, 0x99, 0x77, 0x55, 0x77, 0x11, 0x33,
0x55, 0x31, 0x16, 0x00, 0x00, 0x00, 0xb1, 0x68, 0xde, 0x3a, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00,
0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xb1, 0x7f, 0x39, 0x05, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
}
var unsignedComplexAddNetTx UnsignedTx = complexAddNetTx
unsignedComplexAddNetTxBytes, err := testCodec.Marshal(CodecVersion, &unsignedComplexAddNetTx)
+86 -354
View File
@@ -840,129 +840,36 @@ func TestAddPermissionlessNetValidator(t *testing.T) {
require.NoError(simpleAddNetTx.SyntacticVerify(rt))
expectedUnsignedSimpleAddNetTxBytes := []byte{
// Codec version
0x00, 0x00,
// AddPermissionlessValidatorTx type ID
0x00, 0x00, 0x00, 0x19,
// Mainnet network ID
0x00, 0x00, 0x00, 0x01,
// P-chain blockchain ID (31 zeros + 'P')
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x50,
// Number of immediate outputs
0x00, 0x00, 0x00, 0x00,
// Number of inputs
0x00, 0x00, 0x00, 0x02,
// inputs[0]
// TxID
0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88,
0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88,
0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88,
0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88,
// Tx output index
0x00, 0x00, 0x00, 0x01,
// Mainnet LUX asset ID
0x51, 0xc2, 0x4f, 0xe7, 0xee, 0x02, 0x01, 0xff,
0x0f, 0x33, 0x5f, 0x51, 0x99, 0x28, 0xdb, 0x6e,
0xef, 0x62, 0x24, 0x25, 0x45, 0x52, 0xc9, 0x6b,
0x6b, 0x42, 0x5f, 0xbc, 0x18, 0xfa, 0x24, 0x3b,
// secp256k1fx transfer input type ID
0x00, 0x00, 0x00, 0x05,
// Amount = 1 MilliLUX
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0xe8,
// Number of input signature indices
0x00, 0x00, 0x00, 0x01,
// signature index
0x00, 0x00, 0x00, 0x01,
// inputs[1]
// TxID
0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88,
0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88,
0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88,
0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88,
// Tx output index
0x00, 0x00, 0x00, 0x02,
// custom asset ID
0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31,
0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31,
0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31,
0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31,
// secp256k1fx transfer input type ID
0x00, 0x00, 0x00, 0x05,
// Amount
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
// Number of input signature indices
0x00, 0x00, 0x00, 0x01,
// signature index
0x00, 0x00, 0x00, 0x01,
// memo length
0x00, 0x00, 0x00, 0x00,
// NodeID
0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88,
0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88,
0x11, 0x22, 0x33, 0x44,
// Start time
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x39,
// End time
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x3a,
// Stake weight
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
// NetID
0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08,
0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18,
0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28,
0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38,
// No signer type ID
0x00, 0x00, 0x00, 0x1b,
// Number of locked outputs
0x00, 0x00, 0x00, 0x01,
// custom asset ID
0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31,
0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31,
0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31,
0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31,
// secp256k1fx transferable output type ID
0x00, 0x00, 0x00, 0x07,
// amount
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
// locktime
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
// threshold
0x00, 0x00, 0x00, 0x01,
// number of addresses
0x00, 0x00, 0x00, 0x01,
// addresses[0]
0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xaa, 0xbb,
0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xaa, 0xbb,
0x44, 0x55, 0x66, 0x77,
// secp256k1fx owner type ID
0x00, 0x00, 0x00, 0x0b,
// locktime
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
// threshold
0x00, 0x00, 0x00, 0x01,
// number of addresses
0x00, 0x00, 0x00, 0x01,
// addresses[0]
0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xaa, 0xbb,
0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xaa, 0xbb,
0x44, 0x55, 0x66, 0x77,
// secp256k1fx owner type ID
0x00, 0x00, 0x00, 0x0b,
// locktime
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
// threshold
0x00, 0x00, 0x00, 0x01,
// number of addresses
0x00, 0x00, 0x00, 0x01,
// addresses[0]
0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xaa, 0xbb,
0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xaa, 0xbb,
0x44, 0x55, 0x66, 0x77,
// delegation shares
0x00, 0x0f, 0x42, 0x40,
0x00, 0x00, 0x19, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x50, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00,
0x00, 0x00, 0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88, 0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa,
0x99, 0x88, 0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88, 0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa,
0x99, 0x88, 0x01, 0x00, 0x00, 0x00, 0x51, 0xc2, 0x4f, 0xe7, 0xee, 0x02, 0x01, 0xff, 0x0f, 0x33,
0x5f, 0x51, 0x99, 0x28, 0xdb, 0x6e, 0xef, 0x62, 0x24, 0x25, 0x45, 0x52, 0xc9, 0x6b, 0x6b, 0x42,
0x5f, 0xbc, 0x18, 0xfa, 0x24, 0x3b, 0x05, 0x00, 0x00, 0x00, 0xe8, 0x03, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa,
0x99, 0x88, 0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88, 0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa,
0x99, 0x88, 0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88, 0x02, 0x00, 0x00, 0x00, 0x99, 0x77,
0x55, 0x77, 0x11, 0x33, 0x55, 0x31, 0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31, 0x99, 0x77,
0x55, 0x77, 0x11, 0x33, 0x55, 0x31, 0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31, 0x05, 0x00,
0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x11, 0x22,
0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x11, 0x22, 0x33, 0x44, 0x39, 0x30, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x3a, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16,
0x17, 0x18, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36,
0x37, 0x38, 0x1b, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x99, 0x77, 0x55, 0x77, 0x11, 0x33,
0x55, 0x31, 0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31, 0x99, 0x77, 0x55, 0x77, 0x11, 0x33,
0x55, 0x31, 0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31, 0x07, 0x00, 0x00, 0x00, 0x01, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00,
0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xaa, 0xbb, 0x44, 0x55,
0x66, 0x77, 0x88, 0x99, 0xaa, 0xbb, 0x44, 0x55, 0x66, 0x77, 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x44, 0x55,
0x66, 0x77, 0x88, 0x99, 0xaa, 0xbb, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xaa, 0xbb, 0x44, 0x55,
0x66, 0x77, 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00,
0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xaa, 0xbb, 0x44, 0x55,
0x66, 0x77, 0x88, 0x99, 0xaa, 0xbb, 0x44, 0x55, 0x66, 0x77, 0x40, 0x42, 0x0f, 0x00,
}
var unsignedSimpleAddNetTx UnsignedTx = simpleAddNetTx
unsignedSimpleAddNetTxBytes, err := testCodec.Marshal(CodecVersion, &unsignedSimpleAddNetTx)
@@ -1142,237 +1049,62 @@ func TestAddPermissionlessNetValidator(t *testing.T) {
require.NoError(complexAddNetTx.SyntacticVerify(ctx2))
expectedUnsignedComplexAddNetTxBytes := []byte{
// Codec version
0x00, 0x00,
// AddPermissionlessValidatorTx type ID
0x00, 0x00, 0x00, 0x19,
// Mainnet network ID
0x00, 0x00, 0x00, 0x01,
// P-chain blockchain ID (31 zeros + 'P')
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x50,
// Number of immediate outputs
0x00, 0x00, 0x00, 0x03,
// outputs[0]
// Mainnet LUX asset ID
0x51, 0xc2, 0x4f, 0xe7, 0xee, 0x02, 0x01, 0xff,
0x0f, 0x33, 0x5f, 0x51, 0x99, 0x28, 0xdb, 0x6e,
0xef, 0x62, 0x24, 0x25, 0x45, 0x52, 0xc9, 0x6b,
0x6b, 0x42, 0x5f, 0xbc, 0x18, 0xfa, 0x24, 0x3b,
// secp256k1fx transfer output type ID
0x00, 0x00, 0x00, 0x07,
// amount
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
// locktime
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
// threshold
0x00, 0x00, 0x00, 0x01,
// number of addresses
0x00, 0x00, 0x00, 0x01,
// addresses[0]
0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xaa, 0xbb,
0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xaa, 0xbb,
0x44, 0x55, 0x66, 0x77,
// outputs[1]
// Mainnet LUX asset ID
0x51, 0xc2, 0x4f, 0xe7, 0xee, 0x02, 0x01, 0xff,
0x0f, 0x33, 0x5f, 0x51, 0x99, 0x28, 0xdb, 0x6e,
0xef, 0x62, 0x24, 0x25, 0x45, 0x52, 0xc9, 0x6b,
0x6b, 0x42, 0x5f, 0xbc, 0x18, 0xfa, 0x24, 0x3b,
// stakeable locked output type ID
0x00, 0x00, 0x00, 0x16,
// locktime
0x00, 0x00, 0x00, 0x00, 0x05, 0x39, 0x7f, 0xb1,
// secp256k1fx transfer output type ID
0x00, 0x00, 0x00, 0x07,
// amount
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
// locktime
0x00, 0x00, 0x00, 0x00, 0x00, 0xbc, 0x61, 0x4e,
// threshold
0x00, 0x00, 0x00, 0x00,
// number of addresses
0x00, 0x00, 0x00, 0x00,
// outputs[2]
// custom asset ID
0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31,
0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31,
0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31,
0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31,
// stakeable locked output type ID
0x00, 0x00, 0x00, 0x16,
// locktime
0x00, 0x00, 0x00, 0x00, 0x34, 0x3e, 0xfc, 0xea,
// secp256k1fx transfer output type ID
0x00, 0x00, 0x00, 0x07,
// amount
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf0,
// locktime
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
// threshold
0x00, 0x00, 0x00, 0x01,
// number of addresses
0x00, 0x00, 0x00, 0x01,
// address[0]
0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xaa, 0xbb,
0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xaa, 0xbb,
0x44, 0x55, 0x66, 0x77,
// number of inputs
0x00, 0x00, 0x00, 0x03,
// inputs[0]
// TxID
0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88,
0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88,
0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88,
0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88,
// Tx output index
0x00, 0x00, 0x00, 0x01,
// Mainnet LUX asset ID
0x51, 0xc2, 0x4f, 0xe7, 0xee, 0x02, 0x01, 0xff,
0x0f, 0x33, 0x5f, 0x51, 0x99, 0x28, 0xdb, 0x6e,
0xef, 0x62, 0x24, 0x25, 0x45, 0x52, 0xc9, 0x6b,
0x6b, 0x42, 0x5f, 0xbc, 0x18, 0xfa, 0x24, 0x3b,
// secp256k1fx transfer input type ID
0x00, 0x00, 0x00, 0x05,
// amount
0x00, 0x00, 0x00, 0xe8, 0xd4, 0xa5, 0x10, 0x00,
// number of signature indices
0x00, 0x00, 0x00, 0x02,
// first signature index
0x00, 0x00, 0x00, 0x02,
// second signature index
0x00, 0x00, 0x00, 0x05,
// inputs[1]
// TxID
0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88,
0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88,
0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88,
0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88,
// Tx output index
0x00, 0x00, 0x00, 0x02,
// custom asset ID
0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31,
0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31,
0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31,
0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31,
// stakeable locked input type ID
0x00, 0x00, 0x00, 0x15,
// locktime
0x00, 0x00, 0x00, 0x00, 0x34, 0x3e, 0xfc, 0xea,
// secp256k1fx transfer input type ID
0x00, 0x00, 0x00, 0x05,
// amount
0xef, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
// number of signature indices
0x00, 0x00, 0x00, 0x01,
// signature index
0x00, 0x00, 0x00, 0x00,
// inputs[2]
// TxID
0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88,
0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88,
0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88,
0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88,
// Tx output index
0x00, 0x00, 0x00, 0x03,
// custom asset ID
0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31,
0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31,
0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31,
0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31,
// secp256k1 transfer input type ID
0x00, 0x00, 0x00, 0x05,
// amount
0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
// number of signature indices
0x00, 0x00, 0x00, 0x00,
// memo length
0x00, 0x00, 0x00, 0x14,
// memo
0xf0, 0x9f, 0x98, 0x85, 0x0a, 0x77, 0x65, 0x6c,
0x6c, 0x20, 0x74, 0x68, 0x61, 0x74, 0x27, 0x73,
0x01, 0x23, 0x45, 0x21,
// nodeID
0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88,
0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88,
0x11, 0x22, 0x33, 0x44,
// Start time
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x39,
// End time
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x3a,
// Stake weight
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09,
// netID
0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08,
0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18,
0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28,
0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38,
// Empty signer type ID
0x00, 0x00, 0x00, 0x1b,
// number of locked outputs
0x00, 0x00, 0x00, 0x02,
// custom asset ID
0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31,
0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31,
0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31,
0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31,
// secp256k1 transfer output type ID
0x00, 0x00, 0x00, 0x07,
// amount
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02,
// locktime
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
// threshold
0x00, 0x00, 0x00, 0x01,
// number of addresses
0x00, 0x00, 0x00, 0x01,
// addresses[0]
0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xaa, 0xbb,
0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xaa, 0xbb,
0x44, 0x55, 0x66, 0x77,
// custom asset ID
0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31,
0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31,
0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31,
0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31,
// stakeable locked output type ID
0x00, 0x00, 0x00, 0x16,
// locktime
0x00, 0x00, 0x00, 0x00, 0x3a, 0xde, 0x68, 0xb1,
// secp256k1 transfer output type ID
0x00, 0x00, 0x00, 0x07,
// amount
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07,
// locktime
0x00, 0x00, 0x00, 0x00, 0x05, 0x39, 0x7f, 0xb1,
// threshold
0x00, 0x00, 0x00, 0x00,
// number of addresses
0x00, 0x00, 0x00, 0x00,
// secp256k1 owner type ID
0x00, 0x00, 0x00, 0x0b,
// locktime
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
// threshold
0x00, 0x00, 0x00, 0x01,
// number of addresses
0x00, 0x00, 0x00, 0x01,
// addresses[0]
0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xaa, 0xbb,
0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xaa, 0xbb,
0x44, 0x55, 0x66, 0x77,
// secp256k1 owner type ID
0x00, 0x00, 0x00, 0x0b,
// locktime
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
// threshold
0x00, 0x00, 0x00, 0x00,
// number of addresses
0x00, 0x00, 0x00, 0x00,
// delegation shares
0x00, 0x0f, 0x42, 0x40,
0x00, 0x00, 0x19, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x50, 0x03, 0x00, 0x00, 0x00, 0x51, 0xc2,
0x4f, 0xe7, 0xee, 0x02, 0x01, 0xff, 0x0f, 0x33, 0x5f, 0x51, 0x99, 0x28, 0xdb, 0x6e, 0xef, 0x62,
0x24, 0x25, 0x45, 0x52, 0xc9, 0x6b, 0x6b, 0x42, 0x5f, 0xbc, 0x18, 0xfa, 0x24, 0x3b, 0x07, 0x00,
0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99,
0xaa, 0xbb, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xaa, 0xbb, 0x44, 0x55, 0x66, 0x77, 0x51, 0xc2,
0x4f, 0xe7, 0xee, 0x02, 0x01, 0xff, 0x0f, 0x33, 0x5f, 0x51, 0x99, 0x28, 0xdb, 0x6e, 0xef, 0x62,
0x24, 0x25, 0x45, 0x52, 0xc9, 0x6b, 0x6b, 0x42, 0x5f, 0xbc, 0x18, 0xfa, 0x24, 0x3b, 0x16, 0x00,
0x00, 0x00, 0xb1, 0x7f, 0x39, 0x05, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x01, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x4e, 0x61, 0xbc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31, 0x99, 0x77,
0x55, 0x77, 0x11, 0x33, 0x55, 0x31, 0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31, 0x99, 0x77,
0x55, 0x77, 0x11, 0x33, 0x55, 0x31, 0x16, 0x00, 0x00, 0x00, 0xea, 0xfc, 0x3e, 0x34, 0x00, 0x00,
0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0xf0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x44, 0x55,
0x66, 0x77, 0x88, 0x99, 0xaa, 0xbb, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xaa, 0xbb, 0x44, 0x55,
0x66, 0x77, 0x03, 0x00, 0x00, 0x00, 0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88, 0xff, 0xee,
0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88, 0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88, 0xff, 0xee,
0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88, 0x01, 0x00, 0x00, 0x00, 0x51, 0xc2, 0x4f, 0xe7, 0xee, 0x02,
0x01, 0xff, 0x0f, 0x33, 0x5f, 0x51, 0x99, 0x28, 0xdb, 0x6e, 0xef, 0x62, 0x24, 0x25, 0x45, 0x52,
0xc9, 0x6b, 0x6b, 0x42, 0x5f, 0xbc, 0x18, 0xfa, 0x24, 0x3b, 0x05, 0x00, 0x00, 0x00, 0x00, 0x10,
0xa5, 0xd4, 0xe8, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x05, 0x00,
0x00, 0x00, 0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88, 0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa,
0x99, 0x88, 0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88, 0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa,
0x99, 0x88, 0x02, 0x00, 0x00, 0x00, 0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31, 0x99, 0x77,
0x55, 0x77, 0x11, 0x33, 0x55, 0x31, 0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31, 0x99, 0x77,
0x55, 0x77, 0x11, 0x33, 0x55, 0x31, 0x15, 0x00, 0x00, 0x00, 0xea, 0xfc, 0x3e, 0x34, 0x00, 0x00,
0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xef, 0x01, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88, 0xff, 0xee,
0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88, 0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88, 0xff, 0xee,
0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88, 0x03, 0x00, 0x00, 0x00, 0x99, 0x77, 0x55, 0x77, 0x11, 0x33,
0x55, 0x31, 0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31, 0x99, 0x77, 0x55, 0x77, 0x11, 0x33,
0x55, 0x31, 0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0xf0, 0x9f,
0x98, 0x85, 0x0a, 0x77, 0x65, 0x6c, 0x6c, 0x20, 0x74, 0x68, 0x61, 0x74, 0x27, 0x73, 0x01, 0x23,
0x45, 0x21, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66,
0x77, 0x88, 0x11, 0x22, 0x33, 0x44, 0x39, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3a, 0x30,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x02,
0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x21, 0x22,
0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x1b, 0x00,
0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31, 0x99, 0x77,
0x55, 0x77, 0x11, 0x33, 0x55, 0x31, 0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31, 0x99, 0x77,
0x55, 0x77, 0x11, 0x33, 0x55, 0x31, 0x07, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00,
0x00, 0x00, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xaa, 0xbb, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99,
0xaa, 0xbb, 0x44, 0x55, 0x66, 0x77, 0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31, 0x99, 0x77,
0x55, 0x77, 0x11, 0x33, 0x55, 0x31, 0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31, 0x99, 0x77,
0x55, 0x77, 0x11, 0x33, 0x55, 0x31, 0x16, 0x00, 0x00, 0x00, 0xb1, 0x68, 0xde, 0x3a, 0x00, 0x00,
0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xb1, 0x7f,
0x39, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0b, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00,
0x00, 0x00, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xaa, 0xbb, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99,
0xaa, 0xbb, 0x44, 0x55, 0x66, 0x77, 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x42, 0x0f, 0x00,
}
var unsignedComplexAddNetTx UnsignedTx = complexAddNetTx
unsignedComplexAddNetTxBytes, err := testCodec.Marshal(CodecVersion, &unsignedComplexAddNetTx)
+42 -170
View File
@@ -80,44 +80,15 @@ func TestBaseTxSerialization(t *testing.T) {
require.NoError(simpleBaseTx.SyntacticVerify(rt))
expectedUnsignedSimpleBaseTxBytes := []byte{
// Codec version
0x00, 0x00,
// BaseTx Type ID
0x00, 0x00, 0x00, 0x22,
// Mainnet network ID
0x00, 0x00, 0x00, 0x01,
// P-chain blockchain ID (31 zeros + 'P')
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
// Number of outputs
0x00, 0x00, 0x00, 0x00,
// Number of inputs
0x00, 0x00, 0x00, 0x01,
// Inputs[0]
// TxID
0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88,
0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88,
0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88,
0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88,
// Tx output index
0x00, 0x00, 0x00, 0x01,
// Mainnet LUX assetID
0x51, 0xc2, 0x4f, 0xe7, 0xee, 0x02, 0x01, 0xff,
0x0f, 0x33, 0x5f, 0x51, 0x99, 0x28, 0xdb, 0x6e,
0xef, 0x62, 0x24, 0x25, 0x45, 0x52, 0xc9, 0x6b,
0x6b, 0x42, 0x5f, 0xbc, 0x18, 0xfa, 0x24, 0x3b,
// secp256k1fx transfer input type ID
0x00, 0x00, 0x00, 0x05,
// input amount = 1 MilliLux
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0xe8,
// number of signatures needed in input
0x00, 0x00, 0x00, 0x01,
// index of signer
0x00, 0x00, 0x00, 0x05,
// length of memo
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x22, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00,
0x00, 0x00, 0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88, 0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa,
0x99, 0x88, 0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88, 0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa,
0x99, 0x88, 0x01, 0x00, 0x00, 0x00, 0x51, 0xc2, 0x4f, 0xe7, 0xee, 0x02, 0x01, 0xff, 0x0f, 0x33,
0x5f, 0x51, 0x99, 0x28, 0xdb, 0x6e, 0xef, 0x62, 0x24, 0x25, 0x45, 0x52, 0xc9, 0x6b, 0x6b, 0x42,
0x5f, 0xbc, 0x18, 0xfa, 0x24, 0x3b, 0x05, 0x00, 0x00, 0x00, 0xe8, 0x03, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
}
var unsignedSimpleBaseTx UnsignedTx = simpleBaseTx
unsignedSimpleBaseTxBytes, err := testCodec.Marshal(CodecVersion, &unsignedSimpleBaseTx)
@@ -228,138 +199,39 @@ func TestBaseTxSerialization(t *testing.T) {
require.NoError(complexBaseTx.SyntacticVerify(ctx2))
expectedUnsignedComplexBaseTxBytes := []byte{
// Codec version
0x00, 0x00,
// BaseTx Type ID
0x00, 0x00, 0x00, 0x22,
// Mainnet network ID
0x00, 0x00, 0x00, 0x01,
// P-chain blockchain ID (31 zeros + 'P')
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
// Number of outputs
0x00, 0x00, 0x00, 0x02,
// Outputs[0]
// Mainnet LUX assetID
0x51, 0xc2, 0x4f, 0xe7, 0xee, 0x02, 0x01, 0xff,
0x0f, 0x33, 0x5f, 0x51, 0x99, 0x28, 0xdb, 0x6e,
0xef, 0x62, 0x24, 0x25, 0x45, 0x52, 0xc9, 0x6b,
0x6b, 0x42, 0x5f, 0xbc, 0x18, 0xfa, 0x24, 0x3b,
// Stakeable locked output type ID
0x00, 0x00, 0x00, 0x16,
// Locktime
0x00, 0x00, 0x00, 0x00, 0x05, 0x39, 0x7f, 0xb1,
// secp256k1fx transfer output type ID
0x00, 0x00, 0x00, 0x07,
// amount
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
// secp256k1fx output locktime
0x00, 0x00, 0x00, 0x00, 0x00, 0xbc, 0x61, 0x4e,
// threshold
0x00, 0x00, 0x00, 0x00,
// number of addresses
0x00, 0x00, 0x00, 0x00,
// Outputs[1]
// custom asset ID
0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31,
0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31,
0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31,
0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31,
// Stakeable locked output type ID
0x00, 0x00, 0x00, 0x16,
// Locktime
0x00, 0x00, 0x00, 0x00, 0x34, 0x3e, 0xfc, 0xea,
// secp256k1fx transfer output type ID
0x00, 0x00, 0x00, 0x07,
// amount
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
// secp256k1fx output locktime
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
// threshold
0x00, 0x00, 0x00, 0x01,
// number of addresses
0x00, 0x00, 0x00, 0x01,
// address[0]
0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xaa, 0xbb,
0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xaa, 0xbb,
0x44, 0x55, 0x66, 0x77,
// number of inputs
0x00, 0x00, 0x00, 0x03,
// inputs[0]
// TxID
0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88,
0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88,
0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88,
0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88,
// Tx output index
0x00, 0x00, 0x00, 0x01,
// Mainnet LUX assetID
0x51, 0xc2, 0x4f, 0xe7, 0xee, 0x02, 0x01, 0xff,
0x0f, 0x33, 0x5f, 0x51, 0x99, 0x28, 0xdb, 0x6e,
0xef, 0x62, 0x24, 0x25, 0x45, 0x52, 0xc9, 0x6b,
0x6b, 0x42, 0x5f, 0xbc, 0x18, 0xfa, 0x24, 0x3b,
// secp256k1fx transfer input type ID
0x00, 0x00, 0x00, 0x05,
// input amount = 1 Lux
0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x42, 0x40,
// number of signatures needed in input
0x00, 0x00, 0x00, 0x02,
// index of first signer
0x00, 0x00, 0x00, 0x02,
// index of second signer
0x00, 0x00, 0x00, 0x05,
// inputs[1]
// TxID
0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88,
0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88,
0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88,
0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88,
// Tx output index
0x00, 0x00, 0x00, 0x02,
// Custom asset ID
0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31,
0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31,
0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31,
0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31,
// Stakeable locked input type ID
0x00, 0x00, 0x00, 0x15,
// Locktime
0x00, 0x00, 0x00, 0x00, 0x34, 0x3e, 0xfc, 0xea,
// secp256k1fx transfer input type ID
0x00, 0x00, 0x00, 0x05,
// input amount
0xef, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
// number of signatures needed in input
0x00, 0x00, 0x00, 0x01,
// index of signer
0x00, 0x00, 0x00, 0x00,
// inputs[2]
// TxID
0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88,
0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88,
0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88,
0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88,
// Tx output index
0x00, 0x00, 0x00, 0x03,
// custom asset ID
0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31,
0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31,
0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31,
0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31,
// secp256k1fx transfer input type ID
0x00, 0x00, 0x00, 0x05,
// input amount
0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
// number of signatures needed in input
0x00, 0x00, 0x00, 0x00,
// length of memo
0x00, 0x00, 0x00, 0x14,
// memo
0xf0, 0x9f, 0x98, 0x85, 0x0a, 0x77, 0x65, 0x6c,
0x6c, 0x20, 0x74, 0x68, 0x61, 0x74, 0x27, 0x73,
0x01, 0x23, 0x45, 0x21,
0x00, 0x00, 0x22, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x51, 0xc2,
0x4f, 0xe7, 0xee, 0x02, 0x01, 0xff, 0x0f, 0x33, 0x5f, 0x51, 0x99, 0x28, 0xdb, 0x6e, 0xef, 0x62,
0x24, 0x25, 0x45, 0x52, 0xc9, 0x6b, 0x6b, 0x42, 0x5f, 0xbc, 0x18, 0xfa, 0x24, 0x3b, 0x16, 0x00,
0x00, 0x00, 0xb1, 0x7f, 0x39, 0x05, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x01, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x4e, 0x61, 0xbc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31, 0x99, 0x77,
0x55, 0x77, 0x11, 0x33, 0x55, 0x31, 0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31, 0x99, 0x77,
0x55, 0x77, 0x11, 0x33, 0x55, 0x31, 0x16, 0x00, 0x00, 0x00, 0xea, 0xfc, 0x3e, 0x34, 0x00, 0x00,
0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x44, 0x55,
0x66, 0x77, 0x88, 0x99, 0xaa, 0xbb, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xaa, 0xbb, 0x44, 0x55,
0x66, 0x77, 0x03, 0x00, 0x00, 0x00, 0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88, 0xff, 0xee,
0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88, 0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88, 0xff, 0xee,
0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88, 0x01, 0x00, 0x00, 0x00, 0x51, 0xc2, 0x4f, 0xe7, 0xee, 0x02,
0x01, 0xff, 0x0f, 0x33, 0x5f, 0x51, 0x99, 0x28, 0xdb, 0x6e, 0xef, 0x62, 0x24, 0x25, 0x45, 0x52,
0xc9, 0x6b, 0x6b, 0x42, 0x5f, 0xbc, 0x18, 0xfa, 0x24, 0x3b, 0x05, 0x00, 0x00, 0x00, 0x40, 0x42,
0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x05, 0x00,
0x00, 0x00, 0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88, 0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa,
0x99, 0x88, 0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88, 0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa,
0x99, 0x88, 0x02, 0x00, 0x00, 0x00, 0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31, 0x99, 0x77,
0x55, 0x77, 0x11, 0x33, 0x55, 0x31, 0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31, 0x99, 0x77,
0x55, 0x77, 0x11, 0x33, 0x55, 0x31, 0x15, 0x00, 0x00, 0x00, 0xea, 0xfc, 0x3e, 0x34, 0x00, 0x00,
0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xef, 0x01, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88, 0xff, 0xee,
0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88, 0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88, 0xff, 0xee,
0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88, 0x03, 0x00, 0x00, 0x00, 0x99, 0x77, 0x55, 0x77, 0x11, 0x33,
0x55, 0x31, 0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31, 0x99, 0x77, 0x55, 0x77, 0x11, 0x33,
0x55, 0x31, 0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0xf0, 0x9f,
0x98, 0x85, 0x0a, 0x77, 0x65, 0x6c, 0x6c, 0x20, 0x74, 0x68, 0x61, 0x74, 0x27, 0x73, 0x01, 0x23,
0x45, 0x21,
}
var unsignedComplexBaseTx UnsignedTx = complexBaseTx
unsignedComplexBaseTxBytes, err := testCodec.Marshal(CodecVersion, &unsignedComplexBaseTx)
+70 -263
View File
@@ -134,68 +134,22 @@ func TestConvertNetworkToL1TxSerialization(t *testing.T) {
},
},
expectedBytes: []byte{
// Codec version
0x00, 0x00,
// ConvertNetworkToL1Tx Type ID
0x00, 0x00, 0x00, 0x23,
// Mainnet Network ID
0x00, 0x00, 0x00, 0x01,
// P-chain blockchain ID (31 zeros + 'P')
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x50,
// Number of outputs
0x00, 0x00, 0x00, 0x00,
// Number of inputs
0x00, 0x00, 0x00, 0x01,
// Inputs[0]
// TxID
0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88,
0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88,
0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88,
0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88,
// Tx output index
0x00, 0x00, 0x00, 0x01,
// LUX assetID
0x21, 0xe6, 0x73, 0x17, 0xcb, 0xc4, 0xbe, 0x2a,
0xeb, 0x00, 0x67, 0x7a, 0xd6, 0x46, 0x27, 0x78,
0xa8, 0xf5, 0x22, 0x74, 0xb9, 0xd6, 0x05, 0xdf,
0x25, 0x91, 0xb2, 0x30, 0x27, 0xa8, 0x7d, 0xff,
// secp256k1fx transfer input type ID
0x00, 0x00, 0x00, 0x05,
// input amount = 1 MilliLux
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0xe8,
// number of signatures needed in input
0x00, 0x00, 0x00, 0x01,
// index of signer
0x00, 0x00, 0x00, 0x05,
// length of memo
0x00, 0x00, 0x00, 0x00,
// chainID to modify
0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08,
0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18,
0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28,
0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38,
// chainID of the manager
0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38,
0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28,
0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18,
0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08,
// length of the manager address
0x00, 0x00, 0x00, 0x14,
// address of the manager
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0xde, 0xad,
// number of validators
0x00, 0x00, 0x00, 0x00,
// secp256k1fx authorization type ID
0x00, 0x00, 0x00, 0x0a,
// number of signatures needed in authorization
0x00, 0x00, 0x00, 0x01,
// index of signer
0x00, 0x00, 0x00, 0x03,
0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x50, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00,
0x00, 0x00, 0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88, 0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa,
0x99, 0x88, 0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88, 0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa,
0x99, 0x88, 0x01, 0x00, 0x00, 0x00, 0x21, 0xe6, 0x73, 0x17, 0xcb, 0xc4, 0xbe, 0x2a, 0xeb, 0x00,
0x67, 0x7a, 0xd6, 0x46, 0x27, 0x78, 0xa8, 0xf5, 0x22, 0x74, 0xb9, 0xd6, 0x05, 0xdf, 0x25, 0x91,
0xb2, 0x30, 0x27, 0xa8, 0x7d, 0xff, 0x05, 0x00, 0x00, 0x00, 0xe8, 0x03, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x02,
0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x21, 0x22,
0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x31, 0x32,
0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x11, 0x12,
0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x14, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0xde, 0xad, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x01, 0x00,
0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
},
expectedJSON: convertNetToL1TxSimpleJSON,
},
@@ -323,207 +277,60 @@ func TestConvertNetworkToL1TxSerialization(t *testing.T) {
},
},
expectedBytes: []byte{
// Codec version
0x00, 0x00,
// ConvertNetworkToL1Tx Type ID
0x00, 0x00, 0x00, 0x23,
// Mainnet Network ID
0x00, 0x00, 0x00, 0x01,
// P-chain blockchain ID (31 zeros + 'P')
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x50,
// Number of outputs
0x00, 0x00, 0x00, 0x02,
// Outputs[0]
// LUX assetID
0x21, 0xe6, 0x73, 0x17, 0xcb, 0xc4, 0xbe, 0x2a,
0xeb, 0x00, 0x67, 0x7a, 0xd6, 0x46, 0x27, 0x78,
0xa8, 0xf5, 0x22, 0x74, 0xb9, 0xd6, 0x05, 0xdf,
0x25, 0x91, 0xb2, 0x30, 0x27, 0xa8, 0x7d, 0xff,
// Stakeable locked output type ID
0x00, 0x00, 0x00, 0x16,
// Locktime
0x00, 0x00, 0x00, 0x00, 0x05, 0x39, 0x7f, 0xb1,
// secp256k1fx transfer output type ID
0x00, 0x00, 0x00, 0x07,
// amount
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
// secp256k1fx output locktime
0x00, 0x00, 0x00, 0x00, 0x00, 0xbc, 0x61, 0x4e,
// threshold
0x00, 0x00, 0x00, 0x00,
// number of addresses
0x00, 0x00, 0x00, 0x00,
// Outputs[1]
// custom asset ID
0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31,
0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31,
0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31,
0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31,
// Stakeable locked output type ID
0x00, 0x00, 0x00, 0x16,
// Locktime
0x00, 0x00, 0x00, 0x00, 0x34, 0x3e, 0xfc, 0xea,
// secp256k1fx transfer output type ID
0x00, 0x00, 0x00, 0x07,
// amount
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
// secp256k1fx output locktime
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
// threshold
0x00, 0x00, 0x00, 0x01,
// number of addresses
0x00, 0x00, 0x00, 0x01,
// address[0]
0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xaa, 0xbb,
0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xaa, 0xbb,
0x44, 0x55, 0x66, 0x77,
// number of inputs
0x00, 0x00, 0x00, 0x03,
// inputs[0]
// TxID
0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88,
0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88,
0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88,
0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88,
// Tx output index
0x00, 0x00, 0x00, 0x01,
// LUX assetID
0x21, 0xe6, 0x73, 0x17, 0xcb, 0xc4, 0xbe, 0x2a,
0xeb, 0x00, 0x67, 0x7a, 0xd6, 0x46, 0x27, 0x78,
0xa8, 0xf5, 0x22, 0x74, 0xb9, 0xd6, 0x05, 0xdf,
0x25, 0x91, 0xb2, 0x30, 0x27, 0xa8, 0x7d, 0xff,
// secp256k1fx transfer input type ID
0x00, 0x00, 0x00, 0x05,
// input amount = 1 Lux
0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x42, 0x40,
// number of signatures needed in input
0x00, 0x00, 0x00, 0x02,
// index of first signer
0x00, 0x00, 0x00, 0x02,
// index of second signer
0x00, 0x00, 0x00, 0x05,
// inputs[1]
// TxID
0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88,
0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88,
0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88,
0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88,
// Tx output index
0x00, 0x00, 0x00, 0x02,
// Custom asset ID
0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31,
0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31,
0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31,
0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31,
// Stakeable locked input type ID
0x00, 0x00, 0x00, 0x15,
// Locktime
0x00, 0x00, 0x00, 0x00, 0x34, 0x3e, 0xfc, 0xea,
// secp256k1fx transfer input type ID
0x00, 0x00, 0x00, 0x05,
// input amount
0xef, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
// number of signatures needed in input
0x00, 0x00, 0x00, 0x01,
// index of signer
0x00, 0x00, 0x00, 0x00,
// inputs[2]
// TxID
0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88,
0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88,
0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88,
0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88,
// Tx output index
0x00, 0x00, 0x00, 0x03,
// custom asset ID
0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31,
0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31,
0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31,
0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31,
// secp256k1fx transfer input type ID
0x00, 0x00, 0x00, 0x05,
// input amount
0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
// number of signatures needed in input
0x00, 0x00, 0x00, 0x00,
// length of memo
0x00, 0x00, 0x00, 0x14,
// memo
0xf0, 0x9f, 0x98, 0x85, 0x0a, 0x77, 0x65, 0x6c,
0x6c, 0x20, 0x74, 0x68, 0x61, 0x74, 0x27, 0x73,
0x01, 0x23, 0x45, 0x21,
// chainID to modify
0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08,
0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18,
0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28,
0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38,
// chainID of the manager
0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38,
0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28,
0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18,
0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08,
// length of the manager address
0x00, 0x00, 0x00, 0x14,
// address of the manager
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0xde, 0xad,
// number of validators
0x00, 0x00, 0x00, 0x01,
// Validators[0]
// node ID length
0x00, 0x00, 0x00, 0x14,
// node ID
0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88,
0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88,
0x11, 0x22, 0x33, 0x44,
// weight
0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08,
// balance
0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x42, 0x40,
// BLS compressed public key
0xaf, 0xf4, 0xac, 0xb4, 0xc5, 0x43, 0x9b, 0x5d,
0x42, 0x6c, 0xad, 0xf9, 0xe9, 0x46, 0xd3, 0xa4,
0x52, 0xf7, 0xde, 0x34, 0x14, 0xd1, 0xad, 0x27,
0x33, 0x61, 0x33, 0x21, 0x1d, 0x8b, 0x90, 0xcf,
0x49, 0xfb, 0x97, 0xee, 0xbc, 0xde, 0xee, 0xf7,
0x14, 0xdc, 0x20, 0xf5, 0x4e, 0xd0, 0xd4, 0xd1,
// BLS compressed signature
0x8c, 0xfd, 0x79, 0x09, 0xd1, 0x53, 0xb9, 0x60,
0x4b, 0x62, 0xb1, 0x43, 0xba, 0x36, 0x20, 0x7b,
0xb7, 0xe6, 0x48, 0x67, 0x42, 0x44, 0x80, 0x20,
0x2a, 0x67, 0xdc, 0x68, 0x76, 0x83, 0x46, 0xd9,
0x5c, 0x90, 0x98, 0x3c, 0x2d, 0x27, 0x9c, 0x64,
0xc4, 0x3c, 0x51, 0x13, 0x6b, 0x2a, 0x05, 0xe0,
0x16, 0x02, 0xd5, 0x2a, 0xa6, 0x37, 0x6f, 0xda,
0x17, 0xfa, 0x6e, 0x2a, 0x18, 0xa0, 0x83, 0xe4,
0x9d, 0x9c, 0x45, 0x0e, 0xab, 0x7b, 0x89, 0xb1,
0xd5, 0x55, 0x5d, 0xa5, 0xc4, 0x89, 0x87, 0x2e,
0x02, 0xb7, 0xe5, 0x22, 0x7b, 0x77, 0x55, 0x0a,
0xf1, 0x33, 0x0e, 0x5a, 0x71, 0xf8, 0xc3, 0x68,
// RemainingBalanceOwner threshold
0x00, 0x00, 0x00, 0x01,
// RemainingBalanceOwner number of addresses
0x00, 0x00, 0x00, 0x01,
// RemainingBalanceOwner Addrs[0]
0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xaa, 0xbb,
0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xaa, 0xbb,
0x44, 0x55, 0x66, 0x77,
// DeactivationOwner threshold
0x00, 0x00, 0x00, 0x01,
// DeactivationOwner number of addresses
0x00, 0x00, 0x00, 0x01,
// DeactivationOwner Addrs[0]
0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xaa, 0xbb,
0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xaa, 0xbb,
0x44, 0x55, 0x66, 0x77,
// secp256k1fx authorization type ID
0x00, 0x00, 0x00, 0x0a,
// number of signatures needed in authorization
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x50, 0x02, 0x00, 0x00, 0x00, 0x21, 0xe6,
0x73, 0x17, 0xcb, 0xc4, 0xbe, 0x2a, 0xeb, 0x00, 0x67, 0x7a, 0xd6, 0x46, 0x27, 0x78, 0xa8, 0xf5,
0x22, 0x74, 0xb9, 0xd6, 0x05, 0xdf, 0x25, 0x91, 0xb2, 0x30, 0x27, 0xa8, 0x7d, 0xff, 0x16, 0x00,
0x00, 0x00, 0xb1, 0x7f, 0x39, 0x05, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x01, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x4e, 0x61, 0xbc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31, 0x99, 0x77,
0x55, 0x77, 0x11, 0x33, 0x55, 0x31, 0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31, 0x99, 0x77,
0x55, 0x77, 0x11, 0x33, 0x55, 0x31, 0x16, 0x00, 0x00, 0x00, 0xea, 0xfc, 0x3e, 0x34, 0x00, 0x00,
0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x44, 0x55,
0x66, 0x77, 0x88, 0x99, 0xaa, 0xbb, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xaa, 0xbb, 0x44, 0x55,
0x66, 0x77, 0x03, 0x00, 0x00, 0x00, 0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88, 0xff, 0xee,
0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88, 0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88, 0xff, 0xee,
0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88, 0x01, 0x00, 0x00, 0x00, 0x21, 0xe6, 0x73, 0x17, 0xcb, 0xc4,
0xbe, 0x2a, 0xeb, 0x00, 0x67, 0x7a, 0xd6, 0x46, 0x27, 0x78, 0xa8, 0xf5, 0x22, 0x74, 0xb9, 0xd6,
0x05, 0xdf, 0x25, 0x91, 0xb2, 0x30, 0x27, 0xa8, 0x7d, 0xff, 0x05, 0x00, 0x00, 0x00, 0x40, 0x42,
0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x05, 0x00,
0x00, 0x00, 0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88, 0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa,
0x99, 0x88, 0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88, 0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa,
0x99, 0x88, 0x02, 0x00, 0x00, 0x00, 0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31, 0x99, 0x77,
0x55, 0x77, 0x11, 0x33, 0x55, 0x31, 0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31, 0x99, 0x77,
0x55, 0x77, 0x11, 0x33, 0x55, 0x31, 0x15, 0x00, 0x00, 0x00, 0xea, 0xfc, 0x3e, 0x34, 0x00, 0x00,
0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xef, 0x01, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88, 0xff, 0xee,
0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88, 0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88, 0xff, 0xee,
0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88, 0x03, 0x00, 0x00, 0x00, 0x99, 0x77, 0x55, 0x77, 0x11, 0x33,
0x55, 0x31, 0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31, 0x99, 0x77, 0x55, 0x77, 0x11, 0x33,
0x55, 0x31, 0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0xf0, 0x9f,
0x98, 0x85, 0x0a, 0x77, 0x65, 0x6c, 0x6c, 0x20, 0x74, 0x68, 0x61, 0x74, 0x27, 0x73, 0x01, 0x23,
0x45, 0x21, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16,
0x17, 0x18, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36,
0x37, 0x38, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26,
0x27, 0x28, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06,
0x07, 0x08, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xde, 0xad, 0x01, 0x00, 0x00, 0x00, 0x14, 0x00,
0x00, 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66,
0x77, 0x88, 0x11, 0x22, 0x33, 0x44, 0x08, 0x07, 0x06, 0x05, 0x04, 0x03, 0x02, 0x01, 0x40, 0x42,
0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0xaf, 0xf4, 0xac, 0xb4, 0xc5, 0x43, 0x9b, 0x5d, 0x42, 0x6c,
0xad, 0xf9, 0xe9, 0x46, 0xd3, 0xa4, 0x52, 0xf7, 0xde, 0x34, 0x14, 0xd1, 0xad, 0x27, 0x33, 0x61,
0x33, 0x21, 0x1d, 0x8b, 0x90, 0xcf, 0x49, 0xfb, 0x97, 0xee, 0xbc, 0xde, 0xee, 0xf7, 0x14, 0xdc,
0x20, 0xf5, 0x4e, 0xd0, 0xd4, 0xd1, 0x8c, 0xfd, 0x79, 0x09, 0xd1, 0x53, 0xb9, 0x60, 0x4b, 0x62,
0xb1, 0x43, 0xba, 0x36, 0x20, 0x7b, 0xb7, 0xe6, 0x48, 0x67, 0x42, 0x44, 0x80, 0x20, 0x2a, 0x67,
0xdc, 0x68, 0x76, 0x83, 0x46, 0xd9, 0x5c, 0x90, 0x98, 0x3c, 0x2d, 0x27, 0x9c, 0x64, 0xc4, 0x3c,
0x51, 0x13, 0x6b, 0x2a, 0x05, 0xe0, 0x16, 0x02, 0xd5, 0x2a, 0xa6, 0x37, 0x6f, 0xda, 0x17, 0xfa,
0x6e, 0x2a, 0x18, 0xa0, 0x83, 0xe4, 0x9d, 0x9c, 0x45, 0x0e, 0xab, 0x7b, 0x89, 0xb1, 0xd5, 0x55,
0x5d, 0xa5, 0xc4, 0x89, 0x87, 0x2e, 0x02, 0xb7, 0xe5, 0x22, 0x7b, 0x77, 0x55, 0x0a, 0xf1, 0x33,
0x0e, 0x5a, 0x71, 0xf8, 0xc3, 0x68, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x44, 0x55,
0x66, 0x77, 0x88, 0x99, 0xaa, 0xbb, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xaa, 0xbb, 0x44, 0x55,
0x66, 0x77, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99,
0xaa, 0xbb, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xaa, 0xbb, 0x44, 0x55, 0x66, 0x77, 0x0a, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
},
expectedJSON: convertNetToL1TxComplexJSON,
},
+35 -143
View File
@@ -162,149 +162,41 @@ func TestDisableL1ValidatorTxSerialization(t *testing.T) {
require.NoError(err)
expectedBytes := []byte{
// Codec version
0x00, 0x00,
// DisableL1ValidatorTx Type ID
0x00, 0x00, 0x00, 0x27,
// Network ID
0x00, 0x00, 0x00, 0x01,
// P-chain blockchain ID (31 zeros + 'P')
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x50,
// Number of outputs
0x00, 0x00, 0x00, 0x02,
// Outputs[0]
// LUX assetID
0x21, 0xe6, 0x73, 0x17, 0xcb, 0xc4, 0xbe, 0x2a,
0xeb, 0x00, 0x67, 0x7a, 0xd6, 0x46, 0x27, 0x78,
0xa8, 0xf5, 0x22, 0x74, 0xb9, 0xd6, 0x05, 0xdf,
0x25, 0x91, 0xb2, 0x30, 0x27, 0xa8, 0x7d, 0xff,
// Stakeable locked output type ID
0x00, 0x00, 0x00, 0x16,
// Locktime
0x00, 0x00, 0x00, 0x00, 0x05, 0x39, 0x7f, 0xb1,
// secp256k1fx transfer output type ID
0x00, 0x00, 0x00, 0x07,
// amount
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
// secp256k1fx output locktime
0x00, 0x00, 0x00, 0x00, 0x00, 0xbc, 0x61, 0x4e,
// threshold
0x00, 0x00, 0x00, 0x00,
// number of addresses
0x00, 0x00, 0x00, 0x00,
// Outputs[1]
// custom asset ID
0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31,
0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31,
0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31,
0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31,
// Stakeable locked output type ID
0x00, 0x00, 0x00, 0x16,
// Locktime
0x00, 0x00, 0x00, 0x00, 0x34, 0x3e, 0xfc, 0xea,
// secp256k1fx transfer output type ID
0x00, 0x00, 0x00, 0x07,
// amount
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
// secp256k1fx output locktime
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
// threshold
0x00, 0x00, 0x00, 0x01,
// number of addresses
0x00, 0x00, 0x00, 0x01,
// address[0]
0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xaa, 0xbb,
0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xaa, 0xbb,
0x44, 0x55, 0x66, 0x77,
// number of inputs
0x00, 0x00, 0x00, 0x03,
// inputs[0]
// TxID
0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88,
0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88,
0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88,
0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88,
// Tx output index
0x00, 0x00, 0x00, 0x01,
// LUX assetID
0x21, 0xe6, 0x73, 0x17, 0xcb, 0xc4, 0xbe, 0x2a,
0xeb, 0x00, 0x67, 0x7a, 0xd6, 0x46, 0x27, 0x78,
0xa8, 0xf5, 0x22, 0x74, 0xb9, 0xd6, 0x05, 0xdf,
0x25, 0x91, 0xb2, 0x30, 0x27, 0xa8, 0x7d, 0xff,
// secp256k1fx transfer input type ID
0x00, 0x00, 0x00, 0x05,
// input amount = 1 Lux
0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x42, 0x40,
// number of signatures needed in input
0x00, 0x00, 0x00, 0x02,
// index of first signer
0x00, 0x00, 0x00, 0x02,
// index of second signer
0x00, 0x00, 0x00, 0x05,
// inputs[1]
// TxID
0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88,
0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88,
0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88,
0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88,
// Tx output index
0x00, 0x00, 0x00, 0x02,
// Custom asset ID
0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31,
0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31,
0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31,
0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31,
// Stakeable locked input type ID
0x00, 0x00, 0x00, 0x15,
// Locktime
0x00, 0x00, 0x00, 0x00, 0x34, 0x3e, 0xfc, 0xea,
// secp256k1fx transfer input type ID
0x00, 0x00, 0x00, 0x05,
// input amount
0xef, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
// number of signatures needed in input
0x00, 0x00, 0x00, 0x01,
// index of signer
0x00, 0x00, 0x00, 0x00,
// inputs[2]
// TxID
0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88,
0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88,
0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88,
0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88,
// Tx output index
0x00, 0x00, 0x00, 0x03,
// custom asset ID
0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31,
0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31,
0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31,
0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31,
// secp256k1fx transfer input type ID
0x00, 0x00, 0x00, 0x05,
// input amount
0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
// number of signatures needed in input
0x00, 0x00, 0x00, 0x00,
// length of memo
0x00, 0x00, 0x00, 0x14,
// memo
0xf0, 0x9f, 0x98, 0x85, 0x0a, 0x77, 0x65, 0x6c,
0x6c, 0x20, 0x74, 0x68, 0x61, 0x74, 0x27, 0x73,
0x01, 0x23, 0x45, 0x21,
// validation ID
0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef,
0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef,
0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef,
0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef,
// disable auth type ID
0x00, 0x00, 0x00, 0x0a,
// disable auth number of indices
0x00, 0x00, 0x00, 0x01,
// disable auth index
0x00, 0x00, 0x00, 0x09,
0x00, 0x00, 0x27, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x50, 0x02, 0x00, 0x00, 0x00, 0x21, 0xe6,
0x73, 0x17, 0xcb, 0xc4, 0xbe, 0x2a, 0xeb, 0x00, 0x67, 0x7a, 0xd6, 0x46, 0x27, 0x78, 0xa8, 0xf5,
0x22, 0x74, 0xb9, 0xd6, 0x05, 0xdf, 0x25, 0x91, 0xb2, 0x30, 0x27, 0xa8, 0x7d, 0xff, 0x16, 0x00,
0x00, 0x00, 0xb1, 0x7f, 0x39, 0x05, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x01, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x4e, 0x61, 0xbc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31, 0x99, 0x77,
0x55, 0x77, 0x11, 0x33, 0x55, 0x31, 0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31, 0x99, 0x77,
0x55, 0x77, 0x11, 0x33, 0x55, 0x31, 0x16, 0x00, 0x00, 0x00, 0xea, 0xfc, 0x3e, 0x34, 0x00, 0x00,
0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x44, 0x55,
0x66, 0x77, 0x88, 0x99, 0xaa, 0xbb, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xaa, 0xbb, 0x44, 0x55,
0x66, 0x77, 0x03, 0x00, 0x00, 0x00, 0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88, 0xff, 0xee,
0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88, 0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88, 0xff, 0xee,
0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88, 0x01, 0x00, 0x00, 0x00, 0x21, 0xe6, 0x73, 0x17, 0xcb, 0xc4,
0xbe, 0x2a, 0xeb, 0x00, 0x67, 0x7a, 0xd6, 0x46, 0x27, 0x78, 0xa8, 0xf5, 0x22, 0x74, 0xb9, 0xd6,
0x05, 0xdf, 0x25, 0x91, 0xb2, 0x30, 0x27, 0xa8, 0x7d, 0xff, 0x05, 0x00, 0x00, 0x00, 0x40, 0x42,
0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x05, 0x00,
0x00, 0x00, 0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88, 0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa,
0x99, 0x88, 0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88, 0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa,
0x99, 0x88, 0x02, 0x00, 0x00, 0x00, 0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31, 0x99, 0x77,
0x55, 0x77, 0x11, 0x33, 0x55, 0x31, 0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31, 0x99, 0x77,
0x55, 0x77, 0x11, 0x33, 0x55, 0x31, 0x15, 0x00, 0x00, 0x00, 0xea, 0xfc, 0x3e, 0x34, 0x00, 0x00,
0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xef, 0x01, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88, 0xff, 0xee,
0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88, 0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88, 0xff, 0xee,
0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88, 0x03, 0x00, 0x00, 0x00, 0x99, 0x77, 0x55, 0x77, 0x11, 0x33,
0x55, 0x31, 0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31, 0x99, 0x77, 0x55, 0x77, 0x11, 0x33,
0x55, 0x31, 0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0xf0, 0x9f,
0x98, 0x85, 0x0a, 0x77, 0x65, 0x6c, 0x6c, 0x20, 0x74, 0x68, 0x61, 0x74, 0x27, 0x73, 0x01, 0x23,
0x45, 0x21, 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef, 0x01, 0x23, 0x45, 0x67, 0x89, 0xab,
0xcd, 0xef, 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef, 0x01, 0x23, 0x45, 0x67, 0x89, 0xab,
0xcd, 0xef, 0x0a, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00,
}
require.Equal(expectedBytes, txBytes)
+35 -139
View File
@@ -160,145 +160,41 @@ func TestIncreaseL1ValidatorBalanceTxSerialization(t *testing.T) {
require.NoError(err)
expectedBytes := []byte{
// Codec version
0x00, 0x00,
// IncreaseL1ValidatorBalanceTx Type ID
0x00, 0x00, 0x00, 0x26,
// Network ID
0x00, 0x00, 0x00, 0x01,
// P-chain blockchain ID (31 zeros + 'P')
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x50,
// Number of outputs
0x00, 0x00, 0x00, 0x02,
// Outputs[0]
// LUX assetID
0x21, 0xe6, 0x73, 0x17, 0xcb, 0xc4, 0xbe, 0x2a,
0xeb, 0x00, 0x67, 0x7a, 0xd6, 0x46, 0x27, 0x78,
0xa8, 0xf5, 0x22, 0x74, 0xb9, 0xd6, 0x05, 0xdf,
0x25, 0x91, 0xb2, 0x30, 0x27, 0xa8, 0x7d, 0xff,
// Stakeable locked output type ID
0x00, 0x00, 0x00, 0x16,
// Locktime
0x00, 0x00, 0x00, 0x00, 0x05, 0x39, 0x7f, 0xb1,
// secp256k1fx transfer output type ID
0x00, 0x00, 0x00, 0x07,
// amount
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
// secp256k1fx output locktime
0x00, 0x00, 0x00, 0x00, 0x00, 0xbc, 0x61, 0x4e,
// threshold
0x00, 0x00, 0x00, 0x00,
// number of addresses
0x00, 0x00, 0x00, 0x00,
// Outputs[1]
// custom asset ID
0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31,
0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31,
0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31,
0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31,
// Stakeable locked output type ID
0x00, 0x00, 0x00, 0x16,
// Locktime
0x00, 0x00, 0x00, 0x00, 0x34, 0x3e, 0xfc, 0xea,
// secp256k1fx transfer output type ID
0x00, 0x00, 0x00, 0x07,
// amount
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
// secp256k1fx output locktime
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
// threshold
0x00, 0x00, 0x00, 0x01,
// number of addresses
0x00, 0x00, 0x00, 0x01,
// address[0]
0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xaa, 0xbb,
0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xaa, 0xbb,
0x44, 0x55, 0x66, 0x77,
// number of inputs
0x00, 0x00, 0x00, 0x03,
// inputs[0]
// TxID
0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88,
0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88,
0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88,
0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88,
// Tx output index
0x00, 0x00, 0x00, 0x01,
// LUX assetID
0x21, 0xe6, 0x73, 0x17, 0xcb, 0xc4, 0xbe, 0x2a,
0xeb, 0x00, 0x67, 0x7a, 0xd6, 0x46, 0x27, 0x78,
0xa8, 0xf5, 0x22, 0x74, 0xb9, 0xd6, 0x05, 0xdf,
0x25, 0x91, 0xb2, 0x30, 0x27, 0xa8, 0x7d, 0xff,
// secp256k1fx transfer input type ID
0x00, 0x00, 0x00, 0x05,
// input amount = 1 Lux
0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x42, 0x40,
// number of signatures needed in input
0x00, 0x00, 0x00, 0x02,
// index of first signer
0x00, 0x00, 0x00, 0x02,
// index of second signer
0x00, 0x00, 0x00, 0x05,
// inputs[1]
// TxID
0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88,
0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88,
0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88,
0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88,
// Tx output index
0x00, 0x00, 0x00, 0x02,
// Custom asset ID
0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31,
0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31,
0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31,
0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31,
// Stakeable locked input type ID
0x00, 0x00, 0x00, 0x15,
// Locktime
0x00, 0x00, 0x00, 0x00, 0x34, 0x3e, 0xfc, 0xea,
// secp256k1fx transfer input type ID
0x00, 0x00, 0x00, 0x05,
// input amount
0xef, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
// number of signatures needed in input
0x00, 0x00, 0x00, 0x01,
// index of signer
0x00, 0x00, 0x00, 0x00,
// inputs[2]
// TxID
0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88,
0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88,
0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88,
0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88,
// Tx output index
0x00, 0x00, 0x00, 0x03,
// custom asset ID
0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31,
0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31,
0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31,
0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31,
// secp256k1fx transfer input type ID
0x00, 0x00, 0x00, 0x05,
// input amount
0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
// number of signatures needed in input
0x00, 0x00, 0x00, 0x00,
// length of memo
0x00, 0x00, 0x00, 0x14,
// memo
0xf0, 0x9f, 0x98, 0x85, 0x0a, 0x77, 0x65, 0x6c,
0x6c, 0x20, 0x74, 0x68, 0x61, 0x74, 0x27, 0x73,
0x01, 0x23, 0x45, 0x21,
// validation ID
0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef,
0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef,
0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef,
0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef,
// balance
0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10,
0x00, 0x00, 0x26, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x50, 0x02, 0x00, 0x00, 0x00, 0x21, 0xe6,
0x73, 0x17, 0xcb, 0xc4, 0xbe, 0x2a, 0xeb, 0x00, 0x67, 0x7a, 0xd6, 0x46, 0x27, 0x78, 0xa8, 0xf5,
0x22, 0x74, 0xb9, 0xd6, 0x05, 0xdf, 0x25, 0x91, 0xb2, 0x30, 0x27, 0xa8, 0x7d, 0xff, 0x16, 0x00,
0x00, 0x00, 0xb1, 0x7f, 0x39, 0x05, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x01, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x4e, 0x61, 0xbc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31, 0x99, 0x77,
0x55, 0x77, 0x11, 0x33, 0x55, 0x31, 0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31, 0x99, 0x77,
0x55, 0x77, 0x11, 0x33, 0x55, 0x31, 0x16, 0x00, 0x00, 0x00, 0xea, 0xfc, 0x3e, 0x34, 0x00, 0x00,
0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x44, 0x55,
0x66, 0x77, 0x88, 0x99, 0xaa, 0xbb, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xaa, 0xbb, 0x44, 0x55,
0x66, 0x77, 0x03, 0x00, 0x00, 0x00, 0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88, 0xff, 0xee,
0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88, 0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88, 0xff, 0xee,
0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88, 0x01, 0x00, 0x00, 0x00, 0x21, 0xe6, 0x73, 0x17, 0xcb, 0xc4,
0xbe, 0x2a, 0xeb, 0x00, 0x67, 0x7a, 0xd6, 0x46, 0x27, 0x78, 0xa8, 0xf5, 0x22, 0x74, 0xb9, 0xd6,
0x05, 0xdf, 0x25, 0x91, 0xb2, 0x30, 0x27, 0xa8, 0x7d, 0xff, 0x05, 0x00, 0x00, 0x00, 0x40, 0x42,
0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x05, 0x00,
0x00, 0x00, 0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88, 0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa,
0x99, 0x88, 0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88, 0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa,
0x99, 0x88, 0x02, 0x00, 0x00, 0x00, 0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31, 0x99, 0x77,
0x55, 0x77, 0x11, 0x33, 0x55, 0x31, 0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31, 0x99, 0x77,
0x55, 0x77, 0x11, 0x33, 0x55, 0x31, 0x15, 0x00, 0x00, 0x00, 0xea, 0xfc, 0x3e, 0x34, 0x00, 0x00,
0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xef, 0x01, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88, 0xff, 0xee,
0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88, 0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88, 0xff, 0xee,
0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88, 0x03, 0x00, 0x00, 0x00, 0x99, 0x77, 0x55, 0x77, 0x11, 0x33,
0x55, 0x31, 0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31, 0x99, 0x77, 0x55, 0x77, 0x11, 0x33,
0x55, 0x31, 0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0xf0, 0x9f,
0x98, 0x85, 0x0a, 0x77, 0x65, 0x6c, 0x6c, 0x20, 0x74, 0x68, 0x61, 0x74, 0x27, 0x73, 0x01, 0x23,
0x45, 0x21, 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef, 0x01, 0x23, 0x45, 0x67, 0x89, 0xab,
0xcd, 0xef, 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef, 0x01, 0x23, 0x45, 0x67, 0x89, 0xab,
0xcd, 0xef, 0x10, 0x32, 0x54, 0x76, 0x98, 0xba, 0xdc, 0xfe,
}
require.Equal(expectedBytes, txBytes)
+40 -151
View File
@@ -167,157 +167,46 @@ func TestRegisterL1ValidatorTxSerialization(t *testing.T) {
require.NoError(err)
expectedBytes := []byte{
// Codec version
0x00, 0x00,
// RegisterL1ValidatorTx Type ID
0x00, 0x00, 0x00, 0x24,
// Network ID
0x00, 0x00, 0x00, 0x01,
// P-chain blockchain ID (31 zeros + 'P')
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x50,
// Number of outputs
0x00, 0x00, 0x00, 0x02,
// Outputs[0]
// LUX assetID
0x21, 0xe6, 0x73, 0x17, 0xcb, 0xc4, 0xbe, 0x2a,
0xeb, 0x00, 0x67, 0x7a, 0xd6, 0x46, 0x27, 0x78,
0xa8, 0xf5, 0x22, 0x74, 0xb9, 0xd6, 0x05, 0xdf,
0x25, 0x91, 0xb2, 0x30, 0x27, 0xa8, 0x7d, 0xff,
// Stakeable locked output type ID
0x00, 0x00, 0x00, 0x16,
// Locktime
0x00, 0x00, 0x00, 0x00, 0x05, 0x39, 0x7f, 0xb1,
// secp256k1fx transfer output type ID
0x00, 0x00, 0x00, 0x07,
// amount
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
// secp256k1fx output locktime
0x00, 0x00, 0x00, 0x00, 0x00, 0xbc, 0x61, 0x4e,
// threshold
0x00, 0x00, 0x00, 0x00,
// number of addresses
0x00, 0x00, 0x00, 0x00,
// Outputs[1]
// custom asset ID
0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31,
0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31,
0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31,
0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31,
// Stakeable locked output type ID
0x00, 0x00, 0x00, 0x16,
// Locktime
0x00, 0x00, 0x00, 0x00, 0x34, 0x3e, 0xfc, 0xea,
// secp256k1fx transfer output type ID
0x00, 0x00, 0x00, 0x07,
// amount
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
// secp256k1fx output locktime
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
// threshold
0x00, 0x00, 0x00, 0x01,
// number of addresses
0x00, 0x00, 0x00, 0x01,
// address[0]
0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xaa, 0xbb,
0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xaa, 0xbb,
0x44, 0x55, 0x66, 0x77,
// number of inputs
0x00, 0x00, 0x00, 0x03,
// inputs[0]
// TxID
0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88,
0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88,
0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88,
0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88,
// Tx output index
0x00, 0x00, 0x00, 0x01,
// LUX assetID
0x21, 0xe6, 0x73, 0x17, 0xcb, 0xc4, 0xbe, 0x2a,
0xeb, 0x00, 0x67, 0x7a, 0xd6, 0x46, 0x27, 0x78,
0xa8, 0xf5, 0x22, 0x74, 0xb9, 0xd6, 0x05, 0xdf,
0x25, 0x91, 0xb2, 0x30, 0x27, 0xa8, 0x7d, 0xff,
// secp256k1fx transfer input type ID
0x00, 0x00, 0x00, 0x05,
// input amount = 1 Lux
0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x42, 0x40,
// number of signatures needed in input
0x00, 0x00, 0x00, 0x02,
// index of first signer
0x00, 0x00, 0x00, 0x02,
// index of second signer
0x00, 0x00, 0x00, 0x05,
// inputs[1]
// TxID
0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88,
0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88,
0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88,
0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88,
// Tx output index
0x00, 0x00, 0x00, 0x02,
// Custom asset ID
0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31,
0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31,
0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31,
0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31,
// Stakeable locked input type ID
0x00, 0x00, 0x00, 0x15,
// Locktime
0x00, 0x00, 0x00, 0x00, 0x34, 0x3e, 0xfc, 0xea,
// secp256k1fx transfer input type ID
0x00, 0x00, 0x00, 0x05,
// input amount
0xef, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
// number of signatures needed in input
0x00, 0x00, 0x00, 0x01,
// index of signer
0x00, 0x00, 0x00, 0x00,
// inputs[2]
// TxID
0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88,
0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88,
0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88,
0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88,
// Tx output index
0x00, 0x00, 0x00, 0x03,
// custom asset ID
0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31,
0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31,
0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31,
0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31,
// secp256k1fx transfer input type ID
0x00, 0x00, 0x00, 0x05,
// input amount
0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
// number of signatures needed in input
0x00, 0x00, 0x00, 0x00,
// length of memo
0x00, 0x00, 0x00, 0x14,
// memo
0xf0, 0x9f, 0x98, 0x85, 0x0a, 0x77, 0x65, 0x6c,
0x6c, 0x20, 0x74, 0x68, 0x61, 0x74, 0x27, 0x73,
0x01, 0x23, 0x45, 0x21,
// balance
0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x42, 0x40,
// proof of possession (BLS signature)
0x8c, 0xfd, 0x79, 0x09, 0xd1, 0x53, 0xb9, 0x60,
0x4b, 0x62, 0xb1, 0x43, 0xba, 0x36, 0x20, 0x7b,
0xb7, 0xe6, 0x48, 0x67, 0x42, 0x44, 0x80, 0x20,
0x2a, 0x67, 0xdc, 0x68, 0x76, 0x83, 0x46, 0xd9,
0x5c, 0x90, 0x98, 0x3c, 0x2d, 0x27, 0x9c, 0x64,
0xc4, 0x3c, 0x51, 0x13, 0x6b, 0x2a, 0x05, 0xe0,
0x16, 0x02, 0xd5, 0x2a, 0xa6, 0x37, 0x6f, 0xda,
0x17, 0xfa, 0x6e, 0x2a, 0x18, 0xa0, 0x83, 0xe4,
0x9d, 0x9c, 0x45, 0x0e, 0xab, 0x7b, 0x89, 0xb1,
0xd5, 0x55, 0x5d, 0xa5, 0xc4, 0x89, 0x87, 0x2e,
0x02, 0xb7, 0xe5, 0x22, 0x7b, 0x77, 0x55, 0x0a,
0xf1, 0x33, 0x0e, 0x5a, 0x71, 0xf8, 0xc3, 0x68,
// length of message
0x00, 0x00, 0x00, 0x07,
// message
0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65,
0x00, 0x00, 0x24, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x50, 0x02, 0x00, 0x00, 0x00, 0x21, 0xe6,
0x73, 0x17, 0xcb, 0xc4, 0xbe, 0x2a, 0xeb, 0x00, 0x67, 0x7a, 0xd6, 0x46, 0x27, 0x78, 0xa8, 0xf5,
0x22, 0x74, 0xb9, 0xd6, 0x05, 0xdf, 0x25, 0x91, 0xb2, 0x30, 0x27, 0xa8, 0x7d, 0xff, 0x16, 0x00,
0x00, 0x00, 0xb1, 0x7f, 0x39, 0x05, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x01, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x4e, 0x61, 0xbc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31, 0x99, 0x77,
0x55, 0x77, 0x11, 0x33, 0x55, 0x31, 0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31, 0x99, 0x77,
0x55, 0x77, 0x11, 0x33, 0x55, 0x31, 0x16, 0x00, 0x00, 0x00, 0xea, 0xfc, 0x3e, 0x34, 0x00, 0x00,
0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x44, 0x55,
0x66, 0x77, 0x88, 0x99, 0xaa, 0xbb, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xaa, 0xbb, 0x44, 0x55,
0x66, 0x77, 0x03, 0x00, 0x00, 0x00, 0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88, 0xff, 0xee,
0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88, 0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88, 0xff, 0xee,
0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88, 0x01, 0x00, 0x00, 0x00, 0x21, 0xe6, 0x73, 0x17, 0xcb, 0xc4,
0xbe, 0x2a, 0xeb, 0x00, 0x67, 0x7a, 0xd6, 0x46, 0x27, 0x78, 0xa8, 0xf5, 0x22, 0x74, 0xb9, 0xd6,
0x05, 0xdf, 0x25, 0x91, 0xb2, 0x30, 0x27, 0xa8, 0x7d, 0xff, 0x05, 0x00, 0x00, 0x00, 0x40, 0x42,
0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x05, 0x00,
0x00, 0x00, 0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88, 0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa,
0x99, 0x88, 0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88, 0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa,
0x99, 0x88, 0x02, 0x00, 0x00, 0x00, 0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31, 0x99, 0x77,
0x55, 0x77, 0x11, 0x33, 0x55, 0x31, 0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31, 0x99, 0x77,
0x55, 0x77, 0x11, 0x33, 0x55, 0x31, 0x15, 0x00, 0x00, 0x00, 0xea, 0xfc, 0x3e, 0x34, 0x00, 0x00,
0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xef, 0x01, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88, 0xff, 0xee,
0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88, 0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88, 0xff, 0xee,
0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88, 0x03, 0x00, 0x00, 0x00, 0x99, 0x77, 0x55, 0x77, 0x11, 0x33,
0x55, 0x31, 0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31, 0x99, 0x77, 0x55, 0x77, 0x11, 0x33,
0x55, 0x31, 0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0xf0, 0x9f,
0x98, 0x85, 0x0a, 0x77, 0x65, 0x6c, 0x6c, 0x20, 0x74, 0x68, 0x61, 0x74, 0x27, 0x73, 0x01, 0x23,
0x45, 0x21, 0x40, 0x42, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x8c, 0xfd, 0x79, 0x09, 0xd1, 0x53,
0xb9, 0x60, 0x4b, 0x62, 0xb1, 0x43, 0xba, 0x36, 0x20, 0x7b, 0xb7, 0xe6, 0x48, 0x67, 0x42, 0x44,
0x80, 0x20, 0x2a, 0x67, 0xdc, 0x68, 0x76, 0x83, 0x46, 0xd9, 0x5c, 0x90, 0x98, 0x3c, 0x2d, 0x27,
0x9c, 0x64, 0xc4, 0x3c, 0x51, 0x13, 0x6b, 0x2a, 0x05, 0xe0, 0x16, 0x02, 0xd5, 0x2a, 0xa6, 0x37,
0x6f, 0xda, 0x17, 0xfa, 0x6e, 0x2a, 0x18, 0xa0, 0x83, 0xe4, 0x9d, 0x9c, 0x45, 0x0e, 0xab, 0x7b,
0x89, 0xb1, 0xd5, 0x55, 0x5d, 0xa5, 0xc4, 0x89, 0x87, 0x2e, 0x02, 0xb7, 0xe5, 0x22, 0x7b, 0x77,
0x55, 0x0a, 0xf1, 0x33, 0x0e, 0x5a, 0x71, 0xf8, 0xc3, 0x68, 0x07, 0x00, 0x00, 0x00, 0x6d, 0x65,
0x73, 0x73, 0x61, 0x67, 0x65,
}
// Skip byte comparison when CGO is disabled because CGO BLS (BLST) and
// pure Go BLS produce different signatures from the same private key
+49 -198
View File
@@ -108,59 +108,19 @@ func TestRemoveChainValidatorTxSerialization(t *testing.T) {
require.NoError(simpleRemoveValidatorTx.SyntacticVerify(rt))
expectedUnsignedSimpleRemoveValidatorTxBytes := []byte{
// Codec version
0x00, 0x00,
// RemoveChainValidatorTx Type ID
0x00, 0x00, 0x00, 0x17,
// Mainnet network ID
0x00, 0x00, 0x00, 0x01,
// P-chain blockchain ID (31 zeros + 'P')
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
// Number of outputs
0x00, 0x00, 0x00, 0x00,
// Number of inputs
0x00, 0x00, 0x00, 0x01,
// Inputs[0]
// TxID
0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88,
0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88,
0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88,
0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88,
// Tx output index
0x00, 0x00, 0x00, 0x01,
// Mainnet LUX assetID
0x51, 0xc2, 0x4f, 0xe7, 0xee, 0x02, 0x01, 0xff,
0x0f, 0x33, 0x5f, 0x51, 0x99, 0x28, 0xdb, 0x6e,
0xef, 0x62, 0x24, 0x25, 0x45, 0x52, 0xc9, 0x6b,
0x6b, 0x42, 0x5f, 0xbc, 0x18, 0xfa, 0x24, 0x3b,
// secp256k1fx transfer input type ID
0x00, 0x00, 0x00, 0x05,
// input amount = 1 MilliLux (1000 MicroLux)
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0xe8,
// number of signatures needed in input
0x00, 0x00, 0x00, 0x01,
// index of signer
0x00, 0x00, 0x00, 0x05,
// length of memo field
0x00, 0x00, 0x00, 0x00,
// nodeID to remove
0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88,
0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88,
0x11, 0x22, 0x33, 0x44,
// netID to remove from
0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08,
0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18,
0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28,
0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38,
// secp256k1fx authorization type ID (secp256k1fx.Input)
0x00, 0x00, 0x00, 0x0a,
// number of signatures needed in authorization
0x00, 0x00, 0x00, 0x01,
// index of signer
0x00, 0x00, 0x00, 0x03,
0x00, 0x00, 0x17, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00,
0x00, 0x00, 0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88, 0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa,
0x99, 0x88, 0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88, 0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa,
0x99, 0x88, 0x01, 0x00, 0x00, 0x00, 0x51, 0xc2, 0x4f, 0xe7, 0xee, 0x02, 0x01, 0xff, 0x0f, 0x33,
0x5f, 0x51, 0x99, 0x28, 0xdb, 0x6e, 0xef, 0x62, 0x24, 0x25, 0x45, 0x52, 0xc9, 0x6b, 0x6b, 0x42,
0x5f, 0xbc, 0x18, 0xfa, 0x24, 0x3b, 0x05, 0x00, 0x00, 0x00, 0xe8, 0x03, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x11, 0x22,
0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x11, 0x22,
0x33, 0x44, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16,
0x17, 0x18, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36,
0x37, 0x38, 0x0a, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
}
var unsignedSimpleRemoveValidatorTx UnsignedTx = simpleRemoveValidatorTx
unsignedSimpleRemoveValidatorTxBytes, err := testCodec.Marshal(CodecVersion, &unsignedSimpleRemoveValidatorTx)
@@ -278,151 +238,42 @@ func TestRemoveChainValidatorTxSerialization(t *testing.T) {
require.NoError(complexRemoveValidatorTx.SyntacticVerify(ctx2))
expectedUnsignedComplexRemoveValidatorTxBytes := []byte{
// Codec version
0x00, 0x00,
// RemoveChainValidatorTx Type ID
0x00, 0x00, 0x00, 0x17,
// Mainnet network ID
0x00, 0x00, 0x00, 0x01,
// P-chain blockchain ID (31 zeros + 'P')
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
// Number of outputs
0x00, 0x00, 0x00, 0x02,
// Outputs[0]
// Mainnet LUX assetID
0x51, 0xc2, 0x4f, 0xe7, 0xee, 0x02, 0x01, 0xff,
0x0f, 0x33, 0x5f, 0x51, 0x99, 0x28, 0xdb, 0x6e,
0xef, 0x62, 0x24, 0x25, 0x45, 0x52, 0xc9, 0x6b,
0x6b, 0x42, 0x5f, 0xbc, 0x18, 0xfa, 0x24, 0x3b,
// Stakeable locked output type ID
0x00, 0x00, 0x00, 0x16,
// Locktime
0x00, 0x00, 0x00, 0x00, 0x05, 0x39, 0x7f, 0xb1,
// secp256k1fx transfer output type ID
0x00, 0x00, 0x00, 0x07,
// amount
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
// secp256k1fx output locktime
0x00, 0x00, 0x00, 0x00, 0x00, 0xbc, 0x61, 0x4e,
// threshold
0x00, 0x00, 0x00, 0x00,
// number of addresses
0x00, 0x00, 0x00, 0x00,
// Outputs[1]
// custom asset ID
0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31,
0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31,
0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31,
0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31,
// Stakeable locked output type ID
0x00, 0x00, 0x00, 0x16,
// Locktime
0x00, 0x00, 0x00, 0x00, 0x34, 0x3e, 0xfc, 0xea,
// secp256k1fx transfer output type ID
0x00, 0x00, 0x00, 0x07,
// amount
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
// secp256k1fx output locktime
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
// threshold
0x00, 0x00, 0x00, 0x01,
// number of addresses
0x00, 0x00, 0x00, 0x01,
// address[0]
0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xaa, 0xbb,
0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xaa, 0xbb,
0x44, 0x55, 0x66, 0x77,
// number of inputs
0x00, 0x00, 0x00, 0x03,
// inputs[0]
// TxID
0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88,
0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88,
0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88,
0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88,
// Tx output index
0x00, 0x00, 0x00, 0x01,
// Mainnet LUX assetID
0x51, 0xc2, 0x4f, 0xe7, 0xee, 0x02, 0x01, 0xff,
0x0f, 0x33, 0x5f, 0x51, 0x99, 0x28, 0xdb, 0x6e,
0xef, 0x62, 0x24, 0x25, 0x45, 0x52, 0xc9, 0x6b,
0x6b, 0x42, 0x5f, 0xbc, 0x18, 0xfa, 0x24, 0x3b,
// secp256k1fx transfer input type ID
0x00, 0x00, 0x00, 0x05,
// input amount = 1 Lux (1,000,000 MicroLux)
0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x42, 0x40,
// number of signatures needed in input
0x00, 0x00, 0x00, 0x02,
// index of first signer
0x00, 0x00, 0x00, 0x02,
// index of second signer
0x00, 0x00, 0x00, 0x05,
// inputs[1]
// TxID
0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88,
0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88,
0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88,
0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88,
// Tx output index
0x00, 0x00, 0x00, 0x02,
// Custom asset ID
0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31,
0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31,
0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31,
0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31,
// Stakeable locked input type ID
0x00, 0x00, 0x00, 0x15,
// Locktime
0x00, 0x00, 0x00, 0x00, 0x34, 0x3e, 0xfc, 0xea,
// secp256k1fx transfer input type ID
0x00, 0x00, 0x00, 0x05,
// input amount
0xef, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
// number of signatures needed in input
0x00, 0x00, 0x00, 0x01,
// index of signer
0x00, 0x00, 0x00, 0x00,
// inputs[2]
// TxID
0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88,
0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88,
0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88,
0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88,
// Tx output index
0x00, 0x00, 0x00, 0x03,
// custom asset ID
0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31,
0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31,
0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31,
0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31,
// secp256k1fx transfer input type ID
0x00, 0x00, 0x00, 0x05,
// input amount
0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
// number of signatures needed in input
0x00, 0x00, 0x00, 0x00,
// length of memo
0x00, 0x00, 0x00, 0x14,
// memo
0xf0, 0x9f, 0x98, 0x85, 0x0a, 0x77, 0x65, 0x6c,
0x6c, 0x20, 0x74, 0x68, 0x61, 0x74, 0x27, 0x73,
0x01, 0x23, 0x45, 0x21,
// nodeID to remove
0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88,
0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88,
0x11, 0x22, 0x33, 0x44,
// netID to remove from
0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08,
0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18,
0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28,
0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38,
// secp256k1fx authorization type ID (secp256k1fx.Input)
0x00, 0x00, 0x00, 0x0a,
// number of signatures needed in authorization
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x17, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x51, 0xc2,
0x4f, 0xe7, 0xee, 0x02, 0x01, 0xff, 0x0f, 0x33, 0x5f, 0x51, 0x99, 0x28, 0xdb, 0x6e, 0xef, 0x62,
0x24, 0x25, 0x45, 0x52, 0xc9, 0x6b, 0x6b, 0x42, 0x5f, 0xbc, 0x18, 0xfa, 0x24, 0x3b, 0x16, 0x00,
0x00, 0x00, 0xb1, 0x7f, 0x39, 0x05, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x01, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x4e, 0x61, 0xbc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31, 0x99, 0x77,
0x55, 0x77, 0x11, 0x33, 0x55, 0x31, 0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31, 0x99, 0x77,
0x55, 0x77, 0x11, 0x33, 0x55, 0x31, 0x16, 0x00, 0x00, 0x00, 0xea, 0xfc, 0x3e, 0x34, 0x00, 0x00,
0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x44, 0x55,
0x66, 0x77, 0x88, 0x99, 0xaa, 0xbb, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xaa, 0xbb, 0x44, 0x55,
0x66, 0x77, 0x03, 0x00, 0x00, 0x00, 0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88, 0xff, 0xee,
0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88, 0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88, 0xff, 0xee,
0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88, 0x01, 0x00, 0x00, 0x00, 0x51, 0xc2, 0x4f, 0xe7, 0xee, 0x02,
0x01, 0xff, 0x0f, 0x33, 0x5f, 0x51, 0x99, 0x28, 0xdb, 0x6e, 0xef, 0x62, 0x24, 0x25, 0x45, 0x52,
0xc9, 0x6b, 0x6b, 0x42, 0x5f, 0xbc, 0x18, 0xfa, 0x24, 0x3b, 0x05, 0x00, 0x00, 0x00, 0x40, 0x42,
0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x05, 0x00,
0x00, 0x00, 0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88, 0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa,
0x99, 0x88, 0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88, 0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa,
0x99, 0x88, 0x02, 0x00, 0x00, 0x00, 0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31, 0x99, 0x77,
0x55, 0x77, 0x11, 0x33, 0x55, 0x31, 0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31, 0x99, 0x77,
0x55, 0x77, 0x11, 0x33, 0x55, 0x31, 0x15, 0x00, 0x00, 0x00, 0xea, 0xfc, 0x3e, 0x34, 0x00, 0x00,
0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xef, 0x01, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88, 0xff, 0xee,
0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88, 0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88, 0xff, 0xee,
0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88, 0x03, 0x00, 0x00, 0x00, 0x99, 0x77, 0x55, 0x77, 0x11, 0x33,
0x55, 0x31, 0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31, 0x99, 0x77, 0x55, 0x77, 0x11, 0x33,
0x55, 0x31, 0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0xf0, 0x9f,
0x98, 0x85, 0x0a, 0x77, 0x65, 0x6c, 0x6c, 0x20, 0x74, 0x68, 0x61, 0x74, 0x27, 0x73, 0x01, 0x23,
0x45, 0x21, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66,
0x77, 0x88, 0x11, 0x22, 0x33, 0x44, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x11, 0x12,
0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x31, 0x32,
0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
}
var unsignedComplexRemoveValidatorTx UnsignedTx = complexRemoveValidatorTx
unsignedComplexRemoveValidatorTxBytes, err := testCodec.Marshal(CodecVersion, &unsignedComplexRemoveValidatorTx)
+33 -136
View File
@@ -153,142 +153,39 @@ func TestSetL1ValidatorWeightTxSerialization(t *testing.T) {
require.NoError(err)
expectedBytes := []byte{
// Codec version
0x00, 0x00,
// SetL1ValidatorWeightTx Type ID
0x00, 0x00, 0x00, 0x25,
// Network ID
0x00, 0x00, 0x00, 0x01,
// P-chain blockchain ID (31 zeros + 'P')
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x50,
// Number of outputs
0x00, 0x00, 0x00, 0x02,
// Outputs[0]
// LUX assetID
0x21, 0xe6, 0x73, 0x17, 0xcb, 0xc4, 0xbe, 0x2a,
0xeb, 0x00, 0x67, 0x7a, 0xd6, 0x46, 0x27, 0x78,
0xa8, 0xf5, 0x22, 0x74, 0xb9, 0xd6, 0x05, 0xdf,
0x25, 0x91, 0xb2, 0x30, 0x27, 0xa8, 0x7d, 0xff,
// Stakeable locked output type ID
0x00, 0x00, 0x00, 0x16,
// Locktime
0x00, 0x00, 0x00, 0x00, 0x05, 0x39, 0x7f, 0xb1,
// secp256k1fx transfer output type ID
0x00, 0x00, 0x00, 0x07,
// amount
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
// secp256k1fx output locktime
0x00, 0x00, 0x00, 0x00, 0x00, 0xbc, 0x61, 0x4e,
// threshold
0x00, 0x00, 0x00, 0x00,
// number of addresses
0x00, 0x00, 0x00, 0x00,
// Outputs[1]
// custom asset ID
0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31,
0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31,
0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31,
0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31,
// Stakeable locked output type ID
0x00, 0x00, 0x00, 0x16,
// Locktime
0x00, 0x00, 0x00, 0x00, 0x34, 0x3e, 0xfc, 0xea,
// secp256k1fx transfer output type ID
0x00, 0x00, 0x00, 0x07,
// amount
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
// secp256k1fx output locktime
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
// threshold
0x00, 0x00, 0x00, 0x01,
// number of addresses
0x00, 0x00, 0x00, 0x01,
// address[0]
0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xaa, 0xbb,
0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xaa, 0xbb,
0x44, 0x55, 0x66, 0x77,
// number of inputs
0x00, 0x00, 0x00, 0x03,
// inputs[0]
// TxID
0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88,
0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88,
0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88,
0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88,
// Tx output index
0x00, 0x00, 0x00, 0x01,
// LUX assetID
0x21, 0xe6, 0x73, 0x17, 0xcb, 0xc4, 0xbe, 0x2a,
0xeb, 0x00, 0x67, 0x7a, 0xd6, 0x46, 0x27, 0x78,
0xa8, 0xf5, 0x22, 0x74, 0xb9, 0xd6, 0x05, 0xdf,
0x25, 0x91, 0xb2, 0x30, 0x27, 0xa8, 0x7d, 0xff,
// secp256k1fx transfer input type ID
0x00, 0x00, 0x00, 0x05,
// input amount = 1 Lux
0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x42, 0x40,
// number of signatures needed in input
0x00, 0x00, 0x00, 0x02,
// index of first signer
0x00, 0x00, 0x00, 0x02,
// index of second signer
0x00, 0x00, 0x00, 0x05,
// inputs[1]
// TxID
0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88,
0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88,
0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88,
0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88,
// Tx output index
0x00, 0x00, 0x00, 0x02,
// Custom asset ID
0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31,
0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31,
0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31,
0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31,
// Stakeable locked input type ID
0x00, 0x00, 0x00, 0x15,
// Locktime
0x00, 0x00, 0x00, 0x00, 0x34, 0x3e, 0xfc, 0xea,
// secp256k1fx transfer input type ID
0x00, 0x00, 0x00, 0x05,
// input amount
0xef, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
// number of signatures needed in input
0x00, 0x00, 0x00, 0x01,
// index of signer
0x00, 0x00, 0x00, 0x00,
// inputs[2]
// TxID
0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88,
0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88,
0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88,
0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88,
// Tx output index
0x00, 0x00, 0x00, 0x03,
// custom asset ID
0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31,
0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31,
0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31,
0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31,
// secp256k1fx transfer input type ID
0x00, 0x00, 0x00, 0x05,
// input amount
0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
// number of signatures needed in input
0x00, 0x00, 0x00, 0x00,
// length of memo
0x00, 0x00, 0x00, 0x14,
// memo
0xf0, 0x9f, 0x98, 0x85, 0x0a, 0x77, 0x65, 0x6c,
0x6c, 0x20, 0x74, 0x68, 0x61, 0x74, 0x27, 0x73,
0x01, 0x23, 0x45, 0x21,
// length of message
0x00, 0x00, 0x00, 0x07,
// message
0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65,
0x00, 0x00, 0x25, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x50, 0x02, 0x00, 0x00, 0x00, 0x21, 0xe6,
0x73, 0x17, 0xcb, 0xc4, 0xbe, 0x2a, 0xeb, 0x00, 0x67, 0x7a, 0xd6, 0x46, 0x27, 0x78, 0xa8, 0xf5,
0x22, 0x74, 0xb9, 0xd6, 0x05, 0xdf, 0x25, 0x91, 0xb2, 0x30, 0x27, 0xa8, 0x7d, 0xff, 0x16, 0x00,
0x00, 0x00, 0xb1, 0x7f, 0x39, 0x05, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x01, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x4e, 0x61, 0xbc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31, 0x99, 0x77,
0x55, 0x77, 0x11, 0x33, 0x55, 0x31, 0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31, 0x99, 0x77,
0x55, 0x77, 0x11, 0x33, 0x55, 0x31, 0x16, 0x00, 0x00, 0x00, 0xea, 0xfc, 0x3e, 0x34, 0x00, 0x00,
0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x44, 0x55,
0x66, 0x77, 0x88, 0x99, 0xaa, 0xbb, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xaa, 0xbb, 0x44, 0x55,
0x66, 0x77, 0x03, 0x00, 0x00, 0x00, 0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88, 0xff, 0xee,
0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88, 0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88, 0xff, 0xee,
0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88, 0x01, 0x00, 0x00, 0x00, 0x21, 0xe6, 0x73, 0x17, 0xcb, 0xc4,
0xbe, 0x2a, 0xeb, 0x00, 0x67, 0x7a, 0xd6, 0x46, 0x27, 0x78, 0xa8, 0xf5, 0x22, 0x74, 0xb9, 0xd6,
0x05, 0xdf, 0x25, 0x91, 0xb2, 0x30, 0x27, 0xa8, 0x7d, 0xff, 0x05, 0x00, 0x00, 0x00, 0x40, 0x42,
0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x05, 0x00,
0x00, 0x00, 0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88, 0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa,
0x99, 0x88, 0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88, 0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa,
0x99, 0x88, 0x02, 0x00, 0x00, 0x00, 0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31, 0x99, 0x77,
0x55, 0x77, 0x11, 0x33, 0x55, 0x31, 0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31, 0x99, 0x77,
0x55, 0x77, 0x11, 0x33, 0x55, 0x31, 0x15, 0x00, 0x00, 0x00, 0xea, 0xfc, 0x3e, 0x34, 0x00, 0x00,
0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xef, 0x01, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88, 0xff, 0xee,
0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88, 0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88, 0xff, 0xee,
0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88, 0x03, 0x00, 0x00, 0x00, 0x99, 0x77, 0x55, 0x77, 0x11, 0x33,
0x55, 0x31, 0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31, 0x99, 0x77, 0x55, 0x77, 0x11, 0x33,
0x55, 0x31, 0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0xf0, 0x9f,
0x98, 0x85, 0x0a, 0x77, 0x65, 0x6c, 0x6c, 0x20, 0x74, 0x68, 0x61, 0x74, 0x27, 0x73, 0x01, 0x23,
0x45, 0x21, 0x07, 0x00, 0x00, 0x00, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65,
}
require.Equal(expectedBytes, txBytes)
+53 -214
View File
@@ -102,67 +102,21 @@ func TestTransferChainOwnershipTxSerialization(t *testing.T) {
require.NoError(simpleTransferChainOwnershipTx.SyntacticVerify(rt))
expectedUnsignedSimpleTransferChainOwnershipTxBytes := []byte{
// Codec version
0x00, 0x00,
// TransferChainOwnershipTx Type ID
0x00, 0x00, 0x00, 0x21,
// Mainnet network ID
0x00, 0x00, 0x00, 0x01,
// P-chain blockchain ID (31 zeros + 'P')
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
// Number of outputs
0x00, 0x00, 0x00, 0x00,
// Number of inputs
0x00, 0x00, 0x00, 0x01,
// Inputs[0]
// TxID
0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88,
0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88,
0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88,
0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88,
// Tx output index
0x00, 0x00, 0x00, 0x01,
// Mainnet LUX assetID
0x51, 0xc2, 0x4f, 0xe7, 0xee, 0x02, 0x01, 0xff,
0x0f, 0x33, 0x5f, 0x51, 0x99, 0x28, 0xdb, 0x6e,
0xef, 0x62, 0x24, 0x25, 0x45, 0x52, 0xc9, 0x6b,
0x6b, 0x42, 0x5f, 0xbc, 0x18, 0xfa, 0x24, 0x3b,
// secp256k1fx transfer input type ID
0x00, 0x00, 0x00, 0x05,
// input amount = 1 MilliLux
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0xe8,
// number of signatures needed in input
0x00, 0x00, 0x00, 0x01,
// index of signer
0x00, 0x00, 0x00, 0x05,
// length of memo
0x00, 0x00, 0x00, 0x00,
// netID to modify
0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08,
0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18,
0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28,
0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38,
// secp256k1fx authorization type ID
0x00, 0x00, 0x00, 0x0a,
// number of signatures needed in authorization
0x00, 0x00, 0x00, 0x01,
// index of signer
0x00, 0x00, 0x00, 0x03,
// secp256k1fx output owners type ID
0x00, 0x00, 0x00, 0x0b,
// locktime
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
// threshold
0x00, 0x00, 0x00, 0x01,
// number of addrs
0x00, 0x00, 0x00, 0x01,
// Addrs[0]
0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xaa, 0xbb,
0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xaa, 0xbb,
0x44, 0x55, 0x66, 0x77,
0x00, 0x00, 0x21, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00,
0x00, 0x00, 0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88, 0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa,
0x99, 0x88, 0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88, 0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa,
0x99, 0x88, 0x01, 0x00, 0x00, 0x00, 0x51, 0xc2, 0x4f, 0xe7, 0xee, 0x02, 0x01, 0xff, 0x0f, 0x33,
0x5f, 0x51, 0x99, 0x28, 0xdb, 0x6e, 0xef, 0x62, 0x24, 0x25, 0x45, 0x52, 0xc9, 0x6b, 0x6b, 0x42,
0x5f, 0xbc, 0x18, 0xfa, 0x24, 0x3b, 0x05, 0x00, 0x00, 0x00, 0xe8, 0x03, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x02,
0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x21, 0x22,
0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x0a, 0x00,
0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x44, 0x55,
0x66, 0x77, 0x88, 0x99, 0xaa, 0xbb, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xaa, 0xbb, 0x44, 0x55,
0x66, 0x77,
}
var unsignedSimpleTransferChainOwnershipTx UnsignedTx = simpleTransferChainOwnershipTx
unsignedSimpleTransferChainOwnershipTxBytes, err := testCodec.Marshal(CodecVersion, &unsignedSimpleTransferChainOwnershipTx)
@@ -286,159 +240,44 @@ func TestTransferChainOwnershipTxSerialization(t *testing.T) {
require.NoError(complexTransferChainOwnershipTx.SyntacticVerify(ctx2))
expectedUnsignedComplexTransferChainOwnershipTxBytes := []byte{
// Codec version
0x00, 0x00,
// TransferChainOwnershipTx Type ID
0x00, 0x00, 0x00, 0x21,
// Mainnet network ID
0x00, 0x00, 0x00, 0x01,
// P-chain blockchain ID (31 zeros + 'P')
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
// Number of outputs
0x00, 0x00, 0x00, 0x02,
// Outputs[0]
// Mainnet LUX assetID
0x51, 0xc2, 0x4f, 0xe7, 0xee, 0x02, 0x01, 0xff,
0x0f, 0x33, 0x5f, 0x51, 0x99, 0x28, 0xdb, 0x6e,
0xef, 0x62, 0x24, 0x25, 0x45, 0x52, 0xc9, 0x6b,
0x6b, 0x42, 0x5f, 0xbc, 0x18, 0xfa, 0x24, 0x3b,
// Stakeable locked output type ID
0x00, 0x00, 0x00, 0x16,
// Locktime
0x00, 0x00, 0x00, 0x00, 0x05, 0x39, 0x7f, 0xb1,
// secp256k1fx transfer output type ID
0x00, 0x00, 0x00, 0x07,
// amount
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
// secp256k1fx output locktime
0x00, 0x00, 0x00, 0x00, 0x00, 0xbc, 0x61, 0x4e,
// threshold
0x00, 0x00, 0x00, 0x00,
// number of addresses
0x00, 0x00, 0x00, 0x00,
// Outputs[1]
// custom asset ID
0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31,
0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31,
0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31,
0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31,
// Stakeable locked output type ID
0x00, 0x00, 0x00, 0x16,
// Locktime
0x00, 0x00, 0x00, 0x00, 0x34, 0x3e, 0xfc, 0xea,
// secp256k1fx transfer output type ID
0x00, 0x00, 0x00, 0x07,
// amount
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
// secp256k1fx output locktime
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
// threshold
0x00, 0x00, 0x00, 0x01,
// number of addresses
0x00, 0x00, 0x00, 0x01,
// address[0]
0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xaa, 0xbb,
0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xaa, 0xbb,
0x44, 0x55, 0x66, 0x77,
// number of inputs
0x00, 0x00, 0x00, 0x03,
// inputs[0]
// TxID
0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88,
0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88,
0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88,
0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88,
// Tx output index
0x00, 0x00, 0x00, 0x01,
// Mainnet LUX assetID
0x51, 0xc2, 0x4f, 0xe7, 0xee, 0x02, 0x01, 0xff,
0x0f, 0x33, 0x5f, 0x51, 0x99, 0x28, 0xdb, 0x6e,
0xef, 0x62, 0x24, 0x25, 0x45, 0x52, 0xc9, 0x6b,
0x6b, 0x42, 0x5f, 0xbc, 0x18, 0xfa, 0x24, 0x3b,
// secp256k1fx transfer input type ID
0x00, 0x00, 0x00, 0x05,
// input amount = 1 Lux
0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x42, 0x40,
// number of signatures needed in input
0x00, 0x00, 0x00, 0x02,
// index of first signer
0x00, 0x00, 0x00, 0x02,
// index of second signer
0x00, 0x00, 0x00, 0x05,
// inputs[1]
// TxID
0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88,
0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88,
0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88,
0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88,
// Tx output index
0x00, 0x00, 0x00, 0x02,
// Custom asset ID
0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31,
0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31,
0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31,
0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31,
// Stakeable locked input type ID
0x00, 0x00, 0x00, 0x15,
// Locktime
0x00, 0x00, 0x00, 0x00, 0x34, 0x3e, 0xfc, 0xea,
// secp256k1fx transfer input type ID
0x00, 0x00, 0x00, 0x05,
// input amount
0xef, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
// number of signatures needed in input
0x00, 0x00, 0x00, 0x01,
// index of signer
0x00, 0x00, 0x00, 0x00,
// inputs[2]
// TxID
0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88,
0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88,
0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88,
0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88,
// Tx output index
0x00, 0x00, 0x00, 0x03,
// custom asset ID
0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31,
0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31,
0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31,
0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31,
// secp256k1fx transfer input type ID
0x00, 0x00, 0x00, 0x05,
// input amount
0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
// number of signatures needed in input
0x00, 0x00, 0x00, 0x00,
// length of memo
0x00, 0x00, 0x00, 0x14,
// memo
0xf0, 0x9f, 0x98, 0x85, 0x0a, 0x77, 0x65, 0x6c,
0x6c, 0x20, 0x74, 0x68, 0x61, 0x74, 0x27, 0x73,
0x01, 0x23, 0x45, 0x21,
// netID to modify
0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08,
0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18,
0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28,
0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38,
// secp256k1fx authorization type ID
0x00, 0x00, 0x00, 0x0a,
// number of signatures needed in authorization
0x00, 0x00, 0x00, 0x00,
// secp256k1fx output owners type ID
0x00, 0x00, 0x00, 0x0b,
// locktime
0x00, 0x00, 0x00, 0x00, 0x34, 0x3e, 0xfc, 0xea,
// threshold
0x00, 0x00, 0x00, 0x01,
// number of addrs
0x00, 0x00, 0x00, 0x01,
// Addrs[0]
0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xaa, 0xbb,
0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xaa, 0xbb,
0x44, 0x55, 0x66, 0x77,
0x00, 0x00, 0x21, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x51, 0xc2,
0x4f, 0xe7, 0xee, 0x02, 0x01, 0xff, 0x0f, 0x33, 0x5f, 0x51, 0x99, 0x28, 0xdb, 0x6e, 0xef, 0x62,
0x24, 0x25, 0x45, 0x52, 0xc9, 0x6b, 0x6b, 0x42, 0x5f, 0xbc, 0x18, 0xfa, 0x24, 0x3b, 0x16, 0x00,
0x00, 0x00, 0xb1, 0x7f, 0x39, 0x05, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x01, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x4e, 0x61, 0xbc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31, 0x99, 0x77,
0x55, 0x77, 0x11, 0x33, 0x55, 0x31, 0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31, 0x99, 0x77,
0x55, 0x77, 0x11, 0x33, 0x55, 0x31, 0x16, 0x00, 0x00, 0x00, 0xea, 0xfc, 0x3e, 0x34, 0x00, 0x00,
0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x44, 0x55,
0x66, 0x77, 0x88, 0x99, 0xaa, 0xbb, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xaa, 0xbb, 0x44, 0x55,
0x66, 0x77, 0x03, 0x00, 0x00, 0x00, 0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88, 0xff, 0xee,
0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88, 0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88, 0xff, 0xee,
0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88, 0x01, 0x00, 0x00, 0x00, 0x51, 0xc2, 0x4f, 0xe7, 0xee, 0x02,
0x01, 0xff, 0x0f, 0x33, 0x5f, 0x51, 0x99, 0x28, 0xdb, 0x6e, 0xef, 0x62, 0x24, 0x25, 0x45, 0x52,
0xc9, 0x6b, 0x6b, 0x42, 0x5f, 0xbc, 0x18, 0xfa, 0x24, 0x3b, 0x05, 0x00, 0x00, 0x00, 0x40, 0x42,
0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x05, 0x00,
0x00, 0x00, 0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88, 0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa,
0x99, 0x88, 0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88, 0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa,
0x99, 0x88, 0x02, 0x00, 0x00, 0x00, 0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31, 0x99, 0x77,
0x55, 0x77, 0x11, 0x33, 0x55, 0x31, 0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31, 0x99, 0x77,
0x55, 0x77, 0x11, 0x33, 0x55, 0x31, 0x15, 0x00, 0x00, 0x00, 0xea, 0xfc, 0x3e, 0x34, 0x00, 0x00,
0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xef, 0x01, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88, 0xff, 0xee,
0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88, 0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88, 0xff, 0xee,
0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88, 0x03, 0x00, 0x00, 0x00, 0x99, 0x77, 0x55, 0x77, 0x11, 0x33,
0x55, 0x31, 0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31, 0x99, 0x77, 0x55, 0x77, 0x11, 0x33,
0x55, 0x31, 0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0xf0, 0x9f,
0x98, 0x85, 0x0a, 0x77, 0x65, 0x6c, 0x6c, 0x20, 0x74, 0x68, 0x61, 0x74, 0x27, 0x73, 0x01, 0x23,
0x45, 0x21, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16,
0x17, 0x18, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36,
0x37, 0x38, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0xea, 0xfc,
0x3e, 0x34, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x44, 0x55,
0x66, 0x77, 0x88, 0x99, 0xaa, 0xbb, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xaa, 0xbb, 0x44, 0x55,
0x66, 0x77,
}
var unsignedComplexTransferChainOwnershipTx UnsignedTx = complexTransferChainOwnershipTx
unsignedComplexTransferChainOwnershipTxBytes, err := testCodec.Marshal(CodecVersion, &unsignedComplexTransferChainOwnershipTx)
+66 -269
View File
@@ -123,105 +123,30 @@ func TestTransformChainTxSerialization(t *testing.T) {
require.NoError(simpleTransformTx.SyntacticVerify(rt))
expectedUnsignedSimpleTransformTxBytes := []byte{
// Codec version
0x00, 0x00,
// TransformChainTx type ID
0x00, 0x00, 0x00, 0x18,
// Mainnet network ID
0x00, 0x00, 0x00, 0x01,
// P-chain blockchain ID (31 zeros + 'P')
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
// number of outputs
0x00, 0x00, 0x00, 0x00,
// number of inputs
0x00, 0x00, 0x00, 0x02,
// inputs[0]
// TxID
0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88,
0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88,
0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88,
0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88,
// Tx output index
0x00, 0x00, 0x00, 0x01,
// Mainnet LUX assetID
0x51, 0xc2, 0x4f, 0xe7, 0xee, 0x02, 0x01, 0xff,
0x0f, 0x33, 0x5f, 0x51, 0x99, 0x28, 0xdb, 0x6e,
0xef, 0x62, 0x24, 0x25, 0x45, 0x52, 0xc9, 0x6b,
0x6b, 0x42, 0x5f, 0xbc, 0x18, 0xfa, 0x24, 0x3b,
// secp256k1fx transfer input type ID
0x00, 0x00, 0x00, 0x05,
// input amount = 10 LUX (10 * 10^6 with 6 decimals)
0x00, 0x00, 0x00, 0x00, 0x00, 0x98, 0x96, 0x80,
// number of signatures needed in input
0x00, 0x00, 0x00, 0x01,
// index of signer
0x00, 0x00, 0x00, 0x05,
// inputs[1]
// TxID
0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88,
0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88,
0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88,
0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88,
// Tx output index
0x00, 0x00, 0x00, 0x02,
// custom asset ID
0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31,
0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31,
0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31,
0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31,
// secp256k1fx transfer input type ID
0x00, 0x00, 0x00, 0x05,
// input amount
0xef, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
// number of signatures needed in input
0x00, 0x00, 0x00, 0x01,
// index of signer
0x00, 0x00, 0x00, 0x00,
// length of memo
0x00, 0x00, 0x00, 0x00,
// netID being transformed
0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08,
0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18,
0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28,
0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38,
// staking asset ID
0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31,
0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31,
0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31,
0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31,
// initial supply
0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
// maximum supply
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
// minimum consumption rate
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0xe8,
// maximum consumption rate (1,000,000 = 0x0f4240)
0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x42, 0x40,
// minimum staking amount
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
// maximum staking amount
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
// minimum staking duration
0x00, 0x00, 0x00, 0x01,
// maximum staking duration
0x01, 0xe1, 0x33, 0x80,
// minimum delegation fee
0x00, 0x0f, 0x42, 0x40,
// minimum delegation amount
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
// maximum validator weight factor
0x01,
// uptime requirement
0x00, 0x0e, 0x7e, 0xf0,
// secp256k1fx authorization type ID
0x00, 0x00, 0x00, 0x0a,
// number of signatures needed in authorization
0x00, 0x00, 0x00, 0x01,
// authorization signfature index
0x00, 0x00, 0x00, 0x03,
0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00,
0x00, 0x00, 0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88, 0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa,
0x99, 0x88, 0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88, 0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa,
0x99, 0x88, 0x01, 0x00, 0x00, 0x00, 0x51, 0xc2, 0x4f, 0xe7, 0xee, 0x02, 0x01, 0xff, 0x0f, 0x33,
0x5f, 0x51, 0x99, 0x28, 0xdb, 0x6e, 0xef, 0x62, 0x24, 0x25, 0x45, 0x52, 0xc9, 0x6b, 0x6b, 0x42,
0x5f, 0xbc, 0x18, 0xfa, 0x24, 0x3b, 0x05, 0x00, 0x00, 0x00, 0x80, 0x96, 0x98, 0x00, 0x00, 0x00,
0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa,
0x99, 0x88, 0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88, 0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa,
0x99, 0x88, 0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88, 0x02, 0x00, 0x00, 0x00, 0x99, 0x77,
0x55, 0x77, 0x11, 0x33, 0x55, 0x31, 0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31, 0x99, 0x77,
0x55, 0x77, 0x11, 0x33, 0x55, 0x31, 0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31, 0x05, 0x00,
0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xef, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x11, 0x12,
0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x31, 0x32,
0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31, 0x99, 0x77,
0x55, 0x77, 0x11, 0x33, 0x55, 0x31, 0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31, 0x99, 0x77,
0x55, 0x77, 0x11, 0x33, 0x55, 0x31, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xe8, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x42,
0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00, 0x80, 0x33, 0xe1, 0x01, 0x40, 0x42,
0x0f, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0xf0, 0x7e, 0x0e, 0x00, 0x0a,
0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
}
var unsignedSimpleTransformTx UnsignedTx = simpleTransformTx
unsignedSimpleTransformTxBytes, err := testCodec.Marshal(CodecVersion, &unsignedSimpleTransformTx)
@@ -351,176 +276,48 @@ func TestTransformChainTxSerialization(t *testing.T) {
require.NoError(complexTransformTx.SyntacticVerify(ctx2))
expectedUnsignedComplexTransformTxBytes := []byte{
// Codec version
0x00, 0x00,
// TransformChainTx type ID
0x00, 0x00, 0x00, 0x18,
// Mainnet network ID
0x00, 0x00, 0x00, 0x01,
// P-chain blockchain ID (31 zeros + 'P')
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
// number of outputs
0x00, 0x00, 0x00, 0x02,
// outputs[0]
// Mainnet LUX asset ID
0x51, 0xc2, 0x4f, 0xe7, 0xee, 0x02, 0x01, 0xff,
0x0f, 0x33, 0x5f, 0x51, 0x99, 0x28, 0xdb, 0x6e,
0xef, 0x62, 0x24, 0x25, 0x45, 0x52, 0xc9, 0x6b,
0x6b, 0x42, 0x5f, 0xbc, 0x18, 0xfa, 0x24, 0x3b,
// Stakeable locked output type ID
0x00, 0x00, 0x00, 0x16,
// Locktime
0x00, 0x00, 0x00, 0x00, 0x05, 0x39, 0x7f, 0xb1,
// seck256k1fx transfer output type ID
0x00, 0x00, 0x00, 0x07,
// amount
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
// secp256k1fx locktime
0x00, 0x00, 0x00, 0x00, 0x00, 0xbc, 0x61, 0x4e,
// threshold
0x00, 0x00, 0x00, 0x00,
// number of addresses
0x00, 0x00, 0x00, 0x00,
// outputs[1]
// custom assest ID
0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31,
0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31,
0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31,
0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31,
// Stakeable locked output type ID
0x00, 0x00, 0x00, 0x16,
// Locktime
0x00, 0x00, 0x00, 0x00, 0x34, 0x3e, 0xfc, 0xea,
// seck256k1fx transfer output type ID
0x00, 0x00, 0x00, 0x07,
// amount
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
// secp256k1fx locktime
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
// threshold
0x00, 0x00, 0x00, 0x01,
// number of addresses
0x00, 0x00, 0x00, 0x01,
// address[0]
0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xaa, 0xbb,
0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xaa, 0xbb,
0x44, 0x55, 0x66, 0x77,
// number of inputs
0x00, 0x00, 0x00, 0x03,
// inputs[0]
// TxID
0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88,
0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88,
0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88,
0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88,
// Tx output index
0x00, 0x00, 0x00, 0x01,
// Mainnet LUX asset ID
0x51, 0xc2, 0x4f, 0xe7, 0xee, 0x02, 0x01, 0xff,
0x0f, 0x33, 0x5f, 0x51, 0x99, 0x28, 0xdb, 0x6e,
0xef, 0x62, 0x24, 0x25, 0x45, 0x52, 0xc9, 0x6b,
0x6b, 0x42, 0x5f, 0xbc, 0x18, 0xfa, 0x24, 0x3b,
// secp256k1fx transfer input type ID
0x00, 0x00, 0x00, 0x05,
// amount = 1 KiloLux (with 6 decimals = 1,000,000,000 microLUX)
0x00, 0x00, 0x00, 0x00, 0x3b, 0x9a, 0xca, 0x00,
// number of signatures indices
0x00, 0x00, 0x00, 0x02,
// first signature index
0x00, 0x00, 0x00, 0x02,
// second signature index
0x00, 0x00, 0x00, 0x05,
// inputs[1]
// TxID
0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88,
0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88,
0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88,
0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88,
// Tx output index
0x00, 0x00, 0x00, 0x02,
// custom asset ID
0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31,
0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31,
0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31,
0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31,
// stakeable locked input type ID
0x00, 0x00, 0x00, 0x15,
// locktime
0x00, 0x00, 0x00, 0x00, 0x34, 0x3e, 0xfc, 0xea,
// secp256k1fx transfer input type ID
0x00, 0x00, 0x00, 0x05,
// input amount
0xef, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
// number of signatures needed in input
0x00, 0x00, 0x00, 0x01,
// index of signer
0x00, 0x00, 0x00, 0x00,
// inputs[2]
// TxID
0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88,
0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88,
0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88,
0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88,
// Tx output index
0x00, 0x00, 0x00, 0x03,
// custom asset ID
0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31,
0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31,
0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31,
0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31,
// secp256k1fx transfer input type ID
0x00, 0x00, 0x00, 0x05,
// input amount
0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
// number of signatures needed in input
0x00, 0x00, 0x00, 0x00,
// memo length
0x00, 0x00, 0x00, 0x14,
// memo
0xf0, 0x9f, 0x98, 0x85, 0x0a, 0x77, 0x65, 0x6c,
0x6c, 0x20, 0x74, 0x68, 0x61, 0x74, 0x27, 0x73,
0x01, 0x23, 0x45, 0x21,
// netID being transformed
0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08,
0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18,
0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28,
0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38,
// staking asset ID
0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31,
0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31,
0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31,
0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31,
// initial supply
0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
// maximum supply
0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
// minimum consumption rate
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
// maximum consumption rate
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
// minimum staking amount
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
// maximum staking amount
0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
// minimum staking duration
0x00, 0x00, 0x00, 0x01,
// maximum staking duration
0x00, 0x00, 0x00, 0x01,
// minimum delegation fee
0x00, 0x00, 0x00, 0x00,
// minimum delegation amount
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
// maximum validator weight factor
0xff,
// uptime requirement
0x00, 0x00, 0x00, 0x00,
// secp256k1fx authorization type ID
0x00, 0x00, 0x00, 0x0a,
// number of signatures needed in authorization
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x51, 0xc2,
0x4f, 0xe7, 0xee, 0x02, 0x01, 0xff, 0x0f, 0x33, 0x5f, 0x51, 0x99, 0x28, 0xdb, 0x6e, 0xef, 0x62,
0x24, 0x25, 0x45, 0x52, 0xc9, 0x6b, 0x6b, 0x42, 0x5f, 0xbc, 0x18, 0xfa, 0x24, 0x3b, 0x16, 0x00,
0x00, 0x00, 0xb1, 0x7f, 0x39, 0x05, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x01, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x4e, 0x61, 0xbc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31, 0x99, 0x77,
0x55, 0x77, 0x11, 0x33, 0x55, 0x31, 0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31, 0x99, 0x77,
0x55, 0x77, 0x11, 0x33, 0x55, 0x31, 0x16, 0x00, 0x00, 0x00, 0xea, 0xfc, 0x3e, 0x34, 0x00, 0x00,
0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x44, 0x55,
0x66, 0x77, 0x88, 0x99, 0xaa, 0xbb, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xaa, 0xbb, 0x44, 0x55,
0x66, 0x77, 0x03, 0x00, 0x00, 0x00, 0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88, 0xff, 0xee,
0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88, 0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88, 0xff, 0xee,
0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88, 0x01, 0x00, 0x00, 0x00, 0x51, 0xc2, 0x4f, 0xe7, 0xee, 0x02,
0x01, 0xff, 0x0f, 0x33, 0x5f, 0x51, 0x99, 0x28, 0xdb, 0x6e, 0xef, 0x62, 0x24, 0x25, 0x45, 0x52,
0xc9, 0x6b, 0x6b, 0x42, 0x5f, 0xbc, 0x18, 0xfa, 0x24, 0x3b, 0x05, 0x00, 0x00, 0x00, 0x00, 0xca,
0x9a, 0x3b, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x05, 0x00,
0x00, 0x00, 0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88, 0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa,
0x99, 0x88, 0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88, 0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa,
0x99, 0x88, 0x02, 0x00, 0x00, 0x00, 0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31, 0x99, 0x77,
0x55, 0x77, 0x11, 0x33, 0x55, 0x31, 0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31, 0x99, 0x77,
0x55, 0x77, 0x11, 0x33, 0x55, 0x31, 0x15, 0x00, 0x00, 0x00, 0xea, 0xfc, 0x3e, 0x34, 0x00, 0x00,
0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xef, 0x01, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88, 0xff, 0xee,
0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88, 0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88, 0xff, 0xee,
0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88, 0x03, 0x00, 0x00, 0x00, 0x99, 0x77, 0x55, 0x77, 0x11, 0x33,
0x55, 0x31, 0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31, 0x99, 0x77, 0x55, 0x77, 0x11, 0x33,
0x55, 0x31, 0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0xf0, 0x9f,
0x98, 0x85, 0x0a, 0x77, 0x65, 0x6c, 0x6c, 0x20, 0x74, 0x68, 0x61, 0x74, 0x27, 0x73, 0x01, 0x23,
0x45, 0x21, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16,
0x17, 0x18, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36,
0x37, 0x38, 0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31, 0x99, 0x77, 0x55, 0x77, 0x11, 0x33,
0x55, 0x31, 0x99, 0x77, 0x55, 0x77, 0x11, 0x33, 0x55, 0x31, 0x99, 0x77, 0x55, 0x77, 0x11, 0x33,
0x55, 0x31, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x10, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00,
}
var unsignedComplexTransformTx UnsignedTx = complexTransformTx
unsignedComplexTransformTxBytes, err := testCodec.Marshal(CodecVersion, &unsignedComplexTransformTx)
+2 -2
View File
@@ -135,14 +135,14 @@ Warp 1.5 introduces new signature types for quantum-safe messaging:
1. **BitSetSignature** (Warp 1.0): Classical BLS aggregate signatures
2. **CoronaSignature** (Warp 1.5 - Recommended): Post-quantum threshold signatures using LWE
3. **EncryptedWarpPayload** (Warp 1.5): ML-KEM + AES-256-GCM encrypted cross-chain payloads
4. **HybridBLSRTSignature** (Deprecated): BLS + Corona hybrid for transition period
4. **HybridBLSCRSignature** (Deprecated): BLS + Corona hybrid for transition period
### CoronaSignature
Corona is a lattice-based threshold signature scheme from LWE (Learning With Errors).
- **Paper**: https://eprint.iacr.org/2024/1113
- **Implementation**: github.com/luxfi/corona
- **Implementation**: github.com/luxfi/Corona
- **Properties**:
- Post-quantum secure (based on LWE hardness)
- Native threshold support (t-of-n signing in 2 rounds)
+22 -34
View File
@@ -20,41 +20,29 @@ func TestChainToL1ConversionID(t *testing.T) {
require := require.New(t)
c := pvmcodectest.NewMessageCodec()
// Regenerated post-LP-023 ZAP cutover (LE wire format).
// uint32 length prefixes and uint64 Weight are now little-endian.
chainToL1ConversionDataBytes := []byte{
// Codec version:
0x00, 0x00,
// ChainID:
0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08,
0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10,
0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18,
0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0x20,
// ManagerChainID:
0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28,
0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, 0x30,
0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38,
0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, 0x40,
// ManagerAddress Length:
0x00, 0x00, 0x00, 0x01,
// ManagerAddress:
0x41,
// Validators Length:
0x00, 0x00, 0x00, 0x01,
// Validator[0]:
// NodeID Length:
0x00, 0x00, 0x00, 0x14,
// NodeID:
0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49,
0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, 0x50, 0x51,
0x52, 0x53, 0x54, 0x55,
// BLSPublicKey:
0x56, 0x57, 0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d,
0x5e, 0x5f, 0x60, 0x61, 0x62, 0x63, 0x64, 0x65,
0x66, 0x67, 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d,
0x6e, 0x6f, 0x70, 0x71, 0x72, 0x73, 0x74, 0x75,
0x76, 0x77, 0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d,
0x7e, 0x7f, 0x80, 0x81, 0x82, 0x83, 0x84, 0x85,
// Weight:
0x86, 0x87, 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d,
0x00, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06,
0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e,
0x0f, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16,
0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e,
0x1f, 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26,
0x27, 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e,
0x2f, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36,
0x37, 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e,
0x3f, 0x40, 0x01, 0x00, 0x00, 0x00, 0x41, 0x01,
0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x42,
0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4a,
0x4b, 0x4c, 0x4d, 0x4e, 0x4f, 0x50, 0x51, 0x52,
0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5a,
0x5b, 0x5c, 0x5d, 0x5e, 0x5f, 0x60, 0x61, 0x62,
0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6a,
0x6b, 0x6c, 0x6d, 0x6e, 0x6f, 0x70, 0x71, 0x72,
0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7a,
0x7b, 0x7c, 0x7d, 0x7e, 0x7f, 0x80, 0x81, 0x82,
0x83, 0x84, 0x85, 0x8d, 0x8c, 0x8b, 0x8a, 0x89,
0x88, 0x87, 0x86,
}
var expectedChainToL1ConversionID ids.ID = hash.ComputeHash256Array(chainToL1ConversionDataBytes)
+38 -66
View File
@@ -56,49 +56,31 @@ func TestParse(t *testing.T) {
},
{
name: "RegisterL1Validator",
// Regenerated post-LP-023 ZAP cutover (LE wire format).
bytes: []byte{
// Codec version:
0x00, 0x00,
// Payload type = RegisterL1Validator:
0x00, 0x00, 0x00, 0x01,
// ChainID:
0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08,
0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10,
0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18,
0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0x20,
// NodeID Length:
0x00, 0x00, 0x00, 0x14,
// NodeID:
0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28,
0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, 0x30,
0x31, 0x32, 0x33, 0x34,
// BLSPublicKey:
0x35, 0x36, 0x37, 0x38, 0x39, 0x3a, 0x3b, 0x3c,
0x3d, 0x3e, 0x3f, 0x40, 0x41, 0x42, 0x43, 0x44,
0x45, 0x46, 0x47, 0x48, 0x49, 0x4a, 0x4b, 0x4c,
0x4d, 0x4e, 0x4f, 0x50, 0x51, 0x52, 0x53, 0x54,
0x55, 0x56, 0x57, 0x58, 0x59, 0x5a, 0x5b, 0x5c,
0x5d, 0x5e, 0x5f, 0x60, 0x61, 0x62, 0x63, 0x64,
// Expiry:
0x65, 0x66, 0x67, 0x68, 0x69, 0x6a, 0x6b, 0x6c,
// Remaining Balance Owner Threshold:
0x6d, 0x6e, 0x6f, 0x70,
// Remaining Balance Owner Addresses Length:
0x00, 0x00, 0x00, 0x01,
// Remaining Balance Owner Address[0]:
0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78,
0x79, 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, 0x80,
0x81, 0x82, 0x83, 0x84,
// Disable Owner Threshold:
0x85, 0x86, 0x87, 0x88,
// Disable Owner Addresses Length:
0x00, 0x00, 0x00, 0x01,
// Disable Owner Address[0]:
0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f, 0x90,
0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98,
0x99, 0x9a, 0x9b, 0x9c,
// Weight:
0x9d, 0x9e, 0x9f, 0xa0, 0xa1, 0xa2, 0xa3, 0xa4,
0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x02,
0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a,
0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12,
0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a,
0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0x20, 0x14, 0x00,
0x00, 0x00, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26,
0x27, 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e,
0x2f, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36,
0x37, 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e,
0x3f, 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46,
0x47, 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e,
0x4f, 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56,
0x57, 0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e,
0x5f, 0x60, 0x61, 0x62, 0x63, 0x64, 0x6c, 0x6b,
0x6a, 0x69, 0x68, 0x67, 0x66, 0x65, 0x70, 0x6f,
0x6e, 0x6d, 0x01, 0x00, 0x00, 0x00, 0x71, 0x72,
0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7a,
0x7b, 0x7c, 0x7d, 0x7e, 0x7f, 0x80, 0x81, 0x82,
0x83, 0x84, 0x88, 0x87, 0x86, 0x85, 0x01, 0x00,
0x00, 0x00, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e,
0x8f, 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96,
0x97, 0x98, 0x99, 0x9a, 0x9b, 0x9c, 0xa4, 0xa3,
0xa2, 0xa1, 0xa0, 0x9f, 0x9e, 0x9d,
},
expected: mustCreate(message.NewRegisterL1Validator(
c,
@@ -147,18 +129,13 @@ func TestParse(t *testing.T) {
},
{
name: "L1ValidatorRegistration",
// Regenerated post-LP-023 ZAP cutover (LE wire format).
bytes: []byte{
// Codec version:
0x00, 0x00,
// Payload type = L1ValidatorRegistration:
0x00, 0x00, 0x00, 0x02,
// ValidationID:
0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08,
0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10,
0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18,
0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0x20,
// Registered:
0x00,
0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x02,
0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a,
0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12,
0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a,
0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0x20, 0x00,
},
expected: mustCreate(message.NewL1ValidatorRegistration(
c,
@@ -173,20 +150,15 @@ func TestParse(t *testing.T) {
},
{
name: "L1ValidatorWeight",
// Regenerated post-LP-023 ZAP cutover (LE wire format).
bytes: []byte{
// Codec version:
0x00, 0x00,
// Payload type = L1ValidatorWeight:
0x00, 0x00, 0x00, 0x03,
// ValidationID:
0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08,
0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10,
0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18,
0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0x20,
// Nonce:
0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28,
// Weight:
0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, 0x30,
0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x02,
0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a,
0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12,
0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a,
0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0x20, 0x28, 0x27,
0x26, 0x25, 0x24, 0x23, 0x22, 0x21, 0x30, 0x2f,
0x2e, 0x2d, 0x2c, 0x2b, 0x2a, 0x29,
},
expected: mustCreate(message.NewL1ValidatorWeight(
c,
+179
View File
@@ -0,0 +1,179 @@
// Copyright (C) 2019-2026, Lux Industries, Inc. All rights reserved.
// See the file LICENSE for licensing terms.
//go:build emit_fixtures
package message_test
import (
"encoding/hex"
"fmt"
"strings"
"testing"
"github.com/luxfi/crypto/bls"
"github.com/luxfi/ids"
"github.com/luxfi/proto/internal/pvmcodectest"
"github.com/luxfi/proto/p/warp/message"
"github.com/luxfi/vm/types"
)
// TestEmitWarpMessagePayloads regenerates the warp message fixtures
// used by TestChainToL1ConversionID and TestParse subtests. The codec
// is LE, but the existing fixtures were encoded with the legacy BE
// linearcodec — we re-marshal the expected payload via the current
// codec and print the new wire bytes.
//
// Run via:
// go test -tags emit_fixtures -run TestEmitWarpMessagePayloads -v ./p/warp/message
func TestEmitWarpMessagePayloads(t *testing.T) {
c := pvmcodectest.NewMessageCodec()
// ChainToL1ConversionData fixture (matches TestChainToL1ConversionID).
chainToL1ConversionData := message.ChainToL1ConversionData{
ChainID: ids.ID{
0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08,
0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10,
0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18,
0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0x20,
},
ManagerChainID: ids.ID{
0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28,
0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, 0x30,
0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38,
0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, 0x40,
},
ManagerAddress: []byte{0x41},
Validators: []message.ChainToL1ConversionValidatorData{
{
NodeID: types.JSONByteSlice([]byte{
0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49,
0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, 0x50, 0x51,
0x52, 0x53, 0x54, 0x55,
}),
BLSPublicKey: [bls.PublicKeyLen]byte{
0x56, 0x57, 0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d,
0x5e, 0x5f, 0x60, 0x61, 0x62, 0x63, 0x64, 0x65,
0x66, 0x67, 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d,
0x6e, 0x6f, 0x70, 0x71, 0x72, 0x73, 0x74, 0x75,
0x76, 0x77, 0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d,
0x7e, 0x7f, 0x80, 0x81, 0x82, 0x83, 0x84, 0x85,
},
Weight: 0x868788898a8b8c8d,
},
},
}
bs, err := c.Marshal(0, &chainToL1ConversionData)
if err != nil {
t.Fatalf("Marshal: %v", err)
}
fmt.Printf("EMIT_FIXTURE: ChainToL1ConversionData bytes (len=%d)\n", len(bs))
fmt.Printf(" hex: %s\n", hex.EncodeToString(bs))
fmt.Printf(" go : %s\n", goByteLiteral(bs))
// For TestParse subtests, marshal each Payload and emit its bytes.
cases := []struct {
name string
msg message.Payload
}{
{
name: "RegisterL1Validator",
msg: mustEmit(message.NewRegisterL1Validator(
c,
ids.ID{
0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08,
0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10,
0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18,
0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0x20,
},
ids.NodeID{
0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28,
0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, 0x30,
0x31, 0x32, 0x33, 0x34,
},
[bls.PublicKeyLen]byte{
0x35, 0x36, 0x37, 0x38, 0x39, 0x3a, 0x3b, 0x3c,
0x3d, 0x3e, 0x3f, 0x40, 0x41, 0x42, 0x43, 0x44,
0x45, 0x46, 0x47, 0x48, 0x49, 0x4a, 0x4b, 0x4c,
0x4d, 0x4e, 0x4f, 0x50, 0x51, 0x52, 0x53, 0x54,
0x55, 0x56, 0x57, 0x58, 0x59, 0x5a, 0x5b, 0x5c,
0x5d, 0x5e, 0x5f, 0x60, 0x61, 0x62, 0x63, 0x64,
},
0x6566676869_6a6b6c,
message.PChainOwner{
Threshold: 0x6d6e6f70,
Addresses: []ids.ShortID{
{
0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78,
0x79, 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, 0x80,
0x81, 0x82, 0x83, 0x84,
},
},
},
message.PChainOwner{
Threshold: 0x85868788,
Addresses: []ids.ShortID{
{
0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f, 0x90,
0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98,
0x99, 0x9a, 0x9b, 0x9c,
},
},
},
0x9d9e9fa0_a1a2a3a4,
)),
},
{
name: "L1ValidatorRegistration",
msg: mustEmit(message.NewL1ValidatorRegistration(
c,
ids.ID{
0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08,
0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10,
0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18,
0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0x20,
},
false,
)),
},
{
name: "L1ValidatorWeight",
msg: mustEmit(message.NewL1ValidatorWeight(
c,
ids.ID{
0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08,
0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10,
0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18,
0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0x20,
},
0x2122232425262728,
0x292a2b2c2d2e2f30,
)),
},
}
for _, ca := range cases {
t.Run(ca.name, func(t *testing.T) {
parsedBytes := ca.msg.Bytes()
fmt.Printf("EMIT_FIXTURE: %s msg.Bytes() (len=%d)\n", ca.name, len(parsedBytes))
fmt.Printf(" hex: %s\n", hex.EncodeToString(parsedBytes))
fmt.Printf(" go : %s\n", goByteLiteral(parsedBytes))
})
}
_ = c
}
func mustEmit(msg message.Payload, err error) message.Payload {
if err != nil {
panic(err)
}
return msg
}
func goByteLiteral(b []byte) string {
parts := make([]string, len(b))
for i, v := range b {
parts[i] = fmt.Sprintf("0x%02x", v)
}
return "[]byte{" + strings.Join(parts, ", ") + "}"
}
+1 -1
View File
@@ -41,7 +41,7 @@ func TestParseAddressedCallJunk(t *testing.T) {
func TestAddressedCallBytes(t *testing.T) {
require := require.New(t)
c := pvmcodectest.NewPayloadCodec()
base64Payload := "AAAAAAABAAAAEAECAwAAAAAAAAAAAAAAAAAAAAADCgsM"
base64Payload := "AAABAAAAEAAAAAECAwAAAAAAAAAAAAAAAAADAAAACgsM"
addressedPayload, err := payload.NewAddressedCall(
c,
[]byte{1, 2, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
+16 -63
View File
@@ -29,68 +29,21 @@ func TestBaseTxSerialization(t *testing.T) {
require := require.New(t)
expected := []byte{
// Codec version:
0x00, 0x00,
// txID:
0x00, 0x00, 0x00, 0x00,
// networkID:
0x00, 0x00, 0x01, 0x71, // 369 = UnitTestID
// blockchainID:
0x05, 0x04, 0x03, 0x02, 0x01, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
// number of outs:
0x00, 0x00, 0x00, 0x01,
// output[0]:
// assetID:
0x01, 0x02, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
// fxID:
0x00, 0x00, 0x00, 0x07,
// secp256k1 Transferable Output:
// amount:
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x39,
// locktime:
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
// threshold:
0x00, 0x00, 0x00, 0x01,
// number of addresses
0x00, 0x00, 0x00, 0x01,
// address[0]
0xfc, 0xed, 0xa8, 0xf9, 0x0f, 0xcb, 0x5d, 0x30,
0x61, 0x4b, 0x99, 0xd7, 0x9f, 0xc4, 0xba, 0xa2,
0x93, 0x07, 0x76, 0x26,
// number of inputs:
0x00, 0x00, 0x00, 0x01,
// txID:
0xff, 0xfe, 0xfd, 0xfc, 0xfb, 0xfa, 0xf9, 0xf8,
0xf7, 0xf6, 0xf5, 0xf4, 0xf3, 0xf2, 0xf1, 0xf0,
0xef, 0xee, 0xed, 0xec, 0xeb, 0xea, 0xe9, 0xe8,
0xe7, 0xe6, 0xe5, 0xe4, 0xe3, 0xe2, 0xe1, 0xe0,
// utxo index:
0x00, 0x00, 0x00, 0x01,
// assetID:
0x01, 0x02, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
// fxID:
0x00, 0x00, 0x00, 0x05,
// amount:
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xd4, 0x31,
// number of signatures:
0x00, 0x00, 0x00, 0x01,
// signature index[0]:
0x00, 0x00, 0x00, 0x02,
// Memo length:
0x00, 0x00, 0x00, 0x04,
// Memo:
0x00, 0x01, 0x02, 0x03,
// Number of credentials
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x71, 0x01, 0x00, 0x00, 0x05, 0x04, 0x03, 0x02, 0x01, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x02,
0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00,
0x00, 0x00, 0x39, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0xfc, 0xed, 0xa8, 0xf9, 0x0f, 0xcb,
0x5d, 0x30, 0x61, 0x4b, 0x99, 0xd7, 0x9f, 0xc4, 0xba, 0xa2, 0x93, 0x07, 0x76, 0x26, 0x01, 0x00,
0x00, 0x00, 0xff, 0xfe, 0xfd, 0xfc, 0xfb, 0xfa, 0xf9, 0xf8, 0xf7, 0xf6, 0xf5, 0xf4, 0xf3, 0xf2,
0xf1, 0xf0, 0xef, 0xee, 0xed, 0xec, 0xeb, 0xea, 0xe9, 0xe8, 0xe7, 0xe6, 0xe5, 0xe4, 0xe3, 0xe2,
0xe1, 0xe0, 0x01, 0x00, 0x00, 0x00, 0x01, 0x02, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x31, 0xd4, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x01,
0x02, 0x03, 0x00, 0x00, 0x00, 0x00,
}
tx := &txs.Tx{Unsigned: &txs.BaseTx{BaseTx: lux.BaseTx{
@@ -136,7 +89,7 @@ func TestBaseTxSerialization(t *testing.T) {
require.NoError(err)
require.NoError(tx.Initialize(parser.Codec()))
require.Equal("28f9BswnotzWBpsXKeubSZW8xz32snhyyQ6ac89oz7seExtAs5", tx.ID().String())
require.Equal("2Rxg3BTzwShRePp48i9WX8XpYsFkn8eMNo6AatcgEE9yyGqsni", tx.ID().String())
result := tx.Bytes()
require.Equal(expected, result)
+46 -187
View File
@@ -22,80 +22,29 @@ func TestCreateAssetTxSerialization(t *testing.T) {
require := require.New(t)
expected := []byte{
// Codec version:
0x00, 0x00,
// txID:
0x00, 0x00, 0x00, 0x01,
// networkID:
0x00, 0x00, 0x00, 0x02,
// blockchainID:
0xff, 0xff, 0xff, 0xff, 0xee, 0xee, 0xee, 0xee,
0xdd, 0xdd, 0xdd, 0xdd, 0xcc, 0xcc, 0xcc, 0xcc,
0xbb, 0xbb, 0xbb, 0xbb, 0xaa, 0xaa, 0xaa, 0xaa,
0x99, 0x99, 0x99, 0x99, 0x88, 0x88, 0x88, 0x88,
// number of outs:
0x00, 0x00, 0x00, 0x01,
// output[0]:
// assetID:
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f,
// output:
0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x30, 0x39, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0xd4, 0x31, 0x00, 0x00, 0x00, 0x01,
0x00, 0x00, 0x00, 0x02, 0x51, 0x02, 0x5c, 0x61,
0xfb, 0xcf, 0xc0, 0x78, 0xf6, 0x93, 0x34, 0xf8,
0x34, 0xbe, 0x6d, 0xd2, 0x6d, 0x55, 0xa9, 0x55,
0xc3, 0x34, 0x41, 0x28, 0xe0, 0x60, 0x12, 0x8e,
0xde, 0x35, 0x23, 0xa2, 0x4a, 0x46, 0x1c, 0x89,
0x43, 0xab, 0x08, 0x59,
// number of inputs:
0x00, 0x00, 0x00, 0x01,
// txID:
0xf1, 0xe1, 0xd1, 0xc1, 0xb1, 0xa1, 0x91, 0x81,
0x71, 0x61, 0x51, 0x41, 0x31, 0x21, 0x11, 0x01,
0xf0, 0xe0, 0xd0, 0xc0, 0xb0, 0xa0, 0x90, 0x80,
0x70, 0x60, 0x50, 0x40, 0x30, 0x20, 0x10, 0x00,
// utxoIndex:
0x00, 0x00, 0x00, 0x05,
// assetID:
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f,
// input:
0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00,
0x07, 0x5b, 0xcd, 0x15, 0x00, 0x00, 0x00, 0x02,
0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x07,
// Memo length:
0x00, 0x00, 0x00, 0x04,
// Memo:
0x00, 0x01, 0x02, 0x03,
// name:
0x00, 0x10, 0x56, 0x6f, 0x6c, 0x61, 0x74, 0x69,
0x6c, 0x69, 0x74, 0x79, 0x20, 0x49, 0x6e, 0x64,
0x65, 0x78,
// symbol:
0x00, 0x03, 0x56, 0x49, 0x58,
// denomination:
0x02,
// number of InitialStates:
0x00, 0x00, 0x00, 0x01,
// InitialStates[0]:
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x30, 0x39, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0xd4, 0x31, 0x00, 0x00, 0x00, 0x01,
0x00, 0x00, 0x00, 0x02, 0x51, 0x02, 0x5c, 0x61,
0xfb, 0xcf, 0xc0, 0x78, 0xf6, 0x93, 0x34, 0xf8,
0x34, 0xbe, 0x6d, 0xd2, 0x6d, 0x55, 0xa9, 0x55,
0xc3, 0x34, 0x41, 0x28, 0xe0, 0x60, 0x12, 0x8e,
0xde, 0x35, 0x23, 0xa2, 0x4a, 0x46, 0x1c, 0x89,
0x43, 0xab, 0x08, 0x59,
// number of credentials:
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xee, 0xee,
0xee, 0xee, 0xdd, 0xdd, 0xdd, 0xdd, 0xcc, 0xcc, 0xcc, 0xcc, 0xbb, 0xbb, 0xbb, 0xbb, 0xaa, 0xaa,
0xaa, 0xaa, 0x99, 0x99, 0x99, 0x99, 0x88, 0x88, 0x88, 0x88, 0x01, 0x00, 0x00, 0x00, 0x00, 0x01,
0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10, 0x11,
0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0x07, 0x00,
0x00, 0x00, 0x39, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x31, 0xd4, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x51, 0x02, 0x5c, 0x61, 0xfb, 0xcf,
0xc0, 0x78, 0xf6, 0x93, 0x34, 0xf8, 0x34, 0xbe, 0x6d, 0xd2, 0x6d, 0x55, 0xa9, 0x55, 0xc3, 0x34,
0x41, 0x28, 0xe0, 0x60, 0x12, 0x8e, 0xde, 0x35, 0x23, 0xa2, 0x4a, 0x46, 0x1c, 0x89, 0x43, 0xab,
0x08, 0x59, 0x01, 0x00, 0x00, 0x00, 0xf1, 0xe1, 0xd1, 0xc1, 0xb1, 0xa1, 0x91, 0x81, 0x71, 0x61,
0x51, 0x41, 0x31, 0x21, 0x11, 0x01, 0xf0, 0xe0, 0xd0, 0xc0, 0xb0, 0xa0, 0x90, 0x80, 0x70, 0x60,
0x50, 0x40, 0x30, 0x20, 0x10, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05,
0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15,
0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0x05, 0x00, 0x00, 0x00, 0x15, 0xcd,
0x5b, 0x07, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x07, 0x00,
0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x01, 0x02, 0x03, 0x10, 0x00, 0x56, 0x6f, 0x6c, 0x61,
0x74, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x20, 0x49, 0x6e, 0x64, 0x65, 0x78, 0x03, 0x00, 0x56, 0x49,
0x58, 0x02, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x07, 0x00,
0x00, 0x00, 0x39, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x31, 0xd4, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x51, 0x02, 0x5c, 0x61, 0xfb, 0xcf,
0xc0, 0x78, 0xf6, 0x93, 0x34, 0xf8, 0x34, 0xbe, 0x6d, 0xd2, 0x6d, 0x55, 0xa9, 0x55, 0xc3, 0x34,
0x41, 0x28, 0xe0, 0x60, 0x12, 0x8e, 0xde, 0x35, 0x23, 0xa2, 0x4a, 0x46, 0x1c, 0x89, 0x43, 0xab,
0x08, 0x59, 0x00, 0x00, 0x00, 0x00,
}
tx := &txs.Tx{Unsigned: &txs.CreateAssetTx{
@@ -212,119 +161,29 @@ func TestCreateAssetTxSerializationAgain(t *testing.T) {
require := require.New(t)
expected := []byte{
// Codec version:
0x00, 0x00,
// txID:
0x00, 0x00, 0x00, 0x01,
// networkID:
0x00, 0x00, 0x01, 0x71, // 369 = UnitTestID
// chainID:
0x05, 0x04, 0x03, 0x02, 0x01, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
// number of outs:
0x00, 0x00, 0x00, 0x03,
// output[0]:
// assetID:
0x01, 0x02, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
// fxID:
0x00, 0x00, 0x00, 0x07,
// secp256k1 Transferable Output:
// amount: 20 * KiloLux = 20,000,000,000 (6-decimal)
0x00, 0x00, 0x00, 0x04, 0xa8, 0x17, 0xc8, 0x00,
// locktime:
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
// threshold:
0x00, 0x00, 0x00, 0x01,
// number of addresses
0x00, 0x00, 0x00, 0x01,
// address[0]
0xfc, 0xed, 0xa8, 0xf9, 0x0f, 0xcb, 0x5d, 0x30,
0x61, 0x4b, 0x99, 0xd7, 0x9f, 0xc4, 0xba, 0xa2,
0x93, 0x07, 0x76, 0x26,
// output[1]:
// assetID:
0x01, 0x02, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
// fxID:
0x00, 0x00, 0x00, 0x07,
// secp256k1 Transferable Output:
// amount: 20 * KiloLux = 20,000,000,000 (6-decimal)
0x00, 0x00, 0x00, 0x04, 0xa8, 0x17, 0xc8, 0x00,
// locktime:
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
// threshold:
0x00, 0x00, 0x00, 0x01,
// number of addresses:
0x00, 0x00, 0x00, 0x01,
// address[0]:
0x6e, 0xad, 0x69, 0x3c, 0x17, 0xab, 0xb1, 0xbe,
0x42, 0x2b, 0xb5, 0x0b, 0x30, 0xb9, 0x71, 0x1f,
0xf9, 0x8d, 0x66, 0x7e,
// output[2]:
// assetID:
0x01, 0x02, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
// fxID:
0x00, 0x00, 0x00, 0x07,
// secp256k1 Transferable Output:
// amount: 20 * KiloLux = 20,000,000,000 (6-decimal)
0x00, 0x00, 0x00, 0x04, 0xa8, 0x17, 0xc8, 0x00,
// locktime:
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
// threshold:
0x00, 0x00, 0x00, 0x01,
// number of addresses:
0x00, 0x00, 0x00, 0x01,
// address[0]:
0xf2, 0x42, 0x08, 0x46, 0x87, 0x6e, 0x69, 0xf4,
0x73, 0xdd, 0xa2, 0x56, 0x17, 0x29, 0x67, 0xe9,
0x92, 0xf0, 0xee, 0x31,
// number of inputs:
0x00, 0x00, 0x00, 0x00,
// Memo length:
0x00, 0x00, 0x00, 0x04,
// Memo:
0x00, 0x01, 0x02, 0x03,
// name length:
0x00, 0x04,
// name:
'n', 'a', 'm', 'e',
// symbol length:
0x00, 0x04,
// symbol:
's', 'y', 'm', 'b',
// denomination
0x00,
// number of initial states:
0x00, 0x00, 0x00, 0x01,
// fx index:
0x00, 0x00, 0x00, 0x00,
// number of outputs:
0x00, 0x00, 0x00, 0x01,
// fxID:
0x00, 0x00, 0x00, 0x06,
// secp256k1 Mint Output:
// locktime:
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
// threshold:
0x00, 0x00, 0x00, 0x01,
// number of addresses:
0x00, 0x00, 0x00, 0x01,
// address[0]:
0xfc, 0xed, 0xa8, 0xf9, 0x0f, 0xcb, 0x5d, 0x30,
0x61, 0x4b, 0x99, 0xd7, 0x9f, 0xc4, 0xba, 0xa2,
0x93, 0x07, 0x76, 0x26,
// number of credentials:
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x71, 0x01, 0x00, 0x00, 0x05, 0x04, 0x03, 0x02, 0x01, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x02,
0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00,
0x00, 0x00, 0x00, 0xc8, 0x17, 0xa8, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0xfc, 0xed, 0xa8, 0xf9, 0x0f, 0xcb,
0x5d, 0x30, 0x61, 0x4b, 0x99, 0xd7, 0x9f, 0xc4, 0xba, 0xa2, 0x93, 0x07, 0x76, 0x26, 0x01, 0x02,
0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00,
0x00, 0x00, 0x00, 0xc8, 0x17, 0xa8, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x6e, 0xad, 0x69, 0x3c, 0x17, 0xab,
0xb1, 0xbe, 0x42, 0x2b, 0xb5, 0x0b, 0x30, 0xb9, 0x71, 0x1f, 0xf9, 0x8d, 0x66, 0x7e, 0x01, 0x02,
0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00,
0x00, 0x00, 0x00, 0xc8, 0x17, 0xa8, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0xf2, 0x42, 0x08, 0x46, 0x87, 0x6e,
0x69, 0xf4, 0x73, 0xdd, 0xa2, 0x56, 0x17, 0x29, 0x67, 0xe9, 0x92, 0xf0, 0xee, 0x31, 0x00, 0x00,
0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x01, 0x02, 0x03, 0x04, 0x00, 0x6e, 0x61, 0x6d, 0x65,
0x04, 0x00, 0x73, 0x79, 0x6d, 0x62, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0xfc, 0xed, 0xa8, 0xf9, 0x0f, 0xcb, 0x5d, 0x30, 0x61,
0x4b, 0x99, 0xd7, 0x9f, 0xc4, 0xba, 0xa2, 0x93, 0x07, 0x76, 0x26, 0x00, 0x00, 0x00, 0x00,
}
unsignedTx := &txs.CreateAssetTx{
+55 -100
View File
@@ -22,55 +22,18 @@ func TestExportTxSerialization(t *testing.T) {
require := require.New(t)
expected := []byte{
// Codec version:
0x00, 0x00,
// txID:
0x00, 0x00, 0x00, 0x04,
// networkID:
0x00, 0x00, 0x00, 0x02,
// blockchainID:
0xff, 0xff, 0xff, 0xff, 0xee, 0xee, 0xee, 0xee,
0xdd, 0xdd, 0xdd, 0xdd, 0xcc, 0xcc, 0xcc, 0xcc,
0xbb, 0xbb, 0xbb, 0xbb, 0xaa, 0xaa, 0xaa, 0xaa,
0x99, 0x99, 0x99, 0x99, 0x88, 0x88, 0x88, 0x88,
// number of outs:
0x00, 0x00, 0x00, 0x00,
// number of inputs:
0x00, 0x00, 0x00, 0x01,
// utxoID:
0x0f, 0x2f, 0x4f, 0x6f, 0x8e, 0xae, 0xce, 0xee,
0x0d, 0x2d, 0x4d, 0x6d, 0x8c, 0xac, 0xcc, 0xec,
0x0b, 0x2b, 0x4b, 0x6b, 0x8a, 0xaa, 0xca, 0xea,
0x09, 0x29, 0x49, 0x69, 0x88, 0xa8, 0xc8, 0xe8,
// output index
0x00, 0x00, 0x00, 0x00,
// assetID:
0x1f, 0x3f, 0x5f, 0x7f, 0x9e, 0xbe, 0xde, 0xfe,
0x1d, 0x3d, 0x5d, 0x7d, 0x9c, 0xbc, 0xdc, 0xfc,
0x1b, 0x3b, 0x5b, 0x7b, 0x9a, 0xba, 0xda, 0xfa,
0x19, 0x39, 0x59, 0x79, 0x98, 0xb8, 0xd8, 0xf8,
// input:
// input ID:
0x00, 0x00, 0x00, 0x05,
// amount:
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0xe8,
// num sig indices:
0x00, 0x00, 0x00, 0x01,
// sig index[0]:
0x00, 0x00, 0x00, 0x00,
// Memo length:
0x00, 0x00, 0x00, 0x04,
// Memo:
0x00, 0x01, 0x02, 0x03,
// Destination Chain ID:
0x1f, 0x8f, 0x9f, 0x0f, 0x1e, 0x8e, 0x9e, 0x0e,
0x2d, 0x7d, 0xad, 0xfd, 0x2c, 0x7c, 0xac, 0xfc,
0x3b, 0x6b, 0xbb, 0xeb, 0x3a, 0x6a, 0xba, 0xea,
0x49, 0x59, 0xc9, 0xd9, 0x48, 0x58, 0xc8, 0xd8,
// number of exported outs:
0x00, 0x00, 0x00, 0x00,
// number of credentials:
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xee, 0xee,
0xee, 0xee, 0xdd, 0xdd, 0xdd, 0xdd, 0xcc, 0xcc, 0xcc, 0xcc, 0xbb, 0xbb, 0xbb, 0xbb, 0xaa, 0xaa,
0xaa, 0xaa, 0x99, 0x99, 0x99, 0x99, 0x88, 0x88, 0x88, 0x88, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00,
0x00, 0x00, 0x0f, 0x2f, 0x4f, 0x6f, 0x8e, 0xae, 0xce, 0xee, 0x0d, 0x2d, 0x4d, 0x6d, 0x8c, 0xac,
0xcc, 0xec, 0x0b, 0x2b, 0x4b, 0x6b, 0x8a, 0xaa, 0xca, 0xea, 0x09, 0x29, 0x49, 0x69, 0x88, 0xa8,
0xc8, 0xe8, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x3f, 0x5f, 0x7f, 0x9e, 0xbe, 0xde, 0xfe, 0x1d, 0x3d,
0x5d, 0x7d, 0x9c, 0xbc, 0xdc, 0xfc, 0x1b, 0x3b, 0x5b, 0x7b, 0x9a, 0xba, 0xda, 0xfa, 0x19, 0x39,
0x59, 0x79, 0x98, 0xb8, 0xd8, 0xf8, 0x05, 0x00, 0x00, 0x00, 0xe8, 0x03, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x01,
0x02, 0x03, 0x1f, 0x8f, 0x9f, 0x0f, 0x1e, 0x8e, 0x9e, 0x0e, 0x2d, 0x7d, 0xad, 0xfd, 0x2c, 0x7c,
0xac, 0xfc, 0x3b, 0x6b, 0xbb, 0xeb, 0x3a, 0x6a, 0xba, 0xea, 0x49, 0x59, 0xc9, 0xd9, 0x48, 0x58,
0xc8, 0xd8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
}
tx := &txs.Tx{Unsigned: &txs.ExportTx{
@@ -119,59 +82,49 @@ func TestExportTxSerialization(t *testing.T) {
require.NoError(err)
require.NoError(tx.Initialize(parser.Codec()))
require.Equal("2PKJE4TrKYpgynBFCpNPpV3GHK7d9QTgrL5mpYG6abHKDvNBG3", tx.ID().String())
require.Equal("218sX5RECzRWffe1JKGET72KsUhAGJAuPe8tAe2s8PLCJrAeqZ", tx.ID().String())
result := tx.Bytes()
require.Equal(expected, result)
// Regenerated post-LP-023 ZAP cutover. LE wire format changes the
// signed-hash → different ECDSA signatures vs the legacy BE bytes.
credBytes := []byte{
// type id
0x00, 0x00, 0x00, 0x09,
// there are two signers (thus two signatures)
0x00, 0x00, 0x00, 0x02,
// 65 bytes
0x61, 0xdd, 0x9b, 0xff, 0xc0, 0x49, 0x95, 0x6e, 0xd7, 0xf8,
0xcd, 0x92, 0xec, 0xda, 0x03, 0x6e, 0xac, 0xb8, 0x16, 0x9e,
0x53, 0x83, 0xc0, 0x3a, 0x2e, 0x88, 0x5b, 0x5f, 0xc6, 0xef,
0x2e, 0xbe, 0x50, 0x59, 0x72, 0x8d, 0x0f, 0xa6, 0x59, 0x66,
0x93, 0x28, 0x88, 0xb4, 0x56, 0x3b, 0x77, 0x7c, 0x59, 0xa5,
0x8f, 0xe0, 0x2a, 0xf3, 0xcc, 0x31, 0x32, 0xef, 0xfe, 0x7d,
0x3d, 0x9f, 0x14, 0x94, 0x01,
// 65 bytes
0x61, 0xdd, 0x9b, 0xff, 0xc0, 0x49, 0x95, 0x6e, 0xd7, 0xf8,
0xcd, 0x92, 0xec, 0xda, 0x03, 0x6e, 0xac, 0xb8, 0x16, 0x9e,
0x53, 0x83, 0xc0, 0x3a, 0x2e, 0x88, 0x5b, 0x5f, 0xc6, 0xef,
0x2e, 0xbe, 0x50, 0x59, 0x72, 0x8d, 0x0f, 0xa6, 0x59, 0x66,
0x93, 0x28, 0x88, 0xb4, 0x56, 0x3b, 0x77, 0x7c, 0x59, 0xa5,
0x8f, 0xe0, 0x2a, 0xf3, 0xcc, 0x31, 0x32, 0xef, 0xfe, 0x7d,
0x3d, 0x9f, 0x14, 0x94, 0x01,
// type id
0x00, 0x00, 0x00, 0x09,
// there are two signers (thus two signatures)
0x00, 0x00, 0x00, 0x02,
// 65 bytes
0x61, 0xdd, 0x9b, 0xff, 0xc0, 0x49, 0x95, 0x6e, 0xd7, 0xf8,
0xcd, 0x92, 0xec, 0xda, 0x03, 0x6e, 0xac, 0xb8, 0x16, 0x9e,
0x53, 0x83, 0xc0, 0x3a, 0x2e, 0x88, 0x5b, 0x5f, 0xc6, 0xef,
0x2e, 0xbe, 0x50, 0x59, 0x72, 0x8d, 0x0f, 0xa6, 0x59, 0x66,
0x93, 0x28, 0x88, 0xb4, 0x56, 0x3b, 0x77, 0x7c, 0x59, 0xa5,
0x8f, 0xe0, 0x2a, 0xf3, 0xcc, 0x31, 0x32, 0xef, 0xfe, 0x7d,
0x3d, 0x9f, 0x14, 0x94, 0x01,
// 65 bytes
0x61, 0xdd, 0x9b, 0xff, 0xc0, 0x49, 0x95, 0x6e, 0xd7, 0xf8,
0xcd, 0x92, 0xec, 0xda, 0x03, 0x6e, 0xac, 0xb8, 0x16, 0x9e,
0x53, 0x83, 0xc0, 0x3a, 0x2e, 0x88, 0x5b, 0x5f, 0xc6, 0xef,
0x2e, 0xbe, 0x50, 0x59, 0x72, 0x8d, 0x0f, 0xa6, 0x59, 0x66,
0x93, 0x28, 0x88, 0xb4, 0x56, 0x3b, 0x77, 0x7c, 0x59, 0xa5,
0x8f, 0xe0, 0x2a, 0xf3, 0xcc, 0x31, 0x32, 0xef, 0xfe, 0x7d,
0x3d, 0x9f, 0x14, 0x94, 0x01,
0x09, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
0xbe, 0xcc, 0x36, 0x52, 0xcc, 0xb4, 0xf9, 0xb1,
0x7d, 0xdd, 0xfd, 0x7f, 0xc5, 0x25, 0xd3, 0x47,
0x8c, 0x31, 0x0e, 0x1a, 0x0d, 0x14, 0x8b, 0xdb,
0xef, 0xfb, 0x36, 0xc4, 0x31, 0x22, 0xc3, 0xd7,
0x23, 0x90, 0xda, 0x5d, 0xdb, 0xb9, 0x1a, 0x8d,
0xc2, 0xc4, 0x8c, 0x37, 0x66, 0x24, 0x60, 0x38,
0x12, 0x9a, 0x2b, 0x54, 0x27, 0x6f, 0xe1, 0xf6,
0x82, 0xb0, 0x1d, 0x9f, 0xd6, 0xab, 0x45, 0x06,
0x00, 0xbe, 0xcc, 0x36, 0x52, 0xcc, 0xb4, 0xf9,
0xb1, 0x7d, 0xdd, 0xfd, 0x7f, 0xc5, 0x25, 0xd3,
0x47, 0x8c, 0x31, 0x0e, 0x1a, 0x0d, 0x14, 0x8b,
0xdb, 0xef, 0xfb, 0x36, 0xc4, 0x31, 0x22, 0xc3,
0xd7, 0x23, 0x90, 0xda, 0x5d, 0xdb, 0xb9, 0x1a,
0x8d, 0xc2, 0xc4, 0x8c, 0x37, 0x66, 0x24, 0x60,
0x38, 0x12, 0x9a, 0x2b, 0x54, 0x27, 0x6f, 0xe1,
0xf6, 0x82, 0xb0, 0x1d, 0x9f, 0xd6, 0xab, 0x45,
0x06, 0x00, 0x09, 0x00, 0x00, 0x00, 0x02, 0x00,
0x00, 0x00, 0xbe, 0xcc, 0x36, 0x52, 0xcc, 0xb4,
0xf9, 0xb1, 0x7d, 0xdd, 0xfd, 0x7f, 0xc5, 0x25,
0xd3, 0x47, 0x8c, 0x31, 0x0e, 0x1a, 0x0d, 0x14,
0x8b, 0xdb, 0xef, 0xfb, 0x36, 0xc4, 0x31, 0x22,
0xc3, 0xd7, 0x23, 0x90, 0xda, 0x5d, 0xdb, 0xb9,
0x1a, 0x8d, 0xc2, 0xc4, 0x8c, 0x37, 0x66, 0x24,
0x60, 0x38, 0x12, 0x9a, 0x2b, 0x54, 0x27, 0x6f,
0xe1, 0xf6, 0x82, 0xb0, 0x1d, 0x9f, 0xd6, 0xab,
0x45, 0x06, 0x00, 0xbe, 0xcc, 0x36, 0x52, 0xcc,
0xb4, 0xf9, 0xb1, 0x7d, 0xdd, 0xfd, 0x7f, 0xc5,
0x25, 0xd3, 0x47, 0x8c, 0x31, 0x0e, 0x1a, 0x0d,
0x14, 0x8b, 0xdb, 0xef, 0xfb, 0x36, 0xc4, 0x31,
0x22, 0xc3, 0xd7, 0x23, 0x90, 0xda, 0x5d, 0xdb,
0xb9, 0x1a, 0x8d, 0xc2, 0xc4, 0x8c, 0x37, 0x66,
0x24, 0x60, 0x38, 0x12, 0x9a, 0x2b, 0x54, 0x27,
0x6f, 0xe1, 0xf6, 0x82, 0xb0, 0x1d, 0x9f, 0xd6,
0xab, 0x45, 0x06, 0x00,
}
require.NoError(tx.SignSECP256K1Fx(
parser.Codec(),
@@ -180,10 +133,12 @@ func TestExportTxSerialization(t *testing.T) {
{keys[0], keys[0]},
},
))
require.Equal("2oG52e7Cb7XF1yUzv3pRFndAypgbpswWRcSAKD5SH5VgaiTm5D", tx.ID().String())
require.Equal("2XWcfypBSo6rhikT9hYvvk6YwJvoaYKrHrK1DLjGpPPxyFuNtE", tx.ID().String())
// there are two credentials
expected[len(expected)-1] = 0x02
// there are two credentials — credentials count is a uint32 LE
// length prefix, so the low byte sits 4 positions from the end.
// Regenerated post-LP-023 ZAP cutover (was [len-1] in legacy BE).
expected[len(expected)-4] = 0x02
expected = append(expected, credBytes...)
result = tx.Bytes()
require.Equal(expected, result)
+55 -100
View File
@@ -22,55 +22,18 @@ func TestImportTxSerialization(t *testing.T) {
require := require.New(t)
expected := []byte{
// Codec version
0x00, 0x00,
// txID:
0x00, 0x00, 0x00, 0x03,
// networkID:
0x00, 0x00, 0x00, 0x02,
// blockchainID:
0xff, 0xff, 0xff, 0xff, 0xee, 0xee, 0xee, 0xee,
0xdd, 0xdd, 0xdd, 0xdd, 0xcc, 0xcc, 0xcc, 0xcc,
0xbb, 0xbb, 0xbb, 0xbb, 0xaa, 0xaa, 0xaa, 0xaa,
0x99, 0x99, 0x99, 0x99, 0x88, 0x88, 0x88, 0x88,
// number of base outs:
0x00, 0x00, 0x00, 0x00,
// number of base inputs:
0x00, 0x00, 0x00, 0x00,
// Memo length:
0x00, 0x00, 0x00, 0x04,
// Memo:
0x00, 0x01, 0x02, 0x03,
// Source Chain ID:
0x1f, 0x8f, 0x9f, 0x0f, 0x1e, 0x8e, 0x9e, 0x0e,
0x2d, 0x7d, 0xad, 0xfd, 0x2c, 0x7c, 0xac, 0xfc,
0x3b, 0x6b, 0xbb, 0xeb, 0x3a, 0x6a, 0xba, 0xea,
0x49, 0x59, 0xc9, 0xd9, 0x48, 0x58, 0xc8, 0xd8,
// number of inputs:
0x00, 0x00, 0x00, 0x01,
// utxoID:
0x0f, 0x2f, 0x4f, 0x6f, 0x8e, 0xae, 0xce, 0xee,
0x0d, 0x2d, 0x4d, 0x6d, 0x8c, 0xac, 0xcc, 0xec,
0x0b, 0x2b, 0x4b, 0x6b, 0x8a, 0xaa, 0xca, 0xea,
0x09, 0x29, 0x49, 0x69, 0x88, 0xa8, 0xc8, 0xe8,
// output index
0x00, 0x00, 0x00, 0x00,
// assetID:
0x1f, 0x3f, 0x5f, 0x7f, 0x9e, 0xbe, 0xde, 0xfe,
0x1d, 0x3d, 0x5d, 0x7d, 0x9c, 0xbc, 0xdc, 0xfc,
0x1b, 0x3b, 0x5b, 0x7b, 0x9a, 0xba, 0xda, 0xfa,
0x19, 0x39, 0x59, 0x79, 0x98, 0xb8, 0xd8, 0xf8,
// input:
// input ID:
0x00, 0x00, 0x00, 0x05,
// amount:
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0xe8,
// num sig indices:
0x00, 0x00, 0x00, 0x01,
// sig index[0]:
0x00, 0x00, 0x00, 0x00,
// number of credentials:
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xee, 0xee,
0xee, 0xee, 0xdd, 0xdd, 0xdd, 0xdd, 0xcc, 0xcc, 0xcc, 0xcc, 0xbb, 0xbb, 0xbb, 0xbb, 0xaa, 0xaa,
0xaa, 0xaa, 0x99, 0x99, 0x99, 0x99, 0x88, 0x88, 0x88, 0x88, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x01, 0x02, 0x03, 0x1f, 0x8f, 0x9f, 0x0f, 0x1e, 0x8e,
0x9e, 0x0e, 0x2d, 0x7d, 0xad, 0xfd, 0x2c, 0x7c, 0xac, 0xfc, 0x3b, 0x6b, 0xbb, 0xeb, 0x3a, 0x6a,
0xba, 0xea, 0x49, 0x59, 0xc9, 0xd9, 0x48, 0x58, 0xc8, 0xd8, 0x01, 0x00, 0x00, 0x00, 0x0f, 0x2f,
0x4f, 0x6f, 0x8e, 0xae, 0xce, 0xee, 0x0d, 0x2d, 0x4d, 0x6d, 0x8c, 0xac, 0xcc, 0xec, 0x0b, 0x2b,
0x4b, 0x6b, 0x8a, 0xaa, 0xca, 0xea, 0x09, 0x29, 0x49, 0x69, 0x88, 0xa8, 0xc8, 0xe8, 0x00, 0x00,
0x00, 0x00, 0x1f, 0x3f, 0x5f, 0x7f, 0x9e, 0xbe, 0xde, 0xfe, 0x1d, 0x3d, 0x5d, 0x7d, 0x9c, 0xbc,
0xdc, 0xfc, 0x1b, 0x3b, 0x5b, 0x7b, 0x9a, 0xba, 0xda, 0xfa, 0x19, 0x39, 0x59, 0x79, 0x98, 0xb8,
0xd8, 0xf8, 0x05, 0x00, 0x00, 0x00, 0xe8, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
}
tx := &txs.Tx{Unsigned: &txs.ImportTx{
@@ -119,59 +82,49 @@ func TestImportTxSerialization(t *testing.T) {
require.NoError(err)
require.NoError(tx.Initialize(parser.Codec()))
require.Equal("9wdPb5rsThXYLX4WxkNeyYrNMfDE5cuWLgifSjxKiA2dCmgCZ", tx.ID().String())
require.Equal("tSexDDwyJnwDsjkP8Eam2ecKKuvcNZFiHkrXHbhK141DTdZoS", tx.ID().String())
result := tx.Bytes()
require.Equal(expected, result)
// Regenerated post-LP-023 ZAP cutover. LE wire format changes the
// signed-hash → different ECDSA signatures vs the legacy BE bytes.
credBytes := []byte{
// type id
0x00, 0x00, 0x00, 0x09,
// there are two signers (thus two signatures)
0x00, 0x00, 0x00, 0x02,
// 65 bytes
0x8c, 0xc7, 0xdc, 0x8c, 0x11, 0xd3, 0x75, 0x9e, 0x16, 0xa5,
0x9f, 0xd2, 0x9c, 0x64, 0xd7, 0x1f, 0x9b, 0xad, 0x1a, 0x62,
0x33, 0x98, 0xc7, 0xaf, 0x67, 0x02, 0xc5, 0xe0, 0x75, 0x8e,
0x62, 0xcf, 0x15, 0x6d, 0x99, 0xf5, 0x4e, 0x71, 0xb8, 0xf4,
0x8b, 0x5b, 0xbf, 0x0c, 0x59, 0x62, 0x79, 0x34, 0x97, 0x1a,
0x1f, 0x49, 0x9b, 0x0a, 0x4f, 0xbf, 0x95, 0xfc, 0x31, 0x39,
0x46, 0x4e, 0xa1, 0xaf, 0x00,
// 65 bytes
0x8c, 0xc7, 0xdc, 0x8c, 0x11, 0xd3, 0x75, 0x9e, 0x16, 0xa5,
0x9f, 0xd2, 0x9c, 0x64, 0xd7, 0x1f, 0x9b, 0xad, 0x1a, 0x62,
0x33, 0x98, 0xc7, 0xaf, 0x67, 0x02, 0xc5, 0xe0, 0x75, 0x8e,
0x62, 0xcf, 0x15, 0x6d, 0x99, 0xf5, 0x4e, 0x71, 0xb8, 0xf4,
0x8b, 0x5b, 0xbf, 0x0c, 0x59, 0x62, 0x79, 0x34, 0x97, 0x1a,
0x1f, 0x49, 0x9b, 0x0a, 0x4f, 0xbf, 0x95, 0xfc, 0x31, 0x39,
0x46, 0x4e, 0xa1, 0xaf, 0x00,
// type id
0x00, 0x00, 0x00, 0x09,
// there are two signers (thus two signatures)
0x00, 0x00, 0x00, 0x02,
// 65 bytes
0x8c, 0xc7, 0xdc, 0x8c, 0x11, 0xd3, 0x75, 0x9e, 0x16, 0xa5,
0x9f, 0xd2, 0x9c, 0x64, 0xd7, 0x1f, 0x9b, 0xad, 0x1a, 0x62,
0x33, 0x98, 0xc7, 0xaf, 0x67, 0x02, 0xc5, 0xe0, 0x75, 0x8e,
0x62, 0xcf, 0x15, 0x6d, 0x99, 0xf5, 0x4e, 0x71, 0xb8, 0xf4,
0x8b, 0x5b, 0xbf, 0x0c, 0x59, 0x62, 0x79, 0x34, 0x97, 0x1a,
0x1f, 0x49, 0x9b, 0x0a, 0x4f, 0xbf, 0x95, 0xfc, 0x31, 0x39,
0x46, 0x4e, 0xa1, 0xaf, 0x00,
// 65 bytes
0x8c, 0xc7, 0xdc, 0x8c, 0x11, 0xd3, 0x75, 0x9e, 0x16, 0xa5,
0x9f, 0xd2, 0x9c, 0x64, 0xd7, 0x1f, 0x9b, 0xad, 0x1a, 0x62,
0x33, 0x98, 0xc7, 0xaf, 0x67, 0x02, 0xc5, 0xe0, 0x75, 0x8e,
0x62, 0xcf, 0x15, 0x6d, 0x99, 0xf5, 0x4e, 0x71, 0xb8, 0xf4,
0x8b, 0x5b, 0xbf, 0x0c, 0x59, 0x62, 0x79, 0x34, 0x97, 0x1a,
0x1f, 0x49, 0x9b, 0x0a, 0x4f, 0xbf, 0x95, 0xfc, 0x31, 0x39,
0x46, 0x4e, 0xa1, 0xaf, 0x00,
0x09, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
0x49, 0x19, 0x22, 0x34, 0x1f, 0xbc, 0xdb, 0x97,
0xd1, 0xbf, 0x43, 0x28, 0x7b, 0x22, 0x3f, 0xc3,
0x3a, 0xa9, 0x6d, 0x9b, 0xab, 0x73, 0x1c, 0x51,
0x40, 0x83, 0x96, 0xe3, 0x8b, 0x92, 0x07, 0x13,
0x20, 0xe7, 0x50, 0x68, 0xce, 0x53, 0x8f, 0x0e,
0x92, 0xc2, 0x5e, 0xd1, 0x45, 0xea, 0xef, 0x6f,
0xe1, 0xad, 0x24, 0x97, 0xc9, 0x28, 0xce, 0xe0,
0xc5, 0x11, 0xbe, 0xc9, 0x69, 0xf4, 0x70, 0x22,
0x00, 0x49, 0x19, 0x22, 0x34, 0x1f, 0xbc, 0xdb,
0x97, 0xd1, 0xbf, 0x43, 0x28, 0x7b, 0x22, 0x3f,
0xc3, 0x3a, 0xa9, 0x6d, 0x9b, 0xab, 0x73, 0x1c,
0x51, 0x40, 0x83, 0x96, 0xe3, 0x8b, 0x92, 0x07,
0x13, 0x20, 0xe7, 0x50, 0x68, 0xce, 0x53, 0x8f,
0x0e, 0x92, 0xc2, 0x5e, 0xd1, 0x45, 0xea, 0xef,
0x6f, 0xe1, 0xad, 0x24, 0x97, 0xc9, 0x28, 0xce,
0xe0, 0xc5, 0x11, 0xbe, 0xc9, 0x69, 0xf4, 0x70,
0x22, 0x00, 0x09, 0x00, 0x00, 0x00, 0x02, 0x00,
0x00, 0x00, 0x49, 0x19, 0x22, 0x34, 0x1f, 0xbc,
0xdb, 0x97, 0xd1, 0xbf, 0x43, 0x28, 0x7b, 0x22,
0x3f, 0xc3, 0x3a, 0xa9, 0x6d, 0x9b, 0xab, 0x73,
0x1c, 0x51, 0x40, 0x83, 0x96, 0xe3, 0x8b, 0x92,
0x07, 0x13, 0x20, 0xe7, 0x50, 0x68, 0xce, 0x53,
0x8f, 0x0e, 0x92, 0xc2, 0x5e, 0xd1, 0x45, 0xea,
0xef, 0x6f, 0xe1, 0xad, 0x24, 0x97, 0xc9, 0x28,
0xce, 0xe0, 0xc5, 0x11, 0xbe, 0xc9, 0x69, 0xf4,
0x70, 0x22, 0x00, 0x49, 0x19, 0x22, 0x34, 0x1f,
0xbc, 0xdb, 0x97, 0xd1, 0xbf, 0x43, 0x28, 0x7b,
0x22, 0x3f, 0xc3, 0x3a, 0xa9, 0x6d, 0x9b, 0xab,
0x73, 0x1c, 0x51, 0x40, 0x83, 0x96, 0xe3, 0x8b,
0x92, 0x07, 0x13, 0x20, 0xe7, 0x50, 0x68, 0xce,
0x53, 0x8f, 0x0e, 0x92, 0xc2, 0x5e, 0xd1, 0x45,
0xea, 0xef, 0x6f, 0xe1, 0xad, 0x24, 0x97, 0xc9,
0x28, 0xce, 0xe0, 0xc5, 0x11, 0xbe, 0xc9, 0x69,
0xf4, 0x70, 0x22, 0x00,
}
require.NoError(tx.SignSECP256K1Fx(
parser.Codec(),
@@ -180,10 +133,12 @@ func TestImportTxSerialization(t *testing.T) {
{keys[0], keys[0]},
},
))
require.Equal("pCW7sVBytzdZ1WrqzGY1DvA2S9UaMr72xpUMxVyx1QHBARNYx", tx.ID().String())
require.Equal("Uv77K7265Um1dTQhZJXfVGGPPMPwtJf8RpQqw4pDg2AZysEzD", tx.ID().String())
// there are two credentials
expected[len(expected)-1] = 0x02
// there are two credentials — credentials count is a uint32 LE
// length prefix, so the low byte sits 4 positions from the end.
// Regenerated post-LP-023 ZAP cutover (was [len-1] in legacy BE).
expected[len(expected)-4] = 0x02
expected = append(expected, credBytes...)
result = tx.Bytes()
require.Equal(expected, result)
+5 -16
View File
@@ -27,22 +27,11 @@ func TestInitialStateVerifySerialization(t *testing.T) {
require.NoError(c.RegisterType(&secp256k1fx.TransferOutput{}))
expected := []byte{
// Codec version:
0x00, 0x00,
// fxID:
0x00, 0x00, 0x00, 0x00,
// num outputs:
0x00, 0x00, 0x00, 0x01,
// output:
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x30, 0x39, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0xd4, 0x31, 0x00, 0x00, 0x00, 0x01,
0x00, 0x00, 0x00, 0x02, 0x51, 0x02, 0x5c, 0x61,
0xfb, 0xcf, 0xc0, 0x78, 0xf6, 0x93, 0x34, 0xf8,
0x34, 0xbe, 0x6d, 0xd2, 0x6d, 0x55, 0xa9, 0x55,
0xc3, 0x34, 0x41, 0x28, 0xe0, 0x60, 0x12, 0x8e,
0xde, 0x35, 0x23, 0xa2, 0x4a, 0x46, 0x1c, 0x89,
0x43, 0xab, 0x08, 0x59,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x39, 0x30,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x31, 0xd4, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00,
0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x51, 0x02, 0x5c, 0x61, 0xfb, 0xcf, 0xc0, 0x78, 0xf6, 0x93,
0x34, 0xf8, 0x34, 0xbe, 0x6d, 0xd2, 0x6d, 0x55, 0xa9, 0x55, 0xc3, 0x34, 0x41, 0x28, 0xe0, 0x60,
0x12, 0x8e, 0xde, 0x35, 0x23, 0xa2, 0x4a, 0x46, 0x1c, 0x89, 0x43, 0xab, 0x08, 0x59,
}
is := &txs.InitialState{
+167
View File
@@ -0,0 +1,167 @@
// Copyright (C) 2019-2026, Lux Industries, Inc. All rights reserved.
// See the file LICENSE for licensing terms.
//go:build emit_fixtures
package txs_test
import (
"encoding/hex"
"fmt"
"strings"
"testing"
"github.com/luxfi/crypto/secp256k1"
"github.com/luxfi/ids"
"github.com/luxfi/proto/internal/xcodectest"
"github.com/luxfi/proto/x/fxs"
"github.com/luxfi/proto/x/txs"
lux "github.com/luxfi/utxo"
"github.com/luxfi/utxo/secp256k1fx"
)
// TestEmitTxCredBytes emits the credBytes portion of the signed Import/Export
// transactions used by TestImportTxSerialization and TestExportTxSerialization.
// The credBytes are signed bytes, deterministically derived from
// SignSECP256K1Fx — they change whenever the wire format the signer
// signs over changes.
//
// Run via:
//
// go test -tags emit_fixtures -run TestEmitTxCredBytes -v ./x/txs
//
// then paste the hex output into the respective credBytes literal in
// import_tx_test.go / export_tx_test.go.
func TestEmitTxCredBytes(t *testing.T) {
parser, err := txs.NewParser(
xcodectest.New(),
[]fxs.Fx{&secp256k1fx.Fx{}},
)
if err != nil {
t.Fatalf("NewParser: %v", err)
}
// Use the same shared TestKeys() that the package's *_test.go
// files use (defined in base_tx_test.go as `keys = secp256k1.TestKeys()`).
allKeys := secp256k1.TestKeys()
k := allKeys[0]
type emit struct {
name string
tx *txs.Tx
}
cases := []emit{
{
name: "ImportTx",
tx: &txs.Tx{Unsigned: &txs.ImportTx{
BaseTx: txs.BaseTx{BaseTx: lux.BaseTx{
NetworkID: 2,
BlockchainID: ids.ID{
0xff, 0xff, 0xff, 0xff, 0xee, 0xee, 0xee, 0xee,
0xdd, 0xdd, 0xdd, 0xdd, 0xcc, 0xcc, 0xcc, 0xcc,
0xbb, 0xbb, 0xbb, 0xbb, 0xaa, 0xaa, 0xaa, 0xaa,
0x99, 0x99, 0x99, 0x99, 0x88, 0x88, 0x88, 0x88,
},
Memo: []byte{0x00, 0x01, 0x02, 0x03},
}},
SourceChain: ids.ID{
0x1f, 0x8f, 0x9f, 0x0f, 0x1e, 0x8e, 0x9e, 0x0e,
0x2d, 0x7d, 0xad, 0xfd, 0x2c, 0x7c, 0xac, 0xfc,
0x3b, 0x6b, 0xbb, 0xeb, 0x3a, 0x6a, 0xba, 0xea,
0x49, 0x59, 0xc9, 0xd9, 0x48, 0x58, 0xc8, 0xd8,
},
ImportedIns: []*lux.TransferableInput{{
UTXOID: lux.UTXOID{TxID: ids.ID{
0x0f, 0x2f, 0x4f, 0x6f, 0x8e, 0xae, 0xce, 0xee,
0x0d, 0x2d, 0x4d, 0x6d, 0x8c, 0xac, 0xcc, 0xec,
0x0b, 0x2b, 0x4b, 0x6b, 0x8a, 0xaa, 0xca, 0xea,
0x09, 0x29, 0x49, 0x69, 0x88, 0xa8, 0xc8, 0xe8,
}},
Asset: lux.Asset{ID: ids.ID{
0x1f, 0x3f, 0x5f, 0x7f, 0x9e, 0xbe, 0xde, 0xfe,
0x1d, 0x3d, 0x5d, 0x7d, 0x9c, 0xbc, 0xdc, 0xfc,
0x1b, 0x3b, 0x5b, 0x7b, 0x9a, 0xba, 0xda, 0xfa,
0x19, 0x39, 0x59, 0x79, 0x98, 0xb8, 0xd8, 0xf8,
}},
In: &secp256k1fx.TransferInput{
Amt: 1000,
Input: secp256k1fx.Input{SigIndices: []uint32{0}},
},
}},
}},
},
{
name: "ExportTx",
tx: &txs.Tx{Unsigned: &txs.ExportTx{
BaseTx: txs.BaseTx{BaseTx: lux.BaseTx{
NetworkID: 2,
BlockchainID: ids.ID{
0xff, 0xff, 0xff, 0xff, 0xee, 0xee, 0xee, 0xee,
0xdd, 0xdd, 0xdd, 0xdd, 0xcc, 0xcc, 0xcc, 0xcc,
0xbb, 0xbb, 0xbb, 0xbb, 0xaa, 0xaa, 0xaa, 0xaa,
0x99, 0x99, 0x99, 0x99, 0x88, 0x88, 0x88, 0x88,
},
Ins: []*lux.TransferableInput{{
UTXOID: lux.UTXOID{TxID: ids.ID{
0x0f, 0x2f, 0x4f, 0x6f, 0x8e, 0xae, 0xce, 0xee,
0x0d, 0x2d, 0x4d, 0x6d, 0x8c, 0xac, 0xcc, 0xec,
0x0b, 0x2b, 0x4b, 0x6b, 0x8a, 0xaa, 0xca, 0xea,
0x09, 0x29, 0x49, 0x69, 0x88, 0xa8, 0xc8, 0xe8,
}},
Asset: lux.Asset{ID: ids.ID{
0x1f, 0x3f, 0x5f, 0x7f, 0x9e, 0xbe, 0xde, 0xfe,
0x1d, 0x3d, 0x5d, 0x7d, 0x9c, 0xbc, 0xdc, 0xfc,
0x1b, 0x3b, 0x5b, 0x7b, 0x9a, 0xba, 0xda, 0xfa,
0x19, 0x39, 0x59, 0x79, 0x98, 0xb8, 0xd8, 0xf8,
}},
In: &secp256k1fx.TransferInput{
Amt: 1000,
Input: secp256k1fx.Input{SigIndices: []uint32{0}},
},
}},
Memo: []byte{0x00, 0x01, 0x02, 0x03},
}},
DestinationChain: ids.ID{
0x1f, 0x8f, 0x9f, 0x0f, 0x1e, 0x8e, 0x9e, 0x0e,
0x2d, 0x7d, 0xad, 0xfd, 0x2c, 0x7c, 0xac, 0xfc,
0x3b, 0x6b, 0xbb, 0xeb, 0x3a, 0x6a, 0xba, 0xea,
0x49, 0x59, 0xc9, 0xd9, 0x48, 0x58, 0xc8, 0xd8,
},
}},
},
}
for _, c := range cases {
t.Run(c.name, func(t *testing.T) {
if err := c.tx.Initialize(parser.Codec()); err != nil {
t.Fatalf("Initialize: %v", err)
}
unsignedLen := len(c.tx.Bytes())
if err := c.tx.SignSECP256K1Fx(
parser.Codec(),
[][]*secp256k1.PrivateKey{{k, k}, {k, k}},
); err != nil {
t.Fatalf("SignSECP256K1Fx: %v", err)
}
signed := c.tx.Bytes()
// credBytes = everything after the unsigned body. But the
// signed tx also bumps the last "creds count" byte at
// position (unsignedLen-1) from 0 to 2; the test mirrors
// this with `expected[len(expected)-1] = 0x02`.
credBytes := signed[unsignedLen:]
fmt.Printf("EMIT_CREDBYTES: %s tx.ID=%s unsignedLen=%d signedLen=%d\n",
c.name, c.tx.ID().String(), unsignedLen, len(signed))
fmt.Printf(" credBytes hex: %s\n", hex.EncodeToString(credBytes))
fmt.Printf(" credBytes go : %s\n", goByteLiteral(credBytes))
})
}
}
func goByteLiteral(b []byte) string {
parts := make([]string, len(b))
for i, v := range b {
parts[i] = fmt.Sprintf("0x%02x", v)
}
return "[]byte{" + strings.Join(parts, ", ") + "}"
}