Skip to content

Commit

Permalink
chain: change env name for block receipts check and add to docs
Browse files Browse the repository at this point in the history
  • Loading branch information
incrypto32 committed Jun 17, 2024
1 parent 1ec1bcd commit 301773c
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 8 deletions.
14 changes: 8 additions & 6 deletions chain/ethereum/src/env.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,9 @@ pub struct EnvVars {
/// (expressed in seconds). The default value is 180s.
pub json_rpc_timeout: Duration,

/// Set by the environment variable `GRAPH_ETHEREUM_BLOCK_RECEIPTS_TIMEOUT`
/// (expressed in seconds). The default value is 180s.
pub block_receipts_timeout: Duration,
/// Set by the environment variable `GRAPH_ETHEREUM_BLOCK_RECEIPTS_CHECK_TIMEOUT`
/// (expressed in seconds). The default value is 10s.
pub block_receipts_check_timeout: Duration,
/// This is used for requests that will not fail the subgraph if the limit
/// is reached, but will simply restart the syncing step, so it can be low.
/// This limit guards against scenarios such as requesting a block hash that
Expand Down Expand Up @@ -118,7 +118,9 @@ impl From<Inner> for EnvVars {
block_batch_size: x.block_batch_size,
max_block_range_size: x.max_block_range_size,
json_rpc_timeout: Duration::from_secs(x.json_rpc_timeout_in_secs),
block_receipts_timeout: Duration::from_secs(x.block_receipts_timeout_in_seccs),
block_receipts_check_timeout: Duration::from_secs(
x.block_receipts_check_timeout_in_seccs,
),
request_retries: x.request_retries,
block_ingestor_max_concurrent_json_rpc_calls: x
.block_ingestor_max_concurrent_json_rpc_calls,
Expand Down Expand Up @@ -162,8 +164,8 @@ struct Inner {
max_block_range_size: BlockNumber,
#[envconfig(from = "GRAPH_ETHEREUM_JSON_RPC_TIMEOUT", default = "180")]
json_rpc_timeout_in_secs: u64,
#[envconfig(from = "GRAPH_ETHEREUM_BLOCK_RECEIPTS_TIMEOUT", default = "10")]
block_receipts_timeout_in_seccs: u64,
#[envconfig(from = "GRAPH_ETHEREUM_BLOCK_RECEIPTS_CHECK_TIMEOUT", default = "10")]
block_receipts_check_timeout_in_seccs: u64,
#[envconfig(from = "GRAPH_ETHEREUM_REQUEST_RETRIES", default = "10")]
request_retries: usize,
#[envconfig(
Expand Down
4 changes: 2 additions & 2 deletions chain/ethereum/src/ethereum_adapter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ impl EthereumAdapter {

info!(logger, "Checking eth_getBlockReceipts support");
let result = timeout(
ENV_VARS.block_receipts_timeout,
ENV_VARS.block_receipts_check_timeout,
check_block_receipt_support(web3, block_hash, supports_eip_1898, call_only),
)
.await;
Expand All @@ -261,7 +261,7 @@ impl EthereumAdapter {
warn!(
logger,
"Skipping use of block receipts, reason: Timeout after {} seconds",
ENV_VARS.block_receipts_timeout.as_secs()
ENV_VARS.block_receipts_check_timeout.as_secs()
);
false
}
Expand Down
5 changes: 5 additions & 0 deletions docs/environment-variables.md
Original file line number Diff line number Diff line change
Expand Up @@ -251,3 +251,8 @@ those.
- `GRAPH_STORE_WRITE_BATCH_SIZE`: how many changes to accumulate during
syncing in kilobytes before a write has to happen. The default is 10_000
which corresponds to 10MB. Setting this to 0 disables write batching.
- `GRAPH_MIN_HISTORY_BLOCKS`: Specifies the minimum number of blocks to
retain for subgraphs with historyBlocks set to auto. The default value is 2 times the reorg threshold.
- `GRAPH_ETHEREUM_BLOCK_RECEIPTS_CHECK_TIMEOUT`: Timeout for checking
`eth_getBlockReceipts` support during chain startup, if this times out
individual transaction receipts will be fetched instead. Defaults to 10s.

0 comments on commit 301773c

Please sign in to comment.