-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
chore(sdk): improve usability tx primitive traits #12437
Conversation
c0b9f77
to
99c9943
Compare
84c0134
to
ae6d4b8
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.
don't fully get the motivation here, doesn't this effectively just extend the transaction trait with an AT for txtype?
{ | ||
} | ||
|
||
impl<T> TxType for T where |
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.
I don't think we want a default here
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.
it's derived for reth_primitives::TxType
, so we probably wan't to remove that attribute next before integrating the generic tx type, in order to keep scope meaningful
on the other hand, if a tx type is unknown, don't we fallback to try to decode it as a legacy tx? hence it's kind of like a default? @mattsse
/// 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 {} | ||
|
||
#[allow(dead_code)] | ||
/// Abstraction of a 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.
do we still need this?
unclear why we need 3 traits now if this trait is now just a default
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.
I thought about moving the rlp encoding traits to FullTransaction
...to make primitive traits more lightweight. I'm also good with removing the Full
-traits for the data primitive traits and adding Compact
as a super trait always. wdyt? @mattsse
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.
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.
In essence, the new trait AlloyTransactionExt
can be removed with #12465 and moving is_dynamic_fee
down a level into alloy_consensus::Transaction
.
fn signature_hash(&self) -> B256 { | ||
self.transaction().signature_hash() | ||
} |
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.
imo we can add SigneableTransaction
as super trait like I did initially, since all the tx types we now import from alloy, already impl this trait @mattsse
it add blanket impl of |
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.
last nits
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
d9ba3d0
to
da6a573
Compare
Implements
Transaction
forSignedTransaction
types