@serfab/cadre-core 1.8.0 → 1.10.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 (126) hide show
  1. package/dist/cadre-node.d.ts +301 -121
  2. package/dist/cadre-node.js +588 -244
  3. package/dist/cadre-node.js.map +1 -1
  4. package/dist/control-authorization.d.ts +2 -2
  5. package/dist/control-authorization.js +1 -0
  6. package/dist/control-authorization.js.map +1 -1
  7. package/dist/control-cohort.d.ts +1 -1
  8. package/dist/control-cohort.js +1 -1
  9. package/dist/control-database.d.ts +105 -14
  10. package/dist/control-database.js +242 -73
  11. package/dist/control-database.js.map +1 -1
  12. package/dist/control-formation-recorder.d.ts +6 -6
  13. package/dist/control-formation-recorder.js +7 -8
  14. package/dist/control-formation-recorder.js.map +1 -1
  15. package/dist/control-schema.d.ts +1 -1
  16. package/dist/control-schema.js +90 -3
  17. package/dist/control-schema.js.map +1 -1
  18. package/dist/control-write-retry.d.ts +21 -15
  19. package/dist/control-write-retry.js +21 -15
  20. package/dist/control-write-retry.js.map +1 -1
  21. package/dist/index.d.ts +7 -7
  22. package/dist/index.js +16 -13
  23. package/dist/index.js.map +1 -1
  24. package/dist/invitation-bootstrap.d.ts +32 -0
  25. package/dist/invitation-bootstrap.js +30 -0
  26. package/dist/invitation-bootstrap.js.map +1 -0
  27. package/dist/link-budget.d.ts +204 -119
  28. package/dist/link-budget.js +208 -120
  29. package/dist/link-budget.js.map +1 -1
  30. package/dist/membership-connection-gater.d.ts +3 -3
  31. package/dist/membership-connection-gater.js +3 -3
  32. package/dist/node-local-snapshot.d.ts +6 -4
  33. package/dist/node-local-snapshot.js +7 -3
  34. package/dist/node-local-snapshot.js.map +1 -1
  35. package/dist/peer-dial.d.ts +18 -14
  36. package/dist/peer-dial.js +18 -14
  37. package/dist/peer-dial.js.map +1 -1
  38. package/dist/peer-join-backfill.d.ts +3 -12
  39. package/dist/peer-join-backfill.js +2 -3
  40. package/dist/peer-join-backfill.js.map +1 -1
  41. package/dist/pending-join-runner.d.ts +186 -0
  42. package/dist/pending-join-runner.js +649 -0
  43. package/dist/pending-join-runner.js.map +1 -0
  44. package/dist/push-fanout.d.ts +1 -1
  45. package/dist/push-fanout.js +1 -1
  46. package/dist/seed-bootstrap.d.ts +2 -2
  47. package/dist/seed-bootstrap.js +1 -1
  48. package/dist/strand-addr-protocol.js +2 -2
  49. package/dist/strand-formation-deadlines.d.ts +5 -5
  50. package/dist/strand-formation-deadlines.js +5 -5
  51. package/dist/strand-formation-manager.d.ts +18 -4
  52. package/dist/strand-formation-manager.js +48 -33
  53. package/dist/strand-formation-manager.js.map +1 -1
  54. package/dist/strand-formation-protocol.d.ts +71 -25
  55. package/dist/strand-formation-protocol.js +225 -51
  56. package/dist/strand-formation-protocol.js.map +1 -1
  57. package/dist/strand-formation-rejection.d.ts +94 -0
  58. package/dist/strand-formation-rejection.js +77 -0
  59. package/dist/strand-formation-rejection.js.map +1 -0
  60. package/dist/strand-fret-addrs.d.ts +54 -0
  61. package/dist/strand-fret-addrs.js +108 -0
  62. package/dist/strand-fret-addrs.js.map +1 -0
  63. package/dist/strand-instance-manager.d.ts +9 -38
  64. package/dist/strand-instance-manager.js +17 -74
  65. package/dist/strand-instance-manager.js.map +1 -1
  66. package/dist/strand-network-state-file.d.ts +12 -0
  67. package/dist/strand-network-state-file.js +38 -0
  68. package/dist/strand-network-state-file.js.map +1 -0
  69. package/dist/strand-network-state.d.ts +111 -0
  70. package/dist/strand-network-state.js +191 -0
  71. package/dist/strand-network-state.js.map +1 -0
  72. package/dist/strand-solicitation.d.ts +11 -3
  73. package/dist/strand-solicitation.js +9 -0
  74. package/dist/strand-solicitation.js.map +1 -1
  75. package/dist/types.d.ts +123 -40
  76. package/dist/types.js +5 -9
  77. package/dist/types.js.map +1 -1
  78. package/package.json +25 -24
  79. package/src/cadre-node.ts +637 -251
  80. package/src/control-authorization.ts +117 -116
  81. package/src/control-cohort.ts +1 -1
  82. package/src/control-database.ts +303 -82
  83. package/src/control-formation-recorder.ts +8 -9
  84. package/src/control-schema.ts +90 -3
  85. package/src/control-write-retry.ts +21 -15
  86. package/src/index.ts +36 -56
  87. package/src/invitation-bootstrap.ts +40 -0
  88. package/src/link-budget.ts +221 -120
  89. package/src/membership-connection-gater.ts +3 -3
  90. package/src/node-local-snapshot.ts +12 -7
  91. package/src/peer-dial.ts +18 -14
  92. package/src/peer-join-backfill.ts +5 -6
  93. package/src/pending-join-runner.ts +735 -0
  94. package/src/push-fanout.ts +1 -1
  95. package/src/seed-bootstrap.ts +2 -2
  96. package/src/strand-addr-protocol.ts +2 -2
  97. package/src/strand-formation-deadlines.ts +5 -5
  98. package/src/strand-formation-manager.ts +62 -37
  99. package/src/strand-formation-protocol.ts +1036 -803
  100. package/src/strand-formation-rejection.ts +129 -0
  101. package/src/strand-fret-addrs.ts +145 -0
  102. package/src/strand-instance-manager.ts +24 -97
  103. package/src/strand-network-state-file.ts +40 -0
  104. package/src/strand-network-state.ts +243 -0
  105. package/src/strand-solicitation.ts +17 -4
  106. package/src/types.ts +119 -40
  107. package/dist/strand-peer-book-file.d.ts +0 -12
  108. package/dist/strand-peer-book-file.js +0 -37
  109. package/dist/strand-peer-book-file.js.map +0 -1
  110. package/dist/strand-peer-book-protocol.d.ts +0 -168
  111. package/dist/strand-peer-book-protocol.js +0 -356
  112. package/dist/strand-peer-book-protocol.js.map +0 -1
  113. package/dist/strand-peer-book-swap.d.ts +0 -104
  114. package/dist/strand-peer-book-swap.js +0 -284
  115. package/dist/strand-peer-book-swap.js.map +0 -1
  116. package/dist/strand-peer-book.d.ts +0 -159
  117. package/dist/strand-peer-book.js +0 -361
  118. package/dist/strand-peer-book.js.map +0 -1
  119. package/dist/strand-peer-observer.d.ts +0 -88
  120. package/dist/strand-peer-observer.js +0 -180
  121. package/dist/strand-peer-observer.js.map +0 -1
  122. package/src/strand-peer-book-file.ts +0 -39
  123. package/src/strand-peer-book-protocol.ts +0 -466
  124. package/src/strand-peer-book-swap.ts +0 -338
  125. package/src/strand-peer-book.ts +0 -475
  126. package/src/strand-peer-observer.ts +0 -235
