Skip to content

fix(network-monitor): move local proving off async runtime#2136

Open
Ollie202 wants to merge 1 commit into
0xMiden:nextfrom
Ollie202:fix/network-monitor-blocking-work
Open

fix(network-monitor): move local proving off async runtime#2136
Ollie202 wants to merge 1 commit into
0xMiden:nextfrom
Ollie202:fix/network-monitor-blocking-work

Conversation

@Ollie202
Copy link
Copy Markdown
Contributor

Partially addresses #1976.

Problem

The network monitor still performs local transaction execution and proof generation directly from async code in two places:

  • counter account deployment
  • periodic counter increment submission

Both paths can run CPU-heavy VM/prover work without yielding, which can starve Tokio worker threads while the monitor is running.

Changes

  • Move counter account deployment execution/proving into spawn_blocking_in_current_span.
  • Move counter increment execution/proving into spawn_blocking_in_current_span.
  • Add Clone for MonitorDataStore so the blocking task owns a fresh in-memory datastore and can rebuild its MAST store from the loaded accounts.
  • Add a changelog entry for the Execution and signing is blocking in an async runtime #1976 follow-up.

Testing

  • cargo +nightly fmt --check --all
  • git diff --check

I also tried cargo check -p miden-network-monitor, but it stops before compiling on Windows because the current protocol dependency pulls an AggLayer submodule file with : in the filename:

tools/addRollupType/addRollupMainnet10/add_rollup_type_10_output-2025-03-11T15:54:21.263Z.json

Comment thread bin/network-monitor/src/deploy/mod.rs Outdated
let proven_tx = prover.prove(executed_tx).await.context("Failed to prove transaction")?;
let account_id = counter_account.id();
let handle = tokio::runtime::Handle::current();
let (proven_tx, transaction_inputs) = spawn_blocking_in_current_span(move || {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

considering that this shouldn't be called regularly, maybe we can omit spawn blocking here

Comment thread CHANGELOG.md Outdated
- [BREAKING] Removed `CheckNullifiers` endpoint ([#2049](https://github.com/0xMiden/node/pull/2049)).
- Replaced blocking-in-async operations in the validator, remote prover, and ntx-builder with `spawn_blocking` to avoid starving the Tokio runtime ([#2041](https://github.com/0xMiden/node/pull/2041)).
- Replaced local store block proving with `spawn_blocking` to avoid starving the Tokio runtime ([#1976](https://github.com/0xMiden/node/issues/1976)).
- Replaced local network monitor transaction execution and proving with `spawn_blocking` to avoid starving the Tokio runtime ([#1976](https://github.com/0xMiden/node/issues/1976)).
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think thadt this change requires a changelog entry

@Ollie202 Ollie202 force-pushed the fix/network-monitor-blocking-work branch from 53b4ea4 to ce36808 Compare May 28, 2026 14:04
@Ollie202 Ollie202 requested a review from SantiagoPittella May 28, 2026 14:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants