Skip to main content

sp1_sdk/network/
error.rs

1use thiserror::Error;
2use tonic::Status;
3
4/// An error that can occur when interacting with the prover network.
5#[derive(Error, Debug)]
6pub enum Error {
7    /// The program execution failed.
8    #[error("Program simulation failed")]
9    SimulationFailed,
10
11    /// The proof request is unexecutable.
12    #[error("Proof request 0x{} is unexecutable", hex::encode(.request_id))]
13    RequestUnexecutable {
14        /// The ID of the request that cannot be executed.
15        request_id: Vec<u8>,
16    },
17
18    /// The proof request is unfulfillable.
19    #[error("Proof request 0x{} is unfulfillable", hex::encode(.request_id))]
20    RequestUnfulfillable {
21        /// The ID of the request that cannot be fulfilled.
22        request_id: Vec<u8>,
23    },
24
25    /// The proof request timed out.
26    #[error("Proof request 0x{} timed out", hex::encode(.request_id))]
27    RequestTimedOut {
28        /// The ID of the request that timed out.
29        request_id: Vec<u8>,
30    },
31
32    /// The proof request timed out waiting for a prover to bid on it.
33    #[error("Proof request 0x{} timed out during the auction", hex::encode(.request_id))]
34    RequestAuctionTimedOut {
35        /// The ID of the request that timed out during auction.
36        request_id: Vec<u8>,
37    },
38
39    /// An error occurred while interacting with the RPC server.
40    #[error("RPC error: {0}")]
41    RpcError(#[from] Status),
42
43    /// An unknown error occurred.
44    #[error("Other error: {0}")]
45    Other(#[from] anyhow::Error),
46}