specdata

package
v0.18.0 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2026 License: Apache-2.0 Imports: 10 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 specdata holds what a verifier pins (SPEC.md section 9): every file under the spec repository's spec/, the 12 files and the constructions texts under constructions/, embedded byte for byte from verification/spec/ beside this file, with verification/SOURCE naming the spec commit they came from.

task verification-sync writes verification/ here and testdata/verification/ at the module root from one commit on the spec's main, and nothing else may change either copy; task verification-check compares both with that commit. The tests hold testdata/verification/ to its MANIFEST.sha256, the embedded files and verification/ to that copy, and each table this package holds to the file it is transcribed from (SPEC.md section 13.1, "Beyond the vectors").

A file comes back as its bytes, from File: nothing here decodes JSON, so a file is read under the parsing rules of SPEC.md section 10.1 by the verifier's own strict reader. What a verifier needs as constants is written here as Go values, transcribed from its file and held equal to it by a test:

  • the constants of constants.json, as Go constants, and Constants;
  • SMALL_ORDER_KEYS, SmallOrderKeys;
  • the pattern classes of encodings.json, Encodings;
  • the network names of networks.json, Networks;
  • the default network pins of network-pins.json, DefaultNetworkPins and Environments;
  • the reason codes of reason-codes.json, with their sub_reasons, ReasonCodes;
  • the exit codes of exit-codes.json, ExitCodes and ExitCode;
  • CONSTRUCTIONS_ACCEPTED, the digests of the texts under constructions/, computed from the embedded bytes, Accepted.

The contents of keyring.production.json, the compiled keyring pin of SPEC.md section 8.3, are read only through File: it holds Truestamp's production key, and no table of this package transcribes it.

Index

Constants

View Source
const (
	// BitcoinFinality is BITCOIN_FINALITY.
	BitcoinFinality = 10
	// BitcoinMaxTotalTxs is BITCOIN_MAX_TOTAL_TXS.
	BitcoinMaxTotalTxs = 16666
	// BitcoinMedianSpan is BITCOIN_MEDIAN_SPAN.
	BitcoinMedianSpan = 11
	// ClaimsMaxOctets is CLAIMS_MAX_OCTETS.
	ClaimsMaxOctets = 20480
	// MaxDepth is MAX_DEPTH, counting the document object as 1.
	MaxDepth = 32
	// MaxDocumentOctets is MAX_DOCUMENT_OCTETS.
	MaxDocumentOctets = 65536
	// MaxInteger is MAX_INTEGER, 2^53 - 1.
	MaxInteger = 9007199254740991
	// MaxPathSteps is MAX_PATH_STEPS.
	MaxPathSteps = 32
	// MaxReadOctets is MAX_READ_OCTETS.
	MaxReadOctets = 262144
	// RawTxMaxOctets is RAW_TX_MAX_OCTETS.
	RawTxMaxOctets = 1000
	// StellarIndexMargin is STELLAR_INDEX_MARGIN, in ledgers.
	StellarIndexMargin = 60
	// TxoutproofMaxOctets is TXOUTPROOF_MAX_OCTETS.
	TxoutproofMaxOctets = 1024
	// VectorKey is VECTOR_KEY, in hex: the public key of the seed of 32
	// bytes of 0x42, valid only when the verifier's environment is test.
	VectorKey = "2152f8d19b791d24453242e15f2eab6cb7cffa7b6a5ed30097960e069881db12"
)

The constants of SPEC.md section 9, each named after the name spec/constants.json gives it. A test holds each to the file and to SPEC.md's table.

Variables

This section is empty.

Functions

func Accepted

func Accepted() []string

Accepted returns CONSTRUCTIONS_ACCEPTED, the accepted digests, sorted. Each call returns a new slice.

func Constants

func Constants() map[string]any

Constants returns every constant by its name in spec/constants.json, an integer as an int64 and VECTOR_KEY as its hex string. Each call returns a new map.

func Encodings

func Encodings() map[string]Encoding

Encodings returns the pattern classes of spec/encodings.json, by name. Each call returns a new map, sharing nothing with the table.

func Environments

func Environments() []string

Environments returns every E_v (SPEC.md section 6.4): prod, then the values of ENV in the order spec/encodings.json lists them. Each call returns a new slice.

func ExitCode

func ExitCode(ending Ending) (int, bool)

ExitCode returns the exit code of ending, and whether it is an ending of the table.

func File

func File(name string) ([]byte, error)

File returns the bytes of name, a path under spec/ such as "constants.json" or "constructions/<d>.json", exactly as the sync copied them. Each call returns a new slice. A name that is not a file under spec/, or not a clean relative path, is an error.

