@serfab/cadre-core 0.11.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.
Files changed (121) hide show
  1. package/README.md +3 -2
  2. package/dist/announce-addrs.d.ts +49 -0
  3. package/dist/announce-addrs.js +78 -0
  4. package/dist/announce-addrs.js.map +1 -0
  5. package/dist/cadre-node.d.ts +607 -53
  6. package/dist/cadre-node.js +1268 -157
  7. package/dist/cadre-node.js.map +1 -1
  8. package/dist/control-database.d.ts +174 -23
  9. package/dist/control-database.js +317 -107
  10. package/dist/control-database.js.map +1 -1
  11. package/dist/control-read-retry.d.ts +103 -0
  12. package/dist/control-read-retry.js +145 -0
  13. package/dist/control-read-retry.js.map +1 -0
  14. package/dist/control-retry.d.ts +101 -0
  15. package/dist/control-retry.js +108 -0
  16. package/dist/control-retry.js.map +1 -0
  17. package/dist/control-schema.d.ts +1 -1
  18. package/dist/control-schema.js +50 -6
  19. package/dist/control-schema.js.map +1 -1
  20. package/dist/control-write-retry.d.ts +59 -35
  21. package/dist/control-write-retry.js +21 -92
  22. package/dist/control-write-retry.js.map +1 -1
  23. package/dist/delegate-admission.d.ts +17 -15
  24. package/dist/delegate-admission.js +17 -15
  25. package/dist/delegate-admission.js.map +1 -1
  26. package/dist/enrolled-machine-store-file.d.ts +13 -0
  27. package/dist/enrolled-machine-store-file.js +41 -0
  28. package/dist/enrolled-machine-store-file.js.map +1 -0
  29. package/dist/enrolled-machine-store.d.ts +81 -0
  30. package/dist/enrolled-machine-store.js +225 -0
  31. package/dist/enrolled-machine-store.js.map +1 -0
  32. package/dist/file-durable-slot.js +5 -3
  33. package/dist/file-durable-slot.js.map +1 -1
  34. package/dist/index.d.ts +10 -6
  35. package/dist/index.js +39 -12
  36. package/dist/index.js.map +1 -1
  37. package/dist/membership-connection-gater.d.ts +226 -26
  38. package/dist/membership-connection-gater.js +316 -30
  39. package/dist/membership-connection-gater.js.map +1 -1
  40. package/dist/node-local-snapshot.d.ts +6 -0
  41. package/dist/node-local-snapshot.js +7 -1
  42. package/dist/node-local-snapshot.js.map +1 -1
  43. package/dist/{strand-backfill.d.ts → peer-join-backfill.d.ts} +49 -20
  44. package/dist/{strand-backfill.js → peer-join-backfill.js} +146 -56
  45. package/dist/peer-join-backfill.js.map +1 -0
  46. package/dist/peer-record.d.ts +26 -0
  47. package/dist/peer-record.js +32 -0
  48. package/dist/peer-record.js.map +1 -1
  49. package/dist/relay-addrs.d.ts +145 -22
  50. package/dist/relay-addrs.js +314 -31
  51. package/dist/relay-addrs.js.map +1 -1
  52. package/dist/relay-reservation.d.ts +20 -15
  53. package/dist/relay-reservation.js +18 -14
  54. package/dist/relay-reservation.js.map +1 -1
  55. package/dist/strand-addr-protocol.js +16 -0
  56. package/dist/strand-addr-protocol.js.map +1 -1
  57. package/dist/strand-database.d.ts +12 -0
  58. package/dist/strand-database.js +16 -0
  59. package/dist/strand-database.js.map +1 -1
  60. package/dist/strand-formation-manager.d.ts +22 -9
  61. package/dist/strand-formation-manager.js +20 -12
  62. package/dist/strand-formation-manager.js.map +1 -1
  63. package/dist/strand-formation-protocol.d.ts +83 -9
  64. package/dist/strand-formation-protocol.js +86 -10
  65. package/dist/strand-formation-protocol.js.map +1 -1
  66. package/dist/strand-instance-manager.d.ts +151 -17
  67. package/dist/strand-instance-manager.js +237 -32
  68. package/dist/strand-instance-manager.js.map +1 -1
  69. package/dist/strand-membership-writer.d.ts +118 -14
  70. package/dist/strand-membership-writer.js +203 -15
  71. package/dist/strand-membership-writer.js.map +1 -1
  72. package/dist/strand-network-config.d.ts +84 -0
  73. package/dist/strand-network-config.js +136 -0
  74. package/dist/strand-network-config.js.map +1 -0
  75. package/dist/strand-revocation-enforcer.d.ts +392 -0
  76. package/dist/strand-revocation-enforcer.js +533 -0
  77. package/dist/strand-revocation-enforcer.js.map +1 -0
  78. package/dist/strand-solicitation.d.ts +10 -3
  79. package/dist/strand-solicitation.js +12 -7
  80. package/dist/strand-solicitation.js.map +1 -1
  81. package/dist/strand-wake-protocol.d.ts +47 -2
  82. package/dist/strand-wake-protocol.js +76 -6
  83. package/dist/strand-wake-protocol.js.map +1 -1
  84. package/dist/strand-watcher.js +6 -1
  85. package/dist/strand-watcher.js.map +1 -1
  86. package/dist/types.d.ts +282 -43
  87. package/dist/types.js +7 -1
  88. package/dist/types.js.map +1 -1
  89. package/package.json +16 -8
  90. package/src/announce-addrs.ts +93 -0
  91. package/src/cadre-node.ts +1366 -171
  92. package/src/control-database.ts +2628 -2406
  93. package/src/control-read-retry.ts +167 -0
  94. package/src/control-retry.ts +190 -0
  95. package/src/control-schema.ts +50 -6
  96. package/src/control-write-retry.ts +30 -130
  97. package/src/delegate-admission.ts +17 -15
  98. package/src/enrolled-machine-store-file.ts +43 -0
  99. package/src/enrolled-machine-store.ts +280 -0
  100. package/src/file-durable-slot.ts +5 -3
  101. package/src/index.ts +477 -407
  102. package/src/membership-connection-gater.ts +539 -204
  103. package/src/node-local-snapshot.ts +13 -1
  104. package/src/peer-addr-book.ts +251 -250
  105. package/src/{strand-backfill.ts → peer-join-backfill.ts} +187 -75
  106. package/src/peer-record.ts +33 -0
  107. package/src/relay-addrs.ts +436 -111
  108. package/src/relay-reservation.ts +828 -823
  109. package/src/strand-addr-protocol.ts +17 -0
  110. package/src/strand-database.ts +17 -0
  111. package/src/strand-formation-manager.ts +511 -491
  112. package/src/strand-formation-protocol.ts +808 -692
  113. package/src/strand-instance-manager.ts +899 -611
  114. package/src/strand-membership-writer.ts +232 -15
  115. package/src/strand-network-config.ts +172 -0
  116. package/src/strand-revocation-enforcer.ts +653 -0
  117. package/src/strand-solicitation.ts +484 -472
  118. package/src/strand-wake-protocol.ts +94 -8
  119. package/src/strand-watcher.ts +319 -314
  120. package/src/types.ts +1554 -1309
  121. package/dist/strand-backfill.js.map +0 -1
