@serfab/cadre-core 1.4.0 → 1.6.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 +38 -15
- package/dist/cadre-node.js +81 -29
- package/dist/cadre-node.js.map +1 -1
- package/dist/control-database.d.ts +24 -10
- package/dist/control-database.js +48 -16
- package/dist/control-database.js.map +1 -1
- package/dist/control-read-retry.d.ts +12 -0
- package/dist/control-read-retry.js +12 -0
- package/dist/control-read-retry.js.map +1 -1
- package/dist/control-write-retry.d.ts +5 -4
- package/dist/control-write-retry.js +24 -7
- package/dist/control-write-retry.js.map +1 -1
- package/dist/index.d.ts +3 -2
- package/dist/index.js +5 -2
- package/dist/index.js.map +1 -1
- package/dist/link-budget.d.ts +224 -0
- package/dist/link-budget.js +239 -0
- package/dist/link-budget.js.map +1 -0
- package/dist/peer-dial.d.ts +36 -17
- package/dist/peer-dial.js +37 -17
- package/dist/peer-dial.js.map +1 -1
- package/dist/peer-join-backfill.d.ts +58 -4
- package/dist/peer-join-backfill.js +166 -20
- package/dist/peer-join-backfill.js.map +1 -1
- package/dist/relay-reservation.d.ts +59 -11
- package/dist/relay-reservation.js +169 -43
- package/dist/relay-reservation.js.map +1 -1
- package/dist/seed-bootstrap.js +2 -1
- package/dist/seed-bootstrap.js.map +1 -1
- package/dist/strand-first-sync-gate.d.ts +105 -22
- package/dist/strand-first-sync-gate.js +121 -27
- package/dist/strand-first-sync-gate.js.map +1 -1
- package/dist/strand-instance-manager.d.ts +27 -2
- package/dist/strand-instance-manager.js +60 -13
- package/dist/strand-instance-manager.js.map +1 -1
- package/dist/strand-membership-reconciler.d.ts +200 -45
- package/dist/strand-membership-reconciler.js +302 -86
- package/dist/strand-membership-reconciler.js.map +1 -1
- package/dist/strand-membership-writer.d.ts +3 -2
- package/dist/strand-membership-writer.js +67 -90
- package/dist/strand-membership-writer.js.map +1 -1
- package/dist/strand-network-config.d.ts +2 -2
- package/dist/strand-network-config.js +2 -2
- package/dist/types.d.ts +105 -9
- package/dist/types.js +20 -4
- package/dist/types.js.map +1 -1
- package/package.json +8 -8
- package/src/cadre-node.ts +7449 -7397
- package/src/control-database.ts +48 -16
- package/src/control-read-retry.ts +214 -202
- package/src/control-write-retry.ts +24 -7
- package/src/index.ts +582 -563
- package/src/link-budget.ts +264 -0
- package/src/peer-dial.ts +39 -17
- package/src/peer-join-backfill.ts +648 -478
- package/src/relay-reservation.ts +1119 -951
- package/src/seed-bootstrap.ts +2 -1
- package/src/strand-first-sync-gate.ts +352 -258
- package/src/strand-instance-manager.ts +1520 -1458
- package/src/strand-membership-reconciler.ts +334 -92
- package/src/strand-membership-writer.ts +1962 -1987
- package/src/strand-network-config.ts +2 -2
- package/src/types.ts +104 -8
package/dist/peer-dial.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"peer-dial.js","sourceRoot":"","sources":["../src/peer-dial.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"peer-dial.js","sourceRoot":"","sources":["../src/peer-dial.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAEvD,MAAM,GAAG,GAAG,KAAK,CAAC,wBAAwB,CAAC,CAAC;AAE5C;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,MAAM,CAAC,MAAM,kDAAkD,GAAG,mBAAmB,EAAE,CAAC;AAExF;;;;GAIG;AACH,MAAM,CAAC,MAAM,oCAAoC,GAAG,CAAC,CAAC;AAEtD;;;;;;;;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C;QAC3B,OAAO,IAAI,KAAK,CAAC,GAAG,KAAK,0BAA0B,CAAC,CAAC;IACtD,CAAC;IACD,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC3B,OAAO,QAAQ,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;IAC1B,CAAC;IACD,MAAM,MAAM,GAAG,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC3F,OAAO,IAAI,KAAK,CAAC,GAAG,KAAK,mBAAmB,QAAQ,CAAC,MAAM,yBAAyB,MAAM,EAAE,EAAE,EAAE,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,KAAK,EAAE,CAAC,CAAC;AAC7H,CAAC;AAED,SAAS,aAAa;IACrB,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,CAAC;AACzD,CAAC"}
|
|
@@ -8,6 +8,13 @@ import { BlockTransferClient, type IRawStorage } from '@optimystic/db-p2p';
|
|
|
8
8
|
* changes it or starts exporting it.
|
|
9
9
|
*/
|
|
10
10
|
export declare const MAX_BLOCK_MESSAGE_BYTES: number;
|
|
11
|
+
/**
|
|
12
|
+
* Consecutive failed catch-up runs against ONE peer before the module says so on
|
|
13
|
+
* `console.warn` rather than only in its DEBUG log. At the default backoff that is reached
|
|
14
|
+
* about 35 seconds in (5 s + 10 s + 20 s), which is late enough to have ruled out a blip and
|
|
15
|
+
* early enough to be the first thing an operator sees about a machine that is not catching up.
|
|
16
|
+
*/
|
|
17
|
+
export declare const PEER_JOIN_BACKFILL_WARN_AFTER_FAILURES = 3;
|
|
11
18
|
/** Tuning for the per-peer catch-up. Every field optional; defaults in {@link DEFAULT_PEER_JOIN_BACKFILL}. */
|
|
12
19
|
export interface PeerJoinBackfillConfig {
|
|
13
20
|
/** Default true. False disables the catch-up entirely (the pre-existing behaviour). */
|
|
@@ -20,10 +27,28 @@ export interface PeerJoinBackfillConfig {
|
|
|
20
27
|
maxChunkBytes?: number;
|
|
21
28
|
/** Max blocks per push message. Default 64. */
|
|
22
29
|
maxChunkBlocks?: number;
|
|
23
|
-
/**
|
|
30
|
+
/**
|
|
31
|
+
* Per-push dial deadline, ms. Default {@link peerJoinPushBudget}'s `dialTimeoutMs` — four link
|
|
32
|
+
* round trips at the declared link, 14 000 ms as shipped. NOT a fixed number: a relayed dial
|
|
33
|
+
* costs a fixed number of exchanges, so a host on a slower link moves this (and every other
|
|
34
|
+
* cadre dial budget) by declaring `NetworkConfig.linkRoundTripMs`. Naming it here still wins
|
|
35
|
+
* over the derived value — `link-budget.ts` has the counts and the measurement.
|
|
36
|
+
*/
|
|
24
37
|
dialTimeoutMs?: number;
|
|
25
|
-
/**
|
|
38
|
+
/**
|
|
39
|
+
* Per-push response deadline, ms. Default {@link peerJoinPushBudget}'s `responseTimeoutMs` —
|
|
40
|
+
* two link round trips at the declared link plus a transfer allowance for the chunk's own
|
|
41
|
+
* bytes, 13 000 ms as shipped. Derived differently from {@link dialTimeoutMs} because it
|
|
42
|
+
* bounds a data transfer over a connection that is already open, not a dial.
|
|
43
|
+
*/
|
|
26
44
|
responseTimeoutMs?: number;
|
|
45
|
+
/**
|
|
46
|
+
* First wait before re-running a catch-up whose last run did not complete cleanly, ms.
|
|
47
|
+
* Default 5000. Doubles per consecutive failure up to {@link maxRetryBackoffMs}.
|
|
48
|
+
*/
|
|
49
|
+
retryBackoffMs?: number;
|
|
50
|
+
/** Ceiling on that doubling wait, ms. Default 60_000. */
|
|
51
|
+
maxRetryBackoffMs?: number;
|
|
27
52
|
}
|
|
28
53
|
/** The resolved defaults every {@link PeerJoinBackfill} starts from. */
|
|
29
54
|
export declare const DEFAULT_PEER_JOIN_BACKFILL: Required<PeerJoinBackfillConfig>;
|
|
@@ -105,8 +130,18 @@ export declare class PeerJoinBackfill {
|
|
|
105
130
|
* reconnect, which is exactly what the re-arm exists to avoid.
|
|
106
131
|
*/
|
|
107
132
|
private readonly rearmAfterFlight;
|
|
108
|
-
/** Pending per-peer debounce
|
|
133
|
+
/** Pending per-peer timers — the debounce, or a backoff re-arm. Cleared on stop. */
|
|
109
134
|
private readonly timers;
|
|
135
|
+
/** Consecutive non-clean runs per peer, cleared when one finishes cleanly. */
|
|
136
|
+
private readonly failures;
|
|
137
|
+
/**
|
|
138
|
+
* Epoch ms before which a peer's catch-up must not be re-run, set alongside a backoff timer
|
|
139
|
+
* that will run it. Its presence is what makes `connection:open` churn free: a schedule
|
|
140
|
+
* arriving inside the wait is dropped, rather than collapsing the backoff to the debounce.
|
|
141
|
+
*/
|
|
142
|
+
private readonly retryAfter;
|
|
143
|
+
/** Peers already reported on `console.warn`; reset when a run finally lands cleanly. */
|
|
144
|
+
private readonly warned;
|
|
110
145
|
private readonly onConnectionOpen;
|
|
111
146
|
private loggedNoListBlockIds;
|
|
112
147
|
constructor(deps: PeerJoinBackfillDeps, config?: PeerJoinBackfillConfig);
|
|
@@ -133,6 +168,25 @@ export declare class PeerJoinBackfill {
|
|
|
133
168
|
* caught up, or this backfill is stopped.
|
|
134
169
|
*/
|
|
135
170
|
catchUpPeer(peerId: PeerId): Promise<PeerJoinBackfillResult>;
|
|
136
|
-
/**
|
|
171
|
+
/** Whether this network's libp2p node still holds a connection to that peer. */
|
|
172
|
+
private isConnected;
|
|
173
|
+
/**
|
|
174
|
+
* Re-arm one peer's catch-up after a run whose push failed, on a wait that doubles
|
|
175
|
+
* per consecutive failure up to `maxRetryBackoffMs`. Sets {@link retryAfter} alongside the
|
|
176
|
+
* timer, which is what makes `connection:open` churn inside the wait free.
|
|
177
|
+
*/
|
|
178
|
+
private scheduleRetryWithBackoff;
|
|
179
|
+
/**
|
|
180
|
+
* Say ONCE per peer, outside the DEBUG log, that its catch-up is not landing. Without this a
|
|
181
|
+
* machine on a link too slow for a relayed dial produces no statement that anything is wrong:
|
|
182
|
+
* the peer never appears to hold the blocks, and the only trace is a DEBUG line naming a dial
|
|
183
|
+
* timeout. Reset when a run finally lands cleanly, so a peer that recovers can report again.
|
|
184
|
+
*/
|
|
185
|
+
private warnPersistentFailure;
|
|
186
|
+
/**
|
|
187
|
+
* The actual copy. `clean` = every chunk pushed and the remote persisted every block.
|
|
188
|
+
* `pushFailed` = at least one push THREW, which is the only non-clean outcome a retry can
|
|
189
|
+
* change; the others are verdicts (denied, inert store, blocks the receiver refused).
|
|
190
|
+
*/
|
|
137
191
|
private runCatchUp;
|
|
138
192
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import debug from 'debug';
|
|
2
2
|
import { BlockTransferClient } from '@optimystic/db-p2p';
|
|
3
|
+
import { peerJoinPushBudget } from './link-budget.js';
|
|
3
4
|
// Peer-join whole-store block catch-up, shared by the STRAND networks and the CONTROL
|
|
4
5
|
// network. On `connection:open` (debounced) it pushes every committed, materialized block
|
|
5
6
|
// in the local raw store to the new peer, so a machine that joined after blocks were
|
|
@@ -40,19 +41,75 @@ import { BlockTransferClient } from '@optimystic/db-p2p';
|
|
|
40
41
|
// `scheduleConnectedPeers()` on a membership change (the production join order is
|
|
41
42
|
// connect-then-authorize, so the denial at dial time is the expected first pass).
|
|
42
43
|
//
|
|
43
|
-
//
|
|
44
|
-
//
|
|
45
|
-
//
|
|
46
|
-
//
|
|
47
|
-
//
|
|
48
|
-
//
|
|
44
|
+
// Both per-push deadlines are DERIVED from the declared link round trip
|
|
45
|
+
// (`link-budget.ts`), not fixed milliseconds. That is not tuning — it is what makes this
|
|
46
|
+
// module work at all over a relay. Opening a relayed connection costs a fixed number of
|
|
47
|
+
// exchanges, so the 3000 ms this catch-up used to allow its dial could never finish one
|
|
48
|
+
// above 375 ms of one-way link delay: the catch-up existed so that a machine which joined
|
|
49
|
+
// after blocks were committed physically ends up holding them, and through a relay on any
|
|
50
|
+
// link slow enough to matter it had never once managed to. The reproduction is
|
|
51
|
+
// `packages/integration-tests/src/scenarios/relayed-dial-cost-by-latency.integration.ts`.
|
|
49
52
|
//
|
|
50
|
-
//
|
|
51
|
-
//
|
|
52
|
-
//
|
|
53
|
-
//
|
|
54
|
-
//
|
|
55
|
-
//
|
|
53
|
+
// It does NOT work at every speed. Above the declared link, libp2p's own dial and
|
|
54
|
+
// inbound-upgrade limits — derived from the same declaration — abandon the connection before
|
|
55
|
+
// any deadline here is consulted, and the listener's one makes that failure look like an absent
|
|
56
|
+
// peer rather than a timeout. That is also what happens when the machine being caught up
|
|
57
|
+
// declared a FASTER link than this one, since its limit is the listener's. See
|
|
58
|
+
// `link-budget.ts` ("libp2p's own two limits", "What still fails at the supported link").
|
|
59
|
+
//
|
|
60
|
+
// RETRY, and why it backs off. A run whose PUSH FAILED — the transport threw, which is what
|
|
61
|
+
// a dial or response deadline expiring looks like here — re-arms on a doubling backoff
|
|
62
|
+
// (`retryBackoffMs` to `maxRetryBackoffMs`), and a `connection:open` arriving while that wait
|
|
63
|
+
// is outstanding is DROPPED rather than collapsing it back to the debounce. Both halves are
|
|
64
|
+
// load-bearing:
|
|
65
|
+
//
|
|
66
|
+
// - Without the re-arm, a transient push failure over a stable connection left the peer
|
|
67
|
+
// partially copied until its next reconnect (read repair still covered reads meanwhile).
|
|
68
|
+
// - Without dropping churn inside the wait, a peer that cannot be reached at all is
|
|
69
|
+
// re-dialled on every `connection:open` forever. That is not hypothetical: the 2026-09-26
|
|
70
|
+
// relayed reproduction shows one peer re-opening a connection about every 14.5 s for a
|
|
71
|
+
// 200-second run, each event starting a catch-up whose dial could not possibly finish.
|
|
72
|
+
// The connection kept re-appearing because Optimystic's own block-transfer push path
|
|
73
|
+
// budgets its dial at `transferTimeoutMs ?? 30000` — the one dial budget in the stack
|
|
74
|
+
// above the measured relayed setup cost — so it succeeded where this one could not.
|
|
75
|
+
//
|
|
76
|
+
// A NON-CLEAN run is NOT on its own enough to re-arm, and the distinction is what keeps the
|
|
77
|
+
// backoff from becoming a worse problem than the one it fixes. `clean` also goes false for
|
|
78
|
+
// outcomes no amount of retrying can change: the membership gate DENIED the peer; this
|
|
79
|
+
// network's raw storage implements no `listBlockIds`, so the catch-up is inert; or the
|
|
80
|
+
// receiver reported blocks in `missing`, which it does per block for a payload it cannot
|
|
81
|
+
// parse and for a revision whose retained commit proof this node does not hold (a push
|
|
82
|
+
// carrying no proof is refused outright by a receiver running the default
|
|
83
|
+
// `requirePushCertificate: true`, and an unretained proof is the ordinary case — see
|
|
84
|
+
// {@link Chunk.proofs}). Re-arming on those would re-push the WHOLE store to that peer every
|
|
85
|
+
// `maxRetryBackoffMs` for as long as the node runs, and report the failure below as a link
|
|
86
|
+
// budget problem when nothing about the link is wrong. All three still leave the peer
|
|
87
|
+
// un-memoized, so its next `connection:open` retries — the behaviour that predates the
|
|
88
|
+
// backoff, and the right one for a verdict rather than a timeout. Denial in particular is
|
|
89
|
+
// re-driven on purpose by `scheduleConnectedPeers()` the moment the membership commit lands,
|
|
90
|
+
// because the control network's join order is connect-then-authorize.
|
|
91
|
+
//
|
|
92
|
+
// A re-arm is also skipped when the peer is no longer CONNECTED. This module's trigger is
|
|
93
|
+
// `connection:open`, so a peer that went away already has one: re-arming instead would leave
|
|
94
|
+
// a machine dialing a peer it cannot see once a minute for the rest of its uptime.
|
|
95
|
+
//
|
|
96
|
+
// After `PEER_JOIN_BACKFILL_WARN_AFTER_FAILURES` consecutive failures one `console.warn`
|
|
97
|
+
// names the peer and the budget, because otherwise a machine on a too-slow link says
|
|
98
|
+
// nothing at all: the connection simply never appears and only a DEBUG log mentions a dial
|
|
99
|
+
// timeout.
|
|
100
|
+
//
|
|
101
|
+
// NOTE: a failing dial to a non-speaking peer costs one dial timeout per attempt, and is
|
|
102
|
+
// never memoized (only clean runs are). Bounded by the backoff above plus the
|
|
103
|
+
// unreachable-peer bail in `runCatchUp` — one dial per attempt, not one per chunk. If a node
|
|
104
|
+
// ever holds many such connections, or the enumeration ahead of the first chunk gets
|
|
105
|
+
// expensive, pre-check `libp2p.peerStore` for this network's block-transfer protocol before
|
|
106
|
+
// enumerating.
|
|
107
|
+
//
|
|
108
|
+
// NOTE: a peer that disconnects INSIDE a backoff wait still costs the one attempt that wait
|
|
109
|
+
// was already armed for — the connectivity check is made when the re-arm is decided, not when
|
|
110
|
+
// the timer fires, and this module subscribes to `connection:open` only. One dial, not a
|
|
111
|
+
// recurring one; if a node ever holds many transient peers, subscribe to `connection:close`
|
|
112
|
+
// and clear the pending timer there.
|
|
56
113
|
const log = debug('sereus:cadre:peer-join-backfill');
|
|
57
114
|
/**
|
|
58
115
|
* The block-transfer protocol's hard cap on one length-prefixed message. Mirrors
|
|
@@ -61,6 +118,13 @@ const log = debug('sereus:cadre:peer-join-backfill');
|
|
|
61
118
|
* changes it or starts exporting it.
|
|
62
119
|
*/
|
|
63
120
|
export const MAX_BLOCK_MESSAGE_BYTES = 8 * 1024 * 1024;
|
|
121
|
+
/**
|
|
122
|
+
* Consecutive failed catch-up runs against ONE peer before the module says so on
|
|
123
|
+
* `console.warn` rather than only in its DEBUG log. At the default backoff that is reached
|
|
124
|
+
* about 35 seconds in (5 s + 10 s + 20 s), which is late enough to have ruled out a blip and
|
|
125
|
+
* early enough to be the first thing an operator sees about a machine that is not catching up.
|
|
126
|
+
*/
|
|
127
|
+
export const PEER_JOIN_BACKFILL_WARN_AFTER_FAILURES = 3;
|
|
64
128
|
/** The resolved defaults every {@link PeerJoinBackfill} starts from. */
|
|
65
129
|
export const DEFAULT_PEER_JOIN_BACKFILL = {
|
|
66
130
|
enabled: true,
|
|
@@ -68,8 +132,13 @@ export const DEFAULT_PEER_JOIN_BACKFILL = {
|
|
|
68
132
|
maxBlocks: 10000,
|
|
69
133
|
maxChunkBytes: 1024 * 1024,
|
|
70
134
|
maxChunkBlocks: 64,
|
|
71
|
-
|
|
72
|
-
|
|
135
|
+
// Derived at the DEFAULT declared link, for a `PeerJoinBackfill` built without a host's
|
|
136
|
+
// declaration (this module's own tests, an embedder driving it directly). The two production
|
|
137
|
+
// construction sites pass `peerJoinPushBudget(network?.linkRoundTripMs)` so a host that
|
|
138
|
+
// declares a slower link moves both — see `link-budget.ts`.
|
|
139
|
+
...peerJoinPushBudget(),
|
|
140
|
+
retryBackoffMs: 5000,
|
|
141
|
+
maxRetryBackoffMs: 60000
|
|
73
142
|
};
|
|
74
143
|
function emptyResult() {
|
|
75
144
|
return { offered: 0, accepted: 0, rejected: [], uncommitted: 0, unmaterialized: 0, capped: 0, oversized: [], denied: false };
|
|
@@ -110,8 +179,18 @@ export class PeerJoinBackfill {
|
|
|
110
179
|
* reconnect, which is exactly what the re-arm exists to avoid.
|
|
111
180
|
*/
|
|
112
181
|
this.rearmAfterFlight = new Set();
|
|
113
|
-
/** Pending per-peer debounce
|
|
182
|
+
/** Pending per-peer timers — the debounce, or a backoff re-arm. Cleared on stop. */
|
|
114
183
|
this.timers = new Map();
|
|
184
|
+
/** Consecutive non-clean runs per peer, cleared when one finishes cleanly. */
|
|
185
|
+
this.failures = new Map();
|
|
186
|
+
/**
|
|
187
|
+
* Epoch ms before which a peer's catch-up must not be re-run, set alongside a backoff timer
|
|
188
|
+
* that will run it. Its presence is what makes `connection:open` churn free: a schedule
|
|
189
|
+
* arriving inside the wait is dropped, rather than collapsing the backoff to the debounce.
|
|
190
|
+
*/
|
|
191
|
+
this.retryAfter = new Map();
|
|
192
|
+
/** Peers already reported on `console.warn`; reset when a run finally lands cleanly. */
|
|
193
|
+
this.warned = new Set();
|
|
115
194
|
this.loggedNoListBlockIds = false;
|
|
116
195
|
this.config = { ...DEFAULT_PEER_JOIN_BACKFILL, ...config };
|
|
117
196
|
this.createPushClient = deps.createPushClient
|
|
@@ -142,6 +221,7 @@ export class PeerJoinBackfill {
|
|
|
142
221
|
}
|
|
143
222
|
this.timers.clear();
|
|
144
223
|
this.rearmAfterFlight.clear();
|
|
224
|
+
this.retryAfter.clear();
|
|
145
225
|
log('[%s] stopped', this.deps.label);
|
|
146
226
|
}
|
|
147
227
|
/**
|
|
@@ -178,6 +258,13 @@ export class PeerJoinBackfill {
|
|
|
178
258
|
this.rearmAfterFlight.add(key);
|
|
179
259
|
return;
|
|
180
260
|
}
|
|
261
|
+
// A peer whose last run failed is already re-armed on a backoff timer that will run it, so
|
|
262
|
+
// DROP this schedule instead of shortening the wait — otherwise a peer that cannot be
|
|
263
|
+
// reached is re-dialled on every connection:open forever (see the module comment's retry
|
|
264
|
+
// paragraph). A denied run never gets here: it does not set a backoff.
|
|
265
|
+
const retryAt = this.retryAfter.get(key);
|
|
266
|
+
if (retryAt !== undefined && Date.now() < retryAt)
|
|
267
|
+
return;
|
|
181
268
|
const existing = this.timers.get(key);
|
|
182
269
|
if (existing)
|
|
183
270
|
clearTimeout(existing);
|
|
@@ -198,7 +285,7 @@ export class PeerJoinBackfill {
|
|
|
198
285
|
}
|
|
199
286
|
this.inFlight.add(key);
|
|
200
287
|
try {
|
|
201
|
-
const { result, clean } = await this.runCatchUp(peerId);
|
|
288
|
+
const { result, clean, pushFailed } = await this.runCatchUp(peerId);
|
|
202
289
|
// NOTE: a run that hit `maxBlocks` is still "clean" and still memoizes the peer, so
|
|
203
290
|
// the tail past the ceiling never reaches it. Deliberate: enumeration is not
|
|
204
291
|
// resumable, so not memoizing would re-push the same prefix on every reconnect
|
|
@@ -206,6 +293,19 @@ export class PeerJoinBackfill {
|
|
|
206
293
|
// realistically exceed maxBlocks, the fix is a resumable cursor, not either policy.
|
|
207
294
|
if (clean && !this.stopped) {
|
|
208
295
|
this.done.add(key);
|
|
296
|
+
this.failures.delete(key);
|
|
297
|
+
this.retryAfter.delete(key);
|
|
298
|
+
this.warned.delete(key);
|
|
299
|
+
}
|
|
300
|
+
else if (pushFailed && !this.stopped && this.started && this.isConnected(peerId)) {
|
|
301
|
+
// `pushFailed`, not `!clean`: a denial, an inert store and a receiver's per-block
|
|
302
|
+
// rejection are all verdicts a retry cannot change, and re-arming on them would
|
|
303
|
+
// re-push the whole store to that peer forever. See the module comment.
|
|
304
|
+
//
|
|
305
|
+
// Gated on `started` too: the re-arm exists to REPLACE a connection:open-driven retry,
|
|
306
|
+
// so a caller driving `catchUpPeer` by hand against a backfill that was never started
|
|
307
|
+
// owns its own retry policy and must not be left holding a background timer.
|
|
308
|
+
this.scheduleRetryWithBackoff(peerId);
|
|
209
309
|
}
|
|
210
310
|
log('[%s] catch-up peer=%s offered=%d accepted=%d rejected=%d uncommitted=%d unmaterialized=%d capped=%d oversized=%d denied=%s done=%s', this.deps.label, key, result.offered, result.accepted, result.rejected.length, result.uncommitted, result.unmaterialized, result.capped, result.oversized.length, result.denied, clean);
|
|
211
311
|
return result;
|
|
@@ -225,7 +325,53 @@ export class PeerJoinBackfill {
|
|
|
225
325
|
}
|
|
226
326
|
}
|
|
227
327
|
}
|
|
228
|
-
/**
|
|
328
|
+
/** Whether this network's libp2p node still holds a connection to that peer. */
|
|
329
|
+
isConnected(peerId) {
|
|
330
|
+
return this.deps.libp2p.getConnections(peerId).length > 0;
|
|
331
|
+
}
|
|
332
|
+
/**
|
|
333
|
+
* Re-arm one peer's catch-up after a run whose push failed, on a wait that doubles
|
|
334
|
+
* per consecutive failure up to `maxRetryBackoffMs`. Sets {@link retryAfter} alongside the
|
|
335
|
+
* timer, which is what makes `connection:open` churn inside the wait free.
|
|
336
|
+
*/
|
|
337
|
+
scheduleRetryWithBackoff(peerId) {
|
|
338
|
+
const key = peerId.toString();
|
|
339
|
+
const failures = (this.failures.get(key) ?? 0) + 1;
|
|
340
|
+
this.failures.set(key, failures);
|
|
341
|
+
const delayMs = Math.min(this.config.retryBackoffMs * 2 ** (failures - 1), this.config.maxRetryBackoffMs);
|
|
342
|
+
this.retryAfter.set(key, Date.now() + delayMs);
|
|
343
|
+
const existing = this.timers.get(key);
|
|
344
|
+
if (existing)
|
|
345
|
+
clearTimeout(existing);
|
|
346
|
+
this.timers.set(key, setTimeout(() => {
|
|
347
|
+
this.timers.delete(key);
|
|
348
|
+
this.retryAfter.delete(key);
|
|
349
|
+
void this.catchUpPeer(peerId);
|
|
350
|
+
}, delayMs));
|
|
351
|
+
log('[%s] catch-up peer=%s failed %d time(s) in a row; retrying in %dms', this.deps.label, key, failures, delayMs);
|
|
352
|
+
this.warnPersistentFailure(key, failures);
|
|
353
|
+
}
|
|
354
|
+
/**
|
|
355
|
+
* Say ONCE per peer, outside the DEBUG log, that its catch-up is not landing. Without this a
|
|
356
|
+
* machine on a link too slow for a relayed dial produces no statement that anything is wrong:
|
|
357
|
+
* the peer never appears to hold the blocks, and the only trace is a DEBUG line naming a dial
|
|
358
|
+
* timeout. Reset when a run finally lands cleanly, so a peer that recovers can report again.
|
|
359
|
+
*/
|
|
360
|
+
warnPersistentFailure(key, failures) {
|
|
361
|
+
if (failures < PEER_JOIN_BACKFILL_WARN_AFTER_FAILURES || this.warned.has(key))
|
|
362
|
+
return;
|
|
363
|
+
this.warned.add(key);
|
|
364
|
+
console.warn(`[cadre:${this.deps.label}] peer-join block catch-up to peer ${key} has failed ${failures} times in a row `
|
|
365
|
+
+ `(dial budget ${this.config.dialTimeoutMs}ms, response budget ${this.config.responseTimeoutMs}ms). `
|
|
366
|
+
+ 'That peer may not be holding blocks committed before it joined. If it is reachable only through a relay, '
|
|
367
|
+
+ 'these budgets and libp2p\'s own connection limits are derived from network.linkRoundTripMs (see link-budget.ts); '
|
|
368
|
+
+ 'a link slower than that declaration, or a peer that declared a faster one, cannot open a relayed connection at all.');
|
|
369
|
+
}
|
|
370
|
+
/**
|
|
371
|
+
* The actual copy. `clean` = every chunk pushed and the remote persisted every block.
|
|
372
|
+
* `pushFailed` = at least one push THREW, which is the only non-clean outcome a retry can
|
|
373
|
+
* change; the others are verdicts (denied, inert store, blocks the receiver refused).
|
|
374
|
+
*/
|
|
229
375
|
async runCatchUp(peerId) {
|
|
230
376
|
const result = emptyResult();
|
|
231
377
|
const { storage } = this.deps;
|
|
@@ -243,7 +389,7 @@ export class PeerJoinBackfill {
|
|
|
243
389
|
}
|
|
244
390
|
if (!authorized) {
|
|
245
391
|
result.denied = true;
|
|
246
|
-
return { result, clean: false };
|
|
392
|
+
return { result, clean: false, pushFailed: false };
|
|
247
393
|
}
|
|
248
394
|
}
|
|
249
395
|
if (!storage.listBlockIds) {
|
|
@@ -251,7 +397,7 @@ export class PeerJoinBackfill {
|
|
|
251
397
|
this.loggedNoListBlockIds = true;
|
|
252
398
|
log('[%s] raw storage does not implement listBlockIds(); backfill is inert', this.deps.label);
|
|
253
399
|
}
|
|
254
|
-
return { result, clean: false };
|
|
400
|
+
return { result, clean: false, pushFailed: false };
|
|
255
401
|
}
|
|
256
402
|
const client = this.createPushClient(peerId);
|
|
257
403
|
const encoder = new TextEncoder();
|
|
@@ -363,7 +509,7 @@ export class PeerJoinBackfill {
|
|
|
363
509
|
log('[%s] peer=%s catch-up CAPPED at %d blocks; %d block id(s) not attempted', this.deps.label, peerId.toString(), this.config.maxBlocks, result.capped);
|
|
364
510
|
}
|
|
365
511
|
const clean = !chunkFailed && result.rejected.length === 0;
|
|
366
|
-
return { result, clean };
|
|
512
|
+
return { result, clean, pushFailed: chunkFailed };
|
|
367
513
|
}
|
|
368
514
|
}
|
|
369
515
|
//# sourceMappingURL=peer-join-backfill.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"peer-join-backfill.js","sourceRoot":"","sources":["../src/peer-join-backfill.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,EAAE,mBAAmB,EAA2C,MAAM,oBAAoB,CAAC;AAElG,sFAAsF;AACtF,0FAA0F;AAC1F,qFAAqF;AACrF,0FAA0F;AAC1F,0FAA0F;AAC1F,yFAAyF;AACzF,yFAAyF;AACzF,EAAE;AACF,wFAAwF;AACxF,iFAAiF;AACjF,0FAA0F;AAC1F,uFAAuF;AACvF,0FAA0F;AAC1F,sBAAsB;AACtB,EAAE;AACF,2FAA2F;AAC3F,wFAAwF;AACxF,o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
|
81
81
|
* And because discovery is out of reach, nothing would ever ASK again either —
|
|
82
82
|
* so {@link driveRelayReservation} stays a single-shot primitive and
|
|
83
83
|
* {@link superviseRelayReservation} owns the retry cadence on top of it. That
|
|
84
|
-
* loop is what makes a lost reservation recover without a page reload.
|
|
84
|
+
* loop is what makes a lost reservation recover without a page reload. Single-shot
|
|
85
|
+
* but not unstoppable: the primitive takes an `AbortSignal` and the loop trips it
|
|
86
|
+
* from `stop()`, because a drive left running against a node being torn down both
|
|
87
|
+
* logs failures that read as real and — through the timers it still holds — keeps
|
|
88
|
+
* the process alive for the rest of its `timeoutMs`.
|
|
85
89
|
*
|
|
86
90
|
* One measured refinement to "out of reach": libp2p 3.1.3's `connection.newStream`
|
|
87
91
|
* records every protocol OUR OWN outbound stream negotiated into the peer store, so
|
|
@@ -125,12 +129,45 @@ export interface RelayReservationState {
|
|
|
125
129
|
*/
|
|
126
130
|
retryAtMs: number | null;
|
|
127
131
|
}
|
|
128
|
-
/**
|
|
129
|
-
|
|
132
|
+
/**
|
|
133
|
+
* How long {@link driveRelayReservation} waits for a reservation to appear, at the DEFAULT
|
|
134
|
+
* declared link round trip: `RELAY_RESERVATION_ROUND_TRIPS` (4) x `DECLARED_LINK_ROUND_TRIP_MS`
|
|
135
|
+
* (3500 ms) = 14 000 ms, where it was a fixed 10_000 before it was derived.
|
|
136
|
+
*
|
|
137
|
+
* Counted rather than chosen because this one deadline bounds the whole drive — dial the relay,
|
|
138
|
+
* request the reservation, wait — and each of those costs a fixed number of exchanges, not a
|
|
139
|
+
* fixed number of milliseconds. `link-budget.ts` carries the counts, the measurement behind
|
|
140
|
+
* them, and what still fails at the supported link whatever this says.
|
|
141
|
+
*
|
|
142
|
+
* A host on a slower link moves it by declaring `NetworkConfig.linkRoundTripMs`, which both
|
|
143
|
+
* call sites thread in (`CadreNode.reserveRelays` for the control node,
|
|
144
|
+
* `StrandInstanceManager`'s per-relay supervisors for a strand). This constant is the fallback
|
|
145
|
+
* for a caller that declares nothing.
|
|
146
|
+
*/
|
|
147
|
+
export declare const DEFAULT_RELAY_RESERVE_TIMEOUT_MS: number;
|
|
130
148
|
export declare const DEFAULT_RELAY_RESERVE_POLL_MS = 250;
|
|
131
149
|
export interface RelayReserveOptions {
|
|
132
150
|
timeoutMs?: number;
|
|
133
151
|
pollMs?: number;
|
|
152
|
+
/**
|
|
153
|
+
* Ends an in-flight drive early. Aborting is not a failure: the drive returns
|
|
154
|
+
* `{ error: null, cancelled: true }` and clears every timer it holds, so the
|
|
155
|
+
* process is free to exit immediately instead of trailing the teardown that
|
|
156
|
+
* cancelled it.
|
|
157
|
+
*/
|
|
158
|
+
signal?: AbortSignal;
|
|
159
|
+
}
|
|
160
|
+
/** What one {@link driveRelayReservation} came back with. */
|
|
161
|
+
export interface RelayReserveResult {
|
|
162
|
+
/** Why no reservation landed; `null` when one did — or when the drive was cancelled. */
|
|
163
|
+
error: string | null;
|
|
164
|
+
/**
|
|
165
|
+
* The drive ended because its caller's `signal` tripped, not because of anything
|
|
166
|
+
* the relay did. Separate from `error` because `error: null` means "a reservation
|
|
167
|
+
* landed" and a cancelled drive landed nothing: folded together, a caller would
|
|
168
|
+
* read cancellation as success. `cancelled: true` always implies `error: null`.
|
|
169
|
+
*/
|
|
170
|
+
cancelled: boolean;
|
|
134
171
|
}
|
|
135
172
|
/**
|
|
136
173
|
* The slice of `@libp2p/utils`' `Filter` (a cuckoo filter) that the reservation
|
|
@@ -205,18 +242,27 @@ export declare function findCircuitRelayTransport(node: Libp2p): CircuitRelayTra
|
|
|
205
242
|
* (`error: null`).
|
|
206
243
|
*
|
|
207
244
|
* `timeoutMs` bounds the WHOLE drive — dials, reservation requests and the wait
|
|
208
|
-
* share one deadline.
|
|
245
|
+
* share one deadline. `opts.signal` bounds it from the other side: every phase
|
|
246
|
+
* below returns as soon as it trips, and the drive reports `cancelled` rather than
|
|
247
|
+
* inventing a failure for a relay that was never given a chance to answer.
|
|
209
248
|
*/
|
|
210
|
-
export declare function driveRelayReservation(node: Libp2p, addrs: readonly string[], opts?: RelayReserveOptions): Promise<
|
|
211
|
-
error: string | null;
|
|
212
|
-
}>;
|
|
249
|
+
export declare function driveRelayReservation(node: Libp2p, addrs: readonly string[], opts?: RelayReserveOptions): Promise<RelayReserveResult>;
|
|
213
250
|
/** Gap between liveness checks while a reservation is held. */
|
|
214
251
|
export declare const DEFAULT_RELAY_CHECK_MS = 5000;
|
|
215
252
|
/** Backoff before the first re-drive after a failed attempt. */
|
|
216
253
|
export declare const DEFAULT_RELAY_MIN_BACKOFF_MS = 2000;
|
|
217
254
|
/** Ceiling the backoff doubles up to. */
|
|
218
255
|
export declare const DEFAULT_RELAY_MAX_BACKOFF_MS = 60000;
|
|
219
|
-
|
|
256
|
+
/**
|
|
257
|
+
* Everything one drive takes, minus its `signal`, plus the loop's own cadence.
|
|
258
|
+
*
|
|
259
|
+
* `signal` is omitted rather than inherited because these options are handed
|
|
260
|
+
* straight to every drive: a caller-supplied one would cancel each attempt without
|
|
261
|
+
* the loop knowing, leaving it to reschedule drives that return immediately and
|
|
262
|
+
* forever. The way to cancel a supervisor is
|
|
263
|
+
* {@link RelayReservationSupervisor.stop}, which owns the signal it passes down.
|
|
264
|
+
*/
|
|
265
|
+
export interface RelayReservationSupervisorOptions extends Omit<RelayReserveOptions, 'signal'> {
|
|
220
266
|
/** Gap between liveness checks while a reservation is held. Default 5_000. */
|
|
221
267
|
checkMs?: number;
|
|
222
268
|
/** Backoff before the first re-drive after a failure. Default 2_000. */
|
|
@@ -256,9 +302,11 @@ export interface RelayReservationSupervisor {
|
|
|
256
302
|
/** Reason the last drive produced no reservation; `null` once one is held. */
|
|
257
303
|
readonly lastError: string | null;
|
|
258
304
|
/**
|
|
259
|
-
* Idempotent. Clears the timer so no further drive is scheduled
|
|
260
|
-
*
|
|
261
|
-
*
|
|
305
|
+
* Idempotent. Clears the timer so no further drive is scheduled, and CANCELS the
|
|
306
|
+
* drive already in flight: it stops dialing or polling, clears every timer it
|
|
307
|
+
* holds and reports `cancelled`, so a teardown does not trail an attempt against
|
|
308
|
+
* the node it is dismantling. That result is discarded — a cancelled drive is
|
|
309
|
+
* not a failure — and nothing follows it.
|
|
262
310
|
*/
|
|
263
311
|
stop(): void;
|
|
264
312
|
}
|