@serfab/cadre-core 1.6.0 → 1.8.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.
Files changed (179) hide show
  1. package/README.md +8 -6
  2. package/dist/cadre-node.d.ts +548 -137
  3. package/dist/cadre-node.js +1208 -383
  4. package/dist/cadre-node.js.map +1 -1
  5. package/dist/control-authorization.d.ts +2 -2
  6. package/dist/control-authorization.js +1 -0
  7. package/dist/control-authorization.js.map +1 -1
  8. package/dist/control-cohort.d.ts +6 -0
  9. package/dist/control-cohort.js +6 -0
  10. package/dist/control-cohort.js.map +1 -1
  11. package/dist/control-database.d.ts +46 -8
  12. package/dist/control-database.js +97 -18
  13. package/dist/control-database.js.map +1 -1
  14. package/dist/control-formation-recorder.d.ts +37 -14
  15. package/dist/control-formation-recorder.js +60 -10
  16. package/dist/control-formation-recorder.js.map +1 -1
  17. package/dist/control-read-retry.d.ts +13 -12
  18. package/dist/control-read-retry.js +14 -12
  19. package/dist/control-read-retry.js.map +1 -1
  20. package/dist/control-schema.d.ts +1 -1
  21. package/dist/control-schema.js +67 -5
  22. package/dist/control-schema.js.map +1 -1
  23. package/dist/control-stream.d.ts +9 -1
  24. package/dist/control-stream.js +24 -1
  25. package/dist/control-stream.js.map +1 -1
  26. package/dist/control-write-retry.d.ts +12 -2
  27. package/dist/control-write-retry.js +13 -2
  28. package/dist/control-write-retry.js.map +1 -1
  29. package/dist/delegate-admission.d.ts +11 -8
  30. package/dist/delegate-admission.js +19 -11
  31. package/dist/delegate-admission.js.map +1 -1
  32. package/dist/diagnostics/connection-path.d.ts +0 -7
  33. package/dist/diagnostics/connection-path.js +0 -7
  34. package/dist/diagnostics/connection-path.js.map +1 -1
  35. package/dist/formation-approval.d.ts +7 -0
  36. package/dist/formation-approval.js +9 -3
  37. package/dist/formation-approval.js.map +1 -1
  38. package/dist/fs-atomic.d.ts +11 -2
  39. package/dist/fs-atomic.js +13 -3
  40. package/dist/fs-atomic.js.map +1 -1
  41. package/dist/hibernation-manager.d.ts +111 -8
  42. package/dist/hibernation-manager.js +234 -49
  43. package/dist/hibernation-manager.js.map +1 -1
  44. package/dist/index.d.ts +13 -6
  45. package/dist/index.js +27 -5
  46. package/dist/index.js.map +1 -1
  47. package/dist/joined-strand-store.d.ts +177 -0
  48. package/dist/joined-strand-store.js +431 -0
  49. package/dist/joined-strand-store.js.map +1 -0
  50. package/dist/key-store-file.js +14 -5
  51. package/dist/key-store-file.js.map +1 -1
  52. package/dist/key-store.d.ts +6 -0
  53. package/dist/key-store.js.map +1 -1
  54. package/dist/link-budget.d.ts +367 -69
  55. package/dist/link-budget.js +375 -72
  56. package/dist/link-budget.js.map +1 -1
  57. package/dist/membership-connection-gater.d.ts +30 -43
  58. package/dist/membership-connection-gater.js +31 -42
  59. package/dist/membership-connection-gater.js.map +1 -1
  60. package/dist/node-local-snapshot.d.ts +5 -4
  61. package/dist/node-local-snapshot.js +6 -3
  62. package/dist/node-local-snapshot.js.map +1 -1
  63. package/dist/peer-dial.d.ts +24 -4
  64. package/dist/peer-dial.js +74 -5
  65. package/dist/peer-dial.js.map +1 -1
  66. package/dist/peer-join-backfill.d.ts +35 -15
  67. package/dist/peer-join-backfill.js +115 -55
  68. package/dist/peer-join-backfill.js.map +1 -1
  69. package/dist/push-fanout.d.ts +6 -0
  70. package/dist/push-fanout.js +6 -0
  71. package/dist/push-fanout.js.map +1 -1
  72. package/dist/relay-reservation.d.ts +3 -1
  73. package/dist/relay-reservation.js +3 -1
  74. package/dist/relay-reservation.js.map +1 -1
  75. package/dist/relay-server.d.ts +79 -0
  76. package/dist/relay-server.js +74 -0
  77. package/dist/relay-server.js.map +1 -0
  78. package/dist/seed-bootstrap.d.ts +57 -4
  79. package/dist/seed-bootstrap.js +107 -83
  80. package/dist/seed-bootstrap.js.map +1 -1
  81. package/dist/storage-scope.d.ts +33 -17
  82. package/dist/storage-scope.js +44 -23
  83. package/dist/storage-scope.js.map +1 -1
  84. package/dist/strand-addr-protocol.d.ts +58 -21
  85. package/dist/strand-addr-protocol.js +133 -85
  86. package/dist/strand-addr-protocol.js.map +1 -1
  87. package/dist/strand-database.d.ts +20 -2
  88. package/dist/strand-database.js +42 -5
  89. package/dist/strand-database.js.map +1 -1
  90. package/dist/strand-first-sync-gate.d.ts +59 -21
  91. package/dist/strand-first-sync-gate.js +58 -19
  92. package/dist/strand-first-sync-gate.js.map +1 -1
  93. package/dist/strand-formation-deadlines.d.ts +151 -0
  94. package/dist/strand-formation-deadlines.js +171 -0
  95. package/dist/strand-formation-deadlines.js.map +1 -0
  96. package/dist/strand-formation-manager.d.ts +63 -30
  97. package/dist/strand-formation-manager.js +67 -41
  98. package/dist/strand-formation-manager.js.map +1 -1
  99. package/dist/strand-formation-protocol.d.ts +45 -35
  100. package/dist/strand-formation-protocol.js +59 -122
  101. package/dist/strand-formation-protocol.js.map +1 -1
  102. package/dist/strand-instance-manager.d.ts +152 -6
  103. package/dist/strand-instance-manager.js +331 -42
  104. package/dist/strand-instance-manager.js.map +1 -1
  105. package/dist/strand-membership-writer.d.ts +6 -0
  106. package/dist/strand-membership-writer.js +11 -0
  107. package/dist/strand-membership-writer.js.map +1 -1
  108. package/dist/strand-peer-book-file.d.ts +12 -0
  109. package/dist/strand-peer-book-file.js +37 -0
  110. package/dist/strand-peer-book-file.js.map +1 -0
  111. package/dist/strand-peer-book-protocol.d.ts +168 -0
  112. package/dist/strand-peer-book-protocol.js +356 -0
  113. package/dist/strand-peer-book-protocol.js.map +1 -0
  114. package/dist/strand-peer-book-swap.d.ts +104 -0
  115. package/dist/strand-peer-book-swap.js +284 -0
  116. package/dist/strand-peer-book-swap.js.map +1 -0
  117. package/dist/strand-peer-book.d.ts +159 -0
  118. package/dist/strand-peer-book.js +361 -0
  119. package/dist/strand-peer-book.js.map +1 -0
  120. package/dist/strand-peer-observer.d.ts +88 -0
  121. package/dist/strand-peer-observer.js +180 -0
  122. package/dist/strand-peer-observer.js.map +1 -0
  123. package/dist/strand-revocation-enforcer.js +2 -1
  124. package/dist/strand-revocation-enforcer.js.map +1 -1
  125. package/dist/strand-solicitation.d.ts +36 -20
  126. package/dist/strand-solicitation.js +4 -4
  127. package/dist/strand-solicitation.js.map +1 -1
  128. package/dist/strand-wake-protocol.d.ts +80 -23
  129. package/dist/strand-wake-protocol.js +89 -64
  130. package/dist/strand-wake-protocol.js.map +1 -1
  131. package/dist/types.d.ts +181 -33
  132. package/dist/types.js +4 -3
  133. package/dist/types.js.map +1 -1
  134. package/package.json +11 -7
  135. package/src/cadre-node.ts +1316 -398
  136. package/src/control-authorization.ts +2 -1
  137. package/src/control-cohort.ts +6 -0
  138. package/src/control-database.ts +122 -18
  139. package/src/control-formation-recorder.ts +354 -305
  140. package/src/control-read-retry.ts +14 -12
  141. package/src/control-schema.ts +67 -5
  142. package/src/control-stream.ts +25 -1
  143. package/src/control-write-retry.ts +13 -2
  144. package/src/delegate-admission.ts +23 -13
  145. package/src/diagnostics/connection-path.ts +0 -7
  146. package/src/formation-approval.ts +610 -604
  147. package/src/fs-atomic.ts +14 -4
  148. package/src/hibernation-manager.ts +638 -437
  149. package/src/index.ts +91 -6
  150. package/src/joined-strand-store.ts +498 -0
  151. package/src/key-store-file.ts +14 -5
  152. package/src/key-store.ts +6 -0
  153. package/src/link-budget.ts +393 -74
  154. package/src/membership-connection-gater.ts +31 -45
  155. package/src/node-local-snapshot.ts +293 -289
  156. package/src/peer-dial.ts +81 -7
  157. package/src/peer-join-backfill.ts +120 -57
  158. package/src/push-fanout.ts +6 -0
  159. package/src/relay-reservation.ts +3 -1
  160. package/src/relay-server.ts +98 -0
  161. package/src/seed-bootstrap.ts +133 -91
  162. package/src/storage-scope.ts +44 -23
  163. package/src/strand-addr-protocol.ts +547 -458
  164. package/src/strand-database.ts +287 -242
  165. package/src/strand-first-sync-gate.ts +58 -19
  166. package/src/strand-formation-deadlines.ts +227 -0
  167. package/src/strand-formation-manager.ts +700 -647
  168. package/src/strand-formation-protocol.ts +103 -150
  169. package/src/strand-instance-manager.ts +387 -45
  170. package/src/strand-membership-writer.ts +12 -0
  171. package/src/strand-peer-book-file.ts +39 -0
  172. package/src/strand-peer-book-protocol.ts +466 -0
  173. package/src/strand-peer-book-swap.ts +338 -0
  174. package/src/strand-peer-book.ts +475 -0
  175. package/src/strand-peer-observer.ts +235 -0
  176. package/src/strand-revocation-enforcer.ts +2 -1
  177. package/src/strand-solicitation.ts +519 -500
  178. package/src/strand-wake-protocol.ts +401 -355
  179. package/src/types.ts +185 -33
