vectors

package
v0.6.5 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2026 License: Apache-2.0 Imports: 22 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 logrec codec. Every input is fixed, so a run writes the same bytes every time; TestVectors regenerates them and compares byte for byte.

Index

Constants

View Source
const OtherStream = "example_app_hdjvnwpxle"

OtherStream shares Stream's readable part under another suffix: a different stream, and a different topic.

View Source
const Stream = "example_app_qzxkvbmwtr"

Stream is the vectors' stream identifier: the readable part "example_app" and a fixed example suffix. A real stream draws its suffix at random (logrec.NewStream); a vector fixes one so it is reproducible.

Variables

View Source
var FixedKey = bytes.Repeat([]byte{0x42}, 32)

FixedKey is the test key: 32 bytes of 0x42. It is public and must never hold anything real.

View Source
var OtherKey = bytes.Repeat([]byte{0x43}, 32)

OtherKey is a second test key, 32 bytes of 0x43, for producer-policy and other-producer cases. Public, never for real use.

Functions

func Generate

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

Generate returns every vector file, keyed by its name under testdata/vectors.

func Names

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

Names returns the generated file names in order.

func Producer

func Producer() []byte

Producer returns the fixed key's compressed identity key.

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 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.

Jump to

Keyboard shortcuts

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