@@ -19,27 +19,18 @@
19
19
  */
20
20
  import type { Libp2p } from '@libp2p/interface';
21
21
  import type { StrandFormationDisclosure, StrandMembershipInvite } from './types.js';
22
+ import { type FormationRejectionCode } from './strand-formation-rejection.js';
22
23
  /** Protocol id for the native formation transport (parallel to `/sereus/seed/1.0.0`). */
23
24
  export declare const FORMATION_PROTOCOL = "/sereus/formation/1.0.0";
24
25
  /**
25
- * Rejection reason for an invitation that cannot be redeemed at all — unknown, expired, or
26
- * fully spent. Shared with `StrandFormationManager`, which reports an
27
- * `InvitationExhaustedError` (an invite spent out from under a redemption already in flight)
28
- * with this SAME wording on purpose: a joiner that lost the race must be indistinguishable
29
- * from a non-racing latecomer, so the two sites must never drift apart.
26
+ * Rejection reason for an invitation that cannot be redeemed — unknown here
27
+ * (`'token-unknown'`), or expired or fully spent (`'token-spent'`); the code tells them
28
+ * apart. Shared with `StrandFormationManager`, which reports an `InvitationExhaustedError`
29
+ * (an invite spent out from under a redemption already in flight) with this SAME wording and
30
+ * code on purpose: a joiner that lost the race must be indistinguishable from a non-racing
31
+ * latecomer, so the two sites must never drift apart.
30
32
  */
31
33
  export declare const INVALID_TOKEN_REASON = "Invalid token";
32
- /**
33
- * Cap on the strand-network addresses a formation result carries
34
- * ({@link FormationResultMessage.strandAddrs}). A node's own strand multiaddrs are a
35
- * handful of entries (one per listen transport, plus a circuit-relay reservation), so
36
- * 16 is generous for the honest case while keeping the result frame bounded against a
37
- * peer that would pad it — either direction, since both sides run the list through
38
- * {@link sanitizeStrandAddrs}. Exported because the same bound has to hold on the
39
- * initiator's stored copy: `CadreNode` accumulates across repeat formations against one
40
- * strand, so it caps the accumulation rather than only each arriving list.
41
- */
42
- export declare const MAX_STRAND_ADDRS = 16;
43
34
  export type FormationParty = 'initiator' | 'responder';
