Skip to content

Conversation

@qj0r9j0vc2
Copy link
Member

Summary

  • Fixed critical bug in TcpPrimaryNetwork::connect_to_peer() where the reader half of outgoing TCP connections was immediately dropped
  • Previously: let (_, writer) = tokio::io::split(stream); - reader assigned to _ and dropped
  • Now: spawns a reader task to handle incoming messages (e.g., attestations) on outgoing connections

Root Cause

When Primary A connects to Primary B and sends a Car:

  1. A initiates connection to B (outgoing from A's perspective)
  2. A sends Car via the writer half
  3. B receives Car on its incoming connection handler
  4. B generates attestation and sends it back
  5. BUG: A's reader was dropped, so A never receives the attestation
  6. A times out waiting for attestation: "Car attestation failed after max retries"

Test plan

  • cargo build -p cipherd passes
  • cargo test -p cipherd passes (85 tests)
  • cargo fmt -- --check passes
  • cargo clippy -p cipherd -- -D warnings passes
  • Deploy to testnet and verify attestations are received

Previously, when connecting to peer Primaries, the reader half
of the TCP stream was immediately dropped. This caused a critical
bug where attestations sent back on the connection could never
be received, leading to "Car attestation failed after max retries".
@qj0r9j0vc2 qj0r9j0vc2 force-pushed the fix/primary-outgoing-connection-reader branch from fcf4ffc to 61fbc66 Compare January 20, 2026 05:57
@qj0r9j0vc2 qj0r9j0vc2 merged commit f92d630 into main Jan 20, 2026
9 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