object_id = BLAKE3("vein/1" 0x00 || type_byte || body)
type_byte: chunk=1 blob=2 tree=3 commit=4 conflict=5 operation=6 view=7
navid/veins / ffdd48d871afb312fd4cf1c3a30f25840e5f93484f753cb9f549f8ce5b7e0c7f / docs/test-vectors/M0.adoc
M0.adoc
← docs/test-vectors · 7616 bytes · raw · download · view source
vein Format Test Vectors: Milestone 0
This document publishes the format-version-1 test vectors for milestone M0:
BLAKE3, canonical varints, FastCDC chunk boundaries, object IDs and bodies,
and the pack/index container. They were generated with an independent Python
implementation using the reference blake3 package and are checked by
vn self-test.
Object IDs use the domain separator from the specification:
The hex encodings below are lowercase and contain no separators. Integer fields are little-endian.
BLAKE3
| Input | Bytes | BLAKE3-256 |
|---|---|---|
empty |
(none) |
|
|
|
|
|
|
|
Chunker test input (used below):
length = 300000
seed = 2
byte[i] = (i * 31 + seed * 17) mod 251
Chunking that input produces exactly two chunks:
| Chunk | Length | Object ID |
|---|---|---|
0 |
|
|
1 |
|
|
The manifest for this file is a single leaf node (form 1) with those two entries. Its blob ID is:
34bb8e7c00665b61c882fe1cae0a51a44d6ad1719fd44a1b22c991ae6a3c24bc
FastCDC gear table
docs/test-vectors/fastcdc_gear.txt contains the 256 frozen u64 entries.
Each entry is derived reproducibly:
gear[i] = u64le( BLAKE3("vein/fastcdc/gear/v1" || u8(i))[0..8] )
i = 0..255
For convenience, the BLAKE3 of the concatenated 2048-byte little-endian gear table is:
52097d05a1f8eefb70604af851826bea02cf3f47f46aa129a661d630a40972da
Parameters: minimum 16 KiB, average 64 KiB, maximum 256 KiB, normalization
level 2. The rolling hash is fp = (fp >> 1) + gear[byte] (wrapping u64).
A boundary is taken when fp & 0x3ffff == 0 before the average size and
fp & 0x3fff == 0 from the average size onward, never before 16 KiB and never
past 256 KiB.
Canonical varints
| Value | Encoding |
|---|---|
0 |
|
127 |
|
128 |
|
300 |
|
18446744073709551615 |
|
A decoder rejects a multi-byte varint whose final group is zero, any encoding
longer than ten bytes, and any tenth byte other than 00 or 01.
Object bodies and IDs
| Object | Body hex | ID | Notes |
|---|---|---|---|
empty tree |
|
|
empty list |
inline blob |
|
|
form 0 + bytes |
The following vectors use these three inline blobs:
base = "base" -> 000462617365 -> c11596e0f11881620de9b26e54c4c1233e4d9545c09b7a677f0011121a9b56b6
ours = "ours" -> 00046f757273 -> a77d538ccdf102fc33a4f20dfd0a67e9aa16a996bee763f2a14a3fd512d20e75
theirs = "theirs" -> 0006746865697273 -> 4a1f7bff6488363e0902d1c71bb7eb514bcee359ca4fcd2fb3099e152389275f
Conflict
Two file adds (ours, theirs) and one file remove (base):
body = 02
01 || ours_id
01 || theirs_id
01
01 || base_id
id = d6d530d1e90142531d26d6db8489b0c42654b312d27b56f74b45d97f2b00e7a9
Full body hex:
0201a77d538ccdf102fc33a4f20dfd0a67e9aa16a996bee763f2a14a3fd512d20e75014a1f7bff6488363e0902d1c71bb7eb514bcee359ca4fcd2fb3099e152389275f0101c11596e0f11881620de9b26e54c4c1233e4d9545c09b7a677f0011121a9b56b6
Commit
Fields: version 1, no parents, root tree = empty tree,
change ID = 0b0c0d0e0f101112131415161718191a,
author = committer = Alice <alice@example.com> at 1700000000 +0000,
message initial commit, renames_state = 1, no renames, no extra headers.
body = 0100
01fd6e74c2454903e76762c71e9f22f7418e5d36f6149c48eeee734ec2e3dc41
0b0c0d0e0f101112131415161718191a
05416c696365 11616c696365406578616d706c652e636f6d 00f153650000000000 0000
05416c696365 11616c696365406578616d706c652e636f6d 00f153650000000000 0000
0e696e697469616c20636f6d6d6974
01 00 00
id = c6a60eba55e527a7b746aee77e66fc5e8e60ef31c5c407d57eaceaeececebb3c
Full body hex:
010001fd6e74c2454903e76762c71e9f22f7418e5d36f6149c48eeee734ec2e3dc410b0c0d0e0f101112131415161718191a05416c69636511616c696365406578616d706c652e636f6d00f1536500000000000005416c69636511616c696365406578616d706c652e636f6d00f153650000000000000e696e697469616c20636f6d6d6974010000
View
heads = [commit]; bookmark main resolves to [commit]; no tags or
remote refs; working copy default at commit.
body = 01 || commit_id
01 || 046d61696e || 01 || 01 || commit_id || 00
00
00
01 || 0764656661756c74 || commit_id
id = 9ba517b0693bd2016b9662f18fb54ca0ceaadc2ab08c4d87d9c4c9e42e689eed
Full body hex:
01c6a60eba55e527a7b746aee77e66fc5e8e60ef31c5c407d57eaceaeececebb3c01046d61696e0101c6a60eba55e527a7b746aee77e66fc5e8e60ef31c5c407d57eaceaeececebb3c000000010764656661756c74c6a60eba55e527a7b746aee77e66fc5e8e60ef31c5c407d57eaceaeececebb3c
Operation
No parents; view above; start = end = 1700000000000 +0000; hostname host,
username alice, description self-test operation; no tags.
body = 00 || view_id
0068e5cf8b01000000 0000
0068e5cf8b01000000 0000
04686f7374 05616c696365 1273656c6674657374206f7065726174696f6e
00
id = 99a9dea611815d7320e8481495227bf62e8a224ec873f3cd1daca5b4e2ece4f1
Full body hex:
009ba517b0693bd2016b9662f18fb54ca0ceaadc2ab08c4d87d9c4c9e42e689eed0068e5cf8b01000000000068e5cf8b010000000004686f737405616c6963651273656c6674657374206f7065726174696f6e00
Pack and index
A pack containing exactly the empty tree object above, stored uncompressed (compression byte 0), is 85 bytes:
magic 56504b31
version 01000000
count 0100000000000000
record tree_id (32 bytes)
type_byte 03
compression 00
raw_length 01
stored_length 01
body 00
trailer 294c1017488cc29fd32a67b299e998e7d995f5636ef245e1a5bc47be5c1e1042
Full pack hex:
56504b3101000000010000000000000001fd6e74c2454903e76762c71e9f22f7418e5d36f6149c48eeee734ec2e3dc410300010100294c1017488cc29fd32a67b299e998e7d995f5636ef245e1a5bc47be5c1e1042
Its index is 1136 bytes. The index contains the fanout, sorted IDs, the record offset (16), the pack trailer, and the index trailer. Instead of reproducing 1136 bytes here, the published checks are:
| Property | Value |
|---|---|
Length |
|
BLAKE3 of the complete index |
|
Index trailer (last 32 bytes) |
|
Record offset |
|
Verification
vn self-test checks every vector in this document, including the exact pack
bytes and the index checksum, and then runs vn fsck on a repository
constructed from the vectors.