-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
feat: transaction trait #11877
feat: transaction trait #11877
Conversation
Hey @emhane ! Could you have a look at this one please? |
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.
good job so far
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.
with these things I recommend starting smol, we can always add more functionality later
/// Helper trait that unifies all behaviour required by transaction to support full node operations. | ||
pub trait FullTransaction: Transaction + Compact {} | ||
|
||
impl<T> FullTransaction for T where T: Transaction + Compact {} |
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.
revert this, we don't want to require Compact
be a super trait for Transaction
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.
almost there
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.
another idea for arbitrary feature, is to do smthg like this in order to use it as super trait independently of FullTransaction
, as you initially thought, but without requiring impl of another trait TransactionInner
on transaction types alloy-rs/core#766 (comment)
so for this case it would be
#[cfg(not(feature = "arbitrary"))]
trait MaybeArbitrary {}
#[cfg(feature = "arbitrary")]
trait MaybeArbitrary: for<'a> arbitrary::Arbitrary<'a> {}
pub trait Transaction: .. + MaybeArbitrary {
..
}
but we can merge this pr as is and make that change in a follow up pr
That makes sense! |
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, pending @emhane suggestions
/// Helper trait that unifies all behaviour required by transaction to support full node operations. | ||
pub trait FullTransaction: Transaction + Compact {} | ||
|
||
#[cfg(feature = "arbitrary")] |
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.
#[cfg(feature = "arbitrary")] |
Transaction trait has been partially implemented but it's missing a few trait bounds as well as the behavior of
reth_primitives::Transaction
Closes #11533