diff --git a/crates/sdk/src/network-v2/client.rs b/crates/sdk/src/network-v2/client.rs index 24e7469a54..8bd71e2e1b 100644 --- a/crates/sdk/src/network-v2/client.rs +++ b/crates/sdk/src/network-v2/client.rs @@ -1,27 +1,29 @@ -use std::time::Duration; +use std::result::Result::Ok as StdOk; +use std::str::FromStr; +use std::time::{Duration, SystemTime, UNIX_EPOCH}; use alloy_signer::SignerSync; use alloy_signer_local::PrivateKeySigner; use anyhow::{Context, Ok, Result}; use reqwest_middleware::ClientWithMiddleware as HttpClientWithMiddleware; -use serde::de::DeserializeOwned; -use serde::Serialize; +use serde::{de::DeserializeOwned, Serialize}; +use tonic::{ + transport::{channel::ClientTlsConfig, Channel}, + Code, +}; + use sp1_core_machine::io::SP1Stdin; -use sp1_prover::SP1VerifyingKey; -use std::str::FromStr; -use std::time::{SystemTime, UNIX_EPOCH}; -use tokio::try_join; -use tonic::transport::channel::ClientTlsConfig; -use tonic::transport::Channel; +use sp1_prover::{HashableKey, SP1VerifyingKey}; use crate::network_v2::proto::artifact::{ artifact_store_client::ArtifactStoreClient, CreateArtifactRequest, }; use crate::network_v2::proto::network::{ - prover_network_client::ProverNetworkClient, GetFilteredProofRequestsRequest, - GetFilteredProofRequestsResponse, GetNonceRequest, GetProofRequestStatusRequest, - GetProofRequestStatusResponse, ProofMode, ProofStatus, ProofStrategy, RequestProofRequest, - RequestProofRequestBody, RequestProofResponse, + prover_network_client::ProverNetworkClient, CreateProgramRequest, CreateProgramRequestBody, + CreateProgramResponse, FulfillmentStatus, FulfillmentStrategy, GetNonceRequest, + GetProgramRequest, GetProgramResponse, GetProofRequestStatusRequest, + GetProofRequestStatusResponse, ProofMode, RequestProofRequest, RequestProofRequestBody, + RequestProofResponse, }; use crate::network_v2::Signable; @@ -95,6 +97,76 @@ impl NetworkClient { Ok(res.into_inner().nonce) } + /// Get the verifying key hash from a verifying key. The verifying key hash is used to identify + /// a program. + pub fn get_vk_hash(vk: &SP1VerifyingKey) -> Result> { + let vk_hash_str = vk.bytes32(); + let vk_hash = hex::decode(vk_hash_str.strip_prefix("0x").unwrap_or(&vk_hash_str))?; + Ok(vk_hash) + } + + /// Registers a program if it is not already registered. + pub async fn register_program(&self, vk: &SP1VerifyingKey, elf: &[u8]) -> Result> { + let vk_hash = Self::get_vk_hash(vk)?; + + // Try to get the existing program. + match self.get_program(&vk_hash).await? { + Some(_) => { + // The program already exists. + Ok(vk_hash) + } + None => { + // The program doesn't exist, create it. + self.create_program(&vk_hash, vk, elf).await?; + log::info!("Registered program 0x{}", hex::encode(vk_hash.clone())); + Ok(vk_hash) + } + } + } + + /// Attempts to get program info, returns None if program doesn't exist. + async fn get_program(&self, vk_hash: &[u8]) -> Result> { + let mut rpc = self.get_rpc().await?; + match rpc.get_program(GetProgramRequest { vk_hash: vk_hash.to_vec() }).await { + StdOk(response) => Ok(Some(response.into_inner())), + Err(status) if status.code() == Code::NotFound => Ok(None), + Err(e) => Err(e.into()), + } + } + + /// Creates a new program. + async fn create_program( + &self, + vk_hash: &[u8], + vk: &SP1VerifyingKey, + elf: &[u8], + ) -> Result { + // Create the program artifact. + let mut store = self.get_store().await?; + let program_uri = self.create_artifact_with_content(&mut store, &elf).await?; + + // Serialize the verifying key. + let vk_encoded = bincode::serialize(&vk)?; + + // Send the request. + let mut rpc = self.get_rpc().await?; + let nonce = self.get_nonce().await?; + let request_body = CreateProgramRequestBody { + nonce, + vk_hash: vk_hash.to_vec(), + vk: vk_encoded, + program_uri, + }; + + Ok(rpc + .create_program(CreateProgramRequest { + signature: request_body.sign(&self.signer).into(), + body: Some(request_body), + }) + .await? + .into_inner()) + } + /// Get the status of a given proof. If the status is Fulfilled, the proof is also returned. pub async fn get_proof_request_status( &self, @@ -108,9 +180,9 @@ impl NetworkClient { .await? .into_inner(); - let status = ProofStatus::try_from(res.proof_status)?; + let status = FulfillmentStatus::try_from(res.fulfillment_status)?; let proof = match status { - ProofStatus::Fulfilled => { + FulfillmentStatus::Fulfilled => { let proof_uri = res .proof_uri .as_ref() @@ -124,38 +196,15 @@ impl NetworkClient { Ok((res, proof)) } - /// Get all the proof requests for a given status. Also filter by version if provided. - pub async fn get_filtered_proof_requests( - &self, - version: Option, - proof_status: Option, - execution_status: Option, - limit: Option, - ) -> Result { - let mut rpc = self.get_rpc().await?; - let res = rpc - .get_filtered_proof_requests(GetFilteredProofRequestsRequest { - version, - proof_status, - execution_status, - limit, - }) - .await? - .into_inner(); - - Ok(res) - } - - /// Creates a proof request with the given ELF and stdin. + /// Creates a proof request with the given verifying key hash and stdin. #[allow(clippy::too_many_arguments)] pub async fn request_proof( &self, - elf: &[u8], + vk_hash: &[u8], stdin: &SP1Stdin, - vk: &SP1VerifyingKey, mode: ProofMode, version: &str, - strategy: ProofStrategy, + strategy: FulfillmentStrategy, timeout_secs: u64, cycle_limit: u64, ) -> Result { @@ -164,15 +213,9 @@ impl NetworkClient { let since_the_epoch = start.duration_since(UNIX_EPOCH).expect("Invalid start time"); let deadline = since_the_epoch.as_secs() + timeout_secs; - // Create the program and stdin artifacts. + // Create the stdin artifact. let mut store = self.get_store().await?; - let mut store_clone = store.clone(); - let program_promise = self.create_artifact_with_content(&mut store, &elf); - let stdin_promise = self.create_artifact_with_content(&mut store_clone, &stdin); - let (program_uri, stdin_uri) = try_join!(program_promise, stdin_promise)?; - - // Serialize the vkey. - let vkey = bincode::serialize(&vk)?; + let stdin_uri = self.create_artifact_with_content(&mut store, &stdin).await?; // Send the request. let mut rpc = self.get_rpc().await?; @@ -180,10 +223,9 @@ impl NetworkClient { let request_body = RequestProofRequestBody { nonce, version: format!("sp1-{}", version), - vkey, + vk_hash: vk_hash.to_vec(), mode: mode.into(), strategy: strategy.into(), - program_uri, stdin_uri, deadline, cycle_limit, diff --git a/crates/sdk/src/network-v2/proto/network.rs b/crates/sdk/src/network-v2/proto/network.rs index b210cb9215..cea0e67d82 100644 --- a/crates/sdk/src/network-v2/proto/network.rs +++ b/crates/sdk/src/network-v2/proto/network.rs @@ -1,99 +1,38 @@ // This file is @generated by prost-build. #[derive(serde::Serialize, serde::Deserialize, Clone, PartialEq, ::prost::Message)] -pub struct GetFilteredProofRequestsRequest { - /// The optional version of the proof requests to filter for. - #[prost(string, optional, tag = "1")] - pub version: ::core::option::Option<::prost::alloc::string::String>, - /// The optional proof status of the proof requests to filter for. - #[prost(enumeration = "ProofStatus", optional, tag = "2")] - pub proof_status: ::core::option::Option, - /// The optional execution status of the proof requests to filter for. - #[prost(enumeration = "ExecutionStatus", optional, tag = "3")] - pub execution_status: ::core::option::Option, - /// The optional maximum number of proof requests to return (default is 10, - /// maximum is 100). - #[prost(uint32, optional, tag = "4")] - pub limit: ::core::option::Option, -} -#[derive(serde::Serialize, serde::Deserialize, Clone, PartialEq, ::prost::Message)] -pub struct ProofRequest { - /// The request identifier. - #[prost(string, tag = "1")] - pub request_id: ::prost::alloc::string::String, - /// The version of the prover to use. - #[prost(string, tag = "2")] - pub version: ::prost::alloc::string::String, - /// The mode for the proof. - #[prost(enumeration = "ProofMode", tag = "4")] - pub mode: i32, - /// The strategy for prover assignment. - #[prost(enumeration = "ProofStrategy", tag = "5")] - pub strategy: i32, - /// The program resource identifier. - #[prost(string, tag = "6")] - pub program_uri: ::prost::alloc::string::String, - /// The stdin resource identifier. - #[prost(string, tag = "7")] - pub stdin_uri: ::prost::alloc::string::String, - /// The deadline for the proof. - #[prost(uint64, tag = "8")] - pub deadline: u64, - /// The cycle limit for the proof. - #[prost(uint64, tag = "9")] - pub cycle_limit: u64, - /// The proof status of the proof request. - #[prost(enumeration = "ProofStatus", tag = "10")] - pub proof_status: i32, - /// The execution status of the proof request. - #[prost(enumeration = "ExecutionStatus", tag = "11")] - pub execution_status: i32, - /// The requester address. - #[prost(bytes = "vec", tag = "12")] - pub requester: ::prost::alloc::vec::Vec, -} -#[derive(serde::Serialize, serde::Deserialize, Clone, PartialEq, ::prost::Message)] -pub struct GetFilteredProofRequestsResponse { - /// The proof requests for the given status. - #[prost(message, repeated, tag = "1")] - pub requests: ::prost::alloc::vec::Vec, -} -#[derive(serde::Serialize, serde::Deserialize, Clone, PartialEq, ::prost::Message)] pub struct RequestProofRequest { /// The signature of the sender. #[prost(bytes = "vec", tag = "1")] pub signature: ::prost::alloc::vec::Vec, /// The body of the request. - #[prost(message, optional, tag = "3")] + #[prost(message, optional, tag = "2")] pub body: ::core::option::Option, } #[derive(serde::Serialize, serde::Deserialize, Clone, PartialEq, ::prost::Message)] pub struct RequestProofRequestBody { - /// The nonce of the request. + /// The account nonce of the sender. #[prost(uint64, tag = "1")] pub nonce: u64, + /// The verification key hash of the program. + #[prost(bytes = "vec", tag = "2")] + pub vk_hash: ::prost::alloc::vec::Vec, /// The version of the prover to use. - #[prost(string, tag = "2")] + #[prost(string, tag = "3")] pub version: ::prost::alloc::string::String, - /// The verification key. - #[prost(bytes = "vec", tag = "3")] - pub vkey: ::prost::alloc::vec::Vec, - /// The mode for the proof. + /// The mode for the request. #[prost(enumeration = "ProofMode", tag = "4")] pub mode: i32, - /// The strategy for prover assignment. - #[prost(enumeration = "ProofStrategy", tag = "5")] + /// The strategy for fulfiller assignment. + #[prost(enumeration = "FulfillmentStrategy", tag = "5")] pub strategy: i32, - /// The program resource identifier. - #[prost(string, tag = "6")] - pub program_uri: ::prost::alloc::string::String, /// The stdin resource identifier. - #[prost(string, tag = "7")] + #[prost(string, tag = "6")] pub stdin_uri: ::prost::alloc::string::String, - /// The deadline for the proof. - #[prost(uint64, tag = "8")] + /// The deadline for the request. + #[prost(uint64, tag = "7")] pub deadline: u64, - /// The cycle limit for the proof. - #[prost(uint64, tag = "9")] + /// The cycle limit for the request. + #[prost(uint64, tag = "8")] pub cycle_limit: u64, } #[derive(serde::Serialize, serde::Deserialize, Clone, PartialEq, ::prost::Message)] @@ -107,7 +46,7 @@ pub struct RequestProofResponse { } #[derive(serde::Serialize, serde::Deserialize, Clone, PartialEq, ::prost::Message)] pub struct RequestProofResponseBody { - /// The identifier for the proof. + /// The identifier for the request. #[prost(bytes = "vec", tag = "1")] pub request_id: ::prost::alloc::vec::Vec, } @@ -117,15 +56,15 @@ pub struct FulfillProofRequest { #[prost(bytes = "vec", tag = "1")] pub signature: ::prost::alloc::vec::Vec, /// The body of the request. - #[prost(message, optional, tag = "3")] + #[prost(message, optional, tag = "2")] pub body: ::core::option::Option, } #[derive(serde::Serialize, serde::Deserialize, Clone, PartialEq, ::prost::Message)] pub struct FulfillProofRequestBody { - /// The nonce of the request. + /// The account nonce of the sender. #[prost(uint64, tag = "1")] pub nonce: u64, - /// The identifier for the proof. + /// The identifier for the request. #[prost(bytes = "vec", tag = "2")] pub request_id: ::prost::alloc::vec::Vec, /// The proof bytes. @@ -149,15 +88,15 @@ pub struct ExecuteProofRequest { #[prost(bytes = "vec", tag = "1")] pub signature: ::prost::alloc::vec::Vec, /// The body of the request. - #[prost(message, optional, tag = "3")] + #[prost(message, optional, tag = "2")] pub body: ::core::option::Option, } #[derive(serde::Serialize, serde::Deserialize, Clone, PartialEq, ::prost::Message)] pub struct ExecuteProofRequestBody { - /// The nonce of the request. + /// The account nonce of the sender. #[prost(uint64, tag = "1")] pub nonce: u64, - /// The identifier for the proof request. + /// The identifier for the request. #[prost(bytes = "vec", tag = "2")] pub request_id: ::prost::alloc::vec::Vec, /// The execution status of the request. @@ -167,8 +106,8 @@ pub struct ExecuteProofRequestBody { /// the request is valid. #[prost(bytes = "vec", optional, tag = "4")] pub public_values_hash: ::core::option::Option<::prost::alloc::vec::Vec>, - /// The optional cycles of the request execution, only included if the request - /// is valid. + /// The optional cycles used when executing the request, only included if the + /// request is valid. #[prost(uint64, optional, tag = "5")] pub cycles: ::core::option::Option, } @@ -183,679 +122,2957 @@ pub struct ExecuteProofResponse { } #[derive(serde::Serialize, serde::Deserialize, Clone, Copy, PartialEq, ::prost::Message)] pub struct ExecuteProofResponseBody {} -#[derive(serde::Serialize, serde::Deserialize, Clone, Copy, PartialEq, ::prost::Message)] -pub struct GetLatestBridgeBlockRequest { - /// The chain ID of the bridge. - #[prost(uint32, tag = "1")] - pub chain_id: u32, +#[derive(serde::Serialize, serde::Deserialize, Clone, PartialEq, ::prost::Message)] +pub struct FailFulfillmentRequest { + /// The signature of the sender. + #[prost(bytes = "vec", tag = "1")] + pub signature: ::prost::alloc::vec::Vec, + /// The body of the request. + #[prost(message, optional, tag = "2")] + pub body: ::core::option::Option, } -#[derive(serde::Serialize, serde::Deserialize, Clone, Copy, PartialEq, ::prost::Message)] -pub struct GetLatestBridgeBlockResponse { - /// The latest processed block in the bridge. +#[derive(serde::Serialize, serde::Deserialize, Clone, PartialEq, ::prost::Message)] +pub struct FailFulfillmentRequestBody { + /// The account nonce of the sender. #[prost(uint64, tag = "1")] - pub block_number: u64, + pub nonce: u64, + /// The identifier for the request. + #[prost(bytes = "vec", tag = "2")] + pub request_id: ::prost::alloc::vec::Vec, } #[derive(serde::Serialize, serde::Deserialize, Clone, PartialEq, ::prost::Message)] -pub struct GetBalanceRequest { - /// The address of the account. +pub struct FailFulfillmentResponse { + /// The transaction hash. #[prost(bytes = "vec", tag = "1")] - pub address: ::prost::alloc::vec::Vec, -} -#[derive(serde::Serialize, serde::Deserialize, Clone, PartialEq, ::prost::Message)] -pub struct GetBalanceResponse { - /// The amount of credits owned by the account. - #[prost(string, tag = "1")] - pub amount: ::prost::alloc::string::String, + pub tx_hash: ::prost::alloc::vec::Vec, + /// The body of the response. + #[prost(message, optional, tag = "2")] + pub body: ::core::option::Option, } +#[derive(serde::Serialize, serde::Deserialize, Clone, Copy, PartialEq, ::prost::Message)] +pub struct FailFulfillmentResponseBody {} #[derive(serde::Serialize, serde::Deserialize, Clone, PartialEq, ::prost::Message)] -pub struct AddCreditRequest { +pub struct FailExecutionRequest { /// The signature of the sender. #[prost(bytes = "vec", tag = "1")] pub signature: ::prost::alloc::vec::Vec, /// The body of the request. - #[prost(message, optional, tag = "3")] - pub body: ::core::option::Option, + #[prost(message, optional, tag = "2")] + pub body: ::core::option::Option, } #[derive(serde::Serialize, serde::Deserialize, Clone, PartialEq, ::prost::Message)] -pub struct AddCreditRequestBody { - /// The nonce of the request. +pub struct FailExecutionRequestBody { + /// The account nonce of the sender. #[prost(uint64, tag = "1")] pub nonce: u64, - /// The address of the account to add credits to. + /// The identifier for the request. #[prost(bytes = "vec", tag = "2")] - pub address: ::prost::alloc::vec::Vec, - /// The amount of credits to add. - #[prost(string, tag = "3")] - pub amount: ::prost::alloc::string::String, + pub request_id: ::prost::alloc::vec::Vec, } #[derive(serde::Serialize, serde::Deserialize, Clone, PartialEq, ::prost::Message)] -pub struct AddCreditResponse { +pub struct FailExecutionResponse { /// The transaction hash. #[prost(bytes = "vec", tag = "1")] pub tx_hash: ::prost::alloc::vec::Vec, /// The body of the response. #[prost(message, optional, tag = "2")] - pub body: ::core::option::Option, + pub body: ::core::option::Option, } #[derive(serde::Serialize, serde::Deserialize, Clone, Copy, PartialEq, ::prost::Message)] -pub struct AddCreditResponseBody {} +pub struct FailExecutionResponseBody {} #[derive(serde::Serialize, serde::Deserialize, Clone, PartialEq, ::prost::Message)] -pub struct GetNonceRequest { - /// The address of the account. +pub struct ProofRequest { + /// The request identifier. #[prost(bytes = "vec", tag = "1")] - pub address: ::prost::alloc::vec::Vec, -} -#[derive(serde::Serialize, serde::Deserialize, Clone, Copy, PartialEq, ::prost::Message)] -pub struct GetNonceResponse { - /// The nonce of the account. - #[prost(uint64, tag = "1")] - pub nonce: u64, + pub request_id: ::prost::alloc::vec::Vec, + /// The verification key hash of the program. + #[prost(bytes = "vec", tag = "2")] + pub vk_hash: ::prost::alloc::vec::Vec, + /// The version of the prover to use. + #[prost(string, tag = "3")] + pub version: ::prost::alloc::string::String, + /// The mode for the proof. + #[prost(enumeration = "ProofMode", tag = "4")] + pub mode: i32, + /// The strategy for fulfiller assignment. + #[prost(enumeration = "FulfillmentStrategy", tag = "5")] + pub strategy: i32, + /// The program resource identifier. + #[prost(string, tag = "6")] + pub program_uri: ::prost::alloc::string::String, + /// The stdin resource identifier. + #[prost(string, tag = "7")] + pub stdin_uri: ::prost::alloc::string::String, + /// The deadline for the request. + #[prost(uint64, tag = "8")] + pub deadline: u64, + /// The cycle limit for the request. + #[prost(uint64, tag = "9")] + pub cycle_limit: u64, + /// The gas price for the request. + #[prost(uint64, optional, tag = "10")] + pub gas_price: ::core::option::Option, + /// The fulfillment status of the request. + #[prost(enumeration = "FulfillmentStatus", tag = "11")] + pub fulfillment_status: i32, + /// The execution status of the request. + #[prost(enumeration = "ExecutionStatus", tag = "12")] + pub execution_status: i32, + /// The requester address that signed the request. + #[prost(bytes = "vec", tag = "13")] + pub requester: ::prost::alloc::vec::Vec, + /// The fulfiller address that fulfilled the request. + #[prost(bytes = "vec", optional, tag = "14")] + pub fulfiller: ::core::option::Option<::prost::alloc::vec::Vec>, + /// The optional name to refer to an alias of the program id. + #[prost(string, optional, tag = "15")] + pub program_name: ::core::option::Option<::prost::alloc::string::String>, + /// The optional name to refer to an alias of the requester address. + #[prost(string, optional, tag = "16")] + pub requester_name: ::core::option::Option<::prost::alloc::string::String>, + /// The optional name to refer to an alias of the fulfiller address. + #[prost(string, optional, tag = "17")] + pub fulfiller_name: ::core::option::Option<::prost::alloc::string::String>, + /// The unix timestamp of when the request was created. + #[prost(uint64, tag = "18")] + pub created_at: u64, + /// The unix timestamp of when the request was updated. + #[prost(uint64, tag = "19")] + pub updated_at: u64, + /// The unix timestamp of when the request was fulfilled. + #[prost(uint64, optional, tag = "20")] + pub fulfilled_at: ::core::option::Option, + /// The transaction hash of the request. + #[prost(bytes = "vec", tag = "21")] + pub tx_hash: ::prost::alloc::vec::Vec, + /// The cycle count for the request. + #[prost(uint64, optional, tag = "22")] + pub cycles: ::core::option::Option, + /// The amount deducted from the fulfiller's balance. + #[prost(string, optional, tag = "23")] + pub deduction_amount: ::core::option::Option<::prost::alloc::string::String>, + /// The amount refunded to the fulfiller's balance. + #[prost(string, optional, tag = "24")] + pub refund_amount: ::core::option::Option<::prost::alloc::string::String>, } #[derive(serde::Serialize, serde::Deserialize, Clone, PartialEq, ::prost::Message)] pub struct GetProofRequestStatusRequest { - /// The identifier for the proof request. + /// The identifier for the request. #[prost(bytes = "vec", tag = "1")] pub request_id: ::prost::alloc::vec::Vec, } #[derive(serde::Serialize, serde::Deserialize, Clone, PartialEq, ::prost::Message)] pub struct GetProofRequestStatusResponse { - /// The status of the proof request. - #[prost(enumeration = "ProofStatus", tag = "1")] - pub proof_status: i32, - /// The execution status of the proof request. + /// The fulfillment status of the request. + #[prost(enumeration = "FulfillmentStatus", tag = "1")] + pub fulfillment_status: i32, + /// The execution status of the request. #[prost(enumeration = "ExecutionStatus", tag = "2")] pub execution_status: i32, - /// The transaction hash of the proof request. + /// The transaction hash of the request. #[prost(bytes = "vec", tag = "3")] pub request_tx_hash: ::prost::alloc::vec::Vec, /// The optional transaction hash of the proof fulfill. Only included if the - /// proof request has a status of FULFILLED. + /// request has a fulfillment status of FULFILLED. #[prost(bytes = "vec", optional, tag = "4")] pub fulfill_tx_hash: ::core::option::Option<::prost::alloc::vec::Vec>, - /// The optional proof URI, where you can download the result of the proof - /// request. Only included if the proof has a status of FULFILLED. + /// The optional proof URI, where you can download the result of the request. + /// Only included if the request has a fulfillment status of FULFILLED. #[prost(string, optional, tag = "5")] pub proof_uri: ::core::option::Option<::prost::alloc::string::String>, - /// The optional error status code, if the request failed. - #[prost(uint32, optional, tag = "6")] - pub error_code: ::core::option::Option, - /// The optional error description details, if the request failed. - #[prost(string, optional, tag = "7")] - pub error_description: ::core::option::Option<::prost::alloc::string::String>, } -#[derive( - serde::Serialize, - serde::Deserialize, - Clone, - Copy, - Debug, - PartialEq, - Eq, - Hash, - PartialOrd, - Ord, - ::prost::Enumeration, -)] -#[repr(i32)] -pub enum ProofMode { - UnspecifiedMode = 0, - Core = 1, - Compressed = 2, - Plonk = 3, - Groth16 = 4, +#[derive(serde::Serialize, serde::Deserialize, Clone, PartialEq, ::prost::Message)] +pub struct GetProofRequestDetailsRequest { + /// The identifier for the request. + #[prost(bytes = "vec", tag = "1")] + pub request_id: ::prost::alloc::vec::Vec, } -impl ProofMode { - /// String value of the enum field names used in the ProtoBuf definition. - /// - /// The values are not transformed in any way and thus are considered stable - /// (if the ProtoBuf definition does not change) and safe for programmatic use. - pub fn as_str_name(&self) -> &'static str { - match self { - Self::UnspecifiedMode => "UNSPECIFIED_MODE", - Self::Core => "CORE", - Self::Compressed => "COMPRESSED", - Self::Plonk => "PLONK", - Self::Groth16 => "GROTH16", - } - } - /// Creates an enum from field names used in the ProtoBuf definition. - pub fn from_str_name(value: &str) -> ::core::option::Option { - match value { - "UNSPECIFIED_MODE" => Some(Self::UnspecifiedMode), - "CORE" => Some(Self::Core), - "COMPRESSED" => Some(Self::Compressed), - "PLONK" => Some(Self::Plonk), - "GROTH16" => Some(Self::Groth16), - _ => None, - } - } +#[derive(serde::Serialize, serde::Deserialize, Clone, PartialEq, ::prost::Message)] +pub struct GetProofRequestDetailsResponse { + /// The detailed request. + #[prost(message, optional, tag = "1")] + pub request: ::core::option::Option, } -#[derive( - serde::Serialize, - serde::Deserialize, - Clone, - Copy, - Debug, - PartialEq, - Eq, - Hash, - PartialOrd, - Ord, - ::prost::Enumeration, -)] -#[repr(i32)] -pub enum ProofStrategy { - UnspecifiedStrategy = 0, - Hosted = 1, +#[derive(serde::Serialize, serde::Deserialize, Clone, PartialEq, ::prost::Message)] +pub struct GetFilteredProofRequestsRequest { + /// The optional version of the requests to filter for. + #[prost(string, optional, tag = "1")] + pub version: ::core::option::Option<::prost::alloc::string::String>, + /// The optional fulfillment status of the requests to filter for. + #[prost(enumeration = "FulfillmentStatus", optional, tag = "2")] + pub fulfillment_status: ::core::option::Option, + /// The optional execution status of the requests to filter for. + #[prost(enumeration = "ExecutionStatus", optional, tag = "3")] + pub execution_status: ::core::option::Option, + /// The optional minimum unix timestamp deadline of the requests to filter for. + /// Only returns requests with deadlines after this timestamp. + #[prost(uint64, optional, tag = "4")] + pub minimum_deadline: ::core::option::Option, + /// The optional verification key hash of the program to filter for. + #[prost(bytes = "vec", optional, tag = "5")] + pub vk_hash: ::core::option::Option<::prost::alloc::vec::Vec>, + /// The optional requester address to filter for. + #[prost(bytes = "vec", optional, tag = "6")] + pub requester: ::core::option::Option<::prost::alloc::vec::Vec>, + /// The optional fulfiller address to filter for. + #[prost(bytes = "vec", optional, tag = "7")] + pub fulfiller: ::core::option::Option<::prost::alloc::vec::Vec>, + /// The optional minimum creation unix timestamp of the requests to filter for. + #[prost(uint64, optional, tag = "8")] + pub from: ::core::option::Option, + /// The optional maximum creation unix timestamp of the requests to filter for. + #[prost(uint64, optional, tag = "9")] + pub to: ::core::option::Option, + /// The optional maximum number of requests to return (default is 10, + /// maximum is 100). + #[prost(uint32, optional, tag = "10")] + pub limit: ::core::option::Option, + /// The optional page number to return (default is 1). + #[prost(uint32, optional, tag = "11")] + pub page: ::core::option::Option, + /// The optional mode of the requests to filter for. + #[prost(enumeration = "ProofMode", optional, tag = "12")] + pub mode: ::core::option::Option, } -impl ProofStrategy { - /// String value of the enum field names used in the ProtoBuf definition. - /// - /// The values are not transformed in any way and thus are considered stable - /// (if the ProtoBuf definition does not change) and safe for programmatic use. - pub fn as_str_name(&self) -> &'static str { - match self { - Self::UnspecifiedStrategy => "UNSPECIFIED_STRATEGY", - Self::Hosted => "HOSTED", - } - } - /// Creates an enum from field names used in the ProtoBuf definition. - pub fn from_str_name(value: &str) -> ::core::option::Option { - match value { - "UNSPECIFIED_STRATEGY" => Some(Self::UnspecifiedStrategy), - "HOSTED" => Some(Self::Hosted), - _ => None, - } - } +#[derive(serde::Serialize, serde::Deserialize, Clone, PartialEq, ::prost::Message)] +pub struct GetFilteredProofRequestsResponse { + /// The requests that matched the filter criteria. + #[prost(message, repeated, tag = "1")] + pub requests: ::prost::alloc::vec::Vec, } -#[derive( - serde::Serialize, - serde::Deserialize, - Clone, - Copy, - Debug, - PartialEq, - Eq, - Hash, - PartialOrd, - Ord, - ::prost::Enumeration, -)] -#[repr(i32)] -pub enum ProofStatus { - UnspecifiedProofStatus = 0, - Requested = 1, - Assigned = 2, - Fulfilled = 3, +#[derive(serde::Serialize, serde::Deserialize, Clone, PartialEq, ::prost::Message)] +pub struct GetSearchResultsRequest { + /// The search query string. + #[prost(string, tag = "1")] + pub query: ::prost::alloc::string::String, } -impl ProofStatus { - /// String value of the enum field names used in the ProtoBuf definition. - /// - /// The values are not transformed in any way and thus are considered stable - /// (if the ProtoBuf definition does not change) and safe for programmatic use. - pub fn as_str_name(&self) -> &'static str { - match self { - Self::UnspecifiedProofStatus => "UNSPECIFIED_PROOF_STATUS", - Self::Requested => "REQUESTED", - Self::Assigned => "ASSIGNED", - Self::Fulfilled => "FULFILLED", - } - } - /// Creates an enum from field names used in the ProtoBuf definition. - pub fn from_str_name(value: &str) -> ::core::option::Option { - match value { - "UNSPECIFIED_PROOF_STATUS" => Some(Self::UnspecifiedProofStatus), - "REQUESTED" => Some(Self::Requested), - "ASSIGNED" => Some(Self::Assigned), - "FULFILLED" => Some(Self::Fulfilled), - _ => None, - } - } +#[derive(serde::Serialize, serde::Deserialize, Clone, PartialEq, ::prost::Message)] +pub struct SearchResult { + #[prost(bytes = "vec", tag = "1")] + pub id: ::prost::alloc::vec::Vec, + #[prost(string, optional, tag = "2")] + pub name: ::core::option::Option<::prost::alloc::string::String>, } -#[derive( - serde::Serialize, - serde::Deserialize, - Clone, - Copy, - Debug, - PartialEq, - Eq, - Hash, - PartialOrd, - Ord, - ::prost::Enumeration, -)] -#[repr(i32)] -pub enum ExecutionStatus { - UnspecifiedExecutionStatus = 0, - Unexecuted = 1, - Executed = 2, - Failed = 3, +#[derive(serde::Serialize, serde::Deserialize, Clone, PartialEq, ::prost::Message)] +pub struct GetSearchResultsResponse { + /// List of matching request IDs with optional names. + #[prost(message, repeated, tag = "1")] + pub requests: ::prost::alloc::vec::Vec, + /// List of matching program IDs with optional names. + #[prost(message, repeated, tag = "2")] + pub programs: ::prost::alloc::vec::Vec, + /// List of matching requester IDs with optional names. + #[prost(message, repeated, tag = "3")] + pub requesters: ::prost::alloc::vec::Vec, } -impl ExecutionStatus { - /// String value of the enum field names used in the ProtoBuf definition. - /// - /// The values are not transformed in any way and thus are considered stable - /// (if the ProtoBuf definition does not change) and safe for programmatic use. - pub fn as_str_name(&self) -> &'static str { - match self { - Self::UnspecifiedExecutionStatus => "UNSPECIFIED_EXECUTION_STATUS", - Self::Unexecuted => "UNEXECUTED", - Self::Executed => "EXECUTED", - Self::Failed => "FAILED", - } - } - /// Creates an enum from field names used in the ProtoBuf definition. - pub fn from_str_name(value: &str) -> ::core::option::Option { - match value { - "UNSPECIFIED_EXECUTION_STATUS" => Some(Self::UnspecifiedExecutionStatus), - "UNEXECUTED" => Some(Self::Unexecuted), - "EXECUTED" => Some(Self::Executed), - "FAILED" => Some(Self::Failed), - _ => None, - } - } +#[derive(serde::Serialize, serde::Deserialize, Clone, PartialEq, ::prost::Message)] +pub struct GetProofRequestMetricsRequest { + /// The optional address to filter for. + #[prost(bytes = "vec", optional, tag = "1")] + pub address: ::core::option::Option<::prost::alloc::vec::Vec>, + /// The optional interval in days for volume calculation. + #[prost(uint64, optional, tag = "2")] + pub volume_interval_days: ::core::option::Option, } -/// Generated client implementations. -pub mod prover_network_client { - #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)] - use tonic::codegen::{http::Uri, *}; - #[derive(Debug, Clone)] - pub struct ProverNetworkClient { - inner: tonic::client::Grpc, - } - impl ProverNetworkClient { - /// Attempt to create a new client by connecting to a given endpoint. - pub async fn connect(dst: D) -> Result - where - D: TryInto, - D::Error: Into, - { - let conn = tonic::transport::Endpoint::new(dst)?.connect().await?; - Ok(Self::new(conn)) - } - } - impl ProverNetworkClient - where - T: tonic::client::GrpcService, - T::Error: Into, - T::ResponseBody: Body + std::marker::Send + 'static, - ::Error: Into + std::marker::Send, - { - pub fn new(inner: T) -> Self { - let inner = tonic::client::Grpc::new(inner); - Self { inner } - } - pub fn with_origin(inner: T, origin: Uri) -> Self { - let inner = tonic::client::Grpc::with_origin(inner, origin); - Self { inner } - } - pub fn with_interceptor( - inner: T, - interceptor: F, - ) -> ProverNetworkClient> - where - F: tonic::service::Interceptor, - T::ResponseBody: Default, - T: tonic::codegen::Service< - http::Request, - Response = http::Response< - >::ResponseBody, - >, - >, - >>::Error: - Into + std::marker::Send + std::marker::Sync, - { - ProverNetworkClient::new(InterceptedService::new(inner, interceptor)) - } - /// Compress requests with the given encoding. - /// - /// This requires the server to support it otherwise it might respond with an - /// error. - #[must_use] - pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self { - self.inner = self.inner.send_compressed(encoding); - self - } - /// Enable decompressing responses. - #[must_use] - pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self { - self.inner = self.inner.accept_compressed(encoding); - self - } - /// Limits the maximum size of a decoded message. - /// - /// Default: `4MB` - #[must_use] - pub fn max_decoding_message_size(mut self, limit: usize) -> Self { - self.inner = self.inner.max_decoding_message_size(limit); - self - } - /// Limits the maximum size of an encoded message. - /// - /// Default: `usize::MAX` - #[must_use] - pub fn max_encoding_message_size(mut self, limit: usize) -> Self { - self.inner = self.inner.max_encoding_message_size(limit); - self - } - /// Creates a proof. - pub async fn request_proof( - &mut self, - request: impl tonic::IntoRequest, - ) -> std::result::Result, tonic::Status> - { - self.inner.ready().await.map_err(|e| { - tonic::Status::new( - tonic::Code::Unknown, - format!("Service was not ready: {}", e.into()), - ) - })?; - let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static("/network.ProverNetwork/RequestProof"); - let mut req = request.into_request(); - req.extensions_mut().insert(GrpcMethod::new("network.ProverNetwork", "RequestProof")); - self.inner.unary(req, path, codec).await - } - /// Fulfills a proof. - pub async fn fulfill_proof( - &mut self, - request: impl tonic::IntoRequest, - ) -> std::result::Result, tonic::Status> - { - self.inner.ready().await.map_err(|e| { - tonic::Status::new( - tonic::Code::Unknown, - format!("Service was not ready: {}", e.into()), - ) - })?; - let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static("/network.ProverNetwork/FulfillProof"); - let mut req = request.into_request(); - req.extensions_mut().insert(GrpcMethod::new("network.ProverNetwork", "FulfillProof")); - self.inner.unary(req, path, codec).await - } - /// Execute a proof. - pub async fn execute_proof( - &mut self, - request: impl tonic::IntoRequest, - ) -> std::result::Result, tonic::Status> - { - self.inner.ready().await.map_err(|e| { - tonic::Status::new( - tonic::Code::Unknown, - format!("Service was not ready: {}", e.into()), - ) - })?; - let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static("/network.ProverNetwork/ExecuteProof"); - let mut req = request.into_request(); - req.extensions_mut().insert(GrpcMethod::new("network.ProverNetwork", "ExecuteProof")); - self.inner.unary(req, path, codec).await - } - /// Get the proof requests the meet the filter criteria. - pub async fn get_filtered_proof_requests( - &mut self, - request: impl tonic::IntoRequest, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - > { - self.inner.ready().await.map_err(|e| { - tonic::Status::new( - tonic::Code::Unknown, - format!("Service was not ready: {}", e.into()), - ) - })?; - let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static( - "/network.ProverNetwork/GetFilteredProofRequests", - ); - let mut req = request.into_request(); - req.extensions_mut() - .insert(GrpcMethod::new("network.ProverNetwork", "GetFilteredProofRequests")); - self.inner.unary(req, path, codec).await - } - /// Get the status of a proof request. - pub async fn get_proof_request_status( - &mut self, - request: impl tonic::IntoRequest, - ) -> std::result::Result, tonic::Status> - { - self.inner.ready().await.map_err(|e| { - tonic::Status::new( - tonic::Code::Unknown, - format!("Service was not ready: {}", e.into()), - ) - })?; - let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static( - "/network.ProverNetwork/GetProofRequestStatus", - ); - let mut req = request.into_request(); - req.extensions_mut() - .insert(GrpcMethod::new("network.ProverNetwork", "GetProofRequestStatus")); - self.inner.unary(req, path, codec).await - } - /// Get the latest processed block in the bridge. - pub async fn get_latest_bridge_block( - &mut self, - request: impl tonic::IntoRequest, - ) -> std::result::Result, tonic::Status> - { - self.inner.ready().await.map_err(|e| { - tonic::Status::new( - tonic::Code::Unknown, - format!("Service was not ready: {}", e.into()), - ) - })?; - let codec = tonic::codec::ProstCodec::default(); - let path = - http::uri::PathAndQuery::from_static("/network.ProverNetwork/GetLatestBridgeBlock"); - let mut req = request.into_request(); - req.extensions_mut() - .insert(GrpcMethod::new("network.ProverNetwork", "GetLatestBridgeBlock")); - self.inner.unary(req, path, codec).await - } - /// Get the balance of an account. - pub async fn get_balance( - &mut self, - request: impl tonic::IntoRequest, - ) -> std::result::Result, tonic::Status> - { - self.inner.ready().await.map_err(|e| { - tonic::Status::new( - tonic::Code::Unknown, - format!("Service was not ready: {}", e.into()), - ) - })?; - let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static("/network.ProverNetwork/GetBalance"); - let mut req = request.into_request(); - req.extensions_mut().insert(GrpcMethod::new("network.ProverNetwork", "GetBalance")); - self.inner.unary(req, path, codec).await - } - /// Add credit to an account. - pub async fn add_credit( - &mut self, - request: impl tonic::IntoRequest, - ) -> std::result::Result, tonic::Status> { - self.inner.ready().await.map_err(|e| { - tonic::Status::new( - tonic::Code::Unknown, - format!("Service was not ready: {}", e.into()), - ) - })?; - let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static("/network.ProverNetwork/AddCredit"); - let mut req = request.into_request(); - req.extensions_mut().insert(GrpcMethod::new("network.ProverNetwork", "AddCredit")); - self.inner.unary(req, path, codec).await - } - /// Get the nonce of the account. - pub async fn get_nonce( - &mut self, - request: impl tonic::IntoRequest, - ) -> std::result::Result, tonic::Status> { - self.inner.ready().await.map_err(|e| { - tonic::Status::new( - tonic::Code::Unknown, - format!("Service was not ready: {}", e.into()), - ) - })?; - let codec = tonic::codec::ProstCodec::default(); - let path = http::uri::PathAndQuery::from_static("/network.ProverNetwork/GetNonce"); - let mut req = request.into_request(); - req.extensions_mut().insert(GrpcMethod::new("network.ProverNetwork", "GetNonce")); - self.inner.unary(req, path, codec).await - } - } +#[derive(serde::Serialize, serde::Deserialize, Clone, Copy, PartialEq, ::prost::Message)] +pub struct GetProofRequestMetricsResponse { + /// The total number of proofs. + #[prost(uint64, tag = "1")] + pub total_proofs: u64, + /// The total number of cycles. + #[prost(uint64, tag = "2")] + pub total_cycles: u64, + /// The volume in the specified interval. + #[prost(uint64, tag = "3")] + pub volume: u64, } -/// Generated server implementations. -pub mod prover_network_server { - #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)] - use tonic::codegen::*; - /// Generated trait containing gRPC methods that should be implemented for use with - /// ProverNetworkServer. - #[async_trait] - pub trait ProverNetwork: std::marker::Send + std::marker::Sync + 'static { - /// Creates a proof. - async fn request_proof( - &self, - request: tonic::Request, - ) -> std::result::Result, tonic::Status>; - /// Fulfills a proof. - async fn fulfill_proof( - &self, - request: tonic::Request, - ) -> std::result::Result, tonic::Status>; - /// Execute a proof. - async fn execute_proof( - &self, - request: tonic::Request, - ) -> std::result::Result, tonic::Status>; - /// Get the proof requests the meet the filter criteria. - async fn get_filtered_proof_requests( - &self, - request: tonic::Request, - ) -> std::result::Result< - tonic::Response, - tonic::Status, - >; - /// Get the status of a proof request. - async fn get_proof_request_status( - &self, - request: tonic::Request, - ) -> std::result::Result, tonic::Status>; - /// Get the latest processed block in the bridge. - async fn get_latest_bridge_block( - &self, - request: tonic::Request, - ) -> std::result::Result, tonic::Status>; - /// Get the balance of an account. - async fn get_balance( - &self, - request: tonic::Request, - ) -> std::result::Result, tonic::Status>; - /// Add credit to an account. - async fn add_credit( - &self, - request: tonic::Request, - ) -> std::result::Result, tonic::Status>; - /// Get the nonce of the account. - async fn get_nonce( - &self, - request: tonic::Request, - ) -> std::result::Result, tonic::Status>; - } - #[derive(Debug)] - pub struct ProverNetworkServer { - inner: Arc, - accept_compression_encodings: EnabledCompressionEncodings, - send_compression_encodings: EnabledCompressionEncodings, - max_decoding_message_size: Option, - max_encoding_message_size: Option, - } - impl ProverNetworkServer { - pub fn new(inner: T) -> Self { - Self::from_arc(Arc::new(inner)) - } - pub fn from_arc(inner: Arc) -> Self { - Self { - inner, - accept_compression_encodings: Default::default(), - send_compression_encodings: Default::default(), - max_decoding_message_size: None, - max_encoding_message_size: None, - } - } - pub fn with_interceptor(inner: T, interceptor: F) -> InterceptedService - where - F: tonic::service::Interceptor, - { - InterceptedService::new(Self::new(inner), interceptor) - } - /// Enable decompressing requests with the given encoding. - #[must_use] - pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self { - self.accept_compression_encodings.enable(encoding); - self - } - /// Compress responses with the given encoding, if the client supports it. - #[must_use] - pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self { - self.send_compression_encodings.enable(encoding); - self - } - /// Limits the maximum size of a decoded message. - /// - /// Default: `4MB` - #[must_use] - pub fn max_decoding_message_size(mut self, limit: usize) -> Self { - self.max_decoding_message_size = Some(limit); - self - } - /// Limits the maximum size of an encoded message. - /// - /// Default: `usize::MAX` - #[must_use] - pub fn max_encoding_message_size(mut self, limit: usize) -> Self { - self.max_encoding_message_size = Some(limit); - self - } - } - impl tonic::codegen::Service> for ProverNetworkServer - where - T: ProverNetwork, - B: Body + std::marker::Send + 'static, - B::Error: Into + std::marker::Send + 'static, - { - type Response = http::Response; - type Error = std::convert::Infallible; - type Future = BoxFuture; - fn poll_ready( - &mut self, - _cx: &mut Context<'_>, - ) -> Poll> { - Poll::Ready(Ok(())) - } - fn call(&mut self, req: http::Request) -> Self::Future { - match req.uri().path() { - "/network.ProverNetwork/RequestProof" => { +#[derive(serde::Serialize, serde::Deserialize, Clone, PartialEq, ::prost::Message)] +pub struct GetProofRequestGraphRequest { + /// The optional address to filter for. + #[prost(bytes = "vec", optional, tag = "1")] + pub address: ::core::option::Option<::prost::alloc::vec::Vec>, + /// The optional interval in days for the graph range. + #[prost(uint64, optional, tag = "2")] + pub range_interval_days: ::core::option::Option, +} +#[derive(serde::Serialize, serde::Deserialize, Clone, PartialEq, ::prost::Message)] +pub struct GraphData { + /// The timestamp of the data point. + #[prost(string, tag = "1")] + pub timestamp: ::prost::alloc::string::String, + /// The value at this timestamp. + #[prost(uint64, tag = "2")] + pub value: u64, +} +#[derive(serde::Serialize, serde::Deserialize, Clone, PartialEq, ::prost::Message)] +pub struct GetProofRequestGraphResponse { + /// The time series data points. + #[prost(message, repeated, tag = "1")] + pub data: ::prost::alloc::vec::Vec, +} +#[derive(serde::Serialize, serde::Deserialize, Clone, PartialEq, ::prost::Message)] +pub struct GetAnalyticsGraphsRequest { + /// The optional address to filter for. + #[prost(bytes = "vec", optional, tag = "1")] + pub address: ::core::option::Option<::prost::alloc::vec::Vec>, + /// The optional interval in days for the graph range. + #[prost(uint64, optional, tag = "2")] + pub range_interval_days: ::core::option::Option, +} +#[derive(serde::Serialize, serde::Deserialize, Clone, PartialEq, ::prost::Message)] +pub struct GetAnalyticsGraphsResponse { + /// The time series data points for proof count. + #[prost(message, repeated, tag = "1")] + pub proofs: ::prost::alloc::vec::Vec, + /// The time series data points for program count. + #[prost(message, repeated, tag = "2")] + pub programs: ::prost::alloc::vec::Vec, + /// The time series data points for cycle count. + #[prost(message, repeated, tag = "3")] + pub cycles: ::prost::alloc::vec::Vec, +} +#[derive(serde::Serialize, serde::Deserialize, Clone, PartialEq, ::prost::Message)] +pub struct GetNonceRequest { + /// The address of the account. + #[prost(bytes = "vec", tag = "1")] + pub address: ::prost::alloc::vec::Vec, +} +#[derive(serde::Serialize, serde::Deserialize, Clone, Copy, PartialEq, ::prost::Message)] +pub struct GetNonceResponse { + /// The nonce of the account. + #[prost(uint64, tag = "1")] + pub nonce: u64, +} +#[derive(serde::Serialize, serde::Deserialize, Clone, PartialEq, ::prost::Message)] +pub struct Delegation { + /// The address of the owner. + #[prost(bytes = "vec", tag = "1")] + pub owner: ::prost::alloc::vec::Vec, + /// The address of the delegate (the account with granted permissions). + #[prost(bytes = "vec", tag = "2")] + pub delegate: ::prost::alloc::vec::Vec, + /// Whether the delegation has been accepted. + #[prost(bool, tag = "3")] + pub accepted: bool, + /// The unix timestamp of when the delegation was created. + #[prost(uint64, tag = "4")] + pub created_at: u64, +} +#[derive(serde::Serialize, serde::Deserialize, Clone, PartialEq, ::prost::Message)] +pub struct GetFilteredDelegationsRequest { + /// The optional owner address to filter for. + #[prost(bytes = "vec", optional, tag = "1")] + pub owner: ::core::option::Option<::prost::alloc::vec::Vec>, + /// The optional maximum number of requests to return (default is 10, + /// maximum is 100). + #[prost(uint32, optional, tag = "2")] + pub limit: ::core::option::Option, + /// The optional page number to return (default is 1). + #[prost(uint32, optional, tag = "3")] + pub page: ::core::option::Option, +} +#[derive(serde::Serialize, serde::Deserialize, Clone, PartialEq, ::prost::Message)] +pub struct GetFilteredDelegationsResponse { + /// The delegations that matched the filter criteria. + #[prost(message, repeated, tag = "1")] + pub delegations: ::prost::alloc::vec::Vec, +} +#[derive(serde::Serialize, serde::Deserialize, Clone, PartialEq, ::prost::Message)] +pub struct AddDelegationRequest { + /// The signature of the sender. + #[prost(bytes = "vec", tag = "1")] + pub signature: ::prost::alloc::vec::Vec, + /// The body of the request. + #[prost(message, optional, tag = "2")] + pub body: ::core::option::Option, +} +#[derive(serde::Serialize, serde::Deserialize, Clone, PartialEq, ::prost::Message)] +pub struct AddDelegationRequestBody { + /// The account nonce of the sender. + #[prost(uint64, tag = "1")] + pub nonce: u64, + /// The delegate address to add. + #[prost(bytes = "vec", tag = "2")] + pub delegate: ::prost::alloc::vec::Vec, +} +#[derive(serde::Serialize, serde::Deserialize, Clone, PartialEq, ::prost::Message)] +pub struct AddDelegationResponse { + /// The transaction hash. + #[prost(bytes = "vec", tag = "1")] + pub tx_hash: ::prost::alloc::vec::Vec, + /// The body of the response. + #[prost(message, optional, tag = "2")] + pub body: ::core::option::Option, +} +#[derive(serde::Serialize, serde::Deserialize, Clone, Copy, PartialEq, ::prost::Message)] +pub struct AddDelegationResponseBody {} +#[derive(serde::Serialize, serde::Deserialize, Clone, PartialEq, ::prost::Message)] +pub struct RemoveDelegationRequest { + /// The signature of the sender. + #[prost(bytes = "vec", tag = "1")] + pub signature: ::prost::alloc::vec::Vec, + /// The body of the request. + #[prost(message, optional, tag = "2")] + pub body: ::core::option::Option, +} +#[derive(serde::Serialize, serde::Deserialize, Clone, PartialEq, ::prost::Message)] +pub struct RemoveDelegationRequestBody { + /// The account nonce of the sender. + #[prost(uint64, tag = "1")] + pub nonce: u64, + /// The delegate address to remove. + #[prost(bytes = "vec", tag = "2")] + pub delegate: ::prost::alloc::vec::Vec, +} +#[derive(serde::Serialize, serde::Deserialize, Clone, PartialEq, ::prost::Message)] +pub struct RemoveDelegationResponse { + /// The transaction hash. + #[prost(bytes = "vec", tag = "1")] + pub tx_hash: ::prost::alloc::vec::Vec, + /// The body of the response. + #[prost(message, optional, tag = "2")] + pub body: ::core::option::Option, +} +#[derive(serde::Serialize, serde::Deserialize, Clone, Copy, PartialEq, ::prost::Message)] +pub struct RemoveDelegationResponseBody {} +#[derive(serde::Serialize, serde::Deserialize, Clone, PartialEq, ::prost::Message)] +pub struct AcceptDelegationRequest { + /// The signature of the sender. + #[prost(bytes = "vec", tag = "1")] + pub signature: ::prost::alloc::vec::Vec, + /// The body of the request. + #[prost(message, optional, tag = "2")] + pub body: ::core::option::Option, +} +#[derive(serde::Serialize, serde::Deserialize, Clone, PartialEq, ::prost::Message)] +pub struct AcceptDelegationRequestBody { + /// The account nonce of the sender. + #[prost(uint64, tag = "1")] + pub nonce: u64, + /// The address of the owner who requested the delegation + #[prost(bytes = "vec", tag = "2")] + pub owner: ::prost::alloc::vec::Vec, +} +#[derive(serde::Serialize, serde::Deserialize, Clone, PartialEq, ::prost::Message)] +pub struct AcceptDelegationResponse { + /// The transaction hash. + #[prost(bytes = "vec", tag = "1")] + pub tx_hash: ::prost::alloc::vec::Vec, + /// The body of the response. + #[prost(message, optional, tag = "2")] + pub body: ::core::option::Option, +} +#[derive(serde::Serialize, serde::Deserialize, Clone, Copy, PartialEq, ::prost::Message)] +pub struct AcceptDelegationResponseBody {} +#[derive(serde::Serialize, serde::Deserialize, Clone, PartialEq, ::prost::Message)] +pub struct SetAccountNameRequest { + /// The signature of the sender. + #[prost(bytes = "vec", tag = "1")] + pub signature: ::prost::alloc::vec::Vec, + /// The body of the request. + #[prost(message, optional, tag = "2")] + pub body: ::core::option::Option, +} +#[derive(serde::Serialize, serde::Deserialize, Clone, PartialEq, ::prost::Message)] +pub struct SetAccountNameRequestBody { + /// The account nonce of the sender. + #[prost(uint64, tag = "1")] + pub nonce: u64, + /// The address of the account to update the name of. Only the sender can + /// update the name unless authorized. + #[prost(bytes = "vec", tag = "2")] + pub address: ::prost::alloc::vec::Vec, + /// The name of the account. Must be unique. + #[prost(string, tag = "3")] + pub name: ::prost::alloc::string::String, +} +#[derive(serde::Serialize, serde::Deserialize, Clone, PartialEq, ::prost::Message)] +pub struct SetAccountNameResponse { + /// The transaction hash. + #[prost(bytes = "vec", tag = "1")] + pub tx_hash: ::prost::alloc::vec::Vec, + /// The body of the response. + #[prost(message, optional, tag = "2")] + pub body: ::core::option::Option, +} +#[derive(serde::Serialize, serde::Deserialize, Clone, Copy, PartialEq, ::prost::Message)] +pub struct SetAccountNameResponseBody {} +#[derive(serde::Serialize, serde::Deserialize, Clone, PartialEq, ::prost::Message)] +pub struct GetAccountNameRequest { + /// The address of the account. + #[prost(bytes = "vec", tag = "1")] + pub address: ::prost::alloc::vec::Vec, +} +#[derive(serde::Serialize, serde::Deserialize, Clone, PartialEq, ::prost::Message)] +pub struct GetAccountNameResponse { + /// The name of the account. + #[prost(string, optional, tag = "1")] + pub name: ::core::option::Option<::prost::alloc::string::String>, +} +#[derive(serde::Serialize, serde::Deserialize, Clone, PartialEq, ::prost::Message)] +pub struct Program { + /// The verification key hash. + #[prost(bytes = "vec", tag = "1")] + pub vk_hash: ::prost::alloc::vec::Vec, + /// The verification key. + #[prost(bytes = "vec", tag = "2")] + pub vk: ::prost::alloc::vec::Vec, + /// The program resource identifier. + #[prost(string, tag = "3")] + pub program_uri: ::prost::alloc::string::String, + /// The optional name of the program. + #[prost(string, optional, tag = "4")] + pub name: ::core::option::Option<::prost::alloc::string::String>, + /// The owner of the program. + #[prost(bytes = "vec", tag = "5")] + pub owner: ::prost::alloc::vec::Vec, + /// The unix timestamp of when the program was created. + #[prost(uint64, tag = "6")] + pub created_at: u64, +} +#[derive(serde::Serialize, serde::Deserialize, Clone, PartialEq, ::prost::Message)] +pub struct GetProgramRequest { + /// The verification key hash of the program. + #[prost(bytes = "vec", tag = "1")] + pub vk_hash: ::prost::alloc::vec::Vec, +} +#[derive(serde::Serialize, serde::Deserialize, Clone, PartialEq, ::prost::Message)] +pub struct GetProgramResponse { + /// The program details. + #[prost(message, optional, tag = "1")] + pub program: ::core::option::Option, +} +#[derive(serde::Serialize, serde::Deserialize, Clone, PartialEq, ::prost::Message)] +pub struct CreateProgramRequest { + /// The signature of the sender. + #[prost(bytes = "vec", tag = "1")] + pub signature: ::prost::alloc::vec::Vec, + /// The body of the request. + #[prost(message, optional, tag = "2")] + pub body: ::core::option::Option, +} +#[derive(serde::Serialize, serde::Deserialize, Clone, PartialEq, ::prost::Message)] +pub struct CreateProgramRequestBody { + /// The account nonce of the sender. + #[prost(uint64, tag = "1")] + pub nonce: u64, + /// The verification key hash. + #[prost(bytes = "vec", tag = "2")] + pub vk_hash: ::prost::alloc::vec::Vec, + /// The verification key. + #[prost(bytes = "vec", tag = "3")] + pub vk: ::prost::alloc::vec::Vec, + /// The program resource identifier. + #[prost(string, tag = "4")] + pub program_uri: ::prost::alloc::string::String, +} +#[derive(serde::Serialize, serde::Deserialize, Clone, PartialEq, ::prost::Message)] +pub struct CreateProgramResponse { + /// The transaction hash. + #[prost(bytes = "vec", tag = "1")] + pub tx_hash: ::prost::alloc::vec::Vec, + /// The body of the response. + #[prost(message, optional, tag = "2")] + pub body: ::core::option::Option, +} +#[derive(serde::Serialize, serde::Deserialize, Clone, Copy, PartialEq, ::prost::Message)] +pub struct CreateProgramResponseBody {} +#[derive(serde::Serialize, serde::Deserialize, Clone, PartialEq, ::prost::Message)] +pub struct SetProgramNameRequest { + /// The signature of the sender. + #[prost(bytes = "vec", tag = "1")] + pub signature: ::prost::alloc::vec::Vec, + /// The body of the request. + #[prost(message, optional, tag = "2")] + pub body: ::core::option::Option, +} +#[derive(serde::Serialize, serde::Deserialize, Clone, PartialEq, ::prost::Message)] +pub struct SetProgramNameRequestBody { + /// The account nonce of the sender. + #[prost(uint64, tag = "1")] + pub nonce: u64, + /// The identifier of the program to update the name of. Only the original + /// program creator can update the name unless authorized. + #[prost(bytes = "vec", tag = "2")] + pub vk_hash: ::prost::alloc::vec::Vec, + /// The name of the program. Must be unique. + #[prost(string, tag = "3")] + pub name: ::prost::alloc::string::String, +} +#[derive(serde::Serialize, serde::Deserialize, Clone, PartialEq, ::prost::Message)] +pub struct SetProgramNameResponse { + /// The transaction hash. + #[prost(bytes = "vec", tag = "1")] + pub tx_hash: ::prost::alloc::vec::Vec, + /// The body of the response. + #[prost(message, optional, tag = "2")] + pub body: ::core::option::Option, +} +#[derive(serde::Serialize, serde::Deserialize, Clone, Copy, PartialEq, ::prost::Message)] +pub struct SetProgramNameResponseBody {} +#[derive(serde::Serialize, serde::Deserialize, Clone, PartialEq, ::prost::Message)] +pub struct GetBalanceRequest { + /// The address of the account. + #[prost(bytes = "vec", tag = "1")] + pub address: ::prost::alloc::vec::Vec, +} +#[derive(serde::Serialize, serde::Deserialize, Clone, PartialEq, ::prost::Message)] +pub struct GetBalanceResponse { + /// The amount of credits owned by the account. + #[prost(string, tag = "1")] + pub amount: ::prost::alloc::string::String, +} +#[derive(serde::Serialize, serde::Deserialize, Clone, PartialEq, ::prost::Message)] +pub struct BalanceLog { + /// The address of the account. + #[prost(bytes = "vec", tag = "1")] + pub address: ::prost::alloc::vec::Vec, + /// The type of balance change operation. + #[prost(enumeration = "BalanceOperation", tag = "2")] + pub operation: i32, + /// The amount of the change (can be positive or negative). + #[prost(string, tag = "3")] + pub amount: ::prost::alloc::string::String, + /// The transaction hash that caused this change. + #[prost(bytes = "vec", tag = "4")] + pub tx_hash: ::prost::alloc::vec::Vec, + /// The unix timestamp of when this change occurred. + #[prost(uint64, tag = "5")] + pub created_at: u64, +} +#[derive(serde::Serialize, serde::Deserialize, Clone, PartialEq, ::prost::Message)] +pub struct GetFilteredBalanceLogsRequest { + /// The optional address to filter for. + #[prost(bytes = "vec", optional, tag = "1")] + pub address: ::core::option::Option<::prost::alloc::vec::Vec>, + /// The optional type of operations to filter for. + #[prost(enumeration = "BalanceOperation", optional, tag = "2")] + pub operation: ::core::option::Option, + /// The optional minimum unix timestamp to filter logs from. Only returns + /// logs after this timestamp. + #[prost(uint64, optional, tag = "3")] + pub minimum_timestamp: ::core::option::Option, + /// The optional maximum unix timestamp to filter logs to. Only returns + /// logs before this timestamp. + #[prost(uint64, optional, tag = "4")] + pub maximum_timestamp: ::core::option::Option, + /// The optional maximum number of logs to return (default is 10, maximum is 100). + #[prost(uint32, optional, tag = "5")] + pub limit: ::core::option::Option, + /// The optional page number to return (default is 1). + #[prost(uint32, optional, tag = "6")] + pub page: ::core::option::Option, +} +#[derive(serde::Serialize, serde::Deserialize, Clone, PartialEq, ::prost::Message)] +pub struct GetFilteredBalanceLogsResponse { + /// The balance logs that matched the filter criteria. + #[prost(message, repeated, tag = "1")] + pub logs: ::prost::alloc::vec::Vec, +} +#[derive(serde::Serialize, serde::Deserialize, Clone, PartialEq, ::prost::Message)] +pub struct AddCreditRequest { + /// The signature of the sender. + #[prost(bytes = "vec", tag = "1")] + pub signature: ::prost::alloc::vec::Vec, + /// The body of the request. + #[prost(message, optional, tag = "2")] + pub body: ::core::option::Option, +} +#[derive(serde::Serialize, serde::Deserialize, Clone, PartialEq, ::prost::Message)] +pub struct AddCreditRequestBody { + /// The account nonce of the sender. + #[prost(uint64, tag = "1")] + pub nonce: u64, + /// The address of the account to add credits to. + #[prost(bytes = "vec", tag = "2")] + pub address: ::prost::alloc::vec::Vec, + /// The amount of credits to add. + #[prost(string, tag = "3")] + pub amount: ::prost::alloc::string::String, +} +#[derive(serde::Serialize, serde::Deserialize, Clone, PartialEq, ::prost::Message)] +pub struct AddCreditResponse { + /// The transaction hash. + #[prost(bytes = "vec", tag = "1")] + pub tx_hash: ::prost::alloc::vec::Vec, + /// The body of the response. + #[prost(message, optional, tag = "2")] + pub body: ::core::option::Option, +} +#[derive(serde::Serialize, serde::Deserialize, Clone, Copy, PartialEq, ::prost::Message)] +pub struct AddCreditResponseBody {} +#[derive(serde::Serialize, serde::Deserialize, Clone, Copy, PartialEq, ::prost::Message)] +pub struct GetLatestBridgeBlockRequest { + /// The chain ID of the bridge. + #[prost(uint32, tag = "1")] + pub chain_id: u32, +} +#[derive(serde::Serialize, serde::Deserialize, Clone, Copy, PartialEq, ::prost::Message)] +pub struct GetLatestBridgeBlockResponse { + /// The latest processed block in the bridge. + #[prost(uint64, tag = "1")] + pub block_number: u64, +} +#[derive(serde::Serialize, serde::Deserialize, Clone, Copy, PartialEq, ::prost::Message)] +pub struct GetGasPriceEstimateRequest { + #[prost(enumeration = "FulfillmentStrategy", tag = "1")] + pub strategy: i32, +} +#[derive(serde::Serialize, serde::Deserialize, Clone, Copy, PartialEq, ::prost::Message)] +pub struct GetGasPriceEstimateResponse { + #[prost(uint64, tag = "1")] + pub gas_price: u64, +} +#[derive(serde::Serialize, serde::Deserialize, Clone, PartialEq, ::prost::Message)] +pub struct GetTransactionDetailsRequest { + /// The transaction hash. + #[prost(bytes = "vec", tag = "1")] + pub tx_hash: ::prost::alloc::vec::Vec, +} +#[derive(serde::Serialize, serde::Deserialize, Clone, PartialEq, ::prost::Message)] +pub struct TransactionDetails { + #[prost(bytes = "vec", tag = "1")] + pub tx_hash: ::prost::alloc::vec::Vec, + #[prost(bytes = "vec", tag = "2")] + pub sender: ::prost::alloc::vec::Vec, + #[prost(bytes = "vec", tag = "3")] + pub signature: ::prost::alloc::vec::Vec, + #[prost(uint64, tag = "4")] + pub nonce: u64, + #[prost(uint64, tag = "5")] + pub created_at: u64, + #[prost(string, optional, tag = "6")] + pub name: ::core::option::Option<::prost::alloc::string::String>, + #[prost(bytes = "vec", optional, tag = "7")] + pub request_id: ::core::option::Option<::prost::alloc::vec::Vec>, +} +#[derive(serde::Serialize, serde::Deserialize, Clone, PartialEq, ::prost::Message)] +pub struct GetTransactionDetailsResponse { + #[prost(message, optional, tag = "1")] + pub transaction: ::core::option::Option, +} +#[derive(serde::Serialize, serde::Deserialize, Clone, PartialEq, ::prost::Message)] +pub struct Reservation { + /// The address of the requester. + #[prost(bytes = "vec", tag = "1")] + pub requester: ::prost::alloc::vec::Vec, + /// The address of the fulfiller. + #[prost(bytes = "vec", tag = "2")] + pub fulfiller: ::prost::alloc::vec::Vec, + /// The optional name to refer to an alias of the requester address. + #[prost(string, optional, tag = "3")] + pub requester_name: ::core::option::Option<::prost::alloc::string::String>, + /// The optional name to refer to an alias of the fulfiller address. + #[prost(string, optional, tag = "4")] + pub fulfiller_name: ::core::option::Option<::prost::alloc::string::String>, + /// The unix timestamp of when the reservation was created. + #[prost(uint64, tag = "5")] + pub created_at: u64, +} +#[derive(serde::Serialize, serde::Deserialize, Clone, Copy, PartialEq, ::prost::Message)] +pub struct GetFilteredReservationsRequest { + /// The optional maximum number of reservations to return (default is 10, + /// maximum is 100). + #[prost(uint32, optional, tag = "1")] + pub limit: ::core::option::Option, + /// The optional page number to return (default is 1). + #[prost(uint32, optional, tag = "2")] + pub page: ::core::option::Option, +} +#[derive(serde::Serialize, serde::Deserialize, Clone, PartialEq, ::prost::Message)] +pub struct GetFilteredReservationsResponse { + /// The reservations that matched the filter criteria. + #[prost(message, repeated, tag = "1")] + pub reservations: ::prost::alloc::vec::Vec, +} +#[derive(serde::Serialize, serde::Deserialize, Clone, PartialEq, ::prost::Message)] +pub struct AddReservationRequest { + /// The signature of the sender. + #[prost(bytes = "vec", tag = "1")] + pub signature: ::prost::alloc::vec::Vec, + /// The body of the request. + #[prost(message, optional, tag = "2")] + pub body: ::core::option::Option, +} +#[derive(serde::Serialize, serde::Deserialize, Clone, PartialEq, ::prost::Message)] +pub struct AddReservationRequestBody { + /// The account nonce of the sender. + #[prost(uint64, tag = "1")] + pub nonce: u64, + /// The address of the requester to add reservation for. + #[prost(bytes = "vec", tag = "2")] + pub requester: ::prost::alloc::vec::Vec, + /// The address of the fulfiller to reserve. + #[prost(bytes = "vec", tag = "3")] + pub fulfiller: ::prost::alloc::vec::Vec, +} +#[derive(serde::Serialize, serde::Deserialize, Clone, PartialEq, ::prost::Message)] +pub struct AddReservationResponse { + /// The transaction hash. + #[prost(bytes = "vec", tag = "1")] + pub tx_hash: ::prost::alloc::vec::Vec, + /// The body of the response. + #[prost(message, optional, tag = "2")] + pub body: ::core::option::Option, +} +#[derive(serde::Serialize, serde::Deserialize, Clone, Copy, PartialEq, ::prost::Message)] +pub struct AddReservationResponseBody {} +#[derive(serde::Serialize, serde::Deserialize, Clone, PartialEq, ::prost::Message)] +pub struct RemoveReservationRequest { + /// The signature of the sender. + #[prost(bytes = "vec", tag = "1")] + pub signature: ::prost::alloc::vec::Vec, + /// The body of the request. + #[prost(message, optional, tag = "2")] + pub body: ::core::option::Option, +} +#[derive(serde::Serialize, serde::Deserialize, Clone, PartialEq, ::prost::Message)] +pub struct RemoveReservationRequestBody { + /// The account nonce of the sender. + #[prost(uint64, tag = "1")] + pub nonce: u64, + /// The address of the requester to remove reservation for. + #[prost(bytes = "vec", tag = "2")] + pub requester: ::prost::alloc::vec::Vec, +} +#[derive(serde::Serialize, serde::Deserialize, Clone, PartialEq, ::prost::Message)] +pub struct RemoveReservationResponse { + /// The transaction hash. + #[prost(bytes = "vec", tag = "1")] + pub tx_hash: ::prost::alloc::vec::Vec, + /// The body of the response. + #[prost(message, optional, tag = "2")] + pub body: ::core::option::Option, +} +#[derive(serde::Serialize, serde::Deserialize, Clone, Copy, PartialEq, ::prost::Message)] +pub struct RemoveReservationResponseBody {} +#[derive(serde::Serialize, serde::Deserialize, Clone, PartialEq, ::prost::Message)] +pub struct BidRequest { + /// The signature of the sender. + #[prost(bytes = "vec", tag = "1")] + pub signature: ::prost::alloc::vec::Vec, + /// The body of the request. + #[prost(message, optional, tag = "2")] + pub body: ::core::option::Option, +} +#[derive(serde::Serialize, serde::Deserialize, Clone, PartialEq, ::prost::Message)] +pub struct BidRequestBody { + /// The account nonce of the sender. + #[prost(uint64, tag = "1")] + pub nonce: u64, + /// The request ID to bid on. + #[prost(bytes = "vec", tag = "2")] + pub request_id: ::prost::alloc::vec::Vec, +} +#[derive(serde::Serialize, serde::Deserialize, Clone, PartialEq, ::prost::Message)] +pub struct BidResponse { + /// The transaction hash. + #[prost(bytes = "vec", tag = "1")] + pub tx_hash: ::prost::alloc::vec::Vec, + /// The body of the response. + #[prost(message, optional, tag = "2")] + pub body: ::core::option::Option, +} +#[derive(serde::Serialize, serde::Deserialize, Clone, Copy, PartialEq, ::prost::Message)] +pub struct BidResponseBody {} +#[derive(serde::Serialize, serde::Deserialize, Clone, PartialEq, ::prost::Message)] +pub struct SettleRequest { + /// The signature of the sender. + #[prost(bytes = "vec", tag = "1")] + pub signature: ::prost::alloc::vec::Vec, + /// The body of the request. + #[prost(message, optional, tag = "2")] + pub body: ::core::option::Option, +} +#[derive(serde::Serialize, serde::Deserialize, Clone, PartialEq, ::prost::Message)] +pub struct SettleRequestBody { + /// The account nonce of the sender. + #[prost(uint64, tag = "1")] + pub nonce: u64, + /// The request ID to settle bids for. + #[prost(bytes = "vec", tag = "2")] + pub request_id: ::prost::alloc::vec::Vec, +} +#[derive(serde::Serialize, serde::Deserialize, Clone, PartialEq, ::prost::Message)] +pub struct SettleResponse { + /// The transaction hash. + #[prost(bytes = "vec", tag = "1")] + pub tx_hash: ::prost::alloc::vec::Vec, + /// The body of the response. + #[prost(message, optional, tag = "2")] + pub body: ::core::option::Option, +} +#[derive(serde::Serialize, serde::Deserialize, Clone, Copy, PartialEq, ::prost::Message)] +pub struct SettleResponseBody {} +#[derive( + serde::Serialize, + serde::Deserialize, + Clone, + Copy, + Debug, + PartialEq, + Eq, + Hash, + PartialOrd, + Ord, + ::prost::Enumeration, +)] +#[repr(i32)] +pub enum ProofMode { + UnspecifiedProofMode = 0, + /// The core proof mode. + Core = 1, + /// The compressed proof mode. + Compressed = 2, + /// The plonk proof mode. + Plonk = 3, + /// The groth16 proof mode. + Groth16 = 4, +} +impl ProofMode { + /// String value of the enum field names used in the ProtoBuf definition. + /// + /// The values are not transformed in any way and thus are considered stable + /// (if the ProtoBuf definition does not change) and safe for programmatic use. + pub fn as_str_name(&self) -> &'static str { + match self { + Self::UnspecifiedProofMode => "UNSPECIFIED_PROOF_MODE", + Self::Core => "CORE", + Self::Compressed => "COMPRESSED", + Self::Plonk => "PLONK", + Self::Groth16 => "GROTH16", + } + } + /// Creates an enum from field names used in the ProtoBuf definition. + pub fn from_str_name(value: &str) -> ::core::option::Option { + match value { + "UNSPECIFIED_PROOF_MODE" => Some(Self::UnspecifiedProofMode), + "CORE" => Some(Self::Core), + "COMPRESSED" => Some(Self::Compressed), + "PLONK" => Some(Self::Plonk), + "GROTH16" => Some(Self::Groth16), + _ => None, + } + } +} +/// The different strategies that can be used for fulfilling requests. +#[derive( + serde::Serialize, + serde::Deserialize, + Clone, + Copy, + Debug, + PartialEq, + Eq, + Hash, + PartialOrd, + Ord, + ::prost::Enumeration, +)] +#[repr(i32)] +pub enum FulfillmentStrategy { + UnspecifiedFulfillmentStrategy = 0, + /// The hosted fulfillment strategy. Uses Succinct's on-demand prover to fulfill requests. + Hosted = 1, + /// The reserved fulfillment strategy. Uses an already existing agreement with a + /// fulfiller to fulfill requests. + Reserved = 2, + /// The auction fulfillment strategy. Uses a decentralized proof contest to + /// fulfill requests. + Auction = 3, +} +impl FulfillmentStrategy { + /// String value of the enum field names used in the ProtoBuf definition. + /// + /// The values are not transformed in any way and thus are considered stable + /// (if the ProtoBuf definition does not change) and safe for programmatic use. + pub fn as_str_name(&self) -> &'static str { + match self { + Self::UnspecifiedFulfillmentStrategy => "UNSPECIFIED_FULFILLMENT_STRATEGY", + Self::Hosted => "HOSTED", + Self::Reserved => "RESERVED", + Self::Auction => "AUCTION", + } + } + /// Creates an enum from field names used in the ProtoBuf definition. + pub fn from_str_name(value: &str) -> ::core::option::Option { + match value { + "UNSPECIFIED_FULFILLMENT_STRATEGY" => Some(Self::UnspecifiedFulfillmentStrategy), + "HOSTED" => Some(Self::Hosted), + "RESERVED" => Some(Self::Reserved), + "AUCTION" => Some(Self::Auction), + _ => None, + } + } +} +/// The different fulfillment statuses that a request can be in. +#[derive( + serde::Serialize, + serde::Deserialize, + Clone, + Copy, + Debug, + PartialEq, + Eq, + Hash, + PartialOrd, + Ord, + ::prost::Enumeration, +)] +#[repr(i32)] +pub enum FulfillmentStatus { + UnspecifiedFulfillmentStatus = 0, + /// The request has been requested. + Requested = 1, + /// The request has been assigned to a fulfiller. + Assigned = 2, + /// The request has been fulfilled. + Fulfilled = 3, + /// The request cannot be fulfilled. + Unfulfillable = 4, +} +impl FulfillmentStatus { + /// String value of the enum field names used in the ProtoBuf definition. + /// + /// The values are not transformed in any way and thus are considered stable + /// (if the ProtoBuf definition does not change) and safe for programmatic use. + pub fn as_str_name(&self) -> &'static str { + match self { + Self::UnspecifiedFulfillmentStatus => "UNSPECIFIED_FULFILLMENT_STATUS", + Self::Requested => "REQUESTED", + Self::Assigned => "ASSIGNED", + Self::Fulfilled => "FULFILLED", + Self::Unfulfillable => "UNFULFILLABLE", + } + } + /// Creates an enum from field names used in the ProtoBuf definition. + pub fn from_str_name(value: &str) -> ::core::option::Option { + match value { + "UNSPECIFIED_FULFILLMENT_STATUS" => Some(Self::UnspecifiedFulfillmentStatus), + "REQUESTED" => Some(Self::Requested), + "ASSIGNED" => Some(Self::Assigned), + "FULFILLED" => Some(Self::Fulfilled), + "UNFULFILLABLE" => Some(Self::Unfulfillable), + _ => None, + } + } +} +/// The different execution statuses that a request can be in. +#[derive( + serde::Serialize, + serde::Deserialize, + Clone, + Copy, + Debug, + PartialEq, + Eq, + Hash, + PartialOrd, + Ord, + ::prost::Enumeration, +)] +#[repr(i32)] +pub enum ExecutionStatus { + UnspecifiedExecutionStatus = 0, + /// The request has not been executed. + Unexecuted = 1, + /// The request has been executed. + Executed = 2, + /// The request cannot be executed. + Unexecutable = 3, +} +impl ExecutionStatus { + /// String value of the enum field names used in the ProtoBuf definition. + /// + /// The values are not transformed in any way and thus are considered stable + /// (if the ProtoBuf definition does not change) and safe for programmatic use. + pub fn as_str_name(&self) -> &'static str { + match self { + Self::UnspecifiedExecutionStatus => "UNSPECIFIED_EXECUTION_STATUS", + Self::Unexecuted => "UNEXECUTED", + Self::Executed => "EXECUTED", + Self::Unexecutable => "UNEXECUTABLE", + } + } + /// Creates an enum from field names used in the ProtoBuf definition. + pub fn from_str_name(value: &str) -> ::core::option::Option { + match value { + "UNSPECIFIED_EXECUTION_STATUS" => Some(Self::UnspecifiedExecutionStatus), + "UNEXECUTED" => Some(Self::Unexecuted), + "EXECUTED" => Some(Self::Executed), + "UNEXECUTABLE" => Some(Self::Unexecutable), + _ => None, + } + } +} +/// The different types of balance changes that can occur. +#[derive( + serde::Serialize, + serde::Deserialize, + Clone, + Copy, + Debug, + PartialEq, + Eq, + Hash, + PartialOrd, + Ord, + ::prost::Enumeration, +)] +#[repr(i32)] +pub enum BalanceOperation { + UnspecifiedBalanceChangeOperation = 0, + /// A deposit operation (positive). + Deposit = 1, + /// A withdrawal operation (negative). + Withdrawal = 2, + /// A credit operation (positive). + Credit = 3, + /// A deduction operation (negative). + Deduction = 4, + /// A refund operation (positive). + Refund = 5, + /// A bid operation (negative). + Bid = 6, +} +impl BalanceOperation { + /// String value of the enum field names used in the ProtoBuf definition. + /// + /// The values are not transformed in any way and thus are considered stable + /// (if the ProtoBuf definition does not change) and safe for programmatic use. + pub fn as_str_name(&self) -> &'static str { + match self { + Self::UnspecifiedBalanceChangeOperation => "UNSPECIFIED_BALANCE_CHANGE_OPERATION", + Self::Deposit => "DEPOSIT", + Self::Withdrawal => "WITHDRAWAL", + Self::Credit => "CREDIT", + Self::Deduction => "DEDUCTION", + Self::Refund => "REFUND", + Self::Bid => "BID", + } + } + /// Creates an enum from field names used in the ProtoBuf definition. + pub fn from_str_name(value: &str) -> ::core::option::Option { + match value { + "UNSPECIFIED_BALANCE_CHANGE_OPERATION" => Some(Self::UnspecifiedBalanceChangeOperation), + "DEPOSIT" => Some(Self::Deposit), + "WITHDRAWAL" => Some(Self::Withdrawal), + "CREDIT" => Some(Self::Credit), + "DEDUCTION" => Some(Self::Deduction), + "REFUND" => Some(Self::Refund), + "BID" => Some(Self::Bid), + _ => None, + } + } +} +/// Generated client implementations. +pub mod prover_network_client { + #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)] + use tonic::codegen::http::Uri; + use tonic::codegen::*; + #[derive(Debug, Clone)] + pub struct ProverNetworkClient { + inner: tonic::client::Grpc, + } + impl ProverNetworkClient { + /// Attempt to create a new client by connecting to a given endpoint. + pub async fn connect(dst: D) -> Result + where + D: TryInto, + D::Error: Into, + { + let conn = tonic::transport::Endpoint::new(dst)?.connect().await?; + Ok(Self::new(conn)) + } + } + impl ProverNetworkClient + where + T: tonic::client::GrpcService, + T::Error: Into, + T::ResponseBody: Body + std::marker::Send + 'static, + ::Error: Into + std::marker::Send, + { + pub fn new(inner: T) -> Self { + let inner = tonic::client::Grpc::new(inner); + Self { inner } + } + pub fn with_origin(inner: T, origin: Uri) -> Self { + let inner = tonic::client::Grpc::with_origin(inner, origin); + Self { inner } + } + pub fn with_interceptor( + inner: T, + interceptor: F, + ) -> ProverNetworkClient> + where + F: tonic::service::Interceptor, + T::ResponseBody: Default, + T: tonic::codegen::Service< + http::Request, + Response = http::Response< + >::ResponseBody, + >, + >, + >>::Error: + Into + std::marker::Send + std::marker::Sync, + { + ProverNetworkClient::new(InterceptedService::new(inner, interceptor)) + } + /// Compress requests with the given encoding. + /// + /// This requires the server to support it otherwise it might respond with an + /// error. + #[must_use] + pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self { + self.inner = self.inner.send_compressed(encoding); + self + } + /// Enable decompressing responses. + #[must_use] + pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self { + self.inner = self.inner.accept_compressed(encoding); + self + } + /// Limits the maximum size of a decoded message. + /// + /// Default: `4MB` + #[must_use] + pub fn max_decoding_message_size(mut self, limit: usize) -> Self { + self.inner = self.inner.max_decoding_message_size(limit); + self + } + /// Limits the maximum size of an encoded message. + /// + /// Default: `usize::MAX` + #[must_use] + pub fn max_encoding_message_size(mut self, limit: usize) -> Self { + self.inner = self.inner.max_encoding_message_size(limit); + self + } + /// Creates a proof request. + pub async fn request_proof( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result, tonic::Status> + { + self.inner.ready().await.map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static("/network.ProverNetwork/RequestProof"); + let mut req = request.into_request(); + req.extensions_mut().insert(GrpcMethod::new("network.ProverNetwork", "RequestProof")); + self.inner.unary(req, path, codec).await + } + /// Fulfills a proof request. Only callable by the assigned fulfiller. + pub async fn fulfill_proof( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result, tonic::Status> + { + self.inner.ready().await.map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static("/network.ProverNetwork/FulfillProof"); + let mut req = request.into_request(); + req.extensions_mut().insert(GrpcMethod::new("network.ProverNetwork", "FulfillProof")); + self.inner.unary(req, path, codec).await + } + /// Executes a proof request. Only callable by the execution oracle. + pub async fn execute_proof( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result, tonic::Status> + { + self.inner.ready().await.map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static("/network.ProverNetwork/ExecuteProof"); + let mut req = request.into_request(); + req.extensions_mut().insert(GrpcMethod::new("network.ProverNetwork", "ExecuteProof")); + self.inner.unary(req, path, codec).await + } + /// Fails fulfillment. Only callable by the assigned fulfiller. + pub async fn fail_fulfillment( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result, tonic::Status> + { + self.inner.ready().await.map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = + http::uri::PathAndQuery::from_static("/network.ProverNetwork/FailFulfillment"); + let mut req = request.into_request(); + req.extensions_mut() + .insert(GrpcMethod::new("network.ProverNetwork", "FailFulfillment")); + self.inner.unary(req, path, codec).await + } + /// Fails execution. Only callable by the execution oracle. + pub async fn fail_execution( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result, tonic::Status> + { + self.inner.ready().await.map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static("/network.ProverNetwork/FailExecution"); + let mut req = request.into_request(); + req.extensions_mut().insert(GrpcMethod::new("network.ProverNetwork", "FailExecution")); + self.inner.unary(req, path, codec).await + } + /// Get the status of a proof request. + pub async fn get_proof_request_status( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result, tonic::Status> + { + self.inner.ready().await.map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/network.ProverNetwork/GetProofRequestStatus", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert(GrpcMethod::new("network.ProverNetwork", "GetProofRequestStatus")); + self.inner.unary(req, path, codec).await + } + /// Get the details of a proof request. + pub async fn get_proof_request_details( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner.ready().await.map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/network.ProverNetwork/GetProofRequestDetails", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert(GrpcMethod::new("network.ProverNetwork", "GetProofRequestDetails")); + self.inner.unary(req, path, codec).await + } + /// Get the proof requests that meet the filter criteria. + pub async fn get_filtered_proof_requests( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner.ready().await.map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/network.ProverNetwork/GetFilteredProofRequests", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert(GrpcMethod::new("network.ProverNetwork", "GetFilteredProofRequests")); + self.inner.unary(req, path, codec).await + } + /// Search for proof requests, programs, and requesters. + pub async fn get_search_results( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result, tonic::Status> + { + self.inner.ready().await.map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = + http::uri::PathAndQuery::from_static("/network.ProverNetwork/GetSearchResults"); + let mut req = request.into_request(); + req.extensions_mut() + .insert(GrpcMethod::new("network.ProverNetwork", "GetSearchResults")); + self.inner.unary(req, path, codec).await + } + /// Get metrics for proof requests. + pub async fn get_proof_request_metrics( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner.ready().await.map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/network.ProverNetwork/GetProofRequestMetrics", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert(GrpcMethod::new("network.ProverNetwork", "GetProofRequestMetrics")); + self.inner.unary(req, path, codec).await + } + /// Get time series data for proof requests. + pub async fn get_proof_request_graph( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result, tonic::Status> + { + self.inner.ready().await.map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = + http::uri::PathAndQuery::from_static("/network.ProverNetwork/GetProofRequestGraph"); + let mut req = request.into_request(); + req.extensions_mut() + .insert(GrpcMethod::new("network.ProverNetwork", "GetProofRequestGraph")); + self.inner.unary(req, path, codec).await + } + /// Get analytics graphs for proof requests. + pub async fn get_analytics_graphs( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result, tonic::Status> + { + self.inner.ready().await.map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = + http::uri::PathAndQuery::from_static("/network.ProverNetwork/GetAnalyticsGraphs"); + let mut req = request.into_request(); + req.extensions_mut() + .insert(GrpcMethod::new("network.ProverNetwork", "GetAnalyticsGraphs")); + self.inner.unary(req, path, codec).await + } + /// Get the nonce of the account. + pub async fn get_nonce( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result, tonic::Status> { + self.inner.ready().await.map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static("/network.ProverNetwork/GetNonce"); + let mut req = request.into_request(); + req.extensions_mut().insert(GrpcMethod::new("network.ProverNetwork", "GetNonce")); + self.inner.unary(req, path, codec).await + } + /// Get the delegations of the account. + pub async fn get_filtered_delegations( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner.ready().await.map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/network.ProverNetwork/GetFilteredDelegations", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert(GrpcMethod::new("network.ProverNetwork", "GetFilteredDelegations")); + self.inner.unary(req, path, codec).await + } + /// Add a delegation. Only callable by the owner of an account. + pub async fn add_delegation( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result, tonic::Status> + { + self.inner.ready().await.map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static("/network.ProverNetwork/AddDelegation"); + let mut req = request.into_request(); + req.extensions_mut().insert(GrpcMethod::new("network.ProverNetwork", "AddDelegation")); + self.inner.unary(req, path, codec).await + } + /// // Remove a delegation. Only callable by the owner of an account. + pub async fn remove_delegation( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result, tonic::Status> + { + self.inner.ready().await.map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = + http::uri::PathAndQuery::from_static("/network.ProverNetwork/RemoveDelegation"); + let mut req = request.into_request(); + req.extensions_mut() + .insert(GrpcMethod::new("network.ProverNetwork", "RemoveDelegation")); + self.inner.unary(req, path, codec).await + } + /// Accept a delegation. Only callable by the delegate of a delegation. + pub async fn accept_delegation( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result, tonic::Status> + { + self.inner.ready().await.map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = + http::uri::PathAndQuery::from_static("/network.ProverNetwork/AcceptDelegation"); + let mut req = request.into_request(); + req.extensions_mut() + .insert(GrpcMethod::new("network.ProverNetwork", "AcceptDelegation")); + self.inner.unary(req, path, codec).await + } + /// Set the name of the account. Only callable by the owner of an account. + pub async fn set_account_name( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result, tonic::Status> + { + self.inner.ready().await.map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = + http::uri::PathAndQuery::from_static("/network.ProverNetwork/SetAccountName"); + let mut req = request.into_request(); + req.extensions_mut().insert(GrpcMethod::new("network.ProverNetwork", "SetAccountName")); + self.inner.unary(req, path, codec).await + } + /// Get the name of the account. + pub async fn get_account_name( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result, tonic::Status> + { + self.inner.ready().await.map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = + http::uri::PathAndQuery::from_static("/network.ProverNetwork/GetAccountName"); + let mut req = request.into_request(); + req.extensions_mut().insert(GrpcMethod::new("network.ProverNetwork", "GetAccountName")); + self.inner.unary(req, path, codec).await + } + /// Get metadata about a program. + pub async fn get_program( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result, tonic::Status> + { + self.inner.ready().await.map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static("/network.ProverNetwork/GetProgram"); + let mut req = request.into_request(); + req.extensions_mut().insert(GrpcMethod::new("network.ProverNetwork", "GetProgram")); + self.inner.unary(req, path, codec).await + } + /// Create a new program. Must be called before requesting proofs. + pub async fn create_program( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result, tonic::Status> + { + self.inner.ready().await.map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static("/network.ProverNetwork/CreateProgram"); + let mut req = request.into_request(); + req.extensions_mut().insert(GrpcMethod::new("network.ProverNetwork", "CreateProgram")); + self.inner.unary(req, path, codec).await + } + /// Set the name of the program. Only callable by the owner. + pub async fn set_program_name( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result, tonic::Status> + { + self.inner.ready().await.map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = + http::uri::PathAndQuery::from_static("/network.ProverNetwork/SetProgramName"); + let mut req = request.into_request(); + req.extensions_mut().insert(GrpcMethod::new("network.ProverNetwork", "SetProgramName")); + self.inner.unary(req, path, codec).await + } + /// Get the available balance of an account. + pub async fn get_balance( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result, tonic::Status> + { + self.inner.ready().await.map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static("/network.ProverNetwork/GetBalance"); + let mut req = request.into_request(); + req.extensions_mut().insert(GrpcMethod::new("network.ProverNetwork", "GetBalance")); + self.inner.unary(req, path, codec).await + } + /// Get the balance logs that meet the filter criteria. + pub async fn get_filtered_balance_logs( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner.ready().await.map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/network.ProverNetwork/GetFilteredBalanceLogs", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert(GrpcMethod::new("network.ProverNetwork", "GetFilteredBalanceLogs")); + self.inner.unary(req, path, codec).await + } + /// Add credit to an account. + pub async fn add_credit( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result, tonic::Status> { + self.inner.ready().await.map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static("/network.ProverNetwork/AddCredit"); + let mut req = request.into_request(); + req.extensions_mut().insert(GrpcMethod::new("network.ProverNetwork", "AddCredit")); + self.inner.unary(req, path, codec).await + } + /// Get the latest processed block in the bridge. + pub async fn get_latest_bridge_block( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result, tonic::Status> + { + self.inner.ready().await.map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = + http::uri::PathAndQuery::from_static("/network.ProverNetwork/GetLatestBridgeBlock"); + let mut req = request.into_request(); + req.extensions_mut() + .insert(GrpcMethod::new("network.ProverNetwork", "GetLatestBridgeBlock")); + self.inner.unary(req, path, codec).await + } + /// Get the gas price estimate for a given fulfillment strategy. + pub async fn get_gas_price_estimate( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result, tonic::Status> + { + self.inner.ready().await.map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = + http::uri::PathAndQuery::from_static("/network.ProverNetwork/GetGasPriceEstimate"); + let mut req = request.into_request(); + req.extensions_mut() + .insert(GrpcMethod::new("network.ProverNetwork", "GetGasPriceEstimate")); + self.inner.unary(req, path, codec).await + } + /// Get the details of a transaction. + pub async fn get_transaction_details( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result, tonic::Status> + { + self.inner.ready().await.map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/network.ProverNetwork/GetTransactionDetails", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert(GrpcMethod::new("network.ProverNetwork", "GetTransactionDetails")); + self.inner.unary(req, path, codec).await + } + /// Get the reservations that meet the filter criteria. + pub async fn get_filtered_reservations( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner.ready().await.map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/network.ProverNetwork/GetFilteredReservations", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert(GrpcMethod::new("network.ProverNetwork", "GetFilteredReservations")); + self.inner.unary(req, path, codec).await + } + /// Add a reservation for a requester. + pub async fn add_reservation( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result, tonic::Status> + { + self.inner.ready().await.map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = + http::uri::PathAndQuery::from_static("/network.ProverNetwork/AddReservation"); + let mut req = request.into_request(); + req.extensions_mut().insert(GrpcMethod::new("network.ProverNetwork", "AddReservation")); + self.inner.unary(req, path, codec).await + } + /// Remove a reservation for a requester. + pub async fn remove_reservation( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result, tonic::Status> + { + self.inner.ready().await.map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = + http::uri::PathAndQuery::from_static("/network.ProverNetwork/RemoveReservation"); + let mut req = request.into_request(); + req.extensions_mut() + .insert(GrpcMethod::new("network.ProverNetwork", "RemoveReservation")); + self.inner.unary(req, path, codec).await + } + /// Bid for a proof request. Provers that want to be assigned this request must first + /// bid on it. + pub async fn bid( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result, tonic::Status> { + self.inner.ready().await.map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static("/network.ProverNetwork/Bid"); + let mut req = request.into_request(); + req.extensions_mut().insert(GrpcMethod::new("network.ProverNetwork", "Bid")); + self.inner.unary(req, path, codec).await + } + /// Settle the bids on a proof request to choose the assigned prover. Only callable by + /// the approved settler. + pub async fn settle( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result, tonic::Status> { + self.inner.ready().await.map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static("/network.ProverNetwork/Settle"); + let mut req = request.into_request(); + req.extensions_mut().insert(GrpcMethod::new("network.ProverNetwork", "Settle")); + self.inner.unary(req, path, codec).await + } + } +} +/// Generated server implementations. +pub mod prover_network_server { + #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)] + use tonic::codegen::*; + /// Generated trait containing gRPC methods that should be implemented for use with ProverNetworkServer. + #[async_trait] + pub trait ProverNetwork: std::marker::Send + std::marker::Sync + 'static { + /// Creates a proof request. + async fn request_proof( + &self, + request: tonic::Request, + ) -> std::result::Result, tonic::Status>; + /// Fulfills a proof request. Only callable by the assigned fulfiller. + async fn fulfill_proof( + &self, + request: tonic::Request, + ) -> std::result::Result, tonic::Status>; + /// Executes a proof request. Only callable by the execution oracle. + async fn execute_proof( + &self, + request: tonic::Request, + ) -> std::result::Result, tonic::Status>; + /// Fails fulfillment. Only callable by the assigned fulfiller. + async fn fail_fulfillment( + &self, + request: tonic::Request, + ) -> std::result::Result, tonic::Status>; + /// Fails execution. Only callable by the execution oracle. + async fn fail_execution( + &self, + request: tonic::Request, + ) -> std::result::Result, tonic::Status>; + /// Get the status of a proof request. + async fn get_proof_request_status( + &self, + request: tonic::Request, + ) -> std::result::Result, tonic::Status>; + /// Get the details of a proof request. + async fn get_proof_request_details( + &self, + request: tonic::Request, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; + /// Get the proof requests that meet the filter criteria. + async fn get_filtered_proof_requests( + &self, + request: tonic::Request, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; + /// Search for proof requests, programs, and requesters. + async fn get_search_results( + &self, + request: tonic::Request, + ) -> std::result::Result, tonic::Status>; + /// Get metrics for proof requests. + async fn get_proof_request_metrics( + &self, + request: tonic::Request, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; + /// Get time series data for proof requests. + async fn get_proof_request_graph( + &self, + request: tonic::Request, + ) -> std::result::Result, tonic::Status>; + /// Get analytics graphs for proof requests. + async fn get_analytics_graphs( + &self, + request: tonic::Request, + ) -> std::result::Result, tonic::Status>; + /// Get the nonce of the account. + async fn get_nonce( + &self, + request: tonic::Request, + ) -> std::result::Result, tonic::Status>; + /// Get the delegations of the account. + async fn get_filtered_delegations( + &self, + request: tonic::Request, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; + /// Add a delegation. Only callable by the owner of an account. + async fn add_delegation( + &self, + request: tonic::Request, + ) -> std::result::Result, tonic::Status>; + /// // Remove a delegation. Only callable by the owner of an account. + async fn remove_delegation( + &self, + request: tonic::Request, + ) -> std::result::Result, tonic::Status>; + /// Accept a delegation. Only callable by the delegate of a delegation. + async fn accept_delegation( + &self, + request: tonic::Request, + ) -> std::result::Result, tonic::Status>; + /// Set the name of the account. Only callable by the owner of an account. + async fn set_account_name( + &self, + request: tonic::Request, + ) -> std::result::Result, tonic::Status>; + /// Get the name of the account. + async fn get_account_name( + &self, + request: tonic::Request, + ) -> std::result::Result, tonic::Status>; + /// Get metadata about a program. + async fn get_program( + &self, + request: tonic::Request, + ) -> std::result::Result, tonic::Status>; + /// Create a new program. Must be called before requesting proofs. + async fn create_program( + &self, + request: tonic::Request, + ) -> std::result::Result, tonic::Status>; + /// Set the name of the program. Only callable by the owner. + async fn set_program_name( + &self, + request: tonic::Request, + ) -> std::result::Result, tonic::Status>; + /// Get the available balance of an account. + async fn get_balance( + &self, + request: tonic::Request, + ) -> std::result::Result, tonic::Status>; + /// Get the balance logs that meet the filter criteria. + async fn get_filtered_balance_logs( + &self, + request: tonic::Request, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; + /// Add credit to an account. + async fn add_credit( + &self, + request: tonic::Request, + ) -> std::result::Result, tonic::Status>; + /// Get the latest processed block in the bridge. + async fn get_latest_bridge_block( + &self, + request: tonic::Request, + ) -> std::result::Result, tonic::Status>; + /// Get the gas price estimate for a given fulfillment strategy. + async fn get_gas_price_estimate( + &self, + request: tonic::Request, + ) -> std::result::Result, tonic::Status>; + /// Get the details of a transaction. + async fn get_transaction_details( + &self, + request: tonic::Request, + ) -> std::result::Result, tonic::Status>; + /// Get the reservations that meet the filter criteria. + async fn get_filtered_reservations( + &self, + request: tonic::Request, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; + /// Add a reservation for a requester. + async fn add_reservation( + &self, + request: tonic::Request, + ) -> std::result::Result, tonic::Status>; + /// Remove a reservation for a requester. + async fn remove_reservation( + &self, + request: tonic::Request, + ) -> std::result::Result, tonic::Status>; + /// Bid for a proof request. Provers that want to be assigned this request must first + /// bid on it. + async fn bid( + &self, + request: tonic::Request, + ) -> std::result::Result, tonic::Status>; + /// Settle the bids on a proof request to choose the assigned prover. Only callable by + /// the approved settler. + async fn settle( + &self, + request: tonic::Request, + ) -> std::result::Result, tonic::Status>; + } + #[derive(Debug)] + pub struct ProverNetworkServer { + inner: Arc, + accept_compression_encodings: EnabledCompressionEncodings, + send_compression_encodings: EnabledCompressionEncodings, + max_decoding_message_size: Option, + max_encoding_message_size: Option, + } + impl ProverNetworkServer { + pub fn new(inner: T) -> Self { + Self::from_arc(Arc::new(inner)) + } + pub fn from_arc(inner: Arc) -> Self { + Self { + inner, + accept_compression_encodings: Default::default(), + send_compression_encodings: Default::default(), + max_decoding_message_size: None, + max_encoding_message_size: None, + } + } + pub fn with_interceptor(inner: T, interceptor: F) -> InterceptedService + where + F: tonic::service::Interceptor, + { + InterceptedService::new(Self::new(inner), interceptor) + } + /// Enable decompressing requests with the given encoding. + #[must_use] + pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self { + self.accept_compression_encodings.enable(encoding); + self + } + /// Compress responses with the given encoding, if the client supports it. + #[must_use] + pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self { + self.send_compression_encodings.enable(encoding); + self + } + /// Limits the maximum size of a decoded message. + /// + /// Default: `4MB` + #[must_use] + pub fn max_decoding_message_size(mut self, limit: usize) -> Self { + self.max_decoding_message_size = Some(limit); + self + } + /// Limits the maximum size of an encoded message. + /// + /// Default: `usize::MAX` + #[must_use] + pub fn max_encoding_message_size(mut self, limit: usize) -> Self { + self.max_encoding_message_size = Some(limit); + self + } + } + impl tonic::codegen::Service> for ProverNetworkServer + where + T: ProverNetwork, + B: Body + std::marker::Send + 'static, + B::Error: Into + std::marker::Send + 'static, + { + type Response = http::Response; + type Error = std::convert::Infallible; + type Future = BoxFuture; + fn poll_ready( + &mut self, + _cx: &mut Context<'_>, + ) -> Poll> { + Poll::Ready(Ok(())) + } + fn call(&mut self, req: http::Request) -> Self::Future { + match req.uri().path() { + "/network.ProverNetwork/RequestProof" => { + #[allow(non_camel_case_types)] + struct RequestProofSvc(pub Arc); + impl tonic::server::UnaryService + for RequestProofSvc + { + type Response = super::RequestProofResponse; + type Future = BoxFuture, tonic::Status>; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { + let inner = Arc::clone(&self.0); + let fut = async move { + ::request_proof(&inner, request).await + }; + Box::pin(fut) + } + } + let accept_compression_encodings = self.accept_compression_encodings; + let send_compression_encodings = self.send_compression_encodings; + let max_decoding_message_size = self.max_decoding_message_size; + let max_encoding_message_size = self.max_encoding_message_size; + let inner = self.inner.clone(); + let fut = async move { + let method = RequestProofSvc(inner); + let codec = tonic::codec::ProstCodec::default(); + let mut grpc = tonic::server::Grpc::new(codec) + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); + let res = grpc.unary(method, req).await; + Ok(res) + }; + Box::pin(fut) + } + "/network.ProverNetwork/FulfillProof" => { + #[allow(non_camel_case_types)] + struct FulfillProofSvc(pub Arc); + impl tonic::server::UnaryService + for FulfillProofSvc + { + type Response = super::FulfillProofResponse; + type Future = BoxFuture, tonic::Status>; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { + let inner = Arc::clone(&self.0); + let fut = async move { + ::fulfill_proof(&inner, request).await + }; + Box::pin(fut) + } + } + let accept_compression_encodings = self.accept_compression_encodings; + let send_compression_encodings = self.send_compression_encodings; + let max_decoding_message_size = self.max_decoding_message_size; + let max_encoding_message_size = self.max_encoding_message_size; + let inner = self.inner.clone(); + let fut = async move { + let method = FulfillProofSvc(inner); + let codec = tonic::codec::ProstCodec::default(); + let mut grpc = tonic::server::Grpc::new(codec) + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); + let res = grpc.unary(method, req).await; + Ok(res) + }; + Box::pin(fut) + } + "/network.ProverNetwork/ExecuteProof" => { + #[allow(non_camel_case_types)] + struct ExecuteProofSvc(pub Arc); + impl tonic::server::UnaryService + for ExecuteProofSvc + { + type Response = super::ExecuteProofResponse; + type Future = BoxFuture, tonic::Status>; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { + let inner = Arc::clone(&self.0); + let fut = async move { + ::execute_proof(&inner, request).await + }; + Box::pin(fut) + } + } + let accept_compression_encodings = self.accept_compression_encodings; + let send_compression_encodings = self.send_compression_encodings; + let max_decoding_message_size = self.max_decoding_message_size; + let max_encoding_message_size = self.max_encoding_message_size; + let inner = self.inner.clone(); + let fut = async move { + let method = ExecuteProofSvc(inner); + let codec = tonic::codec::ProstCodec::default(); + let mut grpc = tonic::server::Grpc::new(codec) + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); + let res = grpc.unary(method, req).await; + Ok(res) + }; + Box::pin(fut) + } + "/network.ProverNetwork/FailFulfillment" => { + #[allow(non_camel_case_types)] + struct FailFulfillmentSvc(pub Arc); + impl + tonic::server::UnaryService + for FailFulfillmentSvc + { + type Response = super::FailFulfillmentResponse; + type Future = BoxFuture, tonic::Status>; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { + let inner = Arc::clone(&self.0); + let fut = async move { + ::fail_fulfillment(&inner, request).await + }; + Box::pin(fut) + } + } + let accept_compression_encodings = self.accept_compression_encodings; + let send_compression_encodings = self.send_compression_encodings; + let max_decoding_message_size = self.max_decoding_message_size; + let max_encoding_message_size = self.max_encoding_message_size; + let inner = self.inner.clone(); + let fut = async move { + let method = FailFulfillmentSvc(inner); + let codec = tonic::codec::ProstCodec::default(); + let mut grpc = tonic::server::Grpc::new(codec) + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); + let res = grpc.unary(method, req).await; + Ok(res) + }; + Box::pin(fut) + } + "/network.ProverNetwork/FailExecution" => { + #[allow(non_camel_case_types)] + struct FailExecutionSvc(pub Arc); + impl tonic::server::UnaryService + for FailExecutionSvc + { + type Response = super::FailExecutionResponse; + type Future = BoxFuture, tonic::Status>; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { + let inner = Arc::clone(&self.0); + let fut = async move { + ::fail_execution(&inner, request).await + }; + Box::pin(fut) + } + } + let accept_compression_encodings = self.accept_compression_encodings; + let send_compression_encodings = self.send_compression_encodings; + let max_decoding_message_size = self.max_decoding_message_size; + let max_encoding_message_size = self.max_encoding_message_size; + let inner = self.inner.clone(); + let fut = async move { + let method = FailExecutionSvc(inner); + let codec = tonic::codec::ProstCodec::default(); + let mut grpc = tonic::server::Grpc::new(codec) + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); + let res = grpc.unary(method, req).await; + Ok(res) + }; + Box::pin(fut) + } + "/network.ProverNetwork/GetProofRequestStatus" => { + #[allow(non_camel_case_types)] + struct GetProofRequestStatusSvc(pub Arc); + impl + tonic::server::UnaryService + for GetProofRequestStatusSvc + { + type Response = super::GetProofRequestStatusResponse; + type Future = BoxFuture, tonic::Status>; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { + let inner = Arc::clone(&self.0); + let fut = async move { + ::get_proof_request_status(&inner, request) + .await + }; + Box::pin(fut) + } + } + let accept_compression_encodings = self.accept_compression_encodings; + let send_compression_encodings = self.send_compression_encodings; + let max_decoding_message_size = self.max_decoding_message_size; + let max_encoding_message_size = self.max_encoding_message_size; + let inner = self.inner.clone(); + let fut = async move { + let method = GetProofRequestStatusSvc(inner); + let codec = tonic::codec::ProstCodec::default(); + let mut grpc = tonic::server::Grpc::new(codec) + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); + let res = grpc.unary(method, req).await; + Ok(res) + }; + Box::pin(fut) + } + "/network.ProverNetwork/GetProofRequestDetails" => { + #[allow(non_camel_case_types)] + struct GetProofRequestDetailsSvc(pub Arc); + impl + tonic::server::UnaryService + for GetProofRequestDetailsSvc + { + type Response = super::GetProofRequestDetailsResponse; + type Future = BoxFuture, tonic::Status>; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { + let inner = Arc::clone(&self.0); + let fut = async move { + ::get_proof_request_details(&inner, request) + .await + }; + Box::pin(fut) + } + } + let accept_compression_encodings = self.accept_compression_encodings; + let send_compression_encodings = self.send_compression_encodings; + let max_decoding_message_size = self.max_decoding_message_size; + let max_encoding_message_size = self.max_encoding_message_size; + let inner = self.inner.clone(); + let fut = async move { + let method = GetProofRequestDetailsSvc(inner); + let codec = tonic::codec::ProstCodec::default(); + let mut grpc = tonic::server::Grpc::new(codec) + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); + let res = grpc.unary(method, req).await; + Ok(res) + }; + Box::pin(fut) + } + "/network.ProverNetwork/GetFilteredProofRequests" => { + #[allow(non_camel_case_types)] + struct GetFilteredProofRequestsSvc(pub Arc); + impl + tonic::server::UnaryService + for GetFilteredProofRequestsSvc + { + type Response = super::GetFilteredProofRequestsResponse; + type Future = BoxFuture, tonic::Status>; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { + let inner = Arc::clone(&self.0); + let fut = async move { + ::get_filtered_proof_requests(&inner, request) + .await + }; + Box::pin(fut) + } + } + let accept_compression_encodings = self.accept_compression_encodings; + let send_compression_encodings = self.send_compression_encodings; + let max_decoding_message_size = self.max_decoding_message_size; + let max_encoding_message_size = self.max_encoding_message_size; + let inner = self.inner.clone(); + let fut = async move { + let method = GetFilteredProofRequestsSvc(inner); + let codec = tonic::codec::ProstCodec::default(); + let mut grpc = tonic::server::Grpc::new(codec) + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); + let res = grpc.unary(method, req).await; + Ok(res) + }; + Box::pin(fut) + } + "/network.ProverNetwork/GetSearchResults" => { + #[allow(non_camel_case_types)] + struct GetSearchResultsSvc(pub Arc); + impl + tonic::server::UnaryService + for GetSearchResultsSvc + { + type Response = super::GetSearchResultsResponse; + type Future = BoxFuture, tonic::Status>; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { + let inner = Arc::clone(&self.0); + let fut = async move { + ::get_search_results(&inner, request).await + }; + Box::pin(fut) + } + } + let accept_compression_encodings = self.accept_compression_encodings; + let send_compression_encodings = self.send_compression_encodings; + let max_decoding_message_size = self.max_decoding_message_size; + let max_encoding_message_size = self.max_encoding_message_size; + let inner = self.inner.clone(); + let fut = async move { + let method = GetSearchResultsSvc(inner); + let codec = tonic::codec::ProstCodec::default(); + let mut grpc = tonic::server::Grpc::new(codec) + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); + let res = grpc.unary(method, req).await; + Ok(res) + }; + Box::pin(fut) + } + "/network.ProverNetwork/GetProofRequestMetrics" => { + #[allow(non_camel_case_types)] + struct GetProofRequestMetricsSvc(pub Arc); + impl + tonic::server::UnaryService + for GetProofRequestMetricsSvc + { + type Response = super::GetProofRequestMetricsResponse; + type Future = BoxFuture, tonic::Status>; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { + let inner = Arc::clone(&self.0); + let fut = async move { + ::get_proof_request_metrics(&inner, request) + .await + }; + Box::pin(fut) + } + } + let accept_compression_encodings = self.accept_compression_encodings; + let send_compression_encodings = self.send_compression_encodings; + let max_decoding_message_size = self.max_decoding_message_size; + let max_encoding_message_size = self.max_encoding_message_size; + let inner = self.inner.clone(); + let fut = async move { + let method = GetProofRequestMetricsSvc(inner); + let codec = tonic::codec::ProstCodec::default(); + let mut grpc = tonic::server::Grpc::new(codec) + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); + let res = grpc.unary(method, req).await; + Ok(res) + }; + Box::pin(fut) + } + "/network.ProverNetwork/GetProofRequestGraph" => { + #[allow(non_camel_case_types)] + struct GetProofRequestGraphSvc(pub Arc); + impl + tonic::server::UnaryService + for GetProofRequestGraphSvc + { + type Response = super::GetProofRequestGraphResponse; + type Future = BoxFuture, tonic::Status>; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { + let inner = Arc::clone(&self.0); + let fut = async move { + ::get_proof_request_graph(&inner, request).await + }; + Box::pin(fut) + } + } + let accept_compression_encodings = self.accept_compression_encodings; + let send_compression_encodings = self.send_compression_encodings; + let max_decoding_message_size = self.max_decoding_message_size; + let max_encoding_message_size = self.max_encoding_message_size; + let inner = self.inner.clone(); + let fut = async move { + let method = GetProofRequestGraphSvc(inner); + let codec = tonic::codec::ProstCodec::default(); + let mut grpc = tonic::server::Grpc::new(codec) + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); + let res = grpc.unary(method, req).await; + Ok(res) + }; + Box::pin(fut) + } + "/network.ProverNetwork/GetAnalyticsGraphs" => { + #[allow(non_camel_case_types)] + struct GetAnalyticsGraphsSvc(pub Arc); + impl + tonic::server::UnaryService + for GetAnalyticsGraphsSvc + { + type Response = super::GetAnalyticsGraphsResponse; + type Future = BoxFuture, tonic::Status>; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { + let inner = Arc::clone(&self.0); + let fut = async move { + ::get_analytics_graphs(&inner, request).await + }; + Box::pin(fut) + } + } + let accept_compression_encodings = self.accept_compression_encodings; + let send_compression_encodings = self.send_compression_encodings; + let max_decoding_message_size = self.max_decoding_message_size; + let max_encoding_message_size = self.max_encoding_message_size; + let inner = self.inner.clone(); + let fut = async move { + let method = GetAnalyticsGraphsSvc(inner); + let codec = tonic::codec::ProstCodec::default(); + let mut grpc = tonic::server::Grpc::new(codec) + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); + let res = grpc.unary(method, req).await; + Ok(res) + }; + Box::pin(fut) + } + "/network.ProverNetwork/GetNonce" => { + #[allow(non_camel_case_types)] + struct GetNonceSvc(pub Arc); + impl tonic::server::UnaryService for GetNonceSvc { + type Response = super::GetNonceResponse; + type Future = BoxFuture, tonic::Status>; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { + let inner = Arc::clone(&self.0); + let fut = async move { + ::get_nonce(&inner, request).await + }; + Box::pin(fut) + } + } + let accept_compression_encodings = self.accept_compression_encodings; + let send_compression_encodings = self.send_compression_encodings; + let max_decoding_message_size = self.max_decoding_message_size; + let max_encoding_message_size = self.max_encoding_message_size; + let inner = self.inner.clone(); + let fut = async move { + let method = GetNonceSvc(inner); + let codec = tonic::codec::ProstCodec::default(); + let mut grpc = tonic::server::Grpc::new(codec) + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); + let res = grpc.unary(method, req).await; + Ok(res) + }; + Box::pin(fut) + } + "/network.ProverNetwork/GetFilteredDelegations" => { + #[allow(non_camel_case_types)] + struct GetFilteredDelegationsSvc(pub Arc); + impl + tonic::server::UnaryService + for GetFilteredDelegationsSvc + { + type Response = super::GetFilteredDelegationsResponse; + type Future = BoxFuture, tonic::Status>; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { + let inner = Arc::clone(&self.0); + let fut = async move { + ::get_filtered_delegations(&inner, request) + .await + }; + Box::pin(fut) + } + } + let accept_compression_encodings = self.accept_compression_encodings; + let send_compression_encodings = self.send_compression_encodings; + let max_decoding_message_size = self.max_decoding_message_size; + let max_encoding_message_size = self.max_encoding_message_size; + let inner = self.inner.clone(); + let fut = async move { + let method = GetFilteredDelegationsSvc(inner); + let codec = tonic::codec::ProstCodec::default(); + let mut grpc = tonic::server::Grpc::new(codec) + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); + let res = grpc.unary(method, req).await; + Ok(res) + }; + Box::pin(fut) + } + "/network.ProverNetwork/AddDelegation" => { + #[allow(non_camel_case_types)] + struct AddDelegationSvc(pub Arc); + impl tonic::server::UnaryService + for AddDelegationSvc + { + type Response = super::AddDelegationResponse; + type Future = BoxFuture, tonic::Status>; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { + let inner = Arc::clone(&self.0); + let fut = async move { + ::add_delegation(&inner, request).await + }; + Box::pin(fut) + } + } + let accept_compression_encodings = self.accept_compression_encodings; + let send_compression_encodings = self.send_compression_encodings; + let max_decoding_message_size = self.max_decoding_message_size; + let max_encoding_message_size = self.max_encoding_message_size; + let inner = self.inner.clone(); + let fut = async move { + let method = AddDelegationSvc(inner); + let codec = tonic::codec::ProstCodec::default(); + let mut grpc = tonic::server::Grpc::new(codec) + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); + let res = grpc.unary(method, req).await; + Ok(res) + }; + Box::pin(fut) + } + "/network.ProverNetwork/RemoveDelegation" => { + #[allow(non_camel_case_types)] + struct RemoveDelegationSvc(pub Arc); + impl + tonic::server::UnaryService + for RemoveDelegationSvc + { + type Response = super::RemoveDelegationResponse; + type Future = BoxFuture, tonic::Status>; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { + let inner = Arc::clone(&self.0); + let fut = async move { + ::remove_delegation(&inner, request).await + }; + Box::pin(fut) + } + } + let accept_compression_encodings = self.accept_compression_encodings; + let send_compression_encodings = self.send_compression_encodings; + let max_decoding_message_size = self.max_decoding_message_size; + let max_encoding_message_size = self.max_encoding_message_size; + let inner = self.inner.clone(); + let fut = async move { + let method = RemoveDelegationSvc(inner); + let codec = tonic::codec::ProstCodec::default(); + let mut grpc = tonic::server::Grpc::new(codec) + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); + let res = grpc.unary(method, req).await; + Ok(res) + }; + Box::pin(fut) + } + "/network.ProverNetwork/AcceptDelegation" => { + #[allow(non_camel_case_types)] + struct AcceptDelegationSvc(pub Arc); + impl + tonic::server::UnaryService + for AcceptDelegationSvc + { + type Response = super::AcceptDelegationResponse; + type Future = BoxFuture, tonic::Status>; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { + let inner = Arc::clone(&self.0); + let fut = async move { + ::accept_delegation(&inner, request).await + }; + Box::pin(fut) + } + } + let accept_compression_encodings = self.accept_compression_encodings; + let send_compression_encodings = self.send_compression_encodings; + let max_decoding_message_size = self.max_decoding_message_size; + let max_encoding_message_size = self.max_encoding_message_size; + let inner = self.inner.clone(); + let fut = async move { + let method = AcceptDelegationSvc(inner); + let codec = tonic::codec::ProstCodec::default(); + let mut grpc = tonic::server::Grpc::new(codec) + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); + let res = grpc.unary(method, req).await; + Ok(res) + }; + Box::pin(fut) + } + "/network.ProverNetwork/SetAccountName" => { + #[allow(non_camel_case_types)] + struct SetAccountNameSvc(pub Arc); + impl tonic::server::UnaryService + for SetAccountNameSvc + { + type Response = super::SetAccountNameResponse; + type Future = BoxFuture, tonic::Status>; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { + let inner = Arc::clone(&self.0); + let fut = async move { + ::set_account_name(&inner, request).await + }; + Box::pin(fut) + } + } + let accept_compression_encodings = self.accept_compression_encodings; + let send_compression_encodings = self.send_compression_encodings; + let max_decoding_message_size = self.max_decoding_message_size; + let max_encoding_message_size = self.max_encoding_message_size; + let inner = self.inner.clone(); + let fut = async move { + let method = SetAccountNameSvc(inner); + let codec = tonic::codec::ProstCodec::default(); + let mut grpc = tonic::server::Grpc::new(codec) + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); + let res = grpc.unary(method, req).await; + Ok(res) + }; + Box::pin(fut) + } + "/network.ProverNetwork/GetAccountName" => { + #[allow(non_camel_case_types)] + struct GetAccountNameSvc(pub Arc); + impl tonic::server::UnaryService + for GetAccountNameSvc + { + type Response = super::GetAccountNameResponse; + type Future = BoxFuture, tonic::Status>; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { + let inner = Arc::clone(&self.0); + let fut = async move { + ::get_account_name(&inner, request).await + }; + Box::pin(fut) + } + } + let accept_compression_encodings = self.accept_compression_encodings; + let send_compression_encodings = self.send_compression_encodings; + let max_decoding_message_size = self.max_decoding_message_size; + let max_encoding_message_size = self.max_encoding_message_size; + let inner = self.inner.clone(); + let fut = async move { + let method = GetAccountNameSvc(inner); + let codec = tonic::codec::ProstCodec::default(); + let mut grpc = tonic::server::Grpc::new(codec) + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); + let res = grpc.unary(method, req).await; + Ok(res) + }; + Box::pin(fut) + } + "/network.ProverNetwork/GetProgram" => { #[allow(non_camel_case_types)] - struct RequestProofSvc(pub Arc); - impl tonic::server::UnaryService - for RequestProofSvc - { - type Response = super::RequestProofResponse; + struct GetProgramSvc(pub Arc); + impl tonic::server::UnaryService for GetProgramSvc { + type Response = super::GetProgramResponse; type Future = BoxFuture, tonic::Status>; fn call( &mut self, - request: tonic::Request, + request: tonic::Request, ) -> Self::Future { let inner = Arc::clone(&self.0); let fut = async move { - ::request_proof(&inner, request).await + ::get_program(&inner, request).await }; Box::pin(fut) } @@ -866,7 +3083,7 @@ pub mod prover_network_server { let max_encoding_message_size = self.max_encoding_message_size; let inner = self.inner.clone(); let fut = async move { - let method = RequestProofSvc(inner); + let method = GetProgramSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) .apply_compression_config( @@ -882,21 +3099,21 @@ pub mod prover_network_server { }; Box::pin(fut) } - "/network.ProverNetwork/FulfillProof" => { + "/network.ProverNetwork/CreateProgram" => { #[allow(non_camel_case_types)] - struct FulfillProofSvc(pub Arc); - impl tonic::server::UnaryService - for FulfillProofSvc + struct CreateProgramSvc(pub Arc); + impl tonic::server::UnaryService + for CreateProgramSvc { - type Response = super::FulfillProofResponse; + type Response = super::CreateProgramResponse; type Future = BoxFuture, tonic::Status>; fn call( &mut self, - request: tonic::Request, + request: tonic::Request, ) -> Self::Future { let inner = Arc::clone(&self.0); let fut = async move { - ::fulfill_proof(&inner, request).await + ::create_program(&inner, request).await }; Box::pin(fut) } @@ -907,7 +3124,7 @@ pub mod prover_network_server { let max_encoding_message_size = self.max_encoding_message_size; let inner = self.inner.clone(); let fut = async move { - let method = FulfillProofSvc(inner); + let method = CreateProgramSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) .apply_compression_config( @@ -923,21 +3140,21 @@ pub mod prover_network_server { }; Box::pin(fut) } - "/network.ProverNetwork/ExecuteProof" => { + "/network.ProverNetwork/SetProgramName" => { #[allow(non_camel_case_types)] - struct ExecuteProofSvc(pub Arc); - impl tonic::server::UnaryService - for ExecuteProofSvc + struct SetProgramNameSvc(pub Arc); + impl tonic::server::UnaryService + for SetProgramNameSvc { - type Response = super::ExecuteProofResponse; + type Response = super::SetProgramNameResponse; type Future = BoxFuture, tonic::Status>; fn call( &mut self, - request: tonic::Request, + request: tonic::Request, ) -> Self::Future { let inner = Arc::clone(&self.0); let fut = async move { - ::execute_proof(&inner, request).await + ::set_program_name(&inner, request).await }; Box::pin(fut) } @@ -948,7 +3165,7 @@ pub mod prover_network_server { let max_encoding_message_size = self.max_encoding_message_size; let inner = self.inner.clone(); let fut = async move { - let method = ExecuteProofSvc(inner); + let method = SetProgramNameSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) .apply_compression_config( @@ -964,23 +3181,19 @@ pub mod prover_network_server { }; Box::pin(fut) } - "/network.ProverNetwork/GetFilteredProofRequests" => { + "/network.ProverNetwork/GetBalance" => { #[allow(non_camel_case_types)] - struct GetFilteredProofRequestsSvc(pub Arc); - impl - tonic::server::UnaryService - for GetFilteredProofRequestsSvc - { - type Response = super::GetFilteredProofRequestsResponse; + struct GetBalanceSvc(pub Arc); + impl tonic::server::UnaryService for GetBalanceSvc { + type Response = super::GetBalanceResponse; type Future = BoxFuture, tonic::Status>; fn call( &mut self, - request: tonic::Request, + request: tonic::Request, ) -> Self::Future { let inner = Arc::clone(&self.0); let fut = async move { - ::get_filtered_proof_requests(&inner, request) - .await + ::get_balance(&inner, request).await }; Box::pin(fut) } @@ -991,7 +3204,7 @@ pub mod prover_network_server { let max_encoding_message_size = self.max_encoding_message_size; let inner = self.inner.clone(); let fut = async move { - let method = GetFilteredProofRequestsSvc(inner); + let method = GetBalanceSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) .apply_compression_config( @@ -1007,22 +3220,22 @@ pub mod prover_network_server { }; Box::pin(fut) } - "/network.ProverNetwork/GetProofRequestStatus" => { + "/network.ProverNetwork/GetFilteredBalanceLogs" => { #[allow(non_camel_case_types)] - struct GetProofRequestStatusSvc(pub Arc); + struct GetFilteredBalanceLogsSvc(pub Arc); impl - tonic::server::UnaryService - for GetProofRequestStatusSvc + tonic::server::UnaryService + for GetFilteredBalanceLogsSvc { - type Response = super::GetProofRequestStatusResponse; + type Response = super::GetFilteredBalanceLogsResponse; type Future = BoxFuture, tonic::Status>; fn call( &mut self, - request: tonic::Request, + request: tonic::Request, ) -> Self::Future { let inner = Arc::clone(&self.0); let fut = async move { - ::get_proof_request_status(&inner, request) + ::get_filtered_balance_logs(&inner, request) .await }; Box::pin(fut) @@ -1034,7 +3247,46 @@ pub mod prover_network_server { let max_encoding_message_size = self.max_encoding_message_size; let inner = self.inner.clone(); let fut = async move { - let method = GetProofRequestStatusSvc(inner); + let method = GetFilteredBalanceLogsSvc(inner); + let codec = tonic::codec::ProstCodec::default(); + let mut grpc = tonic::server::Grpc::new(codec) + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); + let res = grpc.unary(method, req).await; + Ok(res) + }; + Box::pin(fut) + } + "/network.ProverNetwork/AddCredit" => { + #[allow(non_camel_case_types)] + struct AddCreditSvc(pub Arc); + impl tonic::server::UnaryService for AddCreditSvc { + type Response = super::AddCreditResponse; + type Future = BoxFuture, tonic::Status>; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { + let inner = Arc::clone(&self.0); + let fut = async move { + ::add_credit(&inner, request).await + }; + Box::pin(fut) + } + } + let accept_compression_encodings = self.accept_compression_encodings; + let send_compression_encodings = self.send_compression_encodings; + let max_decoding_message_size = self.max_decoding_message_size; + let max_encoding_message_size = self.max_encoding_message_size; + let inner = self.inner.clone(); + let fut = async move { + let method = AddCreditSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) .apply_compression_config( @@ -1092,19 +3344,22 @@ pub mod prover_network_server { }; Box::pin(fut) } - "/network.ProverNetwork/GetBalance" => { + "/network.ProverNetwork/GetGasPriceEstimate" => { #[allow(non_camel_case_types)] - struct GetBalanceSvc(pub Arc); - impl tonic::server::UnaryService for GetBalanceSvc { - type Response = super::GetBalanceResponse; + struct GetGasPriceEstimateSvc(pub Arc); + impl + tonic::server::UnaryService + for GetGasPriceEstimateSvc + { + type Response = super::GetGasPriceEstimateResponse; type Future = BoxFuture, tonic::Status>; fn call( &mut self, - request: tonic::Request, + request: tonic::Request, ) -> Self::Future { let inner = Arc::clone(&self.0); let fut = async move { - ::get_balance(&inner, request).await + ::get_gas_price_estimate(&inner, request).await }; Box::pin(fut) } @@ -1115,7 +3370,7 @@ pub mod prover_network_server { let max_encoding_message_size = self.max_encoding_message_size; let inner = self.inner.clone(); let fut = async move { - let method = GetBalanceSvc(inner); + let method = GetGasPriceEstimateSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) .apply_compression_config( @@ -1131,19 +3386,22 @@ pub mod prover_network_server { }; Box::pin(fut) } - "/network.ProverNetwork/AddCredit" => { + "/network.ProverNetwork/GetTransactionDetails" => { #[allow(non_camel_case_types)] - struct AddCreditSvc(pub Arc); - impl tonic::server::UnaryService for AddCreditSvc { - type Response = super::AddCreditResponse; + struct GetTransactionDetailsSvc(pub Arc); + impl + tonic::server::UnaryService + for GetTransactionDetailsSvc + { + type Response = super::GetTransactionDetailsResponse; type Future = BoxFuture, tonic::Status>; fn call( &mut self, - request: tonic::Request, + request: tonic::Request, ) -> Self::Future { let inner = Arc::clone(&self.0); let fut = async move { - ::add_credit(&inner, request).await + ::get_transaction_details(&inner, request).await }; Box::pin(fut) } @@ -1154,7 +3412,7 @@ pub mod prover_network_server { let max_encoding_message_size = self.max_encoding_message_size; let inner = self.inner.clone(); let fut = async move { - let method = AddCreditSvc(inner); + let method = GetTransactionDetailsSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) .apply_compression_config( @@ -1170,19 +3428,23 @@ pub mod prover_network_server { }; Box::pin(fut) } - "/network.ProverNetwork/GetNonce" => { + "/network.ProverNetwork/GetFilteredReservations" => { #[allow(non_camel_case_types)] - struct GetNonceSvc(pub Arc); - impl tonic::server::UnaryService for GetNonceSvc { - type Response = super::GetNonceResponse; + struct GetFilteredReservationsSvc(pub Arc); + impl + tonic::server::UnaryService + for GetFilteredReservationsSvc + { + type Response = super::GetFilteredReservationsResponse; type Future = BoxFuture, tonic::Status>; fn call( &mut self, - request: tonic::Request, + request: tonic::Request, ) -> Self::Future { let inner = Arc::clone(&self.0); let fut = async move { - ::get_nonce(&inner, request).await + ::get_filtered_reservations(&inner, request) + .await }; Box::pin(fut) } @@ -1193,7 +3455,166 @@ pub mod prover_network_server { let max_encoding_message_size = self.max_encoding_message_size; let inner = self.inner.clone(); let fut = async move { - let method = GetNonceSvc(inner); + let method = GetFilteredReservationsSvc(inner); + let codec = tonic::codec::ProstCodec::default(); + let mut grpc = tonic::server::Grpc::new(codec) + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); + let res = grpc.unary(method, req).await; + Ok(res) + }; + Box::pin(fut) + } + "/network.ProverNetwork/AddReservation" => { + #[allow(non_camel_case_types)] + struct AddReservationSvc(pub Arc); + impl tonic::server::UnaryService + for AddReservationSvc + { + type Response = super::AddReservationResponse; + type Future = BoxFuture, tonic::Status>; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { + let inner = Arc::clone(&self.0); + let fut = async move { + ::add_reservation(&inner, request).await + }; + Box::pin(fut) + } + } + let accept_compression_encodings = self.accept_compression_encodings; + let send_compression_encodings = self.send_compression_encodings; + let max_decoding_message_size = self.max_decoding_message_size; + let max_encoding_message_size = self.max_encoding_message_size; + let inner = self.inner.clone(); + let fut = async move { + let method = AddReservationSvc(inner); + let codec = tonic::codec::ProstCodec::default(); + let mut grpc = tonic::server::Grpc::new(codec) + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); + let res = grpc.unary(method, req).await; + Ok(res) + }; + Box::pin(fut) + } + "/network.ProverNetwork/RemoveReservation" => { + #[allow(non_camel_case_types)] + struct RemoveReservationSvc(pub Arc); + impl + tonic::server::UnaryService + for RemoveReservationSvc + { + type Response = super::RemoveReservationResponse; + type Future = BoxFuture, tonic::Status>; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { + let inner = Arc::clone(&self.0); + let fut = async move { + ::remove_reservation(&inner, request).await + }; + Box::pin(fut) + } + } + let accept_compression_encodings = self.accept_compression_encodings; + let send_compression_encodings = self.send_compression_encodings; + let max_decoding_message_size = self.max_decoding_message_size; + let max_encoding_message_size = self.max_encoding_message_size; + let inner = self.inner.clone(); + let fut = async move { + let method = RemoveReservationSvc(inner); + let codec = tonic::codec::ProstCodec::default(); + let mut grpc = tonic::server::Grpc::new(codec) + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); + let res = grpc.unary(method, req).await; + Ok(res) + }; + Box::pin(fut) + } + "/network.ProverNetwork/Bid" => { + #[allow(non_camel_case_types)] + struct BidSvc(pub Arc); + impl tonic::server::UnaryService for BidSvc { + type Response = super::BidResponse; + type Future = BoxFuture, tonic::Status>; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { + let inner = Arc::clone(&self.0); + let fut = + async move { ::bid(&inner, request).await }; + Box::pin(fut) + } + } + let accept_compression_encodings = self.accept_compression_encodings; + let send_compression_encodings = self.send_compression_encodings; + let max_decoding_message_size = self.max_decoding_message_size; + let max_encoding_message_size = self.max_encoding_message_size; + let inner = self.inner.clone(); + let fut = async move { + let method = BidSvc(inner); + let codec = tonic::codec::ProstCodec::default(); + let mut grpc = tonic::server::Grpc::new(codec) + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); + let res = grpc.unary(method, req).await; + Ok(res) + }; + Box::pin(fut) + } + "/network.ProverNetwork/Settle" => { + #[allow(non_camel_case_types)] + struct SettleSvc(pub Arc); + impl tonic::server::UnaryService for SettleSvc { + type Response = super::SettleResponse; + type Future = BoxFuture, tonic::Status>; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { + let inner = Arc::clone(&self.0); + let fut = + async move { ::settle(&inner, request).await }; + Box::pin(fut) + } + } + let accept_compression_encodings = self.accept_compression_encodings; + let send_compression_encodings = self.send_compression_encodings; + let max_decoding_message_size = self.max_decoding_message_size; + let max_encoding_message_size = self.max_encoding_message_size; + let inner = self.inner.clone(); + let fut = async move { + let method = SettleSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) .apply_compression_config( diff --git a/crates/sdk/src/network-v2/prover.rs b/crates/sdk/src/network-v2/prover.rs index 83a86b55eb..91056adde1 100644 --- a/crates/sdk/src/network-v2/prover.rs +++ b/crates/sdk/src/network-v2/prover.rs @@ -1,13 +1,16 @@ use std::time::{Duration, Instant}; +use crate::network_v2::client::DEFAULT_PROVER_NETWORK_RPC; use crate::{ network_v2::client::NetworkClient, - network_v2::proto::network::{ProofMode, ProofStatus, ProofStrategy}, + network_v2::proto::network::{ + ExecutionStatus, FulfillmentStatus, FulfillmentStrategy, ProofMode, + }, NetworkProverBuilder, Prover, SP1Context, SP1ProofKind, SP1ProofWithPublicValues, SP1ProvingKey, SP1VerifyingKey, }; use anyhow::Result; -use backoff::{future::retry, ExponentialBackoff}; +use backoff::{future::retry, Error as BackoffError, ExponentialBackoff}; use serde::de::DeserializeOwned; use sp1_core_machine::io::SP1Stdin; use sp1_prover::{components::DefaultProverComponents, SP1Prover, SP1_CIRCUIT_VERSION}; @@ -29,6 +32,7 @@ pub struct NetworkProver { client: NetworkClient, local_prover: CpuProver, skip_simulation: bool, + strategy: FulfillmentStrategy, } impl NetworkProver { @@ -38,7 +42,12 @@ impl NetworkProver { log::info!("Client circuit version: {}", version); let local_prover = CpuProver::new(); let client = NetworkClient::new(private_key, rpc_url); - Self { client, local_prover, skip_simulation } + Self { client, local_prover, skip_simulation, strategy: FulfillmentStrategy::Hosted } + } + + /// Sets the fulfillment strategy for the client. By default, the strategy is set to `Hosted`. + pub fn with_strategy(&mut self, strategy: FulfillmentStrategy) { + self.strategy = strategy; } /// Creates a new network prover builder. See [`NetworkProverBuilder`] for more details. @@ -46,48 +55,56 @@ impl NetworkProver { NetworkProverBuilder::default() } + /// Registers a program if it is not already registered. + pub async fn register_program(&self, vk: &SP1VerifyingKey, elf: &[u8]) -> Result> { + self.client.register_program(vk, elf).await + } + + /// Get the cycle limit, either by simulating or using the default cycle limit. + fn get_cycle_limit(&self, elf: &[u8], stdin: &SP1Stdin) -> Result { + if !self.skip_simulation { + let (_, report) = + self.local_prover.sp1_prover().execute(elf, stdin, Default::default())?; + let cycles = report.total_instruction_count(); + Ok(cycles) + } else { + Ok(DEFAULT_CYCLE_LIMIT) + } + } + /// Requests a proof from the prover network, returning the request ID. pub async fn request_proof( &self, - elf: &[u8], - stdin: SP1Stdin, + vk_hash: &[u8], + stdin: &SP1Stdin, mode: ProofMode, + cycle_limit: u64, timeout: Option, ) -> Result> { - // Simulate and get the cycle limit. - let cycle_limit = if !self.skip_simulation { - let (_, report) = - self.local_prover.sp1_prover().execute(elf, &stdin, Default::default())?; - let cycles = report.total_instruction_count(); - log::info!("Simulation complete, cycles: {}", cycles); - cycles - } else { - log::info!("Skipping simulation"); - DEFAULT_CYCLE_LIMIT - }; - - // Get the verifying key. - let (_, vk) = self.setup(elf); - // Get the timeout. let timeout_secs = timeout.map(|dur| dur.as_secs()).unwrap_or(TIMEOUT_SECS); log::info!("Requesting proof with cycle limit: {}", cycle_limit); - // Request the proof. - let response = self - .client - .request_proof( - elf, - &stdin, - &vk, - mode, - SP1_CIRCUIT_VERSION, - ProofStrategy::Hosted, - timeout_secs, - cycle_limit, - ) - .await?; + // Request the proof with retries. + let response = with_retry( + || async { + self.client + .request_proof( + vk_hash, + stdin, + mode, + SP1_CIRCUIT_VERSION, + self.strategy, + timeout_secs, + cycle_limit, + ) + .await + }, + timeout, + "requesting proof", + ) + .await?; // Log the request ID and transaction hash. let tx_hash_hex = "0x".to_string() + &hex::encode(response.tx_hash); @@ -95,6 +112,10 @@ impl NetworkProver { let request_id_hex = "0x".to_string() + &hex::encode(request_id.clone()); log::info!("Created request {} in transaction {}", request_id_hex, tx_hash_hex); + if self.client.rpc_url() == DEFAULT_PROVER_NETWORK_RPC { + log::info!("View in explorer: https://network.succinct.xyz/request/{}", request_id_hex); + } + Ok(request_id) } @@ -108,80 +129,50 @@ impl NetworkProver { let mut is_assigned = false; let start_time = Instant::now(); - // Configure retries with exponential backoff. - let backoff = ExponentialBackoff { - initial_interval: Duration::from_secs(1), - max_interval: Duration::from_secs(30), - max_elapsed_time: timeout, - ..Default::default() - }; - loop { + // Calculate the remaining timeout. if let Some(timeout) = timeout { if start_time.elapsed() > timeout { return Err(anyhow::anyhow!("Proof request timed out.")); } } - - // Try to get proof status with retries. - let status_result = retry(backoff.clone(), || async { - match self.client.get_proof_request_status::

