Skip to content

Commit f07f214

Browse files
hyperpolymathclaude
andcommitted
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

File tree

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
// SPDX-License-Identifier: PMPL-1.0-or-later
2+
// Copyright (c) 2026 Jonathan D.A. Jewell (hyperpolymath)
3+
4+
const std = @import("std");
5+
6+
pub fn build(b: *std.Build) void {
7+
const target = b.standardTargetOptions(.{});
8+
const optimize = b.standardOptimizeOption(.{});
9+
10+
// Create root module for the library
11+
const lib_mod = b.createModule(.{
12+
.root_source_file = b.path("src/grv6.zig"),
13+
.target = target,
14+
.optimize = optimize,
15+
});
16+
17+
// Library
18+
const lib = b.addLibrary(.{
19+
.name = "grv6",
20+
.root_module = lib_mod,
21+
});
22+
b.installArtifact(lib);
23+
24+
// Create test module with grv6 as import
25+
const test_mod = b.createModule(.{
26+
.root_source_file = b.path("test/grv6_test.zig"),
27+
.target = target,
28+
.optimize = optimize,
29+
.imports = &.{
30+
.{ .name = "grv6", .module = lib_mod },
31+
},
32+
});
33+
34+
// Tests
35+
const tests = b.addTest(.{
36+
.root_module = test_mod,
37+
});
38+
const run_tests = b.addRunArtifact(tests);
39+
const test_step = b.step("test", "Run GRV6 frame tests");
40+
test_step.dependOn(&run_tests.step);
41+
}

0 commit comments

Comments
 (0)