@serfab/cadre-core 1.9.0 → 1.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cadre-node.d.ts +148 -17
- package/dist/cadre-node.js +361 -45
- package/dist/cadre-node.js.map +1 -1
- package/dist/control-authorization.d.ts +2 -2
- package/dist/control-authorization.js +1 -0
- package/dist/control-authorization.js.map +1 -1
- package/dist/control-cohort.d.ts +1 -1
- package/dist/control-cohort.js +1 -1
- package/dist/control-database.d.ts +105 -14
- package/dist/control-database.js +242 -73
- package/dist/control-database.js.map +1 -1
- package/dist/control-formation-recorder.d.ts +6 -6
- package/dist/control-formation-recorder.js +7 -8
- package/dist/control-formation-recorder.js.map +1 -1
- package/dist/control-schema.d.ts +1 -1
- package/dist/control-schema.js +90 -3
- package/dist/control-schema.js.map +1 -1
- package/dist/control-write-retry.d.ts +21 -15
- package/dist/control-write-retry.js +21 -15
- package/dist/control-write-retry.js.map +1 -1
- package/dist/index.d.ts +5 -3
- package/dist/index.js +6 -2
- package/dist/index.js.map +1 -1
- package/dist/invitation-bootstrap.d.ts +32 -0
- package/dist/invitation-bootstrap.js +30 -0
- package/dist/invitation-bootstrap.js.map +1 -0
- package/dist/link-budget.d.ts +204 -119
- package/dist/link-budget.js +208 -120
- package/dist/link-budget.js.map +1 -1
- package/dist/membership-connection-gater.d.ts +3 -3
- package/dist/membership-connection-gater.js +3 -3
- package/dist/peer-dial.d.ts +18 -14
- package/dist/peer-dial.js +18 -14
- package/dist/peer-dial.js.map +1 -1
- package/dist/peer-join-backfill.d.ts +3 -3
- package/dist/pending-join-runner.d.ts +186 -0
- package/dist/pending-join-runner.js +649 -0
- package/dist/pending-join-runner.js.map +1 -0
- package/dist/push-fanout.d.ts +1 -1
- package/dist/push-fanout.js +1 -1
- package/dist/seed-bootstrap.d.ts +2 -2
- package/dist/seed-bootstrap.js +1 -1
- package/dist/strand-addr-protocol.js +2 -2
- package/dist/strand-formation-deadlines.d.ts +5 -5
- package/dist/strand-formation-deadlines.js +5 -5
- package/dist/strand-formation-manager.d.ts +18 -4
- package/dist/strand-formation-manager.js +48 -33
- package/dist/strand-formation-manager.js.map +1 -1
- package/dist/strand-formation-protocol.d.ts +71 -14
- package/dist/strand-formation-protocol.js +222 -47
- package/dist/strand-formation-protocol.js.map +1 -1
- package/dist/strand-formation-rejection.d.ts +94 -0
- package/dist/strand-formation-rejection.js +77 -0
- package/dist/strand-formation-rejection.js.map +1 -0
- package/dist/strand-instance-manager.js +4 -1
- package/dist/strand-instance-manager.js.map +1 -1
- package/dist/strand-solicitation.d.ts +11 -3
- package/dist/strand-solicitation.js +9 -0
- package/dist/strand-solicitation.js.map +1 -1
- package/dist/types.d.ts +103 -17
- package/dist/types.js +5 -9
- package/dist/types.js.map +1 -1
- package/package.json +22 -22
- package/src/cadre-node.ts +399 -46
- package/src/control-authorization.ts +117 -116
- package/src/control-cohort.ts +1 -1
- package/src/control-database.ts +303 -82
- package/src/control-formation-recorder.ts +8 -9
- package/src/control-schema.ts +90 -3
- package/src/control-write-retry.ts +21 -15
- package/src/index.ts +21 -1
- package/src/invitation-bootstrap.ts +40 -0
- package/src/link-budget.ts +221 -120
- package/src/membership-connection-gater.ts +3 -3
- package/src/peer-dial.ts +18 -14
- package/src/peer-join-backfill.ts +3 -3
- package/src/pending-join-runner.ts +735 -0
- package/src/push-fanout.ts +1 -1
- package/src/seed-bootstrap.ts +2 -2
- package/src/strand-addr-protocol.ts +2 -2
- package/src/strand-formation-deadlines.ts +5 -5
- package/src/strand-formation-manager.ts +62 -37
- package/src/strand-formation-protocol.ts +1036 -802
- package/src/strand-formation-rejection.ts +129 -0
- package/src/strand-instance-manager.ts +4 -1
- package/src/strand-solicitation.ts +17 -4
- package/src/types.ts +99 -17
|
@@ -36,9 +36,9 @@
|
|
|
36
36
|
* node has at least one UNEXPIRED, NOT-FULLY-CONSUMED open invitation
|
|
37
37
|
* outstanding (`StrandSolicitationService.hasOutstandingInvitation` — the
|
|
38
38
|
* tokens this process minted or published, plus any still-redeemable
|
|
39
|
-
* `FormationInvite` row the usage recorder can see).
|
|
40
|
-
* responder
|
|
41
|
-
*
|
|
39
|
+
* `FormationInvite` row the usage recorder can see). Registering the
|
|
40
|
+
* responder does NOT suspend it, so every node — each registers one at
|
|
41
|
+
* `CadreNode.start` — keeps a live gate. The
|
|
42
42
|
* handler's own trust decision remains the per-token check, which is
|
|
43
43
|
* strictly finer than this one: a peer admitted here can still be rejected
|
|
44
44
|
* in-protocol for a bogus or spent token.
|
package/src/peer-dial.ts
CHANGED
|
@@ -2,12 +2,15 @@
|
|
|
2
2
|
* Dialing one peer from a list of candidate addresses, so that an address that
|
|
3
3
|
* never answers cannot use up the time the others needed.
|
|
4
4
|
*
|
|
5
|
-
* libp2p's own multi-address dial (`libp2p.dial(addrs)`,
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
5
|
+
* libp2p's own multi-address dial (`libp2p.dial(addrs)`, `DialQueue.dialPeer`)
|
|
6
|
+
* tries the addresses ONE AT A TIME under ONE signal. Its only per-address limit
|
|
7
|
+
* is the connection manager's `addressDialTimeout` (libp2p 3.3+), which cadre
|
|
8
|
+
* sizes for a cold relayed open through two admission decisions
|
|
9
|
+
* (`optimysticDialLimits` in `link-budget.ts`: 39 s at the default declared
|
|
10
|
+
* link). An address whose connection attempt is silently dropped — a firewall, a
|
|
11
|
+
* subnet the dialer cannot route to, a virtual adapter's address a Windows host
|
|
12
|
+
* reports alongside its real ones — holds that dial for that long or until the
|
|
13
|
+
* whole signal expires, and the addresses sorted after it get what is left. It
|
|
11
14
|
* also sorts the list itself (`defaultAddressSorter`), putting loopback addresses
|
|
12
15
|
* last, behind exactly the LAN addresses most likely to be dropped. A phone
|
|
13
16
|
* borrowing a node from a cadre-host whose only reachable address was the
|
|
@@ -34,17 +37,17 @@ const log = debug('sereus:cadre:peer-dial');
|
|
|
34
37
|
|
|
35
38
|
/**
|
|
36
39
|
* Default limit on ONE address's dial attempt, in ms, at the DEFAULT declared link round trip:
|
|
37
|
-
* `RELAYED_DIAL_ROUND_TRIPS` (
|
|
38
|
-
*
|
|
39
|
-
* was a fixed 8000 ms before it was derived.
|
|
40
|
+
* `RELAYED_DIAL_ROUND_TRIPS` (5) x `DECLARED_LINK_ROUND_TRIP_MS` (3500 ms) plus
|
|
41
|
+
* `DIAL_ADMISSION_DECISIONS` (2) x `ADMISSION_DECISION_TIMEOUT_MS` (2000 ms) = 21 500 ms
|
|
42
|
+
* (`relayedDialBudgetMs`). It was a fixed 8000 ms before it was derived.
|
|
40
43
|
*
|
|
41
44
|
* It has to cover the slowest address that should succeed, because an attempt
|
|
42
45
|
* that needs longer fails the same way on every retry. That is a relayed dial on
|
|
43
46
|
* a mobile link: connect to the relay (transport, encryption and multiplexer
|
|
44
47
|
* handshakes, when no relay connection is open yet), open the circuit, then run
|
|
45
48
|
* both handshakes again end to end through the relay. `link-budget.ts` is where that
|
|
46
|
-
* reasoning is now a measured count instead of an estimate —
|
|
47
|
-
*
|
|
49
|
+
* reasoning is now a measured count instead of an estimate — five link round trips, measured at
|
|
50
|
+
* 15 113 ms on a link whose round trip is 3 s — so the value MOVES with a host's
|
|
48
51
|
* `NetworkConfig.linkRoundTripMs` rather than pinning the band this node can reach to whatever
|
|
49
52
|
* number was typed here. A direct dial that works is far quicker — a phone's WebSocket dial to
|
|
50
53
|
* a node forwarded over `adb reverse` measured 1.6 s end to end.
|
|
@@ -200,9 +203,10 @@ export async function dialPeerAddrs(
|
|
|
200
203
|
* one address and immediately dialing the next for the same peer therefore
|
|
201
204
|
* joins the dying job, which rejects the new dial with `AbortError` before it
|
|
202
205
|
* touches the network — the next address is never tried. Seen against libp2p
|
|
203
|
-
* 3.1.3; `test/peer-dial.spec.ts`
|
|
204
|
-
*
|
|
205
|
-
* finished by the time a
|
|
206
|
+
* 3.1.3, and the queue's join is unchanged in 3.3.11; `test/peer-dial.spec.ts`
|
|
207
|
+
* dials real nodes so an upgrade that changes it shows up there. All of the
|
|
208
|
+
* queue's cleanup runs as microtasks, so it has finished by the time a
|
|
209
|
+
* macrotask runs.
|
|
206
210
|
*/
|
|
207
211
|
export async function tryAddrsInTurn<T>(
|
|
208
212
|
addrs: readonly Multiaddr[],
|
|
@@ -175,9 +175,9 @@ export interface PeerJoinBackfillConfig {
|
|
|
175
175
|
/** Max blocks per push message. Default 64. */
|
|
176
176
|
maxChunkBlocks?: number;
|
|
177
177
|
/**
|
|
178
|
-
* Per-push dial deadline, ms. Default {@link peerJoinPushBudget}'s `dialTimeoutMs` —
|
|
179
|
-
* round trips at the declared link plus
|
|
180
|
-
* shipped. NOT a fixed number: a relayed dial
|
|
178
|
+
* Per-push dial deadline, ms. Default {@link peerJoinPushBudget}'s `dialTimeoutMs` — five link
|
|
179
|
+
* round trips at the declared link plus two admission decisions (a party-run relay's and the
|
|
180
|
+
* called machine's), 21 500 ms as shipped. NOT a fixed number: a relayed dial
|
|
181
181
|
* costs a fixed number of exchanges, so a host on a slower link moves this (and every other
|
|
182
182
|
* cadre dial budget) by declaring `NetworkConfig.linkRoundTripMs`. Naming it here still wins
|
|
183
183
|
* over the derived value — `link-budget.ts` has the counts and the measurement.
|