@peerbit/shared-log 16.0.11 → 16.0.13

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.
@@ -458,6 +458,121 @@ let RequestReplicationInfoV2Message = (() => {
458
458
  return RequestReplicationInfoV2Message = _classThis;
459
459
  })();
460
460
  export { RequestReplicationInfoV2Message };
461
+ /**
462
+ * Opt-in query for proof that one V2 stream sequence has reached the receiver's
463
+ * durable application boundary. `revision` is sender-local and opaque to the
464
+ * receiver; echoing it lets the sender coalesce newer authoritative snapshots
465
+ * without retaining an unbounded sequence-to-revision history.
466
+ */
467
+ let RequestReplicationInfoV2AppliedMessage = (() => {
468
+ let _classDecorators = [variant([1, 10])];
469
+ let _classDescriptor;
470
+ let _classExtraInitializers = [];
471
+ let _classThis;
472
+ let _classSuper = TransportMessage;
473
+ let _receiverChallenge_decorators;
474
+ let _receiverChallenge_initializers = [];
475
+ let _receiverChallenge_extraInitializers = [];
476
+ let _senderEpoch_decorators;
477
+ let _senderEpoch_initializers = [];
478
+ let _senderEpoch_extraInitializers = [];
479
+ let _sequence_decorators;
480
+ let _sequence_initializers = [];
481
+ let _sequence_extraInitializers = [];
482
+ let _revision_decorators;
483
+ let _revision_initializers = [];
484
+ let _revision_extraInitializers = [];
485
+ var RequestReplicationInfoV2AppliedMessage = class extends _classSuper {
486
+ static { _classThis = this; }
487
+ static {
488
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
489
+ _receiverChallenge_decorators = [field({ type: fixedArray("u8", 32) })];
490
+ _senderEpoch_decorators = [field({ type: fixedArray("u8", 32) })];
491
+ _sequence_decorators = [field({ type: "u64" })];
492
+ _revision_decorators = [field({ type: "u64" })];
493
+ __esDecorate(null, null, _receiverChallenge_decorators, { kind: "field", name: "receiverChallenge", static: false, private: false, access: { has: obj => "receiverChallenge" in obj, get: obj => obj.receiverChallenge, set: (obj, value) => { obj.receiverChallenge = value; } }, metadata: _metadata }, _receiverChallenge_initializers, _receiverChallenge_extraInitializers);
494
+ __esDecorate(null, null, _senderEpoch_decorators, { kind: "field", name: "senderEpoch", static: false, private: false, access: { has: obj => "senderEpoch" in obj, get: obj => obj.senderEpoch, set: (obj, value) => { obj.senderEpoch = value; } }, metadata: _metadata }, _senderEpoch_initializers, _senderEpoch_extraInitializers);
495
+ __esDecorate(null, null, _sequence_decorators, { kind: "field", name: "sequence", static: false, private: false, access: { has: obj => "sequence" in obj, get: obj => obj.sequence, set: (obj, value) => { obj.sequence = value; } }, metadata: _metadata }, _sequence_initializers, _sequence_extraInitializers);
496
+ __esDecorate(null, null, _revision_decorators, { kind: "field", name: "revision", static: false, private: false, access: { has: obj => "revision" in obj, get: obj => obj.revision, set: (obj, value) => { obj.revision = value; } }, metadata: _metadata }, _revision_initializers, _revision_extraInitializers);
497
+ __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
498
+ RequestReplicationInfoV2AppliedMessage = _classThis = _classDescriptor.value;
499
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
500
+ __runInitializers(_classThis, _classExtraInitializers);
501
+ }
502
+ receiverChallenge = __runInitializers(this, _receiverChallenge_initializers, void 0);
503
+ senderEpoch = (__runInitializers(this, _receiverChallenge_extraInitializers), __runInitializers(this, _senderEpoch_initializers, void 0));
504
+ sequence = (__runInitializers(this, _senderEpoch_extraInitializers), __runInitializers(this, _sequence_initializers, void 0));
505
+ // design-note: This opaque wire correlation value identifies multiple
506
+ // application states within one sender epoch/session. Lifecycle identity
507
+ // cannot tell a receiver which of those states the sender is confirming.
508
+ revision = (__runInitializers(this, _sequence_extraInitializers), __runInitializers(this, _revision_initializers, void 0));
509
+ constructor(properties) {
510
+ super();
511
+ __runInitializers(this, _revision_extraInitializers);
512
+ this.receiverChallenge = properties.receiverChallenge;
513
+ this.senderEpoch = properties.senderEpoch;
514
+ this.sequence = properties.sequence;
515
+ this.revision = properties.revision;
516
+ }
517
+ };
518
+ return RequestReplicationInfoV2AppliedMessage = _classThis;
519
+ })();
520
+ export { RequestReplicationInfoV2AppliedMessage };
521
+ /** Signed receiver response emitted only after the queried sequence applied. */
522
+ let ReplicationInfoV2AppliedMessage = (() => {
523
+ let _classDecorators = [variant([1, 11])];
524
+ let _classDescriptor;
525
+ let _classExtraInitializers = [];
526
+ let _classThis;
527
+ let _classSuper = TransportMessage;
528
+ let _receiverChallenge_decorators;
529
+ let _receiverChallenge_initializers = [];
530
+ let _receiverChallenge_extraInitializers = [];
531
+ let _senderEpoch_decorators;
532
+ let _senderEpoch_initializers = [];
533
+ let _senderEpoch_extraInitializers = [];
534
+ let _sequence_decorators;
535
+ let _sequence_initializers = [];
536
+ let _sequence_extraInitializers = [];
537
+ let _revision_decorators;
538
+ let _revision_initializers = [];
539
+ let _revision_extraInitializers = [];
540
+ var ReplicationInfoV2AppliedMessage = class extends _classSuper {
541
+ static { _classThis = this; }
542
+ static {
543
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
544
+ _receiverChallenge_decorators = [field({ type: fixedArray("u8", 32) })];
545
+ _senderEpoch_decorators = [field({ type: fixedArray("u8", 32) })];
546
+ _sequence_decorators = [field({ type: "u64" })];
547
+ _revision_decorators = [field({ type: "u64" })];
548
+ __esDecorate(null, null, _receiverChallenge_decorators, { kind: "field", name: "receiverChallenge", static: false, private: false, access: { has: obj => "receiverChallenge" in obj, get: obj => obj.receiverChallenge, set: (obj, value) => { obj.receiverChallenge = value; } }, metadata: _metadata }, _receiverChallenge_initializers, _receiverChallenge_extraInitializers);
549
+ __esDecorate(null, null, _senderEpoch_decorators, { kind: "field", name: "senderEpoch", static: false, private: false, access: { has: obj => "senderEpoch" in obj, get: obj => obj.senderEpoch, set: (obj, value) => { obj.senderEpoch = value; } }, metadata: _metadata }, _senderEpoch_initializers, _senderEpoch_extraInitializers);
550
+ __esDecorate(null, null, _sequence_decorators, { kind: "field", name: "sequence", static: false, private: false, access: { has: obj => "sequence" in obj, get: obj => obj.sequence, set: (obj, value) => { obj.sequence = value; } }, metadata: _metadata }, _sequence_initializers, _sequence_extraInitializers);
551
+ __esDecorate(null, null, _revision_decorators, { kind: "field", name: "revision", static: false, private: false, access: { has: obj => "revision" in obj, get: obj => obj.revision, set: (obj, value) => { obj.revision = value; } }, metadata: _metadata }, _revision_initializers, _revision_extraInitializers);
552
+ __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
553
+ ReplicationInfoV2AppliedMessage = _classThis = _classDescriptor.value;
554
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
555
+ __runInitializers(_classThis, _classExtraInitializers);
556
+ }
557
+ receiverChallenge = __runInitializers(this, _receiverChallenge_initializers, void 0);
558
+ senderEpoch = (__runInitializers(this, _receiverChallenge_extraInitializers), __runInitializers(this, _senderEpoch_initializers, void 0));
559
+ sequence = (__runInitializers(this, _senderEpoch_extraInitializers), __runInitializers(this, _sequence_initializers, void 0));
560
+ // design-note: Echoing the query's application-state token proves the exact
561
+ // state requested within one still-current session; it is not used to fence
562
+ // an asynchronous continuation.
563
+ revision = (__runInitializers(this, _sequence_extraInitializers), __runInitializers(this, _revision_initializers, void 0));
564
+ constructor(properties) {
565
+ super();
566
+ __runInitializers(this, _revision_extraInitializers);
567
+ this.receiverChallenge = properties.receiverChallenge;
568
+ this.senderEpoch = properties.senderEpoch;
569
+ this.sequence = properties.sequence;
570
+ this.revision = properties.revision;
571
+ }
572
+ };
573
+ return ReplicationInfoV2AppliedMessage = _classThis;
574
+ })();
575
+ export { ReplicationInfoV2AppliedMessage };
461
576
  export const isReplicationInfoV2Message = (message) => message instanceof FullReplicationInfoV2Message ||