func IsAccepted

func IsAccepted(digest string) bool

IsAccepted reports whether digest, 64 lowercase hex digits, is in CONSTRUCTIONS_ACCEPTED.

func IsReason

func IsReason(name string) bool

IsReason reports whether name is a reason code of the table.

func Names

func Names() []string

Names returns the path under spec/ of every embedded file, sorted.

func Networks

func Networks() map[string][]string

Networks returns the network names of each chain, by chain, as spec/networks.json lists them. Each call returns a new map.

func PrefixByte

func PrefixByte(text string) (byte, error)

PrefixByte reads a registry byte as spec/prefixes.json writes it: "0x" and two lowercase hex digits, such as "0x50". Any other spelling is an error.

func Source

func Source() string

Source returns the full id of the spec commit the embedded files came from, as verification/SOURCE names it, without its newline.

Types

type ChainNetworks

type ChainNetworks struct {
	Bitcoin string
	Stellar string
}

ChainNetworks is a network for each chain: for a commitment pin, the chain's; for an entropy pin, the network of the source of that name.

type Encoding

type Encoding struct {
	// Pattern is the class's regular expression as the file writes it,
	// with no ^ or $.
	Pattern string
	// DecodesToOctets is the length of what a base64url class decodes to.
	DecodesToOctets int
	// CapsInOctets bounds HEXBYTES, by the member it appears at.
	CapsInOctets map[string]int
	// Values lists the values of ENV.
	Values []string
	// ValuesByChain lists the values of NETWORK, by chain.
	ValuesByChain map[string][]string
	// Range bounds INT.
	Range *IntRange
	// Schema names the schema definition of MERKLE_PROOF.
	Schema string
	// RoundTrip says a TIME or NISTTIME value must equal its own
	// re-formatting.
	RoundTrip bool
}

Encoding is one pattern class of spec/encodings.json (SPEC.md section 2.4). Each member is the file's member of that name, and is the zero value when the class has none.

type Ending

type Ending string

Ending is how a run of the command ended. Its value is the words the row of SPEC.md section 12.2 for it begins with.

const (
	EndingVerified             Ending = "label verified"
	EndingInternallyConsistent Ending = "label internally-consistent"
	EndingSuppliedKeyring      Ending = "label supplied-keyring"
	EndingUnattributed         Ending = "label unattributed"
	EndingFailed               Ending = "label failed"
	EndingRuntimeError         Ending = "a runtime error outside verification"
	EndingFault                Ending = "the verifier stopped on a fault"
	EndingBareRejection        Ending = "a bare rejection other than configuration_error"
	EndingConfigurationError   Ending = "configuration_error"
)

The endings of a run, one for each row of SPEC.md section 12.2.

type ExitEntry

type ExitEntry struct {
	Code int
	Run  string
}

ExitEntry is one row of the table of SPEC.md section 12.2: an exit code and the run it is for, as spec/exit-codes.json writes it.

func ExitCodes

func ExitCodes() []ExitEntry

ExitCodes returns the table of SPEC.md section 12.2, in its order. Each call returns a new slice.

type IntRange

type IntRange struct {
	Minimum, Maximum int64
}

IntRange is the minimum and maximum of a class of integers.

type NetworkPins

type NetworkPins struct {
	Commitment ChainNetworks
	Entropy    ChainNetworks
}

NetworkPins is one row of spec/network-pins.json (SPEC.md section 9): the default commitment pins and entropy pins of one E_v.

func DefaultNetworkPins

func DefaultNetworkPins(environment string) (NetworkPins, bool)

DefaultNetworkPins returns the default network pins of environment, an E_v, from spec/network-pins.json, and whether it is one.

type Reason

type Reason string

Reason is a reason code of SPEC.md section 12.1.

