Skip to content

Commit 74f820e

Browse files
chore: fix large_stack_frames clippy warning in run_script (#15361)
1 parent 1630905 commit 74f820e

1 file changed

Lines changed: 25 additions & 16 deletions

File tree

crates/script/src/lib.rs

Lines changed: 25 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -347,30 +347,39 @@ impl ScriptArgs {
347347
eyre::bail!("--tempo.session/TEMPO_SESSION_ID cannot be combined with --unlocked");
348348
}
349349

350+
// Box each branch's future to keep its large async state off `run_script`'s future;
351+
// otherwise `run_command` trips `clippy::large_stack_frames` by a small margin.
350352
if is_tempo {
351353
let batch = self.batch;
352-
let bundled = match self.prepare_bundled::<TempoEvmNetwork>(config, evm_opts).await? {
353-
Some(bundled) => bundled,
354-
None => return Ok(()),
355-
};
356-
// batch mode owns its own pending recovery inside broadcast_batch(); running the
357-
// generic wait_for_pending() first would race with that and could double-process
358-
// an already-confirmed batch hash.
359-
let bundled = if batch { bundled } else { bundled.wait_for_pending().await? };
360-
let broadcasted =
361-
if batch { bundled.broadcast_batch().await? } else { bundled.broadcast().await? };
362-
if broadcasted.args.verify {
363-
broadcasted.verify().await?;
364-
}
365-
return Ok(());
354+
return Box::pin(async move {
355+
let bundled =
356+
match self.prepare_bundled::<TempoEvmNetwork>(config, evm_opts).await? {
357+
Some(bundled) => bundled,
358+
None => return Ok(()),
359+
};
360+
// batch mode owns its own pending recovery inside broadcast_batch(); running the
361+
// generic wait_for_pending() first would race with that and could double-process
362+
// an already-confirmed batch hash.
363+
let bundled = if batch { bundled } else { bundled.wait_for_pending().await? };
364+
let broadcasted = if batch {
365+
bundled.broadcast_batch().await?
366+
} else {
367+
bundled.broadcast().await?
368+
};
369+
if broadcasted.args.verify {
370+
broadcasted.verify().await?;
371+
}
372+
Ok(())
373+
})
374+
.await;
366375
}
367376

368377
#[cfg(feature = "optimism")]
369378
if evm_opts.networks.is_optimism() {
370-
return self.run_generic_script::<OpEvmNetwork>(config, evm_opts).await;
379+
return Box::pin(self.run_generic_script::<OpEvmNetwork>(config, evm_opts)).await;
371380
}
372381

373-
self.run_generic_script::<EthEvmNetwork>(config, evm_opts).await
382+
Box::pin(self.run_generic_script::<EthEvmNetwork>(config, evm_opts)).await
374383
}
375384

376385
/// Prepares the bundled state (compile, simulate, bundle) and returns it

0 commit comments

Comments
 (0)