462
577
  message instanceof AddedReplicationInfoV2Message ||
463
578
  message instanceof StoppedReplicationInfoV2Message;
@@ -1 +1 @@
1
- {"version":3,"file":"replication.js","sourceRoot":"","sources":["../../src/replication.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,EACN,WAAW,EACX,KAAK,EACL,UAAU,EACV,MAAM,EACN,SAAS,EACT,OAAO,EACP,GAAG,GACH,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAc,MAAM,4BAA4B,CAAC;AACxD,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAChD,OAAO,EAEN,uBAAuB,GACvB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AASvD,MAAM,OAAO,WAAW;IACvB,QAAQ,CAAC,GAAc;QACtB,MAAM,IAAI,KAAK,CAAC,iBAAiB,CAAC,CAAC;IACpC,CAAC;CACD;IAGY,gBAAgB;4BAD5B,OAAO,CAAC,CAAC,CAAC;;;;sBAC2B,WAAW;;;;gCAAnB,SAAQ,WAAW;;;;kCAC/C,KAAK,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;YACvB,oKAAA,MAAM,6BAAN,MAAM,uFAAS;YAFhB,6KAYC;;;YAZY,uDAAgB;;QAE5B,MAAM,yDAAS;QAEf,YAAY,KAAa;YACxB,KAAK,EAAE,CAAC;;YACR,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;SACpB;QAED,QAAQ,CAAC,IAAe;YACvB,OAAO,IAAI,CAAC,MAAM,CAAC;QACpB,CAAC;;;;SAXW,gBAAgB;IAehB,6BAA6B;4BADzC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;;;;sBACmC,gBAAgB;6CAAxB,SAAQ,WAAgB;;;;YAAnE,6KAIC;;;YAJY,uDAA6B;;QACzC;YACC,KAAK,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,OAEoD,EACnD,EAAE;IACH,IAAI,GAAG,GAAG,CAAC,CAAC;IACZ,KAAK,MAAM,KAAK,IAAI,OAAO,EAAE,CAAC;QAC7B,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,GAAG,CAAC,CAAC;IAC1D,CAAC;IACD,MAAM,KAAK,GAAG,GAAG,CAAC,QAAQ,CAAC,GAAG,EAAE,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IACnD,MAAM,MAAM,GAAG,GAAG,CAAC,QAAQ,CAAC,GAAG,EAAE,QAAQ,CAAC,GAAG,CAAC,IAAI,MAAM,CAAC,gBAAgB,CAAC;IAC1E,MAAM,eAAe,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,KAAK,CAAC,CAAC;IAC/D,OAAO,eAAe,CAAC;AACxB,CAAC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@peerbit/shared-log",
3
- "version": "16.0.11",
3
+ "version": "16.0.13",
4
4
  "description": "Shared log",
5
5
  "sideEffects": false,
6
6
  "type": "module",
@@ -68,31 +68,31 @@
68
68
  "@peerbit/blocks": "4.2.12",
69
69
  "@peerbit/crypto": "3.1.6",
70
70
  "@peerbit/diagnostics": "0.0.1",
71
- "@peerbit/indexer-interface": "3.0.11",
72
- "@peerbit/indexer-sqlite3": "3.0.16",
73
- "@peerbit/log": "6.2.21",
71
+ "@peerbit/indexer-interface": "3.0.12",
72
+ "@peerbit/indexer-sqlite3": "3.0.18",
73
+ "@peerbit/log": "6.2.23",
74
74
  "@peerbit/logger": "2.0.2",
75
- "@peerbit/program": "6.0.53",
75
+ "@peerbit/program": "6.0.54",
76
+ "@peerbit/pubsub": "5.4.2",
76
77
  "@peerbit/pubsub-interface": "5.2.2",
77
78
  "@peerbit/riblt": "1.2.0",
78
- "@peerbit/rpc": "6.1.21",
79
79
  "@peerbit/stream-interface": "6.0.16",
80
- "@peerbit/pubsub": "5.4.2",
81
- "@peerbit/time": "3.0.1"
80
+ "@peerbit/time": "3.0.1",
81
+ "@peerbit/rpc": "6.1.22"
82
82
  },
83
83
  "optionalDependencies": {
84
- "@peerbit/native-backbone": "0.2.10",
85
- "@peerbit/shared-log-rust": "0.1.6"
84
+ "@peerbit/shared-log-rust": "0.1.6",
85
+ "@peerbit/native-backbone": "0.2.10"
86
86
  },
87
87
  "devDependencies": {
88
88
  "@types/libsodium-wrappers": "^0.7.14",
89
89
  "@types/pidusage": "^2.0.5",
90
90
  "uuid": "^11.1.1",
91
+ "@peerbit/indexer-rust": "1.0.13",
92
+ "@peerbit/test-utils": "3.1.33",
91
93
  "@peerbit/any-store-rust": "0.1.4",
92
- "@peerbit/indexer-rust": "1.0.12",
93
- "@peerbit/indexer-simple": "1.2.15",
94
- "@peerbit/test-utils": "3.1.31",
95
- "peerbit": "5.3.31"
94
+ "@peerbit/indexer-simple": "1.2.16",
95
+ "peerbit": "5.3.33"
96
96
  },
97
97
  "repository": {
98
98
  "type": "git",
@@ -107,6 +107,8 @@
107
107
  "clean": "aegir clean",
108
108
  "build": "aegir build --no-bundle",
109
109
  "benchmark:adaptive-ingest": "node --loader ts-node/esm ./benchmark/adaptive-ingest.ts",
110
+ "benchmark:batch-canappend-signatures": "node --expose-gc --loader ts-node/esm ./benchmark/batch-canappend-signatures.ts",
111
+ "benchmark:batch-canappend-signatures-shared-fs": "node --expose-gc --loader ts-node/esm ./benchmark/batch-canappend-signatures.ts --profile shared-fs --skipNoCanAppend --json",
110
112
  "benchmark:append-storage": "node --loader ts-node/esm ./benchmark/index.ts",
111
113
  "benchmark:join-backfill-repair": "node --loader ts-node/esm ./benchmark/join-backfill-repair.ts",
112
114
  "benchmark:native-graph": "node --loader ts-node/esm ./benchmark/native-graph.ts",
@@ -369,6 +369,13 @@ export const SYNC_CAPABILITY_REPLICATION_INFO_V2_SEND = 1 << 2;
369
369
  */
370
370
  export const SYNC_CAPABILITY_REPLICATION_INFO_V2_APPLY = 1 << 3;
371
371
 
372
+ /**
373
+ * Capability bit: the peer can decode the opt-in replication-info V2
374
+ * application-confirmation request/response variants. Existing V2 delivery
375
+ * remains fire-and-converge unless a caller explicitly waits for confirmation.
376
+ */
377
+ export const SYNC_CAPABILITY_REPLICATION_INFO_V2_CONFIRM = 1 << 4;
378
+
372
379
  /**
373
380
  * One-shot capability advertisement, sent to a peer when it (or we) subscribe
374
381
  * to the program topic. Peers that do not know this message drop it as an
package/src/index.ts CHANGED
@@ -164,6 +164,7 @@ import {
164
164
  ResponseIPruneV2,
165
165
  SYNC_CAPABILITY_RAW_EXCHANGE_HEADS,
166
166
  SYNC_CAPABILITY_REPLICATION_INFO_V2_APPLY,
167
+ SYNC_CAPABILITY_REPLICATION_INFO_V2_CONFIRM,
167
168
  SYNC_CAPABILITY_REPLICATION_INFO_V2_DECODE,
168
169
  SYNC_CAPABILITY_REPLICATION_INFO_V2_SEND,
169
170
  StashBackedRawExchangeHeadsMessage,
@@ -231,6 +232,11 @@ import {
231
232
  shouldAssigneToRangeBoundary as shouldAssignToRangeBoundary,
232
233
  toRebalance,
233
234
  } from "./ranges.js";
235
+ import {
236
+ type ReceiveSignatureVerificationFact,
237
+ receiveSignatureVerificationResult as getReceiveSignatureVerificationResult,
238
+ withReceiveSignatureVerificationFacts as withSignatureVerificationFacts,
239
+ } from "./receive-signature-verification.js";
234
240
  import { ReplicationAnnouncementCoordinator } from "./replication-announcement.js";
235
241
  import {
236
242
  type ReplicationDomainHash,
@@ -251,7 +257,10 @@ import type {
251
257
  FullReplicationInfoMutation,
252
258
  } from "./replication-info-mutation.js";
253
259
  import { ReplicationInfoV2ReceiveCoordinator } from "./replication-info-v2-receive.js";
254
- import { ReplicationInfoV2SendCoordinator } from "./replication-info-v2-send.js";
260
+ import {
261
+ type ReplicationInfoV2ConfirmationOptions,
262
+ ReplicationInfoV2SendCoordinator,
263
+ } from "./replication-info-v2-send.js";
255
264
  import {
256
265
  type ReplicationStatus,
257
266
  classifyReplicationStatus,
@@ -264,10 +273,12 @@ import {
264
273
  FullReplicationInfoV2Message,
265
274
  MinReplicas,
266
275
  ReplicationError,
276
+ ReplicationInfoV2AppliedMessage,
267
277
  type ReplicationInfoV2Message,
268
278
  type ReplicationLimits,
269
279
  ReplicationPingMessage,
270
280
  RequestReplicationInfoMessage,
281
+ RequestReplicationInfoV2AppliedMessage,
271
282
  RequestReplicationInfoV2Message,
272
283
  ResponseRoleMessage,
273
284
  StoppedReplicating,
@@ -1065,6 +1076,10 @@ export type ReplicationOptions<R extends "u32" | "u64" = any> =
1065
1076
  | NewReplicationOptions<R>
1066
1077
  | ExistingReplicationOptions<R>;
1067
1078
 
1079
+ /** Opt-in proof that a local replication-role update applied remotely. */
1080
+ export type ReplicationConfirmationOptions =
1081
+ ReplicationInfoV2ConfirmationOptions;
1082
+
1068
1083
  export { BlocksMessage };
1069
1084
 
1070
1085
  const isAdaptiveReplicatorOption = (
@@ -2179,6 +2194,16 @@ export class SharedLog<
2179
2194
  private _logProperties?: LogProperties<T> &
2180
2195
  LogEvents<T> &
2181
2196
  SharedLogOptions<T, D, R>;
2197
+ // A successful native signature batch is only an authorization input for the
2198
+ // receive operation that requested it. Facts retain the exact verified bytes
2199
+ // and are leased around the lower-log join; byte comparison prevents an
2200
+ // earlier application callback from mutating a later entry underneath the
2201
+ // batch result. The array form also makes overlapping leases for the same
2202
+ // object safe without making verification sticky across retries.
2203
+ private _receiveSignatureVerificationFacts = new WeakMap<
2204
+ Entry<T>,
2205
+ ReceiveSignatureVerificationFact<T>[]
2206
+ >();
2182
2207
  private _closeController!: AbortController;
2183
2208
  private _respondToIHaveTimeout!: any;
2184
2209
  private _checkedPrune!: CheckedPruneCoordinator<T, R>;
@@ -3561,6 +3586,12 @@ export class SharedLog<
3561
3586
  this.captureReplicationOwnershipLifecycle(),
3562
3587
  isReplicationOwnershipLifecycleActive: (controller) =>
3563
3588
  this.isRepairLifecycleActive(controller),
3589
+ supportsApplicationConfirmation: (peerHash, receiverTransportSession) =>
3590
+ this._peerSyncCapabilitySessions.get(peerHash) ===
3591
+ receiverTransportSession &&
3592
+ ((this._peerSyncCapabilities.get(peerHash) ?? 0) &
3593
+ SYNC_CAPABILITY_REPLICATION_INFO_V2_CONFIRM) !==
3594
+ 0,
3564
3595
  });
3565
3596
  }
