-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
refactor: Make TransactionValidationOutcome
generic over error type
#14046
base: main
Are you sure you want to change the base?
refactor: Make TransactionValidationOutcome
generic over error type
#14046
Conversation
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.
yes, we want to generalise the impl body too
impl<T: PoolTransaction, E> TransactionValidationOutcome<T, E> { .. }
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.
hmm,
this error already supports arbitrary errors via
reth/crates/transaction-pool/src/error.rs
Lines 223 to 225 in d3cec5a
/// Any other error that occurred while inserting/validating that is transaction specific | |
#[error(transparent)] | |
Other(Box<dyn PoolTransactionError>), |
skeptical that it's worth integrating an error type
which I think would need to be added to
reth/crates/transaction-pool/src/pool/mod.rs
Line 132 in d3cec5a
pub struct PoolInner<V, T, S> |
rollups want to match on their error variants @mattsse . eventually all components that are customisable at sdk level should have an error associated type for good devx. |
what's a use case for this? |
do smthg based on the error variant |
can we add a helper that typechecking the dyn PollError instead, don't think a dedicated type for this is super useful |
sure rollups can work with down casting. though semantically it's nicer for the rollups to wrap l1 errors in a variant, so they can extend it. another place I'm having the same problem rn is |
I added this for now. |
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.
can we instead make this
reth/crates/transaction-pool/src/error.rs
Line 14 in 440e669
pub trait PoolTransactionError: core::error::Error + Send + Sync { |
`: Any``
and add
#[inline]
fn as_any(&self) -> &dyn std::any::Any;
to the trait?
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.
lgtm
actually @PanGan21 we probably don't need the additional Any fn if we require that this trait is 'static and add these helper functions to reth/crates/transaction-pool/src/error.rs Line 189 in 04c1d71
|
Closes: #14037
Makes
TransactionValidationOutcome
generic over error type.