@@ -1,5 +1,6 @@
1
1
  /**
2
- * Control-network inbound connection gate (defense-in-depth).
2
+ * Control-network inbound admission gates (defense-in-depth): the
3
+ * encrypted-connection checkpoint and the circuit-relay reservation checkpoint.
3
4
  *
4
5
  * Layer 2 of the membership enforcement chain: the PRIMARY gates are per-stream
5
6
  * — every sensitive sereus control protocol rejects a peer that fails the
@@ -10,7 +11,9 @@
10
11
  * time. This module adds the opportunistic connection-level layer on top: a
11
12
  * peer this node can positively determine is NOT authorized is refused at the
12
13
  * encrypted-connection checkpoint, before any protocol negotiation, so a
13
- * known-nothing outsider is never even in the conversation.
14
+ * known-nothing outsider is never even in the conversation — EXCEPT on a node
15
+ * that runs the circuit-relay server, where the refusal moves to the
16
+ * relay-reservation checkpoint instead (see "The relay-reservation seam").
14
17
  *
15
18
  * ## The stranger allowlist (the ONE place it is defined)
16
19
  *
@@ -45,14 +48,54 @@
45
48
  *
46
49
  * - **Announced delegate peers** (`delegate-admission.ts`). A member's strand
47
50
  * node runs as a separate libp2p identity whose peerId no sibling can
48
- * recompute, so a relay-running control node would deny its circuit-relay
49
- * reservation. Before starting a strand node, a member's control node
51
+ * recompute. Before starting a strand node, a member's control node
50
52
  * announces that peerId over the already-authenticated strand-addr RPC, and
51
53
  * the receiver holds a short-lived grant for it
52
- * (`CadreNode.grantDelegateAdmission`). The grant admits the CONNECTION and
53
- * nothing else — a reservation needs no stream — and is deliberately
54
- * invisible to the per-stream gate below, so a delegate still gets refused
55
- * on every members-only protocol.
54
+ * (`CadreNode.grantDelegateAdmission`). The grant admits the CONNECTION,
55
+ * admits the peer's RESERVATION at the seam below (without spending the
56
+ * unauthorized budget), and nothing else — it is deliberately invisible to
57
+ * the per-stream gate, so a delegate still gets refused on every
58
+ * members-only protocol.
59
+ *
60
+ * ## The relay-reservation seam
61
+ *
62
+ * A circuit-relay reservation is established by the reserving peer DIALING the
63
+ * relay, so at the relay it is an inbound connection — and killing that
64
+ * connection kills the reservation. For a genuine member whose `CadrePeer` row
65
+ * has not yet replicated to this node, a connection-level deny here is NOT
66
+ * self-healing the way a data connection's is: an outbound reconcile dial
67
+ * re-establishes a data link, but no outbound dial can grant the REMOTE peer a
68
+ * reservation, and a relay-only peer has no address of its own to dial back —
69
+ * the reservation IS its address. Boot ordering makes the window ordinary (a
70
+ * node's circuit listener runs inside `libp2p.start()`, before its own row
71
+ * could have replicated anywhere), and a stalled replication makes it
72
+ * unbounded. So the relay would be answering a RELAY question ("may this peer
73
+ * use my forwarding capacity?") with a MEMBERSHIP answer, at a checkpoint where
74
+ * a wrong answer is unrecoverable.
75
+ *
76
+ * On a node whose relay server is enabled the two questions are separated:
77
+ *
78
+ * - The policy returns `'admit-for-relay'` instead of `'deny'`, and the
79
+ * connection is ADMITTED. The fail-closed per-stream gates still refuse such
80
+ * a peer every members-only protocol, so it gains identify/ping and the
81
+ * relay hop protocol, nothing else.
82
+ * - The reservation itself is decided at libp2p's
83
+ * `denyInboundRelayReservation` hook (the circuit-relay server consults it
84
+ * per RESERVE request): the policy admits members, delegates and configured
85
+ * infra outright, and admits peers it cannot place only within a bounded
86
+ * budget ({@link UnauthorizedReservationBudget}) — a member whose row is in
87
+ * flight always finds a slot under any sane cap, while outsiders cannot
88
+ * annex the party's relay capacity.
89
+ * - An `'admit-for-relay'` connection that is NOT reserving is dropped: it has
90
+ * {@link RELAY_ADMISSION_RESERVE_DEADLINE_MS} to get a reservation ADMITTED
91
+ * at that hook, after which the underlying connection is aborted. The
92
+ * guarantee above thus weakens on relay-enabled nodes from "never in the
93
+ * conversation" to "in it briefly, and can speak nothing".
94
+ *
95
+ * The deadline clears on reservation ADMISSION, not on the reservation's own
96
+ * success: this gate cannot observe the server-side `reserve()` outcome, so a
97
+ * peer whose admitted reservation is then refused for server capacity keeps its
98
+ * connection until either side closes it — bounded and mute, so harmless.
56
99
  *
57
100
  * Everything else a control node handles — the Optimystic control-DB protocols
58
101
  * (`/optimystic/control-<party>/{repo,cluster,sync,block-transfer}/…`), wake
@@ -70,12 +113,45 @@
70
113
  * stranger carve-outs — an enrollment window admits a stranger's connection
71
114
  * for seed delivery, yet its repo streams are still refused.
72
115
  *
116
+ * ## The bring-up quiet period
117
+ *
118
+ * One state is decided BEFORE any of the above, and is not about the remote peer
119
+ * at all: while this node's control-database bring-up is in flight
120
+ * (`InboundAdmissionPolicy.bringUpInFlight`), the gate denies BOTH directions —
121
+ * `denyDialPeer` and `denyInboundEncryptedConnection` — and then opens.
122
+ *
123
+ * The invariant it protects is "`ControlDatabase.initialize()` runs while this
124
+ * node holds ZERO control connections". Building that database is a long chain
125
+ * of cohort-consulting block probes, and every connected same-party sibling is in
126
+ * the cohort those probes consult. A sibling that has not yet replicated this
127
+ * node's `CadrePeer` row correctly refuses them at its own fail-closed per-stream
128
+ * gate, so ONE connection in this window turns bring-up into
129
+ * `BlockUnavailableError` and `start()` rejects. Retrying cannot converge: the
130
+ * condition that would clear the refusal is this node's own row reaching the
131
+ * sibling, and writing that row needs the database the retry is building. So the
132
+ * only fix is to not be in the conversation yet — which is what this window is.
133
+ *
134
+ * The ordering is arranged so nothing SHOULD open a connection here anyway:
135
+ * `network.relayAddrs` resolves to a listener that dials nothing and reserves
136
+ * after bring-up (`relay-addrs.ts`), and the control-cohort reconcile pass is
137
+ * scheduled post-start. This window is what makes that a property rather than an
138
+ * accident of ordering — the live case it actually catches is
139
+ * `controlNetwork.bootstrapNodes`, where `@libp2p/bootstrap` emits its discovery
140
+ * events ~1 s after `libp2p.start()` and the connection manager auto-dials from
141
+ * there, which is a race bring-up wins only while raw-storage latency stays low.
142
+ *
143
+ * A denial here costs a retry, not a partition: libp2p's connection manager
144
+ * re-dials on its auto-dial cadence, the reservation supervisor re-drives, and a
145
+ * denied inbound peer reconnects. The window opens on bring-up FAILURE too (via
146
+ * `CadreNode.cleanup`), so teardown is never gated.
147
+ *
73
148
  * ## Fail-open, deliberately
74
149
  *
75
- * This layer only ever denies on a POSITIVE determination of "unauthorized
76
- * outsider while no stranger path is open". Any error, missing dependency, or
77
- * ambiguous state admits the connection and defers to the fail-closed stream
78
- * gates — a DB hiccup must not partition a legitimate cadre.
150
+ * Outside that window this layer only ever denies on a POSITIVE determination of
151
+ * "unauthorized outsider while no stranger path is open". Any error, missing
152
+ * dependency, or ambiguous state admits the connection (and the reservation) and
153
+ * defers to the fail-closed stream gates — a DB hiccup must not partition a
154
+ * legitimate cadre.
79
155
  */
