Skip to content
Open
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
14 changes: 14 additions & 0 deletions crates/prover-types/src/artifacts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,20 @@ pub trait ArtifactClient: Send + Sync + Clone + 'static {
artifact_type: ArtifactType,
) -> impl Future<Output = Result<()>> + Send;

/// Block until the store has room for an upload of this artifact.
///
/// Default is a no-op; memory-bounded stores (Redis) override to re-introduce
/// the producer/consumer backpressure lost across a distributed split. The
/// return type is deliberately `()` — this call is advisory and must never
/// fail a proof. Implementations that can't determine store state should
/// return silently and let the upload proceed.
fn wait_for_upload_headroom(
&self,
_artifact: &impl ArtifactId,
) -> impl Future<Output = ()> + Send {
async {}
}

fn try_delete(
&self,
artifact: &impl ArtifactId,
Expand Down
5 changes: 5 additions & 0 deletions crates/prover/src/worker/controller/core.rs
Original file line number Diff line number Diff line change
Expand Up @@ -566,6 +566,11 @@ pub(super) async fn create_core_proving_task<A: ArtifactClient, W: WorkerClient>
TraceData::Memory(_) | TraceData::Precompile(_, _) => None,
};

// Block if the artifact store is near capacity — the distributed analog of the
// local node's `ProverSemaphore` backpressure. Advisory (returns `()`, cannot
// fail the proof). No-op for S3 / in-memory stores.
artifact_client.wait_for_upload_headroom(&record_artifact).await;

artifact_client
.upload(&record_artifact, trace_data)
.await
Expand Down
Loading