Skip to content

Commit

Permalink
fix(sdk): retry network request proof (#1977)
Browse files Browse the repository at this point in the history
  • Loading branch information
mattstam authored Jan 23, 2025
1 parent c974966 commit 5972269
Showing 1 changed file with 28 additions and 22 deletions.
50 changes: 28 additions & 22 deletions crates/sdk/src/network/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -302,28 +302,34 @@ impl NetworkClient {
self.create_artifact_with_content(&mut store, ArtifactType::Stdin, &stdin).await?;

// Send the request.
let mut rpc = self.prover_network_client().await?;
let nonce = self.get_nonce().await?;
let request_body = RequestProofRequestBody {
nonce,
version: format!("sp1-{version}"),
vk_hash: vk_hash.to_vec(),
mode: mode.into(),
strategy: strategy.into(),
stdin_uri,
deadline,
cycle_limit,
};
let request_response = rpc
.request_proof(RequestProofRequest {
format: MessageFormat::Binary.into(),
signature: request_body.sign(&self.signer).into(),
body: Some(request_body),
})
.await?
.into_inner();

Ok(request_response)
self.with_retry(
|| async {
let mut rpc = self.prover_network_client().await?;
let nonce = self.get_nonce().await?;
let request_body = RequestProofRequestBody {
nonce,
version: format!("sp1-{version}"),
vk_hash: vk_hash.to_vec(),
mode: mode.into(),
strategy: strategy.into(),
stdin_uri: stdin_uri.clone(),
deadline,
cycle_limit,
};
let request_response = rpc
.request_proof(RequestProofRequest {
format: MessageFormat::Binary.into(),
signature: request_body.sign(&self.signer).into(),
body: Some(request_body),
})
.await?
.into_inner();

Ok(request_response)
},
"requesting proof",
)
.await
}

pub(crate) async fn prover_network_client(&self) -> Result<ProverNetworkClient<Channel>> {
Expand Down

0 comments on commit 5972269

Please sign in to comment.