ponder 0.8.21 → 0.8.23

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.
@@ -6820,8 +6820,8 @@ function encodeTrace({
6820
6820
  input: trace.input,
6821
6821
  functionSelector: trace.input.slice(0, 10),
6822
6822
  output: trace.output ?? null,
6823
- revertReason: trace.revertReason ?? null,
6824
- error: trace.error ?? null,
6823
+ revertReason: trace.revertReason ? trace.revertReason.replace(/\0/g, "") : null,
6824
+ error: trace.error ? trace.error.replace(/\0/g, "") : null,
6825
6825
  value: trace.value ? hexToBigInt(trace.value) : null,
6826
6826
  index: trace.index,
6827
6827
  subcalls: trace.subcalls,
@@ -7295,7 +7295,7 @@ var createSyncStore = ({
7295
7295
  const hasLog = row.log_id !== null;
7296
7296
  const hasTransaction = row.tx_hash !== null;
7297
7297
  const hasTrace = row.trace_id !== null;
7298
- const hasTransactionReceipt = shouldGetTransactionReceipt(filter);
7298
+ const hasTransactionReceipt = shouldGetTransactionReceipt(filter) && row.txr_from !== null;
7299
7299
  return {
7300
7300
  chainId: filter.chainId,
7301
7301
  sourceIndex: Number(row.event_filterIndex),
@@ -7738,7 +7738,7 @@ var buildEvents = ({
7738
7738
  transaction: transactionCache.has(log.transactionHash) ? convertTransaction(
7739
7739
  transactionCache.get(log.transactionHash)
7740
7740
  ) : void 0,
7741
- transactionReceipt: shouldGetTransactionReceipt(filter) ? convertTransactionReceipt(
7741
+ transactionReceipt: transactionReceiptCache.has(log.transactionHash) && shouldGetTransactionReceipt(filter) ? convertTransactionReceipt(
7742
7742
  transactionReceiptCache.get(log.transactionHash)
7743
7743
  ) : void 0,
7744
7744
  trace: void 0
@@ -8672,9 +8672,19 @@ var createHistoricalSync = async (args) => {
8672
8672
  if (shouldGetTransactionReceipt(filter)) {
8673
8673
  const transactionReceipts = await Promise.all(
8674
8674
  Array.from(requiredBlocks).map((blockHash) => {
8675
- const blockTransactionHashes = new Set(
8676
- logs.filter((l) => l.blockHash === blockHash).map((l) => l.transactionHash)
8677
- );
8675
+ const blockTransactionHashes = /* @__PURE__ */ new Set();
8676
+ for (const log of logs) {
8677
+ if (log.blockHash === blockHash) {
8678
+ if (log.transactionHash === zeroHash) {
8679
+ args.common.logger.warn({
8680
+ service: "sync",
8681
+ msg: `Detected log with empty transaction hash in block ${log.blockHash} at log index ${hexToNumber4(log.logIndex)}. This is expected for some networks like ZKsync.`
8682
+ });
8683
+ } else {
8684
+ blockTransactionHashes.add(log.transactionHash);
8685
+ }
8686
+ }
8687
+ }
8678
8688
  return syncTransactionReceipts(blockHash, blockTransactionHashes);
8679
8689
  })
8680
8690
  ).then((receipts) => receipts.flat());
@@ -9345,7 +9355,7 @@ var createRealtimeSync = (args) => {
9345
9355
  for (const hash of Array.from(transactionHashes)) {
9346
9356
  if (blockReceiptsTransactionHashes.has(hash) === false) {
9347
9357
  throw new Error(
9348
- `Detected inconsistent RPC responses. Transaction receipt with transactionHash ${hash} is missing in \`blockReceipts\`.`
9358
+ `Detected inconsistent RPC responses. 'transaction.hash' ${hash} not found in eth_getBlockReceipts response for block '${blockHash}'`
9349
9359
  );
9350
9360
  }
9351
9361
  }
@@ -9428,11 +9438,18 @@ var createRealtimeSync = (args) => {
9428
9438
  let isMatched = false;
9429
9439
  for (const filter of logFilters) {
9430
9440
  if (isLogFilterMatched({ filter, block, log })) {
9431
- requiredTransactions.add(log.transactionHash);
9432
9441
  isMatched = true;
9433
- if (shouldGetTransactionReceipt(filter)) {
9434
- requiredTransactionReceipts.add(log.transactionHash);
9435
- break;
9442
+ if (log.transactionHash === zeroHash2) {
9443
+ args.common.logger.warn({
9444
+ service: "sync",
9445
+ msg: `Detected log with empty transaction hash in block ${block.hash} at log index ${hexToNumber6(log.logIndex)}. This is expected for some networks like ZKsync.`
9446
+ });
9447
+ } else {
9448
+ requiredTransactions.add(log.transactionHash);
9449
+ if (shouldGetTransactionReceipt(filter)) {
9450
+ requiredTransactionReceipts.add(log.transactionHash);
9451
+ break;
9452
+ }
9436
9453
  }
9437
9454
  }
9438
9455
  }
@@ -10217,7 +10234,6 @@ var createSync = async (args) => {
10217
10234
  to: to < estimatedTo ? to : estimatedTo,
10218
10235
  limit: getEventsMaxBatchSize
10219
10236
  });
10220
- consecutiveErrors = 0;
10221
10237
  args.common.logger.debug({
10222
10238
  service: "sync",
10223
10239
  msg: `Fetched ${events.length} events from the database for a ${formatEta(estimateSeconds * 1e3)} range from ${decodeCheckpoint(from).blockTimestamp}`
@@ -10235,6 +10251,7 @@ var createSync = async (args) => {
10235
10251
  prev: estimateSeconds,
10236
10252
  maxIncrease: 1.08
10237
10253
  });
10254
+ consecutiveErrors = 0;
10238
10255
  yield { events, checkpoint: to };
10239
10256
  from = cursor;
10240
10257
  } catch (error) {