vectors

package
v0.19.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 5, 2026 License: Apache-2.0 Imports: 29 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package vectors generates the golden vectors under testdata/vectors from the codec in storerec. Every value is derived from fixed stand-ins (public test keys, hashes of labels for anything a client draws at random), so the files are reproducible byte for byte; every check the generator makes fails the run when it stops holding.

Index

Constants

View Source
const (
	Bucket      = "photos_qzvmkwerty"
	OtherBucket = "archive_tqpzmwxrvk"
	// Created is the vectors' fixed time, Unix milliseconds.
	Created = 1798761600000
)

The vectors' buckets; each suffix is a fixed example.

View Source
const ContentRule = "" /* 239-byte string literal not displayed */

ContentRule is how every proof vector's content is made, so that both codecs regenerate it: segment s (4,096 bytes) is 1,024 words of xorshift32 (x ^= x << 13; x ^= x >> 17; x ^= x << 5), little-endian, from the state x = (s * 0x9e3779b9 + 0x7f4a7c15) mod 2^32 (1 if that is 0), stepping before each word; the content is the segments in order, cut to its size.

Variables

View Source
var (
	Owner   = party("owner", 0x61)
	Alice   = party("alice", 0x62)
	Bob     = party("bob", 0x63)
	Carol   = party("carol", 0x64)
	Dave    = party("dave", 0x65)
	Erin    = party("erin", 0x66)
	Parties = []Party{Owner, Alice, Bob, Carol, Dave, Erin}
)

The parties: the bucket's owner, a writer, two providers, a front and buyer, and a stranger.

Functions

func Generate

func Generate() (map[string][]byte, error)

Generate builds every vector file. It fails when a check stops holding.

func Names

func Names(files map[string][]byte) []string

Names returns the file names in a stable order.

Types

type Headers

type Headers map[uint32]chainhash.Hash

Headers is the test chain's block headers: a merkle root per height. It is the chain tracker the transaction vectors are admitted against.

func (Headers) CurrentHeight

func (h Headers) CurrentHeight(context.Context) (uint32, error)

CurrentHeight is the highest height held.

func (Headers) IsValidRootForHeight

func (h Headers) IsValidRootForHeight(_ context.Context, root *chainhash.Hash, height uint32) (bool, error)

IsValidRootForHeight holds root to the one the test chain has at height.

type Party

type Party struct {
	Name string
	Priv *ec.PrivateKey
}

Party is one public test identity: 32 bytes of one value as the private key. Never for real use.

func (Party) Pub

func (p Party) Pub() []byte

Pub is the party's compressed identity key.

func (Party) Wallet

func (p Party) Wallet() wallet.Interface

Wallet is a BRC-100 wallet over the party's key.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL