@did-btcr2/method 0.36.1 → 0.37.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 (164) hide show
  1. package/dist/.tsbuildinfo +1 -1
  2. package/dist/browser.js +1060 -96
  3. package/dist/browser.mjs +1060 -96
  4. package/dist/cjs/index.js +1153 -179
  5. package/dist/esm/core/aggregation/beacon-strategy.js +19 -6
  6. package/dist/esm/core/aggregation/beacon-strategy.js.map +1 -1
  7. package/dist/esm/core/aggregation/cohort.js +142 -33
  8. package/dist/esm/core/aggregation/cohort.js.map +1 -1
  9. package/dist/esm/core/aggregation/conditions.js +27 -0
  10. package/dist/esm/core/aggregation/conditions.js.map +1 -1
  11. package/dist/esm/core/aggregation/fallback-spend.js +132 -0
  12. package/dist/esm/core/aggregation/fallback-spend.js.map +1 -0
  13. package/dist/esm/core/aggregation/messages/base.js.map +1 -1
  14. package/dist/esm/core/aggregation/messages/bodies.js +46 -1
  15. package/dist/esm/core/aggregation/messages/bodies.js.map +1 -1
  16. package/dist/esm/core/aggregation/messages/constants.js +11 -0
  17. package/dist/esm/core/aggregation/messages/constants.js.map +1 -1
  18. package/dist/esm/core/aggregation/messages/factories.js +27 -1
  19. package/dist/esm/core/aggregation/messages/factories.js.map +1 -1
  20. package/dist/esm/core/aggregation/messages/guards.js +4 -1
  21. package/dist/esm/core/aggregation/messages/guards.js.map +1 -1
  22. package/dist/esm/core/aggregation/participant.js +210 -21
  23. package/dist/esm/core/aggregation/participant.js.map +1 -1
  24. package/dist/esm/core/aggregation/phases.js +6 -0
  25. package/dist/esm/core/aggregation/phases.js.map +1 -1
  26. package/dist/esm/core/aggregation/recovery-policy.js +156 -0
  27. package/dist/esm/core/aggregation/recovery-policy.js.map +1 -0
  28. package/dist/esm/core/aggregation/recovery-spend.js +106 -0
  29. package/dist/esm/core/aggregation/recovery-spend.js.map +1 -0
  30. package/dist/esm/core/aggregation/runner/aggregation-runner.js +11 -3
  31. package/dist/esm/core/aggregation/runner/aggregation-runner.js.map +1 -1
  32. package/dist/esm/core/aggregation/runner/participant-runner.js +74 -22
  33. package/dist/esm/core/aggregation/runner/participant-runner.js.map +1 -1
  34. package/dist/esm/core/aggregation/runner/service-runner.js +97 -9
  35. package/dist/esm/core/aggregation/runner/service-runner.js.map +1 -1
  36. package/dist/esm/core/aggregation/service.js +221 -11
  37. package/dist/esm/core/aggregation/service.js.map +1 -1
  38. package/dist/esm/core/aggregation/signing-session.js +3 -3
  39. package/dist/esm/core/aggregation/signing-session.js.map +1 -1
  40. package/dist/esm/core/aggregation/transport/http/envelope.js +3 -3
  41. package/dist/esm/core/aggregation/transport/http/inbox-buffer.js +1 -1
  42. package/dist/esm/core/aggregation/transport/http/nonce-cache.js +1 -1
  43. package/dist/esm/core/aggregation/transport/http/rate-limiter.js +1 -1
  44. package/dist/esm/core/aggregation/transport/http/request-auth.js +1 -1
  45. package/dist/esm/core/aggregation/transport/http/server.js +1 -1
  46. package/dist/esm/core/aggregation/transport/http/sse-stream.js +1 -1
  47. package/dist/esm/core/aggregation/transport/http/sse-writer.js +1 -1
  48. package/dist/esm/core/aggregation/transport/in-memory.js +1 -1
  49. package/dist/esm/core/aggregation/transport/nostr.js +6 -6
  50. package/dist/esm/core/beacon/beacon.js +15 -10
  51. package/dist/esm/core/beacon/beacon.js.map +1 -1
  52. package/dist/esm/core/beacon/cas-beacon.js +6 -6
  53. package/dist/esm/core/beacon/cas-beacon.js.map +1 -1
  54. package/dist/esm/core/beacon/singleton-beacon.js +2 -2
  55. package/dist/esm/core/beacon/singleton-beacon.js.map +1 -1
  56. package/dist/esm/core/beacon/smt-beacon.js +3 -3
  57. package/dist/esm/core/beacon/smt-beacon.js.map +1 -1
  58. package/dist/esm/core/resolver.js +8 -8
  59. package/dist/esm/core/resolver.js.map +1 -1
  60. package/dist/esm/core/updater.js +6 -6
  61. package/dist/esm/core/updater.js.map +1 -1
  62. package/dist/esm/did-btcr2.js +2 -2
  63. package/dist/esm/index.js +3 -0
  64. package/dist/esm/index.js.map +1 -1
  65. package/dist/types/core/aggregation/beacon-strategy.d.ts +8 -4
  66. package/dist/types/core/aggregation/beacon-strategy.d.ts.map +1 -1
  67. package/dist/types/core/aggregation/cohort.d.ts +88 -17
  68. package/dist/types/core/aggregation/cohort.d.ts.map +1 -1
  69. package/dist/types/core/aggregation/conditions.d.ts +28 -0
  70. package/dist/types/core/aggregation/conditions.d.ts.map +1 -1
  71. package/dist/types/core/aggregation/fallback-spend.d.ts +94 -0
  72. package/dist/types/core/aggregation/fallback-spend.d.ts.map +1 -0
  73. package/dist/types/core/aggregation/logger.d.ts +1 -1
  74. package/dist/types/core/aggregation/messages/base.d.ts +6 -0
  75. package/dist/types/core/aggregation/messages/base.d.ts.map +1 -1
  76. package/dist/types/core/aggregation/messages/bodies.d.ts +50 -2
  77. package/dist/types/core/aggregation/messages/bodies.d.ts.map +1 -1
  78. package/dist/types/core/aggregation/messages/constants.d.ts +8 -0
  79. package/dist/types/core/aggregation/messages/constants.d.ts.map +1 -1
  80. package/dist/types/core/aggregation/messages/factories.d.ts +40 -0
  81. package/dist/types/core/aggregation/messages/factories.d.ts.map +1 -1
  82. package/dist/types/core/aggregation/messages/guards.d.ts.map +1 -1
  83. package/dist/types/core/aggregation/participant.d.ts +41 -7
  84. package/dist/types/core/aggregation/participant.d.ts.map +1 -1
  85. package/dist/types/core/aggregation/phases.d.ts +8 -2
  86. package/dist/types/core/aggregation/phases.d.ts.map +1 -1
  87. package/dist/types/core/aggregation/recovery-policy.d.ts +132 -0
  88. package/dist/types/core/aggregation/recovery-policy.d.ts.map +1 -0
  89. package/dist/types/core/aggregation/recovery-spend.d.ts +94 -0
  90. package/dist/types/core/aggregation/recovery-spend.d.ts.map +1 -0
  91. package/dist/types/core/aggregation/runner/aggregation-runner.d.ts +13 -3
  92. package/dist/types/core/aggregation/runner/aggregation-runner.d.ts.map +1 -1
  93. package/dist/types/core/aggregation/runner/events.d.ts +28 -7
  94. package/dist/types/core/aggregation/runner/events.d.ts.map +1 -1
  95. package/dist/types/core/aggregation/runner/participant-runner.d.ts +3 -3
  96. package/dist/types/core/aggregation/runner/participant-runner.d.ts.map +1 -1
  97. package/dist/types/core/aggregation/runner/service-runner.d.ts +28 -3
  98. package/dist/types/core/aggregation/runner/service-runner.d.ts.map +1 -1
  99. package/dist/types/core/aggregation/service.d.ts +26 -2
  100. package/dist/types/core/aggregation/service.d.ts.map +1 -1
  101. package/dist/types/core/aggregation/signing-session.d.ts +2 -2
  102. package/dist/types/core/aggregation/signing-session.d.ts.map +1 -1
  103. package/dist/types/core/aggregation/transport/http/envelope.d.ts +3 -3
  104. package/dist/types/core/aggregation/transport/http/inbox-buffer.d.ts +1 -1
  105. package/dist/types/core/aggregation/transport/http/nonce-cache.d.ts +1 -1
  106. package/dist/types/core/aggregation/transport/http/rate-limiter.d.ts +1 -1
  107. package/dist/types/core/aggregation/transport/http/request-auth.d.ts +1 -1
  108. package/dist/types/core/aggregation/transport/http/server.d.ts +1 -1
  109. package/dist/types/core/aggregation/transport/http/sse-stream.d.ts +2 -2
  110. package/dist/types/core/aggregation/transport/http/sse-writer.d.ts +1 -1
  111. package/dist/types/core/aggregation/transport/in-memory.d.ts +1 -1
  112. package/dist/types/core/aggregation/transport/nostr.d.ts +4 -4
  113. package/dist/types/core/aggregation/transport/transport.d.ts +4 -4
  114. package/dist/types/core/aggregation/transport/transport.d.ts.map +1 -1
  115. package/dist/types/core/beacon/beacon.d.ts +7 -7
  116. package/dist/types/core/beacon/beacon.d.ts.map +1 -1
  117. package/dist/types/core/beacon/cas-beacon.d.ts +2 -2
  118. package/dist/types/core/beacon/interfaces.d.ts +1 -1
  119. package/dist/types/core/resolver.d.ts +3 -3
  120. package/dist/types/core/updater.d.ts +4 -4
  121. package/dist/types/did-btcr2.d.ts +2 -2
  122. package/dist/types/index.d.ts +3 -0
  123. package/dist/types/index.d.ts.map +1 -1
  124. package/package.json +4 -4
  125. package/src/core/aggregation/beacon-strategy.ts +27 -9
  126. package/src/core/aggregation/cohort.ts +171 -35
  127. package/src/core/aggregation/conditions.ts +56 -0
  128. package/src/core/aggregation/fallback-spend.ts +223 -0
  129. package/src/core/aggregation/logger.ts +1 -1
  130. package/src/core/aggregation/messages/base.ts +6 -0
  131. package/src/core/aggregation/messages/bodies.ts +94 -1
  132. package/src/core/aggregation/messages/constants.ts +12 -0
  133. package/src/core/aggregation/messages/factories.ts +57 -0
  134. package/src/core/aggregation/messages/guards.ts +6 -0
  135. package/src/core/aggregation/participant.ts +255 -23
  136. package/src/core/aggregation/phases.ts +9 -0
  137. package/src/core/aggregation/recovery-policy.ts +237 -0
  138. package/src/core/aggregation/recovery-spend.ts +192 -0
  139. package/src/core/aggregation/runner/aggregation-runner.ts +27 -5
  140. package/src/core/aggregation/runner/events.ts +26 -7
  141. package/src/core/aggregation/runner/participant-runner.ts +75 -23
  142. package/src/core/aggregation/runner/service-runner.ts +120 -10
  143. package/src/core/aggregation/service.ts +260 -14
  144. package/src/core/aggregation/signing-session.ts +3 -3
  145. package/src/core/aggregation/transport/http/envelope.ts +3 -3
  146. package/src/core/aggregation/transport/http/inbox-buffer.ts +1 -1
  147. package/src/core/aggregation/transport/http/nonce-cache.ts +1 -1
  148. package/src/core/aggregation/transport/http/rate-limiter.ts +1 -1
  149. package/src/core/aggregation/transport/http/request-auth.ts +1 -1
  150. package/src/core/aggregation/transport/http/server.ts +1 -1
  151. package/src/core/aggregation/transport/http/sse-stream.ts +2 -2
  152. package/src/core/aggregation/transport/http/sse-writer.ts +1 -1
  153. package/src/core/aggregation/transport/in-memory.ts +1 -1
  154. package/src/core/aggregation/transport/nostr.ts +6 -6
  155. package/src/core/aggregation/transport/transport.ts +4 -4
  156. package/src/core/beacon/beacon.ts +16 -11
  157. package/src/core/beacon/cas-beacon.ts +7 -7
  158. package/src/core/beacon/interfaces.ts +1 -1
  159. package/src/core/beacon/singleton-beacon.ts +2 -2
  160. package/src/core/beacon/smt-beacon.ts +3 -3
  161. package/src/core/resolver.ts +8 -8
  162. package/src/core/updater.ts +6 -6
  163. package/src/did-btcr2.ts +2 -2
  164. package/src/index.ts +3 -0
