From bcc7f6b143ccd46aa8e493e150af359b2d3639b8 Mon Sep 17 00:00:00 2001 From: Paul Hauner Date: Wed, 18 Nov 2020 22:18:59 +0000 Subject: [PATCH] Add new flag to set blocks per eth1 query (#1931) ## Issue Addressed NA ## Proposed Changes Users on Discord (and @protolambda) have experienced this error (or variants of it): ``` Failed to update eth1 cache: GetDepositLogsFailed("Eth1 node returned error: {\"code\":-32005,\"message\":\"query returned more than 10000 results\"}") ``` This PR allows users to reduce the span of blocks searched for deposit logs and therefore reduce the size of the return result. Hopefully experimentation with this flag can lead to finding a better default value. ## Additional Info NA --- beacon_node/src/cli.rs | 9 +++++++++ beacon_node/src/config.rs | 6 ++++++ 2 files changed, 15 insertions(+) diff --git a/beacon_node/src/cli.rs b/beacon_node/src/cli.rs index 3d867320c5..76ace261de 100644 --- a/beacon_node/src/cli.rs +++ b/beacon_node/src/cli.rs @@ -279,6 +279,15 @@ pub fn cli_app<'a, 'b>() -> App<'a, 'b> { .help("Specifies the server for a web3 connection to the Eth1 chain. Also enables the --eth1 flag. Defaults to http://127.0.0.1:8545.") .takes_value(true) ) + .arg( + Arg::with_name("eth1-blocks-per-log-query") + .long("eth1-blocks-per-log-query") + .value_name("BLOCKS") + .help("Specifies the number of blocks that a deposit log query should span. \ + This will reduce the size of responses from the Eth1 endpoint.") + .default_value("1000") + .takes_value(true) + ) .arg( Arg::with_name("slots-per-restore-point") .long("slots-per-restore-point") diff --git a/beacon_node/src/config.rs b/beacon_node/src/config.rs index b0e00c4efb..e5a10ed47a 100644 --- a/beacon_node/src/config.rs +++ b/beacon_node/src/config.rs @@ -197,6 +197,12 @@ pub fn get_config( client_config.eth1.endpoint = val.to_string(); } + if let Some(val) = cli_args.value_of("eth1-blocks-per-log-query") { + client_config.eth1.blocks_per_log_query = val + .parse() + .map_err(|_| "eth1-blocks-per-log-query is not a valid integer".to_string())?; + } + if let Some(freezer_dir) = cli_args.value_of("freezer-dir") { client_config.freezer_db_path = Some(PathBuf::from(freezer_dir)); }