From d25dcd9997a1b28d8a4af56763be43175fd82cfe Mon Sep 17 00:00:00 2001 From: mattstam Date: Tue, 3 Sep 2024 14:14:42 -0700 Subject: [PATCH 1/4] feat: specify version in network client --- crates/sdk/src/network/client.rs | 8 +++++--- crates/sdk/src/proto/network.rs | 9 ++++++++- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/crates/sdk/src/network/client.rs b/crates/sdk/src/network/client.rs index faacf41991..8ec7278086 100644 --- a/crates/sdk/src/network/client.rs +++ b/crates/sdk/src/network/client.rs @@ -118,10 +118,12 @@ impl NetworkClient { pub async fn get_proof_requests( &self, status: ProofStatus, + circuit_version: Option, ) -> Result { - self.with_error_handling( - self.rpc.get_proof_requests(GetProofRequestsRequest { status: status.into() }), - ) + self.with_error_handling(self.rpc.get_proof_requests(GetProofRequestsRequest { + status: status.into(), + circuit_version: circuit_version.map(|v| v.to_string()), + })) .await } diff --git a/crates/sdk/src/proto/network.rs b/crates/sdk/src/proto/network.rs index 4c3dd84771..1cbad6aec6 100644 --- a/crates/sdk/src/proto/network.rs +++ b/crates/sdk/src/proto/network.rs @@ -229,9 +229,12 @@ pub struct GetProofStatusResponse { #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct GetProofRequestsRequest { - /// The status of the proof requests to get. + /// The status of the proof requests to filter for. #[prost(enumeration = "ProofStatus", tag = "1")] pub status: i32, + /// The SP1 circuit version of the proof requests to filter for. + #[prost(string, optional, tag = "2")] + pub circuit_version: ::core::option::Option<::prost::alloc::string::String>, } /// A proof request. #[derive(serde::Serialize, serde::Deserialize)] @@ -247,6 +250,9 @@ pub struct RequestedProof { /// Proof requester's address. #[prost(bytes = "vec", tag = "3")] pub requester: ::prost::alloc::vec::Vec, + /// The SP1 circuit version to use for the proof. + #[prost(string, tag = "4")] + pub circuit_version: ::prost::alloc::string::String, } /// The response for getting proof requests by a given status. #[derive(serde::Serialize, serde::Deserialize)] @@ -493,6 +499,7 @@ impl UnclaimReason { } } } +pub use twirp; pub const SERVICE_FQN: &str = "/network.NetworkService"; #[twirp::async_trait::async_trait] pub trait NetworkService { From 2c5d524b905d7e314b8a5c3fd94b6141ec985b99 Mon Sep 17 00:00:00 2001 From: mattstam Date: Tue, 3 Sep 2024 15:31:21 -0700 Subject: [PATCH 2/4] str --- crates/sdk/src/network/client.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/crates/sdk/src/network/client.rs b/crates/sdk/src/network/client.rs index 8ec7278086..a5686121d6 100644 --- a/crates/sdk/src/network/client.rs +++ b/crates/sdk/src/network/client.rs @@ -114,15 +114,15 @@ impl NetworkClient { Ok((res, proof)) } - /// Get all the proof requests for a given status. + /// Get all the proof requests for a given status. Also filter by circuit version if provided. pub async fn get_proof_requests( &self, status: ProofStatus, - circuit_version: Option, + circuit_version: Option<&str>, ) -> Result { self.with_error_handling(self.rpc.get_proof_requests(GetProofRequestsRequest { status: status.into(), - circuit_version: circuit_version.map(|v| v.to_string()), + circuit_version: circuit_version.map(|v| v.to_owned()), })) .await } From a5f31f840ca237022cd71dbac8cca1e06818f40a Mon Sep 17 00:00:00 2001 From: mattstam Date: Tue, 3 Sep 2024 16:38:25 -0700 Subject: [PATCH 3/4] rn version in createproof --- crates/sdk/src/proto/network.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/sdk/src/proto/network.rs b/crates/sdk/src/proto/network.rs index 1cbad6aec6..a0e0d883e5 100644 --- a/crates/sdk/src/proto/network.rs +++ b/crates/sdk/src/proto/network.rs @@ -16,9 +16,9 @@ pub struct CreateProofRequest { /// The deadline for the proof request, signifying the latest time a fulfillment would be valid. #[prost(uint64, tag = "4")] pub deadline: u64, - /// The client version used, in the form of an 8-character git commit hash. + /// The SP1 circuit version to use for the proof. #[prost(string, tag = "5")] - pub version: ::prost::alloc::string::String, + pub circuit_version: ::prost::alloc::string::String, } /// The response for creating a proof. #[derive(serde::Serialize, serde::Deserialize)] From 3f0732b93f9c8795f239e5cf911776a5c5478f4c Mon Sep 17 00:00:00 2001 From: mattstam Date: Tue, 3 Sep 2024 16:52:40 -0700 Subject: [PATCH 4/4] fixes --- crates/sdk/src/network/client.rs | 10 ++++++---- crates/sdk/src/network/prover.rs | 3 +-- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/crates/sdk/src/network/client.rs b/crates/sdk/src/network/client.rs index a5686121d6..936d55fdb8 100644 --- a/crates/sdk/src/network/client.rs +++ b/crates/sdk/src/network/client.rs @@ -133,15 +133,17 @@ impl NetworkClient { elf: &[u8], stdin: &SP1Stdin, mode: ProofMode, - version: &str, + circuit_version: &str, ) -> Result { let start = SystemTime::now(); let since_the_epoch = start.duration_since(UNIX_EPOCH).expect("Invalid start time"); let deadline = since_the_epoch.as_secs() + TIMEOUT.as_secs(); let nonce = self.get_nonce().await?; - let create_proof_signature = - self.auth.sign_create_proof_message(nonce, deadline, mode.into(), version).await?; + let create_proof_signature = self + .auth + .sign_create_proof_message(nonce, deadline, mode.into(), circuit_version) + .await?; let res = self .with_error_handling(self.rpc.create_proof(CreateProofRequest { @@ -149,7 +151,7 @@ impl NetworkClient { nonce, deadline, mode: mode.into(), - version: version.to_string(), + circuit_version: circuit_version.to_string(), })) .await?; diff --git a/crates/sdk/src/network/prover.rs b/crates/sdk/src/network/prover.rs index 0b0759fcca..d7561a123f 100644 --- a/crates/sdk/src/network/prover.rs +++ b/crates/sdk/src/network/prover.rs @@ -61,8 +61,7 @@ impl NetworkProver { log::info!("Skipping simulation"); } - let version = SP1_CIRCUIT_VERSION; - let proof_id = client.create_proof(elf, &stdin, mode, version).await?; + let proof_id = client.create_proof(elf, &stdin, mode, SP1_CIRCUIT_VERSION).await?; log::info!("Created {}", proof_id); if NetworkClient::rpc_url() == DEFAULT_PROVER_NETWORK_RPC {