80
156
  import type { ConnectionGater } from '@libp2p/interface';
81
157
  /**
@@ -94,7 +170,8 @@ export declare const STRANGER_OPEN_PROTOCOLS: readonly string[];
94
170
  */
95
171
  export declare const DEFAULT_ENROLLMENT_WINDOW_MS: number;
96
172
  /**
97
- * Deadline for one admission decision, after which the connection is ADMITTED.
173
+ * Deadline for one admission decision, after which the fail-open outcome is
174
+ * used (connection admitted / reservation admitted).
98
175
  *
99
176
  * libp2p awaits `denyInboundEncryptedConnection` inside the inbound upgrade
100
177
  * WITHOUT racing its inbound-upgrade timeout signal (unlike the pre-encryption
@@ -108,25 +185,134 @@ export declare const DEFAULT_ENROLLMENT_WINDOW_MS: number;
108
185
  */
109
186
  export declare const ADMISSION_DECISION_TIMEOUT_MS = 2000;
110
187
  /**
111
- * The admission decision the gate defers to — implemented by
112
- * `CadreNode.admitInboundControlConnection` (enrollment windows, anchor state,
113
- * bootstrap infra, the authorized-member set). Kept injectable so the gater's
188
+ * How long an `'admit-for-relay'` connection may exist without a relay
189
+ * reservation being ADMITTED at the `denyInboundRelayReservation` hook, after
190
+ * which the gate aborts the underlying connection. A reserving client asks for
191
+ * its slot immediately after the connection upgrades (`relay-reservation.ts`
192
+ * dials and requests in one drive; a strand node's configured circuit listener
193
+ * does the same from inside its own `listen()`), so a connection idle past this
194
+ * deadline is not reserving.
195
+ */
196
+ export declare const RELAY_ADMISSION_RESERVE_DEADLINE_MS = 5000;
197
+ /**
198
+ * Default cap on concurrent relay reservations held by peers the membership
199
+ * check could not place (see {@link UnauthorizedReservationBudget}). Small on
200
+ * purpose: it exists for the handful of genuine members whose rows are still
201
+ * in flight, not as public relay capacity. Overridable per node via
202
+ * `network.unauthorizedRelayReservationCap` (0 refuses every unauthorized
203
+ * reservation — the strict pre-seam posture).
204
+ *
205
+ * NOTE: this cap shares the relay server's own reservation store, whose default
206
+ * size is 15 (`@libp2p/circuit-relay-v2`'s `DEFAULT_MAX_RESERVATION_STORE_SIZE`);
207
+ * unplaced peers may therefore occupy up to this many of those slots, and the
208
+ * rest are what members and delegates compete for. This module cannot read the
209
+ * server's size, so the two are kept apart by hand — if either is raised, keep
210
+ * this one well under the store's, or a fleet of unplaceable peers can crowd
211
+ * genuine members out of the server's own store (which the gate cannot override).
212
+ */
213
+ export declare const MAX_UNAUTHORIZED_RELAY_RESERVATIONS = 8;
214
+ /**
215
+ * How long one {@link UnauthorizedReservationBudget} entry occupies a slot
216
+ * without a refresh. Mirrors the relay server's own default reservation TTL
217
+ * (`@libp2p/circuit-relay-v2`'s `DEFAULT_MAX_RESERVATION_TTL`, 2 h): the server
218
+ * holds an unrefreshed reservation exactly that long, and a live reserver
219
+ * re-requests (re-hitting the admission hook, refreshing its entry) well before
220
+ * expiry — so the live entry count tracks the server's own occupancy without
221
+ * this module reaching into the server's reservation store.
222
+ *
223
+ * NOTE: a mirror, not a live coupling — if the relay server is ever configured
224
+ * with a non-default `reservationTtl` (db-p2p's `relayServerInit`), update this
225
+ * constant alongside it or the budget's occupancy drifts from the server's.
226
+ */
227
+ export declare const UNAUTHORIZED_RESERVATION_TTL_MS: number;
228
+ /**
229
+ * The connection-level outcome of the admission policy:
230
+ * - `'admit'` — a peer with a legitimate claim on the connection (member,
231
+ * delegate, infra, open stranger window, or any fail-open state).
232
+ * - `'deny'` — positively an outsider, and this node runs no relay server, so
233
+ * the connection can carry nothing legitimate.
234
+ * - `'admit-for-relay'` — positively an outsider (or an unreplicated member —
235
+ * indistinguishable), but this node runs the relay server: admit the
236
+ * connection so a reservation can be asked for, decide at the reservation
237
+ * seam, and drop the connection if no reservation is admitted in time.
238
+ */
239
+ export type InboundConnectionVerdict = 'admit' | 'deny' | 'admit-for-relay';
240
+ /**
241
+ * The admission decisions the gate defers to — implemented by
242
+ * `CadreNode.admitInboundControlConnection` /
243
+ * `CadreNode.admitControlRelayReservation` (enrollment windows, anchor state,
244
+ * bootstrap infra, delegate grants, the authorized-member set, the
245
+ * unauthorized-reservation budget). Kept injectable so the gater's
114
246
  * composition/fail-open behavior is unit-testable without a full node.
115
247
  */