@@ -1 +1 @@
1
- {"version":3,"file":"relay-reservation.js","sourceRoot":"","sources":["../src/relay-reservation.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqGG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACpD,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAEnD,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,wBAAwB,EAAE,MAAM,kBAAkB,CAAC;AAE5D,MAAM,GAAG,GAAG,KAAK,CAAC,gCAAgC,CAAC,CAAC;AAgCpD;;;;;;;;;;;;;;GAcG;AACH,MAAM,CAAC,MAAM,gCAAgC,GAAG,wBAAwB,EAAE,CAAC;AAC3E,MAAM,CAAC,MAAM,6BAA6B,GAAG,GAAG,CAAC;AAoEjD;;;;;GAKG;AACH,MAAM,UAAU,iBAAiB,CAAC,IAAY;IAC5C,OAAO,IAAI;SACR,aAAa,EAAE;SACf,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,QAAQ,EAAE,CAAC;SAC1B,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,cAAc,CAAC,CAAC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IAAI,SAAS,KAAK,IAAI,EAAE,CAAC;QACvB,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,KAAK,EAAE,QAAQ,EAAE,YAAY,EAAE,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC;IACrF,CAAC;IACD,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,YAAY,EAAE,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;AACxF,CAAC"}
@@ -0,0 +1,79 @@
1
+ /**
2
+ * The circuit-relay SERVER a party-run node runs — whether it runs one, and with which
3
+ * `@libp2p/circuit-relay-v2` init — resolved once from `NetworkConfig` for both node
4
+ * kinds: the control node (`cadre-node.ts` → `buildControlNodeOptions`) and every strand
5
+ * node (`strand-instance-manager.ts` → `buildStrandRuntime`). One function decides both
6
+ * answers so the two build sites cannot drift apart.
7
+ *
8
+ * WHY cadre sets an init at all. libp2p's server defaults `applyDefaultLimit` to true,
9
+ * which stamps every reservation with `Limit { data: 128 KiB, duration: 2 min }`; libp2p
10
+ * marks each connection relayed under it "limited" and resets it once either cap is
11
+ * reached, and db-p2p's database protocols refuse a limited connection outright (they do
12
+ * not set `runOnLimitedConnection`). A party-run relay exists to carry that party's own
13
+ * database traffic, so the cap cut off every sync and chat history forwarded through it
14
+ * (gotchoices/sereus#19). The dedicated relays (`ops/docker/libp2p-infra`, and the
15
+ * `startDedicatedRelay` test fixture that stands in for it) already turn the limit off;
16
+ * this is the same policy for the party-run kind.
17
+ */
18
+ import type { CircuitRelayServerInit, ServerReservationStoreInit } from '@libp2p/circuit-relay-v2';
19
+ import type { NetworkConfig, NodeProfile } from './types.js';
20
+ /**
21
+ * Default size of a party-run relay's reservation store, raised from libp2p's 15.
22
+ *
23
+ * A NAT'd machine reserves one slot for its control node and one for each strand it
24
+ * serves, all on the same relay (`strand-network-config.ts` hands strand nodes the
25
+ * control node's `network.relayAddrs`), so the store needs
26
+ * `NAT'd machines × (1 + strands each)` slots. At libp2p's 15, three phones serving four
27
+ * strands each already fill it. 128 covers, for example, ten NAT'd machines serving eleven
28
+ * strands each with the unauthorized-reservation budget's 8 slots
29
+ * (`MAX_UNAUTHORIZED_RELAY_RESERVATIONS`) still free on top — one party's worth, where the
30
+ * dedicated relay's 500 is sized for many parties. A reservation costs the server a map
31
+ * entry and a timer, not a connection's worth of state, so the headroom is cheap.
32
+ */
33
+ export declare const PARTY_RELAY_MAX_RESERVATIONS = 128;
34
+ /**
35
+ * How long a party-run relay holds a reservation that is not refreshed: libp2p's own
36
+ * default (2 h), set EXPLICITLY so that cadre, not a libp2p constant it cannot import,
37
+ * owns the value the unauthorized-reservation budget has to agree with (see
38
+ * {@link ResolvedRelayServer.init}).
39
+ */
40
+ export declare const PARTY_RELAY_RESERVATION_TTL_MS: number;
41
+ /**
42
+ * The reservation-store settings every party-run relay resolves unless the caller
43
+ * overrides them one key at a time through `network.relayServerInit.reservations`.
44
+ * `applyDefaultLimit: false` is the point of this module — see the module doc.
45
+ */
46
+ declare const PARTY_RELAY_RESERVATION_DEFAULTS: {
47
+ readonly applyDefaultLimit: false;
48
+ readonly maxReservations: 128;
49
+ readonly reservationTtl: number;
50
+ };
51
+ /** Reservation settings with the three keys cadre always resolves made definite. */
52
+ export type ResolvedRelayReservations = ServerReservationStoreInit & Required<Pick<ServerReservationStoreInit, keyof typeof PARTY_RELAY_RESERVATION_DEFAULTS>>;
53
+ /** What {@link resolveRelayServer} decides for one node. */
54
+ export interface ResolvedRelayServer {
55
+ /** Does this node run the relay server? Passed as db-p2p's `relay`. */
56
+ enabled: boolean;
57
+ /**
58
+ * The server's init, passed as db-p2p's `relayServerInit` when {@link enabled}: the
59
+ * party-run defaults with the caller's `network.relayServerInit` merged over them.
60
+ * `reservations.reservationTtl` is always set, which is what lets the control node's
61
+ * unauthorized-reservation budget expire its entries on the server's own clock.
62
+ */
63
+ init: CircuitRelayServerInit & {
64
+ reservations: ResolvedRelayReservations;
65
+ };
66
+ }
67
+ /**
68
+ * Resolve the relay server for a node built from `network` with `profile`.
69
+ *
70
+ * `enabled`: an explicit `network.enableRelay` wins; otherwise storage-profile nodes run
71
+ * the server (they are the machines with the connectivity and uptime to be a relay).
72
+ *
73
+ * `init`: MERGED, not replaced. `reservations` is merged key by key over the party-run
74
+ * defaults, so a caller who sets only `maxReservations` does not silently get the data
75
+ * limit back; every other top-level key is taken from the caller as given. A key set to
76
+ * `undefined` counts as unset, so the default beneath it holds.
77
+ */
78
+ export declare function resolveRelayServer(network: NetworkConfig | undefined, profile: NodeProfile): ResolvedRelayServer;
79
+ export {};
@@ -0,0 +1,74 @@
1
+ /**
2
+ * The circuit-relay SERVER a party-run node runs — whether it runs one, and with which
3
+ * `@libp2p/circuit-relay-v2` init — resolved once from `NetworkConfig` for both node
4
+ * kinds: the control node (`cadre-node.ts` → `buildControlNodeOptions`) and every strand
5
+ * node (`strand-instance-manager.ts` → `buildStrandRuntime`). One function decides both
6
+ * answers so the two build sites cannot drift apart.
7
+ *
8
+ * WHY cadre sets an init at all. libp2p's server defaults `applyDefaultLimit` to true,
9
+ * which stamps every reservation with `Limit { data: 128 KiB, duration: 2 min }`; libp2p
10
+ * marks each connection relayed under it "limited" and resets it once either cap is
11
+ * reached, and db-p2p's database protocols refuse a limited connection outright (they do
12
+ * not set `runOnLimitedConnection`). A party-run relay exists to carry that party's own
13
+ * database traffic, so the cap cut off every sync and chat history forwarded through it
14
+ * (gotchoices/sereus#19). The dedicated relays (`ops/docker/libp2p-infra`, and the
15
+ * `startDedicatedRelay` test fixture that stands in for it) already turn the limit off;
16
+ * this is the same policy for the party-run kind.
17
+ */
18
+ /**
19
+ * Default size of a party-run relay's reservation store, raised from libp2p's 15.
20
+ *
21
+ * A NAT'd machine reserves one slot for its control node and one for each strand it
22
+ * serves, all on the same relay (`strand-network-config.ts` hands strand nodes the
23
+ * control node's `network.relayAddrs`), so the store needs
24
+ * `NAT'd machines × (1 + strands each)` slots. At libp2p's 15, three phones serving four
25
+ * strands each already fill it. 128 covers, for example, ten NAT'd machines serving eleven
26
+ * strands each with the unauthorized-reservation budget's 8 slots
27
+ * (`MAX_UNAUTHORIZED_RELAY_RESERVATIONS`) still free on top — one party's worth, where the
28
+ * dedicated relay's 500 is sized for many parties. A reservation costs the server a map
29
+ * entry and a timer, not a connection's worth of state, so the headroom is cheap.
30
+ */
31
+ export const PARTY_RELAY_MAX_RESERVATIONS = 128;
32
+ /**
33
+ * How long a party-run relay holds a reservation that is not refreshed: libp2p's own
34
+ * default (2 h), set EXPLICITLY so that cadre, not a libp2p constant it cannot import,
35
+ * owns the value the unauthorized-reservation budget has to agree with (see
36
+ * {@link ResolvedRelayServer.init}).
37
+ */
38
+ export const PARTY_RELAY_RESERVATION_TTL_MS = 2 * 60 * 60 * 1000;
39
+ /**
40
+ * The reservation-store settings every party-run relay resolves unless the caller
41
+ * overrides them one key at a time through `network.relayServerInit.reservations`.
42
+ * `applyDefaultLimit: false` is the point of this module — see the module doc.
43
+ */
44
+ const PARTY_RELAY_RESERVATION_DEFAULTS = {
45
+ applyDefaultLimit: false,
46
+ maxReservations: PARTY_RELAY_MAX_RESERVATIONS,
47
+ reservationTtl: PARTY_RELAY_RESERVATION_TTL_MS
48
+ };
49
+ /**
50
+ * Resolve the relay server for a node built from `network` with `profile`.
51
+ *
52
+ * `enabled`: an explicit `network.enableRelay` wins; otherwise storage-profile nodes run
53
+ * the server (they are the machines with the connectivity and uptime to be a relay).
54
+ *
55
+ * `init`: MERGED, not replaced. `reservations` is merged key by key over the party-run
56
+ * defaults, so a caller who sets only `maxReservations` does not silently get the data
57
+ * limit back; every other top-level key is taken from the caller as given. A key set to
58
+ * `undefined` counts as unset, so the default beneath it holds.
59
+ */
60
+ export function resolveRelayServer(network, profile) {
61
+ const override = network?.relayServerInit;
62
+ return {
63
+ enabled: network?.enableRelay ?? (profile === 'storage'),
64
+ init: {
65
+ ...override,
66
+ reservations: { ...PARTY_RELAY_RESERVATION_DEFAULTS, ...definedEntries(override?.reservations) }
67
+ }
68
+ };
69
+ }
70
+ /** `obj` without its `undefined`-valued keys, so spreading it never erases a default. */
71
+ function definedEntries(obj) {
72
+ return Object.fromEntries(Object.entries(obj ?? {}).filter(([, value]) => value !== undefined));
73
+ }
74
+ //# sourceMappingURL=relay-server.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"relay-server.js","sourceRoot":"","sources":["../src/relay-server.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAKH;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,MAAM,4BAA4B,GAAG,GAAG,CAAC;AAEhD;;;;;GAKG;AACH,MAAM,CAAC,MAAM,8BAA8B,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;AAEjE;;;;GAIG;AACH,MAAM,gCAAgC,GAAG;IACvC,iBAAiB,EAAE,KAAK;IACxB,eAAe,EAAE,4BAA4B;IAC7C,cAAc,EAAE,8BAA8B;CACD,CAAC;AAmBhD;;;;;;;;;;GAUG;AACH,MAAM,UAAU,kBAAkB,CAAC,OAAkC,EAAE,OAAoB;IACzF,MAAM,QAAQ,GAAG,OAAO,EAAE,eAAe,CAAC;IAC1C,OAAO;QACL,OAAO,EAAE,OAAO,EAAE,WAAW,IAAI,CAAC,OAAO,KAAK,SAAS,CAAC;QACxD,IAAI,EAAE;YACJ,GAAG,QAAQ;YACX,YAAY,EAAE,EAAE,GAAG,gCAAgC,EAAE,GAAG,cAAc,CAAC,QAAQ,EAAE,YAAY,CAAC,EAAE;SACjG;KACF,CAAC;AACJ,CAAC;AAED,yFAAyF;AACzF,SAAS,cAAc,CAAmB,GAAkB;IAC1D,OAAO,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC,OAAO,CAAC,GAAG,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,KAAK,KAAK,SAAS,CAAC,CAAe,CAAC;AAChH,CAAC"}
@@ -90,13 +90,28 @@ export interface SeedBootstrapConfig {
90
90
  * returned without applying any seed.
91
91
  */
92
92
  maxConcurrentSeeds?: number;
93
+ /**
94
+ * The host's declared link round trip (`NetworkConfig.linkRoundTripMs`), from which
95
+ * {@link seedDeliverTimeoutMs}'s default is derived. Unset means the declared default.
96
+ */
97
+ linkRoundTripMs?: number;
93
98
  /**
94
99
  * Time {@link SeedBootstrapService.deliverSeed} waits for the whole exchange —
95
- * dial, write, ack read — before aborting (ms). Defaults to
96
- * {@link DEFAULT_SEED_DELIVER_TIMEOUT_MS}. Bounds the SENDER against a seed
100
+ * dial, write, ack read — before aborting (ms). Bounds the SENDER against a seed
97
101
  * target that accepts the stream and then never replies; the target is a
98
102
  * not-yet-trusted node during onboarding, so this is the more exposed
99
103
  * direction than the receiver knobs above.
104
+ *
105
+ * Defaults to `relayedRequestBudgetMs(linkRoundTripMs)` (`link-budget.ts`; 23 s at the
106
+ * default declaration): one dial that may need a relay, then one request and its answer.
107
+ * Delivery does not set `runOnLimitedConnection`, so it does not use a limited relayed
108
+ * connection today; the relayed-dial count is the upper bound on the dial it can use, the
109
+ * same choice `CadreNode.controlDialBudget` makes for every address. It holds only link work
110
+ * because the receiver acks before its owner dials.
111
+ *
112
+ * NOTE: no transfer allowance — a seed is a peer list of a few KB, and `MAX_SEED_SIZE` (1 MiB)
113
+ * is a defensive cap. If seeds ever grow toward that cap, add an allowance the way
114
+ * `PUSH_TRANSFER_ALLOWANCE_MS` does.
100
115
  */
101
116
  seedDeliverTimeoutMs?: number;
102
117
  /**
@@ -172,10 +187,14 @@ export declare class SeedBootstrapService {
172
187
  * `controlDatabase` for dialing and known-key lookup, and must NOT bind a
173
188
  * discarded closure to the shared node (a handler leak, and a second
174
189
  * `handle()` of the same protocol throws `DuplicateProtocolHandlerError`).
190
+ *
191
+ * Rejects when libp2p refuses the registration; the node and database are
192
+ * kept only once the handler is in place, so a failed service holds nothing
193
+ * for {@link shutdown} to unhandle.
175
194
  */
176
195
  initialize(libp2pNode: Libp2p, controlDatabase: ControlDatabase, options?: {
177
196
  registerHandler?: boolean;
178
- }): void;
197
+ }): Promise<void>;
179
198
  /**
180
199
  * Authorize a new peer to join the cadre.
181
200
  * Signs a membership voucher with the owner key and inserts into CadrePeer table.
@@ -396,6 +415,25 @@ export declare class SeedBootstrapService {
396
415
  applySeed(seed: ControlNetworkSeed, options?: {
397
416
  trustPolicy?: SeedTrustPolicy;
398
417
  }): Promise<ApplySeedResult>;
418
+ /**
419
+ * The first half of {@link applySeed}: check the signature and the signer's trust, then merge
420
+ * the seed's peer addresses into the peer store. Every rejection happens here, so this result is
421
+ * what the inbound handler acks with; the owner dials that follow cannot change it.
422
+ */
423
+ private verifyAndMergeSeed;
424
+ /**
425
+ * The second half of {@link applySeed}: dial the seed's owner peers to establish connections.
426
+ *
427
+ * Best-effort and COUNTED: an owner that is momentarily down leaves this node seeded but
428
+ * unconnected, which the caller can only see if the outcome is reported (see
429
+ * `ApplySeedResult.ownerDialsFailed`). Recovery is not this loop's job —
430
+ * `CadreNode.dialColdStartBootstrap` retries these same addresses on every control-cohort
431
+ * reconcile pass until the control database has siblings.
432
+ *
433
+ * The inbound handler runs this AFTER it has acked and closed the stream
434
+ * ({@link handleSeedStream}), because an unreachable owner can take `dialBudget.totalMs`.
435
+ */
436
+ private dialSeedOwners;
399
437
  /**
400
438
  * Persist a signer that a pin/TOFU accepted into the node-local anchor, so a
401
439
  * later seed from the same owner is anchored without re-supplying the invite
@@ -499,15 +537,30 @@ export declare class SeedBootstrapService {
499
537
  */
