Skip to content

Commit

Permalink
Expose block batch size
Browse files Browse the repository at this point in the history
  • Loading branch information
sug0 committed Nov 12, 2024
1 parent 82f6925 commit 66cc88f
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 0 deletions.
9 changes: 9 additions & 0 deletions crates/apps_lib/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3386,6 +3386,8 @@ pub mod args {
}),
);
pub const BIRTHDAY: ArgOpt<BlockHeight> = arg_opt("birthday");
pub const BLOCK_BATCH: ArgDefault<usize> =
arg_default("block-batch", DefaultFn(|| 10));
pub const BLOCK_HEIGHT: Arg<BlockHeight> = arg("block-height");
pub const BLOCK_HEIGHT_OPT: ArgOpt<BlockHeight> = arg_opt("height");
pub const BLOCK_HEIGHT_TO_OPT: ArgOpt<BlockHeight> = arg_opt("to-height");
Expand Down Expand Up @@ -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,
Expand All @@ -6812,6 +6815,7 @@ pub mod args {
wait_for_last_query_height,
max_concurrent_fetches,
retry_strategy,
block_batch_size,
}
}

Expand Down Expand Up @@ -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."
)))
}
}

Expand All @@ -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),
Expand Down
1 change: 1 addition & 0 deletions crates/apps_lib/src/client/masp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
1 change: 1 addition & 0 deletions crates/node/src/bench_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
))
Expand Down
2 changes: 2 additions & 0 deletions crates/sdk/src/args.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2158,6 +2158,8 @@ pub struct ShieldedSync<C: NamadaTypes = SdkTypes> {
/// 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,
Expand Down

0 comments on commit 66cc88f

Please sign in to comment.