diff --git a/crates/apps_lib/src/cli.rs b/crates/apps_lib/src/cli.rs index 9739caaed5..8fb3e293b3 100644 --- a/crates/apps_lib/src/cli.rs +++ b/crates/apps_lib/src/cli.rs @@ -3386,6 +3386,8 @@ pub mod args { }), ); pub const BIRTHDAY: ArgOpt = arg_opt("birthday"); + pub const BLOCK_BATCH: ArgDefault = + arg_default("block-batch", DefaultFn(|| 10)); pub const BLOCK_HEIGHT: Arg = arg("block-height"); pub const BLOCK_HEIGHT_OPT: ArgOpt = arg_opt("height"); pub const BLOCK_HEIGHT_TO_OPT: ArgOpt = arg_opt("to-height"); @@ -6803,6 +6805,7 @@ pub mod args { Some(times) => RetryStrategy::Times(times), None => RetryStrategy::Forever, }; + let block_batch_size = BLOCK_BATCH.parse(matches); Self { ledger_address, last_query_height, @@ -6812,6 +6815,7 @@ pub mod args { wait_for_last_query_height, max_concurrent_fetches, retry_strategy, + block_batch_size, } } @@ -6849,6 +6853,10 @@ pub mod args { "Maximum number of times to retry fetching. If no \ argument is provided, defaults to retrying forever." ))) + .arg(BLOCK_BATCH.def().help(wrap!( + "Number of blocks fetched per concurrent fetch job. The \ + default is 10." + ))) } } @@ -6862,6 +6870,7 @@ pub mod args { let chain_ctx = ctx.borrow_mut_chain_or_exit(); Ok(ShieldedSync { + block_batch_size: self.block_batch_size, max_concurrent_fetches: self.max_concurrent_fetches, wait_for_last_query_height: self.wait_for_last_query_height, ledger_address: chain_ctx.get(&self.ledger_address), diff --git a/crates/apps_lib/src/client/masp.rs b/crates/apps_lib/src/client/masp.rs index 9992ce96c7..1973564acd 100644 --- a/crates/apps_lib/src/client/masp.rs +++ b/crates/apps_lib/src/client/masp.rs @@ -84,6 +84,7 @@ pub async fn syncing< .shutdown_signal(install_shutdown_signal(false)) .wait_for_last_query_height(args.wait_for_last_query_height) .retry_strategy(args.retry_strategy) + .block_batch_size(args.block_batch_size) .build(); let env = MaspLocalTaskEnv::new(500) diff --git a/crates/node/src/bench_utils.rs b/crates/node/src/bench_utils.rs index e8224f4a24..9bbaeb53f3 100644 --- a/crates/node/src/bench_utils.rs +++ b/crates/node/src/bench_utils.rs @@ -1192,6 +1192,7 @@ impl BenchShieldedCtx { wait_for_last_query_height: false, max_concurrent_fetches: 100, retry_strategy: RetryStrategy::Forever, + block_batch_size: 10, }, &StdIo, )) diff --git a/crates/sdk/src/args.rs b/crates/sdk/src/args.rs index 5933a663f3..9874d3aaf0 100644 --- a/crates/sdk/src/args.rs +++ b/crates/sdk/src/args.rs @@ -2158,6 +2158,8 @@ pub struct ShieldedSync { /// Maximum number of fetch jobs that will ever /// execute concurrently during the shielded sync. pub max_concurrent_fetches: usize, + /// Number of blocks fetched per concurrent fetch job. + pub block_batch_size: usize, /// Maximum number of times to retry fetching. If `None` /// is provided, defaults to "forever". pub retry_strategy: RetryStrategy,