500
538
  private registerProtocolHandler;
501
539
  /**
502
- * Read one inbound seed frame, apply it, and write the ack.
540
+ * Read one inbound seed frame, verify and merge it, write the ack and close the
541
+ * stream, then dial the seed's owners.
542
+ *
543
+ * The ack and the close come BEFORE the owner dials: an unreachable owner can hold
544
+ * a dial for `dialBudget.totalMs` (64 s at the default declared link), which is not
545
+ * link time and does not belong inside the sender's delivery deadline. The close is
546
+ * what releases the sender, which reads the ack to end-of-stream. The stream stays
547
+ * counted in {@link activeStreams} through the dials, so {@link maxConcurrentSeeds}
548
+ * still bounds concurrent owner-dial phases.
503
549
  *
504
550
  * Hardened against a buggy/compromised own-cadre node: a concurrency cap (over
505
551
  * {@link maxConcurrentSeeds}, reply without applying), a read timeout (a peer
506
552
  * that never half-closes is aborted inside `readStreamToEnd`), and the existing
507
553
  * malformed/oversized-frame guard — all reported as a non-accepting
508
554
  * {@link SeedAckMessage} rather than a dropped/hung stream.
555
+ *
556
+ * NOTE: a receiver configured with an interactive trust-on-first-use policy asks a
557
+ * human before acking, and that wait sits inside the sender's delivery deadline. If
558
+ * TOFU is ever used on this wire path, ack "pending" or move the confirmation out of
559
+ * the exchange.
509
560
  */
