@odatano/core 2.0.0-rc.19 → 2.0.0-rc.20
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/@cds-models/CardanoAgentService/index.d.ts +1 -5
- package/@cds-models/CardanoIndexerService/index.d.ts +51 -2
- package/@cds-models/CardanoIndexerService/index.js +7 -0
- package/package.json +1 -1
- package/src/index.d.ts +4 -10
- package/src/index.js +6 -16
- package/src/plugin.js +11 -27
- package/srv/blockchain/backends/blockfrost-backend.d.ts +29 -131
- package/srv/blockchain/backends/blockfrost-backend.js +39 -150
- package/srv/blockchain/backends/cardano-backend.d.ts +53 -171
- package/srv/blockchain/backends/cardano-backend.js +1 -5
- package/srv/blockchain/backends/koios-backend.d.ts +26 -71
- package/srv/blockchain/backends/koios-backend.js +50 -132
- package/srv/blockchain/backends/ogmios-backend.d.ts +43 -124
- package/srv/blockchain/backends/ogmios-backend.js +71 -179
- package/srv/blockchain/backends/ogmios-frame-guard.d.ts +12 -57
- package/srv/blockchain/backends/ogmios-frame-guard.js +27 -66
- package/srv/blockchain/cardano-client.d.ts +43 -216
- package/srv/blockchain/cardano-client.js +49 -234
- package/srv/blockchain/cardano-indexer.d.ts +79 -357
- package/srv/blockchain/cardano-indexer.js +98 -406
- package/srv/blockchain/cardano-tx-builder.d.ts +19 -84
- package/srv/blockchain/cardano-tx-builder.js +21 -107
- package/srv/blockchain/crawler/certificate-backfill.d.ts +45 -0
- package/srv/blockchain/crawler/certificate-backfill.js +150 -0
- package/srv/blockchain/crawler/crawler.d.ts +41 -145
- package/srv/blockchain/crawler/crawler.js +57 -172
- package/srv/blockchain/crawler/hooks.d.ts +3 -14
- package/srv/blockchain/crawler/index.d.ts +2 -6
- package/srv/blockchain/crawler/index.js +4 -9
- package/srv/blockchain/crawler/sync-state.d.ts +17 -39
- package/srv/blockchain/crawler/sync-state.js +23 -55
- package/srv/blockchain/crawler/utxo-set-import.d.ts +5 -22
- package/srv/blockchain/crawler/utxo-set-import.js +8 -28
- package/srv/blockchain/ledger-state.d.ts +3 -12
- package/srv/blockchain/signing/cose-verifier.d.ts +5 -12
- package/srv/blockchain/signing/cose-verifier.js +6 -12
- package/srv/blockchain/signing/external-signer.d.ts +16 -113
- package/srv/blockchain/signing/external-signer.js +19 -122
- package/srv/blockchain/signing/hsm-signer.d.ts +13 -45
- package/srv/blockchain/signing/hsm-signer.js +23 -63
- package/srv/blockchain/signing/signature-verifier.d.ts +8 -44
- package/srv/blockchain/signing/signature-verifier.js +13 -54
- package/srv/blockchain/signing/submission-finalizer.d.ts +9 -36
- package/srv/blockchain/signing/submission-finalizer.js +16 -48
- package/srv/blockchain/transaction-building/buildooor-tx.d.ts +65 -174
- package/srv/blockchain/transaction-building/buildooor-tx.js +107 -266
- package/srv/blockchain/transaction-building/cardano-tx.d.ts +8 -34
- package/srv/blockchain/wallet-worker/build-request.d.ts +4 -17
- package/srv/blockchain/wallet-worker/build-request.js +9 -22
- package/srv/blockchain/wallet-worker/confirmation-tracker.d.ts +12 -35
- package/srv/blockchain/wallet-worker/confirmation-tracker.js +16 -32
- package/srv/blockchain/wallet-worker/index.js +2 -8
- package/srv/blockchain/wallet-worker/job-store.d.ts +33 -111
- package/srv/blockchain/wallet-worker/job-store.js +0 -0
- package/srv/blockchain/wallet-worker/lease-heartbeat.d.ts +4 -20
- package/srv/blockchain/wallet-worker/lease-heartbeat.js +4 -20
- package/srv/blockchain/wallet-worker/signers.d.ts +6 -19
- package/srv/blockchain/wallet-worker/signers.js +3 -8
- package/srv/blockchain/wallet-worker/wallet-worker.d.ts +15 -71
- package/srv/blockchain/wallet-worker/wallet-worker.js +34 -90
- package/srv/cardano-agent-service.cds +1 -5
- package/srv/cardano-agent-service.js +3 -7
- package/srv/cardano-indexer-service.cds +32 -4
- package/srv/cardano-indexer-service.js +83 -15
- package/srv/cardano-service.js +36 -98
- package/srv/cardano-sign-service.cds +1 -1
- package/srv/cardano-sign-service.js +55 -173
- package/srv/cardano-tx-service.cds +1 -1
- package/srv/cardano-tx-service.js +54 -174
- package/srv/cardano-worker-service.js +7 -15
- package/srv/server.d.ts +27 -86
- package/srv/server.js +52 -148
- package/srv/utils/agent-grants-config.d.ts +11 -50
- package/srv/utils/agent-grants-config.js +12 -45
- package/srv/utils/agent-grants.d.ts +34 -123
- package/srv/utils/agent-grants.js +57 -156
- package/srv/utils/agent-token-auth.d.ts +2 -5
- package/srv/utils/agent-token-auth.js +2 -5
- package/srv/utils/backend-request-handler.d.ts +2 -16
- package/srv/utils/backend-request-handler.js +3 -18
- package/srv/utils/collections.d.ts +4 -8
- package/srv/utils/collections.js +4 -8
- package/srv/utils/const.d.ts +19 -68
- package/srv/utils/const.js +20 -69
- package/srv/utils/crypto.d.ts +3 -12
- package/srv/utils/crypto.js +5 -18
- package/srv/utils/db-indexes.d.ts +2 -7
- package/srv/utils/db-indexes.js +7 -34
- package/srv/utils/db-sanitize.d.ts +5 -18
- package/srv/utils/db-sanitize.js +6 -19
- package/srv/utils/error-codes.d.ts +18 -73
- package/srv/utils/error-codes.js +17 -70
- package/srv/utils/errors.d.ts +29 -191
- package/srv/utils/errors.js +44 -229
- package/srv/utils/liveness.d.ts +2 -9
- package/srv/utils/liveness.js +3 -11
- package/srv/utils/mappers.d.ts +50 -298
- package/srv/utils/mappers.js +80 -386
- package/srv/utils/network-context.js +2 -11
- package/srv/utils/pg-order-nulls.js +4 -23
- package/srv/utils/plutus-placeholders.d.ts +6 -18
- package/srv/utils/plutus-placeholders.js +6 -20
- package/srv/utils/rate-limiter.d.ts +6 -17
- package/srv/utils/rate-limiter.js +5 -15
- package/srv/utils/service-events.d.ts +2 -22
- package/srv/utils/service-events.js +3 -23
- package/srv/utils/signing-helper.d.ts +3 -18
- package/srv/utils/signing-helper.js +10 -32
- package/srv/utils/tx-build-helper.d.ts +18 -92
- package/srv/utils/tx-build-helper.js +32 -123
- package/srv/utils/tx-request-parsers.d.ts +7 -26
- package/srv/utils/tx-request-parsers.js +7 -26
- package/srv/utils/tx-utils.d.ts +4 -23
- package/srv/utils/tx-utils.js +12 -41
- package/srv/utils/types.d.ts +67 -206
- package/srv/utils/types.js +2 -6
- package/srv/utils/validators.d.ts +19 -89
- package/srv/utils/validators.js +31 -138
|
@@ -18,11 +18,6 @@ export interface CrawlerConfig {
|
|
|
18
18
|
confirmationDepth: number;
|
|
19
19
|
/** Poll cadence when caught up / on transient errors (pagination path). */
|
|
20
20
|
pollIntervalMs: number;
|
|
21
|
-
/**
|
|
22
|
-
* Analytics coverage of the crawl. All three are
|
|
23
|
-
* by-products of blocks the crawler already holds, except `assetCatalogue: 'enrich'` and
|
|
24
|
-
* `epochSnapshots`, which do talk to a provider.
|
|
25
|
-
*/
|
|
26
21
|
/** Write mint/burn rows into AssetHistory. Free — no provider call. */
|
|
27
22
|
assetHistory: boolean;
|
|
28
23
|
/**
|
|
@@ -46,19 +41,9 @@ export interface CrawlerConfig {
|
|
|
46
41
|
utxoSet: boolean;
|
|
47
42
|
}
|
|
48
43
|
/**
|
|
49
|
-
*
|
|
50
|
-
*
|
|
51
|
-
*
|
|
52
|
-
*
|
|
53
|
-
* Two sources (see CRAWLER_DESIGN.md):
|
|
54
|
-
* - **Ogmios chain-sync** (primary): ordered rollForward + native rollBackward (reorg).
|
|
55
|
-
* - **Blockfrost/Koios pagination** (fallback): forward walk + parent-hash reorg recovery.
|
|
56
|
-
*
|
|
57
|
-
* Lifecycle: start() launches the ingest pipeline detached so the HTTP server binds
|
|
58
|
-
* immediately, but the pipeline promise is retained — stop() halts the loops (waking
|
|
59
|
-
* any pending poll sleep) and AWAITS the pipeline, so shutdown never races in-flight
|
|
60
|
-
* block writes. All per-block writes are atomic. The crawler NEVER crawls from genesis
|
|
61
|
-
* implicitly — it requires an explicit configured start point or an existing cursor.
|
|
44
|
+
* Pre-sync engine: streams the chain forward from a start block and bulk-indexes it. Sources:
|
|
45
|
+
* Ogmios chain-sync (primary, native rollBackward) or Blockfrost/Koios pagination (fallback).
|
|
46
|
+
* Per-block writes are atomic; stop() awaits the detached pipeline; no implicit genesis crawl.
|
|
62
47
|
*/
|
|
63
48
|
export declare class CardanoCrawler {
|
|
64
49
|
private readonly client;
|
|
@@ -69,53 +54,29 @@ export declare class CardanoCrawler {
|
|
|
69
54
|
private readonly leaseOwner?;
|
|
70
55
|
/** Transient-failure retries per block before giving up. */
|
|
71
56
|
private static readonly PERSIST_RETRIES;
|
|
72
|
-
/**
|
|
73
|
-
* A block whose persist keeps failing across crawler restarts is a poison block
|
|
74
|
-
* (e.g. data PostgreSQL rejects). After this many failed persistBlock() calls for
|
|
75
|
-
* the same hash the crawler latches off (desiredRunning=false) instead of
|
|
76
|
-
* restarting forever; an operator fixes the cause and calls resumeCrawler().
|
|
77
|
-
*/
|
|
57
|
+
/** Final persist failures for the same block across restarts before the crawler latches off (poison block). */
|
|
78
58
|
private static readonly POISON_BLOCK_THRESHOLD;
|
|
79
59
|
/** Process-wide, survives instance restarts: the block currently failing and how often. */
|
|
80
60
|
private static poison;
|
|
81
61
|
/**
|
|
82
|
-
*
|
|
83
|
-
*
|
|
84
|
-
* a DB outage, a statement timeout or an exhausted pool fails the same block too,
|
|
85
|
-
* but a restart fixes those, and latching on them would disable the pre-sync for
|
|
86
|
-
* good (the contract of halt()).
|
|
62
|
+
* Errors deterministic for the block's data — only these count towards the poison latch.
|
|
63
|
+
* Outages, statement timeouts and exhausted pools are fixed by a restart and must not latch.
|
|
87
64
|
*/
|
|
88
65
|
private static readonly DATA_REJECTION_PATTERNS;
|
|
89
66
|
/** Timeout for direct backend calls (the crawler bypasses the client's resilience layer). */
|
|
90
67
|
private static readonly CALL_TIMEOUT_MS;
|
|
91
|
-
/**
|
|
92
|
-
* Epoch snapshots are ~100 batched provider requests on mainnet, so they get a wider
|
|
93
|
-
* bound than an ordinary call — still bounded, and cancelled by beginHalt.
|
|
94
|
-
*/
|
|
68
|
+
/** Epoch snapshots are ~100 batched provider requests on mainnet; wider bound, cancelled by beginHalt. */
|
|
95
69
|
private static readonly SNAPSHOT_TIMEOUT_MS;
|
|
96
|
-
/**
|
|
97
|
-
* Backoff after a failed snapshot attempt, doubling up to the cap. Without it a provider
|
|
98
|
-
* outage would re-trigger a full pool/DRep enumeration on every single block for the rest
|
|
99
|
-
* of the epoch — the marker is only set on success, by design.
|
|
100
|
-
*/
|
|
70
|
+
/** Backoff after a failed snapshot attempt, doubling up to the cap; the marker is only set on success. */
|
|
101
71
|
private static readonly SNAPSHOT_RETRY_BASE_MS;
|
|
102
72
|
private static readonly SNAPSHOT_RETRY_MAX_MS;
|
|
103
|
-
/**
|
|
104
|
-
* How often a crawl that runs on pagination for lack of a chain-sync backend retries
|
|
105
|
-
* that backend's init. Pagination is roughly fifty times slower than chain-sync, so
|
|
106
|
-
* the cadence errs on the frequent side; the probe is free when no chain-sync backend
|
|
107
|
-
* is configured at all and bounded by the backend's init timeout when it is down.
|
|
108
|
-
*/
|
|
73
|
+
/** Retry cadence for a chain-sync backend's init while the crawl runs on pagination. */
|
|
109
74
|
private static readonly CHAIN_SYNC_RETRY_MS;
|
|
110
75
|
private running;
|
|
111
76
|
private chainSyncHandle;
|
|
112
77
|
/** What the ingest loop is currently reading from; null while stopped. */
|
|
113
78
|
private activeSource;
|
|
114
|
-
/**
|
|
115
|
-
* Chain-sync init retry while the crawl runs on pagination for lack of one: its own
|
|
116
|
-
* timer (independent of the pagination cadence — a poll sleep can be an hour long),
|
|
117
|
-
* the in-flight recover call, and its outcome.
|
|
118
|
-
*/
|
|
79
|
+
/** Chain-sync init retry while on pagination: own timer, in-flight probe, outcome. */
|
|
119
80
|
private chainSyncProbeTimer;
|
|
120
81
|
private chainSyncProbe;
|
|
121
82
|
private chainSyncRecovered;
|
|
@@ -128,11 +89,7 @@ export declare class CardanoCrawler {
|
|
|
128
89
|
/** Chain-sync callback promises outlive openChainSync(); stop() explicitly drains them. */
|
|
129
90
|
private readonly inFlightCallbacks;
|
|
130
91
|
private haltPromise;
|
|
131
|
-
/**
|
|
132
|
-
* Set when a chain-sync frame could not be parsed at all. The stream cannot deliver that
|
|
133
|
-
* block, so the ingest loop takes it through the paginating backend and then reopens
|
|
134
|
-
* chain-sync — see runIngestPipeline().
|
|
135
|
-
*/
|
|
92
|
+
/** An unparseable chain-sync frame; the ingest loop fetches that block via pagination, then reopens chain-sync. */
|
|
136
93
|
private frameFailure;
|
|
137
94
|
/** Resolves the ingest loop's wait for the current chain-sync stream to end. */
|
|
138
95
|
private streamEnded;
|
|
@@ -154,11 +111,7 @@ export declare class CardanoCrawler {
|
|
|
154
111
|
isRunning(): boolean;
|
|
155
112
|
/** True once the crawler halted because of a failure (not via stop() or a lost lease). */
|
|
156
113
|
haltedWithError(): boolean;
|
|
157
|
-
/**
|
|
158
|
-
* The source this crawler is ingesting from right now, or null while it is not
|
|
159
|
-
* running. Lets an operator see a crawl that degraded to pagination — it still makes
|
|
160
|
-
* progress, so the cursor alone looks healthy.
|
|
161
|
-
*/
|
|
114
|
+
/** Source ingested from right now, or null while not running (a crawl degraded to pagination still advances the cursor). */
|
|
162
115
|
getActiveSource(): CrawlSource | null;
|
|
163
116
|
/**
|
|
164
117
|
* Start crawling. Does NOT await the ingest pipeline (fire-and-forget).
|
|
@@ -167,40 +120,23 @@ export declare class CardanoCrawler {
|
|
|
167
120
|
*/
|
|
168
121
|
start(): Promise<void>;
|
|
169
122
|
/**
|
|
170
|
-
* Stop crawling and
|
|
171
|
-
*
|
|
172
|
-
* final status, then awaits the detached pipeline so callers (shutdownAppContext)
|
|
173
|
-
* can safely tear down backends/DB afterwards.
|
|
123
|
+
* Stop crawling and await the pipeline's in-flight step, so callers can tear down
|
|
124
|
+
* backends/DB afterwards.
|
|
174
125
|
*/
|
|
175
126
|
stop(finalStatus?: CrawlSyncStatusValue): Promise<void>;
|
|
176
127
|
/**
|
|
177
|
-
* Halt without awaiting the pipeline —
|
|
178
|
-
*
|
|
179
|
-
*
|
|
180
|
-
*/
|
|
181
|
-
/**
|
|
182
|
-
* @param latch clears `desiredRunning`, so NO restart brings the crawler back —
|
|
183
|
-
* only an operator's resumeCrawler does. Reserved for failures a restart cannot
|
|
184
|
-
* fix (misconfiguration, missing resume point). Runtime failures — a dropped
|
|
185
|
-
* chain-sync socket, a provider outage, a node restart — must leave it false,
|
|
186
|
-
* otherwise a routine node restart silently disables the pre-sync for good.
|
|
128
|
+
* Halt without awaiting the pipeline — safe to call from inside it.
|
|
129
|
+
* @param latch clears `desiredRunning` so no restart brings the crawler back; only for failures
|
|
130
|
+
* a restart cannot fix (misconfiguration, missing resume point), never for runtime outages.
|
|
187
131
|
*/
|
|
188
132
|
private halt;
|
|
189
|
-
/**
|
|
190
|
-
* Start teardown without awaiting it. Internal callers can therefore halt from
|
|
191
|
-
* inside a tracked callback/pipeline without waiting on their own promise.
|
|
192
|
-
*/
|
|
133
|
+
/** Start teardown without awaiting it, so tracked callbacks can halt from inside themselves. */
|
|
193
134
|
private beginHalt;
|
|
194
135
|
private runIngestPipeline;
|
|
195
136
|
/**
|
|
196
|
-
* Retry the init of a chain-sync backend
|
|
197
|
-
*
|
|
198
|
-
*
|
|
199
|
-
* in the background so no pagination round waits for it, and one at a time so a node
|
|
200
|
-
* that is still replaying is not hammered. On success `chainSyncRecovered` is set and
|
|
201
|
-
* a pending poll sleep is cut short; the pagination loop leaves at its next check
|
|
202
|
-
* (between rounds, or between blocks of a batch — the block in flight completes) and
|
|
203
|
-
* the ingest loop reopens chain-sync from the cursor.
|
|
137
|
+
* Retry the init of a chain-sync backend on its own timer (a poll sleep can be an hour long),
|
|
138
|
+
* one probe at a time. On success `chainSyncRecovered` is set and a pending sleep is cut short;
|
|
139
|
+
* the pagination loop leaves at its next check and the ingest loop reopens chain-sync.
|
|
204
140
|
*/
|
|
205
141
|
private startChainSyncProbing;
|
|
206
142
|
private scheduleChainSyncProbe;
|
|
@@ -211,50 +147,33 @@ export declare class CardanoCrawler {
|
|
|
211
147
|
/** Read and clear the pending frame failure, so each stream starts from a clean slate. */
|
|
212
148
|
private takeFrameFailure;
|
|
213
149
|
/**
|
|
214
|
-
*
|
|
215
|
-
*
|
|
216
|
-
* Requires a height to walk to, a paginating backend to walk with, and an operator who has
|
|
217
|
-
* not pinned the source to 'ogmios' — that setting means chain-sync only, and silently
|
|
218
|
-
* degrading to the weaker pagination reorg handling would defeat the point of it.
|
|
150
|
+
* Whether an unparseable frame can be worked around over HTTP: needs a height, a paginating
|
|
151
|
+
* backend, and a source not pinned to 'ogmios' (chain-sync only).
|
|
219
152
|
*/
|
|
220
153
|
private canDegradeToPagination;
|
|
221
154
|
/**
|
|
222
|
-
* End the chain-sync stream and hand
|
|
223
|
-
*
|
|
224
|
-
* block rather than leaving the empty status a crashed process used to leave behind.
|
|
155
|
+
* End the chain-sync stream and hand back to the ingest loop, which continues on pagination
|
|
156
|
+
* past the offending block. The error is recorded first so `lastError` names the block.
|
|
225
157
|
*/
|
|
226
158
|
private degradeToPagination;
|
|
227
159
|
/**
|
|
228
|
-
* Candidate intersection points,
|
|
229
|
-
*
|
|
230
|
-
*
|
|
231
|
-
*
|
|
232
|
-
* Why more than the cursor: if the cursor's block was orphaned while the crawler
|
|
233
|
-
* was down, a single-point intersection fails outright ("No intersection found")
|
|
234
|
-
* and the stream never opens. With ancestors on the list the node intersects at
|
|
235
|
-
* the last common block and reports it as a rollBackward — the ordinary reorg path
|
|
236
|
-
* that handleReorg already implements. Doubling offsets cover ~32k blocks with 16
|
|
237
|
-
* points; anything deeper is past any realistic rollback and should fail loudly.
|
|
160
|
+
* Candidate intersection points, newest first: the cursor, a ladder of already-crawled
|
|
161
|
+
* ancestors, then the configured start block. If the cursor's block was orphaned while the
|
|
162
|
+
* crawler was down, the node intersects at the last common ancestor and reports a rollBackward.
|
|
238
163
|
*/
|
|
239
164
|
private buildIntersectionPoints;
|
|
240
165
|
/** Track streamed callbacks because closing a socket does not imply DB callbacks finished. */
|
|
241
166
|
private trackCallback;
|
|
242
167
|
/**
|
|
243
|
-
* @param untilHeight
|
|
244
|
-
*
|
|
245
|
-
*
|
|
246
|
-
* for the rest of a backfill would be a poor trade.
|
|
247
|
-
* @param untilChainSync when set, keep retrying a chain-sync backend in the background
|
|
248
|
-
* and return once one is usable, so the ingest loop can hand over to it. Used when
|
|
249
|
-
* the crawl started without one (source 'auto', node still coming up).
|
|
168
|
+
* @param untilHeight return once the cursor reaches it — walks past a block chain-sync
|
|
169
|
+
* cannot deliver, then hands back.
|
|
170
|
+
* @param untilChainSync retry a chain-sync backend in the background; return once one is usable.
|
|
250
171
|
*/
|
|
251
172
|
private runPagination;
|
|
252
173
|
private paginate;
|
|
253
174
|
/**
|
|
254
|
-
* Poll pause between pagination rounds
|
|
255
|
-
*
|
|
256
|
-
* that succeeded while the round was still fetching (tip, blocks) would otherwise be
|
|
257
|
-
* followed by a full poll interval — up to an hour — before the loop notices.
|
|
175
|
+
* Poll pause between pagination rounds; skipped when a chain-sync handover is already due,
|
|
176
|
+
* since the probe's wake-up only reaches a sleep that has begun.
|
|
258
177
|
*/
|
|
259
178
|
private pollPause;
|
|
260
179
|
/**
|
|
@@ -264,46 +183,23 @@ export declare class CardanoCrawler {
|
|
|
264
183
|
*/
|
|
265
184
|
private tryReorgRecovery;
|
|
266
185
|
/**
|
|
267
|
-
* Persist one block atomically and advance the cursor. Transient failures are retried
|
|
268
|
-
*
|
|
269
|
-
* the cursor is not advanced on failure, so a resume re-syncs cleanly from it.
|
|
270
|
-
* Marks the cursor 'synced' when the block is at the reported tip.
|
|
186
|
+
* Persist one block atomically and advance the cursor. Transient failures are retried; the
|
|
187
|
+
* cursor is not advanced on failure, so a resume re-syncs from it. Marks 'synced' at the tip.
|
|
271
188
|
* @returns true when the block was persisted, false when the crawler was stopped
|
|
272
189
|
*/
|
|
273
190
|
private persistBlock;
|
|
274
191
|
/** Epoch a slot belongs to, from the network's Shelley anchor (same math as the Ogmios mapper). */
|
|
275
192
|
private epochOfSlot;
|
|
276
193
|
/**
|
|
277
|
-
*
|
|
278
|
-
*
|
|
279
|
-
*
|
|
280
|
-
* ONLY AT THE TIP. The providers that can enumerate the pool and DRep set report their
|
|
281
|
-
* CURRENT state — Koios `/pool_info` and `/drep_info` take no epoch parameter. Snapshotting
|
|
282
|
-
* while the crawl is still backfilling would therefore write today's stake and vote power
|
|
283
|
-
* under every historical epoch number it passes: a table that reads as a time series but is
|
|
284
|
-
* a constant. So the block's epoch must be the epoch the reported tip is in; otherwise the
|
|
285
|
-
* epoch is skipped, permanently and by design. Backfilled ranges have no snapshots, live
|
|
286
|
-
* ones do.
|
|
287
|
-
*
|
|
288
|
-
* Detached on purpose: the snapshot is a few thousand rows plus ~100 provider requests, and
|
|
289
|
-
* the crawl must not wait for it or fail because of it. It is tracked as an in-flight
|
|
290
|
-
* callback, so a shutdown still drains it, and bounded by a timeout that beginHalt cancels.
|
|
291
|
-
*
|
|
292
|
-
* "Once per epoch" survives a restart: the process-local marker only skips work, the
|
|
293
|
-
* authority is a `PoolEpochSnapshots` row for that epoch — so a crawler restarted right
|
|
294
|
-
* after a boundary still records the epoch, and one restarted mid-epoch does not redo it.
|
|
295
|
-
* A failed attempt leaves the marker unset and backs off (see SNAPSHOT_RETRY_BASE_MS).
|
|
194
|
+
* Pool/DRep snapshot once per epoch, detached from the triggering block and ONLY at the tip:
|
|
195
|
+
* the enumerating providers report current state (no epoch parameter), so epochs passed
|
|
196
|
+
* during a backfill are skipped permanently. Authority is the `PoolEpochSnapshots` row.
|
|
296
197
|
*/
|
|
297
198
|
private maybeSnapshotEpoch;
|
|
298
199
|
/**
|
|
299
|
-
*
|
|
300
|
-
*
|
|
301
|
-
* the cursor to the fork
|
|
302
|
-
*
|
|
303
|
-
* The cut runs on the absolute-slot axis of Blocks (same axis as the fork point), and
|
|
304
|
-
* transactions are resolved via their blockHash — so:
|
|
305
|
-
* - an unresolvable fork height can never widen the delete (no height-0 fallback), and
|
|
306
|
-
* - lazily-indexed transactions of blocks the crawler never wrote are left untouched.
|
|
200
|
+
* Chain rollback in one transaction: delete blocks with slot > fork (absolute-slot axis, never
|
|
201
|
+
* height), their transactions resolved via blockHash (lazily indexed txs of other blocks are
|
|
202
|
+
* untouched), reset the cursor to the fork and write a CardanoReorgLog row.
|
|
307
203
|
*/
|
|
308
204
|
private handleReorg;
|
|
309
205
|
/** Renew the lease while an Ogmios stream is idle; block writes renew it transactionally. */
|