Context
PR #73 added std.testing.fuzz targets for the hand-rolled NIP-13 PoW scanners in handler.zig (getCommittedDifficulty, extractNonceTarget, validateMessageStructure). They are written and smoke-run under zig build test, but zig build test --fuzz cannot run them.
Problem
Zig 0.16.0's bundled test runner fails to compile in fuzz mode:
compiler/test_runner.zig:566:55: error: pointer type child 'builtin.StackTrace'
cannot cast into pointer type child 'debug.StackTrace'
The fuzz error path passes @errorReturnTrace() (*builtin.StackTrace) to std.debug.writeStackTrace, which expects *const debug.StackTrace. This code is only analyzed under -ffuzz, so normal zig build test is unaffected. Reproduces on a trivial standalone project, so it is a toolchain bug, not wisp's.
Interim mitigation (already in PR #73)
A deterministic 100k-iteration randomized stress test exercises the scanners under normal zig build test, relying on Debug safety checks to catch OOB/overflow.
Action when unblocked
Once the Zig toolchain ships a fix (or we bump to a release that has it):
- Verify
zig build test --fuzz discovers and runs the existing fuzz targets.
- Optionally add a short fuzz step/CI job and seed a corpus.
Context
PR #73 added
std.testing.fuzztargets for the hand-rolled NIP-13 PoW scanners inhandler.zig(getCommittedDifficulty,extractNonceTarget,validateMessageStructure). They are written and smoke-run underzig build test, butzig build test --fuzzcannot run them.Problem
Zig 0.16.0's bundled test runner fails to compile in fuzz mode:
The fuzz error path passes
@errorReturnTrace()(*builtin.StackTrace) tostd.debug.writeStackTrace, which expects*const debug.StackTrace. This code is only analyzed under-ffuzz, so normalzig build testis unaffected. Reproduces on a trivial standalone project, so it is a toolchain bug, not wisp's.Interim mitigation (already in PR #73)
A deterministic 100k-iteration randomized stress test exercises the scanners under normal
zig build test, relying on Debug safety checks to catch OOB/overflow.Action when unblocked
Once the Zig toolchain ships a fix (or we bump to a release that has it):
zig build test --fuzzdiscovers and runs the existing fuzz targets.