Kernel flows

A message moving, in four scenarios. Every arrow was recorded from a real Node call — the frames, the byte counts and the decisions are what the kernel did when this page was generated, not a description of what it should do.

That distinction has already earned itself here. The forwarding table in reference/versioned_vectors.json was prose until it was observed, and the prose had hops counting the wrong way and claimed a failed signature stops a relay. Both errors survived review and died on first contact with the code.

These are small and exact — three or four nodes, every frame accounted for. For behaviour at scale, under loss and with adversaries, see Simulations; for the crypto and concurrency state machines, State machines.

A public message floods

The ordinary path, and the one every other scenario is a variation of. Worth drawing because the interesting part is not that it arrives — it is that it stops.

sequenceDiagram
  participant Ana
  participant Ben
  participant Cai
  Note over Ana: publish to "news"
  Ana->>Ben: DATA hops=16 FLOOD signed (128 B)
  Ana->>Cai: DATA hops=16 FLOOD signed (128 B)
  Note over Ben: delivered to the app
  Ben->>Cai: DATA hops=15 FLOOD signed (128 B)
  Note over Cai: delivered to the app
  Cai->>Ben: DATA hops=15 FLOOD signed (128 B)
  Note over Cai: already seen — dropped
  Note over Ben: already seen — dropped

The same message, arriving twice

Dedup is by envelope id with hops zeroed, so two copies that travelled different distances are still one message. Without the zeroing, every hop count would be a different id and a flood would never terminate.

sequenceDiagram
  participant Ana
  participant Ben
  Ana->>Ben: DATA hops=16 FLOOD signed (119 B)
  Note over Ben: delivered x1, forwards x1
  Ana->>Ben: DATA hops=16 FLOOD signed (119 B) (again)
  Note over Ben: delivered x0, forwards x0

Custody: mail for a node that is not on the network

The scenario that makes this a store-and-forward protocol rather than a router. Ben cannot read this message and is not its destination, and he carries it anyway.

sequenceDiagram
  participant Ana
  participant Ben
  participant Cai
  Note over Ana: heard Cai's ANNOUNCE earlier — holds her prekey
  Note over Ana: send_direct to Cai, sealed to her prekey
  Ana->>Ben: DATA hops=16 signed sealed (179 B)
  Note over Ben: kept for later — nowhere onward to send it
  Note over Ben: tick — the offer cadence comes round
  Ben->>Cai: INV hops=16 (34 B)
  Cai->>Ben: WANT hops=16 (34 B)
  Ben->>Cai: DATA hops=16 signed sealed (179 B)
  Note over Cai: delivered — an hour after it was sent

What the kernel refuses, and what it carries anyway

The decisions that are easiest to get backwards. Two of these were wrong in my own prose before they were observed.

sequenceDiagram
  participant Ana
  participant Ben
  Ana->>Ben: DATA hops=0 FLOOD (28 B)
  Note over Ben: hops=0 — delivered x1, forwarded x0
  Ana->>Ben: DATA hops=4 FLOOD (33 B) created_at +1 day
  Note over Ben: post-dated — delivered x0, forwarded x0
  Ana->>Ben: DATA hops=4 FLOOD signed (136 B) altered after signing
  Note over Ben: bad signature — delivered x1, forwarded x1