3566
3597
 
@@ -3569,6 +3600,7 @@ export class SharedLog<
3569
3600
  SYNC_CAPABILITY_REPLICATION_INFO_V2_DECODE |
3570
3601
  SYNC_CAPABILITY_REPLICATION_INFO_V2_SEND |
3571
3602
  SYNC_CAPABILITY_REPLICATION_INFO_V2_APPLY |
3603
+ SYNC_CAPABILITY_REPLICATION_INFO_V2_CONFIRM |
3572
3604
  (this._logProperties?.sync?.rawExchangeHeads === true
3573
3605
  ? SYNC_CAPABILITY_RAW_EXCHANGE_HEADS
3574
3606
  : 0)
@@ -6187,6 +6219,8 @@ export class SharedLog<
6187
6219
  checkDuplicates?: boolean;
6188
6220
  rebalance?: boolean;
6189
6221
  mergeSegments?: boolean;
6222
+ /** Wait for explicit remote durable application; omitted is unchanged. */
6223
+ confirm?: boolean | ReplicationConfirmationOptions;
6190
6224
  announce?: (
6191
6225
  msg: FullReplicationInfoMutation | AddedReplicationInfoMutation,
6192
6226
  ) => void;
@@ -6197,7 +6231,13 @@ export class SharedLog<
6197
6231
  ? this.replicationController?.maxMemoryLimit