(request_id).await { - Ok(result) => Ok(result), - Err(e) => { - if let Some(status) = e.downcast_ref::() { - match status.code() { - Code::NotFound => { - log::error!("Proof request not found: {}", status.message()); - Err(backoff::Error::permanent(e)) - } - Code::Unavailable => { - log::warn!( - "Network temporarily unavailable, retrying: {}", - status.message() - ); - Err(backoff::Error::transient(e)) - } - Code::DeadlineExceeded => { - log::warn!( - "Request deadline exceeded, retrying: {}", - status.message() - ); - Err(backoff::Error::transient(e)) - } - _ => { - log::error!( - "Permanent error encountered: {} ({})", - status.message(), - status.code() - ); - Err(backoff::Error::permanent(e)) - } - } - } else { - log::error!("Unexpected error type: {}", e); - Err(backoff::Error::permanent(e)) - } - } + let remaining_timeout = timeout.map(|t| { + let elapsed = start_time.elapsed(); + if elapsed < t { + t - elapsed + } else { + Duration::from_secs(0) } - }) - .await; + }); - match status_result { - Ok((status, maybe_proof)) => match status.proof_status() { - ProofStatus::Fulfilled => { - return Ok(maybe_proof.unwrap()); - } - ProofStatus::Assigned => { - if !is_assigned { - log::info!("Proof request assigned, proving..."); - is_assigned = true; - } + // Get status with retries. + let (status, maybe_proof) = with_retry( + || async { self.client.get_proof_request_status::

(request_id).await }, + remaining_timeout, + "getting proof request status", + ) + .await?; + + // Check the execution status. + if status.execution_status == ExecutionStatus::Unexecutable as i32 { + return Err(anyhow::anyhow!("Proof request is unexecutable")); + } + + // Check the fulfillment status. + match FulfillmentStatus::try_from(status.fulfillment_status) { + Ok(FulfillmentStatus::Fulfilled) => { + return Ok(maybe_proof.unwrap()); + } + Ok(FulfillmentStatus::Assigned) => { + if !is_assigned { + log::info!("Proof request assigned, proving..."); + is_assigned = true; } - _ => {} - }, - Err(e) => { - return Err(e); } + Ok(FulfillmentStatus::Unfulfillable) => { + return Err(anyhow::anyhow!("Proof request is unfulfillable")); + } + _ => {} } sleep(Duration::from_secs(2)).await; @@ -191,12 +182,14 @@ impl NetworkProver { /// Requests a proof from the prover network and waits for it to be generated. pub async fn prove( &self, - elf: &[u8], + pk: &SP1ProvingKey, stdin: SP1Stdin, mode: ProofMode, timeout: Option, ) -> Result { - let request_id = self.request_proof(elf, stdin, mode, timeout).await?; + let vk_hash = self.register_program(&pk.vk, &pk.elf).await?; + let cycle_limit = self.get_cycle_limit(&pk.elf, &stdin)?; + let request_id = self.request_proof(&vk_hash, &stdin, mode, cycle_limit, timeout).await?; self.wait_proof(&request_id, timeout).await } } @@ -223,7 +216,7 @@ impl Prover for NetworkProver { kind: SP1ProofKind, ) -> Result { warn_if_not_default(&opts.sp1_prover_opts, &context); - block_on(self.prove(&pk.elf, stdin, kind.into(), opts.timeout)) + block_on(self.prove(pk, stdin, kind.into(), opts.timeout)) } } @@ -257,3 +250,81 @@ impl From for ProofMode { } } } + +/// Execute an async operation with exponential backoff retries. +pub async fn with_retry( + operation: F, + timeout: Option, + operation_name: &str, +) -> Result +where + F: Fn() -> Fut, + Fut: std::future::Future>, +{ + let backoff = ExponentialBackoff { + initial_interval: Duration::from_secs(1), + max_interval: Duration::from_secs(120), + max_elapsed_time: timeout, + ..Default::default() + }; + + retry(backoff, || async { + match operation().await { + Ok(result) => Ok(result), + Err(e) => { + // Check for tonic status errors. + if let Some(status) = e.downcast_ref::() { + match status.code() { + Code::Unavailable => { + log::warn!( + "Network temporarily unavailable when {} due to {}, retrying...", + operation_name, + status.message(), + ); + Err(BackoffError::transient(e)) + } + Code::NotFound => { + log::error!( + "{} not found due to {}", + operation_name, + status.message(), + ); + Err(BackoffError::permanent(e)) + } + _ => { + log::error!( + "Permanent error encountered when {}: {} ({})", + operation_name, + status.message(), + status.code() + ); + Err(BackoffError::permanent(e)) + } + } + } else { + // Check for common transport errors. + let error_msg = e.to_string().to_lowercase(); + let is_transient = error_msg.contains("tls handshake") || + error_msg.contains("dns error") || + error_msg.contains("connection reset") || + error_msg.contains("broken pipe") || + error_msg.contains("transport error") || + error_msg.contains("failed to lookup"); + + if is_transient { + log::warn!( + "Transient transport error when {}: {}, retrying...", + operation_name, + error_msg + ); + Err(BackoffError::transient(e)) + } else { + log::error!("Permanent error when {}: {}", operation_name, error_msg); + Err(BackoffError::permanent(e)) + } + } + } + } + }) + .await +}