const (
	ReasonConfigurationError        Reason = "configuration_error"
	ReasonInputTooLarge             Reason = "input_too_large"
	ReasonMalformedJSON             Reason = "malformed_json"
	ReasonInvalidEnvelope           Reason = "invalid_envelope"
	ReasonEnvironmentMismatch       Reason = "environment_mismatch"
	ReasonKeyringUnavailable        Reason = "keyring_unavailable"
	ReasonKeyBindingFailed          Reason = "key_binding_failed"
	ReasonKeyBindingNotPerformed    Reason = "key_binding_not_performed"
	ReasonSignatureInvalid          Reason = "signature_invalid"
	ReasonUnsupportedFormat         Reason = "unsupported_format"
	ReasonUnsupportedVersion        Reason = "unsupported_version"
	ReasonShapeInvalid              Reason = "shape_invalid"
	ReasonConstructionMismatch      Reason = "construction_mismatch"
	ReasonNetworkMismatch           Reason = "network_mismatch"
	ReasonDerivationMismatch        Reason = "derivation_mismatch"
	ReasonBitcoinEvidenceInvalid    Reason = "bitcoin_evidence_invalid"
	ReasonKeyEventMismatch          Reason = "key_event_mismatch"
	ReasonOrderingViolation         Reason = "ordering_violation"
	ReasonNotAttributable           Reason = "not_attributable"
	ReasonOffline                   Reason = "offline"
	ReasonChainMismatch             Reason = "chain_mismatch"
	ReasonSourceUnreachable         Reason = "source_unreachable"
	ReasonNotHeldBySource           Reason = "not_held_by_source"
	ReasonNotYetIndexed             Reason = "not_yet_indexed"
	ReasonChainNotFinal             Reason = "chain_not_final"
	ReasonSourcesDisagree           Reason = "sources_disagree"
	ReasonSourcesIncomplete         Reason = "sources_incomplete"
	ReasonEntropyMismatch           Reason = "entropy_mismatch"
	ReasonWindowNotEstablished      Reason = "window_not_established"
	ReasonWindowInverted            Reason = "window_inverted"
	ReasonRecordedTimeOutsideWindow Reason = "recorded_time_outside_window"
	ReasonExpectedHashMismatch      Reason = "expected_hash_mismatch"
	ReasonExpectedHashWeakAlgorithm Reason = "expected_hash_weak_algorithm"
	ReasonExpectedHashNotChecked    Reason = "expected_hash_not_checked"
	ReasonPriorFailure              Reason = "prior_failure"
	ReasonInternalError             Reason = "internal_error"
)

The reason codes of SPEC.md section 12.1, in the table's order.

type ReasonEntry

type ReasonEntry struct {
	Code   Reason
	Status Status
	// Step is the step as the table writes it, such as "DERIVE, CHAIN" for
	// a code of two steps.
	Step    string
	Meaning string
	// SubReasons lists the values the code's sub_reason takes, in SPEC.md's
	// order. It is empty for every code but malformed_json and
	// invalid_envelope, since no other code carries a sub_reason.
	SubReasons []SubReason
}

ReasonEntry is one row of the table of SPEC.md section 12.1.

func LookupReason

func LookupReason(code Reason) (ReasonEntry, bool)

LookupReason returns the row of code, and whether code is in the table.

func ReasonCodes

func ReasonCodes() []ReasonEntry

ReasonCodes returns the table of SPEC.md section 12.1, in its order. Each call returns a new slice, sharing nothing with the table.

type SmallOrderKey

type SmallOrderKey struct {
	Key            [32]byte
	Order          int
	SignBitVariant bool
}

SmallOrderKey is one entry of SMALL_ORDER_KEYS (SPEC.md sections 6.2 and 9): a 32-byte encoding of a point of small order, the point's order, and whether the encoding is the sign-bit variant of a canonical one.

func SmallOrderKeys

func SmallOrderKeys() []SmallOrderKey

SmallOrderKeys returns SMALL_ORDER_KEYS in the order of spec/small-order-keys.json. Each call returns a new slice.

type Status

type Status string

Status is a reason code's status: StatusBare ends the run in a bare rejection, and the others are row statuses.

const (
	StatusBare Status = "bare"
	StatusFail Status = "fail"
	StatusSkip Status = "skip"
	StatusInfo Status = "info"
	StatusWarn Status = "warn"
)

The statuses spec/reason-codes.json writes.

type SubReason

type SubReason string

SubReason is a value the sub_reason of a malformed_json or invalid_envelope rejection takes.

const (
	SubReasonSyntax        SubReason = "syntax"
	SubReasonInvalidUTF8   SubReason = "invalid_utf8"
	SubReasonLoneSurrogate SubReason = "lone_surrogate"
	SubReasonDuplicateName SubReason = "duplicate_name"
	SubReasonNumber        SubReason = "number"
	SubReasonDepth         SubReason = "depth"
	SubReasonDocument      SubReason = "document"
	SubReasonProof         SubReason = "proof"
	SubReasonSignature     SubReason = "signature"
	SubReasonAlg           SubReason = "alg"
	SubReasonPublicKey     SubReason = "public_key"
	SubReasonValue         SubReason = "value"
)

The sub_reason values of malformed_json (SPEC.md section 10.1) and of invalid_envelope (SPEC.md section 10.2, step 3), each in its order.

func SubReasons

func SubReasons(code Reason) []SubReason

SubReasons returns the values the sub_reason of code takes, in SPEC.md's order: those of malformed_json and of invalid_envelope, and none for any other code.

Jump to

Keyboard shortcuts

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