In progress
Verifying the Cardano Connection Manager
A source-derived formal model of the Cardano network's connection management, used to confirm design guarantees, report issues and suggest fixes.
Problem
The connection manager in ouroboros-network shares connections between inbound and outbound use and coordinates handshakes, handler threads and shutdown. Races in this concurrent code are difficult to find by testing alone, and a connection-state diagram hides many of the interleavings that matter.
Approach
The work models the connection manager, the inbound and outbound governors, server admission, and selected handler, multiplexer and protocol lifecycles, derived from fixed source revisions. It separates logical connection state from physical thread completion, and treats map updates, STM commits, cancellation and cleanup as distinct events.
The evidence comes in kinds that complement each other:
- source mapping of operations and exception boundaries at pinned revisions;
- model proofs, which hold for every execution the model admits;
- concrete executable lifecycles and counterexamples;
- bounded exploration with checked shrinking of violating traces;
- replays of selected scenarios against the pinned Haskell implementation.
Results so far
- Design guarantees confirmed in the model: exclusive ownership of the connection map, map and key uniqueness, validity of handler references, and a conditional shutdown certificate.
- Issues found and reported: retained reservations, incomplete release over the connection limit and unpublished handshake results, re-tested at a pinned source revision; deadlock witnesses and a hidden polling loop in the modelled lifecycle; and a handler that can outlive connection-manager shutdown, observed in a replay against the Haskell code.
- Fixes suggested: a shutdown design with server-owned admission workers and a historical handler registry swept at shutdown, explored in a prototype.
The guarantees hold for the model under its stated premises and scope. There is no full refinement theorem from the model to the Haskell code and no universal progress result, as the project summary records.