@serfab/cadre-core 0.12.0 → 0.13.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/README.md +3 -2
- package/dist/cadre-node.d.ts +328 -25
- package/dist/cadre-node.js +760 -59
- package/dist/cadre-node.js.map +1 -1
- package/dist/control-database.d.ts +19 -0
- package/dist/control-database.js +51 -9
- package/dist/control-database.js.map +1 -1
- package/dist/control-schema.d.ts +1 -1
- package/dist/control-schema.js +30 -2
- package/dist/control-schema.js.map +1 -1
- package/dist/enrolled-machine-store-file.d.ts +13 -0
- package/dist/enrolled-machine-store-file.js +41 -0
- package/dist/enrolled-machine-store-file.js.map +1 -0
- package/dist/enrolled-machine-store.d.ts +81 -0
- package/dist/enrolled-machine-store.js +225 -0
- package/dist/enrolled-machine-store.js.map +1 -0
- package/dist/file-durable-slot.js +5 -3
- package/dist/file-durable-slot.js.map +1 -1
- package/dist/index.d.ts +5 -3
- package/dist/index.js +23 -5
- package/dist/index.js.map +1 -1
- package/dist/membership-connection-gater.d.ts +15 -1
- package/dist/membership-connection-gater.js +9 -3
- package/dist/membership-connection-gater.js.map +1 -1
- package/dist/node-local-snapshot.d.ts +6 -0
- package/dist/node-local-snapshot.js +7 -1
- package/dist/node-local-snapshot.js.map +1 -1
- package/dist/{strand-backfill.d.ts → peer-join-backfill.d.ts} +49 -20
- package/dist/{strand-backfill.js → peer-join-backfill.js} +133 -52
- package/dist/peer-join-backfill.js.map +1 -0
- package/dist/relay-addrs.d.ts +73 -0
- package/dist/relay-addrs.js +195 -0
- package/dist/relay-addrs.js.map +1 -1
- package/dist/strand-database.d.ts +12 -0
- package/dist/strand-database.js +16 -0
- package/dist/strand-database.js.map +1 -1
- package/dist/strand-formation-manager.d.ts +12 -0
- package/dist/strand-formation-manager.js +10 -3
- package/dist/strand-formation-manager.js.map +1 -1
- package/dist/strand-formation-protocol.d.ts +76 -2
- package/dist/strand-formation-protocol.js +78 -2
- package/dist/strand-formation-protocol.js.map +1 -1
- package/dist/strand-instance-manager.d.ts +147 -14
- package/dist/strand-instance-manager.js +225 -45
- package/dist/strand-instance-manager.js.map +1 -1
- package/dist/strand-membership-writer.d.ts +12 -0
- package/dist/strand-membership-writer.js +23 -1
- package/dist/strand-membership-writer.js.map +1 -1
- package/dist/strand-network-config.d.ts +84 -0
- package/dist/strand-network-config.js +136 -0
- package/dist/strand-network-config.js.map +1 -0
- package/dist/strand-revocation-enforcer.d.ts +392 -0
- package/dist/strand-revocation-enforcer.js +533 -0
- package/dist/strand-revocation-enforcer.js.map +1 -0
- package/dist/strand-solicitation.d.ts +7 -0
- package/dist/strand-solicitation.js +8 -2
- package/dist/strand-solicitation.js.map +1 -1
- package/dist/strand-watcher.js +6 -1
- package/dist/strand-watcher.js.map +1 -1
- package/dist/types.d.ts +210 -16
- package/dist/types.js +7 -1
- package/dist/types.js.map +1 -1
- package/package.json +16 -8
- package/src/cadre-node.ts +6353 -5603
- package/src/control-database.ts +53 -9
- package/src/control-schema.ts +30 -2
- package/src/enrolled-machine-store-file.ts +43 -0
- package/src/enrolled-machine-store.ts +280 -0
- package/src/file-durable-slot.ts +5 -3
- package/src/index.ts +52 -10
- package/src/membership-connection-gater.ts +9 -3
- package/src/node-local-snapshot.ts +13 -1
- package/src/peer-addr-book.ts +251 -250
- package/src/{strand-backfill.ts → peer-join-backfill.ts} +478 -389
- package/src/relay-addrs.ts +218 -0
- package/src/strand-database.ts +17 -0
- package/src/strand-formation-manager.ts +22 -3
- package/src/strand-formation-protocol.ts +808 -692
- package/src/strand-instance-manager.ts +317 -54
- package/src/strand-membership-writer.ts +23 -1
- package/src/strand-network-config.ts +172 -0
- package/src/strand-revocation-enforcer.ts +653 -0
- package/src/strand-solicitation.ts +484 -471
- package/src/strand-watcher.ts +319 -314
- package/src/types.ts +1554 -1354
- package/dist/strand-backfill.js.map +0 -1
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Node-local, NON-replicated record of how many machines this party had enrolled
|
|
3
|
+
* the last time this node looked — the block-repair corroboration yardstick the
|
|
4
|
+
* CONTROL network declares when its libp2p node is built.
|
|
5
|
+
*
|
|
6
|
+
* ## Why the number has to be remembered rather than read
|
|
7
|
+
*
|
|
8
|
+
* `resolveRepairYardstick` (in `@serfab/quereus-plugin-sereus`'s `cluster-size.ts`
|
|
9
|
+
* — read it first; the arithmetic and both clamps are explained there and are not
|
|
10
|
+
* repeated here) derives the yardstick from the machines that SERVE the network being
|
|
11
|
+
* configured. For the CONTROL network that is the machines enrolled in the party, and
|
|
12
|
+
* exactly so: every enrolled machine runs the control node by construction. (It is NOT
|
|
13
|
+
* the right number for a strand, which runs on a subset — see
|
|
14
|
+
* `StartStrandConfig.servingMachines`. This store is control-network-only, and that
|
|
15
|
+
* scope is a safety property, not an accident.) Optimystic freezes a network's
|
|
16
|
+
* `clusterPolicy` when its libp2p node is built and offers no runtime setter, so the
|
|
17
|
+
* number has to be known at construction time.
|
|
18
|
+
*
|
|
19
|
+
* The control node cannot read it when it needs it. `CadreNode.buildControlNodeOptions`
|
|
20
|
+
* runs inside `start()` BEFORE `createControlNode()`, which is before the
|
|
21
|
+
* `ControlDatabase` holding the `CadrePeer` rows exists — so at the one moment the
|
|
22
|
+
* number is needed, nothing can answer. That deadlock is why the control network
|
|
23
|
+
* declared no yardstick at all and ran at `CONTROL_CLUSTER_POLICY`'s
|
|
24
|
+
* `assumedClusterSize` of 2.
|
|
25
|
+
*
|
|
26
|
+
* This store breaks it the only way a chicken-and-egg is broken: by remembering
|
|
27
|
+
* across the restart. `CadreNode.refreshAuthorizedControlPeers` records the count
|
|
28
|
+
* every time membership is recomputed; `CadreNode.start()` reads it back before the
|
|
29
|
+
* control node is built. A node therefore declares what it last knew, and a party
|
|
30
|
+
* that grows applies the larger number on each node's NEXT launch. Raising the
|
|
31
|
+
* yardstick is the safe direction and a node still holding the old value is running
|
|
32
|
+
* at exactly today's behaviour, so the next natural restart is soon enough — there
|
|
33
|
+
* is deliberately no forced rebuild.
|
|
34
|
+
*
|
|
35
|
+
* ## Why this is NOT a `NodeLocalSnapshot` like its two siblings
|
|
36
|
+
*
|
|
37
|
+
* The trusted-owner anchor (`trusted-owner-store.ts`) and the cold-start
|
|
38
|
+
* bootstrap-peer store (`bootstrap-peer-store.ts`) are the same `{ version,
|
|
39
|
+
* partyId, ... }` envelope over a {@link DurableSlot} this record is, and this
|
|
40
|
+
* module is deliberately symmetrical with them — same injected-backend shape, same
|
|
41
|
+
* `Memory*` / `Persistent*` / `File*` split, same party scoping. It does NOT share
|
|
42
|
+
* their `NodeLocalSnapshot` machinery, for two reasons:
|
|
43
|
+
*
|
|
44
|
+
* - **Shape.** `NodeLocalSnapshot` is a `key -> entry` map with no delete. This
|
|
45
|
+
* record is one integer that must be able to go DOWN after a machine is removed.
|
|
46
|
+
* - **Load policy — the important one.** `NodeLocalSnapshot.open` THROWS when the
|
|
47
|
+
* slot is present but unreadable. That is right for the anchor (a record that
|
|
48
|
+
* cannot be read in full is not a trust anchor) and right for the peer store (a
|
|
49
|
+
* failed read reported as absent would let the next snapshot write destroy a
|
|
50
|
+
* stranded node's only way home). It is WRONG here. Nothing in this record is
|
|
51
|
+
* trust-bearing, it holds nothing that is not recomputed the moment the control
|
|
52
|
+
* database is up, and refusing to start a node over an unreadable *repair hint*
|
|
53
|
+
* is strictly worse than declaring today's 2. So every unreadable, unparsable,
|
|
54
|
+
* foreign-party or junk slot LOGS and COLD-STARTS, yielding `undefined`, which
|
|
55
|
+
* declares nothing, which is byte-for-byte today's behaviour.
|
|
56
|
+
*
|
|
57
|
+
* Do not "unify" the three modules by routing this one through `NodeLocalSnapshot`:
|
|
58
|
+
* that would quietly import the throw, and turn an unreadable hint into a node that
|
|
59
|
+
* will not start.
|
|
60
|
+
*
|
|
61
|
+
* NOTE: writes are serialised in-process only, the same caveat `NodeLocalSnapshot`
|
|
62
|
+
* carries. Two processes (or two browser tabs) sharing ONE slot for ONE party each
|
|
63
|
+
* write their own view and the loser's count is lost. Two same-origin tabs of
|
|
64
|
+
* `reference-app-web` do exactly that — its slot is one key of a shared IndexedDB
|
|
65
|
+
* database, the same last-writer-wins caveat its `node-local-slots.ts` already
|
|
66
|
+
* records for the other two records. Harmless here, unlike there: this value is one
|
|
67
|
+
* integer both tabs re-derive from the same membership rows on their next refresh,
|
|
68
|
+
* so the views reconverge rather than losing an entry nobody rewrites.
|
|
69
|
+
*/
|
|
70
|
+
import debug from 'debug';
|
|
71
|
+
const log = debug('sereus:cadre:enrolled-machine-store');
|
|
72
|
+
/** Envelope version. Guards future migrations; an unknown version cold-starts. */
|
|
73
|
+
const ENVELOPE_VERSION = 1;
|
|
74
|
+
/** Envelope property holding the count. */
|
|
75
|
+
const PAYLOAD_KEY = 'enrolledMachines';
|
|
76
|
+
/**
|
|
77
|
+
* Ephemeral in-memory store — the default when no store is injected via
|
|
78
|
+
* `CadreNodeConfig.enrolledMachines`. A node using this cold-starts on every
|
|
79
|
+
* launch: `count()` is `undefined` at `start()`, so its control node declares
|
|
80
|
+
* nothing and runs at today's behaviour, exactly as before this record existed.
|
|
81
|
+
*/
|
|
82
|
+
export class MemoryEnrolledMachineStore {
|
|
83
|
+
constructor(partyId) {
|
|
84
|
+
this.partyId = partyId;
|
|
85
|
+
}
|
|
86
|
+
count() {
|
|
87
|
+
return this.current;
|
|
88
|
+
}
|
|
89
|
+
async record(count) {
|
|
90
|
+
const accepted = asMachineCount(count);
|
|
91
|
+
if (accepted === undefined) {
|
|
92
|
+
log('refusing to record a non-positive-integer count %o for party %s', count, this.partyId);
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
95
|
+
this.current = accepted;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Durable {@link EnrolledMachineStore} over an app-supplied {@link DurableSlot} —
|
|
100
|
+
* the cross-platform half of every persistent backend (the Node
|
|
101
|
+
* `FileEnrolledMachineStore` is this class over a file slot).
|
|
102
|
+
*
|
|
103
|
+
* Construct via {@link open}. Load policy is the module comment's: every failure
|
|
104
|
+
* mode cold-starts, and `open` never rejects.
|
|
105
|
+
*/
|
|
106
|
+
export class PersistentEnrolledMachineStore {
|
|
107
|
+
constructor(slot, partyId, loaded) {
|
|
108
|
+
this.slot = slot;
|
|
109
|
+
this.partyId = partyId;
|
|
110
|
+
/** Serialises persists so the last count recorded is the last one written. */
|
|
111
|
+
this.writeChain = Promise.resolve();
|
|
112
|
+
this.current = loaded;
|
|
113
|
+
this.persisted = loaded;
|
|
114
|
+
}
|
|
115
|
+
/** Load (or cold-start) the party's last recorded machine count from `slot`. */
|
|
116
|
+
static async open(slot, partyId) {
|
|
117
|
+
return new PersistentEnrolledMachineStore(slot, partyId, await loadCount(slot, partyId));
|
|
118
|
+
}
|
|
119
|
+
count() {
|
|
120
|
+
return this.current;
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Record the count: visible via {@link count} synchronously, then persisted.
|
|
124
|
+
*
|
|
125
|
+
* Writes are SKIPPED when the slot already holds this number, because the sole
|
|
126
|
+
* caller runs on every committed membership write *and* every timed reconcile
|
|
127
|
+
* pass — a party whose membership is stable would otherwise rewrite the same
|
|
128
|
+
* integer forever. The skip is keyed off {@link persisted} rather than
|
|
129
|
+
* {@link current}, so a write that FAILED is retried by the next refresh instead
|
|
130
|
+
* of being suppressed as "unchanged".
|
|
131
|
+
*/
|
|
132
|
+
record(count) {
|
|
133
|
+
const accepted = asMachineCount(count);
|
|
134
|
+
if (accepted === undefined) {
|
|
135
|
+
log('refusing to record a non-positive-integer count %o for party %s', count, this.partyId);
|
|
136
|
+
return Promise.resolve();
|
|
137
|
+
}
|
|
138
|
+
this.current = accepted;
|
|
139
|
+
if (this.persisted === accepted) {
|
|
140
|
+
return Promise.resolve();
|
|
141
|
+
}
|
|
142
|
+
this.writeChain = this.writeChain.then(() => this.persistCurrent());
|
|
143
|
+
return this.writeChain;
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* Write whatever {@link current} holds when this link of the chain runs — so a
|
|
147
|
+
* burst of records collapses into one write of the latest value — and never
|
|
148
|
+
* throw (see {@link EnrolledMachineStore.record}).
|
|
149
|
+
*/
|
|
150
|
+
async persistCurrent() {
|
|
151
|
+
const pending = this.current;
|
|
152
|
+
if (pending === undefined || pending === this.persisted) {
|
|
153
|
+
return;
|
|
154
|
+
}
|
|
155
|
+
const envelope = {
|
|
156
|
+
version: ENVELOPE_VERSION,
|
|
157
|
+
partyId: this.partyId,
|
|
158
|
+
[PAYLOAD_KEY]: pending
|
|
159
|
+
};
|
|
160
|
+
try {
|
|
161
|
+
await this.slot.save(JSON.stringify(envelope, null, '\t'));
|
|
162
|
+
this.persisted = pending;
|
|
163
|
+
log('recorded %d enrolled machine(s) for party %s', pending, this.partyId);
|
|
164
|
+
}
|
|
165
|
+
catch (error) {
|
|
166
|
+
log('persisting %d enrolled machine(s) for party %s failed (in-memory count stands, retried on the next refresh): %o', pending, this.partyId, error);
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* A usable machine count, or `undefined`. Anything that is not a positive integer
|
|
172
|
+
* is unknown rather than coerced — `'3'`, `0`, `-1`, `2.5`, `null` and a missing key
|
|
173
|
+
* all cold-start. Coercing here would be the beginning of a parser, and Optimystic
|
|
174
|
+
* itself treats a degenerate declaration as absent, so a rounded value would be a
|
|
175
|
+
* number nobody chose.
|
|
176
|
+
*/
|
|
177
|
+
function asMachineCount(value) {
|
|
178
|
+
return typeof value === 'number' && Number.isInteger(value) && value >= 1 ? value : undefined;
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
181
|
+
* Read the slot into the initial count. EVERY failure — unreadable slot, unparsable
|
|
182
|
+
* JSON, wrong envelope version, foreign `partyId`, junk payload — logs and returns
|
|
183
|
+
* `undefined` (see the module comment for why this record, unlike its two siblings,
|
|
184
|
+
* must not throw on an unreadable slot).
|
|
185
|
+
*/
|
|
186
|
+
async function loadCount(slot, partyId) {
|
|
187
|
+
let text;
|
|
188
|
+
try {
|
|
189
|
+
text = await slot.load();
|
|
190
|
+
}
|
|
191
|
+
catch (error) {
|
|
192
|
+
// The deliberate divergence from `NodeLocalSnapshot.open`, which throws here.
|
|
193
|
+
log('slot for party %s is present but unreadable (cold start — this node declares no yardstick): %o', partyId, error);
|
|
194
|
+
return undefined;
|
|
195
|
+
}
|
|
196
|
+
if (text === undefined) {
|
|
197
|
+
return undefined;
|
|
198
|
+
}
|
|
199
|
+
let parsed;
|
|
200
|
+
try {
|
|
201
|
+
parsed = JSON.parse(text);
|
|
202
|
+
}
|
|
203
|
+
catch (error) {
|
|
204
|
+
log('corrupt slot for party %s (cold start): %o', partyId, error);
|
|
205
|
+
return undefined;
|
|
206
|
+
}
|
|
207
|
+
if (!isRecord(parsed) || parsed.version !== ENVELOPE_VERSION || parsed.partyId !== partyId) {
|
|
208
|
+
// A non-string partyId cannot equal the requested one, so this covers both a
|
|
209
|
+
// malformed envelope and a slot reused for another party.
|
|
210
|
+
log('slot for party %s has an unknown shape or a foreign partyId (cold start)', partyId);
|
|
211
|
+
return undefined;
|
|
212
|
+
}
|
|
213
|
+
const count = asMachineCount(parsed[PAYLOAD_KEY]);
|
|
214
|
+
if (count === undefined) {
|
|
215
|
+
log('slot for party %s holds an unusable %s value %o (cold start)', partyId, PAYLOAD_KEY, parsed[PAYLOAD_KEY]);
|
|
216
|
+
return undefined;
|
|
217
|
+
}
|
|
218
|
+
log('loaded %d enrolled machine(s) for party %s', count, partyId);
|
|
219
|
+
return count;
|
|
220
|
+
}
|
|
221
|
+
/** A plain JSON object. Arrays excluded: an array envelope is not an envelope. */
|
|
222
|
+
function isRecord(value) {
|
|
223
|
+
return typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
224
|
+
}
|
|
225
|
+
//# sourceMappingURL=enrolled-machine-store.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"enrolled-machine-store.js","sourceRoot":"","sources":["../src/enrolled-machine-store.ts"],"names":[],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CAAC,0EAA0E,EAAE,OAAO,CAAC,CAAC;QACzF,OAAO,SAAS,CAAC;IAClB,CAAC;IAED,MAAM,KAAK,GAAG,cAAc,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC,CAAC;IAClD,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;QACzB,GAAG,CAAC,8DAA8D,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,CAAC,WAAW,CAAC,CAAC,CAAC;QAC/G,OAAO,SAAS,CAAC;IAClB,CAAC;IACD,GAAG,CAAC,4CAA4C,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;IAClE,OAAO,KAAK,CAAC;AACd,CAAC;AAED,kFAAkF;AAClF,SAAS,QAAQ,CAAC,KAAc;IAC/B,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AAC7E,CAAC"}
|
|
@@ -5,9 +5,11 @@
|
|
|
5
5
|
* parties without cross-party leakage.
|
|
6
6
|
*
|
|
7
7
|
* This is the whole platform-specific part of the file-backed node-local
|
|
8
|
-
* stores (`trusted-owner-store-file.ts`, `bootstrap-peer-store-file.ts
|
|
9
|
-
* load policy, envelope and write chain
|
|
10
|
-
* `node-local-snapshot.ts
|
|
8
|
+
* stores (`trusted-owner-store-file.ts`, `bootstrap-peer-store-file.ts`,
|
|
9
|
+
* `enrolled-machine-store-file.ts`); the load policy, envelope and write chain
|
|
10
|
+
* are cross-platform — in `node-local-snapshot.ts` for the first two, and in
|
|
11
|
+
* `enrolled-machine-store.ts` for the third, which deliberately does not share
|
|
12
|
+
* that machinery. Like its three importers, this module imports
|
|
11
13
|
* `node:fs/promises`, so it is kept OUT of the package's cross-platform
|
|
12
14
|
* default entry and is not itself an exported subpath.
|
|
13
15
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"file-durable-slot.js","sourceRoot":"","sources":["../src/file-durable-slot.ts"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,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,YAAY,OAAO,CAAC,CAAC;IACjE,CAAC;IAED,iFAAiF;IACzE,QAAQ;QACf,MAAM,MAAM,GAAG,WAAW,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;QAC9C,OAAO,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,YAAY,IAAI,MAAM,MAAM,CAAC,CAAC;IAC1E,CAAC;CACD"}
|
package/dist/index.d.ts
CHANGED
|
@@ -11,10 +11,12 @@ export { loadOrCreateIdentityKey, peerKeySigner, type PeerKeySigner } from './id
|
|
|
11
11
|
export { MemoryTrustedOwnerStore, PersistentTrustedOwnerStore, type TrustedOwnerStore, type TrustSource } from './trusted-owner-store.js';
|
|
12
12
|
export type { DurableSlot } from './node-local-snapshot.js';
|
|
13
13
|
export { MemoryBootstrapPeerStore, PersistentBootstrapPeerStore, type BootstrapPeerStore, type BootstrapPeerEntry } from './bootstrap-peer-store.js';
|
|
14
|
+
export { MemoryEnrolledMachineStore, PersistentEnrolledMachineStore, type EnrolledMachineStore } from './enrolled-machine-store.js';
|
|
14
15
|
export { StrandDatabase, type StrandDatabaseConfig } from './strand-database.js';
|
|
15
16
|
export { StrandWatcher, type StrandWatcherCallbacks, type StrandQueryable, type SAppIdLookup, type StrandRowWithApp } from './strand-watcher.js';
|
|
16
17
|
export { StrandInstanceManager, type StartStrandConfig, type ResumeStrandOverrides, getStrandStoragePath } from './strand-instance-manager.js';
|
|
17
|
-
export {
|
|
18
|
+
export { PeerJoinBackfill, DEFAULT_PEER_JOIN_BACKFILL, MAX_BLOCK_MESSAGE_BYTES, type PeerJoinBackfillConfig, type PeerJoinBackfillDeps, type PeerJoinBackfillResult, type PeerJoinBackfillPushClient } from './peer-join-backfill.js';
|
|
19
|
+
export { StrandRevocationEnforcer, createRevocationConnectionGater, readStrandRevocationRows, DEFAULT_REVOCATION_POLL_INTERVAL_MS, type StrandRevocationEnforcementConfig, type StrandRevocationEnforcerDeps, type StrandRevocationRows, type StrandMemberPeerBinding, type StrandRevocationJudge, type StrandRevocationNetwork, type RevocationRefreshScheduler } from './strand-revocation-enforcer.js';
|
|
18
20
|
export { HibernationManager, type HibernationCallbacks } from './hibernation-manager.js';
|
|
19
21
|
export { ArachnodeStub, createArachnodeStub, type RingConfig } from './arachnode-stub.js';
|
|
20
22
|
export { EnrollmentService, type MemberVerifier, type MemberRegistry } from './enrollment.js';
|
|
@@ -38,9 +40,9 @@ export { PushFanoutService, DEFAULT_PUSH_COOLDOWN_MS, DEFAULT_PUSH_DEBOUNCE_MS,
|
|
|
38
40
|
export { selectControlCohortDials, DEFAULT_CONTROL_COHORT_DIAL_TIMEOUT_MS, DEFAULT_CONTROL_COHORT_RECONCILE_MS, DEFAULT_CONTROL_COHORT_TARGET_DEGREE, type ControlCohortSelection } from './control-cohort.js';
|
|
39
41
|
export { anchoredTrustPolicy, pinnedKeyTrustPolicy, tofuTrustPolicy, type SeedTrustPolicy, type SeedTrustContext, type SeedTrustDecision } from './seed-trust-policy.js';
|
|
40
42
|
export { signSchema, verifySchema, assertSchemaSignature, SchemaVerificationError } from './schema-verification.js';
|
|
41
|
-
export { FormationListener, dialFormation, isValidResponderCreatesResult, FORMATION_PROTOCOL, type FormationParty, type FormationContactMessage, type FormationResultMessage, type FormationProvisionResult, type FormationStrandInfo, type FormationDbConnectionInfo, type FormationListenerOptions, type FormationDialOptions, type ResponderProvisionOutcome } from './strand-formation-protocol.js';
|
|
43
|
+
export { FormationListener, dialFormation, isValidResponderCreatesResult, sanitizeStrandAddrs, FORMATION_PROTOCOL, type FormationParty, type FormationContactMessage, type FormationResultMessage, type FormationProvisionResult, type FormationStrandInfo, type FormationDbConnectionInfo, type FormationListenerOptions, type FormationDialOptions, type FormationDialResult, type ResponderProvisionOutcome } from './strand-formation-protocol.js';
|
|
42
44
|
export { StrandFormationManager, createStrandFormationManager, type StrandFormationManagerConfig, type StrandFormationManagerOptions } from './strand-formation-manager.js';
|
|
43
45
|
export { createMembershipConnectionGater, STRANGER_OPEN_PROTOCOLS, DEFAULT_ENROLLMENT_WINDOW_MS, ADMISSION_DECISION_TIMEOUT_MS, RELAY_ADMISSION_RESERVE_DEADLINE_MS, MAX_UNAUTHORIZED_RELAY_RESERVATIONS, UNAUTHORIZED_RESERVATION_TTL_MS, UnauthorizedReservationBudget, type InboundAdmissionPolicy, type InboundConnectionVerdict } from './membership-connection-gater.js';
|
|
44
|
-
export { RelayReservationFailedError, RELAY_SEARCH_LISTEN_ADDR } from './relay-addrs.js';
|
|
46
|
+
export { RelayReservationFailedError, UnbindableListenAddressError, RELAY_SEARCH_LISTEN_ADDR } from './relay-addrs.js';
|
|
45
47
|
export { circuitMultiaddrs, superviseRelayReservation, DEFAULT_RELAY_RESERVE_TIMEOUT_MS, DEFAULT_RELAY_RESERVE_POLL_MS, DEFAULT_RELAY_CHECK_MS, DEFAULT_RELAY_MIN_BACKOFF_MS, DEFAULT_RELAY_MAX_BACKOFF_MS, type RelayReservationStatus, type RelayReservationState, type RelayReserveOptions, type RelayReservationSupervisor, type RelayReservationSupervisorOptions } from './relay-reservation.js';
|
|
46
48
|
export { classifyTransport, classifyConnectionPath, summarizeConnectionPaths, emptyConnectionPathSummary, DEFAULT_SETTLE_WINDOW_MS, type ConnectionPathKind, type ConnectionTransport, type ConnectionPath, type ConnectionPathSummary, type ConnectionLike } from './diagnostics/connection-path.js';
|
package/dist/index.js
CHANGED
|
@@ -40,14 +40,29 @@ export { MemoryTrustedOwnerStore, PersistentTrustedOwnerStore } from './trusted-
|
|
|
40
40
|
// interface + in-memory store here, Node-only file backend behind the subpath
|
|
41
41
|
// '@serfab/cadre-core/bootstrap-peer-store-file'.
|
|
42
42
|
export { MemoryBootstrapPeerStore, PersistentBootstrapPeerStore } from './bootstrap-peer-store.js';
|
|
43
|
+
// Node-local enrolled-machine count: the machines this party had enrolled the
|
|
44
|
+
// last time this node looked, remembered across restarts so the CONTROL node can
|
|
45
|
+
// declare a block-repair yardstick at bring-up — which is before the database
|
|
46
|
+
// holding the membership rows exists. Same cross-platform split as the two
|
|
47
|
+
// records above; Node-only file backend behind the subpath
|
|
48
|
+
// '@serfab/cadre-core/enrolled-machine-store-file'. Its load policy deliberately
|
|
49
|
+
// DIVERGES from theirs (an unreadable slot cold-starts rather than throwing) —
|
|
50
|
+
// see the module comment before unifying the three.
|
|
51
|
+
export { MemoryEnrolledMachineStore, PersistentEnrolledMachineStore } from './enrolled-machine-store.js';
|
|
43
52
|
// Strand database
|
|
44
53
|
export { StrandDatabase } from './strand-database.js';
|
|
45
54
|
// Strand management
|
|
46
55
|
export { StrandWatcher } from './strand-watcher.js';
|
|
47
56
|
export { StrandInstanceManager, getStrandStoragePath } from './strand-instance-manager.js';
|
|
48
|
-
//
|
|
49
|
-
// connected
|
|
50
|
-
|
|
57
|
+
// Peer-join block catch-up (push this network's own blocks to each newly
|
|
58
|
+
// connected peer, so a late joiner physically holds pre-join blocks). Shared
|
|
59
|
+
// by the strand networks (ungated) and the control network (membership-gated).
|
|
60
|
+
export { PeerJoinBackfill, DEFAULT_PEER_JOIN_BACKFILL, MAX_BLOCK_MESSAGE_BYTES } from './peer-join-backfill.js';
|
|
61
|
+
// Closed-strand revoked-peer enforcement (deny the network nodes of removed
|
|
62
|
+
// members at the stream and connection layers, and hang up the sessions they
|
|
63
|
+
// already hold — see the module doc for the settled deny-list design, the
|
|
64
|
+
// teardown seam, and the fail directions).
|
|
65
|
+
export { StrandRevocationEnforcer, createRevocationConnectionGater, readStrandRevocationRows, DEFAULT_REVOCATION_POLL_INTERVAL_MS } from './strand-revocation-enforcer.js';
|
|
51
66
|
// Hibernation
|
|
52
67
|
export { HibernationManager } from './hibernation-manager.js';
|
|
53
68
|
// Arachnode (stub)
|
|
@@ -106,7 +121,7 @@ export { anchoredTrustPolicy, pinnedKeyTrustPolicy, tofuTrustPolicy } from './se
|
|
|
106
121
|
// Schema Verification
|
|
107
122
|
export { signSchema, verifySchema, assertSchemaSignature, SchemaVerificationError } from './schema-verification.js';
|
|
108
123
|
// Strand Formation transport (native cadre-core protocol)
|
|
109
|
-
export { FormationListener, dialFormation, isValidResponderCreatesResult, FORMATION_PROTOCOL } from './strand-formation-protocol.js';
|
|
124
|
+
export { FormationListener, dialFormation, isValidResponderCreatesResult, sanitizeStrandAddrs, FORMATION_PROTOCOL } from './strand-formation-protocol.js';
|
|
110
125
|
// Strand Formation manager (drives the native transport)
|
|
111
126
|
export { StrandFormationManager, createStrandFormationManager } from './strand-formation-manager.js';
|
|
112
127
|
// Control-network inbound connection gate (membership defense-in-depth)
|
|
@@ -114,7 +129,10 @@ export { createMembershipConnectionGater, STRANGER_OPEN_PROTOCOLS, DEFAULT_ENROL
|
|
|
114
129
|
// Thrown out of `CadreNode.start()` when a `network.relayAddrs` reservation does
|
|
115
130
|
// not land on its first attempt — the fail-fast posture of that config field now
|
|
116
131
|
// that the control node reserves AFTER control-database bring-up (relay-addrs.ts).
|
|
117
|
-
|
|
132
|
+
// `UnbindableListenAddressError` is the same posture for the OTHER half of the listen
|
|
133
|
+
// config: a `network.listenAddrs` entry whose transport the node will not have refuses
|
|
134
|
+
// start instead of being silently dropped by libp2p's transport manager.
|
|
135
|
+
export { RelayReservationFailedError, UnbindableListenAddressError, RELAY_SEARCH_LISTEN_ADDR } from './relay-addrs.js';
|
|
118
136
|
// Relay reservation via the bare `/p2p-circuit` search listener — the one route
|
|
119
137
|
// every control node takes; `network.relayAddrs` is its fail-fast posture
|
|
120
138
|
// (see relay-reservation.ts)
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,aAAa;AACb,cAAc,YAAY,CAAC;AAE3B,+DAA+D;AAC/D,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEpD,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AsB;AACtB,OAAO,EACL,UAAU,EACV,YAAY,EACZ,qBAAqB,EACrB,uBAAuB,EACxB,MAAM,0BAA0B,CAAC;AAElC,0DAA0D;AAC1D,OAAO,EACL,iBAAiB,EACjB,aAAa,EACb,6BAA6B,EAC7B,mBAAmB,EACnB,kBAAkB,EAWnB,MAAM,gCAAgC,CAAC;AAExC,yDAAyD;AACzD,OAAO,EACL,sBAAsB,EACtB,4BAA4B,EAG7B,MAAM,+BAA+B,CAAC;AAEvC,wEAAwE;AACxE,OAAO,EACL,+BAA+B,EAC/B,uBAAuB,EACvB,4BAA4B,EAC5B,6BAA6B,EAC7B,mCAAmC,EACnC,mCAAmC,EACnC,+BAA+B,EAC/B,6BAA6B,EAG9B,MAAM,kCAAkC,CAAC;AAE1C,iFAAiF;AACjF,iFAAiF;AACjF,mFAAmF;AACnF,sFAAsF;AACtF,uFAAuF;AACvF,yEAAyE;AACzE,OAAO,EACL,2BAA2B,EAC3B,4BAA4B,EAC5B,wBAAwB,EACzB,MAAM,kBAAkB,CAAC;AAE1B,gFAAgF;AAChF,0EAA0E;AAC1E,6BAA6B;AAC7B,OAAO,EACL,iBAAiB,EACjB,yBAAyB,EACzB,gCAAgC,EAChC,6BAA6B,EAC7B,sBAAsB,EACtB,4BAA4B,EAC5B,4BAA4B,EAM7B,MAAM,wBAAwB,CAAC;AAEhC,2EAA2E;AAC3E,OAAO,EACL,iBAAiB,EACjB,sBAAsB,EACtB,wBAAwB,EACxB,0BAA0B,EAC1B,wBAAwB,EAMzB,MAAM,kCAAkC,CAAC"}
|
|
@@ -327,6 +327,20 @@ export declare class UnauthorizedReservationBudget {
|
|
|
327
327
|
* dialer sees its "open" connection close moments later.
|
|
328
328
|
*
|
|
329
329
|
* Control node only: strand cohort nodes legitimately connect cross-party
|
|
330
|
-
* peers, so
|
|
330
|
+
* peers, so cadre membership never gates them. An OPEN strand's node receives
|
|
331
|
+
* the raw configured gater unchanged; a CLOSED strand's node composes its own
|
|
332
|
+
* revoked-peer denial onto it instead — a deny-list on positive revocation
|
|
333
|
+
* evidence, not this module's membership admission — see
|
|
334
|
+
* `strand-revocation-enforcer.ts`.
|
|
331
335
|
*/
|
|
332
336
|
export declare function createMembershipConnectionGater(policy: InboundAdmissionPolicy, base?: ConnectionGater, decisionTimeoutMs?: number, reserveDeadlineMs?: number): ConnectionGater;
|
|
337
|
+
/**
|
|
338
|
+
* Run one admission decision under `timeoutMs`, resolving to `fallback` (the
|
|
339
|
+
* fail-open outcome) if it has not settled in time — see
|
|
340
|
+
* {@link ADMISSION_DECISION_TIMEOUT_MS} for why an unbounded await is not safe
|
|
341
|
+
* on the connection hook. The timer is always cleared so a decided call never
|
|
342
|
+
* holds the event loop open. Exported for the strand revoked-peer gate
|
|
343
|
+
* (`strand-revocation-enforcer.ts`), which bounds its connection hooks with the
|
|
344
|
+
* same fail-open contract.
|
|
345
|
+
*/
|
|
346
|
+
export declare function decideWithinDeadline<T>(decide: () => Promise<T> | T, fallback: T, timeoutMs: number, what: string): Promise<T>;
|
|
@@ -313,7 +313,11 @@ export class UnauthorizedReservationBudget {
|
|
|
313
313
|
* dialer sees its "open" connection close moments later.
|
|
314
314
|
*
|
|
315
315
|
* Control node only: strand cohort nodes legitimately connect cross-party
|
|
316
|
-
* peers, so
|
|
316
|
+
* peers, so cadre membership never gates them. An OPEN strand's node receives
|
|
317
|
+
* the raw configured gater unchanged; a CLOSED strand's node composes its own
|
|
318
|
+
* revoked-peer denial onto it instead — a deny-list on positive revocation
|
|
319
|
+
* evidence, not this module's membership admission — see
|
|
320
|
+
* `strand-revocation-enforcer.ts`.
|
|
317
321
|
*/
|
|
318
322
|
export function createMembershipConnectionGater(policy, base, decisionTimeoutMs = ADMISSION_DECISION_TIMEOUT_MS, reserveDeadlineMs = RELAY_ADMISSION_RESERVE_DEADLINE_MS) {
|
|
319
323
|
const pendingReservations = new PendingReserveDeadlines(reserveDeadlineMs);
|
|
@@ -378,9 +382,11 @@ export function createMembershipConnectionGater(policy, base, decisionTimeoutMs
|
|
|
378
382
|
* fail-open outcome) if it has not settled in time — see
|
|
379
383
|
* {@link ADMISSION_DECISION_TIMEOUT_MS} for why an unbounded await is not safe
|
|
380
384
|
* on the connection hook. The timer is always cleared so a decided call never
|
|
381
|
-
* holds the event loop open.
|
|
385
|
+
* holds the event loop open. Exported for the strand revoked-peer gate
|
|
386
|
+
* (`strand-revocation-enforcer.ts`), which bounds its connection hooks with the
|
|
387
|
+
* same fail-open contract.
|
|
382
388
|
*/
|
|
383
|
-
async function decideWithinDeadline(decide, fallback, timeoutMs, what) {
|
|
389
|
+
export async function decideWithinDeadline(decide, fallback, timeoutMs, what) {
|
|
384
390
|
let timer;
|
|
385
391
|
try {
|
|
386
392
|
return await Promise.race([
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"membership-connection-gater.js","sourceRoot":"","sources":["../src/membership-connection-gater.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0JG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AAEpE,MAAM,GAAG,GAAG,KAAK,CAAC,+BAA+B,CAAC,CAAC;AAEnD;;;;;GAKG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAsB,CAAC,aAAa,EAAE,kBAAkB,CAAC,CAAC;AAE9F;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,4BAA4B,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;AAE3D;;;;;;;;;;;;;GAaG;AACH,MAAM,CAAC,MAAM,6BAA6B,GAAG,IAAK,CAAC;AAEnD;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mG,EAAE,YAAY,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC;IAC1I,CAAC;IAED,MAAM,CAAC,YAAoB;QACzB,MAAM,OAAO,GAAG,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC;QAC9C,IAAI,CAAC,OAAO,EAAE,CAAC;YACb,OAAO;QACT,CAAC;QACD,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC;QACjC,KAAK,MAAM,KAAK,IAAI,OAAO,EAAE,CAAC;YAC5B,YAAY,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QAC5B,CAAC;IACH,CAAC;IAEO,MAAM,CAAC,YAAoB,EAAE,KAA6B;QAChE,MAAM,OAAO,GAAG,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC;QAC9C,OAAO,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC;QACvB,IAAI,OAAO,EAAE,IAAI,KAAK,CAAC,EAAE,CAAC;YACxB,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC;QACnC,CAAC;QACD,GAAG,CAAC,oGAAoG,EAAE,YAAY,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC;QACzI,IAAI,CAAC;YACH,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC,sEAAsE,IAAI,CAAC,UAAU,IAAI,CAAC,CAAC,CAAC;QAC3H,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,yEAAyE;YACzE,GAAG,CAAC,8DAA8D,EAAE,YAAY,EAAE,KAAK,CAAC,CAAC;QAC3F,CAAC;IACH,CAAC;CACF"}
|
|
@@ -12,6 +12,12 @@ export interface DurableSlot {
|
|
|
12
12
|
* failed read reported as `undefined` silently converts a recoverable error
|
|
13
13
|
* (permissions, a blocked database upgrade, an I/O fault) into destruction
|
|
14
14
|
* of a still-intact record on the next save.
|
|
15
|
+
*
|
|
16
|
+
* A slot always reports the fault; what a READER does with it is the
|
|
17
|
+
* reader's policy. The two records here rethrow it; the enrolled-machine
|
|
18
|
+
* count catches it and cold-starts, because losing a repair hint must not
|
|
19
|
+
* stop a node. So an implementation must never soften this to `undefined`
|
|
20
|
+
* on a reader's behalf.
|
|
15
21
|
*/
|
|
16
22
|
load(): Promise<string | undefined>;
|
|
17
23
|
/**
|
|
@@ -6,7 +6,13 @@
|
|
|
6
6
|
* - the trusted-owner anchor (`trusted-owner-store.ts`),
|
|
7
7
|
* - the cold-start bootstrap-peer store (`bootstrap-peer-store.ts`).
|
|
8
8
|
*
|
|
9
|
-
*
|
|
9
|
+
* A THIRD node-local record — the enrolled-machine count
|
|
10
|
+
* (`enrolled-machine-store.ts`) — reuses {@link DurableSlot} but deliberately
|
|
11
|
+
* NOT this module's snapshot machinery: it is one scalar rather than an entry
|
|
12
|
+
* map, and it must cold-start rather than throw on an unreadable slot. Its
|
|
13
|
+
* module comment carries the reasoning; do not fold it in here.
|
|
14
|
+
*
|
|
15
|
+
* Both records here are the same mechanism with a different payload: a
|
|
10
16
|
* `{ version, partyId, <entries> }` envelope, snapshot-written whole on every
|
|
11
17
|
* change, loaded under one fail-safe-but-not-fail-silent policy. The only part
|
|
12
18
|
* that differs per platform is WHERE the bytes are kept — Node writes a file,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"node-local-snapshot.js","sourceRoot":"","sources":["../src/node-local-snapshot.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"node-local-snapshot.js","sourceRoot":"","sources":["../src/node-local-snapshot.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,MAAM,GAAG,GAAG,KAAK,CAAC,kCAAkC,CAAC,CAAC;AA+BtD,kFAAkF;AAClF,MAAM,gBAAgB,GAAG,CAAC,CAAC;AAgC3B;;;;;;;;;;GAUG;AACH,MAAM,OAA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