test(iroh): verify custom relay round trips

Merged
AZ
3mo ago
+293-0

Adds opt-in live gates that:

  • bind two production FFI endpoints in relay-only mode
  • prove exact custom relay-map selection
  • exchange request and response bytes over one bidirectional stream
  • assert both selected paths are the configured relay
  • support unauthenticated, shared static-token, and endpoint-bound per-device token providers
  • close disposable endpoints on timeout so external failures are bounded

Verification:

  • 46 focused Iroh transport tests pass
  • 10 macOS Iroh settings tests pass
  • 8 iOS Simulator Iroh settings tests pass on isolated iPhone 16 Pro / iOS 18.4
  • user-provided EU relay selection passes
  • full unauthenticated round trip times out, confirming that relay requires provider credentials despite advertising the route

To run authenticated endpoint-bound coverage, provide CMUX_IROH_CUSTOM_RELAY_BOUND_URL, CMUX_IROH_CUSTOM_RELAY_FIRST_SECRET_KEY_HEX, CMUX_IROH_CUSTOM_RELAY_FIRST_TOKEN, CMUX_IROH_CUSTOM_RELAY_SECOND_SECRET_KEY_HEX, and CMUX_IROH_CUSTOM_RELAY_SECOND_TOKEN, plus CMUX_IROH_CUSTOM_RELAY_LIVE=1.


View with Codesmith Autofix with Codesmith
Need help on this PR? Tag /codesmith with what you need. Autofix is disabled.


Summary by cubic

Adds opt-in live tests that verify custom relay round trips in CmuxIrohTransport. Tests assert exact relay selection and a bidirectional request/response over one stream across unauthenticated, static-token, and endpoint-bound modes.

  • New Features

    • Relay-only live tests binding two endpoints via the configured custom relay.
    • Verify path hints and observed path match the exact relay URL.
    • Bidirectional stream round trip with request/response byte checks.
    • Deterministic timeouts with endpoint cleanup; strict hex parsing for endpoint-bound secret keys.
  • Migration

    • Enable: CMUX_IROH_CUSTOM_RELAY_LIVE=1 (optional CMUX_IROH_CUSTOM_RELAY_TIMEOUT, default 10s).
    • Static mode: CMUX_IROH_CUSTOM_RELAY_STATIC_URL, CMUX_IROH_CUSTOM_RELAY_STATIC_TOKEN.
    • Unauthenticated mode: CMUX_IROH_CUSTOM_RELAY_NO_TOKEN_URL.
    • Endpoint-bound mode: CMUX_IROH_CUSTOM_RELAY_BOUND_URL, CMUX_IROH_CUSTOM_RELAY_FIRST_SECRET_KEY_HEX, CMUX_IROH_CUSTOM_RELAY_FIRST_TOKEN, CMUX_IROH_CUSTOM_RELAY_SECOND_SECRET_KEY_HEX, CMUX_IROH_CUSTOM_RELAY_SECOND_TOKEN.