@serfab/cadre-core 1.6.0 → 1.7.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 (51) hide show
  1. package/dist/cadre-node.d.ts +204 -65
  2. package/dist/cadre-node.js +392 -95
  3. package/dist/cadre-node.js.map +1 -1
  4. package/dist/index.d.ts +5 -0
  5. package/dist/index.js +16 -0
  6. package/dist/index.js.map +1 -1
  7. package/dist/joined-strand-store.d.ts +112 -0
  8. package/dist/joined-strand-store.js +263 -0
  9. package/dist/joined-strand-store.js.map +1 -0
  10. package/dist/key-store.d.ts +6 -0
  11. package/dist/key-store.js.map +1 -1
  12. package/dist/node-local-snapshot.d.ts +5 -4
  13. package/dist/node-local-snapshot.js +6 -3
  14. package/dist/node-local-snapshot.js.map +1 -1
  15. package/dist/peer-join-backfill.d.ts +33 -14
  16. package/dist/peer-join-backfill.js +109 -50
  17. package/dist/peer-join-backfill.js.map +1 -1
  18. package/dist/strand-instance-manager.d.ts +39 -0
  19. package/dist/strand-instance-manager.js +74 -1
  20. package/dist/strand-instance-manager.js.map +1 -1
  21. package/dist/strand-peer-book-file.d.ts +12 -0
  22. package/dist/strand-peer-book-file.js +37 -0
  23. package/dist/strand-peer-book-file.js.map +1 -0
  24. package/dist/strand-peer-book-protocol.d.ts +159 -0
  25. package/dist/strand-peer-book-protocol.js +360 -0
  26. package/dist/strand-peer-book-protocol.js.map +1 -0
  27. package/dist/strand-peer-book-swap.d.ts +104 -0
  28. package/dist/strand-peer-book-swap.js +284 -0
  29. package/dist/strand-peer-book-swap.js.map +1 -0
  30. package/dist/strand-peer-book.d.ts +159 -0
  31. package/dist/strand-peer-book.js +354 -0
  32. package/dist/strand-peer-book.js.map +1 -0
  33. package/dist/strand-peer-observer.d.ts +88 -0
  34. package/dist/strand-peer-observer.js +180 -0
  35. package/dist/strand-peer-observer.js.map +1 -0
  36. package/dist/types.d.ts +58 -0
  37. package/dist/types.js.map +1 -1
  38. package/package.json +6 -2
  39. package/src/cadre-node.ts +7776 -7449
  40. package/src/index.ts +67 -0
  41. package/src/joined-strand-store.ts +308 -0
  42. package/src/key-store.ts +6 -0
  43. package/src/node-local-snapshot.ts +293 -289
  44. package/src/peer-join-backfill.ts +112 -51
  45. package/src/strand-instance-manager.ts +100 -1
  46. package/src/strand-peer-book-file.ts +39 -0
  47. package/src/strand-peer-book-protocol.ts +463 -0
  48. package/src/strand-peer-book-swap.ts +338 -0
  49. package/src/strand-peer-book.ts +468 -0
  50. package/src/strand-peer-observer.ts +235 -0
  51. package/src/types.ts +60 -0
@@ -1,14 +1,25 @@
1
1
  import debug from 'debug';
2
- import { BlockTransferClient } from '@optimystic/db-p2p';
2
+ import { BlockTransferClient, buildBlockTransferProtocol } from '@optimystic/db-p2p';
3
3
  import { peerJoinPushBudget } from './link-budget.js';
4
4
  // Peer-join whole-store block catch-up, shared by the STRAND networks and the CONTROL
5
- // network. On `connection:open` (debounced) it pushes every committed, materialized block
6
- // in the local raw store to the new peer, so a machine that joined after blocks were
5
+ // network. On a new peer's `peer:identify` result — libp2p's identify protocol runs once per
6
+ // connection and reports the protocols the remote supports — naming this network's own
7
+ // block-transfer protocol, it schedules a debounced push of every committed, materialized
8
+ // block in the local raw store to that peer, so a machine that joined after blocks were
7
9
  // committed still ends up physically holding them. Optimystic has no cohort-join catch-up
8
10
  // of its own; a block committed while its writer was alone has exactly one holder forever
9
11
  // without this (named collection-header blocks are written once, at collection creation,
10
12
  // and their revision never moves again — so no later commit ever carries them anywhere).
11
13
  //
