Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
- Replaced the network monitor's JavaScript dashboard with a server-rendered Maud + HTMX frontend ([#2024](https://github.com/0xMiden/node/pull/2024)).
- [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)).
- Implemented persistent RocksDB backend for `AccountStateForest`, improving startup time ([#2020](https://github.com/0xMiden/node/pull/2020)).
- [BREAKING] Replaced binding URL env vars and CLI flags with listen socket addresses ([#2054](https://github.com/0xMiden/node/pull/2054)).
- [BREAKING] `BlockRange.block_to` is now required for all RPC endpoints ([#2056](https://github.com/0xMiden/node/pull/2056)).
Expand Down
18 changes: 15 additions & 3 deletions crates/store/src/server/block_prover_client.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use miden_block_prover::{BlockProverError, LocalBlockProver};
use miden_node_utils::spawn::spawn_blocking_in_current_span;
use miden_protocol::batch::OrderedBatches;
use miden_protocol::block::{BlockHeader, BlockInputs, BlockProof};
use miden_remote_prover_client::{RemoteBlockProver, RemoteProverClientError};
Expand All @@ -12,6 +13,8 @@ pub enum StoreProverError {
LocalProvingFailed(#[source] BlockProverError),
#[error("remote proving failed")]
RemoteProvingFailed(#[source] RemoteProverClientError),
#[error("local proving task join error")]
LocalProvingTaskJoin(#[source] tokio::task::JoinError),
}

// BLOCK PROVER
Expand Down Expand Up @@ -43,9 +46,18 @@ impl BlockProver {
block_header: &BlockHeader,
) -> Result<BlockProof, StoreProverError> {
match self {
Self::Local(prover) => Ok(prover
.prove(tx_batches, block_header, block_inputs)
.map_err(StoreProverError::LocalProvingFailed)?),
Self::Local(prover) => {
let prover = prover.clone();
let block_header = block_header.clone();

spawn_blocking_in_current_span(move || {
prover
.prove(tx_batches, &block_header, block_inputs)
.map_err(StoreProverError::LocalProvingFailed)
})
.await
.map_err(StoreProverError::LocalProvingTaskJoin)?
},
Self::Remote(prover) => Ok(prover
.prove(tx_batches, block_header, block_inputs)
.await
Expand Down
Loading