diff --git a/Cargo.lock b/Cargo.lock index f885df7e8..3f384ac11 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2189,7 +2189,6 @@ dependencies = [ "alloy-primitives", "alloy-rlp", "alloy-rpc-types-engine", - "anyhow", "async-trait", "cfg-if", "derive_more", diff --git a/bin/client/Cargo.toml b/bin/client/Cargo.toml index ea8990276..cb0ed1911 100644 --- a/bin/client/Cargo.toml +++ b/bin/client/Cargo.toml @@ -38,7 +38,6 @@ lru.workspace = true spin.workspace = true serde.workspace = true cfg-if.workspace = true -anyhow.workspace = true tracing.workspace = true serde_json.workspace = true async-trait.workspace = true diff --git a/bin/client/src/boot.rs b/bin/client/src/boot.rs index 56e800e28..f46a30f78 100644 --- a/bin/client/src/boot.rs +++ b/bin/client/src/boot.rs @@ -1,8 +1,8 @@ //! This module contains the prologue phase of the client program, pulling in the boot information //! through the `PreimageOracle` ABI as local keys. +use crate::errors::OracleProviderError; use alloy_primitives::{B256, U256}; -use anyhow::{anyhow, Result}; use kona_preimage::{PreimageKey, PreimageOracleClient}; use op_alloy_genesis::RollupConfig; use serde::{Deserialize, Serialize}; @@ -62,34 +62,45 @@ impl BootInfo { /// ## Returns /// - `Ok(BootInfo)`: The boot information. /// - `Err(_)`: Failed to load the boot information. - pub async fn load(oracle: &O) -> Result + pub async fn load(oracle: &O) -> Result where O: PreimageOracleClient + Send, { let mut l1_head: B256 = B256::ZERO; - oracle.get_exact(PreimageKey::new_local(L1_HEAD_KEY.to()), l1_head.as_mut()).await?; + oracle + .get_exact(PreimageKey::new_local(L1_HEAD_KEY.to()), l1_head.as_mut()) + .await + .map_err(OracleProviderError::Preimage)?; let mut l2_output_root: B256 = B256::ZERO; oracle .get_exact(PreimageKey::new_local(L2_OUTPUT_ROOT_KEY.to()), l2_output_root.as_mut()) - .await?; + .await + .map_err(OracleProviderError::Preimage)?; let mut l2_claim: B256 = B256::ZERO; - oracle.get_exact(PreimageKey::new_local(L2_CLAIM_KEY.to()), l2_claim.as_mut()).await?; + oracle + .get_exact(PreimageKey::new_local(L2_CLAIM_KEY.to()), l2_claim.as_mut()) + .await + .map_err(OracleProviderError::Preimage)?; let l2_claim_block = u64::from_be_bytes( oracle .get(PreimageKey::new_local(L2_CLAIM_BLOCK_NUMBER_KEY.to())) - .await? + .await + .map_err(OracleProviderError::Preimage)? + .as_slice() .try_into() - .map_err(|_| anyhow!("Failed to convert L2 claim block number to u64"))?, + .map_err(OracleProviderError::SliceConversion)?, ); let chain_id = u64::from_be_bytes( oracle .get(PreimageKey::new_local(L2_CHAIN_ID_KEY.to())) - .await? + .await + .map_err(OracleProviderError::Preimage)? + .as_slice() .try_into() - .map_err(|_| anyhow!("Failed to convert L2 chain ID to u64"))?, + .map_err(OracleProviderError::SliceConversion)?, ); // Attempt to load the rollup config from the chain ID. If there is no config for the chain, @@ -102,9 +113,11 @@ impl BootInfo { "No rollup config found for chain ID {}, falling back to preimage oracle. This is insecure in production without additional validation!", chain_id ); - let ser_cfg = oracle.get(PreimageKey::new_local(L2_ROLLUP_CONFIG_KEY.to())).await?; - serde_json::from_slice(&ser_cfg) - .map_err(|e| anyhow!("Failed to deserialize rollup config: {}", e))? + let ser_cfg = oracle + .get(PreimageKey::new_local(L2_ROLLUP_CONFIG_KEY.to())) + .await + .map_err(OracleProviderError::Preimage)?; + serde_json::from_slice(&ser_cfg).map_err(OracleProviderError::Serde)? }; Ok(Self { diff --git a/bin/client/src/errors.rs b/bin/client/src/errors.rs index 834fcf5a8..337b170d9 100644 --- a/bin/client/src/errors.rs +++ b/bin/client/src/errors.rs @@ -1,8 +1,9 @@ //! Error types for the client program. -use alloc::string::ToString; +use alloc::string::{String, ToString}; use derive_more::derive::Display; use kona_derive::errors::{PipelineError, PipelineErrorKind}; +use kona_executor::ExecutorError; use kona_mpt::OrderedListWalkerError; use kona_preimage::errors::PreimageOracleError; use op_alloy_protocol::{FromBlockError, OpBlockConversionError}; @@ -31,6 +32,9 @@ pub enum OracleProviderError { /// Slice conversion error. #[display("Slice conversion error: {_0}")] SliceConversion(core::array::TryFromSliceError), + /// Serde error. + #[display("Serde error: {_0}")] + Serde(serde_json::Error), } impl core::error::Error for OracleProviderError {} @@ -43,3 +47,65 @@ impl From for PipelineErrorKind { } } } + +/// Driver error. +#[derive(Display, Debug)] +pub enum DriverError { + /// Pipeline error. + #[display("Pipeline error: {_0}")] + Pipeline(PipelineErrorKind), + /// Execution error. + #[display("Execution error: {_0}")] + Execution(ExecutorError), + /// Error from the oracle provider. + #[display("Oracle provider error: {_0}")] + Oracle(OracleProviderError), + /// Error parsing a hint. + #[display("Hint parsing error: {_0}")] + HintParsing(HintParsingError), + /// Error decoding or encoding RLP. + #[display("RLP error: {_0}")] + Rlp(alloy_rlp::Error), +} + +impl core::error::Error for DriverError {} + +impl From for DriverError { + fn from(val: OracleProviderError) -> Self { + DriverError::Oracle(val) + } +} + +impl From for DriverError { + fn from(val: PipelineErrorKind) -> Self { + DriverError::Pipeline(val) + } +} + +impl From for DriverError { + fn from(val: ExecutorError) -> Self { + DriverError::Execution(val) + } +} + +impl From for DriverError { + fn from(val: HintParsingError) -> Self { + DriverError::HintParsing(val) + } +} + +impl From for DriverError { + fn from(val: alloy_rlp::Error) -> Self { + DriverError::Rlp(val) + } +} + +/// A [Result] type for the [DriverError]. +pub type DriverResult = Result; + +/// Error parsing a hint. +#[derive(Display, Debug)] +#[display("Hint parsing error: {_0}")] +pub struct HintParsingError(pub String); + +impl core::error::Error for HintParsingError {} diff --git a/bin/client/src/fault/handler/bn128_pair.rs b/bin/client/src/fault/handler/bn128_pair.rs index 2d559c8ca..0be0f2264 100644 --- a/bin/client/src/fault/handler/bn128_pair.rs +++ b/bin/client/src/fault/handler/bn128_pair.rs @@ -3,9 +3,11 @@ use crate::fault::{HINT_WRITER, ORACLE_READER}; use alloc::{string::ToString, vec::Vec}; use alloy_primitives::{keccak256, Address, Bytes}; -use anyhow::ensure; -use kona_client::HintType; -use kona_preimage::{HintWriterClient, PreimageKey, PreimageKeyType, PreimageOracleClient}; +use kona_client::{errors::OracleProviderError, HintType}; +use kona_preimage::{ + errors::PreimageOracleError, HintWriterClient, PreimageKey, PreimageKeyType, + PreimageOracleClient, +}; use revm::{ precompile::{ bn128::pair::{ISTANBUL_PAIR_BASE, ISTANBUL_PAIR_PER_POINT}, @@ -39,21 +41,34 @@ fn fpvm_ecpairing(input: &Bytes, gas_limit: u64) -> PrecompileResult { let result_data = kona_common::block_on(async move { // Write the hint for the ecrecover precompile run. let hint_data = &[ECPAIRING_ADDRESS.as_ref(), input.as_ref()]; - HINT_WRITER.write(&HintType::L1Precompile.encode_with(hint_data)).await?; + HINT_WRITER + .write(&HintType::L1Precompile.encode_with(hint_data)) + .await + .map_err(OracleProviderError::Preimage)?; // Construct the key hash for the ecrecover precompile run. let raw_key_data = hint_data.iter().copied().flatten().copied().collect::>(); let key_hash = keccak256(&raw_key_data); // Fetch the result of the ecrecover precompile run from the host. - let result_data = - ORACLE_READER.get(PreimageKey::new(*key_hash, PreimageKeyType::Precompile)).await?; + let result_data = ORACLE_READER + .get(PreimageKey::new(*key_hash, PreimageKeyType::Precompile)) + .await + .map_err(OracleProviderError::Preimage)?; // Ensure we've received valid result data. - ensure!(!result_data.is_empty(), "Invalid result data"); + if result_data.is_empty() { + return Err(OracleProviderError::Preimage(PreimageOracleError::Other( + "Invalid result data".to_string(), + ))); + } // Ensure we've not received an error from the host. - ensure!(result_data[0] != 0, "Error executing ecrecover precompile in host"); + if result_data[0] == 0 { + return Err(OracleProviderError::Preimage(PreimageOracleError::Other( + "Error executing ecrecover precompile in host".to_string(), + ))); + } // Return the result data. Ok(result_data[1..].to_vec()) diff --git a/bin/client/src/fault/handler/ecrecover.rs b/bin/client/src/fault/handler/ecrecover.rs index 3c8c78a20..9ac11d9e7 100644 --- a/bin/client/src/fault/handler/ecrecover.rs +++ b/bin/client/src/fault/handler/ecrecover.rs @@ -3,9 +3,11 @@ use crate::fault::{HINT_WRITER, ORACLE_READER}; use alloc::{string::ToString, vec::Vec}; use alloy_primitives::{keccak256, Address, Bytes}; -use anyhow::ensure; -use kona_client::HintType; -use kona_preimage::{HintWriterClient, PreimageKey, PreimageKeyType, PreimageOracleClient}; +use kona_client::{errors::OracleProviderError, HintType}; +use kona_preimage::{ + errors::PreimageOracleError, HintWriterClient, PreimageKey, PreimageKeyType, + PreimageOracleClient, +}; use revm::{ precompile::{u64_to_address, Error as PrecompileError, PrecompileWithAddress}, primitives::{Precompile, PrecompileOutput, PrecompileResult}, @@ -27,21 +29,34 @@ fn fpvm_ecrecover(input: &Bytes, gas_limit: u64) -> PrecompileResult { let result_data = kona_common::block_on(async move { // Write the hint for the ecrecover precompile run. let hint_data = &[ECRECOVER_ADDRESS.as_ref(), input.as_ref()]; - HINT_WRITER.write(&HintType::L1Precompile.encode_with(hint_data)).await?; + HINT_WRITER + .write(&HintType::L1Precompile.encode_with(hint_data)) + .await + .map_err(OracleProviderError::Preimage)?; // Construct the key hash for the ecrecover precompile run. let raw_key_data = hint_data.iter().copied().flatten().copied().collect::>(); let key_hash = keccak256(&raw_key_data); // Fetch the result of the ecrecover precompile run from the host. - let result_data = - ORACLE_READER.get(PreimageKey::new(*key_hash, PreimageKeyType::Precompile)).await?; + let result_data = ORACLE_READER + .get(PreimageKey::new(*key_hash, PreimageKeyType::Precompile)) + .await + .map_err(OracleProviderError::Preimage)?; // Ensure we've received valid result data. - ensure!(!result_data.is_empty(), "Invalid result data"); + if result_data.is_empty() { + return Err(OracleProviderError::Preimage(PreimageOracleError::Other( + "Invalid result data".to_string(), + ))); + } // Ensure we've not received an error from the host. - ensure!(result_data[0] != 0, "Error executing ecrecover precompile in host"); + if result_data[0] == 0 { + return Err(OracleProviderError::Preimage(PreimageOracleError::Other( + "Error executing ecrecover precompile in host".to_string(), + ))); + } // Return the result data. Ok(result_data[1..].to_vec()) diff --git a/bin/client/src/fault/handler/kzg_point_eval.rs b/bin/client/src/fault/handler/kzg_point_eval.rs index 91eff01d5..9f9c3d4f4 100644 --- a/bin/client/src/fault/handler/kzg_point_eval.rs +++ b/bin/client/src/fault/handler/kzg_point_eval.rs @@ -3,9 +3,11 @@ use crate::fault::{HINT_WRITER, ORACLE_READER}; use alloc::{string::ToString, vec::Vec}; use alloy_primitives::{keccak256, Address, Bytes}; -use anyhow::ensure; -use kona_client::HintType; -use kona_preimage::{HintWriterClient, PreimageKey, PreimageKeyType, PreimageOracleClient}; +use kona_client::{errors::OracleProviderError, HintType}; +use kona_preimage::{ + errors::PreimageOracleError, HintWriterClient, PreimageKey, PreimageKeyType, + PreimageOracleClient, +}; use revm::{ precompile::{u64_to_address, Error as PrecompileError, PrecompileWithAddress}, primitives::{Precompile, PrecompileOutput, PrecompileResult}, @@ -31,21 +33,34 @@ fn fpvm_kzg_point_eval(input: &Bytes, gas_limit: u64) -> PrecompileResult { let result_data = kona_common::block_on(async move { // Write the hint for the ecrecover precompile run. let hint_data = &[POINT_EVAL_ADDRESS.as_ref(), input.as_ref()]; - HINT_WRITER.write(&HintType::L1Precompile.encode_with(hint_data)).await?; + HINT_WRITER + .write(&HintType::L1Precompile.encode_with(hint_data)) + .await + .map_err(OracleProviderError::Preimage)?; // Construct the key hash for the ecrecover precompile run. let raw_key_data = hint_data.iter().copied().flatten().copied().collect::>(); let key_hash = keccak256(&raw_key_data); // Fetch the result of the ecrecover precompile run from the host. - let result_data = - ORACLE_READER.get(PreimageKey::new(*key_hash, PreimageKeyType::Precompile)).await?; + let result_data = ORACLE_READER + .get(PreimageKey::new(*key_hash, PreimageKeyType::Precompile)) + .await + .map_err(OracleProviderError::Preimage)?; // Ensure we've received valid result data. - ensure!(!result_data.is_empty(), "Invalid result data"); + if result_data.is_empty() { + return Err(OracleProviderError::Preimage(PreimageOracleError::Other( + "Invalid result data".to_string(), + ))); + } // Ensure we've not received an error from the host. - ensure!(result_data[0] != 0, "Error executing ecrecover precompile in host"); + if result_data[0] == 0 { + return Err(OracleProviderError::Preimage(PreimageOracleError::Other( + "Error executing ecrecover precompile in host".to_string(), + ))); + } // Return the result data. Ok(result_data[1..].to_vec()) diff --git a/bin/client/src/hint.rs b/bin/client/src/hint.rs index 4baa6e0fc..b35c7831b 100644 --- a/bin/client/src/hint.rs +++ b/bin/client/src/hint.rs @@ -1,9 +1,14 @@ //! This module contains the [HintType] enum. -use alloc::{string::String, vec::Vec}; +use alloc::{ + string::{String, ToString}, + vec::Vec, +}; use alloy_primitives::hex; use core::fmt::Display; +use crate::errors::HintParsingError; + /// The [HintType] enum is used to specify the type of hint that was received. #[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord)] pub enum HintType { @@ -43,7 +48,7 @@ impl HintType { } impl TryFrom<&str> for HintType { - type Error = anyhow::Error; + type Error = HintParsingError; fn try_from(value: &str) -> Result { match value { @@ -59,7 +64,7 @@ impl TryFrom<&str> for HintType { "l2-state-node" => Ok(HintType::L2StateNode), "l2-account-proof" => Ok(HintType::L2AccountProof), "l2-account-storage-proof" => Ok(HintType::L2AccountStorageProof), - _ => anyhow::bail!("Invalid hint type: {value}"), + _ => Err(HintParsingError(value.to_string())), } } } diff --git a/bin/client/src/kona.rs b/bin/client/src/kona.rs index cc14ce88b..597094827 100644 --- a/bin/client/src/kona.rs +++ b/bin/client/src/kona.rs @@ -7,8 +7,9 @@ extern crate alloc; -use alloc::sync::Arc; +use alloc::{string::String, sync::Arc}; use kona_client::{ + errors::DriverError, l1::{DerivationDriver, OracleBlobProvider, OracleL1ChainProvider}, l2::OracleL2ChainProvider, BootInfo, CachingOracle, @@ -24,14 +25,14 @@ use tracing::{error, info, warn}; const ORACLE_LRU_SIZE: usize = 1024; #[client_entry(100_000_000)] -fn main() -> Result<()> { +fn main() -> Result<(), String> { #[cfg(feature = "tracing-subscriber")] { - use anyhow::anyhow; use tracing::Level; let subscriber = tracing_subscriber::fmt().with_max_level(Level::DEBUG).finish(); - tracing::subscriber::set_global_default(subscriber).map_err(|e| anyhow!(e))?; + tracing::subscriber::set_global_default(subscriber) + .expect("setting default subscriber failed"); } kona_common::block_on(async move { @@ -107,6 +108,6 @@ fn main() -> Result<()> { output_root )); - Ok::<_, anyhow::Error>(()) + Ok::<_, DriverError>(()) }) } diff --git a/bin/client/src/l1/blob_provider.rs b/bin/client/src/l1/blob_provider.rs index 920d962c7..31698d1bb 100644 --- a/bin/client/src/l1/blob_provider.rs +++ b/bin/client/src/l1/blob_provider.rs @@ -1,11 +1,10 @@ //! Contains the concrete implementation of the [BlobProvider] trait for the client program. -use crate::HintType; +use crate::{errors::OracleProviderError, HintType}; use alloc::{boxed::Box, sync::Arc, vec::Vec}; use alloy_consensus::Blob; use alloy_eips::eip4844::FIELD_ELEMENTS_PER_BLOB; use alloy_primitives::keccak256; -use anyhow::Result; use async_trait::async_trait; use kona_derive::{sources::IndexedBlobHash, traits::BlobProvider}; use kona_preimage::{CommsClient, PreimageKey, PreimageKeyType}; @@ -32,20 +31,28 @@ impl OracleBlobProvider { /// ## Returns /// - `Ok(blob)`: The blob. /// - `Err(e)`: The blob could not be retrieved. - async fn get_blob(&self, block_ref: &BlockInfo, blob_hash: &IndexedBlobHash) -> Result { + async fn get_blob( + &self, + block_ref: &BlockInfo, + blob_hash: &IndexedBlobHash, + ) -> Result { let mut blob_req_meta = [0u8; 48]; blob_req_meta[0..32].copy_from_slice(blob_hash.hash.as_ref()); blob_req_meta[32..40].copy_from_slice((blob_hash.index).to_be_bytes().as_ref()); blob_req_meta[40..48].copy_from_slice(block_ref.timestamp.to_be_bytes().as_ref()); // Send a hint for the blob commitment and field elements. - self.oracle.write(&HintType::L1Blob.encode_with(&[blob_req_meta.as_ref()])).await?; + self.oracle + .write(&HintType::L1Blob.encode_with(&[blob_req_meta.as_ref()])) + .await + .map_err(OracleProviderError::Preimage)?; // Fetch the blob commitment. let mut commitment = [0u8; 48]; self.oracle .get_exact(PreimageKey::new(*blob_hash.hash, PreimageKeyType::Sha256), &mut commitment) - .await?; + .await + .map_err(OracleProviderError::Preimage)?; // Reconstruct the blob from the 4096 field elements. let mut blob = Blob::default(); @@ -60,7 +67,8 @@ impl OracleBlobProvider { PreimageKey::new(*keccak256(field_element_key), PreimageKeyType::Blob), &mut field_element, ) - .await?; + .await + .map_err(OracleProviderError::Preimage)?; blob[(i as usize) << 5..(i as usize + 1) << 5].copy_from_slice(field_element.as_ref()); } @@ -72,7 +80,7 @@ impl OracleBlobProvider { #[async_trait] impl BlobProvider for OracleBlobProvider { - type Error = anyhow::Error; + type Error = OracleProviderError; async fn get_blobs( &mut self, diff --git a/bin/client/src/l1/chain_provider.rs b/bin/client/src/l1/chain_provider.rs index 85104ae9b..dcec24b6d 100644 --- a/bin/client/src/l1/chain_provider.rs +++ b/bin/client/src/l1/chain_provider.rs @@ -6,7 +6,6 @@ use alloy_consensus::{Header, Receipt, ReceiptEnvelope, TxEnvelope}; use alloy_eips::eip2718::Decodable2718; use alloy_primitives::{Bytes, B256}; use alloy_rlp::Decodable; -use anyhow::Result; use async_trait::async_trait; use kona_derive::traits::ChainProvider; use kona_mpt::{OrderedListWalker, TrieProvider}; diff --git a/bin/client/src/l1/driver.rs b/bin/client/src/l1/driver.rs index e5a05343d..75a67d78e 100644 --- a/bin/client/src/l1/driver.rs +++ b/bin/client/src/l1/driver.rs @@ -4,12 +4,15 @@ //! [OpPayloadAttributes]: op_alloy_rpc_types_engine::OpPayloadAttributes use super::OracleL1ChainProvider; -use crate::{l2::OracleL2ChainProvider, BootInfo, FlushableCache, HintType}; +use crate::{ + errors::{DriverError, DriverResult, OracleProviderError}, + l2::OracleL2ChainProvider, + BootInfo, FlushableCache, HintType, +}; use alloc::{string::ToString, sync::Arc, vec::Vec}; use alloy_consensus::{BlockBody, Header, Sealable, Sealed}; use alloy_primitives::B256; use alloy_rlp::Decodable; -use anyhow::{anyhow, Result}; use core::fmt::Debug; use kona_derive::{ attributes::StatefulAttributesBuilder, @@ -128,7 +131,7 @@ where blob_provider: B, mut chain_provider: OracleL1ChainProvider, mut l2_chain_provider: OracleL2ChainProvider, - ) -> Result { + ) -> DriverResult { let cfg = Arc::new(boot_info.rollup_config.clone()); // Fetch the startup information. @@ -195,7 +198,7 @@ where provider: &P, hinter: &H, handle_register: KonaHandleRegister, - ) -> Result<(u64, B256)> + ) -> DriverResult<(u64, B256)> where P: TrieProvider + Send + Sync + Clone, H: TrieHinter + Send + Sync + Clone, @@ -273,11 +276,8 @@ where .transactions .unwrap_or_default() .into_iter() - .map(|tx| { - OpTxEnvelope::decode(&mut tx.as_ref()) - .map_err(|e| anyhow!("Failed to decode transaction: {}", e)) - }) - .collect::>>()?, + .map(|tx| OpTxEnvelope::decode(&mut tx.as_ref()).map_err(DriverError::Rlp)) + .collect::>>()?, ommers: Vec::new(), withdrawals: None, }, @@ -285,7 +285,8 @@ where // Update the safe head. self.l2_safe_head = - L2BlockInfo::from_block_and_genesis(&block, &self.pipeline.rollup_config.genesis)?; + L2BlockInfo::from_block_and_genesis(&block, &self.pipeline.rollup_config.genesis) + .map_err(OracleProviderError::BlockInfo)?; self.l2_safe_head_header = header.clone().seal_slow(); self.l2_safe_head_output_root = executor.compute_output_root()?; } @@ -387,24 +388,26 @@ where boot_info: &BootInfo, chain_provider: &mut OracleL1ChainProvider, l2_chain_provider: &mut OracleL2ChainProvider, - ) -> Result<(BlockInfo, L2BlockInfo, Sealed
)> { + ) -> DriverResult<(BlockInfo, L2BlockInfo, Sealed
)> { // Find the initial safe head, based off of the starting L2 block number in the boot info. caching_oracle .write( &HintType::StartingL2Output .encode_with(&[boot_info.agreed_l2_output_root.as_ref()]), ) - .await?; + .await + .map_err(OracleProviderError::Preimage)?; let mut output_preimage = [0u8; 128]; caching_oracle .get_exact( PreimageKey::new(*boot_info.agreed_l2_output_root, PreimageKeyType::Keccak256), &mut output_preimage, ) - .await?; + .await + .map_err(OracleProviderError::Preimage)?; let safe_hash = - output_preimage[96..128].try_into().map_err(|_| anyhow!("Invalid L2 output root"))?; + output_preimage[96..128].try_into().map_err(OracleProviderError::SliceConversion)?; let safe_header = l2_chain_provider.header_by_hash(safe_hash)?; let safe_head_info = l2_chain_provider.l2_block_info_by_number(safe_header.number).await?; diff --git a/crates/common-proc/src/lib.rs b/crates/common-proc/src/lib.rs index 3df2b6561..f3bff9c27 100644 --- a/crates/common-proc/src/lib.rs +++ b/crates/common-proc/src/lib.rs @@ -30,9 +30,7 @@ pub fn client_entry(attr: TokenStream, input: TokenStream) -> TokenStream { let fn_name = &input_fn.sig.ident; let expanded = quote! { - use anyhow::Result as AnyhowResult; - - fn #fn_name() -> AnyhowResult<()> { + fn #fn_name() -> Result<(), String> { match #fn_body { Ok(_) => kona_common::io::exit(0), Err(e) => { diff --git a/crates/derive/src/traits/data_sources.rs b/crates/derive/src/traits/data_sources.rs index 6f29f6e74..d0c9b6356 100644 --- a/crates/derive/src/traits/data_sources.rs +++ b/crates/derive/src/traits/data_sources.rs @@ -2,7 +2,7 @@ //! pipeline's stages. use crate::{errors::PipelineResult, sources::IndexedBlobHash}; -use alloc::{boxed::Box, fmt::Debug, vec::Vec}; +use alloc::{boxed::Box, fmt::Debug, string::ToString, vec::Vec}; use alloy_eips::eip4844::Blob; use alloy_primitives::Bytes; use async_trait::async_trait; @@ -13,7 +13,7 @@ use op_alloy_protocol::BlockInfo; #[async_trait] pub trait BlobProvider { /// The error type for the [BlobProvider]. - type Error: Display; + type Error: Display + ToString; /// Fetches blobs for a given block ref and the blob hashes. async fn get_blobs(