envio 3.15.0-subgraph → 3.16.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 (186) hide show
  1. package/README.md +40 -34
  2. package/evm.schema.json +3 -3
  3. package/fuel.schema.json +2 -2
  4. package/index.d.ts +3 -3
  5. package/licenses/README.md +1 -1
  6. package/package.json +9 -10
  7. package/src/Batch.res.mjs +5 -5
  8. package/src/BatchProcessing.res +1 -0
  9. package/src/BatchProcessing.res.mjs +1 -0
  10. package/src/Bin.res +0 -7
  11. package/src/Bin.res.mjs +0 -8
  12. package/src/ChainFetching.res +17 -456
  13. package/src/ChainFetching.res.mjs +33 -404
  14. package/src/ChainState.res +48 -83
  15. package/src/ChainState.res.mjs +83 -115
  16. package/src/ChainState.resi +0 -26
  17. package/src/Clock.res +57 -0
  18. package/src/Clock.res.mjs +72 -0
  19. package/src/Config.res +7 -16
  20. package/src/Config.res.mjs +4 -11
  21. package/src/ContractRegisterContext.res +6 -3
  22. package/src/ContractRegisterContext.res.mjs +2 -4
  23. package/src/Core.res +5 -136
  24. package/src/Core.res.mjs +1 -90
  25. package/src/CrossChainState.res +2 -8
  26. package/src/CrossChainState.res.mjs +3 -3
  27. package/src/Ecosystem.res +4 -7
  28. package/src/Ecosystem.res.mjs +8 -8
  29. package/src/EffectState.res +10 -2
  30. package/src/EffectState.res.mjs +8 -4
  31. package/src/EffectState.resi +3 -1
  32. package/src/EntityId.res +2 -7
  33. package/src/EntityId.res.mjs +1 -8
  34. package/src/EntityTables.res +4 -1
  35. package/src/EntityTables.res.mjs +1 -1
  36. package/src/Env.res +0 -16
  37. package/src/Env.res.mjs +0 -11
  38. package/src/EventProcessing.res +1 -38
  39. package/src/EventProcessing.res.mjs +1 -28
  40. package/src/FetchState.res +160 -319
  41. package/src/FetchState.res.mjs +182 -292
  42. package/src/FinalizeBackfill.res +2 -4
  43. package/src/FinalizeBackfill.res.mjs +3 -4
  44. package/src/HandlerLoader.res +15 -39
  45. package/src/HandlerLoader.res.mjs +8 -27
  46. package/src/HandlerRegister.res +0 -4
  47. package/src/HandlerRegister.res.mjs +2 -5
  48. package/src/HandlerRegister.resi +0 -2
  49. package/src/InMemoryTable.res +17 -16
  50. package/src/InMemoryTable.res.mjs +14 -15
  51. package/src/IndexerState.res +28 -4
  52. package/src/IndexerState.res.mjs +19 -6
  53. package/src/IndexerState.resi +4 -0
  54. package/src/Internal.res +0 -110
  55. package/src/Internal.res.mjs +1 -115
  56. package/src/LoadLayer.res +21 -47
  57. package/src/LoadLayer.res.mjs +47 -72
  58. package/src/LoadLayer.resi +0 -26
  59. package/src/Main.res +1 -14
  60. package/src/Main.res.mjs +3 -4
  61. package/src/Persistence.res +3 -23
  62. package/src/Persistence.res.mjs +3 -3
  63. package/src/Rollback.res +0 -1
  64. package/src/Rollback.res.mjs +1 -1
  65. package/src/RunScope.res +0 -3
  66. package/src/SafeCheckpointTracking.res +4 -4
  67. package/src/SafeCheckpointTracking.res.mjs +1 -1
  68. package/src/SimulateItems.res +26 -42
  69. package/src/SimulateItems.res.mjs +16 -40
  70. package/src/StagedRows.res +106 -0
  71. package/src/StagedRows.res.mjs +102 -0
  72. package/src/Staging.res +32 -14
  73. package/src/Staging.res.mjs +17 -20
  74. package/src/Storage.res +277 -998
  75. package/src/Storage.res.mjs +216 -731
  76. package/src/Supervisor.res +75 -56
  77. package/src/Supervisor.res.mjs +55 -26
  78. package/src/TestIndexer.res +22 -27
  79. package/src/TestIndexer.res.mjs +20 -17
  80. package/src/Throttler.res +15 -8
  81. package/src/Throttler.res.mjs +9 -6
  82. package/src/Throttler.resi +1 -1
  83. package/src/UserContext.res +46 -410
  84. package/src/UserContext.res.mjs +30 -318
  85. package/src/Utils.res +0 -23
  86. package/src/Utils.res.mjs +1 -17
  87. package/src/Writing.res +0 -1
  88. package/src/Writing.res.mjs +1 -1
  89. package/src/bindings/ClickHouse.res +0 -322
  90. package/src/bindings/ClickHouse.res.mjs +0 -338
  91. package/src/bindings/StorageClient.res +107 -175
  92. package/src/bindings/StorageClient.res.mjs +19 -8
  93. package/src/bindings/Vitest.res +0 -26
  94. package/src/bindings/Vitest.res.mjs +0 -3
  95. package/src/db/Table.res +24 -150
  96. package/src/db/Table.res.mjs +38 -272
  97. package/src/sources/AddressSet.res +0 -2
  98. package/src/sources/AddressStore.res +0 -3
  99. package/src/sources/ChainSources.res +2 -0
  100. package/src/sources/ChainSources.res.mjs +2 -2
  101. package/src/sources/EvmChain.res +4 -7
  102. package/src/sources/EvmChain.res.mjs +5 -4
  103. package/src/sources/EvmHyperSyncSource.res +2 -2
  104. package/src/sources/EvmHyperSyncSource.res.mjs +1 -1
  105. package/src/sources/EvmRpcClient.res +13 -3
  106. package/src/sources/EvmRpcClient.res.mjs +4 -3
  107. package/src/sources/EvmRpcWs.res +4 -3
  108. package/src/sources/EvmRpcWs.res.mjs +2 -2
  109. package/src/sources/HeightFeed.res +31 -10
  110. package/src/sources/HeightFeed.res.mjs +10 -6
  111. package/src/sources/HeightStream.res +32 -17
  112. package/src/sources/HeightStream.res.mjs +10 -10
  113. package/src/sources/HyperSync.res +1 -2
  114. package/src/sources/HyperSync.res.mjs +1 -2
  115. package/src/sources/HyperSyncSSE.res +4 -6
  116. package/src/sources/HyperSyncSSE.res.mjs +2 -2
  117. package/src/sources/RpcSource.res +10 -1
  118. package/src/sources/RpcSource.res.mjs +4 -3
  119. package/src/sources/Source.res +3 -0
  120. package/src/sources/SourceManager.res +85 -104
  121. package/src/sources/SourceManager.res.mjs +18 -37
  122. package/src/sources/SourceManager.resi +3 -5
  123. package/src/sources/StartBlockResolver.res +1 -0
  124. package/src/sources/StartBlockResolver.res.mjs +4 -3
  125. package/src/sources/SvmHyperSyncSource.res +2 -2
  126. package/src/sources/SvmHyperSyncSource.res.mjs +1 -1
  127. package/svm.schema.json +3 -3
  128. package/src/EffectCacheLookup.res +0 -98
  129. package/src/EffectCacheLookup.res.mjs +0 -116
  130. package/src/PgWriting.res +0 -36
  131. package/src/PgWriting.res.mjs +0 -34
  132. package/src/PreloadLookahead.res +0 -184
  133. package/src/PreloadLookahead.res.mjs +0 -197
  134. package/src/SubgraphLog.res +0 -19
  135. package/src/SubgraphLog.res.mjs +0 -26
  136. package/src/SyncWrites.res +0 -101
  137. package/src/SyncWrites.res.mjs +0 -98
  138. package/src/db/IndexDefinition.res +0 -47
  139. package/src/db/IndexDefinition.res.mjs +0 -60
  140. package/src/sources/CallSource.res +0 -274
  141. package/src/sources/CallSource.res.mjs +0 -196
  142. package/src/subgraph/abi-types.ts +0 -84
  143. package/src/subgraph/aggregations.ts +0 -745
  144. package/src/subgraph/as-package.ts +0 -143
  145. package/src/subgraph/assemblyscript-regex.ts +0 -67
  146. package/src/subgraph/assemblyscript.ts +0 -731
  147. package/src/subgraph/blocks.ts +0 -398
  148. package/src/subgraph/calls-source.ts +0 -702
  149. package/src/subgraph/calls.ts +0 -258
  150. package/src/subgraph/conformance.ts +0 -106
  151. package/src/subgraph/errors.ts +0 -85
  152. package/src/subgraph/graft.ts +0 -73
  153. package/src/subgraph/graph-cli-worker.mjs +0 -35
  154. package/src/subgraph/graph-cli.ts +0 -900
  155. package/src/subgraph/graph-node-decimal.ts +0 -199
  156. package/src/subgraph/graph-ts-enums.ts +0 -28
  157. package/src/subgraph/graph-ts-types/VERSION +0 -2
  158. package/src/subgraph/graph-ts-types/chain/arweave.d.ts +0 -70
  159. package/src/subgraph/graph-ts-types/chain/cosmos.d.ts +0 -327
  160. package/src/subgraph/graph-ts-types/chain/ethereum.d.ts +0 -233
  161. package/src/subgraph/graph-ts-types/chain/near.d.ts +0 -253
  162. package/src/subgraph/graph-ts-types/chain/starknet.d.ts +0 -32
  163. package/src/subgraph/graph-ts-types/common/collections.d.ts +0 -136
  164. package/src/subgraph/graph-ts-types/common/conversion.d.ts +0 -11
  165. package/src/subgraph/graph-ts-types/common/datasource.d.ts +0 -30
  166. package/src/subgraph/graph-ts-types/common/eager-offset.d.ts +0 -0
  167. package/src/subgraph/graph-ts-types/common/json.d.ts +0 -17
  168. package/src/subgraph/graph-ts-types/common/numbers.d.ts +0 -120
  169. package/src/subgraph/graph-ts-types/common/value.d.ts +0 -120
  170. package/src/subgraph/graph-ts-types/common/yaml.d.ts +0 -90
  171. package/src/subgraph/graph-ts-types/global/global.d.ts +0 -194
  172. package/src/subgraph/graph-ts-types/helper-functions.d.ts +0 -22
  173. package/src/subgraph/graph-ts-types/index.d.ts +0 -102
  174. package/src/subgraph/graph-ts.ts +0 -4280
  175. package/src/subgraph/hosts.ts +0 -554
  176. package/src/subgraph/log.ts +0 -28
  177. package/src/subgraph/receipts.ts +0 -184
  178. package/src/subgraph/register-slots.ts +0 -93
  179. package/src/subgraph/rollup.ts +0 -109
  180. package/src/subgraph/rpc.ts +0 -337
  181. package/src/subgraph/runtime.ts +0 -2060
  182. package/src/subgraph/scope.ts +0 -177
  183. package/src/subgraph/stats.ts +0 -42
  184. package/src/subgraph/template-instances.ts +0 -66
  185. package/src/subgraph/toolchain.ts +0 -327
  186. package/src/subgraph/transient.ts +0 -176
