-
Notifications
You must be signed in to change notification settings - Fork 147
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
Derive rlp en-/decoding for Sealed<T>
#754
Conversation
1b10b57
to
fbabc85
Compare
@@ -5,6 +5,7 @@ use crate::B256; | |||
/// We do not implement any specific hashing algorithm here. Instead types | |||
/// implement the [`Sealable`] trait to provide define their own hash. | |||
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)] | |||
#[cfg_attr(feature = "rlp", derive(alloy_rlp::RlpEncodable, alloy_rlp::RlpDecodable))] |
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 this is useful because the hash is usually never included in any rlp payload if it can be computed from the sealed element
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.
valid, pls open an issue in reth then to remove it from SealedBlock
and SealedHeader
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.
actually, I can see this being useful for decodeable where T: Sealable
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 is still problematic
we should treat this impl as a delegation:
if the seal is keccask(rlp)
this would also allow us to specialize the decode impl but for this type we can't expect this to always be the case
I see, the hash isn't rlp encoded in the buffer also, it's computed. to unblock this, we need to define a trait |
hmm, after thinking about this a bit, I actually leaning towards not using the from reth pov, I wonder if something like |
imo it's good to have as an inner type nonetheless, with the "ethereum autotraits" being implemented, like rlp. rather skip rlp impl than not linking alloy and reth via this type. |
Motivation
RLP encoding of
Sealed<T>
. Ref paradigmxyz/reth#11123.Solution
Enables feature
derive
foralloy-rlp
dep, to derive en-/decoding ofSealed<T>
.PR Checklist