14
+ // A peer whose identify does not name the protocol — a bare circuit relay, a bootstrap node,
15
+ // or (on the control network) a stranger the inbound gate admits without membership — is
16
+ // never scheduled at all: it cannot receive anything, since the protocol id is namespaced per
17
+ // network and the dial would simply fail. Before this filter existed, such a peer WAS
18
+ // scheduled, failed every dial, and after `PEER_JOIN_BACKFILL_WARN_AFTER_FAILURES` produced a
19
+ // `console.warn` naming it — gotchoices/sereus#18 is two relay-only parties restarting and
20
+ // printing exactly that warning about their own relay, forever, on every reconnect. See
21
+ // {@link speaksBlockTransfer}.
22
+ //
12
23
  // NOTE: this copies the WHOLE local store to every newly connected peer, which is right
13
24
  // while a network is one party's handful of machines (see docs/architecture.md →
14
25
  // Replication cluster size — the control network replicates to the whole party by intent,
@@ -23,12 +34,10 @@ import { peerJoinPushBudget } from './link-budget.js';
23
34
  // Membership — the one place the two networks differ, expressed as the optional
24
35
  // `authorizePeer` dep:
25
36
  //
26
- // - STRAND networks pass none. Anything connected on a strand's own libp2p network already
27
- // receives cohort replicas of new commits, so pushing older blocks to it exposes nothing
28
- // new; adding a gate would diverge from what ordinary replication already does there. A
29
- // peer that does NOT speak the strand's block-transfer protocol (a bare circuit relay or
30
- // bootstrap node the strand node also connects to) cannot receive anything: the protocol
31
- // id is namespaced per strand, so the dial fails and the push is dropped.
37
+ // - STRAND networks pass none. Anything that speaks the strand's own block-transfer protocol
38
+ // already receives cohort replicas of new commits, so pushing older blocks to it exposes
39
+ // nothing new; adding a gate would diverge from what ordinary replication already does
40
+ // there.
32
41
  // - The CONTROL network MUST pass one, because that argument does not carry over: its
33
42
  // inbound connection gate deliberately admits non-members in several states (an
34
43
  // un-enrolled node taking its seed, an open enrollment window, an outstanding
@@ -37,8 +46,8 @@ import { peerJoinPushBudget } from './link-budget.js';
37
46
  // peer would hand a stranger the party's entire membership, addresses and strand list.
38
47
  // `CadreNode` passes `isAuthorizedMember`; the gate is consulted at PUSH time, not at
39
48
  // schedule time, and fails closed on a thrown check. A denied run is not memoized, so
40
- // the peer is retried on its next `connection:open` — or sooner, via
41
- // `scheduleConnectedPeers()` on a membership change (the production join order is
49
+ // the peer is retried on its next `peer:identify` (a reconnect re-runs identify) — or
50
+ // sooner, via `scheduleConnectedPeers()` on a membership change (the production join order is
42
51
  // connect-then-authorize, so the denial at dial time is the expected first pass).
43
52
  //
44
53
  // Both per-push deadlines are DERIVED from the declared link round trip
@@ -59,14 +68,14 @@ import { peerJoinPushBudget } from './link-budget.js';
59
68
  //
60
69
  // RETRY, and why it backs off. A run whose PUSH FAILED — the transport threw, which is what
61
70
  // a dial or response deadline expiring looks like here — re-arms on a doubling backoff
62
- // (`retryBackoffMs` to `maxRetryBackoffMs`), and a `connection:open` arriving while that wait
71
+ // (`retryBackoffMs` to `maxRetryBackoffMs`), and a `peer:identify` arriving while that wait
63
72
  // is outstanding is DROPPED rather than collapsing it back to the debounce. Both halves are
64
73
  // load-bearing:
65
74
  //
66
75
  // - Without the re-arm, a transient push failure over a stable connection left the peer
67
76
  // partially copied until its next reconnect (read repair still covered reads meanwhile).
68
77
  // - Without dropping churn inside the wait, a peer that cannot be reached at all is
69
- // re-dialled on every `connection:open` forever. That is not hypothetical: the 2026-09-26
78
+ // re-dialled on every `peer:identify` forever. That is not hypothetical: the 2026-09-26
70
79
  // relayed reproduction shows one peer re-opening a connection about every 14.5 s for a
71
80
  // 200-second run, each event starting a catch-up whose dial could not possibly finish.
72
81
  // The connection kept re-appearing because Optimystic's own block-transfer push path
@@ -84,13 +93,13 @@ import { peerJoinPushBudget } from './link-budget.js';
84
93
  // {@link Chunk.proofs}). Re-arming on those would re-push the WHOLE store to that peer every
85
94
  // `maxRetryBackoffMs` for as long as the node runs, and report the failure below as a link
86
95
  // budget problem when nothing about the link is wrong. All three still leave the peer