6198
6232
  : undefined;
6199
6233
  try {
6200
- return await this.applyReplicationRole(rangeOrEntry, options);
6234
+ const ranges = await this.applyReplicationRole(rangeOrEntry, options);
6235
+ if (options?.confirm) {
6236
+ await this._v2Send.confirmLatest(
6237
+ typeof options.confirm === "object" ? options.confirm : undefined,
6238
+ );
6239
+ }
6240
+ return ranges;
6201
6241
  } finally {
6202
6242
  const storageObjective = this._isAdaptiveReplicating
6203
6243
  ? this.replicationController?.maxMemoryLimit
@@ -6329,7 +6369,10 @@ export class SharedLog<
6329
6369
  );
6330
6370
  }
6331
6371
 
6332
- async unreplicate(rangeOrEntry?: Entry<T> | { id: Uint8Array }[]) {
6372
+ async unreplicate(
6373
+ rangeOrEntry?: Entry<T> | { id: Uint8Array }[],
6374
+ options?: { confirm?: boolean | ReplicationConfirmationOptions },
6375
+ ) {
6333
6376
  const wasAdaptiveReplicating = this._isAdaptiveReplicating;
6334
6377
  const previousStorageObjective = wasAdaptiveReplicating
6335
6378
  ? this.replicationController?.maxMemoryLimit
@@ -6340,10 +6383,16 @@ export class SharedLog<
6340
6383
  const replicationOwnershipLifecycleController =
6341
6384
  this.captureReplicationOwnershipLifecycle();
6342
6385
  try {
6343
- return await this._unreplicate(
6386
+ const result = await this._unreplicate(
6344
6387
  rangeOrEntry,
6345
6388
  replicationOwnershipLifecycleController,
6346
6389
  );
6390
+ if (options?.confirm) {
6391
+ await this._v2Send.confirmLatest(
6392
+ typeof options.confirm === "object" ? options.confirm : undefined,
6393
+ );
6394
+ }
6395
+ return result;
6347
6396
  } finally {
6348
6397
  const storageObjective = this._isAdaptiveReplicating
6349
6398
  ? this.replicationController?.maxMemoryLimit
@@ -14600,6 +14649,7 @@ export class SharedLog<
14600
14649
  : undefined,
14601
14650
  };
14602
14651
  this._logProperties = options;
14652
+ this._receiveSignatureVerificationFacts = new WeakMap();
14603
14653
 
14604
14654
  this.domain = options?.domain
14605
14655
  ? (options.domain(this) as unknown as D)
@@ -17039,6 +17089,93 @@ export class SharedLog<
17039
17089
  });
17040
17090
  }
