@optimystic/db-core 1.19.0 → 1.20.1
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.
- package/dist/src/cluster/structs.d.ts +41 -8
- package/dist/src/cluster/structs.d.ts.map +1 -1
- package/dist/src/cluster/structs.js +18 -7
- package/dist/src/cluster/structs.js.map +1 -1
- package/dist/src/collection/action.d.ts +29 -0
- package/dist/src/collection/action.d.ts.map +1 -1
- package/dist/src/collection/action.js +6 -0
- package/dist/src/collection/action.js.map +1 -1
- package/dist/src/collection/collection.d.ts +533 -120
- package/dist/src/collection/collection.d.ts.map +1 -1
- package/dist/src/collection/collection.js +974 -500
- package/dist/src/collection/collection.js.map +1 -1
- package/dist/src/collection/head-commit.d.ts +110 -0
- package/dist/src/collection/head-commit.d.ts.map +1 -0
- package/dist/src/collection/head-commit.js +65 -0
- package/dist/src/collection/head-commit.js.map +1 -0
- package/dist/src/collection/index.d.ts +2 -0
- package/dist/src/collection/index.d.ts.map +1 -1
- package/dist/src/collection/index.js +2 -0
- package/dist/src/collection/index.js.map +1 -1
- package/dist/src/collection/segments.d.ts +77 -0
- package/dist/src/collection/segments.d.ts.map +1 -0
- package/dist/src/collection/segments.js +110 -0
- package/dist/src/collection/segments.js.map +1 -0
- package/dist/src/collection/struct.d.ts +156 -1
- package/dist/src/collection/struct.d.ts.map +1 -1
- package/dist/src/collection/struct.js +70 -0
- package/dist/src/collection/struct.js.map +1 -1
- package/dist/src/collection/write-attempts.d.ts +245 -0
- package/dist/src/collection/write-attempts.d.ts.map +1 -0
- package/dist/src/collection/write-attempts.js +439 -0
- package/dist/src/collection/write-attempts.js.map +1 -0
- package/dist/src/collections/tree/struct.d.ts +100 -17
- package/dist/src/collections/tree/struct.d.ts.map +1 -1
- package/dist/src/collections/tree/struct.js +38 -7
- package/dist/src/collections/tree/struct.js.map +1 -1
- package/dist/src/collections/tree/tree.d.ts +17 -5
- package/dist/src/collections/tree/tree.d.ts.map +1 -1
- package/dist/src/collections/tree/tree.js +112 -26
- package/dist/src/collections/tree/tree.js.map +1 -1
- package/dist/src/index.d.ts +2 -0
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +2 -0
- package/dist/src/index.js.map +1 -1
- package/dist/src/network/i-repo.d.ts +3 -0
- package/dist/src/network/i-repo.d.ts.map +1 -1
- package/dist/src/network/index.d.ts +3 -0
- package/dist/src/network/index.d.ts.map +1 -1
- package/dist/src/network/index.js +3 -0
- package/dist/src/network/index.js.map +1 -1
- package/dist/src/network/promise-shortfall-error.d.ts +40 -0
- package/dist/src/network/promise-shortfall-error.d.ts.map +1 -0
- package/dist/src/network/promise-shortfall-error.js +67 -0
- package/dist/src/network/promise-shortfall-error.js.map +1 -0
- package/dist/src/network/refuse-solo.d.ts +8 -0
- package/dist/src/network/refuse-solo.d.ts.map +1 -0
- package/dist/src/network/refuse-solo.js +8 -0
- package/dist/src/network/refuse-solo.js.map +1 -0
- package/dist/src/network/stale-failure.d.ts +20 -3
- package/dist/src/network/stale-failure.d.ts.map +1 -1
- package/dist/src/network/stale-failure.js +24 -3
- package/dist/src/network/stale-failure.js.map +1 -1
- package/dist/src/network/struct.d.ts +148 -2
- package/dist/src/network/struct.d.ts.map +1 -1
- package/dist/src/network/struct.js.map +1 -1
- package/dist/src/network/validity-rejected-error.d.ts +28 -0
- package/dist/src/network/validity-rejected-error.d.ts.map +1 -0
- package/dist/src/network/validity-rejected-error.js +51 -0
- package/dist/src/network/validity-rejected-error.js.map +1 -0
- package/dist/src/offline/entry.d.ts +72 -0
- package/dist/src/offline/entry.d.ts.map +1 -0
- package/dist/src/offline/entry.js +73 -0
- package/dist/src/offline/entry.js.map +1 -0
- package/dist/src/offline/index.d.ts +5 -0
- package/dist/src/offline/index.d.ts.map +1 -0
- package/dist/src/offline/index.js +5 -0
- package/dist/src/offline/index.js.map +1 -0
- package/dist/src/offline/journal.d.ts +61 -0
- package/dist/src/offline/journal.d.ts.map +1 -0
- package/dist/src/offline/journal.js +2 -0
- package/dist/src/offline/journal.js.map +1 -0
- package/dist/src/offline/queue.d.ts +484 -0
- package/dist/src/offline/queue.d.ts.map +1 -0
- package/dist/src/offline/queue.js +1236 -0
- package/dist/src/offline/queue.js.map +1 -0
- package/dist/src/offline/reachability.d.ts +25 -0
- package/dist/src/offline/reachability.d.ts.map +1 -0
- package/dist/src/offline/reachability.js +13 -0
- package/dist/src/offline/reachability.js.map +1 -0
- package/dist/src/offline/status.d.ts +148 -0
- package/dist/src/offline/status.d.ts.map +1 -0
- package/dist/src/offline/status.js +63 -0
- package/dist/src/offline/status.js.map +1 -0
- package/dist/src/offline/wake.d.ts +30 -0
- package/dist/src/offline/wake.d.ts.map +1 -0
- package/dist/src/offline/wake.js +68 -0
- package/dist/src/offline/wake.js.map +1 -0
- package/dist/src/testing/test-transactor.d.ts +29 -0
- package/dist/src/testing/test-transactor.d.ts.map +1 -1
- package/dist/src/testing/test-transactor.js +50 -0
- package/dist/src/testing/test-transactor.js.map +1 -1
- package/dist/src/transaction/commit-failure-class.d.ts +103 -0
- package/dist/src/transaction/commit-failure-class.d.ts.map +1 -0
- package/dist/src/transaction/commit-failure-class.js +96 -0
- package/dist/src/transaction/commit-failure-class.js.map +1 -0
- package/dist/src/transaction/coordinator.d.ts +165 -41
- package/dist/src/transaction/coordinator.d.ts.map +1 -1
- package/dist/src/transaction/coordinator.js +605 -300
- package/dist/src/transaction/coordinator.js.map +1 -1
- package/dist/src/transaction/entry-commit.d.ts +139 -0
- package/dist/src/transaction/entry-commit.d.ts.map +1 -0
- package/dist/src/transaction/entry-commit.js +199 -0
- package/dist/src/transaction/entry-commit.js.map +1 -0
- package/dist/src/transaction/index.d.ts +4 -1
- package/dist/src/transaction/index.d.ts.map +1 -1
- package/dist/src/transaction/index.js +1 -0
- package/dist/src/transaction/index.js.map +1 -1
- package/dist/src/transaction/transaction.d.ts +20 -0
- package/dist/src/transaction/transaction.d.ts.map +1 -1
- package/dist/src/transaction/validator.d.ts +7 -0
- package/dist/src/transaction/validator.d.ts.map +1 -1
- package/dist/src/transaction/validator.js +21 -12
- package/dist/src/transaction/validator.js.map +1 -1
- package/dist/src/transactor/network-transactor.d.ts +1 -0
- package/dist/src/transactor/network-transactor.d.ts.map +1 -1
- package/dist/src/transactor/network-transactor.js +61 -28
- package/dist/src/transactor/network-transactor.js.map +1 -1
- package/dist/src/transactor/transactor-source.d.ts +22 -11
- package/dist/src/transactor/transactor-source.d.ts.map +1 -1
- package/dist/src/transactor/transactor-source.js +9 -13
- package/dist/src/transactor/transactor-source.js.map +1 -1
- package/dist/src/utility/visit-every.d.ts +14 -0
- package/dist/src/utility/visit-every.d.ts.map +1 -0
- package/dist/src/utility/visit-every.js +27 -0
- package/dist/src/utility/visit-every.js.map +1 -0
- package/package.json +1 -1
- package/src/cluster/structs.ts +42 -7
- package/src/collection/action.ts +34 -0
- package/src/collection/collection.ts +1048 -543
- package/src/collection/head-commit.ts +148 -0
- package/src/collection/index.ts +2 -0
- package/src/collection/segments.ts +149 -0
- package/src/collection/struct.ts +183 -1
- package/src/collection/write-attempts.ts +506 -0
- package/src/collections/tree/struct.ts +97 -17
- package/src/collections/tree/tree.ts +125 -29
- package/src/index.ts +2 -0
- package/src/network/i-repo.ts +3 -0
- package/src/network/index.ts +3 -0
- package/src/network/promise-shortfall-error.ts +69 -0
- package/src/network/refuse-solo.ts +7 -0
- package/src/network/stale-failure.ts +27 -4
- package/src/network/struct.ts +154 -2
- package/src/network/validity-rejected-error.ts +55 -0
- package/src/offline/entry.ts +127 -0
- package/src/offline/index.ts +4 -0
- package/src/offline/journal.ts +60 -0
- package/src/offline/queue.ts +1342 -0
- package/src/offline/reachability.ts +32 -0
- package/src/offline/status.ts +183 -0
- package/src/offline/wake.ts +67 -0
- package/src/testing/test-transactor.ts +53 -0
- package/src/transaction/commit-failure-class.ts +133 -0
- package/src/transaction/coordinator.ts +696 -349
- package/src/transaction/entry-commit.ts +285 -0
- package/src/transaction/index.ts +4 -0
- package/src/transaction/transaction.ts +21 -0
- package/src/transaction/validator.ts +22 -12
- package/src/transactor/network-transactor.ts +62 -28
- package/src/transactor/transactor-source.ts +29 -13
- package/src/utility/visit-every.ts +25 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/transaction/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/transaction/index.ts"],"names":[],"mappings":"AAiBA,OAAO,EACN,sBAAsB,EACtB,cAAc,EACd,mBAAmB,EACnB,uBAAuB,EACvB,0BAA0B,EAC1B,oBAAoB,EACpB,sBAAsB,EACtB,kBAAkB,EAClB,WAAW,EACX,aAAa,EACb,mBAAmB,EACnB,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EACN,aAAa,EACb,iBAAiB,GACjB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EAAE,uBAAuB,EAAE,MAAM,gCAAgC,CAAC;AACzE,OAAO,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAC;AAE1D,OAAO,EAAE,+BAA+B,EAAE,6BAA6B,EAAE,yBAAyB,EAAE,MAAM,aAAa,CAAC;AACxH,OAAO,EAAE,qBAAqB,EAAE,uBAAuB,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAE1G,OAAO,EAAE,qBAAqB,EAAE,0BAA0B,EAAE,MAAM,iBAAiB,CAAC;AAGpF,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAClD,OAAO,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAGtD,OAAO,EACN,iBAAiB,EACjB,cAAc,EACd,kBAAkB,EAClB,0BAA0B,EAC1B,cAAc,EACd,gBAAgB,EAChB,eAAe,GACf,MAAM,sBAAsB,CAAC"}
|
|
@@ -329,6 +329,24 @@ export declare function createActionsStatements(collections: CollectionActions[]
|
|
|
329
329
|
export type ActionsStatement = {
|
|
330
330
|
collections: CollectionActions[];
|
|
331
331
|
};
|
|
332
|
+
/**
|
|
333
|
+
* The structured class on a refusal that judges the transaction ITSELF wrong: the checker re-ran it,
|
|
334
|
+
* or checked what it claims about itself, and found it false. Such a refusal fails the same way on
|
|
335
|
+
* every retry and at every honest validator.
|
|
336
|
+
*
|
|
337
|
+
* Present only for that class. A refusal that is out of date (a stale read), expired, or that this
|
|
338
|
+
* node could not judge (an unknown engine, a schema it does not hold, an operations-hash format it
|
|
339
|
+
* does not produce, a checker that threw) carries none — so absent means "not known to be a validity
|
|
340
|
+
* judgement", which is also what an older build that never sets it means.
|
|
341
|
+
*
|
|
342
|
+
* It exists because the refusal's `reason` is free-form prose that must never become control flow: a
|
|
343
|
+
* cluster member signs this into its reject vote (`Signature`'s `validity`), and that signed marker is
|
|
344
|
+
* what lets a writer tell "refused for good" from "try again".
|
|
345
|
+
*/
|
|
346
|
+
export type ValidityRejection = {
|
|
347
|
+
/** The operations hash this node computed by re-executing the transaction, when it got that far. */
|
|
348
|
+
computedHash?: string;
|
|
349
|
+
};
|
|
332
350
|
/**
|
|
333
351
|
* Result of transaction validation.
|
|
334
352
|
*/
|
|
@@ -339,6 +357,8 @@ export type ValidationResult = {
|
|
|
339
357
|
reason?: string;
|
|
340
358
|
/** The operations hash computed during validation (for debugging) */
|
|
341
359
|
computedHash?: string;
|
|
360
|
+
/** Set only on a failure that judges the transaction itself wrong; see {@link ValidityRejection}. */
|
|
361
|
+
validity?: ValidityRejection;
|
|
342
362
|
};
|
|
343
363
|
/**
|
|
344
364
|
* Transaction validator interface.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transaction.d.ts","sourceRoot":"","sources":["../../../src/transaction/transaction.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AAG7D;;;;;GA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GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG;IAC9B,mCAAmC;IACnC,KAAK,EAAE,OAAO,CAAC;IACf,qDAAqD;IACrD,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,qEAAqE;IACrE,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,qGAAqG;IACrG,QAAQ,CAAC,EAAE,iBAAiB,CAAC;CAC7B,CAAC;AAEF;;;;;;;;GAQG;AACH,MAAM,WAAW,qBAAqB;IACrC;;;;;;;;;;;;;;;;;;;OAmBG;IACH,QAAQ,CAAC,WAAW,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAC;IAEtF;;;;;;OAMG;IACH,aAAa,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC;CAC7D"}
|
|
@@ -32,6 +32,13 @@ export type BlockStateProvider = (blockId: BlockId) => Promise<BlockActionState
|
|
|
32
32
|
*
|
|
33
33
|
* Validates transactions by re-executing them and comparing operations hash.
|
|
34
34
|
* Used by cluster participants when receiving PendRequests.
|
|
35
|
+
*
|
|
36
|
+
* Every refusal is classed, because a writer and the dispute path act on the class and must never
|
|
37
|
+
* read the prose to find it. Five refusals judge the transaction itself wrong and carry
|
|
38
|
+
* `validity` ({@link validityRefusal}): a tampered stamp, a missing or invalid client signature, a
|
|
39
|
+
* failed re-execution, and an operations-hash mismatch. The rest carry none: an expired stamp (a
|
|
40
|
+
* clock judgement), a stale read (out of date — a re-read can win), and an unknown engine, a schema
|
|
41
|
+
* mismatch or an operations-hash format this node does not produce (this node cannot judge).
|
|
35
42
|
*/
|
|
36
43
|
export declare class TransactionValidator implements ITransactionValidator {
|
|
37
44
|
private readonly engines;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validator.d.ts","sourceRoot":"","sources":["../../../src/transaction/validator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,E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2
|
import { collectOperations, hashOperations, opsHashVersion, OPS_HASH_VERSION } from './operations-hash.js';
|
|
3
|
+
/**
|
|
4
|
+
* A refusal that judges the transaction itself wrong, marked so (see {@link ValidityRejection}).
|
|
5
|
+
* `computedHash` is this node's own re-execution result, present once re-execution produced one.
|
|
6
|
+
*/
|
|
7
|
+
function validityRefusal(reason, computedHash) {
|
|
8
|
+
return computedHash === undefined
|
|
9
|
+
? { valid: false, reason, validity: {} }
|
|
10
|
+
: { valid: false, reason, computedHash, validity: { computedHash } };
|
|
11
|
+
}
|
|
3
12
|
/**
|
|
4
13
|
* Transaction validator implementation.
|
|
5
14
|
*
|
|
6
15
|
* Validates transactions by re-executing them and comparing operations hash.
|
|
7
16
|
* Used by cluster participants when receiving PendRequests.
|
|
17
|
+
*
|
|
18
|
+
* Every refusal is classed, because a writer and the dispute path act on the class and must never
|
|
19
|
+
* read the prose to find it. Five refusals judge the transaction itself wrong and carry
|
|
20
|
+
* `validity` ({@link validityRefusal}): a tampered stamp, a missing or invalid client signature, a
|
|
21
|
+
* failed re-execution, and an operations-hash mismatch. The rest carry none: an expired stamp (a
|
|
22
|
+
* clock judgement), a stale read (out of date — a re-read can win), and an unknown engine, a schema
|
|
23
|
+
* mismatch or an operations-hash format this node does not produce (this node cannot judge).
|
|
8
24
|
*/
|
|
9
25
|
export class TransactionValidator {
|
|
10
26
|
engines;
|
|
@@ -25,7 +41,7 @@ export class TransactionValidator {
|
|
|
25
41
|
// a tampered stamp corrupts expiration and engine selection regardless of signatures.
|
|
26
42
|
const expectedId = await computeStampId(stamp);
|
|
27
43
|
if (expectedId !== stamp.id) {
|
|
28
|
-
return
|
|
44
|
+
return validityRefusal('Tampered transaction stamp');
|
|
29
45
|
}
|
|
30
46
|
// 0. Check expiration before any other work. Ordered BEFORE the signature check so
|
|
31
47
|
// an attacker cannot learn signature-validity for an already-expired transaction.
|
|
@@ -40,11 +56,11 @@ export class TransactionValidator {
|
|
|
40
56
|
// both pass — the p2p enforcement flag decides whether to inject the port at all.
|
|
41
57
|
if (this.verifyClientSignature) {
|
|
42
58
|
if (transaction.signature === undefined) {
|
|
43
|
-
return
|
|
59
|
+
return validityRefusal('Missing client signature');
|
|
44
60
|
}
|
|
45
61
|
const payload = clientSignaturePayload(stamp.id, transaction.statements, transaction.reads);
|
|
46
62
|
if (!this.verifyClientSignature(stamp.peerId, payload, transaction.signature)) {
|
|
47
|
-
return
|
|
63
|
+
return validityRefusal('Invalid client signature');
|
|
48
64
|
}
|
|
49
65
|
}
|
|
50
66
|
// 1. Verify engine exists
|
|
@@ -99,10 +115,7 @@ export class TransactionValidator {
|
|
|
99
115
|
// skipped by the empty-actions guard.
|
|
100
116
|
const result = await registration.engine.execute(transaction);
|
|
101
117
|
if (!result.success) {
|
|
102
|
-
return {
|
|
103
|
-
valid: false,
|
|
104
|
-
reason: `Re-execution failed: ${result.error}`
|
|
105
|
-
};
|
|
118
|
+
return validityRefusal(`Re-execution failed: ${result.error}`);
|
|
106
119
|
}
|
|
107
120
|
// 6. Apply actions to the isolated validation coordinator (builds transforms).
|
|
108
121
|
// Reached only for pure-translator engines that RETURNED actions; a side-effect
|
|
@@ -134,11 +147,7 @@ export class TransactionValidator {
|
|
|
134
147
|
computedHash
|
|
135
148
|
};
|
|
136
149
|
}
|
|
137
|
-
return
|
|
138
|
-
valid: false,
|
|
139
|
-
reason: `Operations hash mismatch`,
|
|
140
|
-
computedHash
|
|
141
|
-
};
|
|
150
|
+
return validityRefusal('Operations hash mismatch', computedHash);
|
|
142
151
|
}
|
|
143
152
|
return { valid: true, computedHash };
|
|
144
153
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validator.js","sourceRoot":"","sources":["../../../src/transaction/validator.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,oBAAoB,EAAE,sBAAsB,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAChG,OAAO,EAAE,iBAAiB,EAAE,cAAc,EAAE,cAAc,EAAE,gBAAgB,E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knowledgement without re-deriving the set by a second rule.
|
|
320
320
|
*/
|
|
321
321
|
private cancelAbandonedSweepBlocks;
|
|
322
|
+
/** Commits `request`'s one block (the tail), returning a confirmed conflict and throwing a transient fault. */
|
|
322
323
|
private commitBlock;
|
|
323
324
|
/**
|
|
324
325
|
* The RETURNED `success:false` responses out of a set of commit batches, merged by
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"network-transactor.d.ts","sourceRoot":"","sources":["../../../src/transactor/network-transactor.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAMlD,OAAO,KAAK,EAAE,gBAAgB,EAAE,YAAY,EAAE,aAAa,EAAE,iBAAiB,EAAE,WAAW,EAA0D,WAAW,EAAE,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,YAAY,EAAE,WAAW,EAAE,KAAK,EAAE,SAAS,EAAc,aAAa,EAAE,QAAQ,EAAqB,qBAAqB,EAAE,YAAY,EAA0H,MAAM,aAAa,CAAC;AAC9d,OAAO,KAAK,EAAE,oBAAoB,EAAE,wBAAwB,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"network-transactor.d.ts","sourceRoot":"","sources":["../../../src/transactor/network-transactor.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAMlD,OAAO,KAAK,EAAE,gBAAgB,EAAE,YAAY,EAAE,aAAa,EAAE,iBAAiB,EAAE,WAAW,EAA0D,WAAW,EAAE,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,YAAY,EAAE,WAAW,EAAE,KAAK,EAAE,SAAS,EAAc,aAAa,EAAE,QAAQ,EAAqB,qBAAqB,EAAE,YAAY,EAA0H,MAAM,aAAa,CAAC;AAC9d,OAAO,KAAK,EAAE,oBAAoB,EAAE,wBAAwB,EAAE,MAAM,sBAAsB,CAAC;AAa3F,OAAO,EAAe,KAAK,eAAe,EAAE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M,CAAC,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,YAAY,CAAC;IAmB3D;;;;;;;;;;;;;;;;;;;;;;;;OAwBG;YACW,gBAAgB;IAmB9B;;;;;;;;;;;;OAYG;IACG,UAAU,CAAC,QAAQ,EAAE,SAAS,aAAa,EAAE,GAAG,OAAO,CAAC,YAAY,GAAG,SAAS,CAAC;IA4BvF;;;;;OAKG;YACW,qBAAqB;IAenC;;;;OAIG;YACW,mBAAmB;IAsFjC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAiCG;YACW,0BAA0B;IA2BxC,+GAA+G;YACjG,WAAW;IAiBzB;;;;;;OAMG;IACH,OAAO,CAAC,gBAAgB;IAKxB,wHAAwH;IACxH,OAAO,CAAC,UAAU;IAIlB,2EAA2E;YAC7D,YAAY;IAuC1B,8FAA8F;YAChF,iBAAiB;IAmB/B;;;;;;;OAOG;YACW,kBAAkB;IAehC;;;;;OAKG;IACH,OAAO,CAAC,kBAAkB;IA2B1B;;;;;;;;;;;;;;;OAeG;YACW,WAAW;IAazB;;;;;;;;;;;;;OAaG;IACH,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,iBAAiB,CAAK;IAE9C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAqCG;YACW,eAAe;IAmD7B;;;;OAIG;YACW,WAAW;IA0BzB;;;;OAIG;YACW,gBAAgB;IAQ9B;;wCAEoC;IACpC,OAAO,CAAC,mBAAmB;CAW3B;AAwOD;;GAEG;AACH,wBAAgB,6BAA6B,CAAC,YAAY,EAAE,gBAAgB,EAAE,GAAG,gBAAgB,EAAE,CAIlG"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { peerIdFromString } from "../network/types.js";
|
|
2
|
-
import { highestStaleAt, isConflictFailure, isExpiryFailure } from "../network/stale-failure.js";
|
|
2
|
+
import { highestStaleAt, isConflictFailure, isExpiryFailure, isRejectedFailure, isShortfallFailure } from "../network/stale-failure.js";
|
|
3
3
|
import { BlockUnavailableError, BlockPossiblyStaleError } from "../network/struct.js";
|
|
4
4
|
import { mergeDurability, withTornBlocks } from "../network/durability.js";
|
|
5
5
|
import { judgeCohortLineage } from "../network/lineage.js";
|
|
@@ -7,6 +7,7 @@ import { assertTransactionFits, transactionBytes, MAX_TRANSACTION_BYTES } from "
|
|
|
7
7
|
import { transformForBlockId, concatTransforms, concatTransform, transformsFromTransform, blockIdsForTransforms } from "../transform/helpers.js";
|
|
8
8
|
import { Tracker } from "../transform/tracker.js";
|
|
9
9
|
import { blockDigestsField, baseRevsField } from "../transform/digest.js";
|
|
10
|
+
import { refuseSoloField } from "../network/refuse-solo.js";
|
|
10
11
|
import { CacheSource } from "../transform/cache-source.js";
|
|
11
12
|
import { TransactorSource, servedRevision } from "./transactor-source.js";
|
|
12
13
|
import { Log } from "../log/log.js";
|
|
@@ -319,20 +320,34 @@ export class NetworkTransactor {
|
|
|
319
320
|
}
|
|
320
321
|
}
|
|
321
322
|
}
|
|
322
|
-
//
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
323
|
+
// A block with no entry is one of two things. When no batch carrying it got any response — each
|
|
324
|
+
// threw, timed out or was still in flight at the deadline — no coordinator was heard from, the
|
|
325
|
+
// `'peers-unreachable'` answer `CoordinatorRepo` gives for a consult that threw: flagged, so the
|
|
326
|
+
// read of THAT block fails typed (`BlockUnavailableError`) while its siblings are returned. When
|
|
327
|
+
// some coordinator responded and left it out, that is a protocol fault, not unreachability, and
|
|
328
|
+
// fails the whole read as it always has. Flagged entries are added after the merge, so they
|
|
329
|
+
// never compete with a real answer.
|
|
330
|
+
const responded = respondedBlocks(batches);
|
|
331
|
+
const omittedIds = distinctBlockIds.filter(bid => !resultEntries.has(bid) && responded.has(bid));
|
|
332
|
+
const unansweredIds = distinctBlockIds.filter(bid => !resultEntries.has(bid) && !responded.has(bid));
|
|
333
|
+
const rootCause = firstBatchError(batches) ?? error;
|
|
334
|
+
if (omittedIds.length > 0) {
|
|
335
|
+
log('get:missing blockIds=%o', omittedIds);
|
|
326
336
|
const details = this.formatBatchStatuses(batches, b => {
|
|
327
337
|
const status = b.request == null ? 'no-response' : (b.request.isResponse ? 'response' : 'in-flight');
|
|
328
338
|
const errMsg = b.request?.isError ? ` cause=${errorMessage(b.request.error)}` : '';
|
|
329
339
|
return `${b.peerId.toString()}[block:${b.blockId}](${status})${errMsg}`;
|
|
330
340
|
});
|
|
331
|
-
const rootCause = firstBatchError(batches) ?? error;
|
|
332
341
|
const aggregate = new Error(`Some peers did not complete: ${details}${rootCause ? `; root: ${rootCause.message}` : ''}`);
|
|
333
342
|
aggregate.cause = rootCause;
|
|
334
343
|
throw aggregate;
|
|
335
344
|
}
|
|
345
|
+
if (unansweredIds.length > 0) {
|
|
346
|
+
log('get:unanswered blockIds=%o root=%s', unansweredIds, errorMessage(rootCause));
|
|
347
|
+
for (const bid of unansweredIds) {
|
|
348
|
+
resultEntries.set(bid, { state: {}, unavailable: 'peers-unreachable' });
|
|
349
|
+
}
|
|
350
|
+
}
|
|
336
351
|
log('get:done blockIds=%d ms=%d', distinctBlockIds.length, Date.now() - t0);
|
|
337
352
|
return Object.fromEntries(resultEntries);
|
|
338
353
|
}
|
|
@@ -987,7 +1002,7 @@ export class NetworkTransactor {
|
|
|
987
1002
|
* its tail, and for a {@link commitInOneRound} that threw.
|
|
988
1003
|
*/
|
|
989
1004
|
async commitTailThenSweep(request, remainingBlocks) {
|
|
990
|
-
const tailResult = await this.commitBlock(request
|
|
1005
|
+
const tailResult = await this.commitBlock(commitOf(request, [request.tailId]));
|
|
991
1006
|
if (!tailResult.success) {
|
|
992
1007
|
// NOTE: a refused tail is NOT an absent tail. The coordinator's durability gate answers
|
|
993
1008
|
// `commit-not-durable` whenever fewer than a majority hold the revision — even though
|
|
@@ -1018,7 +1033,7 @@ export class NetworkTransactor {
|
|
|
1018
1033
|
// walk. Sweeping before the tail would also let a committed header point at a never-committed
|
|
1019
1034
|
// tail: a dangling pointer, strictly worse than an orphaned block.
|
|
1020
1035
|
if (remainingBlocks.length > 0) {
|
|
1021
|
-
const { batches, error } = await this.commitBlocks(
|
|
1036
|
+
const { batches, error } = await this.commitBlocks(commitOf(request, remainingBlocks));
|
|
1022
1037
|
cohortReports.push(...confirmedDurabilities(batches));
|
|
1023
1038
|
if (error) {
|
|
1024
1039
|
// Split by the failure's NATURE, exactly as commitBlock does for the tail: a RETURNED
|
|
@@ -1137,8 +1152,9 @@ export class NetworkTransactor {
|
|
|
1137
1152
|
}
|
|
1138
1153
|
return abandoned;
|
|
1139
1154
|
}
|
|
1140
|
-
|
|
1141
|
-
|
|
1155
|
+
/** Commits `request`'s one block (the tail), returning a confirmed conflict and throwing a transient fault. */
|
|
1156
|
+
async commitBlock(request) {
|
|
1157
|
+
const { batches: tailBatches, error: tailError } = await this.commitBlocks(request);
|
|
1142
1158
|
if (tailError) {
|
|
1143
1159
|
// commit is a pure attempt: stale → { success:false }, transient → throw. Cancellation
|
|
1144
1160
|
// is the CALLER's responsibility (coordinator cancelPhase; TransactorSource.transact),
|
|
@@ -1391,7 +1407,7 @@ export class NetworkTransactor {
|
|
|
1391
1407
|
catch (e) {
|
|
1392
1408
|
error = asError(e);
|
|
1393
1409
|
}
|
|
1394
|
-
return { batches, discharged:
|
|
1410
|
+
return { batches, discharged: respondedBlocks(batches), error };
|
|
1395
1411
|
}
|
|
1396
1412
|
/**
|
|
1397
1413
|
* One re-send of a cancel {@link dischargeCancel} gave up on, for {@link owedCancels}: a single
|
|
@@ -1440,18 +1456,19 @@ function bestCoveringPeer(peerBlocks, uncovered, localPeerId) {
|
|
|
1440
1456
|
return best;
|
|
1441
1457
|
}
|
|
1442
1458
|
/**
|
|
1443
|
-
* The block ids some batch in the tree got an ANSWER for. A cancel batch
|
|
1444
|
-
* responded, discharged nothing — its blocks' pending records are still
|
|
1445
|
-
*
|
|
1446
|
-
*
|
|
1459
|
+
* The block ids some batch in the tree got an ANSWER for, whatever the answer said. A cancel batch
|
|
1460
|
+
* that errored, or never responded, discharged nothing — its blocks' pending records are still
|
|
1461
|
+
* standing — so for a cancel this is the discharged set. For a read it separates a block no
|
|
1462
|
+
* coordinator answered from one a coordinator answered without. Batch payloads are block-id lists,
|
|
1463
|
+
* including the retry batches `processBatches` re-homes, so the union across the whole tree counts.
|
|
1447
1464
|
*/
|
|
1448
|
-
function
|
|
1449
|
-
const
|
|
1465
|
+
function respondedBlocks(batches) {
|
|
1466
|
+
const responded = new Set();
|
|
1450
1467
|
for (const b of allBatches(batches, bb => bb.request?.isResponse === true)) {
|
|
1451
1468
|
for (const bid of b.payload)
|
|
1452
|
-
|
|
1469
|
+
responded.add(bid);
|
|
1453
1470
|
}
|
|
1454
|
-
return
|
|
1471
|
+
return responded;
|
|
1455
1472
|
}
|
|
1456
1473
|
/**
|
|
1457
1474
|
* The durability report off every commit batch in the tree that answered `success: true` — the
|
|
@@ -1468,9 +1485,16 @@ function confirmedDurabilities(batches) {
|
|
|
1468
1485
|
* {@link NetworkTransactor.pend} and the commit paths use, since the action-level answer is rebuilt
|
|
1469
1486
|
* from per-batch ones rather than forwarded, and anything not carried here is lost.
|
|
1470
1487
|
*
|
|
1471
|
-
* -
|
|
1472
|
-
*
|
|
1473
|
-
*
|
|
1488
|
+
* - A **validity rejection** anywhere ({@link isRejectedFailure}) is the answer, verbatim — the first
|
|
1489
|
+
* one. Members judged the content, which no retry changes. Above an expiry for the reason a cohort
|
|
1490
|
+
* that judged the content outranks clock votes inside one record: reporting the verdict as a clock
|
|
1491
|
+
* problem would invite a retry the verdict already refuses.
|
|
1492
|
+
* - Otherwise an **expiry** anywhere ({@link isExpiryFailure}) is the answer, verbatim — the first
|
|
1493
|
+
* one. No retry can succeed while that cohort's clocks disagree with the writer's, so a conflict
|
|
1494
|
+
* beside it must not make the write look retryable, and its numbers must reach the writer whole.
|
|
1495
|
+
* - Otherwise a **promise shortfall** anywhere ({@link isShortfallFailure}) is the answer, verbatim —
|
|
1496
|
+
* the first one, for the same reason: no retry can succeed while that cohort's members are silent.
|
|
1497
|
+
* Below an expiry because a shortfall clears when the members come back, and an expiry does not.
|
|
1474
1498
|
* - Otherwise a {@link StaleFailure}: `reason` is the first one any response gave (the only diagnostic
|
|
1475
1499
|
* that survives an exhausted retry budget and the coordinator's error text — a refusal whose reason
|
|
1476
1500
|
* is `commit-not-durable` must not read as "stale commit", a rival's win); `staleAt` is the highest
|
|
@@ -1487,9 +1511,9 @@ function confirmedDurabilities(batches) {
|
|
|
1487
1511
|
* or if mixed-outcome writes show up as wasted retry latency in practice.
|
|
1488
1512
|
*/
|
|
1489
1513
|
function refusalFrom(responses) {
|
|
1490
|
-
const
|
|
1491
|
-
if (
|
|
1492
|
-
return
|
|
1514
|
+
const unretryable = responses.find(isRejectedFailure) ?? responses.find(isExpiryFailure) ?? responses.find(isShortfallFailure);
|
|
1515
|
+
if (unretryable !== undefined) {
|
|
1516
|
+
return unretryable;
|
|
1493
1517
|
}
|
|
1494
1518
|
const staleAt = highestStaleAt(responses.map(r => r.staleAt));
|
|
1495
1519
|
const reason = responses.map(r => r.reason).find(r => r !== undefined);
|
|
@@ -1509,8 +1533,15 @@ function refusalFrom(responses) {
|
|
|
1509
1533
|
* cohort sign for blocks the request is not committing; and `processBatches` re-batches failed blocks
|
|
1510
1534
|
* onto different coordinators, so only a send-time subset stays correct across retries.
|
|
1511
1535
|
*/
|
|
1512
|
-
function repoCommitRequest(blockIds, { actionId, rev, tailId, blockDigests }) {
|
|
1513
|
-
return { actionId, blockIds, rev, tailId, ...digestsFor(blockDigests, blockIds) };
|
|
1536
|
+
function repoCommitRequest(blockIds, { actionId, rev, tailId, blockDigests, refuseSolo }) {
|
|
1537
|
+
return { actionId, blockIds, rev, tailId, ...digestsFor(blockDigests, blockIds), ...refuseSoloField(refuseSolo) };
|
|
1538
|
+
}
|
|
1539
|
+
/** `request`'s commit of `blockIds` alone, for {@link NetworkTransactor}'s two-step path to hand to its
|
|
1540
|
+
* batching: everything the write carries, with its declarations still action-wide — every send goes
|
|
1541
|
+
* through {@link repoCommitRequest}, which narrows them to the blocks that send commits. */
|
|
1542
|
+
function commitOf(request, blockIds) {
|
|
1543
|
+
return { blockIds, actionId: request.actionId, rev: request.rev, tailId: request.tailId, blockDigests: request.blockDigests,
|
|
1544
|
+
...refuseSoloField(request.refuseSolo) };
|
|
1514
1545
|
}
|
|
1515
1546
|
/** `request`'s blocks with its log tail first, each once — the order a coordinator commits them in. */
|
|
1516
1547
|
function tailFirst(request) {
|
|
@@ -1547,7 +1578,9 @@ function baseRevsFor(all, batchBlockIds) {
|
|
|
1547
1578
|
*
|
|
1548
1579
|
* `soleReservation` survives only on a batch carrying every block of the action: a pend split across
|
|
1549
1580
|
* coordinators — by `consolidateCoordinators`, or by `processBatches` re-batching a failed batch — is
|
|
1550
|
-
* several reservations, which the field must never claim to be. Decided per send, like the bases.
|
|
1581
|
+
* several reservations, which the field must never claim to be. Decided per send, like the bases.
|
|
1582
|
+
* Every other field goes on every batch as given — `refuseSolo` included, whose loss on one batch would
|
|
1583
|
+
* let that coordinator's share be written by a lone node the write asked not to be written by. */
|
|
1551
1584
|
function pendRequestForBatch(action, payload) {
|
|
1552
1585
|
const { baseRevs, soleReservation, ...rest } = action;
|
|
1553
1586
|
const batchBlockIds = blockIdsForTransforms(payload);
|