44
35
  export interface FormationStrandInfo {
45
36
  strandId: string;
@@ -83,9 +74,23 @@ export interface FormationProvisionResult {
83
74
  export type ResponderProvisionOutcome = {
84
75
  approved: true;
85
76
  result: FormationProvisionResult;
86
- } | {
77
+ } | FormationRejection;
78
+ /**
79
+ * A refusal as the responder sends it: never without a code. Carries nothing else — no
80
+ * identity, addresses or keys — so a rejection discloses nothing about the responder.
81
+ */
82
+ export interface FormationRejection {
87
83
  approved: false;
84
+ code: FormationRejectionCode;
85
+ /** Human-facing text for logs; joiners branch on `code`. */
88
86
  reason: string;
87
+ }
88
+ /** What the responder's token check yields; an invalid token names which way it failed. */
89
+ export type FormationTokenCheck = {
90
+ valid: true;
91
+ } | {
92
+ valid: false;
93
+ code: Extract<FormationRejectionCode, 'token-unknown' | 'token-spent'>;
89
94
  };
90
95
  /** Initiator → Responder: carries the real token + disclosure + initiator cadre. */
91
96
  export interface FormationContactMessage {
@@ -113,7 +118,13 @@ export interface FormationContactMessage {
113
118
  /** Responder → Initiator: responder identity/cadre disclosed only after validation. */
114
119
  export interface FormationResultMessage {
115
120
  approved: boolean;
116
- /** Present iff `approved === false`. */
121
+ /**
122
+ * Why the responder refused; present iff `approved === false`. Optional on this wire type
123
+ * only because a frame from another version may omit it — the responder always sends one
124
+ * ({@link FormationRejection}), and the joiner reads a missing one as `'unrecognized'`.
125
+ */
126
+ code?: FormationRejectionCode;
127
+ /** Human-facing text; present iff `approved === false`. */
117
128
  reason?: string;
118
129
  /** Responder's real party id (disclosed only after validation). */
119
130
  partyId?: string;
@@ -173,10 +184,8 @@ export declare function isWellFormedMembershipInvite(value: unknown): value is S
173
184
  */
174
185
  export declare function isValidResponderCreatesResult(response: FormationResultMessage): boolean;
175
186
  export interface FormationListenerOptions {
176
- /** Validate the invitation token; returns whether it is valid. */
177
- validateToken(token: string): Promise<{
178
- valid: boolean;
179
- }>;
187
+ /** Validate the invitation token; an invalid one says whether it is unknown here or spent. */
188
+ validateToken(token: string): Promise<FormationTokenCheck>;
180
189
  /** Validate the initiator's disclosure with the REAL token + disclosure. */
181
190
  validateDisclosure(token: string, disclosure: StrandFormationDisclosure): Promise<boolean>;
182
191
  /**
@@ -279,8 +288,10 @@ export declare class FormationListener {
279
288
  * ({@link formationDeadlines}), which is exactly what runs after the insert attempt passes
280
289
  * its abort check, so at that link the late outcome lands inside it.
281
290
  *
282
- * NOTE: a commit that outlasts even the derived grace (a link slower than declared, or a
283
- * configured `provisionTimeoutMs` whose half-cap shrank the grace) still tells the joiner
291
+ * NOTE: a commit that outlasts even the derived grace (a link slower than declared, a
292
+ * configured `provisionTimeoutMs` whose half-cap shrank the grace, or a commit phase that
293
+ * re-picks an unanswering coordinator, which Optimystic lets run to its transaction budget,
294
+ * 170 s at the default declared link) still tells the joiner
284
295
  * 'timed out' while its one-time invite is in fact spent, and since every retry mints a
285
296
  * fresh keypair no recovery path can match it. Nothing can un-spend an append-only row, so
286
297
  * the late-settle logging below is the observability for it; if it is seen in the wild,
@@ -313,7 +324,21 @@ export declare class FormationListener {
313
324
  export interface FormationDialOptions {
314
325
  /** The contact message to send (real token, partyId, disclosure, initiator cadre). */
315
326
  contact: FormationContactMessage;
316
- /** Responder multiaddrs to dial. */
327
+ /**
328
+ * Responder multiaddrs to dial, normally the invitation's bootstrap list. Every entry that
329
+ * parses is tried, in the order libp2p's default address sorter picks (loopback last, then
330
+ * public before private, then circuit after direct), until one connects, all under one
331
+ * dial-connect budget (`dialTimeoutMs`); an entry that does not parse is skipped.
332
+ *
333
+ * {@link dialFormation} dials ONE machine, so every entry must name the same trailing peer
334
+ * id (or none). An invitation names several machines of the inviting party; hand it to
335
+ * {@link dialFormationByMachine}, which splits the list by trailing peer id, drops entries
336
+ * that name no peer, and runs one {@link dialFormation} session per machine, in the order
337
+ * each machine first appears. Each session keeps its own deadline ladder, so a machine that
338
+ * cannot be dialled costs one `dialTimeoutMs` and one that accepts the contact and then
339
+ * stalls costs up to one `sessionTimeoutMs`; `CadreNode.createOpenInvitation` names at most
340
+ * four machines.
341
+ */
317
342
  responderAddrs: string[];
318
343
  /** Validate the responder's result; a false return aborts the formation. */
319
344
  validateResponse(response: FormationResultMessage): Promise<boolean>;
@@ -361,5 +386,26 @@ export interface FormationDialResult {
361
386
  * contact (carrying the real disclosure/token/cadre), validates the responder's
362
387
  * result, and returns the strand the responder provisioned plus the responder's
363
388
  * strand-network addresses (see {@link FormationDialResult}).
389
+ *
390
+ * Throws {@link FormationUnreachableError} for every failure before a result frame is read
391
+ * (including the session deadline passing first), {@link FormationRejectedError} when the
392
+ * responder refuses, and a plain `Error` for an approval that fails validation.
364
393
  */
365
394
  export declare function dialFormation(node: Libp2p, options: FormationDialOptions): Promise<FormationDialResult>;
395
+ /**
396
+ * Initiator side for a whole invitation: one {@link dialFormation} session per machine of the
397
+ * inviting party the bootstrap list names (see {@link FormationDialOptions.responderAddrs}), in
398
+ * order, until one approves.
399
+ *
400
+ * A machine that cannot be reached, or that refuses retryably, hands over to the next. A final
401
+ * refusal, or an approval that fails validation, is thrown at once: another machine of the
402
+ * same party would answer the same, and an approval may already have spent the invitation.
403
+ * With no machine left, throws the last retryable refusal when any machine answered (the party
404
+ * is reachable but not ready, which says more than "unreachable"), otherwise one
405
+ * {@link FormationUnreachableError} naming each machine's failure.
406
+ *
407
+ * Every session sends the SAME contact. `FormationUsage` is keyed by the contact's
408
+ * `usageStampId`, so at most one machine of the inviting party can record this redemption,
409
+ * even when one the joiner gave up on was still committing it.
410
+ */
411
+ export declare function dialFormationByMachine(node: Libp2p, options: FormationDialOptions): Promise<FormationDialResult>;
@@ -26,16 +26,19 @@ import { verifyFormationConsent } from './peer-authorization.js';
26
26
  // seed-bootstrap imports neither this protocol nor the manager/solicitation layers,
27
27
  // so this import introduces no cycle.
28
28
  import { ed25519PublicKeyB64FromPeerId } from './seed-bootstrap.js';
29
+ import { trailingPeerId } from './peer-record.js';
29
30
  import { formationDeadlines, resolveProvisionTimeoutMs, responderClampReserveMs, splitProvisionBudget } from './strand-formation-deadlines.js';
31
+ import { FormationRejectedError, FormationUnreachableError } from './strand-formation-rejection.js';
30
32
  const log = debug('sereus:cadre:formation-proto');
31
33
  /** Protocol id for the native formation transport (parallel to `/sereus/seed/1.0.0`). */
32
34
  export const FORMATION_PROTOCOL = '/sereus/formation/1.0.0';
33
35
  /**
34
- * Rejection reason for an invitation that cannot be redeemed at all — unknown, expired, or
35
- * fully spent. Shared with `StrandFormationManager`, which reports an
36
- * `InvitationExhaustedError` (an invite spent out from under a redemption already in flight)
37
- * with this SAME wording on purpose: a joiner that lost the race must be indistinguishable
38
- * from a non-racing latecomer, so the two sites must never drift apart.
36
+ * Rejection reason for an invitation that cannot be redeemed — unknown here
37
+ * (`'token-unknown'`), or expired or fully spent (`'token-spent'`); the code tells them
38
+ * apart. Shared with `StrandFormationManager`, which reports an `InvitationExhaustedError`
39
+ * (an invite spent out from under a redemption already in flight) with this SAME wording and
40
+ * code on purpose: a joiner that lost the race must be indistinguishable from a non-racing
41
+ * latecomer, so the two sites must never drift apart.
39
42
  */
40
43
  export const INVALID_TOKEN_REASON = 'Invalid token';
41
44
  /** Maximum formation message size (1MB). */
@@ -58,11 +61,10 @@ const DEFAULT_MAX_CONCURRENT_SESSIONS = 100;
58
61
  * handful of entries (one per listen transport, plus a circuit-relay reservation), so
59
62
  * 16 is generous for the honest case while keeping the result frame bounded against a
60
63
  * peer that would pad it — either direction, since both sides run the list through
61
- * {@link sanitizeStrandAddrs}. Exported because the same bound has to hold on the
62
- * initiator's stored copy: `CadreNode` accumulates across repeat formations against one
63
- * strand, so it caps the accumulation rather than only each arriving list.
64
+ * {@link sanitizeStrandAddrs}. The initiator's kept copy is one arriving list, replaced by
65
+ * the next formation against the same strand, so the same bound holds there.
64
66
  */
65
- export const MAX_STRAND_ADDRS = 16;
67
+ const MAX_STRAND_ADDRS = 16;
66
68
  /**
67
69
  * Normalize a strand-address list arriving from — or heading to — the wire: keep only
68
70
  * parsable multiaddr strings, drop duplicates, and cap at {@link MAX_STRAND_ADDRS}.
@@ -260,7 +262,7 @@ export class FormationListener {
260
262
  }
261
263
  async handleStream(stream) {
262
264
  if (this.activeSessions >= this.maxConcurrentSessions) {
263
- const rejection = { approved: false, reason: 'Too many concurrent formation sessions' };
265
+ const rejection = { approved: false, code: 'busy', reason: 'Too many concurrent formation sessions' };
264
266
  try {
265
267
  writeFrame(stream, rejection);
266
268
  }
@@ -326,8 +328,10 @@ export class FormationListener {
326
328
  * ({@link formationDeadlines}), which is exactly what runs after the insert attempt passes
327
329
  * its abort check, so at that link the late outcome lands inside it.
328
330
  *
329
- * NOTE: a commit that outlasts even the derived grace (a link slower than declared, or a
330
- * configured `provisionTimeoutMs` whose half-cap shrank the grace) still tells the joiner
331
+ * NOTE: a commit that outlasts even the derived grace (a link slower than declared, a
332
+ * configured `provisionTimeoutMs` whose half-cap shrank the grace, or a commit phase that
333
+ * re-picks an unanswering coordinator, which Optimystic lets run to its transaction budget,
334
+ * 170 s at the default declared link) still tells the joiner
331
335
  * 'timed out' while its one-time invite is in fact spent, and since every retry mints a
332
336
  * fresh keypair no recovery path can match it. Nothing can un-spend an append-only row, so
333
337
  * the late-settle logging below is the observability for it; if it is seen in the wild,
@@ -425,30 +429,31 @@ export class FormationListener {
425
429
  const contact = await withTimeout(this.awaitContactMs, `Formation await-contact#${id}`, () => reader.read());
426
430
  log('formation session #%d contact: token=%s party=%s', id, contact.token, contact.partyId);
427
431
  if (!this.isJoinerConsentValid(id, contact)) {
428
- send({ approved: false, reason: 'Invalid joiner consent' });
432
+ send({ approved: false, code: 'consent-invalid', reason: 'Invalid joiner consent' });
429
433
  return;
430
434
  }
431
435
  const tokenResult = await this.options.validateToken(contact.token);
432
436
  if (!tokenResult.valid) {
433
- send({ approved: false, reason: INVALID_TOKEN_REASON });
437
+ send({ approved: false, code: tokenResult.code, reason: INVALID_TOKEN_REASON });
434
438
  return;
435
439
  }
436
440
  const disclosureOk = await this.options.validateDisclosure(contact.token, contact.disclosure);
437
441
  if (!disclosureOk) {
438
- send({ approved: false, reason: 'Invalid disclosure' });
442
+ send({ approved: false, code: 'disclosure-invalid', reason: 'Invalid disclosure' });
439
443
  return;
440
444
  }
441
445
  const outcome = await this.provision(id, contact);
442
446
  if (!outcome) {
443
447
  // Reported as its own retryable reason rather than falling through to the generic
444
448
  // catch below, which would report the misleading 'Internal formation error'.
445
- send({ approved: false, reason: 'Formation provisioning timed out' });
449
+ send({ approved: false, code: 'provisioning-timeout', reason: 'Formation provisioning timed out' });
446
450
  return;
447
451
  }
448
452
  if (!outcome.approved) {
449
- // A post-validation rejection still discloses NEITHER identity NOR cadre,
450
- // exactly like the token/disclosure rejections above.
451
- send({ approved: false, reason: outcome.reason });
453
+ // A post-validation rejection still discloses NEITHER identity NOR cadre, exactly
454
+ // like the token/disclosure rejections above — copied field by field so nothing else
455
+ // a hook put on its outcome reaches the wire.
456
+ send({ approved: false, code: outcome.code, reason: outcome.reason });
452
457
  return;
453
458
  }
454
459
  // Validation + provisioning passed → safe to disclose responder identity/cadre.
@@ -473,7 +478,7 @@ export class FormationListener {
473
478
  // log + close. Re-throw either way so the failure is still recorded — this is a
474
479
  // deliberate, logged conversion, not silent.
475
480
  if (!wroteFrame) {
476
- const internalError = { approved: false, reason: 'Internal formation error' };
481
+ const internalError = { approved: false, code: 'internal', reason: 'Internal formation error' };
477
482
  try {
478
483
  writeFrame(stream, internalError);
479
484
  }
@@ -493,58 +498,227 @@ export class FormationListener {
493
498
  * `exchangeFrame` (`control-stream.ts`) gives a stream dialed past its deadline. A late
494
499
  * rejection is the abort itself, or reaches the caller through the awaited copy, so the
495
500
  * handler below only stops it being reported as unhandled.
501
+ *
502
+ * NOTE: libp2p tries `addrs` one after another, and they all share this one dial budget. Its
503
+ * per-address limit (`addressDialTimeout`: ten link round trips plus two admission decisions, as
504
+ * `optimysticDialLimits` states it) is longer than `dialTimeoutMs` (`formationDeadlines().dialMs`:
505
+ * five round trips plus one decision) at every declaration, so it never cuts off an address
506
+ * inside this dial. An address that hangs without answering (a black-holed relay host) uses the
507
+ * whole budget, and the join moves on to the party's next machine
508
+ * ({@link dialFormationByMachine}) rather than to this machine's next address; an address that is
509
+ * refused fails fast and still hands over to the next. A budget per address here would overrun
510
+ * the session or shrink the await-response budget ({@link formationDeadlines}). If joins through a
511
+ * hung first address are seen in practice, give each address a sub-budget or dial them in parallel.
496
512
  */
497
- function openFormationStream(node, addr, protocolId, dialTimeoutMs) {
498
- return withDeadline(dialTimeoutMs, 'Formation dial-connect', (signal) => {
499
- const pending = node.dialProtocol(addr, protocolId, { signal });
513
+ function openFormationStream(node, addrs, protocolId, dialTimeoutMs) {
514
+ return withDeadline(dialTimeoutMs, 'Formation dial-connect', async (signal) => {
515
+ const pending = node.dialProtocol(addrs, protocolId, { signal });
500
516
  void pending.then((stream) => {
501
517
  if (signal.aborted) {
502
518
  stream.abort(new Error('Formation dial-connect resolved after its deadline'));
503
519
  }
504
520
  }, () => { });
505
- return pending;
521
+ try {
522
+ return await pending;
523
+ }
524
+ catch (error) {
525
+ throw describeAllAddressesFailed(error);
526
+ }
506
527
  });
507
528
  }
529
+ const NO_RESPONDER_ADDRS = 'No responder addresses available for formation';
530
+ /**
531
+ * Parse the responder addresses, skipping any entry that does not parse: the list comes from
532
+ * a stranger's invitation, and one bad entry must not fail an otherwise good list. Entries
533
+ * naming different peers are left for libp2p to refuse; {@link dialFormationByMachine} hands
534
+ * this one machine's addresses at a time.
535
+ */
536
+ function parseResponderAddrs(addrs) {
537
+ const parsed = [];
538
+ for (const addr of addrs) {
539
+ const ma = parseResponderAddr(addr);
540
+ if (ma)
541
+ parsed.push(ma);
542
+ }
543
+ if (parsed.length === 0) {
544
+ throw new FormationUnreachableError(NO_RESPONDER_ADDRS);
545
+ }
546
+ return parsed;
547
+ }
548
+ function parseResponderAddr(addr) {
549
+ try {
550
+ return multiaddr(addr);
551
+ }
552
+ catch (error) {
553
+ log('responderAddrs: skipping unparsable entry: %o', error);
554
+ return null;
555
+ }
556
+ }
557
+ /**
558
+ * Split the responder addresses by the machine each reaches (its trailing peer id), keeping
559
+ * the order in which each machine first appears. An entry that does not parse, or names no
560
+ * peer, is dropped: every address an inviter mints (`getMultiaddrs()`, `resolvePeerAddrs`)
561
+ * names its machine, and libp2p refuses one dial that mixes named and unnamed addresses.
562
+ */
563
+ function groupResponderAddrsByMachine(addrs) {
564
+ const machines = new Map();
565
+ for (const addr of addrs) {
566
+ const ma = parseResponderAddr(addr);
567
+ if (!ma)
568
+ continue;
569
+ const peerId = trailingPeerId(ma);
570
+ if (!peerId) {
571
+ log('responderAddrs: skipping %s — it names no machine', addr);
572
+ continue;
573
+ }
574
+ const group = machines.get(peerId);
575
+ if (group)
576
+ group.push(addr);
577
+ else
578
+ machines.set(peerId, [addr]);
579
+ }
580
+ return [...machines].map(([peerId, group]) => ({ peerId, addrs: group }));
581
+ }
582
+ /**
583
+ * Worth asking the next machine of the inviting party: it could not be reached, or it answered
584
+ * with a refusal a sibling may not repeat (the invitation not replicated to it yet, the host
585
+ * strand not running there, …). A final refusal is the party's answer, not one machine's.
586
+ */
587
+ function shouldTryNextMachine(error) {
588
+ return error instanceof FormationUnreachableError || (error instanceof FormationRejectedError && error.retryable);
589
+ }
590
+ /**
591
+ * Every machine failed without a refusal. A single machine's error already names each address
592
+ * it tried, so it is thrown as is; several are restated as one error naming each machine.
593
+ */
594
+ function noMachineReached(failures) {
595
+ if (failures.length === 1)
596
+ return failures[0].error;
597
+ const errors = failures.map((failure) => failure.error);
598
+ return new FormationUnreachableError(`Formation could not reach any of the inviter's ${failures.length} machines: ` +
599
+ failures.map((failure) => `${failure.peerId}: ${failure.error.message}`).join('; '), { cause: new AggregateError(errors, 'Every inviting machine was unreachable') });
600
+ }
601
+ /**
602
+ * libp2p reports a dial in which every address failed as `AggregateError('All multiaddr dials
603
+ * failed')`, which names none of them; restate it with each address's own error, which names
604
+ * its host and port. A dial that tried only one address already surfaces that address's own
605
+ * error, so anything else passes through unchanged.
606
+ */
607
+ function describeAllAddressesFailed(error) {
608
+ if (!(error instanceof AggregateError))
609
+ return error;
610
+ const reasons = error.errors.map((reason) => reason instanceof Error ? reason.message : String(reason));
611
+ return new FormationUnreachableError(`Formation could not reach the inviter at any of the ${reasons.length} addresses tried: ${reasons.join('; ')}`, { cause: error });
612
+ }
613
+ /** Report a failure that came before any answer as {@link FormationUnreachableError}, keeping its message. */
614
+ function asUnreachable(error) {
615
+ if (error instanceof FormationUnreachableError)
616
+ return error;
617
+ return new FormationUnreachableError(error instanceof Error ? error.message : String(error), { cause: error });
618
+ }
619
+ /**
620
+ * Open the formation stream, send the contact, and read back the one result frame, closing
621
+ * the stream either way. Nothing here has an answer from the responder yet, so the caller
622
+ * reports any failure as {@link FormationUnreachableError} — a frame too large or not JSON
623
+ * included, since it is not an answer either.
624
+ */
625
+ async function exchangeContact(node, addrs, contact, budgets) {
626
+ const stream = await openFormationStream(node, addrs, budgets.protocolId, budgets.dialTimeoutMs);
627
+ try {
628
+ const reader = new FrameReader(stream);
629
+ writeFrame(stream, contact);
630
+ return await withTimeout(budgets.awaitResponseMs, 'Formation await-response', () => reader.read());
631
+ }
632
+ finally {
633
+ try {
634
+ await stream.close();
635
+ }
636
+ catch { /* ignore */ }
637
+ }
638
+ }
639
+ /**
640
+ * Turn the responder's answer into the dial's result. A refusal throws
641
+ * {@link FormationRejectedError}; an approval that fails validation throws a plain `Error`,
642
+ * since that is a misbehaving responder rather than a refusal.
643
+ */
644
+ async function acceptResult(response, validateResponse) {
645
+ if (!response.approved) {
646
+ throw new FormationRejectedError(response.code, response.reason);
647
+ }
648
+ if (!(await validateResponse(response)))
649
+ throw new Error('Responder result failed validation');
650
+ if (!response.provisionResult)
651
+ throw new Error('Missing provision result for responderCreates mode');
652
+ // Sanitized HERE — the wire boundary — so nothing above this call ever handles an
653
+ // unvalidated, unbounded address list from a remote peer.
654
+ return { provision: response.provisionResult, strandAddrs: sanitizeStrandAddrs(response.strandAddrs) };
655
+ }
508
656
  /**
509
657
  * Initiator side of the native formation protocol. Dials the responder, sends the
510
658
  * contact (carrying the real disclosure/token/cadre), validates the responder's
511
659
  * result, and returns the strand the responder provisioned plus the responder's
512
660
  * strand-network addresses (see {@link FormationDialResult}).
661
+ *
662
+ * Throws {@link FormationUnreachableError} for every failure before a result frame is read
663
+ * (including the session deadline passing first), {@link FormationRejectedError} when the
664
+ * responder refuses, and a plain `Error` for an approval that fails validation.
513
665
  */
514
666
  export async function dialFormation(node, options) {
515
- if (options.responderAddrs.length === 0) {
516
- throw new Error('No responder addresses available for formation');
517
- }
667
+ const addrs = parseResponderAddrs(options.responderAddrs);
518
668
  const protocolId = options.protocolId ?? FORMATION_PROTOCOL;
519
669
  const deadlines = formationDeadlines(options.linkRoundTripMs);
520
670
  const sessionTimeoutMs = options.sessionTimeoutMs ?? deadlines.sessionMs;
521
671
  const dialTimeoutMs = options.dialTimeoutMs ?? deadlines.dialMs;
522
- const provisionTimeoutMs = resolveProvisionTimeoutMs(options.provisionTimeoutMs, deadlines.initiatorAwaitResponseMs, sessionTimeoutMs, dialTimeoutMs, 'dialFormation');
523
- const addr = multiaddr(options.responderAddrs[0]);
524
- return withTimeout(sessionTimeoutMs, 'Formation dial', async () => {
525
- const stream = await openFormationStream(node, addr, protocolId, dialTimeoutMs);
672
+ const awaitResponseMs = resolveProvisionTimeoutMs(options.provisionTimeoutMs, deadlines.initiatorAwaitResponseMs, sessionTimeoutMs, dialTimeoutMs, 'dialFormation');
673
+ let answered = false;
674
+ try {
675
+ return await withTimeout(sessionTimeoutMs, 'Formation dial', async () => {
676
+ const response = await exchangeContact(node, addrs, options.contact, { protocolId, dialTimeoutMs, awaitResponseMs });
677
+ answered = true;
678
+ return await acceptResult(response, options.validateResponse);
679
+ });
680
+ }
681
+ catch (error) {
682
+ throw answered ? error : asUnreachable(error);
683
+ }
684
+ }
685
+ /**
686
+ * Initiator side for a whole invitation: one {@link dialFormation} session per machine of the
687
+ * inviting party the bootstrap list names (see {@link FormationDialOptions.responderAddrs}), in
688
+ * order, until one approves.
689
+ *
690
+ * A machine that cannot be reached, or that refuses retryably, hands over to the next. A final
691
+ * refusal, or an approval that fails validation, is thrown at once: another machine of the
692
+ * same party would answer the same, and an approval may already have spent the invitation.
693
+ * With no machine left, throws the last retryable refusal when any machine answered (the party
694
+ * is reachable but not ready, which says more than "unreachable"), otherwise one
695
+ * {@link FormationUnreachableError} naming each machine's failure.
696
+ *
697
+ * Every session sends the SAME contact. `FormationUsage` is keyed by the contact's
698
+ * `usageStampId`, so at most one machine of the inviting party can record this redemption,
699
+ * even when one the joiner gave up on was still committing it.
700
+ */
701
+ export async function dialFormationByMachine(node, options) {
702
+ const machines = groupResponderAddrsByMachine(options.responderAddrs);
703
+ if (machines.length === 0) {
704
+ throw new FormationUnreachableError(NO_RESPONDER_ADDRS);
705
+ }
706
+ const unreached = [];
707
+ let refusal;
708
+ for (const machine of machines) {
526
709
  try {
527
- const reader = new FrameReader(stream);
528
- writeFrame(stream, options.contact);
529
- const response = await withTimeout(provisionTimeoutMs, 'Formation await-response', () => reader.read());
530
- if (!response.approved) {
531
- throw new Error(`Formation rejected: ${response.reason ?? 'no reason provided'}`);
532
- }
533
- const ok = await options.validateResponse(response);
534
- if (!ok)
535
- throw new Error('Responder result failed validation');
536
- if (!response.provisionResult)
537
- throw new Error('Missing provision result for responderCreates mode');
538
- // Sanitized HERE — the wire boundary — so nothing above this call ever handles an
539
- // unvalidated, unbounded address list from a remote peer.
540
- return { provision: response.provisionResult, strandAddrs: sanitizeStrandAddrs(response.strandAddrs) };
710
+ return await dialFormation(node, { ...options, responderAddrs: machine.addrs });
541
711
  }
542
- finally {
543
- try {
544
- await stream.close();
545
- }
546
- catch { /* ignore */ }
712
+ catch (error) {
713
+ if (!shouldTryNextMachine(error))
714
+ throw error;
715
+ log('formation via %s failed (%s), trying the next inviting machine', machine.peerId, error.message);
716
+ if (error instanceof FormationRejectedError)
717
+ refusal = error;
718
+ else
719
+ unreached.push({ peerId: machine.peerId, error });
547
720
  }
548
- });
721
+ }
722
+ throw refusal ?? noMachineReached(unreached);
549
723
  }
550
724
  //# sourceMappingURL=strand-formation-protocol.js.map
@@ -1 +1 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