-
Notifications
You must be signed in to change notification settings - Fork 245
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add custom conversion error to handle additional situations (such as optimism deposit tx) #875
Conversation
Modifying rpc types to support optimism is generally not the plan for this repo. The only concession made so far is the optional signature in transaction response. I would suggest duplicating this error enum into a separate optimism-specific repo |
@prestwich Would you be willing to add a |
I'm not opposed to a |
I've searched Reth and Alloy and only references to this enum I see are:
Neither matches or destructures, just references the individual elements. Any other repos I should be checking to confirm? |
not that i know of at this point i am wondering if this is an example of non-useful type safety. Why is this error anything other than a string? we use structures cc @mattsse |
From what I've seen, I agree with this perspective. |
/// 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, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
these are OP specific ones, I don't like this because this OP specific and should not be included here
we should either add a custom(String) or Box
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
would love you feedback about the discussion in the comments
yeah this can fail for a lot for reasons, and I guess it would be more convenient to just return a message, I doubt matching these variants is very useful. but we have a lot of reasonable ones already and I'd like to keep those and instead add an |
yeah, let's move this to custom and then plan to delete the whole enum when we embed the tx envelope in the rpc response |
@prestwich Updated based on conversation above, and adjusted the PR title & description to match. |
…optimism deposit tx) (alloy-rs#875)
Motivation
paradigmxyz/reth#8763 implements conversion of Alloy transaction to Reth transaction for Optimism deposit transactions. In the conversion process, additional errors are required.
Solution
[EDIT] Originally, this PR added new errors for the three situations that were not already covered.
After additional discussion, the PR was revised to add a single
Custom(String)
error type that could be used in situations that were not already covered, rather than enumerating all possibilities.The plan is to remove the whole enum in the future. From @prestwich:
PR Checklist