116
248
  export interface InboundAdmissionPolicy {
117
- /** Should an inbound encrypted connection from this peer be admitted? */
118
- admitInbound(remotePeerId: string): Promise<boolean> | boolean;
249
+ /** Verdict on an inbound encrypted connection from this peer. */
250
+ admitInbound(remotePeerId: string): Promise<InboundConnectionVerdict> | InboundConnectionVerdict;
251
+ /** Should this peer be granted a circuit-relay reservation slot? */
252
+ admitRelayReservation(remotePeerId: string): Promise<boolean> | boolean;
253
+ /**
254
+ * True while this node's control-database bring-up is in flight — the
255
+ * {@link createMembershipConnectionGater} quiet period (see the module doc).
256
+ * Peer-independent, unlike the two decisions above, and SYNCHRONOUS: it is
257
+ * read on the outbound-dial path, where an await would be a new stall.
258
+ *
259
+ * Optional — a policy that omits it is never quiet, which is the right default
260
+ * for every caller that is not a booting `CadreNode`.
261
+ */
262
+ bringUpInFlight?(): boolean;
263
+ }
264
+ /**
265
+ * Bounded budget of concurrent relay reservations for peers the membership
266
+ * check could not place. `tryAdmit` is the whole surface: an already-admitted
267
+ * peer refreshes its entry (a reservation refresh never double-counts), a new
268
+ * peer takes a free slot or is refused. Entries expire after `ttlMs` (see
269
+ * {@link UNAUTHORIZED_RESERVATION_TTL_MS} for why that mirrors the relay
270
+ * server's own hold). Injectable `now` keeps expiry testable without fake
271
+ * timers. Authorized members and delegates are never run through this — the
272
+ * policy admits them before consulting the budget, and `release`s the slot such
273
+ * a peer took while it was still unplaceable, so the boot-ordering window a
274
+ * member passes through costs the budget nothing once its row lands.
275
+ */
276
+ export declare class UnauthorizedReservationBudget {
277
+ private readonly cap;
278
+ private readonly ttlMs;
279
+ private readonly admitted;
280
+ constructor(cap?: number, ttlMs?: number);
281
+ /** Number of live (unexpired at last prune) entries — test/diagnostic surface. */
282
+ get size(): number;
283
+ /** Admit (or refresh) `remotePeerId` if a slot is free; false when the cap is spent. */
284
+ tryAdmit(remotePeerId: string, now?: number): boolean;
285
+ /**
286
+ * Give back the slot `remotePeerId` holds, if any — called when the peer has
287
+ * become admissible on its own merits (its membership row replicated, or a
288
+ * delegate grant landed), so the slot it took during the boot-ordering window
289
+ * does not stay spent for the remaining TTL on a peer that no longer needs it.
290
+ */
291
+ release(remotePeerId: string): void;
292
+ private prune;
119
293
  }