@@ -1,6 +1,6 @@
1
1
  var _a;
2
2
  import { AggregationServiceError } from '../errors.js';
3
- import { COHORT_OPT_IN, NONCE_CONTRIBUTION, SIGNATURE_AUTHORIZATION, SUBMIT_UPDATE, VALIDATION_ACK, } from '../messages/constants.js';
3
+ import { COHORT_OPT_IN, FALLBACK_SIGNATURE, NONCE_CONTRIBUTION, SIGNATURE_AUTHORIZATION, SUBMIT_NONINCLUDED, SUBMIT_UPDATE, VALIDATION_ACK, } from '../messages/constants.js';
4
4
  import { ServiceCohortPhase } from '../phases.js';
5
5
  import { AggregationService } from '../service.js';
6
6
  import { TypedEventEmitter } from './typed-emitter.js';
@@ -15,7 +15,7 @@ export const DEFAULT_ADVERT_REPEAT_INTERVAL_MS = 60_000;
15
15
  *
16
16
  * A single runner is a long-lived multiplexer: it advertises and drives many
17
17
  * cohorts concurrently over one transport. Each advertised cohort owns an
18
- * independent completion promise and fails in isolation a stalled or failed
18
+ * independent completion promise and fails in isolation - a stalled or failed
19
19
  * cohort never settles its siblings (see ADR 040). Use
