Commit f07f214
feat(groove/ipv6t): GRV6 frame implementation + 10 passing tests on [::1]
reference/ipv6t/ — complete IPv6T implementation:
src/grv6.zig (~350 lines):
- FrameHeader: 108-byte packed struct, zero-copy readable via @ptrCast
- FrameWriter: constructs GRV6 frames with type hash, cap hash,
provenance chain. Maintains chain state across frames.
- FrameReader: detects GRV6 magic, parses header, validates type hash
against expected types, returns untyped for non-GRV6 traffic
- computeTypeHash/computeCapHash: SHA-256 of A2ML type signatures
- computeProvHash: SHA-256 chain linking type+cap+timestamp+payload+prev
- Trust level derivation from flags (declared/attested/proven)
- hashToHex utility for logging
test/grv6_test.zig — 10 tests, all passing:
1. Positive: correct type hash accepted (dual-panel on [::1])
2. Negative: wrong type hash rejected before payload parsing
3. Provenance: 3 chained frames produce verifiable unique hashes
4. Fallback: raw bytes without GRV6 magic treated as untyped
5. Trust flag: PROVEN flag does not bypass type hash validation
6. Header size is exactly 108 bytes
7. Hash determinism: same input always produces same hash
8. Multiple type acceptance: reader accepts any of N expected types
9. Trust level correctly derived from flags
10. Hash hex formatting is correct
Tests run two panel instances on [::1] (IPv6 loopback), exchanging
GRV6 frames over standard TCP. The bytes are identical to what would
traverse the internet — localhost TCP = WAN TCP from the application's
perspective.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>1 parent 05cbdb4 commit f07f214
3 files changed
Lines changed: 861 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
0 commit comments