Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Vendored protocol test vectors are byte-exact artifacts, sha256-pinned by
# tests/wire_format_vectors.rs — never let git rewrite their line endings
# (windows runners set core.autocrlf=true and would break the pin).
tests/vectors/* -text
3 changes: 3 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,9 @@ proptest = "1.4"
serde_json = "1.0"
blake2 = "0.10"
hex = "0.4"
# Unconditional for tests: the optional sha2 above only exists under `encryption`,
# but the wire-format vector fixture pin must verify under every feature set.
sha2 = "0.10"
aes-gcm = { version = "0.10", features = ["zeroize"] }
criterion = { version = "0.5", features = ["html_reports"] }

Expand Down
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,17 @@ cd fuzz && cargo fuzz run byte_storage_corrupted_envelope

See [`fuzz/README.md`](fuzz/README.md) for comprehensive fuzzing documentation.

### Protocol wire-format vectors

`tests/wire_format_vectors.rs` byte-verifies this crate against the canonical
ByteStorage envelope vectors from
[`cachekit-io/protocol`](https://github.com/cachekit-io/protocol)
(`test-vectors/wire-format.json`): every vector must decode to the exact
payload bytes and re-encode to the exact envelope bytes. The fixture is
vendored at `tests/vectors/wire-format.json` and integrity-pinned by sha256 —
to update it, re-copy from the protocol repo and change the pinned hash in the
same commit.

---

## Minimum Supported Rust Version
Expand Down
9 changes: 0 additions & 9 deletions tests/compatibility/test_vector.json

This file was deleted.

164 changes: 0 additions & 164 deletions tests/compatibility_test.rs

This file was deleted.

68 changes: 68 additions & 0 deletions tests/vectors/wire-format.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
{
"checksum": "xxHash3-64, 8 bytes big-endian, computed on uncompressed input",
"compression": "LZ4 block format (NOT frame)",
"envelope_format": "MessagePack positional array (rmp_serde::to_vec): [compressed_data, checksum, original_size, format]; byte fields encode as msgpack arrays of integers, not bin",
"generator": "cachekit-core v0.2.0",
"limits": {
"max_compressed_size": 536870912,
"max_compression_ratio": 1000,
"max_uncompressed_size": 536870912
},
"vectors": [
{
"description": "Zero-length payload",
"envelope_hex": "949100982d06cc800538ccd3cc94ccc200a76d73677061636b",
"envelope_size": 25,
"format": "msgpack",
"input_hex": "",
"input_size": 0,
"name": "empty"
},
{
"description": "Short ASCII text",
"envelope_hex": "94dc0012ccf00168656c6c6f2c2063616368656b697421986dcc8a34ccb63a3c52ccd310a76d73677061636b",
"envelope_size": 44,
"format": "msgpack",
"input_hex": "68656c6c6f2c2063616368656b697421",
"input_size": 16,
"name": "simple_string"
},
{
"description": "64 bytes derived from pi (deterministic, low compressibility)",
"envelope_hex": "94dc0042ccf031243f6acc88cc85cca308ccd31319cc8a2e03707344cca409382229cc9f31ccd0082eccfacc98ccec4e6ccc89452821cce638ccd01377ccbe5466cccf34cce90c6cccc0ccac29ccb7ccc97c50ccdd3fcc84ccd5ccb5ccb5470917982d016e0411ccedcc9e3440a76d73677061636b",
"envelope_size": 117,
"format": "msgpack",
"input_hex": "243f6a8885a308d313198a2e03707344a4093822299f31d0082efa98ec4e6c89452821e638d01377be5466cf34e90c6cc0ac29b7c97c50dd3f84d5b5b5470917",
"input_size": 64,
"name": "binary_data"
},
{
"description": "1024 bytes of repeated 'A' (high compression ratio)",
"envelope_hex": "949f1f410100ccffccffccffcce960414141414141984d35ccad08cce9ccd77c0dcd0400a76d73677061636b",
"envelope_size": 44,
"format": "msgpack",
"input_hex": "41414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141",
"input_size": 1024,
"name": "large_compressible"
},
{
"description": "JSON-like payload (common real-world pattern)",
"envelope_hex": "94dc004cccf03b7b22757365725f6964223a31323334352c226e616d65223a22416c696365222c22656d61696c223a22616c696365406578616d706c652e636f6d222c22616374697665223a747275657d98cc87673661cc9c4bcca8204aa76d73677061636b",
"envelope_size": 102,
"format": "msgpack",
"input_hex": "7b22757365725f6964223a31323334352c226e616d65223a22416c696365222c22656d61696c223a22616c696365406578616d706c652e636f6d222c22616374697665223a747275657d",
"input_size": 74,
"name": "json_like"
},
{
"description": "Single byte 0xFF (minimum non-empty payload)",
"envelope_hex": "949210ccff98ccd6ccbcccec3c6b29ccd72e01a76d73677061636b",
"envelope_size": 27,
"format": "msgpack",
"input_hex": "ff",
"input_size": 1,
"name": "single_byte"
}
],
"version": "1.0.0"
}
Loading
Loading