Skip to content

Commit

Permalink
agent, service: increase the suggested L2 block distance on warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
tilacog committed Sep 29, 2023
1 parent d11d10a commit c725e4b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
6 changes: 5 additions & 1 deletion packages/indexer-agent/src/commands/start.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ import { displayZodParsingError } from './error-handling'
export type AgentOptions = { [key: string]: any } & Argv['argv']

const DEFAULT_SUBGRAPH_MAX_BLOCK_DISTANCE = 0
const SUGGESTED_SUBGRAPH_MAX_BLOCK_DISTANCE_ON_L2 =
50 + DEFAULT_SUBGRAPH_MAX_BLOCK_DISTANCE
const DEFAULT_SUBGRAPH_FRESHNESS_SLEEP_MILLISECONDS = 5_000

export const start = {
Expand Down Expand Up @@ -382,7 +384,9 @@ export async function createNetworkSpecification(
// Warn about inappropriate max block distance for subgraph threshold checks for given networks.
if (networkIdentifier.startsWith('eip155:42161')) {
// Arbitrum-One and Arbitrum-Goerli
if (subgraphs.maxBlockDistance <= DEFAULT_SUBGRAPH_MAX_BLOCK_DISTANCE) {
if (
subgraphs.maxBlockDistance <= SUGGESTED_SUBGRAPH_MAX_BLOCK_DISTANCE_ON_L2
) {
logger.warn(
`Consider increasing 'subgraph-max-block-distance' for Arbitrum networks`,
{
Expand Down
4 changes: 3 additions & 1 deletion packages/indexer-service/src/commands/start.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import fs from 'fs'
import { parse as yaml_parse } from 'yaml'

const DEFAULT_SUBGRAPH_MAX_BLOCK_DISTANCE = 0
const SUGGESTED_SUBGRAPH_MAX_BLOCK_DISTANCE_ON_L2 =
50 + DEFAULT_SUBGRAPH_MAX_BLOCK_DISTANCE
const DEFAULT_SUBGRAPH_FRESHNESS_SLEEP_MILLISECONDS = 5_000

import {
Expand Down Expand Up @@ -318,7 +320,7 @@ export default {
// Warn about inappropriate max block distance for subgraph threshold checks for given networks.
if (protocolNetwork.startsWith('eip155:42161')) {
// Arbitrum-One and Arbitrum-Goerli
if (argv.subgraphMaxBlockDistance <= DEFAULT_SUBGRAPH_MAX_BLOCK_DISTANCE) {
if (argv.subgraphMaxBlockDistance <= SUGGESTED_SUBGRAPH_MAX_BLOCK_DISTANCE_ON_L2) {
logger.warn(
`Consider increasing 'subgraph-max-block-distance' for Arbitrum networks`,
{
Expand Down

0 comments on commit c725e4b

Please sign in to comment.