@serfab/cadre-core 1.5.0 → 1.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -44,7 +44,7 @@ export { validatePushCredentials, redactPushCredentials, REDACTED } from './push
44
44
  export { PushFanoutService, DEFAULT_PUSH_COOLDOWN_MS, DEFAULT_PUSH_DEBOUNCE_MS, type PushFanoutOptions, type FanoutMember } from './push-fanout.js';
45
45
  export { selectControlCohortDials, DEFAULT_CONTROL_COHORT_RECONCILE_MS, DEFAULT_CONTROL_COHORT_TARGET_DEGREE, type ControlCohortSelection, type ControlCohortReconcileResult } from './control-cohort.js';
46
46
  export { dialPeerAddrs, tryAddrsInTurn, directBeforeRelayed, DEFAULT_CONTROL_COHORT_DIAL_TIMEOUT_MS, DEFAULT_CONTROL_COHORT_PER_ADDRESS_DIAL_TIMEOUT_MS, CONTROL_COHORT_DIAL_ADDRESS_ATTEMPTS, DEFAULT_PEER_DIAL_BUDGET, type PeerDialBudget, type AddrDialer } from './peer-dial.js';
47
- export { DECLARED_LINK_ROUND_TRIP_MS, RELAYED_DIAL_ROUND_TRIPS, RELAY_RESERVATION_ROUND_TRIPS, CIRCUIT_REQUEST_ROUND_TRIPS, PUSH_TRANSFER_ALLOWANCE_MS, resolveLinkRoundTripMs, relayedDialBudgetMs, relayReservationBudgetMs, circuitRequestBudgetMs, peerJoinPushBudget, type PeerJoinPushBudget } from './link-budget.js';
47
+ export { DECLARED_LINK_ROUND_TRIP_MS, RELAYED_DIAL_ROUND_TRIPS, RELAY_RESERVATION_ROUND_TRIPS, CIRCUIT_REQUEST_ROUND_TRIPS, PUSH_TRANSFER_ALLOWANCE_MS, resolveLinkRoundTripMs, relayedDialBudgetMs, connectionManagerTimeouts, relayReservationBudgetMs, circuitRequestBudgetMs, peerJoinPushBudget, type PeerJoinPushBudget } from './link-budget.js';
48
48
  export { anchoredTrustPolicy, pinnedKeyTrustPolicy, tofuTrustPolicy, type SeedTrustPolicy, type SeedTrustContext, type SeedTrustDecision } from './seed-trust-policy.js';
49
49
  export { signSchema, verifySchema, assertSchemaSignature, SchemaVerificationError } from './schema-verification.js';
50
50
  export { FormationListener, dialFormation, isValidResponderCreatesResult, isWellFormedMembershipInvite, sanitizeStrandAddrs, FORMATION_PROTOCOL, type FormationParty, type FormationContactMessage, type FormationResultMessage, type FormationProvisionResult, type FormationStrandInfo, type FormationDbConnectionInfo, type FormationListenerOptions, type FormationDialOptions, type FormationDialResult, type ResponderProvisionOutcome } from './strand-formation-protocol.js';