@@ -4,7 +4,6 @@ import * as Env from "./Env.res.mjs";
4
4
  import * as Utils from "./Utils.res.mjs";
5
5
  import * as ChainId from "./ChainId.res.mjs";
6
6
  import * as Js_math from "@rescript/runtime/lib/es6/Js_math.js";
7
- import * as Internal from "./Internal.res.mjs";
8
7
  import * as BlockItem from "./sources/BlockItem.res.mjs";
9
8
  import * as AddressSet from "./sources/AddressSet.res.mjs";
10
9
  import * as Belt_Array from "@rescript/runtime/lib/es6/Belt_Array.js";
@@ -794,77 +793,6 @@ function compareTiebreak(a, b) {
794
793
  }
795
794
  }
796
795
 
797
- function blockOrderRank(item) {
798
- let round = item.runsAfterBlock;
799
- if (round !== undefined) {
800
- return 3 + round | 0;
801
- } else if (item.kind !== 0) {
802
- if (Internal.itemRunsFirst(item)) {
803
- return -1;
804
- } else {
805
- return 3;
806
- }
807
- } else if (item.callRank === 2) {
808
- return 2;
809
- } else {
810
- return 0;
811
- }
812
- }
813
-
814
- function compareWithCalls(a, b) {
815
- let ra = blockOrderRank(a);
816
- let rb = blockOrderRank(b);
817
- if (ra !== rb) {
818
- if (ra < rb) {
819
- return -1;
820
- } else {
821
- return 1;
822
- }
823
- }
824
- if (ra === 3 || ra === -1) {
825
- let la = a.logIndex;
826
- let lb = b.logIndex;
827
- if (la !== lb) {
828
- if (la < lb) {
829
- return -1;
830
- } else {
831
- return 1;
832
- }
833
- } else {
834
- return compareTiebreak(a, b);
835
- }
836
- }
837
- let ta = a.transactionIndex;
838
- let tb = b.transactionIndex;
839
- if (ta !== tb) {
840
- if (ta < tb) {
841
- return -1;
842
- } else {
843
- return 1;
844
- }
845
- }
846
- let ca = Stdlib_Option.isSome(a.callRank) ? 1 : 0;
847
- let cb = Stdlib_Option.isSome(b.callRank) ? 1 : 0;
848
- if (ca !== cb) {
849
- if (ca < cb) {
850
- return -1;
851
- } else {
852
- return 1;
853
- }
854
- }
855
- let la$1 = a.logIndex;
856
- let lb$1 = b.logIndex;
857
- if (la$1 !== lb$1) {
858
- if (la$1 < lb$1) {
859
- return -1;
860
- } else {
861
- return 1;
862
- }
863
- } else {
864
- return compareTiebreak(a, b);
865
- }
866
- }
867
-
868
796
  function compareBufferItem(a, b) {
869
797
  let ba = a.blockNumber;
870
798
  let bb = b.blockNumber;
@@ -875,29 +803,8 @@ function compareBufferItem(a, b) {
875
803
  return 1;
876
804
  }
877
805
  }
878
- if (Internal.callOrderingActive.contents) {
879
- return compareWithCalls(a, b);
880
- }
881
- let round = a.runsAfterBlock;
882
- let ka;
883
- if (round !== undefined) {
884
- ka = 1 + round | 0;
885
- } else {
886
- let kind = a.kind;
887
- ka = kind !== 0 ? (
888
- Internal.itemRunsFirst(a) ? -1 : kind
889
- ) : 0;
890
- }
891
- let round$1 = b.runsAfterBlock;
892
- let kb;
893
- if (round$1 !== undefined) {
894
- kb = 1 + round$1 | 0;
895
- } else {
896
- let kind$1 = b.kind;
897
- kb = kind$1 !== 0 ? (
898
- Internal.itemRunsFirst(b) ? -1 : kind$1
899
- ) : 0;
900
- }
806
+ let ka = a.kind;
807
+ let kb = b.kind;
901
808
  if (ka !== kb) {
902
809
  if (ka < kb) {
903
810
  return -1;
@@ -919,7 +826,7 @@ function compareBufferItem(a, b) {
919
826
  }
920
827
 
921
828
  function isSameLog(a, b) {
922
- if (a.kind !== 0 || b.kind !== 0 || a.callRank !== b.callRank || a.blockNumber !== b.blockNumber || a.logIndex !== b.logIndex) {
829
+ if (a.kind !== 0 || b.kind !== 0 || a.blockNumber !== b.blockNumber || a.logIndex !== b.logIndex) {
923
830
  return false;
924
831
  }
925
832
  let match = a.orderPath;
@@ -1022,9 +929,7 @@ function updateInternal(fetchState, optimizedPartitionsOpt, mutItems, mutItemsSo
1022
929
  tmp = latestFullyFetchedBlock !== undefined ? latestFullyFetchedBlock : knownHeight;
1023
930
  }
1024
931
  let maxBlockNumber = Primitive_int.min(tmp, knownHeight);
1025
- let through = fetchState.blockRegisterThrough;
1026
- let maxBlockNumber$1 = through !== undefined ? Primitive_int.min(maxBlockNumber, through) : maxBlockNumber;
1027
- latestOnBlockBlockNumber = appendOnBlockItems(blockItems, onBlockRegistrations, fetchState.startBlock, fetchState.latestOnBlockBlockNumber, maxBlockNumber$1, fetchState.maxOnBlockBufferSize);
932
+ latestOnBlockBlockNumber = appendOnBlockItems(blockItems, onBlockRegistrations, fetchState.startBlock, fetchState.latestOnBlockBlockNumber, maxBlockNumber, fetchState.maxOnBlockBufferSize);
1028
933
  } else {
1029
934
  latestOnBlockBlockNumber = knownHeight;
1030
935
  }
@@ -1036,28 +941,47 @@ function updateInternal(fetchState, optimizedPartitionsOpt, mutItems, mutItemsSo
1036
941
  chainId: fetchState.chainId,
1037
942
  latestOnBlockBlockNumber: latestOnBlockBlockNumber,
1038
943
  blockLag: blockLag,
944
+ blockThrottle: fetchState.blockThrottle,
1039
945
  buffer: blockItems.length !== 0 ? mergeIntoBuffer(base, blockItems) : base,
1040
946
  maxOnBlockBufferSize: fetchState.maxOnBlockBufferSize,
1041
947
  onBlockRegistrations: fetchState.onBlockRegistrations,
1042
948
  knownHeight: knownHeight,
1043
949
  firstEventBlock: fetchState.firstEventBlock,
1044
- clientFilterAddressThreshold: fetchState.clientFilterAddressThreshold,
1045
- creationBlocks: fetchState.creationBlocks,
1046
- blockRegisterThrough: fetchState.blockRegisterThrough
950
+ clientFilterPolicy: fetchState.clientFilterPolicy
1047
951
  };
1048
952
  }
1049
953
 
1050
- function addClientFilteredContract(clientFilteredContracts, contractName, onNotice, addressCount, threshold, isAlreadyReportedOpt) {
954
+ function switchToClientSideFiltering(clientFilteredContracts, contractNames, policy, dynamicContracts, addressStore, onNotice, isAlreadyReportedOpt) {
1051
955
  let isAlreadyReported = isAlreadyReportedOpt !== undefined ? isAlreadyReportedOpt : false;
1052
- clientFilteredContracts.add(contractName);
1053
- if (!isAlreadyReported) {
1054
- return onNotice({
1055
- TAG: "SwitchedToClientSideFiltering",
1056
- contractName: contractName,
1057
- addressCount: addressCount,
1058
- threshold: threshold
1059
- });
1060
- }
956
+ let switched = new Set(Array.from(clientFilteredContracts));
957
+ contractNames.forEach(contractName => {
958
+ if (switched.has(contractName)) {
959
+ return;
960
+ }
961
+ if (policy.allDynamicContracts && dynamicContracts.has(contractName)) {
962
+ switched.add(contractName);
963
+ return;
964
+ }
965
+ let threshold = policy.addressThreshold;
966
+ if (threshold === undefined) {
967
+ return;
968
+ }
969
+ let addressCount = addressStore.contractCount(contractName);
970
+ if (addressCount > threshold) {
971
+ switched.add(contractName);
972
+ if (!isAlreadyReported) {
973
+ return onNotice({
974
+ TAG: "SwitchedToClientSideFiltering",
975
+ contractName: contractName,
976
+ addressCount: addressCount,
977
+ threshold: threshold
978
+ });
979
+ } else {
980
+ return;
981
+ }
982
+ }
983
+ });
984
+ return switched;
1061
985
  }
1062
986
 
1063
987
  function claimedFetchedBlock(p, knownHeight) {
@@ -1383,43 +1307,6 @@ function createPartitions(registeringSetsByContract, addressStore, dynamicContra
1383
1307
  return make(allPartitions, maxAddrInPartition, nextPartitionIndexRef.contents, dynamicContracts, clientFilteredContracts);
1384
1308
  }
1385
1309
 
1386
- function creationBlockKey(contractName, address) {
1387
- return contractName + `:` + address.toLowerCase();
1388
- }
1389
-
1390
- function markCreationBlockEvents(creationBlocks, newItems, fetchedThrough) {
1391
- Object.entries(creationBlocks).forEach(param => {
1392
- if (param[1].block < fetchedThrough) {
1393
- return Utils.Dict.deleteInPlace(creationBlocks, param[0]);
1394
- }
1395
- });
1396
- newItems.forEach(item => {
1397
- if (item.kind !== 0) {
1398
- return;
1399
- }
1400
- let key = creationBlockKey(item.onEventRegistration.eventConfig.contractName, item.payload.srcAddress);
1401
- let match = creationBlocks[key];
1402
- if (match !== undefined && match.block === item.blockNumber) {
1403
- item.runsAfterBlock = match.round;
1404
- return;
1405
- }
1406
- });
1407
- }
1408
-
1409
- function creationRoundOfRegistration(fetchState, item) {
1410
- let creationBlocks = fetchState.creationBlocks;
1411
- if (creationBlocks === undefined) {
1412
- return 1;
1413
- }
1414
- let key = creationBlockKey(item.onEventRegistration.eventConfig.contractName, item.payload.srcAddress);
1415
- let match = creationBlocks[key];
1416
- if (match !== undefined && match.block === item.blockNumber) {
1417
- return match.round + 1 | 0;
1418
- } else {
1419
- return 1;
1420
- }
1421
- }
1422
-
1423
1310
  function registerDynamicContracts(fetchState, addressStore, onNotice, claimCeilingOpt, registrations) {
1424
1311
  let claimCeiling = claimCeilingOpt !== undefined ? claimCeilingOpt : fetchState.knownHeight;
1425
1312
  if (Utils.$$Array.isEmpty(fetchState.normalSelection.onEventRegistrations)) {
@@ -1434,17 +1321,8 @@ function registerDynamicContracts(fetchState, addressStore, onNotice, claimCeili
1434
1321
  let exit = 0;
1435
1322
  if (typeof verdict !== "object" || verdict.TAG !== "Added") {
1436
1323
  exit = 1;
1437
- } else if (verdict.fetchable) {
1438
- let creationBlocks = fetchState.creationBlocks;
1439
- if (creationBlocks !== undefined) {
1440
- creationBlocks[creationBlockKey(registration.contractName, registration.address)] = {
1441
- block: registration.registrationBlock,
1442
- round: Stdlib_Option.getOr(registration.creationRound, 1)
1443
- };
1444
- }
1445
- if (!registeringContractNames.includes(registration.contractName)) {
1446
- registeringContractNames.push(registration.contractName);
1447
- }
1324
+ } else if (verdict.fetchable && !registeringContractNames.includes(registration.contractName)) {
1325
+ registeringContractNames.push(registration.contractName);
1448
1326
  }
1449
1327
  if (exit === 1) {
1450
1328
  reportRejectedRegistration(verdict, onNotice, registration.address, registration.contractName);
@@ -1505,20 +1383,7 @@ function registerDynamicContracts(fetchState, addressStore, onNotice, claimCeili
1505
1383
  }
1506
1384
  }
1507
1385
  }
1508
- let threshold = fetchState.clientFilterAddressThreshold;
1509
- let clientFilteredContracts;
1510
- if (threshold !== undefined) {
1511
- let clientFilteredContracts$1 = new Set(Array.from(fetchState.optimizedPartitions.clientFilteredContracts));
1512
- Array.from(dynamicContractsRef).forEach(contractName => {
1513
- let addressCount = addressStore.contractCount(contractName);
1514
- if (!clientFilteredContracts$1.has(contractName) && addressCount > threshold) {
1515
- return addClientFilteredContract(clientFilteredContracts$1, contractName, onNotice, addressCount, threshold, undefined);
1516
- }
1517
- });
1518
- clientFilteredContracts = clientFilteredContracts$1;
1519
- } else {
1520
- clientFilteredContracts = fetchState.optimizedPartitions.clientFilteredContracts;
1521
- }
1386
+ let clientFilteredContracts = switchToClientSideFiltering(fetchState.optimizedPartitions.clientFilteredContracts, Array.from(dynamicContractsRef), fetchState.clientFilterPolicy, dynamicContractsRef, addressStore, onNotice, undefined);
1522
1387
  let registeringSetsByContract = {};
1523
1388
  registeringContractNames.forEach(contractName => {
1524
1389
  registeringSetsByContract[contractName] = AddressStore.makeSet(addressStore, contractName, {
@@ -1529,79 +1394,57 @@ function registerDynamicContracts(fetchState, addressStore, onNotice, claimCeili
1529
1394
  return updateInternal(fetchState, optimizedPartitions, undefined, undefined, undefined, undefined);
1530
1395
  }
1531
1396
 
1532
- function handleQueryResult(fetchState, query, latestFetchedBlock, newItems) {
1533
- let tmp;
1534
- if (newItems.length !== 0) {
1535
- let creationBlocks = fetchState.creationBlocks;
1536
- if (creationBlocks !== undefined) {
1537
- markCreationBlockEvents(creationBlocks, newItems, bufferBlockNumber(fetchState));
1538
- }
1539
- tmp = mergeIntoBuffer(fetchState.buffer, newItems);
1540
- } else {
1541
- tmp = undefined;
1542
- }
1543
- return updateInternal(fetchState, handleQueryResponse(fetchState.optimizedPartitions, query, fetchState.knownHeight, newItems.length, latestFetchedBlock), tmp, true, undefined, undefined);
1544
- }
1545
-
1546
- function capAtEndBlock(fetchState, block) {
1547
- let endBlock = fetchState.endBlock;
1548
- if (endBlock !== undefined) {
1549
- return Primitive_int.min(block, endBlock);
1550
- } else {
1551
- return block;
1552
- }
1553
- }
1554
-
1555
- function canAdvanceBlockRegisters(fetchState, through) {
1556
- let after = fetchState.blockRegisterThrough;
1557
- if (after !== undefined) {
1558
- return capAtEndBlock(fetchState, through) > after;
1559
- } else {
1560
- return false;
1561
- }
1562
- }
1563
-
1564
- function blockRegisterItemsAfter(fetchState, after, through, limit) {
1565
- let match = fetchState.blockRegisterThrough;
1566
- if (match === undefined) {
1567
- return;
1568
- }
1569
- if (capAtEndBlock(fetchState, through) <= after) {
1570
- return;
1571
- }
1572
- let through$1 = capAtEndBlock(fetchState, through);
1573
- let items = [];
1574
- let covered = appendOnBlockItems(items, fetchState.onBlockRegistrations.filter(r => r.contractRegister !== undefined), fetchState.startBlock, after, through$1, limit);
1575
- return [
1576
- items,
1577
- covered
1578
- ];
1579
- }
1580
-
1581
- function nextBlockRegisterItems(fetchState, through, limit) {
1582
- let after = fetchState.blockRegisterThrough;
1583
- if (after !== undefined) {
1584
- return blockRegisterItemsAfter(fetchState, after, through, limit);
1585
- }
1586
- }
1587
-
1588
- function setBlockRegisterThrough(fetchState, through) {
1589
- let current = fetchState.blockRegisterThrough;
1590
- if (current === undefined) {
1397
+ function switchDynamicContractsToClientSideFiltering(fetchState, addressStore) {
1398
+ if (fetchState.clientFilterPolicy.allDynamicContracts) {
1591
1399
  return fetchState;
1592
1400
  }
1593
- if (through <= current) {
1594
- return fetchState;
1401
+ let init = fetchState.clientFilterPolicy;
1402
+ let fetchState_optimizedPartitions = fetchState.optimizedPartitions;
1403
+ let fetchState_startBlock = fetchState.startBlock;
1404
+ let fetchState_endBlock = fetchState.endBlock;
1405
+ let fetchState_normalSelection = fetchState.normalSelection;
1406
+ let fetchState_chainId = fetchState.chainId;
1407
+ let fetchState_latestOnBlockBlockNumber = fetchState.latestOnBlockBlockNumber;
1408
+ let fetchState_blockLag = fetchState.blockLag;
1409
+ let fetchState_blockThrottle = fetchState.blockThrottle;
1410
+ let fetchState_buffer = fetchState.buffer;
1411
+ let fetchState_maxOnBlockBufferSize = fetchState.maxOnBlockBufferSize;
1412
+ let fetchState_onBlockRegistrations = fetchState.onBlockRegistrations;
1413
+ let fetchState_knownHeight = fetchState.knownHeight;
1414
+ let fetchState_firstEventBlock = fetchState.firstEventBlock;
1415
+ let fetchState_clientFilterPolicy = {
1416
+ addressThreshold: init.addressThreshold,
1417
+ allDynamicContracts: true
1418
+ };
1419
+ let fetchState$1 = {
1420
+ optimizedPartitions: fetchState_optimizedPartitions,
1421
+ startBlock: fetchState_startBlock,
1422
+ endBlock: fetchState_endBlock,
1423
+ normalSelection: fetchState_normalSelection,
1424
+ chainId: fetchState_chainId,
1425
+ latestOnBlockBlockNumber: fetchState_latestOnBlockBlockNumber,
1426
+ blockLag: fetchState_blockLag,
1427
+ blockThrottle: fetchState_blockThrottle,
1428
+ buffer: fetchState_buffer,
1429
+ maxOnBlockBufferSize: fetchState_maxOnBlockBufferSize,
1430
+ onBlockRegistrations: fetchState_onBlockRegistrations,
1431
+ knownHeight: fetchState_knownHeight,
1432
+ firstEventBlock: fetchState_firstEventBlock,
1433
+ clientFilterPolicy: fetchState_clientFilterPolicy
1434
+ };
1435
+ let match = fetchState_optimizedPartitions;
1436
+ let clientFilteredContracts = match.clientFilteredContracts;
1437
+ let dynamicContracts = match.dynamicContracts;
1438
+ let switched = new Set(Array.from(clientFilteredContracts).concat(Array.from(dynamicContracts)));
1439
+ if (switched.size === clientFilteredContracts.size) {
1440
+ return fetchState$1;
1441
+ } else {
1442
+ return updateInternal(fetchState$1, createPartitions({}, addressStore, dynamicContracts, switched, fetchState_normalSelection, match.maxAddrInPartition, match.nextPartitionIndex, Object.values(fetchState_optimizedPartitions.entities), 0, fetchState_knownHeight), undefined, undefined, undefined, undefined);
1595
1443
  }
1596
- let newrecord = {...fetchState};
1597
- return updateInternal((newrecord.blockRegisterThrough = through, newrecord), undefined, undefined, undefined, undefined, undefined);
1598
1444
  }
1599
1445
 
1600
- function blockRegisterFrontier(fetchState) {
1601
- let optimizedPartitions = fetchState.optimizedPartitions;
1602
- let id = optimizedPartitions.idsInAscOrder[0];
1603
- let block = id !== undefined ? optimizedPartitions.entities[id].latestFetchedBlock : undefined;
1604
- return capAtEndBlock(fetchState, block !== undefined ? Primitive_int.min(block, fetchState.knownHeight) : fetchState.knownHeight);
1446
+ function handleQueryResult(fetchState, query, latestFetchedBlock, newItems) {
1447
+ return updateInternal(fetchState, handleQueryResponse(fetchState.optimizedPartitions, query, fetchState.knownHeight, newItems.length, latestFetchedBlock), newItems.length !== 0 ? mergeIntoBuffer(fetchState.buffer, newItems) : undefined, true, undefined, undefined);
1605
1448
  }
1606
1449
 
1607
1450
  function startFetchingQueries(param, queries) {
@@ -1838,15 +1681,30 @@ function acceptCandidates(candidates, reservations, chainTargetItems, partitionI
1838
1681
  };
1839
1682
  }
1840
1683
 
1841
- function getNextQuery(param, chainTargetBlock, chainTargetItems) {
1842
- let blockLag = param.blockLag;
1684
+ function blocksBehindHeadAllowedByThrottle(param) {
1685
+ let blockThrottle = param.blockThrottle;
1843
1686
  let endBlock = param.endBlock;
1844
- let optimizedPartitions = param.optimizedPartitions;
1845
- let headBlockNumber = param.knownHeight - blockLag | 0;
1687
+ if (endBlock !== undefined && (param.knownHeight - param.blockLag | 0) >= endBlock) {
1688
+ return 0;
1689
+ } else {
1690
+ return Primitive_int.max(0, blockThrottle - 1 | 0);
1691
+ }
1692
+ }
1693
+
1694
+ function headFetchTarget(fetchState) {
1695
+ return (fetchState.knownHeight - fetchState.blockLag | 0) - blocksBehindHeadAllowedByThrottle(fetchState) | 0;
1696
+ }
1697
+
1698
+ function getNextQuery(fetchState, chainTargetBlock, chainTargetItems) {
1699
+ let blockLag = fetchState.blockLag;
1700
+ let endBlock = fetchState.endBlock;
1701
+ let optimizedPartitions = fetchState.optimizedPartitions;
1702
+ let headBlockNumber = fetchState.knownHeight - blockLag | 0;
1846
1703
  if (headBlockNumber <= 0) {
1847
1704
  return "WaitingForNewBlock";
1848
1705
  }
1849
- let isOnBlockBehindTheHead = param.latestOnBlockBlockNumber < headBlockNumber;
1706
+ let caughtUpBlockNumber = headBlockNumber - blocksBehindHeadAllowedByThrottle(fetchState) | 0;
1707
+ let isOnBlockBehindTheHead = fetchState.latestOnBlockBlockNumber < caughtUpBlockNumber;
1850
1708
  let shouldWaitForNewBlock = (
1851
1709
  endBlock !== undefined ? headBlockNumber < endBlock : true
1852
1710
  ) && !isOnBlockBehindTheHead;
@@ -1872,7 +1730,7 @@ function getNextQuery(param, chainTargetBlock, chainTargetItems) {
1872
1730
  }
1873
1731
  }
1874
1732
  inFlightCounts[idx] = inFlightCount;
1875
- if (p.mutPendingQueries.length !== 0 || p.latestFetchedBlock < headBlockNumber) {
1733
+ if (p.mutPendingQueries.length !== 0 || p.latestFetchedBlock < caughtUpBlockNumber) {
1876
1734
  shouldWaitForNewBlock = false;
1877
1735
  }
1878
1736
  }
@@ -1963,14 +1821,14 @@ function getReadyItemsCount(fetchState, targetSize, fromItem) {
1963
1821
  return acc;
1964
1822
  }
1965
1823
 
1966
- function make$1(startBlock, endBlock, onEventRegistrations, addressStore, addressRows, maxAddrInPartition, chainId, onNotice, maxOnBlockBufferSize, knownHeight, progressBlockNumberOpt, onBlockRegistrationsOpt, blockLagOpt, firstEventBlockOpt, clientFilterAddressThresholdOpt, isResumedOpt, deferCreationBlockEventsOpt) {
1824
+ function make$1(startBlock, endBlock, onEventRegistrations, addressStore, addressRows, maxAddrInPartition, chainId, onNotice, maxOnBlockBufferSize, knownHeight, progressBlockNumberOpt, onBlockRegistrationsOpt, blockLagOpt, blockThrottleOpt, firstEventBlockOpt, clientFilterAddressThresholdOpt, isResumedOpt) {
1967
1825
  let progressBlockNumber = progressBlockNumberOpt !== undefined ? progressBlockNumberOpt : startBlock - 1 | 0;
1968
1826
  let onBlockRegistrations = onBlockRegistrationsOpt !== undefined ? onBlockRegistrationsOpt : [];
1969
1827
  let blockLag = blockLagOpt !== undefined ? blockLagOpt : 0;
1828
+ let blockThrottle = blockThrottleOpt !== undefined ? blockThrottleOpt : 0;
1970
1829
  let firstEventBlock = firstEventBlockOpt !== undefined ? Primitive_option.valFromOption(firstEventBlockOpt) : undefined;
1971
1830
  let clientFilterAddressThreshold = clientFilterAddressThresholdOpt !== undefined ? Primitive_option.valFromOption(clientFilterAddressThresholdOpt) : undefined;
1972
1831
  let isResumed = isResumedOpt !== undefined ? isResumedOpt : false;
1973
- let deferCreationBlockEvents = deferCreationBlockEventsOpt !== undefined ? deferCreationBlockEventsOpt : false;
1974
1832
  let notDependingOnAddresses = [];
1975
1833
  let normalRegistrations = [];
1976
1834
  let contractNamesWithNormalEvents = new Set();
@@ -2016,7 +1874,6 @@ function make$1(startBlock, endBlock, onEventRegistrations, addressStore, addres
2016
1874
  requestedFromBlock: rejected.effectiveStartBlock
2017
1875
  }));
2018
1876
  let dynamicContracts = new Set();
2019
- let clientFilteredContracts = new Set();
2020
1877
  let registeringSetsByContract = {};
2021
1878
  Array.from(contractNamesWithNormalEvents).forEach(contractName => {
2022
1879
  if (addressStore.contractCount(contractName) > 0) {
@@ -2030,20 +1887,16 @@ function make$1(startBlock, endBlock, onEventRegistrations, addressStore, addres
2030
1887
  return;
2031
1888
  }
2032
1889
  });
2033
- if (clientFilterAddressThreshold !== undefined) {
2034
- Utils.Dict.forEachWithKey(registeringSetsByContract, (set, contractName) => {
2035
- let addressCount = set.size();
2036
- if (addressCount > clientFilterAddressThreshold) {
2037
- return addClientFilteredContract(clientFilteredContracts, contractName, onNotice, addressCount, clientFilterAddressThreshold, isResumed);
2038
- }
2039
- });
2040
- }
1890
+ let clientFilterPolicy = {
1891
+ addressThreshold: clientFilterAddressThreshold,
1892
+ allDynamicContracts: false
1893
+ };
1894
+ let clientFilteredContracts = switchToClientSideFiltering(new Set(), Object.keys(registeringSetsByContract), clientFilterPolicy, dynamicContracts, addressStore, onNotice, isResumed);
2041
1895
  let optimizedPartitions = createPartitions(registeringSetsByContract, addressStore, dynamicContracts, clientFilteredContracts, normalSelection, maxAddrInPartition, partitions.length, partitions, progressBlockNumber, knownHeight);
2042
1896
  if (optimizedPartitions.idsInAscOrder.length === 0 && Utils.$$Array.isEmpty(onBlockRegistrations$1)) {
2043
1897
  Stdlib_JsError.throwWithMessage(`Invalid configuration: Nothing to fetch on chain ` + ChainId.toString(chainId) + `. ` + (`addresses=` + addressRows.addresses.length.toString() + `, `) + (`onEventRegistrations=` + onEventRegistrations.length.toString() + `, `) + (`normalRegistrations=` + normalRegistrations.length.toString() + `. `) + `Make sure that you provided at least one contract address to index, or have events with Wildcard mode enabled, or have onBlock handlers.`);
2044
1898
  }
2045
1899
  let buffer = [];
2046
- let blockRegisterThrough = onBlockRegistrations$1.some(r => r.contractRegister !== undefined) ? progressBlockNumber : undefined;
2047
1900
  let latestOnBlockBlockNumber;
2048
1901
  let exit = 0;
2049
1902
  if (onBlockRegistrations$1.length !== 0 || knownHeight <= 0) {
@@ -2056,8 +1909,7 @@ function make$1(startBlock, endBlock, onEventRegistrations, addressStore, addres
2056
1909
  let id = optimizedPartitions.idsInAscOrder[0];
2057
1910
  let latestFullyFetchedBlock = id !== undefined ? optimizedPartitions.entities[id].latestFetchedBlock : undefined;
2058
1911
  let maxBlockNumber = latestFullyFetchedBlock !== undefined ? Primitive_int.min(latestFullyFetchedBlock, knownHeight) : knownHeight;
2059
- let maxBlockNumber$1 = blockRegisterThrough !== undefined ? Primitive_int.min(maxBlockNumber, blockRegisterThrough) : maxBlockNumber;
2060
- latestOnBlockBlockNumber = appendOnBlockItems(buffer, onBlockRegistrations$1, startBlock, progressBlockNumber, maxBlockNumber$1, maxOnBlockBufferSize);
1912
+ latestOnBlockBlockNumber = appendOnBlockItems(buffer, onBlockRegistrations$1, startBlock, progressBlockNumber, maxBlockNumber, maxOnBlockBufferSize);
2061
1913
  } else {
2062
1914
  latestOnBlockBlockNumber = progressBlockNumber;
2063
1915
  }
@@ -2070,14 +1922,13 @@ function make$1(startBlock, endBlock, onEventRegistrations, addressStore, addres
2070
1922
  chainId: chainId,
2071
1923
  latestOnBlockBlockNumber: latestOnBlockBlockNumber,
2072
1924
  blockLag: blockLag,
1925
+ blockThrottle: blockThrottle,
2073
1926
  buffer: buffer,
2074
1927
  maxOnBlockBufferSize: maxOnBlockBufferSize,
2075
1928
  onBlockRegistrations: onBlockRegistrations$1,
2076
1929
  knownHeight: knownHeight,
2077
1930
  firstEventBlock: firstEventBlock,
2078
- clientFilterAddressThreshold: clientFilterAddressThreshold,
2079
- creationBlocks: deferCreationBlockEvents ? ({}) : undefined,
2080
- blockRegisterThrough: blockRegisterThrough
1931
+ clientFilterPolicy: clientFilterPolicy
2081
1932
  };
2082
1933
  }
2083
1934
 
@@ -2177,8 +2028,22 @@ function rollback(fetchState, rolledBackAddressStore, targetBlockNumber) {
2177
2028
  }
2178
2029
  }
2179
2030
  let optimizedPartitions = createPartitions(registeringSetsByContract, rolledBackAddressStore, fetchState.optimizedPartitions.dynamicContracts, fetchState.optimizedPartitions.clientFilteredContracts, fetchState.normalSelection, fetchState.optimizedPartitions.maxAddrInPartition, nextKeptIdRef, keptPartitions, targetBlockNumber, fetchState.knownHeight);
2180
- let newrecord = {...fetchState};
2181
- let rolledBack = updateInternal((newrecord.blockRegisterThrough = Stdlib_Option.map(fetchState.blockRegisterThrough, through => Primitive_int.min(through, targetBlockNumber)), newrecord.latestOnBlockBlockNumber = Primitive_int.min(fetchState.latestOnBlockBlockNumber, targetBlockNumber), newrecord), optimizedPartitions, fetchState.buffer.filter(item => {
2031
+ let rolledBack = updateInternal({
2032
+ optimizedPartitions: fetchState.optimizedPartitions,
2033
+ startBlock: fetchState.startBlock,
2034
+ endBlock: fetchState.endBlock,
2035
+ normalSelection: fetchState.normalSelection,
2036
+ chainId: fetchState.chainId,
2037
+ latestOnBlockBlockNumber: Primitive_int.min(fetchState.latestOnBlockBlockNumber, targetBlockNumber),
2038
+ blockLag: fetchState.blockLag,
2039
+ blockThrottle: fetchState.blockThrottle,
2040
+ buffer: fetchState.buffer,
2041
+ maxOnBlockBufferSize: fetchState.maxOnBlockBufferSize,
2042
+ onBlockRegistrations: fetchState.onBlockRegistrations,
2043
+ knownHeight: fetchState.knownHeight,
2044
+ firstEventBlock: fetchState.firstEventBlock,
2045
+ clientFilterPolicy: fetchState.clientFilterPolicy
2046
+ }, optimizedPartitions, fetchState.buffer.filter(item => {
2182
2047
  let tmp;
2183
2048
  tmp = item.kind === 0 ? item.blockNumber : item.blockNumber;
2184
2049
  return tmp <= targetBlockNumber;
@@ -2211,17 +2076,30 @@ function resetPendingQueries(fetchState) {
2211
2076
  };
2212
2077
  }
2213
2078
  }
2214
- let newrecord = {...fetchState};
2215
2079
  let init = fetchState.optimizedPartitions;
2216
- newrecord.optimizedPartitions = {
2217
- idsInAscOrder: init.idsInAscOrder,
2218
- entities: newEntities,
2219
- maxAddrInPartition: init.maxAddrInPartition,
2220
- nextPartitionIndex: init.nextPartitionIndex,
2221
- dynamicContracts: init.dynamicContracts,
2222
- clientFilteredContracts: init.clientFilteredContracts
2080
+ return {
2081
+ optimizedPartitions: {
2082
+ idsInAscOrder: init.idsInAscOrder,
2083
+ entities: newEntities,
2084
+ maxAddrInPartition: init.maxAddrInPartition,
2085
+ nextPartitionIndex: init.nextPartitionIndex,
2086
+ dynamicContracts: init.dynamicContracts,
2087
+ clientFilteredContracts: init.clientFilteredContracts
2088
+ },
2089
+ startBlock: fetchState.startBlock,
2090
+ endBlock: fetchState.endBlock,
2091
+ normalSelection: fetchState.normalSelection,
2092
+ chainId: fetchState.chainId,
2093
+ latestOnBlockBlockNumber: fetchState.latestOnBlockBlockNumber,
2094
+ blockLag: fetchState.blockLag,
2095
+ blockThrottle: fetchState.blockThrottle,
2096
+ buffer: fetchState.buffer,
2097
+ maxOnBlockBufferSize: fetchState.maxOnBlockBufferSize,
2098
+ onBlockRegistrations: fetchState.onBlockRegistrations,
2099
+ knownHeight: fetchState.knownHeight,
2100
+ firstEventBlock: fetchState.firstEventBlock,
2101
+ clientFilterPolicy: fetchState.clientFilterPolicy
2223
2102
  };
2224
- return newrecord;
2225
2103
  }
2226
2104
 
2227
2105
  function isActivelyIndexing(fetchState) {
@@ -2238,21 +2116,37 @@ function isActivelyIndexing(fetchState) {
2238
2116
  }
2239
2117
 
2240
2118
  function isFetchingAtHead(fetchState) {
2241
- let knownHeight = fetchState.knownHeight;
2242
- let blockLag = fetchState.blockLag;
2243
2119
  let endBlock = fetchState.endBlock;
2244
2120
  let bufferBlockNumber$1 = bufferBlockNumber(fetchState);
2245
- if (knownHeight !== 0) {
2121
+ if (fetchState.knownHeight !== 0) {
2246
2122
  if (endBlock !== undefined && bufferBlockNumber$1 >= endBlock) {
2247
2123
  return true;
2248
2124
  } else {
2249
- return bufferBlockNumber$1 >= (knownHeight - blockLag | 0);
2125
+ return bufferBlockNumber$1 >= headFetchTarget(fetchState);
2250
2126
  }
2251
2127
  } else {
2252
2128
  return false;
2253
2129
  }
2254
2130
  }
2255
2131
 
2132
+ function isWithinHeadClientFilteringDistance(fetchState) {
2133
+ let knownHeight = fetchState.knownHeight;
2134
+ let endBlock = fetchState.endBlock;
2135
+ let optimizedPartitions = fetchState.optimizedPartitions;
2136
+ if (!(knownHeight !== 0 && (
2137
+ endBlock !== undefined ? endBlock > (knownHeight - fetchState.blockLag | 0) : true
2138
+ ))) {
2139
+ return false;
2140
+ }
2141
+ let id = optimizedPartitions.idsInAscOrder[0];
2142
+ let latestFetchedBlock = id !== undefined ? optimizedPartitions.entities[id].latestFetchedBlock : undefined;
2143
+ if (latestFetchedBlock !== undefined) {
2144
+ return (headFetchTarget(fetchState) - latestFetchedBlock | 0) <= 200;
2145
+ } else {
2146
+ return true;
2147
+ }
2148
+ }
2149
+
2256
2150
  function isReadyToEnterReorgThreshold(tolerance, fetchState) {
2257
2151
  let knownHeight = fetchState.knownHeight;
2258
2152
  let endBlock = fetchState.endBlock;
@@ -2339,6 +2233,8 @@ let maxChainConcurrency = Env.maxChainConcurrency;
2339
2233
 
2340
2234
  let chunkRangeGrowthFactor = 1.8;
2341
2235
 
2236
+ let headClientFilteringDistance = 200;
2237
+
2342
2238
  export {
2343
2239
  deriveSelectionStartBlock,
2344
2240
  makeSelection,
@@ -2357,29 +2253,19 @@ export {
2357
2253
  getRegistrationIndex,
2358
2254
  comparePath,
2359
2255
  compareTiebreak,
2360
- blockOrderRank,
2361
- compareWithCalls,
2362
2256
  compareBufferItem,
2363
2257
  isSameLog,
2364
2258
  mergeIntoBuffer,
2365
2259
  appendOnBlockItems,
2366
2260
  updateInternal,
2367
- addClientFilteredContract,
2261
+ switchToClientSideFiltering,
2368
2262
  claimedFetchedBlock,
2369
2263
  collapseClientFilteredContracts,
2370
2264
  reportRejectedRegistration,
2371
2265
  createPartitions,
2372
- creationBlockKey,
2373
- markCreationBlockEvents,
2374
- creationRoundOfRegistration,
2375
2266
  registerDynamicContracts,
2267
+ switchDynamicContractsToClientSideFiltering,
2376
2268
  handleQueryResult,
2377
- capAtEndBlock,
2378
- canAdvanceBlockRegisters,
2379
- blockRegisterItemsAfter,
2380
- nextBlockRegisterItems,
2381
- setBlockRegisterThrough,
2382
- blockRegisterFrontier,
2383
2269
  startFetchingQueries,
2384
2270
  maxInFlightChunksPerPartition,
2385
2271
  maxChainConcurrency,
@@ -2389,6 +2275,8 @@ export {
2389
2275
  walkPartitionPending,
2390
2276
  pushForwardCandidates,
2391
2277
  acceptCandidates,
2278
+ blocksBehindHeadAllowedByThrottle,
2279
+ headFetchTarget,
2392
2280
  getNextQuery,
2393
2281
  hasReadyItem,
2394
2282
  getReadyItemsCount,
@@ -2400,6 +2288,8 @@ export {
2400
2288
  resetPendingQueries,
2401
2289
  isActivelyIndexing,
2402
2290
  isFetchingAtHead,
2291
+ headClientFilteringDistance,
2292
+ isWithinHeadClientFilteringDistance,
2403
2293
  isReadyToEnterReorgThreshold,
2404
2294
  getProgressPercentage,
2405
2295
  sortForBatch,