87
- // un-memoized, so its next `connection:open` retries — the behaviour that predates the
96
+ // un-memoized, so its next `peer:identify` retries — the behaviour that predates the
88
97
  // backoff, and the right one for a verdict rather than a timeout. Denial in particular is
89
98
  // re-driven on purpose by `scheduleConnectedPeers()` the moment the membership commit lands,
90
99
  // because the control network's join order is connect-then-authorize.
91
100
  //
92
101
  // A re-arm is also skipped when the peer is no longer CONNECTED. This module's trigger is
93
- // `connection:open`, so a peer that went away already has one: re-arming instead would leave
102
+ // `peer:identify`, so a peer that went away already has one: re-arming instead would leave
94
103
  // a machine dialing a peer it cannot see once a minute for the rest of its uptime.
95
104
  //
96
105
  // After `PEER_JOIN_BACKFILL_WARN_AFTER_FAILURES` consecutive failures one `console.warn`
@@ -98,16 +107,25 @@ import { peerJoinPushBudget } from './link-budget.js';
98
107
  // nothing at all: the connection simply never appears and only a DEBUG log mentions a dial
99
108
  // timeout.
100
109
  //
101
- // NOTE: a failing dial to a non-speaking peer costs one dial timeout per attempt, and is
102
- // never memoized (only clean runs are). Bounded by the backoff above plus the
103
- // unreachable-peer bail in `runCatchUp` — one dial per attempt, not one per chunk. If a node
104
- // ever holds many such connections, or the enumeration ahead of the first chunk gets
105
- // expensive, pre-check `libp2p.peerStore` for this network's block-transfer protocol before
106
- // enumerating.
110
+ // NOTE: the protocol check happens once — either when a connection's `peer:identify` fires,
111
+ // or, for a peer already connected when this instance starts, when `scheduleConnectedPeers()`
112
+ // reads its protocols back from the peer store — and is never repeated once a peer is
113
+ // scheduled. A peer that stops speaking the protocol after being scheduled (should that ever
114
+ // happen) is not de-scheduled; `runCatchUp`'s own unreachable-peer bail is what would catch
115
+ // that case instead. `peer:identify` also fires on every identify-push from a connected peer
116
+ // (address or protocol changes), which only re-enters the debounce — cheap, and dropped
117
+ // outright for caught-up peers and peers inside a backoff wait.
118
+ //
119
+ // NOTE: a same-network peer whose identify never completes on a connection (the identify
120
+ // stream times out over a slow relayed link, say) is not caught up until a later identify
121
+ // succeeds — a reconnect, an identify-push, or on the control network a membership-change
122
+ // re-drive. Accepted: every db-p2p node runs identify, and read repair still covers reads
123
+ // meanwhile; if relayed links ever routinely outlast identify's timeout, raise that timeout
124
+ // in the node builder rather than scheduling unidentified peers here.
107
125
  //
108
126
  // NOTE: a peer that disconnects INSIDE a backoff wait still costs the one attempt that wait
109
127
  // was already armed for — the connectivity check is made when the re-arm is decided, not when
110
- // the timer fires, and this module subscribes to `connection:open` only. One dial, not a
128
+ // the timer fires, and this module subscribes to `peer:identify` only. One dial, not a
111
129
  // recurring one; if a node ever holds many transient peers, subscribe to `connection:close`
112
130
  // and clear the pending timer there.
113
131
  const log = debug('sereus:cadre:peer-join-backfill');
@@ -118,6 +136,17 @@ const log = debug('sereus:cadre:peer-join-backfill');
118
136
  * changes it or starts exporting it.
119
137
  */
120
138
  export const MAX_BLOCK_MESSAGE_BYTES = 8 * 1024 * 1024;
139
+ /**
140
+ * Whether an identified peer's protocol list names this network's own block-transfer
141
+ * protocol — the one gate that decides whether {@link PeerJoinBackfill} schedules a peer at
142
+ * all. A peer that lacks it (a bare circuit relay, a bootstrap node, a stranger the control
143
+ * network's inbound gate admitted without membership) cannot receive a push no matter how
144
+ * long it is dialed, since the protocol id is namespaced per network. Exported because a
145
+ * later strand peer-address ticket's identify-driven observation needs the identical test.
146
+ */
147
+ export function speaksBlockTransfer(protocols, protocolPrefix) {
148
+ return protocols.includes(buildBlockTransferProtocol(protocolPrefix));
149
+ }
121
150
  /**
122
151
  * Consecutive failed catch-up runs against ONE peer before the module says so on
123
152
  * `console.warn` rather than only in its DEBUG log. At the default backoff that is reached
@@ -159,7 +188,7 @@ function base64WireBytes(rawBytes) {
159
188
  * Best-effort throughout: nothing here throws into a libp2p event handler or into a
160
189
  * runtime bring-up; a failed chunk is logged and the run continues. A peer is marked
161
190
  * fully caught up ONLY after a run with no thrown chunk and an empty `missing` list, so
162
- * the next `connection:open` from a peer whose catch-up failed retries it.
191
+ * the next `peer:identify` from a peer whose catch-up failed retries it.
163
192
  */