package/dist/index.js CHANGED
@@ -139,7 +139,7 @@ export { selectControlCohortDials, DEFAULT_CONTROL_COHORT_RECONCILE_MS, DEFAULT_
139
139
  export { dialPeerAddrs, tryAddrsInTurn, directBeforeRelayed, DEFAULT_CONTROL_COHORT_DIAL_TIMEOUT_MS, DEFAULT_CONTROL_COHORT_PER_ADDRESS_DIAL_TIMEOUT_MS, CONTROL_COHORT_DIAL_ADDRESS_ATTEMPTS, DEFAULT_PEER_DIAL_BUDGET } from './peer-dial.js';
140
140
  // Dial and reservation budgets counted in link round trips rather than fixed milliseconds, so
141
141
  // one declared assumption about the link moves them all — see `NetworkConfig.linkRoundTripMs`.
142
- export { DECLARED_LINK_ROUND_TRIP_MS, RELAYED_DIAL_ROUND_TRIPS, RELAY_RESERVATION_ROUND_TRIPS, CIRCUIT_REQUEST_ROUND_TRIPS, PUSH_TRANSFER_ALLOWANCE_MS, resolveLinkRoundTripMs, relayedDialBudgetMs, relayReservationBudgetMs, circuitRequestBudgetMs, peerJoinPushBudget } from './link-budget.js';
142
+ export { DECLARED_LINK_ROUND_TRIP_MS, RELAYED_DIAL_ROUND_TRIPS, RELAY_RESERVATION_ROUND_TRIPS, CIRCUIT_REQUEST_ROUND_TRIPS, PUSH_TRANSFER_ALLOWANCE_MS, resolveLinkRoundTripMs, relayedDialBudgetMs, connectionManagerTimeouts, relayReservationBudgetMs, circuitRequestBudgetMs, peerJoinPushBudget } from './link-budget.js';
143
143
  // Seed trust policy (trust anchor for incoming seeds)
144
144
  export { anchoredTrustPolicy, pinnedKeyTrustPolicy, tofuTrustPolicy } from './seed-trust-policy.js';
145
145
  // Schema Verification
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,aAAa;AACb,cAAc,YAAY,CAAC;AAE3B,+DAA+D;AAC/D,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEpD,uBAAuB;AACvB,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5C,mBAAmB;AACnB,OAAO,EAAE,eAAe,EAAE,sBAAsB,EAAE,yBAAyB,EAAE,qBAAqB,EAAE,uBAAuB,EAAE,eAAe,EAAwO,MAAM,uBAAuB,CAAC;AAElZ,+EAA+E;AAC/E,qFAAqF;AACrF,yCAAyC;AACzC,OAAO,EACL,sBAAsB,EACtB,6BAA6B,EAC7B,oBAAoB,EACpB,wBAAwB,EACxB,8BAA8B,EAC9B,4BAA4B,EAC5B,iBAAiB,EAElB,MAAM,0BAA0B,CAAC;AAElC,gFAAgF;AAChF,yFAAyF;AACzF,OAAO,EACL,qBAAqB,EACrB,4BAA4B,EAC5B,4BAA4B,EAC5B,6BAA6B,EAC7B,gBAAgB,EAEjB,MAAM,yBAAyB,CAAC;AAWjC,2FAA2F;AAC3F,OAAO,EAAE,0BAA0B,EAA0C,MAAM,4BAA4B,CAAC;AAEhH,2DAA2D;AAC3D,OAAO,EAAE,wBAAwB,EAAE,2BAA2B,EAAE,0BAA0B,EAAuB,MAAM,kBAAkB,CAAC;AAE1I,2EAA2E;AAC3E,gFAAgF;AAChF,8EAA8E;AAC9E,+EAA+E;AAC/E,2BAA2B;AAC3B,OAAO,EACL,gBAAgB,EAChB,mBAAmB,EACnB,uBAAuB,EAGxB,MAAM,gBAAgB,CAAC;AAExB,8EAA8E;AAC9E,8EAA8E;AAC9E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MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,eAAe,EAAwB,MAAM,4BAA4B,CAAC;AAEnF,gFAAgF;AAChF,0EAA0E;AAC1E,6BAA6B;AAC7B,OAAO,EACL,iBAAiB,EACjB,yBAAyB,EACzB,gCAAgC,EAChC,6BAA6B,EAC7B,sBAAsB,EACtB,4BAA4B,EAC5B,4BAA4B,EAM7B,MAAM,wBAAwB,CAAC;AAEhC,2EAA2E;AAC3E,OAAO,EACL,iBAAiB,EACjB,sBAAsB,EACtB,wBAAwB,EACxB,0BAA0B,EAC1B,wBAAwB,EAMzB,MAAM,kCAAkC,CAAC"}
@@ -35,62 +35,78 @@
35
35
  *
36
36
  * | operation | link round trips | at the declared default |
37
37
  * | ---------------------------------------------------- | ---------------- | ----------------------- |
38
- * | open a relayed connection to another machine | 4 | 8 000 ms |
39
- * | dial the relay itself | 1 | 2 000 ms |
40
- * | request a reservation on an open relay connection | 1 | 2 000 ms |
41
- * | negotiate a protocol over an established circuit | 1 | 2 000 ms |
42
- *
43
- * **Measured** 2026-09-26, one Windows machine, loopback dedicated relay, re-run for this
44
- * change: a relayed dial took 20-25 ms at no delay, **7 255-7 279 ms at 900 ms one-way**, and
45
- * **12 066-12 094 ms at 1 500 ms one-way**. Four link round trips of pure delay would be 7 200
46
- * and 12 000, so the real cost sits about 60-95 ms ABOVE the arithmetic — the handshakes and a
47
- * phone's pure-JS crypto, which no delay figure contains. That residue is small but it is why
48
- * {@link DECLARED_LINK_ROUND_TRIP_MS} carries headroom over the band sereus supports rather
49
- * than matching it exactly: a declaration equal to the measured round trip would derive a
50
- * budget marginally BELOW the dial it has to contain.
51
- *
52
- * ── The ceiling this does NOT lift ──
53
- *
54
- * Above roughly 1 250 ms one-way — a 2.5-second link round trip — no relayed connection can be
55
- * established by this stack whatever cadre declares here. Two budgets of 10 000 ms each inside
56
- * libp2p bound the same dial and cannot be reached from sereus at all:
57
- * `connectionManager.dialTimeout` (libp2p's own default, which `@optimystic/db-p2p`'s
58
- * `libp2p-node-base.ts` neither sets nor exposes) and `connectionManager.inboundUpgradeTimeout`
59
- * (which it sets to 10 000). Both appear in the same re-run: at 1 500 ms one-way the dial under
60
- * libp2p's default failed with `The operation was aborted due to timeout`, and with the shipped
61
- * inbound-upgrade budget the DIALER's own 12 094 ms dial resolved while the LISTENER had
62
- * already thrown the half-built connection away — so the first stream over it died with
38
+ * | open a relayed connection to another machine | 4 | 14 000 ms |
39
+ * | dial the relay itself | 1 | 3 500 ms |
40
+ * | request a reservation on an open relay connection | 1 | 3 500 ms |
41
+ * | negotiate a protocol over an established circuit | 1 | 3 500 ms |
42
+ *
43
+ * **Measured** 2026-09-26, one Windows machine, loopback dedicated relay: a relayed dial took
44
+ * 20-25 ms at no delay, **7 255-7 279 ms at 900 ms one-way**, and **12 066-12 094 ms at 1 500 ms
45
+ * one-way**. Four link round trips of pure delay would be 7 200 and 12 000, so the real cost
46
+ * sits about 60-95 ms ABOVE the arithmetic — the handshakes, which no delay figure contains.
47
+ * That residue is why {@link DECLARED_LINK_ROUND_TRIP_MS} carries headroom over the link sereus
48
+ * supports rather than matching it exactly: a declaration equal to the supported round trip
49
+ * would derive a budget marginally BELOW the dial it has to contain.
50
+ *
51
+ * ── libp2p's own two limits ──
52
+ *
53
+ * Two limits inside libp2p bound the same relayed dial as cadre's budgets do, and both were
54
+ * 10 000 ms until `@optimystic/db-p2p` 1.7.0 let an embedder set them: the DIALER's
55
+ * `connectionManager.dialTimeout`, which bounds every dial that carries no abort signal of its
56
+ * own, and the LISTENER's `connectionManager.inboundUpgradeTimeout`, which is how long the
57
+ * machine being called lets a half-built connection finish its handshakes. At 10 000 ms each,
58
+ * no relayed connection could be opened above about 1 250 ms one-way (a 2.5-second link round
59
+ * trip) whatever cadre declared. The listener's limit is the one that makes that failure
60
+ * silent: at 1 500 ms one-way the dialer's own 12 094 ms dial RESOLVED while the listener had
61
+ * already thrown the connection away at 10 s, so the first stream over it died with
63
62
  * `Unexpected EOF - stream closed while reading 0/1 bytes` and the listener reported no peer at
64
- * all. That is why a too-slow link produces silence rather than an error.
65
- *
66
- * Two consequences for a reader choosing a declaration. Below that ceiling, the DEFAULT
67
- * declaration of 2 000 ms does not reach it: four round trips of 2 000 ms is 8 000 ms, which
68
- * covers a one-way delay up to 1 000 ms, so a deployment somewhere between 1 000 and 1 250 ms
69
- * one-way has to declare its own (about 2 200-2 500) to use the band libp2p still allows. And
70
- * declaring much ABOVE 2 500 buys nothing: the budgets here grow, and
71
- * the connection still fails inside libp2p. Lifting that needs an upstream change and a
72
- * decision about how slow a link sereus intends to carry —
73
- * `tickets/blocked/how-slow-a-relayed-link-does-sereus-carry`. A reader who raised these
74
- * numbers and still cannot connect at 1 500 ms one-way has met that ceiling, not this module.
63
+ * all. cadre now declares both from this module ({@link connectionManagerTimeouts}) on the
64
+ * control node and every strand node.
65
+ *
66
+ * ── What still fails at the supported link ──
67
+ *
68
+ * - **Optimystic's own request dials.** `@optimystic/db-p2p`'s RPC clients dial with fixed
69
+ * 3 000 ms deadlines of their own (`DEFAULT_DIAL_TIMEOUT_MS`, the `pushDialTimeoutMs`
70
+ * defaults), which neither limit above reaches because a caller's signal replaces
71
+ * `dialTimeout`. So an Optimystic request that has to OPEN a relayed connection fails above
72
+ * 375 ms one-way. A request over a connection that is already open does not dial, and the
73
+ * connections cadre opens itself are budgeted here. Upstream:
74
+ * `debt-rpc-dial-deadlines-cannot-open-a-slow-relayed-connection` in optimystic.
75
+ * - **Cadre deadlines still typed as milliseconds.** The strand wake, strand-address and seed
76
+ * delivery deadlines, and the cohort read deadline, bound exchanges over the same link but do
77
+ * not derive from it: `tickets/backlog/debt-three-more-dial-deadlines-ignore-the-declared-link`.
78
+ * - **A machine that declares a faster link than its peers.** Every machine is the listener
79
+ * for the others, so its `inboundUpgradeTimeout` — derived from ITS declaration — bounds
80
+ * connections other machines open to it. A peer declaring 3 500 ms dialing a machine that
81
+ * declared 500 ms gets exactly the silent failure above. Declare the same link on every
82
+ * machine of a party.
75
83
  */
84
+ import type { Libp2pConnectionTimeouts } from '@optimystic/db-p2p';
76
85
  /**
77
86
  * The link round trip cadre assumes when a host declares none, in milliseconds. A deployment
78
87
  * that knows its own link states it with `NetworkConfig.linkRoundTripMs` instead.
79
88
  *
80
- * **Why 2 000.** It states the slowest link sereus already claims to support, and two other
81
- * budgets fix that claim independently: `COHORT_READ_DEADLINE_MS`
82
- * (`quereus-plugin-sereus/src/cluster-size.ts`, 5 000 ms) and
83
- * `DEFAULT_STRAND_FIRST_SYNC_TIMEOUT_MS` (`strand-first-sync-gate.ts`, 120 000 ms) were both
84
- * sized against two parties reaching each other only through a public relay at a round trip
85
- * near 1.8 s. Declaring 2 000 rounds that band up and leaves about 720 ms over the worst
86
- * relayed dial measured at it (7 279 ms against a derived 8 000 ms).
87
- *
88
- * Raising it is how a deployment that KNOWS its link is slower moves every derived budget at
89
- * once. The cost is the ordinary cost of a longer deadline: a peer that is genuinely gone holds
90
- * the operation for that much longer before it is abandoned and retried. Above about 2 500 it
91
- * buys nothing — see the module doc's ceiling paragraph.
89
+ * **Why 3 500.** Sereus supports two machines that reach each other only through a relay up to
90
+ * a **3-second link round trip** (1 500 ms each way — a congested mobile or satellite link;
91
+ * `docs/architecture.md` → "Relay Integration"). The worst relayed dial measured at that link
92
+ * was 12 094 ms, above the 12 000 ms a declaration of exactly 3 000 would derive, so the
93
+ * declaration rounds the supported link up to the next half second. 3 500 derives 14 000 ms
94
+ * and leaves about 1.9 s over that dial: room for a phone's Noise handshake, which the
95
+ * loopback measurement on a desktop does not contain. (The previous 2 000 followed the same
96
+ * convention for the 1.8 s band sereus supported before, with about 720 ms to spare.)
97
+ *
98
+ * Two budgets outside this module were sized against the 1.8 s band and do NOT move with it:
99
+ * `COHORT_READ_DEADLINE_MS` (`quereus-plugin-sereus/src/cluster-size.ts`, 5 000 ms) and
100
+ * `DEFAULT_STRAND_FIRST_SYNC_TIMEOUT_MS` (`strand-first-sync-gate.ts`). The module doc's
101
+ * "What still fails" list carries the first.
102
+ *
103
+ * What 3 500 costs, against 2 000: a peer that is genuinely gone holds each operation longer
104
+ * before it is abandoned and retried — a relayed dial or a reservation drive 14 s instead of
105
+ * 8 s, and a control-cohort dial of one peer across all its addresses 56 s instead of 32 s.
106
+ * Raise it further for a link slower still; lower it only on a deployment where EVERY machine
107
+ * of the party is that close, for the reason the "What still fails" list gives.
92
108
  */
93
- export declare const DECLARED_LINK_ROUND_TRIP_MS = 2000;
109
+ export declare const DECLARED_LINK_ROUND_TRIP_MS = 3500;
94
110
  /**
95
111
  * Link round trips one relayed connection setup costs: transport, encryption and multiplexer
96
112
  * handshakes to the relay, the circuit open, then both handshakes again end to end through it.
@@ -127,10 +143,10 @@ export declare const CIRCUIT_REQUEST_ROUND_TRIPS = 2;
127
143
  *
128
144
  * NOTE: 6 000 ms is not a measurement of any throughput — it is the residue of the 10 000 ms
129
145
  * this deadline shipped as before it was split into a latency part and a transfer part, chosen
130
- * so that at the default declaration the derived value is the same 10 000 and no fast link got
131
- * slower. Nobody has measured how long 1 MiB takes to cross a relayed mobile link. If pushes
132
- * ever time out with the transfer only part done, measure that and raise THIS, not the declared
133
- * round trip.
146
+ * so that at the declaration then in force (2 000 ms) the derived value stayed 10 000 and no
147
+ * fast link got slower. Nobody has measured how long 1 MiB takes to cross a relayed mobile
148
+ * link. If pushes ever time out with the transfer only part done, measure that and raise THIS,
149
+ * not the declared round trip.
134
150
  */
135
151
  export declare const PUSH_TRANSFER_ALLOWANCE_MS = 6000;
136
152
  /**
@@ -155,6 +171,32 @@ export declare function resolveLinkRoundTripMs(linkRoundTripMs?: number): number
155
171
  * relay: {@link RELAYED_DIAL_ROUND_TRIPS} at the declared link round trip.
156
172
  */
157
173
  export declare function relayedDialBudgetMs(linkRoundTripMs?: number): number;
174
+ /**
175
+ * libp2p's two connection-manager limits for a node at the declared link, handed to
176
+ * `@optimystic/db-p2p`'s `NodeOptions.connectionManager` on the control node and every strand
177
+ * node.
178
+ *
179
+ * Both bound the same thing — opening a relayed connection, measured at 8 one-way link delays,
180
+ * which is {@link RELAYED_DIAL_ROUND_TRIPS} (4) link round trips — so both are
181
+ * {@link relayedDialBudgetMs}: 4 x 3 500 = 14 000 ms at the default declaration, covering the
182
+ * 12 094 ms measured at the supported 3-second link.
183
+ *
184
+ * The listener's limit is deliberately NOT smaller than the dialer's. The listener's clock
185
+ * starts only when the relay hands it the circuit, a few one-way delays after the dialer's
186
+ * started, and both sides finish the handshakes at about the same moment; so with equal limits
187
+ * the listener never discards a connection that the dialer's own dial would still accept. A
188
+ * listener limit below the dialer's is what produced the silent failure in the module doc.
189
+ *
190
+ * The cost of a longer `inboundUpgradeTimeout` is that a peer which opens a connection and then
191
+ * stalls its handshake holds that half-built connection 14 s instead of 10 s.
192
+ *
193
+ * NOTE: derived from the declaration alone, so a per-field override that raises a cadre dial
194
+ * budget above it (`controlCohort.perAddressDialTimeoutMs`, `strandBackfill.dialTimeoutMs`)
195
+ * does not raise these; a dial that outlasts the listener's limit gets the silent failure
196
+ * again. If such overrides start being used for slow links, raise the declaration instead or
197
+ * take the largest configured dial budget here.
198
+ */
199
+ export declare function connectionManagerTimeouts(linkRoundTripMs?: number): Libp2pConnectionTimeouts;
158
200
  /**
159
201
  * Deadline for one whole relay reservation drive: {@link RELAY_RESERVATION_ROUND_TRIPS} at the
160
202
  * declared link round trip.
@@ -35,62 +35,77 @@
35
35
  *
36
36
  * | operation | link round trips | at the declared default |
37
37
  * | ---------------------------------------------------- | ---------------- | ----------------------- |
38
- * | open a relayed connection to another machine | 4 | 8 000 ms |
39
- * | dial the relay itself | 1 | 2 000 ms |
40
- * | request a reservation on an open relay connection | 1 | 2 000 ms |
41
- * | negotiate a protocol over an established circuit | 1 | 2 000 ms |
42
- *
43
- * **Measured** 2026-09-26, one Windows machine, loopback dedicated relay, re-run for this
44
- * change: a relayed dial took 20-25 ms at no delay, **7 255-7 279 ms at 900 ms one-way**, and
45
- * **12 066-12 094 ms at 1 500 ms one-way**. Four link round trips of pure delay would be 7 200
46
- * and 12 000, so the real cost sits about 60-95 ms ABOVE the arithmetic — the handshakes and a
47
- * phone's pure-JS crypto, which no delay figure contains. That residue is small but it is why
48
- * {@link DECLARED_LINK_ROUND_TRIP_MS} carries headroom over the band sereus supports rather
49
- * than matching it exactly: a declaration equal to the measured round trip would derive a
50
- * budget marginally BELOW the dial it has to contain.
51
- *
52
- * ── The ceiling this does NOT lift ──
53
- *
54
- * Above roughly 1 250 ms one-way — a 2.5-second link round trip — no relayed connection can be
55
- * established by this stack whatever cadre declares here. Two budgets of 10 000 ms each inside
56
- * libp2p bound the same dial and cannot be reached from sereus at all:
57
- * `connectionManager.dialTimeout` (libp2p's own default, which `@optimystic/db-p2p`'s
58
- * `libp2p-node-base.ts` neither sets nor exposes) and `connectionManager.inboundUpgradeTimeout`
59
- * (which it sets to 10 000). Both appear in the same re-run: at 1 500 ms one-way the dial under
60
- * libp2p's default failed with `The operation was aborted due to timeout`, and with the shipped
61
- * inbound-upgrade budget the DIALER's own 12 094 ms dial resolved while the LISTENER had
62
- * already thrown the half-built connection away — so the first stream over it died with
38
+ * | open a relayed connection to another machine | 4 | 14 000 ms |
39
+ * | dial the relay itself | 1 | 3 500 ms |
40
+ * | request a reservation on an open relay connection | 1 | 3 500 ms |
41
+ * | negotiate a protocol over an established circuit | 1 | 3 500 ms |
42
+ *
43
+ * **Measured** 2026-09-26, one Windows machine, loopback dedicated relay: a relayed dial took
44
+ * 20-25 ms at no delay, **7 255-7 279 ms at 900 ms one-way**, and **12 066-12 094 ms at 1 500 ms
45
+ * one-way**. Four link round trips of pure delay would be 7 200 and 12 000, so the real cost
46
+ * sits about 60-95 ms ABOVE the arithmetic — the handshakes, which no delay figure contains.
47
+ * That residue is why {@link DECLARED_LINK_ROUND_TRIP_MS} carries headroom over the link sereus
48
+ * supports rather than matching it exactly: a declaration equal to the supported round trip
49
+ * would derive a budget marginally BELOW the dial it has to contain.
50
+ *
51
+ * ── libp2p's own two limits ──
52
+ *
53
+ * Two limits inside libp2p bound the same relayed dial as cadre's budgets do, and both were
54
+ * 10 000 ms until `@optimystic/db-p2p` 1.7.0 let an embedder set them: the DIALER's
55
+ * `connectionManager.dialTimeout`, which bounds every dial that carries no abort signal of its
56
+ * own, and the LISTENER's `connectionManager.inboundUpgradeTimeout`, which is how long the
57
+ * machine being called lets a half-built connection finish its handshakes. At 10 000 ms each,
58
+ * no relayed connection could be opened above about 1 250 ms one-way (a 2.5-second link round
59
+ * trip) whatever cadre declared. The listener's limit is the one that makes that failure
60
+ * silent: at 1 500 ms one-way the dialer's own 12 094 ms dial RESOLVED while the listener had
61
+ * already thrown the connection away at 10 s, so the first stream over it died with
63
62
  * `Unexpected EOF - stream closed while reading 0/1 bytes` and the listener reported no peer at
64
- * all. That is why a too-slow link produces silence rather than an error.
65
- *
66
- * Two consequences for a reader choosing a declaration. Below that ceiling, the DEFAULT
67
- * declaration of 2 000 ms does not reach it: four round trips of 2 000 ms is 8 000 ms, which
68
- * covers a one-way delay up to 1 000 ms, so a deployment somewhere between 1 000 and 1 250 ms
69
- * one-way has to declare its own (about 2 200-2 500) to use the band libp2p still allows. And
70
- * declaring much ABOVE 2 500 buys nothing: the budgets here grow, and
71
- * the connection still fails inside libp2p. Lifting that needs an upstream change and a
72
- * decision about how slow a link sereus intends to carry —
73
- * `tickets/blocked/how-slow-a-relayed-link-does-sereus-carry`. A reader who raised these
74
- * numbers and still cannot connect at 1 500 ms one-way has met that ceiling, not this module.
63
+ * all. cadre now declares both from this module ({@link connectionManagerTimeouts}) on the
64
+ * control node and every strand node.
65
+ *
66
+ * ── What still fails at the supported link ──
67
+ *
68
+ * - **Optimystic's own request dials.** `@optimystic/db-p2p`'s RPC clients dial with fixed
69
+ * 3 000 ms deadlines of their own (`DEFAULT_DIAL_TIMEOUT_MS`, the `pushDialTimeoutMs`
70
+ * defaults), which neither limit above reaches because a caller's signal replaces
71
+ * `dialTimeout`. So an Optimystic request that has to OPEN a relayed connection fails above
72
+ * 375 ms one-way. A request over a connection that is already open does not dial, and the
73
+ * connections cadre opens itself are budgeted here. Upstream:
74
+ * `debt-rpc-dial-deadlines-cannot-open-a-slow-relayed-connection` in optimystic.
75
+ * - **Cadre deadlines still typed as milliseconds.** The strand wake, strand-address and seed
76
+ * delivery deadlines, and the cohort read deadline, bound exchanges over the same link but do
77
+ * not derive from it: `tickets/backlog/debt-three-more-dial-deadlines-ignore-the-declared-link`.
78
+ * - **A machine that declares a faster link than its peers.** Every machine is the listener
79
+ * for the others, so its `inboundUpgradeTimeout` — derived from ITS declaration — bounds
80
+ * connections other machines open to it. A peer declaring 3 500 ms dialing a machine that
81
+ * declared 500 ms gets exactly the silent failure above. Declare the same link on every
82
+ * machine of a party.
75
83
  */
76
84
  /**
77
85
  * The link round trip cadre assumes when a host declares none, in milliseconds. A deployment
78
86
  * that knows its own link states it with `NetworkConfig.linkRoundTripMs` instead.
79
87
  *
80
- * **Why 2 000.** It states the slowest link sereus already claims to support, and two other
81
- * budgets fix that claim independently: `COHORT_READ_DEADLINE_MS`
82
- * (`quereus-plugin-sereus/src/cluster-size.ts`, 5 000 ms) and
83
- * `DEFAULT_STRAND_FIRST_SYNC_TIMEOUT_MS` (`strand-first-sync-gate.ts`, 120 000 ms) were both
84
- * sized against two parties reaching each other only through a public relay at a round trip
85
- * near 1.8 s. Declaring 2 000 rounds that band up and leaves about 720 ms over the worst
86
- * relayed dial measured at it (7 279 ms against a derived 8 000 ms).
87
- *
88
- * Raising it is how a deployment that KNOWS its link is slower moves every derived budget at
89
- * once. The cost is the ordinary cost of a longer deadline: a peer that is genuinely gone holds
90
- * the operation for that much longer before it is abandoned and retried. Above about 2 500 it
91
- * buys nothing — see the module doc's ceiling paragraph.
88
+ * **Why 3 500.** Sereus supports two machines that reach each other only through a relay up to
89
+ * a **3-second link round trip** (1 500 ms each way — a congested mobile or satellite link;
90
+ * `docs/architecture.md` → "Relay Integration"). The worst relayed dial measured at that link
91
+ * was 12 094 ms, above the 12 000 ms a declaration of exactly 3 000 would derive, so the
92
+ * declaration rounds the supported link up to the next half second. 3 500 derives 14 000 ms
93
+ * and leaves about 1.9 s over that dial: room for a phone's Noise handshake, which the
94
+ * loopback measurement on a desktop does not contain. (The previous 2 000 followed the same
95
+ * convention for the 1.8 s band sereus supported before, with about 720 ms to spare.)
96
+ *
97
+ * Two budgets outside this module were sized against the 1.8 s band and do NOT move with it:
98
+ * `COHORT_READ_DEADLINE_MS` (`quereus-plugin-sereus/src/cluster-size.ts`, 5 000 ms) and
99
+ * `DEFAULT_STRAND_FIRST_SYNC_TIMEOUT_MS` (`strand-first-sync-gate.ts`). The module doc's
100
+ * "What still fails" list carries the first.
101
+ *
102
+ * What 3 500 costs, against 2 000: a peer that is genuinely gone holds each operation longer
103
+ * before it is abandoned and retried — a relayed dial or a reservation drive 14 s instead of
104
+ * 8 s, and a control-cohort dial of one peer across all its addresses 56 s instead of 32 s.
105
+ * Raise it further for a link slower still; lower it only on a deployment where EVERY machine
106
+ * of the party is that close, for the reason the "What still fails" list gives.
92
107
  */
93
- export const DECLARED_LINK_ROUND_TRIP_MS = 2000;
108
+ export const DECLARED_LINK_ROUND_TRIP_MS = 3500;
94
109
  /**
95
110
  * Link round trips one relayed connection setup costs: transport, encryption and multiplexer
96
111
  * handshakes to the relay, the circuit open, then both handshakes again end to end through it.
@@ -127,10 +142,10 @@ export const CIRCUIT_REQUEST_ROUND_TRIPS = 2;
127
142
  *
128
143
  * NOTE: 6 000 ms is not a measurement of any throughput — it is the residue of the 10 000 ms
129
144
  * this deadline shipped as before it was split into a latency part and a transfer part, chosen
130
- * so that at the default declaration the derived value is the same 10 000 and no fast link got
131
- * slower. Nobody has measured how long 1 MiB takes to cross a relayed mobile link. If pushes
132
- * ever time out with the transfer only part done, measure that and raise THIS, not the declared
133
- * round trip.
145
+ * so that at the declaration then in force (2 000 ms) the derived value stayed 10 000 and no
146
+ * fast link got slower. Nobody has measured how long 1 MiB takes to cross a relayed mobile
147
+ * link. If pushes ever time out with the transfer only part done, measure that and raise THIS,
148
+ * not the declared round trip.
134
149
  */
135
150
  export const PUSH_TRANSFER_ALLOWANCE_MS = 6000;
136
151
  /**
@@ -165,6 +180,35 @@ export function resolveLinkRoundTripMs(linkRoundTripMs) {
165
180
  export function relayedDialBudgetMs(linkRoundTripMs) {
166
181
  return RELAYED_DIAL_ROUND_TRIPS * resolveLinkRoundTripMs(linkRoundTripMs);
167
182
  }
183
+ /**
184
+ * libp2p's two connection-manager limits for a node at the declared link, handed to
185
+ * `@optimystic/db-p2p`'s `NodeOptions.connectionManager` on the control node and every strand
186
+ * node.
187
+ *
188
+ * Both bound the same thing — opening a relayed connection, measured at 8 one-way link delays,
189
+ * which is {@link RELAYED_DIAL_ROUND_TRIPS} (4) link round trips — so both are
190
+ * {@link relayedDialBudgetMs}: 4 x 3 500 = 14 000 ms at the default declaration, covering the
191
+ * 12 094 ms measured at the supported 3-second link.
192
+ *
193
+ * The listener's limit is deliberately NOT smaller than the dialer's. The listener's clock
194
+ * starts only when the relay hands it the circuit, a few one-way delays after the dialer's
195
+ * started, and both sides finish the handshakes at about the same moment; so with equal limits
196
+ * the listener never discards a connection that the dialer's own dial would still accept. A
197
+ * listener limit below the dialer's is what produced the silent failure in the module doc.
198
+ *
199
+ * The cost of a longer `inboundUpgradeTimeout` is that a peer which opens a connection and then
200
+ * stalls its handshake holds that half-built connection 14 s instead of 10 s.
201
+ *
202
+ * NOTE: derived from the declaration alone, so a per-field override that raises a cadre dial
203
+ * budget above it (`controlCohort.perAddressDialTimeoutMs`, `strandBackfill.dialTimeoutMs`)
204
+ * does not raise these; a dial that outlasts the listener's limit gets the silent failure
205
+ * again. If such overrides start being used for slow links, raise the declaration instead or
206
+ * take the largest configured dial budget here.
207
+ */
208
+ export function connectionManagerTimeouts(linkRoundTripMs) {
209
+ const budgetMs = relayedDialBudgetMs(linkRoundTripMs);
210
+ return { dialTimeout: budgetMs, inboundUpgradeTimeout: budgetMs };
211
+ }
168
212
  /**
169
213
  * Deadline for one whole relay reservation drive: {@link RELAY_RESERVATION_ROUND_TRIPS} at the
170
214
  * declared link round trip.
@@ -1 +1 @@
1
- {"version":3,"file":"link-budget.js","sourceRoot":"","sources":["../src/link-budget.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0EG;AAEH;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,CAAC,MAAM,2BAA2B,GAAG,IAAI,CAAC;AAEhD;;;;GAIG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,CAAC;AAE1C;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,6BAA6B,GAAG,CAAC,CAAC;AAE/C;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,2BAA2B,GAAG,CAAC,CAAC;AAE7C;;;;;;;;;;;;;;GAcG;AACH,MAAM,CAAC,MAAM,0BAA0B,GAAG,IAAI,CAAC;AAE/C;;;;;;;;;;;;;;;GAeG;AACH,MAAM,UAAU,sBAAsB,CAAC,eAAwB;IAC9D,IAAI,eAAe,KAAK,SAAS,EAAE,CAAC;QACnC,OAAO,2BAA2B,CAAC;IACpC,CAAC;IACD,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,eAAe,CAAC,IAAI,eAAe,IAAI,CAAC,EAAE,CAAC;QAC/D,MAAM,IAAI,KAAK,CACd,mFAAmF,MAAM,CAAC,eAAe,CAAC,EAAE,CAC5G,CAAC;IACH,CAAC;IACD,OAAO,eAAe,CAAC;AACxB,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,mBAAmB,CAAC,eAAwB;IAC3D,OAAO,wBAAwB,GAAG,sBAAsB,CAAC,eAAe,CAAC,CAAC;AAC3E,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,wBAAwB,CAAC,eAAwB;IAChE,OAAO,6BAA6B,GAAG,sBAAsB,CAAC,eAAe,CAAC,CAAC;AAChF,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU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C;AACxB,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,mBAAmB,CAAC,eAAwB;IAC3D,OAAO,wBAAwB,GAAG,sBAAsB,CAAC,eAAe,CAAC,CAAC;AAC3E,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,MAAM,UAAU,yBAAyB,CAAC,eAAwB;IACjE,MAAM,QAAQ,GAAG,mBAAmB,CAAC,eAAe,CAAC,CAAC;IACtD,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,qBAAqB,EAAE,QAAQ,EAAE,CAAC;AACnE,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,wBAAwB,CAAC,eAAwB;IAChE,OAAO,6BAA6B,GAAG,sBAAsB,CAAC,eAAe,CAAC,CAAC;AAChF,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,sBAAsB,CACrC,eAAwB,EACxB,mBAAmB,GAAG,0BAA0B;IAEhD,OAAO,2BAA2B,GAAG,sBAAsB,CAAC,eAAe,CAAC,GAAG,mBAAmB,CAAC;AACpG,CAAC;AAUD;;;;;GAKG;AACH,MAAM,UAAU,kBAAkB,CAAC,eAAwB;IAC1D,OAAO;QACN,aAAa,EAAE,mBAAmB,CAAC,eAAe,CAAC;QACnD,iBAAiB,EAAE,sBAAsB,CAAC,eAAe,CAAC;KAC1D,CAAC;AACH,CAAC"}
@@ -26,8 +26,8 @@ import type { Connection } from '@libp2p/interface';
26
26
  import type { Multiaddr } from '@multiformats/multiaddr';
27
27
  /**
28
28
  * Default limit on ONE address's dial attempt, in ms, at the DEFAULT declared link round trip:
29
- * `RELAYED_DIAL_ROUND_TRIPS` (4) x `DECLARED_LINK_ROUND_TRIP_MS` (2000 ms) = 8000 ms, which is
30
- * what this constant was already set to as a fixed number.
29
+ * `RELAYED_DIAL_ROUND_TRIPS` (4) x `DECLARED_LINK_ROUND_TRIP_MS` (3500 ms) = 14 000 ms. It was
30
+ * a fixed 8000 ms before it was derived.
31
31
  *
32
32
  * It has to cover the slowest address that should succeed, because an attempt
33
33
  * that needs longer fails the same way on every retry. That is a relayed dial on
@@ -35,7 +35,7 @@ import type { Multiaddr } from '@multiformats/multiaddr';
35
35
  * handshakes, when no relay connection is open yet), open the circuit, then run
36
36
  * both handshakes again end to end through the relay. `link-budget.ts` is where that
37
37
  * reasoning is now a measured count instead of an estimate — four link round trips, measured at
38
- * 7 279 ms on a link whose round trip is 1.8 s — so the value MOVES with a host's
38
+ * 12 094 ms on a link whose round trip is 3 s — so the value MOVES with a host's
39
39
  * `NetworkConfig.linkRoundTripMs` rather than pinning the band this node can reach to whatever
40
40
  * number was typed here. A direct dial that works is far quicker — a phone's WebSocket dial to
41
41
  * a node forwarded over `adb reverse` measured 1.6 s end to end.
package/dist/peer-dial.js CHANGED
@@ -28,8 +28,8 @@ import { relayedDialBudgetMs } from './link-budget.js';
28
28
  const log = debug('sereus:cadre:peer-dial');
29
29
  /**
30
30
  * Default limit on ONE address's dial attempt, in ms, at the DEFAULT declared link round trip:
31
- * `RELAYED_DIAL_ROUND_TRIPS` (4) x `DECLARED_LINK_ROUND_TRIP_MS` (2000 ms) = 8000 ms, which is
32
- * what this constant was already set to as a fixed number.
31
+ * `RELAYED_DIAL_ROUND_TRIPS` (4) x `DECLARED_LINK_ROUND_TRIP_MS` (3500 ms) = 14 000 ms. It was
32
+ * a fixed 8000 ms before it was derived.
33
33
  *
34
34
  * It has to cover the slowest address that should succeed, because an attempt
35
35
  * that needs longer fails the same way on every retry. That is a relayed dial on
@@ -37,7 +37,7 @@ const log = debug('sereus:cadre:peer-dial');
37
37
  * handshakes, when no relay connection is open yet), open the circuit, then run
38
38
  * both handshakes again end to end through the relay. `link-budget.ts` is where that
39
39
  * reasoning is now a measured count instead of an estimate — four link round trips, measured at
40
- * 7 279 ms on a link whose round trip is 1.8 s — so the value MOVES with a host's
40
+ * 12 094 ms on a link whose round trip is 3 s — so the value MOVES with a host's
41
41
  * `NetworkConfig.linkRoundTripMs` rather than pinning the band this node can reach to whatever
42
42
  * number was typed here. A direct dial that works is far quicker — a phone's WebSocket dial to
43
43
  * a node forwarded over `adb reverse` measured 1.6 s end to end.
@@ -29,7 +29,7 @@ export interface PeerJoinBackfillConfig {
29
29
  maxChunkBlocks?: number;
30
30
  /**
31
31
  * Per-push dial deadline, ms. Default {@link peerJoinPushBudget}'s `dialTimeoutMs` — four link
32
- * round trips at the declared link, 8000 ms as shipped. NOT a fixed number: a relayed dial
32
+ * round trips at the declared link, 14 000 ms as shipped. NOT a fixed number: a relayed dial
33
33
  * costs a fixed number of exchanges, so a host on a slower link moves this (and every other
34
34
  * cadre dial budget) by declaring `NetworkConfig.linkRoundTripMs`. Naming it here still wins
35
35
  * over the derived value — `link-budget.ts` has the counts and the measurement.
@@ -38,7 +38,7 @@ export interface PeerJoinBackfillConfig {
38
38
  /**
39
39
  * Per-push response deadline, ms. Default {@link peerJoinPushBudget}'s `responseTimeoutMs` —
40
40
  * two link round trips at the declared link plus a transfer allowance for the chunk's own
41
- * bytes, 10_000 ms as shipped. Derived differently from {@link dialTimeoutMs} because it
41
+ * bytes, 13 000 ms as shipped. Derived differently from {@link dialTimeoutMs} because it
42
42
  * bounds a data transfer over a connection that is already open, not a dial.
43
43
  */
44
44
  responseTimeoutMs?: number;
@@ -50,11 +50,12 @@ import { peerJoinPushBudget } from './link-budget.js';
50
50
  // link slow enough to matter it had never once managed to. The reproduction is
51
51
  // `packages/integration-tests/src/scenarios/relayed-dial-cost-by-latency.integration.ts`.
52
52
  //
53
- // It does NOT work at every speed. Above roughly 1250 ms one-way, two libp2p budgets that
54
- // sereus cannot reach abandon the connection before any deadline here is consulted, and the
55
- // listener's one makes that failure look like an absent peer rather than a timeout — see
56
- // `link-budget.ts` ("The ceiling this does NOT lift") and
57
- // `tickets/blocked/how-slow-a-relayed-link-does-sereus-carry`.
53
+ // It does NOT work at every speed. Above the declared link, libp2p's own dial and
54
+ // inbound-upgrade limits — derived from the same declaration — abandon the connection before
55
+ // any deadline here is consulted, and the listener's one makes that failure look like an absent
56
+ // peer rather than a timeout. That is also what happens when the machine being caught up
57
+ // declared a FASTER link than this one, since its limit is the listener's. See
58
+ // `link-budget.ts` ("libp2p's own two limits", "What still fails at the supported link").
58
59
  //
59
60
  // RETRY, and why it backs off. A run whose PUSH FAILED — the transport threw, which is what
60
61
  // a dial or response deadline expiring looks like here — re-arms on a doubling backoff
@@ -363,8 +364,8 @@ export class PeerJoinBackfill {
363
364
  console.warn(`[cadre:${this.deps.label}] peer-join block catch-up to peer ${key} has failed ${failures} times in a row `
364
365
  + `(dial budget ${this.config.dialTimeoutMs}ms, response budget ${this.config.responseTimeoutMs}ms). `
365
366
  + 'That peer may not be holding blocks committed before it joined. If it is reachable only through a relay, '
366
- + 'these budgets are derived from network.linkRoundTripMs (see link-budget.ts); above about a 2.5-second '
367
- + 'round trip no relayed connection can be established at all, whatever they are set to.');
367
+ + 'these budgets and libp2p\'s own connection limits are derived from network.linkRoundTripMs (see link-budget.ts); '
368
+ + 'a link slower than that declaration, or a peer that declared a faster one, cannot open a relayed connection at all.');
368
369
  }
369
370
  /**
370
371
  * The actual copy. `clean` = every chunk pushed and the remote persisted every block.