Set up the protocol spec as an mdBook and add a GitHub Actions workflow that builds it on every push/PR and deploys to GitHub Pages on main. The repo is now both a machine-readable corpus and a browsable, searchable site. Structure changes (one-time, mechanical): - Rename the spec source directory from `spec/` to `src/` to match mdBook's default convention. All 21 chapter files move; their internal relative cross-links are unchanged. - Add `src/SUMMARY.md` as the mdBook table of contents, grouping chapters under Wire Format, Payloads, Cryptography & Identity, and Routing & Higher-Layer Protocols. - Add `book.toml` at repo root: title, author, search enabled, fold enabled, edit-on-GitHub links, navy theme. - Add `.github/workflows/mdbook.yml`: build on push + PR, deploy on push to main only (configure-pages + upload-pages-artifact + deploy-pages from actions/). - Add `/book/` to .gitignore. Reference updates so the old path is fully retired: - Every `spec_ref` in `corpus/**/*.json` rewritten from `spec/` to `src/` (54 files). - Schema description text and example path in `corpus/schema/test-vector.schema.json`. - `README.md`: prominent link to the published site near the top; "What's Here" updated for the new layout. - `CONTRIBUTING.md`: spec-editing instructions point at `src/` and note the SUMMARY.md requirement. - `CLAUDE.md`: directory-layout notes updated. CHANGELOG.md historical entries intentionally keep their `spec/` paths since those record what the paths were at the time of those commits. After this lands, the user needs to enable GitHub Pages in repo settings with source = "GitHub Actions" (one-time, manual). The workflow will then publish to https://swaits.github.io/meshcore-spec/ on every push to main. Verified locally: `mdbook build` produces a clean book/ tree with all 21 chapters rendered and the SUMMARY-driven sidebar populated. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
58 lines
2.8 KiB
JSON
58 lines
2.8 KiB
JSON
{
|
|
"$schema": "../../schema/test-vector.schema.json",
|
|
"name": "Invalid - Bad Path Length Encoding",
|
|
"spec_ref": "src/03-path.md",
|
|
"protocol_version": 0,
|
|
"description": "Tests invalid path_len values including the reserved hash_size=4 and path overflow conditions.",
|
|
"vectors": [
|
|
{
|
|
"id": "bpl-001",
|
|
"description": "Reserved hash size code 3 (hash_size would be 4): path_len=0xC0",
|
|
"type": "invalid",
|
|
"binary": "0D C0 01000000",
|
|
"expected_error": "reserved_hash_size",
|
|
"notes": "path_len=0xC0: bits 6-7=11 (hash size code 3). isValidPathLen returns false because hash_size==4."
|
|
},
|
|
{
|
|
"id": "bpl-002",
|
|
"description": "Reserved hash size code 3 with non-zero count: path_len=0xC1",
|
|
"type": "invalid",
|
|
"binary": "0D C1 AA 01000000",
|
|
"expected_error": "reserved_hash_size",
|
|
"notes": "path_len=0xC1: hash size code 3 (reserved), count=1. Invalid regardless of count."
|
|
},
|
|
{
|
|
"id": "bpl-003",
|
|
"description": "Reserved hash size code 3, max count: path_len=0xFF",
|
|
"type": "invalid",
|
|
"binary": "0D FF 0102030405060708090A0B0C0D0E0F101112131415161718191A1B1C1D1E1F202122232425262728292A2B2C2D2E2F303132333435363738393A3B3C3D3E3F 01000000",
|
|
"expected_error": "reserved_hash_size",
|
|
"notes": "path_len=0xFF: hash size code 3 (reserved), count=63. Even if hash_size=4 were valid, 63*4=252 > MAX_PATH_SIZE."
|
|
},
|
|
{
|
|
"id": "bpl-004",
|
|
"description": "Path overflow: hash_size=2, count=33 (66 bytes > MAX_PATH_SIZE)",
|
|
"type": "invalid",
|
|
"binary": "0D 61 000102030405060708090A0B0C0D0E0F101112131415161718191A1B1C1D1E1F202122232425262728292A2B2C2D2E2F30313233343536373839 3A3B3C3D3E3F4041 01000000",
|
|
"expected_error": "path_overflow",
|
|
"notes": "path_len=0x61: hash_size=2, count=33. 33*2=66 > MAX_PATH_SIZE (64). isValidPathLen returns false."
|
|
},
|
|
{
|
|
"id": "bpl-005",
|
|
"description": "Path overflow: hash_size=3, count=22 (66 bytes > MAX_PATH_SIZE)",
|
|
"type": "invalid",
|
|
"binary": "0D 96 000102030405060708090A0B0C0D0E0F101112131415161718191A1B1C1D1E1F202122232425262728292A2B2C2D2E2F303132333435363738393A3B3C3D3E3F4041 01000000",
|
|
"expected_error": "path_overflow",
|
|
"notes": "path_len=0x96: hash_size=3, count=22. 22*3=66 > MAX_PATH_SIZE (64)."
|
|
},
|
|
{
|
|
"id": "bpl-006",
|
|
"description": "Path overflow edge case: hash_size=1, count=63 is valid (63<=64), but with hash_size=2 and count=33 it overflows",
|
|
"type": "invalid",
|
|
"binary": "0D 61 0102030405060708090A0B0C0D0E0F101112131415161718191A1B1C1D1E1F202122232425262728292A2B2C2D2E2F3031323334353637383940 4142 DEADBEEF",
|
|
"expected_error": "path_overflow",
|
|
"notes": "path_len=0x61: size code 1 (hash_size=2), count 33. 33*2=66 > 64."
|
|
}
|
|
]
|
|
}
|