510
561
  private handleSeedStream;
562
+ /** Read the inbound seed frame to EOF (bounded and size-capped) and decode it. */
563
+ private readSeedFrame;
511
564
  /**
512
565
  * Shutdown the service.
513
566
  */
@@ -3,8 +3,9 @@ import { toString as uint8ArrayToString, fromString as uint8ArrayFromString } fr
3
3
  import { digest, sign, verify, getPublicKey } from '@optimystic/quereus-plugin-crypto';
4
4
  import { multiaddr } from '@multiformats/multiaddr';
5
5
  import { peerIdFromString } from '@libp2p/peer-id';
6
- import { writeFrame, withDeadline, exchangeFrame, readStreamToEnd } from './control-stream.js';
7
- import { dialPeerAddrs, DEFAULT_PEER_DIAL_BUDGET } from './peer-dial.js';
6
+ import { withDeadline, exchangeFrame, readStreamToEnd, replyAndClose } from './control-stream.js';
7
+ import { dialPeerAddrs, SelfRelayOnlyError, DEFAULT_PEER_DIAL_BUDGET } from './peer-dial.js';
8
+ import { relayedRequestBudgetMs } from './link-budget.js';
8
9
  import { generateStampId } from './control-database.js';
9
10
  import { canonicalJson } from './canonical-json.js';