164
193
  export class PeerJoinBackfill {
165
194
  constructor(deps, config) {
@@ -185,7 +214,7 @@ export class PeerJoinBackfill {
185
214
  this.failures = new Map();
186
215
  /**
187
216
  * Epoch ms before which a peer's catch-up must not be re-run, set alongside a backoff timer
188
- * that will run it. Its presence is what makes `connection:open` churn free: a schedule
217
+ * that will run it. Its presence is what makes `peer:identify` churn free: a schedule
189
218
  * arriving inside the wait is dropped, rather than collapsing the backoff to the debounce.
190
219
  */
191
220
  this.retryAfter = new Map();
@@ -195,18 +224,30 @@ export class PeerJoinBackfill {
195
224
  this.config = { ...DEFAULT_PEER_JOIN_BACKFILL, ...config };
196
225
  this.createPushClient = deps.createPushClient
197
226
  ?? ((peerId) => new BlockTransferClient(peerId, deps.peerNetwork, deps.protocolPrefix));
198
- this.onConnectionOpen = (evt) => this.schedulePeer(evt.detail.remotePeer);
227
+ this.onPeerIdentify = (evt) => {
228
+ const { peerId, protocols } = evt.detail;
229
+ if (speaksBlockTransfer(protocols, this.deps.protocolPrefix)) {
230
+ this.schedulePeer(peerId);
231
+ }
232
+ };
199
233
  }
200
- /** Subscribe to connection:open AND schedule a catch-up for peers already connected. */
234
+ /**
235
+ * Subscribe to `peer:identify` AND schedule a catch-up for already-connected peers whose
236
+ * stored protocols already name this network's block-transfer protocol — a peer that does
237
+ * not speak it (a bare circuit relay, a bootstrap node) is never scheduled at all. See
238
+ * {@link speaksBlockTransfer} and the module comment.
239
+ */
201
240
  start() {
202
241
  if (this.started || this.stopped || !this.config.enabled)
203
242
  return;
204
243
  this.started = true;
205
- this.deps.libp2p.addEventListener('connection:open', this.onConnectionOpen);
206
- // A runtime rebuilt over live connections (resumeStrand) never sees their
207
- // connection:open, so walk what is already connected once.
208
- const scheduled = this.scheduleConnectedPeers();
209
- log('[%s] started (%d peer(s) already connected)', this.deps.label, scheduled);
244
+ this.deps.libp2p.addEventListener('peer:identify', this.onPeerIdentify);
245
+ // A runtime rebuilt over live connections (resumeStrand) never sees their peer:identify —
246
+ // it already fired before this instance existed, but its result is persisted in the peer
247
+ // store — so walk what is already connected once.
248
+ void this.scheduleConnectedPeers().then((scheduled) => {
249
+ log('[%s] started (%d peer(s) already connected)', this.deps.label, scheduled);
250
+ });
210
251
  }
211
252
  /** Unsubscribe, clear timers; in-flight runs observe the stopped flag and bail. */
212
253
  stop() {
@@ -214,7 +255,7 @@ export class PeerJoinBackfill {
214
255
  return;
215
256
  this.stopped = true;
216
257
  if (this.started) {
217
- this.deps.libp2p.removeEventListener('connection:open', this.onConnectionOpen);
258
+ this.deps.libp2p.removeEventListener('peer:identify', this.onPeerIdentify);
218
259
  }
219
260
  for (const timer of this.timers.values()) {
220
261
  clearTimeout(timer);
@@ -225,28 +266,46 @@ export class PeerJoinBackfill {
225
266
  log('[%s] stopped', this.deps.label);
226
267
  }
227
268
  /**
228
- * (Re-)schedule a debounced catch-up for every currently-connected peer not yet caught
229
- * up. Idempotent and cheap (caught-up peers are skipped before any timer is set, and a
230
- * peer whose run is in flight is deferred to the end of that run rather than dropped).
231
- * Driven by {@link start}, and — on a gated network — by the embedder whenever
232
- * membership changes, so a peer whose first pass was denied (connected before it was
233
- * authorized: the production join order) is retried without waiting for a reconnect.
234
- * Returns how many distinct peers were considered (for the start() log) — a peer holding
235
- * several connections is one peer, and is scheduled once.
269
+ * (Re-)schedule a debounced catch-up for every currently-connected peer whose protocols, as
270
+ * already stored in the libp2p peer store, name this network's block-transfer protocol. A
271
+ * peer not yet in the peer store — its identify has not finished — is left to the
272
+ * `peer:identify` handler rather than dialed blind; one whose stored protocols are known
273
+ * and lack ours is skipped outright. Idempotent and cheap otherwise (caught-up peers are
274
+ * skipped before any timer is set, and a peer whose run is in flight is deferred to the end
275
+ * of that run rather than dropped). Driven by {@link start}, and — on a gated network — by
276
+ * the embedder whenever membership changes, so a peer whose first pass was denied (connected
277
+ * before it was authorized: the production join order) is retried without waiting for a
278
+ * reconnect. Returns how many distinct peers were considered (for the start() log) — a peer
279
+ * holding several connections is one peer, and is scheduled once.
236
280
  */
237
- scheduleConnectedPeers() {
281
+ async scheduleConnectedPeers() {
238
282
  if (this.stopped)
239
283
  return 0;
240
- const peers = new Set();
284
+ const peers = new Map();
241
285
  for (const connection of this.deps.libp2p.getConnections()) {
242
- const key = connection.remotePeer.toString();
243
- if (peers.has(key))
244
- continue;
245
- peers.add(key);
246
- this.schedulePeer(connection.remotePeer);
286
+ peers.set(connection.remotePeer.toString(), connection.remotePeer);
247
287
  }
288
+ await Promise.all([...peers.values()].map((peerId) => this.scheduleIfKnownToSpeak(peerId)));
248
289
  return peers.size;
249
290
  }
291
+ /** Schedules `peerId` only if the peer store already knows it speaks this network's protocol. */
292
+ async scheduleIfKnownToSpeak(peerId) {
293
+ let protocols;
294
+ try {
295
+ ({ protocols } = await this.deps.libp2p.peerStore.get(peerId));
296
+ }
297
+ catch (error) {
298
+ // NotFoundError: identify has not finished. Leave it to the `peer:identify` handler
299
+ // rather than dialing blind. Anything else is unexpected — log it and skip the peer.
300
+ if (error.name !== 'NotFoundError') {
301
+ log('[%s] peer store read for %s failed — not scheduling: %o', this.deps.label, peerId.toString(), error);
302
+ }
303
+ return;
304
+ }
305
+ if (speaksBlockTransfer(protocols, this.deps.protocolPrefix)) {
306
+ this.schedulePeer(peerId);
307
+ }
308
+ }
250
309
  /** Debounced entry point for connection churn: one run per peer per settle window. */
251
310
  schedulePeer(peerId) {
252
311
  const key = peerId.toString();
@@ -260,7 +319,7 @@ export class PeerJoinBackfill {
260
319
  }
261
320
  // A peer whose last run failed is already re-armed on a backoff timer that will run it, so
262
321
  // DROP this schedule instead of shortening the wait — otherwise a peer that cannot be
263
- // reached is re-dialled on every connection:open forever (see the module comment's retry
322
+ // reached is re-dialled on every peer:identify forever (see the module comment's retry
264
323
  // paragraph). A denied run never gets here: it does not set a backoff.
265
324
  const retryAt = this.retryAfter.get(key);
266
325
  if (retryAt !== undefined && Date.now() < retryAt)
@@ -302,7 +361,7 @@ export class PeerJoinBackfill {
302
361
  // rejection are all verdicts a retry cannot change, and re-arming on them would
303
362
  // re-push the whole store to that peer forever. See the module comment.
304
363
  //
305
- // Gated on `started` too: the re-arm exists to REPLACE a connection:open-driven retry,
364
+ // Gated on `started` too: the re-arm exists to REPLACE a peer:identify-driven retry,
306
365
  // so a caller driving `catchUpPeer` by hand against a backfill that was never started
307
366
  // owns its own retry policy and must not be left holding a background timer.
308
367
  this.scheduleRetryWithBackoff(peerId);
@@ -332,7 +391,7 @@ export class PeerJoinBackfill {
332
391
  /**
333
392
  * Re-arm one peer's catch-up after a run whose push failed, on a wait that doubles
334
393
  * per consecutive failure up to `maxRetryBackoffMs`. Sets {@link retryAfter} alongside the
335
- * timer, which is what makes `connection:open` churn inside the wait free.
394
+ * timer, which is what makes `peer:identify` churn inside the wait free.
336
395
  */
337
396
  scheduleRetryWithBackoff(peerId) {
338
397
  const key = peerId.toString();
@@ -1 +1 @@
1
- {"version":3,"file":"peer-join-backfill.js","sourceRoot":"","sources":["../src/peer-join-backfill.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,EAAE,mBAAmB,EAA2C,MAAM,oBAAoB,CAAC;AAClG,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAEtD,sFAAsF;AACtF,0FAA0F;AAC1F,qFAAqF;AACrF,0FAA0F;AAC1F,0FAA0F;AAC1F,yFAAyF;AACzF,yFAAyF;AACzF,EAAE;AACF,wFAAwF;AACxF,iFAAiF;AACjF,0FAA0F;AAC1F,uFAAuF;AACvF,0FAA0F;AAC1F,sBAAsB;AACtB,EAAE;AACF,2FAA2F;AAC3F,wFAAwF;AACxF,oBAAoB;AACpB,EAAE;AACF,gFAAgF;AAChF,uBAAuB;AACvB,EAAE;AACF,2FAA2F;AAC3F,2FAA2F;AAC3F,0FAA0F;AAC1F,2FAA2F;AAC3F,2FAA2F;AAC3F,4EAA4E;AAC5E,sFAAsF;AACtF,kFAAkF;AAClF,gFAAgF;AAChF,iFAAiF;AACjF,wFAAwF;AACxF,yFAAyF;AACzF,wFAAwF;AACxF,wFAAwF;AACxF,uEAAuE;AACvE,oFAAoF;AACpF,oFAAoF;AACpF,EAAE;AACF,wEAAwE;AACxE,yFAAyF;AACzF,wFAAwF;AACxF,wFAAwF;AACxF,0FAA0F;AAC1F,0FAA0F;AAC1F,+EAA+E;AAC/E,0FAA0F;AAC1F,EAAE;AACF,kFAAkF;AAClF,6FAA6F;AAC7F,gGAAgG;AAChG,yFAAyF;AACzF,+EAA+E;AAC/E,0FAA0F;AAC1F,EAAE;AACF,4FAA4F;AAC5F,uFAAuF;AACvF,8FAA8F;AAC9F,4FAA4F;AAC5F,gBAAgB;AAChB,EAAE;AACF,wFAAwF;AACx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AAO,EAAE,MAAM,CAAC,GAAG,CAAC,CAAC;YAC/D,IAAI,KAAK,EAAE,CAAC;gBACV,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,GAAG,KAAK,CAAC;YAChC,CAAC;YACD,KAAK,CAAC,KAAK,IAAI,MAAM,CAAC,MAAM,CAAC;YAC7B,MAAM,CAAC,OAAO,IAAI,CAAC,CAAC;QACtB,CAAC;QAED,IAAI,CAAC,IAAI,CAAC,OAAO,IAAI,CAAC,eAAe,EAAE,EAAE,CAAC;YACxC,MAAM,KAAK,EAAE,CAAC;QAChB,CAAC;QAED,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACtB,GAAG,CAAC,yEAAyE,EAC3E,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE,MAAM,CAAC,QAAQ,EAAE,EAAE,IAAI,CAAC,MAAM,CAAC,SAAS,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC;QAC9E,CAAC;QAED,MAAM,KAAK,GAAG,CAAC,WAAW,IAAI,MAAM,CAAC,QAAQ,CAAC,MAAM,KAAK,CAAC,CAAC;QAC3D,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,CAAC;IACpD,CAAC;CACF"}
@@ -1,5 +1,7 @@
1
1
  import type { PrivateKey } from '@libp2p/interface';
2
2
  import { type PeerJoinBackfillConfig } from './peer-join-backfill.js';
3
+ import { type StrandPeerObservation } from './strand-peer-observer.js';
4
+ import type { StrandPeerBookStore } from './strand-peer-book.js';
3
5
  import { type StrandRevocationEnforcementConfig } from './strand-revocation-enforcer.js';
4
6
  import { type PendingMembershipInviteSource, type StrandMembershipReconciliationConfig } from './strand-membership-reconciler.js';
5
7
  import { type StrandFirstSyncConfig } from './strand-first-sync-gate.js';
@@ -200,6 +202,26 @@ export interface StartStrandConfig {
200
202
  * hibernation wake's rebuilt supervisors carry it too.
201
203
  */
202
204
  announceDelegateToRelay?: (strandId: string, relayAddr: string, delegatePeerId: string) => Promise<void>;
205
+ /**
206
+ * Called when the strand's libp2p node identifies a STRAND peer — one whose
207
+ * identify result names this strand's block-transfer protocol, so never the
208
+ * circuit relay or a bootstrap node — with the addresses it is dialable at
209
+ * (`strand-peer-observer.ts`). Throttled per peer; must not throw. `CadreNode`
210
+ * wires it to the node-local strand peer book, which is what lets a restarted
211
+ * machine dial the peers it was talking to. Absent ⇒ nothing is observed.
212
+ * Retained with the launch config, so a hibernation wake re-arms it on the
213
+ * rebuilt node.
214
+ */
215
+ onStrandPeerIdentified?: (strandId: string, observation: StrandPeerObservation) => void;
216
+ /**
217
+ * The node-local strand peer book the book SWAP reads and writes
218
+ * (`strand-peer-book-swap.ts`): the strand node signs its own addresses with
219
+ * {@link privateKey}, exchanges signed entries with every strand peer it identifies,
220
+ * and files what verifies. Absent ⇒ no swap runs — a peer that dials this node's
221
+ * swap handler gets no answer. `CadreNode` passes its book store. Retained with the
222
+ * launch config, so a hibernation wake re-arms the swap on the rebuilt node.
223
+ */
224
+ strandPeerBook?: StrandPeerBookStore;
203
225
  }
204
226
  /**
205
227
  * Volatile inputs re-resolved when resuming a quiesced strand — the ones that can
@@ -259,6 +281,23 @@ export declare class StrandInstanceManager {
259
281
  * missed writes).
260
282
  */
261
283
  private backfills;
284
+ /**
285
+ * The per-strand peer-book observation writer (`strand-peer-observer.ts`), keyed
286
+ * by strand id. Same lifecycle rationale as {@link backfills}: started in
287
+ * `buildStrandRuntime` right after the libp2p node exists, stopped and dropped in
288
+ * `releaseRuntime`, so quiesce → resume re-arms it on the rebuilt node. Only
289
+ * present when the launch config supplied `onStrandPeerIdentified`.
290
+ */
291
+ private peerObservers;
292
+ /**
293
+ * Per-strand strand peer book SWAP driver ({@link StrandPeerBookSwap}) — the signed
294
+ * exchange of book entries between strand peers. Same lifetime as the peer-book
295
+ * observer above: armed in `buildStrandRuntime` right after the libp2p node exists
296
+ * (its protocol handler must be registered before an early peer dials it), stopped
297
+ * and dropped in `releaseRuntime`. Only present when the launch config supplied
298
+ * `strandPeerBook`.
299
+ */
300
+ private peerBookSwaps;
262
301
  /**
263
302
  * The per-strand revoked-peer enforcer (closed strands only), keyed by strand
264
303
  * id. Same lifecycle rationale as {@link backfills}: created in
@@ -3,6 +3,8 @@ import { createLibp2pNode } from '@optimystic/db-p2p';
3
3
  import { wrapStorageWithCache, disposeStorageCache } from '@serfab/quereus-plugin-sereus';
4
4
  import { StrandDatabase } from './strand-database.js';
5
5
  import { PeerJoinBackfill } from './peer-join-backfill.js';
6
+ import { StrandPeerObserver } from './strand-peer-observer.js';
7
+ import { StrandPeerBookSwap } from './strand-peer-book-swap.js';
6
8
  import { StrandRevocationEnforcer, createRevocationConnectionGater, readStrandRevocationRows } from './strand-revocation-enforcer.js';
7
9
  import { StrandMembershipReconciler } from './strand-membership-reconciler.js';
8
10
  import { removeMemberPeer } from './strand-membership-writer.js';
@@ -119,6 +121,23 @@ export class StrandInstanceManager {
119
121
  * missed writes).
120
122
  */
121
123
  this.backfills = new Map();
124
+ /**
125
+ * The per-strand peer-book observation writer (`strand-peer-observer.ts`), keyed
126
+ * by strand id. Same lifecycle rationale as {@link backfills}: started in
127
+ * `buildStrandRuntime` right after the libp2p node exists, stopped and dropped in
128
+ * `releaseRuntime`, so quiesce → resume re-arms it on the rebuilt node. Only
129
+ * present when the launch config supplied `onStrandPeerIdentified`.
130
+ */
131
+ this.peerObservers = new Map();
132
+ /**
133
+ * Per-strand strand peer book SWAP driver ({@link StrandPeerBookSwap}) — the signed
134
+ * exchange of book entries between strand peers. Same lifetime as the peer-book
135
+ * observer above: armed in `buildStrandRuntime` right after the libp2p node exists
136
+ * (its protocol handler must be registered before an early peer dials it), stopped
137
+ * and dropped in `releaseRuntime`. Only present when the launch config supplied
138
+ * `strandPeerBook`.
139
+ */
140
+ this.peerBookSwaps = new Map();
122
141
  /**
123
142
  * The per-strand revoked-peer enforcer (closed strands only), keyed by strand
124
143
  * id. Same lifecycle rationale as {@link backfills}: created in
@@ -454,6 +473,46 @@ export class StrandInstanceManager {
454
473
  });
455
474
  timing('[buildStrandRuntime:%s] createLibp2pNode: %dms', strandId, Math.round(performance.now() - t0));
456
475
  instance.libp2pNode = node;
476
+ // The peer-book observation writer, armed BEFORE the database bring-up below
477
+ // (unlike the backfill) because the bootstrap dials that follow `libp2p.start()`
478
+ // land during that bring-up, and they are exactly the peers worth remembering:
479
+ // identify for an early peer may already have fired by the time anything after
480
+ // the database initializes runs. Registered in the map immediately so the
481
+ // failure rollback (releaseRuntime) stops it like every other runtime component.
482
+ const onStrandPeerIdentified = config.onStrandPeerIdentified;
483
+ if (onStrandPeerIdentified) {
484
+ const observer = new StrandPeerObserver({
485
+ label: strandId,
486
+ libp2p: node,
487
+ protocolPrefix,
488
+ onObserved: (observation) => onStrandPeerIdentified(strandId, observation)
489
+ });
490
+ this.peerObservers.set(strandId, observer);
491
+ observer.start();
492
+ }
493
+ // The strand peer book SWAP, armed at the same moment and for the same reason as
494
+ // the observer: a peer that dials this node's swap handler before it is registered
495
+ // fails its exchange and sits out a ten-minute throttle. The own entry is signed
496
+ // now and re-signed on every address change, which covers the relay reservation
497
+ // landing below (`self:peer:update` fires when the circuit addr is added), so no
498
+ // separate post-relay step is needed. Registered in the map immediately so the
499
+ // failure rollback (releaseRuntime) stops it like every other runtime component.
500
+ //
501
+ // NOTE: this is a third `peer:identify` listener per running strand, beside the
502
+ // observer's and the backfill's — see the backfill's NOTE below for when to fold
503
+ // them into one dispatcher.
504
+ if (config.strandPeerBook) {
505
+ const swap = new StrandPeerBookSwap({
506
+ strandId,
507
+ libp2p: node,
508
+ protocolPrefix,
509
+ store: config.strandPeerBook,
510
+ privateKey: config.privateKey,
511
+ linkRoundTripMs: config.network?.linkRoundTripMs
512
+ });
513
+ this.peerBookSwaps.set(strandId, swap);
514
+ swap.start();
515
+ }
457
516
  // One reservation supervisor PER RELAY, started now so the first attempts
458
517
  // overlap the database bring-up below (the relay is never in a strand's
459
518
  // Optimystic cohort — its protocol ids are namespaced `/optimystic/strand-<id>/…`
@@ -566,7 +625,7 @@ export class StrandInstanceManager {
566
625
  // peer-join-backfill.ts for the strand-side argument (and why the control
567
626
  // network, which DOES gate, is different).
568
627
  //
569
- // NOTE: cost is one PeerJoinBackfill object + one `connection:open` listener
628
+ // NOTE: cost is one PeerJoinBackfill object + one `peer:identify` listener
570
629
  // per running strand — linear in strand count, negligible at the handful a
571
630
  // device or host runs today. If a node ever hosts strands by the hundred,
572
631
  // move to one shared listener that dispatches by strand id.
@@ -661,6 +720,20 @@ export class StrandInstanceManager {
661
720
  backfill.stop();
662
721
  this.backfills.delete(instance.strandId);
663
722
  }
723
+ // The peer-book observer goes with the node it listened on; a resume re-arms
724
+ // one on the rebuilt node.
725
+ const peerObserver = this.peerObservers.get(instance.strandId);
726
+ if (peerObserver) {
727
+ peerObserver.stop();
728
+ this.peerObservers.delete(instance.strandId);
729
+ }
730
+ // The book swap likewise: unsubscribed and its handler unregistered while the node is
731
+ // still up; a resume re-arms one, which re-signs the own entry over the new addresses.
732
+ const peerBookSwap = this.peerBookSwaps.get(instance.strandId);
733
+ if (peerBookSwap) {
734
+ this.peerBookSwaps.delete(instance.strandId);
735
+ await peerBookSwap.stop();
736
+ }
664
737
  // The revoked-peer enforcer goes with the runtime it gated: a resume
665
738
  // rebuilds it with a fresh (initially empty, fail-open) snapshot.
666
739
  const revocationEnforcer = this.revocationEnforcers.get(instance.strandId);