rust_eigenda_client/
errors.rs1use ark_bn254::G1Affine;
2use tokio::sync::mpsc::error::SendError;
3use tonic::{transport::Error as TonicError, Status};
4
5use crate::{blob_info::BlobQuorumParam, eth_client::RpcErrorResponse, generated::disperser};
6
7#[derive(Debug, thiserror::Error)]
9pub enum EigenClientError {
10 #[error(transparent)]
11 EthClient(#[from] EthClientError),
12 #[error(transparent)]
13 Verification(#[from] VerificationError),
14 #[error(transparent)]
15 Communication(#[from] CommunicationError),
16 #[error(transparent)]
17 BlobStatus(#[from] BlobStatusError),
18 #[error(transparent)]
19 Conversion(#[from] ConversionError),
20 #[error(transparent)]
21 Config(#[from] ConfigError),
22}
23
24#[derive(Debug, thiserror::Error)]
25pub enum ConfigError {
26 #[error("Private Key Error")]
27 PrivateKey,
28 #[error("ETH RPC URL not set")]
29 NoEthRpcUrl,
30 #[error(transparent)]
31 Tonic(#[from] TonicError),
32}
33
34#[derive(Debug, thiserror::Error)]
35pub enum CommunicationError {
36 #[error("No response from server")]
37 NoResponseFromServer,
38 #[error("No payload in response")]
39 NoPayloadInResponse,
40 #[error("Failed to get blob data")]
41 FailedToGetBlob,
42 #[error("Failed to send DisperseBlobRequest: {0}")]
43 DisperseBlob(SendError<disperser::AuthenticatedRequest>),
44 #[error("Failed to send AuthenticationData: {0}")]
45 AuthenticationData(SendError<disperser::AuthenticatedRequest>),
46 #[error("Error from server: {0}")]
47 ErrorFromServer(String),
48 #[error(transparent)]
49 Signing(Box<dyn std::error::Error + Send + Sync>),
50 #[error(transparent)]
51 Hex(#[from] hex::FromHexError),
52 #[error(transparent)]
53 BlobProvider(#[from] Box<dyn std::error::Error + Send + Sync>),
54}
55
56#[derive(Debug, thiserror::Error)]
57pub enum BlobStatusError {
58 #[error("Blob still processing")]
59 BlobStillProcessing,
60 #[error("Blob dispatched failed")]
61 BlobDispatchedFailed,
62 #[error("Insufficient signatures")]
63 InsufficientSignatures,
64 #[error("No blob header in response")]
65 NoBlobHeaderInResponse,
66 #[error("Received unknown blob status")]
67 ReceivedUnknownBlobStatus,
68 #[error(transparent)]
69 Prost(#[from] prost::DecodeError),
70 #[error(transparent)]
71 Status(#[from] Status),
72}
73
74#[derive(Debug, thiserror::Error)]
76pub enum ConversionError {
77 #[error("Failed to convert {0}")]
78 NotPresent(String),
79 #[error("Failed to cast {0}")]
80 Cast(String),
81 #[error("hash digest was not 32B as expected. This is a bug, please report it")]
82 InvalidDigest,
83}
84
85#[derive(Debug, thiserror::Error)]
87pub enum EthClientError {
88 #[error(transparent)]
89 HTTPClient(#[from] reqwest::Error),
90 #[error(transparent)]
91 SerdeJSON(#[from] serde_json::Error),
92 #[error("RPC: {0}")]
93 Rpc(RpcErrorResponse),
94}
95
96#[derive(Debug, thiserror::Error)]
97pub enum KzgError {
98 #[error("Kzg setup error: {0}")]
99 Setup(String),
100 #[error(transparent)]
101 Internal(#[from] rust_kzg_bn254::errors::KzgError),
102}
103
104#[derive(Debug, thiserror::Error)]
105pub enum ServiceManagerError {
106 #[error(transparent)]
107 EthClient(#[from] EthClientError),
108 #[error("Decoding error: {0}")]
109 Decoding(String),
110}
111
112#[derive(Debug, thiserror::Error)]
114pub enum VerificationError {
115 #[error(transparent)]
116 ServiceManager(#[from] ServiceManagerError),
117 #[error(transparent)]
118 Kzg(#[from] KzgError),
119 #[error("Wrong proof")]
120 WrongProof,
121 #[error("Different commitments: expected {expected:?}, got {actual:?}")]
122 DifferentCommitments {
123 expected: Box<G1Affine>,
124 actual: Box<G1Affine>,
125 },
126 #[error("Different roots: expected {expected:?}, got {actual:?}")]
127 DifferentRoots { expected: String, actual: String },
128 #[error("Empty hashes")]
129 EmptyHash,
130 #[error("Different hashes: expected {expected:?}, got {actual:?}")]
131 DifferentHashes { expected: String, actual: String },
132 #[error("Wrong quorum params: {blob_quorum_params:?}")]
133 WrongQuorumParams { blob_quorum_params: BlobQuorumParam },
134 #[error("Quorum not confirmed")]
135 QuorumNotConfirmed,
136 #[error("Commitment not on curve: {0}")]
137 CommitmentNotOnCurve(G1Affine),
138 #[error("Commitment not on correct subgroup: {0}")]
139 CommitmentNotOnCorrectSubgroup(G1Affine),
140 #[error("Point download error: {0}")]
141 PointDownloadError(String),
142 #[error("Data Mismatch")]
143 DataMismatch,
144 #[error(transparent)]
145 Conversion(#[from] ConversionError),
146}