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
This commit is contained in:
Paul Hauner 2020-11-18 22:18:59 +00:00
parent 0c2c2cef93
commit bcc7f6b143
2 changed files with 15 additions and 0 deletions

View File

@ -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")

View File

@ -197,6 +197,12 @@ pub fn get_config<E: EthSpec>(
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));
}