-
Notifications
You must be signed in to change notification settings - Fork 256
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
Define trait TransactionEnvelope
#1910
base: main
Are you sure you want to change the base?
Conversation
da3f0ca
to
385ebcd
Compare
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.
what's the main motiviation for this?
we haven't seen a usecase where we'd need to deal with various txenvelope types, although imo this trait seems reasonable.
but this currently clashes with txenvelope's native functions which we could then remove
#[auto_impl::auto_impl(&, Arc)] | ||
pub trait TransactionEnvelope: Typed2718 { | ||
/// Returns ref to [`Signed<TxLegacy>`] if transaction is a legacy transaction. | ||
fn as_legacy(&self) -> Option<&Signed<TxLegacy>>; |
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.
this bakes in the signed type, which I think is fine because I think this will not be used by reth.
but the function name could be problematic, could we introduce as_signed_*
instead?
ah I guess this isn't necessary:
pub const fn as_eip2930(&self) -> Option<&Signed<TxEip2930>> { |
relying on this trait instead of hardcoded |
Moves part of implementation for
TxEnvelope
into new traitTransactionEnvelope
.