Skip to content

test(p2p): add direct control fuzz harnesses - #74

Merged
trvon merged 1 commit into
fix/p2p-apply-serializationfrom
fix/p2p-operator-validation
Aug 30, 2026
Merged

test(p2p): add direct control fuzz harnesses#74
trvon merged 1 commit into
fix/p2p-apply-serializationfrom
fix/p2p-operator-validation

Conversation

@trvon

@trvon trvon commented Aug 29, 2026

Copy link
Copy Markdown
Owner

Summary

Final blocked draft child in the #68 stack, based on #73. This change closes the disclosed operator-wording and protocol-fuzz registration blockers without marking the umbrella ready, merging, or deploying.

  • clarifies that peer/cycle status is local health telemetry, not proof of global corpus convergence
  • documents exact protocol-v4 full-mesh verification and the remaining decision-grade live-performance gate
  • adds fuzz seams that invoke the production handshake/state/history and delta/bootstrap control parsers
  • retains a protocol-v3 seed to verify exact-version fail-closed rejection after the v4 upgrade
  • bounds noninteractive AFL++ campaigns with AFL_FUZZ_SECONDS
  • registers focused parser-smoke tests without duplicating them in the broad protocol/delta registrations
  • tightens production delta-record, acknowledgement, bootstrap manifest, and bootstrap acknowledgement parser bounds through shared parser seams

AI disclosure

Extensive AI assistance was used for implementation, test generation, and adversarial review. All changes were locally inspected and validated; remaining gates are disclosed above.

Stack

Do not merge or deploy this child independently.

Add libFuzzer/AFL++ harnesses for the direct-P2P handshake/state/history and
delta/bootstrap control parsers. Fuzzers invoke the same production parser
seams as the live wire path, so coverage cannot drift from real validation. A
protocol-v3 seed exercises exact-version rejection after the v4 upgrade. Bound
noninteractive AFL++ campaigns with AFL_FUZZ_SECONDS and register focused
fuzz-smoke tests without duplicating broad protocol/delta registrations.
Clarify that peer/cycle status is local health telemetry rather than global
convergence, and document the remaining decision-grade live-performance gate.

Signed-off-by: trvon <git@trevon.dev>
@trvon
trvon marked this pull request as ready for review August 30, 2026 15:48
Copilot AI lite review requested due to automatic review settings August 30, 2026 15:48

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

There is at least one concrete build-hygiene issue (missing explicit standard header include) that should be fixed to avoid reliance on transitive includes.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

Adds direct P2P protocol-v4 control-message fuzzing entry points and shared parser seams, plus small test/documentation updates, to strengthen bounded parsing guarantees and make fuzzing a first-class regression gate in the P2P stack.

Changes:

  • Add AFL++ fuzz targets + seed corpus generation for P2P handshake/control and delta/bootstrap control parsers.
  • Introduce shared internal parser-validation seams (p2p_fuzz.h) and reuse them in focused Catch2 “fuzz-smoke” tests.
  • Refactor JSON frame parsing into a reusable helper and tighten several delta/bootstrap control-field bounds.
File summaries
File Description
tools/fuzzing/meson.build Registers new fuzz executables for P2P protocol and delta control parsing.
tools/fuzzing/generate_corpus.sh Adds deterministic seed corpora for the new P2P fuzz targets (including a protocol-v3 legacy hello).
tools/fuzzing/fuzz.sh Improves fuzz runner UX (duration bounding via AFL_FUZZ_SECONDS, TTY detection) and updates examples.
tools/fuzzing/fuzz_p2p_protocol.cpp New fuzzer harness invoking production handshake/state/history control validation seam.
tools/fuzzing/fuzz_p2p_delta.cpp New fuzzer harness invoking bounded delta/bootstrap control validation seam.
tests/unit/daemon/p2p_protocol_catch2_test.cpp Adds a focused smoke test that exercises the handshake fuzz seam and bounds/version rejection.
tests/unit/daemon/p2p_delta_catch2_test.cpp Adds a focused smoke test that exercises the delta fuzz seam and key bounds.
tests/meson.build Excludes [fuzz] tests from broad P2P suites and registers dedicated fuzz-smoke tests.
src/daemon/p2p/p2p_protocol.cpp Adds handshake control validation seam used by fuzzing and tests.
src/daemon/p2p/p2p_json.h Extracts parseJsonFrame() helper for reuse by seams/tests/fuzzers.
src/daemon/p2p/p2p_fuzz.h Introduces shared internal validation seam declarations for fuzz/test harnesses.
src/daemon/p2p/p2p_delta.cpp Extracts/tightens delta/bootstrap control parsing/validation and adds delta control validation seam.
docs/p2p.md Documents local-telemetry semantics and how to run the new fuzz targets with bounded campaigns.
Review details
  • Files reviewed: 13/13 changed files
  • Comments generated: 1
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines 13 to 15
#include <limits>
#include <string_view>
#include <utility>
@trvon
trvon merged commit 9c19452 into experimental Aug 30, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants