envio 3.3.0-alpha.3 → 3.3.0-alpha.5

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 (53) hide show
  1. package/evm.schema.json +10 -0
  2. package/package.json +7 -7
  3. package/src/Batch.res.mjs +1 -1
  4. package/src/Bin.res +3 -0
  5. package/src/Bin.res.mjs +4 -0
  6. package/src/ChainFetching.res +1 -3
  7. package/src/ChainFetching.res.mjs +3 -3
  8. package/src/ChainState.res +44 -19
  9. package/src/ChainState.res.mjs +25 -23
  10. package/src/ChainState.resi +3 -3
  11. package/src/Config.res +3 -0
  12. package/src/Config.res.mjs +3 -1
  13. package/src/Core.res +0 -3
  14. package/src/Ecosystem.res +0 -4
  15. package/src/EventConfigBuilder.res +3 -0
  16. package/src/EventConfigBuilder.res.mjs +7 -1
  17. package/src/FetchState.res +73 -160
  18. package/src/FetchState.res.mjs +120 -222
  19. package/src/IndexingAddresses.res +105 -0
  20. package/src/IndexingAddresses.res.mjs +100 -0
  21. package/src/IndexingAddresses.resi +32 -0
  22. package/src/Internal.res +5 -0
  23. package/src/Main.res +21 -24
  24. package/src/Main.res.mjs +21 -20
  25. package/src/Metrics.res +33 -0
  26. package/src/Metrics.res.mjs +39 -0
  27. package/src/Prometheus.res +2 -20
  28. package/src/Prometheus.res.mjs +83 -95
  29. package/src/SimulateItems.res +4 -0
  30. package/src/TestIndexer.res +43 -17
  31. package/src/TestIndexer.res.mjs +16 -9
  32. package/src/bindings/Viem.res +0 -41
  33. package/src/bindings/Viem.res.mjs +1 -43
  34. package/src/sources/Evm.res +17 -39
  35. package/src/sources/Evm.res.mjs +8 -40
  36. package/src/sources/EvmChain.res +3 -1
  37. package/src/sources/EvmChain.res.mjs +2 -1
  38. package/src/sources/EvmRpcClient.res +36 -5
  39. package/src/sources/EvmRpcClient.res.mjs +7 -4
  40. package/src/sources/Fuel.res +0 -2
  41. package/src/sources/Fuel.res.mjs +0 -1
  42. package/src/sources/HyperSyncClient.res +0 -35
  43. package/src/sources/HyperSyncClient.res.mjs +1 -8
  44. package/src/sources/Rpc.res +15 -47
  45. package/src/sources/Rpc.res.mjs +25 -56
  46. package/src/sources/RpcSource.res +30 -73
  47. package/src/sources/RpcSource.res.mjs +24 -73
  48. package/src/sources/SourceManager.res +1 -1
  49. package/src/sources/SourceManager.res.mjs +1 -1
  50. package/src/sources/Svm.res +10 -17
  51. package/src/sources/Svm.res.mjs +6 -18
  52. package/src/sources/TransactionStore.res +98 -76
  53. package/src/sources/TransactionStore.res.mjs +49 -35
@@ -9,12 +9,9 @@ import * as Primitive_int from "@rescript/runtime/lib/es6/Primitive_int.js";
9
9
  import * as Stdlib_Option from "@rescript/runtime/lib/es6/Stdlib_Option.js";
10
10
  import * as Stdlib_JsError from "@rescript/runtime/lib/es6/Stdlib_JsError.js";
11
11
  import * as Primitive_option from "@rescript/runtime/lib/es6/Primitive_option.js";
12
+ import * as IndexingAddresses from "./IndexingAddresses.res.mjs";
12
13
 
13
- function deriveEffectiveStartBlock(registrationBlock, contractStartBlock) {
14
- return Primitive_int.max(Primitive_int.max(registrationBlock, 0), Stdlib_Option.getOr(contractStartBlock, 0));
15
- }
16
-
17
- function deriveContractNameByAddress(addressesByContractName) {
14
+ let deriveContractNameByAddress = Utils.$$WeakMap.memoize(addressesByContractName => {
18
15
  let result = {};
19
16
  Utils.Dict.forEachWithKey(addressesByContractName, (addresses, contractName) => {
20
17
  for (let i = 0, i_finish = addresses.length; i < i_finish; ++i) {
@@ -22,7 +19,7 @@ function deriveContractNameByAddress(addressesByContractName) {
22
19
  }
23
20
  });
24
21
  return result;
25
- }
22
+ });
26
23
 
27
24
  function calculateEstResponseSize(p, fromBlock, toBlock, maxQueryBlockNumber) {
28
25
  if (p.prevQueryRange <= 0) {
@@ -82,7 +79,6 @@ function mergePartitionsAtBlock(p1, p2, potentialMergeBlock, contractName, maxAd
82
79
  latestFetchedBlock: p1.latestFetchedBlock,
83
80
  selection: p1.selection,
84
81
  addressesByContractName: p1.addressesByContractName,
85
- contractNameByAddress: p1.contractNameByAddress,
86
82
  mergeBlock: potentialMergeBlock,
87
83
  dynamicContract: p1.dynamicContract,
88
84
  mutPendingQueries: p1.mutPendingQueries,
@@ -96,7 +92,6 @@ function mergePartitionsAtBlock(p1, p2, potentialMergeBlock, contractName, maxAd
96
92
  latestFetchedBlock: p2.latestFetchedBlock,
97
93
  selection: p2.selection,
98
94
  addressesByContractName: p2.addressesByContractName,
99
- contractNameByAddress: p2.contractNameByAddress,
100
95
  mergeBlock: potentialMergeBlock,
101
96
  dynamicContract: p2.dynamicContract,
102
97
  mutPendingQueries: p2.mutPendingQueries,
@@ -119,7 +114,6 @@ function mergePartitionsAtBlock(p1, p2, potentialMergeBlock, contractName, maxAd
119
114
  },
120
115
  selection: p1.selection,
121
116
  addressesByContractName: {},
122
- contractNameByAddress: {},
123
117
  mergeBlock: undefined,
124
118
  dynamicContract: contractName,
125
119
  mutPendingQueries: [],
@@ -134,7 +128,6 @@ function mergePartitionsAtBlock(p1, p2, potentialMergeBlock, contractName, maxAd
134
128
  latestFetchedBlock: p1.latestFetchedBlock,
135
129
  selection: p1.selection,
136
130
  addressesByContractName: p1.addressesByContractName,
137
- contractNameByAddress: p1.contractNameByAddress,
138
131
  mergeBlock: potentialMergeBlock,
139
132
  dynamicContract: p1.dynamicContract,
140
133
  mutPendingQueries: p1.mutPendingQueries,
@@ -151,7 +144,6 @@ function mergePartitionsAtBlock(p1, p2, potentialMergeBlock, contractName, maxAd
151
144
  latestFetchedBlock: p2.latestFetchedBlock,
152
145
  selection: p2.selection,
153
146
  addressesByContractName: p2.addressesByContractName,
154
- contractNameByAddress: p2.contractNameByAddress,
155
147
  mergeBlock: potentialMergeBlock,
156
148
  dynamicContract: p2.dynamicContract,
157
149
  mutPendingQueries: p2.mutPendingQueries,
@@ -176,7 +168,6 @@ function mergePartitionsAtBlock(p1, p2, potentialMergeBlock, contractName, maxAd
176
168
  latestFetchedBlock: continuingBase.latestFetchedBlock,
177
169
  selection: continuingBase.selection,
178
170
  addressesByContractName: abcFull,
179
- contractNameByAddress: continuingBase.contractNameByAddress,
180
171
  mergeBlock: continuingBase.mergeBlock,
181
172
  dynamicContract: continuingBase.dynamicContract,
182
173
  mutPendingQueries: continuingBase.mutPendingQueries,
@@ -192,7 +183,6 @@ function mergePartitionsAtBlock(p1, p2, potentialMergeBlock, contractName, maxAd
192
183
  latestFetchedBlock: continuingBase.latestFetchedBlock,
193
184
  selection: continuingBase.selection,
194
185
  addressesByContractName: abcRest,
195
- contractNameByAddress: continuingBase.contractNameByAddress,
196
186
  mergeBlock: continuingBase.mergeBlock,
197
187
  dynamicContract: continuingBase.dynamicContract,
198
188
  mutPendingQueries: [],
@@ -210,7 +200,6 @@ function mergePartitionsAtBlock(p1, p2, potentialMergeBlock, contractName, maxAd
210
200
  latestFetchedBlock: continuingBase.latestFetchedBlock,
211
201
  selection: continuingBase.selection,
212
202
  addressesByContractName: abc,
213
- contractNameByAddress: continuingBase.contractNameByAddress,
214
203
  mergeBlock: continuingBase.mergeBlock,
215
204
  dynamicContract: continuingBase.dynamicContract,
216
205
  mutPendingQueries: continuingBase.mutPendingQueries,
@@ -309,20 +298,7 @@ function make(partitions, maxAddrInPartition, nextPartitionIndex, dynamicContrac
309
298
  for (let idx$2 = 0; idx$2 < partitionsCount; ++idx$2) {
310
299
  let p$1 = newPartitions[idx$2];
311
300
  idsInAscOrder[idx$2] = p$1.id;
312
- entities[p$1.id] = {
313
- id: p$1.id,
314
- latestFetchedBlock: p$1.latestFetchedBlock,
315
- selection: p$1.selection,
316
- addressesByContractName: p$1.addressesByContractName,
317
- contractNameByAddress: deriveContractNameByAddress(p$1.addressesByContractName),
318
- mergeBlock: p$1.mergeBlock,
319
- dynamicContract: p$1.dynamicContract,
320
- mutPendingQueries: p$1.mutPendingQueries,
321
- prevQueryRange: p$1.prevQueryRange,
322
- prevPrevQueryRange: p$1.prevPrevQueryRange,
323
- prevRangeSize: p$1.prevRangeSize,
324
- latestBlockRangeUpdateBlock: p$1.latestBlockRangeUpdateBlock
325
- };
301
+ entities[p$1.id] = p$1;
326
302
  }
327
303
  return {
328
304
  idsInAscOrder: idsInAscOrder,
@@ -416,7 +392,6 @@ function handleQueryResponse(optimizedPartitions, query, knownHeight, itemsCount
416
392
  let updatedMainPartition_id = p$1.id;
417
393
  let updatedMainPartition_selection = p$1.selection;
418
394
  let updatedMainPartition_addressesByContractName = p$1.addressesByContractName;
419
- let updatedMainPartition_contractNameByAddress = p$1.contractNameByAddress;
420
395
  let updatedMainPartition_mergeBlock = p$1.mergeBlock;
421
396
  let updatedMainPartition_dynamicContract = p$1.dynamicContract;
422
397
  let updatedMainPartition_mutPendingQueries = p$1.mutPendingQueries;
@@ -426,7 +401,6 @@ function handleQueryResponse(optimizedPartitions, query, knownHeight, itemsCount
426
401
  latestFetchedBlock: updatedLatestFetchedBlock,
427
402
  selection: updatedMainPartition_selection,
428
403
  addressesByContractName: updatedMainPartition_addressesByContractName,
429
- contractNameByAddress: updatedMainPartition_contractNameByAddress,
430
404
  mergeBlock: updatedMainPartition_mergeBlock,
431
405
  dynamicContract: updatedMainPartition_dynamicContract,
432
406
  mutPendingQueries: updatedMainPartition_mutPendingQueries,
@@ -487,6 +461,22 @@ function bufferBlock(param) {
487
461
  }
488
462
  }
489
463
 
464
+ function bufferReadyCount(fetchState) {
465
+ let frontier = bufferBlockNumber(fetchState);
466
+ let buffer = fetchState.buffer;
467
+ let lo = 0;
468
+ let hi = buffer.length;
469
+ while (lo < hi) {
470
+ let mid = (lo + hi | 0) / 2 | 0;
471
+ if (buffer[mid].blockNumber <= frontier) {
472
+ lo = mid + 1 | 0;
473
+ } else {
474
+ hi = mid;
475
+ }
476
+ };
477
+ return lo;
478
+ }
479
+
490
480
  function compareBufferItem(a, b) {
491
481
  let blockOrdering = Primitive_int.compare(a.blockNumber, b.blockNumber);
492
482
  if (blockOrdering === 0) {
@@ -496,10 +486,6 @@ function compareBufferItem(a, b) {
496
486
  }
497
487
  }
498
488
 
499
- function numAddresses(fetchState) {
500
- return Utils.Dict.size(fetchState.indexingAddresses);
501
- }
502
-
503
489
  function appendOnBlockItems(mutItems, onBlockConfigs, indexerStartBlock, fromBlock, maxBlockNumber, maxOnBlockBufferSize) {
504
490
  let newItemsCounter = 0;
505
491
  let latestOnBlockBlockNumber = fromBlock;
@@ -529,9 +515,8 @@ function appendOnBlockItems(mutItems, onBlockConfigs, indexerStartBlock, fromBlo
529
515
  return latestOnBlockBlockNumber;
530
516
  }
531
517
 
532
- function updateInternal(fetchState, optimizedPartitionsOpt, indexingAddressesOpt, mutItems, blockLagOpt, knownHeightOpt) {
518
+ function updateInternal(fetchState, optimizedPartitionsOpt, mutItems, blockLagOpt, knownHeightOpt) {
533
519
  let optimizedPartitions = optimizedPartitionsOpt !== undefined ? optimizedPartitionsOpt : fetchState.optimizedPartitions;
534
- let indexingAddresses = indexingAddressesOpt !== undefined ? indexingAddressesOpt : fetchState.indexingAddresses;
535
520
  let blockLag = blockLagOpt !== undefined ? blockLagOpt : fetchState.blockLag;
536
521
  let knownHeight = knownHeightOpt !== undefined ? knownHeightOpt : fetchState.knownHeight;
537
522
  let mutItemsRef = mutItems;
@@ -572,7 +557,6 @@ function updateInternal(fetchState, optimizedPartitionsOpt, indexingAddressesOpt
572
557
  startBlock: updatedFetchState_startBlock,
573
558
  endBlock: updatedFetchState_endBlock,
574
559
  normalSelection: updatedFetchState_normalSelection,
575
- indexingAddresses: indexingAddresses,
576
560
  contractConfigs: updatedFetchState_contractConfigs,
577
561
  chainId: updatedFetchState_chainId,
578
562
  latestOnBlockBlockNumber: latestOnBlockBlockNumber,
@@ -586,9 +570,6 @@ function updateInternal(fetchState, optimizedPartitionsOpt, indexingAddressesOpt
586
570
  Prometheus.IndexingPartitions.set(optimizedPartitions.idsInAscOrder.length, fetchState.chainId);
587
571
  Prometheus.IndexingBufferSize.set(updatedFetchState_buffer.length, fetchState.chainId);
588
572
  Prometheus.IndexingBufferBlockNumber.set(bufferBlockNumber(updatedFetchState), fetchState.chainId);
589
- if (indexingAddresses !== fetchState.indexingAddresses) {
590
- Prometheus.IndexingAddresses.set(Utils.Dict.size(indexingAddresses), fetchState.chainId);
591
- }
592
573
  return updatedFetchState;
593
574
  }
594
575
 
@@ -674,7 +655,6 @@ function createPartitionsFromIndexingAddresses(registeringContractsByContract, d
674
655
  latestFetchedBlock: latestFetchedBlock,
675
656
  selection: normalSelection,
676
657
  addressesByContractName: addressesByContractName,
677
- contractNameByAddress: {},
678
658
  mergeBlock: undefined,
679
659
  dynamicContract: isDynamic ? contractName : undefined,
680
660
  mutPendingQueries: [],
@@ -726,7 +706,6 @@ function createPartitionsFromIndexingAddresses(registeringContractsByContract, d
726
706
  latestFetchedBlock: currentP.latestFetchedBlock,
727
707
  selection: currentP.selection,
728
708
  addressesByContractName: currentP.addressesByContractName,
729
- contractNameByAddress: currentP.contractNameByAddress,
730
709
  mergeBlock: currentPBlock < nextPBlock ? nextPBlock : undefined,
731
710
  dynamicContract: currentP.dynamicContract,
732
711
  mutPendingQueries: currentP.mutPendingQueries,
@@ -740,7 +719,6 @@ function createPartitionsFromIndexingAddresses(registeringContractsByContract, d
740
719
  latestFetchedBlock: nextP.latestFetchedBlock,
741
720
  selection: nextP.selection,
742
721
  addressesByContractName: mergedAddresses,
743
- contractNameByAddress: nextP.contractNameByAddress,
744
722
  mergeBlock: nextP.mergeBlock,
745
723
  dynamicContract: nextP.dynamicContract,
746
724
  mutPendingQueries: nextP.mutPendingQueries,
@@ -755,7 +733,6 @@ function createPartitionsFromIndexingAddresses(registeringContractsByContract, d
755
733
  latestFetchedBlock: currentP.latestFetchedBlock,
756
734
  selection: currentP.selection,
757
735
  addressesByContractName: mergedAddresses,
758
- contractNameByAddress: currentP.contractNameByAddress,
759
736
  mergeBlock: currentP.mergeBlock,
760
737
  dynamicContract: currentP.dynamicContract,
761
738
  mutPendingQueries: currentP.mutPendingQueries,
@@ -774,11 +751,10 @@ function createPartitionsFromIndexingAddresses(registeringContractsByContract, d
774
751
  return make(existingPartitions.concat(mergedPartitions), maxAddrInPartition, nextPartitionIndexRef, dynamicContracts);
775
752
  }
776
753
 
777
- function registerDynamicContracts(fetchState, items) {
754
+ function registerDynamicContracts(fetchState, indexingAddresses, items) {
778
755
  if (Utils.$$Array.isEmpty(fetchState.normalSelection.eventConfigs)) {
779
756
  Stdlib_JsError.throwWithMessage("Invalid configuration. No events to fetch for the dynamic contract registration.");
780
757
  }
781
- let indexingAddresses = fetchState.indexingAddresses;
782
758
  let registeringContractsByContract = {};
783
759
  let earliestRegisteringEventBlockNumber = Infinity;
784
760
  let noEventsAddresses = {};
@@ -796,14 +772,14 @@ function registerDynamicContracts(fetchState, items) {
796
772
  let dcWithStartBlock_address = dc.address;
797
773
  let dcWithStartBlock_contractName = dc.contractName;
798
774
  let dcWithStartBlock_registrationBlock = dc.registrationBlock;
799
- let dcWithStartBlock_effectiveStartBlock = deriveEffectiveStartBlock(dc.registrationBlock, match.startBlock);
775
+ let dcWithStartBlock_effectiveStartBlock = IndexingAddresses.deriveEffectiveStartBlock(dc.registrationBlock, match.startBlock);
800
776
  let dcWithStartBlock = {
801
777
  address: dcWithStartBlock_address,
802
778
  contractName: dcWithStartBlock_contractName,
803
779
  registrationBlock: dcWithStartBlock_registrationBlock,
804
780
  effectiveStartBlock: dcWithStartBlock_effectiveStartBlock
805
781
  };
806
- let existingContract = indexingAddresses[dc.address];
782
+ let existingContract = IndexingAddresses.get(indexingAddresses, dc.address);
807
783
  if (existingContract !== undefined) {
808
784
  if (existingContract.contractName !== dc.contractName) {
809
785
  warnDifferentContractType(fetchState, existingContract, dcWithStartBlock);
@@ -834,14 +810,14 @@ function registerDynamicContracts(fetchState, items) {
834
810
  let dcAsIndexingAddress_address = dc.address;
835
811
  let dcAsIndexingAddress_contractName = dc.contractName;
836
812
  let dcAsIndexingAddress_registrationBlock = dc.registrationBlock;
837
- let dcAsIndexingAddress_effectiveStartBlock = deriveEffectiveStartBlock(dc.registrationBlock, undefined);
813
+ let dcAsIndexingAddress_effectiveStartBlock = IndexingAddresses.deriveEffectiveStartBlock(dc.registrationBlock, undefined);
838
814
  let dcAsIndexingAddress = {
839
815
  address: dcAsIndexingAddress_address,
840
816
  contractName: dcAsIndexingAddress_contractName,
841
817
  registrationBlock: dcAsIndexingAddress_registrationBlock,
842
818
  effectiveStartBlock: dcAsIndexingAddress_effectiveStartBlock
843
819
  };
844
- let existingContract$1 = indexingAddresses[dc.address];
820
+ let existingContract$1 = IndexingAddresses.get(indexingAddresses, dc.address);
845
821
  if (existingContract$1 !== undefined) {
846
822
  if (existingContract$1.contractName !== dc.contractName) {
847
823
  warnDifferentContractType(fetchState, existingContract$1, dcAsIndexingAddress);
@@ -876,104 +852,100 @@ function registerDynamicContracts(fetchState, items) {
876
852
  }
877
853
  let dcContractNamesToStore = Object.keys(registeringContractsByContract);
878
854
  let hasNoEventsUpdates = !Utils.Dict.isEmpty(noEventsAddresses);
879
- if (dcContractNamesToStore.length !== 0) {
880
- let newPartitions = [];
881
- let newIndexingAddresses = Utils.Dict.shallowCopy(indexingAddresses);
882
- let dynamicContractsRef = fetchState.optimizedPartitions.dynamicContracts;
883
- let mutExistingPartitions = Object.values(fetchState.optimizedPartitions.entities);
884
- for (let idx$1 = 0, idx_finish = dcContractNamesToStore.length; idx$1 < idx_finish; ++idx$1) {
885
- let contractName = dcContractNamesToStore[idx$1];
886
- if (!dynamicContractsRef.has(contractName)) {
887
- dynamicContractsRef = Utils.$$Set.immutableAdd(dynamicContractsRef, contractName);
888
- for (let idx$2 = 0, idx_finish$1 = mutExistingPartitions.length; idx$2 < idx_finish$1; ++idx$2) {
889
- let p = mutExistingPartitions[idx$2];
890
- let addresses = p.addressesByContractName[contractName];
891
- if (addresses !== undefined && p.selection.dependsOnAddresses && p.mergeBlock === undefined) {
892
- let allPartitionContractNames = Object.keys(p.addressesByContractName);
893
- if (allPartitionContractNames.length !== 1) {
894
- let isFetching = p.mutPendingQueries.length !== 0;
895
- if (!isFetching) {
896
- let newPartitionId = (fetchState.optimizedPartitions.nextPartitionIndex + newPartitions.length | 0).toString();
897
- let restAddressesByContractName = Utils.Dict.shallowCopy(p.addressesByContractName);
898
- Utils.Dict.deleteInPlace(restAddressesByContractName, contractName);
899
- mutExistingPartitions[idx$2] = {
900
- id: p.id,
901
- latestFetchedBlock: p.latestFetchedBlock,
902
- selection: p.selection,
903
- addressesByContractName: restAddressesByContractName,
904
- contractNameByAddress: p.contractNameByAddress,
905
- mergeBlock: p.mergeBlock,
906
- dynamicContract: p.dynamicContract,
907
- mutPendingQueries: p.mutPendingQueries,
908
- prevQueryRange: p.prevQueryRange,
909
- prevPrevQueryRange: p.prevPrevQueryRange,
910
- prevRangeSize: p.prevRangeSize,
911
- latestBlockRangeUpdateBlock: p.latestBlockRangeUpdateBlock
912
- };
913
- let addressesByContractName = {};
914
- addressesByContractName[contractName] = addresses;
915
- newPartitions.push({
916
- id: newPartitionId,
917
- latestFetchedBlock: p.latestFetchedBlock,
918
- selection: fetchState.normalSelection,
919
- addressesByContractName: addressesByContractName,
920
- contractNameByAddress: {},
921
- mergeBlock: undefined,
922
- dynamicContract: contractName,
923
- mutPendingQueries: p.mutPendingQueries,
924
- prevQueryRange: p.prevQueryRange,
925
- prevPrevQueryRange: p.prevPrevQueryRange,
926
- prevRangeSize: p.prevRangeSize,
927
- latestBlockRangeUpdateBlock: p.latestBlockRangeUpdateBlock
928
- });
929
- }
930
- } else {
855
+ if (dcContractNamesToStore.length === 0) {
856
+ if (hasNoEventsUpdates) {
857
+ IndexingAddresses.register(indexingAddresses, noEventsAddresses);
858
+ return fetchState;
859
+ } else {
860
+ return fetchState;
861
+ }
862
+ }
863
+ let newPartitions = [];
864
+ let dynamicContractsRef = fetchState.optimizedPartitions.dynamicContracts;
865
+ let mutExistingPartitions = Object.values(fetchState.optimizedPartitions.entities);
866
+ for (let idx$1 = 0, idx_finish = dcContractNamesToStore.length; idx$1 < idx_finish; ++idx$1) {
867
+ let contractName = dcContractNamesToStore[idx$1];
868
+ if (!dynamicContractsRef.has(contractName)) {
869
+ dynamicContractsRef = Utils.$$Set.immutableAdd(dynamicContractsRef, contractName);
870
+ for (let idx$2 = 0, idx_finish$1 = mutExistingPartitions.length; idx$2 < idx_finish$1; ++idx$2) {
871
+ let p = mutExistingPartitions[idx$2];
872
+ let addresses = p.addressesByContractName[contractName];
873
+ if (addresses !== undefined && p.selection.dependsOnAddresses && p.mergeBlock === undefined) {
874
+ let allPartitionContractNames = Object.keys(p.addressesByContractName);
875
+ if (allPartitionContractNames.length !== 1) {
876
+ let isFetching = p.mutPendingQueries.length !== 0;
877
+ if (!isFetching) {
878
+ let newPartitionId = (fetchState.optimizedPartitions.nextPartitionIndex + newPartitions.length | 0).toString();
879
+ let restAddressesByContractName = Utils.Dict.shallowCopy(p.addressesByContractName);
880
+ Utils.Dict.deleteInPlace(restAddressesByContractName, contractName);
931
881
  mutExistingPartitions[idx$2] = {
932
882
  id: p.id,
933
883
  latestFetchedBlock: p.latestFetchedBlock,
934
884
  selection: p.selection,
935
- addressesByContractName: p.addressesByContractName,
936
- contractNameByAddress: p.contractNameByAddress,
885
+ addressesByContractName: restAddressesByContractName,
937
886
  mergeBlock: p.mergeBlock,
938
- dynamicContract: contractName,
887
+ dynamicContract: p.dynamicContract,
939
888
  mutPendingQueries: p.mutPendingQueries,
940
889
  prevQueryRange: p.prevQueryRange,
941
890
  prevPrevQueryRange: p.prevPrevQueryRange,
942
891
  prevRangeSize: p.prevRangeSize,
943
892
  latestBlockRangeUpdateBlock: p.latestBlockRangeUpdateBlock
944
893
  };
894
+ let addressesByContractName = {};
895
+ addressesByContractName[contractName] = addresses;
896
+ newPartitions.push({
897
+ id: newPartitionId,
898
+ latestFetchedBlock: p.latestFetchedBlock,
899
+ selection: fetchState.normalSelection,
900
+ addressesByContractName: addressesByContractName,
901
+ mergeBlock: undefined,
902
+ dynamicContract: contractName,
903
+ mutPendingQueries: p.mutPendingQueries,
904
+ prevQueryRange: p.prevQueryRange,
905
+ prevPrevQueryRange: p.prevPrevQueryRange,
906
+ prevRangeSize: p.prevRangeSize,
907
+ latestBlockRangeUpdateBlock: p.latestBlockRangeUpdateBlock
908
+ });
945
909
  }
910
+ } else {
911
+ mutExistingPartitions[idx$2] = {
912
+ id: p.id,
913
+ latestFetchedBlock: p.latestFetchedBlock,
914
+ selection: p.selection,
915
+ addressesByContractName: p.addressesByContractName,
916
+ mergeBlock: p.mergeBlock,
917
+ dynamicContract: contractName,
918
+ mutPendingQueries: p.mutPendingQueries,
919
+ prevQueryRange: p.prevQueryRange,
920
+ prevPrevQueryRange: p.prevPrevQueryRange,
921
+ prevRangeSize: p.prevRangeSize,
922
+ latestBlockRangeUpdateBlock: p.latestBlockRangeUpdateBlock
923
+ };
946
924
  }
947
925
  }
948
926
  }
949
- let registeringContracts = registeringContractsByContract[contractName];
950
- Object.assign(newIndexingAddresses, registeringContracts);
951
927
  }
952
- Object.assign(newIndexingAddresses, noEventsAddresses);
953
- let optimizedPartitions = createPartitionsFromIndexingAddresses(registeringContractsByContract, dynamicContractsRef, fetchState.normalSelection, fetchState.optimizedPartitions.maxAddrInPartition, fetchState.optimizedPartitions.nextPartitionIndex + newPartitions.length | 0, mutExistingPartitions.concat(newPartitions), 0);
954
- return updateInternal(fetchState, optimizedPartitions, newIndexingAddresses, undefined, undefined, undefined);
955
- }
956
- if (!hasNoEventsUpdates) {
957
- return fetchState;
928
+ let registeringContracts = registeringContractsByContract[contractName];
929
+ IndexingAddresses.register(indexingAddresses, registeringContracts);
958
930
  }
959
- let newIndexingContracts = Utils.Dict.shallowCopy(indexingAddresses);
960
- Object.assign(newIndexingContracts, noEventsAddresses);
961
- return updateInternal(fetchState, undefined, newIndexingContracts, undefined, undefined, undefined);
931
+ IndexingAddresses.register(indexingAddresses, noEventsAddresses);
932
+ let optimizedPartitions = createPartitionsFromIndexingAddresses(registeringContractsByContract, dynamicContractsRef, fetchState.normalSelection, fetchState.optimizedPartitions.maxAddrInPartition, fetchState.optimizedPartitions.nextPartitionIndex + newPartitions.length | 0, mutExistingPartitions.concat(newPartitions), 0);
933
+ return updateInternal(fetchState, optimizedPartitions, undefined, undefined, undefined);
962
934
  }
963
935
 
964
- function handleQueryResult(fetchState, query, latestFetchedBlock, newItems) {
936
+ function handleQueryResult(fetchState, indexingAddresses, query, latestFetchedBlock, newItems) {
965
937
  let newItems$1 = newItems.filter(item => {
966
938
  if (item.kind !== 0) {
967
939
  return true;
968
940
  }
969
941
  let filter = item.eventConfig.clientAddressFilter;
970
942
  if (filter !== undefined) {
971
- return filter(item.payload, item.blockNumber, fetchState.indexingAddresses);
943
+ return filter(item.payload, item.blockNumber, IndexingAddresses.rawForFilter(indexingAddresses));
972
944
  } else {
973
945
  return true;
974
946
  }
975
947
  });
976
- return updateInternal(fetchState, handleQueryResponse(fetchState.optimizedPartitions, query, fetchState.knownHeight, newItems$1.length, latestFetchedBlock), undefined, newItems$1.length !== 0 ? fetchState.buffer.concat(newItems$1) : undefined, undefined, undefined);
948
+ return updateInternal(fetchState, handleQueryResponse(fetchState.optimizedPartitions, query, fetchState.knownHeight, newItems$1.length, latestFetchedBlock), newItems$1.length !== 0 ? fetchState.buffer.concat(newItems$1) : undefined, undefined, undefined);
977
949
  }
978
950
 
979
951
  function startFetchingQueries(param, queries) {
@@ -1029,8 +1001,7 @@ function pushQueriesForRange(queries, partitionId, rangeFromBlock, rangeEndBlock
1029
1001
  chainId: 0,
1030
1002
  progress: 0,
1031
1003
  selection: selection,
1032
- addressesByContractName: addressesByContractName,
1033
- contractNameByAddress: partition.contractNameByAddress
1004
+ addressesByContractName: addressesByContractName
1034
1005
  });
1035
1006
  chunkFromBlock = chunkToBlock + 1 | 0;
1036
1007
  chunkIdx = chunkIdx + 1 | 0;
@@ -1046,8 +1017,7 @@ function pushQueriesForRange(queries, partitionId, rangeFromBlock, rangeEndBlock
1046
1017
  chainId: 0,
1047
1018
  progress: 0,
1048
1019
  selection: selection,
1049
- addressesByContractName: addressesByContractName,
1050
- contractNameByAddress: partition.contractNameByAddress
1020
+ addressesByContractName: addressesByContractName
1051
1021
  });
1052
1022
  return;
1053
1023
  }
@@ -1060,8 +1030,7 @@ function pushQueriesForRange(queries, partitionId, rangeFromBlock, rangeEndBlock
1060
1030
  chainId: 0,
1061
1031
  progress: 0,
1062
1032
  selection: selection,
1063
- addressesByContractName: addressesByContractName,
1064
- contractNameByAddress: partition.contractNameByAddress
1033
+ addressesByContractName: addressesByContractName
1065
1034
  });
1066
1035
  }
1067
1036
 
@@ -1081,7 +1050,7 @@ function getNextQuery(fetchState, budget, chainPendingBudget) {
1081
1050
  let shouldWaitForNewBlock = (
1082
1051
  endBlock !== undefined ? headBlockNumber < endBlock : true
1083
1052
  ) && !isOnBlockBehindTheHead;
1084
- let item = fetchState.buffer[(budget + (chainPendingBudget | 0) | 0) - 1 | 0];
1053
+ let item = fetchState.buffer[((bufferReadyCount(fetchState) + budget | 0) + (chainPendingBudget | 0) | 0) - 1 | 0];
1085
1054
  let maxQueryBlockNumber = item !== undefined ? Primitive_int.min(item.blockNumber, knownHeight) : knownHeight;
1086
1055
  let queries = [];
1087
1056
  let partitionsCount = optimizedPartitions.idsInAscOrder.length;
@@ -1140,8 +1109,7 @@ function getNextQuery(fetchState, budget, chainPendingBudget) {
1140
1109
  chainId: 0,
1141
1110
  progress: 0,
1142
1111
  selection: selection,
1143
- addressesByContractName: addressesByContractName,
1144
- contractNameByAddress: p.contractNameByAddress
1112
+ addressesByContractName: addressesByContractName
1145
1113
  });
1146
1114
  chunkFromBlock = chunkToBlock + 1 | 0;
1147
1115
  chunkIdx = chunkIdx + 1 | 0;
@@ -1156,8 +1124,7 @@ function getNextQuery(fetchState, budget, chainPendingBudget) {
1156
1124
  chainId: 0,
1157
1125
  progress: 0,
1158
1126
  selection: selection,
1159
- addressesByContractName: addressesByContractName,
1160
- contractNameByAddress: p.contractNameByAddress
1127
+ addressesByContractName: addressesByContractName
1161
1128
  });
1162
1129
  }
1163
1130
  } else {
@@ -1170,8 +1137,7 @@ function getNextQuery(fetchState, budget, chainPendingBudget) {
1170
1137
  chainId: 0,
1171
1138
  progress: 0,
1172
1139
  selection: selection,
1173
- addressesByContractName: addressesByContractName,
1174
- contractNameByAddress: p.contractNameByAddress
1140
+ addressesByContractName: addressesByContractName
1175
1141
  });
1176
1142
  }
1177
1143
  }
@@ -1219,8 +1185,7 @@ function getNextQuery(fetchState, budget, chainPendingBudget) {
1219
1185
  chainId: 0,
1220
1186
  progress: 0,
1221
1187
  selection: selection$1,
1222
- addressesByContractName: addressesByContractName$1,
1223
- contractNameByAddress: p.contractNameByAddress
1188
+ addressesByContractName: addressesByContractName$1
1224
1189
  });
1225
1190
  chunkFromBlock$1 = chunkToBlock$1 + 1 | 0;
1226
1191
  chunkIdx$1 = chunkIdx$1 + 1 | 0;
@@ -1235,8 +1200,7 @@ function getNextQuery(fetchState, budget, chainPendingBudget) {
1235
1200
  chainId: 0,
1236
1201
  progress: 0,
1237
1202
  selection: selection$1,
1238
- addressesByContractName: addressesByContractName$1,
1239
- contractNameByAddress: p.contractNameByAddress
1203
+ addressesByContractName: addressesByContractName$1
1240
1204
  });
1241
1205
  }
1242
1206
  } else {
@@ -1249,8 +1213,7 @@ function getNextQuery(fetchState, budget, chainPendingBudget) {
1249
1213
  chainId: 0,
1250
1214
  progress: 0,
1251
1215
  selection: selection$1,
1252
- addressesByContractName: addressesByContractName$1,
1253
- contractNameByAddress: p.contractNameByAddress
1216
+ addressesByContractName: addressesByContractName$1
1254
1217
  });
1255
1218
  }
1256
1219
  }
@@ -1304,7 +1267,7 @@ function getReadyItemsCount(fetchState, targetSize, fromItem) {
1304
1267
  return acc;
1305
1268
  }
1306
1269
 
1307
- function make$1(startBlock, endBlock, eventConfigs, addresses, maxAddrInPartition, chainId, maxOnBlockBufferSize, knownHeight, progressBlockNumberOpt, onBlockConfigsOpt, blockLagOpt, firstEventBlockOpt) {
1270
+ function make$1(startBlock, endBlock, eventConfigs, contractConfigs, addresses, maxAddrInPartition, chainId, maxOnBlockBufferSize, knownHeight, progressBlockNumberOpt, onBlockConfigsOpt, blockLagOpt, firstEventBlockOpt) {
1308
1271
  let progressBlockNumber = progressBlockNumberOpt !== undefined ? progressBlockNumberOpt : startBlock - 1 | 0;
1309
1272
  let onBlockConfigs = onBlockConfigsOpt !== undefined ? onBlockConfigsOpt : [];
1310
1273
  let blockLag = blockLagOpt !== undefined ? blockLagOpt : 0;
@@ -1316,25 +1279,7 @@ function make$1(startBlock, endBlock, eventConfigs, addresses, maxAddrInPartitio
1316
1279
  let notDependingOnAddresses = [];
1317
1280
  let normalEventConfigs = [];
1318
1281
  let contractNamesWithNormalEvents = new Set();
1319
- let indexingAddresses = {};
1320
- let contractConfigs = {};
1321
1282
  eventConfigs.forEach(ec => {
1322
- let match = contractConfigs[ec.contractName];
1323
- if (match !== undefined) {
1324
- let startBlock = match.startBlock;
1325
- let match$1 = ec.startBlock;
1326
- contractConfigs[ec.contractName] = {
1327
- startBlock: startBlock !== undefined ? (
1328
- match$1 !== undefined ? Primitive_int.min(startBlock, match$1) : startBlock
1329
- ) : (
1330
- match$1 !== undefined ? match$1 : undefined
1331
- )
1332
- };
1333
- } else {
1334
- contractConfigs[ec.contractName] = {
1335
- startBlock: ec.startBlock
1336
- };
1337
- }
1338
1283
  if (ec.dependsOnAddresses) {
1339
1284
  normalEventConfigs.push(ec);
1340
1285
  contractNamesWithNormalEvents.add(ec.contractName);
@@ -1352,7 +1297,6 @@ function make$1(startBlock, endBlock, eventConfigs, addresses, maxAddrInPartitio
1352
1297
  dependsOnAddresses: false
1353
1298
  },
1354
1299
  addressesByContractName: {},
1355
- contractNameByAddress: {},
1356
1300
  mergeBlock: undefined,
1357
1301
  dynamicContract: undefined,
1358
1302
  mutPendingQueries: [],
@@ -1370,27 +1314,14 @@ function make$1(startBlock, endBlock, eventConfigs, addresses, maxAddrInPartitio
1370
1314
  let dynamicContracts = new Set();
1371
1315
  addresses.forEach(contract => {
1372
1316
  let contractName = contract.contractName;
1373
- let match = contractConfigs[contractName];
1374
- let contractStartBlock = match !== undefined ? match.startBlock : undefined;
1375
- let ia_address = contract.address;
1376
- let ia_contractName = contract.contractName;
1377
- let ia_registrationBlock = contract.registrationBlock;
1378
- let ia_effectiveStartBlock = deriveEffectiveStartBlock(contract.registrationBlock, contractStartBlock);
1379
- let ia = {
1380
- address: ia_address,
1381
- contractName: ia_contractName,
1382
- registrationBlock: ia_registrationBlock,
1383
- effectiveStartBlock: ia_effectiveStartBlock
1384
- };
1385
- indexingAddresses[contract.address] = ia;
1386
- if (!contractNamesWithNormalEvents.has(contractName)) {
1387
- return;
1388
- }
1389
- let registeringContracts = Utils.Dict.getOrInsertEmptyDict(registeringContractsByContract, contractName);
1390
- registeringContracts[contract.address] = ia;
1391
- if (contract.registrationBlock !== -1) {
1392
- dynamicContracts.add(contractName);
1393
- return;
1317
+ if (contractNamesWithNormalEvents.has(contractName)) {
1318
+ Utils.Dict.getOrInsertEmptyDict(registeringContractsByContract, contractName)[contract.address] = IndexingAddresses.makeIndexingAddress(contract, contractConfigs);
1319
+ if (contract.registrationBlock !== -1) {
1320
+ dynamicContracts.add(contractName);
1321
+ return;
1322
+ } else {
1323
+ return;
1324
+ }
1394
1325
  }
1395
1326
  });
1396
1327
  let optimizedPartitions = createPartitionsFromIndexingAddresses(registeringContractsByContract, dynamicContracts, normalSelection, maxAddrInPartition, partitions.length, partitions, progressBlockNumber);
@@ -1412,7 +1343,6 @@ function make$1(startBlock, endBlock, eventConfigs, addresses, maxAddrInPartitio
1412
1343
  startBlock: startBlock,
1413
1344
  endBlock: endBlock,
1414
1345
  normalSelection: normalSelection,
1415
- indexingAddresses: indexingAddresses,
1416
1346
  contractConfigs: contractConfigs,
1417
1347
  chainId: chainId,
1418
1348
  latestOnBlockBlockNumber: latestOnBlockBlockNumber,
@@ -1423,8 +1353,6 @@ function make$1(startBlock, endBlock, eventConfigs, addresses, maxAddrInPartitio
1423
1353
  knownHeight: knownHeight,
1424
1354
  firstEventBlock: firstEventBlock
1425
1355
  };
1426
- let numAddresses = Utils.Dict.size(indexingAddresses);
1427
- Prometheus.IndexingAddresses.set(numAddresses, chainId);
1428
1356
  Prometheus.IndexingPartitions.set(optimizedPartitions.idsInAscOrder.length, chainId);
1429
1357
  Prometheus.IndexingBufferSize.set(buffer.length, chainId);
1430
1358
  Prometheus.IndexingBufferBlockNumber.set(bufferBlockNumber(fetchState), chainId);
@@ -1438,22 +1366,6 @@ function bufferSize(param) {
1438
1366
  return param.buffer.length;
1439
1367
  }
1440
1368
 
1441
- function bufferReadyCount(fetchState) {
1442
- let frontier = bufferBlockNumber(fetchState);
1443
- let buffer = fetchState.buffer;
1444
- let lo = 0;
1445
- let hi = buffer.length;
1446
- while (lo < hi) {
1447
- let mid = (lo + hi | 0) / 2 | 0;
1448
- if (buffer[mid].blockNumber <= frontier) {
1449
- lo = mid + 1 | 0;
1450
- } else {
1451
- hi = mid;
1452
- }
1453
- };
1454
- return lo;
1455
- }
1456
-
1457
1369
  function rollbackPendingQueries(mutPendingQueries, targetBlockNumber) {
1458
1370
  let adjusted = [];
1459
1371
  for (let qIdx = 0, qIdx_finish = mutPendingQueries.length; qIdx < qIdx_finish; ++qIdx) {
@@ -1483,16 +1395,8 @@ function rollbackPendingQueries(mutPendingQueries, targetBlockNumber) {
1483
1395
  return adjusted;
1484
1396
  }
1485
1397
 
1486
- function rollback(fetchState, targetBlockNumber) {
1487
- let addressesToRemove = new Set();
1488
- let indexingAddresses = {};
1489
- Utils.Dict.forEachWithKey(fetchState.indexingAddresses, (indexingContract, address) => {
1490
- if (indexingContract.registrationBlock > targetBlockNumber) {
1491
- addressesToRemove.add(address);
1492
- } else {
1493
- indexingAddresses[address] = indexingContract;
1494
- }
1495
- });
1398
+ function rollback(fetchState, indexingAddresses, targetBlockNumber) {
1399
+ IndexingAddresses.rollbackInPlace(indexingAddresses, targetBlockNumber);
1496
1400
  let keptPartitions = [];
1497
1401
  let nextKeptIdRef = 0;
1498
1402
  let registeringContractsByContract = {};
@@ -1503,11 +1407,12 @@ function rollback(fetchState, targetBlockNumber) {
1503
1407
  if (p.latestFetchedBlock.blockNumber > targetBlockNumber) {
1504
1408
  Utils.Dict.forEachWithKey(p.addressesByContractName, (addresses, contractName) => {
1505
1409
  addresses.forEach(address => {
1506
- if (!(!addressesToRemove.has(address) && Stdlib_Option.isSome(indexingAddresses[address]))) {
1410
+ let indexingContract = IndexingAddresses.get(indexingAddresses, address);
1411
+ if (indexingContract === undefined) {
1507
1412
  return;
1508
1413
  }
1509
1414
  let registeringContracts = Utils.Dict.getOrInsertEmptyDict(registeringContractsByContract, contractName);
1510
- registeringContracts[address] = indexingAddresses[address];
1415
+ registeringContracts[address] = indexingContract;
1511
1416
  });
1512
1417
  });
1513
1418
  } else {
@@ -1515,7 +1420,7 @@ function rollback(fetchState, targetBlockNumber) {
1515
1420
  let mergeBlock$1 = mergeBlock !== undefined && mergeBlock > targetBlockNumber ? targetBlockNumber : mergeBlock;
1516
1421
  let rollbackedAddressesByContractName = {};
1517
1422
  Utils.Dict.forEachWithKey(p.addressesByContractName, (addresses, contractName) => {
1518
- let keptAddresses = addresses.filter(address => !addressesToRemove.has(address));
1423
+ let keptAddresses = addresses.filter(address => Stdlib_Option.isSome(IndexingAddresses.get(indexingAddresses, address)));
1519
1424
  if (keptAddresses.length !== 0) {
1520
1425
  rollbackedAddressesByContractName[contractName] = keptAddresses;
1521
1426
  return;
@@ -1529,7 +1434,6 @@ function rollback(fetchState, targetBlockNumber) {
1529
1434
  latestFetchedBlock: p.latestFetchedBlock,
1530
1435
  selection: p.selection,
1531
1436
  addressesByContractName: rollbackedAddressesByContractName,
1532
- contractNameByAddress: p.contractNameByAddress,
1533
1437
  mergeBlock: mergeBlock$1,
1534
1438
  dynamicContract: p.dynamicContract,
1535
1439
  mutPendingQueries: rollbackPendingQueries(p.mutPendingQueries, targetBlockNumber),
@@ -1551,7 +1455,6 @@ function rollback(fetchState, targetBlockNumber) {
1551
1455
  }) : p.latestFetchedBlock,
1552
1456
  selection: p.selection,
1553
1457
  addressesByContractName: p.addressesByContractName,
1554
- contractNameByAddress: p.contractNameByAddress,
1555
1458
  mergeBlock: p.mergeBlock,
1556
1459
  dynamicContract: p.dynamicContract,
1557
1460
  mutPendingQueries: rollbackPendingQueries(p.mutPendingQueries, targetBlockNumber),
@@ -1568,7 +1471,6 @@ function rollback(fetchState, targetBlockNumber) {
1568
1471
  startBlock: fetchState.startBlock,
1569
1472
  endBlock: fetchState.endBlock,
1570
1473
  normalSelection: fetchState.normalSelection,
1571
- indexingAddresses: fetchState.indexingAddresses,
1572
1474
  contractConfigs: fetchState.contractConfigs,
1573
1475
  chainId: fetchState.chainId,
1574
1476
  latestOnBlockBlockNumber: Primitive_int.min(fetchState.latestOnBlockBlockNumber, targetBlockNumber),
@@ -1578,7 +1480,7 @@ function rollback(fetchState, targetBlockNumber) {
1578
1480
  onBlockConfigs: fetchState.onBlockConfigs,
1579
1481
  knownHeight: fetchState.knownHeight,
1580
1482
  firstEventBlock: fetchState.firstEventBlock
1581
- }, optimizedPartitions, indexingAddresses, fetchState.buffer.filter(item => {
1483
+ }, optimizedPartitions, fetchState.buffer.filter(item => {
1582
1484
  let tmp;
1583
1485
  tmp = item.kind === 0 ? item.blockNumber : item.blockNumber;
1584
1486
  return tmp <= targetBlockNumber;
@@ -1597,7 +1499,6 @@ function resetPendingQueries(fetchState) {
1597
1499
  latestFetchedBlock: partition.latestFetchedBlock,
1598
1500
  selection: partition.selection,
1599
1501
  addressesByContractName: partition.addressesByContractName,
1600
- contractNameByAddress: partition.contractNameByAddress,
1601
1502
  mergeBlock: partition.mergeBlock,
1602
1503
  dynamicContract: partition.dynamicContract,
1603
1504
  mutPendingQueries: kept,
@@ -1620,7 +1521,6 @@ function resetPendingQueries(fetchState) {
1620
1521
  startBlock: fetchState.startBlock,
1621
1522
  endBlock: fetchState.endBlock,
1622
1523
  normalSelection: fetchState.normalSelection,
1623
- indexingAddresses: fetchState.indexingAddresses,
1624
1524
  contractConfigs: fetchState.contractConfigs,
1625
1525
  chainId: fetchState.chainId,
1626
1526
  latestOnBlockBlockNumber: fetchState.latestOnBlockBlockNumber,
@@ -1750,7 +1650,7 @@ function getProgressBlockNumberAt(fetchState, index) {
1750
1650
  function updateKnownHeight(fetchState, knownHeight) {
1751
1651
  if (knownHeight > fetchState.knownHeight) {
1752
1652
  Prometheus.IndexingKnownHeight.set(knownHeight, fetchState.chainId);
1753
- return updateInternal(fetchState, undefined, undefined, undefined, undefined, knownHeight);
1653
+ return updateInternal(fetchState, undefined, undefined, undefined, knownHeight);
1754
1654
  } else {
1755
1655
  return fetchState;
1756
1656
  }
@@ -1763,7 +1663,6 @@ let blockItemLogIndex = 16777216;
1763
1663
  let maxPendingChunksPerPartition = 10;
1764
1664
 
1765
1665
  export {
1766
- deriveEffectiveStartBlock,
1767
1666
  deriveContractNameByAddress,
1768
1667
  defaultEstResponseSize,
1769
1668
  calculateEstResponseSize,
@@ -1772,9 +1671,9 @@ export {
1772
1671
  OptimizedPartitions,
1773
1672
  bufferBlockNumber,
1774
1673
  bufferBlock,
1674
+ bufferReadyCount,
1775
1675
  compareBufferItem,
1776
1676
  blockItemLogIndex,
1777
- numAddresses,
1778
1677
  appendOnBlockItems,
1779
1678
  updateInternal,
1780
1679
  warnDifferentContractType,
@@ -1791,7 +1690,6 @@ export {
1791
1690
  getReadyItemsCount,
1792
1691
  make$1 as make,
1793
1692
  bufferSize,
1794
- bufferReadyCount,
1795
1693
  rollbackPendingQueries,
1796
1694
  rollback,
1797
1695
  resetPendingQueries,
@@ -1804,4 +1702,4 @@ export {
1804
1702
  getProgressBlockNumberAt,
1805
1703
  updateKnownHeight,
1806
1704
  }
1807
- /* Utils Not a pure module */
1705
+ /* deriveContractNameByAddress Not a pure module */