object_id = BLAKE3("veins/1" 0x00 || type_byte || body)
type_byte: chunk=1 blob=2 tree=3 commit=4 conflict=5 operation=6 view=7
navid/veins / 79b5392b34ecf157dedfbdfc312f4dd064a9057ce2be7ccab52b174b71ead064 / docs/test-vectors/M0.adoc
M0.adoc
← docs/test-vectors · 7619 bytes · raw · download · view source
veins 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:
937fe1a8d674aa28cb9fa074a76ea84cdc1d6c61e209f47bbdebbe4361b698cf
FastCDC gear table
docs/test-vectors/fastcdc_gear.txt contains the 256 frozen u64 entries.
Each entry is derived reproducibly:
gear[i] = u64le( BLAKE3("veins/fastcdc/gear/v1" || u8(i))[0..8] )
i = 0..255
For convenience, the BLAKE3 of the concatenated 2048-byte little-endian gear table is:
e9688c81fa99f8a16eeda8ee984c2ba9c1cd2951d11559048b8959b2c85e9495
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 -> 7d134a69fee08c8ce7d1d9345bcce91013203f944b444b70e3a5bb8450105a88
ours = "ours" -> 00046f757273 -> 065f24446352ad751d7cd19c4716a416650eeebf045693f5fd8fb719a55b636c
theirs = "theirs" -> 0006746865697273 -> 070fdf8c316002e69cc696514c4c60f7df366f79cf36aafc8e905e6ae2dbd4f8
Conflict
Two file adds (ours, theirs) and one file remove (base):
body = 02
01 || ours_id
01 || theirs_id
01
01 || base_id
id = 02b5ddd6d982a32aa19d1c1b11d09165b44667b0c33acd993c44457dedcabd06
Full body hex:
0201065f24446352ad751d7cd19c4716a416650eeebf045693f5fd8fb719a55b636c01070fdf8c316002e69cc696514c4c60f7df366f79cf36aafc8e905e6ae2dbd4f801017d134a69fee08c8ce7d1d9345bcce91013203f944b444b70e3a5bb8450105a88
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
8be3caa39b307b2b4a46533174cc7faa49c0ff34317302d188276c9641be35fb
0b0c0d0e0f101112131415161718191a
05416c696365 11616c696365406578616d706c652e636f6d 00f153650000000000 0000
05416c696365 11616c696365406578616d706c652e636f6d 00f153650000000000 0000
0e696e697469616c20636f6d6d6974
01 00 00
id = 7f648b3621402df01985d121888c89c37107274fb8bb54661f12deca6cc72299
Full body hex:
01008be3caa39b307b2b4a46533174cc7faa49c0ff34317302d188276c9641be35fb0b0c0d0e0f101112131415161718191a05416c69636511616c696365406578616d706c652e636f6d00f1536500000000000005416c69636511616c696365406578616d706c652e636f6d00f153650000000000000e696e697469616c20636f6d6d6974010000
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 = a2e19569bb3b5c28775bc8503c45c4edce6d51f55303e39bc02eec529324cd11
Full body hex:
017f648b3621402df01985d121888c89c37107274fb8bb54661f12deca6cc7229901046d61696e01017f648b3621402df01985d121888c89c37107274fb8bb54661f12deca6cc72299000000010764656661756c747f648b3621402df01985d121888c89c37107274fb8bb54661f12deca6cc72299
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 = 0a5494529353fb5886870a128139e07d95f40afcd831afc423617808f31dc426
Full body hex:
00a2e19569bb3b5c28775bc8503c45c4edce6d51f55303e39bc02eec529324cd110068e5cf8b01000000000068e5cf8b010000000004686f737405616c6963651273656c6674657374206f7065726174696f6e00
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 72c385a83448a5e16853735a79a212f0377d0e40be777d121271758525dbc911
Full pack hex:
56504b310100000001000000000000008be3caa39b307b2b4a46533174cc7faa49c0ff34317302d188276c9641be35fb030001010072c385a83448a5e16853735a79a212f0377d0e40be777d121271758525dbc911
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.