17041
17091
 
17092
+ private receiveSignatureVerificationResult(
17093
+ entry: Entry<T>,
17094
+ ): boolean | undefined {
17095
+ return getReceiveSignatureVerificationResult(
17096
+ this._receiveSignatureVerificationFacts,
17097
+ entry,
17098
+ );
17099
+ }
17100
+
17101
+ private async preverifyReceiveSignaturesBatch(
17102
+ entries: Entry<T>[],
17103
+ profile?: SyncProfileFn,
17104
+ ): Promise<ReceiveSignatureVerificationFact<T>[] | undefined> {
17105
+ const candidates = entries.filter(
17106
+ (entry) => !entry.createdLocally && !hasPreverifiedSignature(entry),
17107
+ );
17108
+ if (candidates.length < NATIVE_ED25519_VERIFY_BATCH_MIN_ENTRIES) {
17109
+ return undefined;
17110
+ }
17111
+
17112
+ let storageBytes: Uint8Array[];
17113
+ let signableInputs: Ed25519VerifyBatchInput[] | undefined;
17114
+ try {
17115
+ // Capture the callback-visible storage state and native signable inputs
17116
+ // before the first await so the result is bound to one entry state.
17117
+ storageBytes = candidates.map((entry) => entry.getStorageBytes().slice());
17118
+ signableInputs =
17119
+ this.prepareReceiveNativeEd25519VerificationBatch(candidates);
17120
+ } catch {
17121
+ return undefined;
17122
+ }
17123
+ if (!signableInputs) {
17124
+ return undefined;
17125
+ }
17126
+
17127
+ const verifyStartedAt = syncProfileStart(profile);
17128
+ let verified: boolean[] | undefined;
17129
+ try {
17130
+ verified = await verifyEd25519Batch(signableInputs);
17131
+ } catch {
17132
+ verified = undefined;
17133
+ }
17134
+ if (!verified || verified.length !== candidates.length) {
17135
+ return undefined;
17136
+ }
17137
+ if (profile) {
17138
+ emitSyncProfileDuration(profile, verifyStartedAt, {
17139
+ name: "sharedLog.canAppendBatch.verifySignatures",
17140
+ component: "shared-log",
17141
+ entries: candidates.length,
17142
+ messages: 1,
17143
+ details: {
17144
+ native: true,
17145
+ mode: "signable",
17146
+ programCanAppendDeferred: true,
17147
+ },
17148
+ });
17149
+ }
17150
+ return candidates.map((entry, index) => ({
17151
+ entry,
17152
+ storageBytes: storageBytes[index]!,
17153
+ verified: verified[index]!,
17154
+ }));
17155
+ }
17156
+
17157
+ private prepareReceiveNativeEd25519VerificationBatch(
17158
+ entries: Entry<T>[],
17159
+ ): Ed25519VerifyBatchInput[] | undefined {
17160
+ const inputs = this.prepareNativeEd25519VerificationBatch(entries);
17161
+ return inputs?.map((input) => ({
17162
+ signature: input.signature.slice(),
17163
+ publicKey: input.publicKey.slice(),
17164
+ message: input.message.slice(),
17165
+ }));
17166
+ }
17167
+
17168
+ private async withReceiveSignatureVerificationFacts<R>(
17169
+ facts: ReceiveSignatureVerificationFact<T>[] | undefined,
17170
+ operation: () => Promise<R>,
17171
+ ): Promise<R> {
17172
+ return withSignatureVerificationFacts(
17173
+ this._receiveSignatureVerificationFacts,
17174
+ facts,
17175
+ operation,
17176
+ );
17177
+ }
17178
+
17042
17179
  async canAppend(entry: Entry<T>) {
17043
17180
  try {
17044
17181
  if (!entry.meta.data) {
@@ -17052,10 +17189,19 @@ export class SharedLog<
17052
17189
 
17053
17190
  checkMinReplicasLimit(replicas);
17054
17191
 
17055
- // Locally-created entries were signed before append.
17192
+ const receiveSignatureVerification =
17193
+ this.receiveSignatureVerificationResult(entry);
17194
+ if (receiveSignatureVerification === false) {
17195
+ return false;
17196
+ }
17197
+
17198
+ // Locally-created entries were signed before append. Raw prepared entries
17199
+ // can carry a durable verifier fact from their decoder; plain receive facts
17200
+ // are scoped to this lower-log join and checked against the exact bytes.
17056
17201
  if (
17057
17202
  !entry.createdLocally &&
17058
17203
  !hasPreverifiedSignature(entry) &&
17204
+ receiveSignatureVerification !== true &&
17059
17205
  !(await entry.verifySignatures())
17060
17206
  ) {
17061
17207
  return false;
@@ -19608,6 +19754,12 @@ export class SharedLog<
19608
19754
  // entry views.
19609
19755
  const programCanAppend = !!this._logProperties?.canAppend;
19610
19756
  const programOnChange = !!this._logProperties?.onChange;
19757
+ const receiveSignatureVerificationFacts = programCanAppend
19758
+ ? await this.preverifyReceiveSignaturesBatch(
19759
+ materializeAllToMergeEntries(),
19760
+ syncProfile,
19761
+ )
19762
+ : undefined;
19611
19763
  const nativeBackboneCommitValidation = programCanAppend
19612
19764
  ? undefined
19613
19765
  : this.validatePreparedRawReceiveHeadsMetadataWithNativeBackbone(
@@ -19811,35 +19963,43 @@ export class SharedLog<
19811
19963
  const joinOnAppendHashes = programOnChange
19812
19964
  ? undefined
19813
19965
  : onAppendHashes;
19814
- const joinedPreparedFacts =
19815
- canUsePreparedAppendFacts &&
19816
- (await trustedLowerLog.joinPreparedAppendFactsBatch(
19817
- preparedAppendFacts,
19818
- {
19966
+ let joinedPreparedFacts = false;
19967
+ const joinLowerLog = async () => {
19968
+ joinedPreparedFacts =
19969
+ canUsePreparedAppendFacts &&
19970
+ (await trustedLowerLog.joinPreparedAppendFactsBatch(
19971
+ preparedAppendFacts,
19972
+ {
19973
+ __peerbitEntriesAlreadyMissing: true,
19974
+ __peerbitCanAppendAlreadyValidated: true,
19975
+ __peerbitDeferIndexWrite: true,
19976
+ __peerbitOnAppendHashes: joinOnAppendHashes,
19977
+ __peerbitProfile: syncProfile,
19978
+ __peerbitNativePreparedJoinCommit:
19979
+ nativePreparedJoinCommit,
19980
+ __peerbitNativePreparedJoinCommitValidatesPlan:
19981
+ nativePreparedJoinCommitValidatesPlan,
19982
+ __peerbitOnPreparedJoinCommitted: nativePreparedJoinCommit
19983
+ ? finishNativePreparedCoordinates
19984
+ : undefined,
19985
+ },
19986
+ ));
19987
+ if (!joinedPreparedFacts) {
19988
+ await trustedLowerLog.join(materializeAllToMergeEntries(), {
19989
+ __peerbitBatchIndependent: true,
19819
19990
  __peerbitEntriesAlreadyMissing: true,
19820
- __peerbitCanAppendAlreadyValidated: true,
19991
+ __peerbitCanAppendAlreadyValidated:
19992
+ fallbackCanAppendAlreadyValidated,
19821
19993
  __peerbitDeferIndexWrite: true,
19822
19994
  __peerbitOnAppendHashes: joinOnAppendHashes,
19823
19995
  __peerbitProfile: syncProfile,
19824
- __peerbitNativePreparedJoinCommit: nativePreparedJoinCommit,
19825
- __peerbitNativePreparedJoinCommitValidatesPlan:
19826
- nativePreparedJoinCommitValidatesPlan,
19827
- __peerbitOnPreparedJoinCommitted: nativePreparedJoinCommit
19828
- ? finishNativePreparedCoordinates
19829
- : undefined,
19830
- },
19831
- ));
19832
- if (!joinedPreparedFacts) {
19833
- await trustedLowerLog.join(materializeAllToMergeEntries(), {
19834
- __peerbitBatchIndependent: true,
19835
- __peerbitEntriesAlreadyMissing: true,
19836
- __peerbitCanAppendAlreadyValidated:
19837
- fallbackCanAppendAlreadyValidated,
19838
- __peerbitDeferIndexWrite: true,
19839
- __peerbitOnAppendHashes: joinOnAppendHashes,
19840
- __peerbitProfile: syncProfile,
19841
- });
19842
- }
19996
+ });
19997
+ }
19998
+ };
19999
+ await this.withReceiveSignatureVerificationFacts(
20000
+ receiveSignatureVerificationFacts,
20001
+ joinLowerLog,
20002
+ );
19843
20003
  // A recursive lower-log join can resolve successfully while declining
19844
20004
  // an individual top-level entry (for example, when one of its parents
19845
20005
  // is temporarily unavailable). The public Log.join() API intentionally
@@ -20153,6 +20313,42 @@ export class SharedLog<
20153
20313
  this.markEntriesKnownByPeer(msg.hashes, context.from.hashcode());
20154
20314
  this.clearRepairFrontierHashes(context.from.hashcode(), msg.hashes);
20155
20315
  return;
20316
+ } else if (msg instanceof RequestReplicationInfoV2AppliedMessage) {
20317
+ if (
20318
+ receiveSession?.phase === "open" &&
20319
+ this._peerSyncCapabilitySessions.get(receiveFromHash) ===
20320
+ context.message.header.session &&
20321
+ ((this._peerSyncCapabilities.get(receiveFromHash) ?? 0) &
20322
+ SYNC_CAPABILITY_REPLICATION_INFO_V2_CONFIRM) !==
20323
+ 0
20324
+ ) {
20325
+ const applied = this._v2Receive.confirmApplied(msg, {
20326
+ from: context.from,
20327
+ peerSession: receiveSession,
20328
+ receiveEpoch: receiveReplicationInfoReceiveEpoch,
20329
+ senderTransportSession: context.message.header.session,
20330
+ });
20331
+ if (applied) {
20332
+ await this.rpc.send(applied, {
20333
+ mode: new SilentDelivery({
20334
+ to: [context.from],
20335
+ redundancy: 1,
20336
+ }),
20337
+ priority: CONVERGENCE_MESSAGE_PRIORITY,
20338
+ signal: AbortSignal.any([
20339
+ this._closeController.signal,
20340
+ lane.ownershipLifecycleController.signal,
20341
+ ]),
20342
+ });
20343
+ }
20344
+ }
20345
+ return;
20346
+ } else if (msg instanceof ReplicationInfoV2AppliedMessage) {
20347
+ this._v2Send.acceptApplied(msg, {
20348
+ from: context.from,
20349
+ receiverTransportSession: context.message.header.session,
20350
+ });
20351
+ return;
20156
20352
  } else if (isReplicationInfoV2Message(msg)) {
20157
20353
  await this.handleReplicationInfoV2Announcement(
20158
20354
  msg,