10
11
  import { deviceTokenAddDigest } from './peer-authorization.js';
@@ -14,12 +15,14 @@ const log = debug('sereus:cadre:seed-bootstrap');
14
15
  export const SEED_PROTOCOL = '/sereus/seed/1.0.0';
15
16
  /** Maximum seed message size (1MB) */
16
17
  const MAX_SEED_SIZE = 1024 * 1024;
17
- /** Default time the receiver waits for an inbound seed frame before aborting (ms). */
18
+ /**
19
+ * Default time the receiver waits for an inbound seed frame before aborting (ms). It covers the
20
+ * read only: the trust decision and the peer-store merge run after it.
21
+ */
22
+ // eslint-disable-next-line no-restricted-syntax -- link-independent: a receiver cap on one seed frame on a stream the peer already opened; it bounds a peer that opens a stream and never sends, not the dial
18
23
  const DEFAULT_SEED_READ_TIMEOUT_MS = 10000;
19
24
  /** Default cap on concurrent inbound seed streams a single peer can pin open. */
20
25
  const DEFAULT_MAX_CONCURRENT_SEEDS = 100;
21
- /** Default time the sender waits for a seed delivery (dial + ack read) before aborting (ms). */
22
- const DEFAULT_SEED_DELIVER_TIMEOUT_MS = 10000;
23
26
  /**
24
27
  * Decode a 4-byte big-endian length-prefixed frame; returns the body bytes.
25
28
  *
@@ -120,7 +123,7 @@ export class SeedBootstrapService {
120
123
  this.trustPolicy = config.trustPolicy ?? anchoredTrustPolicy();
121
124
  this.seedReadTimeoutMs = config.seedReadTimeoutMs ?? DEFAULT_SEED_READ_TIMEOUT_MS;
122
125
  this.maxConcurrentSeeds = config.maxConcurrentSeeds ?? DEFAULT_MAX_CONCURRENT_SEEDS;
123
- this.seedDeliverTimeoutMs = config.seedDeliverTimeoutMs ?? DEFAULT_SEED_DELIVER_TIMEOUT_MS;
126
+ this.seedDeliverTimeoutMs = config.seedDeliverTimeoutMs ?? relayedRequestBudgetMs(config.linkRoundTripMs);
124
127
  this.dialBudget = config.dialBudget ?? DEFAULT_PEER_DIAL_BUDGET;
125
128
  // Derive public key from private key if not provided
126
129
  if (config.ownerPrivateKey && !config.ownerPublicKey) {
@@ -160,14 +163,18 @@ export class SeedBootstrapService {
160
163
  * `controlDatabase` for dialing and known-key lookup, and must NOT bind a
161
164
  * discarded closure to the shared node (a handler leak, and a second
162
165
  * `handle()` of the same protocol throws `DuplicateProtocolHandlerError`).
166
+ *
167
+ * Rejects when libp2p refuses the registration; the node and database are
168
+ * kept only once the handler is in place, so a failed service holds nothing
169
+ * for {@link shutdown} to unhandle.
163
170
  */
