-
Notifications
You must be signed in to change notification settings - Fork 151
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: rlp encoding for logs with generic event data #553
Conversation
@Rjected ptal |
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.
mostly nits, otherwise lgtm
impl<T> alloy_rlp::Encodable for Log<T> | ||
where | ||
for<'a> &'a T: Into<LogData>, | ||
{ |
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.
ah I see, can just be converted to Log<LogData> when serializing
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.
right. and because we are usually using sol!
there is no problem
This is significantly less ergonomic with DynSolEvent
tho, as a decoded sol event can't be assumed to be validly encoded the way a decoded sol!
struct with SolEvent
can be. That
assumption allows the infallible reserialize
cc @DaniPopes do you think that we should clone + attach the DynSolEvent
as a prop on the DecodedEvent
in alloy-dyn-abi so that we can assume valid construction and encoding? This would let us impl From<&DecodedEvent> for LogData
cc @DaniPopes what's up with the tests? |
You can update them by running with env |
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 looks good to me
this also needs to be rebased |
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.
needs clippy
clippy issue seems to have been introduced by merge of main. why? Please do not merge until we know why this is the case |
the new nightly clippy doesnt like things that are never constructed, including in tests |
hmm unsure, was this struct ever used? doing
yields nothing except changelog and the struct def itself weird that it wouldn't be caught before this? edit: not weird given dan comment |
why are we using nightly clippy? didnt we decide that was a mistake with ethers as it introduced unstable lints and situations like this where CI breaks for no reason? |
2ff92d4
to
ee44732
Compare
CI is unrelated. |
This breaks RLP encoding for |
closes #544
Motivation
Allow rlp encoding of logs after their data has been ABI decoded.
Solution
Add a set of methods and a blanket Encode implementation for
Log<T> where for<'a> &'a T: Into<LogData>,
Note that this change does not allow decoding, as that would require embedding the ABI error into the RLP error decode impl
PR Checklist