120
294
  /**
121
295
  * Build the control node's connection gater: the caller-supplied gater (if any)
122
296
  * with membership admission composed onto `denyInboundEncryptedConnection` —
123
- * the earliest checkpoint where the remote's authenticated PeerId is known.
297
+ * the earliest checkpoint where the remote's authenticated PeerId is known —
298
+ * and reservation admission composed onto `denyInboundRelayReservation` — the
299
+ * hook the circuit-relay server consults per RESERVE request (inert on a node
300
+ * whose relay server is off; libp2p never calls it there).
301
+ *
302
+ * `denyDialPeer` is composed too, but ONLY for the bring-up quiet period (see
303
+ * the module doc): outside that window outbound dials are never gated by
304
+ * membership — this node decides for itself who to talk to.
124
305
  *
125
- * Composition semantics: every hook of `base` is preserved as-is; on the
126
- * inbound-encrypted hook a deny from EITHER the base gater or the admission
127
- * policy denies. A policy error — or a decision slower than
128
- * `decisionTimeoutMs` — admits (fail-open, see module doc); the base gater's
129
- * verdict is still honored first.
306
+ * Composition semantics: every hook of `base` is preserved as-is; on the three
307
+ * composed hooks a deny from EITHER the base gater or the admission policy
308
+ * denies. A policy error — or a decision slower than `decisionTimeoutMs` —
309
+ * takes the fail-open outcome (connection admitted / reservation admitted, see
310
+ * module doc); the base gater's verdict is still honored first.
311
+ *
312
+ * An `'admit-for-relay'` verdict admits the connection and arms a
313
+ * `reserveDeadlineMs` timer against it; the timer is disarmed when a
314
+ * reservation for that peer is ADMITTED at the reservation hook, and aborts the
315
+ * underlying `MultiaddrConnection` when it fires first.
130
316
  *
131
317
  * NOTE: `base` is spread, so a gater passed as a CLASS INSTANCE would lose its
132
318
  * prototype methods; every caller in this repo (and libp2p's own default)
@@ -141,6 +327,20 @@ export interface InboundAdmissionPolicy {
141
327
  * dialer sees its "open" connection close moments later.
142
328
  *
143
329
  * Control node only: strand cohort nodes legitimately connect cross-party
144
- * peers, so `CadreNode` threads the raw configured gater to them unchanged.
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`.
335
+ */
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.
145
345
  */
146
- export declare function createMembershipConnectionGater(policy: InboundAdmissionPolicy, base?: ConnectionGater, decisionTimeoutMs?: number): ConnectionGater;
346
+ export declare function decideWithinDeadline<T>(decide: () => Promise<T> | T, fallback: T, timeoutMs: number, what: string): Promise<T>;