From e3a4b2538bc4c064f34b543c0773f0b898e90132 Mon Sep 17 00:00:00 2001 From: Zach Obront Date: Tue, 11 Jun 2024 22:14:51 -0500 Subject: [PATCH 1/3] add new conversion errors --- crates/rpc-types-eth/src/transaction/error.rs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/crates/rpc-types-eth/src/transaction/error.rs b/crates/rpc-types-eth/src/transaction/error.rs index ae96d53367e..d32a2633a56 100644 --- a/crates/rpc-types-eth/src/transaction/error.rs +++ b/crates/rpc-types-eth/src/transaction/error.rs @@ -58,6 +58,15 @@ pub enum ConversionError { /// Missing block number #[error("missing block number")] MissingBlockNumber, + /// Missing source hash (for Optimism deposit tx) + #[error("missing source hash")] + MissingSourceHash, + /// Invalid source hash (for Optimism deposit tx) + #[error("invalid block number")] + InvalidBlockNumber, + /// Invalid mint value (for Optimism deposit tx) + #[error("invalid mint value")] + InvalidMintValue, /// Blob gas used integer conversion error #[error("blob gas used integer conversion error: {0}")] BlobGasUsedConversion(TryFromIntError), From 7991c9d66cef81e3bfff251b6bb1a70f7dc6d4e3 Mon Sep 17 00:00:00 2001 From: Zach Obront Date: Tue, 11 Jun 2024 22:17:19 -0500 Subject: [PATCH 2/3] typo --- crates/rpc-types-eth/src/transaction/error.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/rpc-types-eth/src/transaction/error.rs b/crates/rpc-types-eth/src/transaction/error.rs index d32a2633a56..5a03e8c7dea 100644 --- a/crates/rpc-types-eth/src/transaction/error.rs +++ b/crates/rpc-types-eth/src/transaction/error.rs @@ -62,8 +62,8 @@ pub enum ConversionError { #[error("missing source hash")] MissingSourceHash, /// Invalid source hash (for Optimism deposit tx) - #[error("invalid block number")] - InvalidBlockNumber, + #[error("invalid source hash")] + InvalidSourceHash, /// Invalid mint value (for Optimism deposit tx) #[error("invalid mint value")] InvalidMintValue, From 5c9f2a040486aa0af79a52f9c57b08c49230b372 Mon Sep 17 00:00:00 2001 From: Zach Obront Date: Wed, 12 Jun 2024 21:29:12 -0500 Subject: [PATCH 3/3] replace with custom error --- crates/rpc-types-eth/src/transaction/error.rs | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/crates/rpc-types-eth/src/transaction/error.rs b/crates/rpc-types-eth/src/transaction/error.rs index 5a03e8c7dea..b4f59ffbb1c 100644 --- a/crates/rpc-types-eth/src/transaction/error.rs +++ b/crates/rpc-types-eth/src/transaction/error.rs @@ -58,19 +58,13 @@ pub enum ConversionError { /// Missing block number #[error("missing block number")] MissingBlockNumber, - /// Missing source hash (for Optimism deposit tx) - #[error("missing source hash")] - MissingSourceHash, - /// Invalid source hash (for Optimism deposit tx) - #[error("invalid source hash")] - InvalidSourceHash, - /// Invalid mint value (for Optimism deposit tx) - #[error("invalid mint value")] - InvalidMintValue, /// Blob gas used integer conversion error #[error("blob gas used integer conversion error: {0}")] BlobGasUsedConversion(TryFromIntError), /// Excess blob gas integer conversion error #[error("excess blob gas integer conversion error: {0}")] ExcessBlobGasConversion(TryFromIntError), + /// A custom Conversion Error that doesn't fit other categories. + #[error("conversion error: {0}")] + Custom(String), }