miden_remote_prover_client/
lib.rs1#![no_std]
2#![expect(unused_imports)]
6#[macro_use]
7extern crate alloc;
8
9use alloc::boxed::Box;
10use alloc::string::{String, ToString};
11use core::error::Error as CoreError;
12
13#[cfg(feature = "std")]
14extern crate std;
15
16use thiserror::Error;
17
18mod remote_prover;
19
20#[cfg(feature = "batch-prover")]
21pub use remote_prover::batch_prover::RemoteBatchProver;
22#[cfg(feature = "block-prover")]
23pub use remote_prover::block_prover::RemoteBlockProver;
24#[cfg(feature = "tx-prover")]
25pub use remote_prover::tx_prover::RemoteTransactionProver;
26
27#[derive(Debug, Error)]
31pub enum RemoteProverClientError {
32 #[error("invalid uri {0}")]
34 InvalidEndpoint(String),
35 #[error("failed to connect to prover {0}")]
36 ConnectionFailed(#[source] Box<dyn CoreError + Send + Sync + 'static>),
38 #[error("{error_msg}")]
40 Other {
41 error_msg: Box<str>,
42 source: Option<Box<dyn CoreError + Send + Sync + 'static>>,
44 },
45}
46
47impl From<RemoteProverClientError> for String {
48 fn from(err: RemoteProverClientError) -> Self {
49 err.to_string()
50 }
51}
52
53impl RemoteProverClientError {
54 pub fn other(message: impl Into<String>) -> Self {
57 let message: String = message.into();
58 Self::Other { error_msg: message.into(), source: None }
59 }
60
61 pub fn other_with_source(
64 message: impl Into<String>,
65 source: impl CoreError + Send + Sync + 'static,
66 ) -> Self {
67 let message: String = message.into();
68 Self::Other {
69 error_msg: message.into(),
70 source: Some(Box::new(source)),
71 }
72 }
73}