envio 3.3.0-alpha.5 → 3.3.0-alpha.7
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/package.json +6 -6
- package/src/Address.res +5 -2
- package/src/Address.res.mjs +3 -1
- package/src/BatchProcessing.res +5 -0
- package/src/BatchProcessing.res.mjs +6 -0
- package/src/ChainFetching.res +14 -25
- package/src/ChainFetching.res.mjs +19 -20
- package/src/ChainState.res +4 -4
- package/src/ChainState.res.mjs +2 -2
- package/src/ChainState.resi +1 -1
- package/src/Config.res +44 -0
- package/src/Config.res.mjs +38 -0
- package/src/ContractRegisterContext.res +2 -12
- package/src/ContractRegisterContext.res.mjs +3 -5
- package/src/CrossChainState.res +5 -3
- package/src/CrossChainState.res.mjs +5 -4
- package/src/ExitOnCaughtUp.res +10 -2
- package/src/ExitOnCaughtUp.res.mjs +10 -1
- package/src/FetchState.res +49 -52
- package/src/FetchState.res.mjs +45 -47
- package/src/IndexerState.res +4 -0
- package/src/IndexerState.res.mjs +8 -1
- package/src/IndexerState.resi +1 -0
- package/src/SimulateDeadInputTracker.res +85 -0
- package/src/SimulateDeadInputTracker.res.mjs +73 -0
- package/src/SimulateDeadInputTracker.resi +12 -0
- package/src/SimulateItems.res +29 -43
- package/src/SimulateItems.res.mjs +16 -33
- package/src/TestIndexer.res +3 -27
- package/src/TestIndexer.res.mjs +2 -9
- package/src/sources/EvmChain.res +1 -1
- package/src/sources/EvmChain.res.mjs +1 -1
- package/src/sources/HyperFuelSource.res +1 -0
- package/src/sources/HyperFuelSource.res.mjs +1 -1
- package/src/sources/HyperSync.res +4 -0
- package/src/sources/HyperSync.res.mjs +5 -4
- package/src/sources/HyperSync.resi +1 -0
- package/src/sources/HyperSyncSource.res +2 -0
- package/src/sources/HyperSyncSource.res.mjs +2 -2
- package/src/sources/RpcSource.res +287 -146
- package/src/sources/RpcSource.res.mjs +286 -247
- package/src/sources/SimulateSource.res +2 -0
- package/src/sources/SimulateSource.res.mjs +3 -2
- package/src/sources/Source.res +10 -0
- package/src/sources/SourceManager.res +7 -0
- package/src/sources/SourceManager.res.mjs +2 -1
- package/src/sources/Svm.res +1 -0
- package/src/sources/Svm.res.mjs +1 -1
- package/src/sources/SvmHyperSyncSource.res +2 -0
- package/src/sources/SvmHyperSyncSource.res.mjs +4 -2
package/src/sources/Source.res
CHANGED
|
@@ -64,6 +64,12 @@ type t = {
|
|
|
64
64
|
~knownHeight: int,
|
|
65
65
|
~partitionId: string,
|
|
66
66
|
~selection: FetchState.selection,
|
|
67
|
+
// Soft cap on the number of primary items (logs/instructions/receipts) the
|
|
68
|
+
// source should ask its backend for, from the query's own estResponseSize.
|
|
69
|
+
// A HyperSync-backed source enforces it server-side, so a wrong estimate
|
|
70
|
+
// truncates the response instead of overshooting the shared buffer. Sources
|
|
71
|
+
// without an equivalent lever (RPC, Fuel, Simulate) ignore it.
|
|
72
|
+
~itemsTarget: int,
|
|
67
73
|
~retry: int,
|
|
68
74
|
~logger: Pino.t,
|
|
69
75
|
) => promise<blockRangeFetchResponse>,
|
|
@@ -71,4 +77,8 @@ type t = {
|
|
|
71
77
|
// Invoked by SourceManager once a rollback target is known so the source can
|
|
72
78
|
// drop any state that may now point at an orphaned chain (e.g. RPC block cache).
|
|
73
79
|
onReorg?: (~rollbackTargetBlock: int) => unit,
|
|
80
|
+
// Present only on the simulate source: the items a test fed in. The chain
|
|
81
|
+
// tracks which of these never reach a handler so the run can report dead
|
|
82
|
+
// simulate inputs on completion.
|
|
83
|
+
simulateItems?: array<Internal.item>,
|
|
74
84
|
}
|
|
@@ -680,6 +680,13 @@ let executeQuery = async (
|
|
|
680
680
|
~partitionId=query.partitionId,
|
|
681
681
|
~knownHeight,
|
|
682
682
|
~selection=query.selection,
|
|
683
|
+
// Ceil (not truncate) so a sub-1 estimate from a sparse partition over a
|
|
684
|
+
// small range doesn't round down to 0 and ask the backend to cap the
|
|
685
|
+
// response at nothing — 0 items is indistinguishable from "no signal".
|
|
686
|
+
~itemsTarget={
|
|
687
|
+
let est = query.estResponseSize->Math.ceil->Float.toInt
|
|
688
|
+
est > 0 ? est : FetchState.minEstResponseSize->Float.toInt
|
|
689
|
+
},
|
|
683
690
|
~retry,
|
|
684
691
|
~logger,
|
|
685
692
|
)
|
|
@@ -500,7 +500,8 @@ async function executeQuery(sourceManager, query, knownHeight, isRealtime) {
|
|
|
500
500
|
retry: retry
|
|
501
501
|
});
|
|
502
502
|
try {
|
|
503
|
-
let
|
|
503
|
+
let est = Math.ceil(query.estResponseSize) | 0;
|
|
504
|
+
let response = await source.getItemsOrThrow(query.fromBlock, toBlock, query.addressesByContractName, FetchState.deriveContractNameByAddress(query.addressesByContractName), knownHeight, query.partitionId, query.selection, est > 0 ? est : FetchState.minEstResponseSize | 0, retry, logger$2);
|
|
504
505
|
sourceState.lastFailedAt = undefined;
|
|
505
506
|
responseRef = response;
|
|
506
507
|
} catch (raw_error) {
|
package/src/sources/Svm.res
CHANGED
|
@@ -101,6 +101,7 @@ let makeRPCSource = (~chain, ~rpc: string, ~sourceFor: Source.sourceFor=Sync): S
|
|
|
101
101
|
~knownHeight as _,
|
|
102
102
|
~partitionId as _,
|
|
103
103
|
~selection as _,
|
|
104
|
+
~itemsTarget as _,
|
|
104
105
|
~retry as _,
|
|
105
106
|
~logger as _,
|
|
106
107
|
) => JsError.throwWithMessage("Svm does not support getting items"),
|
package/src/sources/Svm.res.mjs
CHANGED
|
@@ -76,7 +76,7 @@ function makeRPCSource(chain, rpc, sourceForOpt) {
|
|
|
76
76
|
Prometheus.SourceRequestCount.addSeconds(name, chain, "getSlot", seconds);
|
|
77
77
|
return height;
|
|
78
78
|
},
|
|
79
|
-
getItemsOrThrow: (param, param$1, param$2, param$3, param$4, param$5, param$6, param$7, param$8) => Stdlib_JsError.throwWithMessage("Svm does not support getting items")
|
|
79
|
+
getItemsOrThrow: (param, param$1, param$2, param$3, param$4, param$5, param$6, param$7, param$8, param$9) => Stdlib_JsError.throwWithMessage("Svm does not support getting items")
|
|
80
80
|
};
|
|
81
81
|
}
|
|
82
82
|
|
|
@@ -340,6 +340,7 @@ let make = ({chain, endpointUrl, apiToken, eventConfigs, clientTimeoutMillis}: o
|
|
|
340
340
|
~knownHeight,
|
|
341
341
|
~partitionId as _,
|
|
342
342
|
~selection as _,
|
|
343
|
+
~itemsTarget,
|
|
343
344
|
~retry,
|
|
344
345
|
~logger,
|
|
345
346
|
) => {
|
|
@@ -368,6 +369,7 @@ let make = ({chain, endpointUrl, apiToken, eventConfigs, clientTimeoutMillis}: o
|
|
|
368
369
|
toSlot: ?(toBlock->Option.map(toBlock => toBlock + 1)),
|
|
369
370
|
instructions: instructionSelections,
|
|
370
371
|
fields,
|
|
372
|
+
maxNumInstructions: itemsTarget,
|
|
371
373
|
}
|
|
372
374
|
|
|
373
375
|
Prometheus.SourceRequestCount.increment(~sourceName=name, ~chainId, ~method="getInstructions")
|
|
@@ -288,7 +288,7 @@ function make(param) {
|
|
|
288
288
|
return true;
|
|
289
289
|
}
|
|
290
290
|
});
|
|
291
|
-
let getItemsOrThrow = async (fromBlock, toBlock, param, contractNameByAddress, knownHeight, param$1, param$2, retry, logger) => {
|
|
291
|
+
let getItemsOrThrow = async (fromBlock, toBlock, param, contractNameByAddress, knownHeight, param$1, param$2, itemsTarget, retry, logger) => {
|
|
292
292
|
let totalTimeRef = Performance.now();
|
|
293
293
|
let pageFetchRef = Performance.now();
|
|
294
294
|
let instructionSelections = buildInstructionSelections(eventConfigs);
|
|
@@ -323,11 +323,13 @@ function make(param) {
|
|
|
323
323
|
let query_toSlot = Stdlib_Option.map(toBlock, toBlock => toBlock + 1 | 0);
|
|
324
324
|
let query_instructions = instructionSelections;
|
|
325
325
|
let query_fields = fields$1;
|
|
326
|
+
let query_maxNumInstructions = itemsTarget;
|
|
326
327
|
let query = {
|
|
327
328
|
fromSlot: fromBlock,
|
|
328
329
|
toSlot: query_toSlot,
|
|
329
330
|
instructions: query_instructions,
|
|
330
|
-
fields: query_fields
|
|
331
|
+
fields: query_fields,
|
|
332
|
+
maxNumInstructions: query_maxNumInstructions
|
|
331
333
|
};
|
|
332
334
|
Prometheus.SourceRequestCount.increment(name, chain, "getInstructions");
|
|
333
335
|
let match;
|