Skip to content

Commit 67b2197

Browse files
gianbelinchejuan518munoz
authored andcommitted
cherry pick d9ffa55
1 parent 471209a commit 67b2197

File tree

5 files changed

+44
-16
lines changed

5 files changed

+44
-16
lines changed

crates/rust-eigenda-client/src/errors.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ pub enum EigenClientError {
1414
#[error(transparent)]
1515
Communication(#[from] CommunicationError),
1616
#[error(transparent)]
17-
BlobStatus(#[from] BlobStatusError),
17+
BlobStatus(#[from] Box<BlobStatusError>),
1818
#[error(transparent)]
1919
Conversion(#[from] ConversionError),
2020
#[error(transparent)]
@@ -71,6 +71,12 @@ pub enum BlobStatusError {
7171
Status(#[from] Status),
7272
}
7373

74+
impl From<BlobStatusError> for EigenClientError {
75+
fn from(err: BlobStatusError) -> Self {
76+
EigenClientError::BlobStatus(Box::new(err))
77+
}
78+
}
79+
7480
/// Errors specific to conversion
7581
#[derive(Debug, thiserror::Error)]
7682
pub enum ConversionError {

crates/rust-eigenda-signers/src/signers/ethers.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,6 @@ where
131131
}
132132

133133
/// Sets the signer's chain id
134-
#[must_use]
135134
fn with_chain_id<C: Into<u64>>(mut self, chain_id: C) -> Self {
136135
self.chain_id = chain_id.into();
137136
self

crates/rust-eigenda-v2-client/src/disperser_client.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ impl<S> DisperserClient<S> {
183183
.disperse_blob(disperse_request)
184184
.await
185185
.map(|response| response.into_inner())
186-
.map_err(DisperseError::FailedRPC)?;
186+
.map_err(|e| DisperseError::FailedRPC(Box::new(e)))?;
187187

188188
if BlobKey::compute_blob_key(&blob_header)?.to_bytes().to_vec() != reply.blob_key {
189189
return Err(DisperseError::BlobKeyMismatch);
@@ -221,7 +221,7 @@ impl<S> DisperserClient<S> {
221221
.get_blob_status(request)
222222
.await
223223
.map(|response| response.into_inner())
224-
.map_err(DisperseError::FailedRPC)
224+
.map_err(|e| DisperseError::FailedRPC(Box::new(e)))
225225
}
226226

227227
/// Returns the payment state of the disperser client
@@ -253,7 +253,7 @@ impl<S> DisperserClient<S> {
253253
.get_payment_state(request)
254254
.await
255255
.map(|response: tonic::Response<GetPaymentStateReply>| response.into_inner())
256-
.map_err(DisperseError::FailedRPC)
256+
.map_err(|e| DisperseError::FailedRPC(Box::new(e)))
257257
}
258258

259259
pub async fn blob_commitment(&self, data: &[u8]) -> Result<BlobCommitmentReply, DisperseError> {
@@ -267,7 +267,7 @@ impl<S> DisperserClient<S> {
267267
.get_blob_commitment(request)
268268
.await
269269
.map(|response| response.into_inner())
270-
.map_err(DisperseError::FailedRPC)
270+
.map_err(|e| DisperseError::FailedRPC(Box::new(e)))
271271
}
272272
}
273273

crates/rust-eigenda-v2-client/src/errors.rs

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ pub enum EigenClientError {
1414
#[error(transparent)]
1515
Blob(#[from] BlobError),
1616
#[error(transparent)]
17-
PayloadDisperser(#[from] PayloadDisperserError),
17+
PayloadDisperser(#[from] Box<PayloadDisperserError>),
1818
}
1919

2020
/// Errors specific to conversion
@@ -58,7 +58,7 @@ pub enum ConversionError {
5858
#[derive(Debug, thiserror::Error)]
5959
pub enum RelayPayloadRetrieverError {
6060
#[error(transparent)]
61-
RelayClient(#[from] RelayClientError),
61+
RelayClient(#[from] Box<RelayClientError>),
6262
#[error(transparent)]
6363
Blob(#[from] BlobError),
6464
#[error(transparent)]
@@ -120,6 +120,12 @@ pub enum RelayClientError {
120120
RelayKeyToUrl(u32),
121121
}
122122

123+
impl From<RelayClientError> for RelayPayloadRetrieverError {
124+
fn from(err: RelayClientError) -> Self {
125+
RelayPayloadRetrieverError::RelayClient(Box::new(err))
126+
}
127+
}
128+
123129
/// Errors for the EthClient
124130
#[derive(Debug, thiserror::Error)]
125131
pub enum EthClientError {
@@ -166,7 +172,7 @@ pub enum DisperseError {
166172
#[error("Invalid Account id")]
167173
AccountID,
168174
#[error("Failed RPC call: {0}")]
169-
FailedRPC(#[from] tonic::Status),
175+
FailedRPC(#[from] Box<tonic::Status>),
170176
#[error("Calculated and disperser blob key mismatch")]
171177
BlobKeyMismatch,
172178
#[error(transparent)]
@@ -177,6 +183,12 @@ pub enum DisperseError {
177183
Signer(#[from] Box<dyn std::error::Error + Send + Sync>),
178184
}
179185

186+
impl From<tonic::Status> for DisperseError {
187+
fn from(err: tonic::Status) -> Self {
188+
DisperseError::FailedRPC(Box::new(err))
189+
}
190+
}
191+
180192
/// Errors specific to the [`PayloadDisperser`].
181193
#[derive(Debug, thiserror::Error)]
182194
pub enum PayloadDisperserError {
@@ -192,6 +204,12 @@ pub enum PayloadDisperserError {
192204
CertVerifier(#[from] CertVerifierError),
193205
}
194206

207+
impl From<PayloadDisperserError> for EigenClientError {
208+
fn from(err: PayloadDisperserError) -> Self {
209+
EigenClientError::PayloadDisperser(Box::new(err))
210+
}
211+
}
212+
195213
/// Errors specific to the CertVerifier
196214
#[derive(Debug, thiserror::Error)]
197215
pub enum CertVerifierError {

crates/rust-eigenda-v2-client/src/payload_disperser.rs

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -101,10 +101,13 @@ impl<S> PayloadDisperser<S> {
101101
.disperser_client
102102
.blob_status(blob_key)
103103
.await
104-
.map_err(|e| EigenClientError::PayloadDisperser(PayloadDisperserError::Disperser(e)))?;
104+
.map_err(|e| {
105+
EigenClientError::PayloadDisperser(Box::new(PayloadDisperserError::Disperser(e)))
106+
})?;
105107

106-
let blob_status = BlobStatus::try_from(status.status)
107-
.map_err(|e| EigenClientError::PayloadDisperser(PayloadDisperserError::Decode(e)))?;
108+
let blob_status = BlobStatus::try_from(status.status).map_err(|e| {
109+
EigenClientError::PayloadDisperser(Box::new(PayloadDisperserError::Decode(e)))
110+
})?;
108111
match blob_status {
109112
BlobStatus::Unknown | BlobStatus::Failed => Err(PayloadDisperserError::BlobStatus)?,
110113
BlobStatus::Encoded | BlobStatus::GatheringSignatures | BlobStatus::Queued => Ok(None),
@@ -114,7 +117,9 @@ impl<S> PayloadDisperser<S> {
114117
.verify_cert_v2(&eigenda_cert)
115118
.await
116119
.map_err(|e| {
117-
EigenClientError::PayloadDisperser(PayloadDisperserError::CertVerifier(e))
120+
EigenClientError::PayloadDisperser(Box::new(
121+
PayloadDisperserError::CertVerifier(e),
122+
))
118123
})?;
119124
Ok(Some(eigenda_cert))
120125
}
@@ -132,19 +137,19 @@ impl<S> PayloadDisperser<S> {
132137
let signed_batch = match status.clone().signed_batch {
133138
Some(batch) => batch,
134139
None => {
135-
return Err(EigenClientError::PayloadDisperser(
140+
return Err(EigenClientError::PayloadDisperser(Box::new(
136141
PayloadDisperserError::Conversion(ConversionError::SignedBatch(
137142
"Not Present".to_string(),
138143
)),
139-
))
144+
)))
140145
}
141146
};
142147
let non_signer_stakes_and_signature = self
143148
.cert_verifier
144149
.get_non_signer_stakes_and_signature(signed_batch)
145150
.await
146151
.map_err(|e| {
147-
EigenClientError::PayloadDisperser(PayloadDisperserError::CertVerifier(e))
152+
EigenClientError::PayloadDisperser(Box::new(PayloadDisperserError::CertVerifier(e)))
148153
})?;
149154

150155
let cert = build_cert_from_reply(status, non_signer_stakes_and_signature)?;

0 commit comments

Comments
 (0)