20
20
  * {@link AggregationServiceRunner.advertiseCohort} for the multi-cohort path;
21
21
  * {@link AggregationServiceRunner.run} is a thin single-cohort convenience over
@@ -65,6 +65,13 @@ export class AggregationServiceRunner extends TypedEventEmitter {
65
65
  #cohortTtlMs;
66
66
  #phaseTimeoutMs;
67
67
  #advertRepeatIntervalMs;
68
+ #autoFallbackOnStall;
69
+ /** Phases during which a stall can be salvaged by the k-of-n fallback (ADR 042). */
70
+ static #SIGNING_PHASES = [
71
+ ServiceCohortPhase.SigningStarted,
72
+ ServiceCohortPhase.NoncesCollected,
73
+ ServiceCohortPhase.AwaitingPartialSigs,
74
+ ];
68
75
  /** Per-cohort run state, keyed by cohortId. */
69
76
  #contexts = new Map();
70
77
  #handlersRegistered = false;
@@ -82,6 +89,7 @@ export class AggregationServiceRunner extends TypedEventEmitter {
82
89
  this.#cohortTtlMs = options.cohortTtlMs;
83
90
  this.#phaseTimeoutMs = options.phaseTimeoutMs;
84
91
  this.#advertRepeatIntervalMs = options.advertRepeatIntervalMs ?? DEFAULT_ADVERT_REPEAT_INTERVAL_MS;
92
+ this.#autoFallbackOnStall = options.autoFallbackOnStall ?? false;
85
93
  this.session = new AggregationService({
86
94
  // The coordinator never signs, so the state machine receives only the
87
95
  // public half of the operator's keypair (see ADR 038). The full keypair
@@ -123,7 +131,7 @@ export class AggregationServiceRunner extends TypedEventEmitter {
123
131
  }
124
132
  this.#registerHandlers();
125
133
  // createCohort validates the conditions and throws on a bad config before
126
- // any context exists fail-fast, nothing to clean up.
134
+ // any context exists - fail-fast, nothing to clean up.
127
135
  const cohortId = this.session.createCohort(config);
128
136
  let resolve;
129
137
  let reject;
@@ -145,7 +153,7 @@ export class AggregationServiceRunner extends TypedEventEmitter {
145
153
  this.#onPhaseMaybeChanged(ctx);
146
154
  this.emit('cohort-advertised', { cohortId });
147
155
  // Publish the advert. If advertRepeatIntervalMs > 0 we republish on that
148
- // cadence until this cohort's keygen-complete / fail / stop works around
156
+ // cadence until this cohort's keygen-complete / fail / stop - works around
149
157
  // relays that don't backfill historical events to late subscribers.
150
158
  // Otherwise fall back to a single send.
151
159
  if (this.#advertRepeatIntervalMs > 0) {
@@ -256,11 +264,52 @@ export class AggregationServiceRunner extends TypedEventEmitter {
256
264
  if (this.#phaseTimeoutMs === undefined)
257
265
  return;
258
266
  ctx.phaseTimer = setTimeout(() => {
267
+ // A stall during the optimistic signing round can be salvaged by the k-of-n
268
+ // fallback rather than failing the whole cohort (graceful liveness, ADR
269
+ // 042) - but only if enabled and not already committed to a path.
270
+ const phase = this.session.getCohortPhase(ctx.cohortId);
271
+ const inSigning = phase !== undefined && _a.#SIGNING_PHASES.includes(phase);
272
+ if (this.#autoFallbackOnStall && inSigning && !ctx.committedPath && !ctx.settled) {
273
+ this.triggerFallback(ctx.cohortId).catch(err => this.#failCohort(ctx, err));
274
+ return;
275
+ }
259
276
  const reason = `Cohort ${ctx.cohortId} stalled in phase ${ctx.lastObservedPhase ?? '?'} for ${this.#phaseTimeoutMs}ms`;
260
277
  this.emit('cohort-failed', { cohortId: ctx.cohortId, reason });
261
278
  this.#failCohort(ctx, new Error(reason));
262
279
  }, this.#phaseTimeoutMs);
263
280
  }
281
+ /**
282
+ * Abandon the optimistic n-of-n key path for a cohort and collect k-of-n
283
+ * fallback (script-path) signatures instead (ADR 042). Idempotent and safe
284
+ * against the optimistic completion: it commits the cohort to the fallback
285
+ * path synchronously (the `committedPath` latch) before sending anything, so a
286
+ * late optimistic signature can no longer complete-and-broadcast a competing
287
+ * spend of the same UTXO. No-op if the cohort is unknown, already settled, or
288
+ * already committed to a path.
289
+ *
290
+ * Wired automatically to the phase-stall timer when `autoFallbackOnStall` is
291
+ * set; otherwise call it from an operator decision (a UI "fall back now"
292
+ * action). Throws only if the underlying state machine rejects the transition
293
+ * (e.g. signing has not started).
294
+ */
295
+ async triggerFallback(cohortId) {
296
+ const ctx = this.#contexts.get(cohortId);
297
+ if (!ctx || ctx.settled || ctx.committedPath)
298
+ return;
299
+ // startFallbackSigning is synchronous and throws if the cohort is not in a
300
+ // signing phase (e.g. a premature operator call). Run it FIRST so a rejected
301
+ // transition cannot poison the latch: only after it commits the state machine
302
+ // to the fallback do we set committedPath. This still happens synchronously
303
+ // before any await, so a concurrent optimistic completion observes the latch
304
+ // and stands down - but a bad-phase call leaves the optimistic path intact.
305
+ const messages = this.session.startFallbackSigning(cohortId);
306
+ ctx.committedPath = 'fallback';
307
+ this.#stopAdvertRepeating(ctx);
308
+ this.#onPhaseMaybeChanged(ctx);
309
+ const sessionId = this.session.getSigningSessionId(cohortId) ?? '';
310
+ this.emit('fallback-started', { cohortId, sessionId });
311
+ await this.#sendAll(messages);
312
+ }
264
313
  /** Detect a phase change for a cohort since the last observation and reset its phase timer. */
265
314
  #onPhaseMaybeChanged(ctx) {
266
315
  const phase = this.session.getCohortPhase(ctx.cohortId);
@@ -355,13 +404,15 @@ export class AggregationServiceRunner extends TypedEventEmitter {
355
404
  static #HANDLED_MESSAGE_TYPES = [
356
405
  COHORT_OPT_IN,
357
406
  SUBMIT_UPDATE,
407
+ SUBMIT_NONINCLUDED,
358
408
  VALIDATION_ACK,
359
409
  NONCE_CONTRIBUTION,
360
410
  SIGNATURE_AUTHORIZATION,
411
+ FALLBACK_SIGNATURE,
361
412
  ];
362
413
  /**
363
414
  * Internal: handler registration with the transport. Idempotent. Handlers
364
- * are DID-scoped and cohort-agnostic one registration serves every cohort
415
+ * are DID-scoped and cohort-agnostic - one registration serves every cohort
365
416
  * this runner drives; demux to the right {@link RunContext} happens in each
366
417
  * handler via the inbound message's cohortId.
367
418
  */
@@ -371,9 +422,14 @@ export class AggregationServiceRunner extends TypedEventEmitter {
371
422
  this.#handlersRegistered = true;
372
423
  this.#transport.registerMessageHandler(this.#did, COHORT_OPT_IN, this.#handleOptIn.bind(this));
373
424
  this.#transport.registerMessageHandler(this.#did, SUBMIT_UPDATE, this.#handleSubmitUpdate.bind(this));
425
+ // A non-inclusion (decline) is an update-phase response handled identically:
426
+ // session.receive() routes by type, and the response gate + distribute
427
+ // trigger are shared with SUBMIT_UPDATE.
428
+ this.#transport.registerMessageHandler(this.#did, SUBMIT_NONINCLUDED, this.#handleSubmitUpdate.bind(this));
374
429
  this.#transport.registerMessageHandler(this.#did, VALIDATION_ACK, this.#handleValidationAck.bind(this));
375
430
  this.#transport.registerMessageHandler(this.#did, NONCE_CONTRIBUTION, this.#handleNonceContribution.bind(this));
376
431
  this.#transport.registerMessageHandler(this.#did, SIGNATURE_AUTHORIZATION, this.#handleSignatureAuthorization.bind(this));
432
+ this.#transport.registerMessageHandler(this.#did, FALLBACK_SIGNATURE, this.#handleFallbackSignature.bind(this));
377
433
  }
378
434
  /** Internal: detach from the transport. Safe to call repeatedly. */
379
435
  #unregisterHandlers() {
@@ -430,7 +486,7 @@ export class AggregationServiceRunner extends TypedEventEmitter {
430
486
  this.emit('participant-accepted', { cohortId: ctx.cohortId, participantDid: msg.from });
431
487
  // Check if it's time to finalize. The per-cohort `finalizing` flag is set
432
488
  // synchronously before the first await so concurrent opt-in handlers for
433
- // the same cohort observe it and skip otherwise two handlers could both
489
+ // the same cohort observe it and skip - otherwise two handlers could both
434
490
  // pass the minParticipants check and both call finalizeKeygen, the second
435
491
  // of which would throw (phase mismatch).
436
492
  const cohort = this.session.getCohort(ctx.cohortId);
@@ -441,7 +497,7 @@ export class AggregationServiceRunner extends TypedEventEmitter {
441
497
  minRequired: ctx.config.minParticipants,
442
498
  });
443
499
  if (!finalizeDecision.finalize) {
444
- // Operator declined reset the flag so a later opt-in can retry.
500
+ // Operator declined - reset the flag so a later opt-in can retry.
445
501
  ctx.finalizing = false;
446
502
  return;
447
503
  }
@@ -450,7 +506,7 @@ export class AggregationServiceRunner extends TypedEventEmitter {
450
506
  // (which can run all the way to signing-complete) would resolve the
451
507
  // cohort's completion promise before this event fires.
452
508
  const readyMsgs = this.session.finalizeKeygen(ctx.cohortId);
453
- // Keygen done stop re-advertising the cohort. New participants
509
+ // Keygen done - stop re-advertising the cohort. New participants
454
510
  // arriving after this point would be rejected anyway.
455
511
  this.#stopAdvertRepeating(ctx);
456
512
  this.emit('keygen-complete', {
@@ -581,7 +637,39 @@ export class AggregationServiceRunner extends TypedEventEmitter {
581
637
  this.session.receive(msg);
582
638
  this.#drainRejections(ctx);
583
639
  this.#onPhaseMaybeChanged(ctx);
584
- // The state machine auto-completes when all partial sigs received
640
+ // If the cohort already committed to the fallback path, ignore a late
641
+ // optimistic completion: only one path may finalize the single beacon UTXO.
642
+ if (ctx.committedPath === 'fallback')
643
+ return;
644
+ // The state machine auto-completes when all partial sigs received.
645
+ const result = this.session.getResult(ctx.cohortId);
646
+ if (result) {
647
+ ctx.committedPath = 'optimistic';
648
+ this.#completeCohort(ctx, result);
649
+ }
650
+ }
651
+ catch (err) {
652
+ this.#failCohort(ctx, err);
653
+ }
654
+ }
655
+ /**
656
+ * Handler for receiving fallback (k-of-n script-path) signatures. The state
657
+ * machine assembles and finalizes the fallback spend once k valid signatures
658
+ * are in; the result is then emitted and the cohort's completion resolves. The
659
+ * cohort is already committed to the fallback path (via {@link triggerFallback}).
660
+ * @param {BaseMessage} msg - The incoming FALLBACK_SIGNATURE message.
661
+ * @returns {Promise<void>} Resolves when handling is complete.
662
+ */
663
+ async #handleFallbackSignature(msg) {
664
+ if (this.#stopped)
665
+ return;
666
+ const ctx = this.#contextFor(msg);
667
+ if (!ctx)
668
+ return;
669
+ try {
670
+ this.session.receive(msg);
671
+ this.#drainRejections(ctx);
672
+ this.#onPhaseMaybeChanged(ctx);
585
673
  const result = this.session.getResult(ctx.cohortId);
586
674
  if (result) {
587
675
  this.#completeCohort(ctx, result);
@@ -1 +1 @@
1
- {"version":3,"file":"service-runner.js","sourceRoot":"","sources":["../../../../../src/core/aggregation/runner/service-runner.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,uBAAuB,EAAE,MAAM,cAAc,CAAC;AAEvD,OAAO,EACL,aAAa,EACb,kBAAkB,EAClB,uBAAuB,EACvB,aAAa,EACb,cAAc,GACf,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAMlD,OAAO,EACL,kBAAkB,EACnB,MAAM,eAAe,CAAC;AAGvB,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAyFvD,0FAA0F;AAC1F,MAAM,CAAC,MAAM,iCAAiC,GAAG,MAAM,CAAC;AAqCxD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8CG;AACH,MAAM,OAAO,wBAAyB,SAAQ,iBAA2C;IACvF,sEAAsE;IAC7D,OAAO,CAAqB;IAE5B,UAAU,CAAY;IACtB,IAAI,CAAS;IACb,cAAc,CAAgB;IAC9B,gBAAgB,CAAkB;IAClC,kBAAkB,CAAoB;IACtC,gBAAgB,CAAkB;IAClC,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OAAO;QAChB,IAAI,CAAC;YACH,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;YAC1B,IAAI,CAAC,gBAAgB,CAAC,GAAG,CAAC,CAAC;YAC3B,IAAI,CAAC,oBAAoB,CAAC,GAAG,CAAC,CAAC;YAE/B,kEAAkE;YAClE,MAAM,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;YACpD,IAAG,MAAM,EAAE,CAAC;gBACV,IAAI,CAAC,eAAe,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC;YACpC,CAAC;QACH,CAAC;QAAC,OAAM,GAAG,EAAE,CAAC;YACZ,IAAI,CAAC,WAAW,CAAC,GAAG,EAAE,GAAY,CAAC,CAAC;QACtC,CAAC;IACH,CAAC;IAED;;;;OAIG;IACH,KAAK,CAAC,QAAQ,CAAC,IAAmB;QAChC,KAAI,MAAM,CAAC,IAAI,IAAI,EAAE,CAAC;YACpB,MAAM,IAAI,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC,EAAE,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC;QACxD,CAAC;IACH,CAAC"}
1
+ {"version":3,"file":"service-runner.js","sourceRoot":"","sources":["../../../../../src/core/aggregation/runner/service-runner.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,uBAAuB,EAAE,MAAM,cAAc,CAAC;AAEvD,OAAO,EACL,aAAa,EACb,kBAAkB,EAClB,kBAAkB,EAClB,uBAAuB,EACvB,kBAAkB,EAClB,aAAa,EACb,cAAc,GACf,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAOlD,OAAO,EACL,kBAAkB,EACnB,MAAM,eAAe,CAAC;AAGvB,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAoGvD,0FAA0F;AAC1F,MAAM,CAAC,MAAM,iCAAiC,GAA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AC,UAAU,CAAC,WAAW,CAAC,CAAC,EAAE,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC;QACxD,CAAC;IACH,CAAC"}
@@ -1,13 +1,16 @@
1
1
  import { canonicalize } from '@did-btcr2/common';
2
2
  import { BIP340Cryptosuite, SchnorrMultikey } from '@did-btcr2/cryptosuite';
3
- import { bytesToHex } from '@noble/hashes/utils';
3
+ import { schnorr } from '@noble/curves/secp256k1.js';
4
+ import { bytesToHex, hexToBytes } from '@noble/hashes/utils';
4
5
  import { getBeaconStrategy } from './beacon-strategy.js';
5
6
  import { AggregationCohort } from './cohort.js';
6
7
  import { validateCohortConditions } from './conditions.js';
7
8
  import { AggregationServiceError } from './errors.js';
9
+ import { buildFallbackSpend, fallbackSighash } from './fallback-spend.js';
10
+ import { buildFallbackLeaf } from './recovery-policy.js';
8
11
  import { AGGREGATION_WIRE_VERSION } from './messages/base.js';
9
- import { COHORT_OPT_IN, NONCE_CONTRIBUTION, SIGNATURE_AUTHORIZATION, SUBMIT_UPDATE, VALIDATION_ACK, } from './messages/constants.js';
10
- import { createAggregatedNonceMessage, createAuthorizationRequestMessage, createCohortAdvertMessage, createCohortOptInAcceptMessage, createCohortReadyMessage, createDistributeAggregatedDataMessage, } from './messages/factories.js';
12
+ import { COHORT_OPT_IN, FALLBACK_SIGNATURE, NONCE_CONTRIBUTION, SIGNATURE_AUTHORIZATION, SUBMIT_NONINCLUDED, SUBMIT_UPDATE, VALIDATION_ACK, } from './messages/constants.js';
13
+ import { createAggregatedNonceMessage, createAuthorizationRequestMessage, createCohortAdvertMessage, createCohortOptInAcceptMessage, createCohortReadyMessage, createDistributeAggregatedDataMessage, createFallbackAuthorizationRequestMessage, } from './messages/factories.js';
11
14
  import { ServiceCohortPhase } from './phases.js';
12
15
  import { BeaconSigningSession } from './signing-session.js';
13
16
  /** Default maximum canonicalized byte-length of a submitted BTCR2 update. */
@@ -36,7 +39,7 @@ export class AggregationService {
36
39
  }
37
40
  receive(message) {
38
41
  // Reject messages whose wire version doesn't match what this build speaks.
39
- // Missing version treat as legacy and drop: bumping the protocol must be
42
+ // Missing version, treat as legacy and drop: bumping the protocol must be
40
43
  // coordinated across all participants.
41
44
  const version = message.version;
42
45
  if (version === undefined || version !== AGGREGATION_WIRE_VERSION) {
@@ -59,6 +62,9 @@ export class AggregationService {
59
62
  case SUBMIT_UPDATE:
60
63
  this.#handleSubmitUpdate(message);
61
64
  break;
65
+ case SUBMIT_NONINCLUDED:
66
+ this.#handleSubmitNonInclusion(message);
67
+ break;
62
68
  case VALIDATION_ACK:
63
69
  this.#handleValidationAck(message);
64
70
  break;
@@ -68,8 +74,11 @@ export class AggregationService {
68
74
  case SIGNATURE_AUTHORIZATION:
69
75
  this.#handleSignatureAuthorization(message);
70
76
  break;
77
+ case FALLBACK_SIGNATURE:
78
+ this.#handleFallbackSignature(message);
79
+ break;
71
80
  default:
72
- // Unknown message type silently ignore
81
+ // Unknown message type - silently ignore
73
82
  break;
74
83
  }
75
84
  }
@@ -88,7 +97,7 @@ export class AggregationService {
88
97
  }
89
98
  /**
90
99
  * Create a new cohort with the given config. Returns the cohort ID.
91
- * Cohort starts in `Created` phase call `advertise()` to broadcast.
100
+ * Cohort starts in `Created` phase - call `advertise()` to broadcast.
92
101
  */
93
102
  createCohort(config) {
94
103
  // Fail fast on invalid conditions rather than discovering them at finalize.
@@ -101,6 +110,10 @@ export class AggregationService {
101
110
  minParticipants: config.minParticipants,
102
111
  network: config.network,
103
112
  beaconType: config.beaconType,
113
+ recoveryKey: hexToBytes(config.recoveryKey),
114
+ recoverySequence: config.recoverySequence,
115
+ fundingModel: config.fundingModel,
116
+ fallbackThreshold: config.fallbackThreshold,
104
117
  });
105
118
  this.#cohortStates.set(cohort.id, {
106
119
  phase: ServiceCohortPhase.Created,
@@ -167,7 +180,7 @@ export class AggregationService {
167
180
  return;
168
181
  // Reject re-opt-in from already-accepted participants. Without this guard a
169
182
  // participant could send a second opt-in with a different key, overwriting
170
- // pendingOptIns[did] while cohortKeys still holds the original key opening
183
+ // pendingOptIns[did] while cohortKeys still holds the original key - opening
171
184
  // a desync window where #verifySubmittedUpdate accepts updates signed with
172
185
  // a key that is NOT in the MuSig2 cohort.
173
186
  if (state.acceptedParticipants.has(participantDid))
@@ -280,7 +293,7 @@ export class AggregationService {
280
293
  }
281
294
  // Cap the canonicalized update size before doing any heavier verification
282
295
  // work. Without this guard, a participant could submit multi-MB payloads
283
- // that the service would canonicalize, hash, and aggregate cheap DoS.
296
+ // that the service would canonicalize, hash, and aggregate - cheap DoS.
284
297
  const canonicalSize = canonicalize(signedUpdate).length;
285
298
  if (canonicalSize > this.maxUpdateSizeBytes) {
286
299
  state.rejections.push({
@@ -302,11 +315,77 @@ export class AggregationService {
302
315
  });
303
316
  return;
304
317
  }
318
+ // One response per round. A member that already declined cannot also submit,
319
+ // and a member that already submitted cannot resubmit (a silent overwrite
320
+ // would corrupt the aggregated data the member already validated against).
321
+ // Both are dropped as rejections, symmetric with #handleSubmitNonInclusion.
322
+ if (state.cohort.nonIncluded.has(message.from)) {
323
+ state.rejections.push({
324
+ from: message.from,
325
+ code: 'UPDATE_MALFORMED',
326
+ reason: 'Participant already declined this round; cannot also submit an update',
327
+ });
328
+ return;
329
+ }
330
+ if (state.cohort.pendingUpdates.has(message.from)) {
331
+ state.rejections.push({
332
+ from: message.from,
333
+ code: 'UPDATE_MALFORMED',
334
+ reason: 'Participant already submitted an update this round; cannot resubmit',
335
+ });
336
+ return;
337
+ }
305
338
  state.cohort.addUpdate(message.from, signedUpdate);
306
339
  if (state.phase === ServiceCohortPhase.CohortSet) {
307
340
  state.phase = ServiceCohortPhase.CollectingUpdates;
308
341
  }
309
- if (state.cohort.hasAllUpdates()) {
342
+ if (state.cohort.hasAllResponses()) {
343
+ state.phase = ServiceCohortPhase.UpdatesCollected;
344
+ }
345
+ }
346
+ /**
347
+ * Handle an incoming SUBMIT_NONINCLUDED message: a member declares it has no
348
+ * update this round (cooperative non-inclusion). Membership is proven by the
349
+ * signed transport envelope, so the body carries only the cohortId. The member
350
+ * stays in the cohort and still signs; it is absent from the CAS map and
351
+ * carries a non-inclusion leaf in the SMT.
352
+ */
353
+ #handleSubmitNonInclusion(message) {
354
+ const cohortId = message.body?.cohortId;
355
+ if (!cohortId)
356
+ return;
357
+ const state = this.#cohortStates.get(cohortId);
358
+ if (!state)
359
+ return;
360
+ if (state.phase !== ServiceCohortPhase.CohortSet && state.phase !== ServiceCohortPhase.CollectingUpdates)
361
+ return;
362
+ // Membership is proven by the signed envelope sender. A non-member decline is
363
+ // dropped as a rejection, never thrown: addNonInclusion would otherwise throw
364
+ // UNKNOWN_PARTICIPANT out of receive() and fail the whole cohort, a DoS any
365
+ // non-member could trigger. Mirrors the SUBMIT_UPDATE verification path.
366
+ if (!state.cohort.participants.includes(message.from)) {
367
+ state.rejections.push({
368
+ from: message.from,
369
+ code: 'UPDATE_MALFORMED',
370
+ reason: 'Sender is not a member of this cohort',
371
+ });
372
+ return;
373
+ }
374
+ // One response per round: already submitted or already declined. Surface the
375
+ // conflict as a rejection, symmetric with the double-submit guard above.
376
+ if (state.cohort.pendingUpdates.has(message.from) || state.cohort.nonIncluded.has(message.from)) {
377
+ state.rejections.push({
378
+ from: message.from,
379
+ code: 'UPDATE_MALFORMED',
380
+ reason: 'Participant already responded this round',
381
+ });
382
+ return;
383
+ }
384
+ state.cohort.addNonInclusion(message.from);
385
+ if (state.phase === ServiceCohortPhase.CohortSet) {
386
+ state.phase = ServiceCohortPhase.CollectingUpdates;
387
+ }
388
+ if (state.cohort.hasAllResponses()) {
310
389
  state.phase = ServiceCohortPhase.UpdatesCollected;
311
390
  }
312
391
  }
@@ -421,7 +500,7 @@ export class AggregationService {
421
500
  }
422
501
  /**
423
502
  * Start a signing session by creating auth requests for all participants.
424
- * The caller provides the transaction data typically built via
503
+ * The caller provides the transaction data - typically built via
425
504
  * `buildBeaconTransaction()` against a Bitcoin connection.
426
505
  */
427
506
  startSigning(cohortId, txData) {
@@ -521,7 +600,7 @@ export class AggregationService {
521
600
  return;
522
601
  state.signingSession.addPartialSignature(message.from, partialSignature);
523
602
  if (state.signingSession.partialSignatures.size === state.cohort.participants.length) {
524
- // All partial sigs received generate final signature
603
+ // All partial sigs received - generate final signature
525
604
  const signature = state.signingSession.generateFinalSignature();
526
605
  // Set Taproot key-path witness (finalScriptWitness injects the aggregated MuSig2 sig)
527
606
  state.signingSession.pendingTx.updateInput(0, { finalScriptWitness: [signature] });
@@ -529,10 +608,141 @@ export class AggregationService {
529
608
  cohortId,
530
609
  signature,
531
610
  signedTx: state.signingSession.pendingTx,
611
+ path: 'key-path',
532
612
  };
533
613
  state.phase = ServiceCohortPhase.Complete;
534
614
  }
535
615
  }
616
+ /**
617
+ * Abandon the optimistic n-of-n key path and ask members to authorize the
618
+ * k-of-n fallback (script-path) spend of the SAME beacon transaction (graceful
619
+ * liveness, ADR 042). Reuses the in-flight signing session's transaction and
620
+ * spent output, so the announcement and its outputs are unchanged: only the
621
+ * witness path differs. Returns one FALLBACK_AUTHORIZATION_REQUEST per
622
+ * participant.
623
+ *
624
+ * Callable once optimistic signing has started (the session and its tx exist)
625
+ * and before it completes. A cohort can take exactly one of the two paths: the
626
+ * caller (runner) must commit to fallback and stop driving the optimistic path.
627
+ */
628
+ startFallbackSigning(cohortId) {
629
+ const state = this.#cohortStates.get(cohortId);
630
+ if (!state) {
631
+ throw new AggregationServiceError(`Cohort ${cohortId} not found.`, 'COHORT_NOT_FOUND', { cohortId });
632
+ }
633
+ if (!state.signingSession) {
634
+ throw new AggregationServiceError(`Cannot start fallback for cohort ${cohortId}: no signing session.`, 'NO_SIGNING_SESSION', { cohortId });
635
+ }
636
+ const signingPhases = [
637
+ ServiceCohortPhase.SigningStarted,
638
+ ServiceCohortPhase.NoncesCollected,
639
+ ServiceCohortPhase.AwaitingPartialSigs,
640
+ ];
641
+ if (!signingPhases.includes(state.phase)) {
642
+ throw new AggregationServiceError(`Cannot start fallback for cohort ${cohortId}: phase is ${state.phase}.`, 'INVALID_PHASE', { cohortId, phase: state.phase });
643
+ }
644
+ const session = state.signingSession;
645
+ const prevOutScript = session.prevOutScripts[0];
646
+ const prevOutValue = session.prevOutValues[0];
647
+ if (!prevOutScript || prevOutValue === undefined) {
648
+ throw new AggregationServiceError(`Cannot start fallback for cohort ${cohortId}: signing session missing prevout data.`, 'MISSING_PREV_OUT', { cohortId });
649
+ }
650
+ const fallbackLeaf = buildFallbackLeaf({
651
+ cohortKeys: state.cohort.cohortKeys,
652
+ fallbackThreshold: state.cohort.effectiveFallbackThreshold,
653
+ });
654
+ state.fallbackSignatures = new Map();
655
+ state.phase = ServiceCohortPhase.FallbackRequested;
656
+ const messages = [];
657
+ for (const participantDid of state.cohort.participants) {
658
+ messages.push(createFallbackAuthorizationRequestMessage({
659
+ from: this.did,
660
+ to: participantDid,
661
+ cohortId,
662
+ sessionId: session.id,
663
+ pendingTx: session.pendingTx.hex,
664
+ prevOutScriptHex: bytesToHex(prevOutScript),
665
+ prevOutValue: prevOutValue.toString(),
666
+ fallbackLeafScriptHex: bytesToHex(fallbackLeaf),
667
+ }));
668
+ }
669
+ return messages;
670
+ }
671
+ /**
672
+ * Handle an incoming FALLBACK_SIGNATURE: a member's standalone BIP-340
673
+ * signature over the fallback script-path sighash. The signature is
674
+ * authenticated to the sender (its `signerPk` must be the sender's own cohort
675
+ * key and the signature must verify against the sighash) and collected. Once k
676
+ * valid signatures are in, the k-of-n fallback spend is assembled and the
677
+ * cohort completes via the script path.
678
+ */
679
+ #handleFallbackSignature(message) {
680
+ const cohortId = message.body?.cohortId;
681
+ if (!cohortId)
682
+ return;
683
+ const state = this.#cohortStates.get(cohortId);
684
+ if (!state || !state.signingSession || !state.fallbackSignatures)
685
+ return;
686
+ if (state.phase !== ServiceCohortPhase.FallbackRequested)
687
+ return;
688
+ const sessionId = message.body?.sessionId;
689
+ if (sessionId !== state.signingSession.id)
690
+ return;
691
+ const signerPk = message.body?.signerPk;
692
+ const fallbackSignature = message.body?.fallbackSignature;
693
+ if (!signerPk || !fallbackSignature)
694
+ return;
695
+ const prevOutScript = state.signingSession.prevOutScripts[0];
696
+ const prevOutValue = state.signingSession.prevOutValues[0];
697
+ if (!prevOutScript || prevOutValue === undefined)
698
+ return;
699
+ // Authenticate the signature to the sender: signerPk must be the sender's own
700
+ // cohort key (x-only). A non-member or a mismatched key is dropped as a
701
+ // rejection, never thrown, so one bad contribution cannot stall the fallback.
702
+ const memberKey = state.cohort.participantKeys.get(message.from);
703
+ if (!memberKey) {
704
+ state.rejections.push({ from: message.from, code: 'UPDATE_MALFORMED', reason: 'Fallback signature from a non-member' });
705
+ return;
706
+ }
707
+ const memberXOnly = memberKey.slice(1);
708
+ if (signerPk.length !== 32 || !memberXOnly.every((b, i) => b === signerPk[i])) {
709
+ state.rejections.push({ from: message.from, code: 'UPDATE_MALFORMED', reason: 'Fallback signerPk does not match the sender cohort key' });
710
+ return;
711
+ }
712
+ const fallbackLeaf = buildFallbackLeaf({
713
+ cohortKeys: state.cohort.cohortKeys,
714
+ fallbackThreshold: state.cohort.effectiveFallbackThreshold,
715
+ });
716
+ const sighash = fallbackSighash(state.signingSession.pendingTx, 0, prevOutScript, prevOutValue, fallbackLeaf);
717
+ let valid = false;
718
+ try {
719
+ valid = fallbackSignature.length === 64 && schnorr.verify(fallbackSignature, sighash, signerPk);
720
+ }
721
+ catch {
722
+ valid = false;
723
+ }
724
+ if (!valid) {
725
+ state.rejections.push({ from: message.from, code: 'UPDATE_VERIFICATION_FAILED', reason: 'Fallback signature failed verification' });
726
+ return;
727
+ }
728
+ state.fallbackSignatures.set(message.from, { pubKey: signerPk, signature: fallbackSignature });
729
+ if (state.fallbackSignatures.size >= state.cohort.effectiveFallbackThreshold) {
730
+ const signedTx = buildFallbackSpend({
731
+ pendingTx: state.signingSession.pendingTx,
732
+ cohortKeys: state.cohort.cohortKeys,
733
+ fallbackThreshold: state.cohort.effectiveFallbackThreshold,
734
+ recoveryKey: state.cohort.recoveryKey,
735
+ recoverySequence: state.cohort.recoverySequence,
736
+ fundingModel: state.cohort.fundingModel,
737
+ network: state.cohort.network,
738
+ prevOutScript,
739
+ prevOutValue,
740
+ signatures: [...state.fallbackSignatures.values()],
741
+ });
742
+ state.result = { cohortId, signature: new Uint8Array(), signedTx, path: 'script-path' };
743
+ state.phase = ServiceCohortPhase.Complete;
744
+ }
745
+ }
536
746
  getResult(cohortId) {
537
747
  return this.#cohortStates.get(cohortId)?.result;
538
748
  }