164
- initialize(libp2pNode, controlDatabase, options) {
165
- this.libp2pNode = libp2pNode;
166
- this.controlDatabase = controlDatabase;
171
+ async initialize(libp2pNode, controlDatabase, options) {
167
172
  // Register the seed protocol handler unless the caller opted out (temp services).
168
173
  if (options?.registerHandler ?? true) {
169
- this.registerProtocolHandler();
174
+ await this.registerProtocolHandler(libp2pNode);
170
175
  }
176
+ this.libp2pNode = libp2pNode;
177
+ this.controlDatabase = controlDatabase;
171
178
  log('SeedBootstrapService initialized');
172
179
  }
173
180
  /**
@@ -528,6 +535,18 @@ export class SeedBootstrapService {
528
535
  * service-configured default for this seed only.
529
536
  */
530
537
  async applySeed(seed, options) {
538
+ const merged = await this.verifyAndMergeSeed(seed, options);
539
+ if (!merged.success) {
540
+ return merged;
541
+ }
542
+ return { ...merged, ...await this.dialSeedOwners(seed) };
543
+ }
544
+ /**
545
+ * The first half of {@link applySeed}: check the signature and the signer's trust, then merge
546
+ * the seed's peer addresses into the peer store. Every rejection happens here, so this result is
547
+ * what the inbound handler acks with; the owner dials that follow cannot change it.
548
+ */
549
+ async verifyAndMergeSeed(seed, options) {
531
550
  if (!this.libp2pNode) {
532
551
  return seedRejected('Service not initialized');
533
552
  }
@@ -578,12 +597,27 @@ export class SeedBootstrapService {
578
597
  log('Failed to add peer %s: %o', peer.peerId, error);
579
598
  }
580
599
  }
581
- // Dial owner peers to establish connections. Best-effort and COUNTED: an
582
- // owner that is momentarily down leaves this node seeded but unconnected,
583
- // which the caller can only see if the outcome is reported (see
584
- // `ApplySeedResult.ownerDialsFailed`). Recovery is not this loop's job —
585
- // `CadreNode.dialColdStartBootstrap` retries these same addresses on every
586
- // control-cohort reconcile pass until the control database has siblings.
600
+ log('Merged seed: %d peers added', peersAdded);
601
+ return { success: true, peersAdded, ownerDialsAttempted: 0, ownerDialsFailed: 0 };
602
+ }
603
+ /**
604
+ * The second half of {@link applySeed}: dial the seed's owner peers to establish connections.
605
+ *
606
+ * Best-effort and COUNTED: an owner that is momentarily down leaves this node seeded but
607
+ * unconnected, which the caller can only see if the outcome is reported (see
608
+ * `ApplySeedResult.ownerDialsFailed`). Recovery is not this loop's job —
609
+ * `CadreNode.dialColdStartBootstrap` retries these same addresses on every control-cohort
610
+ * reconcile pass until the control database has siblings.
611
+ *
612
+ * The inbound handler runs this AFTER it has acked and closed the stream
613
+ * ({@link handleSeedStream}), because an unreachable owner can take `dialBudget.totalMs`.
614
+ */
615
+ async dialSeedOwners(seed) {
616
+ const node = this.libp2pNode;
617
+ if (!node) {
618
+ log('Seed service shut down before its owner dials; none attempted');
619
+ return { ownerDialsAttempted: 0, ownerDialsFailed: 0 };
620
+ }
587
621
  // `createSeed` projects every non-revoked CadrePeer row, so an owner applying
588
622
  // a seed minted after it joined finds ITSELF in the owner list. Dialing self always
589
623
  // throws, which would report a healthy owner as "seeded but stranded".
@@ -592,12 +626,7 @@ export class SeedBootstrapService {
592
626
  // Every one of an owner's addresses is a candidate, each on its own time limit
593
627
  // (`dialPeerAddrs`), so an owner whose first address never answers neither
594
628
  // stalls seed application nor goes undialed at its other addresses.
595
- // NOTE: `handleSeedStream` acks only after this loop, so an unreachable owner
596
- // can hold the ack for up to `dialBudget.totalMs` each — 56 s at the default declared link
597
- // round trip, more on a host that declared a slower one (`link-budget.ts`) — past a sender's
598
- // 10 s `seedDeliverTimeoutMs`; the seed is still applied. If senders start
599
- // reporting accepted seeds as timed out, ack before dialing.
600
- const selfPeerId = this.libp2pNode.peerId?.toString();
629
+ const selfPeerId = node.peerId?.toString();
601
630
  let ownerDialsAttempted = 0;
602
631
  let ownerDialsFailed = 0;
603
632
  for (const peer of seed.peers.filter(p => p.isOwner)) {
@@ -608,16 +637,23 @@ export class SeedBootstrapService {
608
637
  try {
609
638
  const addrs = parseDialAddrs(peer.multiaddrs);
610
639
  log('Dialing owner peer: %s (%d addr(s))', peer.peerId, addrs.length);
611
- await dialPeerAddrs(this.libp2pNode, addrs, this.dialBudget, `Owner dial of ${peer.peerId}`);
640
+ await dialPeerAddrs(node, addrs, this.dialBudget, `Owner dial of ${peer.peerId}`);
612
641
  }
613
642
  catch (error) {
643
+ // Counted even when the owner reaches us only through our own relay: this node is still
644
+ // not connected to it, and `ownerDialsFailed` is how the caller learns that.
614
645
  ownerDialsFailed++;
615
- log('Failed to dial peer %s: %o', peer.peerId, error);
646
+ if (error instanceof SelfRelayOnlyError) {
647
+ log('Owner peer %s is reachable only by relaying through this node; waiting for it to reconnect', peer.peerId);
648
+ }
649
+ else {
650
+ log('Failed to dial peer %s: %o', peer.peerId, error);
651
+ }
616
652
  // Continue - not all peers need to be reachable
617
653
  }
618
654
  }
619
- log('Applied seed: %d peers added, %d/%d owner dial(s) failed', peersAdded, ownerDialsFailed, ownerDialsAttempted);
620
- return { success: true, peersAdded, ownerDialsAttempted, ownerDialsFailed };
655
+ log('Dialed seed owners: %d/%d owner dial(s) failed', ownerDialsFailed, ownerDialsAttempted);
656
+ return { ownerDialsAttempted, ownerDialsFailed };
621
657
  }
622
658
  /**
623
659
  * Persist a signer that a pin/TOFU accepted into the node-local anchor, so a
@@ -806,98 +842,86 @@ export class SeedBootstrapService {
806
842
  * {@link handleSeedStream} — extracted as a method so it has a unit-test seam
807
843
  * (mirroring wake's `handleStream`) the inline closure never had.
808
844
  */
809
- registerProtocolHandler() {
810
- if (!this.libp2pNode)
811
- return;
812
- void this.libp2pNode.handle(SEED_PROTOCOL, async (rawStream, rawConnection) => {
845
+ async registerProtocolHandler(libp2pNode) {
846
+ await libp2pNode.handle(SEED_PROTOCOL, async (rawStream, rawConnection) => {
813
847
  const remotePeerId = rawConnection.remotePeer.toString();
814
848
  await this.handleSeedStream(rawStream, remotePeerId);
815
849
  });
816
850
  log('Registered seed protocol handler: %s', SEED_PROTOCOL);
817
851
  }
818
852
  /**
819
- * Read one inbound seed frame, apply it, and write the ack.
853
+ * Read one inbound seed frame, verify and merge it, write the ack and close the
854
+ * stream, then dial the seed's owners.
855
+ *
856
+ * The ack and the close come BEFORE the owner dials: an unreachable owner can hold
857
+ * a dial for `dialBudget.totalMs` (64 s at the default declared link), which is not
858
+ * link time and does not belong inside the sender's delivery deadline. The close is
859
+ * what releases the sender, which reads the ack to end-of-stream. The stream stays
860
+ * counted in {@link activeStreams} through the dials, so {@link maxConcurrentSeeds}
861
+ * still bounds concurrent owner-dial phases.
820
862
  *
821
863
  * Hardened against a buggy/compromised own-cadre node: a concurrency cap (over
822
864
  * {@link maxConcurrentSeeds}, reply without applying), a read timeout (a peer
823
865
  * that never half-closes is aborted inside `readStreamToEnd`), and the existing
824
866
  * malformed/oversized-frame guard — all reported as a non-accepting
825
867
  * {@link SeedAckMessage} rather than a dropped/hung stream.
868
+ *
869
+ * NOTE: a receiver configured with an interactive trust-on-first-use policy asks a
870
+ * human before acking, and that wait sits inside the sender's delivery deadline. If
871
+ * TOFU is ever used on this wire path, ack "pending" or move the confirmation out of
872
+ * the exchange.
826
873
  */
827
874
  async handleSeedStream(stream, remotePeerId) {
828
875
  log('Incoming seed delivery from: %s', remotePeerId);
829
876
  if (this.activeStreams >= this.maxConcurrentSeeds) {
830
877
  log('Rejecting seed from %s: %d concurrent streams at cap %d', remotePeerId, this.activeStreams, this.maxConcurrentSeeds);
831
- const ack = { accepted: false, reason: 'Too many concurrent seed deliveries' };
832
- try {
833
- writeFrame(stream, ack);
834
- }
835
- catch {
836
- // Ignore send errors on the reject path.
837
- }
838
- try {
839
- await stream.close();
840
- }
841
- catch {
842
- // Ignore close errors.
843
- }
878
+ await replyAndClose(stream, { accepted: false, reason: 'Too many concurrent seed deliveries' }, 'Seed');
844
879
  return;
845
880
  }
846
881
  this.activeStreams++;
882
+ let acked = false;
847
883
  try {
848
- // Read the seed frame to EOF (bounded + size-capped), then decode it.
849
- const data = await readStreamToEnd(stream, {
850
- maxBytes: MAX_SEED_SIZE,
851
- timeoutMs: this.seedReadTimeoutMs,
852
- label: 'Seed',
853
- });
854
- const messageBody = decodeLengthPrefixedFrame(data);
855
- const messageJson = new TextDecoder().decode(messageBody);
856
- const message = JSON.parse(messageJson);
857
- // Emit seed received event
858
- this.eventCallbacks.onSeedReceived?.(message.partyId, remotePeerId);
859
- // Convert to seed and apply
860
- const seed = {
861
- partyId: message.partyId,
862
- peers: message.peers,
863
- signature: message.signature,
864
- signerKey: message.signerKey,
865
- };
866
- const result = await this.applySeed(seed);
867
- // Emit appropriate event based on result
868
- if (result.success) {
869
- this.eventCallbacks.onSeedApplied?.(seed.partyId, result.peersAdded, seed);
884
+ const seed = await this.readSeedFrame(stream);
885
+ this.eventCallbacks.onSeedReceived?.(seed.partyId, remotePeerId);
886
+ const merged = await this.verifyAndMergeSeed(seed);
887
+ acked = true;
888
+ await replyAndClose(stream, { accepted: merged.success, reason: merged.error }, 'Seed');
889
+ if (merged.success) {
890
+ await this.dialSeedOwners(seed);
891
+ this.eventCallbacks.onSeedApplied?.(seed.partyId, merged.peersAdded, seed);
870
892
  }
871
893
  else {
872
- this.eventCallbacks.onSeedError?.(seed.partyId, result.error ?? 'Unknown error');
894
+ this.eventCallbacks.onSeedError?.(seed.partyId, merged.error ?? 'Unknown error');
873
895
  }
874
- const ack = { accepted: result.success, reason: result.error };
875
- writeFrame(stream, ack);
876
896
  }
877
897
  catch (error) {
878
898
  log('Error handling seed delivery: %o', error);
879
899
  const errorMessage = error instanceof Error ? error.message : 'Unknown error';
880
- // Emit error event
881
900
  this.eventCallbacks.onSeedError?.(this.config.partyId, errorMessage);
882
- // Send error acknowledgment (best-effort on the still-open write side).
883
- const ack = { accepted: false, reason: errorMessage };
884
- try {
885
- writeFrame(stream, ack);
886
- }
887
- catch {
888
- // Ignore send errors
901
+ // Once acked the stream is closed, so a later failure has no reply to make.
902
+ if (!acked) {
903
+ await replyAndClose(stream, { accepted: false, reason: errorMessage }, 'Seed');
889
904
  }
890
905
  }
891
906
  finally {
892
907
  this.activeStreams--;
893
- try {
894
- await stream.close();
895
- }
896
- catch {
897
- // Ignore close errors.
898
- }
899
908
  }
900
909
  }
910
+ /** Read the inbound seed frame to EOF (bounded and size-capped) and decode it. */
911
+ async readSeedFrame(stream) {
912
+ const data = await readStreamToEnd(stream, {
913
+ maxBytes: MAX_SEED_SIZE,
914
+ timeoutMs: this.seedReadTimeoutMs,
915
+ label: 'Seed',
916
+ });
917
+ const message = JSON.parse(new TextDecoder().decode(decodeLengthPrefixedFrame(data)));
918
+ return {
919
+ partyId: message.partyId,
920
+ peers: message.peers,
921
+ signature: message.signature,
922
+ signerKey: message.signerKey,
923
+ };
924
+ }
901
925
  /**
902
926
  * Shutdown the service.
903
927
  */