@optimystic/db-core 1.8.1 → 1.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/src/cohort-topic/addressing.d.ts +46 -6
- package/dist/src/cohort-topic/addressing.d.ts.map +1 -1
- package/dist/src/cohort-topic/addressing.js +58 -18
- package/dist/src/cohort-topic/addressing.js.map +1 -1
- package/dist/src/cohort-topic/member-engine.d.ts +21 -1
- package/dist/src/cohort-topic/member-engine.d.ts.map +1 -1
- package/dist/src/cohort-topic/member-engine.js +39 -9
- package/dist/src/cohort-topic/member-engine.js.map +1 -1
- package/dist/src/cohort-topic/membership/publisher.js +1 -1
- package/dist/src/cohort-topic/membership/publisher.js.map +1 -1
- package/dist/src/cohort-topic/membership/source.d.ts +4 -0
- package/dist/src/cohort-topic/membership/source.d.ts.map +1 -1
- package/dist/src/cohort-topic/membership/source.js +4 -0
- package/dist/src/cohort-topic/membership/source.js.map +1 -1
- package/dist/src/cohort-topic/membership/verifier.d.ts +51 -9
- package/dist/src/cohort-topic/membership/verifier.d.ts.map +1 -1
- package/dist/src/cohort-topic/membership/verifier.js +138 -46
- package/dist/src/cohort-topic/membership/verifier.js.map +1 -1
- package/dist/src/cohort-topic/ports.d.ts +85 -14
- package/dist/src/cohort-topic/ports.d.ts.map +1 -1
- package/dist/src/cohort-topic/ports.js +1 -1
- package/dist/src/cohort-topic/ports.js.map +1 -1
- package/dist/src/cohort-topic/registration/renewal.d.ts +26 -5
- package/dist/src/cohort-topic/registration/renewal.d.ts.map +1 -1
- package/dist/src/cohort-topic/registration/renewal.js +71 -21
- package/dist/src/cohort-topic/registration/renewal.js.map +1 -1
- package/dist/src/cohort-topic/service.d.ts +34 -2
- package/dist/src/cohort-topic/service.d.ts.map +1 -1
- package/dist/src/cohort-topic/service.js +86 -28
- package/dist/src/cohort-topic/service.js.map +1 -1
- package/dist/src/cohort-topic/sig/payloads.d.ts +5 -1
- package/dist/src/cohort-topic/sig/payloads.d.ts.map +1 -1
- package/dist/src/cohort-topic/sig/payloads.js +6 -1
- package/dist/src/cohort-topic/sig/payloads.js.map +1 -1
- package/dist/src/cohort-topic/sig/threshold.d.ts +29 -4
- package/dist/src/cohort-topic/sig/threshold.d.ts.map +1 -1
- package/dist/src/cohort-topic/sig/threshold.js +39 -7
- package/dist/src/cohort-topic/sig/threshold.js.map +1 -1
- package/dist/src/cohort-topic/walk.d.ts +19 -4
- package/dist/src/cohort-topic/walk.d.ts.map +1 -1
- package/dist/src/cohort-topic/walk.js +29 -6
- package/dist/src/cohort-topic/walk.js.map +1 -1
- package/dist/src/cohort-topic/willingness.d.ts +17 -1
- package/dist/src/cohort-topic/willingness.d.ts.map +1 -1
- package/dist/src/cohort-topic/willingness.js +18 -3
- package/dist/src/cohort-topic/willingness.js.map +1 -1
- package/dist/src/cohort-topic/wire/index.d.ts +1 -1
- package/dist/src/cohort-topic/wire/index.d.ts.map +1 -1
- package/dist/src/cohort-topic/wire/index.js +1 -1
- package/dist/src/cohort-topic/wire/index.js.map +1 -1
- package/dist/src/cohort-topic/wire/payloads.d.ts +14 -0
- package/dist/src/cohort-topic/wire/payloads.d.ts.map +1 -1
- package/dist/src/cohort-topic/wire/payloads.js +20 -0
- package/dist/src/cohort-topic/wire/payloads.js.map +1 -1
- package/dist/src/cohort-topic/wire/primitives.d.ts +8 -0
- package/dist/src/cohort-topic/wire/primitives.d.ts.map +1 -1
- package/dist/src/cohort-topic/wire/primitives.js +24 -4
- package/dist/src/cohort-topic/wire/primitives.js.map +1 -1
- package/dist/src/cohort-topic/wire/types.d.ts +37 -0
- package/dist/src/cohort-topic/wire/types.d.ts.map +1 -1
- package/dist/src/cohort-topic/wire/validate.d.ts +9 -1
- package/dist/src/cohort-topic/wire/validate.d.ts.map +1 -1
- package/dist/src/cohort-topic/wire/validate.js +23 -4
- package/dist/src/cohort-topic/wire/validate.js.map +1 -1
- package/dist/src/collection/collection.d.ts +17 -0
- package/dist/src/collection/collection.d.ts.map +1 -1
- package/dist/src/collection/collection.js +19 -0
- package/dist/src/collection/collection.js.map +1 -1
- package/dist/src/reactivity/config.d.ts +9 -5
- package/dist/src/reactivity/config.d.ts.map +1 -1
- package/dist/src/reactivity/config.js +9 -4
- package/dist/src/reactivity/config.js.map +1 -1
- package/dist/src/reactivity/index.d.ts +4 -3
- package/dist/src/reactivity/index.d.ts.map +1 -1
- package/dist/src/reactivity/index.js +4 -3
- package/dist/src/reactivity/index.js.map +1 -1
- package/dist/src/reactivity/notification.d.ts +7 -0
- package/dist/src/reactivity/notification.d.ts.map +1 -1
- package/dist/src/reactivity/notification.js +1 -1
- package/dist/src/reactivity/notification.js.map +1 -1
- package/dist/src/reactivity/rotation.d.ts +73 -57
- package/dist/src/reactivity/rotation.d.ts.map +1 -1
- package/dist/src/reactivity/rotation.js +54 -54
- package/dist/src/reactivity/rotation.js.map +1 -1
- package/dist/src/reactivity/subscription.d.ts +12 -9
- package/dist/src/reactivity/subscription.d.ts.map +1 -1
- package/dist/src/reactivity/subscription.js +9 -6
- package/dist/src/reactivity/subscription.js.map +1 -1
- package/dist/src/reactivity/topic-anchor.d.ts +36 -31
- package/dist/src/reactivity/topic-anchor.d.ts.map +1 -1
- package/dist/src/reactivity/topic-anchor.js +41 -39
- package/dist/src/reactivity/topic-anchor.js.map +1 -1
- package/dist/src/reactivity/verify.d.ts +26 -9
- package/dist/src/reactivity/verify.d.ts.map +1 -1
- package/dist/src/reactivity/verify.js +26 -11
- package/dist/src/reactivity/verify.js.map +1 -1
- package/dist/src/reactivity/wire.d.ts +1 -1
- package/dist/src/reactivity/wire.d.ts.map +1 -1
- package/dist/src/transactor/change-notifier.d.ts +1 -1
- package/package.json +5 -5
- package/src/cohort-topic/addressing.ts +83 -23
- package/src/cohort-topic/member-engine.ts +77 -8
- package/src/cohort-topic/membership/publisher.ts +1 -1
- package/src/cohort-topic/membership/source.ts +4 -0
- package/src/cohort-topic/membership/verifier.ts +169 -51
- package/src/cohort-topic/ports.ts +87 -15
- package/src/cohort-topic/registration/renewal.ts +87 -24
- package/src/cohort-topic/service.ts +157 -35
- package/src/cohort-topic/sig/payloads.ts +7 -2
- package/src/cohort-topic/sig/threshold.ts +41 -7
- package/src/cohort-topic/walk.ts +46 -9
- package/src/cohort-topic/willingness.ts +34 -3
- package/src/cohort-topic/wire/index.ts +1 -0
- package/src/cohort-topic/wire/payloads.ts +21 -0
- package/src/cohort-topic/wire/primitives.ts +26 -4
- package/src/cohort-topic/wire/types.ts +37 -0
- package/src/cohort-topic/wire/validate.ts +26 -3
- package/src/collection/collection.ts +20 -0
- package/src/reactivity/config.ts +10 -5
- package/src/reactivity/index.ts +4 -3
- package/src/reactivity/notification.ts +8 -1
- package/src/reactivity/rotation.ts +86 -78
- package/src/reactivity/subscription.ts +12 -9
- package/src/reactivity/topic-anchor.ts +42 -45
- package/src/reactivity/verify.ts +36 -17
- package/src/reactivity/wire.ts +1 -1
- package/src/transactor/change-notifier.ts +1 -1
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
* canonical signed bytes, acceptable pre-release (no deployed nodes speak this protocol, so there is no
|
|
18
18
|
* version to negotiate).
|
|
19
19
|
*/
|
|
20
|
+
import { presentOnly } from "../wire/payloads.js";
|
|
20
21
|
const utf8 = new TextEncoder();
|
|
21
22
|
/** Canonical signed byte image of a membership certificate. */
|
|
22
23
|
export function membershipCertSigningPayload(cert) {
|
|
@@ -34,8 +35,12 @@ export function demotionNoticeSigningPayload(n) {
|
|
|
34
35
|
* Canonical signed byte image of a child-link frame. `cohortEpoch` stays **last** so the `/sign` endorser
|
|
35
36
|
* (`handleSignRequest`) reads the embedded epoch positionally as `image[image.length - 1]`, exactly as it
|
|
36
37
|
* does for a promotion / demotion notice.
|
|
38
|
+
*
|
|
39
|
+
* `rootKey` (a tier-1 child of a root-placed topic) is covered only when present, and is inserted **before**
|
|
40
|
+
* `cohortEpoch` for that same reason. A link without one keeps the eight-element image unchanged; one
|
|
41
|
+
* with it signs nine elements, so stripping or swapping the key fails verification.
|
|
37
42
|
*/
|
|
38
43
|
export function childLinkSigningPayload(n) {
|
|
39
|
-
return utf8.encode(JSON.stringify(["ChildLinkV1", n.topicId, n.childCohortCoord, n.childParticipantCoord, n.childTier, n.tier, n.effectiveAt, n.cohortEpoch]));
|
|
44
|
+
return utf8.encode(JSON.stringify(["ChildLinkV1", n.topicId, n.childCohortCoord, n.childParticipantCoord, n.childTier, n.tier, n.effectiveAt, ...presentOnly(n.rootKey), n.cohortEpoch]));
|
|
40
45
|
}
|
|
41
46
|
//# sourceMappingURL=payloads.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"payloads.js","sourceRoot":"","sources":["../../../../src/cohort-topic/sig/payloads.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;
|
|
1
|
+
{"version":3,"file":"payloads.js","sourceRoot":"","sources":["../../../../src/cohort-topic/sig/payloads.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAGlD,MAAM,IAAI,GAAG,IAAI,WAAW,EAAE,CAAC;AAK/B,+DAA+D;AAC/D,MAAM,UAAU,4BAA4B,CAAC,IAA4B;IACxE,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,kBAAkB,EAAE,IAAI,CAAC,WAAW,EAAE,IAAI,CAAC,WAAW,EAAE,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;AAC/H,CAAC;AAKD,gIAAgI;AAChI,MAAM,UAAU,6BAA6B,CAAC,CAAoB;IACjE,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,mBAAmB,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,WAAW,EAAE,CAAC,CAAC,WAAW,EAAE,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC;AACzI,CAAC;AAKD,+HAA+H;AAC/H,MAAM,UAAU,4BAA4B,CAAC,CAAmB;IAC/D,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,kBAAkB,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,iBAAiB,EAAE,CAAC,CAAC,WAAW,EAAE,CAAC,CAAC,WAAW,EAAE,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC;AAC/I,CAAC;AAKD;;;;;;;;GAQG;AACH,MAAM,UAAU,uBAAuB,CAAC,CAAoB;IAC3D,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,aAAa,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC,gBAAgB,EAAE,CAAC,CAAC,qBAAqB,EAAE,CAAC,CAAC,SAAS,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,WAAW,EAAE,GAAG,WAAW,CAAC,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC;AAC3L,CAAC"}
|
|
@@ -11,10 +11,30 @@
|
|
|
11
11
|
* crypto: the `signers` must be a distinct `≥ minSigs` subset of the certificate's `members`, *and*
|
|
12
12
|
* the signature must verify against the payload. Either failure → not verified.
|
|
13
13
|
*/
|
|
14
|
-
import type { ICohortThresholdCrypto } from "../ports.js";
|
|
14
|
+
import type { ICohortThresholdCrypto, RootPlacement } from "../ports.js";
|
|
15
15
|
import type { MembershipCertV1 } from "../wire/types.js";
|
|
16
|
-
/** Default cohort-signature threshold, `k − x` (see §Configuration). */
|
|
16
|
+
/** Default cohort-signature threshold, `k − x` (see §Configuration). The rule for every coord that is not root-placed. */
|
|
17
17
|
export declare const DEFAULT_MIN_SIGS = 14;
|
|
18
|
+
/**
|
|
19
|
+
* Build the {@link RootPlacement} for a root-placed cohort from this node's own quorum ratio. A ratio
|
|
20
|
+
* outside `(0, 1]` (or not a number) is a configuration error and throws here, at construction, so
|
|
21
|
+
* verification never has to judge a malformed rule. `rootKey` is the routing key the root coordinate is
|
|
22
|
+
* the hash of, when the caller knows it (see {@link RootPlacement.rootKey}); it is carried, never checked
|
|
23
|
+
* here — the anchor that uses it checks that it hashes to the coordinate being judged.
|
|
24
|
+
*/
|
|
25
|
+
export declare function createRootPlacement(quorumRatio: number, rootKey?: Uint8Array): RootPlacement;
|
|
26
|
+
/**
|
|
27
|
+
* Signature threshold of a root-placed cohort of `memberCount` members: `ceil(memberCount × quorumRatio)`.
|
|
28
|
+
*
|
|
29
|
+
* This is the formula `captureCommitCert` (`packages/db-p2p/src/cluster/cluster-repo.ts`) applies to a
|
|
30
|
+
* storage group's commit certificate — `ceil(|group| × superMajorityThreshold)` — written the same way on
|
|
31
|
+
* purpose (same multiplication, same rounding), so a commit certificate and a verifier given the same ratio
|
|
32
|
+
* agree on the threshold by construction. One member needs 1; four members at `0.75` need 3.
|
|
33
|
+
*
|
|
34
|
+
* The floor of 1 only matters for an empty member list, where the formula would yield 0 and "no signers"
|
|
35
|
+
* would count as a quorum; with it, a cert naming no members can never verify.
|
|
36
|
+
*/
|
|
37
|
+
export declare function rootPlacedMinSigs(memberCount: number, placement: RootPlacement): number;
|
|
18
38
|
/** Threshold signer/verifier over the injected cohort crypto. Peer ids are raw bytes. */
|
|
19
39
|
export interface CohortSigner {
|
|
20
40
|
/** Assemble a cohort threshold signature over `payload` (collects `minSigs` signers). */
|
|
@@ -28,6 +48,11 @@ export interface CohortSigner {
|
|
|
28
48
|
*/
|
|
29
49
|
verifyThreshold(payload: Uint8Array, sig: Uint8Array, signers: readonly Uint8Array[], cert: MembershipCertV1, minSigs: number): boolean;
|
|
30
50
|
}
|
|
31
|
-
/**
|
|
32
|
-
|
|
51
|
+
/**
|
|
52
|
+
* Build a {@link CohortSigner} over the FRET-backed (in db-p2p) threshold crypto. `minSigs` is the assembly
|
|
53
|
+
* threshold: a number for a cohort whose threshold is fixed (the node-wide `k − x`), or a function read at
|
|
54
|
+
* each signing for one whose threshold follows its member count (a root-placed cohort under
|
|
55
|
+
* {@link rootPlacedMinSigs}). Verification takes its threshold as an argument either way.
|
|
56
|
+
*/
|
|
57
|
+
export declare function createCohortSigner(crypto: ICohortThresholdCrypto, minSigs?: number | (() => number)): CohortSigner;
|
|
33
58
|
//# sourceMappingURL=threshold.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"threshold.d.ts","sourceRoot":"","sources":["../../../../src/cohort-topic/sig/threshold.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"threshold.d.ts","sourceRoot":"","sources":["../../../../src/cohort-topic/sig/threshold.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EAAE,sBAAsB,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAEzE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAEzD,0HAA0H;AAC1H,eAAO,MAAM,gBAAgB,KAAK,CAAC;AAEnC;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CAAC,WAAW,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,UAAU,GAAG,aAAa,CAK5F;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,iBAAiB,CAAC,WAAW,EAAE,MAAM,EAAE,SAAS,EAAE,aAAa,GAAG,MAAM,CAEvF;AAED,yFAAyF;AACzF,MAAM,WAAW,YAAY;IAC5B,yFAAyF;IACzF,aAAa,CAAC,OAAO,EAAE,UAAU,GAAG,OAAO,CAAC;QAAE,YAAY,EAAE,UAAU,CAAC;QAAC,OAAO,EAAE,UAAU,EAAE,CAAA;KAAE,CAAC,CAAC;IACjG;;;OAGG;IACH,eAAe,CAAC,OAAO,EAAE,UAAU,EAAE,GAAG,EAAE,UAAU,EAAE,OAAO,EAAE,SAAS,UAAU,EAAE,EAAE,IAAI,EAAE,gBAAgB,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC;CACxI;AA8BD;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,sBAAsB,EAAE,OAAO,GAAE,MAAM,GAAG,CAAC,MAAM,MAAM,CAAoB,GAAG,YAAY,CAEpI"}
|
|
@@ -12,17 +12,44 @@
|
|
|
12
12
|
* the signature must verify against the payload. Either failure → not verified.
|
|
13
13
|
*/
|
|
14
14
|
import { bytesToB64url } from "../wire/codec.js";
|
|
15
|
-
/** Default cohort-signature threshold, `k − x` (see §Configuration). */
|
|
15
|
+
/** Default cohort-signature threshold, `k − x` (see §Configuration). The rule for every coord that is not root-placed. */
|
|
16
16
|
export const DEFAULT_MIN_SIGS = 14;
|
|
17
|
+
/**
|
|
18
|
+
* Build the {@link RootPlacement} for a root-placed cohort from this node's own quorum ratio. A ratio
|
|
19
|
+
* outside `(0, 1]` (or not a number) is a configuration error and throws here, at construction, so
|
|
20
|
+
* verification never has to judge a malformed rule. `rootKey` is the routing key the root coordinate is
|
|
21
|
+
* the hash of, when the caller knows it (see {@link RootPlacement.rootKey}); it is carried, never checked
|
|
22
|
+
* here — the anchor that uses it checks that it hashes to the coordinate being judged.
|
|
23
|
+
*/
|
|
24
|
+
export function createRootPlacement(quorumRatio, rootKey) {
|
|
25
|
+
if (!(quorumRatio > 0 && quorumRatio <= 1)) {
|
|
26
|
+
throw new RangeError(`root placement quorumRatio must be in (0, 1], got ${quorumRatio}`);
|
|
27
|
+
}
|
|
28
|
+
return rootKey === undefined ? { quorumRatio } : { quorumRatio, rootKey };
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Signature threshold of a root-placed cohort of `memberCount` members: `ceil(memberCount × quorumRatio)`.
|
|
32
|
+
*
|
|
33
|
+
* This is the formula `captureCommitCert` (`packages/db-p2p/src/cluster/cluster-repo.ts`) applies to a
|
|
34
|
+
* storage group's commit certificate — `ceil(|group| × superMajorityThreshold)` — written the same way on
|
|
35
|
+
* purpose (same multiplication, same rounding), so a commit certificate and a verifier given the same ratio
|
|
36
|
+
* agree on the threshold by construction. One member needs 1; four members at `0.75` need 3.
|
|
37
|
+
*
|
|
38
|
+
* The floor of 1 only matters for an empty member list, where the formula would yield 0 and "no signers"
|
|
39
|
+
* would count as a quorum; with it, a cert naming no members can never verify.
|
|
40
|
+
*/
|
|
41
|
+
export function rootPlacedMinSigs(memberCount, placement) {
|
|
42
|
+
return Math.max(1, Math.ceil(memberCount * placement.quorumRatio));
|
|
43
|
+
}
|
|
17
44
|
class CryptoCohortSigner {
|
|
18
45
|
crypto;
|
|
19
|
-
|
|
20
|
-
constructor(crypto,
|
|
46
|
+
minSigsNow;
|
|
47
|
+
constructor(crypto, minSigsNow) {
|
|
21
48
|
this.crypto = crypto;
|
|
22
|
-
this.
|
|
49
|
+
this.minSigsNow = minSigsNow;
|
|
23
50
|
}
|
|
24
51
|
thresholdSign(payload) {
|
|
25
|
-
return this.crypto.assemble(payload, this.
|
|
52
|
+
return this.crypto.assemble(payload, this.minSigsNow());
|
|
26
53
|
}
|
|
27
54
|
verifyThreshold(payload, sig, signers, cert, minSigs) {
|
|
28
55
|
if (signers.length < minSigs) {
|
|
@@ -44,8 +71,13 @@ class CryptoCohortSigner {
|
|
|
44
71
|
return this.crypto.verify(payload, sig, signers);
|
|
45
72
|
}
|
|
46
73
|
}
|
|
47
|
-
/**
|
|
74
|
+
/**
|
|
75
|
+
* Build a {@link CohortSigner} over the FRET-backed (in db-p2p) threshold crypto. `minSigs` is the assembly
|
|
76
|
+
* threshold: a number for a cohort whose threshold is fixed (the node-wide `k − x`), or a function read at
|
|
77
|
+
* each signing for one whose threshold follows its member count (a root-placed cohort under
|
|
78
|
+
* {@link rootPlacedMinSigs}). Verification takes its threshold as an argument either way.
|
|
79
|
+
*/
|
|
48
80
|
export function createCohortSigner(crypto, minSigs = DEFAULT_MIN_SIGS) {
|
|
49
|
-
return new CryptoCohortSigner(crypto, minSigs);
|
|
81
|
+
return new CryptoCohortSigner(crypto, typeof minSigs === "number" ? () => minSigs : minSigs);
|
|
50
82
|
}
|
|
51
83
|
//# sourceMappingURL=threshold.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"threshold.js","sourceRoot":"","sources":["../../../../src/cohort-topic/sig/threshold.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAGH,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAGjD,
|
|
1
|
+
{"version":3,"file":"threshold.js","sourceRoot":"","sources":["../../../../src/cohort-topic/sig/threshold.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAGH,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAGjD,0HAA0H;AAC1H,MAAM,CAAC,MAAM,gBAAgB,GAAG,EAAE,CAAC;AAEnC;;;;;;GAMG;AACH,MAAM,UAAU,mBAAmB,CAAC,WAAmB,EAAE,OAAoB;IAC5E,IAAI,CAAC,CAAC,WAAW,GAAG,CAAC,IAAI,WAAW,IAAI,CAAC,CAAC,EAAE,CAAC;QAC5C,MAAM,IAAI,UAAU,CAAC,qDAAqD,WAAW,EAAE,CAAC,CAAC;IAC1F,CAAC;IACD,OAAO,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,WAAW,EAAE,CAAC,CAAC,CAAC,EAAE,WAAW,EAAE,OAAO,EAAE,CAAC;AAC3E,CAAC;AAED;;;;;;;;;;GAUG;AACH,MAAM,UAAU,iBAAiB,CAAC,WAAmB,EAAE,SAAwB;IAC9E,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,IAAI,CAAC,WAAW,GAAG,SAAS,CAAC,WAAW,CAAC,CAAC,CAAC;AACpE,CAAC;AAaD,MAAM,kBAAkB;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,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC;AACtG,CAAC"}
|
|
@@ -25,6 +25,11 @@
|
|
|
25
25
|
* `afterMs` — which begins again at `d_max`, decorrelating retries across the ring (§Anti-flood
|
|
26
26
|
* claim 4: never re-hit the declined coord immediately).
|
|
27
27
|
*
|
|
28
|
+
* **Root-placed topics.** A walk given a `rootKey` (§Tier addressing → Root placement at a routing key)
|
|
29
|
+
* stamps it on every frame it builds and addresses its tier-0 step at `H(rootKey)` — delivered through
|
|
30
|
+
* {@link ITopicRouter.routeToRoot} when the router has it, else `routeAndAct` on the root key. Every other
|
|
31
|
+
* step, reply and back-off rule above is unchanged.
|
|
32
|
+
*
|
|
28
33
|
* This module is FRET-free: it drives the {@link ITopicRouter} port (db-p2p binds it to FRET's
|
|
29
34
|
* `RouteAndMaybeAct` / direct dial) and the {@link TierAddressing} math, and delegates building +
|
|
30
35
|
* signing the {@link RegisterV1} to the injected {@link RegisterMessageFactory} (participant identity
|
|
@@ -44,6 +49,8 @@ export interface AcceptedWalkOutcome {
|
|
|
44
49
|
* probe carries a distinct correlationId; this is the one the cohort admitted.
|
|
45
50
|
*/
|
|
46
51
|
readonly correlationId: string;
|
|
52
|
+
/** The tree tier `d` of the register frame the cohort accepted — where the registration landed. */
|
|
53
|
+
readonly treeTier: number;
|
|
47
54
|
}
|
|
48
55
|
/**
|
|
49
56
|
* The walk hit a `Promoted` redirect and the engine was configured **not** to follow it
|
|
@@ -75,6 +82,7 @@ export interface RegisterMessageFactory {
|
|
|
75
82
|
* (§Anti-DoS — a follow-on is gated identically to a bootstrap) via the injected builder seam before
|
|
76
83
|
* signing — keyed off `bootstrap`/`followOn`, so no extra parameter is needed (the walk decides both
|
|
77
84
|
* internally, not the application). `bootstrap`, `followOn`, and `probe` are mutually exclusive.
|
|
85
|
+
* A `rootKey` is stamped on the frame as `RegisterV1.rootKey` **before** signing, at every tier.
|
|
78
86
|
*/
|
|
79
87
|
build(params: {
|
|
80
88
|
topicId: Uint8Array;
|
|
@@ -86,8 +94,17 @@ export interface RegisterMessageFactory {
|
|
|
86
94
|
/** Read-only lookup probe: the factory stamps `RegisterV1.probe` and never mints cold-start evidence. */
|
|
87
95
|
probe: boolean;
|
|
88
96
|
appPayload?: Uint8Array;
|
|
97
|
+
/** Root key of a root-placed topic; absent for the default addressing. */
|
|
98
|
+
rootKey?: Uint8Array;
|
|
89
99
|
}): Promise<RegisterV1>;
|
|
90
100
|
}
|
|
101
|
+
/** Per-walk options for {@link WalkEngine.register}. */
|
|
102
|
+
export interface WalkOptions {
|
|
103
|
+
/** Read-only lookup: classify without admitting, and never cold-start. */
|
|
104
|
+
readonly probe?: boolean;
|
|
105
|
+
/** Root key of a root-placed topic: the walk's tier-0 step targets `H(rootKey)` and every frame carries the key. */
|
|
106
|
+
readonly rootKey?: Uint8Array;
|
|
107
|
+
}
|
|
91
108
|
export interface WalkConfig {
|
|
92
109
|
/** Cohort size requested from the router (`wantK`). Default 16. */
|
|
93
110
|
wantK?: number;
|
|
@@ -127,11 +144,9 @@ export interface WalkEngine {
|
|
|
127
144
|
* redirects outward. Resolves with the terminal {@link WalkOutcome}. With `opts.probe` the walk is a
|
|
128
145
|
* **read-only lookup**: identical routing discipline, but the terminal cohort classifies rather than
|
|
129
146
|
* admits and the root `no_state` branch backs off instead of issuing a `bootstrap: true` cold-start
|
|
130
|
-
* (a probe never instantiates a cold root).
|
|
147
|
+
* (a probe never instantiates a cold root). With `opts.rootKey` the topic is root-placed.
|
|
131
148
|
*/
|
|
132
|
-
register(topicId: Uint8Array, tier: number, appPayload?: Uint8Array, opts?:
|
|
133
|
-
probe?: boolean;
|
|
134
|
-
}): Promise<WalkOutcome>;
|
|
149
|
+
register(topicId: Uint8Array, tier: number, appPayload?: Uint8Array, opts?: WalkOptions): Promise<WalkOutcome>;
|
|
135
150
|
}
|
|
136
151
|
/** Build a {@link WalkEngine} over the injected router, addressing, `d_max`, and message factory. */
|
|
137
152
|
export declare function createWalkEngine(deps: WalkEngineDeps): WalkEngine;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"walk.d.ts","sourceRoot":"","sources":["../../../src/cohort-topic/walk.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"walk.d.ts","sourceRoot":"","sources":["../../../src/cohort-topic/walk.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAW,MAAM,YAAY,CAAC;AACxD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACtD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAI9C,OAAO,KAAK,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAEnE,sGAAsG;AACtG,MAAM,WAAW,mBAAmB;IACnC,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAC;IAC1B,QAAQ,CAAC,KAAK,EAAE,eAAe,CAAC;IAChC;;;;OAIG;IACH,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B,mGAAmG;IACnG,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;CAC1B;AAED;;;;;GAKG;AACH,MAAM,WAAW,mBAAmB;IACnC,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAC;IAC1B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;CAC5B;AAED;;;;GAIG;AACH,MAAM,WAAW,iBAAiB;IACjC,QAAQ,CAAC,IAAI,EAAE,aAAa,CAAC;IAC7B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;CACzB;AAED,MAAM,MAAM,WAAW,GAAG,mBAAmB,GAAG,mBAAmB,GAAG,iBAAiB,CAAC;AAExF,mGAAmG;AACnG,MAAM,WAAW,sBAAsB;IACtC;;;;;;;;;OASG;IACH,KAAK,CAAC,MAAM,EAAE;QACb,OAAO,EAAE,UAAU,CAAC;QACpB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EAAE,IAAI,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC;CAC/G;AAqMD,qGAAqG;AACrG,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,cAAc,GAAG,UAAU,CAEjE"}
|
|
@@ -25,6 +25,11 @@
|
|
|
25
25
|
* `afterMs` — which begins again at `d_max`, decorrelating retries across the ring (§Anti-flood
|
|
26
26
|
* claim 4: never re-hit the declined coord immediately).
|
|
27
27
|
*
|
|
28
|
+
* **Root-placed topics.** A walk given a `rootKey` (§Tier addressing → Root placement at a routing key)
|
|
29
|
+
* stamps it on every frame it builds and addresses its tier-0 step at `H(rootKey)` — delivered through
|
|
30
|
+
* {@link ITopicRouter.routeToRoot} when the router has it, else `routeAndAct` on the root key. Every other
|
|
31
|
+
* step, reply and back-off rule above is unchanged.
|
|
32
|
+
*
|
|
28
33
|
* This module is FRET-free: it drives the {@link ITopicRouter} port (db-p2p binds it to FRET's
|
|
29
34
|
* `RouteAndMaybeAct` / direct dial) and the {@link TierAddressing} math, and delegates building +
|
|
30
35
|
* signing the {@link RegisterV1} to the injected {@link RegisterMessageFactory} (participant identity
|
|
@@ -64,6 +69,7 @@ class RouterWalkEngine {
|
|
|
64
69
|
const dMax = this.deps.dmax.dMax();
|
|
65
70
|
const maxSteps = this.configuredMaxSteps ?? 2 * (dMax + 2) + this.maxMemberRetries + 8;
|
|
66
71
|
const probe = opts?.probe ?? false;
|
|
72
|
+
const rootKey = opts?.rootKey;
|
|
67
73
|
let d = dMax;
|
|
68
74
|
let bootstrap = false;
|
|
69
75
|
let followOn = false;
|
|
@@ -85,20 +91,17 @@ class RouterWalkEngine {
|
|
|
85
91
|
// back-off rather than spin.
|
|
86
92
|
return { kind: "retry_later", afterMs: backoffRetryMs(0) };
|
|
87
93
|
}
|
|
88
|
-
const reg = await this.deps.factory.build({ topicId, tier, treeTier: d, bootstrap, followOn, probe, appPayload });
|
|
94
|
+
const reg = await this.deps.factory.build({ topicId, tier, treeTier: d, bootstrap, followOn, probe, appPayload, rootKey });
|
|
89
95
|
const activity = encodeCohortMessage(reg, this.maxMessageBytes);
|
|
90
96
|
const raw = dialTarget !== undefined
|
|
91
97
|
? await this.deps.router.dialMember(dialTarget, activity)
|
|
92
|
-
: await this.
|
|
93
|
-
wantK: this.wantK,
|
|
94
|
-
minSigs: this.minSigs,
|
|
95
|
-
});
|
|
98
|
+
: await this.routeToTier(d, topicId, rootKey, activity);
|
|
96
99
|
const reply = decodeRegisterReplyV1(raw, this.maxMessageBytes);
|
|
97
100
|
switch (reply.result) {
|
|
98
101
|
case "accepted": {
|
|
99
102
|
// Surface the accepted probe's correlationId so the participant's renewals can echo it
|
|
100
103
|
// (RenewV1 correlationId "matches original RegisterV1"). `reg` is the frame just admitted.
|
|
101
|
-
return { kind: "accepted", reply, correlationId: reg.correlationId };
|
|
104
|
+
return { kind: "accepted", reply, correlationId: reg.correlationId, treeTier: reg.treeTier };
|
|
102
105
|
}
|
|
103
106
|
case "no_state": {
|
|
104
107
|
// Step toward the root. The cohort served nothing here; no spatial sibling state.
|
|
@@ -202,6 +205,26 @@ class RouterWalkEngine {
|
|
|
202
205
|
}
|
|
203
206
|
}
|
|
204
207
|
}
|
|
208
|
+
/**
|
|
209
|
+
* Route one probe to the cohort at tier `d`, on that tier's route key — the router hashes it once into
|
|
210
|
+
* `coord_d`. The root of a root-placed topic goes through the router's `routeToRoot` when it has one, so
|
|
211
|
+
* the frame reaches the root group by the rule that chose it; a router without it (a mock, an older
|
|
212
|
+
* binding) routes the same frame on the root key itself, which lands at the root coordinate `H(rootKey)`.
|
|
213
|
+
*
|
|
214
|
+
* NOTE: the fallback reaches the root coordinate by ring routing, which is the root group whenever the
|
|
215
|
+
* ring's nearest peers to `H(rootKey)` are the key network's storage group for that key. `routeToRoot`
|
|
216
|
+
* exists only because the two can differ on a ring shared with another network.
|
|
217
|
+
*/
|
|
218
|
+
routeToTier(d, topicId, rootKey, activity) {
|
|
219
|
+
const router = this.deps.router;
|
|
220
|
+
if (d === 0 && rootKey !== undefined && router.routeToRoot !== undefined) {
|
|
221
|
+
return router.routeToRoot(rootKey, activity);
|
|
222
|
+
}
|
|
223
|
+
return router.routeAndAct(this.deps.addressing.routeKey(d, this.deps.self, topicId, rootKey), activity, {
|
|
224
|
+
wantK: this.wantK,
|
|
225
|
+
minSigs: this.minSigs,
|
|
226
|
+
});
|
|
227
|
+
}
|
|
205
228
|
}
|
|
206
229
|
/** Build a {@link WalkEngine} over the injected router, addressing, `d_max`, and message factory. */
|
|
207
230
|
export function createWalkEngine(deps) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"walk.js","sourceRoot":"","sources":["../../../src/cohort-topic/walk.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"walk.js","sourceRoot":"","sources":["../../../src/cohort-topic/walk.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AAKH,OAAO,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAC9C,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,aAAa,EAAE,qBAAqB,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAyH5F;;;;;GAKG;AACH,SAAS,eAAe,CAAC,KAAa;IACrC,OAAO,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC,IAAI,KAAK,IAAI,CAAC,IAAI,KAAK,IAAI,iBAAiB,CAAC;AAC5E,CAAC;AAED,MAAM,gBAAgB;IAQQ;IAPZ,KAAK,CAAS;IACd,OAAO,CAAS;IAChB,gBAAgB,CAAS;IACzB,cAAc,CAAU;IACxB,kBAAkB,CAAU;IAC5B,eAAe,CAAU;IAE1C,YAA6B,IAAoB;QAApB,SAAI,GAAJ,IAAI,CAAgB;QAChD,MAAM,GAAG,GAAG,IAAI,CAAC,MAAM,IAAI,EAAE,CAAC;QAC9B,IAAI,CAAC,KAAK,GAAG,G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qGAAqG;AACrG,MAAM,UAAU,gBAAgB,CAAC,IAAoB;IACpD,OAAO,IAAI,gBAAgB,CAAC,IAAI,CAAC,CAAC;AACnC,CAAC"}
|
|
@@ -13,7 +13,9 @@
|
|
|
13
13
|
* - **{@link UnwillingCohortOutcome}** — fewer than a quorum of members are willing to serve the
|
|
14
14
|
* tier, so the cohort declines the tier entirely; the caller backs off in *time* (no spatial
|
|
15
15
|
* move — see §Why the caller doesn't walk on UnwillingCohort). The `retryAfterMs` follows the
|
|
16
|
-
* capped-doubling curve in {@link backoffRetryMs}.
|
|
16
|
+
* capped-doubling curve in {@link backoffRetryMs}. The outcome also says whether the quorum is short
|
|
17
|
+
* only for want of members that have not gossiped yet (`awaitingMembers`), which the member engine
|
|
18
|
+
* answers by holding the request for their gossip rather than declining at once.
|
|
17
19
|
*
|
|
18
20
|
* A member's *live* willingness for a tier is: its profile serves the tier, the tier's load bucket
|
|
19
21
|
* is below `overloadBucket`, **and** it is under its per-tier primary-topic budget. The coarse 1-bit
|
|
@@ -38,6 +40,14 @@ export interface UnwillingMemberOutcome {
|
|
|
38
40
|
export interface UnwillingCohortOutcome {
|
|
39
41
|
readonly kind: "unwilling_cohort";
|
|
40
42
|
readonly retryAfterMs: number;
|
|
43
|
+
/**
|
|
44
|
+
* True iff the quorum is short only because cohort members have not gossiped yet: it would be met if
|
|
45
|
+
* every member this check holds no contribution from turned out willing. A member that has gossiped
|
|
46
|
+
* *unwilling* counts as heard, so a cohort whose answers are in and short reports `false` — as does an
|
|
47
|
+
* unserviceable tier, and a check given no {@link WillingnessDeps.cohortMembers}. The cohort side may hold
|
|
48
|
+
* the request briefly for those answers instead of declining (§Cold-start instantiation).
|
|
49
|
+
*/
|
|
50
|
+
readonly awaitingMembers: boolean;
|
|
41
51
|
}
|
|
42
52
|
export type WillingnessOutcome = AcceptedOutcome | UnwillingMemberOutcome | UnwillingCohortOutcome;
|
|
43
53
|
/** Per-member willingness / admission check. */
|
|
@@ -102,6 +112,12 @@ export interface WillingnessDeps {
|
|
|
102
112
|
view: CohortView;
|
|
103
113
|
/** This member's own id, base64url (the `fromMember` key) — excluded from the sibling scan. */
|
|
104
114
|
selfMember: string;
|
|
115
|
+
/**
|
|
116
|
+
* The cohort's current members, base64url (the form {@link selfMember} and the view keys use), read at
|
|
117
|
+
* each evaluation. It tells a member that has not gossiped yet apart from one that gossiped unwilling
|
|
118
|
+
* ({@link UnwillingCohortOutcome.awaitingMembers}). Absent → no member counts as unheard.
|
|
119
|
+
*/
|
|
120
|
+
cohortMembers?: () => readonly string[];
|
|
105
121
|
/** Count of topics this member is already `primary` for at `tier` (the budget gate input). */
|
|
106
122
|
primaryTopicCount: (tier: Tier) => number;
|
|
107
123
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"willingness.d.ts","sourceRoot":"","sources":["../../../src/cohort-topic/willingness.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"willingness.d.ts","sourceRoot":"","sources":["../../../src/cohort-topic/willingness.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH,OAAO,EAAgD,KAAK,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAC5G,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAEnD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,EAAa,KAAK,WAAW,EAAE,KAAK,IAAI,EAAE,MAAM,YAAY,CAAC;AAEpE,gEAAgE;AAChE,MAAM,WAAW,eAAe;IAC/B,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAC;CAC1B;AAED,4GAA4G;AAC5G,MAAM,WAAW,sBAAsB;IACtC,QAAQ,CAAC,IAAI,EAAE,kBAAkB,CAAC;IAClC,QAAQ,CAAC,gBAAgB,EAAE,UAAU,EAAE,CAAC;CACxC;AAED,4FAA4F;AAC5F,MAAM,WAAW,sBAAsB;IACtC,QAAQ,CA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pB;;;;OAIG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,8FAA8F;IAC9F,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB;;;OAGG;IACH,uBAAuB,CAAC,EAAE,MAAM,CAAC;IACjC,6FAA6F;IAC7F,OAAO,CAAC,EAAE,aAAa,CAAC;CACxB;AAED,MAAM,WAAW,eAAe;IAC/B,qFAAqF;IACrF,SAAS,EAAE,kBAAkB,CAAC;IAC9B,uEAAuE;IACvE,IAAI,EAAE,UAAU,CAAC;IACjB,+FAA+F;IAC/F,UAAU,EAAE,MAAM,CAAC;IACnB;;;;OAIG;IACH,aAAa,CAAC,EAAE,MAAM,SAAS,MAAM,EAAE,CAAC;IACxC,8FAA8F;IAC9F,iBAAiB,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,MAAM,CAAC;IAC1C;;;OAGG;IACH,QAAQ,CAAC,EAAE,CAAC,GAAG,EAAE,UAAU,KAAK,MAAM,CAAC;IACvC,MAAM,CAAC,EAAE,iBAAiB,CAAC;CAC3B;AAED,qDAAqD;AACrD,wBAAgB,aAAa,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,CAExD;AA+ED,kGAAkG;AAClG,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,eAAe,GAAG,gBAAgB,CAE9E;AAED,kGAAkG;AAClG,wBAAgB,uCAAuC,CACtD,IAAI,EAAE,IAAI,CAAC,eAAe,EAAE,WAAW,CAAC,GACtC;IAAE,KAAK,EAAE,gBAAgB,CAAC;IAAC,SAAS,EAAE,kBAAkB,CAAA;CAAE,CAG5D"}
|
|
@@ -13,7 +13,9 @@
|
|
|
13
13
|
* - **{@link UnwillingCohortOutcome}** — fewer than a quorum of members are willing to serve the
|
|
14
14
|
* tier, so the cohort declines the tier entirely; the caller backs off in *time* (no spatial
|
|
15
15
|
* move — see §Why the caller doesn't walk on UnwillingCohort). The `retryAfterMs` follows the
|
|
16
|
-
* capped-doubling curve in {@link backoffRetryMs}.
|
|
16
|
+
* capped-doubling curve in {@link backoffRetryMs}. The outcome also says whether the quorum is short
|
|
17
|
+
* only for want of members that have not gossiped yet (`awaitingMembers`), which the member engine
|
|
18
|
+
* answers by holding the request for their gossip rather than declining at once.
|
|
17
19
|
*
|
|
18
20
|
* A member's *live* willingness for a tier is: its profile serves the tier, the tier's load bucket
|
|
19
21
|
* is below `overloadBucket`, **and** it is under its per-tier primary-topic budget. The coarse 1-bit
|
|
@@ -96,7 +98,7 @@ class GossipWillingnessCheck {
|
|
|
96
98
|
const tier = reg.tier;
|
|
97
99
|
if (!ALL_TIERS.includes(tier)) {
|
|
98
100
|
// An op tier outside T0..T3 is not serviceable; treat as a cohort-level decline.
|
|
99
|
-
return
|
|
101
|
+
return this.declineCohort(reg, false);
|
|
100
102
|
}
|
|
101
103
|
const selfWilling = this.selfLiveWilling(self, tier);
|
|
102
104
|
const siblings = this.willingSiblings(tier);
|
|
@@ -104,7 +106,7 @@ class GossipWillingnessCheck {
|
|
|
104
106
|
// Quorum gate (§Tier ladder): the cohort takes on tier-T duties only if a quorum of members
|
|
105
107
|
// is willing; otherwise registrations get UnwillingCohort and the caller backs off in time.
|
|
106
108
|
if (willingCount < this.quorum) {
|
|
107
|
-
return
|
|
109
|
+
return this.declineCohort(reg, willingCount + this.unheardMemberCount() >= this.quorum);
|
|
108
110
|
}
|
|
109
111
|
if (selfWilling) {
|
|
110
112
|
return { kind: "accepted" };
|
|
@@ -112,6 +114,19 @@ class GossipWillingnessCheck {
|
|
|
112
114
|
// Quorum holds and self is unwilling → some sibling will serve.
|
|
113
115
|
return { kind: "unwilling_member", candidateMembers: siblings.map((m) => b64urlToBytes(m)) };
|
|
114
116
|
}
|
|
117
|
+
declineCohort(reg, awaitingMembers) {
|
|
118
|
+
return { kind: "unwilling_cohort", retryAfterMs: backoffRetryMs(this.attempts(reg), this.backoff), awaitingMembers };
|
|
119
|
+
}
|
|
120
|
+
/** Cohort members other than self this check holds no gossiped contribution from. */
|
|
121
|
+
unheardMemberCount() {
|
|
122
|
+
const unheard = new Set();
|
|
123
|
+
for (const member of this.deps.cohortMembers?.() ?? []) {
|
|
124
|
+
if (member !== this.deps.selfMember && this.deps.view.get(member) === undefined) {
|
|
125
|
+
unheard.add(member);
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
return unheard.size;
|
|
129
|
+
}
|
|
115
130
|
/** Live willingness of *this* member for `tier`: profile ∧ load-under-threshold ∧ under budget. */
|
|
116
131
|
selfLiveWilling(self, tier) {
|
|
117
132
|
return (self.willingTiers.has(tier) &&
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"willingness.js","sourceRoot":"","sources":["../../../src/cohort-topic/willingness.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"willingness.js","sourceRoot":"","sources":["../../../src/cohort-topic/willingness.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH,OAAO,EAAE,mBAAmB,EAAE,uBAAuB,EAA2B,MAAM,qBAAqB,CAAC;AAE5G,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAEhD,OAAO,EAAE,SAAS,EAA+B,MAAM,YAAY,CAAC;AAmCpE,wFAAwF;AAExF,sFAAsF;AACtF,MAAM,UAAU,OAAO,CAAC,IAAY,EAAE,IAAU;IAC/C,OAAO,CAAC,IAAI,GAAG,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,KAAK,CAAC,CAAC;AACnC,CAAC;AAED,gGAAgG;AAChG,MAAM,UAAU,mBAAmB,CAAC,OAAgC;IACnE,IAAI,IAAI,GAAG,CAAC,CAAC;IACb,KAAK,MAAM,CAAC,IAAI,SAAS,EAAE,CAAC;QAC3B,IAAI,OAAO,CAAC,CAAC,CAAC;YAAE,IAAI,IAAI,CAAC,IAAI,CAAC,CAAC;IAChC,CAAC;IACD,OAAO,IAAI,CAAC;AACb,CAAC;AAED,iGAAiG;AACjG,MAAM,UAAU,kBAAkB,CAAC,IAAY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iBAAiB,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,uBAAuB,CAChE,CAAC;IACH,CAAC;IAED,yFAAyF;IACjF,eAAe,CAAC,IAAU;QACjC,MAAM,GAAG,GAAa,EAAE,CAAC;QACzB,KAAK,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,EAAE,CAAC;YAC3D,IAAI,MAAM,KAAK,IAAI,CAAC,IAAI,CAAC,UAAU;gBAAE,SAAS,CAAC,oCAAoC;YACnF,IAAI,OAAO,CAAC,YAAY,CAAC,WAAW,EAAE,IAAI,CAAC,EAAE,CAAC;gBAC7C,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;YAClB,CAAC;QACF,CAAC;QACD,OAAO,GAAG,CAAC;IACZ,CAAC;CACD;AAED,kGAAkG;AAClG,MAAM,UAAU,sBAAsB,CAAC,IAAqB;IAC3D,OAAO,IAAI,sBAAsB,CAAC,IAAI,CAAC,CAAC;AACzC,CAAC;AAED,kGAAkG;AAClG,MAAM,UAAU,uCAAuC,CACtD,IAAwC;IAExC,MAAM,SAAS,GAAG,mBAAmB,CAAC,EAAE,cAAc,EAAE,IAAI,CAAC,MAAM,EAAE,cAAc,EAAE,CAAC,CAAC;IACvF,OAAO,EAAE,KAAK,EAAE,sBAAsB,CAAC,EAAE,GAAG,IAAI,EAAE,SAAS,EAAE,CAAC,EAAE,SAAS,EAAE,CAAC;AAC7E,CAAC"}
|
|
@@ -2,5 +2,5 @@ export * from "./types.js";
|
|
|
2
2
|
export * from "./codec.js";
|
|
3
3
|
export * from "./payloads.js";
|
|
4
4
|
export { CohortWireError } from "./validate.js";
|
|
5
|
-
export { validateRegisterV1, validateRegisterReplyV1, validateRenewV1, validateRenewReplyV1, validateChildLinkV1, validateChildLinkReplyV1, validatePromotionNoticeV1, validateDemotionNoticeV1, validateCohortGossipV1, validateMembershipCertV1, validateSignRequestV1, validateSignReplyV1, } from "./validate.js";
|
|
5
|
+
export { MAX_ROOT_KEY_BYTES, validateRegisterV1, validateRegisterReplyV1, validateRenewV1, validateRenewReplyV1, validateChildLinkV1, validateChildLinkReplyV1, validatePromotionNoticeV1, validateDemotionNoticeV1, validateCohortGossipV1, validateMembershipCertV1, validateSignRequestV1, validateSignReplyV1, } from "./validate.js";
|
|
6
6
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/cohort-topic/wire/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC;AAC9B,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,EACN,kBAAkB,EAClB,uBAAuB,EACvB,eAAe,EACf,oBAAoB,EACpB,mBAAmB,EACnB,wBAAwB,EACxB,yBAAyB,EACzB,wBAAwB,EACxB,sBAAsB,EACtB,wBAAwB,EACxB,qBAAqB,EACrB,mBAAmB,GACnB,MAAM,eAAe,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/cohort-topic/wire/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC;AAC9B,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,EACN,kBAAkB,EAClB,kBAAkB,EAClB,uBAAuB,EACvB,eAAe,EACf,oBAAoB,EACpB,mBAAmB,EACnB,wBAAwB,EACxB,yBAAyB,EACzB,wBAAwB,EACxB,sBAAsB,EACtB,wBAAwB,EACxB,qBAAqB,EACrB,mBAAmB,GACnB,MAAM,eAAe,CAAC"}
|
|
@@ -2,5 +2,5 @@ export * from "./types.js";
|
|
|
2
2
|
export * from "./codec.js";
|
|
3
3
|
export * from "./payloads.js";
|
|
4
4
|
export { CohortWireError } from "./validate.js";
|
|
5
|
-
export { validateRegisterV1, validateRegisterReplyV1, validateRenewV1, validateRenewReplyV1, validateChildLinkV1, validateChildLinkReplyV1, validatePromotionNoticeV1, validateDemotionNoticeV1, validateCohortGossipV1, validateMembershipCertV1, validateSignRequestV1, validateSignReplyV1, } from "./validate.js";
|
|
5
|
+
export { MAX_ROOT_KEY_BYTES, validateRegisterV1, validateRegisterReplyV1, validateRenewV1, validateRenewReplyV1, validateChildLinkV1, validateChildLinkReplyV1, validatePromotionNoticeV1, validateDemotionNoticeV1, validateCohortGossipV1, validateMembershipCertV1, validateSignRequestV1, validateSignReplyV1, } from "./validate.js";
|
|
6
6
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/cohort-topic/wire/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC;AAC9B,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,EACN,kBAAkB,EAClB,uBAAuB,EACvB,eAAe,EACf,oBAAoB,EACpB,mBAAmB,EACnB,wBAAwB,EACxB,yBAAyB,EACzB,wBAAwB,EACxB,sBAAsB,EACtB,wBAAwB,EACxB,qBAAqB,EACrB,mBAAmB,GACnB,MAAM,eAAe,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/cohort-topic/wire/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC;AAC9B,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,EACN,kBAAkB,EAClB,kBAAkB,EAClB,uBAAuB,EACvB,eAAe,EACf,oBAAoB,EACpB,mBAAmB,EACnB,wBAAwB,EACxB,yBAAyB,EACzB,wBAAwB,EACxB,sBAAsB,EACtB,wBAAwB,EACxB,qBAAqB,EACrB,mBAAmB,GACnB,MAAM,eAAe,CAAC"}
|
|
@@ -13,6 +13,12 @@
|
|
|
13
13
|
* `followOn`→`false`, `appPayload`→`null`, `bootstrapEvidence`→`null` with an empty string treated as
|
|
14
14
|
* absent, `reattach`→`false`, `withdraw`→`false`) so an absent optional and a present-but-default
|
|
15
15
|
* optional can never disagree across the wire round-trip.
|
|
16
|
+
*
|
|
17
|
+
* The root-placement fields (`RegisterV1.rootKey`, `CohortGossipV1.rootPlaced`) are the exception: each
|
|
18
|
+
* is appended to its image **only when present**, with no placeholder. A frame without the field
|
|
19
|
+
* therefore signs exactly the bytes it signed before the field existed, and the two forms cannot be
|
|
20
|
+
* confused — they differ in array length, and neither field has a "present but default" spelling (the
|
|
21
|
+
* validator rejects an empty `rootKey` and a `rootPlaced` other than `true`).
|
|
16
22
|
*/
|
|
17
23
|
import type { CohortGossipV1, RegisterV1, RenewV1 } from "./types.js";
|
|
18
24
|
/** A `RegisterV1` minus its `signature` envelope — the bytes the participant peer-key-signs. */
|
|
@@ -21,6 +27,12 @@ export type RegisterSignable = Omit<RegisterV1, "signature">;
|
|
|
21
27
|
export type RenewSignable = Omit<RenewV1, "signature">;
|
|
22
28
|
/** Canonical signed byte image of a `RegisterV1` body (every field except `signature`). */
|
|
23
29
|
export declare function registerSigningPayload(body: RegisterSignable): Uint8Array;
|
|
30
|
+
/**
|
|
31
|
+
* `[value]` when the optional field is present, `[]` when absent — spread into a signed image for an optional
|
|
32
|
+
* element with no placeholder, so a frame without the field keeps the image it signed before the field existed.
|
|
33
|
+
* Shared with the threshold-signature images in `sig/payloads.ts`.
|
|
34
|
+
*/
|
|
35
|
+
export declare function presentOnly<T>(value: T | undefined): T[];
|
|
24
36
|
/** Canonical signed byte image of a `RenewV1` body (every field except `signature`). */
|
|
25
37
|
export declare function renewSigningPayload(body: RenewSignable): Uint8Array;
|
|
26
38
|
/** A `CohortGossipV1` minus its `signature` envelope — the bytes the gossiping member peer-key-signs. */
|
|
@@ -34,6 +46,8 @@ export type CohortGossipSignable = Omit<CohortGossipV1, "signature">;
|
|
|
34
46
|
* the signer and the receiver (which re-derives this image from the validated frame) agree byte-for-byte.
|
|
35
47
|
* Absent optionals (`records`/`evicted`/`childLinks`/`childUnlinks`) normalize to `[]`, and `appState` to
|
|
36
48
|
* `null`. `childLinks`/`childUnlinks` are covered so a MITM cannot strip or inject a child link/unlink.
|
|
49
|
+
* `rootPlaced` is appended after `timestamp` only when present, so a gossip for a default-addressed coord
|
|
50
|
+
* keeps its image unchanged and the flag cannot be added to, or removed from, a signed frame.
|
|
37
51
|
*/
|
|
38
52
|
export declare function cohortGossipSigningPayload(g: CohortGossipSignable): Uint8Array;
|
|
39
53
|
//# sourceMappingURL=payloads.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"payloads.d.ts","sourceRoot":"","sources":["../../../../src/cohort-topic/wire/payloads.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"payloads.d.ts","sourceRoot":"","sources":["../../../../src/cohort-topic/wire/payloads.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAItE,gGAAgG;AAChG,MAAM,MAAM,gBAAgB,GAAG,IAAI,CAAC,UAAU,EAAE,WAAW,CAAC,CAAC;AAE7D,6FAA6F;AAC7F,MAAM,MAAM,aAAa,GAAG,IAAI,CAAC,OAAO,EAAE,WAAW,CAAC,CAAC;AAOvD,2FAA2F;AAC3F,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,gBAAgB,GAAG,UAAU,CA0BzE;AAED;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,SAAS,GAAG,CAAC,EAAE,CAExD;AAED,wFAAwF;AACxF,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,aAAa,GAAG,UAAU,CAenE;AAED,yGAAyG;AACzG,MAAM,MAAM,oBAAoB,GAAG,IAAI,CAAC,cAAc,EAAE,WAAW,CAAC,CAAC;AAErE;;;;;;;;;;;GAWG;AACH,wBAAgB,0BAA0B,CAAC,CAAC,EAAE,oBAAoB,GAAG,UAAU,CAqC9E"}
|
|
@@ -13,6 +13,12 @@
|
|
|
13
13
|
* `followOn`→`false`, `appPayload`→`null`, `bootstrapEvidence`→`null` with an empty string treated as
|
|
14
14
|
* absent, `reattach`→`false`, `withdraw`→`false`) so an absent optional and a present-but-default
|
|
15
15
|
* optional can never disagree across the wire round-trip.
|
|
16
|
+
*
|
|
17
|
+
* The root-placement fields (`RegisterV1.rootKey`, `CohortGossipV1.rootPlaced`) are the exception: each
|
|
18
|
+
* is appended to its image **only when present**, with no placeholder. A frame without the field
|
|
19
|
+
* therefore signs exactly the bytes it signed before the field existed, and the two forms cannot be
|
|
20
|
+
* confused — they differ in array length, and neither field has a "present but default" spelling (the
|
|
21
|
+
* validator rejects an empty `rootKey` and a `rootPlaced` other than `true`).
|
|
16
22
|
*/
|
|
17
23
|
const utf8 = new TextEncoder();
|
|
18
24
|
/** Normalize the optional bootstrap-evidence slot: absent and empty-string both map to `null`. */
|
|
@@ -42,8 +48,19 @@ export function registerSigningPayload(body) {
|
|
|
42
48
|
// signer (participant) + verifier (db-p2p cohort) agree byte-for-byte. Safe to append: no register
|
|
43
49
|
// signatures are persisted (each is recomputed per verify), so there is no cross-version image concern.
|
|
44
50
|
body.followOn ?? false,
|
|
51
|
+
// The root key of a root-placed topic, appended only when present: a frame without one keeps the
|
|
52
|
+
// image above byte-for-byte, and stripping or swapping the key changes the image and fails verify.
|
|
53
|
+
...presentOnly(body.rootKey),
|
|
45
54
|
]));
|
|
46
55
|
}
|
|
56
|
+
/**
|
|
57
|
+
* `[value]` when the optional field is present, `[]` when absent — spread into a signed image for an optional
|
|
58
|
+
* element with no placeholder, so a frame without the field keeps the image it signed before the field existed.
|
|
59
|
+
* Shared with the threshold-signature images in `sig/payloads.ts`.
|
|
60
|
+
*/
|
|
61
|
+
export function presentOnly(value) {
|
|
62
|
+
return value === undefined ? [] : [value];
|
|
63
|
+
}
|
|
47
64
|
/** Canonical signed byte image of a `RenewV1` body (every field except `signature`). */
|
|
48
65
|
export function renewSigningPayload(body) {
|
|
49
66
|
return utf8.encode(JSON.stringify([
|
|
@@ -70,6 +87,8 @@ export function renewSigningPayload(body) {
|
|
|
70
87
|
* the signer and the receiver (which re-derives this image from the validated frame) agree byte-for-byte.
|
|
71
88
|
* Absent optionals (`records`/`evicted`/`childLinks`/`childUnlinks`) normalize to `[]`, and `appState` to
|
|
72
89
|
* `null`. `childLinks`/`childUnlinks` are covered so a MITM cannot strip or inject a child link/unlink.
|
|
90
|
+
* `rootPlaced` is appended after `timestamp` only when present, so a gossip for a default-addressed coord
|
|
91
|
+
* keeps its image unchanged and the flag cannot be added to, or removed from, a signed frame.
|
|
73
92
|
*/
|
|
74
93
|
export function cohortGossipSigningPayload(g) {
|
|
75
94
|
return utf8.encode(JSON.stringify([
|
|
@@ -106,6 +125,7 @@ export function cohortGossipSigningPayload(g) {
|
|
|
106
125
|
(g.childLinks ?? []).map((c) => [c.topicId, c.childCohortCoord, c.effectiveAt]),
|
|
107
126
|
(g.childUnlinks ?? []).map((c) => [c.topicId, c.childCohortCoord, c.effectiveAt]),
|
|
108
127
|
g.timestamp,
|
|
128
|
+
...presentOnly(g.rootPlaced),
|
|
109
129
|
]));
|
|
110
130
|
}
|
|
111
131
|
//# sourceMappingURL=payloads.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"payloads.js","sourceRoot":"","sources":["../../../../src/cohort-topic/wire/payloads.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"payloads.js","sourceRoot":"","sources":["../../../../src/cohort-topic/wire/payloads.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAI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