@optimystic/db-core 1.9.0 → 1.10.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/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/promotion.d.ts +3 -2
- package/dist/src/cohort-topic/promotion.d.ts.map +1 -1
- package/dist/src/cohort-topic/promotion.js +15 -3
- package/dist/src/cohort-topic/promotion.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/reactivity/config.d.ts +9 -10
- package/dist/src/reactivity/config.d.ts.map +1 -1
- package/dist/src/reactivity/config.js +9 -9
- 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/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 +1 -1
- 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/promotion.ts +15 -3
- 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/reactivity/config.ts +10 -10
- package/src/reactivity/index.ts +4 -3
- 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
|
@@ -5,7 +5,10 @@
|
|
|
5
5
|
* a threshold-signed message:
|
|
6
6
|
*
|
|
7
7
|
* 1. takes the message's `signers`, the cohort `coord` the signers should belong to, and the tier;
|
|
8
|
-
* 2. looks up the cached `MembershipCertV1` for that coord (or pulls the source's `current`);
|
|
8
|
+
* 2. looks up the cached `MembershipCertV1` for that coord (or pulls the source's `current`); a
|
|
9
|
+
* fetched cert is considered only if its own `cohortCoord` names that coord — a cert for any other
|
|
10
|
+
* coord is treated as no cert, since the trust gate and the cache would otherwise be consulted for
|
|
11
|
+
* the coord the cert names rather than the one being verified;
|
|
9
12
|
* 3. checks the signers are a `≥ minSigs` subset of the cert's members and the signature verifies;
|
|
10
13
|
* 4. **on failure against a cached/stale cert, re-fetches the cert from any cohort member exactly
|
|
11
14
|
* once and retries**; still failing → the message is untrusted.
|
|
@@ -14,7 +17,8 @@
|
|
|
14
17
|
* is a `≥ minSigs` quorum over its own `members`) proves only internal well-formedness — *not* that the
|
|
15
18
|
* attesting key set is the legitimate cohort for the coord. An adversary controlling `k − x` keys could
|
|
16
19
|
* mint a self-consistent cert over a coord it does not own. So before a (re)fetched cert is believed,
|
|
17
|
-
* {@link CachingMembershipVerifier.
|
|
20
|
+
* the gate ({@link CachingMembershipVerifier.directVerdict}, then
|
|
21
|
+
* {@link CachingMembershipVerifier.certIsTrusted}) requires it to be self-consistent **AND** anchored by
|
|
18
22
|
* at least one of:
|
|
19
23
|
*
|
|
20
24
|
* - **Trust root** — `(coord, epoch, member-set)` is in the out-of-band-seeded {@link TrustRoot} set
|
|
@@ -33,20 +37,42 @@
|
|
|
33
37
|
* behavior, so there is strictly no regression on coords no node can verify today (distant T2/T3, and
|
|
34
38
|
* T0/T1 until the committed-index binding lands). Once a coord *does* hold a trusted cert, the chain
|
|
35
39
|
* governs successors: an un-anchored cert for an already-trusted coord is rejected (no TOFU downgrade),
|
|
36
|
-
* which is what gives the rotation chain its teeth.
|
|
37
|
-
* the
|
|
38
|
-
*
|
|
40
|
+
* which is what gives the rotation chain its teeth. Two direct-anchor bindings in db-p2p close parts of
|
|
41
|
+
* the gap: `FretTrustAnchor` judges a coord this node serves against its own ring view, and
|
|
42
|
+
* `CommitLogTrustAnchor` judges a reactivity root — a root-placed coord whose placement names its key —
|
|
43
|
+
* against the tail block's commit proof, fetched from the tail's storage group, so a distant subscriber
|
|
44
|
+
* is anchored too. What remains TOFU is a distant coord under neither (other T2/T3 coords a node does
|
|
45
|
+
* not serve, tracked in the backlog `...-fret-stabilization-proof`, and T0/T1 until
|
|
46
|
+
* `...-txlog-committed-binding`).
|
|
47
|
+
*
|
|
48
|
+
* **The gate waits only for the direct verdict.** `directAnchor` may return a promise (the commit-log
|
|
49
|
+
* anchor asks the network), so the gate is in two steps: {@link CachingMembershipVerifier.directVerdict}
|
|
50
|
+
* (self-consistency, trust roots, the direct anchor — nothing that reads per-coord state) is awaited by
|
|
51
|
+
* `loadFrom`, and {@link CachingMembershipVerifier.certIsTrusted} then decides synchronously. Everything
|
|
52
|
+
* that reads or writes the per-coord maps runs after that one `await`, in one synchronous turn with the
|
|
53
|
+
* cache write — see the comment at the `await`.
|
|
39
54
|
*
|
|
40
55
|
* **Deviation from the ticket sketch (documented):** `verifyMessage` takes the cohort `tier`. A coord
|
|
41
56
|
* is an opaque hash, so the T0/T1-vs-T2/T3 source dispatch the same ticket mandates cannot be derived
|
|
42
57
|
* from the coord alone; the caller already knows the tier (it computed the coord from the message's
|
|
43
58
|
* claimed tier/topic). The `tier` is threaded into the gate so the direct anchor is consulted with the
|
|
44
59
|
* same tier the router used (the binding is tier-scoped).
|
|
60
|
+
*
|
|
61
|
+
* **Root-placed coords (§Tier addressing → Root placement at a routing key).** Everything above says
|
|
62
|
+
* "`≥ minSigs`" for the node-wide threshold. The root of a root-placed topic is a different kind of
|
|
63
|
+
* cohort — the group responsible for a routing key, typically smaller than `minSigs` — so a caller that
|
|
64
|
+
* knows the coord is root-placed passes a {@link RootPlacement}, and the verifier then uses
|
|
65
|
+
* `ceil(members × quorumRatio)` of the cert being checked against for **every** threshold it applies at
|
|
66
|
+
* that coord: the cert's self-consistency, the rotation-chain quorum (over the predecessor's members),
|
|
67
|
+
* and the message itself. The ratio is the caller's own configuration, never read off a message or cert.
|
|
68
|
+
* The placement is also handed to the membership source and the direct anchor, which need it to find
|
|
69
|
+
* and judge the root group. A cached cert remembers the rule it was validated under, and a call under a
|
|
70
|
+
* different rule does not see it — see {@link CachingMembershipVerifier.heldUnder}.
|
|
45
71
|
*/
|
|
46
72
|
import { noAuthorityTrustAnchor } from "../ports.js";
|
|
47
73
|
import { b64urlToBytes, bytesToB64url, decodeMembershipCertV1 } from "../wire/codec.js";
|
|
48
74
|
import { CohortWireError } from "../wire/validate.js";
|
|
49
|
-
import { DEFAULT_MIN_SIGS } from "../sig/threshold.js";
|
|
75
|
+
import { DEFAULT_MIN_SIGS, rootPlacedMinSigs } from "../sig/threshold.js";
|
|
50
76
|
import { membershipCertSigningPayload } from "../sig/payloads.js";
|
|
51
77
|
import { LruMap } from "../../utility/lru-map.js";
|
|
52
78
|
/**
|
|
@@ -93,10 +119,10 @@ class CachingMembershipVerifier {
|
|
|
93
119
|
this.lastFetchAt = new LruMap(maxCoords);
|
|
94
120
|
this.staleGapStrikes = new LruMap(maxCoords);
|
|
95
121
|
}
|
|
96
|
-
cache(cert) {
|
|
122
|
+
cache(cert, placement) {
|
|
97
123
|
// The public cache feeds this node its OWN freshly-published cert — a node trusts a cert it itself
|
|
98
124
|
// published, so it is marked trusted and may anchor the next rotation in the attestation chain.
|
|
99
|
-
this.byCoord.set(cert.cohortCoord, { cert, trusted: true });
|
|
125
|
+
this.byCoord.set(cert.cohortCoord, { cert, trusted: true, quorumRatio: placement?.quorumRatio });
|
|
100
126
|
}
|
|
101
127
|
forget(cohortCoord) {
|
|
102
128
|
// Drop the cached cert (the trust lock, when the entry was trusted) and the strike counter — the
|
|
@@ -118,13 +144,16 @@ class CachingMembershipVerifier {
|
|
|
118
144
|
async verifyMessage(signers, expectedCoord, tier, payload, sig, opts) {
|
|
119
145
|
const coordKey = bytesToB64url(expectedCoord);
|
|
120
146
|
const source = this.deps.router.for(tier);
|
|
147
|
+
const placement = opts?.placement;
|
|
148
|
+
const lookup = lookupOptionsFor(placement);
|
|
121
149
|
// Seed from the cheap cached view if we hold nothing yet. A cached cert already passed the gate when
|
|
122
|
-
// it was loaded (or was self-published via `cache`), so it is used directly for message verification
|
|
123
|
-
|
|
150
|
+
// it was loaded (or was self-published via `cache`), so it is used directly for message verification
|
|
151
|
+
// — provided it passed under the rule this call applies (see `heldUnder`).
|
|
152
|
+
let cert = this.heldUnder(coordKey, placement)?.cert;
|
|
124
153
|
if (cert === undefined) {
|
|
125
|
-
cert = await this.loadFrom(source.current(expectedCoord), tier);
|
|
154
|
+
cert = await this.loadFrom(source.current(expectedCoord, lookup), coordKey, tier, placement);
|
|
126
155
|
}
|
|
127
|
-
if (cert !== undefined && this.messageVerifies(cert, signers, payload, sig)) {
|
|
156
|
+
if (cert !== undefined && this.messageVerifies(cert, signers, payload, sig, placement)) {
|
|
128
157
|
this.staleGapStrikes.delete(coordKey); // a verify resets the consecutive stale-gap strike count
|
|
129
158
|
return "verified";
|
|
130
159
|
}
|
|
@@ -136,13 +165,28 @@ class CachingMembershipVerifier {
|
|
|
136
165
|
if (!this.refetchAllowed(coordKey, opts)) {
|
|
137
166
|
return "untrusted";
|
|
138
167
|
}
|
|
139
|
-
const refreshed = await this.loadFrom(source.fetch(expectedCoord), tier);
|
|
140
|
-
if (refreshed !== undefined && this.messageVerifies(refreshed, signers, payload, sig)) {
|
|
168
|
+
const refreshed = await this.loadFrom(source.fetch(expectedCoord, lookup), coordKey, tier, placement);
|
|
169
|
+
if (refreshed !== undefined && this.messageVerifies(refreshed, signers, payload, sig, placement)) {
|
|
141
170
|
this.staleGapStrikes.delete(coordKey); // a verify resets the consecutive stale-gap strike count
|
|
142
171
|
return "verified";
|
|
143
172
|
}
|
|
144
173
|
return "untrusted";
|
|
145
174
|
}
|
|
175
|
+
/**
|
|
176
|
+
* The cached entry for `coordKey`, **only if it was validated under the rule this call applies** — the
|
|
177
|
+
* same root-placement ratio, or both the default rule. An entry held under any other rule reads as
|
|
178
|
+
* absent, for every purpose: message verification, the attestation-chain predecessor, and the trust
|
|
179
|
+
* lock. So a cert that passed one threshold is never taken as having passed another, and the call
|
|
180
|
+
* re-validates from the source under its own rule instead.
|
|
181
|
+
*/
|
|
182
|
+
heldUnder(coordKey, placement) {
|
|
183
|
+
const held = this.byCoord.get(coordKey);
|
|
184
|
+
return held !== undefined && held.quorumRatio === placement?.quorumRatio ? held : undefined;
|
|
185
|
+
}
|
|
186
|
+
/** The signature threshold over `cert`'s members: `ceil(members × quorumRatio)` for a root-placed coord, else the node-wide `minSigs`. */
|
|
187
|
+
minSigsFor(cert, placement) {
|
|
188
|
+
return placement === undefined ? this.minSigs : rootPlacedMinSigs(cert.members.length, placement);
|
|
189
|
+
}
|
|
146
190
|
/**
|
|
147
191
|
* Whether a `source.fetch()` refetch is permitted for `coordKey` now. Unbounded (always `true`) unless
|
|
148
192
|
* the caller supplies both `minRefetchIntervalMs` and `now`, in which case at most one refetch per coord
|
|
@@ -164,11 +208,14 @@ class CachingMembershipVerifier {
|
|
|
164
208
|
}
|
|
165
209
|
/**
|
|
166
210
|
* Decode an encoded cert, run it through the trust gate, cache it (with its trusted status), and return
|
|
167
|
-
* it for message verification; `undefined` if absent, malformed,
|
|
168
|
-
* cert (failed self-consistency, a `"rejected"` direct anchor, or an
|
|
169
|
-
* already-trusted coord) is treated exactly like an absent cert, so the single
|
|
211
|
+
* it for message verification; `undefined` if absent, malformed, for a coord other than `coordKey`, or
|
|
212
|
+
* rejected by the gate. A rejected cert (failed self-consistency, a `"rejected"` direct anchor, or an
|
|
213
|
+
* un-anchored cert for an already-trusted coord) is treated exactly like an absent cert, so the single
|
|
214
|
+
* refetch still fires. The coord check runs before the gate: the gate, the direct anchor and the cache
|
|
215
|
+
* are all keyed on the cert's own `cohortCoord`, so a self-consistent cert for an unrelated coord would
|
|
216
|
+
* otherwise pass as trust-on-first-use there and then verify a message for `coordKey`.
|
|
170
217
|
*/
|
|
171
|
-
async loadFrom(pending, tier) {
|
|
218
|
+
async loadFrom(pending, coordKey, tier, placement) {
|
|
172
219
|
const encoded = await pending;
|
|
173
220
|
if (encoded === undefined) {
|
|
174
221
|
return undefined;
|
|
@@ -177,7 +224,17 @@ class CachingMembershipVerifier {
|
|
|
177
224
|
let trust;
|
|
178
225
|
try {
|
|
179
226
|
cert = decodeMembershipCertV1(encoded, this.deps.maxMessageBytes);
|
|
180
|
-
|
|
227
|
+
if (cert.cohortCoord !== coordKey) {
|
|
228
|
+
return undefined;
|
|
229
|
+
}
|
|
230
|
+
// The last `await` on the load path, and it has to be in this function. Two loads of one coord can
|
|
231
|
+
// be in flight across it, so everything that reads or writes `byCoord` / `staleGapStrikes` — the
|
|
232
|
+
// gate's chain, fallback and stale-gap recovery, then the `lockedUnderAnotherRule` read and the
|
|
233
|
+
// cache write below — runs after it in one synchronous turn. Awaiting an async gate here instead
|
|
234
|
+
// puts a microtask between the gate's reads and the write, and a second load's first-use check
|
|
235
|
+
// then misses the lock this load is about to write.
|
|
236
|
+
const direct = await this.directVerdict(cert, tier, placement);
|
|
237
|
+
trust = this.certIsTrusted(cert, direct, placement);
|
|
181
238
|
}
|
|
182
239
|
catch (err) {
|
|
183
240
|
if (err instanceof CohortWireError) {
|
|
@@ -188,36 +245,65 @@ class CachingMembershipVerifier {
|
|
|
188
245
|
if (trust === "reject") {
|
|
189
246
|
return undefined;
|
|
190
247
|
}
|
|
248
|
+
if (this.lockedUnderAnotherRule(cert.cohortCoord, placement)) {
|
|
249
|
+
return cert; // usable for this call's message check, but it must not displace the lock
|
|
250
|
+
}
|
|
191
251
|
// Only a `"trusted"` cert may anchor a successor in the attestation chain; a `"tofu"` cert is cached
|
|
192
252
|
// for message verification but must never launder trust into a rotation.
|
|
193
|
-
this.byCoord.set(cert.cohortCoord, { cert, trusted: trust === "trusted" });
|
|
253
|
+
this.byCoord.set(cert.cohortCoord, { cert, trusted: trust === "trusted", quorumRatio: placement?.quorumRatio });
|
|
194
254
|
return cert;
|
|
195
255
|
}
|
|
196
256
|
/**
|
|
197
|
-
*
|
|
198
|
-
*
|
|
199
|
-
*
|
|
200
|
-
*
|
|
257
|
+
* Whether the coord holds a **trusted** cert validated under a rule other than this call's. Such an entry
|
|
258
|
+
* is invisible to this call ({@link heldUnder}), so the trust gate ran as if the coord were cold and may
|
|
259
|
+
* have accepted the cert on first use. Caching that result would erase the trust lock through a side
|
|
260
|
+
* door — a call under one rule downgrading what another rule established — so it is used for the
|
|
261
|
+
* current message only.
|
|
262
|
+
*
|
|
263
|
+
* NOTE: a coord has one rule by construction (it follows from how the coord was derived), so two rules
|
|
264
|
+
* meeting at one coord is an anomaly, and the cost here — a source read on every call under the second
|
|
265
|
+
* rule — is not paid in normal operation. If it ever is, key the cache by `(coord, rule)` instead.
|
|
266
|
+
*/
|
|
267
|
+
lockedUnderAnotherRule(coordKey, placement) {
|
|
268
|
+
const held = this.byCoord.get(coordKey);
|
|
269
|
+
return held !== undefined && held.trusted && held.quorumRatio !== placement?.quorumRatio;
|
|
270
|
+
}
|
|
271
|
+
/**
|
|
272
|
+
* The first step of the trust gate: what can be said of a cert without reading per-coord state. A cert
|
|
273
|
+
* that is not self-consistent is `"rejected"` (internal well-formedness is the precondition for any trust
|
|
274
|
+
* path), one matching a configured genesis root is `"anchored"` (authoritative, checked before the direct
|
|
275
|
+
* anchor), and otherwise the direct anchor decides. This is the only step that may wait — the anchor may
|
|
276
|
+
* ask the network — which is why it reads none of the per-coord maps: self-consistency is pure and the
|
|
277
|
+
* trust roots are fixed at construction. Keep it that way.
|
|
201
278
|
*/
|
|
202
|
-
|
|
203
|
-
if (!this.certIsSelfConsistent(cert)) {
|
|
204
|
-
return "
|
|
279
|
+
async directVerdict(cert, tier, placement) {
|
|
280
|
+
if (!this.certIsSelfConsistent(cert, placement)) {
|
|
281
|
+
return "rejected";
|
|
205
282
|
}
|
|
206
283
|
if (this.matchesTrustRoot(cert)) {
|
|
207
|
-
return "
|
|
284
|
+
return "anchored";
|
|
208
285
|
}
|
|
209
|
-
|
|
210
|
-
|
|
286
|
+
return this.anchor.directAnchor(cert, tier, placement);
|
|
287
|
+
}
|
|
288
|
+
/**
|
|
289
|
+
* The trust gate (see the module header), given the cert's {@link directVerdict}. A cert is accepted iff
|
|
290
|
+
* it is self-consistent **and** anchored by a trust root, the direct anchor, or the attestation chain;
|
|
291
|
+
* otherwise it falls to the interim TOFU fallback (first-use only). Returns whether the cert is a trusted
|
|
292
|
+
* anchor (`"trusted"`), an interim TOFU acceptance (`"tofu"`), or rejected (`"reject"`). Synchronous on
|
|
293
|
+
* purpose: it reads the per-coord maps, and `loadFrom` runs it in the same turn as its cache write.
|
|
294
|
+
*/
|
|
295
|
+
certIsTrusted(cert, direct, placement) {
|
|
296
|
+
if (direct === "anchored") {
|
|
211
297
|
return "trusted";
|
|
212
298
|
}
|
|
213
|
-
if (
|
|
299
|
+
if (direct === "rejected") {
|
|
214
300
|
return "reject"; // a contradicted binding is a forgery — fatal, overrides the TOFU fallback
|
|
215
301
|
}
|
|
216
|
-
//
|
|
217
|
-
if (this.hasRotationAttestation(cert) && this.chainGrantsTrust(cert)) {
|
|
302
|
+
// direct === "unknown": no local authority for this coord. Try the attestation chain, else fall back.
|
|
303
|
+
if (this.hasRotationAttestation(cert) && this.chainGrantsTrust(cert, placement)) {
|
|
218
304
|
return "trusted";
|
|
219
305
|
}
|
|
220
|
-
const fallback = this.fallbackTrust(cert);
|
|
306
|
+
const fallback = this.fallbackTrust(cert, placement);
|
|
221
307
|
if (fallback !== "reject") {
|
|
222
308
|
return fallback; // first-use TOFU (coord not locked): no stale lock to recover from
|
|
223
309
|
}
|
|
@@ -225,7 +311,7 @@ class CachingMembershipVerifier {
|
|
|
225
311
|
// did not chain-verify — the state that strands a former cohort member forever. Consult the stale-gap
|
|
226
312
|
// recovery counter, which releases the lock only on a demonstrated chain gap (never a forged rotation
|
|
227
313
|
// off the current predecessor). See {@link staleGapRecovery}.
|
|
228
|
-
return this.staleGapRecovery(cert);
|
|
314
|
+
return this.staleGapRecovery(cert, placement);
|
|
229
315
|
}
|
|
230
316
|
/**
|
|
231
317
|
* Bounded re-TOFU recovery for a coord that is **trust-locked at a stale epoch it can no longer anchor**.
|
|
@@ -247,9 +333,9 @@ class CachingMembershipVerifier {
|
|
|
247
333
|
* reach the source, so a {@link RefetchBound}-suppressed refetch observes no cert and recovery paces itself
|
|
248
334
|
* with the (bounded) refetch rate — intended, do not "fix" that pacing.
|
|
249
335
|
*/
|
|
250
|
-
staleGapRecovery(cert) {
|
|
336
|
+
staleGapRecovery(cert, placement) {
|
|
251
337
|
const coordKey = cert.cohortCoord;
|
|
252
|
-
const locked = this.
|
|
338
|
+
const locked = this.heldUnder(coordKey, placement);
|
|
253
339
|
// Recovery-eligible only on an explicit rotation gap: a full attestation whose prevEpoch is neither the
|
|
254
340
|
// cert's own epoch (a self-referential rotation) nor the cached trusted epoch (a forgery off the current
|
|
255
341
|
// predecessor — the case the lock exists to reject).
|
|
@@ -278,8 +364,8 @@ class CachingMembershipVerifier {
|
|
|
278
364
|
* cert (a failed/absent rotation, including a forged rotation off a trusted predecessor) is **rejected**
|
|
279
365
|
* — no silent TOFU downgrade — which is what gives the attestation chain its teeth.
|
|
280
366
|
*/
|
|
281
|
-
fallbackTrust(cert) {
|
|
282
|
-
return this.
|
|
367
|
+
fallbackTrust(cert, placement) {
|
|
368
|
+
return this.heldUnder(cert.cohortCoord, placement)?.trusted ? "reject" : "tofu";
|
|
283
369
|
}
|
|
284
370
|
/** Whether a cert carries a full rotation attestation (all three fields; validated all-or-nothing on the wire). */
|
|
285
371
|
hasRotationAttestation(cert) {
|
|
@@ -291,18 +377,20 @@ class CachingMembershipVerifier {
|
|
|
291
377
|
* quorum over this cert's signing payload via `rotationSig`. A predecessor that only reached the cache via
|
|
292
378
|
* TOFU (not trusted) must not anchor the successor — the trusted-cache invariant.
|
|
293
379
|
*/
|
|
294
|
-
chainGrantsTrust(cert) {
|
|
380
|
+
chainGrantsTrust(cert, placement) {
|
|
295
381
|
const prevEpoch = cert.prevEpoch;
|
|
296
382
|
if (prevEpoch === cert.cohortEpoch) {
|
|
297
383
|
return false; // a cert cannot rotate from itself
|
|
298
384
|
}
|
|
299
|
-
const predecessor = this.
|
|
385
|
+
const predecessor = this.heldUnder(cert.cohortCoord, placement);
|
|
300
386
|
if (predecessor === undefined || !predecessor.trusted || predecessor.cert.cohortEpoch !== prevEpoch) {
|
|
301
387
|
return false;
|
|
302
388
|
}
|
|
303
389
|
// `rotationSigners` is validated only as a string array, so `b64urlToBytes` may throw `CohortWireError`
|
|
304
390
|
// on a malformed signer — `loadFrom`'s try/catch turns that into "no cert", as for `certIsSelfConsistent`.
|
|
305
|
-
return this.deps.signer.verifyThreshold(membershipCertSigningPayload(cert), b64urlToBytes(cert.rotationSig), cert.rotationSigners.map((s) => b64urlToBytes(s)), predecessor.cert,
|
|
391
|
+
return this.deps.signer.verifyThreshold(membershipCertSigningPayload(cert), b64urlToBytes(cert.rotationSig), cert.rotationSigners.map((s) => b64urlToBytes(s)), predecessor.cert,
|
|
392
|
+
// The rotation is signed by the PREDECESSOR cohort, so the quorum is counted over its members.
|
|
393
|
+
this.minSigsFor(predecessor.cert, placement));
|
|
306
394
|
}
|
|
307
395
|
/** Whether `cert` matches a configured trust root by `(coord, epoch)` and an order-independent member set. */
|
|
308
396
|
matchesTrustRoot(cert) {
|
|
@@ -314,16 +402,20 @@ class CachingMembershipVerifier {
|
|
|
314
402
|
return false;
|
|
315
403
|
}
|
|
316
404
|
/** A cert is self-consistent only if its own threshold signature is a valid quorum of its members. */
|
|
317
|
-
certIsSelfConsistent(cert) {
|
|
405
|
+
certIsSelfConsistent(cert, placement) {
|
|
318
406
|
// `signers` is validated only as a string array (not per-element base64url), so `b64urlToBytes`
|
|
319
407
|
// below may throw `CohortWireError` on a malformed signer — `loadFrom`'s try/catch turns that
|
|
320
408
|
// into "no cert" rather than letting it escape.
|
|
321
|
-
return this.deps.signer.verifyThreshold(membershipCertSigningPayload(cert), b64urlToBytes(cert.thresholdSig), cert.signers.map((s) => b64urlToBytes(s)), cert, this.
|
|
409
|
+
return this.deps.signer.verifyThreshold(membershipCertSigningPayload(cert), b64urlToBytes(cert.thresholdSig), cert.signers.map((s) => b64urlToBytes(s)), cert, this.minSigsFor(cert, placement));
|
|
322
410
|
}
|
|
323
|
-
messageVerifies(cert, signers, payload, sig) {
|
|
324
|
-
return this.deps.signer.verifyThreshold(payload, sig, signers, cert, this.
|
|
411
|
+
messageVerifies(cert, signers, payload, sig, placement) {
|
|
412
|
+
return this.deps.signer.verifyThreshold(payload, sig, signers, cert, this.minSigsFor(cert, placement));
|
|
325
413
|
}
|
|
326
414
|
}
|
|
415
|
+
/** The membership-source options for a call: `{ rootPlaced: true }` under a placement, none otherwise. */
|
|
416
|
+
function lookupOptionsFor(placement) {
|
|
417
|
+
return placement === undefined ? undefined : { rootPlaced: true };
|
|
418
|
+
}
|
|
327
419
|
/** Pre-normalize a {@link TrustRoot} (raw bytes) to the cert's base64url form for cheap matching. */
|
|
328
420
|
function normalizeTrustRoot(root) {
|
|
329
421
|
return {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"verifier.js","sourceRoot":"","sources":["../../../../src/cohort-topic/membership/verifier.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4CG;AAGH,OAAO,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AACrD,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAC;AACxF,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAEtD,OAAO,EAAE,gBAAgB,EAAqB,MAAM,qBAAqB,CAAC;AAC1E,OAAO,EAAE,4BAA4B,EAAE,MAAM,oBAAoB,CAAC;AAElE,OAAO,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAC;AAElD;;;;;GAKG;AACH,MAAM,CAAC,MAAM,sCAAsC,GAAG,OAAO,CAAC;AAuG9D,MAAM,yBAAyB;IAuBD;IAtB7B,uGAAuG;IACvG,sGAAsG;IACtG,qGAAqG;IACrG,4EAA4E;IAC5E,yGAAyG;IACzG,0GAA0G;IAC1G,wGAAwG;IACxG,2FAA2F;IAC1E,OAAO,CAA6B;IACrD,gHAAgH;IAC/F,WAAW,CAAyB;IACrD;;;;OAIG;IACc,eAAe,CAAyB;IACxC,OAAO,CAAS;IAChB,MAAM,CAAyB;IAC/B,UAAU,CAAiC;IAC3C,uBAAuB,CAAS;IAEjD,YAA6B,IAA4B;QAA5B,SAAI,GAAJ,IAAI,CAAwB;QACxD,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,IAAI,gBAAgB,CAAC;QAChD,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,IAAI,sBAAsB,CAAC;QACpD,IAAI,CAAC,UAAU,GAAG,CAAC,IAAI,CAAC,UAAU,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,kBAAkB,CAAC,CAAC;QAClE,IAAI,CAAC,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CAAC,CAAC,CAAC,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC;AACnE,CAAC;AAED,qGAAqG;AACrG,SAAS,kBAAkB,CAAC,IAAe;IAC1C,OAAO;QACN,KAAK,EAAE,aAAa,CAAC,IAAI,CAAC,KAAK,CAAC;QAChC,KAAK,EAAE,aAAa,CAAC,IAAI,CAAC,KAAK,CAAC;QAChC,OAAO,EAAE,IAAI,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC;KACjD,CAAC;AACH,CAAC;AAED,iHAAiH;AACjH,SAAS,cAAc,CAAC,GAAwB,EAAE,OAA0B;IAC3E,MAAM,IAAI,GAAG,IAAI,GAAG,EAAU,CAAC;IAC/B,KAAK,MAAM,CAAC,IAAI,OAAO,EAAE,CAAC;QACzB,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC;YACjB,OAAO,KAAK,CAAC,CAAC,8CAA8C;QAC7D,CAAC;QACD,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;IACb,CAAC;IACD,qGAAqG;IACrG,6EAA6E;IAC7E,OAAO,IAAI,CAAC,IAAI,KAAK,GAAG,CAAC,IAAI,CAAC;AAC/B,CAAC;AAED,2DAA2D;AAC3D,MAAM,UAAU,wBAAwB,CAAC,IAA4B;IACpE,OAAO,IAAI,yBAAyB,CAAC,IAAI,CAAC,CAAC;AAC5C,CAAC"}
|
|
@@ -19,6 +19,21 @@ import type { MembershipCertV1 } from "./wire/types.js";
|
|
|
19
19
|
* matches FRET's ring width so routing keys line up on the wire.
|
|
20
20
|
*/
|
|
21
21
|
export type RingCoord = Uint8Array;
|
|
22
|
+
declare const topicRouteKeyBrand: unique symbol;
|
|
23
|
+
/**
|
|
24
|
+
* The bytes a cohort-topic frame is routed on: FRET hashes them exactly once into the cohort's ring
|
|
25
|
+
* coordinate. FRET's `routeAct` hashes the key it is handed — at the origin and again at every forwarding
|
|
26
|
+
* hop — so handing it a coordinate lands the frame at the hash of that coordinate, a ring position no
|
|
27
|
+
* cohort serves. Branded so the only way to obtain one is `TierAddressing.routeKey`, which builds the
|
|
28
|
+
* preimage of `TierAddressing.coord` for the same inputs; a {@link RingCoord} does not type-check where a
|
|
29
|
+
* route key belongs.
|
|
30
|
+
*
|
|
31
|
+
* A separate brand from `RoutingKey` (`network/routing-key.ts`): that one is obtainable only from a block
|
|
32
|
+
* id, and these preimages are not block keys.
|
|
33
|
+
*/
|
|
34
|
+
export type TopicRouteKey = Uint8Array & {
|
|
35
|
+
readonly [topicRouteKeyBrand]: true;
|
|
36
|
+
};
|
|
22
37
|
/** A peer, referenced only by its opaque byte-array id. No multiaddr, no libp2p PeerId here. */
|
|
23
38
|
export interface PeerRef {
|
|
24
39
|
readonly id: Uint8Array;
|
|
@@ -29,16 +44,58 @@ export interface PeerRef {
|
|
|
29
44
|
*/
|
|
30
45
|
export interface ITopicRouter {
|
|
31
46
|
/**
|
|
32
|
-
* Route `activity` to the cohort
|
|
33
|
-
* collecting up to `wantK` participants and at least `minSigs` signatures.
|
|
47
|
+
* Route `activity` to the cohort at `H(key)` and run the cohort's activity callback,
|
|
48
|
+
* collecting up to `wantK` participants and at least `minSigs` signatures. The router hashes `key`
|
|
49
|
+
* once; build it with `TierAddressing.routeKey` so that hash is the tier's coordinate.
|
|
34
50
|
* @returns the encoded cohort reply.
|
|
35
51
|
*/
|
|
36
|
-
routeAndAct(key:
|
|
52
|
+
routeAndAct(key: TopicRouteKey, activity: Uint8Array, opts: {
|
|
37
53
|
wantK: number;
|
|
38
54
|
minSigs: number;
|
|
39
55
|
}): Promise<Uint8Array>;
|
|
40
56
|
/** Direct dial to a cached primary; falls back to {@link routeAndAct} on failure (caller decides). */
|
|
41
57
|
dialMember(member: PeerRef, activity: Uint8Array): Promise<Uint8Array>;
|
|
58
|
+
/**
|
|
59
|
+
* Deliver `activity` to the **root group** of a root-placed topic — the peers responsible for
|
|
60
|
+
* `rootKey` — and return the encoded reply. Optional: the walk uses it for the tier-0 step of a
|
|
61
|
+
* root-placed topic when the router has it, and otherwise falls back to ring routing on the root key,
|
|
62
|
+
* which reaches the root coordinate `H(rootKey)`.
|
|
63
|
+
*
|
|
64
|
+
* It exists because the two can disagree: `routeAndAct` lands on the ring's nearest peer to the
|
|
65
|
+
* coordinate, which on a ring shared with another network may be a peer of that other network, whereas
|
|
66
|
+
* the root group is chosen by the rule storage placement uses. db-p2p binds this to the key network.
|
|
67
|
+
*/
|
|
68
|
+
routeToRoot?(rootKey: Uint8Array, activity: Uint8Array): Promise<Uint8Array>;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* The per-coord rule for a **root-placed** cohort — the root of a topic whose tier-0 coordinate is
|
|
72
|
+
* `H(rootKey)` (see `addressing.ts`). Such a cohort is the group of peers responsible for the root key
|
|
73
|
+
* rather than the FRET cohort of `wantK`, so the node-wide `minSigs` does not describe it: its signature
|
|
74
|
+
* threshold is `ceil(memberCount × quorumRatio)`.
|
|
75
|
+
*
|
|
76
|
+
* `quorumRatio` is always the **verifying node's own** configuration, never a value read off a message or
|
|
77
|
+
* a certificate. Build one with `createRootPlacement` (`sig/threshold.ts`), which rejects a ratio outside
|
|
78
|
+
* `(0, 1]`.
|
|
79
|
+
*/
|
|
80
|
+
export interface RootPlacement {
|
|
81
|
+
/** Fraction of a root-placed cohort's members whose signatures make a quorum, in `(0, 1]`. */
|
|
82
|
+
readonly quorumRatio: number;
|
|
83
|
+
/**
|
|
84
|
+
* The routing key whose ring position is the root coordinate, when the caller knows it — for a reactivity
|
|
85
|
+
* root, the tail block's routing key (`routingKeyForBlock(tailId)`, the raw UTF-8 of the id). A direct
|
|
86
|
+
* anchor that can locate the group's own commit record from the key (db-p2p's commit-log anchor) needs it;
|
|
87
|
+
* one that cannot ignores it. It takes no part in cache identity: a coordinate is the hash of its key, so
|
|
88
|
+
* one coordinate has one key, and the verifier keys its cache by `quorumRatio` alone.
|
|
89
|
+
*/
|
|
90
|
+
readonly rootKey?: Uint8Array;
|
|
91
|
+
}
|
|
92
|
+
/** Options for a membership-cert lookup ({@link IMembershipSource}). */
|
|
93
|
+
export interface MembershipLookupOptions {
|
|
94
|
+
/**
|
|
95
|
+
* The coord is the root of a root-placed topic, so its cert is held by (and must be fetched from) the
|
|
96
|
+
* root group rather than the FRET cohort around the coord.
|
|
97
|
+
*/
|
|
98
|
+
readonly rootPlaced?: true;
|
|
42
99
|
}
|
|
43
100
|
/** Intra-cohort gossip transport (FRET cohort gossip underneath). */
|
|
44
101
|
export interface ICohortGossipTransport {
|
|
@@ -50,9 +107,9 @@ export interface ICohortGossipTransport {
|
|
|
50
107
|
/** Authoritative cohort membership snapshots (FRET `MembershipCertV1` / stabilization underneath). */
|
|
51
108
|
export interface IMembershipSource {
|
|
52
109
|
/** Current cached membership cert for `coord`, encoded; `undefined` if none is cached. */
|
|
53
|
-
current(coord: RingCoord): Promise<Uint8Array | undefined>;
|
|
110
|
+
current(coord: RingCoord, opts?: MembershipLookupOptions): Promise<Uint8Array | undefined>;
|
|
54
111
|
/** Force one refresh of `coord`'s membership cert (stale-cache retry); encoded, or `undefined`. */
|
|
55
|
-
fetch(coord: RingCoord): Promise<Uint8Array | undefined>;
|
|
112
|
+
fetch(coord: RingCoord, opts?: MembershipLookupOptions): Promise<Uint8Array | undefined>;
|
|
56
113
|
}
|
|
57
114
|
/**
|
|
58
115
|
* Cohort threshold-signature primitive (FRET's `minSigs = k − x` cohort-signature assembly
|
|
@@ -75,10 +132,11 @@ export interface ICohortThresholdCrypto {
|
|
|
75
132
|
/**
|
|
76
133
|
* Sink the cohort uses to publish a `MembershipCertV1` (over FRET's `/membership` protocol).
|
|
77
134
|
* db-core's publisher builds + threshold-signs the cert and hands it here; db-p2p serves it.
|
|
135
|
+
* A node serves one cohort per coordinate it is in, so a cert is published under its coordinate.
|
|
78
136
|
*/
|
|
79
137
|
export interface IMembershipPublishSink {
|
|
80
|
-
/** Publish (advertise/serve) an already-signed membership certificate, encoded
|
|
81
|
-
publish(encodedCert: Uint8Array): void;
|
|
138
|
+
/** Publish (advertise/serve) an already-signed membership certificate, encoded, for cohort coord `coord`. */
|
|
139
|
+
publish(coord: RingCoord, encodedCert: Uint8Array): void;
|
|
82
140
|
}
|
|
83
141
|
/** Network-size estimate feeding `d_max`. */
|
|
84
142
|
export interface ISizeEstimator {
|
|
@@ -104,15 +162,27 @@ export type TrustAnchorVerdict = "anchored" | "rejected" | "unknown";
|
|
|
104
162
|
* Direct (base-case) trust anchor for a {@link MembershipCertV1}'s `coord → keyset` binding.
|
|
105
163
|
*
|
|
106
164
|
* db-core owns the chain-of-attestations and trust-root logic; the **direct** anchor is
|
|
107
|
-
* tier/transport-specific
|
|
108
|
-
*
|
|
109
|
-
*
|
|
110
|
-
*
|
|
111
|
-
*
|
|
165
|
+
* tier/transport-specific and is therefore delegated through this port. db-p2p binds two: the FRET ring
|
|
166
|
+
* agreement for a coord this node serves (`FretTrustAnchor`), and, for a reactivity root — a root-placed
|
|
167
|
+
* coord whose placement names its key — the tail block's own commit proof, fetched from the tail's storage
|
|
168
|
+
* group (`CommitLogTrustAnchor`); the host asks the first and falls through to the second on `"unknown"`.
|
|
169
|
+
* **db-core never imports FRET.** A node with no authority for the coord returns `"unknown"` so the
|
|
170
|
+
* verifier falls through to the chain / interim fallback instead of breaking distant verification. See
|
|
171
|
+
* {@link noAuthorityTrustAnchor} for the db-core default (every coord `"unknown"`).
|
|
172
|
+
*
|
|
173
|
+
* **The verdict may be asynchronous.** An anchor that judges from local state answers synchronously; one
|
|
174
|
+
* that has to ask the network (the commit-log anchor) returns a promise, and the verifier's trust gate
|
|
175
|
+
* awaits either. An anchor is total: it never throws or rejects, and answers `"unknown"` for anything it
|
|
176
|
+
* cannot decode or reach.
|
|
112
177
|
*/
|
|
113
178
|
export interface IMembershipTrustAnchor {
|
|
114
|
-
/**
|
|
115
|
-
|
|
179
|
+
/**
|
|
180
|
+
* Judge, from a directly-trusted source, whether `cert.members` is authoritative for `cert.cohortCoord`
|
|
181
|
+
* at `tier`. `placement` is present when the verifier was told the coord is root-placed, so the anchor
|
|
182
|
+
* compares against the root group (and its threshold) rather than the FRET cohort around the coord; its
|
|
183
|
+
* `rootKey`, when the caller knew it, is what lets an anchor locate that group's own records.
|
|
184
|
+
*/
|
|
185
|
+
directAnchor(cert: MembershipCertV1, tier: number, placement?: RootPlacement): TrustAnchorVerdict | Promise<TrustAnchorVerdict>;
|
|
116
186
|
}
|
|
117
187
|
/**
|
|
118
188
|
* An out-of-band-seeded trust root: the genesis-block-related cohorts a joining participant is told
|
|
@@ -146,4 +216,5 @@ export interface IRingHash {
|
|
|
146
216
|
/** Ring width in bits. */
|
|
147
217
|
readonly ringBits: number;
|
|
148
218
|
}
|
|
219
|
+
export {};
|
|
149
220
|
//# sourceMappingURL=ports.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ports.d.ts","sourceRoot":"","sources":["../../../src/cohort-topic/ports.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAExD;;;;GAIG;AACH,MAAM,MAAM,SAAS,GAAG,UAAU,CAAC;AAEnC,gGAAgG;AAChG,MAAM,WAAW,OAAO;IACvB,QAAQ,CAAC,EAAE,EAAE,UAAU,CAAC;CACxB;AAED;;;GAGG;AACH,MAAM,WAAW,YAAY;IAC5B
|
|
1
|
+
{"version":3,"file":"ports.d.ts","sourceRoot":"","sources":["../../../src/cohort-topic/ports.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAExD;;;;GAIG;AACH,MAAM,MAAM,SAAS,GAAG,UAAU,CAAC;AAEnC,OAAO,CAAC,MAAM,kBAAkB,EAAE,OAAO,MAAM,CAAC;AAEhD;;;;;;;;;;GAUG;AACH,MAAM,MAAM,aAAa,GAAG,UAAU,G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MG;AACH,MAAM,WAAW,SAAS;IACzB,+BAA+B;IAC/B,QAAQ,CAAC,KAAK,EAAE,UAAU,CAAC;IAC3B,gHAAgH;IAChH,QAAQ,CAAC,KAAK,EAAE,UAAU,CAAC;IAC3B,kEAAkE;IAClE,QAAQ,CAAC,OAAO,EAAE,SAAS,UAAU,EAAE,CAAC;CACxC;AAED;;;;GAIG;AACH,eAAO,MAAM,sBAAsB,EAAE,sBAIpC,CAAC;AAEF;;;;GAIG;AACH,MAAM,WAAW,SAAS;IACzB,8EAA8E;IAC9E,CAAC,CAAC,KAAK,EAAE,UAAU,GAAG,SAAS,CAAC;IAChC,0BAA0B;IAC1B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;CAC1B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ports.js","sourceRoot":"","sources":["../../../src/cohort-topic/ports.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;
|
|
1
|
+
{"version":3,"file":"ports.js","sourceRoot":"","sources":["../../../src/cohort-topic/ports.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAkMH;;;;GAIG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAA2B;IAC7D,YAAY,CAAC,KAAuB,EAAE,KAAa,EAAE,UAA0B;QAC9E,OAAO,SAAS,CAAC;IAClB,CAAC;CACD,CAAC"}
|
|
@@ -12,8 +12,9 @@
|
|
|
12
12
|
* - `directParticipants(T) ≥ cap_promote` (64), OR
|
|
13
13
|
* - `loadBucket[tier(T)] ≥ bucket_overload` (6) AND `directParticipants(T) ≥ cap_promote_fast` (32)
|
|
14
14
|
* — the hot-load fast path from the capacity-barometer ticket, OR
|
|
15
|
-
* - the growth **slope** predicts crossing `cap_promote`
|
|
16
|
-
* early to avoid the gossip-lag overshoot (`§Promotion`:
|
|
15
|
+
* - `directParticipants(T) > cap_demote` (16) AND the growth **slope** predicts crossing `cap_promote`
|
|
16
|
+
* within `T_promote_lookahead` (30s) — fires early to avoid the gossip-lag overshoot (`§Promotion`:
|
|
17
|
+
* pre-promotion on slope); the floor keeps a burst of a few arrivals from reading as a flood.
|
|
17
18
|
*
|
|
18
19
|
* Once promoted, the state is **sticky** for ≥ `T_promote_sticky` (60s) before it can be reconsidered
|
|
19
20
|
* for demotion, so transient count drops don't flap a cohort back to accepting.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"promotion.d.ts","sourceRoot":"","sources":["../../../src/cohort-topic/promotion.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"promotion.d.ts","sourceRoot":"","sources":["../../../src/cohort-topic/promotion.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgDG;AAGH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAEvD,OAAO,KAAK,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAC3E,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAKjE,+CAA+C;AAC/C,eAAO,MAAM,mBAAmB,KAAK,CAAC;AACtC,yEAAyE;AACzE,eAAO,MAAM,wBAAwB,KAAK,CAAC;AAC3C,2EAA2E;AAC3E,eAAO,MAAM,uBAAuB,IAAI,CAAC;AACzC,mEAAmE;AACnE,eAAO,MAAM,kBAAkB,KAAK,CAAC;AACrC,+EAA+E;AAC/E,eAAO,MAAM,mBAAmB,SAAU,CAAC;AAC3C,0CAA0C;AAC1C,eAAO,MAAM,8BAA8B,QAAS,CAAC;AACrD,4FAA4F;AAC5F,eAAO,MAAM,2BAA2B,QAAS,CAAC;AAClD;;;;GAIG;AACH,eAAO,MAAM,wBAAwB,QAAS,CAAC;AAE/C,MAAM,WAAW,eAAe;IAC/B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,cAAc,CAAC,EA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