ponder 0.17.9 → 0.17.11

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.
@@ -301,13 +301,14 @@ export const createRealtimeSync = (
301
301
  ////////
302
302
 
303
303
  // "eth_getLogs" calls can be skipped if no filters match `newHeadBlock.logsBloom`.
304
- // Async-execution chains can expose blocks before logsBloom is execution-ready.
305
- const shouldRequestLogs =
306
- (isAsyncExecutionChain(args.chain.id) && logFilters.length > 0) ||
307
- maybeBlockHeader.logsBloom === zeroLogsBloom ||
308
- logFilters.some((filter) =>
309
- isFilterInBloom({ block: maybeBlockHeader, filter }),
310
- );
304
+ // Async-execution chains cannot reliably use blooms to filter or validate logs.
305
+ const isAsyncExecution = isAsyncExecutionChain(args.chain.id);
306
+ const shouldRequestLogs = isAsyncExecution
307
+ ? logFilters.length > 0
308
+ : maybeBlockHeader.logsBloom === zeroLogsBloom ||
309
+ logFilters.some((filter) =>
310
+ isFilterInBloom({ block: maybeBlockHeader, filter }),
311
+ );
311
312
 
312
313
  let logs: SyncLog[] = [];
313
314
  if (shouldRequestLogs) {
@@ -344,54 +345,57 @@ export const createRealtimeSync = (
344
345
  method: "eth_getBlockByHash",
345
346
  params: [block.hash, true],
346
347
  },
348
+ isAsyncExecutionChain(args.chain.id),
347
349
  );
348
350
 
349
- // Note: Exact `logsBloom` validations were considered too strict to add to `validateLogsAndBlock`.
350
- let isInvalidLogsBloom = false;
351
- for (const log of logs) {
352
- if (isInBloom(block.logsBloom, log.address) === false) {
353
- isInvalidLogsBloom = true;
354
- }
351
+ if (isAsyncExecutionChain(args.chain.id) === false) {
352
+ // Note: Exact `logsBloom` validations were considered too strict to add to `validateLogsAndBlock`.
353
+ let isInvalidLogsBloom = false;
354
+ for (const log of logs) {
355
+ if (isInBloom(block.logsBloom, log.address) === false) {
356
+ isInvalidLogsBloom = true;
357
+ }
355
358
 
356
- if (
357
- log.topics[0] &&
358
- isInBloom(block.logsBloom, log.topics[0]) === false
359
- ) {
360
- isInvalidLogsBloom = true;
361
- }
359
+ if (
360
+ log.topics[0] &&
361
+ isInBloom(block.logsBloom, log.topics[0]) === false
362
+ ) {
363
+ isInvalidLogsBloom = true;
364
+ }
362
365
 
363
- if (
364
- log.topics[1] &&
365
- isInBloom(block.logsBloom, log.topics[1]) === false
366
- ) {
367
- isInvalidLogsBloom = true;
368
- }
366
+ if (
367
+ log.topics[1] &&
368
+ isInBloom(block.logsBloom, log.topics[1]) === false
369
+ ) {
370
+ isInvalidLogsBloom = true;
371
+ }
369
372
 
370
- if (
371
- log.topics[2] &&
372
- isInBloom(block.logsBloom, log.topics[2]) === false
373
- ) {
374
- isInvalidLogsBloom = true;
375
- }
373
+ if (
374
+ log.topics[2] &&
375
+ isInBloom(block.logsBloom, log.topics[2]) === false
376
+ ) {
377
+ isInvalidLogsBloom = true;
378
+ }
376
379
 
377
- if (
378
- log.topics[3] &&
379
- isInBloom(block.logsBloom, log.topics[3]) === false
380
- ) {
381
- isInvalidLogsBloom = true;
382
- }
380
+ if (
381
+ log.topics[3] &&
382
+ isInBloom(block.logsBloom, log.topics[3]) === false
383
+ ) {
384
+ isInvalidLogsBloom = true;
385
+ }
383
386
 
384
- if (isInvalidLogsBloom) {
385
- args.common.logger.warn({
386
- msg: "Detected inconsistent RPC responses. Log not found in block.logsBloom.",
387
- action: "fetch_block_data",
388
- chain: args.chain.name,
389
- chain_id: args.chain.id,
390
- number: hexToNumber(block.number),
391
- hash: block.hash,
392
- logIndex: hexToNumber(log.logIndex),
393
- });
394
- break;
387
+ if (isInvalidLogsBloom) {
388
+ args.common.logger.warn({
389
+ msg: "Detected inconsistent RPC responses. Log not found in block.logsBloom.",
390
+ action: "fetch_block_data",
391
+ chain: args.chain.name,
392
+ chain_id: args.chain.id,
393
+ number: hexToNumber(block.number),
394
+ hash: block.hash,
395
+ logIndex: hexToNumber(log.logIndex),
396
+ });
397
+ break;
398
+ }
395
399
  }
396
400
  }
397
401
 
@@ -1,7 +1,10 @@
1
1
  import type { Chain } from "viem";
2
2
 
3
3
  export const isAsyncExecutionChain = (chainId: number) =>
4
- chainId === 143 || chainId === 10143;
4
+ chainId === 143 ||
5
+ chainId === 10143 ||
6
+ chainId === 43114 ||
7
+ chainId === 43113;
5
8
 
6
9
  /**
7
10
  * Returns the number of blocks that must pass before a block is considered final.
@@ -56,11 +56,7 @@ export const parseSQLQuery = async (sql: string): Promise<Node> => {
56
56
  export const validateAllowableSQLQuery = async (sql: string) => {
57
57
  const crypto = await import(/* webpackIgnore: true */ "node:crypto");
58
58
 
59
- const hash = crypto
60
- .createHash("sha256")
61
- .update(sql)
62
- .digest("hex")
63
- .slice(0, 10);
59
+ const hash = crypto.createHash("sha256").update(sql).digest("hex");
64
60
 
65
61
  if (ALLOW_CACHE.has(hash)) {
66
62
  const result = ALLOW_CACHE.get(hash)!;